diff --git a/.gitignore b/.gitignore index de6480de2cc66..fa5ff5c4f07a6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ # IDE & System Related Files # .buildpath +.editorconfig .project .settings .DS_Store diff --git a/.travis.yml b/.travis.yml index b84dde4227f32..fbbdd311e6c35 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,6 +23,8 @@ matrix: env: RUN_PHPCS="yes" INSTALL_APCU="yes" - php: 7.0 env: INSTALL_APCU="yes" INSTALL_APCU_BC_BETA="no" INSTALL_MEMCACHE="no" INSTALL_MEMCACHED="no" INSTALL_REDIS="no" # Disabled apcu_bc install until https://github.com/travis-ci/travis-ci/issues/5207 is resolved + - php: 7.1 + env: INSTALL_APCU="yes" INSTALL_APCU_BC_BETA="no" INSTALL_MEMCACHE="no" INSTALL_MEMCACHED="no" INSTALL_REDIS="no" # Disabled apcu_bc install until https://github.com/travis-ci/travis-ci/issues/5207 is resolved - php: hhvm sudo: true dist: trusty @@ -39,6 +41,7 @@ matrix: - redis-server env: INSTALL_APCU_BC_BETA="no" INSTALL_MEMCACHE="no" INSTALL_MEMCACHED="no" # Disabled items that currently do not work in travis-ci hhvm allow_failures: + - php: 7.1 - php: hhvm services: diff --git a/README.md b/README.md index e069380e9e371..561e26ab5b99c 100644 --- a/README.md +++ b/README.md @@ -15,25 +15,26 @@ What is this? What is Joomla? --------------------- -* Joomla is a **Content Management System** (CMS) which enables you to build websites and powerful online applications. -* It is a simple and powerful web server application which requires a server with PHP and either MySQL, PostgreSQL or SQL Server to run. You can find more [details here](https://www.joomla.org/about-joomla.html). +* [Joomla](https://www.joomla.org/about-joomla.html) is a **Content Management System** (CMS) which enables you to build websites and powerful online applications. +* It is a simple and powerful web server application which requires a server with PHP and either MySQL, PostgreSQL or SQL Server to run. You can find [full technical requirements here](https://www.joomla.org/about-joomla/technical-requirements.html). * Joomla is **free and OpenSource software** distributed under the GNU General Public License version 2 or later. Is Joomla! for you? --------------------- -* Joomla is [the right solution for most content web projects](https://docs.joomla.org/Joomla_Is_it_for_me%3F). -* View Joomla's core [features here](https://www.joomla.org/core-features.html). +* Joomla is [the right solution for most content web projects](https://docs.joomla.org/Portal:Learn_More). +* View Joomla's [core features here](https://www.joomla.org/core-features.html). * Try it out for yourself in our [online demo](https://demo.joomla.org). How to find a Joomla! translation? --------------------- -* Repository of [accredited language packs](http://community.joomla.org/translations.html). -* You can also add languages directly to your website via your Joomla! administration panel. +* Repository of [accredited language packs](https://community.joomla.org/translations.html). +* You can also [add languages](https://docs.joomla.org/J3.x:Setup_a_Multilingual_Site/Installing_New_Language) directly to your website via your Joomla! administration panel. +* Learn how to [setup a Multilingual Joomla! Site](https://docs.joomla.org/J3.x:Setup_a_Multilingual_Site) Learn Joomla! --------------------- * Read ['Getting Started with Joomla!'](https://docs.joomla.org/J3.x:Getting_Started_with_Joomla!) to learn the basics. -* Before installing, read the ['Beginners' Guide'](https://docs.joomla.org/Beginners). +* Before installing, read the ['Beginners' Guide'](https://docs.joomla.org/Portal:Beginners). What are the benefits of Joomla? --------------------- @@ -45,12 +46,12 @@ Is it easy to change the layout display? --------------------- * The layout is controlled by templates that you can edit. * There are a lot of ready-made professional templates that you can download. -* Template management information is [available here](https://docs.joomla.org/Portal:Administrators#Template_Management). +* Template management information is [available here](https://docs.joomla.org/Portal:Template_Management). Ready to install Joomla? --------------------- * Check the [minimum requirements](https://www.joomla.org/about-joomla/technical-requirements.html). -* How do you [install Joomla](https://docs.joomla.org/Installing_Joomla!)? +* How do you [install Joomla](https://docs.joomla.org/J3.x:Installing_Joomla)? * You could start your Joomla! experience by [building your site on a local test server](https://docs.joomla.org/Installing_Joomla_locally). When ready, it can be moved to an on-line hosting account of your choice. @@ -67,20 +68,19 @@ Where can you get support and help? * Post questions at [our forums](http://forum.joomla.org); * [Joomla Resources Directory](http://resources.joomla.org/) (JRD). -Do you already have a Joomla site that isn't built with Joomla 3.x? +Do you already have a Joomla! site that isn't built with Joomla! 3.x? --------------------- * What's [new in Joomla! 3.x](https://www.joomla.org/3)? * What are the [main differences between 2.5 and 3.x](https://docs.joomla.org/What_are_the_major_differences_between_Joomla!_2.5_and_3.x%3F)? * How to [migrate from 2.5.x to 3.x](https://docs.joomla.org/Joomla_2.5_to_3.x_Step_by_Step_Migration). * How to [migrate from 1.5.x to 3.x](https://docs.joomla.org/Joomla_1.5_to_3.x_Step_by_Step_Migration). -* How to [convert an existing website to Joomla](https://docs.joomla.org/How_to_Convert_an_existing_Web_site_to_a_Joomla!_Web_site). Do you want to improve Joomla? -------------------- -* How do you [request a feature](https://docs.joomla.org/How_do_you_request_a_feature%3F)? -* How do you [report a bug](https://docs.joomla.org/Filing_bugs_and_issues)? +* Where to [request a feature](https://issues.joomla.org/)? +* How do you [report a bug](https://docs.joomla.org/Filing_bugs_and_issues) on the [Issue Tracker](https://issues.joomla.org/)? * Get Involved: Joomla! is community developed software. [Join the community](https://volunteers.joomla.org/). -* Documentation for [Developers](https://docs.joomla.org/Developers). +* Documentation for [Developers](https://docs.joomla.org/Portal:Developers). * Documentation for [Web designers](https://docs.joomla.org/Web_designers). Copyright diff --git a/README.txt b/README.txt index 72b246a63ce81..3b2b348276b67 100644 --- a/README.txt +++ b/README.txt @@ -6,38 +6,40 @@ 2- What is Joomla? * Joomla is a Content Management System (CMS) which enables you to build Web sites and powerful online applications. - * It's a free and OpenSource software, distributed under the GNU General Public License version 2 or later - * This is a simple and powerful web server application and it requires a server with PHP and either MySQL, PostgreSQL, or SQL Server to run it. - More details here: https://www.joomla.org/about-joomla.html + * It's a free and OpenSource software, distributed under the GNU General Public License version 2 or later. + * This is a simple and powerful web server application and it requires a server with PHP and either MySQL, PostgreSQL, or SQL Server to run. + You can find full technical requirements here: https://www.joomla.org/about-joomla/technical-requirements.html. -3- Is Joomla for you? - * Joomla is the right solution for any content web project: https://docs.joomla.org/Joomla_Is_it_for_me%3F - * See Features - https://www.joomla.org/core-features.html +3- Is Joomla! for you? + * Joomla is the right solution for most content web projects: https://docs.joomla.org/Portal:Learn_More + * See Joomla's core features - https://www.joomla.org/core-features.html * Try out our online demo: https://demo.joomla.org/ 4- How to find a Joomla! translation? * Repository of accredited language packs: http://community.joomla.org/translations.html - * You can also add languages directly to your website via your Joomla! administration panel. + * You can also add languages directly to your website via your Joomla! administration panel: https://docs.joomla.org/J3.x:Setup_a_Multilingual_Site/Installing_New_Language + * Learn how to setup a Multilingual Joomla! Site: https://docs.joomla.org/J3.x:Setup_a_Multilingual_Site 5- Learn Joomla! * Read Getting Started with Joomla to find out the basics: https://docs.joomla.org/J3.x:Getting_Started_with_Joomla! - * Before installing, read the beginners guide: https://docs.joomla.org/Beginners + * Before installing, read the beginners guide: https://docs.joomla.org/Portal:Beginners -6- What are the limits of Joomla? - * Joomla sites can be extended in functionalities with Extensions that you can create (or download) to suite your needs. - * There are lots of ready made extensions that you can download and install. - * See the Joomla! Extensions Directory (JED): http://extensions.joomla.org +6- What are the benefits of Joomla? + * The functionality of a Joomla website can be extended by installing extensions that you can create (or download) to suit your needs. + * There are many ready-made extensions that you can download and install. + * Check out the Joomla! Extensions Directory (JED): http://extensions.joomla.org 7- Is it easy to change the layout display? * The layout is controlled by templates that you can edit. - * There are lots of ready made templates that you can download. + * There are a lot of ready-made professional templates that you can download. + * Check out the template management information: https://docs.joomla.org/Portal:Template_Management 8- Ready to install Joomla? - * See minimum requirements here: https://www.joomla.org/about-joomla/technical-requirements.html - * How do you install Joomla! ? - https://docs.joomla.org/Installing_Joomla! - * Start your Joomla experience building your site with a local test server. + * Check the minimum requirements here: https://www.joomla.org/about-joomla/technical-requirements.html + * How do you install Joomla - hhttps://docs.joomla.org/J3.x:Installing_Joomla + * You could start your Joomla! experience building your site on a local test server. When ready it can be moved to an on-line hosting account of your choice. - See the tutorial: https://docs.joomla.org/Tutorial:Joomla_Local_install + See the tutorial: https://docs.joomla.org/Installing_Joomla_locally 9- Updates are free! * Always use the latest version: https://www.joomla.org/download.html @@ -48,21 +50,20 @@ * Find the information you need: https://docs.joomla.org/Start_here * Find help and other users: https://www.joomla.org/about-joomla/create-and-share.html * Post questions at our forums: http://forum.joomla.org - * Joomla Resources Directory (JRD): http://resources.joomla.org/ + * Joomla! Resources Directory (JRD): http://resources.joomla.org/ -11- Do you already have a Joomla site that's not built with Joomla 3.x ? - * What's new in Joomla 3.x: https://www.joomla.org/3 - * What are the main differences from 2.5 to 3? Table of contents: https://docs.joomla.org/Differences_from_Joomla_2.5_to_Joomla_3.0 +11- Do you already have a Joomla! site that's not built with Joomla! 3.x ? + * What's new in Joomla! 3.x: https://www.joomla.org/3 + * What are the main differences from 2.5 to 3? https://docs.joomla.org/What_are_the_major_differences_between_Joomla!_2.5_and_3.x%3F * How to migrate from 2.5.x to 3.x? Tutorial: https://docs.joomla.org/Joomla_2.5_to_3.x_Step_by_Step_Migration * How to migrate from 1.5.x to 3.x? Tutorial: https://docs.joomla.org/Joomla_1.5_to_3.x_Step_by_Step_Migration - * Convert an existing Web site to Joomla: https://docs.joomla.org/How_to_Convert_an_existing_Web_site_to_a_Joomla!_Web_site 12- Do you want to improve Joomla? - * How do you request a feature? https://docs.joomla.org/How_do_you_request_a_feature%3F + * Where to request a feature? https://issues.joomla.org/ * How do you report a bug? https://docs.joomla.org/Filing_bugs_and_issues * Get Involved: Joomla! is a community developed software. Join the community at https://volunteers.joomla.org/ - * Are you a Developer? https://docs.joomla.org/Developers - * Are you a Web designer? https://docs.joomla.org/Web_designers + * Documentation for Developers: https://docs.joomla.org/Portal:Developers + * Documentation for Web designers: https://docs.joomla.org/Web_designers Copyright: * Copyright (C) 2005 - 2016 Open Source Matters. All rights reserved. diff --git a/administrator/components/com_admin/models/profile.php b/administrator/components/com_admin/models/profile.php index e97d292bd73f0..779c279f616ad 100644 --- a/administrator/components/com_admin/models/profile.php +++ b/administrator/components/com_admin/models/profile.php @@ -9,7 +9,7 @@ defined('_JEXEC') or die; -require_once JPATH_ADMINISTRATOR . '/components/com_users/models/user.php'; +JLoader::register('UsersModelUser', JPATH_ADMINISTRATOR . '/components/com_users/models/user.php'); /** * User model. diff --git a/administrator/components/com_admin/models/sysinfo.php b/administrator/components/com_admin/models/sysinfo.php index e13a05092e12d..c17e2bc4d92d9 100644 --- a/administrator/components/com_admin/models/sysinfo.php +++ b/administrator/components/com_admin/models/sysinfo.php @@ -209,6 +209,7 @@ protected function cleanSectionPrivateData($sectionValues) { $sectionValues = 'xxxxxx'; } + return strlen($sectionValues) ? 'xxxxxx' : ''; } diff --git a/administrator/components/com_admin/script.php b/administrator/components/com_admin/script.php index 37fd7aa329f5f..17af282982b5c 100644 --- a/administrator/components/com_admin/script.php +++ b/administrator/components/com_admin/script.php @@ -31,6 +31,8 @@ public function update($installer) JLog::addLogger($options, JLog::INFO, array('Update', 'databasequery', 'jerror')); JLog::add(JText::_('COM_JOOMLAUPDATE_UPDATE_LOG_DELETE_FILES'), JLog::INFO, 'Update'); + // This needs to stay for 2.5 update compatibility + $this->deleteUnexistingFiles(); $this->updateManifestCaches(); $this->updateDatabase(); $this->clearRadCache(); diff --git a/administrator/components/com_banners/controller.php b/administrator/components/com_banners/controller.php index 075ef264402de..c64d7edb3aa96 100644 --- a/administrator/components/com_banners/controller.php +++ b/administrator/components/com_banners/controller.php @@ -9,7 +9,7 @@ defined('_JEXEC') or die; -JLoader::register('BannersHelper', JPATH_COMPONENT . '/helpers/banners.php'); +JLoader::register('BannersHelper', JPATH_ADMINISTRATOR . '/components/com_banners/helpers/banners.php'); /** * Banners master display controller. diff --git a/administrator/components/com_banners/models/forms/banner.xml b/administrator/components/com_banners/models/forms/banner.xml index 0a6cc912ca0f9..8a8dac3b9e32a 100644 --- a/administrator/components/com_banners/models/forms/banner.xml +++ b/administrator/components/com_banners/models/forms/banner.xml @@ -169,6 +169,7 @@ name="modified_by" type="user" label="JGLOBAL_FIELD_MODIFIED_BY_LABEL" + description="COM_BANNERS_FIELD_MODIFIED_BY_DESC" class="readonly" readonly="true" filter="unset" diff --git a/administrator/components/com_banners/models/forms/download.xml b/administrator/components/com_banners/models/forms/download.xml index fbaed4e8e8f28..0c90b70bc95d4 100644 --- a/administrator/components/com_banners/models/forms/download.xml +++ b/administrator/components/com_banners/models/forms/download.xml @@ -1,13 +1,15 @@
+
+ @@ -16,9 +18,15 @@ + +
diff --git a/administrator/components/com_banners/models/forms/filter_banners.xml b/administrator/components/com_banners/models/forms/filter_banners.xml index 5ef151967fb41..76268022c7fec 100644 --- a/administrator/components/com_banners/models/forms/filter_banners.xml +++ b/administrator/components/com_banners/models/forms/filter_banners.xml @@ -1,6 +1,6 @@
- + - + state->params->get('save_history', 0) && $user->authorise('core.edit')) + if ($this->state->params->get('save_history', 0) && $canDo->get('core.edit')) { JToolbarHelper::versions('com_banners.banner', $this->item->id); } diff --git a/administrator/components/com_banners/views/banners/view.html.php b/administrator/components/com_banners/views/banners/view.html.php index dc842b884bb39..7dceb56355d30 100644 --- a/administrator/components/com_banners/views/banners/view.html.php +++ b/administrator/components/com_banners/views/banners/view.html.php @@ -73,7 +73,6 @@ public function display($tpl = null) BannersHelper::addSubmenu('banners'); $this->addToolbar(); - require_once JPATH_COMPONENT . '/models/fields/bannerclient.php'; // Include the component HTML helpers. JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); @@ -92,7 +91,7 @@ public function display($tpl = null) */ protected function addToolbar() { - require_once JPATH_COMPONENT . '/helpers/banners.php'; + JLoader::register('BannersHelper', JPATH_ADMINISTRATOR . '/components/com_banners/helpers/banners.php'); $canDo = JHelperContent::getActions('com_banners', 'category', $this->state->get('filter.category_id')); $user = JFactory::getUser(); diff --git a/administrator/components/com_banners/views/client/view.html.php b/administrator/components/com_banners/views/client/view.html.php index 2d03c7b037198..3ae6d6df856df 100644 --- a/administrator/components/com_banners/views/client/view.html.php +++ b/administrator/components/com_banners/views/client/view.html.php @@ -9,7 +9,7 @@ defined('_JEXEC') or die; -JLoader::register('BannersHelper', JPATH_COMPONENT . '/helpers/banners.php'); +JLoader::register('BannersHelper', JPATH_ADMINISTRATOR . '/components/com_banners/helpers/banners.php'); /** * View to edit a client. @@ -105,6 +105,7 @@ protected function addToolbar() { JToolbarHelper::save2new('client.save2new'); } + // If an existing item, can save to a copy. if (!$isNew && $canDo->get('core.create')) { @@ -117,7 +118,7 @@ protected function addToolbar() } else { - if ($this->state->params->get('save_history', 0) && $user->authorise('core.edit')) + if ($this->state->params->get('save_history', 0) && $canDo->get('core.edit')) { JToolbarHelper::versions('com_banners.client', $this->item->id); } diff --git a/administrator/components/com_banners/views/clients/view.html.php b/administrator/components/com_banners/views/clients/view.html.php index 29f4b8aa4b1ae..5bde6f4d9bd5f 100644 --- a/administrator/components/com_banners/views/clients/view.html.php +++ b/administrator/components/com_banners/views/clients/view.html.php @@ -9,7 +9,7 @@ defined('_JEXEC') or die; -JLoader::register('BannersHelper', JPATH_COMPONENT . '/helpers/banners.php'); +JLoader::register('BannersHelper', JPATH_ADMINISTRATOR . '/components/com_banners/helpers/banners.php'); /** * View class for a list of clients. diff --git a/administrator/components/com_banners/views/download/tmpl/default.php b/administrator/components/com_banners/views/download/tmpl/default.php index 85277d11c0dc8..b14e9910659a5 100644 --- a/administrator/components/com_banners/views/download/tmpl/default.php +++ b/administrator/components/com_banners/views/download/tmpl/default.php @@ -8,25 +8,30 @@ */ defined('_JEXEC') or die; + +JHtml::_('bootstrap.tooltip', '.hasTooltip', array('placement' => 'bottom')); ?> - -
- +
+ form->getFieldset() as $field) : ?> - hidden) : ?> - label; ?> - - input; ?> + form->renderField($field->fieldname); ?> -
- - -
- + + + + diff --git a/administrator/components/com_banners/views/tracks/tmpl/default.php b/administrator/components/com_banners/views/tracks/tmpl/default.php index e32fdc47672cd..180d008a8d45a 100644 --- a/administrator/components/com_banners/views/tracks/tmpl/default.php +++ b/administrator/components/com_banners/views/tracks/tmpl/default.php @@ -83,6 +83,26 @@ + + + JText::_('COM_BANNERS_TRACKS_DOWNLOAD'), + 'url' => JRoute::_('index.php?option=com_banners&view=download&tmpl=component'), + 'height' => '370px', + 'width' => '300px', + 'modalWidth' => '40', + 'footer' => '' + . '', + ) + ); ?> + diff --git a/administrator/components/com_banners/views/tracks/view.html.php b/administrator/components/com_banners/views/tracks/view.html.php index 0135cafaa5c40..28bd67efd90bd 100644 --- a/administrator/components/com_banners/views/tracks/view.html.php +++ b/administrator/components/com_banners/views/tracks/view.html.php @@ -9,7 +9,7 @@ defined('_JEXEC') or die; -JLoader::register('BannersHelper', JPATH_COMPONENT . '/helpers/banners.php'); +JLoader::register('BannersHelper', JPATH_ADMINISTRATOR . '/components/com_banners/helpers/banners.php'); /** * View class for a list of tracks. @@ -66,8 +66,6 @@ public function display($tpl = null) $this->addToolbar(); - require_once JPATH_COMPONENT . '/models/fields/bannerclient.php'; - $this->sidebar = JHtmlSidebar::render(); return parent::display($tpl); @@ -87,7 +85,19 @@ protected function addToolbar() JToolbarHelper::title(JText::_('COM_BANNERS_MANAGER_TRACKS'), 'bookmark banners-tracks'); $bar = JToolbar::getInstance('toolbar'); - $bar->appendButton('Popup', 'download', 'JTOOLBAR_EXPORT', 'index.php?option=com_banners&view=download&tmpl=component', 600, 300); + + // Instantiate a new JLayoutFile instance and render the export button + $layout = new JLayoutFile('joomla.toolbar.modal'); + + $dhtml = $layout->render( + array( + 'selector' => 'downloadModal', + 'icon' => 'download', + 'text' => JText::_('JTOOLBAR_EXPORT'), + ) + ); + + $bar->appendButton('Custom', $dhtml, 'download'); if ($canDo->get('core.delete')) { diff --git a/administrator/components/com_cache/controller.php b/administrator/components/com_cache/controller.php index 24854f3407332..70990381d2c85 100644 --- a/administrator/components/com_cache/controller.php +++ b/administrator/components/com_cache/controller.php @@ -28,7 +28,7 @@ class CacheController extends JControllerLegacy */ public function display($cachable = false, $urlparams = false) { - require_once JPATH_COMPONENT . '/helpers/cache.php'; + JLoader::register('CacheHelper', JPATH_ADMINISTRATOR . '/components/com_cache/helpers/cache.php'); // Get the document object. $document = JFactory::getDocument(); @@ -93,6 +93,7 @@ public function delete() JFactory::getApplication()->enqueueMessage(JText::_('COM_CACHE_EXPIRED_ITEMS_HAVE_BEEN_DELETED'), 'message'); } } + $this->setRedirect('index.php?option=com_cache'); } @@ -152,6 +153,7 @@ public function purge() { JFactory::getApplication()->enqueueMessage(JText::_('COM_CACHE_EXPIRED_ITEMS_HAVE_BEEN_PURGED'), 'message'); } + $this->setRedirect('index.php?option=com_cache&view=purge'); } } diff --git a/administrator/components/com_cache/models/cache.php b/administrator/components/com_cache/models/cache.php index 1b592e4a1935c..534c386ffe933 100644 --- a/administrator/components/com_cache/models/cache.php +++ b/administrator/components/com_cache/models/cache.php @@ -196,7 +196,7 @@ public function getClient() /** * Get the number of current Cache Groups. * - * @return int + * @return integer */ public function getTotal() { diff --git a/administrator/components/com_categories/controller.php b/administrator/components/com_categories/controller.php index ae7e2ce010b59..93468f2cd0293 100644 --- a/administrator/components/com_categories/controller.php +++ b/administrator/components/com_categories/controller.php @@ -89,7 +89,7 @@ public function display($cachable = false, $urlparams = array()) $view->document = $document; // Load the submenu. - require_once JPATH_COMPONENT . '/helpers/categories.php'; + JLoader::register('CategoriesHelper', JPATH_ADMINISTRATOR . '/components/com_categories/helpers/categories.php'); CategoriesHelper::addSubmenu($model->getState('filter.extension')); $view->display(); diff --git a/administrator/components/com_categories/helpers/categories.php b/administrator/components/com_categories/helpers/categories.php index e4589f6704bbd..ec29ffc3f914d 100644 --- a/administrator/components/com_categories/helpers/categories.php +++ b/administrator/components/com_categories/helpers/categories.php @@ -148,7 +148,7 @@ public static function createCategory($data) JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_categories/models'); JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_categories/tables'); - $categoryModel = JModelLegacy::getInstance('Category', 'CategoriesModel'); + $categoryModel = JModelLegacy::getInstance('Category', 'CategoriesModel', array('ignore_request' => true)); $categoryModel->save($data); $catid = $categoryModel->getState('category.id'); diff --git a/administrator/components/com_categories/views/categories/tmpl/modal.php b/administrator/components/com_categories/views/categories/tmpl/modal.php index b10924e8ae63c..909bf838d8dd8 100644 --- a/administrator/components/com_categories/views/categories/tmpl/modal.php +++ b/administrator/components/com_categories/views/categories/tmpl/modal.php @@ -16,7 +16,7 @@ JSession::checkToken('get') or die(JText::_('JINVALID_TOKEN')); } -require_once JPATH_ROOT . '/components/com_content/helpers/route.php'; +JLoader::register('ContentHelperRoute', JPATH_ROOT . '/components/com_content/helpers/route.php'); // Include the component HTML helpers. JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); diff --git a/administrator/components/com_categories/views/categories/view.html.php b/administrator/components/com_categories/views/categories/view.html.php index 98539bb2750ae..925cff302649b 100644 --- a/administrator/components/com_categories/views/categories/view.html.php +++ b/administrator/components/com_categories/views/categories/view.html.php @@ -163,7 +163,7 @@ protected function addToolbar() || $lang->load($component, JPATH_ADMINISTRATOR . '/components/' . $component, null, false, true); // Load the category helper. - require_once JPATH_COMPONENT . '/helpers/categories.php'; + JLoader::register('CategoriesHelper', JPATH_ADMINISTRATOR . '/components/com_categories/helpers/categories.php'); // If a component categories title string is present, let's use it. if ($lang->hasKey($component_title_key = strtoupper($component . ($section ? "_$section" : '')) . '_CATEGORIES_TITLE')) diff --git a/administrator/components/com_categories/views/category/tmpl/edit.php b/administrator/components/com_categories/views/category/tmpl/edit.php index 71086a67b1b98..f354d814381fc 100644 --- a/administrator/components/com_categories/views/category/tmpl/edit.php +++ b/administrator/components/com_categories/views/category/tmpl/edit.php @@ -45,8 +45,8 @@ // In case of modal $isModal = $input->get('layout') == 'modal' ? true : false; -$layout = $isModal ? 'modal' : 'edit'; -$tmpl = $isModal ? '&tmpl=component' : ''; +$layout = $isModal ? 'modal' : 'edit'; +$tmpl = $isModal || $input->get('tmpl', '', 'cmd') === 'component' ? '&tmpl=component' : ''; ?>
@@ -68,6 +68,8 @@ + +
@@ -93,8 +95,6 @@ - - form->getInput('extension'); ?> diff --git a/administrator/components/com_categories/views/category/tmpl/edit_associations.php b/administrator/components/com_categories/views/category/tmpl/edit_associations.php index b8751b02e7143..ecb71eb489e61 100644 --- a/administrator/components/com_categories/views/category/tmpl/edit_associations.php +++ b/administrator/components/com_categories/views/category/tmpl/edit_associations.php @@ -9,4 +9,11 @@ defined('_JEXEC') or die; -echo JLayoutHelper::render('joomla.edit.associations', $this); +if ($this->item->id != 0 && $this->item->language != '*') +{ + echo JLayoutHelper::render('joomla.edit.associations', $this); +} +else +{ + echo '
' . JText::_('JGLOBAL_ASSOC_NOT_POSSIBLE') . '
'; +} diff --git a/administrator/components/com_categories/views/category/view.html.php b/administrator/components/com_categories/views/category/view.html.php index 37fe2c8fb2910..4439dae47bd27 100644 --- a/administrator/components/com_categories/views/category/view.html.php +++ b/administrator/components/com_categories/views/category/view.html.php @@ -129,7 +129,7 @@ protected function addToolbar() || $lang->load($component, JPATH_ADMINISTRATOR . '/components/' . $component, null, false, true); // Load the category helper. - require_once JPATH_COMPONENT . '/helpers/categories.php'; + JLoader::register('CategoriesHelper', JPATH_ADMINISTRATOR . '/components/com_categories/helpers/categories.php'); // Get the results for each action. $canDo = $this->canDo; @@ -166,33 +166,34 @@ protected function addToolbar() JToolbarHelper::apply('category.apply'); JToolbarHelper::save('category.save'); JToolbarHelper::save2new('category.save2new'); + JToolbarHelper::cancel('category.cancel'); } // If not checked out, can save the item. - elseif (!$checkedOut && ($canDo->get('core.edit') || ($canDo->get('core.edit.own') && $this->item->created_user_id == $userId))) + else { - JToolbarHelper::apply('category.apply'); - JToolbarHelper::save('category.save'); + // Since it's an existing record, check the edit permission, or fall back to edit own if the owner. + $itemEditable = $canDo->get('core.edit') || ($canDo->get('core.edit.own') && $this->item->created_user_id == $userId); - if ($canDo->get('core.create')) + // Can't save the record if it's checked out and editable + if (!$checkedOut && $itemEditable) { - JToolbarHelper::save2new('category.save2new'); + JToolbarHelper::apply('category.apply'); + JToolbarHelper::save('category.save'); + + if ($canDo->get('core.create')) + { + JToolbarHelper::save2new('category.save2new'); + } } - } - // If an existing item, can save to a copy. - if (!$isNew && $canDo->get('core.create')) - { - JToolbarHelper::save2copy('category.save2copy'); - } + // If an existing item, can save to a copy. + if ($canDo->get('core.create')) + { + JToolbarHelper::save2copy('category.save2copy'); + } - if (empty($this->item->id)) - { - JToolbarHelper::cancel('category.cancel'); - } - else - { - if ($componentParams->get('save_history', 0) && $user->authorise('core.edit')) + if ($componentParams->get('save_history', 0) && $itemEditable) { $typeAlias = $extension . '.category'; JToolbarHelper::versions($typeAlias, $this->item->id); diff --git a/administrator/components/com_config/model/application.php b/administrator/components/com_config/model/application.php index 17b404118f761..5f6649b1d6278 100644 --- a/administrator/components/com_config/model/application.php +++ b/administrator/components/com_config/model/application.php @@ -127,7 +127,16 @@ public function save($data) $host = JUri::getInstance()->getHost(); $options = new \Joomla\Registry\Registry; $options->set('userAgent', 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:41.0) Gecko/20100101 Firefox/41.0'); - $options->set('transport.curl', array(CURLOPT_SSL_VERIFYPEER => false)); + + // Do not check for valid server certificate here, leave this to the user, moreover disable using a proxy if any is configured. + $options->set('transport.curl', + array( + CURLOPT_SSL_VERIFYPEER => false, + CURLOPT_SSL_VERIFYHOST => false, + CURLOPT_PROXY => null, + CURLOPT_PROXYUSERPWD => null, + ) + ); $response = JHttpFactory::getHttp($options)->get('https://' . $host . JUri::root(true) . '/', array('Host' => $host), 10); // If available in HTTPS check also the status code. @@ -778,7 +787,7 @@ public function sendTestMail() } else { - $app->enqueueMessage(JText::sprintf('COM_CONFIG_SENDMAIL_SUCCESS', $app->get('mailfrom'), $methodName), 'success'); + $app->enqueueMessage(JText::sprintf('COM_CONFIG_SENDMAIL_SUCCESS', $app->get('mailfrom'), $methodName), 'message'); } return true; diff --git a/administrator/components/com_config/model/component.php b/administrator/components/com_config/model/component.php index 19c9e4511fd01..9afb0219ae6be 100644 --- a/administrator/components/com_config/model/component.php +++ b/administrator/components/com_config/model/component.php @@ -178,7 +178,7 @@ public function save($data) throw new RuntimeException($table->getError()); } - $result = $dispatcher->trigger('onExtensionBeforeSave', array($context, &$table, false)); + $result = $dispatcher->trigger('onExtensionBeforeSave', array($context, $table, false)); // Store the data. if (in_array(false, $result, true) || !$table->store()) @@ -187,7 +187,7 @@ public function save($data) } // Trigger the after save event. - $dispatcher->trigger('onExtensionAfterSave', array($context, &$table, false)); + $dispatcher->trigger('onExtensionAfterSave', array($context, $table, false)); // Clean the component cache. $this->cleanCache('_system', 0); diff --git a/administrator/components/com_contact/config.xml b/administrator/components/com_contact/config.xml index d435a2c90c479..3a85d293e1b48 100644 --- a/administrator/components/com_contact/config.xml +++ b/administrator/components/com_contact/config.xml @@ -23,12 +23,13 @@ label="COM_CONTACT_FIELD_CONTACT_SHOW_CATEGORY_LABEL" description="COM_CONTACT_FIELD_CONTACT_SHOW_CATEGORY_DESC" default="hide" + class="chzn-color" > - + JYES - + @@ -405,7 +406,7 @@ type="media" label="COM_CONTACT_FIELD_ICONS_ADDRESS_LABEL" description="COM_CONTACT_FIELD_ICONS_ADDRESS_DESC" - hide_none="1" + hide_none="1" showon="contact_icons:0" /> @@ -414,7 +415,7 @@ type="media" label="COM_CONTACT_FIELD_ICONS_EMAIL_LABEL" description="COM_CONTACT_FIELD_ICONS_EMAIL_DESC" - hide_none="1" + hide_none="1" showon="contact_icons:0" /> @@ -422,7 +423,7 @@ name="icon_telephone" type="media" label="COM_CONTACT_FIELD_ICONS_TELEPHONE_LABEL" - description="COM_CONTACT_FIELD_ICONS_TELEPHONE_DESC" + description="COM_CONTACT_FIELD_ICONS_TELEPHONE_DESC" hide_none="1" showon="contact_icons:0" /> @@ -430,8 +431,8 @@ @@ -440,8 +441,8 @@ name="icon_fax" type="media" label="COM_CONTACT_FIELD_ICONS_FAX_LABEL" - description="COM_CONTACT_FIELD_ICONS_FAX_DESC" - hide_none="1" + description="COM_CONTACT_FIELD_ICONS_FAX_DESC" + hide_none="1" showon="contact_icons:0" /> @@ -449,7 +450,7 @@ name="icon_misc" type="media" label="COM_CONTACT_FIELD_ICONS_MISC_LABEL" - description="COM_CONTACT_FIELD_ICONS_MISC_DESC" + description="COM_CONTACT_FIELD_ICONS_MISC_DESC" hide_none="1" showon="contact_icons:0" /> @@ -620,7 +621,7 @@ - + - + diff --git a/administrator/components/com_contact/controller.php b/administrator/components/com_contact/controller.php index 5d8ca9f15c08d..f95496c9033fb 100644 --- a/administrator/components/com_contact/controller.php +++ b/administrator/components/com_contact/controller.php @@ -36,7 +36,7 @@ class ContactController extends JControllerLegacy */ public function display($cachable = false, $urlparams = array()) { - require_once JPATH_COMPONENT . '/helpers/contact.php'; + JLoader::register('ContactHelper', JPATH_ADMINISTRATOR . '/components/com_contact/helpers/contact.php'); $view = $this->input->get('view', 'contacts'); $layout = $this->input->get('layout', 'default'); diff --git a/administrator/components/com_contact/models/forms/contact.xml b/administrator/components/com_contact/models/forms/contact.xml index 99de8f4a92511..f21b7307d01d0 100644 --- a/administrator/components/com_contact/models/forms/contact.xml +++ b/administrator/components/com_contact/models/forms/contact.xml @@ -138,6 +138,7 @@ name="modified_by" type="user" label="JGLOBAL_FIELD_MODIFIED_BY_LABEL" + description="COM_CONTACT_FIELD_MODIFIED_BY_DESC" class="readonly" readonly="true" filter="unset" @@ -431,6 +432,7 @@ type="list" label="JGLOBAL_SHOW_CATEGORY_LABEL" description="COM_CONTACT_FIELD_SHOW_CATEGORY_DESC" + class="chzn-color" > diff --git a/administrator/components/com_contact/models/forms/filter_contacts.xml b/administrator/components/com_contact/models/forms/filter_contacts.xml index 7e9433bbb54e7..60c8ad7d62d73 100755 --- a/administrator/components/com_contact/models/forms/filter_contacts.xml +++ b/administrator/components/com_contact/models/forms/filter_contacts.xml @@ -95,14 +95,14 @@ + + - -
+ +
@@ -104,8 +106,6 @@
- - loadTemplate('associations'); ?> diff --git a/administrator/components/com_contact/views/contact/tmpl/edit_associations.php b/administrator/components/com_contact/views/contact/tmpl/edit_associations.php index a01793eee3932..70d2b1db61b28 100644 --- a/administrator/components/com_contact/views/contact/tmpl/edit_associations.php +++ b/administrator/components/com_contact/views/contact/tmpl/edit_associations.php @@ -9,4 +9,11 @@ defined('_JEXEC') or die; -echo JLayoutHelper::render('joomla.edit.associations', $this); +if ($this->item->id != 0 && $this->item->language != '*') +{ + echo JLayoutHelper::render('joomla.edit.associations', $this); +} +else +{ + echo '
' . JText::_('JGLOBAL_ASSOC_NOT_POSSIBLE') . '
'; +} diff --git a/administrator/components/com_contact/views/contact/view.html.php b/administrator/components/com_contact/views/contact/view.html.php index b251da600ba6d..9d8500a1f09cf 100644 --- a/administrator/components/com_contact/views/contact/view.html.php +++ b/administrator/components/com_contact/views/contact/view.html.php @@ -106,20 +106,19 @@ protected function addToolbar() } else { - // Can't save the record if it's checked out. - if (!$checkedOut) + // Since it's an existing record, check the edit permission, or fall back to edit own if the owner. + $itemEditable = $canDo->get('core.edit') || ($canDo->get('core.edit.own') && $this->item->created_by == $userId); + + // Can't save the record if it's checked out and editable + if (!$checkedOut && $itemEditable) { - // Since it's an existing record, check the edit permission, or fall back to edit own if the owner. - if ($canDo->get('core.edit') || ($canDo->get('core.edit.own') && $this->item->created_by == $userId)) + JToolbarHelper::apply('contact.apply'); + JToolbarHelper::save('contact.save'); + + // We can save this record, but check the create permission to see if we can return to make a new one. + if ($canDo->get('core.create')) { - JToolbarHelper::apply('contact.apply'); - JToolbarHelper::save('contact.save'); - - // We can save this record, but check the create permission to see if we can return to make a new one. - if ($canDo->get('core.create')) - { - JToolbarHelper::save2new('contact.save2new'); - } + JToolbarHelper::save2new('contact.save2new'); } } @@ -129,7 +128,7 @@ protected function addToolbar() JToolbarHelper::save2copy('contact.save2copy'); } - if ($this->state->params->get('save_history', 0) && $user->authorise('core.edit')) + if ($this->state->params->get('save_history', 0) && $itemEditable) { JToolbarHelper::versions('com_contact.contact', $this->item->id); } diff --git a/administrator/components/com_contact/views/contacts/tmpl/default.php b/administrator/components/com_contact/views/contacts/tmpl/default.php index ba70da05ed717..ffd0c975e2cfb 100644 --- a/administrator/components/com_contact/views/contacts/tmpl/default.php +++ b/administrator/components/com_contact/views/contacts/tmpl/default.php @@ -62,9 +62,6 @@ - - - @@ -127,6 +124,7 @@
published, $i, 'contacts.', $canChange, 'cb', $item->publish_up, $item->publish_down); ?> + featured, $i, $canChange); ?> email; ?>
- - featured, $i, $canChange); ?> - access_level; ?> diff --git a/administrator/components/com_contact/views/contacts/tmpl/modal.php b/administrator/components/com_contact/views/contacts/tmpl/modal.php index 6279cb306c7b5..e9a81385e2d3d 100644 --- a/administrator/components/com_contact/views/contacts/tmpl/modal.php +++ b/administrator/components/com_contact/views/contacts/tmpl/modal.php @@ -9,7 +9,7 @@ defined('_JEXEC') or die; -require_once JPATH_ROOT . '/components/com_contact/helpers/route.php'; +JLoader::register('ContactHelperRoute', JPATH_ROOT . '/components/com_contact/helpers/route.php'); JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); diff --git a/administrator/components/com_contact/views/contacts/view.html.php b/administrator/components/com_contact/views/contacts/view.html.php index c3d325e0af937..feef9cabef453 100644 --- a/administrator/components/com_contact/views/contacts/view.html.php +++ b/administrator/components/com_contact/views/contacts/view.html.php @@ -149,6 +149,8 @@ protected function addToolbar() { JToolbarHelper::publish('contacts.publish', 'JTOOLBAR_PUBLISH', true); JToolbarHelper::unpublish('contacts.unpublish', 'JTOOLBAR_UNPUBLISH', true); + JToolbarHelper::custom('contacts.featured', 'featured.png', 'featured_f2.png', 'JFEATURE', true); + JToolbarHelper::custom('contacts.unfeatured', 'unfeatured.png', 'featured_f2.png', 'JUNFEATURE', true); JToolbarHelper::archiveList('contacts.archive'); JToolbarHelper::checkin('contacts.checkin'); } diff --git a/administrator/components/com_content/config.xml b/administrator/components/com_content/config.xml index 808879caa56e1..239eb82e921f7 100644 --- a/administrator/components/com_content/config.xml +++ b/administrator/components/com_content/config.xml @@ -265,8 +265,7 @@ class="btn-group btn-group-yesno" label="JGLOBAL_SHOW_PRINT_ICON_LABEL" description="JGLOBAL_SHOW_PRINT_ICON_DESC" - default="1" - showon="show_icons:1"> + default="1"> @@ -277,8 +276,7 @@ class="btn-group btn-group-yesno" label="JGLOBAL_SHOW_EMAIL_ICON_LABEL" description="JGLOBAL_SHOW_EMAIL_ICON_DESC" - default="1" - showon="show_icons:1"> + default="1"> @@ -696,9 +694,6 @@ type="spacer" hr="true" /> - true)) { - $model = parent::getModel($name, $prefix, $config); - - return $model; + return parent::getModel($name, $prefix, $config); } /** diff --git a/administrator/components/com_content/controllers/featured.php b/administrator/components/com_content/controllers/featured.php index 089df321927db..458026fdcbc7b 100644 --- a/administrator/components/com_content/controllers/featured.php +++ b/administrator/components/com_content/controllers/featured.php @@ -9,7 +9,7 @@ defined('_JEXEC') or die; -require_once __DIR__ . '/articles.php'; +JLoader::register('ContentControllerArticles', __DIR__ . '/articles.php'); /** * Featured content controller class. @@ -90,8 +90,6 @@ public function publish() */ public function getModel($name = 'Feature', $prefix = 'ContentModel', $config = array('ignore_request' => true)) { - $model = parent::getModel($name, $prefix, $config); - - return $model; + return parent::getModel($name, $prefix, $config); } } diff --git a/administrator/components/com_content/models/feature.php b/administrator/components/com_content/models/feature.php index f3730034575d5..7a12a1f876284 100644 --- a/administrator/components/com_content/models/feature.php +++ b/administrator/components/com_content/models/feature.php @@ -9,7 +9,7 @@ defined('_JEXEC') or die; -require_once __DIR__ . '/article.php'; +JLoader::register('ContentModelArticle', __DIR__ . '/article.php'); /** * Feature model. diff --git a/administrator/components/com_content/models/featured.php b/administrator/components/com_content/models/featured.php index 1292491004258..f5d2ef8faeb59 100644 --- a/administrator/components/com_content/models/featured.php +++ b/administrator/components/com_content/models/featured.php @@ -9,7 +9,7 @@ defined('_JEXEC') or die; -require_once __DIR__ . '/articles.php'; +JLoader::register('ContentModelArticles', __DIR__ . '/articles.php'); /** * About Page Model diff --git a/administrator/components/com_content/models/forms/filter_articles.xml b/administrator/components/com_content/models/forms/filter_articles.xml index 8cd89df9d0ee3..51e0dca100994 100644 --- a/administrator/components/com_content/models/forms/filter_articles.xml +++ b/administrator/components/com_content/models/forms/filter_articles.xml @@ -94,26 +94,26 @@ + + - - + + - - - - + + get('layout') == 'modal' ? true : false; -$layout = $isModal ? 'modal' : 'edit'; -$tmpl = $isModal ? '&tmpl=component' : ''; +$layout = $isModal ? 'modal' : 'edit'; +$tmpl = $isModal || $input->get('tmpl', '', 'cmd') === 'component' ? '&tmpl=component' : ''; ?> @@ -104,20 +104,6 @@
- - show_publishing_options == 1) : ?> - -
-
- -
-
- -
-
- - - show_urls_images_backend == 1) : ?> @@ -137,6 +123,24 @@ + show_options = $params->show_article_options; ?> + + + + show_publishing_options == 1) : ?> + +
+
+ +
+
+ +
+
+ + + + loadTemplate('associations'); ?> @@ -145,9 +149,6 @@ - show_options = $params->show_article_options; ?> - - canDo->get('core.admin')) : ?> form->renderFieldset('editorConfig'); ?> diff --git a/administrator/components/com_content/views/article/tmpl/edit_associations.php b/administrator/components/com_content/views/article/tmpl/edit_associations.php index e65a294fdea1c..5da88c15516b0 100644 --- a/administrator/components/com_content/views/article/tmpl/edit_associations.php +++ b/administrator/components/com_content/views/article/tmpl/edit_associations.php @@ -9,4 +9,11 @@ defined('_JEXEC') or die; -echo JLayoutHelper::render('joomla.edit.associations', $this); +if ($this->item->id != 0 && $this->item->language != '*') +{ + echo JLayoutHelper::render('joomla.edit.associations', $this); +} +else +{ + echo '
' . JText::_('JGLOBAL_ASSOC_NOT_POSSIBLE') . '
'; +} diff --git a/administrator/components/com_content/views/article/view.html.php b/administrator/components/com_content/views/article/view.html.php index 9f58183127379..64983e04babfa 100644 --- a/administrator/components/com_content/views/article/view.html.php +++ b/administrator/components/com_content/views/article/view.html.php @@ -101,20 +101,19 @@ protected function addToolbar() } else { - // Can't save the record if it's checked out. - if (!$checkedOut) + // Since it's an existing record, check the edit permission, or fall back to edit own if the owner. + $itemEditable = $canDo->get('core.edit') || ($canDo->get('core.edit.own') && $this->item->created_by == $userId); + + // Can't save the record if it's checked out and editable + if (!$checkedOut && $itemEditable) { - // Since it's an existing record, check the edit permission, or fall back to edit own if the owner. - if ($canDo->get('core.edit') || ($canDo->get('core.edit.own') && $this->item->created_by == $userId)) + JToolbarHelper::apply('article.apply'); + JToolbarHelper::save('article.save'); + + // We can save this record, but check the create permission to see if we can return to make a new one. + if ($canDo->get('core.create')) { - JToolbarHelper::apply('article.apply'); - JToolbarHelper::save('article.save'); - - // We can save this record, but check the create permission to see if we can return to make a new one. - if ($canDo->get('core.create')) - { - JToolbarHelper::save2new('article.save2new'); - } + JToolbarHelper::save2new('article.save2new'); } } @@ -124,7 +123,7 @@ protected function addToolbar() JToolbarHelper::save2copy('article.save2copy'); } - if ($this->state->params->get('save_history', 0) && $canDo->get('core.edit')) + if ($this->state->params->get('save_history', 0) && $itemEditable) { JToolbarHelper::versions('com_content.article', $this->item->id); } diff --git a/administrator/components/com_content/views/articles/tmpl/modal.php b/administrator/components/com_content/views/articles/tmpl/modal.php index 9365c667e98e6..e203021e641e0 100644 --- a/administrator/components/com_content/views/articles/tmpl/modal.php +++ b/administrator/components/com_content/views/articles/tmpl/modal.php @@ -16,7 +16,7 @@ JSession::checkToken('get') or die(JText::_('JINVALID_TOKEN')); } -require_once JPATH_ROOT . '/components/com_content/helpers/route.php'; +JLoader::register('ContentHelperRoute', JPATH_ROOT . '/components/com_content/helpers/route.php'); // Include the component HTML helpers. JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); diff --git a/administrator/components/com_content/views/featured/tmpl/default.php b/administrator/components/com_content/views/featured/tmpl/default.php index cbc40e0bb0eef..161469ce2be31 100644 --- a/administrator/components/com_content/views/featured/tmpl/default.php +++ b/administrator/components/com_content/views/featured/tmpl/default.php @@ -149,7 +149,7 @@ language_title ? $this->escape($item->language_title) : JText::_('JUNDEFINED'); ?> - + escape($item->title); ?> escape($item->title); ?> @@ -174,7 +174,7 @@ - language == '*'):?> + language == '*') : ?> language_title ? JHtml::_('image', 'mod_languages/' . $item->language_image . '.gif', $item->language_title, array('title' => $item->language_title), true) . ' ' . $this->escape($item->language_title) : JText::_('JUNDEFINED'); ?> diff --git a/administrator/components/com_contenthistory/models/compare.php b/administrator/components/com_contenthistory/models/compare.php index f1847762ae03c..bd6f0ed0e17ea 100644 --- a/administrator/components/com_contenthistory/models/compare.php +++ b/administrator/components/com_contenthistory/models/compare.php @@ -52,8 +52,14 @@ public function getItems() return false; } + $user = JFactory::getUser(); + // Access check - if (!JFactory::getUser()->authorise('core.edit', $contentTypeTable->type_alias . '.' . (int) $table1->ucm_item_id)) + if ($user->authorise('core.edit', $contentTypeTable->type_alias . '.' . (int) $table1->ucm_item_id) || $this->canEdit($table1)) + { + $return = true; + } + else { $this->setError(JText::_('JERROR_ALERTNOAUTHOR')); @@ -61,18 +67,64 @@ public function getItems() } // All's well, process the records - foreach (array($table1, $table2) as $table) + if ($return == true) { - $object = new stdClass; - $object->data = ContenthistoryHelper::prepareData($table); - $object->version_note = $table->version_note; - $object->save_date = $table->save_date; - $result[] = $object; - } + foreach (array($table1, $table2) as $table) + { + $object = new stdClass; + $object->data = ContenthistoryHelper::prepareData($table); + $object->version_note = $table->version_note; + $object->save_date = $table->save_date; + $result[] = $object; + } - return $result; + return $result; + } } return false; } + + /** + * Method to test whether a record is editable + * + * @param JTableContenthistory $record A JTable object. + * + * @return boolean True if allowed to edit the record. Defaults to the permission set in the component. + * + * @since 3.6 + */ + protected function canEdit($record) + { + $result = false; + + if (!empty($record->ucm_type_id)) + { + // Check that the type id matches the type alias + $typeAlias = JFactory::getApplication()->input->get('type_alias'); + + /** @var JTableContenttype $contentTypeTable */ + $contentTypeTable = JTable::getInstance('Contenttype', 'JTable'); + + if ($contentTypeTable->getTypeId($typeAlias) == $record->ucm_type_id) + { + /** + * Make sure user has edit privileges for this content item. Note that we use edit permissions + * for the content item, not delete permissions for the content history row. + */ + $user = JFactory::getUser(); + $result = $user->authorise('core.edit', $typeAlias . '.' . (int) $record->ucm_item_id); + } + + // Finally try session (this catches edit.own case too) + if (!$result) + { + $contentTypeTable->load($record->ucm_type_id); + $typeEditables = (array) JFactory::getApplication()->getUserState(str_replace('.', '.edit.', $contentTypeTable->type_alias) . '.id'); + $result = in_array((int) $record->ucm_item_id, $typeEditables); + } + } + + return $result; + } } diff --git a/administrator/components/com_contenthistory/models/history.php b/administrator/components/com_contenthistory/models/history.php index d91429362a167..1f7ee16081917 100644 --- a/administrator/components/com_contenthistory/models/history.php +++ b/administrator/components/com_contenthistory/models/history.php @@ -40,12 +40,11 @@ public function __construct($config = array()) } /** - * Method to test whether a history record can be deleted. Note that we check whether we have edit permissions - * for the content item row. + * Method to test whether a record is editable * * @param JTableContenthistory $record A JTable object. * - * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * @return boolean True if allowed to edit the record. Defaults to the permission set in the component. * * @since 3.2 */ @@ -70,11 +69,34 @@ protected function canEdit($record) $user = JFactory::getUser(); $result = $user->authorise('core.edit', $typeAlias . '.' . (int) $record->ucm_item_id); } + + // Finally try session (this catches edit.own case too) + if (!$result) + { + $contentTypeTable->load($record->ucm_type_id); + $typeEditables = (array) JFactory::getApplication()->getUserState(str_replace('.', '.edit.', $contentTypeTable->type_alias) . '.id'); + $result = in_array((int) $record->ucm_item_id, $typeEditables); + } } return $result; } + /** + * Method to test whether a history record can be deleted. Note that we check whether we have edit permissions + * for the content item row. + * + * @param JTableContenthistory $record A JTable object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 3.6 + */ + protected function canDelete($record) + { + return canEdit($record); + } + /** * Method to delete one or more records from content history table. * @@ -147,6 +169,7 @@ public function delete(&$pks) public function getItems() { $items = parent::getItems(); + $user = JFactory::getUser(); if ($items === false) { @@ -171,15 +194,16 @@ public function getItems() } // Access check - if (!JFactory::getUser()->authorise('core.edit', $contentTypeTable->type_alias . '.' . (int) $items[0]->ucm_item_id)) + if ($user->authorise('core.edit', $contentTypeTable->type_alias . '.' . (int) $items[0]->ucm_item_id) || $this->canEdit($items[0])) + { + return $items; + } + else { $this->setError(JText::_('JERROR_ALERTNOAUTHOR')); return false; } - - // All good, return the items array - return $items; } /** diff --git a/administrator/components/com_contenthistory/models/preview.php b/administrator/components/com_contenthistory/models/preview.php index c93e16bbfd205..386354c8fe46c 100644 --- a/administrator/components/com_contenthistory/models/preview.php +++ b/administrator/components/com_contenthistory/models/preview.php @@ -46,8 +46,14 @@ public function getItem() return false; } + $user = JFactory::getUser(); + // Access check - if (!JFactory::getUser()->authorise('core.edit', $contentTypeTable->type_alias . '.' . (int) $table->ucm_item_id)) + if ($user->authorise('core.edit', $contentTypeTable->type_alias . '.' . (int) $table->ucm_item_id) || $this->canEdit($table)) + { + $return = true; + } + else { $this->setError(JText::_('JERROR_ALERTNOAUTHOR')); @@ -55,10 +61,56 @@ public function getItem() } // Good to go, finish processing the data - $result = new stdClass; - $result->save_date = $table->save_date; - $result->version_note = $table->version_note; - $result->data = ContenthistoryHelper::prepareData($table); + if ($return == true) + { + $result = new stdClass; + $result->save_date = $table->save_date; + $result->version_note = $table->version_note; + $result->data = ContenthistoryHelper::prepareData($table); + + return $result; + } + } + + /** + * Method to test whether a record is editable + * + * @param JTableContenthistory $record A JTable object. + * + * @return boolean True if allowed to edit the record. Defaults to the permission set in the component. + * + * @since 3.6 + */ + protected function canEdit($record) + { + $result = false; + + if (!empty($record->ucm_type_id)) + { + // Check that the type id matches the type alias + $typeAlias = JFactory::getApplication()->input->get('type_alias'); + + /** @var JTableContenttype $contentTypeTable */ + $contentTypeTable = JTable::getInstance('Contenttype', 'JTable'); + + if ($contentTypeTable->getTypeId($typeAlias) == $record->ucm_type_id) + { + /** + * Make sure user has edit privileges for this content item. Note that we use edit permissions + * for the content item, not delete permissions for the content history row. + */ + $user = JFactory::getUser(); + $result = $user->authorise('core.edit', $typeAlias . '.' . (int) $record->ucm_item_id); + } + + // Finally try session (this catches edit.own case too) + if (!$result) + { + $contentTypeTable->load($record->ucm_type_id); + $typeEditables = (array) JFactory::getApplication()->getUserState(str_replace('.', '.edit.', $contentTypeTable->type_alias) . '.id'); + $result = in_array((int) $record->ucm_item_id, $typeEditables); + } + } return $result; } diff --git a/administrator/components/com_cpanel/views/cpanel/view.html.php b/administrator/components/com_cpanel/views/cpanel/view.html.php index 189ec63c6d47a..27d8b2399c58d 100644 --- a/administrator/components/com_cpanel/views/cpanel/view.html.php +++ b/administrator/components/com_cpanel/views/cpanel/view.html.php @@ -47,12 +47,6 @@ public function display($tpl = null) // Display the cpanel modules $this->modules = JModuleHelper::getModules('cpanel'); - // Load the RAD layer and count the number of post-installation messages - if (!defined('FOF_INCLUDED')) - { - require_once JPATH_LIBRARIES . '/fof/include.php'; - } - try { $messages_model = FOFModel::getTmpInstance('Messages', 'PostinstallModel')->eid(700); diff --git a/administrator/components/com_finder/controller.php b/administrator/components/com_finder/controller.php index 502775321d565..51b897015dbfc 100644 --- a/administrator/components/com_finder/controller.php +++ b/administrator/components/com_finder/controller.php @@ -17,7 +17,9 @@ class FinderController extends JControllerLegacy { /** - * @var string The default view. + * The default view. + * + * @var string * @since 2.5 */ protected $default_view = 'index'; @@ -28,13 +30,13 @@ class FinderController extends JControllerLegacy * @param boolean $cachable If true, the view output will be cached * @param array $urlparams An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}. * - * @return JController A JController object to support chaining. + * @return FinderController A JControllerLegacy object to support chaining. * * @since 2.5 */ public function display($cachable = false, $urlparams = array()) { - include_once JPATH_COMPONENT . '/helpers/finder.php'; + JLoader::register('FinderHelper', JPATH_ADMINISTRATOR . '/components/com_finder/helpers/finder.php'); $view = $this->input->get('view', 'index', 'word'); $layout = $this->input->get('layout', 'index', 'word'); @@ -51,8 +53,6 @@ public function display($cachable = false, $urlparams = array()) return false; } - parent::display(); - - return $this; + return parent::display(); } } diff --git a/administrator/components/com_finder/controllers/filter.php b/administrator/components/com_finder/controllers/filter.php index 4432466220ca8..67f370547afb1 100644 --- a/administrator/components/com_finder/controllers/filter.php +++ b/administrator/components/com_finder/controllers/filter.php @@ -35,7 +35,6 @@ public function save($key = null, $urlVar = null) $app = JFactory::getApplication(); $input = $app->input; - $lang = JFactory::getLanguage(); $model = $this->getModel(); $table = $model->getTable(); $data = $input->post->get('jform', array(), 'array'); @@ -186,7 +185,7 @@ public function save($key = null, $urlVar = null) $this->setMessage( JText::_( - ($lang->hasKey($this->text_prefix . ($recordId == 0 && $app->isSite() ? '_SUBMIT' : '') . '_SAVE_SUCCESS') + (JFactory::getLanguage()->hasKey($this->text_prefix . ($recordId == 0 && $app->isSite() ? '_SUBMIT' : '') . '_SAVE_SUCCESS') ? $this->text_prefix : 'JLIB_APPLICATION') . ($recordId == 0 && $app->isSite() ? '_SUBMIT' : '') . '_SAVE_SUCCESS' ) ); diff --git a/administrator/components/com_finder/controllers/filters.php b/administrator/components/com_finder/controllers/filters.php index 0d68b8e06efc8..b5e7d24e0f259 100644 --- a/administrator/components/com_finder/controllers/filters.php +++ b/administrator/components/com_finder/controllers/filters.php @@ -23,14 +23,12 @@ class FinderControllerFilters extends JControllerAdmin * @param string $prefix The class prefix. Optional. * @param array $config Configuration array for model. Optional. * - * @return object The model. + * @return JModelLegacy The model. * * @since 2.5 */ public function getModel($name = 'Filter', $prefix = 'FinderModel', $config = array('ignore_request' => true)) { - $model = parent::getModel($name, $prefix, $config); - - return $model; + return parent::getModel($name, $prefix, $config); } } diff --git a/administrator/components/com_finder/controllers/index.php b/administrator/components/com_finder/controllers/index.php index 411bc7115460f..a21f31575969b 100644 --- a/administrator/components/com_finder/controllers/index.php +++ b/administrator/components/com_finder/controllers/index.php @@ -23,15 +23,13 @@ class FinderControllerIndex extends JControllerAdmin * @param string $prefix The class prefix. Optional. * @param array $config Configuration array for model. Optional. * - * @return object The model. + * @return JModelLegacy The model. * * @since 2.5 */ public function getModel($name = 'Index', $prefix = 'FinderModel', $config = array('ignore_request' => true)) { - $model = parent::getModel($name, $prefix, $config); - - return $model; + return parent::getModel($name, $prefix, $config); } /** diff --git a/administrator/components/com_finder/controllers/indexer.json.php b/administrator/components/com_finder/controllers/indexer.json.php index 31e8215a632b5..c233fcc35dccd 100644 --- a/administrator/components/com_finder/controllers/indexer.json.php +++ b/administrator/components/com_finder/controllers/indexer.json.php @@ -10,7 +10,7 @@ defined('_JEXEC') or die; // Register dependent classes. -JLoader::register('FinderIndexer', JPATH_COMPONENT_ADMINISTRATOR . '/helpers/indexer/indexer.php'); +JLoader::register('FinderIndexer', JPATH_ADMINISTRATOR . '/components/com_finder/helpers/indexer/indexer.php'); /** * Indexer controller class for Finder. @@ -28,27 +28,24 @@ class FinderControllerIndexer extends JControllerLegacy */ public function start() { - static $log; - $params = JComponentHelper::getParams('com_finder'); if ($params->get('enable_logging', '0')) { - if ($log == null) - { - $options['format'] = '{DATE}\t{TIME}\t{LEVEL}\t{CODE}\t{MESSAGE}'; - $options['text_file'] = 'indexer.php'; - $log = JLog::addLogger($options); - } + $options['format'] = '{DATE}\t{TIME}\t{LEVEL}\t{CODE}\t{MESSAGE}'; + $options['text_file'] = 'indexer.php'; + JLog::addLogger($options); } // Log the start JLog::add('Starting the indexer', JLog::INFO); // We don't want this form to be cached. - header('Pragma: no-cache'); - header('Cache-Control: no-cache'); - header('Expires: -1'); + $app = JFactory::getApplication(); + $app->setHeader('Expires', 'Mon, 1 Jan 2001 00:00:00 GMT', true); + $app->setHeader('Last-Modified', gmdate('D, d M Y H:i:s') . ' GMT', true); + $app->setHeader('Cache-Control', 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0', false); + $app->setHeader('Pragma', 'no-cache'); // Check for a valid token. If invalid, send a 403 with the error message. JSession::checkToken('request') or $this->sendResponse(new Exception(JText::_('JINVALID_TOKEN'), 403)); @@ -95,27 +92,24 @@ public function start() */ public function batch() { - static $log; - $params = JComponentHelper::getParams('com_finder'); if ($params->get('enable_logging', '0')) { - if ($log == null) - { - $options['format'] = '{DATE}\t{TIME}\t{LEVEL}\t{CODE}\t{MESSAGE}'; - $options['text_file'] = 'indexer.php'; - $log = JLog::addLogger($options); - } + $options['format'] = '{DATE}\t{TIME}\t{LEVEL}\t{CODE}\t{MESSAGE}'; + $options['text_file'] = 'indexer.php'; + JLog::addLogger($options); } // Log the start JLog::add('Starting the indexer batch process', JLog::INFO); // We don't want this form to be cached. - header('Pragma: no-cache'); - header('Cache-Control: no-cache'); - header('Expires: -1'); + $app = JFactory::getApplication(); + $app->setHeader('Expires', 'Mon, 1 Jan 2001 00:00:00 GMT', true); + $app->setHeader('Last-Modified', gmdate('D, d M Y H:i:s') . ' GMT', true); + $app->setHeader('Cache-Control', 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0', false); + $app->setHeader('Pragma', 'no-cache'); // Check for a valid token. If invalid, send a 403 with the error message. JSession::checkToken('request') or $this->sendResponse(new Exception(JText::_('JINVALID_TOKEN'), 403)); @@ -216,9 +210,11 @@ public function batch() public function optimize() { // We don't want this form to be cached. - header('Pragma: no-cache'); - header('Cache-Control: no-cache'); - header('Expires: -1'); + $app = JFactory::getApplication(); + $app->setHeader('Expires', 'Mon, 1 Jan 2001 00:00:00 GMT', true); + $app->setHeader('Last-Modified', gmdate('D, d M Y H:i:s') . ' GMT', true); + $app->setHeader('Cache-Control', 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0', false); + $app->setHeader('Pragma', 'no-cache'); // Check for a valid token. If invalid, send a 403 with the error message. JSession::checkToken('request') or $this->sendResponse(new Exception(JText::_('JINVALID_TOKEN'), 403)); @@ -262,27 +258,24 @@ public function optimize() */ public static function sendResponse($data = null) { - static $log; + // This method always sends a JSON response + $app = JFactory::getApplication(); + $app->mimeType = 'application/json'; $params = JComponentHelper::getParams('com_finder'); if ($params->get('enable_logging', '0')) { - if ($log == null) - { - $options['format'] = '{DATE}\t{TIME}\t{LEVEL}\t{CODE}\t{MESSAGE}'; - $options['text_file'] = 'indexer.php'; - $log = JLog::addLogger($options); - } + $options['format'] = '{DATE}\t{TIME}\t{LEVEL}\t{CODE}\t{MESSAGE}'; + $options['text_file'] = 'indexer.php'; + JLog::addLogger($options); } // Send the assigned error code if we are catching an exception. if ($data instanceof Exception) { - $app = JFactory::getApplication(); JLog::add($data->getMessage(), JLog::ERROR); $app->setHeader('status', $data->getCode()); - $app->sendHeaders(); } // Create the response object. @@ -292,10 +285,12 @@ public static function sendResponse($data = null) $response->buffer = JDEBUG ? ob_get_contents() : ob_end_clean(); // Send the JSON response. + $app->setHeader('Content-Type', $app->mimeType . '; charset=' . $app->charSet); + $app->sendHeaders(); echo json_encode($response); // Close the application. - JFactory::getApplication()->close(); + $app->close(); } } @@ -315,18 +310,13 @@ class FinderIndexerResponse */ public function __construct($state) { - static $log; - $params = JComponentHelper::getParams('com_finder'); if ($params->get('enable_logging', '0')) { - if ($log == null) - { - $options['format'] = '{DATE}\t{TIME}\t{LEVEL}\t{CODE}\t{MESSAGE}'; - $options['text_file'] = 'indexer.php'; - $log = JLog::addLogger($options); - } + $options['format'] = '{DATE}\t{TIME}\t{LEVEL}\t{CODE}\t{MESSAGE}'; + $options['text_file'] = 'indexer.php'; + JLog::addLogger($options); } // The old token is invalid so send a new one. diff --git a/administrator/components/com_finder/controllers/maps.php b/administrator/components/com_finder/controllers/maps.php index 6e0cb859e60c5..aed0950692548 100644 --- a/administrator/components/com_finder/controllers/maps.php +++ b/administrator/components/com_finder/controllers/maps.php @@ -23,14 +23,12 @@ class FinderControllerMaps extends JControllerAdmin * @param string $prefix The class prefix. Optional. * @param array $config Configuration array for model. Optional. * - * @return object The model. + * @return JModelLegacy The model. * * @since 1.6 */ public function getModel($name = 'Maps', $prefix = 'FinderModel', $config = array('ignore_request' => true)) { - $model = parent::getModel($name, $prefix, $config); - - return $model; + return parent::getModel($name, $prefix, $config); } } diff --git a/administrator/components/com_finder/helpers/finder.php b/administrator/components/com_finder/helpers/finder.php index a847ef4f128ad..9a0f44d727ad3 100644 --- a/administrator/components/com_finder/helpers/finder.php +++ b/administrator/components/com_finder/helpers/finder.php @@ -17,8 +17,10 @@ class FinderHelper { /** - * @var string The extension name. - * @since 2.5 + * The extension name. + * + * @var string + * @since 2.5 */ public static $extension = 'com_finder'; @@ -93,8 +95,6 @@ public static function getActions() JLog::add(__METHOD__ . '() is deprecated, use JHelperContent::getActions() with new arguments order instead.', JLog::WARNING, 'deprecated'); // Get list of actions - $result = JHelperContent::getActions('com_finder'); - - return $result; + return JHelperContent::getActions('com_finder'); } } diff --git a/administrator/components/com_finder/helpers/html/finder.php b/administrator/components/com_finder/helpers/html/finder.php index 00731fff5da1a..0e5e8993b3ec3 100644 --- a/administrator/components/com_finder/helpers/html/finder.php +++ b/administrator/components/com_finder/helpers/html/finder.php @@ -29,8 +29,6 @@ abstract class JHtmlFinder */ public static function typeslist() { - $lang = JFactory::getLanguage(); - // Load the finder types. $db = JFactory::getDbo(); $query = $db->getQuery(true) @@ -46,18 +44,18 @@ public static function typeslist() } catch (RuntimeException $e) { - return; + return array(); } // Compile the options. $options = array(); + $lang = JFactory::getLanguage(); + foreach ($rows as $row) { - $key = $lang->hasKey(FinderHelperLanguage::branchPlural($row->text)) - ? FinderHelperLanguage::branchPlural($row->text) : $row->text; - $string = JText::sprintf('COM_FINDER_ITEM_X_ONLY', JText::_($key)); - $options[] = JHtml::_('select.option', $row->value, $string); + $key = $lang->hasKey(FinderHelperLanguage::branchPlural($row->text)) ? FinderHelperLanguage::branchPlural($row->text) : $row->text; + $options[] = JHtml::_('select.option', $row->value, JText::sprintf('COM_FINDER_ITEM_X_ONLY', JText::_($key))); } return $options; @@ -72,8 +70,6 @@ public static function typeslist() */ public static function mapslist() { - $lang = JFactory::getLanguage(); - // Load the finder types. $db = JFactory::getDbo(); $query = $db->getQuery(true) @@ -93,6 +89,8 @@ public static function mapslist() } // Translate. + $lang = JFactory::getLanguage(); + foreach ($branches as $branch) { $key = FinderHelperLanguage::branchPlural($branch->text); @@ -124,10 +122,9 @@ public static function mapslist() */ public static function statelist() { - $options = array(); - $options[] = JHtml::_('select.option', '1', JText::sprintf('COM_FINDER_ITEM_X_ONLY', JText::_('JPUBLISHED'))); - $options[] = JHtml::_('select.option', '0', JText::sprintf('COM_FINDER_ITEM_X_ONLY', JText::_('JUNPUBLISHED'))); - - return $options; + return array( + JHtml::_('select.option', '1', JText::sprintf('COM_FINDER_ITEM_X_ONLY', JText::_('JPUBLISHED'))), + JHtml::_('select.option', '0', JText::sprintf('COM_FINDER_ITEM_X_ONLY', JText::_('JUNPUBLISHED'))) + ); } } diff --git a/administrator/components/com_finder/helpers/indexer/adapter.php b/administrator/components/com_finder/helpers/indexer/adapter.php index c822d30343ada..6314ebece649c 100644 --- a/administrator/components/com_finder/helpers/indexer/adapter.php +++ b/administrator/components/com_finder/helpers/indexer/adapter.php @@ -163,7 +163,7 @@ public function __construct(&$subject, $config) * @return boolean True on success. * * @since 2.5 - * @throws Exception on error. + * @throws Exception on error. */ public function onStartIndex() { @@ -271,7 +271,7 @@ public function onBuildIndex() * @return boolean True on success. * * @since 2.5 - * @throws Exception on database error. + * @throws Exception on database error. */ protected function change($id, $property, $value) { @@ -527,9 +527,8 @@ protected function getContentCount() // Get the total number of content items to index. $this->db->setQuery($query); - $return = (int) $this->db->loadResult(); - return $return; + return (int) $this->db->loadResult(); } /** @@ -624,9 +623,7 @@ protected function getItems($offset, $limit, $query = null) protected function getListQuery($query = null) { // Check if we can use the supplied SQL query. - $query = $query instanceof JDatabaseQuery ? $query : $this->db->getQuery(true); - - return $query; + return $query instanceof JDatabaseQuery ? $query : $this->db->getQuery(true); } /** @@ -646,9 +643,8 @@ protected function getPluginType($id) ->from($this->db->quoteName('#__extensions')) ->where($this->db->quoteName('extension_id') . ' = ' . (int) $id); $this->db->setQuery($query); - $type = $this->db->loadResult(); - return $type; + return $this->db->loadResult(); } /** @@ -729,9 +725,8 @@ protected function getTypeId() ->from($this->db->quoteName('#__finder_types')) ->where($this->db->quoteName('title') . ' = ' . $this->db->quote($this->type_title)); $this->db->setQuery($query); - $result = (int) $this->db->loadResult(); - return $result; + return (int) $this->db->loadResult(); } /** diff --git a/administrator/components/com_finder/helpers/indexer/helper.php b/administrator/components/com_finder/helpers/indexer/helper.php index d340bc88fe5c6..0a1574f8838bd 100644 --- a/administrator/components/com_finder/helpers/indexer/helper.php +++ b/administrator/components/com_finder/helpers/indexer/helper.php @@ -74,7 +74,7 @@ public static function tokenize($input, $lang, $phrase = false) $quotes = html_entity_decode('‘’'', ENT_QUOTES, 'UTF-8'); // Get the simple language key. - $lang = self::getPrimaryLanguage($lang); + $lang = static::getPrimaryLanguage($lang); /* * Parsing the string input into terms is a multi-step process. @@ -224,14 +224,12 @@ public static function stem($token, $lang) } // Stem the token if we have a valid stemmer to use. - if (self::$stemmer instanceof FinderIndexerStemmer) + if (static::$stemmer instanceof FinderIndexerStemmer) { - return self::$stemmer->stem($token, $lang); - } - else - { - return $token; + return static::$stemmer->stem($token, $lang); } + + return $token; } /** @@ -303,14 +301,7 @@ public static function isCommon($token, $lang) } // Check if the token is in the common array. - if (in_array($token, $data[$lang])) - { - return true; - } - else - { - return false; - } + return in_array($token, $data[$lang]); } /** @@ -335,9 +326,8 @@ public static function getCommonWords($lang) // Load all of the common terms for the language. $db->setQuery($query); - $results = $db->loadColumn(); - return $results; + return $db->loadColumn(); } /** diff --git a/administrator/components/com_finder/helpers/indexer/indexer.php b/administrator/components/com_finder/helpers/indexer/indexer.php index 4da8fbc310635..0bfa0daed411b 100644 --- a/administrator/components/com_finder/helpers/indexer/indexer.php +++ b/administrator/components/com_finder/helpers/indexer/indexer.php @@ -75,7 +75,7 @@ abstract class FinderIndexer /** * The indexer state object. * - * @var object + * @var JObject * @since 2.5 */ public static $state; @@ -83,7 +83,7 @@ abstract class FinderIndexer /** * The indexer profiler object. * - * @var object + * @var JProfiler * @since 2.5 */ public static $profiler; @@ -121,11 +121,9 @@ public static function getInstance() return new $class; } - else - { - // Throw invalid format exception. - throw new RuntimeException(JText::sprintf('COM_FINDER_INDEXER_INVALID_DRIVER', $format)); - } + + // Throw invalid format exception. + throw new RuntimeException(JText::sprintf('COM_FINDER_INDEXER_INVALID_DRIVER', $format)); } /** @@ -138,9 +136,9 @@ public static function getInstance() public static function getState() { // First, try to load from the internal state. - if (!empty(self::$state)) + if (!empty(static::$state)) { - return self::$state; + return static::$state; } // If we couldn't load from the internal state, try the session. @@ -177,7 +175,7 @@ public static function getState() // Setup the profiler if debugging is enabled. if (JFactory::getApplication()->get('debug')) { - self::$profiler = JProfiler::getInstance('FinderIndexer'); + static::$profiler = JProfiler::getInstance('FinderIndexer'); } // Setup the stemmer. @@ -187,9 +185,9 @@ public static function getState() } // Set the state. - self::$state = $data; + static::$state = $data; - return self::$state; + return static::$state; } /** @@ -210,11 +208,10 @@ public static function setState($data) } // Set the new internal state. - self::$state = $data; + static::$state = $data; // Set the new session state. - $session = JFactory::getSession(); - $session->set('_finder.state', $data); + JFactory::getSession()->set('_finder.state', $data); return true; } @@ -232,8 +229,7 @@ public static function resetState() self::$state = null; // Reset the session state to null. - $session = JFactory::getSession(); - $session->set('_finder.state', null); + JFactory::getSession()->set('_finder.state', null); } /** @@ -284,13 +280,14 @@ abstract public function optimize(); protected static function getSignature($item) { // Get the indexer state. - $state = self::getState(); + $state = static::getState(); // Get the relevant configuration variables. - $config = array(); - $config[] = $state->weights; - $config[] = $state->options->get('stem', 1); - $config[] = $state->options->get('stemmer', 'porter_en'); + $config = array( + $state->weights, + $state->options->get('stem', 1), + $state->options->get('stemmer', 'porter_en') + ); return md5(serialize(array($item, $config))); } @@ -298,10 +295,8 @@ protected static function getSignature($item) /** * Method to parse input, tokenize it, and then add it to the database. * - * @param mixed $input String or resource to use as input. A resource - * input will automatically be chunked to conserve - * memory. Strings will be chunked if longer than - * 2K in size. + * @param mixed $input String or resource to use as input. A resource input will automatically be chunked to conserve + * memory. Strings will be chunked if longer than 2K in size. * @param integer $context The context of the input. See context constants. * @param string $lang The language of the input. * @param string $format The format of the input. @@ -373,7 +368,7 @@ protected function tokenizeToDb($input, $context, $lang, $format) $count += $this->addTokensToDb($tokens, $context); // Check if we're approaching the memory limit of the token table. - if ($count > self::$state->options->get('memory_table_limit', 30000)) + if ($count > static::$state->options->get('memory_table_limit', 30000)) { $this->toggleTables(false); } @@ -428,7 +423,7 @@ protected function tokenizeToDb($input, $context, $lang, $format) $count += $this->addTokensToDb($tokens, $context); // Check if we're approaching the memory limit of the token table. - if ($count > self::$state->options->get('memory_table_limit', 30000)) + if ($count > static::$state->options->get('memory_table_limit', 30000)) { $this->toggleTables(false); } diff --git a/administrator/components/com_finder/helpers/indexer/parser.php b/administrator/components/com_finder/helpers/indexer/parser.php index d52023af23315..ff538ce0139a1 100644 --- a/administrator/components/com_finder/helpers/indexer/parser.php +++ b/administrator/components/com_finder/helpers/indexer/parser.php @@ -48,18 +48,16 @@ public static function getInstance($format) $class = 'FinderIndexerParser' . ucfirst($format); // Check if a parser exists for the format. - if (file_exists($path)) - { - // Instantiate the parser. - include_once $path; - $instances[$format] = new $class; - } - else + if (!file_exists($path)) { // Throw invalid format exception. throw new Exception(JText::sprintf('COM_FINDER_INDEXER_INVALID_PARSER', $format)); } + // Instantiate the parser. + include_once $path; + $instances[$format] = new $class; + return $instances[$format]; } diff --git a/administrator/components/com_finder/helpers/indexer/parser/html.php b/administrator/components/com_finder/helpers/indexer/parser/html.php index 44dc4db3d4df3..16bbe283a7e3d 100644 --- a/administrator/components/com_finder/helpers/indexer/parser/html.php +++ b/administrator/components/com_finder/helpers/indexer/parser/html.php @@ -80,9 +80,7 @@ public function parse($input) protected function process($input) { // Replace any amount of white space with a single space. - $input = preg_replace('#\s+#u', ' ', $input); - - return $input; + return preg_replace('#\s+#u', ' ', $input); } /** @@ -102,7 +100,6 @@ protected function process($input) private function removeBlocks($input, $startTag, $endTag) { $return = ''; - $blocks = array(); $offset = 0; $startTagLength = strlen($startTag); $endTagLength = strlen($endTag); diff --git a/administrator/components/com_finder/helpers/indexer/query.php b/administrator/components/com_finder/helpers/indexer/query.php index 2e530888a8c86..76d0b3e30b8f0 100644 --- a/administrator/components/com_finder/helpers/indexer/query.php +++ b/administrator/components/com_finder/helpers/indexer/query.php @@ -290,8 +290,7 @@ public function toUri($base = null) } // Get the filters in the request. - $input = JFactory::getApplication()->input; - $t = $input->request->get('t', array(), 'array'); + $t = JFactory::getApplication()->input->request->get('t', array(), 'array'); // Add the dynamic taxonomy filters if present. if (!empty($this->filters)) @@ -380,9 +379,8 @@ public function getExcludedTermIds() // Sanitize the terms. $results = array_unique($results); - $results = ArrayHelper::toInteger($results); - return $results; + return ArrayHelper::toInteger($results); } /** @@ -487,8 +485,7 @@ protected function processStaticTaxonomy($filterId) $db = JFactory::getDbo(); // Initialize user variables - $user = JFactory::getUser(); - $groups = implode(',', $user->getAuthorisedViewLevels()); + $groups = implode(',', JFactory::getUser()->getAuthorisedViewLevels()); // Load the predefined filter. $query = $db->getQuery(true) @@ -581,8 +578,7 @@ protected function processStaticTaxonomy($filterId) protected function processDynamicTaxonomy($filters) { // Initialize user variables - $user = JFactory::getUser(); - $groups = implode(',', $user->getAuthorisedViewLevels()); + $groups = implode(',', JFactory::getUser()->getAuthorisedViewLevels()); // Remove duplicates and sanitize. $filters = array_unique($filters); @@ -683,8 +679,7 @@ protected function processDates($date1, $date2, $when1, $when2) // The value of 'today' is a special case that we need to handle. if ($date1 === JString::strtolower(JText::_('COM_FINDER_QUERY_FILTER_TODAY'))) { - $today = JFactory::getDate('now', $offset); - $date1 = $today->format('%Y-%m-%d'); + $date1 = JFactory::getDate('now', $offset)->format('%Y-%m-%d'); } // Try to parse the date string. @@ -701,8 +696,7 @@ protected function processDates($date1, $date2, $when1, $when2) // The value of 'today' is a special case that we need to handle. if ($date2 === JString::strtolower(JText::_('COM_FINDER_QUERY_FILTER_TODAY'))) { - $today = JFactory::getDate('now', $offset); - $date2 = $today->format('%Y-%m-%d'); + $date2 = JFactory::getDate('now', $offset)->format('%Y-%m-%d'); } // Try to parse the date string. @@ -809,8 +803,7 @@ protected function processString($input, $lang, $mode) // The value of 'today' is a special case that we need to handle. if ($value === JString::strtolower(JText::_('COM_FINDER_QUERY_FILTER_TODAY'))) { - $today = JFactory::getDate('now', $offset); - $value = $today->format('%Y-%m-%d'); + $value = JFactory::getDate('now', $offset)->format('%Y-%m-%d'); } // Try to parse the date string. diff --git a/administrator/components/com_finder/helpers/indexer/result.php b/administrator/components/com_finder/helpers/indexer/result.php index ef7ad089c8488..78bcb6addde6d 100644 --- a/administrator/components/com_finder/helpers/indexer/result.php +++ b/administrator/components/com_finder/helpers/indexer/result.php @@ -207,12 +207,11 @@ public function __construct() */ public function __set($name, $value) { - $this->elements[$name] = $value; + $this->setElement($name, $value); } /** - * The magic get method is used to retrieve additional element values - * from the elements array. + * The magic get method is used to retrieve additional element values from the elements array. * * @param string $name The name of the element. * @@ -222,20 +221,11 @@ public function __set($name, $value) */ public function __get($name) { - // Get the element value if set. - if (array_key_exists($name, $this->elements)) - { - return $this->elements[$name]; - } - else - { - return null; - } + return $this->getElement($name); } /** - * The magic isset method is used to check the state of additional element - * values in the elements array. + * The magic isset method is used to check the state of additional element values in the elements array. * * @param string $name The name of the element. * @@ -249,8 +239,7 @@ public function __isset($name) } /** - * The magic unset method is used to unset additional element values in the - * elements array. + * The magic unset method is used to unset additional element values in the elements array. * * @param string $name The name of the element. * @@ -279,10 +268,8 @@ public function getElement($name) { return $this->elements[$name]; } - else - { - return null; - } + + return null; } /** diff --git a/administrator/components/com_finder/helpers/indexer/stemmer.php b/administrator/components/com_finder/helpers/indexer/stemmer.php index 1629c2bc4ff90..c5e0582bfd322 100644 --- a/administrator/components/com_finder/helpers/indexer/stemmer.php +++ b/administrator/components/com_finder/helpers/indexer/stemmer.php @@ -56,18 +56,16 @@ public static function getInstance($adapter) $class = 'FinderIndexerStemmer' . ucfirst($adapter); // Check if a stemmer exists for the adapter. - if (file_exists($path)) - { - // Instantiate the stemmer. - include_once $path; - $instances[$adapter] = new $class; - } - else + if (!file_exists($path)) { // Throw invalid adapter exception. throw new Exception(JText::sprintf('COM_FINDER_INDEXER_INVALID_STEMMER', $adapter)); } + // Instantiate the stemmer. + include_once $path; + $instances[$adapter] = new $class; + return $instances[$adapter]; } diff --git a/administrator/components/com_finder/helpers/indexer/stemmer/fr.php b/administrator/components/com_finder/helpers/indexer/stemmer/fr.php index 1ce973c626a5d..7f40a5ed832ef 100644 --- a/administrator/components/com_finder/helpers/indexer/stemmer/fr.php +++ b/administrator/components/com_finder/helpers/indexer/stemmer/fr.php @@ -27,7 +27,7 @@ class FinderIndexerStemmerFr extends FinderIndexerStemmer * @var array * @since 3.0 */ - private static $_stemRules = null; + private static $stemRules = null; /** * Method to stem a token and return the root. @@ -57,7 +57,7 @@ public function stem($token, $lang) if (!isset($this->cache[$lang][$token])) { // Stem the token. - $result = static::_getStem($token); + $result = self::getStem($token); // Add the token to the cache. $this->cache[$lang][$token] = $result; @@ -75,9 +75,9 @@ public function stem($token, $lang) */ protected static function getStemRules() { - if (static::$_stemRules) + if (self::$stemRules) { - return static::$_stemRules; + return self::$stemRules; } $vars = array(); @@ -134,9 +134,9 @@ protected static function getStemRules() 'eya2i.', 'ya1i.', 'yo1i.', 'esu1.', 'ugi1.', 'tt1.', 'end0.' ); - static::$_stemRules = $vars; + self::$stemRules = $vars; - return static::$_stemRules; + return self::$stemRules; } /** @@ -151,7 +151,7 @@ protected static function getStemRules() * * @since 3.0 */ - private static function _getFirstRule($reversed_input, $rule_number) + private static function getFirstRule($reversed_input, $rule_number) { $vars = static::getStemRules(); @@ -181,7 +181,7 @@ private static function _getFirstRule($reversed_input, $rule_number) * * @since 3.0 */ - private static function _check($reversed_stem) + private static function check($reversed_stem) { $vars = static::getStemRules(); @@ -212,7 +212,7 @@ private static function _check($reversed_stem) * * @since 3.0 */ - private static function _getStem($input) + private static function getStem($input) { $vars = static::getStemRules(); @@ -223,7 +223,7 @@ private static function _getStem($input) // This loop goes through the rules' array until it finds an ending one (ending by '.') or the last one ('end0.') while (true) { - $rule_number = static::_getFirstRule($reversed_input, $rule_number); + $rule_number = self::getFirstRule($reversed_input, $rule_number); if ($rule_number == -1) { @@ -238,7 +238,7 @@ private static function _getStem($input) { $reversed_stem = utf8_decode($matches[4]) . substr($reversed_input, $matches[3], strlen($reversed_input) - $matches[3]); - if (self::_check($reversed_stem)) + if (self::check($reversed_stem)) { $reversed_input = $reversed_stem; diff --git a/administrator/components/com_finder/helpers/indexer/stemmer/porter_en.php b/administrator/components/com_finder/helpers/indexer/stemmer/porter_en.php index 3963243854ba6..340a82d1e3f07 100644 --- a/administrator/components/com_finder/helpers/indexer/stemmer/porter_en.php +++ b/administrator/components/com_finder/helpers/indexer/stemmer/porter_en.php @@ -27,7 +27,7 @@ class FinderIndexerStemmerPorter_En extends FinderIndexerStemmer * @var string * @since 2.5 */ - private static $_regex_consonant = '(?:[bcdfghjklmnpqrstvwxz]|(?<=[aeiou])y|^y)'; + private static $regex_consonant = '(?:[bcdfghjklmnpqrstvwxz]|(?<=[aeiou])y|^y)'; /** * Regex for matching a vowel @@ -35,7 +35,7 @@ class FinderIndexerStemmerPorter_En extends FinderIndexerStemmer * @var string * @since 2.5 */ - private static $_regex_vowel = '(?:[aeiou]|(?cache[$lang][$token] = $result; @@ -89,37 +89,37 @@ public function stem($token, $lang) * * @since 2.5 */ - private static function _step1ab($word) + private static function step1ab($word) { // Part a if (substr($word, -1) == 's') { - self::_replace($word, 'sses', 'ss') - or self::_replace($word, 'ies', 'i') - or self::_replace($word, 'ss', 'ss') - or self::_replace($word, 's', ''); + self::replace($word, 'sses', 'ss') + or self::replace($word, 'ies', 'i') + or self::replace($word, 'ss', 'ss') + or self::replace($word, 's', ''); } // Part b - if (substr($word, -2, 1) != 'e' or !self::_replace($word, 'eed', 'ee', 0)) + if (substr($word, -2, 1) != 'e' or !self::replace($word, 'eed', 'ee', 0)) { // First rule - $v = self::$_regex_vowel; + $v = self::$regex_vowel; // Words ending with ing and ed // Note use of && and OR, for precedence reasons - if (preg_match("#$v+#", substr($word, 0, -3)) && self::_replace($word, 'ing', '') - or preg_match("#$v+#", substr($word, 0, -2)) && self::_replace($word, 'ed', '')) + if (preg_match("#$v+#", substr($word, 0, -3)) && self::replace($word, 'ing', '') + or preg_match("#$v+#", substr($word, 0, -2)) && self::replace($word, 'ed', '')) { // If one of above two test successful - if (!self::_replace($word, 'at', 'ate') and !self::_replace($word, 'bl', 'ble') and !self::_replace($word, 'iz', 'ize')) + if (!self::replace($word, 'at', 'ate') and !self::replace($word, 'bl', 'ble') and !self::replace($word, 'iz', 'ize')) { // Double consonant ending - if (self::_doubleConsonant($word) and substr($word, -2) != 'll' and substr($word, -2) != 'ss' and substr($word, -2) != 'zz') + if (self::doubleConsonant($word) and substr($word, -2) != 'll' and substr($word, -2) != 'ss' and substr($word, -2) != 'zz') { $word = substr($word, 0, -1); } - elseif (self::_m($word) == 1 and self::_cvc($word)) + elseif (self::m($word) == 1 and self::cvc($word)) { $word .= 'e'; } @@ -139,13 +139,13 @@ private static function _step1ab($word) * * @since 2.5 */ - private static function _step1c($word) + private static function step1c($word) { - $v = self::$_regex_vowel; + $v = self::$regex_vowel; if (substr($word, -1) == 'y' && preg_match("#$v+#", substr($word, 0, -1))) { - self::_replace($word, 'y', 'i'); + self::replace($word, 'y', 'i'); } return $word; @@ -160,46 +160,46 @@ private static function _step1c($word) * * @since 2.5 */ - private static function _step2($word) + private static function step2($word) { switch (substr($word, -2, 1)) { case 'a': - self::_replace($word, 'ational', 'ate', 0) - or self::_replace($word, 'tional', 'tion', 0); + self::replace($word, 'ational', 'ate', 0) + or self::replace($word, 'tional', 'tion', 0); break; case 'c': - self::_replace($word, 'enci', 'ence', 0) - or self::_replace($word, 'anci', 'ance', 0); + self::replace($word, 'enci', 'ence', 0) + or self::replace($word, 'anci', 'ance', 0); break; case 'e': - self::_replace($word, 'izer', 'ize', 0); + self::replace($word, 'izer', 'ize', 0); break; case 'g': - self::_replace($word, 'logi', 'log', 0); + self::replace($word, 'logi', 'log', 0); break; case 'l': - self::_replace($word, 'entli', 'ent', 0) - or self::_replace($word, 'ousli', 'ous', 0) - or self::_replace($word, 'alli', 'al', 0) - or self::_replace($word, 'bli', 'ble', 0) - or self::_replace($word, 'eli', 'e', 0); + self::replace($word, 'entli', 'ent', 0) + or self::replace($word, 'ousli', 'ous', 0) + or self::replace($word, 'alli', 'al', 0) + or self::replace($word, 'bli', 'ble', 0) + or self::replace($word, 'eli', 'e', 0); break; case 'o': - self::_replace($word, 'ization', 'ize', 0) - or self::_replace($word, 'ation', 'ate', 0) - or self::_replace($word, 'ator', 'ate', 0); + self::replace($word, 'ization', 'ize', 0) + or self::replace($word, 'ation', 'ate', 0) + or self::replace($word, 'ator', 'ate', 0); break; case 's': - self::_replace($word, 'iveness', 'ive', 0) - or self::_replace($word, 'fulness', 'ful', 0) - or self::_replace($word, 'ousness', 'ous', 0) - or self::_replace($word, 'alism', 'al', 0); + self::replace($word, 'iveness', 'ive', 0) + or self::replace($word, 'fulness', 'ful', 0) + or self::replace($word, 'ousness', 'ous', 0) + or self::replace($word, 'alism', 'al', 0); break; case 't': - self::_replace($word, 'biliti', 'ble', 0) - or self::_replace($word, 'aliti', 'al', 0) - or self::_replace($word, 'iviti', 'ive', 0); + self::replace($word, 'biliti', 'ble', 0) + or self::replace($word, 'aliti', 'al', 0) + or self::replace($word, 'iviti', 'ive', 0); break; } @@ -215,28 +215,28 @@ private static function _step2($word) * * @since 2.5 */ - private static function _step3($word) + private static function step3($word) { switch (substr($word, -2, 1)) { case 'a': - self::_replace($word, 'ical', 'ic', 0); + self::replace($word, 'ical', 'ic', 0); break; case 's': - self::_replace($word, 'ness', '', 0); + self::replace($word, 'ness', '', 0); break; case 't': - self::_replace($word, 'icate', 'ic', 0) - or self::_replace($word, 'iciti', 'ic', 0); + self::replace($word, 'icate', 'ic', 0) + or self::replace($word, 'iciti', 'ic', 0); break; case 'u': - self::_replace($word, 'ful', '', 0); + self::replace($word, 'ful', '', 0); break; case 'v': - self::_replace($word, 'ative', '', 0); + self::replace($word, 'ative', '', 0); break; case 'z': - self::_replace($word, 'alize', 'al', 0); + self::replace($word, 'alize', 'al', 0); break; } @@ -252,58 +252,58 @@ private static function _step3($word) * * @since 2.5 */ - private static function _step4($word) + private static function step4($word) { switch (substr($word, -2, 1)) { case 'a': - self::_replace($word, 'al', '', 1); + self::replace($word, 'al', '', 1); break; case 'c': - self::_replace($word, 'ance', '', 1) - or self::_replace($word, 'ence', '', 1); + self::replace($word, 'ance', '', 1) + or self::replace($word, 'ence', '', 1); break; case 'e': - self::_replace($word, 'er', '', 1); + self::replace($word, 'er', '', 1); break; case 'i': - self::_replace($word, 'ic', '', 1); + self::replace($word, 'ic', '', 1); break; case 'l': - self::_replace($word, 'able', '', 1) - or self::_replace($word, 'ible', '', 1); + self::replace($word, 'able', '', 1) + or self::replace($word, 'ible', '', 1); break; case 'n': - self::_replace($word, 'ant', '', 1) - or self::_replace($word, 'ement', '', 1) - or self::_replace($word, 'ment', '', 1) - or self::_replace($word, 'ent', '', 1); + self::replace($word, 'ant', '', 1) + or self::replace($word, 'ement', '', 1) + or self::replace($word, 'ment', '', 1) + or self::replace($word, 'ent', '', 1); break; case 'o': if (substr($word, -4) == 'tion' or substr($word, -4) == 'sion') { - self::_replace($word, 'ion', '', 1); + self::replace($word, 'ion', '', 1); } else { - self::_replace($word, 'ou', '', 1); + self::replace($word, 'ou', '', 1); } break; case 's': - self::_replace($word, 'ism', '', 1); + self::replace($word, 'ism', '', 1); break; case 't': - self::_replace($word, 'ate', '', 1) - or self::_replace($word, 'iti', '', 1); + self::replace($word, 'ate', '', 1) + or self::replace($word, 'iti', '', 1); break; case 'u': - self::_replace($word, 'ous', '', 1); + self::replace($word, 'ous', '', 1); break; case 'v': - self::_replace($word, 'ive', '', 1); + self::replace($word, 'ive', '', 1); break; case 'z': - self::_replace($word, 'ize', '', 1); + self::replace($word, 'ize', '', 1); break; } @@ -319,26 +319,26 @@ private static function _step4($word) * * @since 2.5 */ - private static function _step5($word) + private static function step5($word) { // Part a if (substr($word, -1) == 'e') { - if (self::_m(substr($word, 0, -1)) > 1) + if (self::m(substr($word, 0, -1)) > 1) { - self::_replace($word, 'e', ''); + self::replace($word, 'e', ''); } - elseif (self::_m(substr($word, 0, -1)) == 1) + elseif (self::m(substr($word, 0, -1)) == 1) { - if (!self::_cvc(substr($word, 0, -1))) + if (!self::cvc(substr($word, 0, -1))) { - self::_replace($word, 'e', ''); + self::replace($word, 'e', ''); } } } // Part b - if (self::_m($word) > 1 and self::_doubleConsonant($word) and substr($word, -1) == 'l') + if (self::m($word) > 1 and self::doubleConsonant($word) and substr($word, -1) == 'l') { $word = substr($word, 0, -1); } @@ -361,7 +361,7 @@ private static function _step5($word) * * @since 2.5 */ - private static function _replace(&$str, $check, $repl, $m = null) + private static function replace(&$str, $check, $repl, $m = null) { $len = 0 - strlen($check); @@ -369,7 +369,7 @@ private static function _replace(&$str, $check, $repl, $m = null) { $substr = substr($str, 0, $len); - if (is_null($m) or self::_m($substr) > $m) + if (is_null($m) or self::m($substr) > $m) { $str = $substr . $repl; } @@ -396,10 +396,10 @@ private static function _replace(&$str, $check, $repl, $m = null) * * @since 2.5 */ - private static function _m($str) + private static function m($str) { - $c = self::$_regex_consonant; - $v = self::$_regex_vowel; + $c = self::$regex_consonant; + $v = self::$regex_vowel; $str = preg_replace("#^$c+#", '', $str); $str = preg_replace("#$v+$#", '', $str); @@ -419,9 +419,9 @@ private static function _m($str) * * @since 2.5 */ - private static function _doubleConsonant($str) + private static function doubleConsonant($str) { - $c = self::$_regex_consonant; + $c = self::$regex_consonant; return preg_match("#$c{2}$#", $str, $matches) and $matches[0]{0} == $matches[0]{1}; } @@ -435,10 +435,10 @@ private static function _doubleConsonant($str) * * @since 2.5 */ - private static function _cvc($str) + private static function cvc($str) { - $c = self::$_regex_consonant; - $v = self::$_regex_vowel; + $c = self::$regex_consonant; + $v = self::$regex_vowel; return preg_match("#($c$v$c)$#", $str, $matches) and strlen($matches[1]) == 3 and $matches[1]{2} != 'w' and $matches[1]{2} != 'x' and $matches[1]{2} != 'y'; diff --git a/administrator/components/com_finder/helpers/indexer/taxonomy.php b/administrator/components/com_finder/helpers/indexer/taxonomy.php index 447829d49f518..9a9c9a831a87e 100644 --- a/administrator/components/com_finder/helpers/indexer/taxonomy.php +++ b/administrator/components/com_finder/helpers/indexer/taxonomy.php @@ -47,9 +47,9 @@ class FinderIndexerTaxonomy public static function addBranch($title, $state = 1, $access = 1) { // Check to see if the branch is in the cache. - if (isset(self::$branches[$title])) + if (isset(static::$branches[$title])) { - return self::$branches[$title]->id; + return static::$branches[$title]->id; } // Check to see if the branch is in the table. @@ -68,9 +68,9 @@ public static function addBranch($title, $state = 1, $access = 1) if (!empty($result) && $result->state == $state && $result->access == $access) { // The data matches, add the item to the cache. - self::$branches[$title] = $result; + static::$branches[$title] = $result; - return self::$branches[$title]->id; + return static::$branches[$title]->id; } /* @@ -100,12 +100,12 @@ public static function addBranch($title, $state = 1, $access = 1) } // Store the branch. - self::storeNode($branch); + static::storeNode($branch); // Add the branch to the cache. - self::$branches[$title] = $branch; + static::$branches[$title] = $branch; - return self::$branches[$title]->id; + return static::$branches[$title]->id; } /** @@ -124,13 +124,13 @@ public static function addBranch($title, $state = 1, $access = 1) public static function addNode($branch, $title, $state = 1, $access = 1) { // Check to see if the node is in the cache. - if (isset(self::$nodes[$branch][$title])) + if (isset(static::$nodes[$branch][$title])) { - return self::$nodes[$branch][$title]->id; + return static::$nodes[$branch][$title]->id; } // Get the branch id, insert it if it does not exist. - $branchId = self::addBranch($branch); + $branchId = static::addBranch($branch); // Check to see if the node is in the table. $db = JFactory::getDbo(); @@ -148,9 +148,9 @@ public static function addNode($branch, $title, $state = 1, $access = 1) if (!empty($result) && $result->state == $state && $result->access == $access) { // The data matches, add the item to the cache. - self::$nodes[$branch][$title] = $result; + static::$nodes[$branch][$title] = $result; - return self::$nodes[$branch][$title]->id; + return static::$nodes[$branch][$title]->id; } /* @@ -180,12 +180,12 @@ public static function addNode($branch, $title, $state = 1, $access = 1) } // Store the node. - self::storeNode($node); + static::storeNode($node); // Add the node to the cache. - self::$nodes[$branch][$title] = $node; + static::$nodes[$branch][$title] = $node; - return self::$nodes[$branch][$title]->id; + return static::$nodes[$branch][$title]->id; } /** @@ -242,8 +242,7 @@ public static function getBranchTitles() $db = JFactory::getDbo(); // Set user variables - $user = JFactory::getUser(); - $groups = implode(',', $user->getAuthorisedViewLevels()); + $groups = implode(',', JFactory::getUser()->getAuthorisedViewLevels()); // Create a query to get the taxonomy branch titles. $query = $db->getQuery(true) @@ -255,9 +254,8 @@ public static function getBranchTitles() // Get the branch titles. $db->setQuery($query); - $results = $db->loadColumn(); - return $results; + return $db->loadColumn(); } /** @@ -276,8 +274,7 @@ public static function getNodeByTitle($branch, $title) $db = JFactory::getDbo(); // Set user variables - $user = JFactory::getUser(); - $groups = implode(',', $user->getAuthorisedViewLevels()); + $groups = implode(',', JFactory::getUser()->getAuthorisedViewLevels()); // Create a query to get the node. $query = $db->getQuery(true) @@ -293,9 +290,8 @@ public static function getNodeByTitle($branch, $title) // Get the node. $db->setQuery($query, 0, 1); - $result = $db->loadObject(); - return $result; + return $db->loadObject(); } /** diff --git a/administrator/components/com_finder/helpers/language.php b/administrator/components/com_finder/helpers/language.php index b738729acc102..a7bf2103fbdd1 100644 --- a/administrator/components/com_finder/helpers/language.php +++ b/administrator/components/com_finder/helpers/language.php @@ -33,10 +33,8 @@ public static function branchPlural($branchName) { return 'PLG_FINDER_QUERY_FILTER_BRANCH_P_' . $return; } - else - { - return $branchName; - } + + return $branchName; } /** @@ -93,8 +91,7 @@ public static function branchLanguageTitle($branchName) */ public static function loadComponentLanguage() { - $lang = JFactory::getLanguage(); - $lang->load('com_finder', JPATH_SITE); + JFactory::getLanguage()->load('com_finder', JPATH_SITE); } /** diff --git a/administrator/components/com_finder/models/fields/directories.php b/administrator/components/com_finder/models/fields/directories.php index 2ccb80d9d952f..a65657b02d3f9 100644 --- a/administrator/components/com_finder/models/fields/directories.php +++ b/administrator/components/com_finder/models/fields/directories.php @@ -12,7 +12,7 @@ JFormHelper::loadFieldClass('list'); // Load the base adapter. -require_once JPATH_ADMINISTRATOR . '/components/com_finder/helpers/indexer/adapter.php'; +JLoader::register('FinderIndexerAdapter', JPATH_ADMINISTRATOR . '/components/com_finder/helpers/indexer/adapter.php'); /** * Renders a list of directories. diff --git a/administrator/components/com_finder/models/filter.php b/administrator/components/com_finder/models/filter.php index db7ff44ffd79b..9322e019a6ff2 100644 --- a/administrator/components/com_finder/models/filter.php +++ b/administrator/components/com_finder/models/filter.php @@ -50,7 +50,7 @@ protected function cleanCache($group = 'com_finder', $client_id = 1) /** * Method to get the filter data. * - * @return mixed The filter data. + * @return FinderTableFilter|boolean The filter data or false on a failure. * * @since 2.5 */ @@ -99,7 +99,7 @@ public function getFilter() * @param array $data Data for the form. [optional] * @param boolean $loadData True if the form is to load its own data (default case), false if not. [optional] * - * @return mixed A JForm object on success, false on failure + * @return JForm|boolean A JForm object on success, false on failure * * @since 2.5 */ diff --git a/administrator/components/com_finder/models/filters.php b/administrator/components/com_finder/models/filters.php index 0a0dd21cab37a..ab1ee4c7d0229 100644 --- a/administrator/components/com_finder/models/filters.php +++ b/administrator/components/com_finder/models/filters.php @@ -22,7 +22,7 @@ class FinderModelFilters extends JModelList * @param array $config An associative array of configuration settings. [optional] * * @since 2.5 - * @see JController + * @see JControllerLegacy */ public function __construct($config = array()) { diff --git a/administrator/components/com_finder/models/index.php b/administrator/components/com_finder/models/index.php index 2690f8376cbf2..152ae7e1524ee 100644 --- a/administrator/components/com_finder/models/index.php +++ b/administrator/components/com_finder/models/index.php @@ -38,7 +38,7 @@ class FinderModelIndex extends JModelList * @param array $config An associative array of configuration settings. [optional] * * @since 2.5 - * @see JController + * @see JControllerLegacy */ public function __construct($config = array()) { @@ -69,9 +69,7 @@ public function __construct($config = array()) */ protected function canDelete($record) { - $user = JFactory::getUser(); - - return $user->authorise('core.delete', $this->option); + return JFactory::getUser()->authorise('core.delete', $this->option); } /** @@ -85,9 +83,7 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - - return $user->authorise('core.edit.state', $this->option); + return JFactory::getUser()->authorise('core.edit.state', $this->option); } /** @@ -246,7 +242,7 @@ protected function getListQuery() /** * Method to get the state of the Smart Search plug-ins. * - * @return array Array of relevant plug-ins and whether they are enabled or not. + * @return array Array of relevant plug-ins and whether they are enabled or not. * * @since 2.5 */ @@ -260,10 +256,8 @@ public function getPluginState() ->where($db->quoteName('folder') . ' IN (' . $db->quote('system') . ',' . $db->quote('content') . ')') ->where($db->quoteName('element') . ' = ' . $db->quote('finder')); $db->setQuery($query); - $db->execute(); - $plugins = $db->loadObjectList('name'); - return $plugins; + return $db->loadObjectList('name'); } /** diff --git a/administrator/components/com_finder/models/maps.php b/administrator/components/com_finder/models/maps.php index c60e7383a4945..bd194b823cb06 100644 --- a/administrator/components/com_finder/models/maps.php +++ b/administrator/components/com_finder/models/maps.php @@ -22,7 +22,7 @@ class FinderModelMaps extends JModelList * @param array $config An associative array of configuration settings. [optional] * * @since 2.5 - * @see JController + * @see JControllerLegacy */ public function __construct($config = array()) { @@ -51,9 +51,7 @@ public function __construct($config = array()) */ protected function canDelete($record) { - $user = JFactory::getUser(); - - return $user->authorise('core.delete', $this->option); + return JFactory::getUser()->authorise('core.delete', $this->option); } /** @@ -67,9 +65,7 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - - return $user->authorise('core.edit.state', $this->option); + return JFactory::getUser()->authorise('core.edit.state', $this->option); } /** diff --git a/administrator/components/com_finder/models/statistics.php b/administrator/components/com_finder/models/statistics.php index 045081d6579ae..6ef5f71df0342 100644 --- a/administrator/components/com_finder/models/statistics.php +++ b/administrator/components/com_finder/models/statistics.php @@ -19,7 +19,7 @@ class FinderModelStatistics extends JModelLegacy /** * Method to get the component statistics * - * @return object The component statistics + * @return JObject The component statistics * * @since 2.5 */ @@ -60,7 +60,7 @@ public function getData() ->from($db->quoteName('#__finder_links') . ' AS a') ->join('INNER', $db->quoteName('#__finder_types') . ' AS t ON t.id = a.type_id') ->group('a.type_id, t.title') - ->order($db->quoteName('type_title'), 'ASC'); + ->order($db->quoteName('type_title') . ' ASC'); $db->setQuery($query); $data->type_list = $db->loadObjectList(); diff --git a/administrator/components/com_finder/tables/filter.php b/administrator/components/com_finder/tables/filter.php index 9b1ed5606faa7..cd8498f6a8370 100644 --- a/administrator/components/com_finder/tables/filter.php +++ b/administrator/components/com_finder/tables/filter.php @@ -204,15 +204,15 @@ public function publish($pks = null, $state = 1, $userId = 0) */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = JFactory::getDate()->toSql(); + $userId = JFactory::getUser()->id; - $this->modified = $date->toSql(); + $this->modified = $date; if ($this->filter_id) { // Existing item - $this->modified_by = $user->get('id'); + $this->modified_by = $userId; } else { @@ -220,12 +220,12 @@ public function store($updateNulls = false) // so we don't touch it if it is set. if (!(int) $this->created) { - $this->created = $date->toSql(); + $this->created = $date; } if (empty($this->created_by)) { - $this->created_by = $user->get('id'); + $this->created_by = $userId; } } diff --git a/administrator/components/com_finder/views/filter/view.html.php b/administrator/components/com_finder/views/filter/view.html.php index 2bd7166cc32c2..9e860095282ff 100644 --- a/administrator/components/com_finder/views/filter/view.html.php +++ b/administrator/components/com_finder/views/filter/view.html.php @@ -16,6 +16,34 @@ */ class FinderViewFilter extends JViewLegacy { + /** + * The filter object + * + * @var FinderTableFilter + */ + protected $filter; + + /** + * The JForm object + * + * @var JForm + */ + protected $form; + + /** + * The active item + * + * @var object + */ + protected $item; + + /** + * The model state + * + * @var object + */ + protected $state; + /** * Method to display the view. * @@ -48,7 +76,7 @@ public function display($tpl = null) // Configure the toolbar. $this->addToolbar(); - parent::display($tpl); + return parent::display($tpl); } /** @@ -62,10 +90,8 @@ protected function addToolbar() { JFactory::getApplication()->input->set('hidemainmenu', true); - $user = JFactory::getUser(); - $userId = $user->get('id'); $isNew = ($this->item->filter_id == 0); - $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $userId); + $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == JFactory::getUser()->id); $canDo = JHelperContent::getActions('com_finder'); // Configure the toolbar. diff --git a/administrator/components/com_finder/views/filters/view.html.php b/administrator/components/com_finder/views/filters/view.html.php index c08a3269cf08d..1132f206a5f6c 100644 --- a/administrator/components/com_finder/views/filters/view.html.php +++ b/administrator/components/com_finder/views/filters/view.html.php @@ -16,6 +16,41 @@ */ class FinderViewFilters extends JViewLegacy { + /** + * An array of items + * + * @var array + */ + protected $items; + + /** + * The pagination object + * + * @var JPagination + */ + protected $pagination; + + /** + * The HTML markup for the sidebar + * + * @var string + */ + protected $sidebar; + + /** + * The model state + * + * @var object + */ + protected $state; + + /** + * The total number of items + * + * @var object + */ + protected $total; + /** * Method to display the view. * @@ -50,7 +85,8 @@ public function display($tpl = null) // Configure the toolbar. $this->addToolbar(); $this->sidebar = JHtmlSidebar::render(); - parent::display($tpl); + + return parent::display($tpl); } /** diff --git a/administrator/components/com_finder/views/index/view.html.php b/administrator/components/com_finder/views/index/view.html.php index 416da70630477..1e17aae42fa45 100644 --- a/administrator/components/com_finder/views/index/view.html.php +++ b/administrator/components/com_finder/views/index/view.html.php @@ -18,6 +18,48 @@ */ class FinderViewIndex extends JViewLegacy { + /** + * An array of items + * + * @var array + */ + protected $items; + + /** + * The pagination object + * + * @var JPagination + */ + protected $pagination; + + /** + * The state of core Smart Search plugins + * + * @var array + */ + protected $pluginState; + + /** + * The HTML markup for the sidebar + * + * @var string + */ + protected $sidebar; + + /** + * The model state + * + * @var object + */ + protected $state; + + /** + * The total number of items + * + * @var object + */ + protected $total; + /** * Method to display the view. * @@ -71,7 +113,8 @@ public function display($tpl = null) // Configure the toolbar. $this->addToolbar(); $this->sidebar = JHtmlSidebar::render(); - parent::display($tpl); + + return parent::display($tpl); } /** diff --git a/administrator/components/com_finder/views/maps/view.html.php b/administrator/components/com_finder/views/maps/view.html.php index f14f475eca76d..e3bf2fe3e7a50 100644 --- a/administrator/components/com_finder/views/maps/view.html.php +++ b/administrator/components/com_finder/views/maps/view.html.php @@ -18,6 +18,41 @@ */ class FinderViewMaps extends JViewLegacy { + /** + * An array of items + * + * @var array + */ + protected $items; + + /** + * The pagination object + * + * @var JPagination + */ + protected $pagination; + + /** + * The HTML markup for the sidebar + * + * @var string + */ + protected $sidebar; + + /** + * The model state + * + * @var object + */ + protected $state; + + /** + * The total number of items + * + * @var object + */ + protected $total; + /** * Method to display the view. * @@ -55,7 +90,8 @@ public function display($tpl = null) // Prepare the view. $this->addToolbar(); $this->sidebar = JHtmlSidebar::render(); - parent::display($tpl); + + return parent::display($tpl); } /** @@ -70,7 +106,6 @@ protected function addToolbar() $canDo = JHelperContent::getActions('com_finder'); JToolbarHelper::title(JText::_('COM_FINDER_MAPS_TOOLBAR_TITLE'), 'zoom-in finder'); - $toolbar = JToolbar::getInstance('toolbar'); if ($canDo->get('core.edit.state')) { @@ -85,7 +120,14 @@ protected function addToolbar() } JToolbarHelper::divider(); - $toolbar->appendButton('Popup', 'bars', 'COM_FINDER_STATISTICS', 'index.php?option=com_finder&view=statistics&tmpl=component', 550, 350); + JToolbar::getInstance('toolbar')->appendButton( + 'Popup', + 'bars', + 'COM_FINDER_STATISTICS', + 'index.php?option=com_finder&view=statistics&tmpl=component', + 550, + 350 + ); JToolbarHelper::divider(); JToolbarHelper::help('JHELP_COMPONENTS_FINDER_MANAGE_CONTENT_MAPS'); diff --git a/administrator/components/com_finder/views/statistics/view.html.php b/administrator/components/com_finder/views/statistics/view.html.php index 46271af2585fc..6f72e5d0aa81d 100644 --- a/administrator/components/com_finder/views/statistics/view.html.php +++ b/administrator/components/com_finder/views/statistics/view.html.php @@ -16,6 +16,13 @@ */ class FinderViewStatistics extends JViewLegacy { + /** + * The index statistics + * + * @var JObject + */ + protected $data; + /** * Method to display the view. * @@ -38,6 +45,6 @@ public function display($tpl = null) return false; } - parent::display($tpl); + return parent::display($tpl); } } diff --git a/administrator/components/com_installer/controller.php b/administrator/components/com_installer/controller.php index 6d4e23659050d..e7484b522e8fd 100644 --- a/administrator/components/com_installer/controller.php +++ b/administrator/components/com_installer/controller.php @@ -28,7 +28,7 @@ class InstallerController extends JControllerLegacy */ public function display($cachable = false, $urlparams = false) { - require_once JPATH_ADMINISTRATOR . '/components/com_installer/helpers/installer.php'; + JLoader::register('InstallerHelper', JPATH_ADMINISTRATOR . '/components/com_installer/helpers/installer.php'); // Get the document object. $document = JFactory::getDocument(); diff --git a/administrator/components/com_installer/models/database.php b/administrator/components/com_installer/models/database.php index 808991ea4615e..b4dc2e3ec3a88 100644 --- a/administrator/components/com_installer/models/database.php +++ b/administrator/components/com_installer/models/database.php @@ -167,7 +167,11 @@ public function fixSchemaVersion($changeSet) ->values('700, ' . $db->quote($schema)); $db->setQuery($query); - if (!$db->execute()) + try + { + $db->execute(); + } + catch (JDatabaseExceptionExecuting $e) { return false; } diff --git a/administrator/components/com_installer/models/discover.php b/administrator/components/com_installer/models/discover.php index 2b02c55e4925b..5dda01ec9f0a1 100644 --- a/administrator/components/com_installer/models/discover.php +++ b/administrator/components/com_installer/models/discover.php @@ -9,7 +9,7 @@ defined('_JEXEC') or die; -require_once __DIR__ . '/extension.php'; +JLoader::register('InstallerModel', __DIR__ . '/extension.php'); /** * Installer Discover Model @@ -237,7 +237,11 @@ public function purge() ->where($db->quoteName('state') . ' = -1'); $db->setQuery($query); - if (!$db->execute()) + try + { + $db->execute(); + } + catch (JDatabaseExceptionExecuting $e) { $this->_message = JText::_('COM_INSTALLER_MSG_DISCOVER_FAILEDTOPURGEEXTENSIONS'); diff --git a/administrator/components/com_installer/models/fields/extensionstatus.php b/administrator/components/com_installer/models/fields/extensionstatus.php index f9965d5eb5a5b..1a6ef20416835 100644 --- a/administrator/components/com_installer/models/fields/extensionstatus.php +++ b/administrator/components/com_installer/models/fields/extensionstatus.php @@ -11,7 +11,7 @@ JFormHelper::loadFieldClass('list'); -require_once __DIR__ . '/../../helpers/installer.php'; +JLoader::register('InstallerHelper', JPATH_ADMINISTRATOR . '/components/com_installer/helpers/installer.php'); /** * Status Field class for the Joomla Framework. diff --git a/administrator/components/com_installer/models/fields/folder.php b/administrator/components/com_installer/models/fields/folder.php index c73d8007c5493..08dbfd35fd24a 100644 --- a/administrator/components/com_installer/models/fields/folder.php +++ b/administrator/components/com_installer/models/fields/folder.php @@ -11,7 +11,7 @@ JFormHelper::loadFieldClass('list'); -require_once __DIR__ . '/../../helpers/installer.php'; +JLoader::register('InstallerHelper', JPATH_ADMINISTRATOR . '/components/com_installer/helpers/installer.php'); /** * Folder Field class for the Joomla Framework. diff --git a/administrator/components/com_installer/models/fields/location.php b/administrator/components/com_installer/models/fields/location.php index cf440c2a1cdea..a73177b668000 100644 --- a/administrator/components/com_installer/models/fields/location.php +++ b/administrator/components/com_installer/models/fields/location.php @@ -11,7 +11,7 @@ JFormHelper::loadFieldClass('list'); -require_once __DIR__ . '/../../helpers/installer.php'; +JLoader::register('InstallerHelper', JPATH_ADMINISTRATOR . '/components/com_installer/helpers/installer.php'); /** * Location Field class for the Joomla Framework. diff --git a/administrator/components/com_installer/models/fields/type.php b/administrator/components/com_installer/models/fields/type.php index bb2e72b2d65dc..e3f01db143824 100644 --- a/administrator/components/com_installer/models/fields/type.php +++ b/administrator/components/com_installer/models/fields/type.php @@ -11,7 +11,7 @@ JFormHelper::loadFieldClass('list'); -require_once __DIR__ . '/../../helpers/installer.php'; +JLoader::register('InstallerHelper', JPATH_ADMINISTRATOR . '/components/com_installer/helpers/installer.php'); /** * Type Field class for the Joomla Framework. diff --git a/administrator/components/com_installer/models/manage.php b/administrator/components/com_installer/models/manage.php index cdd9b0486bf5f..b4490328e0760 100644 --- a/administrator/components/com_installer/models/manage.php +++ b/administrator/components/com_installer/models/manage.php @@ -9,7 +9,7 @@ defined('_JEXEC') or die; -require_once __DIR__ . '/extension.php'; +JLoader::register('InstallerModel', __DIR__ . '/extension.php'); /** * Installer Manage Model diff --git a/administrator/components/com_installer/models/update.php b/administrator/components/com_installer/models/update.php index f75fe9c3868ac..6da398fb846bd 100644 --- a/administrator/components/com_installer/models/update.php +++ b/administrator/components/com_installer/models/update.php @@ -277,7 +277,11 @@ public function purge() // This may or may not mean depending on your database $db->setQuery('TRUNCATE TABLE #__updates'); - if (!$db->execute()) + try + { + $db->execute(); + } + catch (JDatabaseExceptionExecuting $e) { $this->_message = JText::_('JLIB_INSTALLER_FAILED_TO_PURGE_UPDATES'); @@ -311,7 +315,11 @@ public function enableSites() ->where($db->quoteName('enabled') . ' = 0'); $db->setQuery($query); - if (!$db->execute()) + try + { + $db->execute(); + } + catch (JDatabaseExceptionExecuting $e) { $this->_message .= JText::_('COM_INSTALLER_FAILED_TO_ENABLE_UPDATES'); diff --git a/administrator/components/com_installer/models/updatesites.php b/administrator/components/com_installer/models/updatesites.php index d806da9bcf8fe..9532dbb683880 100644 --- a/administrator/components/com_installer/models/updatesites.php +++ b/administrator/components/com_installer/models/updatesites.php @@ -9,14 +9,12 @@ defined('_JEXEC') or die; -require_once __DIR__ . '/extension.php'; +JLoader::register('InstallerModel', __DIR__ . '/extension.php'); /** * Installer Update Sites Model * - * @package Joomla.Administrator - * @subpackage com_installer - * @since 3.4 + * @since 3.4 */ class InstallerModelUpdatesites extends InstallerModel { @@ -86,9 +84,7 @@ protected function populateState($ordering = 'name', $direction = 'asc') */ public function publish(&$eid = array(), $value = 1) { - $user = JFactory::getUser(); - - if (!$user->authorise('core.edit.state', 'com_installer')) + if (!JFactory::getUser()->authorise('core.edit.state', 'com_installer')) { throw new Exception(JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'), 403); } @@ -133,9 +129,7 @@ public function publish(&$eid = array(), $value = 1) */ public function delete($ids = array()) { - $user = JFactory::getUser(); - - if (!$user->authorise('core.delete', 'com_installer')) + if (!JFactory::getUser()->authorise('core.delete', 'com_installer')) { throw new Exception(JText::_('JLIB_APPLICATION_ERROR_DELETE_NOT_PERMITTED'), 403); } @@ -160,7 +154,7 @@ public function delete($ids = array()) $updateSitesNames = $db->loadObjectList('update_site_id'); // Gets Joomla core update sites Ids. - $joomlaUpdateSitesIds = $this->getJoomlaUpdateSitesIds(); + $joomlaUpdateSitesIds = $this->getJoomlaUpdateSitesIds(0); // Enable the update site in the table and store it in the database foreach ($ids as $i => $id) @@ -218,9 +212,7 @@ public function delete($ids = array()) */ public function rebuild() { - $user = JFactory::getUser(); - - if (!$user->authorise('core.admin', 'com_installer')) + if (!JFactory::getUser()->authorise('core.admin', 'com_installer')) { throw new Exception(JText::_('COM_INSTALLER_MSG_UPDATESITES_REBUILD_NOT_PERMITTED'), 403); } @@ -228,6 +220,25 @@ public function rebuild() $db = JFactory::getDbo(); $app = JFactory::getApplication(); + // Check if Joomla Extension plugin is enabled. + if (!JPluginHelper::isEnabled('extension', 'joomla')) + { + $query = $db->getQuery(true) + ->select($db->quoteName('extension_id')) + ->from($db->quoteName('#__extensions')) + ->where($db->quoteName('type') . ' = ' . $db->quote('plugin')) + ->where($db->quoteName('element') . ' = ' . $db->quote('joomla')) + ->where($db->quoteName('folder') . ' = ' . $db->quote('extension')); + $db->setQuery($query); + + $pluginId = (int) $db->loadResult(); + + $link = JRoute::_('index.php?option=com_plugins&task=plugin.edit&extension_id=' . $pluginId); + $app->enqueueMessage(JText::sprintf('COM_INSTALLER_MSG_UPDATESITES_REBUILD_EXTENSION_PLUGIN_NOT_ENABLED', $link), 'error'); + + return; + } + $clients = array(JPATH_SITE, JPATH_ADMINISTRATOR); $extensionGroupFolders = array('components', 'modules', 'plugins', 'templates', 'language', 'manifests'); @@ -262,29 +273,32 @@ public function rebuild() } // Gets Joomla core update sites Ids. - $joomlaUpdateSitesIds = implode(', ', $this->getJoomlaUpdateSitesIds()); + $joomlaUpdateSitesIds = implode(', ', $this->getJoomlaUpdateSitesIds(0)); // Delete from all tables (except joomla core update sites). $query = $db->getQuery(true) - ->delete($db->qn('#__update_sites')) - ->where($db->qn('update_site_id') . ' NOT IN (' . $joomlaUpdateSitesIds . ')'); + ->delete($db->quoteName('#__update_sites')) + ->where($db->quoteName('update_site_id') . ' NOT IN (' . $joomlaUpdateSitesIds . ')'); $db->setQuery($query); $db->execute(); $query = $db->getQuery(true) - ->delete($db->qn('#__update_sites_extensions')) - ->where($db->qn('update_site_id') . ' NOT IN (' . $joomlaUpdateSitesIds . ')'); + ->delete($db->quoteName('#__update_sites_extensions')) + ->where($db->quoteName('update_site_id') . ' NOT IN (' . $joomlaUpdateSitesIds . ')'); $db->setQuery($query); $db->execute(); $query = $db->getQuery(true) - ->delete($db->qn('#__updates')) - ->where($db->qn('update_site_id') . ' NOT IN (' . $joomlaUpdateSitesIds . ')'); + ->delete($db->quoteName('#__updates')) + ->where($db->quoteName('update_site_id') . ' NOT IN (' . $joomlaUpdateSitesIds . ')'); $db->setQuery($query); $db->execute(); $count = 0; + // Gets Joomla core extension Ids. + $joomlaCoreExtensionIds = implode(', ', $this->getJoomlaUpdateSitesIds(1)); + // Search for updateservers in manifest files inside the folders to search. foreach ($pathsToSearch as $extensionFolderPath) { @@ -310,13 +324,16 @@ public function rebuild() if (!is_null($manifest)) { + // Search if the extension exists in the extensions table. Excluding joomla core extensions (id < 10000) and discovered extensions. $query = $db->getQuery(true) - ->select($db->qn('extension_id')) - ->from($db->qn('#__extensions')) - ->where($db->qn('name') . ' = ' . $db->q($manifest->name)) - ->where($db->qn('type') . ' = ' . $db->q($manifest['type'])) - ->where($db->qn('state') . ' != -1'); + ->select($db->quoteName('extension_id')) + ->from($db->quoteName('#__extensions')) + ->where($db->quoteName('name') . ' = ' . $db->quote($manifest->name)) + ->where($db->quoteName('type') . ' = ' . $db->quote($manifest['type'])) + ->where($db->quoteName('extension_id') . ' NOT IN (' . $joomlaCoreExtensionIds . ')') + ->where($db->quoteName('state') . ' != -1'); $db->setQuery($query); + $eid = (int) $db->loadResult(); if ($eid && $manifest->updateservers) @@ -351,22 +368,31 @@ public function rebuild() /** * Fetch the Joomla update sites ids. * + * @param integer $column Column to return. 0 for update site ids, 1 for extension ids. + * * @return array Array with joomla core update site ids. * - * @since 3.6 + * @since 3.6.0 */ - protected function getJoomlaUpdateSitesIds() + protected function getJoomlaUpdateSitesIds($column = 0) { $db = JFactory::getDbo(); - // Fetch the Joomla core Joomla update sites ids. - $query = $db->getQuery(true); - $query->select($db->qn('update_site_id')) - ->from($db->qn('#__update_sites')) - ->where($db->qn('location') . ' LIKE \'%update.joomla.org%\''); + // Fetch the Joomla core update sites ids and their extension ids. We search for all except the core joomla extension with update sites. + $query = $db->getQuery(true) + ->select($db->quoteName(array('use.update_site_id', 'e.extension_id'))) + ->from($db->quoteName('#__update_sites_extensions', 'use')) + ->join('LEFT', $db->quoteName('#__update_sites', 'us') . ' ON ' . $db->qn('us.update_site_id') . ' = ' . $db->qn('use.update_site_id')) + ->join('LEFT', $db->quoteName('#__extensions', 'e') . ' ON ' . $db->qn('e.extension_id') . ' = ' . $db->qn('use.extension_id')) + ->where('(' + . '(' . $db->qn('e.type') . ' = ' . $db->quote('file') . ' AND ' . $db->qn('e.element') . ' = ' . $db->quote('joomla') . ')' + . ' OR (' . $db->qn('e.type') . ' = ' . $db->quote('package') . ' AND ' . $db->qn('e.element') . ' = ' . $db->quote('pkg_en-GB') . ')' + . ' OR (' . $db->qn('e.type') . ' = ' . $db->quote('component') . ' AND ' . $db->qn('e.element') . ' = ' . $db->quote('com_joomlaupdate') . ')' + . ')'); + $db->setQuery($query); - return $db->loadColumn(); + return $db->loadColumn($column); } /** diff --git a/administrator/components/com_installer/views/database/view.html.php b/administrator/components/com_installer/views/database/view.html.php index 733134cfdf632..935b82ca0496a 100644 --- a/administrator/components/com_installer/views/database/view.html.php +++ b/administrator/components/com_installer/views/database/view.html.php @@ -9,7 +9,7 @@ defined('_JEXEC') or die; -include_once __DIR__ . '/../default/view.php'; +JLoader::register('InstallerViewDefault', dirname(__DIR__) . '/default/view.php'); /** * Extension Manager Manage View @@ -60,14 +60,13 @@ public function display($tpl = null) $this->errorCount++; } - // Check error count if ($this->errorCount === 0) { $app->enqueueMessage(JText::_('COM_INSTALLER_MSG_DATABASE_OK'), 'notice'); } else { - $app->enqueueMessage(JText::_('COM_INSTALLER_MSG_DATABASE_ERRORS'), 'error'); + $app->enqueueMessage(JText::_('COM_INSTALLER_MSG_DATABASE_ERRORS'), 'warning'); } parent::display($tpl); diff --git a/administrator/components/com_installer/views/discover/view.html.php b/administrator/components/com_installer/views/discover/view.html.php index 4600284f17159..c7b312583a29f 100644 --- a/administrator/components/com_installer/views/discover/view.html.php +++ b/administrator/components/com_installer/views/discover/view.html.php @@ -9,7 +9,7 @@ defined('_JEXEC') or die; -include_once __DIR__ . '/../default/view.php'; +JLoader::register('InstallerViewDefault', dirname(__DIR__) . '/default/view.php'); /** * Extension Manager Discover View diff --git a/administrator/components/com_installer/views/install/tmpl/default.php b/administrator/components/com_installer/views/install/tmpl/default.php index 2fbb105acf47e..31dd50f68985f 100644 --- a/administrator/components/com_installer/views/install/tmpl/default.php +++ b/administrator/components/com_installer/views/install/tmpl/default.php @@ -104,8 +104,8 @@

diff --git a/administrator/components/com_installer/views/install/view.html.php b/administrator/components/com_installer/views/install/view.html.php index c61c838919232..1ede88a5fc87d 100644 --- a/administrator/components/com_installer/views/install/view.html.php +++ b/administrator/components/com_installer/views/install/view.html.php @@ -9,7 +9,7 @@ defined('_JEXEC') or die; -include_once __DIR__ . '/../default/view.php'; +JLoader::register('InstallerViewDefault', dirname(__DIR__) . '/default/view.php'); /** * Extension Manager Install View diff --git a/administrator/components/com_installer/views/languages/view.html.php b/administrator/components/com_installer/views/languages/view.html.php index 0ffb1b9e836c8..59cb4b5113543 100644 --- a/administrator/components/com_installer/views/languages/view.html.php +++ b/administrator/components/com_installer/views/languages/view.html.php @@ -9,7 +9,7 @@ defined('_JEXEC') or die; -include_once __DIR__ . '/../default/view.php'; +JLoader::register('InstallerViewDefault', dirname(__DIR__) . '/default/view.php'); /** * Language installer view diff --git a/administrator/components/com_installer/views/manage/view.html.php b/administrator/components/com_installer/views/manage/view.html.php index 95807df3a5a30..7bfa0b6bfd55e 100644 --- a/administrator/components/com_installer/views/manage/view.html.php +++ b/administrator/components/com_installer/views/manage/view.html.php @@ -9,7 +9,7 @@ defined('_JEXEC') or die; -include_once __DIR__ . '/../default/view.php'; +JLoader::register('InstallerViewDefault', dirname(__DIR__) . '/default/view.php'); /** * Extension Manager Manage View diff --git a/administrator/components/com_installer/views/update/view.html.php b/administrator/components/com_installer/views/update/view.html.php index 325e3a5a91b8a..00559a1a7c76b 100644 --- a/administrator/components/com_installer/views/update/view.html.php +++ b/administrator/components/com_installer/views/update/view.html.php @@ -9,7 +9,7 @@ defined('_JEXEC') or die; -include_once __DIR__ . '/../default/view.php'; +JLoader::register('InstallerViewDefault', dirname(__DIR__) . '/default/view.php'); /** * Extension Manager Update View diff --git a/administrator/components/com_installer/views/updatesites/view.html.php b/administrator/components/com_installer/views/updatesites/view.html.php index 66087e240c031..5b377d4d9af7d 100644 --- a/administrator/components/com_installer/views/updatesites/view.html.php +++ b/administrator/components/com_installer/views/updatesites/view.html.php @@ -9,7 +9,7 @@ defined('_JEXEC') or die; -include_once __DIR__ . '/../default/view.php'; +JLoader::register('InstallerViewDefault', dirname(__DIR__) . '/default/view.php'); /** * Extension Manager Update Sites View diff --git a/administrator/components/com_installer/views/warnings/view.html.php b/administrator/components/com_installer/views/warnings/view.html.php index 5cee0fc778fa7..b8370dbb11845 100644 --- a/administrator/components/com_installer/views/warnings/view.html.php +++ b/administrator/components/com_installer/views/warnings/view.html.php @@ -9,7 +9,7 @@ defined('_JEXEC') or die; -include_once __DIR__ . '/../default/view.php'; +JLoader::register('InstallerViewDefault', dirname(__DIR__) . '/default/view.php'); /** * Extension Manager Templates View diff --git a/administrator/components/com_joomlaupdate/controller.php b/administrator/components/com_joomlaupdate/controller.php index 1040f51a948f9..b9831e34d0bd6 100644 --- a/administrator/components/com_joomlaupdate/controller.php +++ b/administrator/components/com_joomlaupdate/controller.php @@ -47,10 +47,7 @@ public function display($cachable = false, $urlparams = false) $model = $this->getModel('default'); // Push the Installer Warnings model into the view, if we can load it - if (!class_exists('InstallerModelWarnings')) - { - @include_once JPATH_ADMINISTRATOR . '/components/com_installer/models/warnings.php'; - } + static::addModelPath(JPATH_ADMINISTRATOR . '/components/com_installer/models', 'InstallerModel'); $warningsModel = $this->getModel('warnings', 'InstallerModel'); diff --git a/administrator/components/com_joomlaupdate/restore.php b/administrator/components/com_joomlaupdate/restore.php index 71b248d3658a2..1b5256508c05f 100644 --- a/administrator/components/com_joomlaupdate/restore.php +++ b/administrator/components/com_joomlaupdate/restore.php @@ -2056,14 +2056,14 @@ protected abstract function readArchiveHeader(); /** * Concrete classes must use this method to read the file header - * @return bool True if reading the file was successful, false if an error occured or we reached end of archive + * @return bool True if reading the file was successful, false if an error occurred or we reached end of archive */ protected abstract function readFileHeader(); /** * Concrete classes must use this method to process file data. It must set $runState to AK_STATE_DATAREAD when * it's finished processing the file data. - * @return bool True if processing the file data was successful, false if an error occured + * @return bool True if processing the file data was successful, false if an error occurred */ protected abstract function processFileData(); @@ -4323,7 +4323,7 @@ protected function readArchiveHeader() /** * Concrete classes must use this method to read the file header - * @return bool True if reading the file was successful, false if an error occured or we reached end of archive + * @return bool True if reading the file was successful, false if an error occurred or we reached end of archive */ protected function readFileHeader() { @@ -4576,7 +4576,7 @@ protected function readFileHeader() /** * Concrete classes must use this method to process file data. It must set $runState to AK_STATE_DATAREAD when * it's finished processing the file data. - * @return bool True if processing the file data was successful, false if an error occured + * @return bool True if processing the file data was successful, false if an error occurred */ protected function processFileData() { @@ -4632,7 +4632,7 @@ private function processTypeFileUncompressed() // Can we write to the file? if( ($outfp === false) && (!$ignore) ) { - // An error occured + // An error occurred debugMsg('Could not write to output file'); $this->setError( AKText::sprintf('COULDNT_WRITE_FILE', $this->fileHeader->realFile) ); return false; @@ -4714,7 +4714,7 @@ private function processTypeFileCompressedSimple() // Can we write to the file? $ignore = AKFactory::get('kickstart.setup.ignoreerrors', false) || $this->isIgnoredDirectory($this->fileHeader->file); if( ($outfp === false) && (!$ignore) ) { - // An error occured + // An error occurred debugMsg('Could not write to output file'); $this->setError( AKText::sprintf('COULDNT_WRITE_FILE', $this->fileHeader->realFile) ); return false; @@ -4964,7 +4964,7 @@ protected function readArchiveHeader() /** * Concrete classes must use this method to read the file header - * @return bool True if reading the file was successful, false if an error occured or we reached end of archive + * @return bool True if reading the file was successful, false if an error occurred or we reached end of archive */ protected function readFileHeader() { @@ -5260,7 +5260,7 @@ protected function readArchiveHeader() /** * Concrete classes must use this method to read the file header - * @return bool True if reading the file was successful, false if an error occured or we reached end of archive + * @return bool True if reading the file was successful, false if an error occurred or we reached end of archive */ protected function readFileHeader() { @@ -5485,7 +5485,7 @@ protected function readFileHeader() /** * Concrete classes must use this method to process file data. It must set $runState to AK_STATE_DATAREAD when * it's finished processing the file data. - * @return bool True if processing the file data was successful, false if an error occured + * @return bool True if processing the file data was successful, false if an error occurred */ protected function processFileData() { @@ -5537,7 +5537,7 @@ private function processTypeFileUncompressed() // Can we write to the file? if( ($outfp === false) && (!$ignore) ) { - // An error occured + // An error occurred $this->setError( AKText::sprintf('COULDNT_WRITE_FILE', $this->fileHeader->realFile) ); return false; } @@ -5580,7 +5580,7 @@ private function processTypeFileCompressedSimple() // Can we write to the file? $ignore = AKFactory::get('kickstart.setup.ignoreerrors', false) || $this->isIgnoredDirectory($this->fileHeader->file); if( ($outfp === false) && (!$ignore) ) { - // An error occured + // An error occurred $this->setError( AKText::sprintf('COULDNT_WRITE_FILE', $this->fileHeader->realFile) ); return false; } @@ -6208,7 +6208,7 @@ class AKText extends AKAbstractObject 'BTN_SITEFE' => 'Visit your site\'s front-end', 'BTN_SITEBE' => 'Visit your site\'s back-end', 'WARNINGS' => 'Extraction Warnings', - 'ERROR_OCCURED' => 'An error occured', + 'ERROR_OCCURED' => 'An error occurred', 'STEALTH_MODE' => 'Stealth mode', 'STEALTH_URL' => 'HTML file to show to web visitors', 'ERR_NOT_A_JPS_FILE' => 'The file is not a JPA archive', diff --git a/administrator/components/com_joomlaupdate/views/upload/tmpl/captive.php b/administrator/components/com_joomlaupdate/views/upload/tmpl/captive.php index 0ae0824514e74..2c32d13755848 100644 --- a/administrator/components/com_joomlaupdate/views/upload/tmpl/captive.php +++ b/administrator/components/com_joomlaupdate/views/upload/tmpl/captive.php @@ -12,7 +12,7 @@ JHtml::_('behavior.keepalive'); JHtml::_('bootstrap.tooltip'); -require_once JPATH_ADMINISTRATOR . '/modules/mod_login/helper.php'; +JLoader::register('ModLoginHelper', JPATH_ADMINISTRATOR . '/modules/mod_login/helper.php'); $twofactormethods = ModLoginHelper::getTwoFactorMethods(); diff --git a/administrator/components/com_languages/controller.php b/administrator/components/com_languages/controller.php index 564ba304a1ee6..f22c151d76a8b 100644 --- a/administrator/components/com_languages/controller.php +++ b/administrator/components/com_languages/controller.php @@ -28,13 +28,13 @@ class LanguagesController extends JControllerLegacy * @param boolean $cachable If true, the view output will be cached. * @param array $urlparams An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}. * - * @return JController This object to support chaining. + * @return LanguagesController This object to support chaining. * * @since 1.5 */ public function display($cachable = false, $urlparams = false) { - require_once JPATH_COMPONENT . '/helpers/languages.php'; + JLoader::register('LanguagesHelper', JPATH_ADMINISTRATOR . '/components/com_languages/helpers/languages.php'); $view = $this->input->get('view', 'languages'); $layout = $this->input->get('layout', 'default'); @@ -51,8 +51,6 @@ public function display($cachable = false, $urlparams = false) return false; } - parent::display(); - - return $this; + return parent::display(); } } diff --git a/administrator/components/com_languages/controllers/languages.php b/administrator/components/com_languages/controllers/languages.php index 8b15403e17212..fb440e4535ae3 100644 --- a/administrator/components/com_languages/controllers/languages.php +++ b/administrator/components/com_languages/controllers/languages.php @@ -29,9 +29,7 @@ class LanguagesControllerLanguages extends JControllerAdmin */ public function getModel($name = 'Language', $prefix = 'LanguagesModel', $config = array('ignore_request' => true)) { - $model = parent::getModel($name, $prefix, $config); - - return $model; + return parent::getModel($name, $prefix, $config); } /** diff --git a/administrator/components/com_languages/controllers/override.php b/administrator/components/com_languages/controllers/override.php index 0c6c67f02c36e..950284e448c84 100644 --- a/administrator/components/com_languages/controllers/override.php +++ b/administrator/components/com_languages/controllers/override.php @@ -94,7 +94,7 @@ public function save($key = null, $urlVar = null) } // Require helper for filter functions called by JForm. - require_once JPATH_COMPONENT . '/helpers/languages.php'; + JLoader::register('LanguagesHelper', JPATH_ADMINISTRATOR . '/components/com_languages/helpers/languages.php'); // Test whether the data is valid. $validData = $model->validate($form, $data); diff --git a/administrator/components/com_languages/models/override.php b/administrator/components/com_languages/models/override.php index bf3f5825e8706..4801d05690569 100644 --- a/administrator/components/com_languages/models/override.php +++ b/administrator/components/com_languages/models/override.php @@ -89,7 +89,7 @@ protected function loadFormData() */ public function getItem($pk = null) { - require_once JPATH_COMPONENT . '/helpers/languages.php'; + JLoader::register('LanguagesHelper', JPATH_ADMINISTRATOR . '/components/com_languages/helpers/languages.php'); $input = JFactory::getApplication()->input; $pk = (!empty($pk)) ? $pk : $input->get('id'); @@ -122,10 +122,11 @@ public function getItem($pk = null) */ public function save($data, $opposite_client = false) { - $app = JFactory::getApplication(); - require_once JPATH_COMPONENT . '/helpers/languages.php'; + JLoader::register('LanguagesHelper', JPATH_ADMINISTRATOR . '/components/com_languages/helpers/languages.php'); jimport('joomla.filesystem.file'); + $app = JFactory::getApplication(); + $client = $app->getUserState('com_languages.overrides.filter.client', 0); $language = $app->getUserState('com_languages.overrides.filter.language', 'en-GB'); diff --git a/administrator/components/com_languages/models/overrides.php b/administrator/components/com_languages/models/overrides.php index bf762651686b7..5b4ebc2b9a8db 100644 --- a/administrator/components/com_languages/models/overrides.php +++ b/administrator/components/com_languages/models/overrides.php @@ -232,7 +232,7 @@ public function getLanguages() * * @param array $cids Array of keys to delete. * - * @return integer Number of successfully deleted overrides, boolean false if an error occured. + * @return integer Number of successfully deleted overrides, boolean false if an error occurred. * * @since 2.5 */ @@ -247,7 +247,7 @@ public function delete($cids) } jimport('joomla.filesystem.file'); - require_once JPATH_COMPONENT . '/helpers/languages.php'; + JLoader::register('LanguagesHelper', JPATH_ADMINISTRATOR . '/components/com_languages/helpers/languages.php'); $filterclient = JFactory::getApplication()->getUserState('com_languages.overrides.filter.client'); $client = $filterclient == 0 ? 'SITE' : 'ADMINISTRATOR'; diff --git a/administrator/components/com_languages/models/strings.php b/administrator/components/com_languages/models/strings.php index fbe38bba778b5..42395b2344ce6 100644 --- a/administrator/components/com_languages/models/strings.php +++ b/administrator/components/com_languages/models/strings.php @@ -25,7 +25,7 @@ class LanguagesModelStrings extends JModelLegacy */ public function refresh() { - require_once JPATH_COMPONENT . '/helpers/languages.php'; + JLoader::register('LanguagesHelper', JPATH_ADMINISTRATOR . '/components/com_languages/helpers/languages.php'); $app = JFactory::getApplication(); diff --git a/administrator/components/com_languages/views/language/view.html.php b/administrator/components/com_languages/views/language/view.html.php index 6aa594d2a3884..07471d5876922 100644 --- a/administrator/components/com_languages/views/language/view.html.php +++ b/administrator/components/com_languages/views/language/view.html.php @@ -57,7 +57,7 @@ public function display($tpl = null) */ protected function addToolbar() { - require_once JPATH_COMPONENT . '/helpers/languages.php'; + JLoader::register('LanguagesHelper', JPATH_ADMINISTRATOR . '/components/com_languages/helpers/languages.php'); JFactory::getApplication()->input->set('hidemainmenu', 1); $isNew = empty($this->item->lang_id); diff --git a/administrator/components/com_languages/views/multilangstatus/view.html.php b/administrator/components/com_languages/views/multilangstatus/view.html.php index 7062e2131b144..1e33e60e97425 100644 --- a/administrator/components/com_languages/views/multilangstatus/view.html.php +++ b/administrator/components/com_languages/views/multilangstatus/view.html.php @@ -25,7 +25,7 @@ class LanguagesViewMultilangstatus extends JViewLegacy */ public function display($tpl = null) { - require_once JPATH_COMPONENT . '/helpers/multilangstatus.php'; + JLoader::register('MultilangstatusHelper', JPATH_ADMINISTRATOR . '/components/com_languages/helpers/multilangstatus.php'); $this->homes = MultilangstatusHelper::getHomes(); $this->language_filter = JLanguageMultilang::isEnabled(); diff --git a/administrator/components/com_media/media.php b/administrator/components/com_media/media.php index 10177130b20a8..2071beeb163ee 100644 --- a/administrator/components/com_media/media.php +++ b/administrator/components/com_media/media.php @@ -26,7 +26,7 @@ $params = JComponentHelper::getParams('com_media'); // Load the helper class -require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/media.php'; +JLoader::register('MediaHelper', JPATH_ADMINISTRATOR . '/components/com_media/helpers/media.php'); // Set the path definitions $popup_upload = $input->get('pop_up', null); diff --git a/administrator/components/com_media/views/images/tmpl/default.php b/administrator/components/com_media/views/images/tmpl/default.php index eef3d264c12db..7bf956c0bf84f 100644 --- a/administrator/components/com_media/views/images/tmpl/default.php +++ b/administrator/components/com_media/views/images/tmpl/default.php @@ -55,8 +55,8 @@

- - +
@@ -150,7 +150,7 @@
- +

config->get('upload_maxsize') == '0' ? JText::_('COM_MEDIA_UPLOAD_FILES_NOLIMIT') : JText::sprintf('COM_MEDIA_UPLOAD_FILES', $this->config->get('upload_maxsize')); ?>

diff --git a/administrator/components/com_media/views/media/tmpl/default.php b/administrator/components/com_media/views/media/tmpl/default.php index bcf405961f0ab..08478c97c1694 100644 --- a/administrator/components/com_media/views/media/tmpl/default.php +++ b/administrator/components/com_media/views/media/tmpl/default.php @@ -87,7 +87,7 @@
- +

config->get('upload_maxsize') == '0' ? JText::_('COM_MEDIA_UPLOAD_FILES_NOLIMIT') : JText::sprintf('COM_MEDIA_UPLOAD_FILES', $this->config->get('upload_maxsize')); ?>

@@ -99,7 +99,7 @@
- +
diff --git a/administrator/components/com_menus/controller.php b/administrator/components/com_menus/controller.php index 18aa9a4a9a8be..2d903fc27d082 100644 --- a/administrator/components/com_menus/controller.php +++ b/administrator/components/com_menus/controller.php @@ -28,10 +28,8 @@ class MenusController extends JControllerLegacy */ public function display($cachable = false, $urlparams = false) { - require_once JPATH_COMPONENT . '/helpers/menus.php'; + JLoader::register('MenusHelper', JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php'); - parent::display(); - - return $this; + return parent::display(); } } diff --git a/administrator/components/com_menus/controllers/menus.php b/administrator/components/com_menus/controllers/menus.php index 01c7d64001308..a7743bfeef0b1 100644 --- a/administrator/components/com_menus/controllers/menus.php +++ b/administrator/components/com_menus/controllers/menus.php @@ -45,9 +45,7 @@ public function display($cachable = false, $urlparams = false) */ public function getModel($name = 'Menu', $prefix = 'MenusModel', $config = array('ignore_request' => true)) { - $model = parent::getModel($name, $prefix, $config); - - return $model; + return parent::getModel($name, $prefix, $config); } /** @@ -140,9 +138,9 @@ public function rebuild() /** * Temporary method. This should go into the 1.5 to 1.6 upgrade routines. * - * @return void + * @return JException|void JException instance on error * - * @since 1.6 + * @since 1.6 */ public function resync() { diff --git a/administrator/components/com_menus/models/forms/filter_items.xml b/administrator/components/com_menus/models/forms/filter_items.xml index 0127766f70cfc..d9d407a746c3f 100644 --- a/administrator/components/com_menus/models/forms/filter_items.xml +++ b/administrator/components/com_menus/models/forms/filter_items.xml @@ -78,8 +78,8 @@ - - + + diff --git a/administrator/components/com_menus/models/item.php b/administrator/components/com_menus/models/item.php index e45a8af7d65d7..6569852a96508 100644 --- a/administrator/components/com_menus/models/item.php +++ b/administrator/components/com_menus/models/item.php @@ -12,7 +12,7 @@ use Joomla\Registry\Registry; jimport('joomla.filesystem.path'); -require_once JPATH_COMPONENT . '/helpers/menus.php'; +JLoader::register('MenusHelper', JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php'); /** * Menu Item Model for Menus. @@ -1186,7 +1186,7 @@ protected function preprocessForm(JForm $form, $data, $group = 'content') /** * Method rebuild the entire nested set tree. * - * @return boolean False on failure or error, true otherwise. + * @return boolean|JException Boolean true on success, boolean false or JException instance on error * * @since 1.6 */ diff --git a/administrator/components/com_menus/models/items.php b/administrator/components/com_menus/models/items.php index e85a977b368d0..8eb7a25852bb0 100644 --- a/administrator/components/com_menus/models/items.php +++ b/administrator/components/com_menus/models/items.php @@ -30,7 +30,7 @@ public function __construct($config = array()) { $config['filter_fields'] = array( 'id', 'a.id', - 'menutype', 'a.menutype', + 'menutype', 'a.menutype', 'menutype_title', 'title', 'a.title', 'alias', 'a.alias', 'published', 'a.published', @@ -241,6 +241,10 @@ protected function getListQuery() $query->select('ag.title AS access_level') ->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Join over the menu types. + $query->select($db->quoteName('mt.title', 'menutype_title')) + ->join('LEFT', $db->quoteName('#__menu_types', 'mt') . ' ON ' . $db->qn('mt.menutype') . ' = ' . $db->qn('a.menutype')); + // Join over the associations. $assoc = JLanguageAssociations::isEnabled(); diff --git a/administrator/components/com_menus/views/item/tmpl/edit.php b/administrator/components/com_menus/views/item/tmpl/edit.php index 462335edd9b39..f6d868d55880b 100644 --- a/administrator/components/com_menus/views/item/tmpl/edit.php +++ b/administrator/components/com_menus/views/item/tmpl/edit.php @@ -75,12 +75,14 @@ }; "; +$input = JFactory::getApplication()->input; + // Add the script to the document head. JFactory::getDocument()->addScriptDeclaration($script); - +$tmpl = $input->get('tmpl', '', 'cmd') === 'component' ? '&tmpl=component' : ''; ?> - + diff --git a/administrator/components/com_menus/views/item/tmpl/edit_associations.php b/administrator/components/com_menus/views/item/tmpl/edit_associations.php index 2d249134c3e99..e4c34d88ab9eb 100644 --- a/administrator/components/com_menus/views/item/tmpl/edit_associations.php +++ b/administrator/components/com_menus/views/item/tmpl/edit_associations.php @@ -9,4 +9,11 @@ defined('_JEXEC') or die; -echo JLayoutHelper::render('joomla.edit.associations', $this); +if ($this->item->id != 0 && $this->item->language != '*') +{ + echo JLayoutHelper::render('joomla.edit.associations', $this); +} +else +{ + echo '
' . JText::_('JGLOBAL_ASSOC_NOT_POSSIBLE') . '
'; +} diff --git a/administrator/components/com_menus/views/items/tmpl/default.php b/administrator/components/com_menus/views/items/tmpl/default.php index 1494409bbffac..5c0e1b8da2109 100644 --- a/administrator/components/com_menus/views/items/tmpl/default.php +++ b/administrator/components/com_menus/views/items/tmpl/default.php @@ -78,7 +78,7 @@ - + @@ -203,7 +203,7 @@
- escape($item->menutype); ?> + escape($item->menutype_title); ?> type == 'component') : ?> diff --git a/administrator/components/com_menus/views/items/view.html.php b/administrator/components/com_menus/views/items/view.html.php index 065d587cd9550..e4c2012869f0f 100644 --- a/administrator/components/com_menus/views/items/view.html.php +++ b/administrator/components/com_menus/views/items/view.html.php @@ -184,8 +184,8 @@ public function display($tpl = null) $titleParts[] = $vars['view']; } - $value = implode(' » ', $titleParts); } + $value = implode(' » ', $titleParts); } else { diff --git a/administrator/components/com_menus/views/menu/tmpl/edit.php b/administrator/components/com_menus/views/menu/tmpl/edit.php index 8c2993f3a1da9..a3ab116365b24 100644 --- a/administrator/components/com_menus/views/menu/tmpl/edit.php +++ b/administrator/components/com_menus/views/menu/tmpl/edit.php @@ -30,19 +30,13 @@ "); ?> - + + +
'details')); ?> -
-
- form->getLabel('title'); ?> -
-
- form->getInput('title'); ?> -
-
form->getLabel('menutype'); ?> diff --git a/administrator/components/com_messages/controller.php b/administrator/components/com_messages/controller.php index 447aab4285f9f..b732abc0deb04 100644 --- a/administrator/components/com_messages/controller.php +++ b/administrator/components/com_messages/controller.php @@ -28,7 +28,7 @@ class MessagesController extends JControllerLegacy */ public function display($cachable = false, $urlparams = false) { - require_once JPATH_COMPONENT . '/helpers/messages.php'; + JLoader::register('MessagesHelper', JPATH_ADMINISTRATOR . '/components/com_messages/helpers/messages.php'); $view = $this->input->get('view', 'messages'); $layout = $this->input->get('layout', 'default'); diff --git a/administrator/components/com_messages/controllers/messages.php b/administrator/components/com_messages/controllers/messages.php index 94f2813d94724..48db0ffec4798 100644 --- a/administrator/components/com_messages/controllers/messages.php +++ b/administrator/components/com_messages/controllers/messages.php @@ -29,8 +29,6 @@ class MessagesControllerMessages extends JControllerAdmin */ public function getModel($name = 'Message', $prefix = 'MessagesModel', $config = array('ignore_request' => true)) { - $model = parent::getModel($name, $prefix, $config); - - return $model; + return parent::getModel($name, $prefix, $config); } } diff --git a/administrator/components/com_modules/controller.php b/administrator/components/com_modules/controller.php index 7f277519ba48e..ea6d201cc3452 100644 --- a/administrator/components/com_modules/controller.php +++ b/administrator/components/com_modules/controller.php @@ -57,7 +57,7 @@ public function display($cachable = false, $urlparams = false) return $view->display(); } - require_once JPATH_COMPONENT . '/helpers/modules.php'; + JLoader::register('ModulesHelper', JPATH_ADMINISTRATOR . '/components/com_modules/helpers/modules.php'); $layout = $this->input->get('layout', 'edit'); $id = $this->input->getInt('id'); diff --git a/administrator/components/com_modules/controllers/modules.php b/administrator/components/com_modules/controllers/modules.php index bafb6c2dff3ac..eb3f1776bc39f 100644 --- a/administrator/components/com_modules/controllers/modules.php +++ b/administrator/components/com_modules/controllers/modules.php @@ -63,8 +63,6 @@ public function duplicate() */ public function getModel($name = 'Module', $prefix = 'ModulesModel', $config = array('ignore_request' => true)) { - $model = parent::getModel($name, $prefix, $config); - - return $model; + return parent::getModel($name, $prefix, $config); } } diff --git a/administrator/components/com_modules/helpers/html/modules.php b/administrator/components/com_modules/helpers/html/modules.php index 14e68d8185d2f..1d14eacfbebb8 100644 --- a/administrator/components/com_modules/helpers/html/modules.php +++ b/administrator/components/com_modules/helpers/html/modules.php @@ -136,7 +136,8 @@ public static function state($value, $i, $enabled = true, $checkbox = 'cb') public static function positions($clientId, $state = 1, $selectedPosition = '') { - require_once JPATH_ADMINISTRATOR . '/components/com_templates/helpers/templates.php'; + JLoader::register('TemplatesHelper', JPATH_ADMINISTRATOR . '/components/com_templates/helpers/templates.php'); + $templates = array_keys(ModulesHelper::getTemplates($clientId, $state)); $templateGroups = array(); diff --git a/administrator/components/com_modules/models/fields/modulesmodule.php b/administrator/components/com_modules/models/fields/modulesmodule.php index 05727c2f13a08..81c3586a416c1 100644 --- a/administrator/components/com_modules/models/fields/modulesmodule.php +++ b/administrator/components/com_modules/models/fields/modulesmodule.php @@ -11,7 +11,7 @@ JFormHelper::loadFieldClass('list'); -require_once __DIR__ . '/../../helpers/modules.php'; +JLoader::register('ModulesHelper', JPATH_ADMINISTRATOR . '/components/com_modules/helpers/modules.php'); /** * ModulesPosition Field class for the Joomla Framework. diff --git a/administrator/components/com_modules/models/fields/modulesposition.php b/administrator/components/com_modules/models/fields/modulesposition.php index fd00ef4e787a2..8cda336e44462 100644 --- a/administrator/components/com_modules/models/fields/modulesposition.php +++ b/administrator/components/com_modules/models/fields/modulesposition.php @@ -11,7 +11,7 @@ JFormHelper::loadFieldClass('list'); -require_once __DIR__ . '/../../helpers/modules.php'; +JLoader::register('ModulesHelper', JPATH_ADMINISTRATOR . '/components/com_modules/helpers/modules.php'); /** * ModulesPosition Field class for the Joomla Framework. diff --git a/administrator/components/com_modules/models/module.php b/administrator/components/com_modules/models/module.php index b7af812801f55..21936a5c7e649 100644 --- a/administrator/components/com_modules/models/module.php +++ b/administrator/components/com_modules/models/module.php @@ -375,7 +375,7 @@ public function delete(&$pks) * * @param array &$pks An array of primary key IDs. * - * @return boolean True if successful. + * @return boolean|JException Boolean true on success, JException instance on error * * @since 1.6 * @throws Exception @@ -872,7 +872,7 @@ protected function preprocessForm(JForm $form, $data, $group = 'content') */ public function validate($form, $data, $group = null) { - require_once JPATH_ADMINISTRATOR . '/components/com_content/helpers/content.php'; + JLoader::register('ContentHelper', JPATH_ADMINISTRATOR . '/components/com_content/helpers/content.php'); return parent::validate($form, $data, $group); } diff --git a/administrator/components/com_modules/views/module/tmpl/edit.php b/administrator/components/com_modules/views/module/tmpl/edit.php index 3da9af929268e..a51f41fdd9016 100644 --- a/administrator/components/com_modules/views/module/tmpl/edit.php +++ b/administrator/components/com_modules/views/module/tmpl/edit.php @@ -149,10 +149,12 @@ JFactory::getDocument()->addScriptDeclaration($script); +$input = JFactory::getApplication()->input; + // In case of modal -$isModal = JFactory::getApplication()->input->get('layout') == 'modal' ? true : false; +$isModal = $input->get('layout') == 'modal' ? true : false; $layout = $isModal ? 'modal' : 'edit'; -$tmpl = $isModal ? '&tmpl=component' : ''; +$tmpl = $isModal || $input->get('tmpl', '', 'cmd') === 'component' ? '&tmpl=component' : ''; ?> diff --git a/administrator/components/com_modules/views/module/tmpl/edit_assignment.php b/administrator/components/com_modules/views/module/tmpl/edit_assignment.php index d1c1594f81708..b30b020a1a98b 100644 --- a/administrator/components/com_modules/views/module/tmpl/edit_assignment.php +++ b/administrator/components/com_modules/views/module/tmpl/edit_assignment.php @@ -9,8 +9,8 @@ defined('_JEXEC') or die; -// Initiasile related data. -require_once JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php'; +// Initialise related data. +JLoader::register('MenusHelper', JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php'); $menuTypes = MenusHelper::getMenuLinks(); JHtml::_('script', 'jui/treeselectmenu.jquery.min.js', false, true); diff --git a/administrator/components/com_modules/views/module/tmpl/edit_positions.php b/administrator/components/com_modules/views/module/tmpl/edit_positions.php index eaf28009a72fb..2ee47fcd436bc 100644 --- a/administrator/components/com_modules/views/module/tmpl/edit_positions.php +++ b/administrator/components/com_modules/views/module/tmpl/edit_positions.php @@ -9,7 +9,7 @@ defined('_JEXEC') or die; -require_once JPATH_ADMINISTRATOR . '/components/com_templates/helpers/templates.php'; +JLoader::register('TemplatesHelper', JPATH_ADMINISTRATOR . '/components/com_templates/helpers/templates.php'); JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); $clientId = $this->item->client_id; diff --git a/administrator/components/com_newsfeeds/controller.php b/administrator/components/com_newsfeeds/controller.php index cda85773ddd0f..2f4f415f40f2e 100644 --- a/administrator/components/com_newsfeeds/controller.php +++ b/administrator/components/com_newsfeeds/controller.php @@ -28,7 +28,7 @@ class NewsfeedsController extends JControllerLegacy */ public function display($cachable = false, $urlparams = array()) { - require_once JPATH_COMPONENT . '/helpers/newsfeeds.php'; + JLoader::register('NewsfeedsHelper', JPATH_ADMINISTRATOR . '/components/com_newsfeeds/helpers/newsfeeds.php'); $view = $this->input->get('view', 'newsfeeds'); $layout = $this->input->get('layout', 'default'); diff --git a/administrator/components/com_newsfeeds/controllers/newsfeeds.php b/administrator/components/com_newsfeeds/controllers/newsfeeds.php index b5d1042af7a8f..45a6c27464b29 100644 --- a/administrator/components/com_newsfeeds/controllers/newsfeeds.php +++ b/administrator/components/com_newsfeeds/controllers/newsfeeds.php @@ -29,8 +29,7 @@ class NewsfeedsControllerNewsfeeds extends JControllerAdmin */ public function getModel($name = 'Newsfeed', $prefix = 'NewsfeedsModel', $config = array('ignore_request' => true)) { - $model = parent::getModel($name, $prefix, $config); - return $model; + return parent::getModel($name, $prefix, $config); } /** diff --git a/administrator/components/com_newsfeeds/models/forms/newsfeed.xml b/administrator/components/com_newsfeeds/models/forms/newsfeed.xml index a712d04783465..9667e3f405376 100644 --- a/administrator/components/com_newsfeeds/models/forms/newsfeed.xml +++ b/administrator/components/com_newsfeeds/models/forms/newsfeed.xml @@ -177,6 +177,7 @@ name="modified_by" type="user" label="JGLOBAL_FIELD_MODIFIED_BY_LABEL" + description="COM_NEWSFEEDS_FIELD_MODIFIED_BY_DESC" class="readonly" readonly="true" filter="unset" diff --git a/administrator/components/com_newsfeeds/views/newsfeed/tmpl/edit.php b/administrator/components/com_newsfeeds/views/newsfeed/tmpl/edit.php index 59ac6d09167c1..81d699e245a80 100644 --- a/administrator/components/com_newsfeeds/views/newsfeed/tmpl/edit.php +++ b/administrator/components/com_newsfeeds/views/newsfeed/tmpl/edit.php @@ -41,7 +41,7 @@ // In case of modal $isModal = $input->get('layout') == 'modal' ? true : false; $layout = $isModal ? 'modal' : 'edit'; -$tmpl = $isModal ? '&tmpl=component' : ''; +$tmpl = $isModal || $input->get('tmpl', '', 'cmd') === 'component' ? '&tmpl=component' : ''; ?> @@ -76,6 +76,12 @@
+ + loadTemplate('display'); ?> + + + +
@@ -87,12 +93,6 @@
- - loadTemplate('display'); ?> - - - - loadTemplate('associations'); ?> diff --git a/administrator/components/com_newsfeeds/views/newsfeed/tmpl/edit_associations.php b/administrator/components/com_newsfeeds/views/newsfeed/tmpl/edit_associations.php index 0a8f9093adf80..e3f83b3034df3 100644 --- a/administrator/components/com_newsfeeds/views/newsfeed/tmpl/edit_associations.php +++ b/administrator/components/com_newsfeeds/views/newsfeed/tmpl/edit_associations.php @@ -9,4 +9,11 @@ defined('_JEXEC') or die; -echo JLayoutHelper::render('joomla.edit.associations', $this); +if ($this->item->id != 0 && $this->item->language != '*') +{ + echo JLayoutHelper::render('joomla.edit.associations', $this); +} +else +{ + echo '
' . JText::_('JGLOBAL_ASSOC_NOT_POSSIBLE') . '
'; +} diff --git a/administrator/components/com_newsfeeds/views/newsfeed/view.html.php b/administrator/components/com_newsfeeds/views/newsfeed/view.html.php index 9e94b7e558f7c..4e0fb04da66d9 100644 --- a/administrator/components/com_newsfeeds/views/newsfeed/view.html.php +++ b/administrator/components/com_newsfeeds/views/newsfeed/view.html.php @@ -115,7 +115,7 @@ protected function addToolbar() } else { - if ($this->state->params->get('save_history', 0) && $user->authorise('core.edit')) + if ($this->state->params->get('save_history', 0) && $canDo->get('core.edit')) { JToolbarHelper::versions('com_newsfeeds.newsfeed', $this->item->id); } diff --git a/administrator/components/com_newsfeeds/views/newsfeeds/tmpl/modal.php b/administrator/components/com_newsfeeds/views/newsfeeds/tmpl/modal.php index 139db4d59c164..cb002e8360bdf 100644 --- a/administrator/components/com_newsfeeds/views/newsfeeds/tmpl/modal.php +++ b/administrator/components/com_newsfeeds/views/newsfeeds/tmpl/modal.php @@ -9,7 +9,7 @@ defined('_JEXEC') or die; -require_once JPATH_ROOT . '/components/com_newsfeeds/helpers/route.php'; +JLoader::register('NewsfeedsHelperRoute', JPATH_ROOT . '/components/com_newsfeeds/helpers/route.php'); JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); diff --git a/administrator/components/com_plugins/controller.php b/administrator/components/com_plugins/controller.php index 725b064e86c7c..55966d9696072 100644 --- a/administrator/components/com_plugins/controller.php +++ b/administrator/components/com_plugins/controller.php @@ -28,7 +28,7 @@ class PluginsController extends JControllerLegacy */ public function display($cachable = false, $urlparams = false) { - require_once JPATH_COMPONENT . '/helpers/plugins.php'; + JLoader::register('PluginsHelper', JPATH_ADMINISTRATOR . '/components/com_plugins/helpers/plugins.php'); // Load the submenu. PluginsHelper::addSubmenu($this->input->get('view', 'plugins')); diff --git a/administrator/components/com_plugins/controllers/plugins.php b/administrator/components/com_plugins/controllers/plugins.php index 4615766b2c75d..a10bc9be3493a 100644 --- a/administrator/components/com_plugins/controllers/plugins.php +++ b/administrator/components/com_plugins/controllers/plugins.php @@ -29,8 +29,6 @@ class PluginsControllerPlugins extends JControllerAdmin */ public function getModel($name = 'Plugin', $prefix = 'PluginsModel', $config = array('ignore_request' => true)) { - $model = parent::getModel($name, $prefix, $config); - - return $model; + return parent::getModel($name, $prefix, $config); } } diff --git a/administrator/components/com_plugins/models/fields/plugintype.php b/administrator/components/com_plugins/models/fields/plugintype.php index abfc25a69ab69..16e0ebd8dcee6 100644 --- a/administrator/components/com_plugins/models/fields/plugintype.php +++ b/administrator/components/com_plugins/models/fields/plugintype.php @@ -11,7 +11,7 @@ JFormHelper::loadFieldClass('list'); -require_once __DIR__ . '/../../helpers/plugins.php'; +JLoader::register('PluginsHelper', JPATH_ADMINISTRATOR . '/components/com_plugins/helpers/plugins.php'); /** * Plugin Type Field class for the Joomla Framework. diff --git a/administrator/components/com_plugins/views/plugins/tmpl/default.php b/administrator/components/com_plugins/views/plugins/tmpl/default.php index ae3c4418c9779..05d77ccbac543 100644 --- a/administrator/components/com_plugins/views/plugins/tmpl/default.php +++ b/administrator/components/com_plugins/views/plugins/tmpl/default.php @@ -118,7 +118,7 @@ editor, $item->checked_out_time, 'plugins.', $canCheckin); ?> - + name; ?> name; ?> diff --git a/administrator/components/com_postinstall/postinstall.php b/administrator/components/com_postinstall/postinstall.php index 38bd2f398f22b..1745aa617b165 100644 --- a/administrator/components/com_postinstall/postinstall.php +++ b/administrator/components/com_postinstall/postinstall.php @@ -9,11 +9,5 @@ defined('_JEXEC') or die; -// Load the RAD layer. -if (!defined('FOF_INCLUDED')) -{ - require_once JPATH_LIBRARIES . '/fof/include.php'; -} - // Dispatch the component. FOFDispatcher::getTmpInstance('com_postinstall')->dispatch(); diff --git a/administrator/components/com_redirect/controller.php b/administrator/components/com_redirect/controller.php index edba4e74f4c25..4cef71f97c069 100644 --- a/administrator/components/com_redirect/controller.php +++ b/administrator/components/com_redirect/controller.php @@ -34,7 +34,7 @@ class RedirectController extends JControllerLegacy */ public function display($cachable = false, $urlparams = false) { - require_once JPATH_COMPONENT . '/helpers/redirect.php'; + JLoader::register('RedirectHelper', JPATH_ADMINISTRATOR . '/components/com_redirect/helpers/redirect.php'); // Load the submenu. RedirectHelper::addSubmenu($this->input->get('view', 'links')); diff --git a/administrator/components/com_redirect/controllers/links.php b/administrator/components/com_redirect/controllers/links.php index 823d8daed4deb..cd9a47dcbe8a2 100644 --- a/administrator/components/com_redirect/controllers/links.php +++ b/administrator/components/com_redirect/controllers/links.php @@ -111,9 +111,7 @@ public function duplicateUrls() */ public function getModel($name = 'Link', $prefix = 'RedirectModel', $config = array('ignore_request' => true)) { - $model = parent::getModel($name, $prefix, $config); - - return $model; + return parent::getModel($name, $prefix, $config); } /** diff --git a/administrator/components/com_search/controller.php b/administrator/components/com_search/controller.php index 4b94a2f3b3379..5aa407396e0f9 100644 --- a/administrator/components/com_search/controller.php +++ b/administrator/components/com_search/controller.php @@ -28,17 +28,17 @@ class SearchController extends JControllerLegacy * @param boolean $cachable If true, the view output will be cached * @param array $urlparams An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}. * - * @return JController This object to support chaining. + * @return SearchController This object to support chaining. * * @since 1.5 */ public function display($cachable = false, $urlparams = false) { - require_once JPATH_COMPONENT . '/helpers/search.php'; + JLoader::register('SearchHelper', JPATH_ADMINISTRATOR . '/components/com_search/helpers/search.php'); // Load the submenu. SearchHelper::addSubmenu($this->input->get('view', 'searches')); - parent::display(); + return parent::display(); } } diff --git a/administrator/components/com_search/models/searches.php b/administrator/components/com_search/models/searches.php index 6484490d44307..43b0de054e15a 100644 --- a/administrator/components/com_search/models/searches.php +++ b/administrator/components/com_search/models/searches.php @@ -143,7 +143,7 @@ public function getItems() if (!class_exists('JSite')) { // This fools the routers in the search plugins into thinking it's in the frontend - JLoader::register('JSite', JPATH_COMPONENT . '/helpers/site.php'); + JLoader::register('JSite', JPATH_ADMINISTRATOR . '/components/com_search/helpers/site.php'); } foreach ($items as &$item) diff --git a/administrator/components/com_tags/controllers/tags.php b/administrator/components/com_tags/controllers/tags.php index e31a91f9782aa..7f9983ba26c49 100644 --- a/administrator/components/com_tags/controllers/tags.php +++ b/administrator/components/com_tags/controllers/tags.php @@ -29,9 +29,7 @@ class TagsControllerTags extends JControllerAdmin */ public function getModel($name = 'Tag', $prefix = 'TagsModel', $config = array('ignore_request' => true)) { - $model = parent::getModel($name, $prefix, $config); - - return $model; + return parent::getModel($name, $prefix, $config); } /** diff --git a/administrator/components/com_tags/models/forms/tag.xml b/administrator/components/com_tags/models/forms/tag.xml index 1d1cdbf5dbd64..ad5e49ea2386f 100644 --- a/administrator/components/com_tags/models/forms/tag.xml +++ b/administrator/components/com_tags/models/forms/tag.xml @@ -173,7 +173,8 @@ type="calendar" class="readonly" label="JGLOBAL_CREATED_DATE" - filter="unset" + format="%Y-%m-%d %H:%M:%S" + filter="user_utc" readonly="true" /> @@ -191,7 +192,8 @@ type="calendar" class="readonly" label="JGLOBAL_FIELD_MODIFIED_LABEL" - filter="unset" + format="%Y-%m-%d %H:%M:%S" + filter="user_utc" readonly="true" /> diff --git a/administrator/components/com_tags/views/tag/tmpl/edit.php b/administrator/components/com_tags/views/tag/tmpl/edit.php index b6379950b6629..e6248c04520d6 100644 --- a/administrator/components/com_tags/views/tag/tmpl/edit.php +++ b/administrator/components/com_tags/views/tag/tmpl/edit.php @@ -47,6 +47,8 @@
+ +
@@ -58,7 +60,6 @@
-
diff --git a/administrator/components/com_tags/views/tag/view.html.php b/administrator/components/com_tags/views/tag/view.html.php index 7cc5411f91c81..2315fe51a2c2f 100644 --- a/administrator/components/com_tags/views/tag/view.html.php +++ b/administrator/components/com_tags/views/tag/view.html.php @@ -90,33 +90,34 @@ protected function addToolbar() JToolbarHelper::apply('tag.apply'); JToolbarHelper::save('tag.save'); JToolbarHelper::save2new('tag.save2new'); + JToolbarHelper::cancel('tag.cancel'); } // If not checked out, can save the item. - elseif (!$checkedOut && ($canDo->get('core.edit') || ($canDo->get('core.edit.own') && $this->item->created_user_id == $userId))) + else { - JToolbarHelper::apply('tag.apply'); - JToolbarHelper::save('tag.save'); + // Since it's an existing record, check the edit permission, or fall back to edit own if the owner. + $itemEditable = $canDo->get('core.edit') || ($canDo->get('core.edit.own') && $this->item->created_user_id == $userId); - if ($canDo->get('core.create')) + // Can't save the record if it's checked out and editable + if (!$checkedOut && $itemEditable) { - JToolbarHelper::save2new('tag.save2new'); + JToolbarHelper::apply('tag.apply'); + JToolbarHelper::save('tag.save'); + + if ($canDo->get('core.create')) + { + JToolbarHelper::save2new('tag.save2new'); + } } - } - // If an existing item, can save to a copy. - if (!$isNew && $canDo->get('core.create')) - { - JToolbarHelper::save2copy('tag.save2copy'); - } + // If an existing item, can save to a copy. + if ($canDo->get('core.create')) + { + JToolbarHelper::save2copy('tag.save2copy'); + } - if (empty($this->item->id)) - { - JToolbarHelper::cancel('tag.cancel'); - } - else - { - if ($this->state->params->get('save_history', 0) && $user->authorise('core.edit')) + if ($this->state->params->get('save_history', 0) && $itemEditable) { JToolbarHelper::versions('com_tags.tag', $this->item->id); } diff --git a/administrator/components/com_templates/config.xml b/administrator/components/com_templates/config.xml index 9e4fd325a9254..c8da44ed46351 100644 --- a/administrator/components/com_templates/config.xml +++ b/administrator/components/com_templates/config.xml @@ -20,7 +20,7 @@ name="upload_limit" type="text" label="COM_TEMPLATES_CONFIG_UPLOAD_LABEL" description="COM_TEMPLATES_CONFIG_UPLOAD_DESC" - default="2" + default="10" extension="com_templates" /> diff --git a/administrator/components/com_templates/controllers/styles.php b/administrator/components/com_templates/controllers/styles.php index 073ab86986364..4ae3c4cc8156c 100644 --- a/administrator/components/com_templates/controllers/styles.php +++ b/administrator/components/com_templates/controllers/styles.php @@ -62,9 +62,7 @@ public function duplicate() */ public function getModel($name = 'Style', $prefix = 'TemplatesModel', $config = array()) { - $model = parent::getModel($name, $prefix, array('ignore_request' => true)); - - return $model; + return parent::getModel($name, $prefix, array('ignore_request' => true)); } /** diff --git a/administrator/components/com_templates/controllers/template.php b/administrator/components/com_templates/controllers/template.php index 5f0f5a7f2a0be..66d15adfbde7b 100644 --- a/administrator/components/com_templates/controllers/template.php +++ b/administrator/components/com_templates/controllers/template.php @@ -167,9 +167,7 @@ public function copy() */ public function getModel($name = 'Template', $prefix = 'TemplatesModel', $config = array()) { - $model = parent::getModel($name, $prefix, $config); - - return $model; + return parent::getModel($name, $prefix, $config); } /** diff --git a/administrator/components/com_templates/models/fields/templatelocation.php b/administrator/components/com_templates/models/fields/templatelocation.php index 0c8c67774e25f..a7fd6ab1736cc 100644 --- a/administrator/components/com_templates/models/fields/templatelocation.php +++ b/administrator/components/com_templates/models/fields/templatelocation.php @@ -11,7 +11,7 @@ JFormHelper::loadFieldClass('list'); -require_once __DIR__ . '/../../helpers/templates.php'; +JLoader::register('TemplatesHelper', JPATH_ADMINISTRATOR . '/components/com_templates/helpers/templates.php'); /** * Template Style Field class for the Joomla Framework. diff --git a/administrator/components/com_templates/models/fields/templatename.php b/administrator/components/com_templates/models/fields/templatename.php index 00e7522445551..954fc4f10f791 100644 --- a/administrator/components/com_templates/models/fields/templatename.php +++ b/administrator/components/com_templates/models/fields/templatename.php @@ -11,7 +11,7 @@ JFormHelper::loadFieldClass('list'); -require_once __DIR__ . '/../../helpers/templates.php'; +JLoader::register('TemplatesHelper', JPATH_ADMINISTRATOR . '/components/com_templates/helpers/templates.php'); /** * Template Style Field class for the Joomla Framework. diff --git a/administrator/components/com_templates/models/template.php b/administrator/components/com_templates/models/template.php index 582d4f478f58d..57cfa998b0319 100644 --- a/administrator/components/com_templates/models/template.php +++ b/administrator/components/com_templates/models/template.php @@ -496,7 +496,7 @@ public function save($data) if (!is_writable($filePath)) { $app->enqueueMessage(JText::_('COM_TEMPLATES_ERROR_SOURCE_FILE_NOT_WRITABLE'), 'warning'); - $app->enqueueMessage(JText::_('COM_TEMPLATES_FILE_PERMISSIONS' . JPath::getPermissions($filePath)), 'warning'); + $app->enqueueMessage(JText::sprintf('COM_TEMPLATES_FILE_PERMISSIONS', JPath::getPermissions($filePath)), 'warning'); if (!JPath::isOwner($filePath)) { @@ -888,7 +888,7 @@ public function uploadFile($file, $location) $fileName = JFile::makeSafe($file['name']); $err = null; - JLoader::register('TemplateHelper', JPATH_COMPONENT_ADMINISTRATOR . '/helpers/template.php'); + JLoader::register('TemplateHelper', JPATH_ADMINISTRATOR . '/components/com_templates/helpers/template.php'); if (!TemplateHelper::canUpload($file, $err)) { diff --git a/administrator/components/com_templates/views/style/tmpl/edit_assignment.php b/administrator/components/com_templates/views/style/tmpl/edit_assignment.php index c0daf57be4cd5..8e33453613b8e 100644 --- a/administrator/components/com_templates/views/style/tmpl/edit_assignment.php +++ b/administrator/components/com_templates/views/style/tmpl/edit_assignment.php @@ -10,7 +10,7 @@ defined('_JEXEC') or die; // Initiasile related data. -require_once JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php'; +JLoader::register('MenusHelper', JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php'); $menuTypes = MenusHelper::getMenuLinks(); $user = JFactory::getUser(); ?> diff --git a/administrator/components/com_templates/views/template/tmpl/default.php b/administrator/components/com_templates/views/template/tmpl/default.php index 4e7d98c7b72a4..ad3577b887b88 100644 --- a/administrator/components/com_templates/views/template/tmpl/default.php +++ b/administrator/components/com_templates/views/template/tmpl/default.php @@ -194,7 +194,7 @@ function clearCoords()

- +

diff --git a/administrator/components/com_templates/views/templates/tmpl/default.php b/administrator/components/com_templates/views/templates/tmpl/default.php index b52fd467a4b4d..1de575e197695 100644 --- a/administrator/components/com_templates/views/templates/tmpl/default.php +++ b/administrator/components/com_templates/views/templates/tmpl/default.php @@ -36,10 +36,10 @@ - - diff --git a/administrator/language/en-GB/en-GB.com_banners.ini b/administrator/language/en-GB/en-GB.com_banners.ini index 39f2baf179de6..470575e84a907 100644 --- a/administrator/language/en-GB/en-GB.com_banners.ini +++ b/administrator/language/en-GB/en-GB.com_banners.ini @@ -121,6 +121,7 @@ COM_BANNERS_FIELD_LANGUAGE_DESC="Assign a language to this banner." COM_BANNERS_FIELD_METAKEYWORDPREFIX_DESC="When matching Meta keywords, only search for Meta keywords with this prefix (improves performance)." COM_BANNERS_FIELD_METAKEYWORDPREFIX_LABEL="Meta Keyword Prefix" COM_BANNERS_FIELD_METAKEYWORDS_DESC="Enter the meta keywords for the banner." +COM_BANNERS_FIELD_MODIFIED_BY_DESC="Name of the user who modified this banner." COM_BANNERS_FIELD_NAME_DESC="Enter a name for the banner." COM_BANNERS_FIELD_NAME_LABEL="Name" COM_BANNERS_FIELD_PUBLISH_DOWN_DESC="An optional date to Finish Publishing the banner." diff --git a/administrator/language/en-GB/en-GB.com_contact.ini b/administrator/language/en-GB/en-GB.com_contact.ini index 9ca44bdf4f0bb..d45e9313d2d58 100644 --- a/administrator/language/en-GB/en-GB.com_contact.ini +++ b/administrator/language/en-GB/en-GB.com_contact.ini @@ -56,7 +56,7 @@ COM_CONTACT_FIELD_CONFIG_FAX_DESC="Show or hide a Fax column in the list of Cont COM_CONTACT_FIELD_CONFIG_FAX_LABEL="Fax" COM_CONTACT_FIELD_CONFIG_INDIVIDUAL_CONTACT_DESC="These settings apply for single Contact unless they are changed for a specific menu item or Contact." COM_CONTACT_FIELD_CONFIG_INDIVIDUAL_CONTACT_DISPLAY="Contact" -COM_CONTACT_FIELD_CONFIG_SHOW_IMAGE_LABEL="Image" +COM_CONTACT_FIELD_CONFIG_SHOW_IMAGE_LABEL="Image" COM_CONTACT_FIELD_CONFIG_SHOW_IMAGE_DESC="Show or hide an Image column in the list of Contacts." COM_CONTACT_FIELD_CONFIG_MOBILE_DESC="Show or hide show a Mobile column in the list of Contacts." COM_CONTACT_FIELD_CONFIG_MOBILE_LABEL="Mobile" @@ -161,6 +161,7 @@ COM_CONTACT_FIELD_LINKED_USER_DESC="Linked Joomla User." COM_CONTACT_FIELD_LINKED_USER_LABEL="Linked User" COM_CONTACT_FIELD_LINKED_USER_LABEL_ASC="Linked User ascending" COM_CONTACT_FIELD_LINKED_USER_LABEL_DESC="Linked User descending" +COM_CONTACT_FIELD_MODIFIED_BY_DESC="Name of the user who modified this contact." COM_CONTACT_FIELD_MODIFIED_DESC="The date and time that the contact was last modified." COM_CONTACT_FIELD_NAME_DESC="Contact name." COM_CONTACT_FIELD_NAME_LABEL="Name" diff --git a/administrator/language/en-GB/en-GB.com_installer.ini b/administrator/language/en-GB/en-GB.com_installer.ini index 0dbe8eedcf152..dfa94c7a1192a 100644 --- a/administrator/language/en-GB/en-GB.com_installer.ini +++ b/administrator/language/en-GB/en-GB.com_installer.ini @@ -140,10 +140,11 @@ COM_INSTALLER_MSG_UPDATE_NOUPDATES="There are no updates available at the moment COM_INSTALLER_MSG_UPDATE_SITES_COUNT_CHECK="Some update sites are disabled. You may want to check the Update Sites Manager." COM_INSTALLER_MSG_UPDATE_SUCCESS="Updating %s was successful." COM_INSTALLER_MSG_UPDATE_UPDATE="Update" -COM_INSTALLER_MSG_UPDATESITES_DELETE_ERROR="An error has occured while trying to delete "_QQ_"%s"_QQ_" update site: %s." +COM_INSTALLER_MSG_UPDATESITES_DELETE_ERROR="An error has occurred while trying to delete "_QQ_"%s"_QQ_" update site: %s." COM_INSTALLER_MSG_UPDATESITES_DELETE_CANNOT_DELETE="%s update site cannot be deleted." COM_INSTALLER_MSG_UPDATESITES_N_DELETE_UPDATESITES_DELETED="%s update sites have been deleted." COM_INSTALLER_MSG_UPDATESITES_N_DELETE_UPDATESITES_DELETED_1="1 update site has been deleted." +COM_INSTALLER_MSG_UPDATESITES_REBUILD_EXTENSION_PLUGIN_NOT_ENABLED="The Joomla Extension Plugin is disabled. This plugin must be enabled to rebuild the update sites." COM_INSTALLER_MSG_UPDATESITES_REBUILD_NOT_PERMITTED="Rebuilding update sites is not permitted." COM_INSTALLER_MSG_UPDATESITES_REBUILD_WARNING="Update sites have been rebuilt. No extension with updates sites discovered." COM_INSTALLER_MSG_UPDATESITES_REBUILD_SUCCESS="Update sites have been rebuilt from manifest files." @@ -256,7 +257,7 @@ COM_INSTALLER_VALUE_FOLDER_NONAPPLICABLE="N/A" COM_INSTALLER_VALUE_FOLDER_SELECT="- Select Folder -" COM_INSTALLER_VALUE_STATE_SELECT="- Select Status -" COM_INSTALLER_VALUE_TYPE_SELECT="- Select Type -" -COM_INSTALLER_WEBINSTALLER_INSTALL_OBSOLETE="The Install from Web plugin has become obsolete and needs to be updated." +COM_INSTALLER_WEBINSTALLER_INSTALL_OBSOLETE="The Install from Web plugin needs to be updated." COM_INSTALLER_WEBINSTALLER_INSTALL_UPDATE_AVAILABLE="There is a new update available for the Install from Web plugin. It is advisable that you update as soon as possible." COM_INSTALLER_WEBINSTALLER_INSTALL_WEB_CONFIRM="Please confirm the installation by selecting the Install button" COM_INSTALLER_WEBINSTALLER_INSTALL_WEB_CONFIRM_NAME="Extension Name" diff --git a/administrator/language/en-GB/en-GB.com_joomlaupdate.ini b/administrator/language/en-GB/en-GB.com_joomlaupdate.ini index 11ac6e90031c8..cf6dc7c9ac82b 100644 --- a/administrator/language/en-GB/en-GB.com_joomlaupdate.ini +++ b/administrator/language/en-GB/en-GB.com_joomlaupdate.ini @@ -55,7 +55,7 @@ COM_JOOMLAUPDATE_VIEW_DEFAULT_UPDATES_INFO_CUSTOM="You are on the "%s" COM_JOOMLAUPDATE_VIEW_DEFAULT_UPDATES_INFO_DEFAULT="You are on the "%s" update channel. Through this channel you'll receive notifications for all updates of the current Joomla release (3.x)" COM_JOOMLAUPDATE_VIEW_DEFAULT_UPDATES_INFO_NEXT="You are on the "%s" update channel. Through this channel you'll receive notifications for all updates of the current Joomla release (3.x) and you will also be notified when the future major release (4.x) will be available. Before upgrading to 4.x you'll need to assess its compatibility with your environment." COM_JOOMLAUPDATE_VIEW_DEFAULT_UPDATES_INFO_TESTING="You are on the "%s" update channel. This channel is designed for testing new releases and fixes in Joomla.
It is only intended for JBS (Joomla Bug Squad™) members and others within the Joomla community who are testing. Do not use this setting on a production site." -COM_JOOMLAUPDATE_VIEW_DEFAULT_UPLOAD_INTRO="You can use this feature to update Joomla if your server is behind a firewall or otherwise unable to contact the update servers. First download the Joomla Upgrade Package in ZIP format from the official Joomla download page. Then use the fields below to upload and install it." +COM_JOOMLAUPDATE_VIEW_DEFAULT_UPLOAD_INTRO="You can use this feature to update Joomla if your server is behind a firewall or otherwise unable to contact the update servers. First download the Joomla Upgrade Package in ZIP format from the official Joomla download page. Then use the fields below to upload and install it." COM_JOOMLAUPDATE_VIEW_PROGRESS="Update progress" COM_JOOMLAUPDATE_VIEW_UPDATE_BYTESEXTRACTED="Bytes extracted" COM_JOOMLAUPDATE_VIEW_UPDATE_BYTESREAD="Bytes read" diff --git a/administrator/language/en-GB/en-GB.com_newsfeeds.ini b/administrator/language/en-GB/en-GB.com_newsfeeds.ini index 31d002c1a052d..f09ab787c07f5 100644 --- a/administrator/language/en-GB/en-GB.com_newsfeeds.ini +++ b/administrator/language/en-GB/en-GB.com_newsfeeds.ini @@ -44,6 +44,7 @@ COM_NEWSFEEDS_FIELD_IMAGE_CAPTION_LABEL="Caption" COM_NEWSFEEDS_FIELD_LANGUAGE_DESC="Assign a language to this news feed." COM_NEWSFEEDS_FIELD_LINK_DESC="Link to the news feed. IDN (International) Links are converted to punycode when they are saved." COM_NEWSFEEDS_FIELD_LINK_LABEL="Link" +COM_NEWSFEEDS_FIELD_MODIFIED_BY_DESC="Name of the user who modified this news feed." COM_NEWSFEEDS_FIELD_MODIFIED_DESC="The date and time the news feed was last modified." COM_NEWSFEEDS_FIELD_NUM_ARTICLES_COLUMN_DESC="Show or hide the Number of Articles in each Feed (You can set this value in each News feed)." COM_NEWSFEEDS_FIELD_NUM_ARTICLES_COLUMN_LABEL="# Articles" @@ -129,4 +130,4 @@ COM_NEWSFEEDS_UNPUBLISH_ITEM="Unpublish News Feed" COM_NEWSFEEDS_WARNING_PROVIDE_VALID_NAME="Please provide a valid name." COM_NEWSFEEDS_XML_DESCRIPTION="This component manages RSS and Atom news feeds." JGLOBAL_NEWITEMSLAST_DESC="New news feeds default to the last position. The ordering can be changed after this news feed has been saved." -JLIB_RULES_SETTING_NOTES="Changes apply to this component only.
Inherited - a Global Configuration setting or higher level setting is applied.
Denied always wins - whatever is set at the Global or higher level and applies to all child elements.
Allowed will enable the action for this component unless it is overruled by a Global Configuration setting." \ No newline at end of file +JLIB_RULES_SETTING_NOTES="Changes apply to this component only.
Inherited - a Global Configuration setting or higher level setting is applied.
Denied always wins - whatever is set at the Global or higher level and applies to all child elements.
Allowed will enable the action for this component unless it is overruled by a Global Configuration setting." diff --git a/administrator/language/en-GB/en-GB.com_plugins.ini b/administrator/language/en-GB/en-GB.com_plugins.ini index 0f6bb627acbc5..cd521451c0df7 100644 --- a/administrator/language/en-GB/en-GB.com_plugins.ini +++ b/administrator/language/en-GB/en-GB.com_plugins.ini @@ -38,7 +38,7 @@ COM_PLUGINS_OPTION_FOLDER="- Select Type -" COM_PLUGINS_PLUGIN="Plugin" COM_PLUGINS_PLUGINS="Plugins" COM_PLUGINS_SAVE_SUCCESS="Plugin successfully saved." -COM_PLUGINS_SEARCH_IN_TITLE="Search in plugin name. Prefix with ID: to search for a plugin ID" +COM_PLUGINS_SEARCH_IN_TITLE="Search in plugin name. Prefix with ID: to search for a plugin ID." COM_PLUGINS_XML_DESCRIPTION="This component manages Joomla plugins." COM_PLUGINS_XML_ERR="Plugins XML data not available." JLIB_HTML_PUBLISH_ITEM="Enable plugin" diff --git a/administrator/language/en-GB/en-GB.com_tags.ini b/administrator/language/en-GB/en-GB.com_tags.ini index 41cea0401ce5a..7439624563974 100644 --- a/administrator/language/en-GB/en-GB.com_tags.ini +++ b/administrator/language/en-GB/en-GB.com_tags.ini @@ -165,7 +165,7 @@ COM_TAGS_TAG_LIST_SHOW_ITEM_IMAGE_DESC="Shows the image for each item." COM_TAGS_TAG_LIST_SHOW_ITEM_IMAGE_LABEL="Item Image" COM_TAGS_TAG_LIST_SHOW_ITEM_DESCRIPTION_DESC="Whether to show or hide the description for each item in the list. The length may be limited using the Maximum Characters option." COM_TAGS_TAG_LIST_SHOW_ITEM_DESCRIPTION_LABEL="Item Description" -COM_TAGS_TAG_VIEW_LIST_DESC="Displays a compact list of items that have been tagged with the selected tags." +COM_TAGS_TAG_VIEW_LIST_DESC="Displays a compact list of items with the selected tags." COM_TAGS_TAG_VIEW_LIST_OPTION="List view options" COM_TAGS_TAG_VIEW_LIST_TITLE="Tagged items list" COM_TAGS_TAGGED_ITEMS_ACCESS="Access" diff --git a/administrator/language/en-GB/en-GB.com_templates.ini b/administrator/language/en-GB/en-GB.com_templates.ini index 9c68bfb3e07fe..121d42fdd3be7 100644 --- a/administrator/language/en-GB/en-GB.com_templates.ini +++ b/administrator/language/en-GB/en-GB.com_templates.ini @@ -37,7 +37,7 @@ COM_TEMPLATES_CONFIG_FONT_DESC="These file types will be available for font prev COM_TEMPLATES_CONFIG_FONT_LABEL="Valid Font Formats" COM_TEMPLATES_CONFIG_IMAGE_DESC="These file types will be available for cropping and resizing." COM_TEMPLATES_CONFIG_IMAGE_LABEL="Valid Image Formats" -COM_TEMPLATES_CONFIG_SOURCE_DESC="These file types will be available for editing in editor." +COM_TEMPLATES_CONFIG_SOURCE_DESC="These file types will be available for editing." COM_TEMPLATES_CONFIG_SOURCE_LABEL="Valid Source Formats" COM_TEMPLATES_CONFIG_SUPPORTED_DESC="Be careful before changing the file types. Read the tool tips before editing." COM_TEMPLATES_CONFIG_SUPPORTED_LABEL="Supported File Formats" @@ -116,7 +116,7 @@ COM_TEMPLATES_FILE_NEW_NAME_LABEL="Copied File Name" COM_TEMPLATES_FILE_EXISTS="File with the same name already exists." COM_TEMPLATES_FILE_INFO="File Information" COM_TEMPLATES_FILE_NAME="File Name" -COM_TEMPLATES_FILE_PERMISSIONS="The File Permissions are " +COM_TEMPLATES_FILE_PERMISSIONS="The File Permissions are %s" COM_TEMPLATES_FILE_RENAME_ERROR="An error occurred renaming the file." COM_TEMPLATES_FILE_RENAME_SUCCESS="File renamed successfully." COM_TEMPLATES_FILE_RESIZE_ERROR="Failed to resize image." @@ -165,15 +165,15 @@ COM_TEMPLATES_MANAGER_EDIT_FILE="Templates: Edit File" COM_TEMPLATES_MANAGER_EDIT_STYLE="Templates: Edit Style" COM_TEMPLATES_MANAGE_FOLDERS="Manage Folders" COM_TEMPLATES_MANAGER_STYLES="Templates: Styles" -COM_TEMPLATES_MANAGER_STYLES_ADMIN="Templates: Styles (Admin)" +COM_TEMPLATES_MANAGER_STYLES_ADMIN="Templates: Styles (Administrator)" COM_TEMPLATES_MANAGER_STYLES_SITE="Templates: Styles (Site)" COM_TEMPLATES_MANAGER_TEMPLATES="Templates" -COM_TEMPLATES_MANAGER_TEMPLATES_ADMIN="Templates: Templates (Admin)" +COM_TEMPLATES_MANAGER_TEMPLATES_ADMIN="Templates: Templates (Administrator)" COM_TEMPLATES_MANAGER_TEMPLATES_SITE="Templates: Templates (Site)" COM_TEMPLATES_MANAGER_VIEW_TEMPLATE="Templates: Customise" COM_TEMPLATES_MENU_CHANGED_1="1 menu item has been assigned or unassigned to this style." COM_TEMPLATES_MENU_CHANGED_MORE="%d menu items have been assigned or unassigned to this style." -COM_TEMPLATES_MENUS_ASSIGNMENT="Menus assignment" +COM_TEMPLATES_MENUS_ASSIGNMENT="Menu Assignment" COM_TEMPLATES_MODAL_FILE_DELETE="The file %s will be deleted." COM_TEMPLATES_MSG_MANAGE_NO_STYLES="There are no styles installed matching your query." COM_TEMPLATES_MSG_MANAGE_NO_TEMPLATES="There are no templates installed matching your query." diff --git a/administrator/language/en-GB/en-GB.com_users.ini b/administrator/language/en-GB/en-GB.com_users.ini index 84147c955e1e9..4454576f0002a 100644 --- a/administrator/language/en-GB/en-GB.com_users.ini +++ b/administrator/language/en-GB/en-GB.com_users.ini @@ -39,7 +39,7 @@ COM_USERS_CONFIG_FIELD_FRONTEND_LANG_LABEL="Frontend Language" COM_USERS_CONFIG_FIELD_FRONTEND_RESET_COUNT_DESC="The maximum number of password resets allowed within the time period. Zero indicates no limit." COM_USERS_CONFIG_FIELD_FRONTEND_RESET_COUNT_LABEL="Maximum Reset Count" COM_USERS_CONFIG_FIELD_FRONTEND_RESET_TIME_DESC="The time period, in hours, for the reset counter." -COM_USERS_CONFIG_FIELD_FRONTEND_RESET_TIME_LABEL="Time in Hours" +COM_USERS_CONFIG_FIELD_FRONTEND_RESET_TIME_LABEL="Reset Time" COM_USERS_CONFIG_FIELD_FRONTEND_USERPARAMS_DESC="If set to Show, Users will be able to select their language, editor and Help Site preferences on their details screen when logged-in to the Frontend." COM_USERS_CONFIG_FIELD_FRONTEND_USERPARAMS_LABEL="Frontend User Parameters" COM_USERS_CONFIG_FIELD_GUEST_USER_GROUP_DESC="The default Group that will be applied to Guest (not logged-in) Users." @@ -48,13 +48,13 @@ COM_USERS_CONFIG_FIELD_MAILBODY_SUFFIX_DESC="This is added after the mail text." COM_USERS_CONFIG_FIELD_MAILBODY_SUFFIX_LABEL="Mailbody Suffix" COM_USERS_CONFIG_FIELD_MAILTOADMIN_DESC="If set to Yes then a notification mail will be sent to administrators if 'New User Account Activation' is set to 'None' or 'Self'." COM_USERS_CONFIG_FIELD_MAILTOADMIN_LABEL="Notification Mail to Administrators" -COM_USERS_CONFIG_FIELD_MINIMUM_INTEGERS="Password Minimum Integers" +COM_USERS_CONFIG_FIELD_MINIMUM_INTEGERS="Minimum Integers" COM_USERS_CONFIG_FIELD_MINIMUM_INTEGERS_DESC="Set the minimum number of integers that must be included in a password." -COM_USERS_CONFIG_FIELD_MINIMUM_PASSWORD_LENGTH="Password Minimum Length" +COM_USERS_CONFIG_FIELD_MINIMUM_PASSWORD_LENGTH="Minimum Length" COM_USERS_CONFIG_FIELD_MINIMUM_PASSWORD_LENGTH_DESC="Set the minimum length for a password." -COM_USERS_CONFIG_FIELD_MINIMUM_SYMBOLS="Password Minimum Symbols" +COM_USERS_CONFIG_FIELD_MINIMUM_SYMBOLS="Minimum Symbols" COM_USERS_CONFIG_FIELD_MINIMUM_SYMBOLS_DESC="Set the minimum number of symbols (such as !@#$) required in a password." -COM_USERS_CONFIG_FIELD_MINIMUM_UPPERCASE="Password Minimum Upper Case" +COM_USERS_CONFIG_FIELD_MINIMUM_UPPERCASE="Minimum Upper Case" COM_USERS_CONFIG_FIELD_MINIMUM_UPPERCASE_DESC="Set the minimum number of upper case ASCII characters required for a password." COM_USERS_CONFIG_FIELD_NEW_USER_TYPE_DESC="The default group that will be applied to New Users Registering via the Frontend." COM_USERS_CONFIG_FIELD_NEW_USER_TYPE_LABEL="New User Registration Group" @@ -68,7 +68,9 @@ COM_USERS_CONFIG_FIELD_USERACTIVATION_LABEL="New User Account Activation" COM_USERS_CONFIG_FIELD_USERACTIVATION_OPTION_ADMINACTIVATION="Administrator" COM_USERS_CONFIG_FIELD_USERACTIVATION_OPTION_SELFACTIVATION="Self" COM_USERS_CONFIG_IMPORT_FAILED="An error was encountered while importing the configuration: %s." +COM_USERS_CONFIG_PASSWORD_OPTIONS="Password Options" COM_USERS_CONFIG_SAVE_FAILED="An error was encountered while saving the configuration: %s." +COM_USERS_CONFIG_USER_OPTIONS="User Options" COM_USERS_CONFIGURATION="Users: Options" COM_USERS_COUNT_ENABLED_USERS="Enabled users" COM_USERS_COUNT_DISABLED_USERS="Disabled users" @@ -273,7 +275,7 @@ COM_USERS_SEARCH_ASSETS="Search Assets" COM_USERS_SEARCH_GROUPS_LABEL="Search User Groups" COM_USERS_SEARCH_IN_GROUPS="Search in group title. Prefix with ID: to search for a group ID." COM_USERS_SEARCH_IN_NAME="Search in name, username or email. Prefix with ID: to search for a user ID." -COM_USERS_SEARCH_IN_NOTE_TITLE="Search in subject, name or username. Prefix with ID: or UID: to search for a note ID or user ID" +COM_USERS_SEARCH_IN_NOTE_TITLE="Search in subject, name or username. Prefix with ID: or UID: to search for a note ID or user ID." COM_USERS_SEARCH_IN_LEVEL_NAME="Search in level name. Prefix with ID: to search for an access level ID." COM_USERS_SEARCH_IN_ASSETS="Search in asset name or title." COM_USERS_SEARCH_TITLE_LEVELS="Search Access Levels" diff --git a/administrator/language/en-GB/en-GB.ini b/administrator/language/en-GB/en-GB.ini index 2128151eb8774..b5995357e316b 100644 --- a/administrator/language/en-GB/en-GB.ini +++ b/administrator/language/en-GB/en-GB.ini @@ -259,6 +259,7 @@ JGLOBAL_ARTICLE_MANAGER_ORDER="Ordering" JGLOBAL_ARTICLE_ORDER_DESC="The order that articles will show in." JGLOBAL_ARTICLE_ORDER_LABEL="Article Order" JGLOBAL_ARTICLES="Articles" +JGLOBAL_ASSOC_NOT_POSSIBLE="To define associations, please first save this item and make sure its language is not set to 'All'." JGLOBAL_AUTH_ACCESS_DENIED="Access Denied" JGLOBAL_AUTH_ACCESS_GRANTED="Access Granted" JGLOBAL_AUTH_BIND_FAILED="Failed binding to LDAP server" diff --git a/administrator/language/en-GB/en-GB.lib_joomla.ini b/administrator/language/en-GB/en-GB.lib_joomla.ini index c4625bdbefcdf..aff62efa91afd 100644 --- a/administrator/language/en-GB/en-GB.lib_joomla.ini +++ b/administrator/language/en-GB/en-GB.lib_joomla.ini @@ -309,7 +309,7 @@ JLIB_FORM_MEDIA_PREVIEW_ALT="Selected image." JLIB_FORM_MEDIA_PREVIEW_EMPTY="No image selected." JLIB_FORM_MEDIA_PREVIEW_SELECTED_IMAGE="Selected image." JLIB_FORM_MEDIA_PREVIEW_TIP_TITLE="Preview" -JLIB_FORM_SELECT_USER="Select a User." +JLIB_FORM_SELECT_USER="Select a User" JLIB_FORM_VALIDATE_FIELD_INVALID="Invalid field: %s" JLIB_FORM_VALIDATE_FIELD_REQUIRED="Field required: %s" JLIB_FORM_VALIDATE_FIELD_RULE_MISSING="Validation Rule missing: %s" @@ -458,6 +458,7 @@ JLIB_INSTALLER_ABORT_CREATE_DIRECTORY="Extension %1$s: Failed to create folder: JLIB_INSTALLER_ABORT_DEBUG="Installation unexpectedly terminated:" JLIB_INSTALLER_ABORT_DETECTMANIFEST="Unable to detect manifest file." JLIB_INSTALLER_ABORT_DIRECTORY="Extension %1$s: Another %2$s is already using the named folder: %3$s. Are you trying to install the same extension again?" +JLIB_INSTALLER_ABORT_ERROR_DELETING_EXTENSIONS_RECORD="Could not delete the extension's record from the database." JLIB_INSTALLER_ABORT_EXTENSIONNOTVALID="Extension is not valid." JLIB_INSTALLER_ABORT_FILE_INSTALL_COPY_SETUP="Files Install: Could not copy setup file." JLIB_INSTALLER_ABORT_FILE_INSTALL_CUSTOM_INSTALL_FAILURE="Files Install: Custom install routine failure." @@ -628,11 +629,11 @@ JLIB_INSTALLER_ERROR_PACK_UNINSTALL_UNKNOWN_EXTENSION="Attempting to uninstall u JLIB_INSTALLER_NOT_ERROR="If the error is related to the installation of TinyMCE language files it has no effect on the installation of the language(s). Some language packs created prior to Joomla! 3.2.0 may try to install separate TinyMCE language files. As these are now included in the core they no longer need to be installed." JLIB_INSTALLER_UPDATE_LOG_QUERY="Ran query from file %1$s. Query text: %2$s." -JLIB_JS_AJAX_ERROR_CONNECTION_ABORT="A connection abort has occured while fetching the JSON data." +JLIB_JS_AJAX_ERROR_CONNECTION_ABORT="A connection abort has occurred while fetching the JSON data." JLIB_JS_AJAX_ERROR_NO_CONTENT="No content was returned." -JLIB_JS_AJAX_ERROR_OTHER="An error has occured while fetching the JSON data: HTTP %s status code." -JLIB_JS_AJAX_ERROR_PARSE="A parse error has occured while processing the following JSON data:
%s" -JLIB_JS_AJAX_ERROR_TIMEOUT="A timeout has occured while fetching the JSON data." +JLIB_JS_AJAX_ERROR_OTHER="An error has occurred while fetching the JSON data: HTTP %s status code." +JLIB_JS_AJAX_ERROR_PARSE="A parse error has occurred while processing the following JSON data:
%s" +JLIB_JS_AJAX_ERROR_TIMEOUT="A timeout has occurred while fetching the JSON data." JLIB_MAIL_FUNCTION_DISABLED="The mail() function has been disabled and the mail can't be sent." JLIB_MAIL_FUNCTION_OFFLINE="The mail function has been temporarily disabled on this site, please try again later." diff --git a/administrator/language/en-GB/en-GB.plg_installer_folderinstaller.ini b/administrator/language/en-GB/en-GB.plg_installer_folderinstaller.ini index d203854d85b18..33717a14ca278 100644 --- a/administrator/language/en-GB/en-GB.plg_installer_folderinstaller.ini +++ b/administrator/language/en-GB/en-GB.plg_installer_folderinstaller.ini @@ -6,4 +6,4 @@ PLG_INSTALLER_FOLDERINSTALLER_TEXT="Install from Folder" PLG_INSTALLER_FOLDERINSTALLER_BUTTON="Check and Install" PLG_INSTALLER_FOLDERINSTALLER_NO_INSTALL_PATH="Please enter a Folder." -PLG_INSTALLER_FOLDERINSTALLER_PLUGIN_XML_DESCRIPTION="This plugin allows to install packages from a folder." +PLG_INSTALLER_FOLDERINSTALLER_PLUGIN_XML_DESCRIPTION="This plugin allows you to install packages from a folder." diff --git a/administrator/language/en-GB/en-GB.plg_installer_folderinstaller.sys.ini b/administrator/language/en-GB/en-GB.plg_installer_folderinstaller.sys.ini index 58ba8bf180746..c6469ca6aa73f 100644 --- a/administrator/language/en-GB/en-GB.plg_installer_folderinstaller.sys.ini +++ b/administrator/language/en-GB/en-GB.plg_installer_folderinstaller.sys.ini @@ -4,4 +4,4 @@ ; Note : All ini files need to be saved as UTF-8 PLG_INSTALLER_FOLDERINSTALLER="Installer - Install from Folder" -PLG_INSTALLER_FOLDERINSTALLER_PLUGIN_XML_DESCRIPTION="This plugin allows to install packages from a folder." +PLG_INSTALLER_FOLDERINSTALLER_PLUGIN_XML_DESCRIPTION="This plugin allows you to install packages from a folder." diff --git a/administrator/language/en-GB/en-GB.plg_installer_packageinstaller.ini b/administrator/language/en-GB/en-GB.plg_installer_packageinstaller.ini index 92251fe7f894b..221bae256bbe7 100644 --- a/administrator/language/en-GB/en-GB.plg_installer_packageinstaller.ini +++ b/administrator/language/en-GB/en-GB.plg_installer_packageinstaller.ini @@ -5,7 +5,7 @@ PLG_INSTALLER_PACKAGEINSTALLER_EXTENSION_PACKAGE_FILE="Extension package file" PLG_INSTALLER_PACKAGEINSTALLER_NO_PACKAGE="Please select a package to upload" -PLG_INSTALLER_PACKAGEINSTALLER_PLUGIN_XML_DESCRIPTION="This plugin allows to install packages from your local computer." +PLG_INSTALLER_PACKAGEINSTALLER_PLUGIN_XML_DESCRIPTION="This plugin allows you to install packages from your local computer." PLG_INSTALLER_PACKAGEINSTALLER_UPLOAD_INSTALL_JOOMLA_EXTENSION="Upload & Install Joomla Extension" PLG_INSTALLER_PACKAGEINSTALLER_UPLOAD_PACKAGE_FILE="Upload Package File" PLG_INSTALLER_PACKAGEINSTALLER_UPLOAD_AND_INSTALL="Upload & Install" diff --git a/administrator/language/en-GB/en-GB.plg_installer_packageinstaller.sys.ini b/administrator/language/en-GB/en-GB.plg_installer_packageinstaller.sys.ini index aa605893f7eaa..590d917568759 100644 --- a/administrator/language/en-GB/en-GB.plg_installer_packageinstaller.sys.ini +++ b/administrator/language/en-GB/en-GB.plg_installer_packageinstaller.sys.ini @@ -4,4 +4,4 @@ ; Note : All ini files need to be saved as UTF-8 PLG_INSTALLER_PACKAGEINSTALLER="Installer - Install from Upload" -PLG_INSTALLER_PACKAGEINSTALLER_PLUGIN_XML_DESCRIPTION="This plugin allows to install packages from your local computer." +PLG_INSTALLER_PACKAGEINSTALLER_PLUGIN_XML_DESCRIPTION="This plugin allows you to install packages from your local computer." diff --git a/administrator/language/en-GB/en-GB.plg_installer_urlinstaller.ini b/administrator/language/en-GB/en-GB.plg_installer_urlinstaller.ini index a01fabc915422..00f4e63edd301 100644 --- a/administrator/language/en-GB/en-GB.plg_installer_urlinstaller.ini +++ b/administrator/language/en-GB/en-GB.plg_installer_urlinstaller.ini @@ -6,5 +6,5 @@ PLG_INSTALLER_URLINSTALLER_BUTTON="Check and Install" PLG_INSTALLER_URLINSTALLER_INSTALLER_URLFOLDERINSTALLER="Installer - Install from URL." PLG_INSTALLER_URLINSTALLER_NO_URL="Please enter a URL." -PLG_INSTALLER_URLINSTALLER_PLUGIN_XML_DESCRIPTION="This plugin allows to install packages from a URL." +PLG_INSTALLER_URLINSTALLER_PLUGIN_XML_DESCRIPTION="This plugin allows you to install packages from a URL." PLG_INSTALLER_URLINSTALLER_TEXT="Install from URL" diff --git a/administrator/language/en-GB/en-GB.plg_installer_urlinstaller.sys.ini b/administrator/language/en-GB/en-GB.plg_installer_urlinstaller.sys.ini index 9b9d9d79f8a85..908f3648f0f2e 100644 --- a/administrator/language/en-GB/en-GB.plg_installer_urlinstaller.sys.ini +++ b/administrator/language/en-GB/en-GB.plg_installer_urlinstaller.sys.ini @@ -3,5 +3,5 @@ ; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php ; Note : All ini files need to be saved as UTF-8 -PLG_INSTALLER_URLINSTALLER_PLUGIN_XML_DESCRIPTION="This plugin allows to install packages from a URL." +PLG_INSTALLER_URLINSTALLER_PLUGIN_XML_DESCRIPTION="This plugin allows you to install packages from a URL." PLG_INSTALLER_URLINSTALLER="Installer - Install from URL" diff --git a/administrator/language/en-GB/en-GB.plg_system_languagefilter.ini b/administrator/language/en-GB/en-GB.plg_system_languagefilter.ini index 6e1cf8ead6995..1c2b264f2ddb4 100644 --- a/administrator/language/en-GB/en-GB.plg_system_languagefilter.ini +++ b/administrator/language/en-GB/en-GB.plg_system_languagefilter.ini @@ -12,7 +12,7 @@ PLG_SYSTEM_LANGUAGEFILTER_FIELD_AUTOMATIC_CHANGE_LABEL="Automatic Language Chang PLG_SYSTEM_LANGUAGEFILTER_FIELD_COOKIE_DESC="Language cookies can be set to expire at the end of the session or after a year. Default is session." PLG_SYSTEM_LANGUAGEFILTER_FIELD_COOKIE_LABEL="Cookie Lifetime" PLG_SYSTEM_LANGUAGEFILTER_FIELD_DETECT_BROWSER_DESC="Choose site default language or try to detect the browser settings language. It will default to site language if browser settings can't be found." -PLG_SYSTEM_LANGUAGEFILTER_FIELD_DETECT_BROWSER_LABEL="Language Selection for new Visitors." +PLG_SYSTEM_LANGUAGEFILTER_FIELD_DETECT_BROWSER_LABEL="Language Selection for new Visitors" PLG_SYSTEM_LANGUAGEFILTER_FIELD_ITEM_ASSOCIATIONS_DESC="This option will allow item associations when switching from one language to another." PLG_SYSTEM_LANGUAGEFILTER_FIELD_ITEM_ASSOCIATIONS_LABEL="Item Associations" PLG_SYSTEM_LANGUAGEFILTER_FIELD_XDEFAULT_DESC="This option will add x-default meta tag to improve SEO." diff --git a/administrator/language/en-GB/en-GB.plg_system_logout.ini b/administrator/language/en-GB/en-GB.plg_system_logout.ini index 7437d006b83fc..132d8fcb5a5ba 100644 --- a/administrator/language/en-GB/en-GB.plg_system_logout.ini +++ b/administrator/language/en-GB/en-GB.plg_system_logout.ini @@ -3,7 +3,7 @@ ; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php ; Note : All ini files need to be saved as UTF-8 -PLG_SYSTEM_LOGOUT_XML_DESCRIPTION="The system logout plugin enables Joomla to redirect the user to the home page if he chooses to logout while he is on a protected access page." +PLG_SYSTEM_LOGOUT_XML_DESCRIPTION="The system logout plugin enables Joomla to redirect the user to the home page if they choose to logout while they are on a protected access page." PLG_SYSTEM_LOGOUT="System - Logout" PLG_SYSTEM_LOGOUT_REDIRECT="You have been redirected to the home page following logout." diff --git a/administrator/language/en-GB/en-GB.plg_system_logout.sys.ini b/administrator/language/en-GB/en-GB.plg_system_logout.sys.ini index 9a4604228e968..b41e59ff830e3 100644 --- a/administrator/language/en-GB/en-GB.plg_system_logout.sys.ini +++ b/administrator/language/en-GB/en-GB.plg_system_logout.sys.ini @@ -3,5 +3,5 @@ ; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php ; Note : All ini files need to be saved as UTF-8 -PLG_SYSTEM_LOGOUT_XML_DESCRIPTION="The system logout plugin enables Joomla to redirect the user to the home page if he chooses to logout while he is on a protected access page." +PLG_SYSTEM_LOGOUT_XML_DESCRIPTION="The system logout plugin enables Joomla to redirect the user to the home page if they choose to logout while they are on a protected access page." PLG_SYSTEM_LOGOUT="System - Logout" diff --git a/administrator/language/en-GB/en-GB.xml b/administrator/language/en-GB/en-GB.xml index dab1b13b9a4b4..b83d257911e7c 100644 --- a/administrator/language/en-GB/en-GB.xml +++ b/administrator/language/en-GB/en-GB.xml @@ -1,8 +1,8 @@ English (en-GB) - 3.6.0 - June 2016 + 3.6.1 + July 2016 Joomla! Project admin@joomla.org www.joomla.org diff --git a/administrator/language/en-GB/install.xml b/administrator/language/en-GB/install.xml index 8031d3eb870be..64ed05413d877 100644 --- a/administrator/language/en-GB/install.xml +++ b/administrator/language/en-GB/install.xml @@ -2,8 +2,8 @@ English (United Kingdom) en-GB - 3.6.0 - June 2016 + 3.6.1 + July 2016 Joomla! Project admin@joomla.org www.joomla.org diff --git a/administrator/manifests/packages/pkg_en-GB.xml b/administrator/manifests/packages/pkg_en-GB.xml index 47cf5fc21f1cc..a44fdc7bf0979 100644 --- a/administrator/manifests/packages/pkg_en-GB.xml +++ b/administrator/manifests/packages/pkg_en-GB.xml @@ -2,8 +2,8 @@ English (en-GB) Language Pack en-GB - 3.6.0.1 - June 2016 + 3.6.1.1 + July 2016 Joomla! Project admin@joomla.org www.joomla.org diff --git a/administrator/modules/mod_feed/mod_feed.php b/administrator/modules/mod_feed/mod_feed.php index 274246033913f..d2e1755a65f4e 100644 --- a/administrator/modules/mod_feed/mod_feed.php +++ b/administrator/modules/mod_feed/mod_feed.php @@ -10,7 +10,7 @@ defined('_JEXEC') or die; // Include the feed functions only once -require_once __DIR__ . '/helper.php'; +JLoader::register('ModFeedHelper', __DIR__ . '/helper.php'); $rssurl = $params->get('rssurl', ''); $rssrtl = $params->get('rssrtl', 0); diff --git a/administrator/modules/mod_latest/mod_latest.php b/administrator/modules/mod_latest/mod_latest.php index fd15cee9ee4ee..e6dab1c4d911a 100644 --- a/administrator/modules/mod_latest/mod_latest.php +++ b/administrator/modules/mod_latest/mod_latest.php @@ -10,7 +10,7 @@ defined('_JEXEC') or die; // Include dependencies. -require_once __DIR__ . '/helper.php'; +JLoader::register('ModLatestHelper', __DIR__ . '/helper.php'); $list = ModLatestHelper::getList($params); diff --git a/administrator/modules/mod_logged/mod_logged.php b/administrator/modules/mod_logged/mod_logged.php index fb0c9b12d1f83..983d0d726ee4e 100644 --- a/administrator/modules/mod_logged/mod_logged.php +++ b/administrator/modules/mod_logged/mod_logged.php @@ -10,7 +10,7 @@ defined('_JEXEC') or die; // Include dependencies. -require_once __DIR__ . '/helper.php'; +JLoader::register('ModLoggedHelper', __DIR__ . '/helper.php'); $users = ModLoggedHelper::getList($params); diff --git a/administrator/modules/mod_login/helper.php b/administrator/modules/mod_login/helper.php index 906c2a59986f1..3bac8a84318e8 100644 --- a/administrator/modules/mod_login/helper.php +++ b/administrator/modules/mod_login/helper.php @@ -80,7 +80,7 @@ public static function getReturnUri() */ public static function getTwoFactorMethods() { - require_once JPATH_ADMINISTRATOR . '/components/com_users/helpers/users.php'; + JLoader::register('UsersHelper', JPATH_ADMINISTRATOR . '/components/com_users/helpers/users.php'); return UsersHelper::getTwoFactorMethods(); } diff --git a/administrator/modules/mod_login/mod_login.php b/administrator/modules/mod_login/mod_login.php index 435226c9abc4b..0577d589bbdaf 100644 --- a/administrator/modules/mod_login/mod_login.php +++ b/administrator/modules/mod_login/mod_login.php @@ -10,7 +10,7 @@ defined('_JEXEC') or die; // Include the login functions only once -require_once __DIR__ . '/helper.php'; +JLoader::register('ModLoginHelper', __DIR__ . '/helper.php'); $langs = ModLoginHelper::getLanguageList(); $twofactormethods = ModLoginHelper::getTwoFactorMethods(); diff --git a/administrator/modules/mod_menu/mod_menu.php b/administrator/modules/mod_menu/mod_menu.php index f1a9092ef935b..5f2e811c19006 100644 --- a/administrator/modules/mod_menu/mod_menu.php +++ b/administrator/modules/mod_menu/mod_menu.php @@ -10,20 +10,13 @@ defined('_JEXEC') or die; // Include the module helper classes. -if (!class_exists('ModMenuHelper')) -{ - require __DIR__ . '/helper.php'; -} - -if (!class_exists('JAdminCssMenu')) -{ - require __DIR__ . '/menu.php'; -} +JLoader::register('ModMenuHelper', __DIR__ . '/helper.php'); +JLoader::register('JAdminCssMenu', __DIR__ . '/menu.php'); $lang = JFactory::getLanguage(); $user = JFactory::getUser(); $input = JFactory::getApplication()->input; -$menu = new JAdminCSSMenu; +$menu = new JAdminCssMenu; $enabled = $input->getBool('hidemainmenu') ? false : true; // Render the module layout diff --git a/administrator/modules/mod_popular/mod_popular.php b/administrator/modules/mod_popular/mod_popular.php index 114a5a3e065aa..24462df1d0883 100644 --- a/administrator/modules/mod_popular/mod_popular.php +++ b/administrator/modules/mod_popular/mod_popular.php @@ -10,7 +10,7 @@ defined('_JEXEC') or die; // Include the mod_popular functions only once. -require_once __DIR__ . '/helper.php'; +JLoader::register('ModPopularHelper', __DIR__ . '/helper.php'); // Get module data. $list = ModPopularHelper::getList($params); diff --git a/administrator/modules/mod_quickicon/mod_quickicon.php b/administrator/modules/mod_quickicon/mod_quickicon.php index b52bf4525dab1..52cbe3838842d 100644 --- a/administrator/modules/mod_quickicon/mod_quickicon.php +++ b/administrator/modules/mod_quickicon/mod_quickicon.php @@ -9,7 +9,7 @@ defined('_JEXEC') or die; -require_once __DIR__ . '/helper.php'; +JLoader::register('ModQuickIconHelper', __DIR__ . '/helper.php'); $buttons = ModQuickIconHelper::getButtons($params); diff --git a/administrator/modules/mod_stats_admin/mod_stats_admin.php b/administrator/modules/mod_stats_admin/mod_stats_admin.php index 20624106c09cc..d66d624e410f6 100644 --- a/administrator/modules/mod_stats_admin/mod_stats_admin.php +++ b/administrator/modules/mod_stats_admin/mod_stats_admin.php @@ -10,7 +10,7 @@ defined('_JEXEC') or die; // Include the mod_stats functions only once -require_once __DIR__ . '/helper.php'; +JLoader::register('ModStatsHelper', __DIR__ . '/helper.php'); $serverinfo = $params->get('serverinfo'); $siteinfo = $params->get('siteinfo'); diff --git a/administrator/modules/mod_version/mod_version.php b/administrator/modules/mod_version/mod_version.php index 15a2858a98340..d2848caa4ec84 100644 --- a/administrator/modules/mod_version/mod_version.php +++ b/administrator/modules/mod_version/mod_version.php @@ -9,7 +9,7 @@ defined('_JEXEC') or die; -require_once __DIR__ . '/helper.php'; +JLoader::register('ModVersionHelper', __DIR__ . '/helper.php'); $version = ModVersionHelper::getVersion($params); diff --git a/administrator/templates/hathor/css/template.css b/administrator/templates/hathor/css/template.css index 32d3ffe98e3f8..1b2f627ae1138 100644 --- a/administrator/templates/hathor/css/template.css +++ b/administrator/templates/hathor/css/template.css @@ -54,7 +54,7 @@ *z-index: 2050; } .modal-open .popover { - z-index: 2060; + z-index: 2110; } .modal-open .tooltip { z-index: 2080; @@ -165,6 +165,131 @@ body.modal-open { font-size: 1.2em; line-height: 1.6em; } +.popover { + position: absolute; + top: 0; + left: 0; + z-index: 1060; + display: none; + max-width: 276px; + padding: 1px; + text-align: left; + background-color: #ffffff; + -webkit-background-clip: padding-box; + -moz-background-clip: padding; + background-clip: padding-box; + border: 1px solid #ccc; + border: 1px solid rgba(0,0,0,0.2); + -webkit-border-radius: 6px; + -moz-border-radius: 6px; + border-radius: 6px; + -webkit-box-shadow: 0 5px 10px rgba(0,0,0,0.2); + -moz-box-shadow: 0 5px 10px rgba(0,0,0,0.2); + box-shadow: 0 5px 10px rgba(0,0,0,0.2); + white-space: normal; +} +.popover.top { + margin-top: -10px; +} +.popover.right { + margin-left: 10px; +} +.popover.bottom { + margin-top: 10px; +} +.popover.left { + margin-left: -10px; +} +.popover-title { + margin: 0; + padding: 8px 14px; + font-size: 14px; + font-weight: normal; + line-height: 18px; + background-color: #f7f7f7; + border-bottom: 1px solid #ebebeb; + -webkit-border-radius: 5px 5px 0 0; + -moz-border-radius: 5px 5px 0 0; + border-radius: 5px 5px 0 0; +} +.popover-title:empty { + display: none; +} +.popover-content { + padding: 9px 14px; +} +.popover .arrow, +.popover .arrow:after { + position: absolute; + display: block; + width: 0; + height: 0; + border-color: transparent; + border-style: solid; +} +.popover .arrow { + border-width: 11px; +} +.popover .arrow:after { + border-width: 10px; + content: ""; +} +.popover.top .arrow { + left: 50%; + margin-left: -11px; + border-bottom-width: 0; + border-top-color: #999; + border-top-color: rgba(0,0,0,0.25); + bottom: -11px; +} +.popover.top .arrow:after { + bottom: 1px; + margin-left: -10px; + border-bottom-width: 0; + border-top-color: #ffffff; +} +.popover.right .arrow { + top: 50%; + left: -11px; + margin-top: -11px; + border-left-width: 0; + border-right-color: #999; + border-right-color: rgba(0,0,0,0.25); +} +.popover.right .arrow:after { + left: 1px; + bottom: -10px; + border-left-width: 0; + border-right-color: #ffffff; +} +.popover.bottom .arrow { + left: 50%; + margin-left: -11px; + border-top-width: 0; + border-bottom-color: #999; + border-bottom-color: rgba(0,0,0,0.25); + top: -11px; +} +.popover.bottom .arrow:after { + top: 1px; + margin-left: -10px; + border-top-width: 0; + border-bottom-color: #ffffff; +} +.popover.left .arrow { + top: 50%; + right: -11px; + margin-top: -11px; + border-right-width: 0; + border-left-color: #999; + border-left-color: rgba(0,0,0,0.25); +} +.popover.left .arrow:after { + right: 1px; + border-right-width: 0; + border-left-color: #ffffff; + bottom: -10px; +} @font-face { font-family: 'IcoMoon'; src: url('../../../../media/jui/fonts/IcoMoon.eot'); @@ -3454,10 +3579,6 @@ fieldset.uploadform { margin-top: 10px; margin-bottom: 10px; } -fieldset.uploadform .control-group, -fieldset.uploadform .form-actions { - display: inline-block; -} #installer-database, #installer-discover, #installer-update, diff --git a/administrator/templates/hathor/css/template_rtl.css b/administrator/templates/hathor/css/template_rtl.css index bbe70488be562..a0972b17b46ee 100644 --- a/administrator/templates/hathor/css/template_rtl.css +++ b/administrator/templates/hathor/css/template_rtl.css @@ -1289,6 +1289,7 @@ div.btn-toolbar { float: left; } +.popover, .tooltip-inner { text-align: right; } diff --git a/administrator/templates/hathor/html/com_banners/download/default.php b/administrator/templates/hathor/html/com_banners/download/default.php new file mode 100644 index 0000000000000..22fdafc1f6a37 --- /dev/null +++ b/administrator/templates/hathor/html/com_banners/download/default.php @@ -0,0 +1,44 @@ + 'bottom')); +?> +
+ + +
+
    + form->getFieldset() as $field) : ?> +
  • + form->getLabel($field->fieldname); ?> + form->getInput($field->fieldname); ?> +
  • + +
+
+ + + + +
diff --git a/administrator/templates/hathor/html/com_banners/tracks/default.php b/administrator/templates/hathor/html/com_banners/tracks/default.php index fc11820122862..71c66eb22fcaf 100644 --- a/administrator/templates/hathor/html/com_banners/tracks/default.php +++ b/administrator/templates/hathor/html/com_banners/tracks/default.php @@ -19,112 +19,131 @@ $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); ?> -
+ sidebar)) : ?> -
+
sidebar; ?>
-
+
-
- - - -
- - - - - state->get('filter.category_id');?> - - - - - - -
-
-
- -
+ + @@ -71,7 +71,9 @@ name)); ?>
preview && $item->client_id == '0') : ?> - + + + client_id == '1') : ?> diff --git a/administrator/components/com_users/config.xml b/administrator/components/com_users/config.xml index 8a94f8332a27f..aa72720a76d38 100644 --- a/administrator/components/com_users/config.xml +++ b/administrator/components/com_users/config.xml @@ -1,6 +1,8 @@ -
+
JYES + +
+ +
+ + importPlugin('twofactorauth'); $identities = FOFPlatform::getInstance()->runPlugins('onUserTwofactorIdentify', array()); diff --git a/administrator/components/com_users/models/debuggroup.php b/administrator/components/com_users/models/debuggroup.php index dd9ed7526d218..dd085870950eb 100644 --- a/administrator/components/com_users/models/debuggroup.php +++ b/administrator/components/com_users/models/debuggroup.php @@ -9,7 +9,7 @@ defined('_JEXEC') or die; -require_once JPATH_COMPONENT . '/helpers/debug.php'; +JLoader::register('UsersHelperDebug', JPATH_ADMINISTRATOR . '/components/com_users/helpers/debug.php'); /** * Methods supporting a list of user records. diff --git a/administrator/components/com_users/models/debuguser.php b/administrator/components/com_users/models/debuguser.php index 94e155af43f0c..2b41aee566091 100644 --- a/administrator/components/com_users/models/debuguser.php +++ b/administrator/components/com_users/models/debuguser.php @@ -9,7 +9,7 @@ defined('_JEXEC') or die; -require_once JPATH_COMPONENT . '/helpers/debug.php'; +JLoader::register('UsersHelperDebug', JPATH_ADMINISTRATOR . '/components/com_users/helpers/debug.php'); /** * Methods supporting a list of user records. diff --git a/administrator/components/com_users/models/levels.php b/administrator/components/com_users/models/levels.php index d837fae8aa0e0..9aa2368986744 100644 --- a/administrator/components/com_users/models/levels.php +++ b/administrator/components/com_users/models/levels.php @@ -177,7 +177,7 @@ public function reorder($pk, $direction = 0) * @param array $pks An array of primary key ids. * @param integer $order Order position * - * @return boolean + * @return boolean|JException Boolean true on success, boolean false or JException instance on error */ public function saveorder($pks, $order) { diff --git a/administrator/components/com_users/models/user.php b/administrator/components/com_users/models/user.php index 0a2f517bce256..795eb8ba2739c 100644 --- a/administrator/components/com_users/models/user.php +++ b/administrator/components/com_users/models/user.php @@ -38,12 +38,6 @@ public function __construct($config = array()) ); parent::__construct($config); - - // Load the Joomla! RAD layer - if (!defined('FOF_INCLUDED')) - { - include_once JPATH_LIBRARIES . '/fof/include.php'; - } } /** @@ -1207,8 +1201,8 @@ public function isValidSecretKey($user_id, $secretkey, $options = array()) $warnMessage = $options['warn_irq_msg']; } - // Warn the user if he's using a secret code but he has not - // enabled two factor auth in his account. + // Warn the user if they are using a secret code but they have not + // enabled two factor auth in their account. if (!empty($secretkey) && $warn) { try @@ -1231,12 +1225,6 @@ public function isValidSecretKey($user_id, $secretkey, $options = array()) 'secretkey' => $secretkey, ); - // Load the Joomla! RAD layer - if (!defined('FOF_INCLUDED')) - { - include_once JPATH_LIBRARIES . '/fof/include.php'; - } - // Try to validate the OTP FOFPlatform::getInstance()->importPlugin('twofactorauth'); @@ -1300,7 +1288,7 @@ public function isValidOtep($user_id, $otep, $otpConfig = null) { /** * Two factor authentication enabled and no OTEPs defined. The - * user has used them all up. Therefore anything he enters is + * user has used them all up. Therefore anything they enter is * an invalid OTEP. */ return false; diff --git a/administrator/components/com_users/views/note/view.html.php b/administrator/components/com_users/views/note/view.html.php index 5d1968488d391..37476dcbe54e6 100644 --- a/administrator/components/com_users/views/note/view.html.php +++ b/administrator/components/com_users/views/note/view.html.php @@ -114,7 +114,7 @@ protected function addToolbar() } else { - if ($this->state->params->get('save_history', 0) && $user->authorise('core.edit')) + if ($this->state->params->get('save_history', 0) && $canDo->get('core.edit')) { JToolbarHelper::versions('com_users.note', $this->item->id); } diff --git a/administrator/components/com_users/views/users/tmpl/modal.php b/administrator/components/com_users/views/users/tmpl/modal.php index 9baf6fe79c014..ec412b4e276ea 100644 --- a/administrator/components/com_users/views/users/tmpl/modal.php +++ b/administrator/components/com_users/views/users/tmpl/modal.php @@ -27,13 +27,29 @@ $enabledStates = array(0 => 'icon-publish', 1 => 'icon-unpublish'); $activatedStates = array(0 => 'icon-publish', 1 => 'icon-unpublish'); $userRequired = (int) $input->get('required', 0, 'int'); + +/** + * Mootools compatibility + * + * There is an extra option passed in the url for the iframe &ismoo=0 for the bootstraped field. + * By default the value will be 1 or defaults to mootools behaviour using function jSelectUser() + * + * This should be removed when mootools won't be shipped by Joomla. + */ +$isMoo = $input->getInt('ismoo', 1); + +if ($isMoo) +{ + $onClick = "window.parent.jSelectUser(this);window.parent.jQuery('.modal.in').modal('hide');"; +} + ?>
  + data-user-field="escape($field);?>" value="" onclick="window.parent.jSelectUser(this)"> 
$this)); ?> @@ -79,7 +95,7 @@
+ data-user-field="escape($field);?>" onclick=""> escape($item->name); ?>
- - - - - - - - - - - - - items as $i => $item) :?> - - - - - - - - - - -
- - - - - - - - - - - -
- banner_name;?> - - client_name;?> - - category_title;?> - - track_type == 1 ? JText::_('COM_BANNERS_IMPRESSION'): JText::_('COM_BANNERS_CLICK');?> - - count;?> - - track_date, JText::_('DATE_FORMAT_LC4').' H:i');?> -
- - pagination->getListFooter(); ?> - - - - - - -
+ +
+ + + +
+ + + + + state->get('filter.category_id');?> + + + + + + +
+
+ +
+ + + + + + + + + + + + + + + items as $i => $item) :?> + + + + + + + + + + +
+ + + + + + + + + + + +
+ banner_name;?> + + client_name;?> + + category_title;?> + + track_type == 1 ? JText::_('COM_BANNERS_IMPRESSION'): JText::_('COM_BANNERS_CLICK');?> + + count;?> + + track_date, JText::_('DATE_FORMAT_LC4').' H:i');?> +
+ + + JText::_('COM_BANNERS_TRACKS_DOWNLOAD'), + 'url' => JRoute::_('index.php?option=com_banners&view=download&tmpl=component'), + 'width' => '100%', + 'height' => '300px', + 'footer' => '' + . '', + ) + ); ?> + + pagination->getListFooter(); ?> + + + + + + +
diff --git a/administrator/templates/hathor/html/com_content/articles/modal.php b/administrator/templates/hathor/html/com_content/articles/modal.php index 7a03a43a507ba..e2aa9fb8b810f 100644 --- a/administrator/templates/hathor/html/com_content/articles/modal.php +++ b/administrator/templates/hathor/html/com_content/articles/modal.php @@ -16,7 +16,7 @@ JSession::checkToken('get') or die(JText::_('JINVALID_TOKEN')); } -require_once JPATH_ROOT . '/components/com_content/helpers/route.php'; +JLoader::register('ContentHelperRoute', JPATH_ROOT . '/components/com_content/helpers/route.php'); JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); diff --git a/administrator/templates/hathor/html/com_installer/database/default.php b/administrator/templates/hathor/html/com_installer/database/default.php index 50e20b785e83e..ea1a8b00da5f7 100644 --- a/administrator/templates/hathor/html/com_installer/database/default.php +++ b/administrator/templates/hathor/html/com_installer/database/default.php @@ -21,11 +21,9 @@
errorCount === 0) : ?> -

1)); ?> -

1)); ?> errorCount); ?> diff --git a/administrator/templates/hathor/html/com_installer/install/default_form.php b/administrator/templates/hathor/html/com_installer/install/default_form.php index ea2e8c1e99901..e2b485cbe4915 100644 --- a/administrator/templates/hathor/html/com_installer/install/default_form.php +++ b/administrator/templates/hathor/html/com_installer/install/default_form.php @@ -81,7 +81,7 @@ showJedAndWebInstaller && !$this->showMessage) : ?>
- ">× + ">

 

diff --git a/administrator/templates/hathor/html/com_menus/menutypes/default.php b/administrator/templates/hathor/html/com_menus/menutypes/default.php index da0fa0b95564b..f617be97300ef 100644 --- a/administrator/templates/hathor/html/com_menus/menutypes/default.php +++ b/administrator/templates/hathor/html/com_menus/menutypes/default.php @@ -12,6 +12,7 @@ $input = JFactory::getApplication()->input; // Checking if loaded via index.php or component.php $tmpl = ($input->getCmd('tmpl') != '') ? '1' : ''; + JFactory::getDocument()->addScriptDeclaration( ' setmenutype = function(type) { @@ -38,7 +39,7 @@
diff --git a/administrator/templates/hathor/html/com_modules/module/edit_assignment.php b/administrator/templates/hathor/html/com_modules/module/edit_assignment.php index 174fe4d4163aa..b05b23c1dacca 100644 --- a/administrator/templates/hathor/html/com_modules/module/edit_assignment.php +++ b/administrator/templates/hathor/html/com_modules/module/edit_assignment.php @@ -9,8 +9,8 @@ defined('_JEXEC') or die; -// Initiasile related data. -require_once JPATH_ADMINISTRATOR.'/components/com_menus/helpers/menus.php'; +// Initialise related data. +JLoader::register('MenusHelper', JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php'); $menuTypes = MenusHelper::getMenuLinks(); JFactory::getDocument()->addScriptDeclaration(" diff --git a/administrator/templates/hathor/html/com_templates/style/edit_assignment.php b/administrator/templates/hathor/html/com_templates/style/edit_assignment.php index 9fb7a2f6b622d..50df87dff8b3a 100644 --- a/administrator/templates/hathor/html/com_templates/style/edit_assignment.php +++ b/administrator/templates/hathor/html/com_templates/style/edit_assignment.php @@ -9,8 +9,8 @@ defined('_JEXEC') or die; -// Initiasile related data. -require_once JPATH_ADMINISTRATOR.'/components/com_menus/helpers/menus.php'; +// Initialise related data. +JLoader::register('MenusHelper', JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php'); $menuTypes = MenusHelper::getMenuLinks(); $user = JFactory::getUser(); diff --git a/administrator/templates/hathor/html/com_templates/template/default.php b/administrator/templates/hathor/html/com_templates/template/default.php index 6c14bfe02f9d4..f37c916fc0a33 100644 --- a/administrator/templates/hathor/html/com_templates/template/default.php +++ b/administrator/templates/hathor/html/com_templates/template/default.php @@ -287,7 +287,7 @@ function clearCoords()

- +

diff --git a/administrator/templates/hathor/html/layouts/joomla/toolbar/modal.php b/administrator/templates/hathor/html/layouts/joomla/toolbar/modal.php new file mode 100644 index 0000000000000..ea677551e05cf --- /dev/null +++ b/administrator/templates/hathor/html/layouts/joomla/toolbar/modal.php @@ -0,0 +1,22 @@ + + + + + diff --git a/administrator/templates/hathor/less/hathor_variables.less b/administrator/templates/hathor/less/hathor_variables.less index b2c0715b62ace..36bf2f542789b 100644 --- a/administrator/templates/hathor/less/hathor_variables.less +++ b/administrator/templates/hathor/less/hathor_variables.less @@ -87,11 +87,11 @@ // Used for a bird's eye view of components dependent on the z-axis // Try to avoid customizing these :) @zindexDropdown: 1000; -@zindexPopover: 1010; @zindexTooltip: 1030; @zindexFixedNavbar: 1030; @zindexModalBackdrop: 1040; @zindexModal: 1050; +@zindexPopover: 1060; // Form states and alerts // ------------------------- diff --git a/administrator/templates/hathor/less/template.less b/administrator/templates/hathor/less/template.less index 2ee8f18353105..2e2e0e489ccea 100644 --- a/administrator/templates/hathor/less/template.less +++ b/administrator/templates/hathor/less/template.less @@ -11,6 +11,9 @@ @import "modals.less"; //@import "../../../../media/jui/less/modals.joomla.less"; +// Bootstrap Popovers +@import "../../../../media/jui/less/popovers.less"; + // Icon Font @import "icomoon.less"; diff --git a/administrator/templates/hathor/less/variables.less b/administrator/templates/hathor/less/variables.less index 1ab0a216438a3..11e990a1f1e3a 100644 --- a/administrator/templates/hathor/less/variables.less +++ b/administrator/templates/hathor/less/variables.less @@ -120,12 +120,11 @@ // Used for a bird's eye view of components dependent on the z-axis // Try to avoid customizing these :) @zindexDropdown: 1000; -@zindexPopover: 1010; @zindexTooltip: 1020; @zindexFixedNavbar: 1030; @zindexModalBackdrop: 1040; @zindexModal: 1050; - +@zindexPopover: 1060; // Sprite icons path // ------------------------- diff --git a/administrator/templates/isis/css/template-rtl.css b/administrator/templates/isis/css/template-rtl.css index 6f596db6ad80f..64129650b13cb 100644 --- a/administrator/templates/isis/css/template-rtl.css +++ b/administrator/templates/isis/css/template-rtl.css @@ -1671,6 +1671,7 @@ legend + .control-group { .form-horizontal .form-actions { padding-left: 180px; } +.control-label .hasPopover, .control-label .hasTooltip { display: inline-block; } @@ -2202,6 +2203,22 @@ button.close { border: 0; -webkit-appearance: none; } +.alert-options { + float: right; + line-height: 18px; + color: #000; + text-shadow: 0 1px 0 #ffffff; + opacity: 0.2; + filter: alpha(opacity=20); +} +.alert-options:hover, +.alert-options:focus { + color: #000; + text-decoration: none; + cursor: pointer; + opacity: 0.4; + filter: alpha(opacity=40); +} .btn { display: inline-block; *display: inline; @@ -4044,7 +4061,7 @@ input[type="submit"].btn.btn-mini { position: absolute; top: 0; left: 0; - z-index: 1010; + z-index: 1060; display: none; max-width: 276px; padding: 1px; @@ -6202,6 +6219,9 @@ th .tooltip-inner { .alert-link { font-weight: bold; } +.alert .alert-link { + color: #66512c; +} .alert-success .alert-link { color: #2b542c; } @@ -7277,6 +7297,20 @@ body .navbar-fixed-top { background-color: rgba(0,0,0,0.5); -webkit-box-shadow: 0 0 1px rgba(255,255,255,0.5); } +.navbar .nav > li > .dropdown-menu:after { + display: none; +} +.navbar .nav > .dropdown.open:after { + content: ''; + display: inline-block; + border-left: 6px solid transparent; + border-right: 6px solid transparent; + border-bottom: 6px solid #fff; + position: absolute; + top: 25px; + left: 10px; + z-index: 1001; +} .navbar .empty-nav { display: none; } @@ -8039,7 +8073,9 @@ input.input-large-text { } .chzn-color.chzn-single[rel="value_1"], .chzn-color-reverse.chzn-single[rel="value_0"], -.chzn-color-state.chzn-single[rel="value_1"] { +.chzn-color-state.chzn-single[rel="value_1"], +.chzn-color.chzn-single[rel="value_show_no_link"], +.chzn-color.chzn-single[rel="value_show_with_link"] { color: #fff; text-shadow: 0 -1px 0 rgba(0,0,0,0.25); background-color: #409740; @@ -8071,7 +8107,19 @@ input.input-large-text { .chzn-color-state.chzn-single[rel="value_1"]:active, .chzn-color-state.chzn-single[rel="value_1"].active, .chzn-color-state.chzn-single[rel="value_1"].disabled, -.chzn-color-state.chzn-single[rel="value_1"][disabled] { +.chzn-color-state.chzn-single[rel="value_1"][disabled], +.chzn-color.chzn-single[rel="value_show_no_link"]:hover, +.chzn-color.chzn-single[rel="value_show_no_link"]:focus, +.chzn-color.chzn-single[rel="value_show_no_link"]:active, +.chzn-color.chzn-single[rel="value_show_no_link"].active, +.chzn-color.chzn-single[rel="value_show_no_link"].disabled, +.chzn-color.chzn-single[rel="value_show_no_link"][disabled], +.chzn-color.chzn-single[rel="value_show_with_link"]:hover, +.chzn-color.chzn-single[rel="value_show_with_link"]:focus, +.chzn-color.chzn-single[rel="value_show_with_link"]:active, +.chzn-color.chzn-single[rel="value_show_with_link"].active, +.chzn-color.chzn-single[rel="value_show_with_link"].disabled, +.chzn-color.chzn-single[rel="value_show_with_link"][disabled] { color: #fff; background-color: #378137; *background-color: #2f6f2f; @@ -8081,14 +8129,19 @@ input.input-large-text { .chzn-color-reverse.chzn-single[rel="value_0"]:active, .chzn-color-reverse.chzn-single[rel="value_0"].active, .chzn-color-state.chzn-single[rel="value_1"]:active, -.chzn-color-state.chzn-single[rel="value_1"].active { +.chzn-color-state.chzn-single[rel="value_1"].active, +.chzn-color.chzn-single[rel="value_show_no_link"]:active, +.chzn-color.chzn-single[rel="value_show_no_link"].active, +.chzn-color.chzn-single[rel="value_show_with_link"]:active, +.chzn-color.chzn-single[rel="value_show_with_link"].active { background-color: #285d28 \9; } .chzn-color.chzn-single[rel="value_0"], .chzn-color-reverse.chzn-single[rel="value_1"], .chzn-color-state.chzn-single[rel="value_0"], .chzn-color-state.chzn-single[rel="value_-1"], -.chzn-color-state.chzn-single[rel="value_-2"] { +.chzn-color-state.chzn-single[rel="value_-2"], +.chzn-color.chzn-single[rel="value_hide"] { color: #fff; text-shadow: 0 -1px 0 rgba(0,0,0,0.25); background-color: #ad312b; @@ -8132,7 +8185,13 @@ input.input-large-text { .chzn-color-state.chzn-single[rel="value_-2"]:active, .chzn-color-state.chzn-single[rel="value_-2"].active, .chzn-color-state.chzn-single[rel="value_-2"].disabled, -.chzn-color-state.chzn-single[rel="value_-2"][disabled] { +.chzn-color-state.chzn-single[rel="value_-2"][disabled], +.chzn-color.chzn-single[rel="value_hide"]:hover, +.chzn-color.chzn-single[rel="value_hide"]:focus, +.chzn-color.chzn-single[rel="value_hide"]:active, +.chzn-color.chzn-single[rel="value_hide"].active, +.chzn-color.chzn-single[rel="value_hide"].disabled, +.chzn-color.chzn-single[rel="value_hide"][disabled] { color: #fff; background-color: #942a25; *background-color: #802420; @@ -8146,7 +8205,9 @@ input.input-large-text { .chzn-color-state.chzn-single[rel="value_-1"]:active, .chzn-color-state.chzn-single[rel="value_-1"].active, .chzn-color-state.chzn-single[rel="value_-2"]:active, -.chzn-color-state.chzn-single[rel="value_-2"].active { +.chzn-color-state.chzn-single[rel="value_-2"].active, +.chzn-color.chzn-single[rel="value_hide"]:active, +.chzn-color.chzn-single[rel="value_hide"].active { background-color: #6b1f1b \9; } #permissions-sliders .input-small { @@ -8876,9 +8937,18 @@ body { #mediamanager-form .dimensions { direction: ltr; } +.popover, .tooltip-inner { text-align: right; } +.popover.top .arrow, +.popover.bottom .arrow { + margin-right: -11px; +} +.popover.top .arrow:after, +.popover.bottom .arrow:after { + margin-right: -10px; +} @media (max-width: 480px) { .btn-toolbar .btn-wrapper { display: block; @@ -8950,6 +9020,10 @@ input[type="url"] { background-color: rgba(0,0,0,0.5); -webkit-box-shadow: 0 0 1px rgba(255,255,255,0.5); } +.navbar .nav > .dropdown.open:after { + right: 10px; + width: 0; +} .navbar .empty-nav { display: none; } diff --git a/administrator/templates/isis/css/template.css b/administrator/templates/isis/css/template.css index 58041791eb0d2..7ecf29a8336cb 100644 --- a/administrator/templates/isis/css/template.css +++ b/administrator/templates/isis/css/template.css @@ -1671,6 +1671,7 @@ legend + .control-group { .form-horizontal .form-actions { padding-left: 180px; } +.control-label .hasPopover, .control-label .hasTooltip { display: inline-block; } @@ -2202,6 +2203,22 @@ button.close { border: 0; -webkit-appearance: none; } +.alert-options { + float: right; + line-height: 18px; + color: #000; + text-shadow: 0 1px 0 #ffffff; + opacity: 0.2; + filter: alpha(opacity=20); +} +.alert-options:hover, +.alert-options:focus { + color: #000; + text-decoration: none; + cursor: pointer; + opacity: 0.4; + filter: alpha(opacity=40); +} .btn { display: inline-block; *display: inline; @@ -4044,7 +4061,7 @@ input[type="submit"].btn.btn-mini { position: absolute; top: 0; left: 0; - z-index: 1010; + z-index: 1060; display: none; max-width: 276px; padding: 1px; @@ -6202,6 +6219,9 @@ th .tooltip-inner { .alert-link { font-weight: bold; } +.alert .alert-link { + color: #66512c; +} .alert-success .alert-link { color: #2b542c; } @@ -7277,6 +7297,20 @@ body .navbar-fixed-top { background-color: rgba(0,0,0,0.5); -webkit-box-shadow: 0 0 1px rgba(255,255,255,0.5); } +.navbar .nav > li > .dropdown-menu:after { + display: none; +} +.navbar .nav > .dropdown.open:after { + content: ''; + display: inline-block; + border-left: 6px solid transparent; + border-right: 6px solid transparent; + border-bottom: 6px solid #fff; + position: absolute; + top: 25px; + left: 10px; + z-index: 1001; +} .navbar .empty-nav { display: none; } @@ -8039,7 +8073,9 @@ input.input-large-text { } .chzn-color.chzn-single[rel="value_1"], .chzn-color-reverse.chzn-single[rel="value_0"], -.chzn-color-state.chzn-single[rel="value_1"] { +.chzn-color-state.chzn-single[rel="value_1"], +.chzn-color.chzn-single[rel="value_show_no_link"], +.chzn-color.chzn-single[rel="value_show_with_link"] { color: #fff; text-shadow: 0 -1px 0 rgba(0,0,0,0.25); background-color: #409740; @@ -8071,7 +8107,19 @@ input.input-large-text { .chzn-color-state.chzn-single[rel="value_1"]:active, .chzn-color-state.chzn-single[rel="value_1"].active, .chzn-color-state.chzn-single[rel="value_1"].disabled, -.chzn-color-state.chzn-single[rel="value_1"][disabled] { +.chzn-color-state.chzn-single[rel="value_1"][disabled], +.chzn-color.chzn-single[rel="value_show_no_link"]:hover, +.chzn-color.chzn-single[rel="value_show_no_link"]:focus, +.chzn-color.chzn-single[rel="value_show_no_link"]:active, +.chzn-color.chzn-single[rel="value_show_no_link"].active, +.chzn-color.chzn-single[rel="value_show_no_link"].disabled, +.chzn-color.chzn-single[rel="value_show_no_link"][disabled], +.chzn-color.chzn-single[rel="value_show_with_link"]:hover, +.chzn-color.chzn-single[rel="value_show_with_link"]:focus, +.chzn-color.chzn-single[rel="value_show_with_link"]:active, +.chzn-color.chzn-single[rel="value_show_with_link"].active, +.chzn-color.chzn-single[rel="value_show_with_link"].disabled, +.chzn-color.chzn-single[rel="value_show_with_link"][disabled] { color: #fff; background-color: #378137; *background-color: #2f6f2f; @@ -8081,14 +8129,19 @@ input.input-large-text { .chzn-color-reverse.chzn-single[rel="value_0"]:active, .chzn-color-reverse.chzn-single[rel="value_0"].active, .chzn-color-state.chzn-single[rel="value_1"]:active, -.chzn-color-state.chzn-single[rel="value_1"].active { +.chzn-color-state.chzn-single[rel="value_1"].active, +.chzn-color.chzn-single[rel="value_show_no_link"]:active, +.chzn-color.chzn-single[rel="value_show_no_link"].active, +.chzn-color.chzn-single[rel="value_show_with_link"]:active, +.chzn-color.chzn-single[rel="value_show_with_link"].active { background-color: #285d28 \9; } .chzn-color.chzn-single[rel="value_0"], .chzn-color-reverse.chzn-single[rel="value_1"], .chzn-color-state.chzn-single[rel="value_0"], .chzn-color-state.chzn-single[rel="value_-1"], -.chzn-color-state.chzn-single[rel="value_-2"] { +.chzn-color-state.chzn-single[rel="value_-2"], +.chzn-color.chzn-single[rel="value_hide"] { color: #fff; text-shadow: 0 -1px 0 rgba(0,0,0,0.25); background-color: #ad312b; @@ -8132,7 +8185,13 @@ input.input-large-text { .chzn-color-state.chzn-single[rel="value_-2"]:active, .chzn-color-state.chzn-single[rel="value_-2"].active, .chzn-color-state.chzn-single[rel="value_-2"].disabled, -.chzn-color-state.chzn-single[rel="value_-2"][disabled] { +.chzn-color-state.chzn-single[rel="value_-2"][disabled], +.chzn-color.chzn-single[rel="value_hide"]:hover, +.chzn-color.chzn-single[rel="value_hide"]:focus, +.chzn-color.chzn-single[rel="value_hide"]:active, +.chzn-color.chzn-single[rel="value_hide"].active, +.chzn-color.chzn-single[rel="value_hide"].disabled, +.chzn-color.chzn-single[rel="value_hide"][disabled] { color: #fff; background-color: #942a25; *background-color: #802420; @@ -8146,7 +8205,9 @@ input.input-large-text { .chzn-color-state.chzn-single[rel="value_-1"]:active, .chzn-color-state.chzn-single[rel="value_-1"].active, .chzn-color-state.chzn-single[rel="value_-2"]:active, -.chzn-color-state.chzn-single[rel="value_-2"].active { +.chzn-color-state.chzn-single[rel="value_-2"].active, +.chzn-color.chzn-single[rel="value_hide"]:active, +.chzn-color.chzn-single[rel="value_hide"].active { background-color: #6b1f1b \9; } #permissions-sliders .input-small { diff --git a/administrator/templates/isis/html/layouts/joomla/form/field/user.php b/administrator/templates/isis/html/layouts/joomla/form/field/user.php index 272db3868b6d2..1ffe7948a7170 100644 --- a/administrator/templates/isis/html/layouts/joomla/form/field/user.php +++ b/administrator/templates/isis/html/layouts/joomla/form/field/user.php @@ -48,7 +48,7 @@ // Set the link for the user selection page $link = 'index.php?option=com_users&view=users&layout=modal&tmpl=component&required=' - . ($required ? 1 : 0) . '&field={field-user-id}' + . ($required ? 1 : 0) . '&field={field-user-id}&ismoo=0' . (isset($groups) ? ('&groups=' . base64_encode(json_encode($groups))) : '') . (isset($excluded) ? ('&excluded=' . base64_encode(json_encode($excluded))) : ''); diff --git a/administrator/templates/isis/js/template.js b/administrator/templates/isis/js/template.js index 28eb4ffa762c5..38f5aed4dc67d 100644 --- a/administrator/templates/isis/js/template.js +++ b/administrator/templates/isis/js/template.js @@ -10,10 +10,21 @@ { $(document).ready(function() { + var $w = $(window); + $('*[rel=tooltip]').tooltip(); // Turn radios into btn-group $('.radio.btn-group label').addClass('btn'); + + $('fieldset.btn-group').each(function() { + // Handle disabled, prevent clicks on the container, and add disabled style to each button + if ($(this).prop('disabled')) { + $(this).css('pointer-events', 'none').off('click'); + $(this).find('.btn').addClass('disabled'); + } + }); + $('.btn-group label:not(.active)').click(function() { var label = $(this); @@ -58,38 +69,61 @@ /** * Append submenu items to empty UL on hover allowing a scrollable dropdown */ - var menuScroll = $('#menu > li > ul') - var emptyMenu = $('#nav-empty'); - var menuWidth; + var menuScroll = $('#menu > li > ul'), + emptyMenu = $('#nav-empty'); + + $('#menu > li').on('click mouseenter', function() { + + // Set max-height (and width if scroll) for dropdown menu, depending of window height + var $dropdownMenu = $(this).children('ul'), + windowHeight = $w.height(), + linkHeight = $(this).outerHeight(true), + statusHeight = $('#status').outerHeight(true), + menuHeight = $dropdownMenu.height(), + menuOuterHeight = $dropdownMenu.outerHeight(true), + scrollMenuWidth = $dropdownMenu.width() + 15, + maxHeight = windowHeight - (linkHeight + statusHeight + (menuOuterHeight - menuHeight) + 20); + + if (maxHeight < menuHeight) { + $dropdownMenu.css('width', scrollMenuWidth); + } else if (maxHeight > menuHeight) { + $dropdownMenu.css('width', 'auto'); + } + + $dropdownMenu.css('max-height', maxHeight); - $('#menu > li > a').on('click mouseenter', function() { + // Get the submenu position + linkWidth = $(this).outerWidth(true); + menuWidth = $dropdownMenu.width(); + linkPaddingLeft = $(this).children('a').css('padding-left'); + offsetLeft = Math.round($(this).offset().left) - parseInt(linkPaddingLeft); - menuWidth = $(this).next('ul').outerWidth(); emptyMenu.empty().hide(); }); - menuScroll.find('.dropdown-submenu > a').on('mouseenter', function() { + menuScroll.find('.dropdown-submenu > a').on('mouseover', function() { - var $self = $(this); - var dropdown = $self.next('.dropdown-menu'); - var offset = $self.offset(); - var scroll = $(window).scrollTop() + 5; - var width = menuWidth - 13; + var $self = $(this), + dropdown = $self.next('ul'), + submenuWidth = dropdown.outerWidth(), + offsetTop = $self.offset().top, + linkPaddingTop = parseInt(dropdown.css('padding-top')) + parseInt($(this).css('padding-top')), + scroll = $w.scrollTop() + linkPaddingTop; // Set the submenu position if ($('html').attr('dir') == 'rtl') { emptyMenu.css({ - top : offset.top - scroll, - left: offset.left - width + top : offsetTop - scroll, + left: offsetLeft - (menuWidth - linkWidth) - submenuWidth }); } else { emptyMenu.css({ - top : offset.top - scroll, - left: offset.left + width + top : offsetTop - scroll, + left: offsetLeft + menuWidth }); } @@ -97,6 +131,14 @@ dropdown.hide(); emptyMenu.show().html(dropdown.html()); + // Check if the full element is visible. If not, adjust the position + if (emptyMenu.Jvisible() !== true) + { + emptyMenu.css({ + top : ($w.height() - emptyMenu.outerHeight()) - $('#status').height() + }); + } + }); menuScroll.find('a.no-dropdown').on('mouseenter', function() { @@ -109,6 +151,27 @@ }); + $.fn.Jvisible = function(partial,hidden) + { + if (this.length < 1) + { + return; + } + + var $t = this.length > 1 ? this.eq(0) : this, + t = $t.get(0) + + var viewTop = $w.scrollTop(), + viewBottom = (viewTop + $w.height()) - $('#status').height(), + offset = $t.offset(), + _top = offset.top, + _bottom = _top + $t.height(), + compareTop = partial === true ? _bottom : _top, + compareBottom = partial === true ? _top : _bottom; + + return !!t.offsetWidth * t.offsetHeight && ((compareBottom <= viewBottom) && (compareTop >= viewTop)); + }; + /** * USED IN: All views with toolbar and sticky bar enabled */ diff --git a/administrator/templates/isis/less/template-rtl.less b/administrator/templates/isis/less/template-rtl.less index e30956bd42f85..dc3bd9dd0e2ef 100644 --- a/administrator/templates/isis/less/template-rtl.less +++ b/administrator/templates/isis/less/template-rtl.less @@ -37,6 +37,10 @@ } } } + .nav > .dropdown.open:after { + right: 10px; + width: 0; + } .empty-nav { display: none; } diff --git a/administrator/templates/isis/less/template.less b/administrator/templates/isis/less/template.less index e4999725ff1e6..eba11b66355d1 100644 --- a/administrator/templates/isis/less/template.less +++ b/administrator/templates/isis/less/template.less @@ -247,6 +247,20 @@ body .navbar-fixed-top { -webkit-box-shadow: 0 0 1px rgba(255,255,255,.5); } } + .nav > li > .dropdown-menu:after { + display: none; + } + .nav > .dropdown.open:after { + content: ''; + display: inline-block; + border-left: 6px solid transparent; + border-right: 6px solid transparent; + border-bottom: 6px solid #fff; + position: absolute; + top: 25px; + left: 10px; + z-index: 1001; + } .empty-nav { display: none; } @@ -1165,7 +1179,9 @@ input.input-large-text { .chzn-color.chzn-single[rel="value_1"], .chzn-color-reverse.chzn-single[rel="value_0"], -.chzn-color-state.chzn-single[rel="value_1"] { +.chzn-color-state.chzn-single[rel="value_1"], +.chzn-color.chzn-single[rel="value_show_no_link"], +.chzn-color.chzn-single[rel="value_show_with_link"] { .buttonBackground(@btnSuccessBackground, @btnSuccessBackgroundHighlight); } @@ -1173,7 +1189,8 @@ input.input-large-text { .chzn-color-reverse.chzn-single[rel="value_1"], .chzn-color-state.chzn-single[rel="value_0"], .chzn-color-state.chzn-single[rel="value_-1"], -.chzn-color-state.chzn-single[rel="value_-2"] { +.chzn-color-state.chzn-single[rel="value_-2"], +.chzn-color.chzn-single[rel="value_hide"] { .buttonBackground(@btnDangerBackground, @btnDangerBackgroundHighlight); } /* Widen the drop downs for the Permissions Field */ @@ -1379,4 +1396,4 @@ body.modal-open { margin-bottom: 0; } } -} \ No newline at end of file +} diff --git a/administrator/templates/isis/less/variables.less b/administrator/templates/isis/less/variables.less index 80eb86acc553c..b6beb510fb7cc 100644 --- a/administrator/templates/isis/less/variables.less +++ b/administrator/templates/isis/less/variables.less @@ -149,11 +149,11 @@ // Used for a bird's eye view of components dependent on the z-axis // Try to avoid customizing these :) @zindexDropdown: 1000; -@zindexPopover: 1010; @zindexTooltip: 1030; @zindexFixedNavbar: 1030; @zindexModalBackdrop: 1040; @zindexModal: 1050; +@zindexPopover: 1060; // Sprite icons path diff --git a/build/build.php b/build/build.php index f607ec7c481fd..f5e25df954940 100644 --- a/build/build.php +++ b/build/build.php @@ -118,6 +118,10 @@ 'phpunit.xml.dist', 'tests', 'travisci-phpunit.xml', + // Remove the testing sample data from all packages + 'installation/sql/mysql/sample_testing.sql', + 'installation/sql/postgresql/sample_testing.sql', + 'installation/sql/sqlazure/sample_testing.sql', ); /* diff --git a/build/bump.php b/build/bump.php index 842d1ec35a9d5..a243d705e894a 100644 --- a/build/bump.php +++ b/build/bump.php @@ -60,7 +60,7 @@ function usage($command) ); // Change copyright date exclusions. -$copyrightDateExcludeDirectories = array( +$directoryLoopExcludeDirectories = array( '/libraries/vendor/', '/libraries/phputf8/', '/libraries/php-encryption/', @@ -69,7 +69,7 @@ function usage($command) '/libraries/fof/', ); -$copyrightDateExcludeFiles = array( +$directoryLoopExcludeFiles = array( ); // Check arguments (exit if incorrect cli arguments). @@ -259,10 +259,11 @@ function usage($command) } // Updates the copyright date in core files. -$changedFiles = 0; -$year = date('Y'); -$directory = new \RecursiveDirectoryIterator($rootPath); -$iterator = new \RecursiveIteratorIterator($directory, RecursiveIteratorIterator::SELF_FIRST); +$changedFilesCopyrightDate = 0; +$changedFilesSinceVersion = 0; +$year = date('Y'); +$directory = new \RecursiveDirectoryIterator($rootPath); +$iterator = new \RecursiveIteratorIterator($directory, RecursiveIteratorIterator::SELF_FIRST); foreach ($iterator as $file) { @@ -278,7 +279,7 @@ function usage($command) } // Exclude certain files. - if (in_array($relativePath, $copyrightDateExcludeFiles)) + if (in_array($relativePath, $directoryLoopExcludeFiles)) { continue; } @@ -286,7 +287,7 @@ function usage($command) // Exclude certain directories. $continue = true; - foreach ($copyrightDateExcludeDirectories as $excludeDirectory) + foreach ($directoryLoopExcludeDirectories as $excludeDirectory) { if (preg_match('#^' . preg_quote($excludeDirectory) . '#', $relativePath)) { @@ -297,21 +298,47 @@ function usage($command) if ($continue) { + $changeSinceVersion = false; + $changeCopyrightDate = false; + + // Load the file. $fileContents = file_get_contents($filePath); + // Check if need to change the copyright date. if (preg_match('#2005\s+-\s+[0-9]{4}\s+Open\s+Source\s+Matters#', $fileContents) && !preg_match('#2005\s+-\s+' . $year. '\s+Open\s+Source\s+Matters#', $fileContents)) { + $changeCopyrightDate = true; $fileContents = preg_replace('#2005\s+-\s+[0-9]{4}\s+Open\s+Source\s+Matters#', '2005 - ' . $year. ' Open Source Matters', $fileContents); + $changedFilesCopyrightDate++; + } + + // Check if need to change the since version. + if ($relativePath !== '/build/bump.php' && preg_match('#__DEPLOY_VERSION__#', $fileContents)) + { + $changeSinceVersion = true; + $fileContents = preg_replace('#__DEPLOY_VERSION__#', $version['release'], $fileContents); + $changedFilesSinceVersion++; + } + + // Save the file. + if ($changeCopyrightDate || $changeSinceVersion) + { file_put_contents($filePath, $fileContents); - $changedFiles++; } } } } -if ($changedFiles > 0) +if ($changedFilesCopyrightDate > 0 || $changedFilesSinceVersion > 0) { - echo '- Copyright Date changed in ' . $changedFiles . ' files.' . PHP_EOL; + if ($changedFilesCopyrightDate > 0) + { + echo '- Copyright Date changed in ' . $changedFilesCopyrightDate . ' files.' . PHP_EOL; + } + if ($changedFilesSinceVersion > 0) + { + echo '- Since Version changed in ' . $changedFilesSinceVersion . ' files.' . PHP_EOL; + } echo PHP_EOL; } diff --git a/build/phpcs/Joomla/Sniffs/ControlStructures/ControlSignatureSniff.php b/build/phpcs/Joomla/Sniffs/ControlStructures/ControlSignatureSniff.php index 748314d051ddc..c077459e37448 100644 --- a/build/phpcs/Joomla/Sniffs/ControlStructures/ControlSignatureSniff.php +++ b/build/phpcs/Joomla/Sniffs/ControlStructures/ControlSignatureSniff.php @@ -75,7 +75,7 @@ protected function getPatterns() * * @param array $patternInfo Information about the pattern used for checking, which includes are * parsed token representation of the pattern. - * @param PHP_CodeSniffer_File $phpcsFile The PHP_CodeSniffer file where the token occured. + * @param PHP_CodeSniffer_File $phpcsFile The PHP_CodeSniffer file where the token occurred. * @param integer $stackPtr The postion in the tokens stack where the listening token type was found. * * @return return_type diff --git a/build/phpcs/Joomla/ruleset.xml b/build/phpcs/Joomla/ruleset.xml index 8ec2d1a1de48e..868db95586e7d 100644 --- a/build/phpcs/Joomla/ruleset.xml +++ b/build/phpcs/Joomla/ruleset.xml @@ -23,23 +23,15 @@ administrator/components/com_joomlaupdate/restore_finalisation.php administrator/components/com_joomlaupdate/restore.php configuration.php + installation/template/index.php plugins/captcha/recaptcha/recaptchalib.php - - - administrator/components/* - components/* - modules/* - libraries/cms/* - libraries/joomla/* - */tmpl/* templates/* layouts/* - installation/template/index.php @@ -59,14 +51,12 @@ */tmpl/* templates/* layouts/* - installation/template/index.php */tmpl/* templates/* layouts/* - installation/template/index.php @@ -95,7 +85,7 @@ administrator/components/* components/* - modules/* + modules/mod_articles_category/helper.php libraries/cms/* @@ -165,7 +155,6 @@ */tmpl/* templates/* layouts/* - installation/template/index.php @@ -173,7 +162,6 @@ */tmpl/* templates/* layouts/* - installation/template/index.php @@ -181,7 +169,6 @@ */tmpl/* templates/* layouts/* - installation/template/index.php diff --git a/build/travis/phpenv/apcu-7.1.ini b/build/travis/phpenv/apcu-7.1.ini new file mode 100644 index 0000000000000..019901d1ba62c --- /dev/null +++ b/build/travis/phpenv/apcu-7.1.ini @@ -0,0 +1,2 @@ +apc.enabled=true +apc.enable_cli=true diff --git a/components/com_banners/models/banners.php b/components/com_banners/models/banners.php index c7a7e432c0a1e..3173923b5f038 100644 --- a/components/com_banners/models/banners.php +++ b/components/com_banners/models/banners.php @@ -10,6 +10,7 @@ defined('_JEXEC') or die; use Joomla\Registry\Registry; +use Joomla\Utilities\ArrayHelper; JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . '/tables'); @@ -120,7 +121,7 @@ protected function getListQuery() } elseif ((is_array($categoryId)) && (count($categoryId) > 0)) { - JArrayHelper::toInteger($categoryId); + $categoryId = ArrayHelper::toInteger($categoryId); $categoryId = implode(',', $categoryId); if ($categoryId != '0') diff --git a/components/com_config/model/form.php b/components/com_config/model/form.php index a0537d2d403ce..18f0f41c7c82f 100644 --- a/components/com_config/model/form.php +++ b/components/com_config/model/form.php @@ -9,6 +9,8 @@ defined('_JEXEC') or die; +use Joomla\Utilities\ArrayHelper; + /** * Prototype form model. * @@ -137,7 +139,7 @@ abstract public function getForm($data = array(), $loadData = true); protected function loadForm($name, $source = null, $options = array(), $clear = false, $xpath = false) { // Handle the optional arguments. - $options['control'] = JArrayHelper::getValue($options, 'control', false); + $options['control'] = ArrayHelper::getValue($options, 'control', false); // Create a signature hash. $hash = sha1($source . serialize($options)); diff --git a/components/com_content/controllers/article.php b/components/com_content/controllers/article.php index b7b76bb395c26..aea07d99c3750 100644 --- a/components/com_content/controllers/article.php +++ b/components/com_content/controllers/article.php @@ -9,6 +9,8 @@ defined('_JEXEC') or die; +use Joomla\Utilities\ArrayHelper; + /** * Content article class. * @@ -68,7 +70,7 @@ public function add() protected function allowAdd($data = array()) { $user = JFactory::getUser(); - $categoryId = JArrayHelper::getValue($data, 'catid', $this->input->getInt('catid'), 'int'); + $categoryId = ArrayHelper::getValue($data, 'catid', $this->input->getInt('catid'), 'int'); $allow = null; if ($categoryId) @@ -195,9 +197,7 @@ public function edit($key = null, $urlVar = 'a_id') */ public function getModel($name = 'form', $prefix = '', $config = array('ignore_request' => true)) { - $model = parent::getModel($name, $prefix, $config); - - return $model; + return parent::getModel($name, $prefix, $config); } /** diff --git a/components/com_content/models/article.php b/components/com_content/models/article.php index a59567a5379aa..b72a4de0a3b40 100644 --- a/components/com_content/models/article.php +++ b/components/com_content/models/article.php @@ -66,7 +66,7 @@ protected function populateState() * * @param integer $pk The id of the article. * - * @return mixed Menu item data object on success, false on failure. + * @return object|boolean|JException Menu item data object on success, boolean false or JException instance on error */ public function getItem($pk = null) { diff --git a/components/com_content/models/articles.php b/components/com_content/models/articles.php index beaf681d3ec26..15d0fa8f61967 100644 --- a/components/com_content/models/articles.php +++ b/components/com_content/models/articles.php @@ -10,6 +10,7 @@ defined('_JEXEC') or die; use Joomla\Registry\Registry; +use Joomla\Utilities\ArrayHelper; /** * This models supports retrieving lists of articles. @@ -232,7 +233,7 @@ protected function getListQuery() $query->where('a.featured = 1'); } } - elseif ($orderby_sec == 'front') + elseif ($orderby_sec == 'front' || $this->getState('list.ordering') == 'fp.ordering') { $query->join('LEFT', '#__content_frontpage AS fp ON fp.content_id = a.id'); } @@ -301,7 +302,7 @@ protected function getListQuery() } elseif (is_array($published)) { - JArrayHelper::toInteger($published); + $published = ArrayHelper::toInteger($published); $published = implode(',', $published); // Use article state if badcats.id is null, otherwise, force 0 for unpublished @@ -338,7 +339,7 @@ protected function getListQuery() } elseif (is_array($articleId)) { - JArrayHelper::toInteger($articleId); + $articleId = ArrayHelper::toInteger($articleId); $articleId = implode(',', $articleId); $type = $this->getState('filter.article_id.include', true) ? 'IN' : 'NOT IN'; $query->where('a.id ' . $type . ' (' . $articleId . ')'); @@ -381,7 +382,7 @@ protected function getListQuery() } elseif (is_array($categoryId) && (count($categoryId) > 0)) { - JArrayHelper::toInteger($categoryId); + $categoryId = ArrayHelper::toInteger($categoryId); $categoryId = implode(',', $categoryId); if (!empty($categoryId)) @@ -402,7 +403,7 @@ protected function getListQuery() } elseif (is_array($authorId)) { - JArrayHelper::toInteger($authorId); + $authorId = ArrayHelper::toInteger($authorId); $authorId = implode(',', $authorId); if ($authorId) @@ -427,8 +428,6 @@ protected function getListQuery() if (!empty($first)) { - JArrayHelper::toString($authorAlias); - foreach ($authorAlias as $key => $alias) { $authorAlias[$key] = $db->quote($alias); diff --git a/components/com_content/models/category.php b/components/com_content/models/category.php index f92f90400efa2..5906a59c090e1 100644 --- a/components/com_content/models/category.php +++ b/components/com_content/models/category.php @@ -10,6 +10,7 @@ defined('_JEXEC') or die; use Joomla\Registry\Registry; +use Joomla\Utilities\ArrayHelper; /** * This models supports retrieving a category, the articles associated with the category, @@ -458,8 +459,7 @@ public function &getChildren() if ($params->get('orderby_pri') == 'alpha' || $params->get('orderby_pri') == 'ralpha') { - jimport('joomla.utilities.arrayhelper'); - JArrayHelper::sortObjects($this->_children, 'title', ($params->get('orderby_pri') == 'alpha') ? 1 : (-1)); + $this->_children = ArrayHelper::sortObjects($this->_children, 'title', ($params->get('orderby_pri') == 'alpha') ? 1 : (-1)); } } diff --git a/components/com_content/models/form.php b/components/com_content/models/form.php index e8a653057a8ed..72dcca654b3f2 100644 --- a/components/com_content/models/form.php +++ b/components/com_content/models/form.php @@ -10,6 +10,7 @@ defined('_JEXEC') or die; use Joomla\Registry\Registry; +use Joomla\Utilities\ArrayHelper; // Base this model on the backend version. require_once JPATH_ADMINISTRATOR . '/components/com_content/models/article.php'; @@ -83,7 +84,7 @@ public function getItem($itemId = null) } $properties = $table->getProperties(1); - $value = JArrayHelper::toObject($properties, 'JObject'); + $value = ArrayHelper::toObject($properties, 'JObject'); // Convert attrib field to Registry. $value->params = new Registry; diff --git a/components/com_content/views/categories/tmpl/default.xml b/components/com_content/views/categories/tmpl/default.xml index 9846fd292eb72..a5766194d92a4 100644 --- a/components/com_content/views/categories/tmpl/default.xml +++ b/components/com_content/views/categories/tmpl/default.xml @@ -209,10 +209,6 @@ - - JGLOBAL_ACROSS - - setState('params', $params); // Load state from the request. - $ids = $app->input->get('id', array(), 'array'); - - JArrayHelper::toInteger($ids); + $ids = ArrayHelper::toInteger($app->input->get('id', array(), 'array')); $pkString = implode(',', $ids); @@ -193,7 +193,7 @@ protected function populateState($ordering = 'c.core_title', $direction = 'ASC') // Sanitise $typesr = explode(',', $typesr); - JArrayHelper::toInteger($typesr); + $typesr = ArrayHelper::toInteger($typesr); $this->setState('tag.typesr', $typesr); } @@ -290,7 +290,7 @@ public function getItem($pk = null) // Convert the JTable to a clean JObject. $properties = $table->getProperties(1); - $this->item[] = JArrayHelper::toObject($properties, 'JObject'); + $this->item[] = ArrayHelper::toObject($properties, 'JObject'); } catch (RuntimeException $e) { diff --git a/components/com_tags/router.php b/components/com_tags/router.php index bcbb4babd3c28..9bec71e8c2bd2 100644 --- a/components/com_tags/router.php +++ b/components/com_tags/router.php @@ -9,6 +9,8 @@ defined('_JEXEC') or die; +use Joomla\Utilities\ArrayHelper; + /** * Routing class from com_tags * @@ -47,7 +49,7 @@ public function build(&$query) if (is_array($mId)) { - JArrayHelper::toInteger($mId); + $mId = ArrayHelper::toInteger($mId); } $view = ''; diff --git a/components/com_users/controllers/profile.php b/components/com_users/controllers/profile.php index c9efdc6e835b8..b6f8080c539c8 100644 --- a/components/com_users/controllers/profile.php +++ b/components/com_users/controllers/profile.php @@ -98,10 +98,10 @@ public function save() $userId = (int) $user->get('id'); // Get the user data. - $data = $app->input->post->get('jform', array(), 'array'); + $requestData = $app->input->post->get('jform', array(), 'array'); // Force the ID to this user. - $data['id'] = $userId; + $requestData['id'] = $userId; // Validate the posted data. $form = $model->getForm(); @@ -114,7 +114,7 @@ public function save() } // Validate the posted data. - $data = $model->validate($form, $data); + $data = $model->validate($form, $requestData); // Check for errors. if ($data === false) @@ -135,8 +135,12 @@ public function save() } } + // Unset the passwords. + unset($requestData['password1']); + unset($requestData['password2']); + // Save the data in the session. - $app->setUserState('com_users.edit.profile.data', $data); + $app->setUserState('com_users.edit.profile.data', $requestData); // Redirect back to the edit screen. $userId = (int) $app->getUserState('com_users.edit.profile.id'); diff --git a/components/com_users/controllers/user.php b/components/com_users/controllers/user.php index 2b9d1c52d9bb0..56efe6c0e1a5b 100644 --- a/components/com_users/controllers/user.php +++ b/components/com_users/controllers/user.php @@ -204,9 +204,9 @@ public function logout() else { // Don't redirect to an external URL. - if (!JUri::isInternal($data['return'])) + if (!JUri::isInternal($return)) { - $data['return'] = ''; + $return = ''; } } diff --git a/components/com_users/models/remind.php b/components/com_users/models/remind.php index 4888c9435b55f..fd96b0944d797 100644 --- a/components/com_users/models/remind.php +++ b/components/com_users/models/remind.php @@ -9,6 +9,8 @@ defined('_JEXEC') or die; +use Joomla\Utilities\ArrayHelper; + /** * Remind model class for Users. * @@ -162,7 +164,7 @@ public function processRemindRequest($data) $mode = $config->get('force_ssl', 0) == 2 ? 1 : (-1); // Put together the email template data. - $data = JArrayHelper::fromObject($user); + $data = ArrayHelper::fromObject($user); $data['fromname'] = $config->get('fromname'); $data['mailfrom'] = $config->get('mailfrom'); $data['sitename'] = $config->get('sitename'); diff --git a/composer.json b/composer.json index fda3069c9ad66..b455faad2ca23 100644 --- a/composer.json +++ b/composer.json @@ -31,7 +31,7 @@ "leafo/lessphp": "0.5.0", "paragonie/random_compat": "~1.0", "phpmailer/phpmailer": "5.2.14", - "symfony/polyfill-php55": "~1.2", + "symfony/polyfill-php55": "~1.2", "symfony/polyfill-php56": "~1.0", "symfony/yaml": "2.*", "simplepie/simplepie": "1.3.1" diff --git a/htaccess.txt b/htaccess.txt index b5a1e910ed6d3..e06e8341166aa 100644 --- a/htaccess.txt +++ b/htaccess.txt @@ -7,12 +7,13 @@ ## # READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE! # -# The line just below this section: 'Options +FollowSymLinks' may cause problems -# with some server configurations. It is required for use of mod_rewrite, but may already -# be set by your server administrator in a way that disallows changing it in -# your .htaccess file. If using it causes your server to error out, comment it out (add # to -# beginning of line), reload your site in your browser and test your sef url's. If they work, -# it has been set by your server administrator and you do not need it set here. +# The line 'Options +FollowSymLinks' may cause problems with some server configurations. +# It is required for the use of mod_rewrite, but it may have already been set by your +# server administrator in a way that disallows changing it in this .htaccess file. +# If using it causes your site to produce an error, comment it out (add # to the +# beginning of the line), reload your site in your browser and test your sef urls. If +# they work, then it has been set by your server administrator and you do not need to +# set it here. ## ## No directory listings @@ -27,16 +28,17 @@ Options -Indexes RewriteEngine On ## Begin - Rewrite rules to block out some common exploits. -# If you experience problems on your site block out the operations listed below -# This attempts to block the most common type of exploit `attempts` to Joomla! +# If you experience problems on your site then comment out the operations listed +# below by adding a # to the beginning of the line. +# This attempts to block the most common type of exploit `attempts` on Joomla! # -# Block out any script trying to base64_encode data within the URL. +# Block any script trying to base64_encode data within the URL. RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR] -# Block out any script that includes a @@ -48,19 +46,14 @@ Joomla
- isRtl()) - { - $joomla = 'Joomla!®‎'; - } - else - { - $joomla = 'Joomla!®'; - } - $license = '' . JText::_('INSTL_GNU_GPL_LICENSE') . ''; - echo JText::sprintf('JGLOBAL_ISFREESOFTWARE', $joomla, $license); - ?> + + isRtl()) : ?> + Joomla!®‎'; ?> + + Joomla!®'; ?> + + ' . JText::_('INSTL_GNU_GPL_LICENSE') . ''; ?> +
@@ -91,42 +84,52 @@ function initElements() }); // Turn radios into btn-group - $('.radio.btn-group label').addClass('btn'); - $(".btn-group label:not(.active)").click(function() + $('.radio.btn-group label').addClass('btn'); + + $('fieldset.btn-group').each(function() { + // Handle disabled, prevent clicks on the container, and add disabled style to each button + if ($(this).prop('disabled')) { + $(this).css('pointer-events', 'none').off('click'); + $(this).find('.btn').addClass('disabled'); + } + }); + + $(".btn-group label:not(.active)").click(function() { - var label = $(this); - var input = $('#' + label.attr('for')); + var label = $(this); + var input = $('#' + label.attr('for')); - if (!input.prop('checked')) + if (!input.prop('checked')) { - label.closest('.btn-group').find("label").removeClass('active btn-success btn-danger btn-primary'); - if(input.val()== '') + label.closest('.btn-group').find("label").removeClass('active btn-success btn-danger btn-primary'); + if(input.val()== '') { - label.addClass('active btn-primary'); - } else if(input.val()==0 || input.val()=='remove') + label.addClass('active btn-primary'); + } else if(input.val()==0 || input.val()=='remove') { - label.addClass('active btn-danger'); - } else { - label.addClass('active btn-success'); - } - input.prop('checked', true); - } - }); - $(".btn-group input[checked='checked']").each(function() + label.addClass('active btn-danger'); + } else { + label.addClass('active btn-success'); + } + input.prop('checked', true); + } + }); + $(".btn-group input[checked='checked']").each(function() { if ($(this).val()== '') { - $("label[for=" + $(this).attr('id') + "]").addClass('active btn-primary'); - } else if($(this).val()==0 || $(this).val()=='remove') + $("label[for=" + $(this).attr('id') + "]").addClass('active btn-primary'); + } else if($(this).val()==0 || $(this).val()=='remove') { - $("label[for=" + $(this).attr('id') + "]").addClass('active btn-danger'); - } else { - $("label[for=" + $(this).attr('id') + "]").addClass('active btn-success'); - } - }); + $("label[for=" + $(this).attr('id') + "]").addClass('active btn-danger'); + } else { + $("label[for=" + $(this).attr('id') + "]").addClass('active btn-success'); + } + }); })(jQuery); } initElements(); + diff --git a/language/en-GB/en-GB.com_contact.ini b/language/en-GB/en-GB.com_contact.ini index f70b12754503b..72147e7095617 100644 --- a/language/en-GB/en-GB.com_contact.ini +++ b/language/en-GB/en-GB.com_contact.ini @@ -6,7 +6,7 @@ COM_CONTACT_ADDRESS="Address" COM_CONTACT_ARTICLES_HEADING="Contact's articles" COM_CONTACT_CAPTCHA_LABEL="Captcha" -COM_CONTACT_CAPTCHA_DESC="Type in the textbox what you see in the image." +COM_CONTACT_CAPTCHA_DESC="Please complete the security check." COM_CONTACT_CAT_NUM="# of Contacts :" COM_CONTACT_CONTACT_DEFAULT_LABEL="Send an Email" COM_CONTACT_CONTACT_EMAIL_A_COPY_DESC="Sends a copy of the message to the address you have supplied." diff --git a/language/en-GB/en-GB.com_users.ini b/language/en-GB/en-GB.com_users.ini index 018ee97f90ef6..858e2d6066cce 100644 --- a/language/en-GB/en-GB.com_users.ini +++ b/language/en-GB/en-GB.com_users.ini @@ -5,13 +5,13 @@ COM_USERS_ACTIVATION_TOKEN_NOT_FOUND="Verification code not found." COM_USERS_CAPTCHA_LABEL="Captcha" -COM_USERS_CAPTCHA_DESC="Type in the textbox what you see in the image." +COM_USERS_CAPTCHA_DESC="Please complete the security check." COM_USERS_DATABASE_ERROR="Error getting the user from the database: %s" COM_USERS_DESIRED_PASSWORD="Enter your desired password." COM_USERS_DESIRED_USERNAME="Enter your desired username." COM_USERS_EDIT_PROFILE="Edit Profile" COM_USERS_EMAIL_ACCOUNT_DETAILS="Account Details for %s at %s" -COM_USERS_EMAIL_ACTIVATE_WITH_ADMIN_ACTIVATION_BODY="Hello administrator,\n\nA new user has registered at %s.\nThe user has verified his email address and requests that you approve his account.\nThis email contains their details:\n\n Name : %s \n email: %s \n Username: %s \n\nYou can activate the user by selecting on the link below:\n %s \n" +COM_USERS_EMAIL_ACTIVATE_WITH_ADMIN_ACTIVATION_BODY="Hello administrator,\n\nA new user has registered at %s.\nThe user has verified their email address and requests that you approve their account.\nThis email contains their details:\n\n Name : %s \n email: %s \n Username: %s \n\nYou can activate the user by selecting on the link below:\n %s \n" COM_USERS_EMAIL_ACTIVATE_WITH_ADMIN_ACTIVATION_SUBJECT="Registration approval required for account of %s at %s" COM_USERS_EMAIL_ACTIVATED_BY_ADMIN_ACTIVATION_BODY="Hello %s,\n\nYour account has been activated by an administrator. You can now login at %s using the username %s and the password you chose while registering." COM_USERS_EMAIL_ACTIVATED_BY_ADMIN_ACTIVATION_SUBJECT="Account activated for %s at %s" diff --git a/language/en-GB/en-GB.lib_joomla.ini b/language/en-GB/en-GB.lib_joomla.ini index 2765695404fc8..f2630623b73fb 100644 --- a/language/en-GB/en-GB.lib_joomla.ini +++ b/language/en-GB/en-GB.lib_joomla.ini @@ -309,7 +309,7 @@ JLIB_FORM_MEDIA_PREVIEW_ALT="Selected image." JLIB_FORM_MEDIA_PREVIEW_EMPTY="No image selected." JLIB_FORM_MEDIA_PREVIEW_SELECTED_IMAGE="Selected image." JLIB_FORM_MEDIA_PREVIEW_TIP_TITLE="Preview" -JLIB_FORM_SELECT_USER="Select a User." +JLIB_FORM_SELECT_USER="Select a User" JLIB_FORM_VALIDATE_FIELD_INVALID="Invalid field: %s" JLIB_FORM_VALIDATE_FIELD_REQUIRED="Field required: %s" JLIB_FORM_VALIDATE_FIELD_RULE_MISSING="Validation Rule missing: %s" @@ -458,6 +458,7 @@ JLIB_INSTALLER_ABORT_CREATE_DIRECTORY="Extension %1$s: Failed to create folder: JLIB_INSTALLER_ABORT_DEBUG="Installation unexpectedly terminated:" JLIB_INSTALLER_ABORT_DETECTMANIFEST="Unable to detect manifest file." JLIB_INSTALLER_ABORT_DIRECTORY="Extension %1$s: Another %2$s is already using the named folder: %3$s. Are you trying to install the same extension again?" +JLIB_INSTALLER_ABORT_ERROR_DELETING_EXTENSIONS_RECORD="Could not delete the extension's record from the database." JLIB_INSTALLER_ABORT_EXTENSIONNOTVALID="Extension is not valid." JLIB_INSTALLER_ABORT_FILE_INSTALL_COPY_SETUP="Files Install: Could not copy setup file." JLIB_INSTALLER_ABORT_FILE_INSTALL_CUSTOM_INSTALL_FAILURE="Files Install: Custom install routine failure." @@ -628,11 +629,11 @@ JLIB_INSTALLER_ERROR_PACK_UNINSTALL_UNKNOWN_EXTENSION="Attempting to uninstall u JLIB_INSTALLER_NOT_ERROR="If the error is related to the installation of TinyMCE language files it has no effect on the installation of the language(s). Some language packs created prior to Joomla! 3.2.0 may try to install separate TinyMCE language files. As these are now included in the core they no longer need to be installed." JLIB_INSTALLER_UPDATE_LOG_QUERY="Ran query from file %1$s. Query text: %2$s." -JLIB_JS_AJAX_ERROR_CONNECTION_ABORT="A connection abort has occured while fetching the JSON data." +JLIB_JS_AJAX_ERROR_CONNECTION_ABORT="A connection abort has occurred while fetching the JSON data." JLIB_JS_AJAX_ERROR_NO_CONTENT="No content was returned." -JLIB_JS_AJAX_ERROR_OTHER="An error has occured while fetching the JSON data: HTTP %s status code." -JLIB_JS_AJAX_ERROR_PARSE="A parse error has occured while processing the following JSON data:
%s" -JLIB_JS_AJAX_ERROR_TIMEOUT="A timeout has occured while fetching the JSON data." +JLIB_JS_AJAX_ERROR_OTHER="An error has occurred while fetching the JSON data: HTTP %s status code." +JLIB_JS_AJAX_ERROR_PARSE="A parse error has occurred while processing the following JSON data:
%s" +JLIB_JS_AJAX_ERROR_TIMEOUT="A timeout has occurred while fetching the JSON data." JLIB_MAIL_FUNCTION_DISABLED="The mail() function has been disabled and the mail can't be sent." JLIB_MAIL_FUNCTION_OFFLINE="The mail function has been temporarily disabled on this site, please try again later." diff --git a/language/en-GB/en-GB.xml b/language/en-GB/en-GB.xml index d309f4fbe6e86..f22411343aa73 100644 --- a/language/en-GB/en-GB.xml +++ b/language/en-GB/en-GB.xml @@ -1,8 +1,8 @@ English (en-GB) - 3.6.0 - June 2016 + 3.6.1 + July 2016 Joomla! Project admin@joomla.org www.joomla.org diff --git a/language/en-GB/install.xml b/language/en-GB/install.xml index 7427c1b8457b8..2f6b7b56539a4 100644 --- a/language/en-GB/install.xml +++ b/language/en-GB/install.xml @@ -2,8 +2,8 @@ English (United Kingdom) en-GB - 3.6.0 - June 2016 + 3.6.1 + July 2016 Joomla! Project admin@joomla.org www.joomla.org diff --git a/layouts/joomla/form/field/checkboxes.php b/layouts/joomla/form/field/checkboxes.php index 4ce445a66e514..e1cba39033cce 100644 --- a/layouts/joomla/form/field/checkboxes.php +++ b/layouts/joomla/form/field/checkboxes.php @@ -34,7 +34,7 @@ * @var boolean $repeat Allows extensions to duplicate elements. * @var boolean $required Is this field required? * @var integer $size Size attribute of the input. - * @var boolean $spellchec Spellcheck state for the form field. + * @var boolean $spellcheck Spellcheck state for the form field. * @var string $validate Validation rules to apply. * @var string $value Value attribute of the field. * @var array $checkedOptions Options that will be set as checked. diff --git a/layouts/joomla/form/field/radio.php b/layouts/joomla/form/field/radio.php index ea965c1a3c106..0f792ffc96261 100644 --- a/layouts/joomla/form/field/radio.php +++ b/layouts/joomla/form/field/radio.php @@ -34,7 +34,7 @@ * @var boolean $repeat Allows extensions to duplicate elements. * @var boolean $required Is this field required? * @var integer $size Size attribute of the input. - * @var boolean $spellchec Spellcheck state for the form field. + * @var boolean $spellcheck Spellcheck state for the form field. * @var string $validate Validation rules to apply. * @var string $value Value attribute of the field. * @var array $options Options available for this field. diff --git a/layouts/joomla/form/renderlabel.php b/layouts/joomla/form/renderlabel.php index 73d9238824853..ecc6556c1df39 100644 --- a/layouts/joomla/form/renderlabel.php +++ b/layouts/joomla/form/renderlabel.php @@ -29,9 +29,24 @@ if (!empty($description)) { - JHtml::_('bootstrap.tooltip'); - $classes[] = 'hasTooltip'; - $title = ' title="' . JHtml::tooltipText(trim($text, ':'), $description, 0) . '"'; + if ($text && $text != $description) + { + JHtml::_('bootstrap.popover'); + $classes[] = 'hasPopover'; + $title = ' title="' . htmlspecialchars(trim($text, ':')) . '"' + . ' data-content="'. htmlspecialchars($description) . '"'; + + if (JFactory::getLanguage()->isRtl() && !$position) + { + $position = ' data-placement="left" '; + } + } + else + { + JHtml::_('bootstrap.tooltip'); + $classes[] = 'hasTooltip'; + $title = ' title="' . JHtml::tooltipText(trim($text, ':'), $description, 0) . '"'; + } } if ($required) diff --git a/layouts/joomla/searchtools/grid/sort.php b/layouts/joomla/searchtools/grid/sort.php index 3668dd376f9a6..686d76546bf69 100644 --- a/layouts/joomla/searchtools/grid/sort.php +++ b/layouts/joomla/searchtools/grid/sort.php @@ -11,10 +11,12 @@ $data = $displayData; -$metatitle = JHtml::tooltipText(JText::_($data->tip ? $data->tip : $data->title), JText::_('JGLOBAL_CLICK_TO_SORT_THIS_COLUMN'), 0); -JHtml::_('bootstrap.tooltip'); +$title = htmlspecialchars(JText::_($data->tip ? $data->tip : $data->title)); +JHtml::_('bootstrap.popover'); ?> - + icon)) : ?> title)) : ?>title); ?> order == $data->selected) : ?> diff --git a/layouts/joomla/toolbar/modal.php b/layouts/joomla/toolbar/modal.php new file mode 100644 index 0000000000000..719e2d0937c90 --- /dev/null +++ b/layouts/joomla/toolbar/modal.php @@ -0,0 +1,32 @@ + + diff --git a/libraries/cms/application/administrator.php b/libraries/cms/application/administrator.php index 658b0cd36bb34..1d4e765e172dd 100644 --- a/libraries/cms/application/administrator.php +++ b/libraries/cms/application/administrator.php @@ -45,7 +45,7 @@ public function __construct(JInput $input = null, Registry $config = null, JAppl parent::__construct($input, $config, $client); // Set the root in the URI based on the application name - JUri::root(null, rtrim(dirname(JUri::base(true)), '/')); + JUri::root(null, rtrim(dirname(JUri::base(true)), '/\\')); } /** diff --git a/libraries/cms/application/cms.php b/libraries/cms/application/cms.php index 8e50ee6f282c2..8937ed3528783 100644 --- a/libraries/cms/application/cms.php +++ b/libraries/cms/application/cms.php @@ -795,7 +795,7 @@ public function loadSession(JSession $session = null) * @param array $credentials Array('username' => string, 'password' => string) * @param array $options Array('remember' => boolean) * - * @return boolean True on success. + * @return boolean|JException True on success, false if failed or silent handling is configured, or a JException object on authentication error. * * @since 3.2 */ @@ -839,17 +839,11 @@ public function login($credentials, $options = array()) case JAuthentication::STATUS_EXPIRED: return JError::raiseWarning('102002', JText::_('JLIB_LOGIN_EXPIRED')); - break; - case JAuthentication::STATUS_DENIED: return JError::raiseWarning('102003', JText::_('JLIB_LOGIN_DENIED')); - break; - default: return JError::raiseWarning('102004', JText::_('JLIB_LOGIN_AUTHORISATION')); - - break; } } } diff --git a/libraries/cms/application/site.php b/libraries/cms/application/site.php index dadadbf455904..57f9a3074ac6b 100644 --- a/libraries/cms/application/site.php +++ b/libraries/cms/application/site.php @@ -585,8 +585,21 @@ protected function initialiseApp($options = array()) $user->groups = array($guestUsergroup); } - // If a language was specified it has priority, otherwise use user or default language settings - JPluginHelper::importPlugin('system', 'languagefilter'); + /* + * If a language was specified it has priority, otherwise use user or default language settings + * Check this only if the languagefilter plugin is enabled + * + * @TODO - Remove the hardcoded dependency to the languagefilter plugin + */ + if (JPluginHelper::isEnabled('system', 'languagefilter')) + { + $plugin = JPluginHelper::getPlugin('system', 'languagefilter'); + + $pluginParams = new Registry($plugin->params); + + $this->setLanguageFilter(true); + $this->setDetectBrowser($pluginParams->get('detect_browser', '1') == '1'); + } if (empty($options['language'])) { @@ -600,7 +613,7 @@ protected function initialiseApp($options = array()) } } - if ($this->_language_filter && empty($options['language'])) + if ($this->getLanguageFilter() && empty($options['language'])) { // Detect cookie language $lang = $this->input->cookie->get(md5($this->get('secret') . 'language'), null, 'string'); @@ -624,7 +637,7 @@ protected function initialiseApp($options = array()) } } - if ($this->_detect_browser && empty($options['language'])) + if ($this->getDetectBrowser() && empty($options['language'])) { // Detect browser language $lang = JLanguageHelper::detectLanguage(); diff --git a/libraries/cms/component/helper.php b/libraries/cms/component/helper.php index 868801eccdc2c..3a68ba5feda58 100644 --- a/libraries/cms/component/helper.php +++ b/libraries/cms/component/helper.php @@ -462,17 +462,46 @@ protected static function load($option) } catch (RuntimeException $e) { - // Fatal error. - JLog::add(JText::sprintf('JLIB_APPLICATION_ERROR_COMPONENT_NOT_LOADING', $option, $e->getMessage()), JLog::WARNING, 'jerror'); + /* + * Fatal error + * + * It is possible for this error to be reached before the global JLanguage instance has been loaded so we check for its presence + * before logging the error to ensure a human friendly message is always given + */ + + if (JFactory::$language) + { + $msg = JText::sprintf('JLIB_APPLICATION_ERROR_COMPONENT_NOT_LOADING', $option, $e->getMessage()); + } + else + { + $msg = sprintf('Error loading component: %1$s, %2$s', $option, $e->getMessage()); + } + + JLog::add($msg, JLog::WARNING, 'jerror'); return false; } if (empty(static::$components[$option])) { - // Fatal error. - $error = JText::_('JLIB_APPLICATION_ERROR_COMPONENT_NOT_FOUND'); - JLog::add(JText::sprintf('JLIB_APPLICATION_ERROR_COMPONENT_NOT_LOADING', $option, $error), JLog::WARNING, 'jerror'); + /* + * Fatal error + * + * It is possible for this error to be reached before the global JLanguage instance has been loaded so we check for its presence + * before logging the error to ensure a human friendly message is always given + */ + + if (JFactory::$language) + { + $msg = JText::sprintf('JLIB_APPLICATION_ERROR_COMPONENT_NOT_LOADING', $option, JText::_('JLIB_APPLICATION_ERROR_COMPONENT_NOT_FOUND')); + } + else + { + $msg = sprintf('Error loading component: %1$s, %2$s', $option, 'Component not found.'); + } + + JLog::add($msg, JLog::WARNING, 'jerror'); return false; } diff --git a/libraries/cms/form/field/limitbox.php b/libraries/cms/form/field/limitbox.php index 175961667b8e7..7a68fb0830de1 100644 --- a/libraries/cms/form/field/limitbox.php +++ b/libraries/cms/form/field/limitbox.php @@ -39,7 +39,7 @@ class JFormFieldLimitbox extends JFormFieldList * * @var array */ - protected $defaultLimits = array(5, 10, 15, 20, 25, 30, 50, 100); + protected $defaultLimits = array(5, 10, 15, 20, 25, 30, 50, 100, 200, 500); /** * Method to get the options to populate to populate list diff --git a/libraries/cms/form/field/tag.php b/libraries/cms/form/field/tag.php index 488131ea99ec8..76d951c74c5a6 100644 --- a/libraries/cms/form/field/tag.php +++ b/libraries/cms/form/field/tag.php @@ -9,6 +9,8 @@ defined('JPATH_PLATFORM') or die; +use Joomla\Utilities\ArrayHelper; + JFormHelper::loadFieldClass('list'); /** @@ -131,7 +133,7 @@ protected function getOptions() } elseif (is_array($published)) { - JArrayHelper::toInteger($published); + $published = ArrayHelper::toInteger($published); $query->where('a.published IN (' . implode(',', $published) . ')'); } diff --git a/libraries/cms/form/field/user.php b/libraries/cms/form/field/user.php index 8f5a63d7611ef..9dbc98c50d698 100644 --- a/libraries/cms/form/field/user.php +++ b/libraries/cms/form/field/user.php @@ -73,28 +73,29 @@ public function getLayoutData() // Get the basic field data $data = parent::getLayoutData(); - // Load the current username if available. - $table = JTable::getInstance('user'); + // Initialize value + $name = ''; if (is_numeric($this->value)) { - $table->load($this->value); + $name = JUser::getInstance($this->value)->name; } // Handle the special case for "current". elseif (strtoupper($this->value) == 'CURRENT') { // 'CURRENT' is not a reasonable value to be placed in the html - $this->value = JFactory::getUser()->id; + $current = JFactory::getUser(); + $this->value = $current->id; $data['value'] = $this->value; - $table->load($this->value); + $name = $current->name; } else { - $table->name = JText::_('JLIB_FORM_SELECT_USER'); + $name = JText::_('JLIB_FORM_SELECT_USER'); } $extraData = array( - 'userName' => $table->name, + 'userName' => $name, 'groups' => $this->getGroups(), 'excluded' => $this->getExcluded() ); diff --git a/libraries/cms/form/rule/password.php b/libraries/cms/form/rule/password.php index f23ca4bea5feb..f7ee73022d0b6 100644 --- a/libraries/cms/form/rule/password.php +++ b/libraries/cms/form/rule/password.php @@ -77,6 +77,9 @@ public function test(SimpleXMLElement $element, $value, $group = null, Registry $valueLength = strlen($value); + // Load language file of com_users component + JFactory::getLanguage()->load('com_users'); + // We set a maximum length to prevent abuse since it is unfiltered. if ($valueLength > 4096) { diff --git a/libraries/cms/helper/tags.php b/libraries/cms/helper/tags.php index 904d7e7e1d753..39b527a8dc5fe 100644 --- a/libraries/cms/helper/tags.php +++ b/libraries/cms/helper/tags.php @@ -9,6 +9,8 @@ defined('JPATH_PLATFORM') or die; +use Joomla\Utilities\ArrayHelper; + /** * Tags helper class, provides methods to perform various tasks relevant * tagging of content. @@ -457,7 +459,7 @@ public function getTagIds($ids, $prefix) $ids = (array) $ids; $ids = implode(',', $ids); $ids = explode(',', $ids); - JArrayHelper::toInteger($ids); + $ids = ArrayHelper::toInteger($ids); $db = JFactory::getDbo(); @@ -514,7 +516,7 @@ public function getTagItemsQuery($tagId, $typesr = null, $includeChildren = fals $tagIds = (array) $tagId; $tagIds = implode(',', $tagIds); $tagIds = explode(',', $tagIds); - JArrayHelper::toInteger($tagIds); + $tagIds = ArrayHelper::toInteger($tagIds); // If we want to include children we have to adjust the list of tags. // We do not search child tags when the match all option is selected. @@ -533,7 +535,7 @@ public function getTagItemsQuery($tagId, $typesr = null, $includeChildren = fals // Sanitize filter states $stateFilters = explode(',', $stateFilter); - JArrayHelper::toInteger($stateFilters); + $stateFilters = ArrayHelper::toInteger($stateFilters); // M is the mapping table. C is the core_content table. Ct is the content_types table. $query @@ -649,7 +651,7 @@ public function getTagNames($tagIds) if (is_array($tagIds) && count($tagIds) > 0) { - JArrayHelper::toInteger($tagIds); + $tagIds = ArrayHelper::toInteger($tagIds); $db = JFactory::getDbo(); $query = $db->getQuery(true) @@ -750,7 +752,7 @@ public static function getTypes($arrayType = 'objectList', $selectTypes = null, } else { - JArrayHelper::toInteger($selectTypes); + $selectTypes = ArrayHelper::toInteger($selectTypes); $query->where($db->quoteName('type_id') . ' IN (' . implode(',', $selectTypes) . ')'); } @@ -1054,7 +1056,7 @@ public function unTagItem($contentId, JTableInterface $table, $tags = array()) if (is_array($tags) && count($tags) > 0) { - JArrayHelper::toInteger($tags); + $tags = ArrayHelper::toInteger($tags); $query->where($db->quoteName('tag_id') . ' IN (' . implode(',', $tags) . ')'); } diff --git a/libraries/cms/html/behavior.php b/libraries/cms/html/behavior.php index bdf2e65692112..467733d80e0b4 100644 --- a/libraries/cms/html/behavior.php +++ b/libraries/cms/html/behavior.php @@ -405,9 +405,38 @@ public static function modal($selector = 'a.modal', $params = array()) parse: 'rel' }); }); - function jModalClose() { + + window.jModalClose = function () { SqueezeBox.close(); - }" + }; + + // Add extra modal close functionality for tinyMCE-based editors + document.onreadystatechange = function () { + if (document.readyState == 'interactive' && typeof tinyMCE != 'undefined' && tinyMCE) + { + if (typeof window.jModalClose_no_tinyMCE === 'undefined') + { + window.jModalClose_no_tinyMCE = typeof(jModalClose) == 'function' ? jModalClose : false; + + jModalClose = function () { + if (window.jModalClose_no_tinyMCE) window.jModalClose_no_tinyMCE.apply(this, arguments); + tinyMCE.activeEditor.windowManager.close(); + }; + } + + if (typeof window.SqueezeBoxClose_no_tinyMCE === 'undefined') + { + if (typeof(SqueezeBox) == 'undefined') SqueezeBox = {}; + window.SqueezeBoxClose_no_tinyMCE = typeof(SqueezeBox.close) == 'function' ? SqueezeBox.close : false; + + SqueezeBox.close = function () { + if (window.SqueezeBoxClose_no_tinyMCE) window.SqueezeBoxClose_no_tinyMCE.apply(this, arguments); + tinyMCE.activeEditor.windowManager.close(); + }; + } + } + }; + " ); // Set static array diff --git a/libraries/cms/html/category.php b/libraries/cms/html/category.php index aeab567d6449d..7902b4f3c87bd 100644 --- a/libraries/cms/html/category.php +++ b/libraries/cms/html/category.php @@ -9,6 +9,8 @@ defined('JPATH_PLATFORM') or die; +use Joomla\Utilities\ArrayHelper; + /** * Utility class for categories * @@ -60,7 +62,7 @@ public static function options($extension, $config = array('filter.published' => } elseif (is_array($config['filter.published'])) { - JArrayHelper::toInteger($config['filter.published']); + $config['filter.published'] = ArrayHelper::toInteger($config['filter.published']); $query->where('a.published IN (' . implode(',', $config['filter.published']) . ')'); } } @@ -137,7 +139,7 @@ public static function categories($extension, $config = array('filter.published' } elseif (is_array($config['filter.published'])) { - JArrayHelper::toInteger($config['filter.published']); + $config['filter.published'] = ArrayHelper::toInteger($config['filter.published']); $query->where('a.published IN (' . implode(',', $config['filter.published']) . ')'); } } diff --git a/libraries/cms/html/email.php b/libraries/cms/html/email.php index 427f846637fa5..08e8a74914236 100644 --- a/libraries/cms/html/email.php +++ b/libraries/cms/html/email.php @@ -47,21 +47,13 @@ public static function cloak($mail, $mailto = true, $text = '', $email = true) // Convert mail $mail = static::convertEncoding($mail); + // Random hash + $rand = md5($mail . rand(1, 100000)); + // Split email by @ symbol - $mail = explode('@', $mail); + $mail = explode('@', $mail); $mail_parts = explode('.', $mail[1]); - // Random number - $rand = rand(1, 100000); - - $replacement = '' . JText::_('JLIB_HTML_CLOAKING') . '' . ""; + $inlineScript = ''; + $script = " + document.getElementById('cloak" . $rand . "').innerHTML = ''; + var prefix = 'ma' + 'il' + 'to'; + var path = 'hr' + 'ef' + '='; + var addy" . $rand . " = '" . @$mail[0] . "' + '@'; + addy" . $rand . " = addy" . $rand . " + '" . implode("' + '.' + '", $mail_parts) . "'; + $tmpScript + "; + + if (strtolower(JFactory::getApplication()->input->server->get('HTTP_X_REQUESTED_WITH', '')) == 'xmlhttprequest') + { + // Use inline script for ajax calls + $inlineScript = ""; + } + else + { + JFactory::getDocument()->addScriptDeclaration( + " + document.onreadystatechange = function () { + if (document.readyState == 'interactive') { + " . $script . " + } + }; + " + ); + } - return $replacement; + return '' . JText::_('JLIB_HTML_CLOAKING') . '' . $inlineScript; } /** diff --git a/libraries/cms/html/grid.php b/libraries/cms/html/grid.php index a1d6ba3775433..8badb0e1b6f26 100644 --- a/libraries/cms/html/grid.php +++ b/libraries/cms/html/grid.php @@ -72,7 +72,7 @@ public static function boolean($i, $value, $taskOn = null, $taskOff = null) public static function sort($title, $order, $direction = 'asc', $selected = '', $task = null, $new_direction = 'asc', $tip = '') { JHtml::_('behavior.core'); - JHtml::_('bootstrap.tooltip'); + JHtml::_('bootstrap.popover'); $direction = strtolower($direction); $icon = array('arrow-up-3', 'arrow-down-3'); @@ -88,7 +88,8 @@ public static function sort($title, $order, $direction = 'asc', $selected = '', } $html = ''; + . ' class="hasPopover" title="' . htmlspecialchars(JText::_($tip ? $tip : $title)) . '"' + . ' data-content="' . htmlspecialchars(JText::_('JGLOBAL_CLICK_TO_SORT_THIS_COLUMN')) . '" data-placement="top">'; if (isset($title['0']) && $title['0'] == '<') { diff --git a/libraries/cms/html/html.php b/libraries/cms/html/html.php index 6c60362ec6074..2df820cd9973b 100644 --- a/libraries/cms/html/html.php +++ b/libraries/cms/html/html.php @@ -9,10 +9,11 @@ defined('JPATH_PLATFORM') or die; +use Joomla\Utilities\ArrayHelper; + jimport('joomla.environment.browser'); jimport('joomla.filesystem.file'); jimport('joomla.filesystem.path'); -jimport('joomla.utilities.arrayhelper'); /** * Utility class for all HTML drawing classes @@ -251,7 +252,7 @@ public static function link($url, $text, $attribs = null) { if (is_array($attribs)) { - $attribs = JArrayHelper::toString($attribs); + $attribs = ArrayHelper::toString($attribs); } return '' . $text . ''; @@ -273,7 +274,7 @@ public static function iframe($url, $name, $attribs = null, $noFrames = '') { if (is_array($attribs)) { - $attribs = JArrayHelper::toString($attribs); + $attribs = ArrayHelper::toString($attribs); } return ''; @@ -578,7 +579,7 @@ public static function image($file, $alt, $attribs = null, $relative = false, $p else { return '' . $alt . ''; } } @@ -968,7 +969,7 @@ public static function calendar($value, $name, $id, $format = '%Y-%m-%d', $attri $attribs['class'] = isset($attribs['class']) ? $attribs['class'] : 'input-medium'; $attribs['class'] = trim($attribs['class'] . ' hasTooltip'); - $attribs = JArrayHelper::toString($attribs); + $attribs = ArrayHelper::toString($attribs); } static::_('bootstrap.tooltip'); diff --git a/libraries/cms/html/jgrid.php b/libraries/cms/html/jgrid.php index ab9ae74a3cfb6..6008464f63b26 100644 --- a/libraries/cms/html/jgrid.php +++ b/libraries/cms/html/jgrid.php @@ -9,6 +9,8 @@ defined('JPATH_PLATFORM') or die; +use Joomla\Utilities\ArrayHelper; + /** * Utility class for creating HTML Grids * @@ -122,7 +124,7 @@ public static function state($states, $value, $i, $prefix = '', $enabled = true, $prefix = array_key_exists('prefix', $options) ? $options['prefix'] : ''; } - $state = JArrayHelper::getValue($states, (int) $value, $states[0]); + $state = ArrayHelper::getValue($states, (int) $value, $states[0]); $task = array_key_exists('task', $state) ? $state['task'] : $state[0]; $text = array_key_exists('text', $state) ? $state['text'] : (array_key_exists(1, $state) ? $state[1] : ''); $active_title = array_key_exists('active_title', $state) ? $state['active_title'] : (array_key_exists(2, $state) ? $state[2] : ''); diff --git a/libraries/cms/html/links.php b/libraries/cms/html/links.php index 1500fac0a7c76..2a18bf0c59abe 100644 --- a/libraries/cms/html/links.php +++ b/libraries/cms/html/links.php @@ -86,7 +86,7 @@ public static function links($links) } /** - * Method to generate html code for a list of links + * Method to generate html code for a single link * * @param array $link link properties * diff --git a/libraries/cms/html/select.php b/libraries/cms/html/select.php index 6f6cea51a66a5..185d056f05b8c 100644 --- a/libraries/cms/html/select.php +++ b/libraries/cms/html/select.php @@ -9,6 +9,8 @@ defined('JPATH_PLATFORM') or die; +use Joomla\Utilities\ArrayHelper; + /** * Utility class for creating HTML select lists * @@ -104,7 +106,7 @@ public static function genericlist($data, $name, $attribs = null, $optKey = 'val { if (is_array($options['list.attr'])) { - $attribs = JArrayHelper::toString($options['list.attr']); + $attribs = ArrayHelper::toString($options['list.attr']); } else { @@ -229,7 +231,7 @@ public static function groupedlist($data, $name, $options = array()) { if (is_array($options['list.attr'])) { - $attribs = JArrayHelper::toString($options['list.attr']); + $attribs = ArrayHelper::toString($options['list.attr']); } else { @@ -683,7 +685,7 @@ public static function options($arr, $optKey = 'value', $optText = 'text', $sele if (is_array($attr)) { - $attr = JArrayHelper::toString($attr); + $attr = ArrayHelper::toString($attr); } else { @@ -748,7 +750,7 @@ public static function radiolist($data, $name, $attribs = null, $optKey = 'value if (is_array($attribs)) { - $attribs = JArrayHelper::toString($attribs); + $attribs = ArrayHelper::toString($attribs); } $id_text = $idtag ? $idtag : $name; diff --git a/libraries/cms/html/tag.php b/libraries/cms/html/tag.php index 2182e769d2ab8..352a96b816d37 100644 --- a/libraries/cms/html/tag.php +++ b/libraries/cms/html/tag.php @@ -9,6 +9,8 @@ defined('JPATH_PLATFORM') or die; +use Joomla\Utilities\ArrayHelper; + /** * Utility class for tags * @@ -56,7 +58,7 @@ public static function options($config = array('filter.published' => array(0, 1) } elseif (is_array($config['filter.published'])) { - JArrayHelper::toInteger($config['filter.published']); + $config['filter.published'] = ArrayHelper::toInteger($config['filter.published']); $query->where('a.published IN (' . implode(',', $config['filter.published']) . ')'); } } @@ -126,7 +128,7 @@ public static function tags($config = array('filter.published' => array(0, 1))) } elseif (is_array($config['filter.published'])) { - JArrayHelper::toInteger($config['filter.published']); + $config['filter.published'] = ArrayHelper::toInteger($config['filter.published']); $query->where('a.published IN (' . implode(',', $config['filter.published']) . ')'); } } diff --git a/libraries/cms/installer/adapter/module.php b/libraries/cms/installer/adapter/module.php index feb4e74dc20f0..c702c54fc2168 100644 --- a/libraries/cms/installer/adapter/module.php +++ b/libraries/cms/installer/adapter/module.php @@ -9,6 +9,8 @@ defined('JPATH_PLATFORM') or die; +use Joomla\Utilities\ArrayHelper; + jimport('joomla.filesystem.folder'); /** @@ -648,7 +650,7 @@ public function uninstall($id) if (count($modules)) { // Ensure the list is sane - JArrayHelper::toInteger($modules); + $modules = ArrayHelper::toInteger($modules); $modID = implode(',', $modules); // Wipe out any items assigned to menus diff --git a/libraries/cms/installer/installer.php b/libraries/cms/installer/installer.php index 1cd4f6ebb3a7a..368078199a7a3 100644 --- a/libraries/cms/installer/installer.php +++ b/libraries/cms/installer/installer.php @@ -373,7 +373,20 @@ public function abort($msg = null, $type = null) $query->delete($db->quoteName('#__extensions')) ->where($db->quoteName('extension_id') . ' = ' . (int) $step['id']); $db->setQuery($query); - $stepval = $db->execute(); + + try + { + $db->execute(); + + $stepval = true; + } + catch (JDatabaseExceptionExecuting $e) + { + // The database API will have already logged the error it caught, we just need to alert the user to the issue + JLog::add(JText::_('JLIB_INSTALLER_ABORT_ERROR_DELETING_EXTENSIONS_RECORD'), JLog::WARNING, 'jerror'); + + $stepval = false; + } break; @@ -861,9 +874,13 @@ public function parseQueries(SimpleXMLElement $element) { $db->setQuery($db->convertUtf8mb4QueryToUtf8($query)); - if (!$db->execute()) + try { - JLog::add(JText::sprintf('JLIB_INSTALLER_ERROR_SQL_ERROR', $db->stderr(true)), JLog::WARNING, 'jerror'); + $db->execute(); + } + catch (JDatabaseExceptionExecuting $e) + { + JLog::add(JText::sprintf('JLIB_INSTALLER_ERROR_SQL_ERROR', $e->getMessage()), JLog::WARNING, 'jerror'); return false; } @@ -949,9 +966,13 @@ public function parseSQLFiles($element) { $db->setQuery($db->convertUtf8mb4QueryToUtf8($query)); - if (!$db->execute()) + try + { + $db->execute(); + } + catch (JDatabaseExceptionExecuting $e) { - JLog::add(JText::sprintf('JLIB_INSTALLER_ERROR_SQL_ERROR', $db->stderr(true)), JLog::WARNING, 'jerror'); + JLog::add(JText::sprintf('JLIB_INSTALLER_ERROR_SQL_ERROR', $e->getMessage()), JLog::WARNING, 'jerror'); return false; } @@ -1134,19 +1155,21 @@ public function parseSchemaUpdates(SimpleXMLElement $schema, $eid) { $db->setQuery($db->convertUtf8mb4QueryToUtf8($query)); - if (!$db->execute()) + try { - JLog::add(JText::sprintf('JLIB_INSTALLER_ERROR_SQL_ERROR', $db->stderr(true)), JLog::WARNING, 'jerror'); - - return false; + $db->execute(); } - else + catch (JDatabaseExceptionExecuting $e) { - $queryString = (string) $query; - $queryString = str_replace(array("\r", "\n"), array('', ' '), substr($queryString, 0, 80)); - JLog::add(JText::sprintf('JLIB_INSTALLER_UPDATE_LOG_QUERY', $file, $queryString), JLog::INFO, 'Update'); + JLog::add(JText::sprintf('JLIB_INSTALLER_ERROR_SQL_ERROR', $e->getMessage()), JLog::WARNING, 'jerror'); + + return false; } + $queryString = (string) $query; + $queryString = str_replace(array("\r", "\n"), array('', ' '), substr($queryString, 0, 80)); + JLog::add(JText::sprintf('JLIB_INSTALLER_UPDATE_LOG_QUERY', $file, $queryString), JLog::INFO, 'Update'); + $update_count++; } } diff --git a/libraries/cms/layout/file.php b/libraries/cms/layout/file.php index 9cdeabe760299..041bf91dcc392 100644 --- a/libraries/cms/layout/file.php +++ b/libraries/cms/layout/file.php @@ -73,7 +73,7 @@ public function __construct($layoutId, $basePath = null, $options = null) $this->setOptions($options); // Main properties - $this->setLayoutId($layoutId); + $this->setLayout($layoutId); $this->basePath = $basePath; // Init Enviroment @@ -466,7 +466,7 @@ public function setComponent($option) $this->options->set('component', $component); // Refresh include paths - $this->clearIncludePaths(); + $this->refreshIncludePaths(); } /** @@ -501,7 +501,7 @@ public function setClient($client) $this->options->set('client', $client); // Refresh include paths - $this->clearIncludePaths(); + $this->refreshIncludePaths(); } /** diff --git a/libraries/cms/schema/changeitem/mysql.php b/libraries/cms/schema/changeitem/mysql.php index e2a1b9f5159b7..673a5c65289d9 100644 --- a/libraries/cms/schema/changeitem/mysql.php +++ b/libraries/cms/schema/changeitem/mysql.php @@ -233,6 +233,10 @@ private function fixInteger($type1, $type2) { $result = 'int(10) unsigned'; } + elseif (strtolower(substr($type2, 0, 8)) == 'unsigned') + { + $result = $type1 . ' unsigned'; + } return $result; } diff --git a/libraries/cms/table/contenthistory.php b/libraries/cms/table/contenthistory.php index c7d067267aa1c..4bc748fb67921 100644 --- a/libraries/cms/table/contenthistory.php +++ b/libraries/cms/table/contenthistory.php @@ -78,8 +78,12 @@ public function store($updateNulls = false) $this->set('sha1_hash', $this->getSha1($this->get('version_data'), $typeTable)); } - $this->set('editor_user_id', JFactory::getUser()->id); - $this->set('save_date', JFactory::getDate()->toSql()); + // Modify author and date only when not toggling Keep Forever + if (is_null($this->get('keep_forever'))) + { + $this->set('editor_user_id', JFactory::getUser()->id); + $this->set('save_date', JFactory::getDate()->toSql()); + } return parent::store($updateNulls); } diff --git a/libraries/cms/table/corecontent.php b/libraries/cms/table/corecontent.php index 8e1f692ea2292..1570fb70592b5 100644 --- a/libraries/cms/table/corecontent.php +++ b/libraries/cms/table/corecontent.php @@ -10,6 +10,7 @@ defined('JPATH_PLATFORM') or die; use Joomla\Registry\Registry; +use Joomla\Utilities\ArrayHelper; /** * Core content table @@ -334,7 +335,7 @@ public function publish($pks = null, $state = 1, $userId = 0) $k = $this->_tbl_key; // Sanitize input. - JArrayHelper::toInteger($pks); + $pks = ArrayHelper::toInteger($pks); $userId = (int) $userId; $state = (int) $state; diff --git a/libraries/cms/version/version.php b/libraries/cms/version/version.php index 86b15109d17cf..9b388b5fbcfe6 100644 --- a/libraries/cms/version/version.php +++ b/libraries/cms/version/version.php @@ -70,7 +70,7 @@ final class JVersion * @var string * @since 3.5 */ - const RELDATE = '16-June-2016'; + const RELDATE = '13-July-2016'; /** * Release time. @@ -78,7 +78,7 @@ final class JVersion * @var string * @since 3.5 */ - const RELTIME = '13:54'; + const RELTIME = '10:08'; /** * Release timezone. diff --git a/libraries/joomla/access/access.php b/libraries/joomla/access/access.php index af939087e24bd..9e07412ac01b4 100644 --- a/libraries/joomla/access/access.php +++ b/libraries/joomla/access/access.php @@ -9,7 +9,7 @@ defined('JPATH_PLATFORM') or die; -jimport('joomla.utilities.arrayhelper'); +use Joomla\Utilities\ArrayHelper; /** * Class that handles all access authorisation routines. @@ -852,7 +852,7 @@ public static function getGroupsByUser($userId, $recursive = true) $result = $db->loadColumn(); // Clean up any NULL or duplicate values, just in case - JArrayHelper::toInteger($result); + $result = ArrayHelper::toInteger($result); if (empty($result)) { @@ -901,7 +901,7 @@ public static function getUsersByGroup($groupId, $recursive = false) $result = $db->loadColumn(); // Clean up any NULL values, just in case - JArrayHelper::toInteger($result); + $result = ArrayHelper::toInteger($result); return $result; } diff --git a/libraries/joomla/archive/bzip2.php b/libraries/joomla/archive/bzip2.php index aca54e572b8d3..fcb63fa621f5d 100644 --- a/libraries/joomla/archive/bzip2.php +++ b/libraries/joomla/archive/bzip2.php @@ -137,7 +137,9 @@ protected function extractStream($archive, $destination, $options = array ()) * @param int $code The application-internal error code for this error * @param string $msg The error message, which may also be shown the user if need be. * - * @return mixed JError object or Runtime Exception + * @return JException JException instance if JError class exists + * + * @throws RuntimeException if JError class does not exist */ private function raiseWarning($code, $msg) { diff --git a/libraries/joomla/archive/gzip.php b/libraries/joomla/archive/gzip.php index b9fbc1163977b..91328e9da8403 100644 --- a/libraries/joomla/archive/gzip.php +++ b/libraries/joomla/archive/gzip.php @@ -147,7 +147,9 @@ protected function extractStream($archive, $destination, $options = array ()) * @param int $code The application-internal error code for this error * @param string $msg The error message, which may also be shown the user if need be. * - * @return mixed JError object or Runtime Exception + * @return JException JException instance if JError class exists + * + * @throws RuntimeException if JError class does not exist */ private function raiseWarning($code, $msg) { diff --git a/libraries/joomla/archive/tar.php b/libraries/joomla/archive/tar.php index f16b30a21adf5..15d60d26e2d32 100644 --- a/libraries/joomla/archive/tar.php +++ b/libraries/joomla/archive/tar.php @@ -66,10 +66,10 @@ class JArchiveTar implements JArchiveExtractable * @param string $destination Path to extract archive into * @param array $options Extraction options [unused] * - * @return boolean True if successful + * @return boolean|JException True on success, JException instance on failure if JError class exists * - * @throws RuntimeException * @since 11.1 + * @throws RuntimeException if JError class does not exist */ public function extract($archive, $destination, array $options = array()) { @@ -148,18 +148,10 @@ public static function isSupported() * * @param string &$data The Tar archive buffer. * - * @return array Archive metadata array - *
-	 * KEY: Position in the array
-	 * VALUES: 'attr'  --  File attributes
-	 * 'data'  --  Raw file contents
-	 * 'date'  --  File modification time
-	 * 'name'  --  Filename
-	 * 'size'  --  Original file size
-	 * 'type'  --  File type
-	 * 
+ * @return boolean|JException True on success, JException instance on failure if JError class exists * - * @since 11.1 + * @since 11.1 + * @throws RuntimeException if JError class does not exist */ protected function _getTarInfo(& $data) { diff --git a/libraries/joomla/archive/zip.php b/libraries/joomla/archive/zip.php index 652cd52f4ff39..c9e468ee8afbf 100644 --- a/libraries/joomla/archive/zip.php +++ b/libraries/joomla/archive/zip.php @@ -144,7 +144,9 @@ public function extract($archive, $destination, array $options = array()) * @param int $code The application-internal error code for this error * @param string $msg The error message, which may also be shown the user if need be. * - * @return mixed JError object or Runtime Exception + * @return JException JException instance if JError class exists + * + * @throws RuntimeException if JError class does not exist */ private function raiseWarning($code, $msg) { diff --git a/libraries/joomla/cache/storage/apc.php b/libraries/joomla/cache/storage/apc.php index ec68aa5f65a32..c76fa334de127 100644 --- a/libraries/joomla/cache/storage/apc.php +++ b/libraries/joomla/cache/storage/apc.php @@ -50,8 +50,22 @@ public function getAll() foreach ($keys as $key) { - // If APCu is being used for this adapter, the internal key name changed with APCu 4.0.7 from key to info - $name = isset($key['info']) ? $key['info'] : $key['key']; + if (isset($key['info'])) + { + // If APCu is being used for this adapter, the internal key name changed with APCu 4.0.7 from key to info + $name = $key['info']; + } + elseif (isset($key['entry_name'])) + { + // Some APC modules changed the internal key name from key to entry_name, HHVM is one such case + $name = $key['entry_name']; + } + else + { + // A fall back for the old internal key name + $name = $key['key']; + } + $namearr = explode('-', $name); if ($namearr !== false && $namearr[0] == $secret && $namearr[1] == 'cache') @@ -128,8 +142,21 @@ public function clean($group, $mode = null) foreach ($keys as $key) { - // If APCu is being used for this adapter, the internal key name changed with APCu 4.0.7 from key to info - $internalKey = isset($key['info']) ? $key['info'] : $key['key']; + if (isset($key['info'])) + { + // If APCu is being used for this adapter, the internal key name changed with APCu 4.0.7 from key to info + $internalKey = $key['info']; + } + elseif (isset($key['entry_name'])) + { + // Some APC modules changed the internal key name from key to entry_name, HHVM is one such case + $internalKey = $key['entry_name']; + } + else + { + // A fall back for the old internal key name + $internalKey = $key['key']; + } if (strpos($internalKey, $secret . '-cache-' . $group . '-') === 0 xor $mode != 'group') { @@ -155,8 +182,21 @@ public function gc() foreach ($keys as $key) { - // If APCu is being used for this adapter, the internal key name changed with APCu 4.0.7 from key to info - $internalKey = isset($key['info']) ? $key['info'] : $key['key']; + if (isset($key['info'])) + { + // If APCu is being used for this adapter, the internal key name changed with APCu 4.0.7 from key to info + $internalKey = $key['info']; + } + elseif (isset($key['entry_name'])) + { + // Some APC modules changed the internal key name from key to entry_name, HHVM is one such case + $internalKey = $key['entry_name']; + } + else + { + // A fall back for the old internal key name + $internalKey = $key['key']; + } if (strpos($internalKey, $secret . '-cache-')) { diff --git a/libraries/joomla/cache/storage/apcu.php b/libraries/joomla/cache/storage/apcu.php index 87c619996d129..889f02d6ec3bd 100644 --- a/libraries/joomla/cache/storage/apcu.php +++ b/libraries/joomla/cache/storage/apcu.php @@ -50,8 +50,22 @@ public function getAll() foreach ($keys as $key) { - // The internal key name changed with APCu 4.0.7 from key to info - $name = isset($key['info']) ? $key['info'] : $key['key']; + if (isset($key['info'])) + { + // The internal key name changed with APCu 4.0.7 from key to info + $name = $key['info']; + } + elseif (isset($key['entry_name'])) + { + // Some APCu modules changed the internal key name from key to entry_name + $name = $key['entry_name']; + } + else + { + // A fall back for the old internal key name + $name = $key['key']; + } + $namearr = explode('-', $name); if ($namearr !== false && $namearr[0] == $secret && $namearr[1] == 'cache') @@ -136,8 +150,21 @@ public function clean($group, $mode = null) foreach ($keys as $key) { - // The internal key name changed with APCu 4.0.7 from key to info - $internalKey = isset($key['info']) ? $key['info'] : $key['key']; + if (isset($key['info'])) + { + // The internal key name changed with APCu 4.0.7 from key to info + $internalKey = $key['info']; + } + elseif (isset($key['entry_name'])) + { + // Some APCu modules changed the internal key name from key to entry_name + $internalKey = $key['entry_name']; + } + else + { + // A fall back for the old internal key name + $internalKey = $key['key']; + } if (strpos($internalKey, $secret . '-cache-' . $group . '-') === 0 xor $mode != 'group') { @@ -163,8 +190,21 @@ public function gc() foreach ($keys as $key) { - // The internal key name changed with APCu 4.0.7 from key to info - $internalKey = isset($key['info']) ? $key['info'] : $key['key']; + if (isset($key['info'])) + { + // The internal key name changed with APCu 4.0.7 from key to info + $internalKey = $key['info']; + } + elseif (isset($key['entry_name'])) + { + // Some APCu modules changed the internal key name from key to entry_name + $internalKey = $key['entry_name']; + } + else + { + // A fall back for the old internal key name + $internalKey = $key['key']; + } if (strpos($internalKey, $secret . '-cache-')) { diff --git a/libraries/joomla/database/driver/postgresql.php b/libraries/joomla/database/driver/postgresql.php index e4696475c0f8b..5d790b60ee868 100644 --- a/libraries/joomla/database/driver/postgresql.php +++ b/libraries/joomla/database/driver/postgresql.php @@ -138,8 +138,8 @@ public function connect() } pg_set_error_verbosity($this->connection, PGSQL_ERRORS_DEFAULT); - pg_query('SET standard_conforming_strings=off'); - pg_query('SET escape_string_warning=off'); + pg_query($this->connection, 'SET standard_conforming_strings=off'); + pg_query($this->connection, 'SET escape_string_warning=off'); } /** @@ -883,6 +883,11 @@ public function setUtf() { $this->connect(); + if (!function_exists('pg_set_client_encoding')) + { + return -1; + } + return pg_set_client_encoding($this->connection, 'UTF8'); } diff --git a/libraries/joomla/database/iterator/azure.php b/libraries/joomla/database/iterator/sqlazure.php similarity index 84% rename from libraries/joomla/database/iterator/azure.php rename to libraries/joomla/database/iterator/sqlazure.php index 97d1e7d0cb4ca..0a02d398cdcb7 100644 --- a/libraries/joomla/database/iterator/azure.php +++ b/libraries/joomla/database/iterator/sqlazure.php @@ -14,6 +14,6 @@ * * @since 12.1 */ -class JDatabaseIteratorAzure extends JDatabaseIteratorSqlsrv +class JDatabaseIteratorSqlazure extends JDatabaseIteratorSqlsrv { } diff --git a/libraries/joomla/filesystem/file.php b/libraries/joomla/filesystem/file.php index 9240fc9ebfa4c..5153b93e04b8b 100644 --- a/libraries/joomla/filesystem/file.php +++ b/libraries/joomla/filesystem/file.php @@ -484,8 +484,7 @@ public static function append($file, &$buffer, $use_streams = false) if ($FTPOptions['enabled'] == 1) { // Connect the FTP client - jimport('joomla.client.ftp'); - $ftp = JFTP::getInstance($FTPOptions['host'], $FTPOptions['port'], null, $FTPOptions['user'], $FTPOptions['pass']); + $ftp = JClientFtp::getInstance($FTPOptions['host'], $FTPOptions['port'], array(), $FTPOptions['user'], $FTPOptions['pass']); // Translate path for the FTP account and use FTP write buffer to file $file = JPath::clean(str_replace(JPATH_ROOT, $FTPOptions['root'], $file), '/'); diff --git a/libraries/joomla/form/fields/rules.php b/libraries/joomla/form/fields/rules.php index 2f0b5d4a8edbd..59c1ea24d0dc3 100644 --- a/libraries/joomla/form/fields/rules.php +++ b/libraries/joomla/form/fields/rules.php @@ -313,7 +313,7 @@ protected function getInput() $html[] = ' (Use /re/ syntax for regexp search)',s=' (Use /re/ syntax for regexp search)',t='With: ',u="Replace? ";a.commands.find=function(a){o(a),m(a)},a.commands.findPersistent=function(a){o(a),m(a,!1,!0)},a.commands.findNext=m,a.commands.findPrev=function(a){m(a,!0)},a.commands.clearSearch=o,a.commands.replace=q,a.commands.replaceAll=function(a){q(a,!0)}}); \ No newline at end of file +!function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("./searchcursor"),require("../dialog/dialog")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./searchcursor","../dialog/dialog"],a):a(CodeMirror)}(function(a){"use strict";function b(a,b){return"string"==typeof a?a=new RegExp(a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),b?"gi":"g"):a.global||(a=new RegExp(a.source,a.ignoreCase?"gi":"g")),{token:function(b){a.lastIndex=b.pos;var c=a.exec(b.string);return c&&c.index==b.pos?(b.pos+=c[0].length||1,"searching"):void(c?b.pos=c.index:b.skipToEnd())}}}function c(){this.posFrom=this.posTo=this.lastQuery=this.query=null,this.overlay=null}function d(a){return a.state.search||(a.state.search=new c)}function e(a){return"string"==typeof a&&a==a.toLowerCase()}function f(a,b,c){return a.getSearchCursor(b,c,e(b))}function g(a,b,c,d,e){a.openDialog(b,d,{value:c,selectValueOnOpen:!0,closeOnEnter:!1,onClose:function(){o(a)},onKeyDown:e})}function h(a,b,c,d,e){a.openDialog?a.openDialog(b,e,{value:d,selectValueOnOpen:!0}):e(prompt(c,d))}function i(a,b,c,d){a.openConfirm?a.openConfirm(b,d):confirm(c)&&d[0]()}function j(a){return a.replace(/\\(.)/g,function(a,b){return"n"==b?"\n":"r"==b?"\r":b})}function k(a){var b=a.match(/^\/(.*)\/([a-z]*)$/);if(b)try{a=new RegExp(b[1],-1==b[2].indexOf("i")?"":"i")}catch(c){}else a=j(a);return("string"==typeof a?""==a:a.test(""))&&(a=/x^/),a}function l(a,c,d){c.queryText=d,c.query=k(d),a.removeOverlay(c.overlay,e(c.query)),c.overlay=b(c.query,e(c.query)),a.addOverlay(c.overlay),a.showMatchesOnScrollbar&&(c.annotate&&(c.annotate.clear(),c.annotate=null),c.annotate=a.showMatchesOnScrollbar(c.query,e(c.query)))}function m(b,c,e,f){var i=d(b);if(i.query)return n(b,c);var j=b.getSelection()||i.lastQuery;if(e&&b.openDialog){var k=null,m=function(c,d){a.e_stop(d),c&&(c!=i.queryText&&(l(b,i,c),i.posFrom=i.posTo=b.getCursor()),k&&(k.style.opacity=1),n(b,d.shiftKey,function(a,c){var d;c.line<3&&document.querySelector&&(d=b.display.wrapper.querySelector(".CodeMirror-dialog"))&&d.getBoundingClientRect().bottom-4>b.cursorCoords(c,"window").top&&((k=d).style.opacity=.4)}))};g(b,r,j,m,function(c,e){var f=a.keyMap[b.getOption("keyMap")][a.keyName(c)];"findNext"==f||"findPrev"==f?(a.e_stop(c),l(b,d(b),e),b.execCommand(f)):("find"==f||"findPersistent"==f)&&(a.e_stop(c),m(e,c))}),f&&(l(b,i,j),n(b,c))}else h(b,r,"Search for:",j,function(a){a&&!i.query&&b.operation(function(){l(b,i,a),i.posFrom=i.posTo=b.getCursor(),n(b,c)})})}function n(b,c,e){b.operation(function(){var g=d(b),h=f(b,g.query,c?g.posFrom:g.posTo);(h.find(c)||(h=f(b,g.query,c?a.Pos(b.lastLine()):a.Pos(b.firstLine(),0)),h.find(c)))&&(b.setSelection(h.from(),h.to()),b.scrollIntoView({from:h.from(),to:h.to()},20),g.posFrom=h.from(),g.posTo=h.to(),e&&e(h.from(),h.to()))})}function o(a){a.operation(function(){var b=d(a);b.lastQuery=b.query,b.query&&(b.query=b.queryText=null,a.removeOverlay(b.overlay),b.annotate&&(b.annotate.clear(),b.annotate=null))})}function p(a,b,c){a.operation(function(){for(var d=f(a,b);d.findNext();)if("string"!=typeof b){var e=a.getRange(d.from(),d.to()).match(b);d.replace(c.replace(/\$(\d)/g,function(a,b){return e[b]}))}else d.replace(c)})}function q(a,b){if(!a.getOption("readOnly")){var c=a.getSelection()||d(a).lastQuery,e=b?"Replace all:":"Replace:";h(a,e+s,e,c,function(c){c&&(c=k(c),h(a,t,"Replace with:","",function(d){if(d=j(d),b)p(a,c,d);else{o(a);var e=f(a,c,a.getCursor("from")),g=function(){var b,j=e.from();!(b=e.findNext())&&(e=f(a,c),!(b=e.findNext())||j&&e.from().line==j.line&&e.from().ch==j.ch)||(a.setSelection(e.from(),e.to()),a.scrollIntoView({from:e.from(),to:e.to()}),i(a,u,"Replace?",[function(){h(b)},g,function(){p(a,c,d)}]))},h=function(a){e.replace("string"==typeof c?d:d.replace(/\$(\d)/g,function(b,c){return a[c]})),g()};g()}}))})}}var r='Search: (Use /re/ syntax for regexp search)',s=' (Use /re/ syntax for regexp search)',t='With: ',u="Replace? ";a.commands.find=function(a){o(a),m(a)},a.commands.findPersistent=function(a){o(a),m(a,!1,!0)},a.commands.findPersistentNext=function(a){m(a,!1,!0,!0)},a.commands.findPersistentPrev=function(a){m(a,!0,!0,!0)},a.commands.findNext=m,a.commands.findPrev=function(a){m(a,!0)},a.commands.clearSearch=o,a.commands.replace=q,a.commands.replaceAll=function(a){q(a,!0)}}); \ No newline at end of file diff --git a/media/editors/codemirror/addon/wrap/hardwrap.js b/media/editors/codemirror/addon/wrap/hardwrap.js index 8806fbe2f2ff7..04851f99ff370 100644 --- a/media/editors/codemirror/addon/wrap/hardwrap.js +++ b/media/editors/codemirror/addon/wrap/hardwrap.js @@ -30,7 +30,9 @@ } function findBreakPoint(text, column, wrapOn, killTrailingSpace) { - for (var at = column; at > 0; --at) + var at = column + while (at < text.length && text.charAt(at) == " ") at++ + for (; at > 0; --at) if (wrapOn.test(text.slice(at - 1, at + 1))) break; for (var first = true;; first = false) { var endOfText = at; diff --git a/media/editors/codemirror/addon/wrap/hardwrap.min.js b/media/editors/codemirror/addon/wrap/hardwrap.min.js index 46b7660126293..405a9d6fbfbab 100644 --- a/media/editors/codemirror/addon/wrap/hardwrap.min.js +++ b/media/editors/codemirror/addon/wrap/hardwrap.min.js @@ -1 +1 @@ -!function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)}(function(a){"use strict";function b(a,b,c){for(var d=c.paragraphStart||a.getHelper(b,"paragraphStart"),e=b.line,f=a.firstLine();e>f;--e){var g=a.getLine(e);if(d&&d.test(g))break;if(!/\S/.test(g)){++e;break}}for(var h=c.paragraphEnd||a.getHelper(b,"paragraphEnd"),i=b.line+1,j=a.lastLine();j>=i;++i){var g=a.getLine(i);if(h&&h.test(g)){++i;break}if(!/\S/.test(g))break}return{from:e,to:i}}function c(a,b,c,d){for(var e=b;e>0&&!c.test(a.slice(e-1,e+1));--e);for(var f=!0;;f=!1){var g=e;if(d)for(;" "==a.charAt(g-1);)--g;if(0!=g||!f)return{from:g,to:e};e=b}}function d(b,d,f,g){d=b.clipPos(d),f=b.clipPos(f);var h=g.column||80,i=g.wrapOn||/\s\S|-[^\.\d]/,j=g.killTrailingSpace!==!1,k=[],l="",m=d.line,n=b.getRange(d,f,!1);if(!n.length)return null;for(var o=n[0].match(/^[ \t]*/)[0],p=0;ph&&o==t&&c(l,h,i,j);u&&u.from==r&&u.to==r+s?(l=o+q,++m):k.push({text:[s?" ":""],from:e(m,r),to:e(m+1,t.length)})}for(;l.length>h;){var v=c(l,h,i,j);k.push({text:["",o],from:e(m,v.from),to:e(m,v.to)}),l=o+l.slice(v.to),++m}}return k.length&&b.operation(function(){for(var c=0;c=0;g--){var h,i=c[g];if(i.empty()){var j=b(a,i.head,{});h={from:e(j.from,0),to:e(j.to-1)}}else h={from:i.from(),to:i.to()};h.to.line>=f||(f=h.from.line,d(a,h.from,h.to,{}))}})},a.defineExtension("wrapRange",function(a,b,c){return d(this,a,b,c||{})}),a.defineExtension("wrapParagraphsInRange",function(a,c,f){f=f||{};for(var g=this,h=[],i=a.line;i<=c.line;){var j=b(g,e(i,0),f);h.push(j),i=j.to}var k=!1;return h.length&&g.operation(function(){for(var a=h.length-1;a>=0;--a)k=k||d(g,e(h[a].from,0),e(h[a].to-1),f)}),k})}); \ No newline at end of file +!function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)}(function(a){"use strict";function b(a,b,c){for(var d=c.paragraphStart||a.getHelper(b,"paragraphStart"),e=b.line,f=a.firstLine();e>f;--e){var g=a.getLine(e);if(d&&d.test(g))break;if(!/\S/.test(g)){++e;break}}for(var h=c.paragraphEnd||a.getHelper(b,"paragraphEnd"),i=b.line+1,j=a.lastLine();j>=i;++i){var g=a.getLine(i);if(h&&h.test(g)){++i;break}if(!/\S/.test(g))break}return{from:e,to:i}}function c(a,b,c,d){for(var e=b;e0&&!c.test(a.slice(e-1,e+1));--e);for(var f=!0;;f=!1){var g=e;if(d)for(;" "==a.charAt(g-1);)--g;if(0!=g||!f)return{from:g,to:e};e=b}}function d(b,d,f,g){d=b.clipPos(d),f=b.clipPos(f);var h=g.column||80,i=g.wrapOn||/\s\S|-[^\.\d]/,j=g.killTrailingSpace!==!1,k=[],l="",m=d.line,n=b.getRange(d,f,!1);if(!n.length)return null;for(var o=n[0].match(/^[ \t]*/)[0],p=0;ph&&o==t&&c(l,h,i,j);u&&u.from==r&&u.to==r+s?(l=o+q,++m):k.push({text:[s?" ":""],from:e(m,r),to:e(m+1,t.length)})}for(;l.length>h;){var v=c(l,h,i,j);k.push({text:["",o],from:e(m,v.from),to:e(m,v.to)}),l=o+l.slice(v.to),++m}}return k.length&&b.operation(function(){for(var c=0;c=0;g--){var h,i=c[g];if(i.empty()){var j=b(a,i.head,{});h={from:e(j.from,0),to:e(j.to-1)}}else h={from:i.from(),to:i.to()};h.to.line>=f||(f=h.from.line,d(a,h.from,h.to,{}))}})},a.defineExtension("wrapRange",function(a,b,c){return d(this,a,b,c||{})}),a.defineExtension("wrapParagraphsInRange",function(a,c,f){f=f||{};for(var g=this,h=[],i=a.line;i<=c.line;){var j=b(g,e(i,0),f);h.push(j),i=j.to}var k=!1;return h.length&&g.operation(function(){for(var a=h.length-1;a>=0;--a)k=k||d(g,e(h[a].from,0),e(h[a].to-1),f)}),k})}); \ No newline at end of file diff --git a/media/editors/codemirror/keymap/sublime.js b/media/editors/codemirror/keymap/sublime.js index c1749e719609b..ed6b84742818d 100644 --- a/media/editors/codemirror/keymap/sublime.js +++ b/media/editors/codemirror/keymap/sublime.js @@ -420,6 +420,34 @@ map[cK + ctrl + "Backspace"] = "delLineLeft"; + cmds[map["Backspace"] = "smartBackspace"] = function(cm) { + if (cm.somethingSelected()) return CodeMirror.Pass; + + cm.operation(function() { + var cursors = cm.listSelections(); + var indentUnit = cm.getOption("indentUnit"); + + for (var i = cursors.length - 1; i >= 0; i--) { + var cursor = cursors[i].head; + var toStartOfLine = cm.getRange({line: cursor.line, ch: 0}, cursor); + var column = CodeMirror.countColumn(toStartOfLine, null, cm.getOption("tabSize")); + + // Delete by one character by default + var deletePos = cm.findPosH(cursor, -1, "char", false); + + if (toStartOfLine && !/\S/.test(toStartOfLine) && column % indentUnit == 0) { + var prevIndent = new Pos(cursor.line, + CodeMirror.findColumn(toStartOfLine, column - indentUnit, indentUnit)); + + // Smart delete only if we found a valid prevIndent location + if (prevIndent.ch != cursor.ch) deletePos = prevIndent; + } + + cm.replaceRange("", deletePos, cursor, "+delete"); + } + }); + }; + cmds[map[cK + ctrl + "K"] = "delLineRight"] = function(cm) { cm.operation(function() { var ranges = cm.listSelections(); @@ -472,7 +500,8 @@ cm.scrollTo(null, (pos.top + pos.bottom) / 2 - cm.getScrollInfo().clientHeight / 2); }; - cmds[map["Shift-Alt-Up"] = "selectLinesUpward"] = function(cm) { + var selectLinesCombo = mac ? "Ctrl-Shift-" : "Ctrl-Alt-"; + cmds[map[selectLinesCombo + "Up"] = "selectLinesUpward"] = function(cm) { cm.operation(function() { var ranges = cm.listSelections(); for (var i = 0; i < ranges.length; i++) { @@ -482,7 +511,7 @@ } }); }; - cmds[map["Shift-Alt-Down"] = "selectLinesDownward"] = function(cm) { + cmds[map[selectLinesCombo + "Down"] = "selectLinesDownward"] = function(cm) { cm.operation(function() { var ranges = cm.listSelections(); for (var i = 0; i < ranges.length; i++) { diff --git a/media/editors/codemirror/keymap/sublime.min.js b/media/editors/codemirror/keymap/sublime.min.js index 1630c5e9a102b..12b28dc6ead05 100644 --- a/media/editors/codemirror/keymap/sublime.min.js +++ b/media/editors/codemirror/keymap/sublime.min.js @@ -1 +1 @@ -!function(a){"object"==typeof exports&&"object"==typeof module?a(require("../lib/codemirror"),require("../addon/search/searchcursor"),require("../addon/edit/matchbrackets")):"function"==typeof define&&define.amd?define(["../lib/codemirror","../addon/search/searchcursor","../addon/edit/matchbrackets"],a):a(CodeMirror)}(function(a){"use strict";function b(b,c,d){if(0>d&&0==c.ch)return b.clipPos(m(c.line-1));var e=b.getLine(c.line);if(d>0&&c.ch>=e.length)return b.clipPos(m(c.line+1,0));for(var f,g="start",h=c.ch,i=0>d?0:e.length,j=0;h!=i;h+=d,j++){var k=e.charAt(0>d?h-1:h),l="_"!=k&&a.isWordChar(k)?"w":"o";if("w"==l&&k.toUpperCase()==k&&(l="W"),"start"==g)"o"!=l&&(g="in",f=l);else if("in"==g&&f!=l){if("w"==f&&"W"==l&&0>d&&h--,"W"==f&&"w"==l&&d>0){f="w";continue}break}}return m(c.line,h)}function c(a,c){a.extendSelectionsBy(function(d){return a.display.shift||a.doc.extend||d.empty()?b(a.doc,d.head,c):0>c?d.from():d.to()})}function d(b,c){return b.isReadOnly()?a.Pass:(b.operation(function(){for(var a=b.listSelections().length,d=[],e=-1,f=0;a>f;f++){var g=b.listSelections()[f].head;if(!(g.line<=e)){var h=m(g.line+(c?0:1),0);b.replaceRange("\n",h,null,"+insertLine"),b.indentLine(h.line,null,!0),d.push({head:h,anchor:h}),e=g.line+1}}b.setSelections(d)}),void b.execCommand("indentAuto"))}function e(b,c){for(var d=c.ch,e=d,f=b.getLine(c.line);d&&a.isWordChar(f.charAt(d-1));)--d;for(;ea?-1:a==b?0:1}),b.replaceRange(k,i,j),d&&a.push({anchor:i,head:j})}d&&b.setSelections(a,0)})}function h(b,c){b.operation(function(){for(var d=b.listSelections(),f=[],g=[],h=0;h=0;h--){var i=d[f[h]];if(!(j&&a.cmpPos(i.head,j)>0)){var k=e(b,i.head);j=k.from,b.replaceRange(c(k.word),k.from,k.to)}}})}function i(b){var c=b.getCursor("from"),d=b.getCursor("to");if(0==a.cmpPos(c,d)){var f=e(b,c);if(!f.word)return;c=f.from,d=f.to}return{from:c,to:d,query:b.getRange(c,d),word:f}}function j(a,b){var c=i(a);if(c){var d=c.query,e=a.getSearchCursor(d,b?c.to:c.from);(b?e.findNext():e.findPrevious())?a.setSelection(e.from(),e.to()):(e=a.getSearchCursor(d,b?m(a.firstLine(),0):a.clipPos(m(a.lastLine()))),(b?e.findNext():e.findPrevious())?a.setSelection(e.from(),e.to()):c.word&&a.setSelection(c.from,c.to))}}var k=a.keyMap.sublime={fallthrough:"default"},l=a.commands,m=a.Pos,n=a.keyMap["default"]==a.keyMap.macDefault,o=n?"Cmd-":"Ctrl-";l[k["Alt-Left"]="goSubwordLeft"]=function(a){c(a,-1)},l[k["Alt-Right"]="goSubwordRight"]=function(a){c(a,1)},n&&(k["Cmd-Left"]="goLineStartSmart");var p=n?"Ctrl-Alt-":"Ctrl-";l[k[p+"Up"]="scrollLineUp"]=function(a){var b=a.getScrollInfo();if(!a.somethingSelected()){var c=a.lineAtHeight(b.top+b.clientHeight,"local");a.getCursor().line>=c&&a.execCommand("goLineUp")}a.scrollTo(null,b.top-a.defaultTextHeight())},l[k[p+"Down"]="scrollLineDown"]=function(a){var b=a.getScrollInfo();if(!a.somethingSelected()){var c=a.lineAtHeight(b.top,"local")+1;a.getCursor().line<=c&&a.execCommand("goLineDown")}a.scrollTo(null,b.top+a.defaultTextHeight())},l[k["Shift-"+o+"L"]="splitSelectionByLine"]=function(a){for(var b=a.listSelections(),c=[],d=0;de.line&&g==f.line&&0==f.ch||c.push({anchor:g==e.line?e:m(g,0),head:g==f.line?f:m(g)});a.setSelections(c,0)},k["Shift-Tab"]="indentLess",l[k.Esc="singleSelectionTop"]=function(a){var b=a.listSelections()[0];a.setSelection(b.anchor,b.head,{scroll:!1})},l[k[o+"L"]="selectLine"]=function(a){for(var b=a.listSelections(),c=[],d=0;de?d.push(i,j):d.length&&(d[d.length-1]=j),e=j}b.operation(function(){for(var a=0;ab.lastLine()?b.replaceRange("\n"+g,m(b.lastLine()),null,"+swapLine"):b.replaceRange(g+"\n",m(e,0),null,"+swapLine")}b.setSelections(f),b.scrollIntoView()})},l[k[r+"Down"]="swapLineDown"]=function(b){if(b.isReadOnly())return a.Pass;for(var c=b.listSelections(),d=[],e=b.lastLine()+1,f=c.length-1;f>=0;f--){var g=c[f],h=g.to().line+1,i=g.from().line;0!=g.to().ch||g.empty()||h--,e>h?d.push(h,i):d.length&&(d[d.length-1]=i),e=i}b.operation(function(){for(var a=d.length-2;a>=0;a-=2){var c=d[a],e=d[a+1],f=b.getLine(c);c==b.lastLine()?b.replaceRange("",m(c-1),m(c),"+swapLine"):b.replaceRange("",m(c,0),m(c+1,0),"+swapLine"),b.replaceRange(f+"\n",m(e,0),null,"+swapLine")}b.scrollIntoView()})},l[k[o+"/"]="toggleCommentIndented"]=function(a){a.toggleComment({indent:!0})},l[k[o+"J"]="joinLines"]=function(a){for(var b=a.listSelections(),c=[],d=0;dc;c++){var d=a.listSelections()[c];d.empty()?a.replaceRange(a.getLine(d.head.line)+"\n",m(d.head.line,0)):a.replaceRange(a.getRange(d.from(),d.to()),d.from())}a.scrollIntoView()})},k[o+"T"]="transposeChars",l[k.F9="sortLines"]=function(a){g(a,!0)},l[k[o+"F9"]="sortLinesInsensitive"]=function(a){g(a,!1)},l[k.F2="nextBookmark"]=function(a){var b=a.state.sublimeBookmarks;if(b)for(;b.length;){var c=b.shift(),d=c.find();if(d)return b.push(c),a.setSelection(d.from,d.to)}},l[k["Shift-F2"]="prevBookmark"]=function(a){var b=a.state.sublimeBookmarks;if(b)for(;b.length;){b.unshift(b.pop());var c=b[b.length-1].find();if(c)return a.setSelection(c.from,c.to);b.pop()}},l[k[o+"F2"]="toggleBookmark"]=function(a){for(var b=a.listSelections(),c=a.state.sublimeBookmarks||(a.state.sublimeBookmarks=[]),d=0;d=0;c--)a.replaceRange("",b[c].anchor,m(b[c].to().line),"+delete");a.scrollIntoView()})},l[k[s+o+"U"]="upcaseAtCursor"]=function(a){h(a,function(a){return a.toUpperCase()})},l[k[s+o+"L"]="downcaseAtCursor"]=function(a){h(a,function(a){return a.toLowerCase()})},l[k[s+o+"Space"]="setSublimeMark"]=function(a){a.state.sublimeMark&&a.state.sublimeMark.clear(),a.state.sublimeMark=a.setBookmark(a.getCursor())},l[k[s+o+"A"]="selectToSublimeMark"]=function(a){var b=a.state.sublimeMark&&a.state.sublimeMark.find();b&&a.setSelection(a.getCursor(),b)},l[k[s+o+"W"]="deleteToSublimeMark"]=function(b){var c=b.state.sublimeMark&&b.state.sublimeMark.find();if(c){var d=b.getCursor(),e=c;if(a.cmpPos(d,e)>0){var f=e;e=d,d=f}b.state.sublimeKilled=b.getRange(d,e),b.replaceRange("",d,e)}},l[k[s+o+"X"]="swapWithSublimeMark"]=function(a){var b=a.state.sublimeMark&&a.state.sublimeMark.find();b&&(a.state.sublimeMark.clear(),a.state.sublimeMark=a.setBookmark(a.getCursor()),a.setCursor(b))},l[k[s+o+"Y"]="sublimeYank"]=function(a){null!=a.state.sublimeKilled&&a.replaceSelection(a.state.sublimeKilled,null,"paste")},k[s+o+"G"]="clearBookmarks",l[k[s+o+"C"]="showInCenter"]=function(a){var b=a.cursorCoords(null,"local");a.scrollTo(null,(b.top+b.bottom)/2-a.getScrollInfo().clientHeight/2)},l[k["Shift-Alt-Up"]="selectLinesUpward"]=function(a){a.operation(function(){for(var b=a.listSelections(),c=0;ca.firstLine()&&a.addSelection(m(d.head.line-1,d.head.ch))}})},l[k["Shift-Alt-Down"]="selectLinesDownward"]=function(a){a.operation(function(){for(var b=a.listSelections(),c=0;cd&&0==c.ch)return b.clipPos(m(c.line-1));var e=b.getLine(c.line);if(d>0&&c.ch>=e.length)return b.clipPos(m(c.line+1,0));for(var f,g="start",h=c.ch,i=0>d?0:e.length,j=0;h!=i;h+=d,j++){var k=e.charAt(0>d?h-1:h),l="_"!=k&&a.isWordChar(k)?"w":"o";if("w"==l&&k.toUpperCase()==k&&(l="W"),"start"==g)"o"!=l&&(g="in",f=l);else if("in"==g&&f!=l){if("w"==f&&"W"==l&&0>d&&h--,"W"==f&&"w"==l&&d>0){f="w";continue}break}}return m(c.line,h)}function c(a,c){a.extendSelectionsBy(function(d){return a.display.shift||a.doc.extend||d.empty()?b(a.doc,d.head,c):0>c?d.from():d.to()})}function d(b,c){return b.isReadOnly()?a.Pass:(b.operation(function(){for(var a=b.listSelections().length,d=[],e=-1,f=0;a>f;f++){var g=b.listSelections()[f].head;if(!(g.line<=e)){var h=m(g.line+(c?0:1),0);b.replaceRange("\n",h,null,"+insertLine"),b.indentLine(h.line,null,!0),d.push({head:h,anchor:h}),e=g.line+1}}b.setSelections(d)}),void b.execCommand("indentAuto"))}function e(b,c){for(var d=c.ch,e=d,f=b.getLine(c.line);d&&a.isWordChar(f.charAt(d-1));)--d;for(;ea?-1:a==b?0:1}),b.replaceRange(k,i,j),d&&a.push({anchor:i,head:j})}d&&b.setSelections(a,0)})}function h(b,c){b.operation(function(){for(var d=b.listSelections(),f=[],g=[],h=0;h=0;h--){var i=d[f[h]];if(!(j&&a.cmpPos(i.head,j)>0)){var k=e(b,i.head);j=k.from,b.replaceRange(c(k.word),k.from,k.to)}}})}function i(b){var c=b.getCursor("from"),d=b.getCursor("to");if(0==a.cmpPos(c,d)){var f=e(b,c);if(!f.word)return;c=f.from,d=f.to}return{from:c,to:d,query:b.getRange(c,d),word:f}}function j(a,b){var c=i(a);if(c){var d=c.query,e=a.getSearchCursor(d,b?c.to:c.from);(b?e.findNext():e.findPrevious())?a.setSelection(e.from(),e.to()):(e=a.getSearchCursor(d,b?m(a.firstLine(),0):a.clipPos(m(a.lastLine()))),(b?e.findNext():e.findPrevious())?a.setSelection(e.from(),e.to()):c.word&&a.setSelection(c.from,c.to))}}var k=a.keyMap.sublime={fallthrough:"default"},l=a.commands,m=a.Pos,n=a.keyMap["default"]==a.keyMap.macDefault,o=n?"Cmd-":"Ctrl-";l[k["Alt-Left"]="goSubwordLeft"]=function(a){c(a,-1)},l[k["Alt-Right"]="goSubwordRight"]=function(a){c(a,1)},n&&(k["Cmd-Left"]="goLineStartSmart");var p=n?"Ctrl-Alt-":"Ctrl-";l[k[p+"Up"]="scrollLineUp"]=function(a){var b=a.getScrollInfo();if(!a.somethingSelected()){var c=a.lineAtHeight(b.top+b.clientHeight,"local");a.getCursor().line>=c&&a.execCommand("goLineUp")}a.scrollTo(null,b.top-a.defaultTextHeight())},l[k[p+"Down"]="scrollLineDown"]=function(a){var b=a.getScrollInfo();if(!a.somethingSelected()){var c=a.lineAtHeight(b.top,"local")+1;a.getCursor().line<=c&&a.execCommand("goLineDown")}a.scrollTo(null,b.top+a.defaultTextHeight())},l[k["Shift-"+o+"L"]="splitSelectionByLine"]=function(a){for(var b=a.listSelections(),c=[],d=0;de.line&&g==f.line&&0==f.ch||c.push({anchor:g==e.line?e:m(g,0),head:g==f.line?f:m(g)});a.setSelections(c,0)},k["Shift-Tab"]="indentLess",l[k.Esc="singleSelectionTop"]=function(a){var b=a.listSelections()[0];a.setSelection(b.anchor,b.head,{scroll:!1})},l[k[o+"L"]="selectLine"]=function(a){for(var b=a.listSelections(),c=[],d=0;de?d.push(i,j):d.length&&(d[d.length-1]=j),e=j}b.operation(function(){for(var a=0;ab.lastLine()?b.replaceRange("\n"+g,m(b.lastLine()),null,"+swapLine"):b.replaceRange(g+"\n",m(e,0),null,"+swapLine")}b.setSelections(f),b.scrollIntoView()})},l[k[r+"Down"]="swapLineDown"]=function(b){if(b.isReadOnly())return a.Pass;for(var c=b.listSelections(),d=[],e=b.lastLine()+1,f=c.length-1;f>=0;f--){var g=c[f],h=g.to().line+1,i=g.from().line;0!=g.to().ch||g.empty()||h--,e>h?d.push(h,i):d.length&&(d[d.length-1]=i),e=i}b.operation(function(){for(var a=d.length-2;a>=0;a-=2){var c=d[a],e=d[a+1],f=b.getLine(c);c==b.lastLine()?b.replaceRange("",m(c-1),m(c),"+swapLine"):b.replaceRange("",m(c,0),m(c+1,0),"+swapLine"),b.replaceRange(f+"\n",m(e,0),null,"+swapLine")}b.scrollIntoView()})},l[k[o+"/"]="toggleCommentIndented"]=function(a){a.toggleComment({indent:!0})},l[k[o+"J"]="joinLines"]=function(a){for(var b=a.listSelections(),c=[],d=0;dc;c++){var d=a.listSelections()[c];d.empty()?a.replaceRange(a.getLine(d.head.line)+"\n",m(d.head.line,0)):a.replaceRange(a.getRange(d.from(),d.to()),d.from())}a.scrollIntoView()})},k[o+"T"]="transposeChars",l[k.F9="sortLines"]=function(a){g(a,!0)},l[k[o+"F9"]="sortLinesInsensitive"]=function(a){g(a,!1)},l[k.F2="nextBookmark"]=function(a){var b=a.state.sublimeBookmarks;if(b)for(;b.length;){var c=b.shift(),d=c.find();if(d)return b.push(c),a.setSelection(d.from,d.to)}},l[k["Shift-F2"]="prevBookmark"]=function(a){var b=a.state.sublimeBookmarks;if(b)for(;b.length;){b.unshift(b.pop());var c=b[b.length-1].find();if(c)return a.setSelection(c.from,c.to);b.pop()}},l[k[o+"F2"]="toggleBookmark"]=function(a){for(var b=a.listSelections(),c=a.state.sublimeBookmarks||(a.state.sublimeBookmarks=[]),d=0;d=0;e--){var f=c[e].head,g=b.getRange({line:f.line,ch:0},f),h=a.countColumn(g,null,b.getOption("tabSize")),i=b.findPosH(f,-1,"char",!1);if(g&&!/\S/.test(g)&&h%d==0){var j=new m(f.line,a.findColumn(g,h-d,d));j.ch!=f.ch&&(i=j)}b.replaceRange("",i,f,"+delete")}})},l[k[s+o+"K"]="delLineRight"]=function(a){a.operation(function(){for(var b=a.listSelections(),c=b.length-1;c>=0;c--)a.replaceRange("",b[c].anchor,m(b[c].to().line),"+delete");a.scrollIntoView()})},l[k[s+o+"U"]="upcaseAtCursor"]=function(a){h(a,function(a){return a.toUpperCase()})},l[k[s+o+"L"]="downcaseAtCursor"]=function(a){h(a,function(a){return a.toLowerCase()})},l[k[s+o+"Space"]="setSublimeMark"]=function(a){a.state.sublimeMark&&a.state.sublimeMark.clear(),a.state.sublimeMark=a.setBookmark(a.getCursor())},l[k[s+o+"A"]="selectToSublimeMark"]=function(a){var b=a.state.sublimeMark&&a.state.sublimeMark.find();b&&a.setSelection(a.getCursor(),b)},l[k[s+o+"W"]="deleteToSublimeMark"]=function(b){var c=b.state.sublimeMark&&b.state.sublimeMark.find();if(c){var d=b.getCursor(),e=c;if(a.cmpPos(d,e)>0){var f=e;e=d,d=f}b.state.sublimeKilled=b.getRange(d,e),b.replaceRange("",d,e)}},l[k[s+o+"X"]="swapWithSublimeMark"]=function(a){var b=a.state.sublimeMark&&a.state.sublimeMark.find();b&&(a.state.sublimeMark.clear(),a.state.sublimeMark=a.setBookmark(a.getCursor()),a.setCursor(b))},l[k[s+o+"Y"]="sublimeYank"]=function(a){null!=a.state.sublimeKilled&&a.replaceSelection(a.state.sublimeKilled,null,"paste")},k[s+o+"G"]="clearBookmarks",l[k[s+o+"C"]="showInCenter"]=function(a){var b=a.cursorCoords(null,"local");a.scrollTo(null,(b.top+b.bottom)/2-a.getScrollInfo().clientHeight/2)};var t=n?"Ctrl-Shift-":"Ctrl-Alt-";l[k[t+"Up"]="selectLinesUpward"]=function(a){a.operation(function(){for(var b=a.listSelections(),c=0;ca.firstLine()&&a.addSelection(m(d.head.line-1,d.head.ch))}})},l[k[t+"Down"]="selectLinesDownward"]=function(a){a.operation(function(){for(var b=a.listSelections(),c=0;c=0;h--){var k=g[h].head;c.replaceRange("",m(k.line,k.ch-1),m(k.line,k.ch+1),"+delete")}}function f(c){var e=d(c),f=e&&b(e,"explode");if(!f||c.getOption("disableInput"))return a.Pass;for(var g=c.listSelections(),h=0;h0;return{anchor:new m(b.anchor.line,b.anchor.ch+(c?-1:1)),head:new m(b.head.line,b.head.ch+(c?1:-1))}}function h(c,e){var f=d(c);if(!f||c.getOption("disableInput"))return a.Pass;var h=b(f,"pairs"),j=h.indexOf(e);if(-1==j)return a.Pass;for(var l,n=b(f,"triples"),o=h.charAt(j+1)==e,p=c.listSelections(),q=j%2==0,r=0;r1&&n.indexOf(e)>=0&&c.getRange(m(u.line,u.ch-2),u)==e+e&&(u.ch<=2||c.getRange(m(u.line,u.ch-3),m(u.line,u.ch-2))!=e))s="addFour";else if(o){if(a.isWordChar(v)||!k(c,u,e))return a.Pass;s="both"}else{if(!q||c.getLine(u.line).length!=u.ch&&!i(v,h)&&!/\s/.test(v))return a.Pass;s="both"}else s=n.indexOf(e)>=0&&c.getRange(u,m(u.line,u.ch+3))==e+e+e?"skipThree":"skip";if(l){if(l!=s)return a.Pass}else l=s}var w=j%2?h.charAt(j-1):e,x=j%2?e:h.charAt(j+1);c.operation(function(){if("skip"==l)c.execCommand("goCharRight");else if("skipThree"==l)for(var a=0;3>a;a++)c.execCommand("goCharRight");else if("surround"==l){for(var b=c.getSelections(),a=0;a-1&&c%2==1}function j(a,b){var c=a.getRange(m(b.line,b.ch-1),m(b.line,b.ch+1));return 2==c.length?c:null}function k(b,c,d){var e=b.getLine(c.line),f=b.getTokenAt(c);if(/\bstring2?\b/.test(f.type))return!1;var g=new a.StringStream(e.slice(0,c.ch)+d+e.slice(c.ch),4);for(g.pos=g.start=f.start;;){var h=b.getMode().token(g,f.state);if(g.pos>=c.ch+1)return/\bstring2?\b/.test(h);g.start=g.pos}}var l={pairs:"()[]{}''\"\"",triples:"",explode:"[]{}"},m=a.Pos;a.defineOption("autoCloseBrackets",!1,function(b,c,d){d&&d!=a.Init&&(b.removeKeyMap(o),b.state.closeBrackets=null),c&&(b.state.closeBrackets=c,b.addKeyMap(o))});for(var n=l.pairs+"`",o={Backspace:e,Enter:f},p=0;pj.ch&&(r=r.slice(0,r.length-k.end+j.ch));var s=r.toLowerCase();if(!r||"string"==k.type&&(k.end!=j.ch||!/[\"\']/.test(k.string.charAt(k.string.length-1))||1==k.string.length)||"tag"==k.type&&"closeTag"==m.type||k.string.indexOf("/")==k.string.length-1||p&&e(p,s)>-1||f(b,r,j,m,!0))return a.Pass;var t=q&&e(q,s)>-1;d[i]={indent:t,text:">"+(t?"\n\n":"")+"",newPos:t?a.Pos(j.line+1,0):a.Pos(j.line,j.ch+1)}}for(var i=c.length-1;i>=0;i--){var u=d[i];b.replaceRange(u.text,c[i].head,c[i].anchor,"+insert");var v=b.listSelections().slice(0);v[i]={head:u.newPos,anchor:u.newPos},b.setSelections(v),u.indent&&(b.indentLine(u.newPos.line,null,!0),b.indentLine(u.newPos.line+1,null,!0))}}function c(b,c){for(var d=b.listSelections(),e=[],g=c?"/":""!=b.getLine(i.line).charAt(j.end)&&(m+=">"),e[h]=m}b.replaceSelections(e),d=b.listSelections();for(var h=0;hc;++c)if(a[c]==b)return c;return-1}function f(b,c,d,e,f){if(!a.scanForClosingTag)return!1;var g=Math.min(b.lastLine()+1,d.line+500),h=a.scanForClosingTag(b,d,null,g);if(!h||h.tag!=c)return!1;for(var i=e.context,j=f?1:0;i&&i.tagName==c;i=i.prev)++j;d=h.to;for(var k=1;j>k;k++){var l=a.scanForClosingTag(b,d,null,g);if(!l||l.tag!=c)return!1;d=l.to}return!0}a.defineOption("autoCloseTags",!1,function(c,e,f){if(f!=a.Init&&f&&c.removeKeyMap("autoCloseTags"),e){var g={name:"autoCloseTags"};("object"!=typeof e||e.whenClosing)&&(g["'/'"]=function(a){return d(a)}),("object"!=typeof e||e.whenOpening)&&(g["'>'"]=function(a){return b(a)}),c.addKeyMap(g)}});var g=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],h=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];a.commands.closeTag=function(a){return c(a)}}),function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)}(function(a){function b(a,b,d,e){var f=a.getLineHandle(b.line),i=b.ch-1,j=i>=0&&h[f.text.charAt(i)]||h[f.text.charAt(++i)];if(!j)return null;var k=">"==j.charAt(1)?1:-1;if(d&&k>0!=(i==b.ch))return null;var l=a.getTokenTypeAt(g(b.line,i+1)),m=c(a,g(b.line,i+(k>0?1:0)),k,l||null,e);return null==m?null:{from:g(b.line,i),to:m&&m.pos,match:m&&m.ch==j.charAt(0),forward:k>0}}function c(a,b,c,d,e){for(var f=e&&e.maxScanLineLength||1e4,i=e&&e.maxScanLines||1e3,j=[],k=e&&e.bracketRegex?e.bracketRegex:/[(){}[\]]/,l=c>0?Math.min(b.line+i,a.lastLine()+1):Math.max(a.firstLine()-1,b.line-i),m=b.line;m!=l;m+=c){var n=a.getLine(m);if(n){var o=c>0?0:n.length-1,p=c>0?n.length:-1;if(!(n.length>f))for(m==b.line&&(o=b.ch-(0>c?1:0));o!=p;o+=c){var q=n.charAt(o);if(k.test(q)&&(void 0===d||a.getTokenTypeAt(g(m,o+1))==d)){var r=h[q];if(">"==r.charAt(1)==c>0)j.push(q);else{if(!j.length)return{pos:g(m,o),ch:q};j.pop()}}}}}return m-c==(c>0?a.lastLine():a.firstLine())?!1:null}function d(a,c,d){for(var e=a.state.matchBrackets.maxHighlightLineLength||1e3,h=[],i=a.listSelections(),j=0;j",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},i=null;a.defineOption("matchBrackets",!1,function(b,c,d){d&&d!=a.Init&&b.off("cursorActivity",e),c&&(b.state.matchBrackets="object"==typeof c?c:{},b.on("cursorActivity",e))}),a.defineExtension("matchBrackets",function(){d(this,!0)}),a.defineExtension("findMatchingBracket",function(a,c,d){return b(this,a,c,d)}),a.defineExtension("scanForBracket",function(a,b,d,e){return c(this,a,b,d,e)})}),function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("../fold/xml-fold")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../fold/xml-fold"],a):a(CodeMirror)}(function(a){"use strict";function b(a){a.state.tagHit&&a.state.tagHit.clear(),a.state.tagOther&&a.state.tagOther.clear(),a.state.tagHit=a.state.tagOther=null}function c(c){c.state.failedTagMatch=!1,c.operation(function(){if(b(c),!c.somethingSelected()){var d=c.getCursor(),e=c.getViewport();e.from=Math.min(e.from,d.line),e.to=Math.max(d.line+1,e.to);var f=a.findMatchingTag(c,d,e);if(f){if(c.state.matchBothTags){var g="open"==f.at?f.open:f.close;g&&(c.state.tagHit=c.markText(g.from,g.to,{className:"CodeMirror-matchingtag"}))}var h="close"==f.at?f.open:f.close;h?c.state.tagOther=c.markText(h.from,h.to,{className:"CodeMirror-matchingtag"}):c.state.failedTagMatch=!0}}})}function d(a){a.state.failedTagMatch&&c(a)}a.defineOption("matchTags",!1,function(e,f,g){g&&g!=a.Init&&(e.off("cursorActivity",c),e.off("viewportChange",d),b(e)),f&&(e.state.matchBothTags="object"==typeof f&&f.bothTags,e.on("cursorActivity",c),e.on("viewportChange",d),c(e))}),a.commands.toMatchingTag=function(b){var c=a.findMatchingTag(b,b.getCursor());if(c){var d="close"==c.at?c.open:c.close;d&&b.extendSelection(d.to,d.from)}}}),function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)}(function(a){"use strict";a.registerHelper("fold","brace",function(b,c){function d(d){for(var h=c.ch,i=0;;){var j=0>=h?-1:g.lastIndexOf(d,h-1);if(-1!=j){if(1==i&&j=o;++o)for(var p=b.getLine(o),q=o==f?j:0;;){var r=p.indexOf(h,q),s=p.indexOf(i,q);if(0>r&&(r=p.length),0>s&&(s=p.length),q=Math.min(r,s),q==p.length)break;if(b.getTokenTypeAt(a.Pos(o,q+1))==e)if(q==r)++m;else if(!--m){k=o,l=q;break a}++q}if(null!=k&&(f!=k||l!=j))return{from:a.Pos(f,j),to:a.Pos(k,l)}}}),a.registerHelper("fold","import",function(b,c){function d(c){if(cb.lastLine())return null;var d=b.getTokenAt(a.Pos(c,1));if(/\S/.test(d.string)||(d=b.getTokenAt(a.Pos(c,d.end+1))),"keyword"!=d.type||"import"!=d.string)return null;for(var e=c,f=Math.min(b.lastLine(),c+10);f>=e;++e){var g=b.getLine(e),h=g.indexOf(";");if(-1!=h)return{startCh:d.end,end:a.Pos(e,h)}}}var e,f=c.line,g=d(f);if(!g||d(f-1)||(e=d(f-2))&&e.end.line==f-1)return null;for(var h=g.end;;){var i=d(h.line+1);if(null==i)break;h=i.end}return{from:b.clipPos(a.Pos(f,g.startCh+1)),to:h}}),a.registerHelper("fold","include",function(b,c){function d(c){if(cb.lastLine())return null;var d=b.getTokenAt(a.Pos(c,1));return/\S/.test(d.string)||(d=b.getTokenAt(a.Pos(c,d.end+1))),"meta"==d.type&&"#include"==d.string.slice(0,8)?d.start+8:void 0}var e=c.line,f=d(e);if(null==f||null!=d(e-1))return null;for(var g=e;;){var h=d(g+1);if(null==h)break;++g}return{from:a.Pos(e,f+1),to:b.clipPos(a.Pos(g))}})}),function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)}(function(a){"use strict";function b(b,e,f,g){function h(a){var c=i(b,e);if(!c||c.to.line-c.from.lineb.firstLine();)e=a.Pos(e.line-1,0),k=h(!1);if(k&&!k.cleared&&"unfold"!==g){var l=c(b,f);a.on(l,"mousedown",function(b){m.clear(),a.e_preventDefault(b)});var m=b.markText(k.from,k.to,{replacedWith:l,clearOnEnter:!0,__isFold:!0});m.on("clear",function(c,d){a.signal(b,"unfold",b,c,d)}),a.signal(b,"fold",b,k.from,k.to)}}function c(a,b){var c=d(a,b,"widget");if("string"==typeof c){var e=document.createTextNode(c);c=document.createElement("span"),c.appendChild(e),c.className="CodeMirror-foldmarker"}return c}function d(a,b,c){if(b&&void 0!==b[c])return b[c];var d=a.options.foldOptions;return d&&void 0!==d[c]?d[c]:e[c]}a.newFoldFunction=function(a,c){return function(d,e){b(d,e,{rangeFinder:a,widget:c})}},a.defineExtension("foldCode",function(a,c,d){b(this,a,c,d)}),a.defineExtension("isFolded",function(a){for(var b=this.findMarksAt(a),c=0;c=c;c++)b.foldCode(a.Pos(c,0),null,"fold")})},a.commands.unfoldAll=function(b){b.operation(function(){for(var c=b.firstLine(),d=b.lastLine();d>=c;c++)b.foldCode(a.Pos(c,0),null,"unfold")})},a.registerHelper("fold","combine",function(){var a=Array.prototype.slice.call(arguments,0);return function(b,c){for(var d=0;d=h&&(c=e(f.indicatorOpen))}a.setGutterMarker(b,f.gutter,c),++g})}function g(a){var b=a.getViewport(),c=a.state.foldGutter;c&&(a.operation(function(){f(a,b.from,b.to)}),c.from=b.from,c.to=b.to)}function h(a,b,c){var e=a.state.foldGutter;if(e){var f=e.options;if(c==f.gutter){var g=d(a,b);g?g.clear():a.foldCode(l(b,0),f.rangeFinder)}}}function i(a){var b=a.state.foldGutter;if(b){var c=b.options;b.from=b.to=0,clearTimeout(b.changeUpdate),b.changeUpdate=setTimeout(function(){g(a)},c.foldOnChangeTimeSpan||600)}}function j(a){var b=a.state.foldGutter;if(b){var c=b.options;clearTimeout(b.changeUpdate),b.changeUpdate=setTimeout(function(){var c=a.getViewport();b.from==b.to||c.from-b.to>20||b.from-c.to>20?g(a):a.operation(function(){c.fromb.to&&(f(a,b.to,c.to),b.to=c.to)})},c.updateViewportTimeSpan||400)}}function k(a,b){var c=a.state.foldGutter;if(c){var d=b.line;d>=c.from&&d=a.max?void 0:(a.ch=0,a.text=a.cm.getLine(++a.line),!0)}function f(a){return a.line<=a.min?void 0:(a.text=a.cm.getLine(--a.line),a.ch=a.text.length,!0)}function g(a){for(;;){var b=a.text.indexOf(">",a.ch);if(-1==b){if(e(a))continue;return}{if(d(a,b+1)){var c=a.text.lastIndexOf("/",b),f=c>-1&&!/\S/.test(a.text.slice(c+1,b));return a.ch=b+1,f?"selfClose":"regular"}a.ch=b+1}}}function h(a){for(;;){var b=a.ch?a.text.lastIndexOf("<",a.ch-1):-1;if(-1==b){if(f(a))continue;return}if(d(a,b+1)){p.lastIndex=b,a.ch=b;var c=p.exec(a.text);if(c&&c.index==b)return c}else a.ch=b}}function i(a){for(;;){p.lastIndex=a.ch;var b=p.exec(a.text);if(!b){if(e(a))continue;return}{if(d(a,b.index+1))return a.ch=b.index+b[0].length,b;a.ch=b.index+1}}}function j(a){for(;;){var b=a.ch?a.text.lastIndexOf(">",a.ch-1):-1;if(-1==b){if(f(a))continue;return}{if(d(a,b+1)){var c=a.text.lastIndexOf("/",b),e=c>-1&&!/\S/.test(a.text.slice(c+1,b));return a.ch=b+1,e?"selfClose":"regular"}a.ch=b}}}function k(a,b){for(var c=[];;){var d,e=i(a),f=a.line,h=a.ch-(e?e[0].length:0);if(!e||!(d=g(a)))return;if("selfClose"!=d)if(e[1]){for(var j=c.length-1;j>=0;--j)if(c[j]==e[2]){c.length=j;break}if(0>j&&(!b||b==e[2]))return{tag:e[2],from:m(f,h),to:m(a.line,a.ch)}}else c.push(e[2])}}function l(a,b){for(var c=[];;){var d=j(a);if(!d)return;if("selfClose"!=d){var e=a.line,f=a.ch,g=h(a);if(!g)return;if(g[1])c.push(g[2]);else{for(var i=c.length-1;i>=0;--i)if(c[i]==g[2]){c.length=i;break}if(0>i&&(!b||b==g[2]))return{tag:g[2],from:m(a.line,a.ch),to:m(e,f)}}}else h(a)}}var m=a.Pos,n="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",o=n+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",p=new RegExp("<(/?)(["+n+"]["+o+"]*)","g");a.registerHelper("fold","xml",function(a,b){for(var d=new c(a,b.line,0);;){var e,f=i(d);if(!f||d.line!=b.line||!(e=g(d)))return;if(!f[1]&&"selfClose"!=e){var h=m(d.line,d.ch),j=k(d,f[2]);return j&&{from:h,to:j.from}}}}),a.findMatchingTag=function(a,d,e){var f=new c(a,d.line,d.ch,e);if(-1!=f.text.indexOf(">")||-1!=f.text.indexOf("<")){var i=g(f),j=i&&m(f.line,f.ch),n=i&&h(f);if(i&&n&&!(b(f,d)>0)){var o={from:m(f.line,f.ch),to:j,tag:n[2]};return"selfClose"==i?{open:o,close:null,at:"open"}:n[1]?{open:l(f,n[2]),close:o,at:"close"}:(f=new c(a,j.line,j.ch,e),{open:o,close:k(f,n[2]),at:"open"})}}},a.findEnclosingTag=function(a,b,d){for(var e=new c(a,b.line,b.ch,d);;){var f=l(e);if(!f)break;var g=new c(a,b.line,b.ch,d),h=k(g,f.tag);if(h)return{open:f,close:h}}},a.scanForClosingTag=function(a,b,d,e){var f=new c(a,b.line,b.ch,e?{from:0,to:e}:null);return k(f,d)}}),function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),"cjs"):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],function(b){a(b,"amd")}):a(CodeMirror,"plain")}(function(a,b){function c(a,b){var c=b;return function(){0==--c&&a()}}function d(b,d){var e=a.modes[b].dependencies;if(!e)return d();for(var f=[],g=0;g-1?e+b.length:e}var f=b.exec(c?a.slice(c):a);return f?f.index+c+(d?f[0].length:0):-1}var d=Array.prototype.slice.call(arguments,1);return{startState:function(){return{outer:a.startState(b),innerActive:null,inner:null}},copyState:function(c){return{outer:a.copyState(b,c.outer),innerActive:c.innerActive,inner:c.innerActive&&a.copyState(c.innerActive.mode,c.inner)}},token:function(e,f){if(f.innerActive){var g=f.innerActive,h=e.string;if(!g.close&&e.sol())return f.innerActive=f.inner=null,this.token(e,f);var i=g.close?c(h,g.close,e.pos,g.parseDelimiters):-1;if(i==e.pos&&!g.parseDelimiters)return e.match(g.close),f.innerActive=f.inner=null,g.delimStyle&&g.delimStyle+" "+g.delimStyle+"-close";i>-1&&(e.string=h.slice(0,i));var j=g.mode.token(e,f.inner);return i>-1&&(e.string=h),i==e.pos&&g.parseDelimiters&&(f.innerActive=f.inner=null),g.innerStyle&&(j=j?j+" "+g.innerStyle:g.innerStyle),j}for(var k=1/0,h=e.string,l=0;li&&(k=i)}k!=1/0&&(e.string=h.slice(0,k));var n=b.token(e,f.outer);return k!=1/0&&(e.string=h),n},indent:function(c,d){var e=c.innerActive?c.innerActive.mode:b;return e.indent?e.indent(c.innerActive?c.inner:c.outer,d):a.Pass},blankLine:function(c){var e=c.innerActive?c.innerActive.mode:b;if(e.blankLine&&e.blankLine(c.innerActive?c.inner:c.outer),c.innerActive)"\n"===c.innerActive.close&&(c.innerActive=c.inner=null);else for(var f=0;fh)return c.charCoords(a,"local")[b?"top":"bottom"];var d=c.heightAtLine(j,"local");return d+(b?0:j.height)}a!==!1&&this.computeScale();var c=this.cm,d=this.hScale,e=document.createDocumentFragment(),f=this.annotations,g=c.getOption("lineWrapping"),h=g&&1.5*c.defaultTextHeight(),i=null,j=null;if(c.display.barWidth)for(var k,l=0;lo+.9));)m=f[++l],o=b(m.to,!1)*d;if(o!=n){var p=Math.max(o-n,3),q=e.appendChild(document.createElement("div"));q.style.cssText="position: absolute; right: 0px; width: "+Math.max(c.display.barWidth-1,2)+"px; top: "+(n+this.buttonHeight)+"px; height: "+p+"px",q.className=this.options.className,m.id&&q.setAttribute("annotation-id",m.id)}}this.div.textContent="",this.div.appendChild(e)},b.prototype.clear=function(){this.cm.off("refresh",this.resizeHandler),this.cm.off("markerAdded",this.resizeHandler),this.cm.off("markerCleared",this.resizeHandler),this.changeHandler&&this.cm.off("change",this.changeHandler),this.div.parentNode.removeChild(this.div)}}),function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)}(function(a){"use strict";function b(b,c,d){function e(b){var c=a.wheelEventPixels(b)["horizontal"==f.orientation?"x":"y"],d=f.pos;f.moveTo(f.pos+c),f.pos!=d&&a.e_preventDefault(b)}this.orientation=c,this.scroll=d,this.screen=this.total=this.size=1,this.pos=0,this.node=document.createElement("div"),this.node.className=b+"-"+c,this.inner=this.node.appendChild(document.createElement("div"));var f=this;a.on(this.inner,"mousedown",function(b){function c(){a.off(document,"mousemove",d),a.off(document,"mouseup",c)}function d(a){return 1!=a.which?c():void f.moveTo(h+(a[e]-g)*(f.total/f.size))}if(1==b.which){a.e_preventDefault(b);var e="horizontal"==f.orientation?"pageX":"pageY",g=b[e],h=f.pos;a.on(document,"mousemove",d),a.on(document,"mouseup",c)}}),a.on(this.node,"click",function(b){a.e_preventDefault(b);var c,d=f.inner.getBoundingClientRect();c="horizontal"==f.orientation?b.clientXd.right?1:0:b.clientYd.bottom?1:0,f.moveTo(f.pos+c*f.screen)}),a.on(this.node,"mousewheel",e),a.on(this.node,"DOMMouseScroll",e)}function c(a,c,d){this.addClass=a,this.horiz=new b(a,"horizontal",d),c(this.horiz.node),this.vert=new b(a,"vertical",d),c(this.vert.node),this.width=null}b.prototype.setPos=function(a,b){return 0>a&&(a=0),a>this.total-this.screen&&(a=this.total-this.screen),b||a!=this.pos?(this.pos=a,this.inner.style["horizontal"==this.orientation?"left":"top"]=a*(this.size/this.total)+"px",!0):!1},b.prototype.moveTo=function(a){this.setPos(a)&&this.scroll(a,this.orientation)};var d=10;b.prototype.update=function(a,b,c){var e=this.screen!=b||this.total!=a||this.size!=c;e&&(this.screen=b,this.total=a,this.size=c);var f=this.screen*(this.size/this.total);d>f&&(this.size-=d-f,f=d),this.inner.style["horizontal"==this.orientation?"width":"height"]=f+"px",this.setPos(this.pos,e)},c.prototype.update=function(a){if(null==this.width){var b=window.getComputedStyle?window.getComputedStyle(this.horiz.node):this.horiz.node.currentStyle;b&&(this.width=parseInt(b.height))}var c=this.width||0,d=a.scrollWidth>a.clientWidth+1,e=a.scrollHeight>a.clientHeight+1;return this.vert.node.style.display=e?"block":"none",this.horiz.node.style.display=d?"block":"none",e&&(this.vert.update(a.scrollHeight,a.clientHeight,a.viewHeight-(d?c:0)),this.vert.node.style.bottom=d?c+"px":"0"),d&&(this.horiz.update(a.scrollWidth,a.clientWidth,a.viewWidth-(e?c:0)-a.barLeft),this.horiz.node.style.right=e?c+"px":"0", -this.horiz.node.style.left=a.barLeft+"px"),{right:e?c:0,bottom:d?c:0}},c.prototype.setScrollTop=function(a){this.vert.setPos(a)},c.prototype.setScrollLeft=function(a){this.horiz.setPos(a)},c.prototype.clear=function(){var a=this.horiz.node.parentNode;a.removeChild(this.horiz.node),a.removeChild(this.vert.node)},a.scrollbarModel.simple=function(a,b){return new c("CodeMirror-simplescroll",a,b)},a.scrollbarModel.overlay=function(a,b){return new c("CodeMirror-overlayscroll",a,b)}}),function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("./searchcursor"),require("../scroll/annotatescrollbar")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./searchcursor","../scroll/annotatescrollbar"],a):a(CodeMirror)}(function(a){"use strict";function b(a,b,c,d){this.cm=a,this.options=d;var e={listenForChanges:!1};for(var f in d)e[f]=d[f];e.className||(e.className="CodeMirror-search-match"),this.annotation=a.annotateScrollbar(e),this.query=b,this.caseFold=c,this.gap={from:a.firstLine(),to:a.lastLine()+1},this.matches=[],this.update=null,this.findMatches(),this.annotation.update(this.matches);var g=this;a.on("change",this.changeHandler=function(a,b){g.onChange(b)})}function c(a,b,c){return b>=a?a:Math.max(b,a+c)}a.defineExtension("showMatchesOnScrollbar",function(a,c,d){return"string"==typeof d&&(d={className:d}),d||(d={}),new b(this,a,c,d)});var d=1e3;b.prototype.findMatches=function(){if(this.gap){for(var b=0;b=this.gap.to)break;c.to.line>=this.gap.from&&this.matches.splice(b--,1)}for(var e=this.cm.getSearchCursor(this.query,a.Pos(this.gap.from,0),this.caseFold),f=this.options&&this.options.maxMatches||d;e.findNext();){var c={from:e.from(),to:e.to()};if(c.from.line>=this.gap.to)break;if(this.matches.splice(b++,0,c),this.matches.length>f)break}this.gap=null}},b.prototype.onChange=function(b){var d=b.from.line,e=a.changeEnd(b).line,f=e-b.to.line;if(this.gap?(this.gap.from=Math.min(c(this.gap.from,d,f),b.from.line),this.gap.to=Math.max(c(this.gap.to,d,f),b.from.line)):this.gap={from:b.from.line,to:e+1},f)for(var g=0;gi&&d(a,h.slice(i,j),c,b.options.style))}var k=a.getCursor("from"),l=a.getCursor("to");if(k.line==l.line&&(!b.options.wordsOnly||g(a,k,l))){var m=a.getRange(k,l);b.options.trim&&(m=m.replace(/^\s+|\s+$/g,"")),m.length>=b.options.minChars&&d(a,m,!1,b.options.style)}})}function g(a,b,c){var d=a.getRange(b,c);if(null!==d.match(/^\w+$/)){if(b.ch>0){var e={line:b.line,ch:b.ch-1},f=a.getRange(e,b);if(null===f.match(/\W/))return!1}if(c.ch-1)return k=c(i,j,k),{from:d(f.line,k),to:d(f.line,k+g.length)}}else{var i=a.getLine(f.line).slice(f.ch),j=h(i),k=j.indexOf(b);if(k>-1)return k=c(i,j,k)+f.ch,{from:d(f.line,k),to:d(f.line,k+g.length)}}}:this.matches=function(){};else{var j=g.split("\n");this.matches=function(b,c){var e=i.length-1;if(b){if(c.line-(i.length-1)=1;--k,--g)if(i[k]!=h(a.getLine(g)))return;var l=a.getLine(g),m=l.length-j[0].length;if(h(l.slice(m))!=i[0])return;return{from:d(g,m),to:f}}if(!(c.line+(i.length-1)>a.lastLine())){var l=a.getLine(c.line),m=l.length-j[0].length;if(h(l.slice(m))==i[0]){for(var n=d(c.line,m),g=c.line+1,k=1;e>k;++k,++g)if(i[k]!=h(a.getLine(g)))return;if(h(a.getLine(g).slice(0,j[e].length))==i[e])return{from:n,to:d(g,j[e].length)}}}}}}}function c(a,b,c){if(a.length==b.length)return c;for(var d=Math.min(c,a.length);;){var e=a.slice(0,d).toLowerCase().length;if(c>e)++d;else{if(!(e>c))return d;--d}}}var d=a.Pos;b.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(a){function b(a){var b=d(a,0);return c.pos={from:b,to:b},c.atOccurrence=!1,!1}for(var c=this,e=this.doc.clipPos(a?this.pos.from:this.pos.to);;){if(this.pos=this.matches(a,e))return this.atOccurrence=!0,this.pos.match||!0;if(a){if(!e.line)return b(0);e=d(e.line-1,this.doc.getLine(e.line-1).length)}else{var f=this.doc.lineCount();if(e.line==f-1)return b(f);e=d(e.line+1,0)}}},from:function(){return this.atOccurrence?this.pos.from:void 0},to:function(){return this.atOccurrence?this.pos.to:void 0},replace:function(b,c){if(this.atOccurrence){var e=a.splitLines(b);this.doc.replaceRange(e,this.pos.from,this.pos.to,c),this.pos.to=d(this.pos.from.line+e.length-1,e[e.length-1].length+(1==e.length?this.pos.from.ch:0))}}},a.defineExtension("getSearchCursor",function(a,c,d){return new b(this.doc,a,c,d)}),a.defineDocExtension("getSearchCursor",function(a,c,d){return new b(this,a,c,d)}),a.defineExtension("selectMatches",function(b,c){for(var d=[],e=this.getSearchCursor(b,this.getCursor("from"),c);e.findNext()&&!(a.cmpPos(e.to(),this.getCursor("to"))>0);)d.push({anchor:e.from(),head:e.to()});d.length&&this.setSelections(d,0)})}),function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)}(function(a){"use strict";function b(a){for(var b=0;b",type:"keyToKey",toKeys:"h"},{keys:"",type:"keyToKey",toKeys:"l"},{keys:"",type:"keyToKey",toKeys:"k"},{keys:"",type:"keyToKey",toKeys:"j"},{keys:"",type:"keyToKey",toKeys:"l"},{keys:"",type:"keyToKey",toKeys:"h",context:"normal"},{keys:"",type:"keyToKey",toKeys:"W"},{keys:"",type:"keyToKey",toKeys:"B",context:"normal"},{keys:"",type:"keyToKey",toKeys:"w"},{keys:"",type:"keyToKey",toKeys:"b",context:"normal"},{keys:"",type:"keyToKey",toKeys:"j"},{keys:"",type:"keyToKey",toKeys:"k"},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"",context:"insert"},{keys:"",type:"keyToKey",toKeys:"",context:"insert"},{keys:"s",type:"keyToKey",toKeys:"cl",context:"normal"},{keys:"s",type:"keyToKey",toKeys:"c",context:"visual"},{keys:"S",type:"keyToKey",toKeys:"cc",context:"normal"},{keys:"S",type:"keyToKey",toKeys:"VdO",context:"visual"},{keys:"",type:"keyToKey",toKeys:"0"},{keys:"",type:"keyToKey",toKeys:"$"},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"j^",context:"normal"},{keys:"H",type:"motion",motion:"moveToTopLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"M",type:"motion",motion:"moveToMiddleLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"L",type:"motion",motion:"moveToBottomLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"h",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!1}},{keys:"l",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!0}},{keys:"j",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,linewise:!0}},{keys:"k",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,linewise:!0}},{keys:"gj",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!0}},{keys:"gk",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!1}},{keys:"w",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1}},{keys:"W",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1,bigWord:!0}},{keys:"e",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,inclusive:!0}},{keys:"E",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"b",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1}},{keys:"B",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1,bigWord:!0}},{keys:"ge",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,inclusive:!0}},{keys:"gE",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"{",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!1,toJumplist:!0}},{keys:"}",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!0,toJumplist:!0}},{keys:"",type:"motion",motion:"moveByPage",motionArgs:{forward:!0}},{keys:"",type:"motion",motion:"moveByPage",motionArgs:{forward:!1}},{keys:"",type:"motion",motion:"moveByScroll",motionArgs:{forward:!0,explicitRepeat:!0}},{keys:"",type:"motion",motion:"moveByScroll",motionArgs:{forward:!1,explicitRepeat:!0}},{keys:"gg",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"G",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!0,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"0",type:"motion",motion:"moveToStartOfLine"},{keys:"^",type:"motion",motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"+",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0}},{keys:"-",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,toFirstChar:!0}},{keys:"_",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0,repeatOffset:-1}},{keys:"$",type:"motion",motion:"moveToEol",motionArgs:{inclusive:!0}},{keys:"%",type:"motion",motion:"moveToMatchedSymbol",motionArgs:{inclusive:!0,toJumplist:!0}},{keys:"f",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"F",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!1}},{keys:"t",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"T",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!1}},{keys:";",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!0}},{keys:",",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!1}},{keys:"'",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0}},{keys:"]`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0}},{keys:"[`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1}},{keys:"]'",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0,linewise:!0}},{keys:"['",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1,linewise:!0}},{keys:"]p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0,matchIndent:!0}},{keys:"[p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0,matchIndent:!0}},{keys:"]",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!0,toJumplist:!0}},{keys:"[",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!1,toJumplist:!0}},{keys:"|",type:"motion",motion:"moveToColumn"},{keys:"o",type:"motion",motion:"moveToOtherHighlightedEnd",context:"visual"},{keys:"O",type:"motion",motion:"moveToOtherHighlightedEnd",motionArgs:{sameLine:!0},context:"visual"},{keys:"d",type:"operator",operator:"delete"},{keys:"y",type:"operator",operator:"yank"},{keys:"c",type:"operator",operator:"change"},{keys:">",type:"operator",operator:"indent",operatorArgs:{indentRight:!0}},{keys:"<",type:"operator",operator:"indent",operatorArgs:{indentRight:!1}},{keys:"g~",type:"operator",operator:"changeCase"},{keys:"gu",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},isEdit:!0},{keys:"gU",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},isEdit:!0},{keys:"n",type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:!0}},{keys:"N",type:"motion",motion:"findNext",motionArgs:{forward:!1,toJumplist:!0}},{keys:"x",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!0},operatorMotionArgs:{visualLine:!1}},{keys:"X",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!1},operatorMotionArgs:{visualLine:!0}},{keys:"D",type:"operatorMotion",operator:"delete",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"D",type:"operator",operator:"delete",operatorArgs:{linewise:!0},context:"visual"},{keys:"Y",type:"operatorMotion",operator:"yank",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"Y",type:"operator",operator:"yank",operatorArgs:{linewise:!0},context:"visual"},{keys:"C",type:"operatorMotion",operator:"change",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"C",type:"operator",operator:"change",operatorArgs:{linewise:!0},context:"visual"},{keys:"~",type:"operatorMotion",operator:"changeCase",motion:"moveByCharacters",motionArgs:{forward:!0},operatorArgs:{shouldMoveCursor:!0},context:"normal"},{keys:"~",type:"operator",operator:"changeCase",context:"visual"},{keys:"",type:"operatorMotion",operator:"delete",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1},context:"insert"},{keys:"",type:"action",action:"jumpListWalk",actionArgs:{forward:!0}},{keys:"",type:"action",action:"jumpListWalk",actionArgs:{forward:!1}},{keys:"",type:"action",action:"scroll",actionArgs:{forward:!0,linewise:!0}},{keys:"",type:"action",action:"scroll",actionArgs:{forward:!1,linewise:!0}},{keys:"a",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"charAfter"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"eol"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"endOfSelectedArea"},context:"visual"},{keys:"i",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"inplace"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"firstNonBlank"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"startOfSelectedArea"},context:"visual"},{keys:"o",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!0},context:"normal"},{keys:"O",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!1},context:"normal"},{keys:"v",type:"action",action:"toggleVisualMode"},{keys:"V",type:"action",action:"toggleVisualMode",actionArgs:{linewise:!0}},{keys:"",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"gv",type:"action",action:"reselectLastSelection"},{keys:"J",type:"action",action:"joinLines",isEdit:!0},{keys:"p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0}},{keys:"P",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0}},{keys:"r",type:"action",action:"replace",isEdit:!0},{keys:"@",type:"action",action:"replayMacro"},{keys:"q",type:"action",action:"enterMacroRecordMode"},{keys:"R",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{replace:!0}},{keys:"u",type:"action",action:"undo",context:"normal"},{keys:"u",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},context:"visual",isEdit:!0},{keys:"U",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},context:"visual",isEdit:!0},{keys:"",type:"action",action:"redo"},{keys:"m",type:"action",action:"setMark"},{keys:'"',type:"action",action:"setRegister"},{keys:"zz",type:"action",action:"scrollToCursor",actionArgs:{position:"center"}},{keys:"z.",type:"action",action:"scrollToCursor",actionArgs:{position:"center"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zt",type:"action",action:"scrollToCursor",actionArgs:{position:"top"}},{keys:"z",type:"action",action:"scrollToCursor",actionArgs:{position:"top"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"z-",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"}},{keys:"zb",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:".",type:"action",action:"repeatLastEdit"},{keys:"",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!0,backtrack:!1}},{keys:"",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:"a",type:"motion",motion:"textObjectManipulation"},{keys:"i",type:"motion",motion:"textObjectManipulation",motionArgs:{textObjectInner:!0}},{keys:"/",type:"search",searchArgs:{forward:!0,querySrc:"prompt",toJumplist:!0}},{keys:"?",type:"search",searchArgs:{forward:!1,querySrc:"prompt",toJumplist:!0}},{keys:"*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"g*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:"g#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:":",type:"ex"}],c=[{name:"colorscheme",shortName:"colo"},{name:"map"},{name:"imap",shortName:"im"},{name:"nmap",shortName:"nm"},{name:"vmap",shortName:"vm"},{name:"unmap"},{name:"write",shortName:"w"},{name:"undo",shortName:"u"},{name:"redo",shortName:"red"},{name:"set",shortName:"se"},{name:"set",shortName:"se"},{name:"setlocal",shortName:"setl"},{name:"setglobal",shortName:"setg"},{name:"sort",shortName:"sor"},{name:"substitute",shortName:"s",possiblyAsync:!0},{name:"nohlsearch",shortName:"noh"},{name:"yank",shortName:"y"},{name:"delmarks",shortName:"delm"},{name:"registers",shortName:"reg",excludeFromCommandHistory:!0},{name:"global",shortName:"g"}],d=a.Pos,e=function(){function e(b){b.setOption("disableInput",!0),b.setOption("showCursorWhenSelecting",!1),a.signal(b,"vim-mode-change",{mode:"normal"}),b.on("cursorActivity",ab),x(b),a.on(b.getInputField(),"paste",k(b))}function f(b){b.setOption("disableInput",!1),b.off("cursorActivity",ab),a.off(b.getInputField(),"paste",k(b)),b.state.vim=null}function g(b,c){this==a.keyMap.vim&&a.rmClass(b.getWrapperElement(),"cm-fat-cursor"),c&&c.attach==h||f(b,!1)}function h(b,c){this==a.keyMap.vim&&a.addClass(b.getWrapperElement(),"cm-fat-cursor"),c&&c.attach==h||e(b)}function i(b,c){if(!c)return void 0;var d=j(b);if(!d)return!1;var e=a.Vim.findKey(c,d);return"function"==typeof e&&a.signal(c,"vim-keypress",d),e}function j(a){if("'"==a.charAt(0))return a.charAt(1);var b=a.split(/-(?!$)/),c=b[b.length-1];if(1==b.length&&1==b[0].length)return!1;if(2==b.length&&"Shift"==b[0]&&1==c.length)return!1;for(var d=!1,e=0;e"):!1}function k(a){var b=a.state.vim;return b.onPasteFn||(b.onPasteFn=function(){b.insertMode||(a.setCursor(L(a.getCursor(),0,1)),Ab.enterInsertMode(a,{},b))}),b.onPasteFn}function l(a,b){for(var c=[],d=a;a+b>d;d++)c.push(String.fromCharCode(d));return c}function m(a,b){return b>=a.firstLine()&&b<=a.lastLine()}function n(a){return/^[a-z]$/.test(a)}function o(a){return-1!="()[]{}".indexOf(a)}function p(a){return jb.test(a)}function q(a){return/^[A-Z]$/.test(a)}function r(a){return/^\s*$/.test(a)}function s(a,b){for(var c=0;cd;d++)c.push(a);return c}function H(a,b){zb[a]=b}function I(a,b){Ab[a]=b}function J(a,b,c){var e=Math.min(Math.max(a.firstLine(),b.line),a.lastLine()),f=X(a,e)-1;f=c?f+1:f;var g=Math.min(Math.max(0,b.ch),f);return d(e,g)}function K(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function L(a,b,c){return"object"==typeof b&&(c=b.ch,b=b.line),d(a.line+b,a.ch+c)}function M(a,b){return{line:b.line-a.line,ch:b.line-a.line}}function N(a,b,c,d){for(var e,f=[],g=[],h=0;h"==b.slice(-11)){var c=b.length-11,d=a.slice(0,c),e=b.slice(0,c);return d==e&&a.length>c?"full":0==e.indexOf(d)?"partial":!1}return a==b?"full":0==b.indexOf(a)?"partial":!1}function P(a){var b=/^.*(<[\w\-]+>)$/.exec(a),c=b?b[1]:a.slice(-1);if(c.length>1)switch(c){case"":c="\n";break;case"":c=" "}return c}function Q(a,b,c){return function(){for(var d=0;c>d;d++)b(a)}}function R(a){return d(a.line,a.ch)}function S(a,b){return a.ch==b.ch&&a.line==b.line}function T(a,b){return a.line2&&(b=U.apply(void 0,Array.prototype.slice.call(arguments,1))),T(a,b)?a:b}function V(a,b){return arguments.length>2&&(b=V.apply(void 0,Array.prototype.slice.call(arguments,1))),T(a,b)?b:a}function W(a,b,c){var d=T(a,b),e=T(b,c);return d&&e}function X(a,b){return a.getLine(b).length}function Y(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function Z(a){return a.replace(/([.?*+$\[\]\/\\(){}|\-])/g,"\\$1")}function $(a,b,c){var e=X(a,b),f=new Array(c-e+1).join(" ");a.setCursor(d(b,e)),a.replaceRange(f,a.getCursor())}function _(a,b){var c=[],e=a.listSelections(),f=R(a.clipPos(b)),g=!S(b,f),h=a.getCursor("head"),i=ba(e,h),j=S(e[i].head,e[i].anchor),k=e.length-1,l=k-i>i?k:0,m=e[l].anchor,n=Math.min(m.line,f.line),o=Math.max(m.line,f.line),p=m.ch,q=f.ch,r=e[l].head.ch-p,s=q-p;r>0&&0>=s?(p++,g||q--):0>r&&s>=0?(p--,j||q++):0>r&&-1==s&&(p--,q++);for(var t=n;o>=t;t++){var u={anchor:new d(t,p),head:new d(t,q)};c.push(u)}return i=f.line==o?c.length-1:0,a.setSelections(c),b.ch=q,m.ch=p,m}function aa(a,b,c){for(var d=[],e=0;c>e;e++){var f=L(b,e,0);d.push({anchor:f,head:f})}a.setSelections(d,0)}function ba(a,b,c){for(var d=0;dj&&(f.line=j),f.ch=X(a,f.line)}return{ranges:[{anchor:g,head:f}],primary:0}}if("block"==c){for(var k=Math.min(g.line,f.line),l=Math.min(g.ch,f.ch),m=Math.max(g.line,f.line),n=Math.max(g.ch,f.ch)+1,o=m-k+1,p=f.line==k?0:o-1,q=[],r=0;o>r;r++)q.push({anchor:d(k+r,l),head:d(k+r,n)});return{ranges:q,primary:p}}}function ha(a){var b=a.getCursor("head");return 1==a.getSelection().length&&(b=U(b,a.getCursor("anchor"))),b}function ia(b,c){var d=b.state.vim;c!==!1&&b.setCursor(J(b,d.sel.head)),da(b,d),d.visualMode=!1,d.visualLine=!1,d.visualBlock=!1,a.signal(b,"vim-mode-change",{mode:"normal"}),d.fakeCursor&&d.fakeCursor.clear()}function ja(a,b,c){var d=a.getRange(b,c);if(/\n\s*$/.test(d)){var e=d.split("\n");e.pop();for(var f,f=e.pop();e.length>0&&f&&r(f);f=e.pop())c.line--,c.ch=0;f?(c.line--,c.ch=X(a,c.line)):c.ch=0}}function ka(a,b,c){b.ch=0,c.ch=0,c.line++}function la(a){if(!a)return 0;var b=a.search(/\S/);return-1==b?a.length:b}function ma(a,b,c,e,f){for(var g=ha(a),h=a.getLine(g.line),i=g.ch,j=f?kb[0]:lb[0];!j(h.charAt(i));)if(i++, +!function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)}(function(a){"use strict";function b(a){var b=a.getWrapperElement();a.state.fullScreenRestore={scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,width:b.style.width,height:b.style.height},b.style.width="",b.style.height="auto",b.className+=" CodeMirror-fullscreen",document.documentElement.style.overflow="hidden",a.refresh()}function c(a){var b=a.getWrapperElement();b.className=b.className.replace(/\s*CodeMirror-fullscreen\b/,""),document.documentElement.style.overflow="";var c=a.state.fullScreenRestore;b.style.width=c.width,b.style.height=c.height,window.scrollTo(c.scrollLeft,c.scrollTop),a.refresh()}a.defineOption("fullScreen",!1,function(d,e,f){f==a.Init&&(f=!1),!f!=!e&&(e?b(d):c(d))})}),function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)}(function(a){function b(a,b,c,d){this.cm=a,this.node=b,this.options=c,this.height=d,this.cleared=!1}function c(a){var b=a.getWrapperElement(),c=window.getComputedStyle?window.getComputedStyle(b):b.currentStyle,d=parseInt(c.height),e=a.state.panels={setHeight:b.style.height,heightLeft:d,panels:0,wrapper:document.createElement("div")};b.parentNode.insertBefore(e.wrapper,b);var f=a.hasFocus();e.wrapper.appendChild(b),f&&a.focus(),a._setSize=a.setSize,null!=d&&(a.setSize=function(b,c){if(null==c)return this._setSize(b,c);if(e.setHeight=c,"number"!=typeof c){var f=/^(\d+\.?\d*)px$/.exec(c);f?c=Number(f[1]):(e.wrapper.style.height=c,c=e.wrapper.offsetHeight,e.wrapper.style.height="")}a._setSize(b,e.heightLeft+=c-d),d=c})}function d(a){var b=a.state.panels;a.state.panels=null;var c=a.getWrapperElement();b.wrapper.parentNode.replaceChild(c,b.wrapper),c.style.height=b.setHeight,a.setSize=a._setSize,a.setSize()}a.defineExtension("addPanel",function(a,d){d=d||{},this.state.panels||c(this);var e=this.state.panels,f=e.wrapper,g=this.getWrapperElement();d.after instanceof b&&!d.after.cleared?f.insertBefore(a,d.before.node.nextSibling):d.before instanceof b&&!d.before.cleared?f.insertBefore(a,d.before.node):d.replace instanceof b&&!d.replace.cleared?(f.insertBefore(a,d.replace.node),d.replace.clear()):"bottom"==d.position?f.appendChild(a):"before-bottom"==d.position?f.insertBefore(a,g.nextSibling):"after-top"==d.position?f.insertBefore(a,g):f.insertBefore(a,f.firstChild);var h=d&&d.height||a.offsetHeight;return this._setSize(null,e.heightLeft-=h),e.panels++,new b(this,a,d,h)}),b.prototype.clear=function(){if(!this.cleared){this.cleared=!0;var a=this.cm.state.panels;this.cm._setSize(null,a.heightLeft+=this.height),a.wrapper.removeChild(this.node),0==--a.panels&&d(this.cm)}},b.prototype.changed=function(a){var b=null==a?this.node.offsetHeight:a,c=this.cm.state.panels;this.cm._setSize(null,c.height+=b-this.height),this.height=b}}),function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)}(function(a){function b(a,b){return"pairs"==b&&"string"==typeof a?a:"object"==typeof a&&null!=a[b]?a[b]:l[b]}function c(a){return function(b){return h(b,a)}}function d(a){var b=a.state.closeBrackets;if(!b)return null;var c=a.getModeAt(a.getCursor());return c.closeBrackets||b}function e(c){var e=d(c);if(!e||c.getOption("disableInput"))return a.Pass;for(var f=b(e,"pairs"),g=c.listSelections(),h=0;h=0;h--){var k=g[h].head;c.replaceRange("",m(k.line,k.ch-1),m(k.line,k.ch+1),"+delete")}}function f(c){var e=d(c),f=e&&b(e,"explode");if(!f||c.getOption("disableInput"))return a.Pass;for(var g=c.listSelections(),h=0;h0;return{anchor:new m(b.anchor.line,b.anchor.ch+(c?-1:1)),head:new m(b.head.line,b.head.ch+(c?1:-1))}}function h(c,e){var f=d(c);if(!f||c.getOption("disableInput"))return a.Pass;var h=b(f,"pairs"),j=h.indexOf(e);if(-1==j)return a.Pass;for(var l,n=b(f,"triples"),o=h.charAt(j+1)==e,p=c.listSelections(),q=j%2==0,r=0;r1&&n.indexOf(e)>=0&&c.getRange(m(u.line,u.ch-2),u)==e+e&&(u.ch<=2||c.getRange(m(u.line,u.ch-3),m(u.line,u.ch-2))!=e))s="addFour";else if(o){if(a.isWordChar(v)||!k(c,u,e))return a.Pass;s="both"}else{if(!q||c.getLine(u.line).length!=u.ch&&!i(v,h)&&!/\s/.test(v))return a.Pass;s="both"}else s=n.indexOf(e)>=0&&c.getRange(u,m(u.line,u.ch+3))==e+e+e?"skipThree":"skip";if(l){if(l!=s)return a.Pass}else l=s}var w=j%2?h.charAt(j-1):e,x=j%2?e:h.charAt(j+1);c.operation(function(){if("skip"==l)c.execCommand("goCharRight");else if("skipThree"==l)for(var a=0;3>a;a++)c.execCommand("goCharRight");else if("surround"==l){for(var b=c.getSelections(),a=0;a-1&&c%2==1}function j(a,b){var c=a.getRange(m(b.line,b.ch-1),m(b.line,b.ch+1));return 2==c.length?c:null}function k(b,c,d){var e=b.getLine(c.line),f=b.getTokenAt(c);if(/\bstring2?\b/.test(f.type))return!1;var g=new a.StringStream(e.slice(0,c.ch)+d+e.slice(c.ch),4);for(g.pos=g.start=f.start;;){var h=b.getMode().token(g,f.state);if(g.pos>=c.ch+1)return/\bstring2?\b/.test(h);g.start=g.pos}}var l={pairs:"()[]{}''\"\"",triples:"",explode:"[]{}"},m=a.Pos;a.defineOption("autoCloseBrackets",!1,function(b,c,d){d&&d!=a.Init&&(b.removeKeyMap(o),b.state.closeBrackets=null),c&&(b.state.closeBrackets=c,b.addKeyMap(o))});for(var n=l.pairs+"`",o={Backspace:e,Enter:f},p=0;pj.ch&&(r=r.slice(0,r.length-k.end+j.ch));var s=r.toLowerCase();if(!r||"string"==k.type&&(k.end!=j.ch||!/[\"\']/.test(k.string.charAt(k.string.length-1))||1==k.string.length)||"tag"==k.type&&"closeTag"==m.type||k.string.indexOf("/")==k.string.length-1||p&&e(p,s)>-1||f(b,r,j,m,!0))return a.Pass;var t=q&&e(q,s)>-1;d[i]={indent:t,text:">"+(t?"\n\n":"")+"",newPos:t?a.Pos(j.line+1,0):a.Pos(j.line,j.ch+1)}}for(var i=c.length-1;i>=0;i--){var u=d[i];b.replaceRange(u.text,c[i].head,c[i].anchor,"+insert");var v=b.listSelections().slice(0);v[i]={head:u.newPos,anchor:u.newPos},b.setSelections(v),u.indent&&(b.indentLine(u.newPos.line,null,!0),b.indentLine(u.newPos.line+1,null,!0))}}function c(b,c){for(var d=b.listSelections(),e=[],g=c?"/":""!=b.getLine(i.line).charAt(j.end)&&(m+=">"),e[h]=m}b.replaceSelections(e),d=b.listSelections();for(var h=0;hc;++c)if(a[c]==b)return c;return-1}function f(b,c,d,e,f){if(!a.scanForClosingTag)return!1;var g=Math.min(b.lastLine()+1,d.line+500),h=a.scanForClosingTag(b,d,null,g);if(!h||h.tag!=c)return!1;for(var i=e.context,j=f?1:0;i&&i.tagName==c;i=i.prev)++j;d=h.to;for(var k=1;j>k;k++){var l=a.scanForClosingTag(b,d,null,g);if(!l||l.tag!=c)return!1;d=l.to}return!0}a.defineOption("autoCloseTags",!1,function(c,e,f){if(f!=a.Init&&f&&c.removeKeyMap("autoCloseTags"),e){var g={name:"autoCloseTags"};("object"!=typeof e||e.whenClosing)&&(g["'/'"]=function(a){return d(a)}),("object"!=typeof e||e.whenOpening)&&(g["'>'"]=function(a){return b(a)}),c.addKeyMap(g)}});var g=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],h=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];a.commands.closeTag=function(a){return c(a)}}),function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)}(function(a){function b(a,b,d,e){var f=a.getLineHandle(b.line),i=b.ch-1,j=i>=0&&h[f.text.charAt(i)]||h[f.text.charAt(++i)];if(!j)return null;var k=">"==j.charAt(1)?1:-1;if(d&&k>0!=(i==b.ch))return null;var l=a.getTokenTypeAt(g(b.line,i+1)),m=c(a,g(b.line,i+(k>0?1:0)),k,l||null,e);return null==m?null:{from:g(b.line,i),to:m&&m.pos,match:m&&m.ch==j.charAt(0),forward:k>0}}function c(a,b,c,d,e){for(var f=e&&e.maxScanLineLength||1e4,i=e&&e.maxScanLines||1e3,j=[],k=e&&e.bracketRegex?e.bracketRegex:/[(){}[\]]/,l=c>0?Math.min(b.line+i,a.lastLine()+1):Math.max(a.firstLine()-1,b.line-i),m=b.line;m!=l;m+=c){var n=a.getLine(m);if(n){var o=c>0?0:n.length-1,p=c>0?n.length:-1;if(!(n.length>f))for(m==b.line&&(o=b.ch-(0>c?1:0));o!=p;o+=c){var q=n.charAt(o);if(k.test(q)&&(void 0===d||a.getTokenTypeAt(g(m,o+1))==d)){var r=h[q];if(">"==r.charAt(1)==c>0)j.push(q);else{if(!j.length)return{pos:g(m,o),ch:q};j.pop()}}}}}return m-c==(c>0?a.lastLine():a.firstLine())?!1:null}function d(a,c,d){for(var e=a.state.matchBrackets.maxHighlightLineLength||1e3,h=[],i=a.listSelections(),j=0;j",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},i=null;a.defineOption("matchBrackets",!1,function(b,c,d){d&&d!=a.Init&&b.off("cursorActivity",e),c&&(b.state.matchBrackets="object"==typeof c?c:{},b.on("cursorActivity",e))}),a.defineExtension("matchBrackets",function(){d(this,!0)}),a.defineExtension("findMatchingBracket",function(a,c,d){return b(this,a,c,d)}),a.defineExtension("scanForBracket",function(a,b,d,e){return c(this,a,b,d,e)})}),function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("../fold/xml-fold")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../fold/xml-fold"],a):a(CodeMirror)}(function(a){"use strict";function b(a){a.state.tagHit&&a.state.tagHit.clear(),a.state.tagOther&&a.state.tagOther.clear(),a.state.tagHit=a.state.tagOther=null}function c(c){c.state.failedTagMatch=!1,c.operation(function(){if(b(c),!c.somethingSelected()){var d=c.getCursor(),e=c.getViewport();e.from=Math.min(e.from,d.line),e.to=Math.max(d.line+1,e.to);var f=a.findMatchingTag(c,d,e);if(f){if(c.state.matchBothTags){var g="open"==f.at?f.open:f.close;g&&(c.state.tagHit=c.markText(g.from,g.to,{className:"CodeMirror-matchingtag"}))}var h="close"==f.at?f.open:f.close;h?c.state.tagOther=c.markText(h.from,h.to,{className:"CodeMirror-matchingtag"}):c.state.failedTagMatch=!0}}})}function d(a){a.state.failedTagMatch&&c(a)}a.defineOption("matchTags",!1,function(e,f,g){g&&g!=a.Init&&(e.off("cursorActivity",c),e.off("viewportChange",d),b(e)),f&&(e.state.matchBothTags="object"==typeof f&&f.bothTags,e.on("cursorActivity",c),e.on("viewportChange",d),c(e))}),a.commands.toMatchingTag=function(b){var c=a.findMatchingTag(b,b.getCursor());if(c){var d="close"==c.at?c.open:c.close;d&&b.extendSelection(d.to,d.from)}}}),function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)}(function(a){"use strict";a.registerHelper("fold","brace",function(b,c){function d(d){for(var h=c.ch,i=0;;){var j=0>=h?-1:g.lastIndexOf(d,h-1);if(-1!=j){if(1==i&&j=o;++o)for(var p=b.getLine(o),q=o==f?j:0;;){var r=p.indexOf(h,q),s=p.indexOf(i,q);if(0>r&&(r=p.length),0>s&&(s=p.length),q=Math.min(r,s),q==p.length)break;if(b.getTokenTypeAt(a.Pos(o,q+1))==e)if(q==r)++m;else if(!--m){k=o,l=q;break a}++q}if(null!=k&&(f!=k||l!=j))return{from:a.Pos(f,j),to:a.Pos(k,l)}}}),a.registerHelper("fold","import",function(b,c){function d(c){if(cb.lastLine())return null;var d=b.getTokenAt(a.Pos(c,1));if(/\S/.test(d.string)||(d=b.getTokenAt(a.Pos(c,d.end+1))),"keyword"!=d.type||"import"!=d.string)return null;for(var e=c,f=Math.min(b.lastLine(),c+10);f>=e;++e){var g=b.getLine(e),h=g.indexOf(";");if(-1!=h)return{startCh:d.end,end:a.Pos(e,h)}}}var e,f=c.line,g=d(f);if(!g||d(f-1)||(e=d(f-2))&&e.end.line==f-1)return null;for(var h=g.end;;){var i=d(h.line+1);if(null==i)break;h=i.end}return{from:b.clipPos(a.Pos(f,g.startCh+1)),to:h}}),a.registerHelper("fold","include",function(b,c){function d(c){if(cb.lastLine())return null;var d=b.getTokenAt(a.Pos(c,1));return/\S/.test(d.string)||(d=b.getTokenAt(a.Pos(c,d.end+1))),"meta"==d.type&&"#include"==d.string.slice(0,8)?d.start+8:void 0}var e=c.line,f=d(e);if(null==f||null!=d(e-1))return null;for(var g=e;;){var h=d(g+1);if(null==h)break;++g}return{from:a.Pos(e,f+1),to:b.clipPos(a.Pos(g))}})}),function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)}(function(a){"use strict";function b(b,e,f,g){function h(a){var c=i(b,e);if(!c||c.to.line-c.from.lineb.firstLine();)e=a.Pos(e.line-1,0),k=h(!1);if(k&&!k.cleared&&"unfold"!==g){var l=c(b,f);a.on(l,"mousedown",function(b){m.clear(),a.e_preventDefault(b)});var m=b.markText(k.from,k.to,{replacedWith:l,clearOnEnter:d(b,f,"clearOnEnter"),__isFold:!0});m.on("clear",function(c,d){a.signal(b,"unfold",b,c,d)}),a.signal(b,"fold",b,k.from,k.to)}}function c(a,b){var c=d(a,b,"widget");if("string"==typeof c){var e=document.createTextNode(c);c=document.createElement("span"),c.appendChild(e),c.className="CodeMirror-foldmarker"}return c}function d(a,b,c){if(b&&void 0!==b[c])return b[c];var d=a.options.foldOptions;return d&&void 0!==d[c]?d[c]:e[c]}a.newFoldFunction=function(a,c){return function(d,e){b(d,e,{rangeFinder:a,widget:c})}},a.defineExtension("foldCode",function(a,c,d){b(this,a,c,d)}),a.defineExtension("isFolded",function(a){for(var b=this.findMarksAt(a),c=0;c=c;c++)b.foldCode(a.Pos(c,0),null,"fold")})},a.commands.unfoldAll=function(b){b.operation(function(){for(var c=b.firstLine(),d=b.lastLine();d>=c;c++)b.foldCode(a.Pos(c,0),null,"unfold")})},a.registerHelper("fold","combine",function(){var a=Array.prototype.slice.call(arguments,0);return function(b,c){for(var d=0;d=h&&(c=e(f.indicatorOpen))}a.setGutterMarker(b,f.gutter,c),++g})}function g(a){var b=a.getViewport(),c=a.state.foldGutter;c&&(a.operation(function(){f(a,b.from,b.to)}),c.from=b.from,c.to=b.to)}function h(a,b,c){var e=a.state.foldGutter;if(e){var f=e.options;if(c==f.gutter){var g=d(a,b);g?g.clear():a.foldCode(l(b,0),f.rangeFinder)}}}function i(a){var b=a.state.foldGutter;if(b){var c=b.options;b.from=b.to=0,clearTimeout(b.changeUpdate),b.changeUpdate=setTimeout(function(){g(a)},c.foldOnChangeTimeSpan||600)}}function j(a){var b=a.state.foldGutter;if(b){var c=b.options;clearTimeout(b.changeUpdate),b.changeUpdate=setTimeout(function(){var c=a.getViewport();b.from==b.to||c.from-b.to>20||b.from-c.to>20?g(a):a.operation(function(){c.fromb.to&&(f(a,b.to,c.to),b.to=c.to)})},c.updateViewportTimeSpan||400)}}function k(a,b){var c=a.state.foldGutter;if(c){var d=b.line;d>=c.from&&d=a.max?void 0:(a.ch=0,a.text=a.cm.getLine(++a.line),!0)}function f(a){return a.line<=a.min?void 0:(a.text=a.cm.getLine(--a.line),a.ch=a.text.length,!0)}function g(a){for(;;){var b=a.text.indexOf(">",a.ch);if(-1==b){if(e(a))continue;return}{if(d(a,b+1)){var c=a.text.lastIndexOf("/",b),f=c>-1&&!/\S/.test(a.text.slice(c+1,b));return a.ch=b+1,f?"selfClose":"regular"}a.ch=b+1}}}function h(a){for(;;){var b=a.ch?a.text.lastIndexOf("<",a.ch-1):-1;if(-1==b){if(f(a))continue;return}if(d(a,b+1)){p.lastIndex=b,a.ch=b;var c=p.exec(a.text);if(c&&c.index==b)return c}else a.ch=b}}function i(a){for(;;){p.lastIndex=a.ch;var b=p.exec(a.text);if(!b){if(e(a))continue;return}{if(d(a,b.index+1))return a.ch=b.index+b[0].length,b;a.ch=b.index+1}}}function j(a){for(;;){var b=a.ch?a.text.lastIndexOf(">",a.ch-1):-1;if(-1==b){if(f(a))continue;return}{if(d(a,b+1)){var c=a.text.lastIndexOf("/",b),e=c>-1&&!/\S/.test(a.text.slice(c+1,b));return a.ch=b+1,e?"selfClose":"regular"}a.ch=b}}}function k(a,b){for(var c=[];;){var d,e=i(a),f=a.line,h=a.ch-(e?e[0].length:0);if(!e||!(d=g(a)))return;if("selfClose"!=d)if(e[1]){for(var j=c.length-1;j>=0;--j)if(c[j]==e[2]){c.length=j;break}if(0>j&&(!b||b==e[2]))return{tag:e[2],from:m(f,h),to:m(a.line,a.ch)}}else c.push(e[2])}}function l(a,b){for(var c=[];;){var d=j(a);if(!d)return;if("selfClose"!=d){var e=a.line,f=a.ch,g=h(a);if(!g)return;if(g[1])c.push(g[2]);else{for(var i=c.length-1;i>=0;--i)if(c[i]==g[2]){c.length=i;break}if(0>i&&(!b||b==g[2]))return{tag:g[2],from:m(a.line,a.ch),to:m(e,f)}}}else h(a)}}var m=a.Pos,n="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",o=n+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",p=new RegExp("<(/?)(["+n+"]["+o+"]*)","g");a.registerHelper("fold","xml",function(a,b){for(var d=new c(a,b.line,0);;){var e,f=i(d);if(!f||d.line!=b.line||!(e=g(d)))return;if(!f[1]&&"selfClose"!=e){var h=m(d.line,d.ch),j=k(d,f[2]);return j&&{from:h,to:j.from}}}}),a.findMatchingTag=function(a,d,e){var f=new c(a,d.line,d.ch,e);if(-1!=f.text.indexOf(">")||-1!=f.text.indexOf("<")){var i=g(f),j=i&&m(f.line,f.ch),n=i&&h(f);if(i&&n&&!(b(f,d)>0)){var o={from:m(f.line,f.ch),to:j,tag:n[2]};return"selfClose"==i?{open:o,close:null,at:"open"}:n[1]?{open:l(f,n[2]),close:o,at:"close"}:(f=new c(a,j.line,j.ch,e),{open:o,close:k(f,n[2]),at:"open"})}}},a.findEnclosingTag=function(a,b,d){for(var e=new c(a,b.line,b.ch,d);;){var f=l(e);if(!f)break;var g=new c(a,b.line,b.ch,d),h=k(g,f.tag);if(h)return{open:f,close:h}}},a.scanForClosingTag=function(a,b,d,e){var f=new c(a,b.line,b.ch,e?{from:0,to:e}:null);return k(f,d)}}),function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),"cjs"):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],function(b){a(b,"amd")}):a(CodeMirror,"plain")}(function(a,b){function c(a,b){var c=b;return function(){0==--c&&a()}}function d(b,d){var e=a.modes[b].dependencies;if(!e)return d();for(var f=[],g=0;g-1?e+b.length:e}var f=b.exec(c?a.slice(c):a);return f?f.index+c+(d?f[0].length:0):-1}var d=Array.prototype.slice.call(arguments,1);return{startState:function(){return{outer:a.startState(b),innerActive:null,inner:null}},copyState:function(c){return{outer:a.copyState(b,c.outer),innerActive:c.innerActive,inner:c.innerActive&&a.copyState(c.innerActive.mode,c.inner)}},token:function(e,f){if(f.innerActive){var g=f.innerActive,h=e.string;if(!g.close&&e.sol())return f.innerActive=f.inner=null,this.token(e,f);var i=g.close?c(h,g.close,e.pos,g.parseDelimiters):-1;if(i==e.pos&&!g.parseDelimiters)return e.match(g.close),f.innerActive=f.inner=null,g.delimStyle&&g.delimStyle+" "+g.delimStyle+"-close";i>-1&&(e.string=h.slice(0,i));var j=g.mode.token(e,f.inner);return i>-1&&(e.string=h),i==e.pos&&g.parseDelimiters&&(f.innerActive=f.inner=null),g.innerStyle&&(j=j?j+" "+g.innerStyle:g.innerStyle),j}for(var k=1/0,h=e.string,l=0;li&&(k=i)}k!=1/0&&(e.string=h.slice(0,k));var n=b.token(e,f.outer);return k!=1/0&&(e.string=h),n},indent:function(c,d){var e=c.innerActive?c.innerActive.mode:b;return e.indent?e.indent(c.innerActive?c.inner:c.outer,d):a.Pass},blankLine:function(c){var e=c.innerActive?c.innerActive.mode:b;if(e.blankLine&&e.blankLine(c.innerActive?c.inner:c.outer),c.innerActive)"\n"===c.innerActive.close&&(c.innerActive=c.inner=null);else for(var f=0;fh)return c.charCoords(a,"local")[b?"top":"bottom"];var d=c.heightAtLine(j,"local");return d+(b?0:j.height)}a!==!1&&this.computeScale();var c=this.cm,d=this.hScale,e=document.createDocumentFragment(),f=this.annotations,g=c.getOption("lineWrapping"),h=g&&1.5*c.defaultTextHeight(),i=null,j=null;if(c.display.barWidth)for(var k,l=0;lo+.9));)m=f[++l],o=b(m.to,!1)*d;if(o!=n){var p=Math.max(o-n,3),q=e.appendChild(document.createElement("div"));q.style.cssText="position: absolute; right: 0px; width: "+Math.max(c.display.barWidth-1,2)+"px; top: "+(n+this.buttonHeight)+"px; height: "+p+"px",q.className=this.options.className,m.id&&q.setAttribute("annotation-id",m.id)}}this.div.textContent="",this.div.appendChild(e)},b.prototype.clear=function(){this.cm.off("refresh",this.resizeHandler),this.cm.off("markerAdded",this.resizeHandler),this.cm.off("markerCleared",this.resizeHandler),this.changeHandler&&this.cm.off("change",this.changeHandler),this.div.parentNode.removeChild(this.div)}}),function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)}(function(a){"use strict";function b(b,c,d){function e(b){var c=a.wheelEventPixels(b)["horizontal"==f.orientation?"x":"y"],d=f.pos;f.moveTo(f.pos+c),f.pos!=d&&a.e_preventDefault(b)}this.orientation=c,this.scroll=d,this.screen=this.total=this.size=1,this.pos=0,this.node=document.createElement("div"),this.node.className=b+"-"+c,this.inner=this.node.appendChild(document.createElement("div"));var f=this;a.on(this.inner,"mousedown",function(b){function c(){a.off(document,"mousemove",d),a.off(document,"mouseup",c)}function d(a){return 1!=a.which?c():void f.moveTo(h+(a[e]-g)*(f.total/f.size))}if(1==b.which){a.e_preventDefault(b);var e="horizontal"==f.orientation?"pageX":"pageY",g=b[e],h=f.pos;a.on(document,"mousemove",d),a.on(document,"mouseup",c)}}),a.on(this.node,"click",function(b){a.e_preventDefault(b);var c,d=f.inner.getBoundingClientRect();c="horizontal"==f.orientation?b.clientXd.right?1:0:b.clientYd.bottom?1:0,f.moveTo(f.pos+c*f.screen)}),a.on(this.node,"mousewheel",e),a.on(this.node,"DOMMouseScroll",e)}function c(a,c,d){this.addClass=a,this.horiz=new b(a,"horizontal",d),c(this.horiz.node),this.vert=new b(a,"vertical",d),c(this.vert.node),this.width=null}b.prototype.setPos=function(a,b){return 0>a&&(a=0),a>this.total-this.screen&&(a=this.total-this.screen),b||a!=this.pos?(this.pos=a,this.inner.style["horizontal"==this.orientation?"left":"top"]=a*(this.size/this.total)+"px",!0):!1},b.prototype.moveTo=function(a){this.setPos(a)&&this.scroll(a,this.orientation)};var d=10;b.prototype.update=function(a,b,c){var e=this.screen!=b||this.total!=a||this.size!=c;e&&(this.screen=b,this.total=a,this.size=c);var f=this.screen*(this.size/this.total);d>f&&(this.size-=d-f,f=d),this.inner.style["horizontal"==this.orientation?"width":"height"]=f+"px",this.setPos(this.pos,e)},c.prototype.update=function(a){if(null==this.width){var b=window.getComputedStyle?window.getComputedStyle(this.horiz.node):this.horiz.node.currentStyle;b&&(this.width=parseInt(b.height))}var c=this.width||0,d=a.scrollWidth>a.clientWidth+1,e=a.scrollHeight>a.clientHeight+1;return this.vert.node.style.display=e?"block":"none",this.horiz.node.style.display=d?"block":"none",e&&(this.vert.update(a.scrollHeight,a.clientHeight,a.viewHeight-(d?c:0)),this.vert.node.style.bottom=d?c+"px":"0"),d&&(this.horiz.update(a.scrollWidth,a.clientWidth,a.viewWidth-(e?c:0)-a.barLeft), +this.horiz.node.style.right=e?c+"px":"0",this.horiz.node.style.left=a.barLeft+"px"),{right:e?c:0,bottom:d?c:0}},c.prototype.setScrollTop=function(a){this.vert.setPos(a)},c.prototype.setScrollLeft=function(a){this.horiz.setPos(a)},c.prototype.clear=function(){var a=this.horiz.node.parentNode;a.removeChild(this.horiz.node),a.removeChild(this.vert.node)},a.scrollbarModel.simple=function(a,b){return new c("CodeMirror-simplescroll",a,b)},a.scrollbarModel.overlay=function(a,b){return new c("CodeMirror-overlayscroll",a,b)}}),function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("./searchcursor"),require("../scroll/annotatescrollbar")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./searchcursor","../scroll/annotatescrollbar"],a):a(CodeMirror)}(function(a){"use strict";function b(a,b,c,d){this.cm=a,this.options=d;var e={listenForChanges:!1};for(var f in d)e[f]=d[f];e.className||(e.className="CodeMirror-search-match"),this.annotation=a.annotateScrollbar(e),this.query=b,this.caseFold=c,this.gap={from:a.firstLine(),to:a.lastLine()+1},this.matches=[],this.update=null,this.findMatches(),this.annotation.update(this.matches);var g=this;a.on("change",this.changeHandler=function(a,b){g.onChange(b)})}function c(a,b,c){return b>=a?a:Math.max(b,a+c)}a.defineExtension("showMatchesOnScrollbar",function(a,c,d){return"string"==typeof d&&(d={className:d}),d||(d={}),new b(this,a,c,d)});var d=1e3;b.prototype.findMatches=function(){if(this.gap){for(var b=0;b=this.gap.to)break;c.to.line>=this.gap.from&&this.matches.splice(b--,1)}for(var e=this.cm.getSearchCursor(this.query,a.Pos(this.gap.from,0),this.caseFold),f=this.options&&this.options.maxMatches||d;e.findNext();){var c={from:e.from(),to:e.to()};if(c.from.line>=this.gap.to)break;if(this.matches.splice(b++,0,c),this.matches.length>f)break}this.gap=null}},b.prototype.onChange=function(b){var d=b.from.line,e=a.changeEnd(b).line,f=e-b.to.line;if(this.gap?(this.gap.from=Math.min(c(this.gap.from,d,f),b.from.line),this.gap.to=Math.max(c(this.gap.to,d,f),b.from.line)):this.gap={from:b.from.line,to:e+1},f)for(var g=0;gi&&d(a,h.slice(i,j),c,b.options.style))}var k=a.getCursor("from"),l=a.getCursor("to");if(k.line==l.line&&(!b.options.wordsOnly||g(a,k,l))){var m=a.getRange(k,l);b.options.trim&&(m=m.replace(/^\s+|\s+$/g,"")),m.length>=b.options.minChars&&d(a,m,!1,b.options.style)}})}function g(a,b,c){var d=a.getRange(b,c);if(null!==d.match(/^\w+$/)){if(b.ch>0){var e={line:b.line,ch:b.ch-1},f=a.getRange(e,b);if(null===f.match(/\W/))return!1}if(c.ch-1)return k=c(i,j,k),{from:d(f.line,k),to:d(f.line,k+g.length)}}else{var i=a.getLine(f.line).slice(f.ch),j=h(i),k=j.indexOf(b);if(k>-1)return k=c(i,j,k)+f.ch,{from:d(f.line,k),to:d(f.line,k+g.length)}}}:this.matches=function(){};else{var j=g.split("\n");this.matches=function(b,c){var e=i.length-1;if(b){if(c.line-(i.length-1)=1;--k,--g)if(i[k]!=h(a.getLine(g)))return;var l=a.getLine(g),m=l.length-j[0].length;if(h(l.slice(m))!=i[0])return;return{from:d(g,m),to:f}}if(!(c.line+(i.length-1)>a.lastLine())){var l=a.getLine(c.line),m=l.length-j[0].length;if(h(l.slice(m))==i[0]){for(var n=d(c.line,m),g=c.line+1,k=1;e>k;++k,++g)if(i[k]!=h(a.getLine(g)))return;if(h(a.getLine(g).slice(0,j[e].length))==i[e])return{from:n,to:d(g,j[e].length)}}}}}}}function c(a,b,c){if(a.length==b.length)return c;for(var d=Math.min(c,a.length);;){var e=a.slice(0,d).toLowerCase().length;if(c>e)++d;else{if(!(e>c))return d;--d}}}var d=a.Pos;b.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(a){function b(a){var b=d(a,0);return c.pos={from:b,to:b},c.atOccurrence=!1,!1}for(var c=this,e=this.doc.clipPos(a?this.pos.from:this.pos.to);;){if(this.pos=this.matches(a,e))return this.atOccurrence=!0,this.pos.match||!0;if(a){if(!e.line)return b(0);e=d(e.line-1,this.doc.getLine(e.line-1).length)}else{var f=this.doc.lineCount();if(e.line==f-1)return b(f);e=d(e.line+1,0)}}},from:function(){return this.atOccurrence?this.pos.from:void 0},to:function(){return this.atOccurrence?this.pos.to:void 0},replace:function(b,c){if(this.atOccurrence){var e=a.splitLines(b);this.doc.replaceRange(e,this.pos.from,this.pos.to,c),this.pos.to=d(this.pos.from.line+e.length-1,e[e.length-1].length+(1==e.length?this.pos.from.ch:0))}}},a.defineExtension("getSearchCursor",function(a,c,d){return new b(this.doc,a,c,d)}),a.defineDocExtension("getSearchCursor",function(a,c,d){return new b(this,a,c,d)}),a.defineExtension("selectMatches",function(b,c){for(var d=[],e=this.getSearchCursor(b,this.getCursor("from"),c);e.findNext()&&!(a.cmpPos(e.to(),this.getCursor("to"))>0);)d.push({anchor:e.from(),head:e.to()});d.length&&this.setSelections(d,0)})}),function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)}(function(a){"use strict";function b(a){for(var b=0;b",type:"keyToKey",toKeys:"h"},{keys:"",type:"keyToKey",toKeys:"l"},{keys:"",type:"keyToKey",toKeys:"k"},{keys:"",type:"keyToKey",toKeys:"j"},{keys:"",type:"keyToKey",toKeys:"l"},{keys:"",type:"keyToKey",toKeys:"h",context:"normal"},{keys:"",type:"keyToKey",toKeys:"W"},{keys:"",type:"keyToKey",toKeys:"B",context:"normal"},{keys:"",type:"keyToKey",toKeys:"w"},{keys:"",type:"keyToKey",toKeys:"b",context:"normal"},{keys:"",type:"keyToKey",toKeys:"j"},{keys:"",type:"keyToKey",toKeys:"k"},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"",context:"insert"},{keys:"",type:"keyToKey",toKeys:"",context:"insert"},{keys:"s",type:"keyToKey",toKeys:"cl",context:"normal"},{keys:"s",type:"keyToKey",toKeys:"c",context:"visual"},{keys:"S",type:"keyToKey",toKeys:"cc",context:"normal"},{keys:"S",type:"keyToKey",toKeys:"VdO",context:"visual"},{keys:"",type:"keyToKey",toKeys:"0"},{keys:"",type:"keyToKey",toKeys:"$"},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"j^",context:"normal"},{keys:"H",type:"motion",motion:"moveToTopLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"M",type:"motion",motion:"moveToMiddleLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"L",type:"motion",motion:"moveToBottomLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"h",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!1}},{keys:"l",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!0}},{keys:"j",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,linewise:!0}},{keys:"k",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,linewise:!0}},{keys:"gj",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!0}},{keys:"gk",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!1}},{keys:"w",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1}},{keys:"W",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1,bigWord:!0}},{keys:"e",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,inclusive:!0}},{keys:"E",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"b",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1}},{keys:"B",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1,bigWord:!0}},{keys:"ge",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,inclusive:!0}},{keys:"gE",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"{",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!1,toJumplist:!0}},{keys:"}",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!0,toJumplist:!0}},{keys:"",type:"motion",motion:"moveByPage",motionArgs:{forward:!0}},{keys:"",type:"motion",motion:"moveByPage",motionArgs:{forward:!1}},{keys:"",type:"motion",motion:"moveByScroll",motionArgs:{forward:!0,explicitRepeat:!0}},{keys:"",type:"motion",motion:"moveByScroll",motionArgs:{forward:!1,explicitRepeat:!0}},{keys:"gg",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"G",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!0,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"0",type:"motion",motion:"moveToStartOfLine"},{keys:"^",type:"motion",motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"+",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0}},{keys:"-",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,toFirstChar:!0}},{keys:"_",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0,repeatOffset:-1}},{keys:"$",type:"motion",motion:"moveToEol",motionArgs:{inclusive:!0}},{keys:"%",type:"motion",motion:"moveToMatchedSymbol",motionArgs:{inclusive:!0,toJumplist:!0}},{keys:"f",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"F",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!1}},{keys:"t",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"T",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!1}},{keys:";",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!0}},{keys:",",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!1}},{keys:"'",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0}},{keys:"]`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0}},{keys:"[`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1}},{keys:"]'",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0,linewise:!0}},{keys:"['",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1,linewise:!0}},{keys:"]p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0,matchIndent:!0}},{keys:"[p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0,matchIndent:!0}},{keys:"]",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!0,toJumplist:!0}},{keys:"[",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!1,toJumplist:!0}},{keys:"|",type:"motion",motion:"moveToColumn"},{keys:"o",type:"motion",motion:"moveToOtherHighlightedEnd",context:"visual"},{keys:"O",type:"motion",motion:"moveToOtherHighlightedEnd",motionArgs:{sameLine:!0},context:"visual"},{keys:"d",type:"operator",operator:"delete"},{keys:"y",type:"operator",operator:"yank"},{keys:"c",type:"operator",operator:"change"},{keys:">",type:"operator",operator:"indent",operatorArgs:{indentRight:!0}},{keys:"<",type:"operator",operator:"indent",operatorArgs:{indentRight:!1}},{keys:"g~",type:"operator",operator:"changeCase"},{keys:"gu",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},isEdit:!0},{keys:"gU",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},isEdit:!0},{keys:"n",type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:!0}},{keys:"N",type:"motion",motion:"findNext",motionArgs:{forward:!1,toJumplist:!0}},{keys:"x",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!0},operatorMotionArgs:{visualLine:!1}},{keys:"X",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!1},operatorMotionArgs:{visualLine:!0}},{keys:"D",type:"operatorMotion",operator:"delete",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"D",type:"operator",operator:"delete",operatorArgs:{linewise:!0},context:"visual"},{keys:"Y",type:"operatorMotion",operator:"yank",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"Y",type:"operator",operator:"yank",operatorArgs:{linewise:!0},context:"visual"},{keys:"C",type:"operatorMotion",operator:"change",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"C",type:"operator",operator:"change",operatorArgs:{linewise:!0},context:"visual"},{keys:"~",type:"operatorMotion",operator:"changeCase",motion:"moveByCharacters",motionArgs:{forward:!0},operatorArgs:{shouldMoveCursor:!0},context:"normal"},{keys:"~",type:"operator",operator:"changeCase",context:"visual"},{keys:"",type:"operatorMotion",operator:"delete",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1},context:"insert"},{keys:"",type:"action",action:"jumpListWalk",actionArgs:{forward:!0}},{keys:"",type:"action",action:"jumpListWalk",actionArgs:{forward:!1}},{keys:"",type:"action",action:"scroll",actionArgs:{forward:!0,linewise:!0}},{keys:"",type:"action",action:"scroll",actionArgs:{forward:!1,linewise:!0}},{keys:"a",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"charAfter"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"eol"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"endOfSelectedArea"},context:"visual"},{keys:"i",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"inplace"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"firstNonBlank"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"startOfSelectedArea"},context:"visual"},{keys:"o",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!0},context:"normal"},{keys:"O",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!1},context:"normal"},{keys:"v",type:"action",action:"toggleVisualMode"},{keys:"V",type:"action",action:"toggleVisualMode",actionArgs:{linewise:!0}},{keys:"",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"gv",type:"action",action:"reselectLastSelection"},{keys:"J",type:"action",action:"joinLines",isEdit:!0},{keys:"p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0}},{keys:"P",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0}},{keys:"r",type:"action",action:"replace",isEdit:!0},{keys:"@",type:"action",action:"replayMacro"},{keys:"q",type:"action",action:"enterMacroRecordMode"},{keys:"R",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{replace:!0}},{keys:"u",type:"action",action:"undo",context:"normal"},{keys:"u",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},context:"visual",isEdit:!0},{keys:"U",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},context:"visual",isEdit:!0},{keys:"",type:"action",action:"redo"},{keys:"m",type:"action",action:"setMark"},{keys:'"',type:"action",action:"setRegister"},{keys:"zz",type:"action",action:"scrollToCursor",actionArgs:{position:"center"}},{keys:"z.",type:"action",action:"scrollToCursor",actionArgs:{position:"center"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zt",type:"action",action:"scrollToCursor",actionArgs:{position:"top"}},{keys:"z",type:"action",action:"scrollToCursor",actionArgs:{position:"top"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"z-",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"}},{keys:"zb",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:".",type:"action",action:"repeatLastEdit"},{keys:"",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!0,backtrack:!1}},{keys:"",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:"a",type:"motion",motion:"textObjectManipulation"},{keys:"i",type:"motion",motion:"textObjectManipulation",motionArgs:{textObjectInner:!0}},{keys:"/",type:"search",searchArgs:{forward:!0,querySrc:"prompt",toJumplist:!0}},{keys:"?",type:"search",searchArgs:{forward:!1,querySrc:"prompt",toJumplist:!0}},{keys:"*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"g*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:"g#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:":",type:"ex"}],c=[{name:"colorscheme",shortName:"colo"},{name:"map"},{name:"imap",shortName:"im"},{name:"nmap",shortName:"nm"},{name:"vmap",shortName:"vm"},{name:"unmap"},{name:"write",shortName:"w"},{name:"undo",shortName:"u"},{name:"redo",shortName:"red"},{name:"set",shortName:"se"},{name:"set",shortName:"se"},{name:"setlocal",shortName:"setl"},{name:"setglobal",shortName:"setg"},{name:"sort",shortName:"sor"},{name:"substitute",shortName:"s",possiblyAsync:!0},{name:"nohlsearch",shortName:"noh"},{name:"yank",shortName:"y"},{name:"delmarks",shortName:"delm"},{name:"registers",shortName:"reg",excludeFromCommandHistory:!0},{name:"global",shortName:"g"}],d=a.Pos,e=function(){function e(b){b.setOption("disableInput",!0),b.setOption("showCursorWhenSelecting",!1),a.signal(b,"vim-mode-change",{mode:"normal"}),b.on("cursorActivity",ab),x(b),a.on(b.getInputField(),"paste",k(b))}function f(b){b.setOption("disableInput",!1),b.off("cursorActivity",ab),a.off(b.getInputField(),"paste",k(b)),b.state.vim=null}function g(b,c){this==a.keyMap.vim&&a.rmClass(b.getWrapperElement(),"cm-fat-cursor"),c&&c.attach==h||f(b,!1)}function h(b,c){this==a.keyMap.vim&&a.addClass(b.getWrapperElement(),"cm-fat-cursor"),c&&c.attach==h||e(b)}function i(b,c){if(!c)return void 0;var d=j(b);if(!d)return!1;var e=a.Vim.findKey(c,d);return"function"==typeof e&&a.signal(c,"vim-keypress",d),e}function j(a){if("'"==a.charAt(0))return a.charAt(1);var b=a.split(/-(?!$)/),c=b[b.length-1];if(1==b.length&&1==b[0].length)return!1;if(2==b.length&&"Shift"==b[0]&&1==c.length)return!1;for(var d=!1,e=0;e"):!1}function k(a){var b=a.state.vim;return b.onPasteFn||(b.onPasteFn=function(){b.insertMode||(a.setCursor(L(a.getCursor(),0,1)),Ab.enterInsertMode(a,{},b))}),b.onPasteFn}function l(a,b){for(var c=[],d=a;a+b>d;d++)c.push(String.fromCharCode(d));return c}function m(a,b){return b>=a.firstLine()&&b<=a.lastLine()}function n(a){return/^[a-z]$/.test(a)}function o(a){return-1!="()[]{}".indexOf(a)}function p(a){return jb.test(a)}function q(a){return/^[A-Z]$/.test(a)}function r(a){return/^\s*$/.test(a)}function s(a,b){for(var c=0;cd;d++)c.push(a);return c}function H(a,b){zb[a]=b}function I(a,b){Ab[a]=b}function J(a,b,c){var e=Math.min(Math.max(a.firstLine(),b.line),a.lastLine()),f=X(a,e)-1;f=c?f+1:f;var g=Math.min(Math.max(0,b.ch),f);return d(e,g)}function K(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function L(a,b,c){return"object"==typeof b&&(c=b.ch,b=b.line),d(a.line+b,a.ch+c)}function M(a,b){return{line:b.line-a.line,ch:b.line-a.line}}function N(a,b,c,d){for(var e,f=[],g=[],h=0;h"==b.slice(-11)){var c=b.length-11,d=a.slice(0,c),e=b.slice(0,c);return d==e&&a.length>c?"full":0==e.indexOf(d)?"partial":!1}return a==b?"full":0==b.indexOf(a)?"partial":!1}function P(a){var b=/^.*(<[\w\-]+>)$/.exec(a),c=b?b[1]:a.slice(-1);if(c.length>1)switch(c){case"":c="\n";break;case"":c=" "}return c}function Q(a,b,c){return function(){for(var d=0;c>d;d++)b(a)}}function R(a){return d(a.line,a.ch)}function S(a,b){return a.ch==b.ch&&a.line==b.line}function T(a,b){return a.line2&&(b=U.apply(void 0,Array.prototype.slice.call(arguments,1))),T(a,b)?a:b}function V(a,b){return arguments.length>2&&(b=V.apply(void 0,Array.prototype.slice.call(arguments,1))),T(a,b)?b:a}function W(a,b,c){var d=T(a,b),e=T(b,c);return d&&e}function X(a,b){return a.getLine(b).length}function Y(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function Z(a){return a.replace(/([.?*+$\[\]\/\\(){}|\-])/g,"\\$1")}function $(a,b,c){var e=X(a,b),f=new Array(c-e+1).join(" ");a.setCursor(d(b,e)),a.replaceRange(f,a.getCursor())}function _(a,b){var c=[],e=a.listSelections(),f=R(a.clipPos(b)),g=!S(b,f),h=a.getCursor("head"),i=ba(e,h),j=S(e[i].head,e[i].anchor),k=e.length-1,l=k-i>i?k:0,m=e[l].anchor,n=Math.min(m.line,f.line),o=Math.max(m.line,f.line),p=m.ch,q=f.ch,r=e[l].head.ch-p,s=q-p;r>0&&0>=s?(p++,g||q--):0>r&&s>=0?(p--,j||q++):0>r&&-1==s&&(p--,q++);for(var t=n;o>=t;t++){var u={anchor:new d(t,p),head:new d(t,q)};c.push(u)}return i=f.line==o?c.length-1:0,a.setSelections(c),b.ch=q,m.ch=p,m}function aa(a,b,c){for(var d=[],e=0;c>e;e++){var f=L(b,e,0);d.push({anchor:f,head:f})}a.setSelections(d,0)}function ba(a,b,c){for(var d=0;dj&&(f.line=j),f.ch=X(a,f.line)}return{ranges:[{anchor:g,head:f}],primary:0}}if("block"==c){for(var k=Math.min(g.line,f.line),l=Math.min(g.ch,f.ch),m=Math.max(g.line,f.line),n=Math.max(g.ch,f.ch)+1,o=m-k+1,p=f.line==k?0:o-1,q=[],r=0;o>r;r++)q.push({anchor:d(k+r,l),head:d(k+r,n)});return{ranges:q,primary:p}}}function ha(a){var b=a.getCursor("head");return 1==a.getSelection().length&&(b=U(b,a.getCursor("anchor"))),b}function ia(b,c){var d=b.state.vim;c!==!1&&b.setCursor(J(b,d.sel.head)),da(b,d),d.visualMode=!1,d.visualLine=!1,d.visualBlock=!1,a.signal(b,"vim-mode-change",{mode:"normal"}),d.fakeCursor&&d.fakeCursor.clear()}function ja(a,b,c){var d=a.getRange(b,c);if(/\n\s*$/.test(d)){var e=d.split("\n");e.pop();for(var f,f=e.pop();e.length>0&&f&&r(f);f=e.pop())c.line--,c.ch=0;f?(c.line--,c.ch=X(a,c.line)):c.ch=0}}function ka(a,b,c){b.ch=0,c.ch=0,c.line++}function la(a){if(!a)return 0;var b=a.search(/\S/);return-1==b?a.length:b}function ma(a,b,c,e,f){for(var g=ha(a),h=a.getLine(g.line),i=g.ch,j=f?kb[0]:lb[0];!j(h.charAt(i));)if(i++, i>=h.length)return null;e?j=lb[0]:(j=kb[0],j(h.charAt(i))||(j=kb[1]));for(var k=i,l=i;j(h.charAt(k))&&k=0;)l--;if(l++,b){for(var m=k;/\s/.test(h.charAt(k))&&k0;)l--;l||(l=n)}}return{start:d(g.line,l),end:d(g.line,k)}}function na(a,b,c){S(b,c)||ub.jumpList.add(a,b,c)}function oa(a,b){ub.lastCharacterSearch.increment=a,ub.lastCharacterSearch.forward=b.forward,ub.lastCharacterSearch.selectedCharacter=b.selectedCharacter}function pa(a,b,c,e){var f=R(a.getCursor()),g=c?1:-1,h=c?a.lineCount():-1,i=f.ch,j=f.line,k=a.getLine(j),l={lineText:k,nextCh:k.charAt(i),lastCh:null,index:i,symb:e,reverseSymb:(c?{")":"(","}":"{"}:{"(":")","{":"}"})[e],forward:c,depth:0,curMoveThrough:!1},m=Bb[e];if(!m)return f;var n=Cb[m].init,o=Cb[m].isComplete;for(n&&n(l);j!==h&&b;){if(l.index+=g,l.nextCh=l.lineText.charAt(l.index),!l.nextCh){if(j+=g,l.lineText=a.getLine(j)||"",g>0)l.index=0;else{var p=l.lineText.length;l.index=p>0?p-1:0}l.nextCh=l.lineText.charAt(l.index)}o(l)&&(f.line=j,f.ch=l.index,b--)}return l.nextCh||l.curMoveThrough?d(j,l.index):f}function qa(a,b,c,d,e){var f=b.line,g=b.ch,h=a.getLine(f),i=c?1:-1,j=d?lb:kb;if(e&&""==h){if(f+=i,h=a.getLine(f),!m(a,f))return null;g=c?0:h.length}for(;;){if(e&&""==h)return{from:0,to:0,line:f};for(var k=i>0?h.length:-1,l=k,n=k;g!=k;){for(var o=!1,p=0;p0?0:h.length}}function ra(a,b,c,e,f,g){var h=R(b),i=[];(e&&!f||!e&&f)&&c++;for(var j=!(e&&f),k=0;c>k;k++){var l=qa(a,b,e,g,j);if(!l){var m=X(a,a.lastLine());i.push(e?{line:a.lastLine(),from:m,to:m}:{line:0,from:0,to:0});break}i.push(l),b=d(l.line,e?l.to-1:l.from)}var n=i.length!=c,o=i[0],p=i.pop();return e&&!f?(n||o.from==h.ch&&o.line==h.line||(p=i.pop()),d(p.line,p.from)):e&&f?d(p.line,p.to-1):!e&&f?(n||o.to==h.ch&&o.line==h.line||(p=i.pop()),d(p.line,p.to)):d(p.line,p.from)}function sa(a,b,c,e){for(var f,g=a.getCursor(),h=g.ch,i=0;b>i;i++){var j=a.getLine(g.line);if(f=va(h,j,e,c,!0),-1==f)return null;h=f}return d(a.getCursor().line,f)}function ta(a,b){var c=a.getCursor().line;return J(a,d(c,b-1))}function ua(a,b,c,d){s(c,pb)&&(b.marks[c]&&b.marks[c].clear(),b.marks[c]=a.setBookmark(d))}function va(a,b,c,d,e){var f;return d?(f=b.indexOf(c,a+1),-1==f||e||(f-=1)):(f=b.lastIndexOf(c,a-1),-1==f||e||(f+=1)),f}function wa(a,b,c,e,f){function g(b){return!a.getLine(b)}function h(a,b,c){return c?g(a)!=g(a+b):!g(a)&&g(a+b)}var i,j,k=b.line,l=a.firstLine(),m=a.lastLine(),n=k;if(e){for(;n>=l&&m>=n&&c>0;)h(n,e)&&c--,n+=e;return new d(n,0)}var o=a.state.vim;if(o.visualLine&&h(k,1,!0)){var p=o.sel.anchor;h(p.line,-1,!0)&&(f&&p.line==k||(k+=1))}var q=g(k);for(n=k;m>=n&&c;n++)h(n,1,!0)&&(f&&g(n)==q||c--);for(j=new d(n,0),n>m&&!q?q=!0:f=!1,n=k;n>l&&(f&&g(n)!=q&&n!=k||!h(n,-1,!0));n--);return i=new d(n,0),{start:i,end:j}}function xa(a,b,c,e){var f,g,h=b,i={"(":/[()]/,")":/[()]/,"[":/[[\]]/,"]":/[[\]]/,"{":/[{}]/,"}":/[{}]/}[c],j={"(":"(",")":"(","[":"[","]":"[","{":"{","}":"{"}[c],k=a.getLine(h.line).charAt(h.ch),l=k===j?1:0;if(f=a.scanForBracket(d(h.line,h.ch+l),-1,null,{bracketRegex:i}),g=a.scanForBracket(d(h.line,h.ch+l),1,null,{bracketRegex:i}),!f||!g)return{start:h,end:h};if(f=f.pos,g=g.pos,f.line==g.line&&f.ch>g.ch||f.line>g.line){var m=f;f=g,g=m}return e?g.ch+=1:f.ch+=1,{start:f,end:g}}function ya(a,b,c,e){var f,g,h,i,j=R(b),k=a.getLine(j.line),l=k.split(""),m=l.indexOf(c);if(j.ch-1&&!f;h--)l[h]==c&&(f=h+1);else f=j.ch+1;if(f&&!g)for(h=f,i=l.length;i>h&&!g;h++)l[h]==c&&(g=h);return f&&g?(e&&(--f,++g),{start:d(j.line,f),end:d(j.line,g)}):{start:j,end:j}}function za(){}function Aa(a){var b=a.state.vim;return b.searchState_||(b.searchState_=new za)}function Ba(a,b,c,d,e){a.openDialog?a.openDialog(b,d,{bottom:!0,value:e.value,onKeyDown:e.onKeyDown,onKeyUp:e.onKeyUp,selectValueOnOpen:!1}):d(prompt(c,""))}function Ca(a){var b=Da(a)||[];if(!b.length)return[];var c=[];if(0===b[0]){for(var d=0;d'+b+"",{bottom:!0,duration:5e3}):alert(b)}function Ja(a,b){var c=''+(a||"")+'';return b&&(c+=' '+b+""),c}function Ka(a,b){var c=(b.prefix||"")+" "+(b.desc||""),d=Ja(b.prefix,b.desc);Ba(a,d,c,b.onClose,b)}function La(a,b){if(a instanceof RegExp&&b instanceof RegExp){for(var c=["global","multiline","ignoreCase","source"],d=0;dh;h++){var i=g.find(b);if(0==h&&i&&S(g.from(),f)&&(i=g.find(b)),!i&&(g=a.getSearchCursor(c,b?d(a.lastLine()):d(a.firstLine(),0)),!g.find(b)))return}return g.from()})}function Qa(a){var b=Aa(a);a.removeOverlay(Aa(a).getOverlay()),b.setOverlay(null),b.getScrollbarAnnotate()&&(b.getScrollbarAnnotate().clear(),b.setScrollbarAnnotate(null))}function Ra(a,b,c){return"number"!=typeof a&&(a=a.line),b instanceof Array?s(a,b):c?a>=b&&c>=a:a==b}function Sa(a){var b=a.getScrollInfo(),c=6,d=10,e=a.coordsChar({left:0,top:c+b.top},"local"),f=b.clientHeight-d+b.top,g=a.coordsChar({left:0,top:f},"local");return{top:e.line,bottom:g.line}}function Ta(b,c,d,e,f,g,h,i,j){function k(){b.operation(function(){for(;!p;)l(),m();n()})}function l(){var a=b.getRange(g.from(),g.to()),c=a.replace(h,i);g.replace(c)}function m(){for(;g.findNext()&&Ra(g.from(),e,f);)if(d||!q||g.from().line!=q.line)return b.scrollIntoView(g.from(),30),b.setSelection(g.from(),g.to()),q=g.from(),void(p=!1);p=!0}function n(a){if(a&&a(),b.focus(),q){b.setCursor(q);var c=b.state.vim;c.exMode=!1,c.lastHPos=c.lastHSPos=q.ch}j&&j()}function o(c,d,e){a.e_stop(c);var f=a.keyName(c);switch(f){case"Y":l(),m();break;case"N":m();break;case"A":var g=j;j=void 0,b.operation(k),j=g;break;case"L":l();case"Q":case"Esc":case"Ctrl-C":case"Ctrl-[":n(e)}return p&&n(e),!0}b.state.vim.exMode=!0;var p=!1,q=g.from();return m(),p?void Ia(b,"No matches for "+h.source):c?void Ka(b,{prefix:"replace with "+i+" (y/n/a/q/l)",onKeyDown:o}):(k(),void(j&&j()))}function Ua(b){var c=b.state.vim,d=ub.macroModeState,e=ub.registerController.getRegister("."),f=d.isPlaying,g=d.lastInsertModeChanges,h=[];if(!f){for(var i=g.inVisualBlock?c.lastSelection.visualBlock.height:1,j=g.changes,h=[],k=0;k1&&(fb(b,c,c.insertModeRepeat-1,!0),c.lastEditInputState.repeatOverride=c.insertModeRepeat),delete c.insertModeRepeat,c.insertMode=!1,b.setCursor(b.getCursor().line,b.getCursor().ch-1),b.setOption("keyMap","vim"),b.setOption("disableInput",!0),b.toggleOverwrite(!1),e.setText(g.changes.join("")),a.signal(b,"vim-mode-change",{mode:"normal"}),d.isRecording&&Za(d)}function Va(a){b.unshift(a)}function Wa(a,b,c,d,e){var f={keys:a,type:b};f[b]=c,f[b+"Args"]=d;for(var g in e)f[g]=e[g];Va(f)}function Xa(b,c,d,e){var f=ub.registerController.getRegister(e);if(":"==e)return f.keyBuffer[0]&&Ib.processCommand(b,f.keyBuffer[0]),void(d.isPlaying=!1);var g=f.keyBuffer,h=0;d.isPlaying=!0,d.replaySearchQueries=f.searchQueries.slice(0);for(var i=0;i|<\w+>|./.exec(l),k=j[0],l=l.substring(j.index+k.length),a.Vim.handleKey(b,k,"macro"),c.insertMode){var m=f.insertModeChanges[h++].changes;ub.macroModeState.lastInsertModeChanges.changes=m,gb(b,m,1),Ua(b)}d.isPlaying=!1}function Ya(a,b){if(!a.isPlaying){var c=a.latestRegister,d=ub.registerController.getRegister(c);d&&d.pushText(b)}}function Za(a){if(!a.isPlaying){var b=a.latestRegister,c=ub.registerController.getRegister(b);c&&c.pushInsertModeChanges&&c.pushInsertModeChanges(a.lastInsertModeChanges)}}function $a(a,b){if(!a.isPlaying){var c=a.latestRegister,d=ub.registerController.getRegister(c);d&&d.pushSearchQuery&&d.pushSearchQuery(b)}}function _a(a,b){var c=ub.macroModeState,d=c.lastInsertModeChanges;if(!c.isPlaying)for(;b;){if(d.expectCursorActivityForChange=!0,"+input"==b.origin||"paste"==b.origin||void 0===b.origin){var e=b.text.join("\n");d.changes.push(e)}b=b.next}}function ab(a){var b=a.state.vim;if(b.insertMode){var c=ub.macroModeState;if(c.isPlaying)return;var d=c.lastInsertModeChanges;d.expectCursorActivityForChange?d.expectCursorActivityForChange=!1:d.changes=[]}else a.curOp.isVimOp||cb(a,b);b.visualMode&&bb(a)}function bb(a){var b=a.state.vim,c=J(a,R(b.sel.head)),d=L(c,0,1);b.fakeCursor&&b.fakeCursor.clear(),b.fakeCursor=a.markText(c,d,{className:"cm-animate-fat-cursor"})}function cb(b,c){var d=b.getCursor("anchor"),e=b.getCursor("head");if(c.visualMode&&!b.somethingSelected()?ia(b,!1):c.visualMode||c.insertMode||!b.somethingSelected()||(c.visualMode=!0,c.visualLine=!1,a.signal(b,"vim-mode-change",{mode:"visual"})),c.visualMode){var f=T(e,d)?0:-1,g=T(e,d)?-1:0;e=L(e,0,f),d=L(d,0,g),c.sel={anchor:d,head:e},ua(b,c,"<",U(e,d)),ua(b,c,">",V(e,d))}else c.insertMode||(c.lastHPos=b.getCursor().ch)}function db(a){this.keyName=a}function eb(b){function c(){return e.changes.push(new db(f)),!0}var d=ub.macroModeState,e=d.lastInsertModeChanges,f=a.keyName(b);f&&(-1!=f.indexOf("Delete")||-1!=f.indexOf("Backspace"))&&a.lookupKey(f,"vim-insert",c)}function fb(a,b,c,d){function e(){h?xb.processAction(a,b,b.lastEditActionCommand):xb.evalInput(a,b)}function f(c){if(g.lastInsertModeChanges.changes.length>0){c=b.lastEditActionCommand?c:1;var d=g.lastInsertModeChanges;gb(a,d.changes,c)}}var g=ub.macroModeState;g.isPlaying=!0;var h=!!b.lastEditActionCommand,i=b.inputState;if(b.inputState=b.lastEditInputState,h&&b.lastEditActionCommand.interlaceInsertRepeat)for(var j=0;c>j;j++)e(),f(1);else d||e(),f(c);b.inputState=i,b.insertMode&&!d&&Ua(a),g.isPlaying=!1}function gb(b,c,d){function e(c){return"string"==typeof c?a.commands[c](b):c(b),!0}var f=b.getCursor("head"),g=ub.macroModeState.lastInsertModeChanges.inVisualBlock;if(g){var h=b.state.vim,i=h.lastSelection,j=M(i.anchor,i.head);aa(b,f,j.line+1),d=b.listSelections().length,b.setCursor(f)}for(var k=0;d>k;k++){g&&b.setCursor(L(f,k,0));for(var l=0;l"]),qb=[].concat(mb,nb,ob,["-",'"',".",":","/"]),rb={};t("filetype",void 0,"string",["ft"],function(a,b){if(void 0!==b){if(void 0===a){var c=b.getOption("mode");return"null"==c?"":c}var c=""==a?"null":a;b.setOption("mode",c)}});var sb=function(){function a(a,b,h){function i(b){var e=++d%c,f=g[e];f&&f.clear(),g[e]=a.setBookmark(b)}var j=d%c,k=g[j];if(k){var l=k.find();l&&!S(l,b)&&i(b)}else i(b);i(h),e=d,f=d-c+1,0>f&&(f=0)}function b(a,b){d+=b,d>e?d=e:f>d&&(d=f);var h=g[(c+d)%c];if(h&&!h.find()){var i,j=b>0?1:-1,k=a.getCursor();do if(d+=j,h=g[(c+d)%c],h&&(i=h.find())&&!S(k,i))break;while(e>d&&d>f)}return h}var c=100,d=-1,e=0,f=0,g=new Array(c);return{cachedCursor:void 0,add:a,move:b}},tb=function(a){return a?{changes:a.changes,expectCursorActivityForChange:a.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};w.prototype={exitMacroRecordMode:function(){var a=ub.macroModeState;a.onRecordingDone&&a.onRecordingDone(),a.onRecordingDone=void 0,a.isRecording=!1},enterMacroRecordMode:function(a,b){var c=ub.registerController.getRegister(b);c&&(c.clear(),this.latestRegister=b,a.openDialog&&(this.onRecordingDone=a.openDialog("(recording)["+b+"]",null,{bottom:!0})),this.isRecording=!0)}};var ub,vb,wb={buildKeyMap:function(){},getRegisterController:function(){return ub.registerController},resetVimGlobalState_:y,getVimGlobalState_:function(){return ub},maybeInitVimState_:x,suppressErrorLogging:!1,InsertModeKey:db,map:function(a,b,c){Ib.map(a,b,c)},unmap:function(a,b){Ib.unmap(a,b)},setOption:u,getOption:v,defineOption:t,defineEx:function(a,b,c){if(b){if(0!==a.indexOf(b))throw new Error('(Vim.defineEx) "'+b+'" is not a prefix of "'+a+'", command not registered')}else b=a;Hb[a]=c,Ib.commandMap_[b]={name:a,shortName:b,type:"api"}},handleKey:function(a,b,c){var d=this.findKey(a,b,c);return"function"==typeof d?d():void 0},findKey:function(c,d,e){function f(){var a=ub.macroModeState;if(a.isRecording){if("q"==d)return a.exitMacroRecordMode(),A(c),!0;"mapping"!=e&&Ya(a,d)}}function g(){return""==d?(A(c),l.visualMode?ia(c):l.insertMode&&Ua(c),!0):void 0}function h(b){for(var e;b;)e=/<\w+-.+?>|<\w+>|./.exec(b),d=e[0],b=b.substring(e.index+d.length),a.Vim.handleKey(c,d,"mapping")}function i(){if(g())return!0;for(var a=l.inputState.keyBuffer=l.inputState.keyBuffer+d,e=1==d.length,f=xb.matchCommand(a,b,l.inputState,"insert");a.length>1&&"full"!=f.type;){var a=l.inputState.keyBuffer=a.slice(1),h=xb.matchCommand(a,b,l.inputState,"insert");"none"!=h.type&&(f=h)}if("none"==f.type)return A(c),!1;if("partial"==f.type)return vb&&window.clearTimeout(vb),vb=window.setTimeout(function(){l.insertMode&&l.inputState.keyBuffer&&A(c)},v("insertModeEscKeysTimeout")),!e;if(vb&&window.clearTimeout(vb),e){var i=c.getCursor();c.replaceRange("",L(i,0,-(a.length-1)),i,"+input")}return A(c),f.command}function j(){if(f()||g())return!0;var a=l.inputState.keyBuffer=l.inputState.keyBuffer+d;if(/^[1-9]\d*$/.test(a))return!0;var e=/^(\d*)(.*)$/.exec(a);if(!e)return A(c),!1;var h=l.visualMode?"visual":"normal",i=xb.matchCommand(e[2]||e[1],b,l.inputState,h);if("none"==i.type)return A(c),!1;if("partial"==i.type)return!0;l.inputState.keyBuffer="";var e=/^(\d*)(.*)$/.exec(a);return e[1]&&"0"!=e[1]&&l.inputState.pushRepeatDigit(e[1]),i.command}var k,l=x(c);return k=l.insertMode?i():j(),k===!1?void 0:k===!0?function(){}:function(){return c.operation(function(){c.curOp.isVimOp=!0;try{"keyToKey"==k.type?h(k.toKeys):xb.processCommand(c,l,k)}catch(b){throw c.state.vim=void 0,x(c),a.Vim.suppressErrorLogging||console.log(b),b}return!0})}},handleEx:function(a,b){Ib.processCommand(a,b)},defineMotion:F,defineAction:I,defineOperator:H,mapCommand:Wa,_mapCommand:Va,defineRegister:C,exitVisualMode:ia,exitInsertMode:Ua};z.prototype.pushRepeatDigit=function(a){this.operator?this.motionRepeat=this.motionRepeat.concat(a):this.prefixRepeat=this.prefixRepeat.concat(a)},z.prototype.getRepeat=function(){var a=0;return(this.prefixRepeat.length>0||this.motionRepeat.length>0)&&(a=1,this.prefixRepeat.length>0&&(a*=parseInt(this.prefixRepeat.join(""),10)),this.motionRepeat.length>0&&(a*=parseInt(this.motionRepeat.join(""),10))),a},B.prototype={setText:function(a,b,c){this.keyBuffer=[a||""],this.linewise=!!b,this.blockwise=!!c},pushText:function(a,b){b&&(this.linewise||this.keyBuffer.push("\n"),this.linewise=!0),this.keyBuffer.push(a)},pushInsertModeChanges:function(a){this.insertModeChanges.push(tb(a))},pushSearchQuery:function(a){this.searchQueries.push(a)},clear:function(){this.keyBuffer=[],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!1},toString:function(){return this.keyBuffer.join("")}},D.prototype={pushText:function(a,b,c,d,e){d&&"\n"==c.charAt(0)&&(c=c.slice(1)+"\n"),d&&"\n"!==c.charAt(c.length-1)&&(c+="\n");var f=this.isValidRegister(a)?this.getRegister(a):null;if(!f){switch(b){case"yank":this.registers[0]=new B(c,d,e);break;case"delete":case"change":-1==c.indexOf("\n")?this.registers["-"]=new B(c,d):(this.shiftNumericRegisters_(),this.registers[1]=new B(c,d))}return void this.unnamedRegister.setText(c,d,e)}var g=q(a);g?f.pushText(c,d):f.setText(c,d,e),this.unnamedRegister.setText(f.toString(),d)},getRegister:function(a){return this.isValidRegister(a)?(a=a.toLowerCase(),this.registers[a]||(this.registers[a]=new B),this.registers[a]):this.unnamedRegister},isValidRegister:function(a){return a&&s(a,qb)},shiftNumericRegisters_:function(){for(var a=9;a>=2;a--)this.registers[a]=this.getRegister(""+(a-1))}},E.prototype={nextMatch:function(a,b){var c=this.historyBuffer,d=b?-1:1;null===this.initialPrefix&&(this.initialPrefix=a);for(var e=this.iterator+d;b?e>=0:e=c.length?(this.iterator=c.length,this.initialPrefix):0>e?a:void 0},pushInput:function(a){var b=this.historyBuffer.indexOf(a);b>-1&&this.historyBuffer.splice(b,1),a.length&&this.historyBuffer.push(a)},reset:function(){this.initialPrefix=null,this.iterator=this.historyBuffer.length}};var xb={matchCommand:function(a,b,c,d){var e=N(a,b,d,c);if(!e.full&&!e.partial)return{type:"none"};if(!e.full&&e.partial)return{type:"partial"};for(var f,g=0;g"==f.keys.slice(-11)&&(c.selectedCharacter=P(a)),{type:"full",command:f}},processCommand:function(a,b,c){switch(b.inputState.repeatOverride=c.repeatOverride,c.type){case"motion":this.processMotion(a,b,c);break;case"operator":this.processOperator(a,b,c);break;case"operatorMotion":this.processOperatorMotion(a,b,c);break;case"action":this.processAction(a,b,c);break;case"search":this.processSearch(a,b,c);break;case"ex":case"keyToEx":this.processEx(a,b,c)}},processMotion:function(a,b,c){b.inputState.motion=c.motion,b.inputState.motionArgs=K(c.motionArgs),this.evalInput(a,b)},processOperator:function(a,b,c){var d=b.inputState;if(d.operator){if(d.operator==c.operator)return d.motion="expandToLine",d.motionArgs={linewise:!0},void this.evalInput(a,b);A(a)}d.operator=c.operator,d.operatorArgs=K(c.operatorArgs),b.visualMode&&this.evalInput(a,b)},processOperatorMotion:function(a,b,c){var d=b.visualMode,e=K(c.operatorMotionArgs);e&&d&&e.visualLine&&(b.visualLine=!0),this.processOperator(a,b,c),d||this.processMotion(a,b,c)},processAction:function(a,b,c){var d=b.inputState,e=d.getRepeat(),f=!!e,g=K(c.actionArgs)||{};d.selectedCharacter&&(g.selectedCharacter=d.selectedCharacter),c.operator&&this.processOperator(a,b,c),c.motion&&this.processMotion(a,b,c),(c.motion||c.operator)&&this.evalInput(a,b),g.repeat=e||1,g.repeatIsExplicit=f,g.registerName=d.registerName,A(a),b.lastMotion=null,c.isEdit&&this.recordLastEdit(b,d,c),Ab[c.action](a,g,b)},processSearch:function(b,c,d){function e(a,e,f){ub.searchHistoryController.pushInput(a),ub.searchHistoryController.reset();try{Ma(b,a,e,f)}catch(g){return Ia(b,"Invalid regex: "+a),void A(b)}xb.processMotion(b,c,{type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:d.searchArgs.toJumplist}})}function f(a){b.scrollTo(m.left,m.top),e(a,!0,!0);var c=ub.macroModeState;c.isRecording&&$a(c,a)}function g(c,d,e){var f,g=a.keyName(c);"Up"==g||"Down"==g?(f="Up"==g?!0:!1,d=ub.searchHistoryController.nextMatch(d,f)||"",e(d)):"Left"!=g&&"Right"!=g&&"Ctrl"!=g&&"Alt"!=g&&"Shift"!=g&&ub.searchHistoryController.reset();var h;try{h=Ma(b,d,!0,!0)}catch(c){}h?b.scrollIntoView(Pa(b,!i,h),30):(Qa(b),b.scrollTo(m.left,m.top))}function h(c,d,e){var f=a.keyName(c);"Esc"==f||"Ctrl-C"==f||"Ctrl-["==f||"Backspace"==f&&""==d?(ub.searchHistoryController.pushInput(d),ub.searchHistoryController.reset(),Ma(b,l),Qa(b),b.scrollTo(m.left,m.top),a.e_stop(c),A(b),e(),b.focus()):"Ctrl-U"==f&&(a.e_stop(c),e(""))}if(b.getSearchCursor){var i=d.searchArgs.forward,j=d.searchArgs.wholeWordOnly;Aa(b).setReversed(!i);var k=i?"/":"?",l=Aa(b).getQuery(),m=b.getScrollInfo();switch(d.searchArgs.querySrc){case"prompt":var n=ub.macroModeState;if(n.isPlaying){var o=n.replaySearchQueries.shift();e(o,!0,!1)}else Ka(b,{onClose:f,prefix:k,desc:Fb,onKeyUp:g,onKeyDown:h});break;case"wordUnderCursor":var p=ma(b,!1,!0,!1,!0),q=!0;if(p||(p=ma(b,!1,!0,!1,!1),q=!1),!p)return;var o=b.getLine(p.start.line).substring(p.start.ch,p.end.ch);o=q&&j?"\\b"+o+"\\b":Z(o),ub.jumpList.cachedCursor=b.getCursor(),b.setCursor(p.start),e(o,!0,!1)}}},processEx:function(b,c,d){function e(a){ub.exCommandHistoryController.pushInput(a),ub.exCommandHistoryController.reset(),Ib.processCommand(b,a)}function f(c,d,e){var f,g=a.keyName(c);("Esc"==g||"Ctrl-C"==g||"Ctrl-["==g||"Backspace"==g&&""==d)&&(ub.exCommandHistoryController.pushInput(d),ub.exCommandHistoryController.reset(),a.e_stop(c),A(b),e(),b.focus()),"Up"==g||"Down"==g?(f="Up"==g?!0:!1,d=ub.exCommandHistoryController.nextMatch(d,f)||"",e(d)):"Ctrl-U"==g?(a.e_stop(c),e("")):"Left"!=g&&"Right"!=g&&"Ctrl"!=g&&"Alt"!=g&&"Shift"!=g&&ub.exCommandHistoryController.reset()}"keyToEx"==d.type?Ib.processCommand(b,d.exArgs.input):c.visualMode?Ka(b,{onClose:e,prefix:":",value:"'<,'>",onKeyDown:f}):Ka(b,{onClose:e,prefix:":",onKeyDown:f})},evalInput:function(a,b){var c,e,f,g=b.inputState,h=g.motion,i=g.motionArgs||{},j=g.operator,k=g.operatorArgs||{},l=g.registerName,m=b.sel,n=R(b.visualMode?J(a,m.head):a.getCursor("head")),o=R(b.visualMode?J(a,m.anchor):a.getCursor("anchor")),p=R(n),q=R(o);if(j&&this.recordLastEdit(b,g),f=void 0!==g.repeatOverride?g.repeatOverride:g.getRepeat(),f>0&&i.explicitRepeat?i.repeatIsExplicit=!0:(i.noRepeat||!i.explicitRepeat&&0===f)&&(f=1,i.repeatIsExplicit=!1),g.selectedCharacter&&(i.selectedCharacter=k.selectedCharacter=g.selectedCharacter),i.repeat=f,A(a),h){var r=yb[h](a,n,i,b);if(b.lastMotion=yb[h],!r)return;if(i.toJumplist){var s=ub.jumpList,t=s.cachedCursor;t?(na(a,t,r),delete s.cachedCursor):na(a,n,r)}r instanceof Array?(e=r[0],c=r[1]):c=r,c||(c=R(n)),b.visualMode?(b.visualBlock&&c.ch===1/0||(c=J(a,c,b.visualBlock)),e&&(e=J(a,e,!0)),e=e||q,m.anchor=e,m.head=c,fa(a),ua(a,b,"<",T(e,c)?e:c),ua(a,b,">",T(e,c)?c:e)):j||(c=J(a,c),a.setCursor(c.line,c.ch))}if(j){if(k.lastSel){e=q;var u=k.lastSel,v=Math.abs(u.head.line-u.anchor.line),w=Math.abs(u.head.ch-u.anchor.ch);c=u.visualLine?d(q.line+v,q.ch):u.visualBlock?d(q.line+v,q.ch+w):u.head.line==u.anchor.line?d(q.line,q.ch+w):d(q.line+v,q.ch),b.visualMode=!0,b.visualLine=u.visualLine,b.visualBlock=u.visualBlock,m=b.sel={anchor:e,head:c},fa(a)}else b.visualMode&&(k.lastSel={anchor:R(m.anchor),head:R(m.head),visualBlock:b.visualBlock,visualLine:b.visualLine});var x,y,z,B,C;if(b.visualMode){if(x=U(m.head,m.anchor),y=V(m.head,m.anchor),z=b.visualLine||k.linewise,B=b.visualBlock?"block":z?"line":"char",C=ga(a,{anchor:x,head:y},B),z){var D=C.ranges;if("block"==B)for(var E=0;Ei&&f.line==j?this.moveToStartOfLine(a,b,c,e):i>k&&f.line==k?this.moveToEol(a,b,c,e):(c.toFirstChar&&(g=la(a.getLine(i)),e.lastHPos=g),e.lastHSPos=a.charCoords(d(i,g),"div").left,d(i,g))},moveByDisplayLines:function(a,b,c,e){var f=b;switch(e.lastMotion){case this.moveByDisplayLines:case this.moveByScroll:case this.moveByLines:case this.moveToColumn:case this.moveToEol:break;default:e.lastHSPos=a.charCoords(f,"div").left}var g=c.repeat,h=a.findPosV(f,c.forward?g:-g,"line",e.lastHSPos);if(h.hitSide)if(c.forward)var i=a.charCoords(h,"div"),j={top:i.top+8,left:e.lastHSPos},h=a.coordsChar(j,"div");else{var k=a.charCoords(d(a.firstLine(),0),"div");k.left=e.lastHSPos,h=a.coordsChar(k,"div")}return e.lastHPos=h.ch,h},moveByPage:function(a,b,c){var d=b,e=c.repeat;return a.findPosV(d,c.forward?e:-e,"page")},moveByParagraph:function(a,b,c){var d=c.forward?1:-1;return wa(a,b,c.repeat,d)},moveByScroll:function(a,b,c,d){var e=a.getScrollInfo(),f=null,g=c.repeat;g||(g=e.clientHeight/(2*a.defaultTextHeight()));var h=a.charCoords(b,"local");c.repeat=g;var f=yb.moveByDisplayLines(a,b,c,d);if(!f)return null;var i=a.charCoords(f,"local");return a.scrollTo(null,e.top+i.top-h.top),f},moveByWords:function(a,b,c){return ra(a,b,c.repeat,!!c.forward,!!c.wordEnd,!!c.bigWord)},moveTillCharacter:function(a,b,c){var d=c.repeat,e=sa(a,d,c.forward,c.selectedCharacter),f=c.forward?-1:1;return oa(f,c),e?(e.ch+=f,e):null},moveToCharacter:function(a,b,c){var d=c.repeat;return oa(0,c),sa(a,d,c.forward,c.selectedCharacter)||b},moveToSymbol:function(a,b,c){var d=c.repeat;return pa(a,d,c.forward,c.selectedCharacter)||b},moveToColumn:function(a,b,c,d){var e=c.repeat;return d.lastHPos=e-1,d.lastHSPos=a.charCoords(b,"div").left,ta(a,e)},moveToEol:function(a,b,c,e){var f=b;e.lastHPos=1/0;var g=d(f.line+c.repeat-1,1/0),h=a.clipPos(g);return h.ch--,e.lastHSPos=a.charCoords(h,"div").left,g},moveToFirstNonWhiteSpaceCharacter:function(a,b){var c=b;return d(c.line,la(a.getLine(c.line)))},moveToMatchedSymbol:function(a,b){var c,e=b,f=e.line,g=e.ch,h=a.getLine(f);do if(c=h.charAt(g++),c&&o(c)){var i=a.getTokenTypeAt(d(f,g));if("string"!==i&&"comment"!==i)break}while(c);if(c){var j=a.findMatchingBracket(d(f,g));return j.to}return e},moveToStartOfLine:function(a,b){return d(b.line,0)},moveToLineOrEdgeOfDocument:function(a,b,c){var e=c.forward?a.lastLine():a.firstLine();return c.repeatIsExplicit&&(e=c.repeat-a.getOption("firstLineNumber")),d(e,la(a.getLine(e)))},textObjectManipulation:function(a,b,c,d){var e={"(":")",")":"(","{":"}","}":"{","[":"]","]":"["},f={"'":!0,'"':!0},g=c.selectedCharacter;"b"==g?g="(":"B"==g&&(g="{");var h,i=!c.textObjectInner;if(e[g])h=xa(a,b,g,i);else if(f[g])h=ya(a,b,g,i);else if("W"===g)h=ma(a,i,!0,!0);else if("w"===g)h=ma(a,i,!0,!1);else{if("p"!==g)return null;if(h=wa(a,b,c.repeat,0,i),c.linewise=!0,d.visualMode)d.visualLine||(d.visualLine=!0);else{var j=d.inputState.operatorArgs;j&&(j.linewise=!0),h.end.line--}}return a.state.vim.visualMode?ea(a,h.start,h.end):[h.start,h.end]},repeatLastCharacterSearch:function(a,b,c){var d=ub.lastCharacterSearch,e=c.repeat,f=c.forward===d.forward,g=(d.increment?1:0)*(f?-1:1);a.moveH(-g,"char"),c.inclusive=f?!0:!1;var h=sa(a,e,f,d.selectedCharacter);return h?(h.ch+=g,h):(a.moveH(g,"char"),b)}},zb={change:function(b,c,e){var f,g,h=b.state.vim;if(ub.macroModeState.lastInsertModeChanges.inVisualBlock=h.visualBlock,h.visualMode){g=b.getSelection();var i=G("",e.length);b.replaceSelections(i),f=U(e[0].head,e[0].anchor)}else{var j=e[0].anchor,k=e[0].head;g=b.getRange(j,k);var l=h.lastEditInputState||{};if("moveByWords"==l.motion&&!r(g)){var m=/\s+$/.exec(g);m&&l.motionArgs&&l.motionArgs.forward&&(k=L(k,0,-m[0].length),g=g.slice(0,-m[0].length))}var n=new d(j.line-1,Number.MAX_VALUE),o=b.firstLine()==b.lastLine();k.line>b.lastLine()&&c.linewise&&!o?b.replaceRange("",n,k):b.replaceRange("",j,k),c.linewise&&(o||(b.setCursor(n),a.commands.newlineAndIndent(b)),j.ch=Number.MAX_VALUE),f=j}ub.registerController.pushText(c.registerName,"change",g,c.linewise,e.length>1),Ab.enterInsertMode(b,{head:f},b.state.vim)},"delete":function(a,b,c){var e,f,g=a.state.vim;if(g.visualBlock){f=a.getSelection();var h=G("",c.length);a.replaceSelections(h),e=c[0].anchor}else{var i=c[0].anchor,j=c[0].head;b.linewise&&j.line!=a.firstLine()&&i.line==a.lastLine()&&i.line==j.line-1&&(i.line==a.firstLine()?i.ch=0:i=d(i.line-1,X(a,i.line-1))),f=a.getRange(i,j),a.replaceRange("",i,j),e=i,b.linewise&&(e=yb.moveToFirstNonWhiteSpaceCharacter(a,i))}return ub.registerController.pushText(b.registerName,"delete",f,b.linewise,g.visualBlock),J(a,e)},indent:function(a,b,c){var d=a.state.vim,e=c[0].anchor.line,f=d.visualBlock?c[c.length-1].anchor.line:c[0].head.line,g=d.visualMode?b.repeat:1;b.linewise&&f--;for(var h=e;f>=h;h++)for(var i=0;g>i;i++)a.indentLine(h,b.indentRight);return yb.moveToFirstNonWhiteSpaceCharacter(a,c[0].anchor)},changeCase:function(a,b,c,d,e){for(var f=a.getSelections(),g=[],h=b.toLower,i=0;ij.top?(i.line+=(h-j.top)/e,i.line=Math.ceil(i.line),a.setCursor(i),j=a.charCoords(i,"local"),a.scrollTo(null,j.top)):a.scrollTo(null,h);else{var k=h+a.getScrollInfo().clientHeight;k=g.anchor.line?L(g.head,0,1):d(g.anchor.line,0);else if("inplace"==f&&e.visualMode)return;b.setOption("keyMap","vim-insert"),b.setOption("disableInput",!1),c&&c.replace?(b.toggleOverwrite(!0),b.setOption("keyMap","vim-replace"),a.signal(b,"vim-mode-change",{mode:"replace"})):(b.setOption("keyMap","vim-insert"),a.signal(b,"vim-mode-change",{mode:"insert"})),ub.macroModeState.isPlaying||(b.on("change",_a),a.on(b.getInputField(),"keydown",eb)),e.visualMode&&ia(b),aa(b,h,i)}},toggleVisualMode:function(b,c,e){var f,g=c.repeat,h=b.getCursor();e.visualMode?e.visualLine^c.linewise||e.visualBlock^c.blockwise?(e.visualLine=!!c.linewise,e.visualBlock=!!c.blockwise,a.signal(b,"vim-mode-change",{mode:"visual",subMode:e.visualLine?"linewise":e.visualBlock?"blockwise":""}),fa(b)):ia(b):(e.visualMode=!0,e.visualLine=!!c.linewise,e.visualBlock=!!c.blockwise,f=J(b,d(h.line,h.ch+g-1),!0),e.sel={anchor:h,head:f},a.signal(b,"vim-mode-change",{mode:"visual",subMode:e.visualLine?"linewise":e.visualBlock?"blockwise":""}),fa(b),ua(b,e,"<",U(h,f)),ua(b,e,">",V(h,f)))},reselectLastSelection:function(b,c,d){var e=d.lastSelection;if(d.visualMode&&da(b,d),e){var f=e.anchorMark.find(),g=e.headMark.find();if(!f||!g)return;d.sel={anchor:f,head:g},d.visualMode=!0,d.visualLine=e.visualLine,d.visualBlock=e.visualBlock,fa(b),ua(b,d,"<",U(f,g)),ua(b,d,">",V(f,g)),a.signal(b,"vim-mode-change",{mode:"visual",subMode:d.visualLine?"linewise":d.visualBlock?"blockwise":""})}},joinLines:function(a,b,c){var e,f;if(c.visualMode){if(e=a.getCursor("anchor"),f=a.getCursor("head"),T(f,e)){var g=f;f=e,e=g}f.ch=X(a,f.line)-1}else{var h=Math.max(b.repeat,2);e=a.getCursor(),f=J(a,d(e.line+h-1,1/0))}for(var i=0,j=e.line;jc)return"";if(a.getOption("indentWithTabs")){var d=Math.floor(c/h);return Array(d+1).join(" ")}return Array(c+1).join(" ")});g+=m?"\n":""}if(b.repeat>1)var g=Array(b.repeat+1).join(g);var o=f.linewise,p=f.blockwise;if(o)c.visualMode?g=c.visualLine?g.slice(0,-1):"\n"+g.slice(0,g.length-1)+"\n":b.after?(g="\n"+g.slice(0,g.length-1),e.ch=X(a,e.line)):e.ch=0;else{if(p){g=g.split("\n");for(var q=0;qa.lastLine()&&a.replaceRange("\n",d(A,0));var B=X(a,A);Bk.length&&(f=k.length),g=d(i.line,f)}if("\n"==h)e.visualMode||b.replaceRange("",i,g),(a.commands.newlineAndIndentContinueComment||a.commands.newlineAndIndent)(b);else{var l=b.getRange(i,g);if(l=l.replace(/[^\n]/g,h),e.visualBlock){var m=new Array(b.getOption("tabSize")+1).join(" ");l=b.getSelection(),l=l.replace(/\t/g,m).replace(/[^\n]/g,h).split("\n"),b.replaceSelections(l)}else b.replaceRange(l,i,g);e.visualMode?(i=T(j[0].anchor,j[0].head)?j[0].anchor:j[0].head,b.setCursor(i),ia(b,!1)):b.setCursor(L(g,0,-1))}},incrementNumberToken:function(a,b){for(var c,e,f,g,h,i=a.getCursor(),j=a.getLine(i.line),k=/-?\d+/g;null!==(c=k.exec(j))&&(h=c[0],e=c.index,f=e+h.length,!(i.ch=1)return!0}else a.nextCh===a.reverseSymb&&a.depth--;return!1}},section:{init:function(a){a.curMoveThrough=!0,a.symb=(a.forward?"]":"[")===a.symb?"{":"}"},isComplete:function(a){return 0===a.index&&a.nextCh===a.symb}},comment:{isComplete:function(a){var b="*"===a.lastCh&&"/"===a.nextCh;return a.lastCh=a.nextCh,b}},method:{init:function(a){a.symb="m"===a.symb?"{":"}",a.reverseSymb="{"===a.symb?"}":"{"},isComplete:function(a){return a.nextCh===a.symb?!0:!1}},preprocess:{init:function(a){a.index=0},isComplete:function(a){if("#"===a.nextCh){var b=a.lineText.match(/#(\w+)/)[1];if("endif"===b){if(a.forward&&0===a.depth)return!0;a.depth++}else if("if"===b){if(!a.forward&&0===a.depth)return!0;a.depth--}if("else"===b&&0===a.depth)return!0}return!1}}};t("pcre",!0,"boolean"),za.prototype={getQuery:function(){return ub.query},setQuery:function(a){ub.query=a},getOverlay:function(){return this.searchOverlay},setOverlay:function(a){this.searchOverlay=a},isReversed:function(){return ub.isReversed},setReversed:function(a){ub.isReversed=a},getScrollbarAnnotate:function(){return this.annotate},setScrollbarAnnotate:function(a){this.annotate=a}};var Db={"\\n":"\n","\\r":"\r","\\t":" "},Eb={"\\/":"/","\\\\":"\\","\\n":"\n","\\r":"\r","\\t":" "},Fb="(Javascript regexp)",Gb=function(){this.buildCommandMap_()};Gb.prototype={processCommand:function(a,b,c){var d=this;a.operation(function(){a.curOp.isVimOp=!0,d._processCommand(a,b,c)})},_processCommand:function(b,c,d){var e=b.state.vim,f=ub.registerController.getRegister(":"),g=f.toString();e.visualMode&&ia(b);var h=new a.StringStream(c);f.setText(c);var i=d||{};i.input=c;try{this.parseInput_(b,h,i)}catch(j){throw Ia(b,j),j}var k,l;if(i.commandName){if(k=this.matchCommand_(i.commandName)){if(l=k.name,k.excludeFromCommandHistory&&f.setText(g),this.parseCommandArgs_(h,i,k),"exToKey"==k.type){for(var m=0;m0;b--){var c=a.substring(0,b);if(this.commandMap_[c]){var d=this.commandMap_[c];if(0===d.name.indexOf(a))return d}}return null},buildCommandMap_:function(){this.commandMap_={};for(var a=0;a
";if(c){var f;c=c.join("");for(var g=0;g"}}else for(var f in d){var i=d[f].toString();i.length&&(e+='"'+f+" "+i+"
")}Ia(a,e)},sort:function(b,c){function e(){if(c.argString){var b=new a.StringStream(c.argString);if(b.eat("!")&&(g=!0),b.eol())return;if(!b.eatSpace())return"Invalid arguments";var d=b.match(/[a-z]+/);if(d){d=d[0],h=-1!=d.indexOf("i"),i=-1!=d.indexOf("u");var e=-1!=d.indexOf("d")&&1,f=-1!=d.indexOf("x")&&1,k=-1!=d.indexOf("o")&&1;if(e+f+k>1)return"Invalid arguments";j=e&&"decimal"||f&&"hex"||k&&"octal"}if(b.match(/\/.*\//))return"patterns not supported"}}function f(a,b){if(g){var c;c=a,a=b,b=c}h&&(a=a.toLowerCase(),b=b.toLowerCase());var d=j&&q.exec(a),e=j&&q.exec(b);return d?(d=parseInt((d[1]+d[2]).toLowerCase(),r),e=parseInt((e[1]+e[2]).toLowerCase(),r),d-e):b>a?-1:1}var g,h,i,j,k=e();if(k)return void Ia(b,k+": "+c.argString);var l=c.line||b.firstLine(),m=c.lineEnd||c.line||b.lastLine();if(l!=m){var n=d(l,0),o=d(m,X(b,m)),p=b.getRange(n,o).split("\n"),q="decimal"==j?/(-?)([\d]+)/:"hex"==j?/(-?)(?:0x)?([0-9a-f]+)/i:"octal"==j?/([0-7]+)/:null,r="decimal"==j?10:"hex"==j?16:"octal"==j?8:null,s=[],t=[];if(j)for(var u=0;u=m;m++){var n=j.test(a.getLine(m));n&&(k.push(m+1),l+=a.getLine(m)+"
")}if(!d)return void Ia(a,l);var o=0,p=function(){if(o=k)return void Ia(b,"Invalid argument: "+c.argString.substring(f));for(var l=0;k-j>=l;l++){var m=String.fromCharCode(j+l);delete d.marks[m]}}else delete d.marks[g]}}},Ib=new Gb;return a.keyMap.vim={attach:h,detach:g,call:i},t("insertModeEscKeysTimeout",200,"number"),a.keyMap["vim-insert"]={"Ctrl-N":"autocomplete","Ctrl-P":"autocomplete",Enter:function(b){var c=a.commands.newlineAndIndentContinueComment||a.commands.newlineAndIndent;c(b)},fallthrough:["default"],attach:h,detach:g,call:i},a.keyMap["vim-replace"]={Backspace:"goCharLeft",fallthrough:["vim-insert"],attach:h,detach:g,call:i},y(),wb};a.Vim=e()}); \ No newline at end of file diff --git a/media/editors/codemirror/lib/codemirror.css b/media/editors/codemirror/lib/codemirror.css index 4bd815eb54a0a..18b0bf70dbf23 100644 --- a/media/editors/codemirror/lib/codemirror.css +++ b/media/editors/codemirror/lib/codemirror.css @@ -88,8 +88,14 @@ .cm-tab { display: inline-block; text-decoration: inherit; } +.CodeMirror-rulers { + position: absolute; + left: 0; right: 0; top: -50px; bottom: -20px; + overflow: hidden; +} .CodeMirror-ruler { border-left: 1px solid #ccc; + top: 0; bottom: 0; position: absolute; } @@ -291,7 +297,10 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;} visibility: hidden; } -.CodeMirror-cursor { position: absolute; } +.CodeMirror-cursor { + position: absolute; + pointer-events: none; +} .CodeMirror-measure pre { position: static; } div.CodeMirror-cursors { diff --git a/media/editors/codemirror/lib/codemirror.js b/media/editors/codemirror/lib/codemirror.js index 5439299b3979e..7dc842d3baea6 100644 --- a/media/editors/codemirror/lib/codemirror.js +++ b/media/editors/codemirror/lib/codemirror.js @@ -2933,10 +2933,23 @@ for (;;) { if (bidi ? to == from || to == moveVisually(lineObj, from, 1) : to - from <= 1) { var ch = x < fromX || x - fromX <= toX - x ? from : to; + var outside = ch == from ? fromOutside : toOutside var xDiff = x - (ch == from ? fromX : toX); + // This is a kludge to handle the case where the coordinates + // are after a line-wrapped line. We should replace it with a + // more general handling of cursor positions around line + // breaks. (Issue #4078) + if (toOutside && !bidi && !/\s/.test(lineObj.text.charAt(ch)) && xDiff > 0 && + ch < lineObj.text.length && preparedMeasure.view.measure.heights.length > 1) { + var charSize = measureCharPrepared(cm, preparedMeasure, ch, "right"); + if (innerOff <= charSize.bottom && innerOff >= charSize.top && Math.abs(x - charSize.right) < xDiff) { + outside = false + ch++ + xDiff = x - charSize.right + } + } while (isExtendingChar(lineObj.text.charAt(ch))) ++ch; - var pos = PosWithInfo(lineNo, ch, ch == from ? fromOutside : toOutside, - xDiff < -1 ? -1 : xDiff > 1 ? 1 : 0); + var pos = PosWithInfo(lineNo, ch, outside, xDiff < -1 ? -1 : xDiff > 1 ? 1 : 0); return pos; } var step = Math.ceil(dist / 2), middle = from + step; @@ -3660,6 +3673,7 @@ // Let the drag handler handle this. if (webkit) display.scroller.draggable = true; cm.state.draggingText = dragEnd; + dragEnd.copy = mac ? e.altKey : e.ctrlKey // IE's approach to draggable if (display.scroller.dragDrop) display.scroller.dragDrop(); on(document, "mouseup", dragEnd); @@ -3890,7 +3904,7 @@ try { var text = e.dataTransfer.getData("Text"); if (text) { - if (cm.state.draggingText && !(mac ? e.altKey : e.ctrlKey)) + if (cm.state.draggingText && !cm.state.draggingText.copy) var selected = cm.listSelections(); setSelectionNoUndo(cm.doc, simpleSelection(pos, pos)); if (selected) for (var i = 0; i < selected.length; ++i) @@ -8902,7 +8916,7 @@ // THE END - CodeMirror.version = "5.15.2"; + CodeMirror.version = "5.16.0"; return CodeMirror; }); diff --git a/media/editors/codemirror/lib/codemirror.min.css b/media/editors/codemirror/lib/codemirror.min.css index 270da7b725f77..b43f11dccca6f 100644 --- a/media/editors/codemirror/lib/codemirror.min.css +++ b/media/editors/codemirror/lib/codemirror.min.css @@ -1 +1 @@ -.CodeMirror{font-family:monospace;height:300px;color:#000}.CodeMirror-lines{padding:4px 0}.CodeMirror pre{padding:0 4px}.CodeMirror-gutter-filler,.CodeMirror-scrollbar-filler{background-color:#fff}.CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999;white-space:nowrap}.CodeMirror-guttermarker{color:#000}.CodeMirror-guttermarker-subtle{color:#999}.CodeMirror-cursor{border-left:1px solid #000;border-right:none;width:0}.CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}.cm-fat-cursor .CodeMirror-cursor{width:auto;border:0!important;background:#7e7}.cm-fat-cursor div.CodeMirror-cursors{z-index:1}.cm-animate-fat-cursor{width:auto;border:0;-webkit-animation:blink 1.06s steps(1)infinite;-moz-animation:blink 1.06s steps(1)infinite;animation:blink 1.06s steps(1)infinite;background-color:#7e7}@-moz-keyframes blink{50%{background-color:transparent}}@-webkit-keyframes blink{50%{background-color:transparent}}@keyframes blink{50%{background-color:transparent}}.cm-tab{display:inline-block;text-decoration:inherit}.CodeMirror-ruler{border-left:1px solid #ccc;position:absolute}.cm-s-default .cm-header{color:#00f}.cm-s-default .cm-quote{color:#090}.cm-negative{color:#d44}.cm-positive{color:#292}.cm-header,.cm-strong{font-weight:700}.cm-em{font-style:italic}.cm-link{text-decoration:underline}.cm-strikethrough{text-decoration:line-through}.cm-s-default .cm-keyword{color:#708}.cm-s-default .cm-atom{color:#219}.cm-s-default .cm-number{color:#164}.cm-s-default .cm-def{color:#00f}.cm-s-default .cm-variable-2{color:#05a}.cm-s-default .cm-variable-3{color:#085}.cm-s-default .cm-comment{color:#a50}.cm-s-default .cm-string{color:#a11}.cm-s-default .cm-string-2{color:#f50}.cm-s-default .cm-meta,.cm-s-default .cm-qualifier{color:#555}.cm-s-default .cm-builtin{color:#30a}.cm-s-default .cm-bracket{color:#997}.cm-s-default .cm-tag{color:#170}.cm-s-default .cm-attribute{color:#00c}.cm-s-default .cm-hr{color:#999}.cm-s-default .cm-link{color:#00c}.cm-invalidchar,.cm-s-default .cm-error{color:red}.CodeMirror-composing{border-bottom:2px solid}div.CodeMirror span.CodeMirror-matchingbracket{color:#0f0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#f22}.CodeMirror-matchingtag{background:rgba(255,150,0,.3)}.CodeMirror-activeline-background{background:#e8f2ff}.CodeMirror{position:relative;overflow:hidden;background:#fff}.CodeMirror-scroll{overflow:scroll!important;margin-bottom:-30px;margin-right:-30px;padding-bottom:30px;height:100%;outline:0;position:relative}.CodeMirror-sizer{position:relative;border-right:30px solid transparent}.CodeMirror-gutter-filler,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-vscrollbar{position:absolute;z-index:6;display:none}.CodeMirror-vscrollbar{right:0;top:0;overflow-x:hidden;overflow-y:scroll}.CodeMirror-hscrollbar{bottom:0;left:0;overflow-y:hidden;overflow-x:scroll}.CodeMirror-scrollbar-filler{right:0;bottom:0}.CodeMirror-gutter-filler{left:0;bottom:0}.CodeMirror-gutters{position:absolute;left:0;top:0;min-height:100%;z-index:3}.CodeMirror-gutter{white-space:normal;height:100%;display:inline-block;vertical-align:top;margin-bottom:-30px}.CodeMirror-gutter-wrapper{position:absolute;z-index:4;background:0 0!important;border:none!important;-webkit-user-select:none;-moz-user-select:none;user-select:none}.CodeMirror-gutter-background{position:absolute;top:0;bottom:0;z-index:4}.CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.CodeMirror-lines{cursor:text;min-height:1px}.CodeMirror pre{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0;border-width:0;background:0 0;font-family:inherit;font-size:inherit;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;z-index:2;position:relative;overflow:visible;-webkit-tap-highlight-color:transparent;-webkit-font-variant-ligatures:none;font-variant-ligatures:none}.CodeMirror-wrap pre{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.CodeMirror-linebackground{position:absolute;left:0;right:0;top:0;bottom:0;z-index:0}.CodeMirror-linewidget{position:relative;z-index:2;overflow:auto}.CodeMirror-code{outline:0}.CodeMirror-gutter,.CodeMirror-gutters,.CodeMirror-linenumber,.CodeMirror-scroll,.CodeMirror-sizer{-moz-box-sizing:content-box;box-sizing:content-box}.CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}.CodeMirror-cursor{position:absolute}.CodeMirror-measure pre{position:static}div.CodeMirror-cursors{visibility:hidden;position:relative;z-index:3}.CodeMirror-focused div.CodeMirror-cursors,div.CodeMirror-dragcursors{visibility:visible}.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused .CodeMirror-selected,.CodeMirror-line::selection,.CodeMirror-line>span::selection,.CodeMirror-line>span>span::selection{background:#d7d4f0}.CodeMirror-crosshair{cursor:crosshair}.CodeMirror-line::-moz-selection,.CodeMirror-line>span::-moz-selection,.CodeMirror-line>span>span::-moz-selection{background:#d7d4f0}.cm-searching{background:#ffa;background:rgba(255,255,0,.4)}.cm-force-border{padding-right:.1px}@media print{.CodeMirror div.CodeMirror-cursors{visibility:hidden}}.cm-tab-wrap-hack:after{content:''}span.CodeMirror-selectedtext{background:0 0} \ No newline at end of file +.CodeMirror{font-family:monospace;height:300px;color:#000}.CodeMirror-lines{padding:4px 0}.CodeMirror pre{padding:0 4px}.CodeMirror-gutter-filler,.CodeMirror-scrollbar-filler{background-color:#fff}.CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999;white-space:nowrap}.CodeMirror-guttermarker{color:#000}.CodeMirror-guttermarker-subtle{color:#999}.CodeMirror-cursor{border-left:1px solid #000;border-right:none;width:0}.CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}.cm-fat-cursor .CodeMirror-cursor{width:auto;border:0!important;background:#7e7}.cm-fat-cursor div.CodeMirror-cursors{z-index:1}.cm-animate-fat-cursor{width:auto;border:0;-webkit-animation:blink 1.06s steps(1)infinite;-moz-animation:blink 1.06s steps(1)infinite;animation:blink 1.06s steps(1)infinite;background-color:#7e7}@-moz-keyframes blink{50%{background-color:transparent}}@-webkit-keyframes blink{50%{background-color:transparent}}@keyframes blink{50%{background-color:transparent}}.cm-tab{display:inline-block;text-decoration:inherit}.CodeMirror-rulers{position:absolute;left:0;right:0;top:-50px;bottom:-20px;overflow:hidden}.CodeMirror-ruler{border-left:1px solid #ccc;top:0;bottom:0;position:absolute}.cm-s-default .cm-header{color:#00f}.cm-s-default .cm-quote{color:#090}.cm-negative{color:#d44}.cm-positive{color:#292}.cm-header,.cm-strong{font-weight:700}.cm-em{font-style:italic}.cm-link{text-decoration:underline}.cm-strikethrough{text-decoration:line-through}.cm-s-default .cm-keyword{color:#708}.cm-s-default .cm-atom{color:#219}.cm-s-default .cm-number{color:#164}.cm-s-default .cm-def{color:#00f}.cm-s-default .cm-variable-2{color:#05a}.cm-s-default .cm-variable-3{color:#085}.cm-s-default .cm-comment{color:#a50}.cm-s-default .cm-string{color:#a11}.cm-s-default .cm-string-2{color:#f50}.cm-s-default .cm-meta,.cm-s-default .cm-qualifier{color:#555}.cm-s-default .cm-builtin{color:#30a}.cm-s-default .cm-bracket{color:#997}.cm-s-default .cm-tag{color:#170}.cm-s-default .cm-attribute{color:#00c}.cm-s-default .cm-hr{color:#999}.cm-s-default .cm-link{color:#00c}.cm-invalidchar,.cm-s-default .cm-error{color:red}.CodeMirror-composing{border-bottom:2px solid}div.CodeMirror span.CodeMirror-matchingbracket{color:#0f0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#f22}.CodeMirror-matchingtag{background:rgba(255,150,0,.3)}.CodeMirror-activeline-background{background:#e8f2ff}.CodeMirror{position:relative;overflow:hidden;background:#fff}.CodeMirror-scroll{overflow:scroll!important;margin-bottom:-30px;margin-right:-30px;padding-bottom:30px;height:100%;outline:0;position:relative}.CodeMirror-sizer{position:relative;border-right:30px solid transparent}.CodeMirror-gutter-filler,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-vscrollbar{position:absolute;z-index:6;display:none}.CodeMirror-vscrollbar{right:0;top:0;overflow-x:hidden;overflow-y:scroll}.CodeMirror-hscrollbar{bottom:0;left:0;overflow-y:hidden;overflow-x:scroll}.CodeMirror-scrollbar-filler{right:0;bottom:0}.CodeMirror-gutter-filler{left:0;bottom:0}.CodeMirror-gutters{position:absolute;left:0;top:0;min-height:100%;z-index:3}.CodeMirror-gutter{white-space:normal;height:100%;display:inline-block;vertical-align:top;margin-bottom:-30px}.CodeMirror-gutter-wrapper{position:absolute;z-index:4;background:0 0!important;border:none!important;-webkit-user-select:none;-moz-user-select:none;user-select:none}.CodeMirror-gutter-background{position:absolute;top:0;bottom:0;z-index:4}.CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.CodeMirror-lines{cursor:text;min-height:1px}.CodeMirror pre{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0;border-width:0;background:0 0;font-family:inherit;font-size:inherit;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;z-index:2;position:relative;overflow:visible;-webkit-tap-highlight-color:transparent;-webkit-font-variant-ligatures:none;font-variant-ligatures:none}.CodeMirror-wrap pre{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.CodeMirror-linebackground{position:absolute;left:0;right:0;top:0;bottom:0;z-index:0}.CodeMirror-linewidget{position:relative;z-index:2;overflow:auto}.CodeMirror-code{outline:0}.CodeMirror-gutter,.CodeMirror-gutters,.CodeMirror-linenumber,.CodeMirror-scroll,.CodeMirror-sizer{-moz-box-sizing:content-box;box-sizing:content-box}.CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}.CodeMirror-cursor{position:absolute;pointer-events:none}.CodeMirror-measure pre{position:static}div.CodeMirror-cursors{visibility:hidden;position:relative;z-index:3}.CodeMirror-focused div.CodeMirror-cursors,div.CodeMirror-dragcursors{visibility:visible}.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused .CodeMirror-selected,.CodeMirror-line::selection,.CodeMirror-line>span::selection,.CodeMirror-line>span>span::selection{background:#d7d4f0}.CodeMirror-crosshair{cursor:crosshair}.CodeMirror-line::-moz-selection,.CodeMirror-line>span::-moz-selection,.CodeMirror-line>span>span::-moz-selection{background:#d7d4f0}.cm-searching{background:#ffa;background:rgba(255,255,0,.4)}.cm-force-border{padding-right:.1px}@media print{.CodeMirror div.CodeMirror-cursors{visibility:hidden}}.cm-tab-wrap-hack:after{content:''}span.CodeMirror-selectedtext{background:0 0} \ No newline at end of file diff --git a/media/editors/codemirror/lib/codemirror.min.js b/media/editors/codemirror/lib/codemirror.min.js index 5ce5a617b66e8..22220550d93e3 100644 --- a/media/editors/codemirror/lib/codemirror.min.js +++ b/media/editors/codemirror/lib/codemirror.min.js @@ -1,5 +1,5 @@ !function(a){if("object"==typeof exports&&"object"==typeof module)module.exports=a();else{if("function"==typeof define&&define.amd)return define([],a);(this||window).CodeMirror=a()}}(function(){"use strict";function a(c,d){if(!(this instanceof a))return new a(c,d);this.options=d=d?Ke(d):{},Ke(_f,d,!1),n(d);var e=d.value;"string"==typeof e&&(e=new xg(e,d.mode,null,d.lineSeparator)),this.doc=e;var f=new a.inputStyles[d.inputStyle](this),g=this.display=new b(c,e,f);g.wrapper.CodeMirror=this,j(this),h(this),d.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),d.autofocus&&!Cf&&g.input.focus(),r(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,selectingText:!1,draggingText:!1,highlight:new De,keySeq:null,specialChars:null};var i=this;sf&&11>tf&&setTimeout(function(){i.display.input.reset(!0)},20),Qb(this),We(),ub(this),this.curOp.forceUpdate=!0,Xd(this,e),d.autofocus&&!Cf||i.hasFocus()?setTimeout(Le(qc,this),20):rc(this);for(var k in ag)ag.hasOwnProperty(k)&&ag[k](this,d[k],bg);w(this),d.finishInit&&d.finishInit(this);for(var l=0;ltf&&(d.gutters.style.zIndex=-1,d.scroller.style.paddingRight=0),uf||pf&&Cf||(d.scroller.draggable=!0),a&&(a.appendChild?a.appendChild(d.wrapper):a(d.wrapper)),d.viewFrom=d.viewTo=b.first,d.reportedViewFrom=d.reportedViewTo=b.first,d.view=[],d.renderedView=null,d.externalMeasured=null,d.viewOffset=0,d.lastWrapHeight=d.lastWrapWidth=0,d.updateLineNumbers=null,d.nativeBarWidth=d.barHeight=d.barWidth=0,d.scrollbarsClipped=!1,d.lineNumWidth=d.lineNumInnerWidth=d.lineNumChars=null,d.alignWidgets=!1,d.cachedCharWidth=d.cachedTextHeight=d.cachedPaddingH=null,d.maxLine=null,d.maxLineLength=0,d.maxLineChanged=!1,d.wheelDX=d.wheelDY=d.wheelStartX=d.wheelStartY=null,d.shift=!1,d.selForContextMenu=null,d.activeTouch=null,c.init(d)}function c(b){b.doc.mode=a.getMode(b.options,b.doc.modeOption),d(b)}function d(a){a.doc.iter(function(a){a.stateAfter&&(a.stateAfter=null),a.styles&&(a.styles=null)}),a.doc.frontier=a.doc.first,Na(a,100),a.state.modeGen++,a.curOp&&Jb(a)}function e(a){a.options.lineWrapping?(Zg(a.display.wrapper,"CodeMirror-wrap"),a.display.sizer.style.minWidth="",a.display.sizerWidth=null):(Yg(a.display.wrapper,"CodeMirror-wrap"),m(a)),g(a),Jb(a),hb(a),setTimeout(function(){s(a)},100)}function f(a){var b=sb(a.display),c=a.options.lineWrapping,d=c&&Math.max(5,a.display.scroller.clientWidth/tb(a.display)-3);return function(e){if(vd(a.doc,e))return 0;var f=0;if(e.widgets)for(var g=0;gb.maxLineLength&&(b.maxLineLength=c,b.maxLine=a)})}function n(a){var b=Ge(a.gutters,"CodeMirror-linenumbers");-1==b&&a.lineNumbers?a.gutters=a.gutters.concat(["CodeMirror-linenumbers"]):b>-1&&!a.lineNumbers&&(a.gutters=a.gutters.slice(0),a.gutters.splice(b,1))}function o(a){var b=a.display,c=b.gutters.offsetWidth,d=Math.round(a.doc.height+Sa(a.display));return{clientHeight:b.scroller.clientHeight,viewHeight:b.wrapper.clientHeight,scrollWidth:b.scroller.scrollWidth,clientWidth:b.scroller.clientWidth,viewWidth:b.wrapper.clientWidth,barLeft:a.options.fixedGutter?c:0,docHeight:d,scrollHeight:d+Ua(a)+b.barHeight,nativeBarWidth:b.nativeBarWidth,gutterWidth:c}}function p(a,b,c){this.cm=c;var d=this.vert=Pe("div",[Pe("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),e=this.horiz=Pe("div",[Pe("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");a(d),a(e),Dg(d,"scroll",function(){d.clientHeight&&b(d.scrollTop,"vertical")}),Dg(e,"scroll",function(){e.clientWidth&&b(e.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,sf&&8>tf&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")}function q(){}function r(b){b.display.scrollbars&&(b.display.scrollbars.clear(),b.display.scrollbars.addClass&&Yg(b.display.wrapper,b.display.scrollbars.addClass)),b.display.scrollbars=new a.scrollbarModel[b.options.scrollbarStyle](function(a){b.display.wrapper.insertBefore(a,b.display.scrollbarFiller),Dg(a,"mousedown",function(){b.state.focused&&setTimeout(function(){b.display.input.focus()},0)}),a.setAttribute("cm-not-content","true")},function(a,c){"horizontal"==c?ec(b,a):dc(b,a)},b),b.display.scrollbars.addClass&&Zg(b.display.wrapper,b.display.scrollbars.addClass)}function s(a,b){b||(b=o(a));var c=a.display.barWidth,d=a.display.barHeight;t(a,b);for(var e=0;4>e&&c!=a.display.barWidth||d!=a.display.barHeight;e++)c!=a.display.barWidth&&a.options.lineWrapping&&F(a),t(a,o(a)),c=a.display.barWidth,d=a.display.barHeight}function t(a,b){var c=a.display,d=c.scrollbars.update(b);c.sizer.style.paddingRight=(c.barWidth=d.right)+"px",c.sizer.style.paddingBottom=(c.barHeight=d.bottom)+"px",c.heightForcer.style.borderBottom=d.bottom+"px solid transparent",d.right&&d.bottom?(c.scrollbarFiller.style.display="block",c.scrollbarFiller.style.height=d.bottom+"px",c.scrollbarFiller.style.width=d.right+"px"):c.scrollbarFiller.style.display="",d.bottom&&a.options.coverGutterNextToScrollbar&&a.options.fixedGutter?(c.gutterFiller.style.display="block",c.gutterFiller.style.height=d.bottom+"px",c.gutterFiller.style.width=b.gutterWidth+"px"):c.gutterFiller.style.display=""}function u(a,b,c){var d=c&&null!=c.top?Math.max(0,c.top):a.scroller.scrollTop;d=Math.floor(d-Ra(a));var e=c&&null!=c.bottom?c.bottom:d+a.wrapper.clientHeight,f=be(b,d),g=be(b,e);if(c&&c.ensure){var h=c.ensure.from.line,i=c.ensure.to.line;f>h?(f=h,g=be(b,ce(Yd(b,h))+a.wrapper.clientHeight)):Math.min(i,b.lastLine())>=g&&(f=be(b,ce(Yd(b,i))-a.wrapper.clientHeight),g=i)}return{from:f,to:Math.max(g,f+1)}}function v(a){var b=a.display,c=b.view;if(b.alignWidgets||b.gutters.firstChild&&a.options.fixedGutter){for(var d=y(b)-b.scroller.scrollLeft+a.doc.scrollLeft,e=b.gutters.offsetWidth,f=d+"px",g=0;g=c.viewFrom&&b.visible.to<=c.viewTo&&(null==c.updateLineNumbers||c.updateLineNumbers>=c.viewTo)&&c.renderedView==c.view&&0==Pb(a))return!1;w(a)&&(Lb(a),b.dims=H(a));var e=d.first+d.size,f=Math.max(b.visible.from-a.options.viewportMargin,d.first),g=Math.min(e,b.visible.to+a.options.viewportMargin);c.viewFromg&&c.viewTo-g<20&&(g=Math.min(e,c.viewTo)),Kf&&(f=td(a.doc,f),g=ud(a.doc,g));var h=f!=c.viewFrom||g!=c.viewTo||c.lastWrapHeight!=b.wrapperHeight||c.lastWrapWidth!=b.wrapperWidth;Ob(a,f,g),c.viewOffset=ce(Yd(a.doc,c.viewFrom)),a.display.mover.style.top=c.viewOffset+"px";var i=Pb(a);if(!h&&0==i&&!b.force&&c.renderedView==c.view&&(null==c.updateLineNumbers||c.updateLineNumbers>=c.viewTo))return!1;var j=Se();return i>4&&(c.lineDiv.style.display="none"),I(a,c.updateLineNumbers,b.dims),i>4&&(c.lineDiv.style.display=""),c.renderedView=c.view,j&&Se()!=j&&j.offsetHeight&&j.focus(),Qe(c.cursorDiv),Qe(c.selectionDiv),c.gutters.style.height=c.sizer.style.minHeight=0,h&&(c.lastWrapHeight=b.wrapperHeight,c.lastWrapWidth=b.wrapperWidth,Na(a,400)),c.updateLineNumbers=null,!0}function C(a,b){for(var c=b.viewport,d=!0;(d&&a.options.lineWrapping&&b.oldDisplayWidth!=Va(a)||(c&&null!=c.top&&(c={top:Math.min(a.doc.height+Sa(a.display)-Wa(a),c.top)}),b.visible=u(a.display,a.doc,c),!(b.visible.from>=a.display.viewFrom&&b.visible.to<=a.display.viewTo)))&&B(a,b);d=!1){F(a);var e=o(a);Ia(a),s(a,e),E(a,e)}b.signal(a,"update",a),(a.display.viewFrom!=a.display.reportedViewFrom||a.display.viewTo!=a.display.reportedViewTo)&&(b.signal(a,"viewportChange",a,a.display.viewFrom,a.display.viewTo),a.display.reportedViewFrom=a.display.viewFrom,a.display.reportedViewTo=a.display.viewTo)}function D(a,b){var c=new z(a,b);if(B(a,c)){F(a),C(a,c);var d=o(a);Ia(a),s(a,d),E(a,d),c.finish()}}function E(a,b){a.display.sizer.style.minHeight=b.docHeight+"px",a.display.heightForcer.style.top=b.docHeight+"px",a.display.gutters.style.height=b.docHeight+a.display.barHeight+Ua(a)+"px"}function F(a){for(var b=a.display,c=b.lineDiv.offsetTop,d=0;dtf){var g=f.node.offsetTop+f.node.offsetHeight;e=g-c,c=g}else{var h=f.node.getBoundingClientRect();e=h.bottom-h.top}var i=f.line.height-e;if(2>e&&(e=sb(b)),(i>.001||-.001>i)&&(_d(f.line,e),G(f.line),f.rest))for(var j=0;j=b&&l.lineNumber;l.changes&&(Ge(l.changes,"gutter")>-1&&(m=!1),J(a,l,j,c)),m&&(Qe(l.lineNumber),l.lineNumber.appendChild(document.createTextNode(x(a.options,j)))),h=l.node.nextSibling}else{var n=R(a,l,j,c);g.insertBefore(n,h)}j+=l.size}for(;h;)h=d(h)}function J(a,b,c,d){for(var e=0;etf&&(a.node.style.zIndex=2)),a.node}function L(a){var b=a.bgClass?a.bgClass+" "+(a.line.bgClass||""):a.line.bgClass;if(b&&(b+=" CodeMirror-linebackground"),a.background)b?a.background.className=b:(a.background.parentNode.removeChild(a.background),a.background=null);else if(b){var c=K(a);a.background=c.insertBefore(Pe("div",null,b),c.firstChild)}}function M(a,b){var c=a.display.externalMeasured;return c&&c.line==b.line?(a.display.externalMeasured=null,b.measure=c.measure,c.built):Ld(a,b)}function N(a,b){var c=b.text.className,d=M(a,b);b.text==b.node&&(b.node=d.pre),b.text.parentNode.replaceChild(d.pre,b.text),b.text=d.pre,d.bgClass!=b.bgClass||d.textClass!=b.textClass?(b.bgClass=d.bgClass,b.textClass=d.textClass,O(b)):c&&(b.text.className=c)}function O(a){L(a),a.line.wrapClass?K(a).className=a.line.wrapClass:a.node!=a.text&&(a.node.className="");var b=a.textClass?a.textClass+" "+(a.line.textClass||""):a.line.textClass;a.text.className=b||""}function P(a,b,c,d){if(b.gutter&&(b.node.removeChild(b.gutter),b.gutter=null),b.gutterBackground&&(b.node.removeChild(b.gutterBackground),b.gutterBackground=null),b.line.gutterClass){var e=K(b);b.gutterBackground=Pe("div",null,"CodeMirror-gutter-background "+b.line.gutterClass,"left: "+(a.options.fixedGutter?d.fixedPos:-d.gutterTotalWidth)+"px; width: "+d.gutterTotalWidth+"px"),e.insertBefore(b.gutterBackground,b.text)}var f=b.line.gutterMarkers;if(a.options.lineNumbers||f){var e=K(b),g=b.gutter=Pe("div",null,"CodeMirror-gutter-wrapper","left: "+(a.options.fixedGutter?d.fixedPos:-d.gutterTotalWidth)+"px");if(a.display.input.setUneditable(g),e.insertBefore(g,b.text),b.line.gutterClass&&(g.className+=" "+b.line.gutterClass),!a.options.lineNumbers||f&&f["CodeMirror-linenumbers"]||(b.lineNumber=g.appendChild(Pe("div",x(a.options,c),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+d.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+a.display.lineNumInnerWidth+"px"))),f)for(var h=0;h1)if(Nf&&Nf.text.join("\n")==b){if(d.ranges.length%Nf.text.length==0){i=[];for(var j=0;j=0;j--){var k=d.ranges[j],l=k.from(),m=k.to();k.empty()&&(c&&c>0?l=Lf(l.line,l.ch-c):a.state.overwrite&&!g?m=Lf(m.line,Math.min(Yd(f,m.line).text.length,m.ch+Fe(h).length)):Nf&&Nf.lineWise&&Nf.text.join("\n")==b&&(l=m=Lf(l.line,0)));var n=a.curOp.updateInput,o={from:l,to:m,text:i?i[j%i.length]:h,origin:e||(g?"paste":a.state.cutIncoming?"cut":"+input")};zc(a.doc,o),xe(a,"inputRead",a,o)}b&&!g&&_(a,b),Lc(a),a.curOp.updateInput=n,a.curOp.typing=!0,a.state.pasteIncoming=a.state.cutIncoming=!1}function $(a,b){var c=a.clipboardData&&a.clipboardData.getData("text/plain");return c?(a.preventDefault(),b.isReadOnly()||b.options.disableInput||Db(b,function(){Z(b,c,0,null,"paste")}),!0):void 0}function _(a,b){if(a.options.electricChars&&a.options.smartIndent)for(var c=a.doc.sel,d=c.ranges.length-1;d>=0;d--){var e=c.ranges[d];if(!(e.head.ch>100||d&&c.ranges[d-1].head.line==e.head.line)){var f=a.getModeAt(e.head),g=!1;if(f.electricChars){for(var h=0;h-1){g=Nc(a,e.head.line,"smart");break}}else f.electricInput&&f.electricInput.test(Yd(a.doc,e.head.line).text.slice(0,e.head.ch))&&(g=Nc(a,e.head.line,"smart"));g&&xe(a,"electricInput",a,e.head.line)}}}function aa(a){for(var b=[],c=[],d=0;de?j.map:k[e],g=0;ge?a.line:a.rest[e]),l=f[g]+d;return(0>d||h!=b)&&(l=f[g+(d?1:0)]),Lf(i,l)}}}var e=a.text.firstChild,f=!1;if(!b||!Vg(e,b))return ga(Lf(ae(a.line),0),!0);if(b==e&&(f=!0,b=e.childNodes[c],c=0,!b)){var g=a.rest?Fe(a.rest):a.line;return ga(Lf(ae(g),g.text.length),f)}var h=3==b.nodeType?b:null,i=b;for(h||1!=b.childNodes.length||3!=b.firstChild.nodeType||(h=b.firstChild,c&&(c=h.nodeValue.length));i.parentNode!=e;)i=i.parentNode;var j=a.measure,k=j.maps,l=d(h,i,c);if(l)return ga(l,f);for(var m=i.nextSibling,n=h?h.nodeValue.length-c:0;m;m=m.nextSibling){if(l=d(m,m.firstChild,0))return ga(Lf(l.line,l.ch-n),f);n+=m.textContent.length}for(var o=i.previousSibling,n=c;o;o=o.previousSibling){if(l=d(o,o.firstChild,-1))return ga(Lf(l.line,l.ch+n),f);n+=m.textContent.length}}function ja(a,b,c,d,e){function f(a){return function(b){return b.id==a}}function g(b){if(1==b.nodeType){var c=b.getAttribute("cm-text");if(null!=c)return""==c&&(c=b.textContent.replace(/\u200b/g,"")),void(h+=c);var k,l=b.getAttribute("cm-marker");if(l){var m=a.findMarks(Lf(d,0),Lf(e+1,0),f(+l));return void(m.length&&(k=m[0].find())&&(h+=Zd(a.doc,k.from,k.to).join(j)))}if("false"==b.getAttribute("contenteditable"))return;for(var n=0;n=0){var g=X(f.from(),e.from()),h=W(f.to(),e.to()),i=f.empty()?e.from()==e.head:f.from()==f.head;b>=d&&--b,a.splice(--d,2,new la(i?h:g,i?g:h))}}return new ka(a,b)}function na(a,b){return new ka([new la(a,b||a)],0)}function oa(a,b){return Math.max(a.first,Math.min(b,a.first+a.size-1))}function pa(a,b){if(b.linec?Lf(c,Yd(a,c).text.length):qa(b,Yd(a,b.line).text.length)}function qa(a,b){var c=a.ch;return null==c||c>b?Lf(a.line,b):0>c?Lf(a.line,0):a}function ra(a,b){return b>=a.first&&b=b.ch:h.to>b.ch))){if(e&&(Gg(i,"beforeCursorEnter"),i.explicitlyCleared)){if(f.markedSpans){--g;continue}break}if(!i.atomic)continue;if(c){var j,k=i.find(0>d?1:-1);if((0>d?i.inclusiveRight:i.inclusiveLeft)&&(k=Ha(a,k,-d,k&&k.line==b.line?f:null)),k&&k.line==b.line&&(j=Mf(k,c))&&(0>d?0>j:j>0))return Fa(a,k,b,d,e)}var l=i.find(0>d?-1:1);return(0>d?i.inclusiveLeft:i.inclusiveRight)&&(l=Ha(a,l,d,l.line==b.line?f:null)),l?Fa(a,l,b,d,e):null}}return b}function Ga(a,b,c,d,e){var f=d||1,g=Fa(a,b,c,f,e)||!e&&Fa(a,b,c,f,!0)||Fa(a,b,c,-f,e)||!e&&Fa(a,b,c,-f,!0);return g?g:(a.cantEdit=!0,Lf(a.first,0))}function Ha(a,b,c,d){return 0>c&&0==b.ch?b.line>a.first?pa(a,Lf(b.line-1)):null:c>0&&b.ch==(d||Yd(a,b.line)).text.length?b.line=a.display.viewTo||h.to().lineb&&(b=0),b=Math.round(b),d=Math.round(d),h.appendChild(Pe("div",null,"CodeMirror-selected","position: absolute; left: "+a+"px; top: "+b+"px; width: "+(null==c?k-a:c)+"px; height: "+(d-b)+"px"))}function e(b,c,e){function f(c,d){return mb(a,Lf(b,c),"div",l,d)}var h,i,l=Yd(g,b),m=l.text.length;return _e(de(l),c||0,null==e?m:e,function(a,b,g){var l,n,o,p=f(a,"left");if(a==b)l=p,n=o=p.left;else{if(l=f(b-1,"right"),"rtl"==g){var q=p;p=l,l=q}n=p.left,o=l.right}null==c&&0==a&&(n=j),l.top-p.top>3&&(d(n,p.top,null,p.bottom),n=j,p.bottomi.bottom||l.bottom==i.bottom&&l.right>i.right)&&(i=l),j+1>n&&(n=j),d(n,l.top,o-n,l.bottom)}),{start:h,end:i}}var f=a.display,g=a.doc,h=document.createDocumentFragment(),i=Ta(a.display),j=i.left,k=Math.max(f.sizerWidth,Va(a)-f.sizer.offsetLeft)-i.right,l=b.from(),m=b.to();if(l.line==m.line)e(l.line,l.ch,m.ch);else{var n=Yd(g,l.line),o=Yd(g,m.line),p=rd(n)==rd(o),q=e(l.line,l.ch,p?n.text.length+1:null).end,r=e(m.line,p?0:null,m.ch).start;p&&(q.top0?b.blinker=setInterval(function(){b.cursorDiv.style.visibility=(c=!c)?"":"hidden"},a.options.cursorBlinkRate):a.options.cursorBlinkRate<0&&(b.cursorDiv.style.visibility="hidden")}}function Na(a,b){a.doc.mode.startState&&a.doc.frontier=a.display.viewTo)){var c=+new Date+a.options.workTime,d=hg(b.mode,Qa(a,b.frontier)),e=[];b.iter(b.frontier,Math.min(b.first+b.size,a.display.viewTo+500),function(f){if(b.frontier>=a.display.viewFrom){var g=f.styles,h=f.text.length>a.options.maxHighlightLength,i=Hd(a,f,h?hg(b.mode,d):d,!0);f.styles=i.styles;var j=f.styleClasses,k=i.classes;k?f.styleClasses=k:j&&(f.styleClasses=null);for(var l=!g||g.length!=f.styles.length||j!=k&&(!j||!k||j.bgClass!=k.bgClass||j.textClass!=k.textClass),m=0;!l&&mc?(Na(a,a.options.workDelay),!0):void 0}),e.length&&Db(a,function(){for(var b=0;bg;--h){if(h<=f.first)return f.first;var i=Yd(f,h-1);if(i.stateAfter&&(!c||h<=f.frontier))return h;var j=Ng(i.text,null,a.options.tabSize);(null==e||d>j)&&(e=h-1,d=j)}return e}function Qa(a,b,c){var d=a.doc,e=a.display;if(!d.mode.startState)return!0;var f=Pa(a,b,c),g=f>d.first&&Yd(d,f-1).stateAfter;return g=g?hg(d.mode,g):ig(d.mode),d.iter(f,b,function(c){Jd(a,c.text,g);var h=f==b-1||f%5==0||f>=e.viewFrom&&f2&&f.push((i.bottom+j.top)/2-c.top)}}f.push(c.bottom-c.top)}}function Ya(a,b,c){if(a.line==b)return{map:a.measure.map,cache:a.measure.cache};for(var d=0;dc)return{map:a.measure.maps[d],cache:a.measure.caches[d],before:!0}}function Za(a,b){b=rd(b);var c=ae(b),d=a.display.externalMeasured=new Hb(a.doc,b,c);d.lineN=c;var e=d.built=Ld(a,d);return d.text=e.pre,Re(a.display.lineMeasure,e.pre),d}function $a(a,b,c,d){return bb(a,ab(a,b),c,d)}function _a(a,b){if(b>=a.display.viewFrom&&b=c.lineN&&bb?(e=0,f=1,g="left"):j>b?(e=b-i, -f=e+1):(h==a.length-3||b==j&&a[h+3]>b)&&(f=j-i,e=f-1,b>=j&&(g="right")),null!=e){if(d=a[h+2],i==j&&c==(d.insertLeft?"left":"right")&&(g=c),"left"==c&&0==e)for(;h&&a[h-2]==a[h-3]&&a[h-1].insertLeft;)d=a[(h-=3)+2],g="left";if("right"==c&&e==j-i)for(;hk;k++){for(;h&&Oe(b.line.text.charAt(f.coverStart+h));)--h;for(;f.coverStart+itf&&0==h&&i==f.coverEnd-f.coverStart)e=g.parentNode.getBoundingClientRect();else if(sf&&a.options.lineWrapping){var l=Rg(g,h,i).getClientRects();e=l.length?l["right"==d?l.length-1:0]:Rf}else e=Rg(g,h,i).getBoundingClientRect()||Rf;if(e.left||e.right||0==h)break;i=h,h-=1,j="right"}sf&&11>tf&&(e=eb(a.display.measure,e))}else{h>0&&(j=d="right");var l;e=a.options.lineWrapping&&(l=g.getClientRects()).length>1?l["right"==d?l.length-1:0]:g.getBoundingClientRect()}if(sf&&9>tf&&!h&&(!e||!e.left&&!e.right)){var m=g.parentNode.getClientRects()[0];e=m?{left:m.left,right:m.left+tb(a.display),top:m.top,bottom:m.bottom}:Rf}for(var n=e.top-b.rect.top,o=e.bottom-b.rect.top,p=(n+o)/2,q=b.view.measure.heights,k=0;kc.from?g(a-1):g(a,d)}d=d||Yd(a.doc,b.line),e||(e=ab(a,d));var i=de(d),j=b.ch;if(!i)return g(j);var k=jf(i,j),l=h(j,k);return null!=fh&&(l.other=h(j,fh)),l}function ob(a,b){var c=0,b=pa(a.doc,b);a.options.lineWrapping||(c=tb(a.display)*b.ch);var d=Yd(a.doc,b.line),e=ce(d)+Ra(a.display);return{left:c,right:c,top:e,bottom:e+d.height}}function pb(a,b,c,d){var e=Lf(a,b);return e.xRel=d,c&&(e.outside=!0),e}function qb(a,b,c){var d=a.doc;if(c+=a.display.viewOffset,0>c)return pb(d.first,0,!0,-1);var e=be(d,c),f=d.first+d.size-1;if(e>f)return pb(d.first+d.size-1,Yd(d,f).text.length,!0,1);0>b&&(b=0);for(var g=Yd(d,e);;){var h=rb(a,g,e,b,c),i=pd(g),j=i&&i.find(0,!0);if(!i||!(h.ch>j.from.ch||h.ch==j.from.ch&&h.xRel>0))return h;e=ae(g=j.to.line)}}function rb(a,b,c,d,e){function f(d){var e=nb(a,Lf(c,d),"line",b,j);return h=!0,g>e.bottom?e.left-i:gq)return pb(c,n,r,1);for(;;){if(k?n==m||n==lf(b,m,1):1>=n-m){for(var s=o>d||q-d>=d-o?m:n,t=d-(s==m?o:q);Oe(b.text.charAt(s));)++s;var u=pb(c,s,s==m?p:r,-1>t?-1:t>1?1:0);return u}var v=Math.ceil(l/2),w=m+v;if(k){w=m;for(var x=0;v>x;++x)w=lf(b,w,1)}var y=f(w);y>d?(n=w,q=y,(r=h)&&(q+=1e3),l=v):(m=w,o=y,p=h,l-=v)}}function sb(a){if(null!=a.cachedTextHeight)return a.cachedTextHeight;if(null==Of){Of=Pe("pre");for(var b=0;49>b;++b)Of.appendChild(document.createTextNode("x")),Of.appendChild(Pe("br"));Of.appendChild(document.createTextNode("x"))}Re(a.measure,Of);var c=Of.offsetHeight/50;return c>3&&(a.cachedTextHeight=c),Qe(a.measure),c||1}function tb(a){if(null!=a.cachedCharWidth)return a.cachedCharWidth;var b=Pe("span","xxxxxxxxxx"),c=Pe("pre",[b]);Re(a.measure,c);var d=b.getBoundingClientRect(),e=(d.right-d.left)/10;return e>2&&(a.cachedCharWidth=e),e||10}function ub(a){a.curOp={cm:a,viewChanged:!1,startHeight:a.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Tf},Sf?Sf.ops.push(a.curOp):a.curOp.ownsGroup=Sf={ops:[a.curOp],delayedCallbacks:[]}}function vb(a){var b=a.delayedCallbacks,c=0;do{for(;c=c.viewTo)||c.maxLineChanged&&b.options.lineWrapping,a.update=a.mustUpdate&&new z(b,a.mustUpdate&&{top:a.scrollTop,ensure:a.scrollToPos},a.forceUpdate)}function zb(a){a.updatedDisplay=a.mustUpdate&&B(a.cm,a.update)}function Ab(a){var b=a.cm,c=b.display;a.updatedDisplay&&F(b),a.barMeasure=o(b),c.maxLineChanged&&!b.options.lineWrapping&&(a.adjustWidthTo=$a(b,c.maxLine,c.maxLine.text.length).left+3,b.display.sizerWidth=a.adjustWidthTo,a.barMeasure.scrollWidth=Math.max(c.scroller.clientWidth,c.sizer.offsetLeft+a.adjustWidthTo+Ua(b)+b.display.barWidth),a.maxScrollLeft=Math.max(0,c.sizer.offsetLeft+a.adjustWidthTo-Va(b))),(a.updatedDisplay||a.selectionChanged)&&(a.preparedSelection=c.input.prepareSelection(a.focus))}function Bb(a){var b=a.cm;null!=a.adjustWidthTo&&(b.display.sizer.style.minWidth=a.adjustWidthTo+"px",a.maxScrollLeftf;f=d){var g=new Hb(a.doc,Yd(a.doc,f),f);d=f+g.size,e.push(g)}return e}function Jb(a,b,c,d){null==b&&(b=a.doc.first),null==c&&(c=a.doc.first+a.doc.size),d||(d=0);var e=a.display;if(d&&cb)&&(e.updateLineNumbers=b),a.curOp.viewChanged=!0,b>=e.viewTo)Kf&&td(a.doc,b)e.viewFrom?Lb(a):(e.viewFrom+=d,e.viewTo+=d);else if(b<=e.viewFrom&&c>=e.viewTo)Lb(a);else if(b<=e.viewFrom){var f=Nb(a,c,c+d,1);f?(e.view=e.view.slice(f.index),e.viewFrom=f.lineN,e.viewTo+=d):Lb(a)}else if(c>=e.viewTo){var f=Nb(a,b,b,-1);f?(e.view=e.view.slice(0,f.index),e.viewTo=f.lineN):Lb(a)}else{var g=Nb(a,b,b,-1),h=Nb(a,c,c+d,1);g&&h?(e.view=e.view.slice(0,g.index).concat(Ib(a,g.lineN,h.lineN)).concat(e.view.slice(h.index)),e.viewTo+=d):Lb(a)}var i=e.externalMeasured;i&&(c=e.lineN&&b=d.viewTo)){var f=d.view[Mb(a,b)];if(null!=f.node){var g=f.changes||(f.changes=[]);-1==Ge(g,c)&&g.push(c)}}}function Lb(a){a.display.viewFrom=a.display.viewTo=a.doc.first,a.display.view=[],a.display.viewOffset=0}function Mb(a,b){if(b>=a.display.viewTo)return null;if(b-=a.display.viewFrom,0>b)return null;for(var c=a.display.view,d=0;db)return d}function Nb(a,b,c,d){var e,f=Mb(a,b),g=a.display.view;if(!Kf||c==a.doc.first+a.doc.size)return{index:f,lineN:c};for(var h=0,i=a.display.viewFrom;f>h;h++)i+=g[h].size;if(i!=b){if(d>0){if(f==g.length-1)return null;e=i+g[f].size-b,f++}else e=i-b;b+=e,c+=e}for(;td(a.doc,c)!=c;){if(f==(0>d?0:g.length-1))return null;c+=d*g[f-(0>d?1:0)].size,f+=d}return{index:f,lineN:c}}function Ob(a,b,c){var d=a.display,e=d.view;0==e.length||b>=d.viewTo||c<=d.viewFrom?(d.view=Ib(a,b,c),d.viewFrom=b):(d.viewFrom>b?d.view=Ib(a,b,d.viewFrom).concat(d.view):d.viewFromc&&(d.view=d.view.slice(0,Mb(a,c)))),d.viewTo=c}function Pb(a){for(var b=a.display.view,c=0,d=0;d400}var e=a.display;Dg(e.scroller,"mousedown",Eb(a,Vb)),sf&&11>tf?Dg(e.scroller,"dblclick",Eb(a,function(b){if(!ze(a,b)){var c=Ub(a,b);if(c&&!$b(a,b)&&!Tb(a.display,b)){Ag(b);var d=a.findWordAt(c);ua(a.doc,d.anchor,d.head)}}})):Dg(e.scroller,"dblclick",function(b){ze(a,b)||Ag(b)}),If||Dg(e.scroller,"contextmenu",function(b){sc(a,b)});var f,g={end:0};Dg(e.scroller,"touchstart",function(b){if(!ze(a,b)&&!c(b)){clearTimeout(f);var d=+new Date;e.activeTouch={start:d,moved:!1,prev:d-g.end<=300?g:null},1==b.touches.length&&(e.activeTouch.left=b.touches[0].pageX,e.activeTouch.top=b.touches[0].pageY)}}),Dg(e.scroller,"touchmove",function(){e.activeTouch&&(e.activeTouch.moved=!0)}),Dg(e.scroller,"touchend",function(c){var f=e.activeTouch;if(f&&!Tb(e,c)&&null!=f.left&&!f.moved&&new Date-f.start<300){var g,h=a.coordsChar(e.activeTouch,"page");g=!f.prev||d(f,f.prev)?new la(h,h):!f.prev.prev||d(f,f.prev.prev)?a.findWordAt(h):new la(Lf(h.line,0),pa(a.doc,Lf(h.line+1,0))),a.setSelection(g.anchor,g.head),a.focus(),Ag(c)}b()}),Dg(e.scroller,"touchcancel",b),Dg(e.scroller,"scroll",function(){e.scroller.clientHeight&&(dc(a,e.scroller.scrollTop),ec(a,e.scroller.scrollLeft,!0),Gg(a,"scroll",a))}),Dg(e.scroller,"mousewheel",function(b){fc(a,b)}),Dg(e.scroller,"DOMMouseScroll",function(b){fc(a,b)}),Dg(e.wrapper,"scroll",function(){e.wrapper.scrollTop=e.wrapper.scrollLeft=0}),e.dragFunctions={enter:function(b){ze(a,b)||Cg(b)},over:function(b){ze(a,b)||(bc(a,b),Cg(b))},start:function(b){ac(a,b)},drop:Eb(a,_b),leave:function(b){ze(a,b)||cc(a)}};var h=e.input.getField();Dg(h,"keyup",function(b){nc.call(a,b)}),Dg(h,"keydown",Eb(a,lc)),Dg(h,"keypress",Eb(a,oc)),Dg(h,"focus",Le(qc,a)),Dg(h,"blur",Le(rc,a))}function Rb(b,c,d){var e=d&&d!=a.Init;if(!c!=!e){var f=b.display.dragFunctions,g=c?Dg:Fg;g(b.display.scroller,"dragstart",f.start),g(b.display.scroller,"dragenter",f.enter),g(b.display.scroller,"dragover",f.over),g(b.display.scroller,"dragleave",f.leave),g(b.display.scroller,"drop",f.drop)}}function Sb(a){var b=a.display;(b.lastWrapHeight!=b.wrapper.clientHeight||b.lastWrapWidth!=b.wrapper.clientWidth)&&(b.cachedCharWidth=b.cachedTextHeight=b.cachedPaddingH=null,b.scrollbarsClipped=!1,a.setSize())}function Tb(a,b){for(var c=ue(b);c!=a.wrapper;c=c.parentNode)if(!c||1==c.nodeType&&"true"==c.getAttribute("cm-ignore-events")||c.parentNode==a.sizer&&c!=a.mover)return!0}function Ub(a,b,c,d){var e=a.display;if(!c&&"true"==ue(b).getAttribute("cm-not-content"))return null;var f,g,h=e.lineSpace.getBoundingClientRect();try{f=b.clientX-h.left,g=b.clientY-h.top}catch(b){return null}var i,j=qb(a,f,g);if(d&&1==j.xRel&&(i=Yd(a.doc,j.line).text).length==j.ch){var k=Ng(i,i.length,a.options.tabSize)-i.length;j=Lf(j.line,Math.max(0,Math.round((f-Ta(a.display).left)/tb(a.display))-k))}return j}function Vb(a){var b=this,c=b.display;if(!(ze(b,a)||c.activeTouch&&c.input.supportsTouch())){if(c.shift=a.shiftKey,Tb(c,a))return void(uf||(c.scroller.draggable=!1,setTimeout(function(){c.scroller.draggable=!0},100)));if(!$b(b,a)){var d=Ub(b,a);switch(window.focus(),ve(a)){case 1:b.state.selectingText?b.state.selectingText(a):d?Wb(b,a,d):ue(a)==c.scroller&&Ag(a);break;case 2:uf&&(b.state.lastMiddleDown=+new Date),d&&ua(b.doc,d),setTimeout(function(){c.input.focus()},20),Ag(a);break;case 3:If?sc(b,a):pc(b)}}}}function Wb(a,b,c){sf?setTimeout(Le(Y,a),0):a.curOp.focus=Se();var d,e=+new Date;Qf&&Qf.time>e-400&&0==Mf(Qf.pos,c)?d="triple":Pf&&Pf.time>e-400&&0==Mf(Pf.pos,c)?(d="double",Qf={time:e,pos:c}):(d="single",Pf={time:e,pos:c});var f,g=a.doc.sel,h=Df?b.metaKey:b.ctrlKey;a.options.dragDrop&&_g&&!a.isReadOnly()&&"single"==d&&(f=g.contains(c))>-1&&(Mf((f=g.ranges[f]).from(),c)<0||c.xRel>0)&&(Mf(f.to(),c)>0||c.xRel<0)?Xb(a,b,c,h):Yb(a,b,c,d,h)}function Xb(a,b,c,d){var e=a.display,f=+new Date,g=Eb(a,function(h){uf&&(e.scroller.draggable=!1),a.state.draggingText=!1,Fg(document,"mouseup",g),Fg(e.scroller,"drop",g),Math.abs(b.clientX-h.clientX)+Math.abs(b.clientY-h.clientY)<10&&(Ag(h),!d&&+new Date-200=o;o++){var r=Yd(j,o).text,s=Og(r,i,f);i==n?e.push(new la(Lf(o,s),Lf(o,s))):r.length>s&&e.push(new la(Lf(o,s),Lf(o,Og(r,n,f))))}e.length||e.push(new la(c,c)),Aa(j,ma(m.ranges.slice(0,l).concat(e),l),{origin:"*mouse",scroll:!1}),a.scrollIntoView(b)}else{var t=k,u=t.anchor,v=b;if("single"!=d){if("double"==d)var w=a.findWordAt(b);else var w=new la(Lf(b.line,0),pa(j,Lf(b.line+1,0)));Mf(w.anchor,u)>0?(v=w.head,u=X(t.from(),w.anchor)):(v=w.anchor,u=W(t.to(),w.head))}var e=m.ranges.slice(0);e[l]=new la(pa(j,u),v),Aa(j,ma(e,l),Lg)}}function g(b){var c=++s,e=Ub(a,b,!0,"rect"==d);if(e)if(0!=Mf(e,q)){a.curOp.focus=Se(),f(e);var h=u(i,j);(e.line>=h.to||e.liner.bottom?20:0;k&&setTimeout(Eb(a,function(){s==c&&(i.scroller.scrollTop+=k,g(b))}),50)}}function h(b){a.state.selectingText=!1,s=1/0,Ag(b),i.input.focus(),Fg(document,"mousemove",t),Fg(document,"mouseup",v),j.history.lastSelOrigin=null}var i=a.display,j=a.doc;Ag(b);var k,l,m=j.sel,n=m.ranges;if(e&&!b.shiftKey?(l=j.sel.contains(c),k=l>-1?n[l]:new la(c,c)):(k=j.sel.primary(),l=j.sel.primIndex),Ef?b.shiftKey&&b.metaKey:b.altKey)d="rect",e||(k=new la(c,c)),c=Ub(a,b,!0,!0),l=-1;else if("double"==d){var o=a.findWordAt(c);k=a.display.shift||j.extend?ta(j,k,o.anchor,o.head):o}else if("triple"==d){var p=new la(Lf(c.line,0),pa(j,Lf(c.line+1,0)));k=a.display.shift||j.extend?ta(j,k,p.anchor,p.head):p}else k=ta(j,k,c);e?-1==l?(l=n.length,Aa(j,ma(n.concat([k]),l),{scroll:!1,origin:"*mouse"})):n.length>1&&n[l].empty()&&"single"==d&&!b.shiftKey?(Aa(j,ma(n.slice(0,l).concat(n.slice(l+1)),0),{scroll:!1,origin:"*mouse"}),m=j.sel):wa(j,l,k,Lg):(l=0,Aa(j,new ka([k],0),Lg),m=j.sel);var q=c,r=i.wrapper.getBoundingClientRect(),s=0,t=Eb(a,function(a){ve(a)?g(a):h(a)}),v=Eb(a,h);a.state.selectingText=v,Dg(document,"mousemove",t),Dg(document,"mouseup",v)}function Zb(a,b,c,d){try{var e=b.clientX,f=b.clientY}catch(b){return!1}if(e>=Math.floor(a.display.gutters.getBoundingClientRect().right))return!1;d&&Ag(b);var g=a.display,h=g.lineDiv.getBoundingClientRect();if(f>h.bottom||!Be(a,c))return te(b);f-=h.top-g.viewOffset;for(var i=0;i=e){var k=be(a.doc,f),l=a.options.gutters[i];return Gg(a,c,a,k,l,b),te(b)}}}function $b(a,b){return Zb(a,b,"gutterClick",!0)}function _b(a){var b=this;if(cc(b),!ze(b,a)&&!Tb(b.display,a)){Ag(a),sf&&(Uf=+new Date);var c=Ub(b,a,!0),d=a.dataTransfer.files;if(c&&!b.isReadOnly())if(d&&d.length&&window.FileReader&&window.File)for(var e=d.length,f=Array(e),g=0,h=function(a,d){if(!b.options.allowDropFileTypes||-1!=Ge(b.options.allowDropFileTypes,a.type)){var h=new FileReader;h.onload=Eb(b,function(){var a=h.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(a)&&(a=""),f[d]=a,++g==e){c=pa(b.doc,c);var i={from:c,to:c,text:b.doc.splitLines(f.join(b.doc.lineSeparator())),origin:"paste"};zc(b.doc,i),za(b.doc,na(c,$f(i)))}}),h.readAsText(a)}},i=0;e>i;++i)h(d[i],i);else{if(b.state.draggingText&&b.doc.sel.contains(c)>-1)return b.state.draggingText(a),void setTimeout(function(){b.display.input.focus()},20);try{var f=a.dataTransfer.getData("Text");if(f){if(b.state.draggingText&&!(Df?a.altKey:a.ctrlKey))var j=b.listSelections();if(Ba(b.doc,na(c,c)),j)for(var i=0;ig.clientWidth,i=g.scrollHeight>g.clientHeight;if(d&&h||e&&i){if(e&&Df&&uf)a:for(var j=b.target,k=f.view;j!=g;j=j.parentNode)for(var l=0;lm?n=Math.max(0,n+m-50):o=Math.min(a.doc.height,o+m+50),D(a,{top:n,bottom:o})}20>Vf&&(null==f.wheelStartX?(f.wheelStartX=g.scrollLeft,f.wheelStartY=g.scrollTop,f.wheelDX=d,f.wheelDY=e,setTimeout(function(){if(null!=f.wheelStartX){var a=g.scrollLeft-f.wheelStartX,b=g.scrollTop-f.wheelStartY,c=b&&f.wheelDY&&b/f.wheelDY||a&&f.wheelDX&&a/f.wheelDX;f.wheelStartX=f.wheelStartY=null,c&&(Wf=(Wf*Vf+c)/(Vf+1),++Vf)}},200)):(f.wheelDX+=d,f.wheelDY+=e))}}function gc(a,b,c){if("string"==typeof b&&(b=jg[b],!b))return!1;a.display.input.ensurePolled();var d=a.display.shift,e=!1;try{a.isReadOnly()&&(a.state.suppressEdits=!0),c&&(a.display.shift=!1),e=b(a)!=Jg}finally{a.display.shift=d,a.state.suppressEdits=!1}return e}function hc(a,b,c){for(var d=0;dtf&&27==a.keyCode&&(a.returnValue=!1);var c=a.keyCode;b.display.shift=16==c||a.shiftKey;var d=jc(b,a);xf&&(Zf=d?c:null,!d&&88==c&&!ch&&(Df?a.metaKey:a.ctrlKey)&&b.replaceSelection("",null,"cut")),18!=c||/\bCodeMirror-crosshair\b/.test(b.display.lineDiv.className)||mc(b)}}function mc(a){function b(a){18!=a.keyCode&&a.altKey||(Yg(c,"CodeMirror-crosshair"),Fg(document,"keyup",b),Fg(document,"mouseover",b))}var c=a.display.lineDiv;Zg(c,"CodeMirror-crosshair"),Dg(document,"keyup",b),Dg(document,"mouseover",b)}function nc(a){16==a.keyCode&&(this.doc.sel.shift=!1),ze(this,a)}function oc(a){var b=this;if(!(Tb(b.display,a)||ze(b,a)||a.ctrlKey&&!a.altKey||Df&&a.metaKey)){var c=a.keyCode,d=a.charCode;if(xf&&c==Zf)return Zf=null,void Ag(a);if(!xf||a.which&&!(a.which<10)||!jc(b,a)){var e=String.fromCharCode(null==d?c:d);kc(b,a,e)||b.display.input.onKeyPress(a)}}}function pc(a){a.state.delayingBlurEvent=!0,setTimeout(function(){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1,rc(a))},100)}function qc(a){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1),"nocursor"!=a.options.readOnly&&(a.state.focused||(Gg(a,"focus",a),a.state.focused=!0,Zg(a.display.wrapper,"CodeMirror-focused"),a.curOp||a.display.selForContextMenu==a.doc.sel||(a.display.input.reset(),uf&&setTimeout(function(){a.display.input.reset(!0)},20)),a.display.input.receivedFocus()),Ma(a))}function rc(a){a.state.delayingBlurEvent||(a.state.focused&&(Gg(a,"blur",a),a.state.focused=!1,Yg(a.display.wrapper,"CodeMirror-focused")),clearInterval(a.display.blinker),setTimeout(function(){a.state.focused||(a.display.shift=!1)},150))}function sc(a,b){Tb(a.display,b)||tc(a,b)||ze(a,b,"contextmenu")||a.display.input.onContextMenu(b)}function tc(a,b){return Be(a,"gutterContextMenu")?Zb(a,b,"gutterContextMenu",!1):!1}function uc(a,b){if(Mf(a,b.from)<0)return a;if(Mf(a,b.to)<=0)return $f(b);var c=a.line+b.text.length-(b.to.line-b.from.line)-1,d=a.ch;return a.line==b.to.line&&(d+=$f(b).ch-b.to.ch),Lf(c,d)}function vc(a,b){for(var c=[],d=0;d=0;--e)Ac(a,{from:d[e].from,to:d[e].to,text:e?[""]:b.text});else Ac(a,b)}}function Ac(a,b){if(1!=b.text.length||""!=b.text[0]||0!=Mf(b.from,b.to)){var c=vc(a,b);ie(a,b,c,a.cm?a.cm.curOp.id:NaN),Dc(a,b,c,ed(a,b));var d=[];Wd(a,function(a,c){c||-1!=Ge(d,a.history)||(se(a.history,b),d.push(a.history)),Dc(a,b,null,ed(a,b))})}}function Bc(a,b,c){if(!a.cm||!a.cm.state.suppressEdits){for(var d,e=a.history,f=a.sel,g="undo"==b?e.done:e.undone,h="undo"==b?e.undone:e.done,i=0;i=0;--i){var l=d.changes[i];if(l.origin=b,k&&!yc(a,l,!1))return void(g.length=0);j.push(fe(a,l));var m=i?vc(a,l):Fe(g);Dc(a,l,m,gd(a,l)),!i&&a.cm&&a.cm.scrollIntoView({from:l.from,to:$f(l)});var n=[];Wd(a,function(a,b){b||-1!=Ge(n,a.history)||(se(a.history,l),n.push(a.history)),Dc(a,l,null,gd(a,l))})}}}}function Cc(a,b){if(0!=b&&(a.first+=b,a.sel=new ka(He(a.sel.ranges,function(a){return new la(Lf(a.anchor.line+b,a.anchor.ch),Lf(a.head.line+b,a.head.ch))}),a.sel.primIndex),a.cm)){Jb(a.cm,a.first,a.first-b,b);for(var c=a.cm.display,d=c.viewFrom;da.lastLine())){if(b.from.linef&&(b={from:b.from,to:Lf(f,Yd(a,f).text.length),text:[b.text[0]],origin:b.origin}),b.removed=Zd(a,b.from,b.to),c||(c=vc(a,b)),a.cm?Ec(a.cm,b,d):Td(a,b,d),Ba(a,c,Kg)}}function Ec(a,b,c){var d=a.doc,e=a.display,g=b.from,h=b.to,i=!1,j=g.line;a.options.lineWrapping||(j=ae(rd(Yd(d,g.line))),d.iter(j,h.line+1,function(a){return a==e.maxLine?(i=!0,!0):void 0})),d.sel.contains(b.from,b.to)>-1&&Ae(a),Td(d,b,c,f(a)),a.options.lineWrapping||(d.iter(j,g.line+b.text.length,function(a){var b=l(a);b>e.maxLineLength&&(e.maxLine=a,e.maxLineLength=b,e.maxLineChanged=!0,i=!1)}),i&&(a.curOp.updateMaxLine=!0)),d.frontier=Math.min(d.frontier,g.line),Na(a,400);var k=b.text.length-(h.line-g.line)-1;b.full?Jb(a):g.line!=h.line||1!=b.text.length||Sd(a.doc,b)?Jb(a,g.line,h.line+1,k):Kb(a,g.line,"text");var m=Be(a,"changes"),n=Be(a,"change");if(n||m){var o={from:g,to:h,text:b.text,removed:b.removed,origin:b.origin};n&&xe(a,"change",a,o),m&&(a.curOp.changeObjs||(a.curOp.changeObjs=[])).push(o)}a.display.selForContextMenu=null}function Fc(a,b,c,d,e){if(d||(d=c),Mf(d,c)<0){var f=d;d=c,c=f}"string"==typeof b&&(b=a.splitLines(b)),zc(a,{from:c,to:d,text:b,origin:e})}function Gc(a,b){if(!ze(a,"scrollCursorIntoView")){var c=a.display,d=c.sizer.getBoundingClientRect(),e=null;if(b.top+d.top<0?e=!0:b.bottom+d.top>(window.innerHeight||document.documentElement.clientHeight)&&(e=!1),null!=e&&!Af){var f=Pe("div","​",null,"position: absolute; top: "+(b.top-c.viewOffset-Ra(a.display))+"px; height: "+(b.bottom-b.top+Ua(a)+c.barHeight)+"px; left: "+b.left+"px; width: 2px;");a.display.lineSpace.appendChild(f),f.scrollIntoView(e),a.display.lineSpace.removeChild(f)}}}function Hc(a,b,c,d){null==d&&(d=0);for(var e=0;5>e;e++){var f=!1,g=nb(a,b),h=c&&c!=b?nb(a,c):g,i=Jc(a,Math.min(g.left,h.left),Math.min(g.top,h.top)-d,Math.max(g.left,h.left),Math.max(g.bottom,h.bottom)+d),j=a.doc.scrollTop,k=a.doc.scrollLeft;if(null!=i.scrollTop&&(dc(a,i.scrollTop),Math.abs(a.doc.scrollTop-j)>1&&(f=!0)),null!=i.scrollLeft&&(ec(a,i.scrollLeft),Math.abs(a.doc.scrollLeft-k)>1&&(f=!0)),!f)break}return g}function Ic(a,b,c,d,e){var f=Jc(a,b,c,d,e);null!=f.scrollTop&&dc(a,f.scrollTop),null!=f.scrollLeft&&ec(a,f.scrollLeft)}function Jc(a,b,c,d,e){var f=a.display,g=sb(a.display);0>c&&(c=0);var h=a.curOp&&null!=a.curOp.scrollTop?a.curOp.scrollTop:f.scroller.scrollTop,i=Wa(a),j={};e-c>i&&(e=c+i);var k=a.doc.height+Sa(f),l=g>c,m=e>k-g;if(h>c)j.scrollTop=l?0:c;else if(e>h+i){var n=Math.min(c,(m?k:e)-i);n!=h&&(j.scrollTop=n)}var o=a.curOp&&null!=a.curOp.scrollLeft?a.curOp.scrollLeft:f.scroller.scrollLeft,p=Va(a)-(a.options.fixedGutter?f.gutters.offsetWidth:0),q=d-b>p;return q&&(d=b+p),10>b?j.scrollLeft=0:o>b?j.scrollLeft=Math.max(0,b-(q?0:10)):d>p+o-3&&(j.scrollLeft=d+(q?0:10)-p),j}function Kc(a,b,c){(null!=b||null!=c)&&Mc(a),null!=b&&(a.curOp.scrollLeft=(null==a.curOp.scrollLeft?a.doc.scrollLeft:a.curOp.scrollLeft)+b),null!=c&&(a.curOp.scrollTop=(null==a.curOp.scrollTop?a.doc.scrollTop:a.curOp.scrollTop)+c); -}function Lc(a){Mc(a);var b=a.getCursor(),c=b,d=b;a.options.lineWrapping||(c=b.ch?Lf(b.line,b.ch-1):b,d=Lf(b.line,b.ch+1)),a.curOp.scrollToPos={from:c,to:d,margin:a.options.cursorScrollMargin,isCursor:!0}}function Mc(a){var b=a.curOp.scrollToPos;if(b){a.curOp.scrollToPos=null;var c=ob(a,b.from),d=ob(a,b.to),e=Jc(a,Math.min(c.left,d.left),Math.min(c.top,d.top)-b.margin,Math.max(c.right,d.right),Math.max(c.bottom,d.bottom)+b.margin);a.scrollTo(e.scrollLeft,e.scrollTop)}}function Nc(a,b,c,d){var e,f=a.doc;null==c&&(c="add"),"smart"==c&&(f.mode.indent?e=Qa(a,b):c="prev");var g=a.options.tabSize,h=Yd(f,b),i=Ng(h.text,null,g);h.stateAfter&&(h.stateAfter=null);var j,k=h.text.match(/^\s*/)[0];if(d||/\S/.test(h.text)){if("smart"==c&&(j=f.mode.indent(e,h.text.slice(k.length),h.text),j==Jg||j>150)){if(!d)return;c="prev"}}else j=0,c="not";"prev"==c?j=b>f.first?Ng(Yd(f,b-1).text,null,g):0:"add"==c?j=i+a.options.indentUnit:"subtract"==c?j=i-a.options.indentUnit:"number"==typeof c&&(j=i+c),j=Math.max(0,j);var l="",m=0;if(a.options.indentWithTabs)for(var n=Math.floor(j/g);n;--n)m+=g,l+=" ";if(j>m&&(l+=Ee(j-m)),l!=k)return Fc(f,l,Lf(b,0),Lf(b,k.length),"+input"),h.stateAfter=null,!0;for(var n=0;n=0;b--)Fc(a.doc,"",d[b].from,d[b].to,"+delete");Lc(a)})}function Qc(a,b,c,d,e){function f(){var b=h+c;return b=a.first+a.size?!1:(h=b,k=Yd(a,b))}function g(a){var b=(e?lf:mf)(k,i,c,!0);if(null==b){if(a||!f())return!1;i=e?(0>c?df:cf)(k):0>c?k.text.length:0}else i=b;return!0}var h=b.line,i=b.ch,j=c,k=Yd(a,h);if("char"==d)g();else if("column"==d)g(!0);else if("word"==d||"group"==d)for(var l=null,m="group"==d,n=a.cm&&a.cm.getHelper(b,"wordChars"),o=!0;!(0>c)||g(!o);o=!1){var p=k.text.charAt(i)||"\n",q=Me(p,n)?"w":m&&"\n"==p?"n":!m||/\s/.test(p)?null:"p";if(!m||o||q||(q="s"),l&&l!=q){0>c&&(c=1,g());break}if(q&&(l=q),c>0&&!g(!o))break}var r=Ga(a,Lf(h,i),b,j,!0);return Mf(b,r)||(r.hitSide=!0),r}function Rc(a,b,c,d){var e,f=a.doc,g=b.left;if("page"==d){var h=Math.min(a.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);e=b.top+c*(h-(0>c?1.5:.5)*sb(a.display))}else"line"==d&&(e=c>0?b.bottom+3:b.top-3);for(;;){var i=qb(a,g,e);if(!i.outside)break;if(0>c?0>=e:e>=f.height){i.hitSide=!0;break}e+=5*c}return i}function Sc(b,c,d,e){a.defaults[b]=c,d&&(ag[b]=e?function(a,b,c){c!=bg&&d(a,b,c)}:d)}function Tc(a){for(var b,c,d,e,f=a.split(/-(?!$)/),a=f[f.length-1],g=0;g0||0==g&&f.clearWhenEmpty!==!1)return f;if(f.replacedWith&&(f.collapsed=!0,f.widgetNode=Pe("span",[f.replacedWith],"CodeMirror-widget"),d.handleMouseEvents||f.widgetNode.setAttribute("cm-ignore-events","true"),d.insertLeft&&(f.widgetNode.insertLeft=!0)),f.collapsed){if(qd(a,b.line,b,c,f)||b.line!=c.line&&qd(a,c.line,b,c,f))throw new Error("Inserting collapsed marker partially overlapping an existing one");Kf=!0}f.addToHistory&&ie(a,{from:b,to:c,origin:"markText"},a.sel,NaN);var h,i=b.line,j=a.cm;if(a.iter(i,c.line+1,function(a){j&&f.collapsed&&!j.options.lineWrapping&&rd(a)==j.display.maxLine&&(h=!0),f.collapsed&&i!=b.line&&_d(a,0),bd(a,new $c(f,i==b.line?b.ch:null,i==c.line?c.ch:null)),++i}),f.collapsed&&a.iter(b.line,c.line+1,function(b){vd(a,b)&&_d(b,0)}),f.clearOnEnter&&Dg(f,"beforeCursorEnter",function(){f.clear()}),f.readOnly&&(Jf=!0,(a.history.done.length||a.history.undone.length)&&a.clearHistory()),f.collapsed&&(f.id=++pg,f.atomic=!0),j){if(h&&(j.curOp.updateMaxLine=!0),f.collapsed)Jb(j,b.line,c.line+1);else if(f.className||f.title||f.startStyle||f.endStyle||f.css)for(var k=b.line;k<=c.line;k++)Kb(j,k,"text");f.atomic&&Da(j.doc),xe(j,"markerAdded",j,f)}return f}function Wc(a,b,c,d,e){d=Ke(d),d.shared=!1;var f=[Vc(a,b,c,d,e)],g=f[0],h=d.widgetNode;return Wd(a,function(a){h&&(d.widgetNode=h.cloneNode(!0)),f.push(Vc(a,pa(a,b),pa(a,c),d,e));for(var i=0;i=b:f.to>b);(d||(d=[])).push(new $c(g,f.from,i?null:f.to))}}return d}function dd(a,b,c){if(a)for(var d,e=0;e=b:f.to>b);if(h||f.from==b&&"bookmark"==g.type&&(!c||f.marker.insertLeft)){var i=null==f.from||(g.inclusiveLeft?f.from<=b:f.from0&&h)for(var l=0;ll;++l)o.push(p);o.push(i)}return o}function fd(a){for(var b=0;b0)){var k=[i,1],l=Mf(j.from,h.from),m=Mf(j.to,h.to);(0>l||!g.inclusiveLeft&&!l)&&k.push({from:j.from,to:h.from}),(m>0||!g.inclusiveRight&&!m)&&k.push({from:h.to,to:j.to}),e.splice.apply(e,k),i+=k.length-1}}return e}function id(a){var b=a.markedSpans;if(b){for(var c=0;c=0&&0>=l||0>=k&&l>=0)&&(0>=k&&(i.marker.inclusiveRight&&e.inclusiveLeft?Mf(j.to,c)>=0:Mf(j.to,c)>0)||k>=0&&(i.marker.inclusiveRight&&e.inclusiveLeft?Mf(j.from,d)<=0:Mf(j.from,d)<0)))return!0}}}function rd(a){for(var b;b=od(a);)a=b.find(-1,!0).line;return a}function sd(a){for(var b,c;b=pd(a);)a=b.find(1,!0).line,(c||(c=[])).push(a);return c}function td(a,b){var c=Yd(a,b),d=rd(c);return c==d?b:ae(d)}function ud(a,b){if(b>a.lastLine())return b;var c,d=Yd(a,b);if(!vd(a,d))return b;for(;c=pd(d);)d=c.find(1,!0).line;return ae(d)+1}function vd(a,b){var c=Kf&&b.markedSpans;if(c)for(var d,e=0;ef;f++){e&&(e[0]=a.innerMode(b,d).mode);var g=b.token(c,d);if(c.pos>c.start)return g}throw new Error("Mode "+b.name+" failed to advance stream.")}function Fd(a,b,c,d){function e(a){return{start:l.start,end:l.pos,string:l.current(),type:f||null,state:a?hg(g.mode,k):k}}var f,g=a.doc,h=g.mode;b=pa(g,b);var i,j=Yd(g,b.line),k=Qa(a,b.line,c),l=new og(j.text,a.options.tabSize);for(d&&(i=[]);(d||l.posa.options.maxHighlightLength?(h=!1,g&&Jd(a,b,d,l.pos),l.pos=b.length,i=null):i=Cd(Ed(c,l,d,m),f),m){var n=m[0].name;n&&(i="m-"+(i?n+" "+i:n))}if(!h||k!=i){for(;jj;){var d=e[i];d>a&&e.splice(i,1,a,e[i+1],d),i+=2,j=Math.min(a,d)}if(b)if(h.opaque)e.splice(c,i-c,a,"cm-overlay "+b),i=c+2;else for(;i>c;c+=2){var f=e[c+1];e[c+1]=(f?f+" ":"")+"cm-overlay "+b}},f)}return{styles:e,classes:f.bgClass||f.textClass?f:null}}function Id(a,b,c){if(!b.styles||b.styles[0]!=a.state.modeGen){var d=Qa(a,ae(b)),e=Hd(a,b,b.text.length>a.options.maxHighlightLength?hg(a.doc.mode,d):d);b.stateAfter=d,b.styles=e.styles,e.classes?b.styleClasses=e.classes:b.styleClasses&&(b.styleClasses=null),c===a.doc.frontier&&a.doc.frontier++}return b.styles}function Jd(a,b,c,d){var e=a.doc.mode,f=new og(b,a.options.tabSize);for(f.start=f.pos=d||0,""==b&&Dd(e,c);!f.eol();)Ed(e,f,c),f.start=f.pos}function Kd(a,b){if(!a||/^\s*$/.test(a))return null;var c=b.addModeClass?vg:ug;return c[a]||(c[a]=a.replace(/\S+/g,"cm-$&"))}function Ld(a,b){var c=Pe("span",null,null,uf?"padding-right: .1px":null),d={pre:Pe("pre",[c],"CodeMirror-line"),content:c,col:0,pos:0,cm:a,splitSpaces:(sf||uf)&&a.getOption("lineWrapping")};b.measure={};for(var e=0;e<=(b.rest?b.rest.length:0);e++){var f,g=e?b.rest[e-1]:b.line;d.pos=0,d.addToken=Nd,Ze(a.display.measure)&&(f=de(g))&&(d.addToken=Pd(d.addToken,f)),d.map=[];var h=b!=a.display.externalMeasured&&ae(g);Rd(g,d,Id(a,g,h)),g.styleClasses&&(g.styleClasses.bgClass&&(d.bgClass=Ue(g.styleClasses.bgClass,d.bgClass||"")),g.styleClasses.textClass&&(d.textClass=Ue(g.styleClasses.textClass,d.textClass||""))),0==d.map.length&&d.map.push(0,0,d.content.appendChild(Ye(a.display.measure))),0==e?(b.measure.map=d.map,b.measure.cache={}):((b.measure.maps||(b.measure.maps=[])).push(d.map),(b.measure.caches||(b.measure.caches=[])).push({}))}if(uf){var i=d.content.lastChild;(/\bcm-tab\b/.test(i.className)||i.querySelector&&i.querySelector(".cm-tab"))&&(d.content.className="cm-tab-wrap-hack")}return Gg(a,"renderLine",a,b.line,d.pre),d.pre.className&&(d.textClass=Ue(d.pre.className,d.textClass||"")),d}function Md(a){var b=Pe("span","•","cm-invalidchar");return b.title="\\u"+a.charCodeAt(0).toString(16),b.setAttribute("aria-label",b.title),b}function Nd(a,b,c,d,e,f,g){if(b){var h=a.splitSpaces?b.replace(/ {3,}/g,Od):b,i=a.cm.state.specialChars,j=!1;if(i.test(b))for(var k=document.createDocumentFragment(),l=0;;){i.lastIndex=l;var m=i.exec(b),n=m?m.index-l:b.length-l;if(n){var o=document.createTextNode(h.slice(l,l+n));sf&&9>tf?k.appendChild(Pe("span",[o])):k.appendChild(o),a.map.push(a.pos,a.pos+n,o),a.col+=n,a.pos+=n}if(!m)break;if(l+=n+1," "==m[0]){var p=a.cm.options.tabSize,q=p-a.col%p,o=k.appendChild(Pe("span",Ee(q),"cm-tab"));o.setAttribute("role","presentation"),o.setAttribute("cm-text"," "),a.col+=q}else if("\r"==m[0]||"\n"==m[0]){var o=k.appendChild(Pe("span","\r"==m[0]?"␍":"␤","cm-invalidchar"));o.setAttribute("cm-text",m[0]),a.col+=1}else{var o=a.cm.options.specialCharPlaceholder(m[0]);o.setAttribute("cm-text",m[0]),sf&&9>tf?k.appendChild(Pe("span",[o])):k.appendChild(o),a.col+=1}a.map.push(a.pos,a.pos+1,o),a.pos++}else{a.col+=b.length;var k=document.createTextNode(h);a.map.push(a.pos,a.pos+b.length,k),sf&&9>tf&&(j=!0),a.pos+=b.length}if(c||d||e||j||g){var r=c||"";d&&(r+=d),e&&(r+=e);var s=Pe("span",[k],r,g);return f&&(s.title=f),a.content.appendChild(s)}a.content.appendChild(k)}}function Od(a){for(var b=" ",c=0;cj&&m.from<=j)break}if(m.to>=k)return a(c,d,e,f,g,h,i);a(c,d.slice(0,m.to-j),e,f,null,h,i),f=null,d=d.slice(m.to-j),j=m.to}}}function Qd(a,b,c,d){var e=!d&&c.widgetNode;e&&a.map.push(a.pos,a.pos+b,e),!d&&a.cm.display.input.needsContentAttribute&&(e||(e=a.content.appendChild(document.createElement("span"))),e.setAttribute("cm-marker",c.id)),e&&(a.cm.display.input.setUneditable(e),a.content.appendChild(e)),a.pos+=b}function Rd(a,b,c){var d=a.markedSpans,e=a.text,f=0;if(d)for(var g,h,i,j,k,l,m,n=e.length,o=0,p=1,q="",r=0;;){if(r==o){i=j=k=l=h="",m=null,r=1/0;for(var s,t=[],u=0;uo||w.collapsed&&v.to==o&&v.from==o)?(null!=v.to&&v.to!=o&&r>v.to&&(r=v.to,j=""),w.className&&(i+=" "+w.className),w.css&&(h=(h?h+";":"")+w.css),w.startStyle&&v.from==o&&(k+=" "+w.startStyle),w.endStyle&&v.to==r&&(s||(s=[])).push(w.endStyle,v.to),w.title&&!l&&(l=w.title),w.collapsed&&(!m||md(m.marker,w)<0)&&(m=v)):v.from>o&&r>v.from&&(r=v.from)}if(s)for(var u=0;u=n)break;for(var x=Math.min(n,r);;){if(q){var y=o+q.length;if(!m){var z=y>x?q.slice(0,x-o):q;b.addToken(b,z,g?g+i:i,k,o+z.length==r?j:"",l,h)}if(y>=x){q=q.slice(x-o),o=x;break}o=y,k=""}q=e.slice(f,f=c[p++]),g=Kd(c[p++],b.cm.options)}}else for(var p=1;pc;++c)f.push(new tg(j[c],e(c),d));return f}var h=b.from,i=b.to,j=b.text,k=Yd(a,h.line),l=Yd(a,i.line),m=Fe(j),n=e(j.length-1),o=i.line-h.line;if(b.full)a.insert(0,g(0,j.length)),a.remove(j.length,a.size-j.length);else if(Sd(a,b)){var p=g(0,j.length-1);f(l,l.text,n),o&&a.remove(h.line,o),p.length&&a.insert(h.line,p)}else if(k==l)if(1==j.length)f(k,k.text.slice(0,h.ch)+m+k.text.slice(i.ch),n);else{var p=g(1,j.length-1);p.push(new tg(m+k.text.slice(i.ch),n,d)),f(k,k.text.slice(0,h.ch)+j[0],e(0)),a.insert(h.line+1,p)}else if(1==j.length)f(k,k.text.slice(0,h.ch)+j[0]+l.text.slice(i.ch),e(0)),a.remove(h.line+1,o);else{f(k,k.text.slice(0,h.ch)+j[0],e(0)),f(l,m+l.text.slice(i.ch),n);var p=g(1,j.length-1);o>1&&a.remove(h.line+1,o-1),a.insert(h.line+1,p)}xe(a,"change",a,b)}function Ud(a){this.lines=a,this.parent=null;for(var b=0,c=0;bb||b>=a.size)throw new Error("There is no line "+(b+a.first)+" in the document.");for(var c=a;!c.lines;)for(var d=0;;++d){var e=c.children[d],f=e.chunkSize();if(f>b){c=e;break}b-=f}return c.lines[b]}function Zd(a,b,c){var d=[],e=b.line;return a.iter(b.line,c.line+1,function(a){var f=a.text;e==c.line&&(f=f.slice(0,c.ch)),e==b.line&&(f=f.slice(b.ch)),d.push(f),++e}),d}function $d(a,b,c){var d=[];return a.iter(b,c,function(a){d.push(a.text)}),d}function _d(a,b){var c=b-a.height;if(c)for(var d=a;d;d=d.parent)d.height+=c}function ae(a){if(null==a.parent)return null;for(var b=a.parent,c=Ge(b.lines,a),d=b.parent;d;b=d,d=d.parent)for(var e=0;d.children[e]!=b;++e)c+=d.children[e].chunkSize();return c+b.first}function be(a,b){var c=a.first;a:do{for(var d=0;db){a=e;continue a}b-=f,c+=e.chunkSize()}return c}while(!a.lines);for(var d=0;db)break;b-=h}return c+d}function ce(a){a=rd(a);for(var b=0,c=a.parent,d=0;d1&&!a.done[a.done.length-2].ranges?(a.done.pop(),Fe(a.done)):void 0}function ie(a,b,c,d){var e=a.history;e.undone.length=0;var f,g=+new Date;if((e.lastOp==d||e.lastOrigin==b.origin&&b.origin&&("+"==b.origin.charAt(0)&&a.cm&&e.lastModTime>g-a.cm.options.historyEventDelay||"*"==b.origin.charAt(0)))&&(f=he(e,e.lastOp==d))){var h=Fe(f.changes);0==Mf(b.from,b.to)&&0==Mf(b.from,h.to)?h.to=$f(b):f.changes.push(fe(a,b))}else{var i=Fe(e.done);for(i&&i.ranges||le(a.sel,e.done),f={changes:[fe(a,b)],generation:e.generation},e.done.push(f);e.done.length>e.undoDepth;)e.done.shift(),e.done[0].ranges||e.done.shift()}e.done.push(c),e.generation=++e.maxGeneration,e.lastModTime=e.lastSelTime=g,e.lastOp=e.lastSelOp=d,e.lastOrigin=e.lastSelOrigin=b.origin,h||Gg(a,"historyAdded")}function je(a,b,c,d){var e=b.charAt(0);return"*"==e||"+"==e&&c.ranges.length==d.ranges.length&&c.somethingSelected()==d.somethingSelected()&&new Date-a.history.lastSelTime<=(a.cm?a.cm.options.historyEventDelay:500)}function ke(a,b,c,d){var e=a.history,f=d&&d.origin;c==e.lastSelOp||f&&e.lastSelOrigin==f&&(e.lastModTime==e.lastSelTime&&e.lastOrigin==f||je(a,f,Fe(e.done),b))?e.done[e.done.length-1]=b:le(b,e.done),e.lastSelTime=+new Date,e.lastSelOrigin=f,e.lastSelOp=c,d&&d.clearRedo!==!1&&ge(e.undone)}function le(a,b){var c=Fe(b);c&&c.ranges&&c.equals(a)||b.push(a)}function me(a,b,c,d){var e=b["spans_"+a.id],f=0;a.iter(Math.max(a.first,c),Math.min(a.first+a.size,d),function(c){c.markedSpans&&((e||(e=b["spans_"+a.id]={}))[f]=c.markedSpans),++f})}function ne(a){if(!a)return null;for(var b,c=0;c-1&&(Fe(h)[l]=k[l],delete k[l])}}}return e}function qe(a,b,c,d){c0?d.slice():Eg:d||Eg}function xe(a,b){function c(a){return function(){a.apply(null,f)}}var d=we(a,b,!1);if(d.length){var e,f=Array.prototype.slice.call(arguments,2);Sf?e=Sf.delayedCallbacks:Hg?e=Hg:(e=Hg=[],setTimeout(ye,0));for(var g=0;g0}function Ce(a){a.prototype.on=function(a,b){Dg(this,a,b)},a.prototype.off=function(a,b){Fg(this,a,b)}}function De(){this.id=null}function Ee(a){for(;Pg.length<=a;)Pg.push(Fe(Pg)+" ");return Pg[a]}function Fe(a){return a[a.length-1]}function Ge(a,b){for(var c=0;c-1&&Tg(a)?!0:b.test(a):Tg(a)}function Ne(a){for(var b in a)if(a.hasOwnProperty(b)&&a[b])return!1;return!0}function Oe(a){return a.charCodeAt(0)>=768&&Ug.test(a)}function Pe(a,b,c,d){var e=document.createElement(a);if(c&&(e.className=c),d&&(e.style.cssText=d),"string"==typeof b)e.appendChild(document.createTextNode(b));else if(b)for(var f=0;f0;--b)a.removeChild(a.firstChild);return a}function Re(a,b){return Qe(a).appendChild(b)}function Se(){for(var a=document.activeElement;a&&a.root&&a.root.activeElement;)a=a.root.activeElement;return a}function Te(a){return new RegExp("(^|\\s)"+a+"(?:$|\\s)\\s*")}function Ue(a,b){for(var c=a.split(" "),d=0;d2&&!(sf&&8>tf))}var c=Wg?Pe("span","​"):Pe("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return c.setAttribute("cm-text",""),c}function Ze(a){if(null!=Xg)return Xg;var b=Re(a,document.createTextNode("AخA")),c=Rg(b,0,1).getBoundingClientRect();if(!c||c.left==c.right)return!1;var d=Rg(b,1,2).getBoundingClientRect();return Xg=d.right-c.right<3}function $e(a){if(null!=dh)return dh;var b=Re(a,Pe("span","x")),c=b.getBoundingClientRect(),d=Rg(b,0,1).getBoundingClientRect();return dh=Math.abs(c.left-d.left)>1}function _e(a,b,c,d){if(!a)return d(b,c,"ltr");for(var e=!1,f=0;fb||b==c&&g.to==b)&&(d(Math.max(g.from,b),Math.min(g.to,c),1==g.level?"rtl":"ltr"),e=!0)}e||d(b,c,"ltr")}function af(a){return a.level%2?a.to:a.from}function bf(a){return a.level%2?a.from:a.to}function cf(a){var b=de(a);return b?af(b[0]):0}function df(a){var b=de(a);return b?bf(Fe(b)):a.text.length}function ef(a,b){var c=Yd(a.doc,b),d=rd(c);d!=c&&(b=ae(d));var e=de(d),f=e?e[0].level%2?df(d):cf(d):0;return Lf(b,f)}function ff(a,b){for(var c,d=Yd(a.doc,b);c=pd(d);)d=c.find(1,!0).line,b=null;var e=de(d),f=e?e[0].level%2?cf(d):df(d):d.text.length;return Lf(null==b?ae(d):b,f)}function gf(a,b){var c=ef(a,b.line),d=Yd(a.doc,c.line),e=de(d);if(!e||0==e[0].level){var f=Math.max(0,d.text.search(/\S/)),g=b.line==c.line&&b.ch<=f&&b.ch;return Lf(c.line,g?0:f)}return c}function hf(a,b,c){var d=a[0].level;return b==d?!0:c==d?!1:c>b}function jf(a,b){fh=null;for(var c,d=0;db)return d;if(e.from==b||e.to==b){if(null!=c)return hf(a,e.level,a[c].level)?(e.from!=e.to&&(fh=c),d):(e.from!=e.to&&(fh=d),c);c=d}}return c}function kf(a,b,c,d){if(!d)return b+c;do b+=c;while(b>0&&Oe(a.text.charAt(b)));return b}function lf(a,b,c,d){var e=de(a);if(!e)return mf(a,b,c,d);for(var f=jf(e,b),g=e[f],h=kf(a,b,g.level%2?-c:c,d);;){if(h>g.from&&h0==g.level%2?g.to:g.from);if(g=e[f+=c],!g)return null;h=c>0==g.level%2?kf(a,g.to,-1,d):kf(a,g.from,1,d)}}function mf(a,b,c,d){var e=b+c;if(d)for(;e>0&&Oe(a.text.charAt(e));)e+=c;return 0>e||e>a.text.length?null:e}var nf=navigator.userAgent,of=navigator.platform,pf=/gecko\/\d/i.test(nf),qf=/MSIE \d/.test(nf),rf=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(nf),sf=qf||rf,tf=sf&&(qf?document.documentMode||6:rf[1]),uf=/WebKit\//.test(nf),vf=uf&&/Qt\/\d+\.\d+/.test(nf),wf=/Chrome\//.test(nf),xf=/Opera\//.test(nf),yf=/Apple Computer/.test(navigator.vendor),zf=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(nf),Af=/PhantomJS/.test(nf),Bf=/AppleWebKit/.test(nf)&&/Mobile\/\w+/.test(nf),Cf=Bf||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(nf),Df=Bf||/Mac/.test(of),Ef=/\bCrOS\b/.test(nf),Ff=/win/i.test(of),Gf=xf&&nf.match(/Version\/(\d*\.\d*)/);Gf&&(Gf=Number(Gf[1])),Gf&&Gf>=15&&(xf=!1,uf=!0);var Hf=Df&&(vf||xf&&(null==Gf||12.11>Gf)),If=pf||sf&&tf>=9,Jf=!1,Kf=!1;p.prototype=Ke({update:function(a){var b=a.scrollWidth>a.clientWidth+1,c=a.scrollHeight>a.clientHeight+1,d=a.nativeBarWidth;if(c){this.vert.style.display="block",this.vert.style.bottom=b?d+"px":"0";var e=a.viewHeight-(b?d:0);this.vert.firstChild.style.height=Math.max(0,a.scrollHeight-a.clientHeight+e)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(b){this.horiz.style.display="block",this.horiz.style.right=c?d+"px":"0",this.horiz.style.left=a.barLeft+"px";var f=a.viewWidth-a.barLeft-(c?d:0);this.horiz.firstChild.style.width=a.scrollWidth-a.clientWidth+f+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&a.clientHeight>0&&(0==d&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:c?d:0,bottom:b?d:0}},setScrollLeft:function(a){this.horiz.scrollLeft!=a&&(this.horiz.scrollLeft=a),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz)},setScrollTop:function(a){this.vert.scrollTop!=a&&(this.vert.scrollTop=a),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert)},zeroWidthHack:function(){var a=Df&&!zf?"12px":"18px";this.horiz.style.height=this.vert.style.width=a,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new De,this.disableVert=new De},enableZeroWidthBar:function(a,b){function c(){var d=a.getBoundingClientRect(),e=document.elementFromPoint(d.left+1,d.bottom-1);e!=a?a.style.pointerEvents="none":b.set(1e3,c)}a.style.pointerEvents="auto",b.set(1e3,c)},clear:function(){var a=this.horiz.parentNode;a.removeChild(this.horiz),a.removeChild(this.vert)}},p.prototype),q.prototype=Ke({update:function(){ -return{bottom:0,right:0}},setScrollLeft:function(){},setScrollTop:function(){},clear:function(){}},q.prototype),a.scrollbarModel={"native":p,"null":q},z.prototype.signal=function(a,b){Be(a,b)&&this.events.push(arguments)},z.prototype.finish=function(){for(var a=0;a=9&&c.hasSelection&&(c.hasSelection=null),c.poll()}),Dg(f,"paste",function(a){ze(d,a)||$(a,d)||(d.state.pasteIncoming=!0,c.fastPoll())}),Dg(f,"cut",b),Dg(f,"copy",b),Dg(a.scroller,"paste",function(b){Tb(a,b)||ze(d,b)||(d.state.pasteIncoming=!0,c.focus())}),Dg(a.lineSpace,"selectstart",function(b){Tb(a,b)||Ag(b)}),Dg(f,"compositionstart",function(){var a=d.getCursor("from");c.composing&&c.composing.range.clear(),c.composing={start:a,range:d.markText(a,d.getCursor("to"),{className:"CodeMirror-composing"})}}),Dg(f,"compositionend",function(){c.composing&&(c.poll(),c.composing.range.clear(),c.composing=null)})},prepareSelection:function(){var a=this.cm,b=a.display,c=a.doc,d=Ja(a);if(a.options.moveInputWithCursor){var e=nb(a,c.sel.primary().head,"div"),f=b.wrapper.getBoundingClientRect(),g=b.lineDiv.getBoundingClientRect();d.teTop=Math.max(0,Math.min(b.wrapper.clientHeight-10,e.top+g.top-f.top)),d.teLeft=Math.max(0,Math.min(b.wrapper.clientWidth-10,e.left+g.left-f.left))}return d},showSelection:function(a){var b=this.cm,c=b.display;Re(c.cursorDiv,a.cursors),Re(c.selectionDiv,a.selection),null!=a.teTop&&(this.wrapper.style.top=a.teTop+"px",this.wrapper.style.left=a.teLeft+"px")},reset:function(a){if(!this.contextMenuPending){var b,c,d=this.cm,e=d.doc;if(d.somethingSelected()){this.prevInput="";var f=e.sel.primary();b=ch&&(f.to().line-f.from().line>100||(c=d.getSelection()).length>1e3);var g=b?"-":c||d.getSelection();this.textarea.value=g,d.state.focused&&Qg(this.textarea),sf&&tf>=9&&(this.hasSelection=g)}else a||(this.prevInput=this.textarea.value="",sf&&tf>=9&&(this.hasSelection=null));this.inaccurateSelection=b}},getField:function(){return this.textarea},supportsTouch:function(){return!1},focus:function(){if("nocursor"!=this.cm.options.readOnly&&(!Cf||Se()!=this.textarea))try{this.textarea.focus()}catch(a){}},blur:function(){this.textarea.blur()},resetPosition:function(){this.wrapper.style.top=this.wrapper.style.left=0},receivedFocus:function(){this.slowPoll()},slowPoll:function(){var a=this;a.pollingFast||a.polling.set(this.cm.options.pollInterval,function(){a.poll(),a.cm.state.focused&&a.slowPoll()})},fastPoll:function(){function a(){var d=c.poll();d||b?(c.pollingFast=!1,c.slowPoll()):(b=!0,c.polling.set(60,a))}var b=!1,c=this;c.pollingFast=!0,c.polling.set(20,a)},poll:function(){var a=this.cm,b=this.textarea,c=this.prevInput;if(this.contextMenuPending||!a.state.focused||bh(b)&&!c&&!this.composing||a.isReadOnly()||a.options.disableInput||a.state.keySeq)return!1;var d=b.value;if(d==c&&!a.somethingSelected())return!1;if(sf&&tf>=9&&this.hasSelection===d||Df&&/[\uf700-\uf7ff]/.test(d))return a.display.input.reset(),!1;if(a.doc.sel==a.display.selForContextMenu){var e=d.charCodeAt(0);if(8203!=e||c||(c="​"),8666==e)return this.reset(),this.cm.execCommand("undo")}for(var f=0,g=Math.min(c.length,d.length);g>f&&c.charCodeAt(f)==d.charCodeAt(f);)++f;var h=this;return Db(a,function(){Z(a,d.slice(f),c.length-f,null,h.composing?"*compose":null),d.length>1e3||d.indexOf("\n")>-1?b.value=h.prevInput="":h.prevInput=d,h.composing&&(h.composing.range.clear(),h.composing.range=a.markText(h.composing.start,a.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},ensurePolled:function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},onKeyPress:function(){sf&&tf>=9&&(this.hasSelection=null),this.fastPoll()},onContextMenu:function(a){function b(){if(null!=g.selectionStart){var a=e.somethingSelected(),b="​"+(a?g.value:"");g.value="⇚",g.value=b,d.prevInput=a?"":"​",g.selectionStart=1,g.selectionEnd=b.length,f.selForContextMenu=e.doc.sel}}function c(){if(d.contextMenuPending=!1,d.wrapper.style.cssText=l,g.style.cssText=k,sf&&9>tf&&f.scrollbars.setScrollTop(f.scroller.scrollTop=i),null!=g.selectionStart){(!sf||sf&&9>tf)&&b();var a=0,c=function(){f.selForContextMenu==e.doc.sel&&0==g.selectionStart&&g.selectionEnd>0&&"​"==d.prevInput?Eb(e,jg.selectAll)(e):a++<10?f.detectingSelectAll=setTimeout(c,500):f.input.reset()};f.detectingSelectAll=setTimeout(c,200)}}var d=this,e=d.cm,f=e.display,g=d.textarea,h=Ub(e,a),i=f.scroller.scrollTop;if(h&&!xf){var j=e.options.resetSelectionOnContextMenu;j&&-1==e.doc.sel.contains(h)&&Eb(e,Aa)(e.doc,na(h),Kg);var k=g.style.cssText,l=d.wrapper.style.cssText;d.wrapper.style.cssText="position: absolute";var m=d.wrapper.getBoundingClientRect();if(g.style.cssText="position: absolute; width: 30px; height: 30px; top: "+(a.clientY-m.top-5)+"px; left: "+(a.clientX-m.left-5)+"px; z-index: 1000; background: "+(sf?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",uf)var n=window.scrollY;if(f.input.focus(),uf&&window.scrollTo(null,n),f.input.reset(),e.somethingSelected()||(g.value=d.prevInput=" "),d.contextMenuPending=!0,f.selForContextMenu=e.doc.sel,clearTimeout(f.detectingSelectAll),sf&&tf>=9&&b(),If){Cg(a);var o=function(){Fg(window,"mouseup",o),setTimeout(c,20)};Dg(window,"mouseup",o)}else setTimeout(c,50)}},readOnlyChanged:function(a){a||this.reset()},setUneditable:Ie,needsContentAttribute:!1},ca.prototype),ea.prototype=Ke({init:function(a){function b(a){if(!ze(d,a)){if(d.somethingSelected())Nf={lineWise:!1,text:d.getSelections()},"cut"==a.type&&d.replaceSelection("",null,"cut");else{if(!d.options.lineWiseCopyCut)return;var b=aa(d);Nf={lineWise:!0,text:b.text},"cut"==a.type&&d.operation(function(){d.setSelections(b.ranges,0,Kg),d.replaceSelection("",null,"cut")})}if(a.clipboardData&&!Bf)a.preventDefault(),a.clipboardData.clearData(),a.clipboardData.setData("text/plain",Nf.text.join("\n"));else{var c=da(),e=c.firstChild;d.display.lineSpace.insertBefore(c,d.display.lineSpace.firstChild),e.value=Nf.text.join("\n");var f=document.activeElement;Qg(e),setTimeout(function(){d.display.lineSpace.removeChild(c),f.focus()},50)}}}var c=this,d=c.cm,e=c.div=a.lineDiv;ba(e),Dg(e,"paste",function(a){ze(d,a)||$(a,d)}),Dg(e,"compositionstart",function(a){var b=a.data;if(c.composing={sel:d.doc.sel,data:b,startData:b},b){var e=d.doc.sel.primary(),f=d.getLine(e.head.line),g=f.indexOf(b,Math.max(0,e.head.ch-b.length));g>-1&&g<=e.head.ch&&(c.composing.sel=na(Lf(e.head.line,g),Lf(e.head.line,g+b.length)))}}),Dg(e,"compositionupdate",function(a){c.composing.data=a.data}),Dg(e,"compositionend",function(a){var b=c.composing;b&&(a.data==b.startData||/\u200b/.test(a.data)||(b.data=a.data),setTimeout(function(){b.handled||c.applyComposition(b),c.composing==b&&(c.composing=null)},50))}),Dg(e,"touchstart",function(){c.forceCompositionEnd()}),Dg(e,"input",function(){c.composing||(d.isReadOnly()||!c.pollContent())&&Db(c.cm,function(){Jb(d)})}),Dg(e,"copy",b),Dg(e,"cut",b)},prepareSelection:function(){var a=Ja(this.cm,!1);return a.focus=this.cm.state.focused,a},showSelection:function(a,b){a&&this.cm.display.view.length&&((a.focus||b)&&this.showPrimarySelection(),this.showMultipleSelections(a))},showPrimarySelection:function(){var a=window.getSelection(),b=this.cm.doc.sel.primary(),c=ha(this.cm,a.anchorNode,a.anchorOffset),d=ha(this.cm,a.focusNode,a.focusOffset);if(!c||c.bad||!d||d.bad||0!=Mf(X(c,d),b.from())||0!=Mf(W(c,d),b.to())){var e=fa(this.cm,b.from()),f=fa(this.cm,b.to());if(e||f){var g=this.cm.display.view,h=a.rangeCount&&a.getRangeAt(0);if(e){if(!f){var i=g[g.length-1].measure,j=i.maps?i.maps[i.maps.length-1]:i.map;f={node:j[j.length-1],offset:j[j.length-2]-j[j.length-3]}}}else e={node:g[0].measure.map[2],offset:0};try{var k=Rg(e.node,e.offset,f.offset,f.node)}catch(l){}k&&(!pf&&this.cm.state.focused?(a.collapse(e.node,e.offset),k.collapsed||a.addRange(k)):(a.removeAllRanges(),a.addRange(k)),h&&null==a.anchorNode?a.addRange(h):pf&&this.startGracePeriod()),this.rememberSelection()}}},startGracePeriod:function(){var a=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){a.gracePeriod=!1,a.selectionChanged()&&a.cm.operation(function(){a.cm.curOp.selectionChanged=!0})},20)},showMultipleSelections:function(a){Re(this.cm.display.cursorDiv,a.cursors),Re(this.cm.display.selectionDiv,a.selection)},rememberSelection:function(){var a=window.getSelection();this.lastAnchorNode=a.anchorNode,this.lastAnchorOffset=a.anchorOffset,this.lastFocusNode=a.focusNode,this.lastFocusOffset=a.focusOffset},selectionInEditor:function(){var a=window.getSelection();if(!a.rangeCount)return!1;var b=a.getRangeAt(0).commonAncestorContainer;return Vg(this.div,b)},focus:function(){"nocursor"!=this.cm.options.readOnly&&this.div.focus()},blur:function(){this.div.blur()},getField:function(){return this.div},supportsTouch:function(){return!0},receivedFocus:function(){function a(){b.cm.state.focused&&(b.pollSelection(),b.polling.set(b.cm.options.pollInterval,a))}var b=this;this.selectionInEditor()?this.pollSelection():Db(this.cm,function(){b.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,a)},selectionChanged:function(){var a=window.getSelection();return a.anchorNode!=this.lastAnchorNode||a.anchorOffset!=this.lastAnchorOffset||a.focusNode!=this.lastFocusNode||a.focusOffset!=this.lastFocusOffset},pollSelection:function(){if(!this.composing&&!this.gracePeriod&&this.selectionChanged()){var a=window.getSelection(),b=this.cm;this.rememberSelection();var c=ha(b,a.anchorNode,a.anchorOffset),d=ha(b,a.focusNode,a.focusOffset);c&&d&&Db(b,function(){Aa(b.doc,na(c,d),Kg),(c.bad||d.bad)&&(b.curOp.selectionChanged=!0)})}},pollContent:function(){var a=this.cm,b=a.display,c=a.doc.sel.primary(),d=c.from(),e=c.to();if(d.lineb.viewTo-1)return!1;var f;if(d.line==b.viewFrom||0==(f=Mb(a,d.line)))var g=ae(b.view[0].line),h=b.view[0].node;else var g=ae(b.view[f].line),h=b.view[f-1].node.nextSibling;var i=Mb(a,e.line);if(i==b.view.length-1)var j=b.viewTo-1,k=b.lineDiv.lastChild;else var j=ae(b.view[i+1].line)-1,k=b.view[i+1].node.previousSibling;for(var l=a.doc.splitLines(ja(a,h,k,g,j)),m=Zd(a.doc,Lf(g,0),Lf(j,Yd(a.doc,j).text.length));l.length>1&&m.length>1;)if(Fe(l)==Fe(m))l.pop(),m.pop(),j--;else{if(l[0]!=m[0])break;l.shift(),m.shift(),g++}for(var n=0,o=0,p=l[0],q=m[0],r=Math.min(p.length,q.length);r>n&&p.charCodeAt(n)==q.charCodeAt(n);)++n;for(var s=Fe(l),t=Fe(m),u=Math.min(s.length-(1==l.length?n:0),t.length-(1==m.length?n:0));u>o&&s.charCodeAt(s.length-o-1)==t.charCodeAt(t.length-o-1);)++o;l[l.length-1]=s.slice(0,s.length-o),l[0]=l[0].slice(n);var v=Lf(g,n),w=Lf(j,m.length?Fe(m).length-o:0);return l.length>1||l[0]||Mf(v,w)?(Fc(a.doc,l,v,w,"+input"),!0):void 0},ensurePolled:function(){this.forceCompositionEnd()},reset:function(){this.forceCompositionEnd()},forceCompositionEnd:function(){this.composing&&!this.composing.handled&&(this.applyComposition(this.composing),this.composing.handled=!0,this.div.blur(),this.div.focus())},applyComposition:function(a){this.cm.isReadOnly()?Eb(this.cm,Jb)(this.cm):a.data&&a.data!=a.startData&&Eb(this.cm,Z)(this.cm,a.data,0,a.sel)},setUneditable:function(a){a.contentEditable="false"},onKeyPress:function(a){a.preventDefault(),this.cm.isReadOnly()||Eb(this.cm,Z)(this.cm,String.fromCharCode(null==a.charCode?a.keyCode:a.charCode),0)},readOnlyChanged:function(a){this.div.contentEditable=String("nocursor"!=a)},onContextMenu:Ie,resetPosition:Ie,needsContentAttribute:!0},ea.prototype),a.inputStyles={textarea:ca,contenteditable:ea},ka.prototype={primary:function(){return this.ranges[this.primIndex]},equals:function(a){if(a==this)return!0;if(a.primIndex!=this.primIndex||a.ranges.length!=this.ranges.length)return!1;for(var b=0;b=0&&Mf(a,d.to())<=0)return c}return-1}},la.prototype={from:function(){return X(this.anchor,this.head)},to:function(){return W(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};var Of,Pf,Qf,Rf={left:0,right:0,top:0,bottom:0},Sf=null,Tf=0,Uf=0,Vf=0,Wf=null;sf?Wf=-.53:pf?Wf=15:wf?Wf=-.7:yf&&(Wf=-1/3);var Xf=function(a){var b=a.wheelDeltaX,c=a.wheelDeltaY;return null==b&&a.detail&&a.axis==a.HORIZONTAL_AXIS&&(b=a.detail),null==c&&a.detail&&a.axis==a.VERTICAL_AXIS?c=a.detail:null==c&&(c=a.wheelDelta),{x:b,y:c}};a.wheelEventPixels=function(a){var b=Xf(a);return b.x*=Wf,b.y*=Wf,b};var Yf=new De,Zf=null,$f=a.changeEnd=function(a){return a.text?Lf(a.from.line+a.text.length-1,Fe(a.text).length+(1==a.text.length?a.from.ch:0)):a.to};a.prototype={constructor:a,focus:function(){window.focus(),this.display.input.focus()},setOption:function(a,b){var c=this.options,d=c[a];(c[a]!=b||"mode"==a)&&(c[a]=b,ag.hasOwnProperty(a)&&Eb(this,ag[a])(this,b,d))},getOption:function(a){return this.options[a]},getDoc:function(){return this.doc},addKeyMap:function(a,b){this.state.keyMaps[b?"push":"unshift"](Uc(a))},removeKeyMap:function(a){for(var b=this.state.keyMaps,c=0;cc&&(Nc(this,e.head.line,a,!0),c=e.head.line,d==this.doc.sel.primIndex&&Lc(this));else{var f=e.from(),g=e.to(),h=Math.max(c,f.line);c=Math.min(this.lastLine(),g.line-(g.ch?0:1))+1;for(var i=h;c>i;++i)Nc(this,i,a);var j=this.doc.sel.ranges;0==f.ch&&b.length==j.length&&j[d].from().ch>0&&wa(this.doc,d,new la(f,j[d].to()),Kg)}}}),getTokenAt:function(a,b){return Fd(this,a,b)},getLineTokens:function(a,b){return Fd(this,Lf(a),b,!0)},getTokenTypeAt:function(a){a=pa(this.doc,a);var b,c=Id(this,Yd(this.doc,a.line)),d=0,e=(c.length-1)/2,f=a.ch;if(0==f)b=c[2];else for(;;){var g=d+e>>1;if((g?c[2*g-1]:0)>=f)e=g;else{if(!(c[2*g+1]h?b:0==h?null:b.slice(0,h-1)},getModeAt:function(b){var c=this.doc.mode;return c.innerMode?a.innerMode(c,this.getTokenAt(b).state).mode:c},getHelper:function(a,b){return this.getHelpers(a,b)[0]},getHelpers:function(a,b){var c=[];if(!gg.hasOwnProperty(b))return c;var d=gg[b],e=this.getModeAt(a);if("string"==typeof e[b])d[e[b]]&&c.push(d[e[b]]);else if(e[b])for(var f=0;fe&&(a=e,d=!0),c=Yd(this.doc,a)}else c=a;return kb(this,c,{top:0,left:0},b||"page").top+(d?this.doc.height-ce(c):0)},defaultTextHeight:function(){return sb(this.display)},defaultCharWidth:function(){return tb(this.display)},setGutterMarker:Fb(function(a,b,c){return Oc(this.doc,a,"gutter",function(a){var d=a.gutterMarkers||(a.gutterMarkers={});return d[b]=c,!c&&Ne(d)&&(a.gutterMarkers=null),!0})}),clearGutter:Fb(function(a){var b=this,c=b.doc,d=c.first;c.iter(function(c){c.gutterMarkers&&c.gutterMarkers[a]&&(c.gutterMarkers[a]=null,Kb(b,d,"gutter"),Ne(c.gutterMarkers)&&(c.gutterMarkers=null)),++d})}),lineInfo:function(a){if("number"==typeof a){if(!ra(this.doc,a))return null;var b=a;if(a=Yd(this.doc,a),!a)return null}else{var b=ae(a);if(null==b)return null}return{line:b,handle:a,text:a.text,gutterMarkers:a.gutterMarkers,textClass:a.textClass,bgClass:a.bgClass,wrapClass:a.wrapClass,widgets:a.widgets}},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(a,b,c,d,e){var f=this.display;a=nb(this,pa(this.doc,a));var g=a.bottom,h=a.left;if(b.style.position="absolute",b.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(b),f.sizer.appendChild(b),"over"==d)g=a.top;else if("above"==d||"near"==d){var i=Math.max(f.wrapper.clientHeight,this.doc.height),j=Math.max(f.sizer.clientWidth,f.lineSpace.clientWidth);("above"==d||a.bottom+b.offsetHeight>i)&&a.top>b.offsetHeight?g=a.top-b.offsetHeight:a.bottom+b.offsetHeight<=i&&(g=a.bottom),h+b.offsetWidth>j&&(h=j-b.offsetWidth)}b.style.top=g+"px",b.style.left=b.style.right="","right"==e?(h=f.sizer.clientWidth-b.offsetWidth,b.style.right="0px"):("left"==e?h=0:"middle"==e&&(h=(f.sizer.clientWidth-b.offsetWidth)/2),b.style.left=h+"px"),c&&Ic(this,h,g,h+b.offsetWidth,g+b.offsetHeight)},triggerOnKeyDown:Fb(lc),triggerOnKeyPress:Fb(oc),triggerOnKeyUp:nc,execCommand:function(a){return jg.hasOwnProperty(a)?jg[a].call(null,this):void 0},triggerElectric:Fb(function(a){_(this,a)}),findPosH:function(a,b,c,d){var e=1;0>b&&(e=-1,b=-b);for(var f=0,g=pa(this.doc,a);b>f&&(g=Qc(this.doc,g,e,c,d),!g.hitSide);++f);return g},moveH:Fb(function(a,b){var c=this;c.extendSelectionsBy(function(d){return c.display.shift||c.doc.extend||d.empty()?Qc(c.doc,d.head,a,b,c.options.rtlMoveVisually):0>a?d.from():d.to()},Mg)}),deleteH:Fb(function(a,b){var c=this.doc.sel,d=this.doc;c.somethingSelected()?d.replaceSelection("",null,"+delete"):Pc(this,function(c){var e=Qc(d,c.head,a,b,!1);return 0>a?{from:e,to:c.head}:{from:c.head,to:e}})}),findPosV:function(a,b,c,d){var e=1,f=d;0>b&&(e=-1,b=-b);for(var g=0,h=pa(this.doc,a);b>g;++g){var i=nb(this,h,"div");if(null==f?f=i.left:i.left=f,h=Rc(this,i,e,c),h.hitSide)break}return h},moveV:Fb(function(a,b){var c=this,d=this.doc,e=[],f=!c.display.shift&&!d.extend&&d.sel.somethingSelected();if(d.extendSelectionsBy(function(g){if(f)return 0>a?g.from():g.to();var h=nb(c,g.head,"div");null!=g.goalColumn&&(h.left=g.goalColumn),e.push(h.left);var i=Rc(c,h,a,b);return"page"==b&&g==d.sel.primary()&&Kc(c,null,mb(c,i,"div").top-h.top),i},Mg),e.length)for(var g=0;g0&&h(c.charAt(d-1));)--d;for(;e.5)&&g(this),Gg(this,"refresh",this)}),swapDoc:Fb(function(a){var b=this.doc;return b.cm=null,Xd(this,a),hb(this),this.display.input.reset(),this.scrollTo(a.scrollLeft,a.scrollTop),this.curOp.forceScroll=!0,xe(this,"swapDoc",this,b),b}),getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Ce(a);var _f=a.defaults={},ag=a.optionHandlers={},bg=a.Init={toString:function(){return"CodeMirror.Init"}};Sc("value","",function(a,b){a.setValue(b)},!0),Sc("mode",null,function(a,b){a.doc.modeOption=b,c(a)},!0),Sc("indentUnit",2,c,!0),Sc("indentWithTabs",!1),Sc("smartIndent",!0),Sc("tabSize",4,function(a){d(a),hb(a),Jb(a)},!0),Sc("lineSeparator",null,function(a,b){if(a.doc.lineSep=b,b){var c=[],d=a.doc.first;a.doc.iter(function(a){for(var e=0;;){var f=a.text.indexOf(b,e);if(-1==f)break;e=f+b.length,c.push(Lf(d,f))}d++});for(var e=c.length-1;e>=0;e--)Fc(a.doc,b,c[e],Lf(c[e].line,c[e].ch+b.length))}}),Sc("specialChars",/[\u0000-\u001f\u007f\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g,function(b,c,d){b.state.specialChars=new RegExp(c.source+(c.test(" ")?"":"| "),"g"),d!=a.Init&&b.refresh()}),Sc("specialCharPlaceholder",Md,function(a){a.refresh()},!0),Sc("electricChars",!0),Sc("inputStyle",Cf?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),Sc("rtlMoveVisually",!Ff),Sc("wholeLineUpdateBefore",!0),Sc("theme","default",function(a){h(a),i(a)},!0),Sc("keyMap","default",function(b,c,d){var e=Uc(c),f=d!=a.Init&&Uc(d);f&&f.detach&&f.detach(b,e),e.attach&&e.attach(b,f||null)}),Sc("extraKeys",null),Sc("lineWrapping",!1,e,!0),Sc("gutters",[],function(a){n(a.options),i(a)},!0),Sc("fixedGutter",!0,function(a,b){a.display.gutters.style.left=b?y(a.display)+"px":"0",a.refresh()},!0),Sc("coverGutterNextToScrollbar",!1,function(a){s(a)},!0),Sc("scrollbarStyle","native",function(a){r(a),s(a),a.display.scrollbars.setScrollTop(a.doc.scrollTop),a.display.scrollbars.setScrollLeft(a.doc.scrollLeft)},!0),Sc("lineNumbers",!1,function(a){n(a.options),i(a)},!0),Sc("firstLineNumber",1,i,!0),Sc("lineNumberFormatter",function(a){return a},i,!0),Sc("showCursorWhenSelecting",!1,Ia,!0),Sc("resetSelectionOnContextMenu",!0),Sc("lineWiseCopyCut",!0),Sc("readOnly",!1,function(a,b){"nocursor"==b?(rc(a),a.display.input.blur(),a.display.disabled=!0):a.display.disabled=!1,a.display.input.readOnlyChanged(b)}),Sc("disableInput",!1,function(a,b){b||a.display.input.reset()},!0),Sc("dragDrop",!0,Rb),Sc("allowDropFileTypes",null),Sc("cursorBlinkRate",530),Sc("cursorScrollMargin",0),Sc("cursorHeight",1,Ia,!0),Sc("singleCursorHeightPerLine",!0,Ia,!0),Sc("workTime",100),Sc("workDelay",100),Sc("flattenSpans",!0,d,!0),Sc("addModeClass",!1,d,!0),Sc("pollInterval",100),Sc("undoDepth",200,function(a,b){a.doc.history.undoDepth=b}),Sc("historyEventDelay",1250),Sc("viewportMargin",10,function(a){a.refresh()},!0),Sc("maxHighlightLength",1e4,d,!0),Sc("moveInputWithCursor",!0,function(a,b){b||a.display.input.resetPosition()}),Sc("tabindex",null,function(a,b){a.display.input.getField().tabIndex=b||""}),Sc("autofocus",null);var cg=a.modes={},dg=a.mimeModes={};a.defineMode=function(b,c){a.defaults.mode||"null"==b||(a.defaults.mode=b),arguments.length>2&&(c.dependencies=Array.prototype.slice.call(arguments,2)),cg[b]=c},a.defineMIME=function(a,b){dg[a]=b},a.resolveMode=function(b){if("string"==typeof b&&dg.hasOwnProperty(b))b=dg[b];else if(b&&"string"==typeof b.name&&dg.hasOwnProperty(b.name)){var c=dg[b.name];"string"==typeof c&&(c={name:c}),b=Je(c,b),b.name=c.name}else if("string"==typeof b&&/^[\w\-]+\/[\w\-]+\+xml$/.test(b))return a.resolveMode("application/xml");return"string"==typeof b?{name:b}:b||{name:"null"}},a.getMode=function(b,c){var c=a.resolveMode(c),d=cg[c.name];if(!d)return a.getMode(b,"text/plain");var e=d(b,c);if(eg.hasOwnProperty(c.name)){var f=eg[c.name];for(var g in f)f.hasOwnProperty(g)&&(e.hasOwnProperty(g)&&(e["_"+g]=e[g]),e[g]=f[g])}if(e.name=c.name,c.helperType&&(e.helperType=c.helperType),c.modeProps)for(var g in c.modeProps)e[g]=c.modeProps[g];return e},a.defineMode("null",function(){return{token:function(a){a.skipToEnd()}}}),a.defineMIME("text/plain","null");var eg=a.modeExtensions={};a.extendMode=function(a,b){var c=eg.hasOwnProperty(a)?eg[a]:eg[a]={};Ke(b,c)},a.defineExtension=function(b,c){a.prototype[b]=c},a.defineDocExtension=function(a,b){xg.prototype[a]=b},a.defineOption=Sc;var fg=[];a.defineInitHook=function(a){fg.push(a)};var gg=a.helpers={};a.registerHelper=function(b,c,d){gg.hasOwnProperty(b)||(gg[b]=a[b]={_global:[]}),gg[b][c]=d},a.registerGlobalHelper=function(b,c,d,e){a.registerHelper(b,c,e),gg[b]._global.push({pred:d,val:e})};var hg=a.copyState=function(a,b){if(b===!0)return b;if(a.copyState)return a.copyState(b);var c={};for(var d in b){var e=b[d];e instanceof Array&&(e=e.concat([])),c[d]=e}return c},ig=a.startState=function(a,b,c){return a.startState?a.startState(b,c):!0};a.innerMode=function(a,b){for(;a.innerMode;){var c=a.innerMode(b);if(!c||c.mode==a)break;b=c.state,a=c.mode}return c||{mode:a,state:b}};var jg=a.commands={selectAll:function(a){a.setSelection(Lf(a.firstLine(),0),Lf(a.lastLine()),Kg)},singleSelection:function(a){a.setSelection(a.getCursor("anchor"),a.getCursor("head"),Kg)},killLine:function(a){Pc(a,function(b){if(b.empty()){var c=Yd(a.doc,b.head.line).text.length;return b.head.ch==c&&b.head.line0)e=new Lf(e.line,e.ch+1),a.replaceRange(f.charAt(e.ch-1)+f.charAt(e.ch-2),Lf(e.line,e.ch-2),e,"+transpose");else if(e.line>a.doc.first){var g=Yd(a.doc,e.line-1).text;g&&a.replaceRange(f.charAt(0)+a.doc.lineSeparator()+g.charAt(g.length-1),Lf(e.line-1,g.length-1),Lf(e.line,1),"+transpose")}c.push(new la(e,e))}a.setSelections(c)})},newlineAndIndent:function(a){Db(a,function(){for(var b=a.listSelections().length,c=0;b>c;c++){var d=a.listSelections()[c];a.replaceRange(a.doc.lineSeparator(),d.anchor,d.head,"+input"),a.indentLine(d.from().line+1,null,!0)}Lc(a)})},openLine:function(a){a.replaceSelection("\n","start")},toggleOverwrite:function(a){ -a.toggleOverwrite()}},kg=a.keyMap={};kg.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},kg.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},kg.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},kg.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},kg["default"]=Df?kg.macDefault:kg.pcDefault,a.normalizeKeyMap=function(a){var b={};for(var c in a)if(a.hasOwnProperty(c)){var d=a[c];if(/^(name|fallthrough|(de|at)tach)$/.test(c))continue;if("..."==d){delete a[c];continue}for(var e=He(c.split(" "),Tc),f=0;f=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){return this.posb},eatSpace:function(){for(var a=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>a},skipToEnd:function(){this.pos=this.string.length},skipTo:function(a){var b=this.string.indexOf(a,this.pos);return b>-1?(this.pos=b,!0):void 0},backUp:function(a){this.pos-=a},column:function(){return this.lastColumnPos0?null:(d&&b!==!1&&(this.pos+=d[0].length),d)}var e=function(a){return c?a.toLowerCase():a},f=this.string.substr(this.pos,a.length);return e(f)==e(a)?(b!==!1&&(this.pos+=a.length),!0):void 0},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(a,b){this.lineStart+=a;try{return b()}finally{this.lineStart-=a}}};var pg=0,qg=a.TextMarker=function(a,b){this.lines=[],this.type=b,this.doc=a,this.id=++pg};Ce(qg),qg.prototype.clear=function(){if(!this.explicitlyCleared){var a=this.doc.cm,b=a&&!a.curOp;if(b&&ub(a),Be(this,"clear")){var c=this.find();c&&xe(this,"clear",c.from,c.to)}for(var d=null,e=null,f=0;fa.display.maxLineLength&&(a.display.maxLine=i,a.display.maxLineLength=j,a.display.maxLineChanged=!0)}null!=d&&a&&this.collapsed&&Jb(a,d,e+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,a&&Da(a.doc)),a&&xe(a,"markerCleared",a,this),b&&wb(a),this.parent&&this.parent.clear()}},qg.prototype.find=function(a,b){null==a&&"bookmark"==this.type&&(a=1);for(var c,d,e=0;ec;++c){var e=this.lines[c];this.height-=e.height,Bd(e),xe(e,"delete")}this.lines.splice(a,b)},collapse:function(a){a.push.apply(a,this.lines)},insertInner:function(a,b,c){this.height+=c,this.lines=this.lines.slice(0,a).concat(b).concat(this.lines.slice(a));for(var d=0;da;++a)if(c(this.lines[a]))return!0}},Vd.prototype={chunkSize:function(){return this.size},removeInner:function(a,b){this.size-=b;for(var c=0;ca){var f=Math.min(b,e-a),g=d.height;if(d.removeInner(a,f),this.height-=g-d.height,e==f&&(this.children.splice(c--,1),d.parent=null),0==(b-=f))break;a=0}else a-=e}if(this.size-b<25&&(this.children.length>1||!(this.children[0]instanceof Ud))){var h=[];this.collapse(h),this.children=[new Ud(h)],this.children[0].parent=this}},collapse:function(a){for(var b=0;b=a){if(e.insertInner(a,b,c),e.lines&&e.lines.length>50){for(var g=e.lines.length%25+25,h=g;h10);a.parent.maybeSpill()}},iterN:function(a,b,c){for(var d=0;da){var g=Math.min(b,f-a);if(e.iterN(a,g,c))return!0;if(0==(b-=g))break;a=0}else a-=f}}};var wg=0,xg=a.Doc=function(a,b,c,d){if(!(this instanceof xg))return new xg(a,b,c,d);null==c&&(c=0),Vd.call(this,[new Ud([new tg("",null)])]),this.first=c,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.frontier=c;var e=Lf(c,0);this.sel=na(e),this.history=new ee(null),this.id=++wg,this.modeOption=b,this.lineSep=d,this.extend=!1,"string"==typeof a&&(a=this.splitLines(a)),Td(this,{from:e,to:e,text:a}),Aa(this,na(e),Kg)};xg.prototype=Je(Vd.prototype,{constructor:xg,iter:function(a,b,c){c?this.iterN(a-this.first,b-a,c):this.iterN(this.first,this.first+this.size,a)},insert:function(a,b){for(var c=0,d=0;d=0;f--)zc(this,d[f]);h?za(this,h):this.cm&&Lc(this.cm)}),undo:Gb(function(){Bc(this,"undo")}),redo:Gb(function(){Bc(this,"redo")}),undoSelection:Gb(function(){Bc(this,"undo",!0)}),redoSelection:Gb(function(){Bc(this,"redo",!0)}),setExtending:function(a){this.extend=a},getExtending:function(){return this.extend},historySize:function(){for(var a=this.history,b=0,c=0,d=0;d=a.ch)&&b.push(e.marker.parent||e.marker)}return b},findMarks:function(a,b,c){a=pa(this,a),b=pa(this,b);var d=[],e=a.line;return this.iter(a.line,b.line+1,function(f){var g=f.markedSpans;if(g)for(var h=0;h=i.to||null==i.from&&e!=a.line||null!=i.from&&e==b.line&&i.from>=b.ch||c&&!c(i.marker)||d.push(i.marker.parent||i.marker)}++e}),d},getAllMarks:function(){var a=[];return this.iter(function(b){var c=b.markedSpans;if(c)for(var d=0;da?(b=a,!0):(a-=f,void++c)}),pa(this,Lf(c,b))},indexFromPos:function(a){a=pa(this,a);var b=a.ch;if(a.lineb&&(b=a.from),null!=a.to&&a.toh||h>=b)return g+(b-f);g+=h-f,g+=c-g%c,f=h+1}},Og=a.findColumn=function(a,b,c){for(var d=0,e=0;;){var f=a.indexOf(" ",d);-1==f&&(f=a.length);var g=f-d;if(f==a.length||e+g>=b)return d+Math.min(g,b-e);if(e+=f-d,e+=c-e%c,d=f+1,e>=b)return d}},Pg=[""],Qg=function(a){a.select()};Bf?Qg=function(a){a.selectionStart=0,a.selectionEnd=a.value.length}:sf&&(Qg=function(a){try{a.select()}catch(b){}});var Rg,Sg=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Tg=a.isWordChar=function(a){return/\w/.test(a)||a>"€"&&(a.toUpperCase()!=a.toLowerCase()||Sg.test(a))},Ug=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;Rg=document.createRange?function(a,b,c,d){var e=document.createRange();return e.setEnd(d||a,c),e.setStart(a,b),e}:function(a,b,c){var d=document.body.createTextRange();try{d.moveToElementText(a.parentNode)}catch(e){return d}return d.collapse(!0),d.moveEnd("character",c),d.moveStart("character",b),d};var Vg=a.contains=function(a,b){if(3==b.nodeType&&(b=b.parentNode),a.contains)return a.contains(b);do if(11==b.nodeType&&(b=b.host),b==a)return!0;while(b=b.parentNode)};sf&&11>tf&&(Se=function(){try{return document.activeElement}catch(a){return document.body}});var Wg,Xg,Yg=a.rmClass=function(a,b){var c=a.className,d=Te(b).exec(c);if(d){var e=c.slice(d.index+d[0].length);a.className=c.slice(0,d.index)+(e?d[1]+e:"")}},Zg=a.addClass=function(a,b){var c=a.className;Te(b).test(c)||(a.className+=(c?" ":"")+b)},$g=!1,_g=function(){if(sf&&9>tf)return!1;var a=Pe("div");return"draggable"in a||"dragDrop"in a}(),ah=a.splitLines=3!="\n\nb".split(/\n/).length?function(a){for(var b=0,c=[],d=a.length;d>=b;){var e=a.indexOf("\n",b);-1==e&&(e=a.length);var f=a.slice(b,"\r"==a.charAt(e-1)?e-1:e),g=f.indexOf("\r");-1!=g?(c.push(f.slice(0,g)),b+=g+1):(c.push(f),b=e+1)}return c}:function(a){return a.split(/\r\n?|\n/)},bh=window.getSelection?function(a){try{return a.selectionStart!=a.selectionEnd}catch(b){return!1}}:function(a){try{var b=a.ownerDocument.selection.createRange()}catch(c){}return b&&b.parentElement()==a?0!=b.compareEndPoints("StartToEnd",b):!1},ch=function(){var a=Pe("div");return"oncopy"in a?!0:(a.setAttribute("oncopy","return;"),"function"==typeof a.oncopy)}(),dh=null,eh=a.keyNames={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};!function(){for(var a=0;10>a;a++)eh[a+48]=eh[a+96]=String(a);for(var a=65;90>=a;a++)eh[a]=String.fromCharCode(a);for(var a=1;12>=a;a++)eh[a+111]=eh[a+63235]="F"+a}();var fh,gh=function(){function a(a){return 247>=a?c.charAt(a):a>=1424&&1524>=a?"R":a>=1536&&1773>=a?d.charAt(a-1536):a>=1774&&2220>=a?"r":a>=8192&&8203>=a?"w":8204==a?"b":"L"}function b(a,b,c){this.level=a,this.from=b,this.to=c}var c="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",d="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",e=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,f=/[stwN]/,g=/[LRr]/,h=/[Lb1n]/,i=/[1n]/,j="L";return function(c){if(!e.test(c))return!1;for(var d,k=c.length,l=[],m=0;k>m;++m)l.push(d=a(c.charCodeAt(m)));for(var m=0,n=j;k>m;++m){var d=l[m];"m"==d?l[m]=n:n=d}for(var m=0,o=j;k>m;++m){var d=l[m];"1"==d&&"r"==o?l[m]="n":g.test(d)&&(o=d,"r"==d&&(l[m]="R"))}for(var m=1,n=l[0];k-1>m;++m){var d=l[m];"+"==d&&"1"==n&&"1"==l[m+1]?l[m]="1":","!=d||n!=l[m+1]||"1"!=n&&"n"!=n||(l[m]=n),n=d}for(var m=0;k>m;++m){var d=l[m];if(","==d)l[m]="N";else if("%"==d){for(var p=m+1;k>p&&"%"==l[p];++p);for(var q=m&&"!"==l[m-1]||k>p&&"1"==l[p]?"1":"N",r=m;p>r;++r)l[r]=q;m=p-1}}for(var m=0,o=j;k>m;++m){var d=l[m];"L"==o&&"1"==d?l[m]="L":g.test(d)&&(o=d)}for(var m=0;k>m;++m)if(f.test(l[m])){for(var p=m+1;k>p&&f.test(l[p]);++p);for(var s="L"==(m?l[m-1]:j),t="L"==(k>p?l[p]:j),q=s||t?"L":"R",r=m;p>r;++r)l[r]=q;m=p-1}for(var u,v=[],m=0;k>m;)if(h.test(l[m])){var w=m;for(++m;k>m&&h.test(l[m]);++m);v.push(new b(0,w,m))}else{var x=m,y=v.length;for(++m;k>m&&"L"!=l[m];++m);for(var r=x;m>r;)if(i.test(l[r])){r>x&&v.splice(y,0,new b(1,x,r));var z=r;for(++r;m>r&&i.test(l[r]);++r);v.splice(y,0,new b(2,z,r)),x=r}else++r;m>x&&v.splice(y,0,new b(1,x,m))}return 1==v[0].level&&(u=c.match(/^\s+/))&&(v[0].from=u[0].length,v.unshift(new b(0,0,u[0].length))),1==Fe(v).level&&(u=c.match(/\s+$/))&&(Fe(v).to-=u[0].length,v.push(new b(0,k-u[0].length,k))),2==v[0].level&&v.unshift(new b(1,v[0].to,v[0].to)),v[0].level!=Fe(v).level&&v.push(new b(v[0].level,k,k)),v}}();return a.version="5.15.2",a}); \ No newline at end of file +f=e+1):(h==a.length-3||b==j&&a[h+3]>b)&&(f=j-i,e=f-1,b>=j&&(g="right")),null!=e){if(d=a[h+2],i==j&&c==(d.insertLeft?"left":"right")&&(g=c),"left"==c&&0==e)for(;h&&a[h-2]==a[h-3]&&a[h-1].insertLeft;)d=a[(h-=3)+2],g="left";if("right"==c&&e==j-i)for(;hk;k++){for(;h&&Oe(b.line.text.charAt(f.coverStart+h));)--h;for(;f.coverStart+itf&&0==h&&i==f.coverEnd-f.coverStart)e=g.parentNode.getBoundingClientRect();else if(sf&&a.options.lineWrapping){var l=Rg(g,h,i).getClientRects();e=l.length?l["right"==d?l.length-1:0]:Rf}else e=Rg(g,h,i).getBoundingClientRect()||Rf;if(e.left||e.right||0==h)break;i=h,h-=1,j="right"}sf&&11>tf&&(e=eb(a.display.measure,e))}else{h>0&&(j=d="right");var l;e=a.options.lineWrapping&&(l=g.getClientRects()).length>1?l["right"==d?l.length-1:0]:g.getBoundingClientRect()}if(sf&&9>tf&&!h&&(!e||!e.left&&!e.right)){var m=g.parentNode.getClientRects()[0];e=m?{left:m.left,right:m.left+tb(a.display),top:m.top,bottom:m.bottom}:Rf}for(var n=e.top-b.rect.top,o=e.bottom-b.rect.top,p=(n+o)/2,q=b.view.measure.heights,k=0;kc.from?g(a-1):g(a,d)}d=d||Yd(a.doc,b.line),e||(e=ab(a,d));var i=de(d),j=b.ch;if(!i)return g(j);var k=jf(i,j),l=h(j,k);return null!=fh&&(l.other=h(j,fh)),l}function ob(a,b){var c=0,b=pa(a.doc,b);a.options.lineWrapping||(c=tb(a.display)*b.ch);var d=Yd(a.doc,b.line),e=ce(d)+Ra(a.display);return{left:c,right:c,top:e,bottom:e+d.height}}function pb(a,b,c,d){var e=Lf(a,b);return e.xRel=d,c&&(e.outside=!0),e}function qb(a,b,c){var d=a.doc;if(c+=a.display.viewOffset,0>c)return pb(d.first,0,!0,-1);var e=be(d,c),f=d.first+d.size-1;if(e>f)return pb(d.first+d.size-1,Yd(d,f).text.length,!0,1);0>b&&(b=0);for(var g=Yd(d,e);;){var h=rb(a,g,e,b,c),i=pd(g),j=i&&i.find(0,!0);if(!i||!(h.ch>j.from.ch||h.ch==j.from.ch&&h.xRel>0))return h;e=ae(g=j.to.line)}}function rb(a,b,c,d,e){function f(d){var e=nb(a,Lf(c,d),"line",b,j);return h=!0,g>e.bottom?e.left-i:gq)return pb(c,n,r,1);for(;;){if(k?n==m||n==lf(b,m,1):1>=n-m){var s=o>d||q-d>=d-o?m:n,t=s==m?p:r,u=d-(s==m?o:q);if(r&&!k&&!/\s/.test(b.text.charAt(s))&&u>0&&s1){var v=bb(a,j,s,"right");g<=v.bottom&&g>=v.top&&Math.abs(d-v.right)u?-1:u>1?1:0);return w}var x=Math.ceil(l/2),y=m+x;if(k){y=m;for(var z=0;x>z;++z)y=lf(b,y,1)}var A=f(y);A>d?(n=y,q=A,(r=h)&&(q+=1e3),l=x):(m=y,o=A,p=h,l-=x)}}function sb(a){if(null!=a.cachedTextHeight)return a.cachedTextHeight;if(null==Of){Of=Pe("pre");for(var b=0;49>b;++b)Of.appendChild(document.createTextNode("x")),Of.appendChild(Pe("br"));Of.appendChild(document.createTextNode("x"))}Re(a.measure,Of);var c=Of.offsetHeight/50;return c>3&&(a.cachedTextHeight=c),Qe(a.measure),c||1}function tb(a){if(null!=a.cachedCharWidth)return a.cachedCharWidth;var b=Pe("span","xxxxxxxxxx"),c=Pe("pre",[b]);Re(a.measure,c);var d=b.getBoundingClientRect(),e=(d.right-d.left)/10;return e>2&&(a.cachedCharWidth=e),e||10}function ub(a){a.curOp={cm:a,viewChanged:!1,startHeight:a.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Tf},Sf?Sf.ops.push(a.curOp):a.curOp.ownsGroup=Sf={ops:[a.curOp],delayedCallbacks:[]}}function vb(a){var b=a.delayedCallbacks,c=0;do{for(;c=c.viewTo)||c.maxLineChanged&&b.options.lineWrapping,a.update=a.mustUpdate&&new z(b,a.mustUpdate&&{top:a.scrollTop,ensure:a.scrollToPos},a.forceUpdate)}function zb(a){a.updatedDisplay=a.mustUpdate&&B(a.cm,a.update)}function Ab(a){var b=a.cm,c=b.display;a.updatedDisplay&&F(b),a.barMeasure=o(b),c.maxLineChanged&&!b.options.lineWrapping&&(a.adjustWidthTo=$a(b,c.maxLine,c.maxLine.text.length).left+3,b.display.sizerWidth=a.adjustWidthTo,a.barMeasure.scrollWidth=Math.max(c.scroller.clientWidth,c.sizer.offsetLeft+a.adjustWidthTo+Ua(b)+b.display.barWidth),a.maxScrollLeft=Math.max(0,c.sizer.offsetLeft+a.adjustWidthTo-Va(b))),(a.updatedDisplay||a.selectionChanged)&&(a.preparedSelection=c.input.prepareSelection(a.focus))}function Bb(a){var b=a.cm;null!=a.adjustWidthTo&&(b.display.sizer.style.minWidth=a.adjustWidthTo+"px",a.maxScrollLeftf;f=d){var g=new Hb(a.doc,Yd(a.doc,f),f);d=f+g.size,e.push(g)}return e}function Jb(a,b,c,d){null==b&&(b=a.doc.first),null==c&&(c=a.doc.first+a.doc.size),d||(d=0);var e=a.display;if(d&&cb)&&(e.updateLineNumbers=b),a.curOp.viewChanged=!0,b>=e.viewTo)Kf&&td(a.doc,b)e.viewFrom?Lb(a):(e.viewFrom+=d,e.viewTo+=d);else if(b<=e.viewFrom&&c>=e.viewTo)Lb(a);else if(b<=e.viewFrom){var f=Nb(a,c,c+d,1);f?(e.view=e.view.slice(f.index),e.viewFrom=f.lineN,e.viewTo+=d):Lb(a)}else if(c>=e.viewTo){var f=Nb(a,b,b,-1);f?(e.view=e.view.slice(0,f.index),e.viewTo=f.lineN):Lb(a)}else{var g=Nb(a,b,b,-1),h=Nb(a,c,c+d,1);g&&h?(e.view=e.view.slice(0,g.index).concat(Ib(a,g.lineN,h.lineN)).concat(e.view.slice(h.index)),e.viewTo+=d):Lb(a)}var i=e.externalMeasured;i&&(c=e.lineN&&b=d.viewTo)){var f=d.view[Mb(a,b)];if(null!=f.node){var g=f.changes||(f.changes=[]);-1==Ge(g,c)&&g.push(c)}}}function Lb(a){a.display.viewFrom=a.display.viewTo=a.doc.first,a.display.view=[],a.display.viewOffset=0}function Mb(a,b){if(b>=a.display.viewTo)return null;if(b-=a.display.viewFrom,0>b)return null;for(var c=a.display.view,d=0;db)return d}function Nb(a,b,c,d){var e,f=Mb(a,b),g=a.display.view;if(!Kf||c==a.doc.first+a.doc.size)return{index:f,lineN:c};for(var h=0,i=a.display.viewFrom;f>h;h++)i+=g[h].size;if(i!=b){if(d>0){if(f==g.length-1)return null;e=i+g[f].size-b,f++}else e=i-b;b+=e,c+=e}for(;td(a.doc,c)!=c;){if(f==(0>d?0:g.length-1))return null;c+=d*g[f-(0>d?1:0)].size,f+=d}return{index:f,lineN:c}}function Ob(a,b,c){var d=a.display,e=d.view;0==e.length||b>=d.viewTo||c<=d.viewFrom?(d.view=Ib(a,b,c),d.viewFrom=b):(d.viewFrom>b?d.view=Ib(a,b,d.viewFrom).concat(d.view):d.viewFromc&&(d.view=d.view.slice(0,Mb(a,c)))),d.viewTo=c}function Pb(a){for(var b=a.display.view,c=0,d=0;d400}var e=a.display;Dg(e.scroller,"mousedown",Eb(a,Vb)),sf&&11>tf?Dg(e.scroller,"dblclick",Eb(a,function(b){if(!ze(a,b)){var c=Ub(a,b);if(c&&!$b(a,b)&&!Tb(a.display,b)){Ag(b);var d=a.findWordAt(c);ua(a.doc,d.anchor,d.head)}}})):Dg(e.scroller,"dblclick",function(b){ze(a,b)||Ag(b)}),If||Dg(e.scroller,"contextmenu",function(b){sc(a,b)});var f,g={end:0};Dg(e.scroller,"touchstart",function(b){if(!ze(a,b)&&!c(b)){clearTimeout(f);var d=+new Date;e.activeTouch={start:d,moved:!1,prev:d-g.end<=300?g:null},1==b.touches.length&&(e.activeTouch.left=b.touches[0].pageX,e.activeTouch.top=b.touches[0].pageY)}}),Dg(e.scroller,"touchmove",function(){e.activeTouch&&(e.activeTouch.moved=!0)}),Dg(e.scroller,"touchend",function(c){var f=e.activeTouch;if(f&&!Tb(e,c)&&null!=f.left&&!f.moved&&new Date-f.start<300){var g,h=a.coordsChar(e.activeTouch,"page");g=!f.prev||d(f,f.prev)?new la(h,h):!f.prev.prev||d(f,f.prev.prev)?a.findWordAt(h):new la(Lf(h.line,0),pa(a.doc,Lf(h.line+1,0))),a.setSelection(g.anchor,g.head),a.focus(),Ag(c)}b()}),Dg(e.scroller,"touchcancel",b),Dg(e.scroller,"scroll",function(){e.scroller.clientHeight&&(dc(a,e.scroller.scrollTop),ec(a,e.scroller.scrollLeft,!0),Gg(a,"scroll",a))}),Dg(e.scroller,"mousewheel",function(b){fc(a,b)}),Dg(e.scroller,"DOMMouseScroll",function(b){fc(a,b)}),Dg(e.wrapper,"scroll",function(){e.wrapper.scrollTop=e.wrapper.scrollLeft=0}),e.dragFunctions={enter:function(b){ze(a,b)||Cg(b)},over:function(b){ze(a,b)||(bc(a,b),Cg(b))},start:function(b){ac(a,b)},drop:Eb(a,_b),leave:function(b){ze(a,b)||cc(a)}};var h=e.input.getField();Dg(h,"keyup",function(b){nc.call(a,b)}),Dg(h,"keydown",Eb(a,lc)),Dg(h,"keypress",Eb(a,oc)),Dg(h,"focus",Le(qc,a)),Dg(h,"blur",Le(rc,a))}function Rb(b,c,d){var e=d&&d!=a.Init;if(!c!=!e){var f=b.display.dragFunctions,g=c?Dg:Fg;g(b.display.scroller,"dragstart",f.start),g(b.display.scroller,"dragenter",f.enter),g(b.display.scroller,"dragover",f.over),g(b.display.scroller,"dragleave",f.leave),g(b.display.scroller,"drop",f.drop)}}function Sb(a){var b=a.display;(b.lastWrapHeight!=b.wrapper.clientHeight||b.lastWrapWidth!=b.wrapper.clientWidth)&&(b.cachedCharWidth=b.cachedTextHeight=b.cachedPaddingH=null,b.scrollbarsClipped=!1,a.setSize())}function Tb(a,b){for(var c=ue(b);c!=a.wrapper;c=c.parentNode)if(!c||1==c.nodeType&&"true"==c.getAttribute("cm-ignore-events")||c.parentNode==a.sizer&&c!=a.mover)return!0}function Ub(a,b,c,d){var e=a.display;if(!c&&"true"==ue(b).getAttribute("cm-not-content"))return null;var f,g,h=e.lineSpace.getBoundingClientRect();try{f=b.clientX-h.left,g=b.clientY-h.top}catch(b){return null}var i,j=qb(a,f,g);if(d&&1==j.xRel&&(i=Yd(a.doc,j.line).text).length==j.ch){var k=Ng(i,i.length,a.options.tabSize)-i.length;j=Lf(j.line,Math.max(0,Math.round((f-Ta(a.display).left)/tb(a.display))-k))}return j}function Vb(a){var b=this,c=b.display;if(!(ze(b,a)||c.activeTouch&&c.input.supportsTouch())){if(c.shift=a.shiftKey,Tb(c,a))return void(uf||(c.scroller.draggable=!1,setTimeout(function(){c.scroller.draggable=!0},100)));if(!$b(b,a)){var d=Ub(b,a);switch(window.focus(),ve(a)){case 1:b.state.selectingText?b.state.selectingText(a):d?Wb(b,a,d):ue(a)==c.scroller&&Ag(a);break;case 2:uf&&(b.state.lastMiddleDown=+new Date),d&&ua(b.doc,d),setTimeout(function(){c.input.focus()},20),Ag(a);break;case 3:If?sc(b,a):pc(b)}}}}function Wb(a,b,c){sf?setTimeout(Le(Y,a),0):a.curOp.focus=Se();var d,e=+new Date;Qf&&Qf.time>e-400&&0==Mf(Qf.pos,c)?d="triple":Pf&&Pf.time>e-400&&0==Mf(Pf.pos,c)?(d="double",Qf={time:e,pos:c}):(d="single",Pf={time:e,pos:c});var f,g=a.doc.sel,h=Df?b.metaKey:b.ctrlKey;a.options.dragDrop&&_g&&!a.isReadOnly()&&"single"==d&&(f=g.contains(c))>-1&&(Mf((f=g.ranges[f]).from(),c)<0||c.xRel>0)&&(Mf(f.to(),c)>0||c.xRel<0)?Xb(a,b,c,h):Yb(a,b,c,d,h)}function Xb(a,b,c,d){var e=a.display,f=+new Date,g=Eb(a,function(h){uf&&(e.scroller.draggable=!1),a.state.draggingText=!1,Fg(document,"mouseup",g),Fg(e.scroller,"drop",g),Math.abs(b.clientX-h.clientX)+Math.abs(b.clientY-h.clientY)<10&&(Ag(h),!d&&+new Date-200=o;o++){var r=Yd(j,o).text,s=Og(r,i,f);i==n?e.push(new la(Lf(o,s),Lf(o,s))):r.length>s&&e.push(new la(Lf(o,s),Lf(o,Og(r,n,f))))}e.length||e.push(new la(c,c)),Aa(j,ma(m.ranges.slice(0,l).concat(e),l),{origin:"*mouse",scroll:!1}),a.scrollIntoView(b)}else{var t=k,u=t.anchor,v=b;if("single"!=d){if("double"==d)var w=a.findWordAt(b);else var w=new la(Lf(b.line,0),pa(j,Lf(b.line+1,0)));Mf(w.anchor,u)>0?(v=w.head,u=X(t.from(),w.anchor)):(v=w.anchor,u=W(t.to(),w.head))}var e=m.ranges.slice(0);e[l]=new la(pa(j,u),v),Aa(j,ma(e,l),Lg)}}function g(b){var c=++s,e=Ub(a,b,!0,"rect"==d);if(e)if(0!=Mf(e,q)){a.curOp.focus=Se(),f(e);var h=u(i,j);(e.line>=h.to||e.liner.bottom?20:0;k&&setTimeout(Eb(a,function(){s==c&&(i.scroller.scrollTop+=k,g(b))}),50)}}function h(b){a.state.selectingText=!1,s=1/0,Ag(b),i.input.focus(),Fg(document,"mousemove",t),Fg(document,"mouseup",v),j.history.lastSelOrigin=null}var i=a.display,j=a.doc;Ag(b);var k,l,m=j.sel,n=m.ranges;if(e&&!b.shiftKey?(l=j.sel.contains(c),k=l>-1?n[l]:new la(c,c)):(k=j.sel.primary(),l=j.sel.primIndex),Ef?b.shiftKey&&b.metaKey:b.altKey)d="rect",e||(k=new la(c,c)),c=Ub(a,b,!0,!0),l=-1;else if("double"==d){var o=a.findWordAt(c);k=a.display.shift||j.extend?ta(j,k,o.anchor,o.head):o}else if("triple"==d){var p=new la(Lf(c.line,0),pa(j,Lf(c.line+1,0)));k=a.display.shift||j.extend?ta(j,k,p.anchor,p.head):p}else k=ta(j,k,c);e?-1==l?(l=n.length,Aa(j,ma(n.concat([k]),l),{scroll:!1,origin:"*mouse"})):n.length>1&&n[l].empty()&&"single"==d&&!b.shiftKey?(Aa(j,ma(n.slice(0,l).concat(n.slice(l+1)),0),{scroll:!1,origin:"*mouse"}),m=j.sel):wa(j,l,k,Lg):(l=0,Aa(j,new ka([k],0),Lg),m=j.sel);var q=c,r=i.wrapper.getBoundingClientRect(),s=0,t=Eb(a,function(a){ve(a)?g(a):h(a)}),v=Eb(a,h);a.state.selectingText=v,Dg(document,"mousemove",t),Dg(document,"mouseup",v)}function Zb(a,b,c,d){try{var e=b.clientX,f=b.clientY}catch(b){return!1}if(e>=Math.floor(a.display.gutters.getBoundingClientRect().right))return!1;d&&Ag(b);var g=a.display,h=g.lineDiv.getBoundingClientRect();if(f>h.bottom||!Be(a,c))return te(b);f-=h.top-g.viewOffset;for(var i=0;i=e){var k=be(a.doc,f),l=a.options.gutters[i];return Gg(a,c,a,k,l,b),te(b)}}}function $b(a,b){return Zb(a,b,"gutterClick",!0)}function _b(a){var b=this;if(cc(b),!ze(b,a)&&!Tb(b.display,a)){Ag(a),sf&&(Uf=+new Date);var c=Ub(b,a,!0),d=a.dataTransfer.files;if(c&&!b.isReadOnly())if(d&&d.length&&window.FileReader&&window.File)for(var e=d.length,f=Array(e),g=0,h=function(a,d){if(!b.options.allowDropFileTypes||-1!=Ge(b.options.allowDropFileTypes,a.type)){var h=new FileReader;h.onload=Eb(b,function(){var a=h.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(a)&&(a=""),f[d]=a,++g==e){c=pa(b.doc,c);var i={from:c,to:c,text:b.doc.splitLines(f.join(b.doc.lineSeparator())),origin:"paste"};zc(b.doc,i),za(b.doc,na(c,$f(i)))}}),h.readAsText(a)}},i=0;e>i;++i)h(d[i],i);else{if(b.state.draggingText&&b.doc.sel.contains(c)>-1)return b.state.draggingText(a),void setTimeout(function(){b.display.input.focus()},20);try{var f=a.dataTransfer.getData("Text");if(f){if(b.state.draggingText&&!b.state.draggingText.copy)var j=b.listSelections();if(Ba(b.doc,na(c,c)),j)for(var i=0;ig.clientWidth,i=g.scrollHeight>g.clientHeight;if(d&&h||e&&i){if(e&&Df&&uf)a:for(var j=b.target,k=f.view;j!=g;j=j.parentNode)for(var l=0;lm?n=Math.max(0,n+m-50):o=Math.min(a.doc.height,o+m+50),D(a,{top:n,bottom:o})}20>Vf&&(null==f.wheelStartX?(f.wheelStartX=g.scrollLeft,f.wheelStartY=g.scrollTop,f.wheelDX=d,f.wheelDY=e,setTimeout(function(){if(null!=f.wheelStartX){var a=g.scrollLeft-f.wheelStartX,b=g.scrollTop-f.wheelStartY,c=b&&f.wheelDY&&b/f.wheelDY||a&&f.wheelDX&&a/f.wheelDX;f.wheelStartX=f.wheelStartY=null,c&&(Wf=(Wf*Vf+c)/(Vf+1),++Vf)}},200)):(f.wheelDX+=d,f.wheelDY+=e))}}function gc(a,b,c){if("string"==typeof b&&(b=jg[b],!b))return!1;a.display.input.ensurePolled();var d=a.display.shift,e=!1;try{a.isReadOnly()&&(a.state.suppressEdits=!0),c&&(a.display.shift=!1),e=b(a)!=Jg}finally{a.display.shift=d,a.state.suppressEdits=!1}return e}function hc(a,b,c){for(var d=0;dtf&&27==a.keyCode&&(a.returnValue=!1);var c=a.keyCode;b.display.shift=16==c||a.shiftKey;var d=jc(b,a);xf&&(Zf=d?c:null,!d&&88==c&&!ch&&(Df?a.metaKey:a.ctrlKey)&&b.replaceSelection("",null,"cut")),18!=c||/\bCodeMirror-crosshair\b/.test(b.display.lineDiv.className)||mc(b)}}function mc(a){function b(a){18!=a.keyCode&&a.altKey||(Yg(c,"CodeMirror-crosshair"),Fg(document,"keyup",b),Fg(document,"mouseover",b))}var c=a.display.lineDiv;Zg(c,"CodeMirror-crosshair"),Dg(document,"keyup",b),Dg(document,"mouseover",b)}function nc(a){16==a.keyCode&&(this.doc.sel.shift=!1),ze(this,a)}function oc(a){var b=this;if(!(Tb(b.display,a)||ze(b,a)||a.ctrlKey&&!a.altKey||Df&&a.metaKey)){var c=a.keyCode,d=a.charCode;if(xf&&c==Zf)return Zf=null,void Ag(a);if(!xf||a.which&&!(a.which<10)||!jc(b,a)){var e=String.fromCharCode(null==d?c:d);kc(b,a,e)||b.display.input.onKeyPress(a)}}}function pc(a){a.state.delayingBlurEvent=!0,setTimeout(function(){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1,rc(a))},100)}function qc(a){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1),"nocursor"!=a.options.readOnly&&(a.state.focused||(Gg(a,"focus",a),a.state.focused=!0,Zg(a.display.wrapper,"CodeMirror-focused"),a.curOp||a.display.selForContextMenu==a.doc.sel||(a.display.input.reset(),uf&&setTimeout(function(){a.display.input.reset(!0)},20)),a.display.input.receivedFocus()),Ma(a))}function rc(a){a.state.delayingBlurEvent||(a.state.focused&&(Gg(a,"blur",a),a.state.focused=!1,Yg(a.display.wrapper,"CodeMirror-focused")),clearInterval(a.display.blinker),setTimeout(function(){a.state.focused||(a.display.shift=!1)},150))}function sc(a,b){Tb(a.display,b)||tc(a,b)||ze(a,b,"contextmenu")||a.display.input.onContextMenu(b)}function tc(a,b){return Be(a,"gutterContextMenu")?Zb(a,b,"gutterContextMenu",!1):!1}function uc(a,b){if(Mf(a,b.from)<0)return a;if(Mf(a,b.to)<=0)return $f(b);var c=a.line+b.text.length-(b.to.line-b.from.line)-1,d=a.ch;return a.line==b.to.line&&(d+=$f(b).ch-b.to.ch),Lf(c,d)}function vc(a,b){for(var c=[],d=0;d=0;--e)Ac(a,{from:d[e].from,to:d[e].to,text:e?[""]:b.text});else Ac(a,b)}}function Ac(a,b){if(1!=b.text.length||""!=b.text[0]||0!=Mf(b.from,b.to)){var c=vc(a,b);ie(a,b,c,a.cm?a.cm.curOp.id:NaN),Dc(a,b,c,ed(a,b));var d=[];Wd(a,function(a,c){c||-1!=Ge(d,a.history)||(se(a.history,b),d.push(a.history)),Dc(a,b,null,ed(a,b))})}}function Bc(a,b,c){if(!a.cm||!a.cm.state.suppressEdits){for(var d,e=a.history,f=a.sel,g="undo"==b?e.done:e.undone,h="undo"==b?e.undone:e.done,i=0;i=0;--i){var l=d.changes[i];if(l.origin=b,k&&!yc(a,l,!1))return void(g.length=0);j.push(fe(a,l));var m=i?vc(a,l):Fe(g);Dc(a,l,m,gd(a,l)),!i&&a.cm&&a.cm.scrollIntoView({from:l.from,to:$f(l)});var n=[];Wd(a,function(a,b){b||-1!=Ge(n,a.history)||(se(a.history,l),n.push(a.history)),Dc(a,l,null,gd(a,l))})}}}}function Cc(a,b){if(0!=b&&(a.first+=b,a.sel=new ka(He(a.sel.ranges,function(a){return new la(Lf(a.anchor.line+b,a.anchor.ch),Lf(a.head.line+b,a.head.ch))}),a.sel.primIndex),a.cm)){Jb(a.cm,a.first,a.first-b,b);for(var c=a.cm.display,d=c.viewFrom;da.lastLine())){if(b.from.linef&&(b={from:b.from,to:Lf(f,Yd(a,f).text.length),text:[b.text[0]],origin:b.origin}),b.removed=Zd(a,b.from,b.to),c||(c=vc(a,b)),a.cm?Ec(a.cm,b,d):Td(a,b,d),Ba(a,c,Kg)}}function Ec(a,b,c){var d=a.doc,e=a.display,g=b.from,h=b.to,i=!1,j=g.line;a.options.lineWrapping||(j=ae(rd(Yd(d,g.line))),d.iter(j,h.line+1,function(a){return a==e.maxLine?(i=!0,!0):void 0})),d.sel.contains(b.from,b.to)>-1&&Ae(a),Td(d,b,c,f(a)),a.options.lineWrapping||(d.iter(j,g.line+b.text.length,function(a){var b=l(a);b>e.maxLineLength&&(e.maxLine=a,e.maxLineLength=b,e.maxLineChanged=!0,i=!1)}),i&&(a.curOp.updateMaxLine=!0)),d.frontier=Math.min(d.frontier,g.line),Na(a,400);var k=b.text.length-(h.line-g.line)-1;b.full?Jb(a):g.line!=h.line||1!=b.text.length||Sd(a.doc,b)?Jb(a,g.line,h.line+1,k):Kb(a,g.line,"text");var m=Be(a,"changes"),n=Be(a,"change");if(n||m){var o={from:g,to:h,text:b.text,removed:b.removed,origin:b.origin};n&&xe(a,"change",a,o),m&&(a.curOp.changeObjs||(a.curOp.changeObjs=[])).push(o)}a.display.selForContextMenu=null}function Fc(a,b,c,d,e){if(d||(d=c),Mf(d,c)<0){var f=d;d=c,c=f}"string"==typeof b&&(b=a.splitLines(b)),zc(a,{from:c,to:d,text:b,origin:e})}function Gc(a,b){if(!ze(a,"scrollCursorIntoView")){var c=a.display,d=c.sizer.getBoundingClientRect(),e=null;if(b.top+d.top<0?e=!0:b.bottom+d.top>(window.innerHeight||document.documentElement.clientHeight)&&(e=!1),null!=e&&!Af){var f=Pe("div","​",null,"position: absolute; top: "+(b.top-c.viewOffset-Ra(a.display))+"px; height: "+(b.bottom-b.top+Ua(a)+c.barHeight)+"px; left: "+b.left+"px; width: 2px;");a.display.lineSpace.appendChild(f),f.scrollIntoView(e),a.display.lineSpace.removeChild(f)}}}function Hc(a,b,c,d){null==d&&(d=0);for(var e=0;5>e;e++){var f=!1,g=nb(a,b),h=c&&c!=b?nb(a,c):g,i=Jc(a,Math.min(g.left,h.left),Math.min(g.top,h.top)-d,Math.max(g.left,h.left),Math.max(g.bottom,h.bottom)+d),j=a.doc.scrollTop,k=a.doc.scrollLeft;if(null!=i.scrollTop&&(dc(a,i.scrollTop),Math.abs(a.doc.scrollTop-j)>1&&(f=!0)),null!=i.scrollLeft&&(ec(a,i.scrollLeft),Math.abs(a.doc.scrollLeft-k)>1&&(f=!0)),!f)break}return g}function Ic(a,b,c,d,e){var f=Jc(a,b,c,d,e);null!=f.scrollTop&&dc(a,f.scrollTop),null!=f.scrollLeft&&ec(a,f.scrollLeft)}function Jc(a,b,c,d,e){var f=a.display,g=sb(a.display);0>c&&(c=0);var h=a.curOp&&null!=a.curOp.scrollTop?a.curOp.scrollTop:f.scroller.scrollTop,i=Wa(a),j={};e-c>i&&(e=c+i);var k=a.doc.height+Sa(f),l=g>c,m=e>k-g;if(h>c)j.scrollTop=l?0:c;else if(e>h+i){var n=Math.min(c,(m?k:e)-i);n!=h&&(j.scrollTop=n)}var o=a.curOp&&null!=a.curOp.scrollLeft?a.curOp.scrollLeft:f.scroller.scrollLeft,p=Va(a)-(a.options.fixedGutter?f.gutters.offsetWidth:0),q=d-b>p;return q&&(d=b+p),10>b?j.scrollLeft=0:o>b?j.scrollLeft=Math.max(0,b-(q?0:10)):d>p+o-3&&(j.scrollLeft=d+(q?0:10)-p), +j}function Kc(a,b,c){(null!=b||null!=c)&&Mc(a),null!=b&&(a.curOp.scrollLeft=(null==a.curOp.scrollLeft?a.doc.scrollLeft:a.curOp.scrollLeft)+b),null!=c&&(a.curOp.scrollTop=(null==a.curOp.scrollTop?a.doc.scrollTop:a.curOp.scrollTop)+c)}function Lc(a){Mc(a);var b=a.getCursor(),c=b,d=b;a.options.lineWrapping||(c=b.ch?Lf(b.line,b.ch-1):b,d=Lf(b.line,b.ch+1)),a.curOp.scrollToPos={from:c,to:d,margin:a.options.cursorScrollMargin,isCursor:!0}}function Mc(a){var b=a.curOp.scrollToPos;if(b){a.curOp.scrollToPos=null;var c=ob(a,b.from),d=ob(a,b.to),e=Jc(a,Math.min(c.left,d.left),Math.min(c.top,d.top)-b.margin,Math.max(c.right,d.right),Math.max(c.bottom,d.bottom)+b.margin);a.scrollTo(e.scrollLeft,e.scrollTop)}}function Nc(a,b,c,d){var e,f=a.doc;null==c&&(c="add"),"smart"==c&&(f.mode.indent?e=Qa(a,b):c="prev");var g=a.options.tabSize,h=Yd(f,b),i=Ng(h.text,null,g);h.stateAfter&&(h.stateAfter=null);var j,k=h.text.match(/^\s*/)[0];if(d||/\S/.test(h.text)){if("smart"==c&&(j=f.mode.indent(e,h.text.slice(k.length),h.text),j==Jg||j>150)){if(!d)return;c="prev"}}else j=0,c="not";"prev"==c?j=b>f.first?Ng(Yd(f,b-1).text,null,g):0:"add"==c?j=i+a.options.indentUnit:"subtract"==c?j=i-a.options.indentUnit:"number"==typeof c&&(j=i+c),j=Math.max(0,j);var l="",m=0;if(a.options.indentWithTabs)for(var n=Math.floor(j/g);n;--n)m+=g,l+=" ";if(j>m&&(l+=Ee(j-m)),l!=k)return Fc(f,l,Lf(b,0),Lf(b,k.length),"+input"),h.stateAfter=null,!0;for(var n=0;n=0;b--)Fc(a.doc,"",d[b].from,d[b].to,"+delete");Lc(a)})}function Qc(a,b,c,d,e){function f(){var b=h+c;return b=a.first+a.size?!1:(h=b,k=Yd(a,b))}function g(a){var b=(e?lf:mf)(k,i,c,!0);if(null==b){if(a||!f())return!1;i=e?(0>c?df:cf)(k):0>c?k.text.length:0}else i=b;return!0}var h=b.line,i=b.ch,j=c,k=Yd(a,h);if("char"==d)g();else if("column"==d)g(!0);else if("word"==d||"group"==d)for(var l=null,m="group"==d,n=a.cm&&a.cm.getHelper(b,"wordChars"),o=!0;!(0>c)||g(!o);o=!1){var p=k.text.charAt(i)||"\n",q=Me(p,n)?"w":m&&"\n"==p?"n":!m||/\s/.test(p)?null:"p";if(!m||o||q||(q="s"),l&&l!=q){0>c&&(c=1,g());break}if(q&&(l=q),c>0&&!g(!o))break}var r=Ga(a,Lf(h,i),b,j,!0);return Mf(b,r)||(r.hitSide=!0),r}function Rc(a,b,c,d){var e,f=a.doc,g=b.left;if("page"==d){var h=Math.min(a.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);e=b.top+c*(h-(0>c?1.5:.5)*sb(a.display))}else"line"==d&&(e=c>0?b.bottom+3:b.top-3);for(;;){var i=qb(a,g,e);if(!i.outside)break;if(0>c?0>=e:e>=f.height){i.hitSide=!0;break}e+=5*c}return i}function Sc(b,c,d,e){a.defaults[b]=c,d&&(ag[b]=e?function(a,b,c){c!=bg&&d(a,b,c)}:d)}function Tc(a){for(var b,c,d,e,f=a.split(/-(?!$)/),a=f[f.length-1],g=0;g0||0==g&&f.clearWhenEmpty!==!1)return f;if(f.replacedWith&&(f.collapsed=!0,f.widgetNode=Pe("span",[f.replacedWith],"CodeMirror-widget"),d.handleMouseEvents||f.widgetNode.setAttribute("cm-ignore-events","true"),d.insertLeft&&(f.widgetNode.insertLeft=!0)),f.collapsed){if(qd(a,b.line,b,c,f)||b.line!=c.line&&qd(a,c.line,b,c,f))throw new Error("Inserting collapsed marker partially overlapping an existing one");Kf=!0}f.addToHistory&&ie(a,{from:b,to:c,origin:"markText"},a.sel,NaN);var h,i=b.line,j=a.cm;if(a.iter(i,c.line+1,function(a){j&&f.collapsed&&!j.options.lineWrapping&&rd(a)==j.display.maxLine&&(h=!0),f.collapsed&&i!=b.line&&_d(a,0),bd(a,new $c(f,i==b.line?b.ch:null,i==c.line?c.ch:null)),++i}),f.collapsed&&a.iter(b.line,c.line+1,function(b){vd(a,b)&&_d(b,0)}),f.clearOnEnter&&Dg(f,"beforeCursorEnter",function(){f.clear()}),f.readOnly&&(Jf=!0,(a.history.done.length||a.history.undone.length)&&a.clearHistory()),f.collapsed&&(f.id=++pg,f.atomic=!0),j){if(h&&(j.curOp.updateMaxLine=!0),f.collapsed)Jb(j,b.line,c.line+1);else if(f.className||f.title||f.startStyle||f.endStyle||f.css)for(var k=b.line;k<=c.line;k++)Kb(j,k,"text");f.atomic&&Da(j.doc),xe(j,"markerAdded",j,f)}return f}function Wc(a,b,c,d,e){d=Ke(d),d.shared=!1;var f=[Vc(a,b,c,d,e)],g=f[0],h=d.widgetNode;return Wd(a,function(a){h&&(d.widgetNode=h.cloneNode(!0)),f.push(Vc(a,pa(a,b),pa(a,c),d,e));for(var i=0;i=b:f.to>b);(d||(d=[])).push(new $c(g,f.from,i?null:f.to))}}return d}function dd(a,b,c){if(a)for(var d,e=0;e=b:f.to>b);if(h||f.from==b&&"bookmark"==g.type&&(!c||f.marker.insertLeft)){var i=null==f.from||(g.inclusiveLeft?f.from<=b:f.from0&&h)for(var l=0;ll;++l)o.push(p);o.push(i)}return o}function fd(a){for(var b=0;b0)){var k=[i,1],l=Mf(j.from,h.from),m=Mf(j.to,h.to);(0>l||!g.inclusiveLeft&&!l)&&k.push({from:j.from,to:h.from}),(m>0||!g.inclusiveRight&&!m)&&k.push({from:h.to,to:j.to}),e.splice.apply(e,k),i+=k.length-1}}return e}function id(a){var b=a.markedSpans;if(b){for(var c=0;c=0&&0>=l||0>=k&&l>=0)&&(0>=k&&(i.marker.inclusiveRight&&e.inclusiveLeft?Mf(j.to,c)>=0:Mf(j.to,c)>0)||k>=0&&(i.marker.inclusiveRight&&e.inclusiveLeft?Mf(j.from,d)<=0:Mf(j.from,d)<0)))return!0}}}function rd(a){for(var b;b=od(a);)a=b.find(-1,!0).line;return a}function sd(a){for(var b,c;b=pd(a);)a=b.find(1,!0).line,(c||(c=[])).push(a);return c}function td(a,b){var c=Yd(a,b),d=rd(c);return c==d?b:ae(d)}function ud(a,b){if(b>a.lastLine())return b;var c,d=Yd(a,b);if(!vd(a,d))return b;for(;c=pd(d);)d=c.find(1,!0).line;return ae(d)+1}function vd(a,b){var c=Kf&&b.markedSpans;if(c)for(var d,e=0;ef;f++){e&&(e[0]=a.innerMode(b,d).mode);var g=b.token(c,d);if(c.pos>c.start)return g}throw new Error("Mode "+b.name+" failed to advance stream.")}function Fd(a,b,c,d){function e(a){return{start:l.start,end:l.pos,string:l.current(),type:f||null,state:a?hg(g.mode,k):k}}var f,g=a.doc,h=g.mode;b=pa(g,b);var i,j=Yd(g,b.line),k=Qa(a,b.line,c),l=new og(j.text,a.options.tabSize);for(d&&(i=[]);(d||l.posa.options.maxHighlightLength?(h=!1,g&&Jd(a,b,d,l.pos),l.pos=b.length,i=null):i=Cd(Ed(c,l,d,m),f),m){var n=m[0].name;n&&(i="m-"+(i?n+" "+i:n))}if(!h||k!=i){for(;jj;){var d=e[i];d>a&&e.splice(i,1,a,e[i+1],d),i+=2,j=Math.min(a,d)}if(b)if(h.opaque)e.splice(c,i-c,a,"cm-overlay "+b),i=c+2;else for(;i>c;c+=2){var f=e[c+1];e[c+1]=(f?f+" ":"")+"cm-overlay "+b}},f)}return{styles:e,classes:f.bgClass||f.textClass?f:null}}function Id(a,b,c){if(!b.styles||b.styles[0]!=a.state.modeGen){var d=Qa(a,ae(b)),e=Hd(a,b,b.text.length>a.options.maxHighlightLength?hg(a.doc.mode,d):d);b.stateAfter=d,b.styles=e.styles,e.classes?b.styleClasses=e.classes:b.styleClasses&&(b.styleClasses=null),c===a.doc.frontier&&a.doc.frontier++}return b.styles}function Jd(a,b,c,d){var e=a.doc.mode,f=new og(b,a.options.tabSize);for(f.start=f.pos=d||0,""==b&&Dd(e,c);!f.eol();)Ed(e,f,c),f.start=f.pos}function Kd(a,b){if(!a||/^\s*$/.test(a))return null;var c=b.addModeClass?vg:ug;return c[a]||(c[a]=a.replace(/\S+/g,"cm-$&"))}function Ld(a,b){var c=Pe("span",null,null,uf?"padding-right: .1px":null),d={pre:Pe("pre",[c],"CodeMirror-line"),content:c,col:0,pos:0,cm:a,splitSpaces:(sf||uf)&&a.getOption("lineWrapping")};b.measure={};for(var e=0;e<=(b.rest?b.rest.length:0);e++){var f,g=e?b.rest[e-1]:b.line;d.pos=0,d.addToken=Nd,Ze(a.display.measure)&&(f=de(g))&&(d.addToken=Pd(d.addToken,f)),d.map=[];var h=b!=a.display.externalMeasured&&ae(g);Rd(g,d,Id(a,g,h)),g.styleClasses&&(g.styleClasses.bgClass&&(d.bgClass=Ue(g.styleClasses.bgClass,d.bgClass||"")),g.styleClasses.textClass&&(d.textClass=Ue(g.styleClasses.textClass,d.textClass||""))),0==d.map.length&&d.map.push(0,0,d.content.appendChild(Ye(a.display.measure))),0==e?(b.measure.map=d.map,b.measure.cache={}):((b.measure.maps||(b.measure.maps=[])).push(d.map),(b.measure.caches||(b.measure.caches=[])).push({}))}if(uf){var i=d.content.lastChild;(/\bcm-tab\b/.test(i.className)||i.querySelector&&i.querySelector(".cm-tab"))&&(d.content.className="cm-tab-wrap-hack")}return Gg(a,"renderLine",a,b.line,d.pre),d.pre.className&&(d.textClass=Ue(d.pre.className,d.textClass||"")),d}function Md(a){var b=Pe("span","•","cm-invalidchar");return b.title="\\u"+a.charCodeAt(0).toString(16),b.setAttribute("aria-label",b.title),b}function Nd(a,b,c,d,e,f,g){if(b){var h=a.splitSpaces?b.replace(/ {3,}/g,Od):b,i=a.cm.state.specialChars,j=!1;if(i.test(b))for(var k=document.createDocumentFragment(),l=0;;){i.lastIndex=l;var m=i.exec(b),n=m?m.index-l:b.length-l;if(n){var o=document.createTextNode(h.slice(l,l+n));sf&&9>tf?k.appendChild(Pe("span",[o])):k.appendChild(o),a.map.push(a.pos,a.pos+n,o),a.col+=n,a.pos+=n}if(!m)break;if(l+=n+1," "==m[0]){var p=a.cm.options.tabSize,q=p-a.col%p,o=k.appendChild(Pe("span",Ee(q),"cm-tab"));o.setAttribute("role","presentation"),o.setAttribute("cm-text"," "),a.col+=q}else if("\r"==m[0]||"\n"==m[0]){var o=k.appendChild(Pe("span","\r"==m[0]?"␍":"␤","cm-invalidchar"));o.setAttribute("cm-text",m[0]),a.col+=1}else{var o=a.cm.options.specialCharPlaceholder(m[0]);o.setAttribute("cm-text",m[0]),sf&&9>tf?k.appendChild(Pe("span",[o])):k.appendChild(o),a.col+=1}a.map.push(a.pos,a.pos+1,o),a.pos++}else{a.col+=b.length;var k=document.createTextNode(h);a.map.push(a.pos,a.pos+b.length,k),sf&&9>tf&&(j=!0),a.pos+=b.length}if(c||d||e||j||g){var r=c||"";d&&(r+=d),e&&(r+=e);var s=Pe("span",[k],r,g);return f&&(s.title=f),a.content.appendChild(s)}a.content.appendChild(k)}}function Od(a){for(var b=" ",c=0;cj&&m.from<=j)break}if(m.to>=k)return a(c,d,e,f,g,h,i);a(c,d.slice(0,m.to-j),e,f,null,h,i),f=null,d=d.slice(m.to-j),j=m.to}}}function Qd(a,b,c,d){var e=!d&&c.widgetNode;e&&a.map.push(a.pos,a.pos+b,e),!d&&a.cm.display.input.needsContentAttribute&&(e||(e=a.content.appendChild(document.createElement("span"))),e.setAttribute("cm-marker",c.id)),e&&(a.cm.display.input.setUneditable(e),a.content.appendChild(e)),a.pos+=b}function Rd(a,b,c){var d=a.markedSpans,e=a.text,f=0;if(d)for(var g,h,i,j,k,l,m,n=e.length,o=0,p=1,q="",r=0;;){if(r==o){i=j=k=l=h="",m=null,r=1/0;for(var s,t=[],u=0;uo||w.collapsed&&v.to==o&&v.from==o)?(null!=v.to&&v.to!=o&&r>v.to&&(r=v.to,j=""),w.className&&(i+=" "+w.className),w.css&&(h=(h?h+";":"")+w.css),w.startStyle&&v.from==o&&(k+=" "+w.startStyle),w.endStyle&&v.to==r&&(s||(s=[])).push(w.endStyle,v.to),w.title&&!l&&(l=w.title),w.collapsed&&(!m||md(m.marker,w)<0)&&(m=v)):v.from>o&&r>v.from&&(r=v.from)}if(s)for(var u=0;u=n)break;for(var x=Math.min(n,r);;){if(q){var y=o+q.length;if(!m){var z=y>x?q.slice(0,x-o):q;b.addToken(b,z,g?g+i:i,k,o+z.length==r?j:"",l,h)}if(y>=x){q=q.slice(x-o),o=x;break}o=y,k=""}q=e.slice(f,f=c[p++]),g=Kd(c[p++],b.cm.options)}}else for(var p=1;pc;++c)f.push(new tg(j[c],e(c),d));return f}var h=b.from,i=b.to,j=b.text,k=Yd(a,h.line),l=Yd(a,i.line),m=Fe(j),n=e(j.length-1),o=i.line-h.line;if(b.full)a.insert(0,g(0,j.length)),a.remove(j.length,a.size-j.length);else if(Sd(a,b)){var p=g(0,j.length-1);f(l,l.text,n),o&&a.remove(h.line,o),p.length&&a.insert(h.line,p)}else if(k==l)if(1==j.length)f(k,k.text.slice(0,h.ch)+m+k.text.slice(i.ch),n);else{var p=g(1,j.length-1);p.push(new tg(m+k.text.slice(i.ch),n,d)),f(k,k.text.slice(0,h.ch)+j[0],e(0)),a.insert(h.line+1,p)}else if(1==j.length)f(k,k.text.slice(0,h.ch)+j[0]+l.text.slice(i.ch),e(0)),a.remove(h.line+1,o);else{f(k,k.text.slice(0,h.ch)+j[0],e(0)),f(l,m+l.text.slice(i.ch),n);var p=g(1,j.length-1);o>1&&a.remove(h.line+1,o-1),a.insert(h.line+1,p)}xe(a,"change",a,b)}function Ud(a){this.lines=a,this.parent=null;for(var b=0,c=0;bb||b>=a.size)throw new Error("There is no line "+(b+a.first)+" in the document.");for(var c=a;!c.lines;)for(var d=0;;++d){var e=c.children[d],f=e.chunkSize();if(f>b){c=e;break}b-=f}return c.lines[b]}function Zd(a,b,c){var d=[],e=b.line;return a.iter(b.line,c.line+1,function(a){var f=a.text;e==c.line&&(f=f.slice(0,c.ch)),e==b.line&&(f=f.slice(b.ch)),d.push(f),++e}),d}function $d(a,b,c){var d=[];return a.iter(b,c,function(a){d.push(a.text)}),d}function _d(a,b){var c=b-a.height;if(c)for(var d=a;d;d=d.parent)d.height+=c}function ae(a){if(null==a.parent)return null;for(var b=a.parent,c=Ge(b.lines,a),d=b.parent;d;b=d,d=d.parent)for(var e=0;d.children[e]!=b;++e)c+=d.children[e].chunkSize();return c+b.first}function be(a,b){var c=a.first;a:do{for(var d=0;db){a=e;continue a}b-=f,c+=e.chunkSize()}return c}while(!a.lines);for(var d=0;db)break;b-=h}return c+d}function ce(a){a=rd(a);for(var b=0,c=a.parent,d=0;d1&&!a.done[a.done.length-2].ranges?(a.done.pop(),Fe(a.done)):void 0}function ie(a,b,c,d){var e=a.history;e.undone.length=0;var f,g=+new Date;if((e.lastOp==d||e.lastOrigin==b.origin&&b.origin&&("+"==b.origin.charAt(0)&&a.cm&&e.lastModTime>g-a.cm.options.historyEventDelay||"*"==b.origin.charAt(0)))&&(f=he(e,e.lastOp==d))){var h=Fe(f.changes);0==Mf(b.from,b.to)&&0==Mf(b.from,h.to)?h.to=$f(b):f.changes.push(fe(a,b))}else{var i=Fe(e.done);for(i&&i.ranges||le(a.sel,e.done),f={changes:[fe(a,b)],generation:e.generation},e.done.push(f);e.done.length>e.undoDepth;)e.done.shift(),e.done[0].ranges||e.done.shift()}e.done.push(c),e.generation=++e.maxGeneration,e.lastModTime=e.lastSelTime=g,e.lastOp=e.lastSelOp=d,e.lastOrigin=e.lastSelOrigin=b.origin,h||Gg(a,"historyAdded")}function je(a,b,c,d){var e=b.charAt(0);return"*"==e||"+"==e&&c.ranges.length==d.ranges.length&&c.somethingSelected()==d.somethingSelected()&&new Date-a.history.lastSelTime<=(a.cm?a.cm.options.historyEventDelay:500)}function ke(a,b,c,d){var e=a.history,f=d&&d.origin;c==e.lastSelOp||f&&e.lastSelOrigin==f&&(e.lastModTime==e.lastSelTime&&e.lastOrigin==f||je(a,f,Fe(e.done),b))?e.done[e.done.length-1]=b:le(b,e.done),e.lastSelTime=+new Date,e.lastSelOrigin=f,e.lastSelOp=c,d&&d.clearRedo!==!1&&ge(e.undone)}function le(a,b){var c=Fe(b);c&&c.ranges&&c.equals(a)||b.push(a)}function me(a,b,c,d){var e=b["spans_"+a.id],f=0;a.iter(Math.max(a.first,c),Math.min(a.first+a.size,d),function(c){c.markedSpans&&((e||(e=b["spans_"+a.id]={}))[f]=c.markedSpans),++f})}function ne(a){if(!a)return null;for(var b,c=0;c-1&&(Fe(h)[l]=k[l],delete k[l])}}}return e}function qe(a,b,c,d){c0?d.slice():Eg:d||Eg}function xe(a,b){function c(a){return function(){a.apply(null,f)}}var d=we(a,b,!1);if(d.length){var e,f=Array.prototype.slice.call(arguments,2);Sf?e=Sf.delayedCallbacks:Hg?e=Hg:(e=Hg=[],setTimeout(ye,0));for(var g=0;g0}function Ce(a){a.prototype.on=function(a,b){Dg(this,a,b)},a.prototype.off=function(a,b){Fg(this,a,b)}}function De(){this.id=null}function Ee(a){for(;Pg.length<=a;)Pg.push(Fe(Pg)+" ");return Pg[a]}function Fe(a){return a[a.length-1]}function Ge(a,b){for(var c=0;c-1&&Tg(a)?!0:b.test(a):Tg(a)}function Ne(a){for(var b in a)if(a.hasOwnProperty(b)&&a[b])return!1;return!0}function Oe(a){return a.charCodeAt(0)>=768&&Ug.test(a)}function Pe(a,b,c,d){var e=document.createElement(a);if(c&&(e.className=c),d&&(e.style.cssText=d),"string"==typeof b)e.appendChild(document.createTextNode(b));else if(b)for(var f=0;f0;--b)a.removeChild(a.firstChild);return a}function Re(a,b){return Qe(a).appendChild(b)}function Se(){for(var a=document.activeElement;a&&a.root&&a.root.activeElement;)a=a.root.activeElement;return a}function Te(a){return new RegExp("(^|\\s)"+a+"(?:$|\\s)\\s*")}function Ue(a,b){for(var c=a.split(" "),d=0;d2&&!(sf&&8>tf))}var c=Wg?Pe("span","​"):Pe("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return c.setAttribute("cm-text",""),c}function Ze(a){if(null!=Xg)return Xg;var b=Re(a,document.createTextNode("AخA")),c=Rg(b,0,1).getBoundingClientRect();if(!c||c.left==c.right)return!1;var d=Rg(b,1,2).getBoundingClientRect();return Xg=d.right-c.right<3}function $e(a){if(null!=dh)return dh;var b=Re(a,Pe("span","x")),c=b.getBoundingClientRect(),d=Rg(b,0,1).getBoundingClientRect();return dh=Math.abs(c.left-d.left)>1}function _e(a,b,c,d){if(!a)return d(b,c,"ltr");for(var e=!1,f=0;fb||b==c&&g.to==b)&&(d(Math.max(g.from,b),Math.min(g.to,c),1==g.level?"rtl":"ltr"),e=!0)}e||d(b,c,"ltr")}function af(a){return a.level%2?a.to:a.from}function bf(a){return a.level%2?a.from:a.to}function cf(a){var b=de(a);return b?af(b[0]):0}function df(a){var b=de(a);return b?bf(Fe(b)):a.text.length}function ef(a,b){var c=Yd(a.doc,b),d=rd(c);d!=c&&(b=ae(d));var e=de(d),f=e?e[0].level%2?df(d):cf(d):0;return Lf(b,f)}function ff(a,b){for(var c,d=Yd(a.doc,b);c=pd(d);)d=c.find(1,!0).line,b=null;var e=de(d),f=e?e[0].level%2?cf(d):df(d):d.text.length;return Lf(null==b?ae(d):b,f)}function gf(a,b){var c=ef(a,b.line),d=Yd(a.doc,c.line),e=de(d);if(!e||0==e[0].level){var f=Math.max(0,d.text.search(/\S/)),g=b.line==c.line&&b.ch<=f&&b.ch;return Lf(c.line,g?0:f)}return c}function hf(a,b,c){var d=a[0].level;return b==d?!0:c==d?!1:c>b}function jf(a,b){fh=null;for(var c,d=0;db)return d;if(e.from==b||e.to==b){if(null!=c)return hf(a,e.level,a[c].level)?(e.from!=e.to&&(fh=c),d):(e.from!=e.to&&(fh=d),c);c=d}}return c}function kf(a,b,c,d){if(!d)return b+c;do b+=c;while(b>0&&Oe(a.text.charAt(b)));return b}function lf(a,b,c,d){var e=de(a);if(!e)return mf(a,b,c,d);for(var f=jf(e,b),g=e[f],h=kf(a,b,g.level%2?-c:c,d);;){if(h>g.from&&h0==g.level%2?g.to:g.from);if(g=e[f+=c],!g)return null;h=c>0==g.level%2?kf(a,g.to,-1,d):kf(a,g.from,1,d)}}function mf(a,b,c,d){var e=b+c;if(d)for(;e>0&&Oe(a.text.charAt(e));)e+=c;return 0>e||e>a.text.length?null:e}var nf=navigator.userAgent,of=navigator.platform,pf=/gecko\/\d/i.test(nf),qf=/MSIE \d/.test(nf),rf=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(nf),sf=qf||rf,tf=sf&&(qf?document.documentMode||6:rf[1]),uf=/WebKit\//.test(nf),vf=uf&&/Qt\/\d+\.\d+/.test(nf),wf=/Chrome\//.test(nf),xf=/Opera\//.test(nf),yf=/Apple Computer/.test(navigator.vendor),zf=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(nf),Af=/PhantomJS/.test(nf),Bf=/AppleWebKit/.test(nf)&&/Mobile\/\w+/.test(nf),Cf=Bf||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(nf),Df=Bf||/Mac/.test(of),Ef=/\bCrOS\b/.test(nf),Ff=/win/i.test(of),Gf=xf&&nf.match(/Version\/(\d*\.\d*)/);Gf&&(Gf=Number(Gf[1])),Gf&&Gf>=15&&(xf=!1,uf=!0);var Hf=Df&&(vf||xf&&(null==Gf||12.11>Gf)),If=pf||sf&&tf>=9,Jf=!1,Kf=!1;p.prototype=Ke({update:function(a){var b=a.scrollWidth>a.clientWidth+1,c=a.scrollHeight>a.clientHeight+1,d=a.nativeBarWidth;if(c){this.vert.style.display="block",this.vert.style.bottom=b?d+"px":"0";var e=a.viewHeight-(b?d:0);this.vert.firstChild.style.height=Math.max(0,a.scrollHeight-a.clientHeight+e)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(b){this.horiz.style.display="block",this.horiz.style.right=c?d+"px":"0",this.horiz.style.left=a.barLeft+"px";var f=a.viewWidth-a.barLeft-(c?d:0);this.horiz.firstChild.style.width=a.scrollWidth-a.clientWidth+f+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&a.clientHeight>0&&(0==d&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:c?d:0,bottom:b?d:0}},setScrollLeft:function(a){this.horiz.scrollLeft!=a&&(this.horiz.scrollLeft=a),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz)},setScrollTop:function(a){this.vert.scrollTop!=a&&(this.vert.scrollTop=a),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert)},zeroWidthHack:function(){var a=Df&&!zf?"12px":"18px";this.horiz.style.height=this.vert.style.width=a,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new De,this.disableVert=new De},enableZeroWidthBar:function(a,b){function c(){var d=a.getBoundingClientRect(),e=document.elementFromPoint(d.left+1,d.bottom-1); +e!=a?a.style.pointerEvents="none":b.set(1e3,c)}a.style.pointerEvents="auto",b.set(1e3,c)},clear:function(){var a=this.horiz.parentNode;a.removeChild(this.horiz),a.removeChild(this.vert)}},p.prototype),q.prototype=Ke({update:function(){return{bottom:0,right:0}},setScrollLeft:function(){},setScrollTop:function(){},clear:function(){}},q.prototype),a.scrollbarModel={"native":p,"null":q},z.prototype.signal=function(a,b){Be(a,b)&&this.events.push(arguments)},z.prototype.finish=function(){for(var a=0;a=9&&c.hasSelection&&(c.hasSelection=null),c.poll()}),Dg(f,"paste",function(a){ze(d,a)||$(a,d)||(d.state.pasteIncoming=!0,c.fastPoll())}),Dg(f,"cut",b),Dg(f,"copy",b),Dg(a.scroller,"paste",function(b){Tb(a,b)||ze(d,b)||(d.state.pasteIncoming=!0,c.focus())}),Dg(a.lineSpace,"selectstart",function(b){Tb(a,b)||Ag(b)}),Dg(f,"compositionstart",function(){var a=d.getCursor("from");c.composing&&c.composing.range.clear(),c.composing={start:a,range:d.markText(a,d.getCursor("to"),{className:"CodeMirror-composing"})}}),Dg(f,"compositionend",function(){c.composing&&(c.poll(),c.composing.range.clear(),c.composing=null)})},prepareSelection:function(){var a=this.cm,b=a.display,c=a.doc,d=Ja(a);if(a.options.moveInputWithCursor){var e=nb(a,c.sel.primary().head,"div"),f=b.wrapper.getBoundingClientRect(),g=b.lineDiv.getBoundingClientRect();d.teTop=Math.max(0,Math.min(b.wrapper.clientHeight-10,e.top+g.top-f.top)),d.teLeft=Math.max(0,Math.min(b.wrapper.clientWidth-10,e.left+g.left-f.left))}return d},showSelection:function(a){var b=this.cm,c=b.display;Re(c.cursorDiv,a.cursors),Re(c.selectionDiv,a.selection),null!=a.teTop&&(this.wrapper.style.top=a.teTop+"px",this.wrapper.style.left=a.teLeft+"px")},reset:function(a){if(!this.contextMenuPending){var b,c,d=this.cm,e=d.doc;if(d.somethingSelected()){this.prevInput="";var f=e.sel.primary();b=ch&&(f.to().line-f.from().line>100||(c=d.getSelection()).length>1e3);var g=b?"-":c||d.getSelection();this.textarea.value=g,d.state.focused&&Qg(this.textarea),sf&&tf>=9&&(this.hasSelection=g)}else a||(this.prevInput=this.textarea.value="",sf&&tf>=9&&(this.hasSelection=null));this.inaccurateSelection=b}},getField:function(){return this.textarea},supportsTouch:function(){return!1},focus:function(){if("nocursor"!=this.cm.options.readOnly&&(!Cf||Se()!=this.textarea))try{this.textarea.focus()}catch(a){}},blur:function(){this.textarea.blur()},resetPosition:function(){this.wrapper.style.top=this.wrapper.style.left=0},receivedFocus:function(){this.slowPoll()},slowPoll:function(){var a=this;a.pollingFast||a.polling.set(this.cm.options.pollInterval,function(){a.poll(),a.cm.state.focused&&a.slowPoll()})},fastPoll:function(){function a(){var d=c.poll();d||b?(c.pollingFast=!1,c.slowPoll()):(b=!0,c.polling.set(60,a))}var b=!1,c=this;c.pollingFast=!0,c.polling.set(20,a)},poll:function(){var a=this.cm,b=this.textarea,c=this.prevInput;if(this.contextMenuPending||!a.state.focused||bh(b)&&!c&&!this.composing||a.isReadOnly()||a.options.disableInput||a.state.keySeq)return!1;var d=b.value;if(d==c&&!a.somethingSelected())return!1;if(sf&&tf>=9&&this.hasSelection===d||Df&&/[\uf700-\uf7ff]/.test(d))return a.display.input.reset(),!1;if(a.doc.sel==a.display.selForContextMenu){var e=d.charCodeAt(0);if(8203!=e||c||(c="​"),8666==e)return this.reset(),this.cm.execCommand("undo")}for(var f=0,g=Math.min(c.length,d.length);g>f&&c.charCodeAt(f)==d.charCodeAt(f);)++f;var h=this;return Db(a,function(){Z(a,d.slice(f),c.length-f,null,h.composing?"*compose":null),d.length>1e3||d.indexOf("\n")>-1?b.value=h.prevInput="":h.prevInput=d,h.composing&&(h.composing.range.clear(),h.composing.range=a.markText(h.composing.start,a.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},ensurePolled:function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},onKeyPress:function(){sf&&tf>=9&&(this.hasSelection=null),this.fastPoll()},onContextMenu:function(a){function b(){if(null!=g.selectionStart){var a=e.somethingSelected(),b="​"+(a?g.value:"");g.value="⇚",g.value=b,d.prevInput=a?"":"​",g.selectionStart=1,g.selectionEnd=b.length,f.selForContextMenu=e.doc.sel}}function c(){if(d.contextMenuPending=!1,d.wrapper.style.cssText=l,g.style.cssText=k,sf&&9>tf&&f.scrollbars.setScrollTop(f.scroller.scrollTop=i),null!=g.selectionStart){(!sf||sf&&9>tf)&&b();var a=0,c=function(){f.selForContextMenu==e.doc.sel&&0==g.selectionStart&&g.selectionEnd>0&&"​"==d.prevInput?Eb(e,jg.selectAll)(e):a++<10?f.detectingSelectAll=setTimeout(c,500):f.input.reset()};f.detectingSelectAll=setTimeout(c,200)}}var d=this,e=d.cm,f=e.display,g=d.textarea,h=Ub(e,a),i=f.scroller.scrollTop;if(h&&!xf){var j=e.options.resetSelectionOnContextMenu;j&&-1==e.doc.sel.contains(h)&&Eb(e,Aa)(e.doc,na(h),Kg);var k=g.style.cssText,l=d.wrapper.style.cssText;d.wrapper.style.cssText="position: absolute";var m=d.wrapper.getBoundingClientRect();if(g.style.cssText="position: absolute; width: 30px; height: 30px; top: "+(a.clientY-m.top-5)+"px; left: "+(a.clientX-m.left-5)+"px; z-index: 1000; background: "+(sf?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",uf)var n=window.scrollY;if(f.input.focus(),uf&&window.scrollTo(null,n),f.input.reset(),e.somethingSelected()||(g.value=d.prevInput=" "),d.contextMenuPending=!0,f.selForContextMenu=e.doc.sel,clearTimeout(f.detectingSelectAll),sf&&tf>=9&&b(),If){Cg(a);var o=function(){Fg(window,"mouseup",o),setTimeout(c,20)};Dg(window,"mouseup",o)}else setTimeout(c,50)}},readOnlyChanged:function(a){a||this.reset()},setUneditable:Ie,needsContentAttribute:!1},ca.prototype),ea.prototype=Ke({init:function(a){function b(a){if(!ze(d,a)){if(d.somethingSelected())Nf={lineWise:!1,text:d.getSelections()},"cut"==a.type&&d.replaceSelection("",null,"cut");else{if(!d.options.lineWiseCopyCut)return;var b=aa(d);Nf={lineWise:!0,text:b.text},"cut"==a.type&&d.operation(function(){d.setSelections(b.ranges,0,Kg),d.replaceSelection("",null,"cut")})}if(a.clipboardData&&!Bf)a.preventDefault(),a.clipboardData.clearData(),a.clipboardData.setData("text/plain",Nf.text.join("\n"));else{var c=da(),e=c.firstChild;d.display.lineSpace.insertBefore(c,d.display.lineSpace.firstChild),e.value=Nf.text.join("\n");var f=document.activeElement;Qg(e),setTimeout(function(){d.display.lineSpace.removeChild(c),f.focus()},50)}}}var c=this,d=c.cm,e=c.div=a.lineDiv;ba(e),Dg(e,"paste",function(a){ze(d,a)||$(a,d)}),Dg(e,"compositionstart",function(a){var b=a.data;if(c.composing={sel:d.doc.sel,data:b,startData:b},b){var e=d.doc.sel.primary(),f=d.getLine(e.head.line),g=f.indexOf(b,Math.max(0,e.head.ch-b.length));g>-1&&g<=e.head.ch&&(c.composing.sel=na(Lf(e.head.line,g),Lf(e.head.line,g+b.length)))}}),Dg(e,"compositionupdate",function(a){c.composing.data=a.data}),Dg(e,"compositionend",function(a){var b=c.composing;b&&(a.data==b.startData||/\u200b/.test(a.data)||(b.data=a.data),setTimeout(function(){b.handled||c.applyComposition(b),c.composing==b&&(c.composing=null)},50))}),Dg(e,"touchstart",function(){c.forceCompositionEnd()}),Dg(e,"input",function(){c.composing||(d.isReadOnly()||!c.pollContent())&&Db(c.cm,function(){Jb(d)})}),Dg(e,"copy",b),Dg(e,"cut",b)},prepareSelection:function(){var a=Ja(this.cm,!1);return a.focus=this.cm.state.focused,a},showSelection:function(a,b){a&&this.cm.display.view.length&&((a.focus||b)&&this.showPrimarySelection(),this.showMultipleSelections(a))},showPrimarySelection:function(){var a=window.getSelection(),b=this.cm.doc.sel.primary(),c=ha(this.cm,a.anchorNode,a.anchorOffset),d=ha(this.cm,a.focusNode,a.focusOffset);if(!c||c.bad||!d||d.bad||0!=Mf(X(c,d),b.from())||0!=Mf(W(c,d),b.to())){var e=fa(this.cm,b.from()),f=fa(this.cm,b.to());if(e||f){var g=this.cm.display.view,h=a.rangeCount&&a.getRangeAt(0);if(e){if(!f){var i=g[g.length-1].measure,j=i.maps?i.maps[i.maps.length-1]:i.map;f={node:j[j.length-1],offset:j[j.length-2]-j[j.length-3]}}}else e={node:g[0].measure.map[2],offset:0};try{var k=Rg(e.node,e.offset,f.offset,f.node)}catch(l){}k&&(!pf&&this.cm.state.focused?(a.collapse(e.node,e.offset),k.collapsed||a.addRange(k)):(a.removeAllRanges(),a.addRange(k)),h&&null==a.anchorNode?a.addRange(h):pf&&this.startGracePeriod()),this.rememberSelection()}}},startGracePeriod:function(){var a=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){a.gracePeriod=!1,a.selectionChanged()&&a.cm.operation(function(){a.cm.curOp.selectionChanged=!0})},20)},showMultipleSelections:function(a){Re(this.cm.display.cursorDiv,a.cursors),Re(this.cm.display.selectionDiv,a.selection)},rememberSelection:function(){var a=window.getSelection();this.lastAnchorNode=a.anchorNode,this.lastAnchorOffset=a.anchorOffset,this.lastFocusNode=a.focusNode,this.lastFocusOffset=a.focusOffset},selectionInEditor:function(){var a=window.getSelection();if(!a.rangeCount)return!1;var b=a.getRangeAt(0).commonAncestorContainer;return Vg(this.div,b)},focus:function(){"nocursor"!=this.cm.options.readOnly&&this.div.focus()},blur:function(){this.div.blur()},getField:function(){return this.div},supportsTouch:function(){return!0},receivedFocus:function(){function a(){b.cm.state.focused&&(b.pollSelection(),b.polling.set(b.cm.options.pollInterval,a))}var b=this;this.selectionInEditor()?this.pollSelection():Db(this.cm,function(){b.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,a)},selectionChanged:function(){var a=window.getSelection();return a.anchorNode!=this.lastAnchorNode||a.anchorOffset!=this.lastAnchorOffset||a.focusNode!=this.lastFocusNode||a.focusOffset!=this.lastFocusOffset},pollSelection:function(){if(!this.composing&&!this.gracePeriod&&this.selectionChanged()){var a=window.getSelection(),b=this.cm;this.rememberSelection();var c=ha(b,a.anchorNode,a.anchorOffset),d=ha(b,a.focusNode,a.focusOffset);c&&d&&Db(b,function(){Aa(b.doc,na(c,d),Kg),(c.bad||d.bad)&&(b.curOp.selectionChanged=!0)})}},pollContent:function(){var a=this.cm,b=a.display,c=a.doc.sel.primary(),d=c.from(),e=c.to();if(d.lineb.viewTo-1)return!1;var f;if(d.line==b.viewFrom||0==(f=Mb(a,d.line)))var g=ae(b.view[0].line),h=b.view[0].node;else var g=ae(b.view[f].line),h=b.view[f-1].node.nextSibling;var i=Mb(a,e.line);if(i==b.view.length-1)var j=b.viewTo-1,k=b.lineDiv.lastChild;else var j=ae(b.view[i+1].line)-1,k=b.view[i+1].node.previousSibling;for(var l=a.doc.splitLines(ja(a,h,k,g,j)),m=Zd(a.doc,Lf(g,0),Lf(j,Yd(a.doc,j).text.length));l.length>1&&m.length>1;)if(Fe(l)==Fe(m))l.pop(),m.pop(),j--;else{if(l[0]!=m[0])break;l.shift(),m.shift(),g++}for(var n=0,o=0,p=l[0],q=m[0],r=Math.min(p.length,q.length);r>n&&p.charCodeAt(n)==q.charCodeAt(n);)++n;for(var s=Fe(l),t=Fe(m),u=Math.min(s.length-(1==l.length?n:0),t.length-(1==m.length?n:0));u>o&&s.charCodeAt(s.length-o-1)==t.charCodeAt(t.length-o-1);)++o;l[l.length-1]=s.slice(0,s.length-o),l[0]=l[0].slice(n);var v=Lf(g,n),w=Lf(j,m.length?Fe(m).length-o:0);return l.length>1||l[0]||Mf(v,w)?(Fc(a.doc,l,v,w,"+input"),!0):void 0},ensurePolled:function(){this.forceCompositionEnd()},reset:function(){this.forceCompositionEnd()},forceCompositionEnd:function(){this.composing&&!this.composing.handled&&(this.applyComposition(this.composing),this.composing.handled=!0,this.div.blur(),this.div.focus())},applyComposition:function(a){this.cm.isReadOnly()?Eb(this.cm,Jb)(this.cm):a.data&&a.data!=a.startData&&Eb(this.cm,Z)(this.cm,a.data,0,a.sel)},setUneditable:function(a){a.contentEditable="false"},onKeyPress:function(a){a.preventDefault(),this.cm.isReadOnly()||Eb(this.cm,Z)(this.cm,String.fromCharCode(null==a.charCode?a.keyCode:a.charCode),0)},readOnlyChanged:function(a){this.div.contentEditable=String("nocursor"!=a)},onContextMenu:Ie,resetPosition:Ie,needsContentAttribute:!0},ea.prototype),a.inputStyles={textarea:ca,contenteditable:ea},ka.prototype={primary:function(){return this.ranges[this.primIndex]},equals:function(a){if(a==this)return!0;if(a.primIndex!=this.primIndex||a.ranges.length!=this.ranges.length)return!1;for(var b=0;b=0&&Mf(a,d.to())<=0)return c}return-1}},la.prototype={from:function(){return X(this.anchor,this.head)},to:function(){return W(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};var Of,Pf,Qf,Rf={left:0,right:0,top:0,bottom:0},Sf=null,Tf=0,Uf=0,Vf=0,Wf=null;sf?Wf=-.53:pf?Wf=15:wf?Wf=-.7:yf&&(Wf=-1/3);var Xf=function(a){var b=a.wheelDeltaX,c=a.wheelDeltaY;return null==b&&a.detail&&a.axis==a.HORIZONTAL_AXIS&&(b=a.detail),null==c&&a.detail&&a.axis==a.VERTICAL_AXIS?c=a.detail:null==c&&(c=a.wheelDelta),{x:b,y:c}};a.wheelEventPixels=function(a){var b=Xf(a);return b.x*=Wf,b.y*=Wf,b};var Yf=new De,Zf=null,$f=a.changeEnd=function(a){return a.text?Lf(a.from.line+a.text.length-1,Fe(a.text).length+(1==a.text.length?a.from.ch:0)):a.to};a.prototype={constructor:a,focus:function(){window.focus(),this.display.input.focus()},setOption:function(a,b){var c=this.options,d=c[a];(c[a]!=b||"mode"==a)&&(c[a]=b,ag.hasOwnProperty(a)&&Eb(this,ag[a])(this,b,d))},getOption:function(a){return this.options[a]},getDoc:function(){return this.doc},addKeyMap:function(a,b){this.state.keyMaps[b?"push":"unshift"](Uc(a))},removeKeyMap:function(a){for(var b=this.state.keyMaps,c=0;cc&&(Nc(this,e.head.line,a,!0),c=e.head.line,d==this.doc.sel.primIndex&&Lc(this));else{var f=e.from(),g=e.to(),h=Math.max(c,f.line);c=Math.min(this.lastLine(),g.line-(g.ch?0:1))+1;for(var i=h;c>i;++i)Nc(this,i,a);var j=this.doc.sel.ranges;0==f.ch&&b.length==j.length&&j[d].from().ch>0&&wa(this.doc,d,new la(f,j[d].to()),Kg)}}}),getTokenAt:function(a,b){return Fd(this,a,b)},getLineTokens:function(a,b){return Fd(this,Lf(a),b,!0)},getTokenTypeAt:function(a){a=pa(this.doc,a);var b,c=Id(this,Yd(this.doc,a.line)),d=0,e=(c.length-1)/2,f=a.ch;if(0==f)b=c[2];else for(;;){var g=d+e>>1;if((g?c[2*g-1]:0)>=f)e=g;else{if(!(c[2*g+1]h?b:0==h?null:b.slice(0,h-1)},getModeAt:function(b){var c=this.doc.mode;return c.innerMode?a.innerMode(c,this.getTokenAt(b).state).mode:c},getHelper:function(a,b){return this.getHelpers(a,b)[0]},getHelpers:function(a,b){var c=[];if(!gg.hasOwnProperty(b))return c;var d=gg[b],e=this.getModeAt(a);if("string"==typeof e[b])d[e[b]]&&c.push(d[e[b]]);else if(e[b])for(var f=0;fe&&(a=e,d=!0),c=Yd(this.doc,a)}else c=a;return kb(this,c,{top:0,left:0},b||"page").top+(d?this.doc.height-ce(c):0)},defaultTextHeight:function(){return sb(this.display)},defaultCharWidth:function(){return tb(this.display)},setGutterMarker:Fb(function(a,b,c){return Oc(this.doc,a,"gutter",function(a){var d=a.gutterMarkers||(a.gutterMarkers={});return d[b]=c,!c&&Ne(d)&&(a.gutterMarkers=null),!0})}),clearGutter:Fb(function(a){var b=this,c=b.doc,d=c.first;c.iter(function(c){c.gutterMarkers&&c.gutterMarkers[a]&&(c.gutterMarkers[a]=null,Kb(b,d,"gutter"),Ne(c.gutterMarkers)&&(c.gutterMarkers=null)),++d})}),lineInfo:function(a){if("number"==typeof a){if(!ra(this.doc,a))return null;var b=a;if(a=Yd(this.doc,a),!a)return null}else{var b=ae(a);if(null==b)return null}return{line:b,handle:a,text:a.text,gutterMarkers:a.gutterMarkers,textClass:a.textClass,bgClass:a.bgClass,wrapClass:a.wrapClass,widgets:a.widgets}},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(a,b,c,d,e){var f=this.display;a=nb(this,pa(this.doc,a));var g=a.bottom,h=a.left;if(b.style.position="absolute",b.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(b),f.sizer.appendChild(b),"over"==d)g=a.top;else if("above"==d||"near"==d){var i=Math.max(f.wrapper.clientHeight,this.doc.height),j=Math.max(f.sizer.clientWidth,f.lineSpace.clientWidth);("above"==d||a.bottom+b.offsetHeight>i)&&a.top>b.offsetHeight?g=a.top-b.offsetHeight:a.bottom+b.offsetHeight<=i&&(g=a.bottom),h+b.offsetWidth>j&&(h=j-b.offsetWidth)}b.style.top=g+"px",b.style.left=b.style.right="","right"==e?(h=f.sizer.clientWidth-b.offsetWidth,b.style.right="0px"):("left"==e?h=0:"middle"==e&&(h=(f.sizer.clientWidth-b.offsetWidth)/2),b.style.left=h+"px"),c&&Ic(this,h,g,h+b.offsetWidth,g+b.offsetHeight)},triggerOnKeyDown:Fb(lc),triggerOnKeyPress:Fb(oc),triggerOnKeyUp:nc,execCommand:function(a){return jg.hasOwnProperty(a)?jg[a].call(null,this):void 0},triggerElectric:Fb(function(a){_(this,a)}),findPosH:function(a,b,c,d){var e=1;0>b&&(e=-1,b=-b);for(var f=0,g=pa(this.doc,a);b>f&&(g=Qc(this.doc,g,e,c,d),!g.hitSide);++f);return g},moveH:Fb(function(a,b){var c=this;c.extendSelectionsBy(function(d){return c.display.shift||c.doc.extend||d.empty()?Qc(c.doc,d.head,a,b,c.options.rtlMoveVisually):0>a?d.from():d.to()},Mg)}),deleteH:Fb(function(a,b){var c=this.doc.sel,d=this.doc;c.somethingSelected()?d.replaceSelection("",null,"+delete"):Pc(this,function(c){var e=Qc(d,c.head,a,b,!1);return 0>a?{from:e,to:c.head}:{from:c.head,to:e}})}),findPosV:function(a,b,c,d){var e=1,f=d;0>b&&(e=-1,b=-b);for(var g=0,h=pa(this.doc,a);b>g;++g){var i=nb(this,h,"div");if(null==f?f=i.left:i.left=f,h=Rc(this,i,e,c),h.hitSide)break}return h},moveV:Fb(function(a,b){var c=this,d=this.doc,e=[],f=!c.display.shift&&!d.extend&&d.sel.somethingSelected();if(d.extendSelectionsBy(function(g){if(f)return 0>a?g.from():g.to();var h=nb(c,g.head,"div");null!=g.goalColumn&&(h.left=g.goalColumn),e.push(h.left);var i=Rc(c,h,a,b);return"page"==b&&g==d.sel.primary()&&Kc(c,null,mb(c,i,"div").top-h.top),i},Mg),e.length)for(var g=0;g0&&h(c.charAt(d-1));)--d;for(;e.5)&&g(this),Gg(this,"refresh",this)}),swapDoc:Fb(function(a){var b=this.doc;return b.cm=null,Xd(this,a),hb(this),this.display.input.reset(),this.scrollTo(a.scrollLeft,a.scrollTop),this.curOp.forceScroll=!0,xe(this,"swapDoc",this,b),b}),getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Ce(a);var _f=a.defaults={},ag=a.optionHandlers={},bg=a.Init={toString:function(){return"CodeMirror.Init"}};Sc("value","",function(a,b){a.setValue(b)},!0),Sc("mode",null,function(a,b){a.doc.modeOption=b,c(a)},!0),Sc("indentUnit",2,c,!0),Sc("indentWithTabs",!1),Sc("smartIndent",!0),Sc("tabSize",4,function(a){d(a),hb(a),Jb(a)},!0),Sc("lineSeparator",null,function(a,b){if(a.doc.lineSep=b,b){var c=[],d=a.doc.first;a.doc.iter(function(a){for(var e=0;;){var f=a.text.indexOf(b,e);if(-1==f)break;e=f+b.length,c.push(Lf(d,f))}d++});for(var e=c.length-1;e>=0;e--)Fc(a.doc,b,c[e],Lf(c[e].line,c[e].ch+b.length))}}),Sc("specialChars",/[\u0000-\u001f\u007f\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g,function(b,c,d){b.state.specialChars=new RegExp(c.source+(c.test(" ")?"":"| "),"g"),d!=a.Init&&b.refresh()}),Sc("specialCharPlaceholder",Md,function(a){a.refresh()},!0),Sc("electricChars",!0),Sc("inputStyle",Cf?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),Sc("rtlMoveVisually",!Ff),Sc("wholeLineUpdateBefore",!0),Sc("theme","default",function(a){h(a),i(a)},!0),Sc("keyMap","default",function(b,c,d){var e=Uc(c),f=d!=a.Init&&Uc(d);f&&f.detach&&f.detach(b,e),e.attach&&e.attach(b,f||null)}),Sc("extraKeys",null),Sc("lineWrapping",!1,e,!0),Sc("gutters",[],function(a){n(a.options),i(a)},!0),Sc("fixedGutter",!0,function(a,b){a.display.gutters.style.left=b?y(a.display)+"px":"0",a.refresh()},!0),Sc("coverGutterNextToScrollbar",!1,function(a){s(a)},!0),Sc("scrollbarStyle","native",function(a){r(a),s(a),a.display.scrollbars.setScrollTop(a.doc.scrollTop),a.display.scrollbars.setScrollLeft(a.doc.scrollLeft)},!0),Sc("lineNumbers",!1,function(a){n(a.options),i(a)},!0),Sc("firstLineNumber",1,i,!0),Sc("lineNumberFormatter",function(a){return a},i,!0),Sc("showCursorWhenSelecting",!1,Ia,!0),Sc("resetSelectionOnContextMenu",!0),Sc("lineWiseCopyCut",!0),Sc("readOnly",!1,function(a,b){"nocursor"==b?(rc(a),a.display.input.blur(),a.display.disabled=!0):a.display.disabled=!1,a.display.input.readOnlyChanged(b)}),Sc("disableInput",!1,function(a,b){b||a.display.input.reset()},!0),Sc("dragDrop",!0,Rb),Sc("allowDropFileTypes",null),Sc("cursorBlinkRate",530),Sc("cursorScrollMargin",0),Sc("cursorHeight",1,Ia,!0),Sc("singleCursorHeightPerLine",!0,Ia,!0),Sc("workTime",100),Sc("workDelay",100),Sc("flattenSpans",!0,d,!0),Sc("addModeClass",!1,d,!0),Sc("pollInterval",100),Sc("undoDepth",200,function(a,b){a.doc.history.undoDepth=b}),Sc("historyEventDelay",1250),Sc("viewportMargin",10,function(a){a.refresh()},!0),Sc("maxHighlightLength",1e4,d,!0),Sc("moveInputWithCursor",!0,function(a,b){b||a.display.input.resetPosition()}),Sc("tabindex",null,function(a,b){a.display.input.getField().tabIndex=b||""}),Sc("autofocus",null);var cg=a.modes={},dg=a.mimeModes={};a.defineMode=function(b,c){a.defaults.mode||"null"==b||(a.defaults.mode=b),arguments.length>2&&(c.dependencies=Array.prototype.slice.call(arguments,2)),cg[b]=c},a.defineMIME=function(a,b){dg[a]=b},a.resolveMode=function(b){if("string"==typeof b&&dg.hasOwnProperty(b))b=dg[b];else if(b&&"string"==typeof b.name&&dg.hasOwnProperty(b.name)){var c=dg[b.name];"string"==typeof c&&(c={name:c}),b=Je(c,b),b.name=c.name}else if("string"==typeof b&&/^[\w\-]+\/[\w\-]+\+xml$/.test(b))return a.resolveMode("application/xml");return"string"==typeof b?{name:b}:b||{name:"null"}},a.getMode=function(b,c){var c=a.resolveMode(c),d=cg[c.name];if(!d)return a.getMode(b,"text/plain");var e=d(b,c);if(eg.hasOwnProperty(c.name)){var f=eg[c.name];for(var g in f)f.hasOwnProperty(g)&&(e.hasOwnProperty(g)&&(e["_"+g]=e[g]),e[g]=f[g])}if(e.name=c.name,c.helperType&&(e.helperType=c.helperType),c.modeProps)for(var g in c.modeProps)e[g]=c.modeProps[g];return e},a.defineMode("null",function(){return{token:function(a){a.skipToEnd()}}}),a.defineMIME("text/plain","null");var eg=a.modeExtensions={};a.extendMode=function(a,b){var c=eg.hasOwnProperty(a)?eg[a]:eg[a]={};Ke(b,c)},a.defineExtension=function(b,c){a.prototype[b]=c},a.defineDocExtension=function(a,b){xg.prototype[a]=b},a.defineOption=Sc;var fg=[];a.defineInitHook=function(a){fg.push(a)};var gg=a.helpers={};a.registerHelper=function(b,c,d){gg.hasOwnProperty(b)||(gg[b]=a[b]={_global:[]}),gg[b][c]=d},a.registerGlobalHelper=function(b,c,d,e){a.registerHelper(b,c,e),gg[b]._global.push({pred:d,val:e})};var hg=a.copyState=function(a,b){if(b===!0)return b;if(a.copyState)return a.copyState(b);var c={};for(var d in b){var e=b[d];e instanceof Array&&(e=e.concat([])),c[d]=e}return c},ig=a.startState=function(a,b,c){return a.startState?a.startState(b,c):!0};a.innerMode=function(a,b){for(;a.innerMode;){var c=a.innerMode(b);if(!c||c.mode==a)break;b=c.state,a=c.mode}return c||{mode:a,state:b}};var jg=a.commands={selectAll:function(a){a.setSelection(Lf(a.firstLine(),0),Lf(a.lastLine()),Kg)},singleSelection:function(a){a.setSelection(a.getCursor("anchor"),a.getCursor("head"),Kg)},killLine:function(a){Pc(a,function(b){if(b.empty()){var c=Yd(a.doc,b.head.line).text.length;return b.head.ch==c&&b.head.line0)e=new Lf(e.line,e.ch+1),a.replaceRange(f.charAt(e.ch-1)+f.charAt(e.ch-2),Lf(e.line,e.ch-2),e,"+transpose");else if(e.line>a.doc.first){var g=Yd(a.doc,e.line-1).text;g&&a.replaceRange(f.charAt(0)+a.doc.lineSeparator()+g.charAt(g.length-1),Lf(e.line-1,g.length-1),Lf(e.line,1),"+transpose")}c.push(new la(e,e))}a.setSelections(c)})},newlineAndIndent:function(a){Db(a,function(){for(var b=a.listSelections().length,c=0;b>c;c++){ +var d=a.listSelections()[c];a.replaceRange(a.doc.lineSeparator(),d.anchor,d.head,"+input"),a.indentLine(d.from().line+1,null,!0)}Lc(a)})},openLine:function(a){a.replaceSelection("\n","start")},toggleOverwrite:function(a){a.toggleOverwrite()}},kg=a.keyMap={};kg.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},kg.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},kg.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},kg.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},kg["default"]=Df?kg.macDefault:kg.pcDefault,a.normalizeKeyMap=function(a){var b={};for(var c in a)if(a.hasOwnProperty(c)){var d=a[c];if(/^(name|fallthrough|(de|at)tach)$/.test(c))continue;if("..."==d){delete a[c];continue}for(var e=He(c.split(" "),Tc),f=0;f=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){return this.posb},eatSpace:function(){for(var a=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>a},skipToEnd:function(){this.pos=this.string.length},skipTo:function(a){var b=this.string.indexOf(a,this.pos);return b>-1?(this.pos=b,!0):void 0},backUp:function(a){this.pos-=a},column:function(){return this.lastColumnPos0?null:(d&&b!==!1&&(this.pos+=d[0].length),d)}var e=function(a){return c?a.toLowerCase():a},f=this.string.substr(this.pos,a.length);return e(f)==e(a)?(b!==!1&&(this.pos+=a.length),!0):void 0},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(a,b){this.lineStart+=a;try{return b()}finally{this.lineStart-=a}}};var pg=0,qg=a.TextMarker=function(a,b){this.lines=[],this.type=b,this.doc=a,this.id=++pg};Ce(qg),qg.prototype.clear=function(){if(!this.explicitlyCleared){var a=this.doc.cm,b=a&&!a.curOp;if(b&&ub(a),Be(this,"clear")){var c=this.find();c&&xe(this,"clear",c.from,c.to)}for(var d=null,e=null,f=0;fa.display.maxLineLength&&(a.display.maxLine=i,a.display.maxLineLength=j,a.display.maxLineChanged=!0)}null!=d&&a&&this.collapsed&&Jb(a,d,e+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,a&&Da(a.doc)),a&&xe(a,"markerCleared",a,this),b&&wb(a),this.parent&&this.parent.clear()}},qg.prototype.find=function(a,b){null==a&&"bookmark"==this.type&&(a=1);for(var c,d,e=0;ec;++c){var e=this.lines[c];this.height-=e.height,Bd(e),xe(e,"delete")}this.lines.splice(a,b)},collapse:function(a){a.push.apply(a,this.lines)},insertInner:function(a,b,c){this.height+=c,this.lines=this.lines.slice(0,a).concat(b).concat(this.lines.slice(a));for(var d=0;da;++a)if(c(this.lines[a]))return!0}},Vd.prototype={chunkSize:function(){return this.size},removeInner:function(a,b){this.size-=b;for(var c=0;ca){var f=Math.min(b,e-a),g=d.height;if(d.removeInner(a,f),this.height-=g-d.height,e==f&&(this.children.splice(c--,1),d.parent=null),0==(b-=f))break;a=0}else a-=e}if(this.size-b<25&&(this.children.length>1||!(this.children[0]instanceof Ud))){var h=[];this.collapse(h),this.children=[new Ud(h)],this.children[0].parent=this}},collapse:function(a){for(var b=0;b=a){if(e.insertInner(a,b,c),e.lines&&e.lines.length>50){for(var g=e.lines.length%25+25,h=g;h10);a.parent.maybeSpill()}},iterN:function(a,b,c){for(var d=0;da){var g=Math.min(b,f-a);if(e.iterN(a,g,c))return!0;if(0==(b-=g))break;a=0}else a-=f}}};var wg=0,xg=a.Doc=function(a,b,c,d){if(!(this instanceof xg))return new xg(a,b,c,d);null==c&&(c=0),Vd.call(this,[new Ud([new tg("",null)])]),this.first=c,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.frontier=c;var e=Lf(c,0);this.sel=na(e),this.history=new ee(null),this.id=++wg,this.modeOption=b,this.lineSep=d,this.extend=!1,"string"==typeof a&&(a=this.splitLines(a)),Td(this,{from:e,to:e,text:a}),Aa(this,na(e),Kg)};xg.prototype=Je(Vd.prototype,{constructor:xg,iter:function(a,b,c){c?this.iterN(a-this.first,b-a,c):this.iterN(this.first,this.first+this.size,a)},insert:function(a,b){for(var c=0,d=0;d=0;f--)zc(this,d[f]);h?za(this,h):this.cm&&Lc(this.cm)}),undo:Gb(function(){Bc(this,"undo")}),redo:Gb(function(){Bc(this,"redo")}),undoSelection:Gb(function(){Bc(this,"undo",!0)}),redoSelection:Gb(function(){Bc(this,"redo",!0)}),setExtending:function(a){this.extend=a},getExtending:function(){return this.extend},historySize:function(){for(var a=this.history,b=0,c=0,d=0;d=a.ch)&&b.push(e.marker.parent||e.marker)}return b},findMarks:function(a,b,c){a=pa(this,a),b=pa(this,b);var d=[],e=a.line;return this.iter(a.line,b.line+1,function(f){var g=f.markedSpans;if(g)for(var h=0;h=i.to||null==i.from&&e!=a.line||null!=i.from&&e==b.line&&i.from>=b.ch||c&&!c(i.marker)||d.push(i.marker.parent||i.marker)}++e}),d},getAllMarks:function(){var a=[];return this.iter(function(b){var c=b.markedSpans;if(c)for(var d=0;da?(b=a,!0):(a-=f,void++c)}),pa(this,Lf(c,b))},indexFromPos:function(a){a=pa(this,a);var b=a.ch;if(a.lineb&&(b=a.from),null!=a.to&&a.toh||h>=b)return g+(b-f);g+=h-f,g+=c-g%c,f=h+1}},Og=a.findColumn=function(a,b,c){for(var d=0,e=0;;){var f=a.indexOf(" ",d);-1==f&&(f=a.length);var g=f-d;if(f==a.length||e+g>=b)return d+Math.min(g,b-e);if(e+=f-d,e+=c-e%c,d=f+1,e>=b)return d}},Pg=[""],Qg=function(a){a.select()};Bf?Qg=function(a){a.selectionStart=0,a.selectionEnd=a.value.length}:sf&&(Qg=function(a){try{a.select()}catch(b){}});var Rg,Sg=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Tg=a.isWordChar=function(a){return/\w/.test(a)||a>"€"&&(a.toUpperCase()!=a.toLowerCase()||Sg.test(a))},Ug=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;Rg=document.createRange?function(a,b,c,d){var e=document.createRange();return e.setEnd(d||a,c),e.setStart(a,b),e}:function(a,b,c){var d=document.body.createTextRange();try{d.moveToElementText(a.parentNode)}catch(e){return d}return d.collapse(!0),d.moveEnd("character",c),d.moveStart("character",b),d};var Vg=a.contains=function(a,b){if(3==b.nodeType&&(b=b.parentNode),a.contains)return a.contains(b);do if(11==b.nodeType&&(b=b.host),b==a)return!0;while(b=b.parentNode)};sf&&11>tf&&(Se=function(){try{return document.activeElement}catch(a){return document.body}});var Wg,Xg,Yg=a.rmClass=function(a,b){var c=a.className,d=Te(b).exec(c);if(d){var e=c.slice(d.index+d[0].length);a.className=c.slice(0,d.index)+(e?d[1]+e:"")}},Zg=a.addClass=function(a,b){var c=a.className;Te(b).test(c)||(a.className+=(c?" ":"")+b)},$g=!1,_g=function(){if(sf&&9>tf)return!1;var a=Pe("div");return"draggable"in a||"dragDrop"in a}(),ah=a.splitLines=3!="\n\nb".split(/\n/).length?function(a){for(var b=0,c=[],d=a.length;d>=b;){var e=a.indexOf("\n",b);-1==e&&(e=a.length);var f=a.slice(b,"\r"==a.charAt(e-1)?e-1:e),g=f.indexOf("\r");-1!=g?(c.push(f.slice(0,g)),b+=g+1):(c.push(f),b=e+1)}return c}:function(a){return a.split(/\r\n?|\n/)},bh=window.getSelection?function(a){try{return a.selectionStart!=a.selectionEnd}catch(b){return!1}}:function(a){try{var b=a.ownerDocument.selection.createRange()}catch(c){}return b&&b.parentElement()==a?0!=b.compareEndPoints("StartToEnd",b):!1},ch=function(){var a=Pe("div");return"oncopy"in a?!0:(a.setAttribute("oncopy","return;"),"function"==typeof a.oncopy)}(),dh=null,eh=a.keyNames={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};!function(){for(var a=0;10>a;a++)eh[a+48]=eh[a+96]=String(a);for(var a=65;90>=a;a++)eh[a]=String.fromCharCode(a);for(var a=1;12>=a;a++)eh[a+111]=eh[a+63235]="F"+a}();var fh,gh=function(){function a(a){return 247>=a?c.charAt(a):a>=1424&&1524>=a?"R":a>=1536&&1773>=a?d.charAt(a-1536):a>=1774&&2220>=a?"r":a>=8192&&8203>=a?"w":8204==a?"b":"L"}function b(a,b,c){this.level=a,this.from=b,this.to=c}var c="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",d="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",e=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,f=/[stwN]/,g=/[LRr]/,h=/[Lb1n]/,i=/[1n]/,j="L";return function(c){if(!e.test(c))return!1;for(var d,k=c.length,l=[],m=0;k>m;++m)l.push(d=a(c.charCodeAt(m)));for(var m=0,n=j;k>m;++m){var d=l[m];"m"==d?l[m]=n:n=d}for(var m=0,o=j;k>m;++m){var d=l[m];"1"==d&&"r"==o?l[m]="n":g.test(d)&&(o=d,"r"==d&&(l[m]="R"))}for(var m=1,n=l[0];k-1>m;++m){var d=l[m];"+"==d&&"1"==n&&"1"==l[m+1]?l[m]="1":","!=d||n!=l[m+1]||"1"!=n&&"n"!=n||(l[m]=n),n=d}for(var m=0;k>m;++m){var d=l[m];if(","==d)l[m]="N";else if("%"==d){for(var p=m+1;k>p&&"%"==l[p];++p);for(var q=m&&"!"==l[m-1]||k>p&&"1"==l[p]?"1":"N",r=m;p>r;++r)l[r]=q;m=p-1}}for(var m=0,o=j;k>m;++m){var d=l[m];"L"==o&&"1"==d?l[m]="L":g.test(d)&&(o=d)}for(var m=0;k>m;++m)if(f.test(l[m])){for(var p=m+1;k>p&&f.test(l[p]);++p);for(var s="L"==(m?l[m-1]:j),t="L"==(k>p?l[p]:j),q=s||t?"L":"R",r=m;p>r;++r)l[r]=q;m=p-1}for(var u,v=[],m=0;k>m;)if(h.test(l[m])){var w=m;for(++m;k>m&&h.test(l[m]);++m);v.push(new b(0,w,m))}else{var x=m,y=v.length;for(++m;k>m&&"L"!=l[m];++m);for(var r=x;m>r;)if(i.test(l[r])){r>x&&v.splice(y,0,new b(1,x,r));var z=r;for(++r;m>r&&i.test(l[r]);++r);v.splice(y,0,new b(2,z,r)),x=r}else++r;m>x&&v.splice(y,0,new b(1,x,m))}return 1==v[0].level&&(u=c.match(/^\s+/))&&(v[0].from=u[0].length,v.unshift(new b(0,0,u[0].length))),1==Fe(v).level&&(u=c.match(/\s+$/))&&(Fe(v).to-=u[0].length,v.push(new b(0,k-u[0].length,k))),2==v[0].level&&v.unshift(new b(1,v[0].to,v[0].to)),v[0].level!=Fe(v).level&&v.push(new b(v[0].level,k,k)),v}}();return a.version="5.16.0",a}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/go/go.js b/media/editors/codemirror/mode/go/go.js index 21fe9a2d6e8a9..3c9ef6b989d33 100644 --- a/media/editors/codemirror/mode/go/go.js +++ b/media/editors/codemirror/mode/go/go.js @@ -23,7 +23,7 @@ CodeMirror.defineMode("go", function(config) { "bool":true, "byte":true, "complex64":true, "complex128":true, "float32":true, "float64":true, "int8":true, "int16":true, "int32":true, "int64":true, "string":true, "uint8":true, "uint16":true, "uint32":true, - "uint64":true, "int":true, "uint":true, "uintptr":true + "uint64":true, "int":true, "uint":true, "uintptr":true, "error": true }; var atoms = { diff --git a/media/editors/codemirror/mode/go/go.min.js b/media/editors/codemirror/mode/go/go.min.js index bf7bfe9858a02..3d32f1bd86049 100644 --- a/media/editors/codemirror/mode/go/go.min.js +++ b/media/editors/codemirror/mode/go/go.min.js @@ -1 +1 @@ -!function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)}(function(a){"use strict";a.defineMode("go",function(a){function b(a,b){var e=a.next();if('"'==e||"'"==e||"`"==e)return b.tokenize=c(e),b.tokenize(a,b);if(/[\d\.]/.test(e))return"."==e?a.match(/^[0-9]+([eE][\-+]?[0-9]+)?/):"0"==e?a.match(/^[xX][0-9a-fA-F]+/)||a.match(/^0[0-7]+/):a.match(/^[0-9]*\.?[0-9]*([eE][\-+]?[0-9]+)?/),"number";if(/[\[\]{}\(\),;\:\.]/.test(e))return h=e,null;if("/"==e){if(a.eat("*"))return b.tokenize=d,d(a,b);if(a.eat("/"))return a.skipToEnd(),"comment"}if(l.test(e))return a.eatWhile(l),"operator";a.eatWhile(/[\w\$_\xa1-\uffff]/);var f=a.current();return j.propertyIsEnumerable(f)?(("case"==f||"default"==f)&&(h="case"),"keyword"):k.propertyIsEnumerable(f)?"atom":"variable"}function c(a){return function(c,d){for(var e,f=!1,g=!1;null!=(e=c.next());){if(e==a&&!f){g=!0;break}f=!f&&"`"!=a&&"\\"==e}return(g||!f&&"`"!=a)&&(d.tokenize=b),"string"}}function d(a,c){for(var d,e=!1;d=a.next();){if("/"==d&&e){c.tokenize=b;break}e="*"==d}return"comment"}function e(a,b,c,d,e){this.indented=a,this.column=b,this.type=c,this.align=d,this.prev=e}function f(a,b,c){return a.context=new e(a.indented,b,c,null,a.context)}function g(a){if(a.context.prev){var b=a.context.type;return(")"==b||"]"==b||"}"==b)&&(a.indented=a.context.indented),a.context=a.context.prev}}var h,i=a.indentUnit,j={"break":!0,"case":!0,chan:!0,"const":!0,"continue":!0,"default":!0,defer:!0,"else":!0,fallthrough:!0,"for":!0,func:!0,go:!0,"goto":!0,"if":!0,"import":!0,"interface":!0,map:!0,"package":!0,range:!0,"return":!0,select:!0,struct:!0,"switch":!0,type:!0,"var":!0,bool:!0,"byte":!0,complex64:!0,complex128:!0,float32:!0,float64:!0,int8:!0,int16:!0,int32:!0,int64:!0,string:!0,uint8:!0,uint16:!0,uint32:!0,uint64:!0,"int":!0,uint:!0,uintptr:!0},k={"true":!0,"false":!0,iota:!0,nil:!0,append:!0,cap:!0,close:!0,complex:!0,copy:!0,imag:!0,len:!0,make:!0,"new":!0,panic:!0,print:!0,println:!0,real:!0,recover:!0},l=/[+\-*&^%:=<>!|\/]/;return{startState:function(a){return{tokenize:null,context:new e((a||0)-i,0,"top",!1),indented:0,startOfLine:!0}},token:function(a,c){var d=c.context;if(a.sol()&&(null==d.align&&(d.align=!1),c.indented=a.indentation(),c.startOfLine=!0,"case"==d.type&&(d.type="}")),a.eatSpace())return null;h=null;var e=(c.tokenize||b)(a,c);return"comment"==e?e:(null==d.align&&(d.align=!0),"{"==h?f(c,a.column(),"}"):"["==h?f(c,a.column(),"]"):"("==h?f(c,a.column(),")"):"case"==h?d.type="case":"}"==h&&"}"==d.type?d=g(c):h==d.type&&g(c),c.startOfLine=!1,e)},indent:function(a,c){if(a.tokenize!=b&&null!=a.tokenize)return 0;var d=a.context,e=c&&c.charAt(0);if("case"==d.type&&/^(?:case|default)\b/.test(c))return a.context.type="}",d.indented;var f=e==d.type;return d.align?d.column+(f?0:1):d.indented+(f?0:i)},electricChars:"{}):",fold:"brace",blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//"}}),a.defineMIME("text/x-go","go")}); \ No newline at end of file +!function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)}(function(a){"use strict";a.defineMode("go",function(a){function b(a,b){var e=a.next();if('"'==e||"'"==e||"`"==e)return b.tokenize=c(e),b.tokenize(a,b);if(/[\d\.]/.test(e))return"."==e?a.match(/^[0-9]+([eE][\-+]?[0-9]+)?/):"0"==e?a.match(/^[xX][0-9a-fA-F]+/)||a.match(/^0[0-7]+/):a.match(/^[0-9]*\.?[0-9]*([eE][\-+]?[0-9]+)?/),"number";if(/[\[\]{}\(\),;\:\.]/.test(e))return h=e,null;if("/"==e){if(a.eat("*"))return b.tokenize=d,d(a,b);if(a.eat("/"))return a.skipToEnd(),"comment"}if(l.test(e))return a.eatWhile(l),"operator";a.eatWhile(/[\w\$_\xa1-\uffff]/);var f=a.current();return j.propertyIsEnumerable(f)?(("case"==f||"default"==f)&&(h="case"),"keyword"):k.propertyIsEnumerable(f)?"atom":"variable"}function c(a){return function(c,d){for(var e,f=!1,g=!1;null!=(e=c.next());){if(e==a&&!f){g=!0;break}f=!f&&"`"!=a&&"\\"==e}return(g||!f&&"`"!=a)&&(d.tokenize=b),"string"}}function d(a,c){for(var d,e=!1;d=a.next();){if("/"==d&&e){c.tokenize=b;break}e="*"==d}return"comment"}function e(a,b,c,d,e){this.indented=a,this.column=b,this.type=c,this.align=d,this.prev=e}function f(a,b,c){return a.context=new e(a.indented,b,c,null,a.context)}function g(a){if(a.context.prev){var b=a.context.type;return(")"==b||"]"==b||"}"==b)&&(a.indented=a.context.indented),a.context=a.context.prev}}var h,i=a.indentUnit,j={"break":!0,"case":!0,chan:!0,"const":!0,"continue":!0,"default":!0,defer:!0,"else":!0,fallthrough:!0,"for":!0,func:!0,go:!0,"goto":!0,"if":!0,"import":!0,"interface":!0,map:!0,"package":!0,range:!0,"return":!0,select:!0,struct:!0,"switch":!0,type:!0,"var":!0,bool:!0,"byte":!0,complex64:!0,complex128:!0,float32:!0,float64:!0,int8:!0,int16:!0,int32:!0,int64:!0,string:!0,uint8:!0,uint16:!0,uint32:!0,uint64:!0,"int":!0,uint:!0,uintptr:!0,error:!0},k={"true":!0,"false":!0,iota:!0,nil:!0,append:!0,cap:!0,close:!0,complex:!0,copy:!0,imag:!0,len:!0,make:!0,"new":!0,panic:!0,print:!0,println:!0,real:!0,recover:!0},l=/[+\-*&^%:=<>!|\/]/;return{startState:function(a){return{tokenize:null,context:new e((a||0)-i,0,"top",!1),indented:0,startOfLine:!0}},token:function(a,c){var d=c.context;if(a.sol()&&(null==d.align&&(d.align=!1),c.indented=a.indentation(),c.startOfLine=!0,"case"==d.type&&(d.type="}")),a.eatSpace())return null;h=null;var e=(c.tokenize||b)(a,c);return"comment"==e?e:(null==d.align&&(d.align=!0),"{"==h?f(c,a.column(),"}"):"["==h?f(c,a.column(),"]"):"("==h?f(c,a.column(),")"):"case"==h?d.type="case":"}"==h&&"}"==d.type?d=g(c):h==d.type&&g(c),c.startOfLine=!1,e)},indent:function(a,c){if(a.tokenize!=b&&null!=a.tokenize)return 0;var d=a.context,e=c&&c.charAt(0);if("case"==d.type&&/^(?:case|default)\b/.test(c))return a.context.type="}",d.indented;var f=e==d.type;return d.align?d.column+(f?0:1):d.indented+(f?0:i)},electricChars:"{}):",fold:"brace",blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//"}}),a.defineMIME("text/x-go","go")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/soy/soy.js b/media/editors/codemirror/mode/soy/soy.js index 79bfc24dfd6cd..580c306f15f9e 100644 --- a/media/editors/codemirror/mode/soy/soy.js +++ b/media/editors/codemirror/mode/soy/soy.js @@ -121,10 +121,11 @@ return tokenUntil(stream, state, /\{\/literal}/); case "string": - if (stream.match(/^.*?"/)) { - state.soyState.pop(); - } else { + var match = stream.match(/^.*?("|\\[\s\S])/); + if (!match) { stream.skipToEnd(); + } else if (match[1] == "\"") { + state.soyState.pop(); } return "string"; } diff --git a/media/editors/codemirror/mode/soy/soy.min.js b/media/editors/codemirror/mode/soy/soy.min.js index f176f2968b79a..bff7d2c0bda24 100644 --- a/media/editors/codemirror/mode/soy/soy.min.js +++ b/media/editors/codemirror/mode/soy/soy.min.js @@ -1 +1 @@ -!function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("../htmlmixed/htmlmixed")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../htmlmixed/htmlmixed"],a):a(CodeMirror)}(function(a){"use strict";var b=["template","literal","msg","fallbackmsg","let","if","elseif","else","switch","case","default","foreach","ifempty","for","call","param","deltemplate","delcall","log"];a.defineMode("soy",function(c){function d(a){return a[a.length-1]}function e(a,b,c){var d=a.string,e=c.exec(d.substr(a.pos));e&&(a.string=d.substr(0,a.pos+e.index));var f=a.hideFirstChars(b.indent,function(){return b.localMode.token(a,b.localState)});return a.string=d,f}var f=a.getMode(c,"text/plain"),g={html:a.getMode(c,{name:"text/html",multilineTagIndentFactor:2,multilineTagIndentPastTag:!1}),attributes:f,text:f,uri:f,css:a.getMode(c,"text/css"),js:a.getMode(c,{name:"text/javascript",statementIndent:2*c.indentUnit})};return{startState:function(){return{kind:[],kindTag:[],soyState:[],indent:0,localMode:g.html,localState:a.startState(g.html)}},copyState:function(b){return{tag:b.tag,kind:b.kind.concat([]),kindTag:b.kindTag.concat([]),soyState:b.soyState.concat([]),indent:b.indent,localMode:b.localMode,localState:a.copyState(b.localMode,b.localState)}},token:function(f,h){var i;switch(d(h.soyState)){case"comment":return f.match(/^.*?\*\//)?h.soyState.pop():f.skipToEnd(),"comment";case"variable":return f.match(/^}/)?(h.indent-=2*c.indentUnit,h.soyState.pop(),"variable-2"):(f.next(),null);case"tag":if(f.match(/^\/?}/))return"/template"==h.tag||"/deltemplate"==h.tag?h.indent=0:h.indent-=("/}"==f.current()||-1==b.indexOf(h.tag)?2:1)*c.indentUnit,h.soyState.pop(),"keyword";if(f.match(/^([\w?]+)(?==)/)){if("kind"==f.current()&&(i=f.match(/^="([^"]+)/,!1))){var j=i[1];h.kind.push(j),h.kindTag.push(h.tag),h.localMode=g[j]||g.html,h.localState=a.startState(h.localMode)}return"attribute"}return f.match(/^"/)?(h.soyState.push("string"),"string"):(f.next(),null);case"literal":return f.match(/^(?=\{\/literal})/)?(h.indent-=c.indentUnit,h.soyState.pop(),this.token(f,h)):e(f,h,/\{\/literal}/);case"string":return f.match(/^.*?"/)?h.soyState.pop():f.skipToEnd(),"string"}return f.match(/^\/\*/)?(h.soyState.push("comment"),"comment"):f.match(f.sol()?/^\s*\/\/.*/:/^\s+\/\/.*/)?"comment":f.match(/^\{\$[\w?]*/)?(h.indent+=2*c.indentUnit,h.soyState.push("variable"),"variable-2"):f.match(/^\{literal}/)?(h.indent+=c.indentUnit,h.soyState.push("literal"),"keyword"):(i=f.match(/^\{([\/@\\]?[\w?]*)/))?("/switch"!=i[1]&&(h.indent+=(/^(\/|(else|elseif|case|default)$)/.test(i[1])&&"switch"!=h.tag?1:2)*c.indentUnit),h.tag=i[1],h.tag=="/"+d(h.kindTag)&&(h.kind.pop(),h.kindTag.pop(),h.localMode=g[d(h.kind)]||g.html,h.localState=a.startState(h.localMode)),h.soyState.push("tag"),"keyword"):e(f,h,/\{|\s+\/\/|\/\*/)},indent:function(b,e){var f=b.indent,g=d(b.soyState);if("comment"==g)return a.Pass;if("literal"==g)/^\{\/literal}/.test(e)&&(f-=c.indentUnit);else{if(/^\s*\{\/(template|deltemplate)\b/.test(e))return 0;/^\{(\/|(fallbackmsg|elseif|else|ifempty)\b)/.test(e)&&(f-=c.indentUnit),"switch"!=b.tag&&/^\{(case|default)\b/.test(e)&&(f-=c.indentUnit),/^\{\/switch\b/.test(e)&&(f-=c.indentUnit)}return f&&b.localMode.indent&&(f+=b.localMode.indent(b.localState,e)),f},innerMode:function(a){return a.soyState.length&&"literal"!=d(a.soyState)?null:{state:a.localState,mode:a.localMode}},electricInput:/^\s*\{(\/|\/template|\/deltemplate|\/switch|fallbackmsg|elseif|else|case|default|ifempty|\/literal\})$/,lineComment:"//",blockCommentStart:"/*",blockCommentEnd:"*/",blockCommentContinue:" * ",fold:"indent"}},"htmlmixed"),a.registerHelper("hintWords","soy",b.concat(["delpackage","namespace","alias","print","css","debugger"])),a.defineMIME("text/x-soy","soy")}); \ No newline at end of file +!function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("../htmlmixed/htmlmixed")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../htmlmixed/htmlmixed"],a):a(CodeMirror)}(function(a){"use strict";var b=["template","literal","msg","fallbackmsg","let","if","elseif","else","switch","case","default","foreach","ifempty","for","call","param","deltemplate","delcall","log"];a.defineMode("soy",function(c){function d(a){return a[a.length-1]}function e(a,b,c){var d=a.string,e=c.exec(d.substr(a.pos));e&&(a.string=d.substr(0,a.pos+e.index));var f=a.hideFirstChars(b.indent,function(){return b.localMode.token(a,b.localState)});return a.string=d,f}var f=a.getMode(c,"text/plain"),g={html:a.getMode(c,{name:"text/html",multilineTagIndentFactor:2,multilineTagIndentPastTag:!1}),attributes:f,text:f,uri:f,css:a.getMode(c,"text/css"),js:a.getMode(c,{name:"text/javascript",statementIndent:2*c.indentUnit})};return{startState:function(){return{kind:[],kindTag:[],soyState:[],indent:0,localMode:g.html,localState:a.startState(g.html)}},copyState:function(b){return{tag:b.tag,kind:b.kind.concat([]),kindTag:b.kindTag.concat([]),soyState:b.soyState.concat([]),indent:b.indent,localMode:b.localMode,localState:a.copyState(b.localMode,b.localState)}},token:function(f,h){var i;switch(d(h.soyState)){case"comment":return f.match(/^.*?\*\//)?h.soyState.pop():f.skipToEnd(),"comment";case"variable":return f.match(/^}/)?(h.indent-=2*c.indentUnit,h.soyState.pop(),"variable-2"):(f.next(),null);case"tag":if(f.match(/^\/?}/))return"/template"==h.tag||"/deltemplate"==h.tag?h.indent=0:h.indent-=("/}"==f.current()||-1==b.indexOf(h.tag)?2:1)*c.indentUnit,h.soyState.pop(),"keyword";if(f.match(/^([\w?]+)(?==)/)){if("kind"==f.current()&&(i=f.match(/^="([^"]+)/,!1))){var j=i[1];h.kind.push(j),h.kindTag.push(h.tag),h.localMode=g[j]||g.html,h.localState=a.startState(h.localMode)}return"attribute"}return f.match(/^"/)?(h.soyState.push("string"),"string"):(f.next(),null);case"literal":return f.match(/^(?=\{\/literal})/)?(h.indent-=c.indentUnit,h.soyState.pop(),this.token(f,h)):e(f,h,/\{\/literal}/);case"string":var i=f.match(/^.*?("|\\[\s\S])/);return i?'"'==i[1]&&h.soyState.pop():f.skipToEnd(),"string"}return f.match(/^\/\*/)?(h.soyState.push("comment"),"comment"):f.match(f.sol()?/^\s*\/\/.*/:/^\s+\/\/.*/)?"comment":f.match(/^\{\$[\w?]*/)?(h.indent+=2*c.indentUnit,h.soyState.push("variable"),"variable-2"):f.match(/^\{literal}/)?(h.indent+=c.indentUnit,h.soyState.push("literal"),"keyword"):(i=f.match(/^\{([\/@\\]?[\w?]*)/))?("/switch"!=i[1]&&(h.indent+=(/^(\/|(else|elseif|case|default)$)/.test(i[1])&&"switch"!=h.tag?1:2)*c.indentUnit),h.tag=i[1],h.tag=="/"+d(h.kindTag)&&(h.kind.pop(),h.kindTag.pop(),h.localMode=g[d(h.kind)]||g.html,h.localState=a.startState(h.localMode)),h.soyState.push("tag"),"keyword"):e(f,h,/\{|\s+\/\/|\/\*/)},indent:function(b,e){var f=b.indent,g=d(b.soyState);if("comment"==g)return a.Pass;if("literal"==g)/^\{\/literal}/.test(e)&&(f-=c.indentUnit);else{if(/^\s*\{\/(template|deltemplate)\b/.test(e))return 0;/^\{(\/|(fallbackmsg|elseif|else|ifempty)\b)/.test(e)&&(f-=c.indentUnit),"switch"!=b.tag&&/^\{(case|default)\b/.test(e)&&(f-=c.indentUnit),/^\{\/switch\b/.test(e)&&(f-=c.indentUnit)}return f&&b.localMode.indent&&(f+=b.localMode.indent(b.localState,e)),f},innerMode:function(a){return a.soyState.length&&"literal"!=d(a.soyState)?null:{state:a.localState,mode:a.localMode}},electricInput:/^\s*\{(\/|\/template|\/deltemplate|\/switch|fallbackmsg|elseif|else|case|default|ifempty|\/literal\})$/,lineComment:"//",blockCommentStart:"/*",blockCommentEnd:"*/",blockCommentContinue:" * ",fold:"indent"}},"htmlmixed"),a.registerHelper("hintWords","soy",b.concat(["delpackage","namespace","alias","print","css","debugger"])),a.defineMIME("text/x-soy","soy")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/sql/sql.js b/media/editors/codemirror/mode/sql/sql.js index daec60ce6f386..01ebd80ae1a28 100644 --- a/media/editors/codemirror/mode/sql/sql.js +++ b/media/editors/codemirror/mode/sql/sql.js @@ -366,9 +366,9 @@ CodeMirror.defineMode("sql", function(config, parserConfig) { // http://www.postgresql.org/docs/9.5/static/datatype.html builtin: set("bigint int8 bigserial serial8 bit varying varbit boolean bool box bytea character char varchar cidr circle date double precision float8 inet integer int int4 interval json jsonb line lseg macaddr money numeric decimal path pg_lsn point polygon real float4 smallint int2 smallserial serial2 serial serial4 text time without zone with timetz timestamp timestamptz tsquery tsvector txid_snapshot uuid xml"), atoms: set("false true null unknown"), - operatorChars: /^[*+\-%<>!=&|^]/, + operatorChars: /^[*+\-%<>!=&|^\/#@?~]/, dateSQL: set("date time timestamp"), - support: set("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber nCharCast charsetCast commentHash commentSpaceRequired") + support: set("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber nCharCast charsetCast") }); // Google's SQL-like query language, GQL diff --git a/media/editors/codemirror/mode/sql/sql.min.js b/media/editors/codemirror/mode/sql/sql.min.js index b505613e8e82f..55c11d56e1bff 100644 --- a/media/editors/codemirror/mode/sql/sql.min.js +++ b/media/editors/codemirror/mode/sql/sql.min.js @@ -1 +1 @@ -!function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)}(function(a){"use strict";a.defineMode("sql",function(b,c){function d(a,b){var c=a.next();if(o[c]){var d=o[c](a,b);if(d!==!1)return d}if(1==n.hexNumber&&("0"==c&&a.match(/^[xX][0-9a-fA-F]+/)||("x"==c||"X"==c)&&a.match(/^'[0-9a-fA-F]+'/)))return"number";if(1==n.binaryNumber&&(("b"==c||"B"==c)&&a.match(/^'[01]+'/)||"0"==c&&a.match(/^b[01]+/)))return"number";if(c.charCodeAt(0)>47&&c.charCodeAt(0)<58)return a.match(/^[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?/),1==n.decimallessFloat&&a.eat("."),"number";if("?"==c&&(a.eatSpace()||a.eol()||a.eat(";")))return"variable-3";if("'"==c||'"'==c&&n.doubleQuote)return b.tokenize=e(c),b.tokenize(a,b);if((1==n.nCharCast&&("n"==c||"N"==c)||1==n.charsetCast&&"_"==c&&a.match(/[a-z][a-z0-9]*/i))&&("'"==a.peek()||'"'==a.peek()))return"keyword";if(/^[\(\),\;\[\]]/.test(c))return null;if(n.commentSlashSlash&&"/"==c&&a.eat("/"))return a.skipToEnd(),"comment";if(n.commentHash&&"#"==c||"-"==c&&a.eat("-")&&(!n.commentSpaceRequired||a.eat(" ")))return a.skipToEnd(),"comment";if("/"==c&&a.eat("*"))return b.tokenize=f,b.tokenize(a,b);if("."!=c){if(m.test(c))return a.eatWhile(m),null;if("{"==c&&(a.match(/^( )*(d|D|t|T|ts|TS)( )*'[^']*'( )*}/)||a.match(/^( )*(d|D|t|T|ts|TS)( )*"[^"]*"( )*}/)))return"number";a.eatWhile(/^[_\w\d]/);var g=a.current().toLowerCase();return p.hasOwnProperty(g)&&(a.match(/^( )+'[^']*'/)||a.match(/^( )+"[^"]*"/))?"number":j.hasOwnProperty(g)?"atom":k.hasOwnProperty(g)?"builtin":l.hasOwnProperty(g)?"keyword":i.hasOwnProperty(g)?"string-2":null}return 1==n.zerolessFloat&&a.match(/^(?:\d+(?:e[+-]?\d+)?)/i)?"number":1==n.ODBCdotTable&&a.match(/^[a-zA-Z_]+/)?"variable-2":void 0}function e(a){return function(b,c){for(var e,f=!1;null!=(e=b.next());){if(e==a&&!f){c.tokenize=d;break}f=!f&&"\\"==e}return"string"}}function f(a,b){for(;;){if(!a.skipTo("*")){a.skipToEnd();break}if(a.next(),a.eat("/")){b.tokenize=d;break}}return"comment"}function g(a,b,c){b.context={prev:b.context,indent:a.indentation(),col:a.column(),type:c}}function h(a){a.indent=a.context.indent,a.context=a.context.prev}var i=c.client||{},j=c.atoms||{"false":!0,"true":!0,"null":!0},k=c.builtin||{},l=c.keywords||{},m=c.operatorChars||/^[*+\-%<>!=&|~^]/,n=c.support||{},o=c.hooks||{},p=c.dateSQL||{date:!0,time:!0,timestamp:!0};return{startState:function(){return{tokenize:d,context:null}},token:function(a,b){if(a.sol()&&b.context&&null==b.context.align&&(b.context.align=!1),a.eatSpace())return null;var c=b.tokenize(a,b);if("comment"==c)return c;b.context&&null==b.context.align&&(b.context.align=!0);var d=a.current();return"("==d?g(a,b,")"):"["==d?g(a,b,"]"):b.context&&b.context.type==d&&h(b),c},indent:function(c,d){var e=c.context;if(!e)return a.Pass;var f=d.charAt(0)==e.type;return e.align?e.col+(f?0:1):e.indent+(f?0:b.indentUnit)},blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:n.commentSlashSlash?"//":n.commentHash?"#":null}}),function(){function b(a){for(var b;null!=(b=a.next());)if("`"==b&&!a.eat("`"))return"variable-2";return a.backUp(a.current().length-1),a.eatWhile(/\w/)?"variable-2":null}function c(a){return a.eat("@")&&(a.match(/^session\./),a.match(/^local\./),a.match(/^global\./)),a.eat("'")?(a.match(/^.*'/),"variable-2"):a.eat('"')?(a.match(/^.*"/),"variable-2"):a.eat("`")?(a.match(/^.*`/),"variable-2"):a.match(/^[0-9a-zA-Z$\.\_]+/)?"variable-2":null}function d(a){return a.eat("N")?"atom":a.match(/^[a-zA-Z.#!?]/)?"variable-2":null}function e(a){for(var b={},c=a.split(" "),d=0;d!=]/,dateSQL:e("date time timestamp"),support:e("ODBCdotTable doubleQuote binaryNumber hexNumber")}),a.defineMIME("text/x-mssql",{name:"sql",client:e("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:e(f+"begin trigger proc view index for add constraint key primary foreign collate clustered nonclustered declare"),builtin:e("bigint numeric bit smallint decimal smallmoney int tinyint money float real char varchar text nchar nvarchar ntext binary varbinary image cursor timestamp hierarchyid uniqueidentifier sql_variant xml table "),atoms:e("false true null unknown"),operatorChars:/^[*+\-%<>!=]/,dateSQL:e("date datetimeoffset datetime2 smalldatetime datetime time"),hooks:{"@":c}}),a.defineMIME("text/x-mysql",{name:"sql",client:e("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:e(f+"accessible action add after algorithm all analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general get global grant grants group group_concat handler hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show signal slave slow smallint snapshot soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),builtin:e("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),atoms:e("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^]/,dateSQL:e("date time timestamp"),support:e("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"),hooks:{"@":c,"`":b,"\\":d}}),a.defineMIME("text/x-mariadb",{name:"sql",client:e("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:e(f+"accessible action add after algorithm all always analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general generated get global grant grants group groupby_concat handler hard hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password persistent phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show shutdown signal slave slow smallint snapshot soft soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views virtual warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),builtin:e("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),atoms:e("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^]/,dateSQL:e("date time timestamp"),support:e("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"),hooks:{"@":c,"`":b,"\\":d}}),a.defineMIME("text/x-cassandra",{name:"sql",client:{},keywords:e("add all allow alter and any apply as asc authorize batch begin by clustering columnfamily compact consistency count create custom delete desc distinct drop each_quorum exists filtering from grant if in index insert into key keyspace keyspaces level limit local_one local_quorum modify nan norecursive nosuperuser not of on one order password permission permissions primary quorum rename revoke schema select set storage superuser table three to token truncate ttl two type unlogged update use user users using values where with writetime"),builtin:e("ascii bigint blob boolean counter decimal double float frozen inet int list map static text timestamp timeuuid tuple uuid varchar varint"),atoms:e("false true infinity NaN"),operatorChars:/^[<>=]/,dateSQL:{},support:e("commentSlashSlash decimallessFloat"),hooks:{}}),a.defineMIME("text/x-plsql",{name:"sql",client:e("appinfo arraysize autocommit autoprint autorecovery autotrace blockterminator break btitle cmdsep colsep compatibility compute concat copycommit copytypecheck define describe echo editfile embedded escape exec execute feedback flagger flush heading headsep instance linesize lno loboffset logsource long longchunksize markup native newpage numformat numwidth pagesize pause pno recsep recsepchar release repfooter repheader serveroutput shiftinout show showmode size spool sqlblanklines sqlcase sqlcode sqlcontinue sqlnumber sqlpluscompatibility sqlprefix sqlprompt sqlterminator suffix tab term termout time timing trimout trimspool ttitle underline verify version wrap"),keywords:e("abort accept access add all alter and any array arraylen as asc assert assign at attributes audit authorization avg base_table begin between binary_integer body boolean by case cast char char_base check close cluster clusters colauth column comment commit compress connect connected constant constraint crash create current currval cursor data_base database date dba deallocate debugoff debugon decimal declare default definition delay delete desc digits dispose distinct do drop else elseif elsif enable end entry escape exception exception_init exchange exclusive exists exit external fast fetch file for force form from function generic goto grant group having identified if immediate in increment index indexes indicator initial initrans insert interface intersect into is key level library like limited local lock log logging long loop master maxextents maxtrans member minextents minus mislabel mode modify multiset new next no noaudit nocompress nologging noparallel not nowait number_base object of off offline on online only open option or order out package parallel partition pctfree pctincrease pctused pls_integer positive positiven pragma primary prior private privileges procedure public raise range raw read rebuild record ref references refresh release rename replace resource restrict return returning returns reverse revoke rollback row rowid rowlabel rownum rows run savepoint schema segment select separate session set share snapshot some space split sql start statement storage subtype successful synonym tabauth table tables tablespace task terminate then to trigger truncate type union unique unlimited unrecoverable unusable update use using validate value values variable view views when whenever where while with work"),builtin:e("abs acos add_months ascii asin atan atan2 average bfile bfilename bigserial bit blob ceil character chartorowid chr clob concat convert cos cosh count dec decode deref dual dump dup_val_on_index empty error exp false float floor found glb greatest hextoraw initcap instr instrb int integer isopen last_day least length lengthb ln lower lpad ltrim lub make_ref max min mlslabel mod months_between natural naturaln nchar nclob new_time next_day nextval nls_charset_decl_len nls_charset_id nls_charset_name nls_initcap nls_lower nls_sort nls_upper nlssort no_data_found notfound null number numeric nvarchar2 nvl others power rawtohex real reftohex round rowcount rowidtochar rowtype rpad rtrim serial sign signtype sin sinh smallint soundex sqlcode sqlerrm sqrt stddev string substr substrb sum sysdate tan tanh to_char text to_date to_label to_multi_byte to_number to_single_byte translate true trunc uid unlogged upper user userenv varchar varchar2 variance varying vsize xml"),operatorChars:/^[*+\-%<>!=~]/,dateSQL:e("date time timestamp"),support:e("doubleQuote nCharCast zerolessFloat binaryNumber hexNumber")}),a.defineMIME("text/x-hive",{name:"sql",keywords:e("select alter $elem$ $key$ $value$ add after all analyze and archive as asc before between binary both bucket buckets by cascade case cast change cluster clustered clusterstatus collection column columns comment compute concatenate continue create cross cursor data database databases dbproperties deferred delete delimited desc describe directory disable distinct distribute drop else enable end escaped exclusive exists explain export extended external false fetch fields fileformat first format formatted from full function functions grant group having hold_ddltime idxproperties if import in index indexes inpath inputdriver inputformat insert intersect into is items join keys lateral left like limit lines load local location lock locks mapjoin materialized minus msck no_drop nocompress not of offline on option or order out outer outputdriver outputformat overwrite partition partitioned partitions percent plus preserve procedure purge range rcfile read readonly reads rebuild recordreader recordwriter recover reduce regexp rename repair replace restrict revoke right rlike row schema schemas semi sequencefile serde serdeproperties set shared show show_database sort sorted ssl statistics stored streamtable table tables tablesample tblproperties temporary terminated textfile then tmp to touch transform trigger true unarchive undo union uniquejoin unlock update use using utc utc_tmestamp view when where while with"),builtin:e("bool boolean long timestamp tinyint smallint bigint int float double date datetime unsigned string array struct map uniontype"),atoms:e("false true null unknown"),operatorChars:/^[*+\-%<>!=]/,dateSQL:e("date timestamp"),support:e("ODBCdotTable doubleQuote binaryNumber hexNumber")}),a.defineMIME("text/x-pgsql",{name:"sql",client:e("source"),keywords:e(f+"a abort abs absent absolute access according action ada add admin after aggregate all allocate also always analyse analyze any are array array_agg array_max_cardinality asensitive assertion assignment asymmetric at atomic attribute attributes authorization avg backward base64 before begin begin_frame begin_partition bernoulli binary bit_length blob blocked bom both breadth c cache call called cardinality cascade cascaded case cast catalog catalog_name ceil ceiling chain characteristics characters character_length character_set_catalog character_set_name character_set_schema char_length check checkpoint class class_origin clob close cluster coalesce cobol collate collation collation_catalog collation_name collation_schema collect column columns column_name command_function command_function_code comment comments commit committed concurrently condition condition_number configuration conflict connect connection connection_name constraint constraints constraint_catalog constraint_name constraint_schema constructor contains content continue control conversion convert copy corr corresponding cost covar_pop covar_samp cross csv cube cume_dist current current_catalog current_date current_default_transform_group current_path current_role current_row current_schema current_time current_timestamp current_transform_group_for_type current_user cursor cursor_name cycle data database datalink datetime_interval_code datetime_interval_precision day db deallocate dec declare default defaults deferrable deferred defined definer degree delimiter delimiters dense_rank depth deref derived describe descriptor deterministic diagnostics dictionary disable discard disconnect dispatch dlnewcopy dlpreviouscopy dlurlcomplete dlurlcompleteonly dlurlcompletewrite dlurlpath dlurlpathonly dlurlpathwrite dlurlscheme dlurlserver dlvalue do document domain dynamic dynamic_function dynamic_function_code each element else empty enable encoding encrypted end end-exec end_frame end_partition enforced enum equals escape event every except exception exclude excluding exclusive exec execute exists exp explain expression extension external extract false family fetch file filter final first first_value flag float floor following for force foreign fortran forward found frame_row free freeze fs full function functions fusion g general generated get global go goto grant granted greatest grouping groups handler header hex hierarchy hold hour id identity if ignore ilike immediate immediately immutable implementation implicit import including increment indent index indexes indicator inherit inherits initially inline inner inout input insensitive instance instantiable instead integrity intersect intersection invoker isnull isolation k key key_member key_type label lag language large last last_value lateral lead leading leakproof least left length level library like_regex link listen ln load local localtime localtimestamp location locator lock locked logged lower m map mapping match matched materialized max maxvalue max_cardinality member merge message_length message_octet_length message_text method min minute minvalue mod mode modifies module month more move multiset mumps name names namespace national natural nchar nclob nesting new next nfc nfd nfkc nfkd nil no none normalize normalized nothing notify notnull nowait nth_value ntile null nullable nullif nulls number object occurrences_regex octets octet_length of off offset oids old only open operator option options ordering ordinality others out outer output over overlaps overlay overriding owned owner p pad parameter parameter_mode parameter_name parameter_ordinal_position parameter_specific_catalog parameter_specific_name parameter_specific_schema parser partial partition pascal passing passthrough password percent percentile_cont percentile_disc percent_rank period permission placing plans pli policy portion position position_regex power precedes preceding prepare prepared preserve primary prior privileges procedural procedure program public quote range rank read reads reassign recheck recovery recursive ref references referencing refresh regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy regr_syy reindex relative release rename repeatable replace replica requiring reset respect restart restore restrict result return returned_cardinality returned_length returned_octet_length returned_sqlstate returning returns revoke right role rollback rollup routine routine_catalog routine_name routine_schema row rows row_count row_number rule savepoint scale schema schema_name scope scope_catalog scope_name scope_schema scroll search second section security selective self sensitive sequence sequences serializable server server_name session session_user setof sets share show similar simple size skip snapshot some source space specific specifictype specific_name sql sqlcode sqlerror sqlexception sqlstate sqlwarning sqrt stable standalone start state statement static statistics stddev_pop stddev_samp stdin stdout storage strict strip structure style subclass_origin submultiset substring substring_regex succeeds sum symmetric sysid system system_time system_user t tables tablesample tablespace table_name temp template temporary then ties timezone_hour timezone_minute to token top_level_count trailing transaction transactions_committed transactions_rolled_back transaction_active transform transforms translate translate_regex translation treat trigger trigger_catalog trigger_name trigger_schema trim trim_array true truncate trusted type types uescape unbounded uncommitted under unencrypted unique unknown unlink unlisten unlogged unnamed unnest until untyped upper uri usage user user_defined_type_catalog user_defined_type_code user_defined_type_name user_defined_type_schema using vacuum valid validate validator value value_of varbinary variadic var_pop var_samp verbose version versioning view views volatile when whenever whitespace width_bucket window within work wrapper write xmlagg xmlattributes xmlbinary xmlcast xmlcomment xmlconcat xmldeclaration xmldocument xmlelement xmlexists xmlforest xmliterate xmlnamespaces xmlparse xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltext xmlvalidate year yes loop repeat"),builtin:e("bigint int8 bigserial serial8 bit varying varbit boolean bool box bytea character char varchar cidr circle date double precision float8 inet integer int int4 interval json jsonb line lseg macaddr money numeric decimal path pg_lsn point polygon real float4 smallint int2 smallserial serial2 serial serial4 text time without zone with timetz timestamp timestamptz tsquery tsvector txid_snapshot uuid xml"),atoms:e("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^]/,dateSQL:e("date time timestamp"),support:e("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber nCharCast charsetCast commentHash commentSpaceRequired")}),a.defineMIME("text/x-gql",{name:"sql",keywords:e("ancestor and asc by contains desc descendant distinct from group has in is limit offset on order select superset where"),atoms:e("false true"),builtin:e("blob datetime first key __key__ string integer double boolean null"),operatorChars:/^[*+\-%<>!=]/})}()}); \ No newline at end of file +!function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)}(function(a){"use strict";a.defineMode("sql",function(b,c){function d(a,b){var c=a.next();if(o[c]){var d=o[c](a,b);if(d!==!1)return d}if(1==n.hexNumber&&("0"==c&&a.match(/^[xX][0-9a-fA-F]+/)||("x"==c||"X"==c)&&a.match(/^'[0-9a-fA-F]+'/)))return"number";if(1==n.binaryNumber&&(("b"==c||"B"==c)&&a.match(/^'[01]+'/)||"0"==c&&a.match(/^b[01]+/)))return"number";if(c.charCodeAt(0)>47&&c.charCodeAt(0)<58)return a.match(/^[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?/),1==n.decimallessFloat&&a.eat("."),"number";if("?"==c&&(a.eatSpace()||a.eol()||a.eat(";")))return"variable-3";if("'"==c||'"'==c&&n.doubleQuote)return b.tokenize=e(c),b.tokenize(a,b);if((1==n.nCharCast&&("n"==c||"N"==c)||1==n.charsetCast&&"_"==c&&a.match(/[a-z][a-z0-9]*/i))&&("'"==a.peek()||'"'==a.peek()))return"keyword";if(/^[\(\),\;\[\]]/.test(c))return null;if(n.commentSlashSlash&&"/"==c&&a.eat("/"))return a.skipToEnd(),"comment";if(n.commentHash&&"#"==c||"-"==c&&a.eat("-")&&(!n.commentSpaceRequired||a.eat(" ")))return a.skipToEnd(),"comment";if("/"==c&&a.eat("*"))return b.tokenize=f,b.tokenize(a,b);if("."!=c){if(m.test(c))return a.eatWhile(m),null;if("{"==c&&(a.match(/^( )*(d|D|t|T|ts|TS)( )*'[^']*'( )*}/)||a.match(/^( )*(d|D|t|T|ts|TS)( )*"[^"]*"( )*}/)))return"number";a.eatWhile(/^[_\w\d]/);var g=a.current().toLowerCase();return p.hasOwnProperty(g)&&(a.match(/^( )+'[^']*'/)||a.match(/^( )+"[^"]*"/))?"number":j.hasOwnProperty(g)?"atom":k.hasOwnProperty(g)?"builtin":l.hasOwnProperty(g)?"keyword":i.hasOwnProperty(g)?"string-2":null}return 1==n.zerolessFloat&&a.match(/^(?:\d+(?:e[+-]?\d+)?)/i)?"number":1==n.ODBCdotTable&&a.match(/^[a-zA-Z_]+/)?"variable-2":void 0}function e(a){return function(b,c){for(var e,f=!1;null!=(e=b.next());){if(e==a&&!f){c.tokenize=d;break}f=!f&&"\\"==e}return"string"}}function f(a,b){for(;;){if(!a.skipTo("*")){a.skipToEnd();break}if(a.next(),a.eat("/")){b.tokenize=d;break}}return"comment"}function g(a,b,c){b.context={prev:b.context,indent:a.indentation(),col:a.column(),type:c}}function h(a){a.indent=a.context.indent,a.context=a.context.prev}var i=c.client||{},j=c.atoms||{"false":!0,"true":!0,"null":!0},k=c.builtin||{},l=c.keywords||{},m=c.operatorChars||/^[*+\-%<>!=&|~^]/,n=c.support||{},o=c.hooks||{},p=c.dateSQL||{date:!0,time:!0,timestamp:!0};return{startState:function(){return{tokenize:d,context:null}},token:function(a,b){if(a.sol()&&b.context&&null==b.context.align&&(b.context.align=!1),a.eatSpace())return null;var c=b.tokenize(a,b);if("comment"==c)return c;b.context&&null==b.context.align&&(b.context.align=!0);var d=a.current();return"("==d?g(a,b,")"):"["==d?g(a,b,"]"):b.context&&b.context.type==d&&h(b),c},indent:function(c,d){var e=c.context;if(!e)return a.Pass;var f=d.charAt(0)==e.type;return e.align?e.col+(f?0:1):e.indent+(f?0:b.indentUnit)},blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:n.commentSlashSlash?"//":n.commentHash?"#":null}}),function(){function b(a){for(var b;null!=(b=a.next());)if("`"==b&&!a.eat("`"))return"variable-2";return a.backUp(a.current().length-1),a.eatWhile(/\w/)?"variable-2":null}function c(a){return a.eat("@")&&(a.match(/^session\./),a.match(/^local\./),a.match(/^global\./)),a.eat("'")?(a.match(/^.*'/),"variable-2"):a.eat('"')?(a.match(/^.*"/),"variable-2"):a.eat("`")?(a.match(/^.*`/),"variable-2"):a.match(/^[0-9a-zA-Z$\.\_]+/)?"variable-2":null}function d(a){return a.eat("N")?"atom":a.match(/^[a-zA-Z.#!?]/)?"variable-2":null}function e(a){for(var b={},c=a.split(" "),d=0;d!=]/,dateSQL:e("date time timestamp"),support:e("ODBCdotTable doubleQuote binaryNumber hexNumber")}),a.defineMIME("text/x-mssql",{name:"sql",client:e("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:e(f+"begin trigger proc view index for add constraint key primary foreign collate clustered nonclustered declare"),builtin:e("bigint numeric bit smallint decimal smallmoney int tinyint money float real char varchar text nchar nvarchar ntext binary varbinary image cursor timestamp hierarchyid uniqueidentifier sql_variant xml table "),atoms:e("false true null unknown"),operatorChars:/^[*+\-%<>!=]/,dateSQL:e("date datetimeoffset datetime2 smalldatetime datetime time"),hooks:{"@":c}}),a.defineMIME("text/x-mysql",{name:"sql",client:e("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:e(f+"accessible action add after algorithm all analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general get global grant grants group group_concat handler hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show signal slave slow smallint snapshot soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),builtin:e("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),atoms:e("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^]/,dateSQL:e("date time timestamp"),support:e("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"),hooks:{"@":c,"`":b,"\\":d}}),a.defineMIME("text/x-mariadb",{name:"sql",client:e("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:e(f+"accessible action add after algorithm all always analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general generated get global grant grants group groupby_concat handler hard hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password persistent phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show shutdown signal slave slow smallint snapshot soft soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views virtual warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),builtin:e("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),atoms:e("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^]/,dateSQL:e("date time timestamp"),support:e("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"),hooks:{"@":c,"`":b,"\\":d}}),a.defineMIME("text/x-cassandra",{name:"sql",client:{},keywords:e("add all allow alter and any apply as asc authorize batch begin by clustering columnfamily compact consistency count create custom delete desc distinct drop each_quorum exists filtering from grant if in index insert into key keyspace keyspaces level limit local_one local_quorum modify nan norecursive nosuperuser not of on one order password permission permissions primary quorum rename revoke schema select set storage superuser table three to token truncate ttl two type unlogged update use user users using values where with writetime"),builtin:e("ascii bigint blob boolean counter decimal double float frozen inet int list map static text timestamp timeuuid tuple uuid varchar varint"),atoms:e("false true infinity NaN"),operatorChars:/^[<>=]/,dateSQL:{},support:e("commentSlashSlash decimallessFloat"),hooks:{}}),a.defineMIME("text/x-plsql",{name:"sql",client:e("appinfo arraysize autocommit autoprint autorecovery autotrace blockterminator break btitle cmdsep colsep compatibility compute concat copycommit copytypecheck define describe echo editfile embedded escape exec execute feedback flagger flush heading headsep instance linesize lno loboffset logsource long longchunksize markup native newpage numformat numwidth pagesize pause pno recsep recsepchar release repfooter repheader serveroutput shiftinout show showmode size spool sqlblanklines sqlcase sqlcode sqlcontinue sqlnumber sqlpluscompatibility sqlprefix sqlprompt sqlterminator suffix tab term termout time timing trimout trimspool ttitle underline verify version wrap"),keywords:e("abort accept access add all alter and any array arraylen as asc assert assign at attributes audit authorization avg base_table begin between binary_integer body boolean by case cast char char_base check close cluster clusters colauth column comment commit compress connect connected constant constraint crash create current currval cursor data_base database date dba deallocate debugoff debugon decimal declare default definition delay delete desc digits dispose distinct do drop else elseif elsif enable end entry escape exception exception_init exchange exclusive exists exit external fast fetch file for force form from function generic goto grant group having identified if immediate in increment index indexes indicator initial initrans insert interface intersect into is key level library like limited local lock log logging long loop master maxextents maxtrans member minextents minus mislabel mode modify multiset new next no noaudit nocompress nologging noparallel not nowait number_base object of off offline on online only open option or order out package parallel partition pctfree pctincrease pctused pls_integer positive positiven pragma primary prior private privileges procedure public raise range raw read rebuild record ref references refresh release rename replace resource restrict return returning returns reverse revoke rollback row rowid rowlabel rownum rows run savepoint schema segment select separate session set share snapshot some space split sql start statement storage subtype successful synonym tabauth table tables tablespace task terminate then to trigger truncate type union unique unlimited unrecoverable unusable update use using validate value values variable view views when whenever where while with work"),builtin:e("abs acos add_months ascii asin atan atan2 average bfile bfilename bigserial bit blob ceil character chartorowid chr clob concat convert cos cosh count dec decode deref dual dump dup_val_on_index empty error exp false float floor found glb greatest hextoraw initcap instr instrb int integer isopen last_day least length lengthb ln lower lpad ltrim lub make_ref max min mlslabel mod months_between natural naturaln nchar nclob new_time next_day nextval nls_charset_decl_len nls_charset_id nls_charset_name nls_initcap nls_lower nls_sort nls_upper nlssort no_data_found notfound null number numeric nvarchar2 nvl others power rawtohex real reftohex round rowcount rowidtochar rowtype rpad rtrim serial sign signtype sin sinh smallint soundex sqlcode sqlerrm sqrt stddev string substr substrb sum sysdate tan tanh to_char text to_date to_label to_multi_byte to_number to_single_byte translate true trunc uid unlogged upper user userenv varchar varchar2 variance varying vsize xml"),operatorChars:/^[*+\-%<>!=~]/,dateSQL:e("date time timestamp"),support:e("doubleQuote nCharCast zerolessFloat binaryNumber hexNumber")}),a.defineMIME("text/x-hive",{name:"sql",keywords:e("select alter $elem$ $key$ $value$ add after all analyze and archive as asc before between binary both bucket buckets by cascade case cast change cluster clustered clusterstatus collection column columns comment compute concatenate continue create cross cursor data database databases dbproperties deferred delete delimited desc describe directory disable distinct distribute drop else enable end escaped exclusive exists explain export extended external false fetch fields fileformat first format formatted from full function functions grant group having hold_ddltime idxproperties if import in index indexes inpath inputdriver inputformat insert intersect into is items join keys lateral left like limit lines load local location lock locks mapjoin materialized minus msck no_drop nocompress not of offline on option or order out outer outputdriver outputformat overwrite partition partitioned partitions percent plus preserve procedure purge range rcfile read readonly reads rebuild recordreader recordwriter recover reduce regexp rename repair replace restrict revoke right rlike row schema schemas semi sequencefile serde serdeproperties set shared show show_database sort sorted ssl statistics stored streamtable table tables tablesample tblproperties temporary terminated textfile then tmp to touch transform trigger true unarchive undo union uniquejoin unlock update use using utc utc_tmestamp view when where while with"),builtin:e("bool boolean long timestamp tinyint smallint bigint int float double date datetime unsigned string array struct map uniontype"),atoms:e("false true null unknown"),operatorChars:/^[*+\-%<>!=]/,dateSQL:e("date timestamp"),support:e("ODBCdotTable doubleQuote binaryNumber hexNumber")}),a.defineMIME("text/x-pgsql",{name:"sql",client:e("source"),keywords:e(f+"a abort abs absent absolute access according action ada add admin after aggregate all allocate also always analyse analyze any are array array_agg array_max_cardinality asensitive assertion assignment asymmetric at atomic attribute attributes authorization avg backward base64 before begin begin_frame begin_partition bernoulli binary bit_length blob blocked bom both breadth c cache call called cardinality cascade cascaded case cast catalog catalog_name ceil ceiling chain characteristics characters character_length character_set_catalog character_set_name character_set_schema char_length check checkpoint class class_origin clob close cluster coalesce cobol collate collation collation_catalog collation_name collation_schema collect column columns column_name command_function command_function_code comment comments commit committed concurrently condition condition_number configuration conflict connect connection connection_name constraint constraints constraint_catalog constraint_name constraint_schema constructor contains content continue control conversion convert copy corr corresponding cost covar_pop covar_samp cross csv cube cume_dist current current_catalog current_date current_default_transform_group current_path current_role current_row current_schema current_time current_timestamp current_transform_group_for_type current_user cursor cursor_name cycle data database datalink datetime_interval_code datetime_interval_precision day db deallocate dec declare default defaults deferrable deferred defined definer degree delimiter delimiters dense_rank depth deref derived describe descriptor deterministic diagnostics dictionary disable discard disconnect dispatch dlnewcopy dlpreviouscopy dlurlcomplete dlurlcompleteonly dlurlcompletewrite dlurlpath dlurlpathonly dlurlpathwrite dlurlscheme dlurlserver dlvalue do document domain dynamic dynamic_function dynamic_function_code each element else empty enable encoding encrypted end end-exec end_frame end_partition enforced enum equals escape event every except exception exclude excluding exclusive exec execute exists exp explain expression extension external extract false family fetch file filter final first first_value flag float floor following for force foreign fortran forward found frame_row free freeze fs full function functions fusion g general generated get global go goto grant granted greatest grouping groups handler header hex hierarchy hold hour id identity if ignore ilike immediate immediately immutable implementation implicit import including increment indent index indexes indicator inherit inherits initially inline inner inout input insensitive instance instantiable instead integrity intersect intersection invoker isnull isolation k key key_member key_type label lag language large last last_value lateral lead leading leakproof least left length level library like_regex link listen ln load local localtime localtimestamp location locator lock locked logged lower m map mapping match matched materialized max maxvalue max_cardinality member merge message_length message_octet_length message_text method min minute minvalue mod mode modifies module month more move multiset mumps name names namespace national natural nchar nclob nesting new next nfc nfd nfkc nfkd nil no none normalize normalized nothing notify notnull nowait nth_value ntile null nullable nullif nulls number object occurrences_regex octets octet_length of off offset oids old only open operator option options ordering ordinality others out outer output over overlaps overlay overriding owned owner p pad parameter parameter_mode parameter_name parameter_ordinal_position parameter_specific_catalog parameter_specific_name parameter_specific_schema parser partial partition pascal passing passthrough password percent percentile_cont percentile_disc percent_rank period permission placing plans pli policy portion position position_regex power precedes preceding prepare prepared preserve primary prior privileges procedural procedure program public quote range rank read reads reassign recheck recovery recursive ref references referencing refresh regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy regr_syy reindex relative release rename repeatable replace replica requiring reset respect restart restore restrict result return returned_cardinality returned_length returned_octet_length returned_sqlstate returning returns revoke right role rollback rollup routine routine_catalog routine_name routine_schema row rows row_count row_number rule savepoint scale schema schema_name scope scope_catalog scope_name scope_schema scroll search second section security selective self sensitive sequence sequences serializable server server_name session session_user setof sets share show similar simple size skip snapshot some source space specific specifictype specific_name sql sqlcode sqlerror sqlexception sqlstate sqlwarning sqrt stable standalone start state statement static statistics stddev_pop stddev_samp stdin stdout storage strict strip structure style subclass_origin submultiset substring substring_regex succeeds sum symmetric sysid system system_time system_user t tables tablesample tablespace table_name temp template temporary then ties timezone_hour timezone_minute to token top_level_count trailing transaction transactions_committed transactions_rolled_back transaction_active transform transforms translate translate_regex translation treat trigger trigger_catalog trigger_name trigger_schema trim trim_array true truncate trusted type types uescape unbounded uncommitted under unencrypted unique unknown unlink unlisten unlogged unnamed unnest until untyped upper uri usage user user_defined_type_catalog user_defined_type_code user_defined_type_name user_defined_type_schema using vacuum valid validate validator value value_of varbinary variadic var_pop var_samp verbose version versioning view views volatile when whenever whitespace width_bucket window within work wrapper write xmlagg xmlattributes xmlbinary xmlcast xmlcomment xmlconcat xmldeclaration xmldocument xmlelement xmlexists xmlforest xmliterate xmlnamespaces xmlparse xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltext xmlvalidate year yes loop repeat"),builtin:e("bigint int8 bigserial serial8 bit varying varbit boolean bool box bytea character char varchar cidr circle date double precision float8 inet integer int int4 interval json jsonb line lseg macaddr money numeric decimal path pg_lsn point polygon real float4 smallint int2 smallserial serial2 serial serial4 text time without zone with timetz timestamp timestamptz tsquery tsvector txid_snapshot uuid xml"),atoms:e("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^\/#@?~]/,dateSQL:e("date time timestamp"),support:e("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber nCharCast charsetCast")}),a.defineMIME("text/x-gql",{name:"sql",keywords:e("ancestor and asc by contains desc descendant distinct from group has in is limit offset on order select superset where"),atoms:e("false true"),builtin:e("blob datetime first key __key__ string integer double boolean null"),operatorChars:/^[*+\-%<>!=]/})}()}); \ No newline at end of file diff --git a/media/editors/codemirror/theme/solarized.css b/media/editors/codemirror/theme/solarized.css index 7882c93763cbc..4b1e16307a520 100644 --- a/media/editors/codemirror/theme/solarized.css +++ b/media/editors/codemirror/theme/solarized.css @@ -4,7 +4,7 @@ http://ethanschoonover.com/solarized */ /* -Solarized color pallet +Solarized color palette http://ethanschoonover.com/solarized/img/solarized-palette.png */ @@ -34,7 +34,7 @@ http://ethanschoonover.com/solarized/img/solarized-palette.png } .cm-s-solarized.cm-s-dark { color: #839496; - background-color: #002b36; + background-color: #002b36; text-shadow: #002b36 0 1px; } .cm-s-solarized.cm-s-light { @@ -113,32 +113,34 @@ http://ethanschoonover.com/solarized/img/solarized-palette.png box-shadow: inset 7px 0 12px -6px #000; } -/* Gutter border and some shadow from it */ +/* Remove gutter border */ .cm-s-solarized .CodeMirror-gutters { - border-right: 1px solid; + border-right: 0; } /* Gutter colors and line number styling based of color scheme (dark / light) */ /* Dark */ .cm-s-solarized.cm-s-dark .CodeMirror-gutters { - background-color: #002b36; - border-color: #00232c; + background-color: #073642; } .cm-s-solarized.cm-s-dark .CodeMirror-linenumber { + color: #586e75; text-shadow: #021014 0 -1px; } /* Light */ .cm-s-solarized.cm-s-light .CodeMirror-gutters { - background-color: #fdf6e3; - border-color: #eee8d5; + background-color: #eee8d5; +} + +.cm-s-solarized.cm-s-light .CodeMirror-linenumber { + color: #839496; } /* Common */ .cm-s-solarized .CodeMirror-linenumber { - color: #586e75; padding: 0 5px; } .cm-s-solarized .CodeMirror-guttermarker-subtle { color: #586e75; } @@ -149,15 +151,19 @@ http://ethanschoonover.com/solarized/img/solarized-palette.png color: #586e75; } +/* Cursor */ .cm-s-solarized .CodeMirror-cursor { border-left: 1px solid #819090; } -/* -Active line. Negative margin compensates left padding of the text in the -view-port -*/ +/* Fat cursor */ +.cm-s-solarized.cm-s-light.cm-fat-cursor .CodeMirror-cursor { background: #fdf6e3; } +.cm-s-solarized.cm-s-light .cm-animate-fat-cursor { background-color: #fdf6e3; } +.cm-s-solarized.cm-s-dark.cm-fat-cursor .CodeMirror-cursor { background: #586e75; } +.cm-s-solarized.cm-s-dark .cm-animate-fat-cursor { background-color: #586e75; } + +/* Active line */ .cm-s-solarized.cm-s-dark .CodeMirror-activeline-background { - background: rgba(255, 255, 255, 0.10); + background: rgba(255, 255, 255, 0.06); } .cm-s-solarized.cm-s-light .CodeMirror-activeline-background { - background: rgba(0, 0, 0, 0.10); + background: rgba(0, 0, 0, 0.06); } diff --git a/media/editors/tinymce/changelog.txt b/media/editors/tinymce/changelog.txt index b7b19179b182d..dc46a6be463b5 100644 --- a/media/editors/tinymce/changelog.txt +++ b/media/editors/tinymce/changelog.txt @@ -1,3 +1,23 @@ +Version 4.4.0 (2016-06-30) + Added new inlite theme this is a more lightweight inline UI. + Added smarter paste logic that auto detects urls in the clipboard and inserts images/links based on that. + Added a better image resize algorithm for better image quality in the imagetools plugin. + Fixed bug where it wasn't possible to drag/dropping cE=false elements on FF. + Fixed bug where backspace/delete before/after a cE=false block would produce a new paragraph. + Fixed bug where list style type css property wasn't preserved when indenting lists. + Fixed bug where merging of lists where done even if the list style type was different. + Fixed bug where the image_dataimg_filter function wasn't used when pasting images. + Fixed bug where nested editable within a non editable element would cause scroll on focus in Chrome. + Fixed so invalid targets for inline mode is blocked on initialization. We only support elements that can have children. +Version 4.3.13 (2016-06-08) + Added characters with a diacritical mark to charmap plugin. Patch contributed by Dominik Schilling. + Added better error handling if the image proxy service would produce errors. + Fixed issue with pasting list items into list items would produce nested list rather than a merged list. + Fixed bug where table selection could get stuck in selection mode for inline editors. + Fixed bug where it was possible to place the caret inside the resize grid elements. + Fixed bug where it wasn't possible to place in elements horizontally adjacent cE=false blocks. + Fixed bug where multiple notifications wouldn't be properly placed on screen. + Fixed bug where multiple editor instance of the same id could be produces in some specific integrations. Version 4.3.12 (2016-05-10) Fixed bug where focus calls couldn't be made inside the editors PostRender event handler. Fixed bug where some translations wouldn't work as expected due to a bug in editor.translate. diff --git a/media/editors/tinymce/plugins/advlist/plugin.min.js b/media/editors/tinymce/plugins/advlist/plugin.min.js index 1e1c66804d051..fb7a6b04db252 100644 --- a/media/editors/tinymce/plugins/advlist/plugin.min.js +++ b/media/editors/tinymce/plugins/advlist/plugin.min.js @@ -1 +1 @@ -tinymce.PluginManager.add("advlist",function(a){function b(a,b){var c=[];return tinymce.each(b.split(/[ ,]/),function(a){c.push({text:a.replace(/\-/g," ").replace(/\b\w/g,function(a){return a.toUpperCase()}),data:"default"==a?"":a})}),c}function c(b,c){a.undoManager.transact(function(){var d,e=a.dom,f=a.selection;d=e.getParent(f.getNode(),"ol,ul"),d&&d.nodeName==b&&c!==!1||a.execCommand("UL"==b?"InsertUnorderedList":"InsertOrderedList"),c=c===!1?g[b]:c,g[b]=c,d=e.getParent(f.getNode(),"ol,ul"),d&&(e.setStyle(d,"listStyleType",c?c:null),d.removeAttribute("data-mce-style")),a.focus()})}function d(b){var c=a.dom.getStyle(a.dom.getParent(a.selection.getNode(),"ol,ul"),"listStyleType")||"";b.control.items().each(function(a){a.active(a.settings.data===c)})}var e,f,g={};e=b("OL",a.getParam("advlist_number_styles","default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman")),f=b("UL",a.getParam("advlist_bullet_styles","default,circle,disc,square")),a.addButton("numlist",{type:"splitbutton",tooltip:"Numbered list",menu:e,onshow:d,onselect:function(a){c("OL",a.control.settings.data)},onclick:function(){c("OL",!1)}}),a.addButton("bullist",{type:"splitbutton",tooltip:"Bullet list",menu:f,onshow:d,onselect:function(a){c("UL",a.control.settings.data)},onclick:function(){c("UL",!1)}})}); \ No newline at end of file +tinymce.PluginManager.add("advlist",function(a){function b(a,b){var c=[];return tinymce.each(b.split(/[ ,]/),function(a){c.push({text:a.replace(/\-/g," ").replace(/\b\w/g,function(a){return a.toUpperCase()}),data:"default"==a?"":a})}),c}function c(b,c){a.undoManager.transact(function(){var d,e=a.dom,f=a.selection;if(d=e.getParent(f.getNode(),"ol,ul"),!d||d.nodeName!=b||c===!1){var h={"list-style-type":c?c:null};a.execCommand("UL"==b?"InsertUnorderedList":"InsertOrderedList",!1,h)}c=c===!1?g[b]:c,g[b]=c,d=e.getParent(f.getNode(),"ol,ul"),d&&(e.setStyle(d,"listStyleType",c?c:null),d.removeAttribute("data-mce-style")),a.focus()})}function d(b){var c=a.dom.getStyle(a.dom.getParent(a.selection.getNode(),"ol,ul"),"listStyleType")||"";b.control.items().each(function(a){a.active(a.settings.data===c)})}var e,f,g={};e=b("OL",a.getParam("advlist_number_styles","default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman")),f=b("UL",a.getParam("advlist_bullet_styles","default,circle,disc,square")),a.addButton("numlist",{type:"splitbutton",tooltip:"Numbered list",menu:e,onshow:d,onselect:function(a){c("OL",a.control.settings.data)},onclick:function(){c("OL",!1)}}),a.addButton("bullist",{type:"splitbutton",tooltip:"Bullet list",menu:f,onshow:d,onselect:function(a){c("UL",a.control.settings.data)},onclick:function(){c("UL",!1)}})}); \ No newline at end of file diff --git a/media/editors/tinymce/plugins/charmap/plugin.min.js b/media/editors/tinymce/plugins/charmap/plugin.min.js index 9fd639ef9c2ad..9bf1e9fcd85f4 100644 --- a/media/editors/tinymce/plugins/charmap/plugin.min.js +++ b/media/editors/tinymce/plugins/charmap/plugin.min.js @@ -1 +1 @@ -tinymce.PluginManager.add("charmap",function(a){function b(){return[["160","no-break space"],["173","soft hyphen"],["34","quotation mark"],["162","cent sign"],["8364","euro sign"],["163","pound sign"],["165","yen sign"],["169","copyright sign"],["174","registered sign"],["8482","trade mark sign"],["8240","per mille sign"],["181","micro sign"],["183","middle dot"],["8226","bullet"],["8230","three dot leader"],["8242","minutes / feet"],["8243","seconds / inches"],["167","section sign"],["182","paragraph sign"],["223","sharp s / ess-zed"],["8249","single left-pointing angle quotation mark"],["8250","single right-pointing angle quotation mark"],["171","left pointing guillemet"],["187","right pointing guillemet"],["8216","left single quotation mark"],["8217","right single quotation mark"],["8220","left double quotation mark"],["8221","right double quotation mark"],["8218","single low-9 quotation mark"],["8222","double low-9 quotation mark"],["60","less-than sign"],["62","greater-than sign"],["8804","less-than or equal to"],["8805","greater-than or equal to"],["8211","en dash"],["8212","em dash"],["175","macron"],["8254","overline"],["164","currency sign"],["166","broken bar"],["168","diaeresis"],["161","inverted exclamation mark"],["191","turned question mark"],["710","circumflex accent"],["732","small tilde"],["176","degree sign"],["8722","minus sign"],["177","plus-minus sign"],["247","division sign"],["8260","fraction slash"],["215","multiplication sign"],["185","superscript one"],["178","superscript two"],["179","superscript three"],["188","fraction one quarter"],["189","fraction one half"],["190","fraction three quarters"],["402","function / florin"],["8747","integral"],["8721","n-ary sumation"],["8734","infinity"],["8730","square root"],["8764","similar to"],["8773","approximately equal to"],["8776","almost equal to"],["8800","not equal to"],["8801","identical to"],["8712","element of"],["8713","not an element of"],["8715","contains as member"],["8719","n-ary product"],["8743","logical and"],["8744","logical or"],["172","not sign"],["8745","intersection"],["8746","union"],["8706","partial differential"],["8704","for all"],["8707","there exists"],["8709","diameter"],["8711","backward difference"],["8727","asterisk operator"],["8733","proportional to"],["8736","angle"],["180","acute accent"],["184","cedilla"],["170","feminine ordinal indicator"],["186","masculine ordinal indicator"],["8224","dagger"],["8225","double dagger"],["192","A - grave"],["193","A - acute"],["194","A - circumflex"],["195","A - tilde"],["196","A - diaeresis"],["197","A - ring above"],["198","ligature AE"],["199","C - cedilla"],["200","E - grave"],["201","E - acute"],["202","E - circumflex"],["203","E - diaeresis"],["204","I - grave"],["205","I - acute"],["206","I - circumflex"],["207","I - diaeresis"],["208","ETH"],["209","N - tilde"],["210","O - grave"],["211","O - acute"],["212","O - circumflex"],["213","O - tilde"],["214","O - diaeresis"],["216","O - slash"],["338","ligature OE"],["352","S - caron"],["217","U - grave"],["218","U - acute"],["219","U - circumflex"],["220","U - diaeresis"],["221","Y - acute"],["376","Y - diaeresis"],["222","THORN"],["224","a - grave"],["225","a - acute"],["226","a - circumflex"],["227","a - tilde"],["228","a - diaeresis"],["229","a - ring above"],["230","ligature ae"],["231","c - cedilla"],["232","e - grave"],["233","e - acute"],["234","e - circumflex"],["235","e - diaeresis"],["236","i - grave"],["237","i - acute"],["238","i - circumflex"],["239","i - diaeresis"],["240","eth"],["241","n - tilde"],["242","o - grave"],["243","o - acute"],["244","o - circumflex"],["245","o - tilde"],["246","o - diaeresis"],["248","o slash"],["339","ligature oe"],["353","s - caron"],["249","u - grave"],["250","u - acute"],["251","u - circumflex"],["252","u - diaeresis"],["253","y - acute"],["254","thorn"],["255","y - diaeresis"],["913","Alpha"],["914","Beta"],["915","Gamma"],["916","Delta"],["917","Epsilon"],["918","Zeta"],["919","Eta"],["920","Theta"],["921","Iota"],["922","Kappa"],["923","Lambda"],["924","Mu"],["925","Nu"],["926","Xi"],["927","Omicron"],["928","Pi"],["929","Rho"],["931","Sigma"],["932","Tau"],["933","Upsilon"],["934","Phi"],["935","Chi"],["936","Psi"],["937","Omega"],["945","alpha"],["946","beta"],["947","gamma"],["948","delta"],["949","epsilon"],["950","zeta"],["951","eta"],["952","theta"],["953","iota"],["954","kappa"],["955","lambda"],["956","mu"],["957","nu"],["958","xi"],["959","omicron"],["960","pi"],["961","rho"],["962","final sigma"],["963","sigma"],["964","tau"],["965","upsilon"],["966","phi"],["967","chi"],["968","psi"],["969","omega"],["8501","alef symbol"],["982","pi symbol"],["8476","real part symbol"],["978","upsilon - hook symbol"],["8472","Weierstrass p"],["8465","imaginary part"],["8592","leftwards arrow"],["8593","upwards arrow"],["8594","rightwards arrow"],["8595","downwards arrow"],["8596","left right arrow"],["8629","carriage return"],["8656","leftwards double arrow"],["8657","upwards double arrow"],["8658","rightwards double arrow"],["8659","downwards double arrow"],["8660","left right double arrow"],["8756","therefore"],["8834","subset of"],["8835","superset of"],["8836","not a subset of"],["8838","subset of or equal to"],["8839","superset of or equal to"],["8853","circled plus"],["8855","circled times"],["8869","perpendicular"],["8901","dot operator"],["8968","left ceiling"],["8969","right ceiling"],["8970","left floor"],["8971","right floor"],["9001","left-pointing angle bracket"],["9002","right-pointing angle bracket"],["9674","lozenge"],["9824","black spade suit"],["9827","black club suit"],["9829","black heart suit"],["9830","black diamond suit"],["8194","en space"],["8195","em space"],["8201","thin space"],["8204","zero width non-joiner"],["8205","zero width joiner"],["8206","left-to-right mark"],["8207","right-to-left mark"]]}function c(a){return tinymce.util.Tools.grep(a,function(a){return i(a)&&2==a.length})}function d(a){return i(a)?[].concat(c(a)):"function"==typeof a?a():[]}function e(b){var c=a.settings;return c.charmap&&(b=d(c.charmap)),c.charmap_append?[].concat(b).concat(d(c.charmap_append)):b}function f(){return e(b())}function g(b){a.fire("insertCustomChar",{chr:b}).chr,a.execCommand("mceInsertContent",!1,b)}function h(){function b(a){for(;a;){if("TD"==a.nodeName)return a;a=a.parentNode}}var c,d,e,h;c='';var i=f(),j=Math.min(i.length,25),k=Math.ceil(i.length/j);for(e=0;k>e;e++){for(c+="",d=0;j>d;d++){var l=e*j+d;if(l
'+(m?String.fromCharCode(parseInt(m[0],10)):" ")+"
"}else c+="
"}c+="";var n={type:"container",html:c,onclick:function(a){var c=a.target;/^(TD|DIV)$/.test(c.nodeName)&&b(c).firstChild&&(g(tinymce.trim(c.innerText||c.textContent)),a.ctrlKey||h.close())},onmouseover:function(a){var c=b(a.target);c&&c.firstChild?(h.find("#preview").text(c.firstChild.firstChild.data),h.find("#previewTitle").text(c.title)):(h.find("#preview").text(" "),h.find("#previewTitle").text(" "))}};h=a.windowManager.open({title:"Special character",spacing:10,padding:10,items:[n,{type:"container",layout:"flex",direction:"column",align:"center",spacing:5,minWidth:160,minHeight:160,items:[{type:"label",name:"preview",text:" ",style:"font-size: 40px; text-align: center",border:1,minWidth:140,minHeight:80},{type:"label",name:"previewTitle",text:" ",style:"text-align: center",border:1,minWidth:140,minHeight:80}]}],buttons:[{text:"Close",onclick:function(){h.close()}}]})}var i=tinymce.util.Tools.isArray;return a.addCommand("mceShowCharmap",h),a.addButton("charmap",{icon:"charmap",tooltip:"Special character",cmd:"mceShowCharmap"}),a.addMenuItem("charmap",{icon:"charmap",text:"Special character",cmd:"mceShowCharmap",context:"insert"}),{getCharMap:f,insertChar:g}}); \ No newline at end of file +tinymce.PluginManager.add("charmap",function(a){function b(){return[["160","no-break space"],["173","soft hyphen"],["34","quotation mark"],["162","cent sign"],["8364","euro sign"],["163","pound sign"],["165","yen sign"],["169","copyright sign"],["174","registered sign"],["8482","trade mark sign"],["8240","per mille sign"],["181","micro sign"],["183","middle dot"],["8226","bullet"],["8230","three dot leader"],["8242","minutes / feet"],["8243","seconds / inches"],["167","section sign"],["182","paragraph sign"],["223","sharp s / ess-zed"],["8249","single left-pointing angle quotation mark"],["8250","single right-pointing angle quotation mark"],["171","left pointing guillemet"],["187","right pointing guillemet"],["8216","left single quotation mark"],["8217","right single quotation mark"],["8220","left double quotation mark"],["8221","right double quotation mark"],["8218","single low-9 quotation mark"],["8222","double low-9 quotation mark"],["60","less-than sign"],["62","greater-than sign"],["8804","less-than or equal to"],["8805","greater-than or equal to"],["8211","en dash"],["8212","em dash"],["175","macron"],["8254","overline"],["164","currency sign"],["166","broken bar"],["168","diaeresis"],["161","inverted exclamation mark"],["191","turned question mark"],["710","circumflex accent"],["732","small tilde"],["176","degree sign"],["8722","minus sign"],["177","plus-minus sign"],["247","division sign"],["8260","fraction slash"],["215","multiplication sign"],["185","superscript one"],["178","superscript two"],["179","superscript three"],["188","fraction one quarter"],["189","fraction one half"],["190","fraction three quarters"],["402","function / florin"],["8747","integral"],["8721","n-ary sumation"],["8734","infinity"],["8730","square root"],["8764","similar to"],["8773","approximately equal to"],["8776","almost equal to"],["8800","not equal to"],["8801","identical to"],["8712","element of"],["8713","not an element of"],["8715","contains as member"],["8719","n-ary product"],["8743","logical and"],["8744","logical or"],["172","not sign"],["8745","intersection"],["8746","union"],["8706","partial differential"],["8704","for all"],["8707","there exists"],["8709","diameter"],["8711","backward difference"],["8727","asterisk operator"],["8733","proportional to"],["8736","angle"],["180","acute accent"],["184","cedilla"],["170","feminine ordinal indicator"],["186","masculine ordinal indicator"],["8224","dagger"],["8225","double dagger"],["192","A - grave"],["193","A - acute"],["194","A - circumflex"],["195","A - tilde"],["196","A - diaeresis"],["197","A - ring above"],["256","A - macron"],["198","ligature AE"],["199","C - cedilla"],["200","E - grave"],["201","E - acute"],["202","E - circumflex"],["203","E - diaeresis"],["274","E - macron"],["204","I - grave"],["205","I - acute"],["206","I - circumflex"],["207","I - diaeresis"],["298","I - macron"],["208","ETH"],["209","N - tilde"],["210","O - grave"],["211","O - acute"],["212","O - circumflex"],["213","O - tilde"],["214","O - diaeresis"],["216","O - slash"],["332","O - macron"],["338","ligature OE"],["352","S - caron"],["217","U - grave"],["218","U - acute"],["219","U - circumflex"],["220","U - diaeresis"],["362","U - macron"],["221","Y - acute"],["376","Y - diaeresis"],["562","Y - macron"],["222","THORN"],["224","a - grave"],["225","a - acute"],["226","a - circumflex"],["227","a - tilde"],["228","a - diaeresis"],["229","a - ring above"],["257","a - macron"],["230","ligature ae"],["231","c - cedilla"],["232","e - grave"],["233","e - acute"],["234","e - circumflex"],["235","e - diaeresis"],["275","e - macron"],["236","i - grave"],["237","i - acute"],["238","i - circumflex"],["239","i - diaeresis"],["299","i - macron"],["240","eth"],["241","n - tilde"],["242","o - grave"],["243","o - acute"],["244","o - circumflex"],["245","o - tilde"],["246","o - diaeresis"],["248","o slash"],["333","o macron"],["339","ligature oe"],["353","s - caron"],["249","u - grave"],["250","u - acute"],["251","u - circumflex"],["252","u - diaeresis"],["363","u - macron"],["253","y - acute"],["254","thorn"],["255","y - diaeresis"],["563","y - macron"],["913","Alpha"],["914","Beta"],["915","Gamma"],["916","Delta"],["917","Epsilon"],["918","Zeta"],["919","Eta"],["920","Theta"],["921","Iota"],["922","Kappa"],["923","Lambda"],["924","Mu"],["925","Nu"],["926","Xi"],["927","Omicron"],["928","Pi"],["929","Rho"],["931","Sigma"],["932","Tau"],["933","Upsilon"],["934","Phi"],["935","Chi"],["936","Psi"],["937","Omega"],["945","alpha"],["946","beta"],["947","gamma"],["948","delta"],["949","epsilon"],["950","zeta"],["951","eta"],["952","theta"],["953","iota"],["954","kappa"],["955","lambda"],["956","mu"],["957","nu"],["958","xi"],["959","omicron"],["960","pi"],["961","rho"],["962","final sigma"],["963","sigma"],["964","tau"],["965","upsilon"],["966","phi"],["967","chi"],["968","psi"],["969","omega"],["8501","alef symbol"],["982","pi symbol"],["8476","real part symbol"],["978","upsilon - hook symbol"],["8472","Weierstrass p"],["8465","imaginary part"],["8592","leftwards arrow"],["8593","upwards arrow"],["8594","rightwards arrow"],["8595","downwards arrow"],["8596","left right arrow"],["8629","carriage return"],["8656","leftwards double arrow"],["8657","upwards double arrow"],["8658","rightwards double arrow"],["8659","downwards double arrow"],["8660","left right double arrow"],["8756","therefore"],["8834","subset of"],["8835","superset of"],["8836","not a subset of"],["8838","subset of or equal to"],["8839","superset of or equal to"],["8853","circled plus"],["8855","circled times"],["8869","perpendicular"],["8901","dot operator"],["8968","left ceiling"],["8969","right ceiling"],["8970","left floor"],["8971","right floor"],["9001","left-pointing angle bracket"],["9002","right-pointing angle bracket"],["9674","lozenge"],["9824","black spade suit"],["9827","black club suit"],["9829","black heart suit"],["9830","black diamond suit"],["8194","en space"],["8195","em space"],["8201","thin space"],["8204","zero width non-joiner"],["8205","zero width joiner"],["8206","left-to-right mark"],["8207","right-to-left mark"]]}function c(a){return tinymce.util.Tools.grep(a,function(a){return i(a)&&2==a.length})}function d(a){return i(a)?[].concat(c(a)):"function"==typeof a?a():[]}function e(b){var c=a.settings;return c.charmap&&(b=d(c.charmap)),c.charmap_append?[].concat(b).concat(d(c.charmap_append)):b}function f(){return e(b())}function g(b){a.fire("insertCustomChar",{chr:b}).chr,a.execCommand("mceInsertContent",!1,b)}function h(){function b(a){for(;a;){if("TD"==a.nodeName)return a;a=a.parentNode}}var c,d,e,h;c='';var i=f(),j=Math.min(i.length,25),k=Math.ceil(i.length/j);for(e=0;k>e;e++){for(c+="",d=0;j>d;d++){var l=e*j+d;if(l
'+(m?String.fromCharCode(parseInt(m[0],10)):" ")+"
"}else c+="
"}c+="";var n={type:"container",html:c,onclick:function(a){var c=a.target;/^(TD|DIV)$/.test(c.nodeName)&&b(c).firstChild&&(g(tinymce.trim(c.innerText||c.textContent)),a.ctrlKey||h.close())},onmouseover:function(a){var c=b(a.target);c&&c.firstChild?(h.find("#preview").text(c.firstChild.firstChild.data),h.find("#previewTitle").text(c.title)):(h.find("#preview").text(" "),h.find("#previewTitle").text(" "))}};h=a.windowManager.open({title:"Special character",spacing:10,padding:10,items:[n,{type:"container",layout:"flex",direction:"column",align:"center",spacing:5,minWidth:160,minHeight:160,items:[{type:"label",name:"preview",text:" ",style:"font-size: 40px; text-align: center",border:1,minWidth:140,minHeight:80},{type:"label",name:"previewTitle",text:" ",style:"text-align: center",border:1,minWidth:140,minHeight:80}]}],buttons:[{text:"Close",onclick:function(){h.close()}}]})}var i=tinymce.util.Tools.isArray;return a.addCommand("mceShowCharmap",h),a.addButton("charmap",{icon:"charmap",tooltip:"Special character",cmd:"mceShowCharmap"}),a.addMenuItem("charmap",{icon:"charmap",text:"Special character",cmd:"mceShowCharmap",context:"insert"}),{getCharMap:f,insertChar:g}}); \ No newline at end of file diff --git a/media/editors/tinymce/plugins/imagetools/plugin.min.js b/media/editors/tinymce/plugins/imagetools/plugin.min.js index a2ad266e9b4fc..4d2ee3d2d5952 100644 --- a/media/editors/tinymce/plugins/imagetools/plugin.min.js +++ b/media/editors/tinymce/plugins/imagetools/plugin.min.js @@ -1 +1 @@ -!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;g>i;++i)h[i]=d(e[i]);var j=f.apply(null,h);if(void 0===j)throw"module ["+b+"] returned undefined";c.instance=j},c=function(b,c,d){if("string"!=typeof b)throw"module id must be a string";if(void 0===c)throw"no dependencies for "+b;if(void 0===d)throw"no definition function for "+b;a[b]={deps:c,defn:d,instance:void 0}},d=function(c){var d=a[c];if(void 0===d)throw"module ["+c+"] was undefined";return void 0===d.instance&&b(c),d.instance},e=function(a,b){for(var c=a.length,e=new Array(c),f=0;c>f;++f)e.push(d(a[f]));b.apply(null,b)},f={};f.bolt={module:{api:{define:c,require:e,demand:d}}};var g=c,h=function(a,b){g(a,[],function(){return b})};h("1",tinymce.PluginManager),h("2",tinymce.Env),h("3",tinymce.util.Promise),h("4",tinymce.util.URI),h("5",tinymce.util.Tools),h("6",tinymce.util.Delay),g("j",[],function(){function a(a,b){return c(document.createElement("canvas"),a,b)}function b(a){return a.getContext("2d")}function c(a,b,c){return a.width=b,a.height=c,a}return{create:a,resize:c,get2dContext:b}}),g("k",[],function(){function a(a){return a.naturalWidth||a.width}function b(a){return a.naturalHeight||a.height}return{getWidth:a,getHeight:b}}),g("l",[],function(){function a(a,b){return function(){a.apply(b,arguments)}}function b(b){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof b)throw new TypeError("not a function");this._state=null,this._value=null,this._deferreds=[],h(b,a(d,this),a(e,this))}function c(a){var b=this;return null===this._state?void this._deferreds.push(a):void i(function(){var c=b._state?a.onFulfilled:a.onRejected;if(null===c)return void(b._state?a.resolve:a.reject)(b._value);var d;try{d=c(b._value)}catch(e){return void a.reject(e)}a.resolve(d)})}function d(b){try{if(b===this)throw new TypeError("A promise cannot be resolved with itself.");if(b&&("object"==typeof b||"function"==typeof b)){var c=b.then;if("function"==typeof c)return void h(a(c,b),a(d,this),a(e,this))}this._state=!0,this._value=b,f.call(this)}catch(g){e.call(this,g)}}function e(a){this._state=!1,this._value=a,f.call(this)}function f(){for(var a=0,b=this._deferreds.length;b>a;a++)c.call(this,this._deferreds[a]);this._deferreds=null}function g(a,b,c,d){this.onFulfilled="function"==typeof a?a:null,this.onRejected="function"==typeof b?b:null,this.resolve=c,this.reject=d}function h(a,b,c){var d=!1;try{a(function(a){d||(d=!0,b(a))},function(a){d||(d=!0,c(a))})}catch(e){if(d)return;d=!0,c(e)}}if(window.Promise)return window.Promise;var i=b.immediateFn||"function"==typeof setImmediate&&setImmediate||function(a){setTimeout(a,1)},j=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)};return b.prototype["catch"]=function(a){return this.then(null,a)},b.prototype.then=function(a,d){var e=this;return new b(function(b,f){c.call(e,new g(a,d,b,f))})},b.all=function(){var a=Array.prototype.slice.call(1===arguments.length&&j(arguments[0])?arguments[0]:arguments);return new b(function(b,c){function d(f,g){try{if(g&&("object"==typeof g||"function"==typeof g)){var h=g.then;if("function"==typeof h)return void h.call(g,function(a){d(f,a)},c)}a[f]=g,0===--e&&b(a)}catch(i){c(i)}}if(0===a.length)return b([]);for(var e=a.length,f=0;fd;d++)a[d].then(b,c)})},b}),g("m",[],function(){function a(a){var b=document.createElement("a");return b.href=a,b.pathname}function b(b){var c=a(b).split("."),d=c[c.length-1],e={jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png"};return d&&(d=d.toLowerCase()),e[d]}return{guessMimeType:b}}),g("c",["l","j","m","k"],function(a,b,c,d){function e(b){return new a(function(a){function c(){b.removeEventListener("load",c),a(b)}b.complete?a(b):b.addEventListener("load",c)})}function f(a){return e(a).then(function(a){var c,e;return e=b.create(d.getWidth(a),d.getHeight(a)),c=b.get2dContext(e),c.drawImage(a,0,0),e})}function g(a){return e(a).then(function(a){var b=a.src;return 0===b.indexOf("blob:")?i(b):0===b.indexOf("data:")?j(b):f(a).then(function(a){return j(a.toDataURL(c.guessMimeType(b)))})})}function h(b){return new a(function(a){function c(){d.removeEventListener("load",c),a(d)}var d=new Image;d.addEventListener("load",c),d.src=URL.createObjectURL(b),d.complete&&c()})}function i(b){return new a(function(a){var c=new XMLHttpRequest;c.open("GET",b,!0),c.responseType="blob",c.onload=function(){200==this.status&&a(this.response)},c.send()})}function j(b){return new a(function(a){var c,d,e,f,g,h;if(b=b.split(","),f=/data:([^;]+)/.exec(b[0]),f&&(g=f[1]),c=atob(b[1]),window.WebKitBlobBuilder){for(h=new WebKitBlobBuilder,d=new ArrayBuffer(c.length),e=0;ec?a=c:b>a&&(a=b),a}function b(){return[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1]}function c(a,b){var c,d,e,f,g=[],h=new Array(10);for(c=0;5>c;c++){for(d=0;5>d;d++)g[d]=b[d+5*c];for(d=0;5>d;d++){for(f=0,e=0;5>e;e++)f+=a[d+5*e]*g[e];h[d+5*c]=f}}return h}function d(b,c){return c=a(c,0,1),b.map(function(b,d){return d%6===0?b=1-(1-b)*c:b*=c,a(b,0,1)})}function e(b,d){var e;return d=a(d,-1,1),d*=100,0>d?e=127+d/100*127:(e=d%1,e=0===e?l[d]:l[Math.floor(d)]*(1-e)+l[Math.floor(d)+1]*e,e=127*e+127),c(b,[e/127,0,0,0,.5*(127-e),0,e/127,0,0,.5*(127-e),0,0,e/127,0,.5*(127-e),0,0,0,1,0,0,0,0,0,1])}function f(b,d){var e,f,g,h;return d=a(d,-1,1),e=1+(d>0?3*d:d),f=.3086,g=.6094,h=.082,c(b,[f*(1-e)+e,g*(1-e),h*(1-e),0,0,f*(1-e),g*(1-e)+e,h*(1-e),0,0,f*(1-e),g*(1-e),h*(1-e)+e,0,0,0,0,0,1,0,0,0,0,0,1])}function g(b,d){var e,f,g,h,i;return d=a(d,-180,180)/180*Math.PI,e=Math.cos(d),f=Math.sin(d),g=.213,h=.715,i=.072,c(b,[g+e*(1-g)+f*-g,h+e*-h+f*-h,i+e*-i+f*(1-i),0,0,g+e*-g+.143*f,h+e*(1-h)+.14*f,i+e*-i+f*-.283,0,0,g+e*-g+f*-(1-g),h+e*-h+f*h,i+e*(1-i)+f*i,0,0,0,0,0,1,0,0,0,0,0,1])}function h(b,d){return d=a(255*d,-255,255),c(b,[1,0,0,0,d,0,1,0,0,d,0,0,1,0,d,0,0,0,1,0,0,0,0,0,1])}function i(b,d,e,f){return d=a(d,0,2),e=a(e,0,2),f=a(f,0,2),c(b,[d,0,0,0,0,0,e,0,0,0,0,0,f,0,0,0,0,0,1,0,0,0,0,0,1])}function j(b,e){return e=a(e,0,1),c(b,d([.393,.769,.189,0,0,.349,.686,.168,0,0,.272,.534,.131,0,0,0,0,0,1,0,0,0,0,0,1],e))}function k(b,e){return e=a(e,0,1),c(b,d([.33,.34,.33,0,0,.33,.34,.33,0,0,.33,.34,.33,0,0,0,0,0,1,0,0,0,0,0,1],e))}var l=[0,.01,.02,.04,.05,.06,.07,.08,.1,.11,.12,.14,.15,.16,.17,.18,.2,.21,.22,.24,.25,.27,.28,.3,.32,.34,.36,.38,.4,.42,.44,.46,.48,.5,.53,.56,.59,.62,.65,.68,.71,.74,.77,.8,.83,.86,.89,.92,.95,.98,1,1.06,1.12,1.18,1.24,1.3,1.36,1.42,1.48,1.54,1.6,1.66,1.72,1.78,1.84,1.9,1.96,2,2.12,2.25,2.37,2.5,2.62,2.75,2.87,3,3.2,3.4,3.6,3.8,4,4.3,4.7,4.9,5,5.5,6,6.5,6.8,7,7.3,7.5,7.8,8,8.4,8.7,9,9.4,9.6,9.8,10];return{identity:b,adjust:d,multiply:c,adjustContrast:e,adjustBrightness:h,adjustSaturation:f,adjustHue:g,adjustColors:i,adjustSepia:j,adjustGrayscale:k}}),g("a",["j","k","c","n"],function(a,b,c,d){function e(d,e){return c.blobToImage(d).then(function(d){function f(a,b){var c,d,e,f,g,h=a.data,i=b[0],j=b[1],k=b[2],l=b[3],m=b[4],n=b[5],o=b[6],p=b[7],q=b[8],r=b[9],s=b[10],t=b[11],u=b[12],v=b[13],w=b[14],x=b[15],y=b[16],z=b[17],A=b[18],B=b[19];for(g=0;gc?a=c:b>a&&(a=b),a}var e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;for(g=Math.round(Math.sqrt(c.length)),h=Math.floor(g/2),e=a.data,f=b.data,t=a.width,u=a.height,j=0;u>j;j++)for(i=0;t>i;i++){for(k=l=m=0,o=0;g>o;o++)for(n=0;g>n;n++)p=d(i+n-h,0,t-1),q=d(j+o-h,0,u-1),r=4*(q*t+p),s=c[o*g+n],k+=e[r]*s,l+=e[r+1]*s,m+=e[r+2]*s;r=4*(j*t+i),f[r]=d(k,0,255),f[r+1]=d(l,0,255),f[r+2]=d(m,0,255)}return b}var g,h,i=a.create(b.getWidth(d),b.getHeight(d)),j=a.get2dContext(i);return j.drawImage(d,0,0),k(d),g=j.getImageData(0,0,i.width,i.height),h=j.getImageData(0,0,i.width,i.height),h=f(g,h,e),j.putImageData(h,0,0),c.canvasToBlob(i)})}function g(d){return function(e,f){return c.blobToImage(e).then(function(e){function g(a,b){var c,d=a.data;for(c=0;ce?360+e:e,90!=e&&270!=e||b.resize(g,g.height,g.width),90!=e&&180!=e||(j=g.width),270!=e&&180!=e||(k=g.height),i.translate(j,k),i.rotate(e*Math.PI/180),i.drawImage(f,0,0),h(f),a.canvasToBlob(g,d.type)})}function e(d,e){return a.blobToImage(d).then(function(d){var f=b.create(c.getWidth(d),c.getHeight(d)),g=b.get2dContext(f);return"v"==e?(g.scale(1,-1),g.drawImage(d,0,-f.height)):(g.scale(-1,1),g.drawImage(d,-f.width,0)),h(d),a.canvasToBlob(f)})}function f(c,d,e,f,g){return a.blobToImage(c).then(function(c){var i=b.create(f,g),j=b.get2dContext(i);return j.drawImage(c,-d,-e),h(c),a.canvasToBlob(i)})}function g(c,d,e){return a.blobToImage(c).then(function(f){var g=b.create(d,e),i=b.get2dContext(g);return i.drawImage(f,0,0,d,e),h(f),a.canvasToBlob(g,c.type)})}var h=a.revokeImageUrl;return{rotate:d,flip:e,crop:f,resize:g}}),g("7",["a","b"],function(a,b){var c=function(b){return a.invert(b)},d=function(b){return a.sharpen(b)},e=function(b){return a.emboss(b)},f=function(b,c){return a.gamma(b,c)},g=function(b,c){return a.exposure(b,c)},h=function(b,c,d,e){return a.colorize(b,c,d,e)},i=function(b,c){return a.brightness(b,c)},j=function(b,c){return a.hue(b,c)},k=function(b,c){return a.saturate(b,c)},l=function(b,c){return a.contrast(b,c)},m=function(b,c){return a.grayscale(b,c)},n=function(b,c){return a.sepia(b,c)},o=function(a,c){return b.flip(a,c)},p=function(a,c,d,e,f){return b.crop(a,c,d,e,f)},q=function(a,c,d){return b.resize(a,c,d)},r=function(a,c){return b.rotate(a,c)};return{invert:c,sharpen:d,emboss:e,brightness:i,hue:j,saturate:k,contrast:l,grayscale:m,sepia:n,colorize:h,gamma:f,exposure:g,flip:o,crop:p,resize:q,rotate:r}}),g("8",["c"],function(a){var b=function(b){return a.blobToImage(b)},c=function(b){return a.imageToBlob(b)},d=function(b){return a.blobToDataUri(b)},e=function(b){return a.blobToBase64(b)};return{blobToImage:b,imageToBlob:c,blobToDataUri:d,blobToBase64:e}}),h("d",tinymce.dom.DOMUtils),h("e",tinymce.ui.Factory),h("f",tinymce.ui.Form),h("g",tinymce.ui.Container),h("o",tinymce.ui.Control),h("p",tinymce.ui.DragHelper),h("q",tinymce.geom.Rect),h("s",tinymce.dom.DomQuery),h("t",tinymce.util.Observable),h("u",tinymce.util.VK),g("r",["s","p","q","5","t","u"],function(a,b,c,d,e,f){var g=0;return function(h,i,j,k,l){function m(a,b){return{x:b.x+a.x,y:b.y+a.y,w:b.w,h:b.h}}function n(a,b){return{x:b.x-a.x,y:b.y-a.y,w:b.w,h:b.h}}function o(){return n(j,h)}function p(a,b,d,e){var f,g,i,k,l;f=b.x,g=b.y,i=b.w,k=b.h,f+=d*a.deltaX,g+=e*a.deltaY,i+=d*a.deltaW,k+=e*a.deltaH,20>i&&(i=20),20>k&&(k=20),l=h=c.clamp({x:f,y:g,w:i,h:k},j,"move"==a.name),l=n(j,l),y.fire("updateRect",{rect:l}),v(l)}function q(){function c(a){var c;return new b(D,{document:k.ownerDocument,handle:D+"-"+a.name,start:function(){c=h},drag:function(b){p(a,c,b.deltaX,b.deltaY)}})}a('
').appendTo(k),d.each(B,function(b){a("#"+D,k).append('