diff --git a/.gitignore b/.gitignore index 9b3d10dcedab6..9f283cf83d385 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,14 @@ /phpunit.xml /tests/system/webdriver/tests/logs/ /tests/system/servers/configdef.php +codecept.phar +tests/codeception/_output/* +tests/codeception/vendor/* +tests/codeception/testingsite* +tests/codeception/tests/acceptance.suite.yml +tests/codeception/tests/acceptance/*Tester.php +tests/codeception/tests/functional/*Tester.php +tests/codeception/tests/unit/*Tester.php # phpDocumentor Logs # phpdoc-* diff --git a/administrator/components/com_admin/helpers/html/directory.php b/administrator/components/com_admin/helpers/html/directory.php index 34243641609b0..70eb5e0df9dfe 100644 --- a/administrator/components/com_admin/helpers/html/directory.php +++ b/administrator/components/com_admin/helpers/html/directory.php @@ -29,10 +29,8 @@ public static function writable($writable) { return '' . JText::_('COM_ADMIN_WRITABLE') . ''; } - else - { - return '' . JText::_('COM_ADMIN_UNWRITABLE') . ''; - } + + return '' . JText::_('COM_ADMIN_UNWRITABLE') . ''; } /** @@ -46,22 +44,13 @@ public static function writable($writable) */ public static function message($dir, $message, $visible = true) { - if ($visible) - { - $output = $dir; - } - else - { - $output = ''; - } + $output = $visible ? $dir : ''; if (empty($message)) { return $output; } - else - { - return $output . ' ' . JText::_($message) . ''; - } + + return $output . ' ' . JText::_($message) . ''; } } diff --git a/administrator/components/com_admin/helpers/html/phpsetting.php b/administrator/components/com_admin/helpers/html/phpsetting.php index 425d7b45e765c..312c15c4b94c7 100644 --- a/administrator/components/com_admin/helpers/html/phpsetting.php +++ b/administrator/components/com_admin/helpers/html/phpsetting.php @@ -25,14 +25,7 @@ abstract class JHtmlPhpSetting */ public static function boolean($val) { - if ($val) - { - return JText::_('JON'); - } - else - { - return JText::_('JOFF'); - } + return JText::_($val ? 'JON' : 'JOFF'); } /** @@ -44,14 +37,7 @@ public static function boolean($val) */ public static function set($val) { - if ($val) - { - return JText::_('JYES'); - } - else - { - return JText::_('JNO'); - } + return JText::_($val ? 'JYES' : 'JNO'); } /** @@ -63,14 +49,7 @@ public static function set($val) */ public static function string($val) { - if (empty($val)) - { - return JText::_('JNONE'); - } - else - { - return $val; - } + return !empty($val) ? $val : JText::_('JNONE'); } /** diff --git a/administrator/components/com_admin/helpers/html/system.php b/administrator/components/com_admin/helpers/html/system.php index 4189c9c5859c1..33b7a840d5cca 100644 --- a/administrator/components/com_admin/helpers/html/system.php +++ b/administrator/components/com_admin/helpers/html/system.php @@ -25,13 +25,6 @@ abstract class JHtmlSystem */ public static function server($val) { - if (empty($val)) - { - return JText::_('COM_ADMIN_NA'); - } - else - { - return $val; - } + return !empty($val) ? $val : JText::_('COM_ADMIN_NA'); } } diff --git a/administrator/components/com_admin/models/help.php b/administrator/components/com_admin/models/help.php index 23497cd9775bb..763fe6353355d 100644 --- a/administrator/components/com_admin/models/help.php +++ b/administrator/components/com_admin/models/help.php @@ -127,68 +127,72 @@ public function getLangTag() */ public function &getToc() { - if (is_null($this->toc)) + if (!is_null($this->toc)) { - // Get vars - $lang_tag = $this->getLangTag(); - $help_search = $this->getHelpSearch(); + return $this->toc; + } - // New style - Check for a TOC JSON file - if (file_exists(JPATH_BASE . '/help/' . $lang_tag . '/toc.json')) - { - $data = json_decode(file_get_contents(JPATH_BASE . '/help/' . $lang_tag . '/toc.json')); + // Get vars + $lang_tag = $this->getLangTag(); + $help_search = $this->getHelpSearch(); - // Loop through the data array - foreach ($data as $key => $value) - { - $this->toc[$key] = JText::_('COM_ADMIN_HELP_' . $value); - } - } - else + // New style - Check for a TOC JSON file + if (file_exists(JPATH_BASE . '/help/' . $lang_tag . '/toc.json')) + { + $data = json_decode(file_get_contents(JPATH_BASE . '/help/' . $lang_tag . '/toc.json')); + + // Loop through the data array + foreach ($data as $key => $value) { - // Get Help files - jimport('joomla.filesystem.folder'); - $files = JFolder::files(JPATH_BASE . '/help/' . $lang_tag, '\.xml$|\.html$'); - $this->toc = array(); - - foreach ($files as $file) - { - $buffer = file_get_contents(JPATH_BASE . '/help/' . $lang_tag . '/' . $file); - - if (preg_match('#(.*?)#', $buffer, $m)) - { - $title = trim($m[1]); - - if ($title) - { - // Translate the page title - $title = JText::_($title); - - // Strip the extension - $file = preg_replace('#\.xml$|\.html$#', '', $file); - - if ($help_search) - { - if (JString::strpos(JString::strtolower(strip_tags($buffer)), JString::strtolower($help_search)) !== false) - { - // Add an item in the Table of Contents - $this->toc[$file] = $title; - } - } - else - { - // Add an item in the Table of Contents - $this->toc[$file] = $title; - } - } - } - } + $this->toc[$key] = JText::_('COM_ADMIN_HELP_' . $value); } // Sort the Table of Contents asort($this->toc); + + return $this->toc; + } + + // Get Help files + jimport('joomla.filesystem.folder'); + $files = JFolder::files(JPATH_BASE . '/help/' . $lang_tag, '\.xml$|\.html$'); + $this->toc = array(); + + foreach ($files as $file) + { + $buffer = file_get_contents(JPATH_BASE . '/help/' . $lang_tag . '/' . $file); + + if (!preg_match('#(.*?)#', $buffer, $m)) + { + continue; + } + + $title = trim($m[1]); + + if (!$title) + { + continue; + } + + // Translate the page title + $title = JText::_($title); + + // Strip the extension + $file = preg_replace('#\.xml$|\.html$#', '', $file); + + if ($help_search + && JString::strpos(JString::strtolower(strip_tags($buffer)), JString::strtolower($help_search)) === false) + { + continue; + } + + // Add an item in the Table of Contents + $this->toc[$file] = $title; } + // Sort the Table of Contents + asort($this->toc); + return $this->toc; } diff --git a/administrator/components/com_admin/models/sysinfo.php b/administrator/components/com_admin/models/sysinfo.php index 3d5905eaa1a59..324e352b6872a 100644 --- a/administrator/components/com_admin/models/sysinfo.php +++ b/administrator/components/com_admin/models/sysinfo.php @@ -67,27 +67,29 @@ class AdminModelSysInfo extends JModelLegacy */ public function &getPhpSettings() { - if (is_null($this->php_settings)) + if (!is_null($this->php_settings)) { - $this->php_settings = array(); - $this->php_settings['safe_mode'] = ini_get('safe_mode') == '1'; - $this->php_settings['display_errors'] = ini_get('display_errors') == '1'; - $this->php_settings['short_open_tag'] = ini_get('short_open_tag') == '1'; - $this->php_settings['file_uploads'] = ini_get('file_uploads') == '1'; - $this->php_settings['magic_quotes_gpc'] = ini_get('magic_quotes_gpc') == '1'; - $this->php_settings['register_globals'] = ini_get('register_globals') == '1'; - $this->php_settings['output_buffering'] = (bool) ini_get('output_buffering'); - $this->php_settings['open_basedir'] = ini_get('open_basedir'); - $this->php_settings['session.save_path'] = ini_get('session.save_path'); - $this->php_settings['session.auto_start'] = ini_get('session.auto_start'); - $this->php_settings['disable_functions'] = ini_get('disable_functions'); - $this->php_settings['xml'] = extension_loaded('xml'); - $this->php_settings['zlib'] = extension_loaded('zlib'); - $this->php_settings['zip'] = function_exists('zip_open') && function_exists('zip_read'); - $this->php_settings['mbstring'] = extension_loaded('mbstring'); - $this->php_settings['iconv'] = function_exists('iconv'); + return $this->php_settings; } + $this->php_settings = array(); + $this->php_settings['safe_mode'] = ini_get('safe_mode') == '1'; + $this->php_settings['display_errors'] = ini_get('display_errors') == '1'; + $this->php_settings['short_open_tag'] = ini_get('short_open_tag') == '1'; + $this->php_settings['file_uploads'] = ini_get('file_uploads') == '1'; + $this->php_settings['magic_quotes_gpc'] = ini_get('magic_quotes_gpc') == '1'; + $this->php_settings['register_globals'] = ini_get('register_globals') == '1'; + $this->php_settings['output_buffering'] = (bool) ini_get('output_buffering'); + $this->php_settings['open_basedir'] = ini_get('open_basedir'); + $this->php_settings['session.save_path'] = ini_get('session.save_path'); + $this->php_settings['session.auto_start'] = ini_get('session.auto_start'); + $this->php_settings['disable_functions'] = ini_get('disable_functions'); + $this->php_settings['xml'] = extension_loaded('xml'); + $this->php_settings['zlib'] = extension_loaded('zlib'); + $this->php_settings['zip'] = function_exists('zip_open') && function_exists('zip_read'); + $this->php_settings['mbstring'] = extension_loaded('mbstring'); + $this->php_settings['iconv'] = function_exists('iconv'); + return $this->php_settings; } @@ -100,16 +102,18 @@ public function &getPhpSettings() */ public function &getConfig() { - if (is_null($this->config)) + if (!is_null($this->config)) { - $registry = new Registry(new JConfig); - $this->config = $registry->toArray(); - $hidden = array('host', 'user', 'password', 'ftp_user', 'ftp_pass', 'smtpuser', 'smtppass'); + return $this->config; + } - foreach ($hidden as $key) - { - $this->config[$key] = 'xxxxxx'; - } + $registry = new Registry(new JConfig); + $this->config = $registry->toArray(); + $hidden = array('host', 'user', 'password', 'ftp_user', 'ftp_pass', 'smtpuser', 'smtppass'); + + foreach ($hidden as $key) + { + $this->config[$key] = 'xxxxxx'; } return $this->config; @@ -124,33 +128,26 @@ public function &getConfig() */ public function &getInfo() { - if (is_null($this->info)) + if (!is_null($this->info)) { - $this->info = array(); - $version = new JVersion; - $platform = new JPlatform; - $db = JFactory::getDbo(); - - if (isset($_SERVER['SERVER_SOFTWARE'])) - { - $sf = $_SERVER['SERVER_SOFTWARE']; - } - else - { - $sf = getenv('SERVER_SOFTWARE'); - } - - $this->info['php'] = php_uname(); - $this->info['dbversion'] = $db->getVersion(); - $this->info['dbcollation'] = $db->getCollation(); - $this->info['phpversion'] = phpversion(); - $this->info['server'] = $sf; - $this->info['sapi_name'] = php_sapi_name(); - $this->info['version'] = $version->getLongVersion(); - $this->info['platform'] = $platform->getLongVersion(); - $this->info['useragent'] = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ""; + return $this->info; } + $this->info = array(); + $version = new JVersion; + $platform = new JPlatform; + $db = JFactory::getDbo(); + + $this->info['php'] = php_uname(); + $this->info['dbversion'] = $db->getVersion(); + $this->info['dbcollation'] = $db->getCollation(); + $this->info['phpversion'] = phpversion(); + $this->info['server'] = isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : getenv('SERVER_SOFTWARE'); + $this->info['sapi_name'] = php_sapi_name(); + $this->info['version'] = $version->getLongVersion(); + $this->info['platform'] = $platform->getLongVersion(); + $this->info['useragent'] = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ""; + return $this->info; } @@ -163,9 +160,7 @@ public function &getInfo() */ public function phpinfoEnabled() { - $disabled = explode(',', ini_get('disable_functions')); - - return !in_array('phpinfo', $disabled); + return !in_array('phpinfo', explode(',', ini_get('disable_functions'))); } /** @@ -177,28 +172,33 @@ public function phpinfoEnabled() */ public function &getPHPInfo() { - if (is_null($this->php_info) && $this->phpinfoEnabled()) + if (!$this->phpinfoEnabled()) { - ob_start(); - date_default_timezone_set('UTC'); - phpinfo(INFO_GENERAL | INFO_CONFIGURATION | INFO_MODULES); - $phpInfo = ob_get_contents(); - ob_end_clean(); - preg_match_all('#]*>(.*)#siU', $phpInfo, $output); - $output = preg_replace('#]*>#', '', $output[1][0]); - $output = preg_replace('#(\w),(\w)#', '\1, \2', $output); - $output = preg_replace('#
#', '', $output); - $output = str_replace('
', '', $output); - $output = preg_replace('#
(.*)<\/tr>#', '$1', $output); - $output = str_replace('
', '', $output); - $output = str_replace('', '', $output); - $this->php_info = $output; + $this->php_info = JText::_('COM_ADMIN_PHPINFO_DISABLED'); + + return $this->php_info; } - else + + if (!is_null($this->php_info)) { - $this->php_info = JText::_('COM_ADMIN_PHPINFO_DISABLED'); + return $this->php_info; } + ob_start(); + date_default_timezone_set('UTC'); + phpinfo(INFO_GENERAL | INFO_CONFIGURATION | INFO_MODULES); + $phpInfo = ob_get_contents(); + ob_end_clean(); + preg_match_all('#]*>(.*)#siU', $phpInfo, $output); + $output = preg_replace('#]*>#', '', $output[1][0]); + $output = preg_replace('#(\w),(\w)#', '\1, \2', $output); + $output = preg_replace('#
#', '', $output); + $output = str_replace('
', '', $output); + $output = preg_replace('#
(.*)<\/tr>#', '$1', $output); + $output = str_replace('
', '', $output); + $output = str_replace('', '', $output); + $this->php_info = $output; + return $this->php_info; } @@ -211,104 +211,116 @@ public function &getPHPInfo() */ public function getDirectory() { - if (is_null($this->directories)) + if (!is_null($this->directories)) { - $this->directories = array(); + return $this->directories; + } - $registry = JFactory::getConfig(); - $cparams = JComponentHelper::getParams('com_media'); + $this->directories = array(); - $this->_addDirectory('administrator/components', JPATH_ADMINISTRATOR . '/components'); - $this->_addDirectory('administrator/language', JPATH_ADMINISTRATOR . '/language'); + $registry = JFactory::getConfig(); + $cparams = JComponentHelper::getParams('com_media'); - // List all admin languages - $admin_langs = new DirectoryIterator(JPATH_ADMINISTRATOR . '/language'); + $this->_addDirectory('administrator/components', JPATH_ADMINISTRATOR . '/components'); + $this->_addDirectory('administrator/language', JPATH_ADMINISTRATOR . '/language'); - foreach ($admin_langs as $folder) - { - if (!$folder->isDir() || $folder->isDot()) - { - continue; - } + // List all admin languages + $admin_langs = new DirectoryIterator(JPATH_ADMINISTRATOR . '/language'); - $this->_addDirectory('administrator/language/' . $folder->getFilename(), JPATH_ADMINISTRATOR . '/language/' . $folder->getFilename()); + foreach ($admin_langs as $folder) + { + if (!$folder->isDir() || $folder->isDot()) + { + continue; } - // List all manifests folders - $manifests = new DirectoryIterator(JPATH_ADMINISTRATOR . '/manifests'); + $this->_addDirectory('administrator/language/' . $folder->getFilename(), JPATH_ADMINISTRATOR . '/language/' . $folder->getFilename()); + } + + // List all manifests folders + $manifests = new DirectoryIterator(JPATH_ADMINISTRATOR . '/manifests'); - foreach ($manifests as $folder) + foreach ($manifests as $folder) + { + if (!$folder->isDir() || $folder->isDot()) { - if (!$folder->isDir() || $folder->isDot()) - { - continue; - } - - $this->_addDirectory('administrator/manifests/' . $folder->getFilename(), JPATH_ADMINISTRATOR . '/manifests/' . $folder->getFilename()); + continue; } - $this->_addDirectory('administrator/modules', JPATH_ADMINISTRATOR . '/modules'); - $this->_addDirectory('administrator/templates', JPATH_THEMES); + $this->_addDirectory('administrator/manifests/' . $folder->getFilename(), JPATH_ADMINISTRATOR . '/manifests/' . $folder->getFilename()); + } - $this->_addDirectory('components', JPATH_SITE . '/components'); + $this->_addDirectory('administrator/modules', JPATH_ADMINISTRATOR . '/modules'); + $this->_addDirectory('administrator/templates', JPATH_THEMES); - $this->_addDirectory($cparams->get('image_path'), JPATH_SITE . '/' . $cparams->get('image_path')); + $this->_addDirectory('components', JPATH_SITE . '/components'); - // List all images folders - $image_folders = new DirectoryIterator(JPATH_SITE . '/' . $cparams->get('image_path')); + $this->_addDirectory($cparams->get('image_path'), JPATH_SITE . '/' . $cparams->get('image_path')); - foreach ($image_folders as $folder) - { - if (!$folder->isDir() || $folder->isDot()) - { - continue; - } + // List all images folders + $image_folders = new DirectoryIterator(JPATH_SITE . '/' . $cparams->get('image_path')); - $this->_addDirectory('images/' . $folder->getFilename(), JPATH_SITE . '/' . $cparams->get('image_path') . '/' . $folder->getFilename()); + foreach ($image_folders as $folder) + { + if (!$folder->isDir() || $folder->isDot()) + { + continue; } - $this->_addDirectory('language', JPATH_SITE . '/language'); + $this->_addDirectory('images/' . $folder->getFilename(), JPATH_SITE . '/' . $cparams->get('image_path') . '/' . $folder->getFilename()); + } - // List all site languages - $site_langs = new DirectoryIterator(JPATH_SITE . '/language'); + $this->_addDirectory('language', JPATH_SITE . '/language'); - foreach ($site_langs as $folder) - { - if (!$folder->isDir() || $folder->isDot()) - { - continue; - } + // List all site languages + $site_langs = new DirectoryIterator(JPATH_SITE . '/language'); - $this->_addDirectory('language/' . $folder->getFilename(), JPATH_SITE . '/language/' . $folder->getFilename()); + foreach ($site_langs as $folder) + { + if (!$folder->isDir() || $folder->isDot()) + { + continue; } - $this->_addDirectory('libraries', JPATH_LIBRARIES); + $this->_addDirectory('language/' . $folder->getFilename(), JPATH_SITE . '/language/' . $folder->getFilename()); + } - $this->_addDirectory('media', JPATH_SITE . '/media'); - $this->_addDirectory('modules', JPATH_SITE . '/modules'); - $this->_addDirectory('plugins', JPATH_PLUGINS); + $this->_addDirectory('libraries', JPATH_LIBRARIES); - $plugin_groups = new DirectoryIterator(JPATH_SITE . '/plugins'); + $this->_addDirectory('media', JPATH_SITE . '/media'); + $this->_addDirectory('modules', JPATH_SITE . '/modules'); + $this->_addDirectory('plugins', JPATH_PLUGINS); - foreach ($plugin_groups as $folder) - { - if (!$folder->isDir() || $folder->isDot()) - { - continue; - } + $plugin_groups = new DirectoryIterator(JPATH_SITE . '/plugins'); - $this->_addDirectory('plugins/' . $folder->getFilename(), JPATH_PLUGINS . '/' . $folder->getFilename()); + foreach ($plugin_groups as $folder) + { + if (!$folder->isDir() || $folder->isDot()) + { + continue; } - $this->_addDirectory('templates', JPATH_SITE . '/templates'); - $this->_addDirectory('configuration.php', JPATH_CONFIGURATION . '/configuration.php'); + $this->_addDirectory('plugins/' . $folder->getFilename(), JPATH_PLUGINS . '/' . $folder->getFilename()); + } + + $this->_addDirectory('templates', JPATH_SITE . '/templates'); + $this->_addDirectory('configuration.php', JPATH_CONFIGURATION . '/configuration.php'); + + // Is there a cache path in configuration.php? + if ($cache_path = trim($registry->get('cache_path', ''))) + { + // Frontend and backend use same directory for caching. + $this->_addDirectory($cache_path, $cache_path, 'COM_ADMIN_CACHE_DIRECTORY'); + } + else + { $this->_addDirectory('cache', JPATH_SITE . '/cache', 'COM_ADMIN_CACHE_DIRECTORY'); $this->_addDirectory('administrator/cache', JPATH_CACHE, 'COM_ADMIN_CACHE_DIRECTORY'); - - $this->_addDirectory($registry->get('log_path', JPATH_ROOT . '/log'), $registry->get('log_path', JPATH_ROOT . '/log'), 'COM_ADMIN_LOG_DIRECTORY'); - $this->_addDirectory($registry->get('tmp_path', JPATH_ROOT . '/tmp'), $registry->get('tmp_path', JPATH_ROOT . '/tmp'), 'COM_ADMIN_TEMP_DIRECTORY'); } + $this->_addDirectory($registry->get('log_path', JPATH_ROOT . '/log'), $registry->get('log_path', JPATH_ROOT . '/log'), 'COM_ADMIN_LOG_DIRECTORY'); + $this->_addDirectory($registry->get('tmp_path', JPATH_ROOT . '/tmp'), $registry->get('tmp_path', JPATH_ROOT . '/tmp'), 'COM_ADMIN_TEMP_DIRECTORY'); + return $this->directories; } @@ -343,11 +355,13 @@ private function _addDirectory($name, $path, $message = '') */ public function &getEditor() { - if (is_null($this->editor)) + if (!is_null($this->editor)) { - $this->editor = JFactory::getConfig()->get('editor'); + return $this->editor; } + $this->editor = JFactory::getConfig()->get('editor'); + return $this->editor; } } diff --git a/administrator/components/com_admin/postinstall/languageaccess340.php b/administrator/components/com_admin/postinstall/languageaccess340.php index bad4153699bb0..4de4266b78c42 100644 --- a/administrator/components/com_admin/postinstall/languageaccess340.php +++ b/administrator/components/com_admin/postinstall/languageaccess340.php @@ -39,9 +39,7 @@ function admin_postinstall_languageaccess340_condition() // one row with access set to 0 return true; } - else - { - // All good the query return nothing. - return false; - } + + // All good the query return nothing. + return false; } diff --git a/administrator/components/com_admin/script.php b/administrator/components/com_admin/script.php index 807b67aceeb0c..cd0c4978f55b0 100644 --- a/administrator/components/com_admin/script.php +++ b/administrator/components/com_admin/script.php @@ -19,7 +19,7 @@ class JoomlaInstallerScript /** * Method to update Joomla! * - * @param JInstallerFile $installer The class calling this method + * @param JInstallerFile $installer The class calling this method * * @return void */ @@ -47,13 +47,48 @@ protected function updateDatabase() { $db = JFactory::getDbo(); - if (substr($db->name, 0, 5) == 'mysql') + if (strpos($db->name, 'mysql') !== false) { - $db->setQuery('SHOW ENGINES'); + $this->updateDatabaseMySQL(); + } + + $this->uninstallEosPlugin(); + } + + /** + * Method to update MySQL Database + * + * @return void + */ + protected function updateDatabaseMySQL() + { + $db = JFactory::getDbo(); + + $db->setQuery('SHOW ENGINES'); + + try + { + $results = $db->loadObjectList(); + } + catch (Exception $e) + { + echo JText::sprintf('JLIB_DATABASE_ERROR_FUNCTION_FAILED', $e->getCode(), $e->getMessage()) . '
'; + + return; + } + + foreach ($results as $result) + { + if ($result->Support != 'DEFAULT') + { + continue; + } + + $db->setQuery('ALTER TABLE #__update_sites_extensions ENGINE = ' . $result->Engine); try { - $results = $db->loadObjectList(); + $db->execute(); } catch (Exception $e) { @@ -62,27 +97,18 @@ protected function updateDatabase() return; } - foreach ($results as $result) - { - if ($result->Support == 'DEFAULT') - { - $db->setQuery('ALTER TABLE #__update_sites_extensions ENGINE = ' . $result->Engine); - - try - { - $db->execute(); - } - catch (Exception $e) - { - echo JText::sprintf('JLIB_DATABASE_ERROR_FUNCTION_FAILED', $e->getCode(), $e->getMessage()) . '
'; - - return; - } - - break; - } - } + break; } + } + + /** + * Uninstall the 2.5 EOS plugin + * + * @return void + */ + protected function uninstallEosPlugin() + { + $db = JFactory::getDbo(); // Check if the 2.5 EOS plugin is present and uninstall it if so $id = $db->setQuery( @@ -92,19 +118,21 @@ protected function updateDatabase() ->where('name = ' . $db->quote('PLG_EOSNOTIFY')) )->loadResult(); - if ($id) + if (!$id) { - // We need to unprotect the plugin so we can uninstall it - $db->setQuery( - $db->getQuery(true) - ->update('#__extensions') - ->set('protected = 0') - ->where($db->quoteName('extension_id') . ' = ' . $id) - )->execute(); - - $installer = new JInstaller; - $installer->uninstall('plugin', $id); + return; } + + // We need to unprotect the plugin so we can uninstall it + $db->setQuery( + $db->getQuery(true) + ->update('#__extensions') + ->set('protected = 0') + ->where($db->quoteName('extension_id') . ' = ' . $id) + )->execute(); + + $installer = new JInstaller; + $installer->uninstall('plugin', $id); } /** @@ -114,155 +142,154 @@ protected function updateDatabase() */ protected function updateManifestCaches() { - $extensions = array(); - - // Components - // `type`, `element`, `folder`, `client_id` - $extensions[] = array('component', 'com_mailto', '', 0); - $extensions[] = array('component', 'com_wrapper', '', 0); - $extensions[] = array('component', 'com_admin', '', 1); - $extensions[] = array('component', 'com_ajax', '', 1); - $extensions[] = array('component', 'com_banners', '', 1); - $extensions[] = array('component', 'com_cache', '', 1); - $extensions[] = array('component', 'com_categories', '', 1); - $extensions[] = array('component', 'com_checkin', '', 1); - $extensions[] = array('component', 'com_contact', '', 1); - $extensions[] = array('component', 'com_cpanel', '', 1); - $extensions[] = array('component', 'com_installer', '', 1); - $extensions[] = array('component', 'com_languages', '', 1); - $extensions[] = array('component', 'com_login', '', 1); - $extensions[] = array('component', 'com_media', '', 1); - $extensions[] = array('component', 'com_menus', '', 1); - $extensions[] = array('component', 'com_messages', '', 1); - $extensions[] = array('component', 'com_modules', '', 1); - $extensions[] = array('component', 'com_newsfeeds', '', 1); - $extensions[] = array('component', 'com_plugins', '', 1); - $extensions[] = array('component', 'com_search', '', 1); - $extensions[] = array('component', 'com_templates', '', 1); - $extensions[] = array('component', 'com_content', '', 1); - $extensions[] = array('component', 'com_config', '', 1); - $extensions[] = array('component', 'com_redirect', '', 1); - $extensions[] = array('component', 'com_users', '', 1); - $extensions[] = array('component', 'com_tags', '', 1); - $extensions[] = array('component', 'com_contenthistory', '', 1); - $extensions[] = array('component', 'com_postinstall', '', 1); + $extensions = array( + // Components + // `type`, `element`, `folder`, `client_id` + array('component', 'com_mailto', '', 0), + array('component', 'com_wrapper', '', 0), + array('component', 'com_admin', '', 1), + array('component', 'com_ajax', '', 1), + array('component', 'com_banners', '', 1), + array('component', 'com_cache', '', 1), + array('component', 'com_categories', '', 1), + array('component', 'com_checkin', '', 1), + array('component', 'com_contact', '', 1), + array('component', 'com_cpanel', '', 1), + array('component', 'com_installer', '', 1), + array('component', 'com_languages', '', 1), + array('component', 'com_login', '', 1), + array('component', 'com_media', '', 1), + array('component', 'com_menus', '', 1), + array('component', 'com_messages', '', 1), + array('component', 'com_modules', '', 1), + array('component', 'com_newsfeeds', '', 1), + array('component', 'com_plugins', '', 1), + array('component', 'com_search', '', 1), + array('component', 'com_templates', '', 1), + array('component', 'com_content', '', 1), + array('component', 'com_config', '', 1), + array('component', 'com_redirect', '', 1), + array('component', 'com_users', '', 1), + array('component', 'com_tags', '', 1), + array('component', 'com_contenthistory', '', 1), + array('component', 'com_postinstall', '', 1), - // Libraries - $extensions[] = array('library', 'phpmailer', '', 0); - $extensions[] = array('library', 'simplepie', '', 0); - $extensions[] = array('library', 'phputf8', '', 0); - $extensions[] = array('library', 'joomla', '', 0); - $extensions[] = array('library', 'idna_convert', '', 0); - $extensions[] = array('library', 'fof', '', 0); - $extensions[] = array('library', 'phpass', '', 0); + // Libraries + array('library', 'phpmailer', '', 0), + array('library', 'simplepie', '', 0), + array('library', 'phputf8', '', 0), + array('library', 'joomla', '', 0), + array('library', 'idna_convert', '', 0), + array('library', 'fof', '', 0), + array('library', 'phpass', '', 0), - // Modules site - // Site - $extensions[] = array('module', 'mod_articles_archive', '', 0); - $extensions[] = array('module', 'mod_articles_latest', '', 0); - $extensions[] = array('module', 'mod_articles_popular', '', 0); - $extensions[] = array('module', 'mod_banners', '', 0); - $extensions[] = array('module', 'mod_breadcrumbs', '', 0); - $extensions[] = array('module', 'mod_custom', '', 0); - $extensions[] = array('module', 'mod_feed', '', 0); - $extensions[] = array('module', 'mod_footer', '', 0); - $extensions[] = array('module', 'mod_login', '', 0); - $extensions[] = array('module', 'mod_menu', '', 0); - $extensions[] = array('module', 'mod_articles_news', '', 0); - $extensions[] = array('module', 'mod_random_image', '', 0); - $extensions[] = array('module', 'mod_related_items', '', 0); - $extensions[] = array('module', 'mod_search', '', 0); - $extensions[] = array('module', 'mod_stats', '', 0); - $extensions[] = array('module', 'mod_syndicate', '', 0); - $extensions[] = array('module', 'mod_users_latest', '', 0); - $extensions[] = array('module', 'mod_whosonline', '', 0); - $extensions[] = array('module', 'mod_wrapper', '', 0); - $extensions[] = array('module', 'mod_articles_category', '', 0); - $extensions[] = array('module', 'mod_articles_categories', '', 0); - $extensions[] = array('module', 'mod_languages', '', 0); - $extensions[] = array('module', 'mod_tags_popular', '', 0); - $extensions[] = array('module', 'mod_tags_similar', '', 0); + // Modules site + // Site + array('module', 'mod_articles_archive', '', 0), + array('module', 'mod_articles_latest', '', 0), + array('module', 'mod_articles_popular', '', 0), + array('module', 'mod_banners', '', 0), + array('module', 'mod_breadcrumbs', '', 0), + array('module', 'mod_custom', '', 0), + array('module', 'mod_feed', '', 0), + array('module', 'mod_footer', '', 0), + array('module', 'mod_login', '', 0), + array('module', 'mod_menu', '', 0), + array('module', 'mod_articles_news', '', 0), + array('module', 'mod_random_image', '', 0), + array('module', 'mod_related_items', '', 0), + array('module', 'mod_search', '', 0), + array('module', 'mod_stats', '', 0), + array('module', 'mod_syndicate', '', 0), + array('module', 'mod_users_latest', '', 0), + array('module', 'mod_whosonline', '', 0), + array('module', 'mod_wrapper', '', 0), + array('module', 'mod_articles_category', '', 0), + array('module', 'mod_articles_categories', '', 0), + array('module', 'mod_languages', '', 0), + array('module', 'mod_tags_popular', '', 0), + array('module', 'mod_tags_similar', '', 0), - // Administrator - $extensions[] = array('module', 'mod_custom', '', 1); - $extensions[] = array('module', 'mod_feed', '', 1); - $extensions[] = array('module', 'mod_latest', '', 1); - $extensions[] = array('module', 'mod_logged', '', 1); - $extensions[] = array('module', 'mod_login', '', 1); - $extensions[] = array('module', 'mod_menu', '', 1); - $extensions[] = array('module', 'mod_popular', '', 1); - $extensions[] = array('module', 'mod_quickicon', '', 1); - $extensions[] = array('module', 'mod_stats_admin', '', 1); - $extensions[] = array('module', 'mod_status', '', 1); - $extensions[] = array('module', 'mod_submenu', '', 1); - $extensions[] = array('module', 'mod_title', '', 1); - $extensions[] = array('module', 'mod_toolbar', '', 1); - $extensions[] = array('module', 'mod_multilangstatus', '', 1); + // Administrator + array('module', 'mod_custom', '', 1), + array('module', 'mod_feed', '', 1), + array('module', 'mod_latest', '', 1), + array('module', 'mod_logged', '', 1), + array('module', 'mod_login', '', 1), + array('module', 'mod_menu', '', 1), + array('module', 'mod_popular', '', 1), + array('module', 'mod_quickicon', '', 1), + array('module', 'mod_stats_admin', '', 1), + array('module', 'mod_status', '', 1), + array('module', 'mod_submenu', '', 1), + array('module', 'mod_title', '', 1), + array('module', 'mod_toolbar', '', 1), + array('module', 'mod_multilangstatus', '', 1), - // Plug-ins - $extensions[] = array('plugin', 'gmail', 'authentication', 0); - $extensions[] = array('plugin', 'joomla', 'authentication', 0); - $extensions[] = array('plugin', 'ldap', 'authentication', 0); - $extensions[] = array('plugin', 'contact', 'content', 0); - $extensions[] = array('plugin', 'emailcloak', 'content', 0); - $extensions[] = array('plugin', 'loadmodule', 'content', 0); - $extensions[] = array('plugin', 'pagebreak', 'content', 0); - $extensions[] = array('plugin', 'pagenavigation', 'content', 0); - $extensions[] = array('plugin', 'vote', 'content', 0); - $extensions[] = array('plugin', 'codemirror', 'editors', 0); - $extensions[] = array('plugin', 'none', 'editors', 0); - $extensions[] = array('plugin', 'tinymce', 'editors', 0); - $extensions[] = array('plugin', 'article', 'editors-xtd', 0); - $extensions[] = array('plugin', 'image', 'editors-xtd', 0); - $extensions[] = array('plugin', 'pagebreak', 'editors-xtd', 0); - $extensions[] = array('plugin', 'readmore', 'editors-xtd', 0); - $extensions[] = array('plugin', 'categories', 'search', 0); - $extensions[] = array('plugin', 'contacts', 'search', 0); - $extensions[] = array('plugin', 'content', 'search', 0); - $extensions[] = array('plugin', 'newsfeeds', 'search', 0); - $extensions[] = array('plugin', 'tags', 'search', 0); - $extensions[] = array('plugin', 'languagefilter', 'system', 0); - $extensions[] = array('plugin', 'p3p', 'system', 0); - $extensions[] = array('plugin', 'cache', 'system', 0); - $extensions[] = array('plugin', 'debug', 'system', 0); - $extensions[] = array('plugin', 'log', 'system', 0); - $extensions[] = array('plugin', 'redirect', 'system', 0); - $extensions[] = array('plugin', 'remember', 'system', 0); - $extensions[] = array('plugin', 'sef', 'system', 0); - $extensions[] = array('plugin', 'logout', 'system', 0); - $extensions[] = array('plugin', 'contactcreator', 'user', 0); - $extensions[] = array('plugin', 'joomla', 'user', 0); - $extensions[] = array('plugin', 'profile', 'user', 0); - $extensions[] = array('plugin', 'joomla', 'extension', 0); - $extensions[] = array('plugin', 'joomla', 'content', 0); - $extensions[] = array('plugin', 'languagecode', 'system', 0); - $extensions[] = array('plugin', 'joomlaupdate', 'quickicon', 0); - $extensions[] = array('plugin', 'extensionupdate', 'quickicon', 0); - $extensions[] = array('plugin', 'recaptcha', 'captcha', 0); - $extensions[] = array('plugin', 'categories', 'finder', 0); - $extensions[] = array('plugin', 'contacts', 'finder', 0); - $extensions[] = array('plugin', 'content', 'finder', 0); - $extensions[] = array('plugin', 'newsfeeds', 'finder', 0); - $extensions[] = array('plugin', 'tags', 'finder', 0); - $extensions[] = array('plugin', 'totp', 'twofactorauth', 0); - $extensions[] = array('plugin', 'yubikey', 'twofactorauth', 0); - $extensions[] = array('plugin', 'nocaptcha', 'captcha', 0); + // Plug-ins + array('plugin', 'gmail', 'authentication', 0), + array('plugin', 'joomla', 'authentication', 0), + array('plugin', 'ldap', 'authentication', 0), + array('plugin', 'contact', 'content', 0), + array('plugin', 'emailcloak', 'content', 0), + array('plugin', 'loadmodule', 'content', 0), + array('plugin', 'pagebreak', 'content', 0), + array('plugin', 'pagenavigation', 'content', 0), + array('plugin', 'vote', 'content', 0), + array('plugin', 'codemirror', 'editors', 0), + array('plugin', 'none', 'editors', 0), + array('plugin', 'tinymce', 'editors', 0), + array('plugin', 'article', 'editors-xtd', 0), + array('plugin', 'image', 'editors-xtd', 0), + array('plugin', 'pagebreak', 'editors-xtd', 0), + array('plugin', 'readmore', 'editors-xtd', 0), + array('plugin', 'categories', 'search', 0), + array('plugin', 'contacts', 'search', 0), + array('plugin', 'content', 'search', 0), + array('plugin', 'newsfeeds', 'search', 0), + array('plugin', 'tags', 'search', 0), + array('plugin', 'languagefilter', 'system', 0), + array('plugin', 'p3p', 'system', 0), + array('plugin', 'cache', 'system', 0), + array('plugin', 'debug', 'system', 0), + array('plugin', 'log', 'system', 0), + array('plugin', 'redirect', 'system', 0), + array('plugin', 'remember', 'system', 0), + array('plugin', 'sef', 'system', 0), + array('plugin', 'logout', 'system', 0), + array('plugin', 'contactcreator', 'user', 0), + array('plugin', 'joomla', 'user', 0), + array('plugin', 'profile', 'user', 0), + array('plugin', 'joomla', 'extension', 0), + array('plugin', 'joomla', 'content', 0), + array('plugin', 'languagecode', 'system', 0), + array('plugin', 'joomlaupdate', 'quickicon', 0), + array('plugin', 'extensionupdate', 'quickicon', 0), + array('plugin', 'recaptcha', 'captcha', 0), + array('plugin', 'categories', 'finder', 0), + array('plugin', 'contacts', 'finder', 0), + array('plugin', 'content', 'finder', 0), + array('plugin', 'newsfeeds', 'finder', 0), + array('plugin', 'tags', 'finder', 0), + array('plugin', 'totp', 'twofactorauth', 0), + array('plugin', 'yubikey', 'twofactorauth', 0), - // Templates - $extensions[] = array('template', 'beez3', '', 0); - $extensions[] = array('template', 'hathor', '', 1); - $extensions[] = array('template', 'protostar', '', 0); - $extensions[] = array('template', 'isis', '', 1); + // Templates + array('template', 'beez3', '', 0), + array('template', 'hathor', '', 1), + array('template', 'protostar', '', 0), + array('template', 'isis', '', 1), - // Languages - $extensions[] = array('language', 'en-GB', '', 0); - $extensions[] = array('language', 'en-GB', '', 1); + // Languages + array('language', 'en-GB', '', 0), + array('language', 'en-GB', '', 1), - // Files - $extensions[] = array('file', 'joomla', '', 0); + // Files + array('file', 'joomla', '', 0), - // Packages - // None in core at this time + // Packages + // None in core at this time + ); // Attempt to refresh manifest caches $db = JFactory::getDbo(); @@ -1263,6 +1290,8 @@ public function deleteUnexistingFiles() '/administrator/components/com_config/models/fields/index.html', '/administrator/components/com_config/models/forms/application.xml', '/administrator/components/com_config/models/forms/index.html', + // Joomla 3.4.2 + '/libraries/composer_autoload.php', ); // TODO There is an issue while deleting folders using the ftp mode @@ -1374,12 +1403,10 @@ public function deleteUnexistingFiles() * Needed for updates post-3.4 * If com_weblinks doesn't exist then assume we can delete the weblinks package manifest (included in the update packages) */ - if (!JFile::exists(JPATH_ADMINISTRATOR . '/components/com_weblinks/weblinks.php')) + if (!JFile::exists(JPATH_ADMINISTRATOR . '/components/com_weblinks/weblinks.php') + && JFile::exists(JPATH_MANIFESTS . '/packages/pkg_weblinks.xml')) { - if (JFile::exists(JPATH_MANIFESTS . '/packages/pkg_weblinks.xml')) - { - JFile::delete(JPATH_MANIFESTS . '/packages/pkg_weblinks.xml'); - } + JFile::delete(JPATH_MANIFESTS . '/packages/pkg_weblinks.xml'); } } @@ -1424,21 +1451,23 @@ public function updateAssets() { $asset = JTable::getInstance('Asset'); - if (!$asset->loadByName($component)) + if ($asset->loadByName($component)) { - $asset->name = $component; - $asset->parent_id = 1; - $asset->rules = '{}'; - $asset->title = $component; - $asset->setLocation(1, 'last-child'); + continue; + } + + $asset->name = $component; + $asset->parent_id = 1; + $asset->rules = '{}'; + $asset->title = $component; + $asset->setLocation(1, 'last-child'); - if (!$asset->store()) - { - // Install failed, roll back changes - $this->parent->abort(JText::sprintf('JLIB_INSTALLER_ABORT_COMP_INSTALL_ROLLBACK', $db->stderr(true))); + if (!$asset->store()) + { + // Install failed, roll back changes + $this->parent->abort(JText::sprintf('JLIB_INSTALLER_ABORT_COMP_INSTALL_ROLLBACK', $asset->stderr(true))); - return false; - } + return false; } } diff --git a/administrator/components/com_admin/sql/updates/mysql/3.4.0-2015-02-26.sql b/administrator/components/com_admin/sql/updates/mysql/3.4.0-2015-02-26.sql index 62b0be25aef2e..da3cc8c50ab48 100644 --- a/administrator/components/com_admin/sql/updates/mysql/3.4.0-2015-02-26.sql +++ b/administrator/components/com_admin/sql/updates/mysql/3.4.0-2015-02-26.sql @@ -1,2 +1,2 @@ INSERT INTO `#__postinstall_messages` (`extension_id`, `title_key`, `description_key`, `action_key`, `language_extension`, `language_client_id`, `type`, `action_file`, `action`, `condition_file`, `condition_method`, `version_introduced`, `enabled`) VALUES -(700, 'COM_CPANEL_MSG_LANGUAGEACCESS340_TITLE', 'COM_CPANEL_MSG_LANGUAGEACCESS340_BODY', '', 'com_cpanel', 1, 'message', ', '', 'admin://components/com_admin/postinstall/languageaccess340.php', 'admin_postinstall_languageaccess340_condition', '3.4.1', 1); +(700, 'COM_CPANEL_MSG_LANGUAGEACCESS340_TITLE', 'COM_CPANEL_MSG_LANGUAGEACCESS340_BODY', '', 'com_cpanel', 1, 'message', '', '', 'admin://components/com_admin/postinstall/languageaccess340.php', 'admin_postinstall_languageaccess340_condition', '3.4.1', 1); diff --git a/administrator/components/com_admin/views/profile/tmpl/edit.php b/administrator/components/com_admin/views/profile/tmpl/edit.php index bcaab4c97df1a..7c0c9f3cfb181 100644 --- a/administrator/components/com_admin/views/profile/tmpl/edit.php +++ b/administrator/components/com_admin/views/profile/tmpl/edit.php @@ -37,7 +37,12 @@ form->getFieldset('user_details') as $field) : ?>
label; ?>
-
input; ?>
+
+ fieldname == 'password2') : ?> + + + input; ?> +
diff --git a/administrator/components/com_banners/access.xml b/administrator/components/com_banners/access.xml index 0a8b8b395e22b..7f3ace116eace 100644 --- a/administrator/components/com_banners/access.xml +++ b/administrator/components/com_banners/access.xml @@ -2,6 +2,7 @@
+ diff --git a/administrator/components/com_banners/controllers/tracks.php b/administrator/components/com_banners/controllers/tracks.php index be5feea792acb..6dce44326bf07 100644 --- a/administrator/components/com_banners/controllers/tracks.php +++ b/administrator/components/com_banners/controllers/tracks.php @@ -84,10 +84,14 @@ public function delete() { JError::raiseWarning(500, $model->getError()); } - else + elseif (count > 0) { $this->setMessage(JText::plural('COM_BANNERS_TRACKS_N_ITEMS_DELETED', $count)); } + else + { + $this->setMessage(JText::_('COM_BANNERS_TRACKS_NO_ITEMS_DELETED')); + } $this->setRedirect('index.php?option=com_banners&view=tracks'); } diff --git a/administrator/components/com_banners/models/fields/clicks.php b/administrator/components/com_banners/models/fields/clicks.php index 73aefd73f1fc5..b0aa0083c777d 100644 --- a/administrator/components/com_banners/models/fields/clicks.php +++ b/administrator/components/com_banners/models/fields/clicks.php @@ -37,7 +37,7 @@ protected function getInput() return ' ' + . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '" readonly="readonly" /> ' . JText::_('COM_BANNERS_RESET_CLICKS') . ''; } } diff --git a/administrator/components/com_banners/models/fields/impmade.php b/administrator/components/com_banners/models/fields/impmade.php index 38fcafdea8a34..a45d38f8bfb19 100644 --- a/administrator/components/com_banners/models/fields/impmade.php +++ b/administrator/components/com_banners/models/fields/impmade.php @@ -37,7 +37,7 @@ protected function getInput() return ' ' + . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '" readonly="readonly" /> ' . JText::_('COM_BANNERS_RESET_IMPMADE') . ''; } } diff --git a/administrator/components/com_banners/models/forms/client.xml b/administrator/components/com_banners/models/forms/client.xml index 2cb0d4f932ed9..7b51b671b8222 100644 --- a/administrator/components/com_banners/models/forms/client.xml +++ b/administrator/components/com_banners/models/forms/client.xml @@ -63,7 +63,7 @@ label="COM_BANNERS_FIELD_TRACKIMPRESSION_LABEL" description="COM_BANNERS_FIELD_TRACKIMPRESSION_DESC" > - + @@ -72,7 +72,7 @@ class="chzn-color" label="COM_BANNERS_FIELD_TRACKCLICK_LABEL" description="COM_BANNERS_FIELD_TRACKCLICK_DESC" > - + diff --git a/administrator/components/com_banners/models/forms/filter_banners.xml b/administrator/components/com_banners/models/forms/filter_banners.xml index a50dc10142c81..9fd0528f1ae43 100644 --- a/administrator/components/com_banners/models/forms/filter_banners.xml +++ b/administrator/components/com_banners/models/forms/filter_banners.xml @@ -5,6 +5,7 @@ name="search" type="text" label="COM_BANNERS_SEARCH_IN_TITLE" + description="COM_BANNERS_SEARCH_IN_TITLE" hint="JSEARCH_FILTER" class="js-stools-search-string" /> @@ -17,16 +18,6 @@ > - - - JOPTION_SELECT_LANGUAGE + + + diff --git a/administrator/components/com_banners/views/banners/tmpl/default.php b/administrator/components/com_banners/views/banners/tmpl/default.php index e6e0bcd731c57..4ff00bce05017 100644 --- a/administrator/components/com_banners/views/banners/tmpl/default.php +++ b/administrator/components/com_banners/views/banners/tmpl/default.php @@ -110,7 +110,7 @@ } ?> - + + + authorise('core.create', 'com_banners') + && $user->authorise('core.edit', 'com_banners') + && $user->authorise('core.edit.state', 'com_banners')) : ?> + JText::_('COM_BANNERS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + - - loadTemplate('batch'); ?> diff --git a/administrator/components/com_banners/views/banners/tmpl/default_batch.php b/administrator/components/com_banners/views/banners/tmpl/default_batch.php index 950ab70184623..2c7ac73742556 100644 --- a/administrator/components/com_banners/views/banners/tmpl/default_batch.php +++ b/administrator/components/com_banners/views/banners/tmpl/default_batch.php @@ -5,6 +5,8 @@ * * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt + * + * @deprecated 3.4 Use default_batch_body and default_batch_footer */ defined('_JEXEC') or die; diff --git a/administrator/components/com_banners/views/banners/tmpl/default_batch_body.php b/administrator/components/com_banners/views/banners/tmpl/default_batch_body.php new file mode 100644 index 0000000000000..708673688cb96 --- /dev/null +++ b/administrator/components/com_banners/views/banners/tmpl/default_batch_body.php @@ -0,0 +1,36 @@ +state->get('filter.published'); +?> + +

+
+
+
+ +
+
+
+
+ +
+
+
+
+ = 0) : ?> +
+
+ +
+
+ +
diff --git a/administrator/components/com_banners/views/banners/tmpl/default_batch_footer.php b/administrator/components/com_banners/views/banners/tmpl/default_batch_footer.php new file mode 100644 index 0000000000000..6082476dd8eda --- /dev/null +++ b/administrator/components/com_banners/views/banners/tmpl/default_batch_footer.php @@ -0,0 +1,17 @@ + + + diff --git a/administrator/components/com_banners/views/banners/view.html.php b/administrator/components/com_banners/views/banners/view.html.php index 12e629489f6d7..1c39175a2e22a 100644 --- a/administrator/components/com_banners/views/banners/view.html.php +++ b/administrator/components/com_banners/views/banners/view.html.php @@ -122,7 +122,6 @@ protected function addToolbar() && $user->authorise('core.edit', 'com_banners') && $user->authorise('core.edit.state', 'com_banners')) { - JHtml::_('bootstrap.modal', 'collapseModal'); $title = JText::_('JTOOLBAR_BATCH'); // Instantiate a new JLayoutFile instance and render the batch button @@ -141,7 +140,7 @@ protected function addToolbar() JToolbarHelper::trash('banners.trash'); } - if ($user->authorise('core.admin', 'com_banners')) + if ($user->authorise('core.admin', 'com_banners') || $user->authorise('core.options', 'com_banners')) { JToolbarHelper::preferences('com_banners'); } diff --git a/administrator/components/com_banners/views/client/tmpl/edit.php b/administrator/components/com_banners/views/client/tmpl/edit.php index 7f5d66703398e..e5fe8aa5a39dd 100644 --- a/administrator/components/com_banners/views/client/tmpl/edit.php +++ b/administrator/components/com_banners/views/client/tmpl/edit.php @@ -13,19 +13,17 @@ JHtml::_('behavior.formvalidator'); JHtml::_('formbehavior.chosen', 'select'); -JFactory::getDocument()->addScriptDeclaration(' +JFactory::getDocument()->addScriptDeclaration( + ' Joomla.submitbutton = function(task) { if (task == "client.cancel" || document.formvalidator.isValid(document.getElementById("client-form"))) { Joomla.submitform(task, document.getElementById("client-form")); } - }; -'); + };' +); ?> -
diff --git a/administrator/components/com_banners/views/clients/view.html.php b/administrator/components/com_banners/views/clients/view.html.php index d43717bd02c61..b109f766a6f8d 100644 --- a/administrator/components/com_banners/views/clients/view.html.php +++ b/administrator/components/com_banners/views/clients/view.html.php @@ -94,7 +94,7 @@ protected function addToolbar() JToolbarHelper::trash('clients.trash'); } - if ($canDo->get('core.admin')) + if ($canDo->get('core.admin') || $canDo->get('core.options')) { JToolbarHelper::preferences('com_banners'); } diff --git a/administrator/components/com_banners/views/tracks/tmpl/default.php b/administrator/components/com_banners/views/tracks/tmpl/default.php index 0305edfa0dce5..8eff96676d277 100644 --- a/administrator/components/com_banners/views/tracks/tmpl/default.php +++ b/administrator/components/com_banners/views/tracks/tmpl/default.php @@ -20,7 +20,8 @@ $listDirn = $this->escape($this->state->get('list.direction')); $sortFields = $this->getSortFields(); -JFactory::getDocument()->addScriptDeclaration(' +JFactory::getDocument()->addScriptDeclaration( + ' Joomla.orderTable = function() { table = document.getElementById("sortTable"); @@ -40,12 +41,9 @@ Joomla.closeModalDialog = function() { window.jQuery("#modal-download").modal("hide"); - }; -'); + };' +); ?> -
sidebar; ?> diff --git a/administrator/components/com_banners/views/tracks/view.html.php b/administrator/components/com_banners/views/tracks/view.html.php index fd6f7c7e67a8e..a8b719d240426 100644 --- a/administrator/components/com_banners/views/tracks/view.html.php +++ b/administrator/components/com_banners/views/tracks/view.html.php @@ -78,7 +78,7 @@ protected function addToolbar() JToolbarHelper::divider(); } - if ($canDo->get('core.admin')) + if ($canDo->get('core.admin') || $canDo->get('core.options')) { JToolbarHelper::preferences('com_banners'); JToolbarHelper::divider(); diff --git a/administrator/components/com_categories/models/category.php b/administrator/components/com_categories/models/category.php index d45068cf63f12..f5b866c09cafc 100644 --- a/administrator/components/com_categories/models/category.php +++ b/administrator/components/com_categories/models/category.php @@ -309,11 +309,25 @@ protected function getReorderConditions($table) protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_categories.edit.' . $this->getName() . '.data', array()); + $app = JFactory::getApplication(); + $data = $app->getUserState('com_categories.edit.' . $this->getName() . '.data', array()); if (empty($data)) { $data = $this->getItem(); + + // Pre-select some filters (Status, Language, Access) in edit form if those have been selected in Category Manager + if (!$data->id) + { + // Check for which extension the Category Manager is used and get selected fields + $extension = substr($app->getUserState('com_categories.categories.filter.extension'), 4); + $filters = (array) $app->getUserState('com_categories.categories.' . $extension . '.filter'); + + $data->set('published', $app->input->getInt('published', (isset($filters['published']) ? $filters['published'] : null))); + $data->set('language', $app->input->getString('language', (isset($filters['language']) ? $filters['language'] : null))); + $data->set('access', $app->input->getInt('access', (isset($filters['access']) ? $filters['access'] : null))); + } + } $this->preprocessData('com_categories.category', $data); diff --git a/administrator/components/com_categories/models/fields/modal/category.php b/administrator/components/com_categories/models/fields/modal/category.php index 0e91e570e127e..d3f299f2592e7 100644 --- a/administrator/components/com_categories/models/fields/modal/category.php +++ b/administrator/components/com_categories/models/fields/modal/category.php @@ -48,9 +48,6 @@ protected function getInput() // Load language JFactory::getLanguage()->load('com_categories', JPATH_ADMINISTRATOR); - // Load the modal behavior script. - JHtml::_('behavior.modal', 'a.modal'); - // Build the script. $script = array(); @@ -69,7 +66,7 @@ protected function getInput() $script[] = ' jQuery("#' . $this->id . '_clear").removeClass("hidden");'; } - $script[] = ' jModalClose();'; + $script[] = ' jQuery("#modalCategory-' . $this->id . '").modal("hide");'; $script[] = ' }'; // Clear button script @@ -143,12 +140,10 @@ protected function getInput() // The current category display field. $html[] = ''; $html[] = ''; - $html[] = '' - . ' ' . JText::_('JSELECT') + $html[] = '' + . ' ' . JText::_('JSELECT') . ''; // Edit category button @@ -161,6 +156,19 @@ protected function getInput() . ' title="' . JHtml::tooltipText('COM_CATEGORIES_EDIT_CATEGORY') . '" >' . '' . JText::_('JACTION_EDIT') . ''; + + $html[] = JHtml::_( + 'bootstrap.renderModal', + 'modalCategory-' . $this->id, + array( + 'url' => $link . '&' . JSession::getFormToken() . '=1"', + 'title' => JText::_('COM_CATEGORIES_SELECT_A_CATEGORY'), + 'width' => '800px', + 'height' => '300px', + 'footer' => '' + ) + ); } // Clear category button diff --git a/administrator/components/com_categories/models/forms/category.xml b/administrator/components/com_categories/models/forms/category.xml index 2d43800aa644a..cefc7e7369dc9 100644 --- a/administrator/components/com_categories/models/forms/category.xml +++ b/administrator/components/com_categories/models/forms/category.xml @@ -85,8 +85,8 @@ diff --git a/administrator/components/com_categories/models/forms/filter_categories.xml b/administrator/components/com_categories/models/forms/filter_categories.xml index 8719aa3b32e2f..cd19fee3d359f 100644 --- a/administrator/components/com_categories/models/forms/filter_categories.xml +++ b/administrator/components/com_categories/models/forms/filter_categories.xml @@ -8,19 +8,6 @@ hint="JSEARCH_FILTER" class="js-stools-search-string" /> - - - + + + - + @@ -189,9 +189,21 @@ + + authorise('core.create', $extension) + && $user->authorise('core.edit', $extension) + && $user->authorise('core.edit.state', $extension)) : ?> + JText::_('COM_CATEGORIES_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + - - loadTemplate('batch'); ?> diff --git a/administrator/components/com_categories/views/categories/tmpl/default_batch.php b/administrator/components/com_categories/views/categories/tmpl/default_batch.php index 2fc255baaa83a..4cf5a49231163 100644 --- a/administrator/components/com_categories/views/categories/tmpl/default_batch.php +++ b/administrator/components/com_categories/views/categories/tmpl/default_batch.php @@ -5,6 +5,8 @@ * * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt + * + * @deprecated 3.4 Use default_batch_body and default_batch_footer */ defined('_JEXEC') or die; diff --git a/administrator/templates/hathor/html/com_categories/categories/default_batch.php b/administrator/components/com_categories/views/categories/tmpl/default_batch_body.php similarity index 55% rename from administrator/templates/hathor/html/com_categories/categories/default_batch.php rename to administrator/components/com_categories/views/categories/tmpl/default_batch_body.php index e672b6828da51..8a7b6427a48c2 100644 --- a/administrator/templates/hathor/html/com_categories/categories/default_batch.php +++ b/administrator/components/com_categories/views/categories/tmpl/default_batch_body.php @@ -6,9 +6,10 @@ * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ - defined('_JEXEC') or die; +JHtml::_('formbehavior.chosen', 'select'); + $options = array( JHtml::_('select.option', 'c', JText::_('JLIB_HTML_BATCH_COPY')), JHtml::_('select.option', 'm', JText::_('JLIB_HTML_BATCH_MOVE')) @@ -16,30 +17,27 @@ $published = $this->state->get('filter.published'); $extension = $this->escape($this->state->get('filter.extension')); ?> -
- - + +
diff --git a/administrator/components/com_installer/views/updatesites/tmpl/default.php b/administrator/components/com_installer/views/updatesites/tmpl/default.php index cd1183349960f..dac0c514d501d 100644 --- a/administrator/components/com_installer/views/updatesites/tmpl/default.php +++ b/administrator/components/com_installer/views/updatesites/tmpl/default.php @@ -35,8 +35,8 @@
- - + +
diff --git a/administrator/components/com_joomlaupdate/access.xml b/administrator/components/com_joomlaupdate/access.xml index caa29f7a51d8b..c8c9f3dd739df 100644 --- a/administrator/components/com_joomlaupdate/access.xml +++ b/administrator/components/com_joomlaupdate/access.xml @@ -2,6 +2,7 @@
+ diff --git a/administrator/components/com_joomlaupdate/views/default/view.html.php b/administrator/components/com_joomlaupdate/views/default/view.html.php index bb4199c406b53..aaa8a955ea606 100644 --- a/administrator/components/com_joomlaupdate/views/default/view.html.php +++ b/administrator/components/com_joomlaupdate/views/default/view.html.php @@ -44,7 +44,9 @@ public function display($tpl = null) JToolbarHelper::custom('update.purge', 'purge', 'purge', 'JTOOLBAR_PURGE_CACHE', false, false); // Add toolbar buttons. - if (JFactory::getUser()->authorise('core.admin', 'com_joomlaupdate')) + $user = JFactory::getUser(); + + if ($user->authorise('core.admin', 'com_joomlaupdate') || $user->authorise('core.options', 'com_joomlaupdate')) { JToolbarHelper::preferences('com_joomlaupdate'); } diff --git a/administrator/components/com_joomlaupdate/views/update/view.html.php b/administrator/components/com_joomlaupdate/views/update/view.html.php index f171dea628ea9..014be8739430e 100644 --- a/administrator/components/com_joomlaupdate/views/update/view.html.php +++ b/administrator/components/com_joomlaupdate/views/update/view.html.php @@ -36,7 +36,9 @@ public function display($tpl=null) JToolBarHelper::help('JHELP_COMPONENTS_JOOMLA_UPDATE'); // Add toolbar buttons. - if (JFactory::getUser()->authorise('core.admin', 'com_joomlaupdate')) + $user = JFactory::getUser(); + + if ($user->authorise('core.admin', 'com_joomlaupdate') || $user->authorise('core.options', 'com_joomlaupdate')) { JToolbarHelper::preferences('com_joomlaupdate'); } diff --git a/administrator/components/com_languages/languages.php b/administrator/components/com_languages/languages.php index fd622e6f17152..972e6bfc6a52d 100644 --- a/administrator/components/com_languages/languages.php +++ b/administrator/components/com_languages/languages.php @@ -15,6 +15,6 @@ return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); } -$controller = JControllerLegacy::getInstance('Languages'); +$controller = JControllerLegacy::getInstance('Languages'); $controller->execute(JFactory::getApplication()->input->get('task')); $controller->redirect(); diff --git a/administrator/components/com_languages/models/installed.php b/administrator/components/com_languages/models/installed.php index 9c9dd8e22bc80..267dff1ddeb88 100644 --- a/administrator/components/com_languages/models/installed.php +++ b/administrator/components/com_languages/models/installed.php @@ -189,6 +189,12 @@ public function getData() $row->$key = $value; } + // Fix wrongly set parentheses in RTL languages + if (JFactory::getLanguage()->isRTL()) + { + $row->name = html_entity_decode($row->name . '‎', ENT_QUOTES, 'UTF-8'); + } + // If current than set published. $params = JComponentHelper::getParams('com_languages'); diff --git a/administrator/components/com_languages/views/language/tmpl/edit.php b/administrator/components/com_languages/views/language/tmpl/edit.php index d3972115cb575..52b11137c4f99 100644 --- a/administrator/components/com_languages/views/language/tmpl/edit.php +++ b/administrator/components/com_languages/views/language/tmpl/edit.php @@ -14,7 +14,8 @@ JHtml::_('behavior.formvalidator'); JHtml::_('formbehavior.chosen', 'select'); -JFactory::getDocument()->addScriptDeclaration(' +JFactory::getDocument()->addScriptDeclaration( + ' Joomla.submitbutton = function(task) { if (task == "language.cancel" || document.formvalidator.isValid(document.getElementById("language-form"))) @@ -22,7 +23,21 @@ Joomla.submitform(task, document.getElementById("language-form")); } }; -'); + + jQuery(document).ready(function() { + jQuery("#jform_image").on("change", function() { + var flag = this.value; + if (!jQuery("#flag img").attr("src")) { + jQuery("#flag img").attr("src", "' . JUri::root(true) . '" + "/media/mod_languages/images/" + flag + ".gif"); + } else { + jQuery("#flag img").attr("src", function(index, attr) { + return attr.replace(jQuery("#flag img").attr("title") + ".gif", flag + ".gif") + }) + } + jQuery("#flag img").attr("title", flag).attr("alt", flag); + }); +});' +); ?> @@ -70,19 +85,3 @@ - diff --git a/administrator/components/com_languages/views/languages/tmpl/default.php b/administrator/components/com_languages/views/languages/tmpl/default.php index 57428581b4af0..8020a5ae6eb71 100644 --- a/administrator/components/com_languages/views/languages/tmpl/default.php +++ b/administrator/components/com_languages/views/languages/tmpl/default.php @@ -64,8 +64,8 @@
- - + +
@@ -97,7 +97,7 @@ - ', 'a.ordering', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + ', 'a.ordering', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> @@ -157,12 +157,12 @@ $disableClassName = 'inactive tip-top'; endif; ?> - + - + diff --git a/administrator/components/com_languages/views/multilangstatus/tmpl/default.php b/administrator/components/com_languages/views/multilangstatus/tmpl/default.php index 81284bf998a27..1a7e979225e1e 100644 --- a/administrator/components/com_languages/views/multilangstatus/tmpl/default.php +++ b/administrator/components/com_languages/views/multilangstatus/tmpl/default.php @@ -26,7 +26,7 @@ - + @@ -36,7 +36,7 @@ - + @@ -46,7 +46,7 @@ - + @@ -57,7 +57,7 @@ lang_code, $this->homepages) && (!array_key_exists($contentlang->lang_code, $this->site_langs) || !$contentlang->published)) : ?> - + lang_code); ?> @@ -67,7 +67,7 @@ lang_code, $this->site_langs)) : ?> - + lang_code); ?> @@ -78,7 +78,7 @@ listUsersError) : ?> - + @@ -176,7 +176,7 @@ element) : // Published Site languages ?> - + @@ -185,20 +185,20 @@ lang_code && $status->published) : // Published Content languages ?> - + - + home_language) : // Published Home pages ?> - + - + @@ -210,22 +210,22 @@ lang_code; ?> - + published) : ?> - + published && array_key_exists($contentlang->lang_code, $this->homepages)) : ?> - + published) : ?> - + lang_code, $this->homepages)) : ?> - + - + diff --git a/administrator/components/com_languages/views/overrides/tmpl/default.php b/administrator/components/com_languages/views/overrides/tmpl/default.php index a92c03007e6f6..27b7275ae8f05 100644 --- a/administrator/components/com_languages/views/overrides/tmpl/default.php +++ b/administrator/components/com_languages/views/overrides/tmpl/default.php @@ -32,8 +32,8 @@
- - + +
diff --git a/administrator/components/com_media/access.xml b/administrator/components/com_media/access.xml index cee9d758a3938..d4b0fee8c6fcc 100644 --- a/administrator/components/com_media/access.xml +++ b/administrator/components/com_media/access.xml @@ -2,6 +2,7 @@
+ diff --git a/administrator/components/com_media/layouts/toolbar/deletemedia.php b/administrator/components/com_media/layouts/toolbar/deletemedia.php index 1212587492dea..6cbb440969ea6 100644 --- a/administrator/components/com_media/layouts/toolbar/deletemedia.php +++ b/administrator/components/com_media/layouts/toolbar/deletemedia.php @@ -12,5 +12,5 @@ $title = JText::_('JTOOLBAR_DELETE'); ?> diff --git a/administrator/components/com_media/layouts/toolbar/newfolder.php b/administrator/components/com_media/layouts/toolbar/newfolder.php index 9039cc4b41938..30077a2b111d1 100644 --- a/administrator/components/com_media/layouts/toolbar/newfolder.php +++ b/administrator/components/com_media/layouts/toolbar/newfolder.php @@ -12,5 +12,5 @@ $title = JText::_('COM_MEDIA_CREATE_NEW_FOLDER'); ?> diff --git a/administrator/components/com_media/layouts/toolbar/uploadmedia.php b/administrator/components/com_media/layouts/toolbar/uploadmedia.php index d27404b21ce0a..fabd39b812e86 100644 --- a/administrator/components/com_media/layouts/toolbar/uploadmedia.php +++ b/administrator/components/com_media/layouts/toolbar/uploadmedia.php @@ -12,5 +12,5 @@ $title = JText::_('JTOOLBAR_UPLOAD'); ?> diff --git a/administrator/components/com_media/models/list.php b/administrator/components/com_media/models/list.php index 71c3a7c520b7d..ec76241c41227 100644 --- a/administrator/components/com_media/models/list.php +++ b/administrator/components/com_media/models/list.php @@ -108,28 +108,15 @@ public function getList() } // Get current path from request - $current = $this->getState('folder'); + $current = (string) $this->getState('folder'); - // If undefined, set to empty - if ($current == 'undefined') - { - $current = ''; - } - - if (strlen($current) > 0) - { - $basePath = COM_MEDIA_BASE . '/' . $current; - } - else - { - $basePath = COM_MEDIA_BASE; - } + $basePath = COM_MEDIA_BASE . ((strlen($current) > 0) ? '/' . $current : ''); $mediaBase = str_replace(DIRECTORY_SEPARATOR, '/', COM_MEDIA_BASE . '/'); - $images = array (); - $folders = array (); - $docs = array (); + $images = array (); + $folders = array (); + $docs = array (); $fileList = false; $folderList = false; diff --git a/administrator/components/com_media/views/images/tmpl/default.php b/administrator/components/com_media/views/images/tmpl/default.php index b4b78ae32d95e..0c0a14ed8925e 100644 --- a/administrator/components/com_media/views/images/tmpl/default.php +++ b/administrator/components/com_media/views/images/tmpl/default.php @@ -16,11 +16,14 @@ $user = JFactory::getUser(); $input = JFactory::getApplication()->input; +$params = JComponentHelper::getParams('com_media'); + +JFactory::getDocument()->addScriptDeclaration( + " + var image_base_path = '" . $params->get('image_path', 'images') . "/'; + " +); ?> -
- +

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/imageslist/tmpl/default_folder.php b/administrator/components/com_media/views/imageslist/tmpl/default_folder.php index 1bdaec0e35b87..435283b8270cc 100644 --- a/administrator/components/com_media/views/imageslist/tmpl/default_folder.php +++ b/administrator/components/com_media/views/imageslist/tmpl/default_folder.php @@ -14,7 +14,7 @@
  • - +
    _tmp_folder->name, 10, false); ?> diff --git a/administrator/components/com_media/views/media/tmpl/default.php b/administrator/components/com_media/views/media/tmpl/default.php index eabdffab02be2..88d70fc5dbc9b 100644 --- a/administrator/components/com_media/views/media/tmpl/default.php +++ b/administrator/components/com_media/views/media/tmpl/default.php @@ -52,7 +52,7 @@
    - +

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

    @@ -66,7 +66,7 @@ - +
    diff --git a/administrator/components/com_media/views/media/tmpl/default_folders.php b/administrator/components/com_media/views/media/tmpl/default_folders.php index 9ca3f3685cbac..68f6e7f811c0a 100644 --- a/administrator/components/com_media/views/media/tmpl/default_folders.php +++ b/administrator/components/com_media/views/media/tmpl/default_folders.php @@ -19,7 +19,7 @@ // Get a sanitised name for the target $target = str_replace('/', '-', $folder['data']->relative); ?>
  • - + name; ?> diff --git a/administrator/components/com_media/views/media/tmpl/default_navigation.php b/administrator/components/com_media/views/media/tmpl/default_navigation.php index 7a5a9c9776b58..176cfe31d4b62 100644 --- a/administrator/components/com_media/views/media/tmpl/default_navigation.php +++ b/administrator/components/com_media/views/media/tmpl/default_navigation.php @@ -13,7 +13,7 @@ ?> diff --git a/administrator/components/com_media/views/media/view.html.php b/administrator/components/com_media/views/media/view.html.php index 9b86558ef33de..9568f3eb9fbb2 100644 --- a/administrator/components/com_media/views/media/view.html.php +++ b/administrator/components/com_media/views/media/view.html.php @@ -46,7 +46,7 @@ public function display($tpl = null) JHtml::_('behavior.framework', true); - JHtml::_('script', 'media/mediamanager.js', true, true); + JHtml::_('script', 'media/mediamanager.min.js', true, true); JHtml::_('behavior.modal'); $document->addScriptDeclaration(" @@ -149,7 +149,7 @@ protected function addToolbar() } // Add a preferences button - if ($user->authorise('core.admin', 'com_media')) + if ($user->authorise('core.admin', 'com_media') || $user->authorise('core.options', 'com_media')) { JToolbarHelper::preferences('com_media'); JToolbarHelper::divider(); diff --git a/administrator/components/com_media/views/medialist/tmpl/details.php b/administrator/components/com_media/views/medialist/tmpl/details.php index b74d4bda2bc5f..a0e6cf657f774 100644 --- a/administrator/components/com_media/views/medialist/tmpl/details.php +++ b/administrator/components/com_media/views/medialist/tmpl/details.php @@ -15,7 +15,7 @@

    - + state->folder != '') : ?> get($path, 'images') . '/' . $this->state->folder; ?> diff --git a/administrator/components/com_media/views/medialist/tmpl/details_doc.php b/administrator/components/com_media/views/medialist/tmpl/details_doc.php index 1fe5ee594ad29..a608c6014f6b9 100644 --- a/administrator/components/com_media/views/medialist/tmpl/details_doc.php +++ b/administrator/components/com_media/views/medialist/tmpl/details_doc.php @@ -33,7 +33,7 @@ authorise('core.delete', 'com_media')):?> - + diff --git a/administrator/components/com_media/views/medialist/tmpl/details_folder.php b/administrator/components/com_media/views/medialist/tmpl/details_folder.php index 556b387cbde4c..a76016dd70c0d 100644 --- a/administrator/components/com_media/views/medialist/tmpl/details_folder.php +++ b/administrator/components/com_media/views/medialist/tmpl/details_folder.php @@ -15,7 +15,7 @@ - + _tmp_folder->name; ?> @@ -28,7 +28,7 @@ authorise('core.delete', 'com_media')):?> - + diff --git a/administrator/components/com_media/views/medialist/tmpl/details_img.php b/administrator/components/com_media/views/medialist/tmpl/details_img.php index 916ff728f8219..d5cf918920992 100644 --- a/administrator/components/com_media/views/medialist/tmpl/details_img.php +++ b/administrator/components/com_media/views/medialist/tmpl/details_img.php @@ -33,7 +33,7 @@ authorise('core.delete', 'com_media')):?> - + diff --git a/administrator/components/com_media/views/medialist/tmpl/details_up.php b/administrator/components/com_media/views/medialist/tmpl/details_up.php index 9a0cb96c94259..eaa869b6311dd 100644 --- a/administrator/components/com_media/views/medialist/tmpl/details_up.php +++ b/administrator/components/com_media/views/medialist/tmpl/details_up.php @@ -15,7 +15,7 @@ - + .. diff --git a/administrator/components/com_media/views/medialist/tmpl/thumbs.php b/administrator/components/com_media/views/medialist/tmpl/thumbs.php index 20b192040d6ba..1adc972dfeab2 100644 --- a/administrator/components/com_media/views/medialist/tmpl/thumbs.php +++ b/administrator/components/com_media/views/medialist/tmpl/thumbs.php @@ -14,7 +14,7 @@

    - + state->folder != '') : ?> get($path, 'images') . '/' . $this->state->folder; ?> diff --git a/administrator/components/com_media/views/medialist/tmpl/thumbs_folder.php b/administrator/components/com_media/views/medialist/tmpl/thumbs_folder.php index 74023c6ac0a87..1164a7bf686dc 100644 --- a/administrator/components/com_media/views/medialist/tmpl/thumbs_folder.php +++ b/administrator/components/com_media/views/medialist/tmpl/thumbs_folder.php @@ -18,7 +18,7 @@

    diff --git a/administrator/components/com_media/views/medialist/tmpl/thumbs_up.php b/administrator/components/com_media/views/medialist/tmpl/thumbs_up.php index 932ffa3911ebf..00b213e31d303 100644 --- a/administrator/components/com_media/views/medialist/tmpl/thumbs_up.php +++ b/administrator/components/com_media/views/medialist/tmpl/thumbs_up.php @@ -14,7 +14,7 @@
    - +
    diff --git a/administrator/components/com_menus/access.xml b/administrator/components/com_menus/access.xml index 64347dc3abd11..c59379a6f704b 100644 --- a/administrator/components/com_menus/access.xml +++ b/administrator/components/com_menus/access.xml @@ -2,6 +2,7 @@
    + diff --git a/administrator/components/com_menus/controller.php b/administrator/components/com_menus/controller.php index 509d37a054bbe..9fc4bff6e03ec 100644 --- a/administrator/components/com_menus/controller.php +++ b/administrator/components/com_menus/controller.php @@ -30,10 +30,6 @@ public function display($cachable = false, $urlparams = false) { require_once JPATH_COMPONENT . '/helpers/menus.php'; - $view = $this->input->get('view', 'menus'); - $layout = $this->input->get('layout', 'default'); - $id = $this->input->getInt('id'); - parent::display(); return $this; diff --git a/administrator/components/com_menus/helpers/html/menus.php b/administrator/components/com_menus/helpers/html/menus.php index b0bec2660fa0a..98fcaff18baf7 100644 --- a/administrator/components/com_menus/helpers/html/menus.php +++ b/administrator/components/com_menus/helpers/html/menus.php @@ -108,7 +108,7 @@ public static function state($value, $i, $enabled = true, $checkbox = 'cb') '', 'COM_MENUS_HTML_UNPUBLISH_HEADING', '', - false, + true, 'publish', 'publish' ), @@ -117,7 +117,7 @@ public static function state($value, $i, $enabled = true, $checkbox = 'cb') '', 'COM_MENUS_HTML_PUBLISH_HEADING', '', - false, + true, 'unpublish', 'unpublish' ), @@ -126,7 +126,7 @@ public static function state($value, $i, $enabled = true, $checkbox = 'cb') '', 'COM_MENUS_HTML_UNPUBLISH_SEPARATOR', '', - false, + true, 'publish', 'publish' ), @@ -135,7 +135,7 @@ public static function state($value, $i, $enabled = true, $checkbox = 'cb') '', 'COM_MENUS_HTML_PUBLISH_SEPARATOR', '', - false, + true, 'unpublish', 'unpublish' ), @@ -144,7 +144,7 @@ public static function state($value, $i, $enabled = true, $checkbox = 'cb') '', 'COM_MENUS_HTML_UNPUBLISH_ALIAS', '', - false, + true, 'publish', 'publish' ), @@ -153,7 +153,7 @@ public static function state($value, $i, $enabled = true, $checkbox = 'cb') '', 'COM_MENUS_HTML_PUBLISH_ALIAS', '', - false, + true, 'unpublish', 'unpublish' ), @@ -162,7 +162,7 @@ public static function state($value, $i, $enabled = true, $checkbox = 'cb') '', 'COM_MENUS_HTML_UNPUBLISH_URL', '', - false, + true, 'publish', 'publish' ), @@ -171,7 +171,7 @@ public static function state($value, $i, $enabled = true, $checkbox = 'cb') '', 'COM_MENUS_HTML_PUBLISH_URL', '', - false, + true, 'unpublish', 'unpublish' ), @@ -208,8 +208,17 @@ public static function state($value, $i, $enabled = true, $checkbox = 'cb') 'COM_MENUS_HTML_PUBLISH_DISABLED', 'COM_MENUS_EXTENSION_UNPUBLISHED_DISABLED', true, - 'unpublish', - 'unpublish' + 'trash', + 'trash' + ), + -3 => array( + 'publish', + '', + 'COM_MENUS_HTML_PUBLISH', + '', + true, + 'trash', + 'trash' ), ); diff --git a/administrator/components/com_menus/models/fields/menutype.php b/administrator/components/com_menus/models/fields/menutype.php index 9037cb7d81f5f..f51bac82af779 100644 --- a/administrator/components/com_menus/models/fields/menutype.php +++ b/administrator/components/com_menus/models/fields/menutype.php @@ -70,19 +70,34 @@ protected function getInput() $value = JText::_(JArrayHelper::getValue($rlu, MenusHelper::getLinkKey($link))); break; } - // Load the javascript and css - JHtml::_('behavior.framework'); - JHtml::_('behavior.modal'); + // Include jQuery + JHtml::_('jquery.framework'); - $getMenuTypesUrl = 'index.php?option=com_menus&view=menutypes&tmpl=component&recordId=' . $recordId; - $html[] = '' - . '' - . '' - . ' ' . JText::_('JSELECT') - . ''; - $html[] = ''; + // Add the script to the document head. + JFactory::getDocument()->addScriptDeclaration(' + function jSelectPosition_' . $this->id . '(name) { + document.getElementById("' . $this->id . '").value = name; + } + '); + + $link = JRoute::_('index.php?option=com_menus&view=menutypes&tmpl=component&recordId=' . $recordId); + $html[] = ''; + $html[] = '' + . ' ' + . JText::_('JSELECT') . ''; + $html[] = JHtml::_( + 'bootstrap.renderModal', + 'menuTypeModal', + array( + 'url' => $link, + 'title' => JText::_('COM_MENUS_ITEM_FIELD_TYPE_LABEL'), + 'width' => '800px', + 'height' => '300px', + 'footer' => '' + ) + ); + $html[] = ''; return implode("\n", $html); } diff --git a/administrator/components/com_menus/models/forms/filter_items.xml b/administrator/components/com_menus/models/forms/filter_items.xml index 89611b052b238..8f4ec675b1fdd 100644 --- a/administrator/components/com_menus/models/forms/filter_items.xml +++ b/administrator/components/com_menus/models/forms/filter_items.xml @@ -12,31 +12,20 @@ name="search" type="text" label="COM_MENUS_FILTER_SEARCH_DESC" + description="COM_MENUS_ITEMS_SEARCH_FILTER" hint="JSEARCH_FILTER" class="js-stools-search-string" /> - - - JOPTION_SELECT_LANGUAGE + + + getItem(), (array) JFactory::getApplication()->getUserState('com_menus.edit.item.data', array())); + // For a new menu item, pre-select some filters (Status, Language, Access) in edit form if those have been selected in Menu Manager + if ($this->getItem()->id == 0) + { + // Get selected fields + $filters = JFactory::getApplication()->getUserState('com_menus.items.filter'); + $data['published'] = (isset($filters['published']) ? $filters['published'] : null); + $data['language'] = (isset($filters['language']) ? $filters['language'] : null); + $data['access'] = (isset($filters['access']) ? $filters['access'] : null); + } + $this->preprocessData('com_menus.item', $data); return $data; @@ -904,9 +914,6 @@ protected function preprocessForm(JForm $form, $data, $group = 'content') $base = JPATH_SITE . '/components/' . $option; } - // Confirm a view is defined. - $formFile = false; - if (isset($args['view'])) { $view = $args['view']; @@ -921,8 +928,6 @@ protected function preprocessForm(JForm $form, $data, $group = 'content') $layout = 'default'; } - $formFile = false; - // Check for the layout XML file. Use standard xml file if it exists. $tplFolders = array( $base . '/views/' . $view . '/tmpl', @@ -1023,26 +1028,6 @@ protected function preprocessForm(JForm $form, $data, $group = 'content') $this->helpLocal = (($helpLoc == 'true') || ($helpLoc == '1') || ($helpLoc == 'local')) ? true : false; } - // Now load the component params. - // TODO: Work out why 'fixing' this breaks JForm - if ($isNew = false) - { - $path = JPath::clean(JPATH_ADMINISTRATOR . '/components/' . $option . '/config.xml'); - } - else - { - $path = 'null'; - } - - if (is_file($path)) - { - // Add the component params last of all to the existing form. - if (!$form->load($path, true, '/config')) - { - throw new Exception(JText::_('JERROR_LOADFILE_FAILED')); - } - } - // Load the specific type file if (!$form->loadFile('item_' . $type, false, false)) { diff --git a/administrator/components/com_menus/models/items.php b/administrator/components/com_menus/models/items.php index e1fb7878fe293..2fb817aa0b9f8 100644 --- a/administrator/components/com_menus/models/items.php +++ b/administrator/components/com_menus/models/items.php @@ -209,13 +209,17 @@ protected function getListQuery() ) ); $query->select( - 'CASE a.type' . - ' WHEN ' . $db->quote('component') . ' THEN a.published+2*(e.enabled-1) ' . - ' WHEN ' . $db->quote('url') . ' THEN a.published+2 ' . - ' WHEN ' . $db->quote('alias') . ' THEN a.published+4 ' . - ' WHEN ' . $db->quote('separator') . ' THEN a.published+6 ' . - ' WHEN ' . $db->quote('heading') . ' THEN a.published+8 ' . - ' END AS published' + 'CASE ' . + ' WHEN a.type = ' . $db->quote('component') . ' THEN a.published+2*(e.enabled-1) ' . + ' WHEN a.type = ' . $db->quote('url') . 'AND a.published != -2 THEN a.published+2 ' . + ' WHEN a.type = ' . $db->quote('url') . 'AND a.published = -2 THEN a.published-1 ' . + ' WHEN a.type = ' . $db->quote('alias') . 'AND a.published != -2 THEN a.published+4 ' . + ' WHEN a.type = ' . $db->quote('alias') . 'AND a.published = -2 THEN a.published-1 ' . + ' WHEN a.type = ' . $db->quote('separator') . 'AND a.published != -2 THEN a.published+6 ' . + ' WHEN a.type = ' . $db->quote('separator') . 'AND a.published = -2 THEN a.published-1 ' . + ' WHEN a.type = ' . $db->quote('heading') . 'AND a.published != -2 THEN a.published+8 ' . + ' WHEN a.type = ' . $db->quote('heading') . 'AND a.published = -2 THEN a.published-1 ' . + ' END AS published ' ); $query->from($db->quoteName('#__menu') . ' AS a'); diff --git a/administrator/components/com_menus/models/menus.php b/administrator/components/com_menus/models/menus.php index a083b5834451b..63a754e988fbe 100644 --- a/administrator/components/com_menus/models/menus.php +++ b/administrator/components/com_menus/models/menus.php @@ -161,10 +161,9 @@ protected function getListQuery() $query = $db->getQuery(true); // Select all fields from the table. - $query->select($this->getState('list.select', 'a.*')) + $query->select($this->getState('list.select', 'a.id, a.menutype, a.title, a.description')) ->from($db->quoteName('#__menu_types') . ' AS a') - - ->group('a.id, a.menutype, a.title, a.description'); + ->where('a.id > 0'); // Filter by search in title or menutype if ($search = trim($this->getState('filter.search'))) diff --git a/administrator/components/com_menus/views/item/tmpl/edit_modules.php b/administrator/components/com_menus/views/item/tmpl/edit_modules.php index a0419848a2138..ed1bb489f566c 100644 --- a/administrator/components/com_menus/views/item/tmpl/edit_modules.php +++ b/administrator/components/com_menus/views/item/tmpl/edit_modules.php @@ -21,10 +21,10 @@ jQuery(document).ready(function() { jQuery(document).on("click", "input:radio[id^=\'jform_toggle_modules1\']", function (event) { - jQuery(".table tr.no").hide(); + jQuery(".table tr.no").hide(); }); jQuery(document).on("click", "input:radio[id^=\'jform_toggle_modules0\']", function (event) { - jQuery(".table tr.no").show(); + jQuery(".table tr.no").show(); }); }); '); @@ -65,7 +65,7 @@ id . '&tmpl=component&view=module&layout=modal'; ?> - + escape($module->title); ?> @@ -99,6 +99,20 @@ + id . 'Modal', + array( + 'url' => $link, + 'title' => JText::_('COM_MENUS_EDIT_MODULE_SETTINGS'), + 'height' => '300px', + 'width' => '800px', + 'footer' => '' + . '' + ) + ); ?> diff --git a/administrator/components/com_menus/views/items/tmpl/default.php b/administrator/components/com_menus/views/items/tmpl/default.php index 510a179a34471..215df0660885c 100644 --- a/administrator/components/com_menus/views/items/tmpl/default.php +++ b/administrator/components/com_menus/views/items/tmpl/default.php @@ -146,7 +146,7 @@ } ?> - + @@ -226,11 +226,19 @@ + + authorise('core.create', 'com_menus') || $user->authorise('core.edit', 'com_menus')) : ?> + JText::_('COM_MENUS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + - - authorise('core.create', 'com_menus') || $user->authorise('core.edit', 'com_menus')) : ?> - loadTemplate('batch'); ?> - diff --git a/administrator/components/com_menus/views/items/tmpl/default_batch.php b/administrator/components/com_menus/views/items/tmpl/default_batch.php index 21b8cc8a04dd5..22fdeac8f54b9 100644 --- a/administrator/components/com_menus/views/items/tmpl/default_batch.php +++ b/administrator/components/com_menus/views/items/tmpl/default_batch.php @@ -5,6 +5,8 @@ * * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt + * + * @deprecated 3.4 Use default_batch_body and default_batch_footer */ defined('_JEXEC') or die; diff --git a/administrator/components/com_menus/views/items/tmpl/default_batch_body.php b/administrator/components/com_menus/views/items/tmpl/default_batch_body.php new file mode 100644 index 0000000000000..5c3a21a9e547e --- /dev/null +++ b/administrator/components/com_menus/views/items/tmpl/default_batch_body.php @@ -0,0 +1,48 @@ +state->get('filter.published'); +?> + +

    +
    +
    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    + = 0) : ?> +
    + +
    + +
    +
    +
    + +
    + +
    \ No newline at end of file diff --git a/administrator/components/com_menus/views/items/tmpl/default_batch_footer.php b/administrator/components/com_menus/views/items/tmpl/default_batch_footer.php new file mode 100644 index 0000000000000..f5f004c133320 --- /dev/null +++ b/administrator/components/com_menus/views/items/tmpl/default_batch_footer.php @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/administrator/components/com_menus/views/items/view.html.php b/administrator/components/com_menus/views/items/view.html.php index f227519df5892..3a71a5cc0d067 100644 --- a/administrator/components/com_menus/views/items/view.html.php +++ b/administrator/components/com_menus/views/items/view.html.php @@ -263,9 +263,10 @@ protected function addToolbar() } // Add a batch button - if ($user->authorise('core.create', 'com_menus') && $user->authorise('core.edit', 'com_menus') && $user->authorise('core.edit.state', 'com_menus')) + if ($user->authorise('core.create', 'com_menus') + && $user->authorise('core.edit', 'com_menus') + && $user->authorise('core.edit.state', 'com_menus')) { - JHtml::_('bootstrap.modal', 'collapseModal'); $title = JText::_('JTOOLBAR_BATCH'); // Instantiate a new JLayoutFile instance and render the batch button diff --git a/administrator/components/com_menus/views/menus/tmpl/default.php b/administrator/components/com_menus/views/menus/tmpl/default.php index f39e7622a8daf..06b901f3450aa 100644 --- a/administrator/components/com_menus/views/menus/tmpl/default.php +++ b/administrator/components/com_menus/views/menus/tmpl/default.php @@ -14,7 +14,6 @@ JHtml::_('bootstrap.tooltip'); JHtml::_('behavior.multiselect'); -JHtml::_('behavior.modal'); JHtml::_('formbehavior.chosen', 'select'); $uri = JUri::getInstance(); @@ -34,6 +33,27 @@ } }; "); + +$script = array(); +$script[] = "jQuery(document).ready(function() {"; + +foreach ($this->items as $item) : + if ($user->authorise('core.edit', 'com_menus')) : + $script[] = ' function jSelectPosition_' . $item->id . '(name) {'; + $script[] = ' document.getElementById("' . $item->id . '").value = name;'; + $script[] = ' jQuery(".modal").modal("hide");'; + $script[] = ' };'; + endif; +endforeach; + +$script[] = ' jQuery(".modal").on("hidden", function () {'; +$script[] = ' setTimeout(function(){'; +$script[] = ' window.parent.location.reload();'; +$script[] = ' },1000);'; +$script[] = ' });'; +$script[] = "});"; + +JFactory::getDocument()->addScriptDeclaration(implode("\n", $script)); ?> sidebar)) : ?> @@ -50,8 +70,8 @@
    - - + +
    @@ -73,17 +93,22 @@ - - + + + - - + + + - - + + + - - + + + + @@ -131,19 +156,20 @@ count_trashed; ?> - + modules[$item->menutype])) : ?>
    - +
    + modules[$item->menutype] as &$module) : ?> + + id . '&return=' . $return . '&tmpl=component&layout=modal'); ?> + id . 'Modal', + array( + 'url' => $link, + 'title' => JText::_('COM_MENUS_EDIT_MODULE_SETTINGS'), + 'height' => '300px', + 'width' => '800px', + 'footer' => '' + . '' + ) + ); ?> + + + $link, + 'title' => JText::_('COM_MENUS_EDIT_MODULE_SETTINGS'), + 'height' => '500px', + 'width' => '800px', + 'footer' => '' + ) + ); ?> diff --git a/administrator/components/com_menus/views/menus/view.html.php b/administrator/components/com_menus/views/menus/view.html.php index b9a9f4ce2d142..883b3c8a7d789 100644 --- a/administrator/components/com_menus/views/menus/view.html.php +++ b/administrator/components/com_menus/views/menus/view.html.php @@ -98,7 +98,7 @@ protected function addToolbar() JToolbarHelper::custom('menus.rebuild', 'refresh.png', 'refresh_f2.png', 'JTOOLBAR_REBUILD', false); - if ($canDo->get('core.admin')) + if ($canDo->get('core.admin') || $canDo->get('core.options')) { JToolbarHelper::divider(); JToolbarHelper::preferences('com_menus'); diff --git a/administrator/components/com_menus/views/menutypes/tmpl/default.php b/administrator/components/com_menus/views/menutypes/tmpl/default.php index 3da8e9982ab35..656648e254b52 100644 --- a/administrator/components/com_menus/views/menutypes/tmpl/default.php +++ b/administrator/components/com_menus/views/menutypes/tmpl/default.php @@ -14,13 +14,14 @@ // Checking if loaded via index.php or component.php $tmpl = ($input->getCmd('tmpl') != '') ? '1' : ''; +JHtml::_('behavior.core'); JFactory::getDocument()->addScriptDeclaration(' setmenutype = function(type) { var tmpl = ' . json_encode($tmpl) . '; if (tmpl) { window.parent.Joomla.submitbutton("item.setType", type); - window.parent.jModalClose(); + window.parent.jQuery("#menuTypeModal").modal("hide"); } else { diff --git a/administrator/components/com_menus/views/menutypes/view.html.php b/administrator/components/com_menus/views/menutypes/view.html.php index f1b93e2fb6b28..c59c3e25410ee 100644 --- a/administrator/components/com_menus/views/menutypes/view.html.php +++ b/administrator/components/com_menus/views/menutypes/view.html.php @@ -104,7 +104,7 @@ protected function addToolbar() // Cancel $title = JText::_('JTOOLBAR_CANCEL'); $dhtml = ""; $bar->appendButton('Custom', $dhtml, 'new'); } diff --git a/administrator/components/com_messages/helpers/html/messages.php b/administrator/components/com_messages/helpers/html/messages.php index 286085d016ca8..e6aea4fea649c 100644 --- a/administrator/components/com_messages/helpers/html/messages.php +++ b/administrator/components/com_messages/helpers/html/messages.php @@ -77,8 +77,8 @@ public static function status($i, $value = 0, $canChange = false) if ($canChange) { - $html = ''; + $html = ''; } return $html; diff --git a/administrator/components/com_messages/layouts/toolbar/mysettings.php b/administrator/components/com_messages/layouts/toolbar/mysettings.php index 855ea73aee5e4..3bc37684b6991 100644 --- a/administrator/components/com_messages/layouts/toolbar/mysettings.php +++ b/administrator/components/com_messages/layouts/toolbar/mysettings.php @@ -15,5 +15,5 @@ rel="{handler:'iframe', size:{x:700,y:300}}" href="index.php?option=com_messages&view=config&tmpl=component" title="" class="messagesSettings btn btn-small"> - + diff --git a/administrator/components/com_messages/views/messages/tmpl/default.php b/administrator/components/com_messages/views/messages/tmpl/default.php index c0342efbe848d..9c33de250f9ac 100644 --- a/administrator/components/com_messages/views/messages/tmpl/default.php +++ b/administrator/components/com_messages/views/messages/tmpl/default.php @@ -35,8 +35,8 @@
    - - + +
    - - + +
    @@ -94,7 +94,7 @@ - ', 'ordering', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + ', 'ordering', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> @@ -154,7 +154,7 @@ } ?> - + diff --git a/administrator/components/com_modules/views/modules/tmpl/default_batch.php b/administrator/components/com_modules/views/modules/tmpl/default_batch.php index c5df3853c1cbf..52941681b1c8c 100644 --- a/administrator/components/com_modules/views/modules/tmpl/default_batch.php +++ b/administrator/components/com_modules/views/modules/tmpl/default_batch.php @@ -10,7 +10,8 @@ defined('_JEXEC') or die; $clientId = $this->state->get('filter.client_id'); -$published = $this->state->get('filter.published'); +// show only Module Positions of published Templates +$published = 1; $positions = JHtml::_('modules.positions', $clientId, $published); $positions['']['items'][] = ModulesHelper::createOption('nochange', JText::_('COM_MODULES_BATCH_POSITION_NOCHANGE')); $positions['']['items'][] = ModulesHelper::createOption('noposition', JText::_('COM_MODULES_BATCH_POSITION_NOPOSITION')); diff --git a/administrator/components/com_modules/views/preview/tmpl/default.php b/administrator/components/com_modules/views/preview/tmpl/default.php index 9a63ed87b176e..772c6bc19734e 100644 --- a/administrator/components/com_modules/views/preview/tmpl/default.php +++ b/administrator/components/com_modules/views/preview/tmpl/default.php @@ -9,20 +9,24 @@ defined('_JEXEC') or die; -JFactory::getDocument()->addScriptDeclaration(' +JFactory::getDocument()->addScriptDeclaration( + ' var form = window.top.document.adminForm var title = form.title.value; var alltext = window.top.' . $this->editor->getContent('text') . '; -'); + + jQuery(document).ready(function() { + document.getElementById("td-title").innerHTML = title; + document.getElementById("td-text").innerHTML = alltext; + });' +); ?> - + - +
    - -
    diff --git a/administrator/components/com_modules/views/select/tmpl/default.php b/administrator/components/com_modules/views/select/tmpl/default.php index 4fa44a520443b..ae926ca038425 100644 --- a/administrator/components/com_modules/views/select/tmpl/default.php +++ b/administrator/components/com_modules/views/select/tmpl/default.php @@ -18,14 +18,12 @@

      items as &$item) : ?> - + extension_id; ?> + escape($item->name); ?> + escape(strip_tags($item->desc))), 200); ?> + escape(strip_tags($item->desc))), 90); ?> - $link = 'index.php?option=com_modules&task=module.add&eid=' . $item->extension_id; - $name = $this->escape($item->name); - $desc = JHTML::_('string.truncate', ($this->escape($item->desc)), 200); - $short_desc = JHTML::_('string.truncate', ($this->escape($item->desc)), 90); - ?> direction != "rtl") : ?>
    • @@ -36,11 +34,11 @@
    • - +
    • - +
    diff --git a/administrator/components/com_newsfeeds/access.xml b/administrator/components/com_newsfeeds/access.xml index 0020f9411ff6f..0cf23a397571b 100644 --- a/administrator/components/com_newsfeeds/access.xml +++ b/administrator/components/com_newsfeeds/access.xml @@ -2,6 +2,7 @@
    + diff --git a/administrator/components/com_newsfeeds/models/fields/modal/newsfeed.php b/administrator/components/com_newsfeeds/models/fields/modal/newsfeed.php index 66c1b9c5f01d5..76da33520b989 100644 --- a/administrator/components/com_newsfeeds/models/fields/modal/newsfeed.php +++ b/administrator/components/com_newsfeeds/models/fields/modal/newsfeed.php @@ -40,8 +40,6 @@ protected function getInput() JFactory::getLanguage()->load('com_newsfeeds', JPATH_ADMINISTRATOR); // Load the javascript - JHtml::_('behavior.framework'); - JHtml::_('behavior.modal', 'a.modal'); JHtml::_('bootstrap.tooltip'); // Build the script. @@ -62,7 +60,14 @@ protected function getInput() $script[] = ' jQuery("#' . $this->id . '_clear").removeClass("hidden");'; } - $script[] = ' jModalClose();'; + $script[] = ' jQuery("#modalNewsfeed' . $this->id . '").modal("hide");'; + + if ($this->required) + { + $script[] = ' document.formvalidator.validate(document.getElementById("' . $this->id . '_id"));'; + $script[] = ' document.formvalidator.validate(document.getElementById("' . $this->id . '_name"));'; + } + $script[] = ' }'; // Clear button script @@ -136,10 +141,24 @@ protected function getInput() $html[] = ''; $html[] = ''; - $html[] = ' ' . - JText::_('JSELECT') . ''; + + $html[] = '' + . ' ' . JText::_('JSELECT') + . ''; + + $html[] = JHtml::_( + 'bootstrap.renderModal', + 'modalNewsfeed' . $this->id, + array( + 'url' => $link . '&' . JSession::getFormToken() . '=1"', + 'title' => JText::_('COM_NEWSFEEDS_CHANGE_FEED_BUTTON'), + 'width' => '800px', + 'height' => '300px', + 'footer' => '' + ) + ); // Edit newsfeed button if ($allowEdit) @@ -171,4 +190,16 @@ protected function getInput() return implode("\n", $html); } + + /** + * Method to get the field label markup. + * + * @return string The field label markup. + * + * @since 3.4 + */ + protected function getLabel() + { + return str_replace($this->id, $this->id . '_id', parent::getLabel()); + } } diff --git a/administrator/components/com_newsfeeds/views/newsfeeds/tmpl/default.php b/administrator/components/com_newsfeeds/views/newsfeeds/tmpl/default.php index ff06f45d1c973..1721636d4c087 100644 --- a/administrator/components/com_newsfeeds/views/newsfeeds/tmpl/default.php +++ b/administrator/components/com_newsfeeds/views/newsfeeds/tmpl/default.php @@ -66,8 +66,8 @@
    - - + +
    @@ -99,7 +99,7 @@ - ', 'a.ordering', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + ', 'a.ordering', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> @@ -161,7 +161,7 @@ } ?> - + @@ -235,10 +235,21 @@ - - - - loadTemplate('batch'); ?> + + authorise('core.create', 'com_newsfeeds') + && $user->authorise('core.edit', 'com_newsfeeds') + && $user->authorise('core.edit.state', 'com_newsfeeds')) : ?> + JText::_('COM_NEWSFEEDS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + diff --git a/administrator/components/com_newsfeeds/views/newsfeeds/tmpl/default_batch.php b/administrator/components/com_newsfeeds/views/newsfeeds/tmpl/default_batch.php index b36226f5bda1e..e4930dc2da6e1 100644 --- a/administrator/components/com_newsfeeds/views/newsfeeds/tmpl/default_batch.php +++ b/administrator/components/com_newsfeeds/views/newsfeeds/tmpl/default_batch.php @@ -5,6 +5,8 @@ * * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt + * + * @deprecated 3.4 Use default_batch_body and default_batch_footer */ defined('_JEXEC') or die; diff --git a/administrator/components/com_newsfeeds/views/newsfeeds/tmpl/default_batch_body.php b/administrator/components/com_newsfeeds/views/newsfeeds/tmpl/default_batch_body.php new file mode 100644 index 0000000000000..e10703582afe3 --- /dev/null +++ b/administrator/components/com_newsfeeds/views/newsfeeds/tmpl/default_batch_body.php @@ -0,0 +1,39 @@ +state->get('filter.published'); +?> + +

    +
    +
    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    + = 0) : ?> +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    diff --git a/administrator/components/com_newsfeeds/views/newsfeeds/tmpl/default_batch_footer.php b/administrator/components/com_newsfeeds/views/newsfeeds/tmpl/default_batch_footer.php new file mode 100644 index 0000000000000..920d2f1236c15 --- /dev/null +++ b/administrator/components/com_newsfeeds/views/newsfeeds/tmpl/default_batch_footer.php @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/administrator/components/com_newsfeeds/views/newsfeeds/tmpl/modal.php b/administrator/components/com_newsfeeds/views/newsfeeds/tmpl/modal.php index aaad93196848e..ac629e8323a43 100644 --- a/administrator/components/com_newsfeeds/views/newsfeeds/tmpl/modal.php +++ b/administrator/components/com_newsfeeds/views/newsfeeds/tmpl/modal.php @@ -32,9 +32,9 @@
    + +
    diff --git a/administrator/components/com_newsfeeds/views/newsfeeds/view.html.php b/administrator/components/com_newsfeeds/views/newsfeeds/view.html.php index 2c68c49d68eb6..a96711df6326c 100644 --- a/administrator/components/com_newsfeeds/views/newsfeeds/view.html.php +++ b/administrator/components/com_newsfeeds/views/newsfeeds/view.html.php @@ -113,7 +113,6 @@ protected function addToolbar() && $user->authorise('core.edit', 'com_newsfeeds') && $user->authorise('core.edit.state', 'com_newsfeeds')) { - JHtml::_('bootstrap.modal', 'collapseModal'); $title = JText::_('JTOOLBAR_BATCH'); // Instantiate a new JLayoutFile instance and render the batch button @@ -132,7 +131,7 @@ protected function addToolbar() JToolbarHelper::trash('newsfeeds.trash'); } - if ($user->authorise('core.admin', 'com_newsfeeds')) + if ($user->authorise('core.admin', 'com_newsfeeds') || $user->authorise('core.options', 'com_newsfeeds')) { JToolbarHelper::preferences('com_newsfeeds'); } diff --git a/administrator/components/com_plugins/models/plugin.php b/administrator/components/com_plugins/models/plugin.php index 04de9c85b8ee4..1928010292a75 100644 --- a/administrator/components/com_plugins/models/plugin.php +++ b/administrator/components/com_plugins/models/plugin.php @@ -363,6 +363,7 @@ public function getHelp() */ protected function cleanCache($group = null, $client_id = 0) { - parent::cleanCache('com_plugins'); + parent::cleanCache('com_plugins', 0); + parent::cleanCache('com_plugins', 1); } } diff --git a/administrator/components/com_plugins/views/plugins/tmpl/default.php b/administrator/components/com_plugins/views/plugins/tmpl/default.php index 6d9abdc88b9a1..25ea143c00e58 100644 --- a/administrator/components/com_plugins/views/plugins/tmpl/default.php +++ b/administrator/components/com_plugins/views/plugins/tmpl/default.php @@ -61,8 +61,8 @@
    - - + +
    @@ -94,7 +94,7 @@ - ', 'ordering', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + ', 'ordering', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> @@ -147,7 +147,7 @@ } ?> - + diff --git a/administrator/components/com_redirect/access.xml b/administrator/components/com_redirect/access.xml index f571c60cda987..ddf5198b162fe 100644 --- a/administrator/components/com_redirect/access.xml +++ b/administrator/components/com_redirect/access.xml @@ -2,6 +2,7 @@
    + diff --git a/administrator/components/com_redirect/helpers/html/redirect.php b/administrator/components/com_redirect/helpers/html/redirect.php index b067b4b156b59..857ac5181d553 100644 --- a/administrator/components/com_redirect/helpers/html/redirect.php +++ b/administrator/components/com_redirect/helpers/html/redirect.php @@ -49,8 +49,8 @@ public static function published($value = 0, $i = null, $canChange = true) if ($canChange) { - $html = ''; + $html = ''; } return $html; diff --git a/administrator/components/com_redirect/views/links/tmpl/default.php b/administrator/components/com_redirect/views/links/tmpl/default.php index a854680668775..27aeae5fe992b 100755 --- a/administrator/components/com_redirect/views/links/tmpl/default.php +++ b/administrator/components/com_redirect/views/links/tmpl/default.php @@ -35,8 +35,8 @@
    - - + +
    @@ -141,14 +141,26 @@ + + authorise('core.create', 'com_redirect') + && $user->authorise('core.edit', 'com_redirect') + && $user->authorise('core.edit.state', 'com_redirect')) : ?> + JText::_('COM_REDIRECT_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + items)) : ?> loadTemplate('addform'); ?> - loadTemplate('batch'); ?> - diff --git a/administrator/components/com_redirect/views/links/tmpl/default_batch.php b/administrator/components/com_redirect/views/links/tmpl/default_batch.php index 28de5c15a64b9..390ffbadae1c4 100644 --- a/administrator/components/com_redirect/views/links/tmpl/default_batch.php +++ b/administrator/components/com_redirect/views/links/tmpl/default_batch.php @@ -5,6 +5,8 @@ * * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt + * + * @deprecated 3.4 Use default_batch_body and default_batch_footer */ defined('_JEXEC') or die; diff --git a/administrator/components/com_redirect/views/links/tmpl/default_batch_body.php b/administrator/components/com_redirect/views/links/tmpl/default_batch_body.php new file mode 100644 index 0000000000000..c9100b7f2c466 --- /dev/null +++ b/administrator/components/com_redirect/views/links/tmpl/default_batch_body.php @@ -0,0 +1,20 @@ +state->get('filter.published'); +?> + +

    +
    +
    +
    + +
    +
    +
    \ No newline at end of file diff --git a/administrator/components/com_redirect/views/links/tmpl/default_batch_footer.php b/administrator/components/com_redirect/views/links/tmpl/default_batch_footer.php new file mode 100644 index 0000000000000..db6f73e2287fc --- /dev/null +++ b/administrator/components/com_redirect/views/links/tmpl/default_batch_footer.php @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/administrator/components/com_redirect/views/links/view.html.php b/administrator/components/com_redirect/views/links/view.html.php index b44c1bfca2a50..8eadb771548a1 100644 --- a/administrator/components/com_redirect/views/links/view.html.php +++ b/administrator/components/com_redirect/views/links/view.html.php @@ -109,7 +109,6 @@ protected function addToolbar() // Get the toolbar object instance $bar = JToolBar::getInstance('toolbar'); - JHtml::_('bootstrap.modal', 'collapseModal'); $title = JText::_('JTOOLBAR_BATCH'); // Instantiate a new JLayoutFile instance and render the batch button @@ -130,7 +129,7 @@ protected function addToolbar() JToolbarHelper::divider(); } - if ($canDo->get('core.admin')) + if ($canDo->get('core.admin') || $canDo->get('core.options')) { JToolbarHelper::preferences('com_redirect'); JToolbarHelper::divider(); diff --git a/administrator/components/com_search/access.xml b/administrator/components/com_search/access.xml index 2c9a44e704cc7..9b65a75052466 100644 --- a/administrator/components/com_search/access.xml +++ b/administrator/components/com_search/access.xml @@ -2,6 +2,7 @@
    +
    diff --git a/administrator/components/com_search/views/searches/tmpl/default.php b/administrator/components/com_search/views/searches/tmpl/default.php index 87889998a29d5..a2f3c198e74ae 100644 --- a/administrator/components/com_search/views/searches/tmpl/default.php +++ b/administrator/components/com_search/views/searches/tmpl/default.php @@ -25,8 +25,8 @@
    @@ -36,10 +36,10 @@ state->get('filter.results')) : ?> - + - +
    diff --git a/administrator/components/com_search/views/searches/view.html.php b/administrator/components/com_search/views/searches/view.html.php index 4523847e470df..e8f93773b5740 100644 --- a/administrator/components/com_search/views/searches/view.html.php +++ b/administrator/components/com_search/views/searches/view.html.php @@ -71,7 +71,7 @@ protected function addToolbar() JToolbarHelper::divider(); - if ($canDo->get('core.admin')) + if ($canDo->get('core.admin') || $canDo->get('core.options')) { JToolbarHelper::preferences('com_search'); } diff --git a/administrator/components/com_tags/access.xml b/administrator/components/com_tags/access.xml index 36b9a3fad640d..c4f8083a72c53 100644 --- a/administrator/components/com_tags/access.xml +++ b/administrator/components/com_tags/access.xml @@ -2,6 +2,7 @@
    + diff --git a/administrator/components/com_tags/models/forms/tag.xml b/administrator/components/com_tags/models/forms/tag.xml index 76fb1cc223def..0f45a536bc7b9 100644 --- a/administrator/components/com_tags/models/forms/tag.xml +++ b/administrator/components/com_tags/models/forms/tag.xml @@ -85,8 +85,8 @@ name="note" type="text" class="span12" - label="JFIELD_NOTE_LABEL" - description="JFIELD_NOTE_DESC" + label="COM_TAGS_FIELD_NOTE_LABEL" + description="COM_TAGS_FIELD_NOTE_DESC" size="40" /> diff --git a/administrator/components/com_tags/tags.php b/administrator/components/com_tags/tags.php index f21291d11c51a..7c83f7b6e1238 100644 --- a/administrator/components/com_tags/tags.php +++ b/administrator/components/com_tags/tags.php @@ -10,15 +10,11 @@ defined('_JEXEC') or die; JHtml::_('behavior.tabstate'); -$input = JFactory::getApplication()->input; - if (!JFactory::getUser()->authorise('core.manage', 'com_tags')) { return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); } -$task = $input->get('task'); - $controller = JControllerLegacy::getInstance('Tags'); -$controller->execute($input->get('task')); +$controller->execute(JFactory::getApplication()->input->get('task')); $controller->redirect(); diff --git a/administrator/components/com_tags/views/tags/tmpl/default.php b/administrator/components/com_tags/views/tags/tmpl/default.php index 2b47745976828..1a3989684fc39 100644 --- a/administrator/components/com_tags/views/tags/tmpl/default.php +++ b/administrator/components/com_tags/views/tags/tmpl/default.php @@ -64,8 +64,8 @@
    - - + +
    @@ -98,7 +98,7 @@ - ', 'a.ordering', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + ', 'a.ordering', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> @@ -175,7 +175,7 @@ } ?> - + @@ -227,9 +227,21 @@ + + authorise('core.create', 'com_tags') + && $user->authorise('core.edit', 'com_tags') + && $user->authorise('core.edit.state', 'com_tags')) : ?> + JText::_('COM_TAGS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + - - loadTemplate('batch'); ?> diff --git a/administrator/components/com_tags/views/tags/tmpl/default_batch.php b/administrator/components/com_tags/views/tags/tmpl/default_batch.php index 4548276cdc463..e5b8da91b7490 100644 --- a/administrator/components/com_tags/views/tags/tmpl/default_batch.php +++ b/administrator/components/com_tags/views/tags/tmpl/default_batch.php @@ -5,6 +5,8 @@ * * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt + * + * @deprecated 3.4 Use default_batch_body and default_batch_footer */ defined('_JEXEC') or die; diff --git a/administrator/components/com_tags/views/tags/tmpl/default_batch_body.php b/administrator/components/com_tags/views/tags/tmpl/default_batch_body.php new file mode 100644 index 0000000000000..a4085944854c3 --- /dev/null +++ b/administrator/components/com_tags/views/tags/tmpl/default_batch_body.php @@ -0,0 +1,25 @@ +state->get('filter.published'); +?> + +

    +
    +
    +
    + +
    +
    +
    +
    + +
    +
    +
    \ No newline at end of file diff --git a/administrator/components/com_tags/views/tags/tmpl/default_batch_footer.php b/administrator/components/com_tags/views/tags/tmpl/default_batch_footer.php new file mode 100644 index 0000000000000..cfcae68c2c4c5 --- /dev/null +++ b/administrator/components/com_tags/views/tags/tmpl/default_batch_footer.php @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/administrator/components/com_tags/views/tags/view.html.php b/administrator/components/com_tags/views/tags/view.html.php index cf5d6e9660066..b7e8d361cef66 100644 --- a/administrator/components/com_tags/views/tags/view.html.php +++ b/administrator/components/com_tags/views/tags/view.html.php @@ -31,11 +31,9 @@ class TagsViewTags extends JViewLegacy */ public function display($tpl = null) { - $this->state = $this->get('State'); - $this->items = $this->get('Items'); - $this->pagination = $this->get('Pagination'); - - TagsHelper::addSubmenu('tags'); + $this->state = $this->get('State'); + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); // Check for errors. if (count($errors = $this->get('Errors'))) @@ -44,6 +42,7 @@ public function display($tpl = null) return false; } + // Preprocess the list of items to find ordering divisions. foreach ($this->items as &$item) { @@ -111,9 +110,10 @@ protected function addToolbar() } // Add a batch button - if ($user->authorise('core.create', 'com_tags') && $user->authorise('core.edit', 'com_tags') && $user->authorise('core.edit.state', 'com_tags')) + if ($user->authorise('core.create', 'com_tags') + && $user->authorise('core.edit', 'com_tags') + && $user->authorise('core.edit.state', 'com_tags')) { - JHtml::_('bootstrap.modal', 'collapseModal'); $title = JText::_('JTOOLBAR_BATCH'); // Instantiate a new JLayoutFile instance and render the batch button @@ -132,7 +132,7 @@ protected function addToolbar() JToolbarHelper::trash('tags.trash'); } - if ($canDo->get('core.admin')) + if ($canDo->get('core.admin') || $canDo->get('core.options')) { JToolbarHelper::preferences('com_tags'); } diff --git a/administrator/components/com_templates/access.xml b/administrator/components/com_templates/access.xml index f8757907b7106..085a53d701b5d 100644 --- a/administrator/components/com_templates/access.xml +++ b/administrator/components/com_templates/access.xml @@ -2,6 +2,7 @@
    + diff --git a/administrator/components/com_templates/helpers/html/templates.php b/administrator/components/com_templates/helpers/html/templates.php index d92055e78f45e..edb1380a37ede 100644 --- a/administrator/components/com_templates/helpers/html/templates.php +++ b/administrator/components/com_templates/helpers/html/templates.php @@ -30,7 +30,6 @@ public static function thumb($template, $clientId = 0) { $client = JApplicationHelper::getClientInfo($clientId); $basePath = $client->path . '/templates/' . $template; - $baseUrl = ($clientId == 0) ? JUri::root(true) : JUri::root(true) . '/administrator'; $thumb = $basePath . '/template_thumbnail.png'; $preview = $basePath . '/template_preview.png'; $html = ''; @@ -38,7 +37,6 @@ public static function thumb($template, $clientId = 0) if (file_exists($thumb)) { JHtml::_('bootstrap.tooltip'); - JHtml::_('behavior.modal'); $clientPath = ($clientId == 0) ? '' : 'administrator/'; $thumb = $clientPath . 'templates/' . $template . '/template_thumbnail.png'; @@ -46,12 +44,55 @@ public static function thumb($template, $clientId = 0) if (file_exists($preview)) { - $preview = $baseUrl . '/templates/' . $template . '/template_preview.png'; - $html = '' . $html . ''; } } return $html; } + + /** + * Renders the html for the modal linked to thumb. + * + * @param string $template The name of the template. + * @param integer $clientId The application client ID the template applies to + * + * @return string The html string + * + * @since 3.4 + */ + public static function thumbModal($template, $clientId = 0) + { + $client = JApplicationHelper::getClientInfo($clientId); + $basePath = $client->path . '/templates/' . $template; + $baseUrl = ($clientId == 0) ? JUri::root(true) : JUri::root(true) . '/administrator'; + $thumb = $basePath . '/template_thumbnail.png'; + $preview = $basePath . '/template_preview.png'; + $html = ''; + + if (file_exists($thumb)) + { + if (file_exists($preview)) + { + $preview = $baseUrl . '/templates/' . $template . '/template_preview.png'; + $footer = '
    - - + +
    @@ -117,6 +116,7 @@ escape($url); ?>

    + element, $item->client_id); ?> diff --git a/administrator/components/com_templates/views/templates/view.html.php b/administrator/components/com_templates/views/templates/view.html.php index 0502ecc9d6df0..f186caf0c7dcd 100644 --- a/administrator/components/com_templates/views/templates/view.html.php +++ b/administrator/components/com_templates/views/templates/view.html.php @@ -85,7 +85,7 @@ protected function addToolbar() JToolbarHelper::title(JText::_('COM_TEMPLATES_MANAGER_TEMPLATES'), 'eye thememanager'); - if ($canDo->get('core.admin')) + if ($canDo->get('core.admin') || $canDo->get('core.options')) { JToolbarHelper::preferences('com_templates'); JToolbarHelper::divider(); diff --git a/administrator/components/com_users/access.xml b/administrator/components/com_users/access.xml index bcf13c6888c4d..b10b8fe446277 100644 --- a/administrator/components/com_users/access.xml +++ b/administrator/components/com_users/access.xml @@ -2,6 +2,7 @@
    + diff --git a/administrator/components/com_users/helpers/html/users.php b/administrator/components/com_users/helpers/html/users.php index 9dd6853323fef..be050125fbde9 100644 --- a/administrator/components/com_users/helpers/html/users.php +++ b/administrator/components/com_users/helpers/html/users.php @@ -55,7 +55,7 @@ public static function addNote($userId) $title = JText::_('COM_USERS_ADD_NOTE'); return '' - . '' . $title . ''; + . '' . $title . ''; } /** @@ -78,7 +78,7 @@ public static function filterNotes($count, $userId) $title = JText::_('COM_USERS_FILTER_NOTES'); return '' - . ''; + . ''; } /** @@ -101,7 +101,7 @@ public static function notes($count, $userId) $title = JText::plural('COM_USERS_N_USER_NOTES', $count); return '' - . '' . $title . ''; + . '' . $title . ''; } /** @@ -122,13 +122,22 @@ public static function notesModal($count, $userId) } $title = JText::plural('COM_USERS_N_USER_NOTES', $count); + $footer = ' - + +
    @@ -72,9 +72,9 @@
    - - - + + +
    @@ -107,7 +107,7 @@ ?> - + diff --git a/administrator/components/com_users/views/debuguser/tmpl/default.php b/administrator/components/com_users/views/debuguser/tmpl/default.php index 418d1e6bc0e27..1f4c228455a32 100644 --- a/administrator/components/com_users/views/debuguser/tmpl/default.php +++ b/administrator/components/com_users/views/debuguser/tmpl/default.php @@ -32,8 +32,8 @@
    - - + +
    @@ -71,9 +71,9 @@
    - - - + + +
    @@ -106,7 +106,7 @@ ?> - + diff --git a/administrator/components/com_users/views/groups/tmpl/default.php b/administrator/components/com_users/views/groups/tmpl/default.php index 1f5f466cc2b93..86fe7920be898 100644 --- a/administrator/components/com_users/views/groups/tmpl/default.php +++ b/administrator/components/com_users/views/groups/tmpl/default.php @@ -87,8 +87,8 @@
    - - + +
    diff --git a/administrator/components/com_users/views/groups/view.html.php b/administrator/components/com_users/views/groups/view.html.php index e0edaad252028..118636bf6a365 100644 --- a/administrator/components/com_users/views/groups/view.html.php +++ b/administrator/components/com_users/views/groups/view.html.php @@ -98,7 +98,7 @@ protected function addToolbar() JToolbarHelper::divider(); } - if ($canDo->get('core.admin')) + if ($canDo->get('core.admin') || $canDo->get('core.options')) { JToolbarHelper::preferences('com_users'); JToolbarHelper::divider(); diff --git a/administrator/components/com_users/views/levels/tmpl/default.php b/administrator/components/com_users/views/levels/tmpl/default.php index 3b7809c23f6bb..5139ccae58720 100644 --- a/administrator/components/com_users/views/levels/tmpl/default.php +++ b/administrator/components/com_users/views/levels/tmpl/default.php @@ -61,8 +61,8 @@
    @@ -94,7 +94,7 @@ - ', 'a.ordering', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + ', 'a.ordering', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> @@ -136,7 +136,7 @@ } ?> - + diff --git a/administrator/components/com_users/views/levels/view.html.php b/administrator/components/com_users/views/levels/view.html.php index 1e3840f32acb8..a4083261c88ff 100644 --- a/administrator/components/com_users/views/levels/view.html.php +++ b/administrator/components/com_users/views/levels/view.html.php @@ -98,7 +98,7 @@ protected function addToolbar() JToolbarHelper::divider(); } - if ($canDo->get('core.admin')) + if ($canDo->get('core.admin') || $canDo->get('core.options')) { JToolbarHelper::preferences('com_users'); JToolbarHelper::divider(); diff --git a/administrator/components/com_users/views/notes/tmpl/default.php b/administrator/components/com_users/views/notes/tmpl/default.php index 813f4693fca46..a1a3bc4a7067a 100644 --- a/administrator/components/com_users/views/notes/tmpl/default.php +++ b/administrator/components/com_users/views/notes/tmpl/default.php @@ -51,8 +51,8 @@
    - - + +
    @@ -148,7 +148,7 @@ state, $i, 'notes.', $canChange, 'cb', $item->publish_up, $item->publish_down); ?> - review_time)) : ?> + review_time !== JFactory::getDbo()->getNullDate()) : ?> review_time, JText::_('DATE_FORMAT_LC4')); ?> diff --git a/administrator/components/com_users/views/notes/view.html.php b/administrator/components/com_users/views/notes/view.html.php index e886b9b27c4d8..af3a62ca7a614 100644 --- a/administrator/components/com_users/views/notes/view.html.php +++ b/administrator/components/com_users/views/notes/view.html.php @@ -135,7 +135,7 @@ protected function addToolbar() JToolbarHelper::divider(); } - if ($canDo->get('core.admin')) + if ($canDo->get('core.admin') || $canDo->get('core.options')) { JToolbarHelper::preferences('com_users'); JToolbarHelper::divider(); diff --git a/administrator/components/com_users/views/user/tmpl/edit.php b/administrator/components/com_users/views/user/tmpl/edit.php index c215d168ced2f..bcd1d16dfe70f 100644 --- a/administrator/components/com_users/views/user/tmpl/edit.php +++ b/administrator/components/com_users/views/user/tmpl/edit.php @@ -59,6 +59,9 @@ label; ?>
    + fieldname == 'password') : ?> + + input; ?>
    diff --git a/administrator/components/com_users/views/users/tmpl/default.php b/administrator/components/com_users/views/users/tmpl/default.php index 74b680c674309..3388562ba1f7f 100644 --- a/administrator/components/com_users/views/users/tmpl/default.php +++ b/administrator/components/com_users/views/users/tmpl/default.php @@ -164,11 +164,22 @@ + + authorise('core.create', 'com_users') + && $loggeduser->authorise('core.edit', 'com_users') + && $loggeduser->authorise('core.edit.state', 'com_users')) : ?> + JText::_('COM_USERS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + - - loadTemplate('batch'); ?> - diff --git a/administrator/components/com_users/views/users/tmpl/default_batch.php b/administrator/components/com_users/views/users/tmpl/default_batch.php index 8d23a5f6333ab..d19641a773a18 100644 --- a/administrator/components/com_users/views/users/tmpl/default_batch.php +++ b/administrator/components/com_users/views/users/tmpl/default_batch.php @@ -5,6 +5,8 @@ * * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt + * + * @deprecated 3.4 Use default_batch_body and default_batch_footer */ defined('_JEXEC') or die; diff --git a/administrator/components/com_users/views/users/tmpl/default_batch_body.php b/administrator/components/com_users/views/users/tmpl/default_batch_body.php new file mode 100644 index 0000000000000..46cc0f26574ae --- /dev/null +++ b/administrator/components/com_users/views/users/tmpl/default_batch_body.php @@ -0,0 +1,48 @@ + + +
    +
    + +
    +
    +
    + +
    +
    +
    + +
    +
    + +
    + +
    \ No newline at end of file diff --git a/administrator/components/com_users/views/users/tmpl/default_batch_footer.php b/administrator/components/com_users/views/users/tmpl/default_batch_footer.php new file mode 100644 index 0000000000000..ae1cabfdb65bb --- /dev/null +++ b/administrator/components/com_users/views/users/tmpl/default_batch_footer.php @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/administrator/components/com_users/views/users/tmpl/modal.php b/administrator/components/com_users/views/users/tmpl/modal.php index 9ad5d15d92ac3..db1baba4aa033 100644 --- a/administrator/components/com_users/views/users/tmpl/modal.php +++ b/administrator/components/com_users/views/users/tmpl/modal.php @@ -29,8 +29,8 @@
    - - + +
    diff --git a/administrator/components/com_users/views/users/view.html.php b/administrator/components/com_users/views/users/view.html.php index 4dbe6a4e99211..3e44bca4c023c 100644 --- a/administrator/components/com_users/views/users/view.html.php +++ b/administrator/components/com_users/views/users/view.html.php @@ -118,9 +118,10 @@ protected function addToolbar() } // Add a batch button - if ($user->authorise('core.create', 'com_users') && $user->authorise('core.edit', 'com_users') && $user->authorise('core.edit.state', 'com_users')) + if ($user->authorise('core.create', 'com_users') + && $user->authorise('core.edit', 'com_users') + && $user->authorise('core.edit.state', 'com_users')) { - JHtml::_('bootstrap.modal', 'collapseModal'); $title = JText::_('JTOOLBAR_BATCH'); // Instantiate a new JLayoutFile instance and render the batch button @@ -130,7 +131,7 @@ protected function addToolbar() $bar->appendButton('Custom', $dhtml, 'batch'); } - if ($canDo->get('core.admin')) + if ($canDo->get('core.admin') || $canDo->get('core.options')) { JToolbarHelper::preferences('com_users'); JToolbarHelper::divider(); diff --git a/administrator/includes/toolbar.php b/administrator/includes/toolbar.php index 8002bd4228162..17fafd999a08f 100644 --- a/administrator/includes/toolbar.php +++ b/administrator/includes/toolbar.php @@ -627,10 +627,11 @@ public static function versions($typeAlias, $itemId, $height = 800, $width = 500 */ public static function modal($targetModalId, $icon, $alt) { - JHtml::_('behavior.modal'); + JHtml::_('bootstrap.framework'); + $title = JText::_($alt); $dhtml = ""; + " . $title . ""; $bar = JToolbar::getInstance('toolbar'); $bar->appendButton('Custom', $dhtml, $alt); diff --git a/administrator/index.php b/administrator/index.php index 9246cf2e35cb8..d99d82b2321fb 100644 --- a/administrator/index.php +++ b/administrator/index.php @@ -6,9 +6,14 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -if (version_compare(PHP_VERSION, '5.3.10', '<')) +/** + * Define the application's minimum supported PHP version as a constant so it can be referenced within the application. + */ +define('JOOMLA_MINIMUM_PHP', '5.3.10'); + +if (version_compare(PHP_VERSION, JOOMLA_MINIMUM_PHP, '<')) { - die('Your host needs to use PHP 5.3.10 or higher to run this version of Joomla!'); + die('Your host needs to use PHP ' . JOOMLA_MINIMUM_PHP . ' or higher to run this version of Joomla!'); } /** diff --git a/administrator/language/en-GB/en-GB.com_ajax.ini b/administrator/language/en-GB/en-GB.com_ajax.ini index 75e65eda5c03f..a45d05e383171 100644 --- a/administrator/language/en-GB/en-GB.com_ajax.ini +++ b/administrator/language/en-GB/en-GB.com_ajax.ini @@ -1,7 +1,7 @@ ; Joomla! Project ; Copyright (C) 2005 - 2015 Open Source Matters. All rights reserved. ; 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 - No BOM +; Note : All ini files need to be saved as UTF-8 COM_AJAX="Ajax Interface" diff --git a/administrator/language/en-GB/en-GB.com_ajax.sys.ini b/administrator/language/en-GB/en-GB.com_ajax.sys.ini index d569390333189..8ea9db17e8454 100644 --- a/administrator/language/en-GB/en-GB.com_ajax.sys.ini +++ b/administrator/language/en-GB/en-GB.com_ajax.sys.ini @@ -1,7 +1,7 @@ ; Joomla! Project ; Copyright (C) 2005 - 2015 Open Source Matters. All rights reserved. ; 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 - No BOM +; Note : All ini files need to be saved as UTF-8 COM_AJAX="Ajax Interface" diff --git a/administrator/language/en-GB/en-GB.com_banners.ini b/administrator/language/en-GB/en-GB.com_banners.ini index b1f71406eac2a..b602a14654e74 100644 --- a/administrator/language/en-GB/en-GB.com_banners.ini +++ b/administrator/language/en-GB/en-GB.com_banners.ini @@ -56,7 +56,7 @@ COM_BANNERS_END_LABEL="End Date:" COM_BANNERS_ERR_ZIP_ADAPTER_FAILURE="Zip adapter failure" COM_BANNERS_ERR_ZIP_CREATE_FAILURE="Zip create failure" COM_BANNERS_ERR_ZIP_DELETE_FAILURE="Zip delete failure" -COM_BANNERS_ERROR_UNIQUE_ALIAS="Another Banner from this category has the same alias." +COM_BANNERS_ERROR_UNIQUE_ALIAS="Another Banner from this category has the same alias (remember it may be a trashed item)." COM_BANNERS_EXTRA="Additional Information" COM_BANNERS_FIELD_ALIAS_DESC="The alias is for internal use only. Leave this blank and Joomla will fill in a default value from the title. It has to be unique for each banner in the same category." COM_BANNERS_FIELD_ALT_DESC="Alternative text for the banner image." @@ -99,7 +99,7 @@ COM_BANNERS_FIELD_EXTRAINFO_DESC="Enter extra information for this client." COM_BANNERS_FIELD_EXTRAINFO_LABEL="Additional Information" COM_BANNERS_FIELD_HEIGHT_DESC="The height of the banner." COM_BANNERS_FIELD_HEIGHT_LABEL="Height" -COM_BANNERS_FIELD_IMAGE_DESC="Select an image for this banner. Images have to be in the /images/banners/ directory." +COM_BANNERS_FIELD_IMAGE_DESC="Select or upload an image for this banner. Images have to be in the /images/banners/ directory." COM_BANNERS_FIELD_IMAGE_LABEL="Image" COM_BANNERS_FIELD_IMPMADE_DESC="Displays the number of impressions made for the banner." COM_BANNERS_FIELD_IMPMADE_LABEL="Total Impressions" @@ -117,7 +117,7 @@ COM_BANNERS_FIELD_PUBLISH_UP_DESC="An optional date to Start Publishing the bann COM_BANNERS_FIELD_PUBLISH_UP_LABEL="Start Publishing" COM_BANNERS_FIELD_PURCHASETYPE_DESC="Select the type of purchase in the list." COM_BANNERS_FIELD_PURCHASETYPE_LABEL="Purchase Type" -COM_BANNERS_FIELD_STATE_DESC="Defines the status of the banner" +COM_BANNERS_FIELD_STATE_DESC="Defines the status of the banner." COM_BANNERS_FIELD_STICKY_DESC="Whether or not the Banner is 'pinned'. If one or more Banners in a Category are pinned, they will take priority over Banners that are not pinned. For example, if two Banners in a Category are pinned and a third Banner is not pinned, the third Banner will not display if the module setting is 'Pinned, Randomise'. Only the two pinned Banners will display." COM_BANNERS_FIELD_STICKY_LABEL="Pinned" COM_BANNERS_FIELD_TRACKCLICK_DESC="Record the number of clicks on the banners on a daily basis." @@ -203,7 +203,7 @@ COM_BANNERS_RESET_CLICKS="Reset clicks" COM_BANNERS_RESET_IMPMADE="Reset impressions" COM_BANNERS_SEARCH_IN_TITLE="Search in title" COM_BANNERS_SELECT_CLIENT="- Select Client -" -COM_BANNERS_SELECT_TYPE="- Type -" +COM_BANNERS_SELECT_TYPE="- Select Type -" COM_BANNERS_SUBMENU_BANNERS="Banners" COM_BANNERS_SUBMENU_CATEGORIES="Categories" COM_BANNERS_SUBMENU_CLIENTS="Clients" @@ -211,6 +211,7 @@ COM_BANNERS_SUBMENU_TRACKS="Tracks" COM_BANNERS_TRACKS_DELETE="Delete Tracks" COM_BANNERS_TRACKS_DOWNLOAD="Download tracks" COM_BANNERS_TRACKS_EXPORT="Export" +COM_BANNERS_TRACKS_NO_ITEMS_DELETED="No Tracks to Delete." COM_BANNERS_TRACKS_N_ITEMS_DELETED="%d tracks successfully deleted." COM_BANNERS_TRACKS_N_ITEMS_DELETED_1="%d track successfully deleted." COM_BANNERS_TYPE1="Impressions" diff --git a/administrator/language/en-GB/en-GB.com_cache.ini b/administrator/language/en-GB/en-GB.com_cache.ini index 64794d79307f1..a05cd50d548a6 100644 --- a/administrator/language/en-GB/en-GB.com_cache.ini +++ b/administrator/language/en-GB/en-GB.com_cache.ini @@ -18,7 +18,7 @@ COM_CACHE_PURGE_CACHE_ADMIN="Purge Cache Admin" COM_CACHE_PURGE_EXPIRED="Purge expired" COM_CACHE_PURGE_EXPIRED_ITEMS="Purge expired items" COM_CACHE_PURGE_INSTRUCTIONS="Click on the Purge Expired icon in the toolbar to delete all expired cache files. Note: Cache files that are still current will not be deleted." -COM_CACHE_RESOURCE_INTENSIVE_WARNING="WARNING: This can be resource intensive on sites with large number of items!" +COM_CACHE_RESOURCE_INTENSIVE_WARNING="WARNING: This can be resource intensive on sites with a large number of items!" COM_CACHE_SIZE="Size" COM_CACHE_SELECT_CLIENT="- Select Location -" COM_CACHE_XML_DESCRIPTION="Component for cache management." diff --git a/administrator/language/en-GB/en-GB.com_categories.ini b/administrator/language/en-GB/en-GB.com_categories.ini index 180044f981f91..840b76027aaf3 100644 --- a/administrator/language/en-GB/en-GB.com_categories.ini +++ b/administrator/language/en-GB/en-GB.com_categories.ini @@ -32,9 +32,11 @@ COM_CATEGORIES_FIELD_BASIC_LABEL="Options" COM_CATEGORIES_FIELD_HITS_DESC="Number of hits for this category." COM_CATEGORIES_FIELD_IMAGE_ALT_LABEL="Alt Text" COM_CATEGORIES_FIELD_IMAGE_ALT_DESC="Alternative text used for visitors without access to images." -COM_CATEGORIES_FIELD_IMAGE_DESC="Choose an image for this category." +COM_CATEGORIES_FIELD_IMAGE_DESC="Select or upload an image for this category." COM_CATEGORIES_FIELD_IMAGE_LABEL="Image" COM_CATEGORIES_FIELD_LANGUAGE_DESC="Assign a language to this category." +COM_CATEGORIES_FIELD_NOTE_DESC="An optional note to display in the category list." +COM_CATEGORIES_FIELD_NOTE_LABEL="Note" COM_CATEGORIES_FIELD_PARENT_DESC="Select a parent category." COM_CATEGORIES_FIELD_PARENT_LABEL="Parent" COM_CATEGORIES_FIELDSET_DETAILS="Category Details" diff --git a/administrator/language/en-GB/en-GB.com_config.ini b/administrator/language/en-GB/en-GB.com_config.ini index 7f185990eff2f..01880aa1a4c2e 100644 --- a/administrator/language/en-GB/en-GB.com_config.ini +++ b/administrator/language/en-GB/en-GB.com_config.ini @@ -50,7 +50,7 @@ COM_CONFIG_FIELD_DATABASE_TYPE_DESC="The type of database in use entered during COM_CONFIG_FIELD_DATABASE_TYPE_LABEL="Database Type" COM_CONFIG_FIELD_DATABASE_USERNAME_DESC="The username for access to your database entered during the installation process. Do not edit this field unless absolutely necessary (eg the transfer of the database to a new hosting provider)." COM_CONFIG_FIELD_DATABASE_USERNAME_LABEL="Database Username" -COM_CONFIG_FIELD_DEBUG_LANG_DESC="Select whether the debugging indicators (**...**) or (??...??) for the Joomla! Language files will be displayed. Debug Language will work without Debug System being activated, but you will not get the additional detailed references that will help you correct any errors." +COM_CONFIG_FIELD_DEBUG_LANG_DESC="Select whether the debugging indicators (**...**) or (??...??) for the Joomla Language files will be displayed. Debug Language will work without Debug System being activated, but you will not get the additional detailed references that will help you correct any errors." COM_CONFIG_FIELD_DEBUG_LANG_LABEL="Debug Language" COM_CONFIG_FIELD_DEBUG_SYSTEM_DESC="If enabled, diagnostic information, language translation and SQL errors (if present) will be displayed. The information will be displayed at the foot of every page you view within the Joomla Backend and Frontend. It is not advisable to leave the debug mode activated when running a live website." COM_CONFIG_FIELD_DEBUG_SYSTEM_LABEL="Debug System" @@ -80,7 +80,7 @@ COM_CONFIG_FRONTEDITING_MENUSANDMODULES_ADMIN_TOO="Modules & Menus (admin too)" COM_CONFIG_FRONTEDITING_MODULES="Modules" COM_CONFIG_FIELD_FORCE_SSL_DESC="Force site access to always occur under SSL (https) for selected areas. You will not be able to access selected areas under non-ssl. Note, you must have SSL enabled on your server to utilise this option." COM_CONFIG_FIELD_FORCE_SSL_LABEL="Force SSL" -COM_CONFIG_FIELD_FTP_ENABLE_DESC="Enable the built in FTP (File Transfer Protocol) functionality which is needed in some server environments to be used instead of the normal upload functionality of Joomla!" +COM_CONFIG_FIELD_FTP_ENABLE_DESC="Enable the built in FTP (File Transfer Protocol) functionality which is needed in some server environments to be used instead of the normal upload functionality of Joomla." COM_CONFIG_FIELD_FTP_ENABLE_LABEL="Enable FTP" COM_CONFIG_FIELD_FTP_HOST_DESC="Enter the name of the host of your FTP server." COM_CONFIG_FIELD_FTP_HOST_LABEL="FTP Host" @@ -142,19 +142,19 @@ COM_CONFIG_FIELD_REDIS_PORT_DESC="Redis server port." COM_CONFIG_FIELD_REDIS_PORT_LABEL="Redis Server Port" COM_CONFIG_FIELD_METAAUTHOR_DESC="Show the author meta tag when viewing articles." COM_CONFIG_FIELD_METAAUTHOR_LABEL="Show Author Meta Tag" -COM_CONFIG_FIELD_METADESC_DESC="Enter a description of the overall website that is to be used by search engines. Generally, a maximum of 20 words is optimal." +COM_CONFIG_FIELD_METADESC_DESC="Enter a description of the overall website that may be used by search engines. Generally, a maximum of 20 words is optimal." COM_CONFIG_FIELD_METADESC_LABEL="Site Meta Description" COM_CONFIG_FIELD_METAKEYS_DESC="Enter the keywords and phrases that best describe your website. Separate keywords and phrases with a comma." COM_CONFIG_FIELD_METAKEYS_LABEL="Site Meta Keywords" COM_CONFIG_FIELD_METALANGUAGE_DESC="Places the selected language in the metadata for the site." COM_CONFIG_FIELD_METALANGUAGE_LABEL="Site Meta Language" -COM_CONFIG_FIELD_METAVERSION_LABEL="Show Joomla! Version" -COM_CONFIG_FIELD_METAVERSION_DESC="Show the Joomla! version number in the generator meta tag." -COM_CONFIG_FIELD_OFFLINE_IMAGE_DESC="An optional image to be displayed on the default offline page. Make sure the image is less than 400px wide." +COM_CONFIG_FIELD_METAVERSION_LABEL="Show Joomla Version" +COM_CONFIG_FIELD_METAVERSION_DESC="Show the Joomla version number in the generator meta tag." +COM_CONFIG_FIELD_OFFLINE_IMAGE_DESC="Select or upload an optional image to be displayed on the default offline page. Make sure the image is less than 400px wide." COM_CONFIG_FIELD_OFFLINE_IMAGE_LABEL="Offline Image" COM_CONFIG_FIELD_OFFLINE_MESSAGE_DESC="The custom offline message will be used if the 'Offline Message' field is set to 'Use Custom Message'." COM_CONFIG_FIELD_OFFLINE_MESSAGE_LABEL="Custom Message" -COM_CONFIG_FIELD_PROXY_ENABLE_DESC="Enable Joomla to use a proxy which is needed in some server environments in order to fetch URLs like in the Joomla! Update component." +COM_CONFIG_FIELD_PROXY_ENABLE_DESC="Enable Joomla to use a proxy which is needed in some server environments in order to fetch URLs like in the Joomla Update component." COM_CONFIG_FIELD_PROXY_ENABLE_LABEL="Enable Proxy" COM_CONFIG_FIELD_PROXY_HOST_DESC="Enter the name of the host of your Proxy server." COM_CONFIG_FIELD_PROXY_HOST_LABEL="Proxy Host" @@ -164,7 +164,7 @@ COM_CONFIG_FIELD_PROXY_PORT_DESC="Enter the port that Proxy should be accessed b COM_CONFIG_FIELD_PROXY_PORT_LABEL="Proxy Port" COM_CONFIG_FIELD_PROXY_USERNAME_DESC="The username used to access the Proxy server." COM_CONFIG_FIELD_PROXY_USERNAME_LABEL="Proxy Username" -COM_CONFIG_FIELD_SECRET_DESC="This is an auto-generated, unique alphanumeric code for every Joomla! installation. It is used for security functions." +COM_CONFIG_FIELD_SECRET_DESC="This is an auto-generated, unique alphanumeric code for every Joomla installation. It is used for security functions." COM_CONFIG_FIELD_SECRET_LABEL="Secret" COM_CONFIG_FIELD_SEF_REWRITE_DESC="Select to use a server's rewrite engine to catch URLs that meet specific conditions and rewrite them as directed. Available for IIS 7 and Apache.
    Apache users only!
    Rename htaccess.txt to .htaccess before activating.
    IIS 7 users only!
    Rename web.config.txt to web.config and install IIS URL Rewrite Module before activating.
    " COM_CONFIG_FIELD_SEF_REWRITE_LABEL="Use URL Rewriting" @@ -174,7 +174,7 @@ COM_CONFIG_FIELD_SEF_URL_DESC="Select whether or not the URLs are optimised for COM_CONFIG_FIELD_SEF_URL_LABEL="Search Engine Friendly URLs" COM_CONFIG_FIELD_SERVER_TIMEZONE_DESC="Choose a city in the list to configure the date and time for display." COM_CONFIG_FIELD_SERVER_TIMEZONE_LABEL="Server Time Zone" -COM_CONFIG_FIELD_SESSION_HANDLER_DESC="The mechanism by which Joomla! identifies a User once they are connected to the website using non-persistent cookies." +COM_CONFIG_FIELD_SESSION_HANDLER_DESC="The mechanism by which Joomla identifies a User once they are connected to the website using non-persistent cookies." COM_CONFIG_FIELD_SESSION_HANDLER_LABEL="Session Handler" COM_CONFIG_FIELD_SESSION_TIME_DESC="Auto log out a User after they have been inactive for the entered number of minutes. Do not set too high." COM_CONFIG_FIELD_SESSION_TIME_LABEL="Session Lifetime" @@ -213,7 +213,7 @@ COM_CONFIG_FIELD_VALUE_SSL="SSL" COM_CONFIG_FIELD_VALUE_SYSTEM_DEFAULT="System Default" COM_CONFIG_FIELD_VALUE_TLS="TLS" COM_CONFIG_FTP_DETAILS="FTP Login Details" -COM_CONFIG_FTP_DETAILS_TIP="For updating your configuration.php file, Joomla! will most likely need your FTP account details. Please enter them in the form fields below." +COM_CONFIG_FTP_DETAILS_TIP="For updating your configuration.php file, Joomla will most likely need your FTP account details. Please enter them in the form fields below." COM_CONFIG_FTP_SETTINGS="FTP Settings" COM_CONFIG_GLOBAL_CONFIGURATION="Global Configuration" COM_CONFIG_HELPREFRESH_SUCCESS="The Help Sites list has been refreshed." diff --git a/administrator/language/en-GB/en-GB.com_contact.ini b/administrator/language/en-GB/en-GB.com_contact.ini index 1c39b9812f73f..8fc01183c1f44 100644 --- a/administrator/language/en-GB/en-GB.com_contact.ini +++ b/administrator/language/en-GB/en-GB.com_contact.ini @@ -21,8 +21,10 @@ COM_CONTACT_CONTACT_VIEW_DEFAULT_DESC="This links to the contact information for COM_CONTACT_DETAILS="Contact Information" COM_CONTACT_EDIT_CONTACT="Contact" COM_CONTACT_EDIT_DETAILS="Edit contact information displayed on an individual page." -COM_CONTACT_ERROR_UNIQUE_ALIAS="Another Contact from this category has the same alias" +COM_CONTACT_ERROR_UNIQUE_ALIAS="Another Contact from this category has the same alias (remember it may be a trashed item)." COM_CONTACT_ERROR_ALL_LANGUAGE_ASSOCIATED="A contact item set to All languages can't be associated. Associations have not been set." +COM_CONTACT_FIELD_ARTICLES_DISPLAY_NUM_DESC="Number of articles to list." +COM_CONTACT_FIELD_ARTICLES_DISPLAY_NUM_LABEL="# Articles to List" COM_CONTACT_FIELD_ARTICLES_SHOW_DESC="If this contact is mapped to a user, and if this is set to Show, then a list of articles created by this user will show." COM_CONTACT_FIELD_ARTICLES_SHOW_LABEL="Show User Articles" COM_CONTACT_FIELD_BREADCRUMBS_DESC="Show/Hide category breadcrumbs." @@ -87,24 +89,24 @@ COM_CONTACT_FIELD_EMAIL_BANNED_TEXT_DESC="Text not allowed in contact form body. COM_CONTACT_FIELD_EMAIL_BANNED_TEXT_LABEL="Banned Text" COM_CONTACT_FIELD_EMAIL_EMAIL_COPY_DESC="Hide or Show checkbox to allow copy of email to be sent to submitter." COM_CONTACT_FIELD_EMAIL_EMAIL_COPY_LABEL="Send Copy to Submitter" -COM_CONTACT_FIELD_EMAIL_SHOW_FORM_DESC="Show or Hide contact form." +COM_CONTACT_FIELD_EMAIL_SHOW_FORM_DESC="Show or hide contact form." COM_CONTACT_FIELD_EMAIL_SHOW_FORM_LABEL="Show Contact Form" COM_CONTACT_FIELD_FEATURED_DESC="If marked yes, will be displayed in featured view." COM_CONTACT_FIELD_FEEDLINK_DESC="Show/Hide a feed link for this contact category." COM_CONTACT_FIELD_FEEDLINK_LABEL="Feed Link" -COM_CONTACT_FIELD_ICONS_ADDRESS_DESC="Select the Address icon. If none selected, the default icon will be displayed." +COM_CONTACT_FIELD_ICONS_ADDRESS_DESC="Select or upload an image for the Address icon. If none selected, the default icon will be displayed." COM_CONTACT_FIELD_ICONS_ADDRESS_LABEL="Address Icon" -COM_CONTACT_FIELD_ICONS_EMAIL_DESC="Select the Email icon. If none selected, the default icon will be displayed." +COM_CONTACT_FIELD_ICONS_EMAIL_DESC="Select or upload an image for the Email icon. If none selected, the default icon will be displayed." COM_CONTACT_FIELD_ICONS_EMAIL_LABEL="Email Icon" -COM_CONTACT_FIELD_ICONS_FAX_DESC="Select the Fax icon. If none selected, the default icon will be displayed." +COM_CONTACT_FIELD_ICONS_FAX_DESC="Select or upload an image for the Fax icon. If none selected, the default icon will be displayed." COM_CONTACT_FIELD_ICONS_FAX_LABEL="Fax Icon" -COM_CONTACT_FIELD_ICONS_MISC_DESC="Select the Misc icon. If none selected, the default icon will be displayed." +COM_CONTACT_FIELD_ICONS_MISC_DESC="Select or upload an image for the Misc icon. If none selected, the default icon will be displayed." COM_CONTACT_FIELD_ICONS_MISC_LABEL="Misc Icon" -COM_CONTACT_FIELD_ICONS_MOBILE_DESC="Select the Mobile icon. If none selected, the default icon will be displayed." +COM_CONTACT_FIELD_ICONS_MOBILE_DESC="Select or upload an image for the Mobile icon. If none selected, the default icon will be displayed." COM_CONTACT_FIELD_ICONS_MOBILE_LABEL="Mobile Icon" COM_CONTACT_FIELD_ICONS_SETTINGS_DESC="Choose whether to display icons, text or nothing next to the information." COM_CONTACT_FIELD_ICONS_SETTINGS_LABEL="Settings" -COM_CONTACT_FIELD_ICONS_TELEPHONE_DESC="Select the Telephone icon. If none selected, the default icon will be displayed." +COM_CONTACT_FIELD_ICONS_TELEPHONE_DESC="Select or upload an image for the Telephone icon. If none selected, the default icon will be displayed." COM_CONTACT_FIELD_ICONS_TELEPHONE_LABEL="Telephone Icon" COM_CONTACT_FIELD_IMAGE_ALIGN_DESC="Alignment of the image." COM_CONTACT_FIELD_IMAGE_ALIGN_LABEL="Image Alignment" @@ -152,37 +154,37 @@ COM_CONTACT_FIELD_LINKD_NAME_LABEL="Link D Label" COM_CONTACT_FIELD_LINKE_DESC="Enter a URL for Link E." COM_CONTACT_FIELD_LINKE_LABEL="Link E URL" COM_CONTACT_FIELD_LINKE_NAME_LABEL="Link E Label" -COM_CONTACT_FIELD_LINKED_USER_DESC="Linked Joomla! user." +COM_CONTACT_FIELD_LINKED_USER_DESC="Linked Joomla User." COM_CONTACT_FIELD_LINKED_USER_LABEL="Linked User" 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" COM_CONTACT_FIELD_NUM_CONTACTS_DESC="Number of Contacts to display as list." COM_CONTACT_FIELD_NUM_CONTACTS_LABEL="Number of Contacts" -COM_CONTACT_FIELD_PARAMS_CONTACT_E_MAIL_DESC="Show or Hide contact email." -COM_CONTACT_FIELD_PARAMS_CONTACT_POSITION_DESC="Show or Hide position." +COM_CONTACT_FIELD_PARAMS_CONTACT_E_MAIL_DESC="Show or hide contact email." +COM_CONTACT_FIELD_PARAMS_CONTACT_POSITION_DESC="Show or hide position." COM_CONTACT_FIELD_PARAMS_CONTACT_POSITION_LABEL="Contact's Position" -COM_CONTACT_FIELD_PARAMS_COUNTRY_DESC="Show or Hide country." +COM_CONTACT_FIELD_PARAMS_COUNTRY_DESC="Show or hide country." COM_CONTACT_FIELD_PARAMS_COUNTRY_LABEL="Country" -COM_CONTACT_FIELD_PARAMS_FAX_DESC="Show or Hide fax number." +COM_CONTACT_FIELD_PARAMS_FAX_DESC="Show or hide fax number." COM_CONTACT_FIELD_PARAMS_FAX_LABEL="Fax" -COM_CONTACT_FIELD_PARAMS_IMAGE_DESC="Select the contact image." +COM_CONTACT_FIELD_PARAMS_IMAGE_DESC="Select or upload the contact image." COM_CONTACT_FIELD_PARAMS_IMAGE_LABEL="Image" -COM_CONTACT_FIELD_PARAMS_MISC_INFO_DESC="Show or Hide miscellaneous information." +COM_CONTACT_FIELD_PARAMS_MISC_INFO_DESC="Show or hide miscellaneous information." COM_CONTACT_FIELD_PARAMS_MISC_INFO_LABEL="Misc. Information" -COM_CONTACT_FIELD_PARAMS_MOBILE_DESC="Show or Hide mobile number." +COM_CONTACT_FIELD_PARAMS_MOBILE_DESC="Show or hide mobile number." COM_CONTACT_FIELD_PARAMS_MOBILE_LABEL="Mobile Phone" COM_CONTACT_FIELD_PARAMS_NAME_DESC="Show name of the contact." COM_CONTACT_FIELD_PARAMS_NAME_LABEL="Name" -COM_CONTACT_FIELD_PARAMS_POST-ZIP_CODE_DESC="Show or Hide postal or zip code." +COM_CONTACT_FIELD_PARAMS_POST-ZIP_CODE_DESC="Show or hide postal or zip code." COM_CONTACT_FIELD_PARAMS_POST-ZIP_CODE_LABEL="Postal Code" -COM_CONTACT_FIELD_PARAMS_SHOW_IMAGE_DESC="Show or Hide image." +COM_CONTACT_FIELD_PARAMS_SHOW_IMAGE_DESC="Show or hide image." COM_CONTACT_FIELD_PARAMS_SHOW_IMAGE_LABEL="Image" -COM_CONTACT_FIELD_PARAMS_STATE-COUNTY_DESC="Show or Hide state or county." +COM_CONTACT_FIELD_PARAMS_STATE-COUNTY_DESC="Show or hide state or county." COM_CONTACT_FIELD_PARAMS_STATE-COUNTY_LABEL="State or County" -COM_CONTACT_FIELD_PARAMS_STREET_ADDRESS_DESC="Show or Hide street address." +COM_CONTACT_FIELD_PARAMS_STREET_ADDRESS_DESC="Show or hide street address." COM_CONTACT_FIELD_PARAMS_STREET_ADDRESS_LABEL="Street Address" -COM_CONTACT_FIELD_PARAMS_TELEPHONE_DESC="Show or Hide telephone number." +COM_CONTACT_FIELD_PARAMS_TELEPHONE_DESC="Show or hide telephone number." COM_CONTACT_FIELD_PARAMS_TELEPHONE_LABEL="Telephone" COM_CONTACT_FIELD_PARAMS_TOWN-SUBURB_DESC="Show or hide city or suburb." COM_CONTACT_FIELD_PARAMS_TOWN-SUBURB_LABEL="City or Suburb" @@ -198,7 +200,7 @@ COM_CONTACT_FIELD_PUBLISH_DOWN_DESC="An optional date to Finish Publishing the c COM_CONTACT_FIELD_PUBLISH_DOWN_LABEL="Finish Publishing" COM_CONTACT_FIELD_PUBLISH_UP_DESC="An optional date to Start Publishing the contact." COM_CONTACT_FIELD_PUBLISH_UP_LABEL="Start Publishing" -COM_CONTACT_FIELD_SHOW_CAT_ITEMS_DESC="Show or Hide the number of contacts in category." +COM_CONTACT_FIELD_SHOW_CAT_ITEMS_DESC="Show or hide the number of contacts in category." COM_CONTACT_FIELD_SHOW_CAT_ITEMS_LABEL="# Contacts in Category" COM_CONTACT_FIELD_SHOW_CATEGORY_DESC="Displays the category." COM_CONTACT_FIELD_SHOW_LINKS_DESC="Show or hide the links." @@ -223,6 +225,7 @@ COM_CONTACT_FIELD_VALUE_SLIDERS="Sliders" COM_CONTACT_FIELD_VALUE_SORT_NAME="Sort Name" COM_CONTACT_FIELD_VALUE_TABS="Tabs" COM_CONTACT_FIELD_VALUE_TEXT="Text" +COM_CONTACT_FIELD_VALUE_USE_CONTACT_SETTINGS="Use Contact Settings" COM_CONTACT_FIELD_VALUE_WITH_LINK="Show With Link" COM_CONTACT_FIELD_VERSION_LABEL="Revision" COM_CONTACT_FIELD_VERSION_DESC="A count of the number of times this contact has been revised." diff --git a/administrator/language/en-GB/en-GB.com_content.ini b/administrator/language/en-GB/en-GB.com_content.ini index 98d37e31957ee..ff8e2b98be10a 100644 --- a/administrator/language/en-GB/en-GB.com_content.ini +++ b/administrator/language/en-GB/en-GB.com_content.ini @@ -52,7 +52,7 @@ COM_CONTENT_FIELD_CREATED_BY_LABEL="Created By" COM_CONTENT_FIELD_CREATED_DESC="Created date." COM_CONTENT_FIELD_CREATED_LABEL="Created Date" COM_CONTENT_FIELD_FEATURED_DESC="Assign the article to the featured blog layout." -COM_CONTENT_FIELD_FULL_DESC="Image for the single article display." +COM_CONTENT_FIELD_FULL_DESC="Select or upload an image for the single article display." COM_CONTENT_FIELD_FULL_LABEL="Full Article Image" COM_CONTENT_FIELD_FULLTEXT="Full text" COM_CONTENT_FIELD_HITS_DESC="Number of hits for this article." diff --git a/administrator/language/en-GB/en-GB.com_cpanel.ini b/administrator/language/en-GB/en-GB.com_cpanel.ini index 66f79d05a7fe1..a68536dbebacf 100644 --- a/administrator/language/en-GB/en-GB.com_cpanel.ini +++ b/administrator/language/en-GB/en-GB.com_cpanel.ini @@ -22,7 +22,7 @@ COM_CPANEL_MSG_EACCELERATOR_TITLE="eAccelerator is not compatible with Joomla!" COM_CPANEL_MSG_HTACCESS_BODY="A change to the default .htaccess and web.config files was made in Joomla! 3.4 to disallow directory listings by default. Users are recommended to implement this change in their files. Please see this page for more information." COM_CPANEL_MSG_HTACCESS_TITLE=".htaccess & web.config Update" COM_CPANEL_MSG_LANGUAGEACCESS340_TITLE="You have possible issues with your multilingual settings" -COM_CPANEL_MSG_LANGUAGEACCESS340_BODY="Since Joomla 3.4.0 you may have issues with the System - Language Filter plugin on your web site. To fix them please open the Language Manager and save each content language manually to make sure an Access level is saved." +COM_CPANEL_MSG_LANGUAGEACCESS340_BODY="Since Joomla! 3.4.0 you may have issues with the System - Language Filter plugin on your web site. To fix them please open the Language Manager and save each content language manually to make sure an Access level is saved." COM_CPANEL_MSG_PHPVERSION_BODY="Beginning with Joomla! 3.3, the version of PHP this site is using will no longer be supported. Joomla! 3.3 will require at least PHP version 5.3.10 in order to provide enhanced security features to its users." COM_CPANEL_MSG_PHPVERSION_TITLE="Your PHP Version Will Be Unsupported in Joomla! 3.3" COM_CPANEL_MSG_ROBOTS_TITLE="robots.txt Update" diff --git a/administrator/language/en-GB/en-GB.com_finder.ini b/administrator/language/en-GB/en-GB.com_finder.ini index c46d831babae2..3b3821aa3fa8a 100644 --- a/administrator/language/en-GB/en-GB.com_finder.ini +++ b/administrator/language/en-GB/en-GB.com_finder.ini @@ -136,7 +136,8 @@ COM_FINDER_INDEX_HEADING_INDEX_TYPE="Type" COM_FINDER_INDEX_HEADING_LINK_URL="Raw URL" COM_FINDER_INDEX_NO_CONTENT="No content matches your search criteria." COM_FINDER_INDEX_NO_DATA="No content has been indexed." -COM_FINDER_INDEX_PLUGIN_CONTENT_NOT_ENABLED="Smart Search content plugin is not enabled. Changes to content will not update the Smart Search index if you do not enable this plugin." +; Change 'Content%20-%20Smart%20Search' to the value for PLG_CONTENT_FINDER in plg_content_finder.sys.ini for your language +COM_FINDER_INDEX_PLUGIN_CONTENT_NOT_ENABLED="Smart Search content plugin is not enabled. Changes to content will not update the Smart Search index if you do not enable this plugin." COM_FINDER_INDEX_PURGE_SUCCESS="All items have been successfully purged." COM_FINDER_INDEX_TIP="Start the indexer by pressing the Index button in the toolbar." COM_FINDER_INDEX_TOOLBAR_PURGE="Purge" diff --git a/administrator/language/en-GB/en-GB.com_installer.ini b/administrator/language/en-GB/en-GB.com_installer.ini index 2af9caee29134..5cd54a23a8896 100644 --- a/administrator/language/en-GB/en-GB.com_installer.ini +++ b/administrator/language/en-GB/en-GB.com_installer.ini @@ -5,7 +5,7 @@ COM_INSTALLER="Installation Manager" COM_INSTALLER_AUTHOR_INFORMATION="Author Information" -COM_INSTALLER_CACHETIMEOUT_DESC="For how many hours should Joomla! cache extension update information." +COM_INSTALLER_CACHETIMEOUT_DESC="For how many hours should Joomla cache extension update information." COM_INSTALLER_CACHETIMEOUT_LABEL="Updates Caching (in hours)" COM_INSTALLER_CONFIGURATION="Installer configuration" COM_INSTALLER_ENABLED_UPDATES_1=", 1 disabled site was enabled." @@ -50,9 +50,9 @@ COM_INSTALLER_INSTALL_FROM_DIRECTORY="Install from Directory" COM_INSTALLER_INSTALL_FROM_URL="Install from URL" COM_INSTALLER_INSTALL_FROM_WEB="Install from Web" COM_INSTALLER_INSTALL_FROM_WEB_ADD_TAB="Add "Install from Web" tab" -COM_INSTALLER_INSTALL_FROM_WEB_INFO="Joomla! Extensions Directory (JED) now available with Install from Web on this page." +COM_INSTALLER_INSTALL_FROM_WEB_INFO="Joomla! Extensions Directory™ (JED) now available with Install from Web on this page." COM_INSTALLER_INSTALL_FROM_WEB_TOS="By clicking "_QQ_"Add Install from Web tab"_QQ_" below, you agree to the JED Terms of Service and all applicable third party license terms." -COM_INSTALLER_INSTALL_SUCCESS="Installing %s was successful." +COM_INSTALLER_INSTALL_SUCCESS="Installation of the %s was successful." COM_INSTALLER_INSTALL_URL="Install URL" COM_INSTALLER_INVALID_EXTENSION_UPDATE="Invalid extension update" COM_INSTALLER_LABEL_HIDEPROTECTED_DESC="Hide protected extensions. Protected extensions can't be uninstalled." @@ -84,9 +84,9 @@ COM_INSTALLER_MSG_DATABASE_SCHEMA_VERSION="Database schema version (in #__schema COM_INSTALLER_MSG_DATABASE_SKIPPED="%s database changes did not alter table structure and were skipped." COM_INSTALLER_MSG_DATABASE_UPDATE_VERSION="Update version (in #__extensions): %s." COM_INSTALLER_MSG_DATABASE_UPDATEVERSION_ERROR="Database update version (%s) does not match CMS version (%s)." -COM_INSTALLER_MSG_DESCFTP="For installing or uninstalling Extensions, Joomla! will most likely need your FTP account details. Please enter them in the form fields below." +COM_INSTALLER_MSG_DESCFTP="For installing or uninstalling Extensions, Joomla will most likely need your FTP account details. Please enter them in the form fields below." COM_INSTALLER_MSG_DESCFTPTITLE="FTP Login Details" -COM_INSTALLER_MSG_DISCOVER_DESCRIPTION="This screen allows you to discover extensions that have not gone through the normal installation process.
    For example, some extensions are too large in file size to upload using the web interface due to limitations of the web hosting environment. Using this feature you can upload extension files directly to your web server using some other means such as FTP or SFTP and place those extension files into the appropriate directory.
    You can then use the discover feature to find the newly uploaded extension and activate it in your Joomla! installation.
    Using the discover operation you can also discover and install multiple extensions at the same time." +COM_INSTALLER_MSG_DISCOVER_DESCRIPTION="This screen allows you to discover extensions that have not gone through the normal installation process.
    For example, some extensions are too large in file size to upload using the web interface due to limitations of the web hosting environment. Using this feature you can upload extension files directly to your web server using some other means such as FTP or SFTP and place those extension files into the appropriate directory.
    You can then use the discover feature to find the newly uploaded extension and activate it in your Joomla installation.
    Using the discover operation you can also discover and install multiple extensions at the same time." COM_INSTALLER_MSG_DISCOVER_FAILEDTOPURGEEXTENSIONS="Failed to purge extensions" COM_INSTALLER_MSG_DISCOVER_INSTALLFAILED="Discover install failed." COM_INSTALLER_MSG_DISCOVER_INSTALLSUCCESSFUL="Discover install successful." @@ -105,7 +105,7 @@ COM_INSTALLER_MSG_INSTALL_WARNINSTALLUPLOADERROR="There was an error uploading t COM_INSTALLER_MSG_INSTALL_WARNINSTALLZLIB="The installer can't continue until Zlib is installed." COM_INSTALLER_MSG_LANGUAGES_CANT_FIND_REMOTE_MANIFEST="The installer can't get the URL to the XML manifest file of the %s language." COM_INSTALLER_MSG_LANGUAGES_CANT_FIND_REMOTE_PACKAGE="The installer can't get the URL to the remote %s language." -COM_INSTALLER_MSG_LANGUAGES_NOLANGUAGES="There are no available languages to install at the moment. Please click on the "Find languages" button to check for updates on the Joomla Languages server. You will need an internet connection for this to work." +COM_INSTALLER_MSG_LANGUAGES_NOLANGUAGES="There are no available languages to install at the moment. Please click on the "Find languages" button to check for updates on the Joomla! Languages server. You will need an internet connection for this to work." COM_INSTALLER_MSG_LANGUAGES_TRY_LATER="Try again later or contact the language team coordinator" COM_INSTALLER_MSG_MANAGE_NOEXTENSION="There are no extensions installed matching your query." COM_INSTALLER_MSG_MANAGE_NOUPDATESITE="There are no update sites matching your query." @@ -121,10 +121,10 @@ COM_INSTALLER_MSG_WARNINGFURTHERINFO="Further information on warnings" COM_INSTALLER_MSG_WARNINGFURTHERINFODESC="For more information on warnings, see the Joomla! Documentation Site." COM_INSTALLER_MSG_WARNINGS_FILEUPLOADISDISABLEDDESC="File uploads are required to upload extensions into the installer." COM_INSTALLER_MSG_WARNINGS_FILEUPLOADSDISABLED="File uploads disabled." -COM_INSTALLER_MSG_WARNINGS_JOOMLATMPNOTSET="The Joomla! temporary directory is not set." -COM_INSTALLER_MSG_WARNINGS_JOOMLATMPNOTSETDESC="The Joomla! temporary directory is where Joomla! copies an extension, extracts the extension and the files are copied into the correct directories. If this configuration is not set in configuration.php ($tmp_path) then you won't be able to upload extensions. Create a directory to enable Joomla! to write to the directory to fix the issue." -COM_INSTALLER_MSG_WARNINGS_JOOMLATMPNOTWRITEABLE="Joomla temporary directory not writable or does not exist." -COM_INSTALLER_MSG_WARNINGS_JOOMLATMPNOTWRITEABLEDESC="The Joomla temporary directory is not writeable by the Joomla! instance, or may not exist, which may cause issues when attempting to upload extensions to Joomla! If you are having issues uploading extensions, make sure the directory defined in your configuration.php exists or check the '%s' and set it to be writeable and see if this fixes the issue." +COM_INSTALLER_MSG_WARNINGS_JOOMLATMPNOTSET="The Joomla temporary directory is not set." +COM_INSTALLER_MSG_WARNINGS_JOOMLATMPNOTSETDESC="The Joomla temporary directory is where Joomla copies an extension, extracts the extension and the files are copied into the correct directories. If this configuration is not set in configuration.php ($tmp_path) then you won't be able to upload extensions. Create a directory to enable Joomla to write to the directory to fix the issue." +COM_INSTALLER_MSG_WARNINGS_JOOMLATMPNOTWRITEABLE="The Joomla temporary directory is not writable or does not exist." +COM_INSTALLER_MSG_WARNINGS_JOOMLATMPNOTWRITEABLEDESC="The Joomla temporary directory is not writeable by the Joomla instance, or may not exist, which may cause issues when attempting to upload extensions to Joomla. If you are having issues uploading extensions, make sure the directory defined in your configuration.php exists or check the '%s' and set it to be writeable and see if this fixes the issue." COM_INSTALLER_MSG_WARNINGS_LOWMEMORYDESC="Low PHP memory limit." COM_INSTALLER_MSG_WARNINGS_LOWMEMORYWARN="Your PHP memory limit is set below 8MB which may cause some issues when installing large extensions. Please set your memory limit to at least 16MB." COM_INSTALLER_MSG_WARNINGS_MEDMEMORYDESC="Potentially low PHP memory limit." @@ -132,16 +132,16 @@ COM_INSTALLER_MSG_WARNINGS_MEDMEMORYWARN="Your PHP memory limit is set below 16M COM_INSTALLER_MSG_WARNINGS_NONE="No warnings detected." COM_INSTALLER_MSG_WARNINGS_NOTCOMPLETE="

    Warning: Update Not Complete!

    The update is only partially complete. Please do the second update to complete the process.

    " COM_INSTALLER_MSG_WARNINGS_PHPUPLOADNOTSET="The PHP temporary directory is not set." -COM_INSTALLER_MSG_WARNINGS_PHPUPLOADNOTSETDESC="The PHP temporary directory is the directory that PHP uses to store an uploaded file before Joomla! can access this file. Whilst the directory not being set isn't always a problem, if you are having issues with manifest files not being detected or uploaded files not being detected, setting this in your php.ini file might fix the issue." +COM_INSTALLER_MSG_WARNINGS_PHPUPLOADNOTSETDESC="The PHP temporary directory is the directory that PHP uses to store an uploaded file before Joomla can access this file. Whilst the directory not being set isn't always a problem, if you are having issues with manifest files not being detected or uploaded files not being detected, setting this in your php.ini file might fix the issue." COM_INSTALLER_MSG_WARNINGS_PHPUPLOADNOTWRITEABLE="The PHP temporary directory is not writeable." -COM_INSTALLER_MSG_WARNINGS_PHPUPLOADNOTWRITEABLEDESC="The PHP temporary directory is not writeable by the Joomla! instance, which may cause issues when attempting to upload extensions to Joomla! If you are having issues uploading extensions, check the '%s' and set it to be writeable and see if this fixes the issue." +COM_INSTALLER_MSG_WARNINGS_PHPUPLOADNOTWRITEABLEDESC="The PHP temporary directory is not writeable by the Joomla! instance, which may cause issues when attempting to upload extensions to Joomla. If you are having issues uploading extensions, check the '%s' and set it to be writeable and see if this fixes the issue." COM_INSTALLER_MSG_WARNINGS_SMALLPOSTSIZE="Small PHP maximum POST size." COM_INSTALLER_MSG_WARNINGS_SMALLPOSTSIZEDESC="The maximum POST size sets the most amount of data that can be sent via POST to the server. This includes form submissions for articles, media (images, videos) and extensions. This value is less than 8MB which may impact on uploading large extensions. This is set in the php.ini under post_max_size." COM_INSTALLER_MSG_WARNINGS_SMALLUPLOADSIZE="Maximum PHP file upload size is too small: This is set in php.ini in both upload_max_filesize and post_max_size settings of your PHP settings (located in php.ini and/or .htaccess file)." COM_INSTALLER_MSG_WARNINGS_SMALLUPLOADSIZEDESC="The maximum file size for uploads is set to less than 8MB which may impact on uploading large extensions." COM_INSTALLER_MSG_WARNINGS_UPDATE_NOTICE="Before updating ensure that the update is compatible with your Joomla! installation." COM_INSTALLER_MSG_WARNINGS_UPLOADBIGGERTHANPOST="PHP Upload Size bigger than POST size." -COM_INSTALLER_MSG_WARNINGS_UPLOADBIGGERTHANPOSTDESC="The value of the upload_max_filesize in the php.ini file is greater than the post_max_size variable. The post_max_size variable will take precedence here and block requests larger than it. This is generally a server misconfiguration when trying to increase upload sizes. Please increase the upload_max_filesize to at least match the post_max_size variable or vice versa." +COM_INSTALLER_MSG_WARNINGS_UPLOADBIGGERTHANPOSTDESC="The value of the upload_max_filesize in the php.ini file is greater than the post_max_size variable. The post_max_size variable will take precedence and block requests larger than it. This is generally a server misconfiguration when trying to increase upload sizes. Please increase the upload_max_filesize to at least match the post_max_size variable or vice versa." COM_INSTALLER_N_EXTENSIONS_PUBLISHED="%d extensions successfully enabled." COM_INSTALLER_N_EXTENSIONS_PUBLISHED_1="%d extension successfully enabled." COM_INSTALLER_N_EXTENSIONS_UNPUBLISHED="%d extensions successfully disabled." @@ -156,11 +156,11 @@ COM_INSTALLER_PACKAGE_DOWNLOAD_FAILED="Package download failed: %s" COM_INSTALLER_PACKAGE_FILE="Package File" COM_INSTALLER_PREFERENCES_DESCRIPTION="Fine tune how extensions installation and updates work." COM_INSTALLER_PREFERENCES_LABEL="Preferences" -COM_INSTALLER_SHOW_JED_INFORMATION_DESC="Show or hide the information at the top of the installer page about the Joomla! Extensions Directory." +COM_INSTALLER_SHOW_JED_INFORMATION_DESC="Show or hide the information at the top of the installer page about the Joomla! Extensions Directory™." COM_INSTALLER_SHOW_JED_INFORMATION_HIDE_MESSAGE="Hide message" COM_INSTALLER_SHOW_JED_INFORMATION_LABEL="Joomla! Extensions Directory" COM_INSTALLER_SHOW_JED_INFORMATION_SHOW_MESSAGE="Show message" -COM_INSTALLER_SHOW_JED_INFORMATION_TOOLTIP="Opens Installer Options for setting to hide this Joomla! Extensions Directory message." +COM_INSTALLER_SHOW_JED_INFORMATION_TOOLTIP="Opens Installer Options for setting to hide this Joomla! Extensions Directory™ message." COM_INSTALLER_SUBMENU_DATABASE="Database" COM_INSTALLER_SUBMENU_DISCOVER="Discover" COM_INSTALLER_SUBMENU_INSTALL="Install" @@ -205,7 +205,7 @@ COM_INSTALLER_TYPE_TYPE_TEMPLATE="template" COM_INSTALLER_UNABLE_TO_FIND_INSTALL_PACKAGE="Unable to find install package" COM_INSTALLER_UNINSTALL_ERROR="Error uninstalling %s." COM_INSTALLER_UNINSTALL_LANGUAGE="A language should always have been installed as a package.
    To uninstall a language, filter type by package and uninstall the package." -COM_INSTALLER_UNINSTALL_SUCCESS="Uninstalling %s was successful." +COM_INSTALLER_UNINSTALL_SUCCESS="Uninstalling the %s was successful." COM_INSTALLER_UPLOAD_AND_INSTALL="Upload & Install" COM_INSTALLER_UPLOAD_INSTALL_JOOMLA_EXTENSION="Upload & Install Joomla Extension" COM_INSTALLER_UPLOAD_PACKAGE_FILE="Upload Package File" diff --git a/administrator/language/en-GB/en-GB.com_joomlaupdate.ini b/administrator/language/en-GB/en-GB.com_joomlaupdate.ini index a73060a6e94a8..7a1f10967d53b 100644 --- a/administrator/language/en-GB/en-GB.com_joomlaupdate.ini +++ b/administrator/language/en-GB/en-GB.com_joomlaupdate.ini @@ -1,16 +1,16 @@ ; Joomla! Project ; Copyright (C) 2005 - 2015 Open Source Matters. All rights reserved. ; 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 - No BOM +; Note : All ini files need to be saved as UTF-8 COM_JOOMLAUPDATE_CONFIG_CUSTOMURL_DESC="This is a custom XML update source URL, used only when the "Update Source" option is set to "Custom URL"." COM_JOOMLAUPDATE_CONFIG_CUSTOMURL_LABEL="Custom URL" -COM_JOOMLAUPDATE_CONFIG_SOURCES_DESC="Configure where Joomla! gets its update information from." +COM_JOOMLAUPDATE_CONFIG_SOURCES_DESC="Configure where Joomla gets its update information from." COM_JOOMLAUPDATE_CONFIG_SOURCES_LABEL="Update Source" COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_CUSTOM="Custom URL" COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_CUSTOM_ERROR="The custom URL field is empty." COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_DEFAULT="Default" -COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_DESC="The update channel Joomla! will use to find out if there is an update available." +COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_DESC="The update channel Joomla will use to find out if there is an update available." COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_LABEL="Update Channel" COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_NEXT="Joomla! Next" COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_TESTING="Testing" @@ -24,7 +24,7 @@ COM_JOOMLAUPDATE_UPDATE_LOG_FINALISE="Finalising installation." COM_JOOMLAUPDATE_UPDATE_LOG_START="Update started by user %2$s (%1$s). Old version is %3$s." COM_JOOMLAUPDATE_UPDATE_LOG_INSTALL="Starting installation of new version." COM_JOOMLAUPDATE_UPDATE_LOG_URL="Downloading update file from %s." -COM_JOOMLAUPDATE_VIEW_COMPLETE_HEADING="Joomla! Version Update Status" +COM_JOOMLAUPDATE_VIEW_COMPLETE_HEADING="Joomla Version Update Status" COM_JOOMLAUPDATE_VIEW_COMPLETE_MESSAGE="Your site has been successfully updated. Your Joomla version is now %s." COM_JOOMLAUPDATE_VIEW_DEFAULT_DOWNLOAD_IN_PROGRESS="Downloading update file. Please wait ..." COM_JOOMLAUPDATE_VIEW_DEFAULT_FTP_DIRECTORY="FTP directory" @@ -33,26 +33,26 @@ COM_JOOMLAUPDATE_VIEW_DEFAULT_FTP_PASSWORD="FTP password" COM_JOOMLAUPDATE_VIEW_DEFAULT_FTP_PORT="FTP port" COM_JOOMLAUPDATE_VIEW_DEFAULT_FTP_USERNAME="FTP username" COM_JOOMLAUPDATE_VIEW_DEFAULT_INFOURL="Additional Information" -COM_JOOMLAUPDATE_VIEW_DEFAULT_INSTALLED="Installed Joomla! version" +COM_JOOMLAUPDATE_VIEW_DEFAULT_INSTALLED="Installed Joomla version" COM_JOOMLAUPDATE_VIEW_DEFAULT_INSTALLUPDATE="Install the Update" -COM_JOOMLAUPDATE_VIEW_DEFAULT_LATEST="Latest Joomla! version" +COM_JOOMLAUPDATE_VIEW_DEFAULT_LATEST="Latest Joomla version" COM_JOOMLAUPDATE_VIEW_DEFAULT_METHOD_DIRECT="Write files directly" COM_JOOMLAUPDATE_VIEW_DEFAULT_METHOD_FTP="Write files using FTP" COM_JOOMLAUPDATE_VIEW_DEFAULT_METHOD="Installation method" COM_JOOMLAUPDATE_VIEW_DEFAULT_NOUPDATES="No updates available." -COM_JOOMLAUPDATE_VIEW_DEFAULT_NOUPDATESNOTICE="You already have the latest Joomla! version, %s." +COM_JOOMLAUPDATE_VIEW_DEFAULT_NOUPDATESNOTICE="You already have the latest Joomla version, %s." COM_JOOMLAUPDATE_VIEW_DEFAULT_PACKAGE="Update package URL" -COM_JOOMLAUPDATE_VIEW_DEFAULT_UPDATEFOUND="A Joomla! update was found." -COM_JOOMLAUPDATE_VIEW_DEFAULT_UPDATE_NOTICE="Before you update Joomla!, ensure that the installed extensions are available for the new Joomla! version." +COM_JOOMLAUPDATE_VIEW_DEFAULT_UPDATEFOUND="A Joomla update was found." +COM_JOOMLAUPDATE_VIEW_DEFAULT_UPDATE_NOTICE="Before you update Joomla, ensure that the installed extensions are available for the new Joomla version." COM_JOOMLAUPDATE_VIEW_DEFAULT_UPDATES_INFO_CUSTOM="You are on the "%s" update channel. This is not an official Joomla! update channel." 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_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_PROGRESS="Update progress" COM_JOOMLAUPDATE_VIEW_UPDATE_BYTESEXTRACTED="Bytes extracted" COM_JOOMLAUPDATE_VIEW_UPDATE_BYTESREAD="Bytes read" COM_JOOMLAUPDATE_VIEW_UPDATE_DOWNLOADFAILED="Download of update package failed." COM_JOOMLAUPDATE_VIEW_UPDATE_FILESEXTRACTED="Files extracted" -COM_JOOMLAUPDATE_VIEW_UPDATE_INPROGRESS="Updating your Joomla! files. Please wait ..." +COM_JOOMLAUPDATE_VIEW_UPDATE_INPROGRESS="Updating your Joomla files. Please wait ..." COM_JOOMLAUPDATE_VIEW_UPDATE_PERCENT="Percent complete" -COM_JOOMLAUPDATE_XML_DESCRIPTION="Updates Joomla! to the latest version with one click." +COM_JOOMLAUPDATE_XML_DESCRIPTION="Updates Joomla to the latest version with one click." diff --git a/administrator/language/en-GB/en-GB.com_joomlaupdate.sys.ini b/administrator/language/en-GB/en-GB.com_joomlaupdate.sys.ini index d0d992eaa25dc..fc0820108eacd 100644 --- a/administrator/language/en-GB/en-GB.com_joomlaupdate.sys.ini +++ b/administrator/language/en-GB/en-GB.com_joomlaupdate.sys.ini @@ -4,4 +4,4 @@ ; Note : All ini files need to be saved as UTF-8 COM_JOOMLAUPDATE="Joomla! Update" -COM_JOOMLAUPDATE_XML_DESCRIPTION="One-click update to the latest Joomla! release." \ No newline at end of file +COM_JOOMLAUPDATE_XML_DESCRIPTION="One-click update to the latest Joomla release." diff --git a/administrator/language/en-GB/en-GB.com_languages.ini b/administrator/language/en-GB/en-GB.com_languages.ini index 808135ae5e3d7..1742d6372bb36 100644 --- a/administrator/language/en-GB/en-GB.com_languages.ini +++ b/administrator/language/en-GB/en-GB.com_languages.ini @@ -25,17 +25,17 @@ COM_LANGUAGES_OVERRIDE_FIELD_FILE_DESC="Language overrides are stored in a speci COM_LANGUAGES_OVERRIDE_FIELD_LANGUAGE_LABEL="Language" COM_LANGUAGES_OVERRIDE_FIELD_LANGUAGE_DESC="Language for which the constant is overridden." COM_LANGUAGES_OVERRIDE_FIELD_KEY_LABEL="Language Constant" -COM_LANGUAGES_OVERRIDE_FIELD_KEY_DESC="The language constant of the string you want to override.
    Each language output text on your site is identified by a specific language constant which you have to use for creating an override of the text.
    If you don't know the corresponding constant you can search for text you want to change on the right. By clicking on the desired result the correct constant will automatically be inserted into the form." +COM_LANGUAGES_OVERRIDE_FIELD_KEY_DESC="The language constant of the string you want to override.
    All text on your site is identified by a specific language constant which you have to use for creating an override of the text.
    If you don't know the corresponding constant you can search for text you want to change on the right. By clicking on the desired result the correct constant will automatically be inserted into the form." COM_LANGUAGES_OVERRIDE_FIELD_OVERRIDE_LABEL="Text" -COM_LANGUAGES_OVERRIDE_FIELD_OVERRIDE_DESC="Here you can enter the text which you want to be displayed instead of the overridden one.
    Please note that there may be placeholders (eg %s, %d or %1$s) in the text which could be important (they will be replaced by other texts afore displaying), so you should leave them in there." +COM_LANGUAGES_OVERRIDE_FIELD_OVERRIDE_DESC="Enter the text that you want to be displayed instead of the original one.
    Please note that there may be placeholders (eg %s, %d or %1$s) in the text which could be important (they will be replaced by other texts before displaying), so you should leave them in there." COM_LANGUAGES_OVERRIDE_FIELD_SEARCHSTRING_LABEL="Search Text" COM_LANGUAGES_OVERRIDE_FIELD_SEARCHSTRING_DESC="Please enter the text to search for here. It may be in any of the language files." COM_LANGUAGES_OVERRIDE_FIELD_SEARCHTYPE_LABEL="Search For" -COM_LANGUAGES_OVERRIDE_FIELD_SEARCHTYPE_DESC="Here you can select whether you want to search for constant names or the values (thus the actual texts)." +COM_LANGUAGES_OVERRIDE_FIELD_SEARCHTYPE_DESC="Select whether you want to search for constant names or the values (the actual text)." COM_LANGUAGES_OVERRIDE_FIELD_SEARCHTYPE_CONSTANT="Constant" COM_LANGUAGES_OVERRIDE_FIELD_SEARCHTYPE_TEXT="Value" COM_LANGUAGES_FIELD_PUBLISHED_DESC="Whether this content language is published or not. If published, it will display as a choice in the Language Switcher module in Frontend." -COM_LANGUAGES_FIELD_LANG_CODE_DESC="This Language Code will be appended to the site URL. When SEF is enabled, one will get http://example.com/en/. If SEF is disabled the suffix &lang=en will be appended at the end of the URL. Note the Language Code must be unique among all the languages." +COM_LANGUAGES_FIELD_LANG_CODE_DESC="This Language Code will be appended to the site URL. When SEF is enabled, you will get http://example.com/en/. If SEF is disabled the suffix &lang=en will be appended at the end of the URL. Note the Language Code must be unique among all the languages." COM_LANGUAGES_FIELD_LANG_CODE_LABEL="URL Language Code" COM_LANGUAGES_FIELD_SITE_NAME_DESC="Enter a custom site name for this content language. If the site name is set to display, this custom site name will be used instead of the Global Configuration setting." COM_LANGUAGES_FIELD_SITE_NAME_LABEL="Custom Site Name" @@ -44,7 +44,7 @@ COM_LANGUAGES_FIELD_TITLE_DESC="The name of the language as it will appear in th COM_LANGUAGES_FIELD_TITLE_NATIVE_DESC="Title in native language." COM_LANGUAGES_FIELD_TITLE_NATIVE_LABEL="Title Native" COM_LANGUAGES_FILTER_CLIENT_LABEL="Filter Location:" -COM_LANGUAGES_FTP_DESC="For setting Languages as default, Joomla! will most likely need your FTP account details. Please enter them in the form fields below." +COM_LANGUAGES_FTP_DESC="For setting Languages as default, Joomla will most likely need your FTP account details. Please enter them in the form fields below." COM_LANGUAGES_FTP_TITLE="FTP Login Details" COM_LANGUAGES_HEADING_AUTHOR_EMAIL="Author Email" COM_LANGUAGES_HEADING_DEFAULT="Default" @@ -65,7 +65,7 @@ COM_LANGUAGES_MULTILANGSTATUS_HOMES_PUBLISHED_INCLUDING_ALL="Published Default H COM_LANGUAGES_MULTILANGSTATUS_LANGSWITCHER_PUBLISHED="Published Language Switcher Modules." COM_LANGUAGES_MULTILANGSTATUS_LANGSWITCHER_UNPUBLISHED="This site is set as a multilingual site, at least one Language Switcher module set to language "All" has to be published. Disregard this message if you do not use a language switcher module but direct links." COM_LANGUAGES_MULTILANGSTATUS_LANGUAGEFILTER="Language Filter Plugin" -COM_LANGUAGES_MULTILANGSTATUS_LANGUAGEFILTER_DISABLED="This site is set as a multilingual site. The Languagefilter plugin is not enabled although one or more Language Switcher modules OR/AND one or more specific Content language Default Home pages are published." +COM_LANGUAGES_MULTILANGSTATUS_LANGUAGEFILTER_DISABLED="This site is set as a multilingual site. The Language Filter plugin is not enabled although one or more Language Switcher modules OR/AND one or more specific Content language Default Home pages are published." COM_LANGUAGES_MULTILANGSTATUS_NONE="This site is not set as a multilingual site." COM_LANGUAGES_MULTILANGSTATUS_SITE_LANG_PUBLISHED="Published Site Languages" COM_LANGUAGES_MULTILANGSTATUS_USELESS_HOMES="This site is not set as a multilingual site.
    Note: at least one Default Home page is assigned to a Content Language. This will not break a monolingual site but is useless." @@ -102,7 +102,7 @@ COM_LANGUAGES_VIEW_OVERRIDE_RESULTS_LEGEND="Search Results" COM_LANGUAGES_VIEW_OVERRIDE_SAVE_SUCCESS="Language Override was saved successfully." COM_LANGUAGES_VIEW_OVERRIDE_SEARCH_BUTTON="Search" COM_LANGUAGES_VIEW_OVERRIDE_SEARCH_LEGEND="Search text you want to change." -COM_LANGUAGES_VIEW_OVERRIDE_SEARCH_TIP="A language string is composed of two parts: a specific language constant and its value.
    For example, in the string:
         COM_CONTENT_READ_MORE="Read more: "
    'COM_CONTENT_READ_MORE' is the constant and 'Read more: ' is the value.
    You have to use the specific language constant in order to create an override of the value.
    Therefore, you can search for the constant or the value you want to change with the search field below.
    By clicking on the desired result the correct constant will automatically be inserted into the form." +COM_LANGUAGES_VIEW_OVERRIDE_SEARCH_TIP="A language string is composed of two parts: a specific language constant and its value.
    For example, in the string: COM_CONTENT_READ_MORE="Read more: "
    'COM_CONTENT_READ_MORE' is the constant and 'Read more: ' is the value.
    You have to use the specific language constant in order to create an override of the value.
    Therefore, you can search for the constant or the value you want to change with the search field below.
    By clicking on the desired result the correct constant will automatically be inserted into the form." COM_LANGUAGES_VIEW_OVERRIDES_FILTER_SEARCH_DESC="Search constant or text." COM_LANGUAGES_VIEW_OVERRIDES_KEY="Constant" COM_LANGUAGES_VIEW_OVERRIDES_LANGUAGES_BOX_ITEM="%1$s - %2$s" diff --git a/administrator/language/en-GB/en-GB.com_media.ini b/administrator/language/en-GB/en-GB.com_media.ini index 1e90eeff95e88..a23c5b84bb403 100644 --- a/administrator/language/en-GB/en-GB.com_media.ini +++ b/administrator/language/en-GB/en-GB.com_media.ini @@ -18,7 +18,7 @@ COM_MEDIA_CREATE_NEW_FOLDER="Create New Folder" COM_MEDIA_CURRENT_PROGRESS="Current progress" COM_MEDIA_DELETE_COMPLETE="Delete Complete: %s" COM_MEDIA_DESCFTPTITLE="FTP Login Details" -COM_MEDIA_DESCFTP="To upload, change and delete media files, Joomla! will most likely need your FTP account details. Please enter them in the form fields below." +COM_MEDIA_DESCFTP="To upload, change and delete media files, Joomla will most likely need your FTP account details. Please enter them in the form fields below." COM_MEDIA_DETAIL_VIEW="Detail View" COM_MEDIA_DIRECTORY="Directory" COM_MEDIA_DIRECTORY_UP="Directory Up" diff --git a/administrator/language/en-GB/en-GB.com_menus.ini b/administrator/language/en-GB/en-GB.com_menus.ini index 6a9d0117cc21f..3e38d0b07cd5c 100644 --- a/administrator/language/en-GB/en-GB.com_menus.ini +++ b/administrator/language/en-GB/en-GB.com_menus.ini @@ -42,6 +42,7 @@ COM_MENUS_HEADING_POSITION="Position" COM_MENUS_HEADING_PUBLISHED_ITEMS="Published" COM_MENUS_HEADING_TRASHED_ITEMS="Trashed" COM_MENUS_HEADING_UNPUBLISHED_ITEMS="Unpublished" +COM_MENUS_HTML_PUBLISH="Publish menu item" COM_MENUS_HTML_PUBLISH_ALIAS="Publish the menu item alias" COM_MENUS_HTML_PUBLISH_DISABLED="Publish menu item::Component disabled" COM_MENUS_HTML_PUBLISH_ENABLED="Publish menu item::Component enabled" @@ -65,7 +66,7 @@ COM_MENUS_ITEM_FIELD_ANCHOR_CSS_DESC="An optional, custom style to apply to the COM_MENUS_ITEM_FIELD_ANCHOR_CSS_LABEL="Link CSS Style" COM_MENUS_ITEM_FIELD_ANCHOR_TITLE_DESC="An optional, custom description for the title attribute of the menu hyperlink." COM_MENUS_ITEM_FIELD_ANCHOR_TITLE_LABEL="Link Title Attribute" -COM_MENUS_ITEM_FIELD_ASSIGNED_DESC="Shows which menu a link will appear in." +COM_MENUS_ITEM_FIELD_ASSIGNED_DESC="Shows which menu the link will appear in." COM_MENUS_ITEM_FIELD_ASSIGNED_LABEL=" Menu Location" COM_MENUS_ITEM_FIELD_ASSOCIATION_NO_VALUE="- No association -" COM_MENUS_ITEM_FIELD_BROWSERNAV_DESC="Target browser window when the menu item is clicked." @@ -78,11 +79,11 @@ COM_MENUS_ITEM_FIELD_HOME_LABEL="Default Page" COM_MENUS_ITEM_FIELD_LANGUAGE_DESC="Assign a language to this menu item." COM_MENUS_ITEM_FIELD_LINK_DESC="Link for this menu." COM_MENUS_ITEM_FIELD_LINK_LABEL="Link" -COM_MENUS_ITEM_FIELD_MENU_IMAGE_DESC="An optional image to be used with the menu hyperlink." +COM_MENUS_ITEM_FIELD_MENU_IMAGE_DESC="Select or upload an optional image to be used with the menu hyperlink." COM_MENUS_ITEM_FIELD_MENU_IMAGE_LABEL="Link Image" COM_MENUS_ITEM_FIELD_MENU_TEXT_DESC="If the optional image is added, adds the menu title next to the image. Default is 'Yes'." COM_MENUS_ITEM_FIELD_MENU_TEXT_LABEL="Add Menu Title" -COM_MENUS_ITEM_FIELD_NOTE_DESC="Enter some text here." +COM_MENUS_ITEM_FIELD_NOTE_DESC="An optional note to display in the Menu Manager." COM_MENUS_ITEM_FIELD_ORDERING_DESC="The menu item will be placed in the menu after the selected menu item." COM_MENUS_ITEM_FIELD_ORDERING_LABEL="Ordering" COM_MENUS_ITEM_FIELD_ORDERING_TEXT="Ordering will be available after saving." diff --git a/administrator/language/en-GB/en-GB.com_modules.ini b/administrator/language/en-GB/en-GB.com_modules.ini index 9626503b3053a..454eb169be4fc 100644 --- a/administrator/language/en-GB/en-GB.com_modules.ini +++ b/administrator/language/en-GB/en-GB.com_modules.ini @@ -42,7 +42,7 @@ COM_MODULES_FIELD_MODULE_DESC="Module type." COM_MODULES_FIELD_MODULE_LABEL="Module Type" COM_MODULES_FIELD_MODULECLASS_SFX_DESC="A suffix to be applied to the CSS class of the module. This allows for individual module styling." COM_MODULES_FIELD_MODULECLASS_SFX_LABEL="Module Class Suffix" -COM_MODULES_FIELD_NOTE_DESC="An optional note to display in module list." +COM_MODULES_FIELD_NOTE_DESC="An optional note to display in the Module Manager." COM_MODULES_FIELD_NOTE_LABEL="Note" COM_MODULES_FIELD_POSITION_DESC="You may select a module position from the list of pre-defined positions or enter your own module position by typing the name in the field and pressing enter." COM_MODULES_FIELD_POSITION_LABEL="Position" @@ -86,7 +86,7 @@ COM_MODULES_MODULE_DESCRIPTION="Module Description" COM_MODULES_MODULE_TEMPLATE_POSITION="%1$s (%2$s)" COM_MODULES_MODULES="Modules" COM_MODULES_MODULES_FILTER_SEARCH_DESC="Search in module title." -COM_MODULES_MSG_MANAGE_NO_MODULES="There are no modules installed matching your query" +COM_MODULES_MSG_MANAGE_NO_MODULES="There are no modules matching your query" COM_MODULES_N_ITEMS_ARCHIVED="%d modules successfully archived." COM_MODULES_N_ITEMS_ARCHIVED_1="%d module successfully archived." COM_MODULES_N_ITEMS_CHECKED_IN_0="No module successfully checked in." diff --git a/administrator/language/en-GB/en-GB.com_modules.sys.ini b/administrator/language/en-GB/en-GB.com_modules.sys.ini index 7dde267c99acd..0421d3cd16eb2 100644 --- a/administrator/language/en-GB/en-GB.com_modules.sys.ini +++ b/administrator/language/en-GB/en-GB.com_modules.sys.ini @@ -4,5 +4,7 @@ ; Note : All ini files need to be saved as UTF-8 COM_MODULES="Module Manager" +COM_MODULES_GENERAL="General" +COM_MODULES_REDIRECT_EDIT_DESC="Select if module editing should be opened in the site or administration interface." +COM_MODULES_REDIRECT_EDIT_LABEL="Edit module" COM_MODULES_XML_DESCRIPTION="Component for module management on the Backend." - diff --git a/administrator/language/en-GB/en-GB.com_newsfeeds.ini b/administrator/language/en-GB/en-GB.com_newsfeeds.ini index 14542752b611c..1febce28c0853 100644 --- a/administrator/language/en-GB/en-GB.com_newsfeeds.ini +++ b/administrator/language/en-GB/en-GB.com_newsfeeds.ini @@ -12,7 +12,7 @@ COM_NEWSFEEDS_CATEGORIES_DESC="These settings apply for News Feeds Categories Op COM_NEWSFEEDS_CHANGE_FEED_BUTTON="Select Feed" COM_NEWSFEEDS_CONFIGURATION="News Feed Manager Options" COM_NEWSFEEDS_EDIT_NEWSFEED="Edit News Feed" -COM_NEWSFEEDS_ERROR_UNIQUE_ALIAS="Another News feed from this category has the same alias." +COM_NEWSFEEDS_ERROR_UNIQUE_ALIAS="Another News feed from this category has the same alias (remember it may be a trashed item)." COM_NEWSFEEDS_ERROR_ALL_LANGUAGE_ASSOCIATED="A news feed item set to All languages can't be associated. Associations have not been set." COM_NEWSFEEDS_FEED_CATEGORY_OPTIONS_LABEL="Feeds Category Display Options" COM_NEWSFEEDS_FIELD_CACHETIME_DESC="The number of minutes before the news feed cache is refreshed." @@ -32,7 +32,7 @@ COM_NEWSFEEDS_FIELD_FEED_DISPLAY_ORDER_DESC="The order used to display the feed. COM_NEWSFEEDS_FIELD_FEED_DISPLAY_ORDER_LABEL="Feed Display Order" COM_NEWSFEEDS_FIELD_FEED_OPTIONS_DESC="Feeds display options." COM_NEWSFEEDS_FIELD_FEED_OPTIONS_LABEL="Feeds Display Options" -COM_NEWSFEEDS_FIELD_FIRST_DESC="The image to be displayed." +COM_NEWSFEEDS_FIELD_FIRST_DESC="Select or upload the image to be displayed." COM_NEWSFEEDS_FIELD_FIRST_LABEL="First Image" COM_NEWSFEEDS_FIELD_IMAGE_ALT_DESC="Alternative text used for visitors without access to images. Replaced with caption text if it is present." COM_NEWSFEEDS_FIELD_IMAGE_ALT_LABEL="Alt Text" @@ -42,7 +42,7 @@ 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_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_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" COM_NEWSFEEDS_FIELD_NUM_ARTICLES_DESC="Number of articles from the feed to display." COM_NEWSFEEDS_FIELD_NUM_ARTICLES_LABEL="Number of Articles" @@ -53,18 +53,18 @@ COM_NEWSFEEDS_FIELD_NUMFEEDS_LABEL="Number of Feeds" COM_NEWSFEEDS_FIELD_OPTIONS="Feed" COM_NEWSFEEDS_FIELD_RTL_DESC="Select the language direction of the feed." COM_NEWSFEEDS_FIELD_RTL_LABEL="Language Direction" -COM_NEWSFEEDS_FIELD_SECOND_DESC="The second image to be displayed." +COM_NEWSFEEDS_FIELD_SECOND_DESC="Select or upload the second image to be displayed." COM_NEWSFEEDS_FIELD_SECOND_LABEL="Second Image" COM_NEWSFEEDS_FIELD_SELECT_CATEGORY_DESC="Choose a feed category to display." COM_NEWSFEEDS_FIELD_SELECT_FEED_DESC="Select a feed to display." COM_NEWSFEEDS_FIELD_SELECT_FEED_LABEL="Feed" -COM_NEWSFEEDS_FIELD_SHOW_CAT_ITEMS_DESC="Show or Hide the number of news feeds in category." +COM_NEWSFEEDS_FIELD_SHOW_CAT_ITEMS_DESC="Show or hide the number of news feeds in category." COM_NEWSFEEDS_FIELD_SHOW_CAT_ITEMS_LABEL="# Feeds in Category" COM_NEWSFEEDS_FIELD_SHOW_CAT_TAGS_DESC="Show the tags for a category." COM_NEWSFEEDS_FIELD_SHOW_CAT_TAGS_LABEL="Show Tags" -COM_NEWSFEEDS_FIELD_SHOW_FEED_DESCRIPTION_DESC="Show or Hide feed description." +COM_NEWSFEEDS_FIELD_SHOW_FEED_DESCRIPTION_DESC="Show or hide feed description." COM_NEWSFEEDS_FIELD_SHOW_FEED_DESCRIPTION_LABEL="Feed Description" -COM_NEWSFEEDS_FIELD_SHOW_FEED_IMAGE_DESC="Show or Hide feed images." +COM_NEWSFEEDS_FIELD_SHOW_FEED_IMAGE_DESC="Show or hide feed images." COM_NEWSFEEDS_FIELD_SHOW_FEED_IMAGE_LABEL="Feed Image" COM_NEWSFEEDS_FIELD_SHOW_ITEM_DESCRIPTION_DESC="Show or hide feed content." COM_NEWSFEEDS_FIELD_SHOW_ITEM_DESCRIPTION_LABEL="Feed Content" diff --git a/administrator/language/en-GB/en-GB.com_plugins.ini b/administrator/language/en-GB/en-GB.com_plugins.ini index 67b309a480d4b..6554b2f7f00b5 100644 --- a/administrator/language/en-GB/en-GB.com_plugins.ini +++ b/administrator/language/en-GB/en-GB.com_plugins.ini @@ -34,7 +34,7 @@ COM_PLUGINS_PLUGIN="Plugin" COM_PLUGINS_PLUGINS="Plugins" COM_PLUGINS_SAVE_SUCCESS="Plugin successfully saved." COM_PLUGINS_SEARCH_IN_TITLE="Search in plugin title." -COM_PLUGINS_XML_DESCRIPTION="This component manages Joomla! plugins." +COM_PLUGINS_XML_DESCRIPTION="This component manages Joomla plugins." COM_PLUGINS_XML_ERR="Plugins XML data not available." JLIB_HTML_PUBLISH_ITEM="Enable plugin" JLIB_HTML_UNPUBLISH_ITEM="Disable plugin" diff --git a/administrator/language/en-GB/en-GB.com_plugins.sys.ini b/administrator/language/en-GB/en-GB.com_plugins.sys.ini index db0536bc13961..f05d7e222a1f8 100644 --- a/administrator/language/en-GB/en-GB.com_plugins.sys.ini +++ b/administrator/language/en-GB/en-GB.com_plugins.sys.ini @@ -4,4 +4,4 @@ ; Note : All ini files need to be saved as UTF-8 COM_PLUGINS="Plugins Manager" -COM_PLUGINS_XML_DESCRIPTION="This component manages Joomla! plugins." +COM_PLUGINS_XML_DESCRIPTION="This component manages Joomla plugins." diff --git a/administrator/language/en-GB/en-GB.com_postinstall.ini b/administrator/language/en-GB/en-GB.com_postinstall.ini index ca22bbce0922c..784351054c7a0 100644 --- a/administrator/language/en-GB/en-GB.com_postinstall.ini +++ b/administrator/language/en-GB/en-GB.com_postinstall.ini @@ -10,9 +10,9 @@ COM_POSTINSTALL_CONFIGURATION="Post-installation Messages Configuration" COM_POSTINSTALL_LBL_MESSAGES="Post-installation and Upgrade Messages" COM_POSTINSTALL_LBL_NOMESSAGES_DESC="You have already seen and hidden all messages for the current version. If you want to reset the messages, meaning that all messages you have hidden will be displayed again, please click on the Reset Messages button below." COM_POSTINSTALL_LBL_NOMESSAGES_TITLE="No Messages" -COM_POSTINSTALL_LBL_RELEASENEWS="Release news (from Joomla.org)" +COM_POSTINSTALL_LBL_RELEASENEWS="Release news from the Joomla! Project" COM_POSTINSTALL_LBL_SINCEVERSION="Since version %s" COM_POSTINSTALL_MESSAGES_FOR="Showing messages for" COM_POSTINSTALL_MESSAGES_TITLE="Post-installation Messages for %s" -COM_POSTINSTALL_TITLE_JOOMLA="Joomla!" -COM_POSTINSTALL_XML_DESCRIPTION="Displays post-installation and post-upgrade messages for Joomla! and its extensions." +COM_POSTINSTALL_TITLE_JOOMLA="Joomla" +COM_POSTINSTALL_XML_DESCRIPTION="Displays post-installation and post-upgrade messages for Joomla and its extensions." diff --git a/administrator/language/en-GB/en-GB.com_redirect.ini b/administrator/language/en-GB/en-GB.com_redirect.ini index 87335af511ece..d79d404ea940f 100644 --- a/administrator/language/en-GB/en-GB.com_redirect.ini +++ b/administrator/language/en-GB/en-GB.com_redirect.ini @@ -56,7 +56,8 @@ COM_REDIRECT_N_LINKS_UPDATED_1="1 link has been updated." COM_REDIRECT_NEW_LINK="New Link" COM_REDIRECT_NO_ITEM_ADDED="No links added." COM_REDIRECT_NO_ITEM_SELECTED="No links selected." -COM_REDIRECT_PLUGIN_DISABLED="The Redirect Plugin is disabled. Enable it in the Plugin Manager." +; Change 'System%20-%20Redirect' to the value in plg_system_redirect.sys.ini for your language +COM_REDIRECT_PLUGIN_DISABLED="The Redirect Plugin is disabled. Enable it in the Plugin Manager." COM_REDIRECT_PLUGIN_ENABLED="The Redirect Plugin is enabled." COM_REDIRECT_REDIRECTED_ON="Redirected on: %s." COM_REDIRECT_SAVE_SUCCESS="Link successfully saved." diff --git a/administrator/language/en-GB/en-GB.com_tags.ini b/administrator/language/en-GB/en-GB.com_tags.ini index 837034c2c0900..dee9a5d2d62d3 100644 --- a/administrator/language/en-GB/en-GB.com_tags.ini +++ b/administrator/language/en-GB/en-GB.com_tags.ini @@ -7,7 +7,7 @@ COM_TAGS="Tags" COM_TAGS_ALL="All" COM_TAGS_ALL_TAGS_DESCRIPTION_DESC="Description to display at the heading of tags list." COM_TAGS_ALL_TAGS_DESCRIPTION_LABEL="Heading Description" -COM_TAGS_ALL_TAGS_MEDIA_DESC="The image to display in the heading of the tags list." +COM_TAGS_ALL_TAGS_MEDIA_DESC="Select or upload the image to display in the heading of the tags list." COM_TAGS_ALL_TAGS_MEDIA_LABEL="Heading Image File" COM_TAGS_ANY="Any" COM_TAGS_BASE_ADD_TITLE="Tag Manager: Add New Tag" @@ -39,28 +39,30 @@ COM_TAGS_CONFIG_TAGGED_ITEMS_FIELD_LAYOUT_LABEL="Default Tagged Items Layout" COM_TAGS_CONFIGURATION="Tags Configuration" COM_TAGS_DELETE_NOT_ALLOWED="Delete not allowed for tag %s." COM_TAGS_DESCRIPTION_DESC="Enter an optional tag description in the text area." -COM_TAGS_ERROR_UNIQUE_ALIAS="Another Tag has the same alias" +COM_TAGS_ERROR_UNIQUE_ALIAS="Another Tag has the same alias (remember it may be a trashed item)." COM_TAGS_EXCLUDE="Exclude" COM_TAGS_FIELD_CONFIG_HITS_DESC="Displays the number of hits." COM_TAGS_FIELD_CONFIG_TAGDESCRIPTION_DESC="Configure com_tags." COM_TAGS_FIELD_CONFIG_TAGDESCRIPTION_LABEL="Tags" COM_TAGS_FIELD_CONTENT_TYPE_DESC="Only tagged items of these types will be displayed." COM_TAGS_FIELD_CONTENT_TYPE_LABEL="Content types" -COM_TAGS_FIELD_FULL_DESC="This will be displayed in the single tag view." +COM_TAGS_FIELD_FULL_DESC="Select or upload an image that will be displayed in the single tag view." COM_TAGS_FIELD_FULL_LABEL="Full Image" COM_TAGS_FIELD_HITS_DESC="Number of hits for this tag." COM_TAGS_FIELD_IMAGE_ALT_DESC="Alt text for the image." COM_TAGS_FIELD_IMAGE_ALT_LABEL="Alt" COM_TAGS_FIELD_IMAGE_CAPTION_DESC="Caption for the image." COM_TAGS_FIELD_IMAGE_CAPTION_LABEL="Caption" -COM_TAGS_FIELD_IMAGE_DESC="Choose an image for this tag." +COM_TAGS_FIELD_IMAGE_DESC="Select or upload an image for this tag." COM_TAGS_FIELD_IMAGE_LABEL="Image" -COM_TAGS_FIELD_INTRO_DESC="This will be displayed as part of a list." +COM_TAGS_FIELD_INTRO_DESC="Select or upload an image that will be displayed as part of a list." COM_TAGS_FIELD_INTRO_LABEL="Teaser Image." COM_TAGS_FIELD_ITEM_BODY_DESC="Show the body for each item." COM_TAGS_FIELD_LANGUAGE_DESC="Assign a language to this tag." COM_TAGS_FIELD_LANGUAGE_FILTER_DESC="Optionally filter the list of tags based on language." COM_TAGS_FIELD_LANGUAGE_FILTER_LABEL="Language Filter" +COM_TAGS_FIELD_NOTE_DESC="An optional note to display in the tag list." +COM_TAGS_FIELD_NOTE_LABEL="Note" COM_TAGS_FIELD_PARENT_DESC="Select a parent tag." COM_TAGS_FIELD_PARENT_LABEL="Parent" COM_TAGS_FIELD_PARENT_TAG_DESC="If set only tags that are direct children of the selected tag will be displayed." @@ -70,7 +72,7 @@ COM_TAGS_FIELD_TAG_BODY_DESC="Show or hide the tag description." COM_TAGS_FIELD_TAG_BODY_LABEL="Description." COM_TAGS_FIELD_TAG_LABEL="Tag" COM_TAGS_FIELD_TAG_LINK_CLASS="CSS Class for tag link." -COM_TAGS_FIELD_TAG_LINK_CLASS_DESC="Add here specific CSS classes for the tag link. If empty 'label label-info' will be added by the default tag layout." +COM_TAGS_FIELD_TAG_LINK_CLASS_DESC="Add specific CSS classes for the tag link. If empty 'label label-info' will be added by the default tag layout." COM_TAGS_FIELD_TYPE_DESC="Only tags of the selected types will be displayed (optional)." COM_TAGS_FIELD_TYPE_LABEL="Content Type" COM_TAGS_FIELDSET_DETAILS="Tag Details" @@ -151,7 +153,7 @@ COM_TAGS_TAG_LIST_DESCRIPTION_LABEL="Layout Description" COM_TAGS_TAG_LIST_FIELD_ITEM_DESCRIPTION_LABEL="Item Body" COM_TAGS_TAG_LIST_ITEM_DESCRIPTION_DESC="Shows the body text for the individual items (depends on the source table)." COM_TAGS_TAG_LIST_ITEM_HITS_DESC="Shows the number of hits for each individual item." -COM_TAGS_TAG_LIST_MEDIA_DESC="Show the tag image (full image)." +COM_TAGS_TAG_LIST_MEDIA_DESC="Select or upload the tag image (full image)." COM_TAGS_TAG_LIST_MEDIA_LABEL="Image" COM_TAGS_TAG_LIST_SHOW_ITEM_IMAGE_DESC="Shows the image for each item." COM_TAGS_TAG_LIST_SHOW_ITEM_IMAGE_LABEL="Item Image" diff --git a/administrator/language/en-GB/en-GB.com_templates.ini b/administrator/language/en-GB/en-GB.com_templates.ini index b32361f575c43..f07245ec26d09 100644 --- a/administrator/language/en-GB/en-GB.com_templates.ini +++ b/administrator/language/en-GB/en-GB.com_templates.ini @@ -87,9 +87,9 @@ COM_TEMPLATES_ERROR_WARNFILETYPE="File format not supported." COM_TEMPLATES_ERROR_WARNIEXSS="Can't be uploaded. Contains XSS." COM_TEMPLATES_FIELD_CLIENT_DESC="Whether this template is used for the Frontend (0) or the Backend (1)." COM_TEMPLATES_FIELD_CLIENT_LABEL="Location" -COM_TEMPLATES_FIELD_HOME_ADMINISTRATOR_DESC="This template style is defined or not as default template style." +COM_TEMPLATES_FIELD_HOME_ADMINISTRATOR_DESC="This template style is defined as the default." COM_TEMPLATES_FIELD_HOME_LABEL="Default" -COM_TEMPLATES_FIELD_HOME_SITE_DESC="If the multilingual functionality is not implemented, please limit your choice between No and All. The template style will be defined or not as global default template style.
    If the System - Language Filter plugin is enabled and you use different template styles depending on your content languages please assign a language to this style." +COM_TEMPLATES_FIELD_HOME_SITE_DESC="If the multilingual functionality is not implemented, please limit your choice between No and All. This template style will be defined as the global default template style.
    If the System - Language Filter plugin is enabled and you use different template styles depending on your content languages please assign a language to this style." COM_TEMPLATES_FIELD_SOURCE_DESC="Source code." COM_TEMPLATES_FIELD_SOURCE_LABEL="Source Code" COM_TEMPLATES_FIELD_TEMPLATE_DESC="Template name." @@ -134,7 +134,7 @@ COM_TEMPLATES_FOLDER_ERROR="Not able to create folder." COM_TEMPLATES_FOLDER_EXISTS="Folder with the same name already exists." COM_TEMPLATES_FOLDER_NAME="Folder Name" COM_TEMPLATES_FOLDER_NOT_EXISTS="The folder does not exist." -COM_TEMPLATES_FTP_DESC="For updating the template source files, Joomla! will most likely need your FTP account details. Please enter them in the form fields below." +COM_TEMPLATES_FTP_DESC="For updating the template source files, Joomla will most likely need your FTP account details. Please enter them in the form fields below." COM_TEMPLATES_FTP_TITLE="FTP Login Details" COM_TEMPLATES_GRID_UNSET_LANGUAGE="Unset %s Default" COM_TEMPLATES_HOME_BUTTON="Documentation" diff --git a/administrator/language/en-GB/en-GB.com_users.ini b/administrator/language/en-GB/en-GB.com_users.ini index 1946a5ceaa774..812e7eeb3748f 100644 --- a/administrator/language/en-GB/en-GB.com_users.ini +++ b/administrator/language/en-GB/en-GB.com_users.ini @@ -265,6 +265,7 @@ COM_USERS_USER_FIELD_LASTVISIT_DESC="Last visit date." COM_USERS_USER_FIELD_LASTVISIT_LABEL="Last Visit Date" COM_USERS_USER_FIELD_NAME_DESC="Enter the name of the user." COM_USERS_USER_FIELD_NAME_LABEL="Name" +COM_USERS_USER_FIELD_PASSWORD1_MESSAGE="The passwords you entered do not match. Please enter your desired password in the password field and confirm your entry by entering it in the confirm password field." COM_USERS_USER_FIELD_PASSWORD2_DESC="Confirm the user's password." COM_USERS_USER_FIELD_PASSWORD2_LABEL="Confirm Password" COM_USERS_USER_FIELD_PASSWORD_DESC="Enter the password for the user." diff --git a/administrator/language/en-GB/en-GB.com_weblinks.ini b/administrator/language/en-GB/en-GB.com_weblinks.ini index 59c523921a014..c2b8ccd31f248 100644 --- a/administrator/language/en-GB/en-GB.com_weblinks.ini +++ b/administrator/language/en-GB/en-GB.com_weblinks.ini @@ -17,7 +17,7 @@ COM_WEBLINKS_EDIT_WEBLINK="Edit Web Link" COM_WEBLINKS_ERR_TABLES_NAME="There is already a Web Link with that name in this category. Please try again." COM_WEBLINKS_ERR_TABLES_PROVIDE_URL="Please provide a valid URL" COM_WEBLINKS_ERR_TABLES_TITLE="Your web link must contain a title." -COM_WEBLINKS_ERROR_UNIQUE_ALIAS="Another web link from this category has the same alias" +COM_WEBLINKS_ERROR_UNIQUE_ALIAS="Another web link from this category has the same alias (remember it may be a trashed item)." COM_WEBLINKS_FIELD_ALIAS_DESC="The alias is for internal use only. Leave this blank and Joomla will fill in a default value from the title. It has to be unique for each web link in the same category." COM_WEBLINKS_FIELD_CATEGORY_DESC="Choose a category for this Web link." COM_WEBLINKS_FIELD_CATEGORYCHOOSE_DESC="Please choose a Web Links category to display." diff --git a/administrator/language/en-GB/en-GB.ini b/administrator/language/en-GB/en-GB.ini index 8c19c1df8b61c..f22ffd55aabd2 100644 --- a/administrator/language/en-GB/en-GB.ini +++ b/administrator/language/en-GB/en-GB.ini @@ -111,7 +111,7 @@ JSHOW="Show" JSITE="Site" JSUBMIT="Submit" JTAG="Tags" -JTAG_DESC="Assign tags to content items. Tag names must be unique." +JTAG_DESC="Assign tags to content items. You may select a tag from the pre-defined list or enter your own by typing the name in the field and pressing enter." JTRASH="Trash" JTRASHED="Trashed" JTRUE="True" @@ -165,6 +165,7 @@ JERROR_MAGIC_QUOTES="Your host needs to disable magic_quotes_gpc to run this ver JERROR_NO_ITEMS_SELECTED="No item(s) selected." JERROR_NOLOGIN_BLOCKED="Login denied! Your account has either been blocked or you have not activated it yet." JERROR_SENDING_EMAIL="Email could not be sent." +JERROR_SESSION_STARTUP="Error initialising the session." JERROR_SAVE_FAILED="Could not save data. Error: %s" JFIELD_ACCESS_DESC="The access level group that is allowed to view this item." @@ -179,11 +180,11 @@ JFIELD_ALT_PAGE_TITLE_DESC="An optional alternative page title to set that will JFIELD_ALT_PAGE_TITLE_LABEL="Alternative Page Title" JFIELD_BASIS_LOGIN_DESCRIPTION_DESC="Text to display on login page." JFIELD_BASIS_LOGIN_DESCRIPTION_LABEL="Login Description Text" -JFIELD_BASIS_LOGIN_DESCRIPTION_SHOW_DESC="Show or Hide login description." +JFIELD_BASIS_LOGIN_DESCRIPTION_SHOW_DESC="Show or hide login description." JFIELD_BASIS_LOGIN_DESCRIPTION_SHOW_LABEL="Login Description" JFIELD_BASIS_LOGOUT_DESCRIPTION_DESC="Text for logout page." JFIELD_BASIS_LOGOUT_DESCRIPTION_LABEL="Logout Description Text" -JFIELD_BASIS_LOGOUT_DESCRIPTION_SHOW_DESC="Show or Hide logout description." +JFIELD_BASIS_LOGOUT_DESCRIPTION_SHOW_DESC="Show or hide logout description." JFIELD_BASIS_LOGOUT_DESCRIPTION_SHOW_LABEL="Logout Text" JFIELD_CATEGORY_DESC="The category that this item is assigned to." JFIELD_ENABLED_DESC="The enabled status of this item." @@ -191,11 +192,11 @@ JFIELD_KEY_REFERENCE_DESC="Used to store information referring to an external re JFIELD_KEY_REFERENCE_LABEL="Key Reference" JFIELD_LANGUAGE_DESC="Assign a language to this article." JFIELD_LANGUAGE_LABEL="Language" -JFIELD_LOGIN_IMAGE_DESC="Image to display on login page." +JFIELD_LOGIN_IMAGE_DESC="Select or upload an image to display on login page." JFIELD_LOGIN_IMAGE_LABEL="Login Image" JFIELD_LOGIN_REDIRECT_URL_DESC="If an URL is entered here, users will be redirected to it after login. The URL must not be an external one." JFIELD_LOGIN_REDIRECT_URL_LABEL="Login Redirect" -JFIELD_LOGOUT_IMAGE_DESC="Image to display on logout page." +JFIELD_LOGOUT_IMAGE_DESC="Select or upload an image to display on logout page." JFIELD_LOGOUT_IMAGE_LABEL="Logout Image" JFIELD_LOGOUT_REDIRECT_URL_DESC="If an URL is entered here, users will be redirected to it after logout. The URL must not be an external one." JFIELD_LOGOUT_REDIRECT_URL_LABEL="Logout Redirect" @@ -495,7 +496,7 @@ JGLOBAL_SHOW_FEATURED_ARTICLES_LABEL="Featured Articles" JGLOBAL_SHOW_FEED_LINK_DESC="Show or hide an RSS Feed Link. (A Feed Link will show up as a feed icon in the address bar of most modern browsers)." JGLOBAL_SHOW_FEED_LINK_LABEL="Show Feed Link" JGLOBAL_SHOW_FULL_DESCRIPTION="Show full description..." -JGLOBAL_SHOW_HEADINGS_DESC="Show or Hide the headings in list layouts." +JGLOBAL_SHOW_HEADINGS_DESC="Show or hide the headings in list layouts." JGLOBAL_SHOW_HEADINGS_LABEL="Table Headings" JGLOBAL_SHOW_HITS_DESC="If set to Show, the number of Hits on a particular Article will be displayed. This is a global setting but can be changed at the Category, Menu and Article levels." JGLOBAL_SHOW_HITS_LABEL="Show Hits" @@ -967,6 +968,6 @@ SQLITE="SQLite" SQLSRV="Microsoft SQL Server" ; Search tools -JSEARCH_TOOLS="Search tools" +JSEARCH_TOOLS="Search Tools" JSEARCH_TOOLS_DESC="Filter the list items." JSEARCH_TOOLS_ORDERING="Order by:" diff --git a/administrator/language/en-GB/en-GB.lib_joomla.ini b/administrator/language/en-GB/en-GB.lib_joomla.ini index be3c8ccd591d3..852291a472cd5 100644 --- a/administrator/language/en-GB/en-GB.lib_joomla.ini +++ b/administrator/language/en-GB/en-GB.lib_joomla.ini @@ -141,8 +141,8 @@ JLIB_CLIENT_ERROR_LDAP_ADDRESS_NOT_AVAILABLE="Address not available." JLIB_DATABASE_ERROR_ADAPTER_MYSQL="The MySQL adapter 'mysql' is not available." JLIB_DATABASE_ERROR_ADAPTER_MYSQLI="The MySQL adapter 'mysqli' is not available." JLIB_DATABASE_ERROR_BIND_FAILED_INVALID_SOURCE_ARGUMENT="%s: :bind failed. Invalid source argument." -JLIB_DATABASE_ERROR_ARTICLE_UNIQUE_ALIAS="Another article from this category has the same alias." -JLIB_DATABASE_ERROR_CATEGORY_UNIQUE_ALIAS="Another category with the same parent category has the same alias." +JLIB_DATABASE_ERROR_ARTICLE_UNIQUE_ALIAS="Another article from this category has the same alias (remember it may be a trashed item)." +JLIB_DATABASE_ERROR_CATEGORY_UNIQUE_ALIAS="Another category with the same parent category has the same alias (remember it may be a trashed item)." JLIB_DATABASE_ERROR_CHECK_FAILED="%s: :check Failed - %s" JLIB_DATABASE_ERROR_CHECKIN_FAILED="%s: :check-in failed - %s" JLIB_DATABASE_ERROR_CHECKOUT_FAILED="%s: :check-out failed - %s" @@ -180,8 +180,8 @@ JLIB_DATABASE_ERROR_MENU_CANNOT_UNSET_DEFAULT="The Language parameter for this m JLIB_DATABASE_ERROR_MENU_CANNOT_UNSET_DEFAULT_DEFAULT="At least one menu item has to be set as Default." JLIB_DATABASE_ERROR_MENU_UNPUBLISH_DEFAULT_HOME="Can't unpublish default home." JLIB_DATABASE_ERROR_MENU_DEFAULT_CHECKIN_USER_MISMATCH="The current home menu for this language is checked out." -JLIB_DATABASE_ERROR_MENU_UNIQUE_ALIAS="Another menu item with the same parent has this alias." -JLIB_DATABASE_ERROR_MENU_UNIQUE_ALIAS_ROOT="Another menu item has the same alias in Root. Root is the top level parent." +JLIB_DATABASE_ERROR_MENU_UNIQUE_ALIAS="Another menu item with the same parent has this alias (remember it may be a trashed item)." +JLIB_DATABASE_ERROR_MENU_UNIQUE_ALIAS_ROOT="Another menu item has the same alias in Root (remember it may be a trashed item). Root is the top level parent." JLIB_DATABASE_ERROR_MENU_HOME_NOT_COMPONENT="The home menu item must be a component." JLIB_DATABASE_ERROR_MENU_HOME_NOT_UNIQUE_IN_MENU="A menu should contain only one Default home." JLIB_DATABASE_ERROR_MENU_ROOT_ALIAS_COMPONENT="A first level menu item alias can't be 'component'." @@ -189,6 +189,7 @@ JLIB_DATABASE_ERROR_MENU_ROOT_ALIAS_FOLDER="A first level menu item alias can't JLIB_DATABASE_ERROR_MOVE_FAILED="%s: :move failed - %s" JLIB_DATABASE_ERROR_MUSTCONTAIN_A_TITLE_CATEGORY="Category must have a title." JLIB_DATABASE_ERROR_MUSTCONTAIN_A_TITLE_EXTENSION="Extension must have a title." +JLIB_DATABASE_ERROR_MUSTCONTAIN_A_TITLE_MENUITEM="Menu Item must have a title." JLIB_DATABASE_ERROR_MUSTCONTAIN_A_TITLE_MODULE="Module must have a title." JLIB_DATABASE_ERROR_MUSTCONTAIN_A_TITLE_UPDATESITE="Update site must have a title." JLIB_DATABASE_ERROR_NEGATIVE_NOT_PERMITTED="%s can't be negative." @@ -432,6 +433,7 @@ JLIB_INSTALLER_ABORT_COMP_INSTALL_PHP_INSTALL="Component Install: Could not copy JLIB_INSTALLER_ABORT_COMP_INSTALL_PHP_UNINSTALL="Component Install: Could not copy PHP uninstall file." JLIB_INSTALLER_ABORT_COMP_INSTALL_ROLLBACK="Component Install: %s" JLIB_INSTALLER_ABORT_COMP_INSTALL_SQL_ERROR="Component Install: SQL error file %s" +JLIB_INSTALLER_ABORT_COMP_UPDATESITEMENUS_FAILED="Component Install: Failed to update menu items." JLIB_INSTALLER_ABORT_COMP_UPDATE_ADMIN_ELEMENT="Component Update: The XML file did not contain an administration element" JLIB_INSTALLER_ABORT_COMP_UPDATE_COPY_SETUP="Component Update: Could not copy setup file." JLIB_INSTALLER_ABORT_COMP_UPDATE_MANIFEST="Component Update: Could not copy PHP manifest file." diff --git a/administrator/language/en-GB/en-GB.mod_menu.ini b/administrator/language/en-GB/en-GB.mod_menu.ini index 8c25ef5155604..edb251a7d92ad 100644 --- a/administrator/language/en-GB/en-GB.mod_menu.ini +++ b/administrator/language/en-GB/en-GB.mod_menu.ini @@ -56,6 +56,7 @@ MOD_MENU_HELP_SUPPORT_CUSTOM_FORUM="Custom Support Forum" MOD_MENU_HELP_SUPPORT_OFFICIAL_LANGUAGE_FORUM="Official [language] forum" MOD_MENU_HELP_SUPPORT_OFFICIAL_LANGUAGE_FORUM_VALUE="" MOD_MENU_HELP_TRANSLATIONS="Joomla! Translations" +MOD_MENU_HELP_XCHANGE="Stack Exchange" MOD_MENU_HOME_DEFAULT="Home" MOD_MENU_HOME_MULTIPLE="Warning! Multiple homes!" MOD_MENU_LOGOUT="Logout" diff --git a/administrator/language/en-GB/en-GB.mod_stats_admin.ini b/administrator/language/en-GB/en-GB.mod_stats_admin.ini index af5a510f592fa..2cc8a480ceed0 100644 --- a/administrator/language/en-GB/en-GB.mod_stats_admin.ini +++ b/administrator/language/en-GB/en-GB.mod_stats_admin.ini @@ -1,7 +1,7 @@ ; Joomla! Project ; Copyright (C) 2005 - 2015 Open Source Matters. All rights reserved. ; 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 - No BOM +; Note : All ini files need to be saved as UTF-8 MOD_STATS_ADMIN="Statistics" MOD_STATS_ARTICLES="Articles" diff --git a/administrator/language/en-GB/en-GB.mod_stats_admin.sys.ini b/administrator/language/en-GB/en-GB.mod_stats_admin.sys.ini index 880ed3f3bfb05..2b7dde2e21b64 100644 --- a/administrator/language/en-GB/en-GB.mod_stats_admin.sys.ini +++ b/administrator/language/en-GB/en-GB.mod_stats_admin.sys.ini @@ -1,7 +1,7 @@ ; Joomla! Project ; Copyright (C) 2005 - 2015 Open Source Matters. All rights reserved. ; 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 - No BOM +; Note : All ini files need to be saved as UTF-8 MOD_STATS_ADMIN="Statistics" MOD_STATS_LAYOUT_DEFAULT="Default" diff --git a/administrator/language/en-GB/en-GB.plg_content_pagebreak.ini b/administrator/language/en-GB/en-GB.plg_content_pagebreak.ini index 8680bc014ac3f..5cc6a013e7095 100644 --- a/administrator/language/en-GB/en-GB.plg_content_pagebreak.ini +++ b/administrator/language/en-GB/en-GB.plg_content_pagebreak.ini @@ -19,7 +19,7 @@ PLG_CONTENT_PAGEBREAK_SITE_ARTICLEINDEX_LABEL="Article Index Heading" PLG_CONTENT_PAGEBREAK_SITE_TITLE_DESC="Title and heading attributes from Plugin added to Site Title tag." PLG_CONTENT_PAGEBREAK_SITE_TITLE_LABEL="Show Site Title" PLG_CONTENT_PAGEBREAK_SLIDERS="Sliders" -PLG_CONTENT_PAGEBREAK_STYLE_DESC="Chose whether to layout the article with separate pages, tabs or sliders." +PLG_CONTENT_PAGEBREAK_STYLE_DESC="Choose whether to layout the article with separate pages, tabs or sliders." PLG_CONTENT_PAGEBREAK_STYLE_LABEL="Presentation Style" PLG_CONTENT_PAGEBREAK_TABS="Tabs" PLG_CONTENT_PAGEBREAK_TOC_DESC="Display a table of contents on multipage Articles." diff --git a/administrator/language/en-GB/en-GB.plg_quickicon_extensionupdate.ini b/administrator/language/en-GB/en-GB.plg_quickicon_extensionupdate.ini index aaa1ac56f3b67..1c342a792b8f2 100644 --- a/administrator/language/en-GB/en-GB.plg_quickicon_extensionupdate.ini +++ b/administrator/language/en-GB/en-GB.plg_quickicon_extensionupdate.ini @@ -9,7 +9,7 @@ PLG_QUICKICON_EXTENSIONUPDATE_ERROR="Unknown extensions ..." PLG_QUICKICON_EXTENSIONUPDATE_GROUP_DESC="The group of this plugin (this value is compared with the group value used in Quick Icons modules to inject icons)." PLG_QUICKICON_EXTENSIONUPDATE_GROUP_LABEL="Group" PLG_QUICKICON_EXTENSIONUPDATE_UPDATEFOUND="Updates are available! %s" -PLG_QUICKICON_EXTENSIONUPDATE_UPDATEFOUND_BUTTON="Update Now" +PLG_QUICKICON_EXTENSIONUPDATE_UPDATEFOUND_BUTTON="View Updates" PLG_QUICKICON_EXTENSIONUPDATE_UPDATEFOUND_MESSAGE="%s Extension Update(s) are available:" PLG_QUICKICON_EXTENSIONUPDATE_UPTODATE="All extensions are up-to-date." PLG_QUICKICON_EXTENSIONUPDATE_XML_DESCRIPTION="Checks for updates of your installed third-party extensions and notifies you when you visit the Control Panel page." diff --git a/administrator/language/en-GB/en-GB.plg_quickicon_joomlaupdate.ini b/administrator/language/en-GB/en-GB.plg_quickicon_joomlaupdate.ini index cc0d5dda9b567..d78aac6d5e2ba 100644 --- a/administrator/language/en-GB/en-GB.plg_quickicon_joomlaupdate.ini +++ b/administrator/language/en-GB/en-GB.plg_quickicon_joomlaupdate.ini @@ -11,5 +11,5 @@ PLG_QUICKICON_JOOMLAUPDATE_GROUP_LABEL="Group" PLG_QUICKICON_JOOMLAUPDATE_UPDATEFOUND="Joomla! %s, Update now!" PLG_QUICKICON_JOOMLAUPDATE_UPDATEFOUND_BUTTON="Update Now" PLG_QUICKICON_JOOMLAUPDATE_UPDATEFOUND_MESSAGE="Joomla! %s is available:" -PLG_QUICKICON_JOOMLAUPDATE_UPTODATE="Joomla! is up-to-date" +PLG_QUICKICON_JOOMLAUPDATE_UPTODATE="Joomla! is up-to-date." PLG_QUICKICON_JOOMLAUPDATE_XML_DESCRIPTION="Checks for Joomla! updates and notifies you when you visit the Control Panel page." diff --git a/administrator/language/en-GB/en-GB.plg_system_debug.ini b/administrator/language/en-GB/en-GB.plg_system_debug.ini index 9a6e2e8015bdc..e13525b35b81b 100644 --- a/administrator/language/en-GB/en-GB.plg_system_debug.ini +++ b/administrator/language/en-GB/en-GB.plg_system_debug.ini @@ -1,7 +1,7 @@ ; Joomla! Project ; Copyright (C) 2005 - 2015 Open Source Matters. All rights reserved. ; 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 - No BOM +; Note : All ini files need to be saved as UTF-8 PLG_DEBUG_BYTES="Bytes" PLG_DEBUG_CALL_STACK="Call Stack" @@ -9,6 +9,8 @@ PLG_DEBUG_ERRORS="Errors" PLG_DEBUG_EXPLAIN="Explain" PLG_DEBUG_FIELD_ALLOWED_GROUPS_DESC="Optionally restrict users that can see debug information to those in the selected user groups. If none selected, all users will see the debug information." PLG_DEBUG_FIELD_ALLOWED_GROUPS_LABEL="Allowed Groups" +PLG_DEBUG_FIELD_EXECUTEDSQL_DESC="If enabled, executed SQL queries will be logged. Only use this setting for short periods of time and for benchmarking purposes." +PLG_DEBUG_FIELD_EXECUTEDSQL_LABEL="Log Executed Queries" PLG_DEBUG_FIELD_LANGUAGE_ERRORFILES_DESC="Display a list of the language files that are in error according to the Joomla ini specification." PLG_DEBUG_FIELD_LANGUAGE_ERRORFILES_LABEL="Show Errors When Parsing Language Files" PLG_DEBUG_FIELD_LANGUAGE_FILES_DESC="Display a list of the language files that Joomla has tried to load." @@ -17,7 +19,7 @@ PLG_DEBUG_FIELD_LANGUAGE_STRING_DESC="Display a list of the untranslated languag PLG_DEBUG_FIELD_LANGUAGE_STRING_LABEL="Show Language String" PLG_DEBUG_FIELD_LOGS_DESC="Display a list of logged messages." PLG_DEBUG_FIELD_LOGS_LABEL="Show Log Entries" -PLG_DEBUG_FIELD_LOG_CATEGORIES_DESC="A comma separated list of log categories to include. Common log categories include but are not limited to: database, databasequery, deprecated and jerror. If empty, all categories will be shown." +PLG_DEBUG_FIELD_LOG_CATEGORIES_DESC="A comma separated list of log categories to include. Common log categories include but are not limited to: database, databasequery, database-error, deprecated and jerror. If empty, all categories will be shown." PLG_DEBUG_FIELD_LOG_CATEGORIES_LABEL="Log Categories" PLG_DEBUG_FIELD_LOG_CATEGORY_MODE_DESC="Select whether the listed categories should be included or excluded." PLG_DEBUG_FIELD_LOG_CATEGORY_MODE_EXCLUDE="Exclude" diff --git a/administrator/language/en-GB/en-GB.plg_system_debug.sys.ini b/administrator/language/en-GB/en-GB.plg_system_debug.sys.ini index 9e0dd2353dcf2..230f110832033 100644 --- a/administrator/language/en-GB/en-GB.plg_system_debug.sys.ini +++ b/administrator/language/en-GB/en-GB.plg_system_debug.sys.ini @@ -1,7 +1,7 @@ ; Joomla! Project ; Copyright (C) 2005 - 2015 Open Source Matters. All rights reserved. ; 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 - No BOM +; Note : All ini files need to be saved as UTF-8 PLG_DEBUG_XML_DESCRIPTION="This plugin provides a variety of system information and assistance for the creation of translation files." PLG_SYSTEM_DEBUG="System - Debug" diff --git a/administrator/language/en-GB/en-GB.plg_system_languagecode.ini b/administrator/language/en-GB/en-GB.plg_system_languagecode.ini index 4fa004c51585b..05a1280d1b041 100644 --- a/administrator/language/en-GB/en-GB.plg_system_languagecode.ini +++ b/administrator/language/en-GB/en-GB.plg_system_languagecode.ini @@ -5,6 +5,6 @@ PLG_SYSTEM_LANGUAGECODE="System - Language Code" PLG_SYSTEM_LANGUAGECODE_FIELD_DESC="Changes the language code used for the %s language." -PLG_SYSTEM_LANGUAGECODE_FIELDSET_DESC="Changes the language code for the generated HTML document. Example of use: One has installed the fr-FR language pack and wants the Search Engines to recognise the page as aimed at French-speaking Canada. Add the tag 'fr-CA' to the corresponding field for 'fr-FR' to resolve this." +PLG_SYSTEM_LANGUAGECODE_FIELDSET_DESC="Changes the language code for the generated HTML document. Example of use: You have installed the fr-FR language pack and want the Search Engines to recognise the page as aimed at French-speaking Canada. Add the tag 'fr-CA' to the corresponding field for 'fr-FR' to resolve this." PLG_SYSTEM_LANGUAGECODE_FIELDSET_LABEL="Language Codes" PLG_SYSTEM_LANGUAGECODE_XML_DESCRIPTION="Provides the ability to change the language code in the generated HTML document to improve SEO.
    The fields will appear when the plugin is enabled and saved.
    More information at W3.org." diff --git a/administrator/language/en-GB/en-GB.plg_system_redirect.ini b/administrator/language/en-GB/en-GB.plg_system_redirect.ini index 456a14501841f..041fcf3469d8f 100644 --- a/administrator/language/en-GB/en-GB.plg_system_redirect.ini +++ b/administrator/language/en-GB/en-GB.plg_system_redirect.ini @@ -3,7 +3,8 @@ ; 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_REDIRECT_XML_DESCRIPTION="The system redirect plugin enables the Joomla Redirect system to catch missing pages and redirect users." PLG_SYSTEM_REDIRECT="System - Redirect" +PLG_SYSTEM_REDIRECT_ERROR_UPDATING_DATABASE="An error occurred while updating the database." PLG_SYSTEM_REDIRECT_FIELD_COLLECT_URLS_DESC="This option controls the collection of URLs. This is useful to avoid unnecessary load on the database." PLG_SYSTEM_REDIRECT_FIELD_COLLECT_URLS_LABEL="Collect URLs" +PLG_SYSTEM_REDIRECT_XML_DESCRIPTION="The system redirect plugin enables the Joomla Redirect system to catch missing pages and redirect users." diff --git a/administrator/language/en-GB/en-GB.plg_system_redirect.sys.ini b/administrator/language/en-GB/en-GB.plg_system_redirect.sys.ini index 72f6df3bafe43..5bfe91eb6d25d 100644 --- a/administrator/language/en-GB/en-GB.plg_system_redirect.sys.ini +++ b/administrator/language/en-GB/en-GB.plg_system_redirect.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_REDIRECT_XML_DESCRIPTION="The system redirect plugin enables the Joomla Redirect system to catch missing pages and redirect users." PLG_SYSTEM_REDIRECT="System - Redirect" +PLG_SYSTEM_REDIRECT_XML_DESCRIPTION="The system redirect plugin enables the Joomla Redirect system to catch missing pages and redirect users." diff --git a/administrator/language/en-GB/en-GB.plg_user_contactcreator.ini b/administrator/language/en-GB/en-GB.plg_user_contactcreator.ini index bb140a25bbb01..5011eb3828205 100644 --- a/administrator/language/en-GB/en-GB.plg_user_contactcreator.ini +++ b/administrator/language/en-GB/en-GB.plg_user_contactcreator.ini @@ -1,7 +1,7 @@ ; Joomla! Project ; Copyright (C) 2005 - 2015 Open Source Matters. All rights reserved. ; 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 - No BOM +; Note : All ini files need to be saved as UTF-8 PLG_CONTACTCREATOR_ERR_FAILED_CREATING_CONTACT="Automatic contact creation failed. Please contact a site administrator." PLG_CONTACTCREATOR_ERR_NO_CATEGORY="Contact automatic creation failed because contact category is not set!" diff --git a/administrator/language/en-GB/en-GB.plg_user_contactcreator.sys.ini b/administrator/language/en-GB/en-GB.plg_user_contactcreator.sys.ini index 6ed85b6bb35fb..aeae72b0bbf51 100644 --- a/administrator/language/en-GB/en-GB.plg_user_contactcreator.sys.ini +++ b/administrator/language/en-GB/en-GB.plg_user_contactcreator.sys.ini @@ -1,7 +1,7 @@ ; Joomla! Project ; Copyright (C) 2005 - 2015 Open Source Matters. All rights reserved. ; 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 - No BOM +; Note : All ini files need to be saved as UTF-8 PLG_CONTACTCREATOR_XML_DESCRIPTION="Plugin to automatically create contact information for new users." PLG_USER_CONTACTCREATOR="User - Contact Creator" diff --git a/administrator/language/en-GB/en-GB.tpl_hathor.ini b/administrator/language/en-GB/en-GB.tpl_hathor.ini index e734574a0b0aa..0e7733674c7bb 100644 --- a/administrator/language/en-GB/en-GB.tpl_hathor.ini +++ b/administrator/language/en-GB/en-GB.tpl_hathor.ini @@ -1,7 +1,7 @@ ; Joomla! Project ; Copyright (C) 2005 - 2015 Open Source Matters. All rights reserved. ; 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 - No BOM +; Note : All ini files need to be saved as UTF-8 HATHOR="Hathor Administrator template" TPL_HATHOR_ALTERNATE_MENU_DESC="Use the alternative menu which integrates mouse and keyboard. JavaScript Required. The regular menu for Hathor is accessible with or without JavaScript, but leaves the mouse and keyboard independent." @@ -19,7 +19,7 @@ TPL_HATHOR_COM_MENUS_MENU="Menu" TPL_HATHOR_COM_MODULES_CUSTOM_POSITION_LABEL="Select" TPL_HATHOR_CPANEL_LINK_TEXT="Return to Control Panel" TPL_HATHOR_GO="Go" -TPL_HATHOR_LOGO_DESC="Upload a custom logo for the admin template." +TPL_HATHOR_LOGO_DESC="Select or upload a custom logo for the admin template." TPL_HATHOR_LOGO_LABEL="Logo" TPL_HATHOR_MAIN_MENU="Main Menu" TPL_HATHOR_SHOW_SITE_NAME_DESC="Show the site name in the template header." diff --git a/administrator/language/en-GB/en-GB.tpl_hathor.sys.ini b/administrator/language/en-GB/en-GB.tpl_hathor.sys.ini index 221abf2c80990..232dd0d901232 100644 --- a/administrator/language/en-GB/en-GB.tpl_hathor.sys.ini +++ b/administrator/language/en-GB/en-GB.tpl_hathor.sys.ini @@ -1,7 +1,7 @@ ; Joomla! Project ; Copyright (C) 2005 - 2015 Open Source Matters. All rights reserved. ; 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 - No BOM +; Note : All ini files need to be saved as UTF-8 HATHOR="Hathor Administrator template" TPL_HATHOR_POSITION_CP_SHELL="Unused" diff --git a/administrator/language/en-GB/en-GB.tpl_isis.ini b/administrator/language/en-GB/en-GB.tpl_isis.ini index eb4928567946f..300611762d6e0 100644 --- a/administrator/language/en-GB/en-GB.tpl_isis.ini +++ b/administrator/language/en-GB/en-GB.tpl_isis.ini @@ -20,7 +20,7 @@ TPL_ISIS_HEADER_DESC="Optional display of header." TPL_ISIS_HEADER_LABEL="Display Header" TPL_ISIS_INSTALLER="Installer" TPL_ISIS_ISFREESOFTWARE="Joomla is free software released under the GNU General Public License." -TPL_ISIS_LOGIN_LOGO_DESC="Upload a custom logo for the login area of admin template." +TPL_ISIS_LOGIN_LOGO_DESC="Select or upload a custom logo for the login area of admin template." TPL_ISIS_LOGIN_LOGO_LABEL="Login Logo" TPL_ISIS_LOGO_DESC="Upload a custom logo for the admin template." TPL_ISIS_LOGO_LABEL="Logo" diff --git a/administrator/language/en-GB/en-GB.xml b/administrator/language/en-GB/en-GB.xml index cb7ad0b28c8c0..7e0fbf8571157 100644 --- a/administrator/language/en-GB/en-GB.xml +++ b/administrator/language/en-GB/en-GB.xml @@ -1,7 +1,7 @@ English (en-GB) - 3.4.1 + 3.4.2 2013-03-07 Joomla! Project admin@joomla.org diff --git a/administrator/language/en-GB/install.xml b/administrator/language/en-GB/install.xml index aa75ed353f977..90f34eb1d2ae0 100644 --- a/administrator/language/en-GB/install.xml +++ b/administrator/language/en-GB/install.xml @@ -2,7 +2,7 @@ English (United Kingdom) en-GB - 3.4.1 + 3.4.2 2013-03-07 Joomla! Project admin@joomla.org @@ -213,7 +213,6 @@ en-GB.tpl_hathor.sys.ini en-GB.tpl_isis.ini en-GB.tpl_isis.sys.ini - index.html en-GB.xml install.xml diff --git a/administrator/manifests/files/joomla.xml b/administrator/manifests/files/joomla.xml index 7ff8bfe9e2ccf..1229b30ca8bb4 100644 --- a/administrator/manifests/files/joomla.xml +++ b/administrator/manifests/files/joomla.xml @@ -6,8 +6,8 @@ www.joomla.org (C) 2005 - 2015 Open Source Matters. All rights reserved GNU General Public License version 2 or later; see LICENSE.txt - 3.4.1-dev - February 2015 + 3.4.2-rc2-dev + June 2015 FILES_JOOMLA_XML_DESCRIPTION administrator/components/com_admin/script.php diff --git a/administrator/manifests/libraries/fof.xml b/administrator/manifests/libraries/fof.xml index 3af14cc251c1e..80dc1d82aa9e7 100644 --- a/administrator/manifests/libraries/fof.xml +++ b/administrator/manifests/libraries/fof.xml @@ -3,16 +3,20 @@ FOF fof LIB_FOF_XML_DESCRIPTION - 2015-03-11 11:59:00 + 2015-04-22 13:15:32 Nicholas K. Dionysopoulos / Akeeba Ltd nicholas@akeebabackup.com https://www.akeebabackup.com (C)2011-2015 Nicholas K. Dionysopoulos GNU GPLv2 or later - 2.4.2 + 2.4.3 Akeeba Ltd https://www.AkeebaBackup.com/download.html + + en-GB/en-GB.lib_fof.ini + + autoloader config diff --git a/administrator/manifests/packages/index.html b/administrator/manifests/packages/index.html new file mode 100644 index 0000000000000..2efb97f319a35 --- /dev/null +++ b/administrator/manifests/packages/index.html @@ -0,0 +1 @@ + diff --git a/administrator/modules/mod_latest/tmpl/default.php b/administrator/modules/mod_latest/tmpl/default.php index f8f5a5323a56b..34c3e3312a8d7 100644 --- a/administrator/modules/mod_latest/tmpl/default.php +++ b/administrator/modules/mod_latest/tmpl/default.php @@ -36,7 +36,7 @@
    - created, JText::_('DATE_FORMAT_LC4')); ?> + created, JText::_('DATE_FORMAT_LC4')); ?>
    diff --git a/administrator/modules/mod_logged/tmpl/default.php b/administrator/modules/mod_logged/tmpl/default.php index dafebca2145d8..2cff73b7ebbed 100644 --- a/administrator/modules/mod_logged/tmpl/default.php +++ b/administrator/modules/mod_logged/tmpl/default.php @@ -17,7 +17,7 @@
    client_id == 0) : ?> - + @@ -41,7 +41,7 @@
    - time, JText::_('DATE_FORMAT_LC4')); ?> + time, JText::_('DATE_FORMAT_LC4')); ?>
    diff --git a/administrator/modules/mod_login/helper.php b/administrator/modules/mod_login/helper.php index 60a76b74370b8..9265f32464af0 100644 --- a/administrator/modules/mod_login/helper.php +++ b/administrator/modules/mod_login/helper.php @@ -38,6 +38,15 @@ function ($a, $b) } ); + // Fix wrongly set parentheses in RTL languages + if (JFactory::getLanguage()->isRTL()) + { + foreach ($languages as &$language) + { + $language['text'] = $language['text'] . '‎'; + } + } + array_unshift($languages, JHtml::_('select.option', '', JText::_('JDEFAULTLANGUAGE'))); return JHtml::_('select.genericlist', $languages, 'lang', ' class="advancedSelect"', 'value', 'text', null); diff --git a/administrator/modules/mod_login/tmpl/default.php b/administrator/modules/mod_login/tmpl/default.php index 0f7fd1a4b70ba..1c247a68af149 100644 --- a/administrator/modules/mod_login/tmpl/default.php +++ b/administrator/modules/mod_login/tmpl/default.php @@ -20,14 +20,14 @@
    - + - +
    @@ -36,14 +36,14 @@
    - + - +
    @@ -53,14 +53,14 @@
    - + - +
    @@ -71,7 +71,7 @@
    - + @@ -83,9 +83,9 @@
    -
    -
    diff --git a/administrator/modules/mod_menu/helper.php b/administrator/modules/mod_menu/helper.php index 6878b406144ee..9af57c5a37504 100644 --- a/administrator/modules/mod_menu/helper.php +++ b/administrator/modules/mod_menu/helper.php @@ -42,7 +42,15 @@ public static function getMenus() $db->setQuery($query); - $result = $db->loadObjectList(); + try + { + $result = $db->loadObjectList(); + } + catch (RuntimeException $e) + { + $result = array(); + JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error'); + } return $result; } @@ -80,7 +88,15 @@ public static function getComponents($authCheck = true) $db->setQuery($query); // Component list - $components = $db->loadObjectList(); + try + { + $components = $db->loadObjectList(); + } + catch (RuntimeException $e) + { + $components = array(); + JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error'); + } // Parse the list of extensions. foreach ($components as &$component) diff --git a/administrator/modules/mod_menu/tmpl/default_enabled.php b/administrator/modules/mod_menu/tmpl/default_enabled.php index 4e176bdbc832a..2942535561ed8 100644 --- a/administrator/modules/mod_menu/tmpl/default_enabled.php +++ b/administrator/modules/mod_menu/tmpl/default_enabled.php @@ -151,7 +151,7 @@ } elseif ($menuType->home == 1 && $menuType->language == '*') { - $titleicon = ' '; + $titleicon = ' '; } elseif ($menuType->home > 1) { @@ -355,9 +355,10 @@ $menu->addChild(new JMenuNode(JText::_('MOD_MENU_HELP_RESOURCES'), 'http://resources.joomla.org', 'class:help-jrd', false, '_blank')); $menu->addChild(new JMenuNode(JText::_('MOD_MENU_HELP_COMMUNITY'), 'http://community.joomla.org', 'class:help-community', false, '_blank')); $menu->addChild( - new JMenuNode(JText::_('MOD_MENU_HELP_SECURITY'), 'http://developer.joomla.org/security.html', 'class:help-security', false, '_blank') + new JMenuNode(JText::_('MOD_MENU_HELP_SECURITY'), 'http://developer.joomla.org/security-centre.html', 'class:help-security', false, '_blank') ); $menu->addChild(new JMenuNode(JText::_('MOD_MENU_HELP_DEVELOPER'), 'http://developer.joomla.org', 'class:help-dev', false, '_blank')); + $menu->addChild(new JMenuNode(JText::_('MOD_MENU_HELP_XCHANGE'), 'http://joomla.stackexchange.com', 'class:help-dev', false, '_blank')); $menu->addChild(new JMenuNode(JText::_('MOD_MENU_HELP_SHOP'), 'http://shop.joomla.org', 'class:help-shop', false, '_blank')); $menu->getParent(); } diff --git a/administrator/modules/mod_multilangstatus/tmpl/default.php b/administrator/modules/mod_multilangstatus/tmpl/default.php index 0eaf5115455ba..820b4d8076403 100644 --- a/administrator/modules/mod_multilangstatus/tmpl/default.php +++ b/administrator/modules/mod_multilangstatus/tmpl/default.php @@ -9,19 +9,32 @@ defined('_JEXEC') or die; - // Include jQuery - JHtml::_('jquery.framework'); - JHtml::_('bootstrap.modal'); +// Include jQuery +JHtml::_('jquery.framework'); - JFactory::getDocument()->addStyleDeclaration('.navbar-fixed-bottom {z-index:1050;}'); +JFactory::getDocument()->addStyleDeclaration('.navbar-fixed-bottom {z-index:1050;}'); - $link = JRoute::_('index.php?option=com_languages&view=multilangstatus&tmpl=component'); +$link = JRoute::_('index.php?option=com_languages&view=multilangstatus&tmpl=component'); +$footer = '
    - + created, JText::_('DATE_FORMAT_LC4')); ?>
    diff --git a/administrator/modules/mod_stats_admin/helper.php b/administrator/modules/mod_stats_admin/helper.php index cb67ee15720ac..900b1ce54a82a 100644 --- a/administrator/modules/mod_stats_admin/helper.php +++ b/administrator/modules/mod_stats_admin/helper.php @@ -83,14 +83,28 @@ public static function getStats(&$params) $query->select('COUNT(id) AS count_users') ->from('#__users'); $db->setQuery($query); - $users = $db->loadResult(); + try + { + $users = $db->loadResult(); + } + catch (RuntimeException $e) + { + $users = false; + } $query->clear() ->select('COUNT(id) AS count_items') ->from('#__content') ->where('state = 1'); $db->setQuery($query); - $items = $db->loadResult(); + try + { + $items = $db->loadResult(); + } + catch (RuntimeException $e) + { + $items = false; + } if ($users) { @@ -117,7 +131,14 @@ public static function getStats(&$params) ->from('#__weblinks') ->where('state = 1'); $db->setQuery($query); - $links = $db->loadResult(); + try + { + $links = $db->loadResult(); + } + catch (RuntimeException $e) + { + $links = false; + } if ($links) { @@ -137,7 +158,14 @@ public static function getStats(&$params) ->from('#__content') ->where('state = 1'); $db->setQuery($query); - $hits = $db->loadResult(); + try + { + $hits = $db->loadResult(); + } + catch (RuntimeException $e) + { + $hits = false; + } if ($hits) { diff --git a/administrator/modules/mod_stats_admin/language/en-GB.mod_stats_admin.ini b/administrator/modules/mod_stats_admin/language/en-GB.mod_stats_admin.ini index 83c03cce69960..bb987c3b2eacf 100644 --- a/administrator/modules/mod_stats_admin/language/en-GB.mod_stats_admin.ini +++ b/administrator/modules/mod_stats_admin/language/en-GB.mod_stats_admin.ini @@ -1,7 +1,7 @@ ; Joomla! Project ; Copyright (C) 2005 - 2015 Open Source Matters. All rights reserved. ; 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 - No BOM +; Note : All ini files need to be saved as UTF-8 MOD_STATS_ADMIN="Statistics" MOD_STATS_ARTICLES="Articles" diff --git a/administrator/modules/mod_stats_admin/language/en-GB.mod_stats_admin.sys.ini b/administrator/modules/mod_stats_admin/language/en-GB.mod_stats_admin.sys.ini index 75590bc6c7686..c5732a268d4cd 100644 --- a/administrator/modules/mod_stats_admin/language/en-GB.mod_stats_admin.sys.ini +++ b/administrator/modules/mod_stats_admin/language/en-GB.mod_stats_admin.sys.ini @@ -1,7 +1,7 @@ ; Joomla! Project ; Copyright (C) 2005 - 2015 Open Source Matters. All rights reserved. ; 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 - No BOM +; Note : All ini files need to be saved as UTF-8 MOD_STATS_ADMIN="Statistics" MOD_STATS_XML_DESCRIPTION="The Statistics Module shows information about your server installation together with statistics on the website users, number of Articles in your database and the number of Web links you provide." diff --git a/administrator/modules/mod_stats_admin/tmpl/default.php b/administrator/modules/mod_stats_admin/tmpl/default.php index 5dce93379df5d..71408be912978 100644 --- a/administrator/modules/mod_stats_admin/tmpl/default.php +++ b/administrator/modules/mod_stats_admin/tmpl/default.php @@ -11,6 +11,6 @@ ?>
      -
    • title; ?> data; ?>
    • +
    • title; ?> data; ?>
    diff --git a/administrator/modules/mod_status/tmpl/default.php b/administrator/modules/mod_status/tmpl/default.php index d84b63d7036b7..d80911dd3b34b 100644 --- a/administrator/modules/mod_status/tmpl/default.php +++ b/administrator/modules/mod_status/tmpl/default.php @@ -18,7 +18,7 @@ { $output[] = '' . '
    '; @@ -49,7 +49,7 @@ $output[] = '
    ' . ($hideLinks ? '' : '') - . ' ' + . ' ' . '' . $unread . '' . ($hideLinks ? '' : '') . '
    ' @@ -70,7 +70,7 @@ { $output[] = ''; } diff --git a/administrator/templates/hathor/component.php b/administrator/templates/hathor/component.php index 3d62b434dadb7..c672b967cdfc7 100644 --- a/administrator/templates/hathor/component.php +++ b/administrator/templates/hathor/component.php @@ -18,6 +18,9 @@ $app = JFactory::getApplication(); $doc = JFactory::getDocument(); +// jQuery needed by template.js +JHtml::_('jquery.framework'); + // Load optional RTL Bootstrap CSS JHtml::_('bootstrap.loadCss', false, $this->direction); diff --git a/administrator/templates/hathor/cpanel.php b/administrator/templates/hathor/cpanel.php index 94b3b691134ee..3852b2eb6f9b7 100644 --- a/administrator/templates/hathor/cpanel.php +++ b/administrator/templates/hathor/cpanel.php @@ -151,8 +151,18 @@ diff --git a/administrator/templates/hathor/css/template.css b/administrator/templates/hathor/css/template.css index 7210e266f9877..a2fec511ed167 100644 --- a/administrator/templates/hathor/css/template.css +++ b/administrator/templates/hathor/css/template.css @@ -47,6 +47,18 @@ .collapse.in { height: auto; } +.modal-open .dropdown-menu { + z-index: 2050; +} +.modal-open .dropdown.open { + *z-index: 2050; +} +.modal-open .popover { + z-index: 2060; +} +.modal-open .tooltip { + z-index: 2080; +} .modal-backdrop { position: fixed; top: 0; @@ -64,28 +76,50 @@ opacity: 0.8; filter: alpha(opacity=80); } +div.modal { + position: fixed; + top: 50%; + left: 50%; + z-index: 1050; + overflow: auto; + width: 80%; + margin: -250px 0 0 -40%; + background-color: #ffffff; + border: 1px solid #999; + border: 1px solid rgba(0,0,0,0.3); + *border: 1px solid #999; + -webkit-border-radius: 6px; + -moz-border-radius: 6px; + border-radius: 6px; + -webkit-box-shadow: 0 3px 7px rgba(0,0,0,0.3); + -moz-box-shadow: 0 3px 7px rgba(0,0,0,0.3); + box-shadow: 0 3px 7px rgba(0,0,0,0.3); + -webkit-background-clip: padding-box; + -moz-background-clip: padding-box; + background-clip: padding-box; +} +div.modal.fade { + -webkit-transition: opacity .3s linear, top .3s ease-out; + -moz-transition: opacity .3s linear, top .3s ease-out; + -o-transition: opacity .3s linear, top .3s ease-out; + transition: opacity .3s linear, top .3s ease-out; + top: -25%; +} +div.modal.fade.in { + top: 50%; +} .modal-header { padding: 9px 15px; border-bottom: 1px solid #eee; } .modal-header .close { + float: right; margin-top: 2px; } -.modal-header h3 { - margin: 0; - line-height: 30px; -} .modal-body { - width: 98%; - position: relative; overflow-y: auto; max-height: 400px; - padding: 1%; -} -.modal-body iframe { - width: 100%; - max-height: none; - border: 0 !important; + padding: 15px; } .modal-form { margin-bottom: 0; @@ -120,43 +154,9 @@ .modal-footer .btn-group .btn + .btn { margin-left: -1px; } -.modal-footer .btn-block + .btn-block { - margin-left: 0; -} -div.modal { - position: fixed; - top: 5%; - left: 50%; - z-index: 1050; - width: 80%; - margin-left: -40%; - background-color: #ffffff; - border: 1px solid #999; - border: 1px solid rgba(0,0,0,0.3); - *border: 1px solid #999; - -webkit-border-radius: 6px; - -moz-border-radius: 6px; - border-radius: 6px; - -webkit-box-shadow: 0 3px 7px rgba(0,0,0,0.3); - -moz-box-shadow: 0 3px 7px rgba(0,0,0,0.3); - box-shadow: 0 3px 7px rgba(0,0,0,0.3); - -webkit-background-clip: padding-box; - -moz-background-clip: padding-box; - background-clip: padding-box; - outline: none; -} -div.modal.fade { - -webkit-transition: opacity .3s linear, top .3s ease-out; - -moz-transition: opacity .3s linear, top .3s ease-out; - -o-transition: opacity .3s linear, top .3s ease-out; - transition: opacity .3s linear, top .3s ease-out; - top: -25%; -} -div.modal.fade.in { - top: 5%; -} -.modal-batch { - overflow-y: visible; +body.modal-open { + overflow: hidden; + -ms-overflow-style: none; } @font-face { font-family: 'IcoMoon'; @@ -369,7 +369,6 @@ dl.article-info dd.hits span[class*=" icon-"] { .icon-plus-2:before { content: "\5d"; } -.icon-ban-circle:before, .icon-minus-sign:before, .icon-minus-2:before { content: "\5e"; @@ -396,6 +395,7 @@ dl.article-info dd.hits span[class*=" icon-"] { .icon-not-ok:before { content: "\4b"; } +.icon-ban-circle:before, .icon-minus-circle:before { content: "\e216"; } @@ -524,7 +524,6 @@ dl.article-info dd.hits span[class*=" icon-"] { .icon-file-plus:before { content: "\29"; } -.icon-file-remove:before, .icon-file-minus:before { content: "\e017"; } diff --git a/administrator/templates/hathor/favicon.ico b/administrator/templates/hathor/favicon.ico index b222fdd596107..1a4d7979dcf49 100644 Binary files a/administrator/templates/hathor/favicon.ico and b/administrator/templates/hathor/favicon.ico differ diff --git a/administrator/templates/hathor/html/com_admin/profile/edit.php b/administrator/templates/hathor/html/com_admin/profile/edit.php index 426eca9f63f83..364249e1ccb56 100644 --- a/administrator/templates/hathor/html/com_admin/profile/edit.php +++ b/administrator/templates/hathor/html/com_admin/profile/edit.php @@ -12,22 +12,21 @@ // Include the component HTML helpers. JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.formvalidation'); +JHtml::_('behavior.formvalidator'); // Get the form fieldsets. $fieldsets = $this->form->getFieldsets(); -?> - - +"); +?>
    diff --git a/administrator/templates/hathor/html/com_banners/banner/edit.php b/administrator/templates/hathor/html/com_banners/banner/edit.php index 6b98c7e2a6bcd..f5b1830124d78 100644 --- a/administrator/templates/hathor/html/com_banners/banner/edit.php +++ b/administrator/templates/hathor/html/com_banners/banner/edit.php @@ -11,18 +11,18 @@ JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); -JHtml::_('behavior.formvalidation'); -?> - - +"); +?>
    diff --git a/administrator/templates/hathor/html/com_banners/banners/default.php b/administrator/templates/hathor/html/com_banners/banners/default.php index 7f6b5e25cdb68..8852105995582 100644 --- a/administrator/templates/hathor/html/com_banners/banners/default.php +++ b/administrator/templates/hathor/html/com_banners/banners/default.php @@ -12,7 +12,6 @@ JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); JHtml::_('behavior.multiselect'); -JHtml::_('behavior.modal'); $user = JFactory::getUser(); $userId = $user->get('id'); @@ -217,7 +216,19 @@
    - loadTemplate('batch'); ?> + authorise('core.create', 'com_banners') + && $user->authorise('core.edit', 'com_banners') + && $user->authorise('core.edit.state', 'com_banners')) : ?> + JText::_('COM_BANNERS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + diff --git a/administrator/templates/hathor/html/com_banners/client/edit.php b/administrator/templates/hathor/html/com_banners/client/edit.php index 3ba67c2151602..8616623d358d7 100644 --- a/administrator/templates/hathor/html/com_banners/client/edit.php +++ b/administrator/templates/hathor/html/com_banners/client/edit.php @@ -11,17 +11,18 @@ JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.formvalidation'); -?> - +"); +?> diff --git a/administrator/templates/hathor/html/com_categories/categories/default.php b/administrator/templates/hathor/html/com_categories/categories/default.php index 0c540a8f6b2c5..adb42ad6a9e03 100644 --- a/administrator/templates/hathor/html/com_categories/categories/default.php +++ b/administrator/templates/hathor/html/com_categories/categories/default.php @@ -13,7 +13,6 @@ JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); JHtml::_('behavior.multiselect'); -JHtml::_('behavior.modal'); $app = JFactory::getApplication(); $user = JFactory::getUser(); @@ -23,7 +22,6 @@ $listDirn = $this->escape($this->state->get('list.direction')); $ordering = ($listOrder == 'a.lft'); $saveOrder = ($listOrder == 'a.lft' && $listDirn == 'asc'); -$assoc = JLanguageAssociations::isEnabled(); ?>
    @@ -101,7 +99,7 @@ - + assoc) : ?> @@ -165,7 +163,7 @@ escape($item->access_level); ?> - + assoc) : ?> association): ?> id, $extension); ?> @@ -192,7 +190,19 @@
    - loadTemplate('batch'); ?> + authorise('core.create', $extension) + && $user->authorise('core.edit', $extension) + && $user->authorise('core.edit.state', $extension)) : ?> + JText::_('COM_CATEGORIES_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + diff --git a/administrator/templates/hathor/html/com_categories/category/edit.php b/administrator/templates/hathor/html/com_categories/category/edit.php index bd07019ecfb4b..ce8029278985d 100644 --- a/administrator/templates/hathor/html/com_categories/category/edit.php +++ b/administrator/templates/hathor/html/com_categories/category/edit.php @@ -16,22 +16,21 @@ $saveHistory = $this->state->get('params')->get('save_history', 0); -JHtml::_('behavior.formvalidation'); JHtml::_('behavior.keepalive'); +JHtml::_('behavior.formvalidator'); -$assoc = JLanguageAssociations::isEnabled(); - -?> - - +"); +$assoc = JLanguageAssociations::isEnabled(); + +?>
    diff --git a/administrator/templates/hathor/html/com_config/application/default.php b/administrator/templates/hathor/html/com_config/application/default.php index 03ec6d030731f..9de28a7bb0a76 100644 --- a/administrator/templates/hathor/html/com_config/application/default.php +++ b/administrator/templates/hathor/html/com_config/application/default.php @@ -9,21 +9,21 @@ defined('_JEXEC') or die; -JHtml::_('behavior.formvalidation'); +JHtml::_('behavior.formvalidator'); JHtml::_('behavior.switcher'); // Load submenu template, using element id 'submenu' as needed by behavior.switcher $this->document->setBuffer($this->loadTemplate('navigation'), 'modules', 'submenu'); -?> - +"); +?> ftp) : ?> diff --git a/administrator/templates/hathor/html/com_config/component/default.php b/administrator/templates/hathor/html/com_config/component/default.php index cdd9c0f6392c7..9e6350ea2e28d 100644 --- a/administrator/templates/hathor/html/com_config/component/default.php +++ b/administrator/templates/hathor/html/com_config/component/default.php @@ -12,17 +12,18 @@ $app = JFactory::getApplication(); $template = $app->getTemplate(); -JHtml::_('behavior.formvalidation'); +JHtml::_('behavior.formvalidator'); JHtml::_('bootstrap.framework'); -?> - +"); +?> component->option . '_configuration', array('useCookie' => 1)); diff --git a/administrator/templates/hathor/html/com_contact/contact/edit.php b/administrator/templates/hathor/html/com_contact/contact/edit.php index 64284002b1078..581b1b11807a1 100644 --- a/administrator/templates/hathor/html/com_contact/contact/edit.php +++ b/administrator/templates/hathor/html/com_contact/contact/edit.php @@ -12,7 +12,7 @@ // Include the component HTML helpers. JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.formvalidation'); +JHtml::_('behavior.formvalidator'); $app = JFactory::getApplication(); $input = $app->input; @@ -21,18 +21,17 @@ $assoc = JLanguageAssociations::isEnabled(); -?> - - +"); +?>
    diff --git a/administrator/templates/hathor/html/com_contact/contacts/default.php b/administrator/templates/hathor/html/com_contact/contacts/default.php index 51866e0d551a8..ca72a8404464d 100644 --- a/administrator/templates/hathor/html/com_contact/contacts/default.php +++ b/administrator/templates/hathor/html/com_contact/contacts/default.php @@ -12,7 +12,6 @@ JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); JHtml::_('behavior.multiselect'); -JHtml::_('behavior.modal'); $app = JFactory::getApplication(); $user = JFactory::getUser(); @@ -219,8 +218,20 @@ - - loadTemplate('batch'); ?> + + authorise('core.create', 'com_contact') + && $user->authorise('core.edit', 'com_contact') + && $user->authorise('core.edit.state', 'com_contact')) : ?> + JText::_('COM_CONTACT_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + pagination->getListFooter(); ?> diff --git a/administrator/templates/hathor/html/com_content/article/edit.php b/administrator/templates/hathor/html/com_content/article/edit.php index c81f50d0ee48f..42a1b795bdb3b 100644 --- a/administrator/templates/hathor/html/com_content/article/edit.php +++ b/administrator/templates/hathor/html/com_content/article/edit.php @@ -12,7 +12,7 @@ // Include the component HTML helpers. JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.formvalidation'); +JHtml::_('behavior.formvalidator'); JHtml::_('behavior.keepalive'); // Create shortcut to parameters. @@ -45,19 +45,17 @@ $assoc = JLanguageAssociations::isEnabled(); -?> - - - +"); +?>
    diff --git a/administrator/templates/hathor/html/com_content/articles/default.php b/administrator/templates/hathor/html/com_content/articles/default.php index d0a4f9574dfbe..788ea7e082705 100644 --- a/administrator/templates/hathor/html/com_content/articles/default.php +++ b/administrator/templates/hathor/html/com_content/articles/default.php @@ -12,7 +12,6 @@ JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); JHtml::_('behavior.multiselect'); -JHtml::_('behavior.modal'); $app = JFactory::getApplication(); $user = JFactory::getUser(); @@ -51,7 +50,7 @@ @@ -232,8 +231,20 @@ - - loadTemplate('batch'); ?> + + authorise('core.create', 'com_content') + && $user->authorise('core.edit', 'com_content') + && $user->authorise('core.edit.state', 'com_content')) : ?> + JText::_('COM_CONTENT_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + pagination->getListFooter(); ?> diff --git a/administrator/templates/hathor/html/com_finder/filters/default.php b/administrator/templates/hathor/html/com_finder/filters/default.php index 580e17fe0f768..0d2d684fca133 100644 --- a/administrator/templates/hathor/html/com_finder/filters/default.php +++ b/administrator/templates/hathor/html/com_finder/filters/default.php @@ -15,9 +15,8 @@ $listDirn = $this->escape($this->state->get('list.direction')); JText::script('COM_FINDER_INDEX_CONFIRM_DELETE_PROMPT'); -?> - +"); +?> sidebar)) : ?> diff --git a/administrator/templates/hathor/html/com_finder/index/default.php b/administrator/templates/hathor/html/com_finder/index/default.php index d9f285597d3ba..08319d4316693 100644 --- a/administrator/templates/hathor/html/com_finder/index/default.php +++ b/administrator/templates/hathor/html/com_finder/index/default.php @@ -17,38 +17,37 @@ $lang = JFactory::getLanguage(); JText::script('COM_FINDER_INDEX_CONFIRM_PURGE_PROMPT'); JText::script('COM_FINDER_INDEX_CONFIRM_DELETE_PROMPT'); -?> - + Joomla.submitform(pressbutton); + } +"); +?> sidebar)) : ?>
    diff --git a/administrator/templates/hathor/html/com_finder/maps/default.php b/administrator/templates/hathor/html/com_finder/maps/default.php index ce6c26a394ba7..381de5a5c5632 100644 --- a/administrator/templates/hathor/html/com_finder/maps/default.php +++ b/administrator/templates/hathor/html/com_finder/maps/default.php @@ -16,25 +16,26 @@ $lang = JFactory::getLanguage(); JText::script('COM_FINDER_MAPS_CONFIRM_DELETE_PROMPT'); -?> - +"); +?> + sidebar)) : ?>
    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 faccc90774ba0..fa3bb0dc06d3a 100644 --- a/administrator/templates/hathor/html/com_installer/install/default_form.php +++ b/administrator/templates/hathor/html/com_installer/install/default_form.php @@ -13,15 +13,14 @@ JHtml::_('behavior.framework', true); JHtml::_('bootstrap.tooltip'); -?> - - +"); +?> sidebar)) : ?>
    diff --git a/administrator/templates/hathor/html/com_languages/installed/default.php b/administrator/templates/hathor/html/com_languages/installed/default.php index 340cc98047499..93f3912403e3e 100644 --- a/administrator/templates/hathor/html/com_languages/installed/default.php +++ b/administrator/templates/hathor/html/com_languages/installed/default.php @@ -9,6 +9,7 @@ defined('_JEXEC') or die; +JHtmlBehavior::core(); // Add specific helper files for html generation JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); $user = JFactory::getUser(); @@ -94,7 +95,7 @@ escape($row->author); ?> - escape($row->authorEmail); ?> + escape($row->authorEmail)); ?> diff --git a/administrator/templates/hathor/html/com_menus/item/edit.php b/administrator/templates/hathor/html/com_menus/item/edit.php index f87dd6ef93619..b7b64b60f71e9 100644 --- a/administrator/templates/hathor/html/com_menus/item/edit.php +++ b/administrator/templates/hathor/html/com_menus/item/edit.php @@ -13,67 +13,66 @@ JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); JHtml::_('behavior.framework'); -JHtml::_('behavior.formvalidation'); +JHtml::_('behavior.formvalidator'); JHtml::_('behavior.modal'); -//Ajax for parent items -$script = "jQuery(document).ready(function ($){ - $('#jform_menutype').change(function(){ - var menutype = $(this).val(); - $.ajax({ - url: 'index.php?option=com_menus&task=item.getParentItem&menutype=' + menutype, - dataType: 'json' - }).done(function(data) { - $('#jform_parent_id option').each(function() { - if ($(this).val() != '1') { - $(this).remove(); - } - }); - - $.each(data, function (i, val) { - var option = $('
    diff --git a/layouts/joomla/edit/frontediting_modules.php b/layouts/joomla/edit/frontediting_modules.php index 996d516806bd2..c572d99b70407 100644 --- a/layouts/joomla/edit/frontediting_modules.php +++ b/layouts/joomla/edit/frontediting_modules.php @@ -15,7 +15,9 @@ $mod = $displayData['module']; $position = $displayData['position']; $menusEditing = $displayData['menusediting']; -$redirectUri = '&return='. urlencode(base64_encode(JUri::getInstance()->toString())); +$parameters = JComponentHelper::getParams('com_modules'); +$redirectUri = '&return=' . urlencode(base64_encode(JUri::getInstance()->toString())); +$target = '_blank'; if (preg_match('/<(?:div|span|nav|ul|ol|h\d) [^>]*class="[^"]* jmoddiv"/', $moduleHtml)) { @@ -24,7 +26,13 @@ } // Add css class jmoddiv and data attributes for module-editing URL and for the tooltip: -$editUrl = JUri::base() . 'index.php?option=com_config&controller=config.display.modules&id=' . (int) $mod->id . $redirectUri; +$editUrl = JURI::base() . 'administrator/index.php?option=com_modules&view=module&layout=edit&id=' . (int) $mod->id; + +if ($parameters->get('redirect_edit', 'site') == 'site') +{ + $editUrl = JUri::base() . 'index.php?option=com_config&controller=config.display.modules&id=' . (int) $mod->id . $redirectUri; + $target = '_self'; +} // Add class, editing URL and tooltip, and if module of type menu, also the tooltip for editing the menu item: $count = 0; @@ -32,7 +40,7 @@ // Replace first tag of module with a class '/^(\s*<(?:div|span|nav|ul|ol|h\d) [^>]*class="[^"]*)"/', // By itself, adding class jmoddiv and data attributes for the url and tooltip: - '\\1 jmoddiv" data-jmodediturl="' . $editUrl . '" data-jmodtip="' + '\\1 jmoddiv" data-jmodediturl="' . $editUrl . '" data-target="' . $target . '" data-jmodtip="' . JHtml::tooltipText( JText::_('JLIB_HTML_EDIT_MODULE'), htmlspecialchars($mod->title) . '
    ' . sprintf(JText::_('JLIB_HTML_EDIT_MODULE_IN_POSITION'), htmlspecialchars($position)), diff --git a/layouts/joomla/edit/global.php b/layouts/joomla/edit/global.php index 9f734ed21f439..2a8708214a3b8 100644 --- a/layouts/joomla/edit/global.php +++ b/layouts/joomla/edit/global.php @@ -9,49 +9,47 @@ defined('_JEXEC') or die; -$app = JFactory::getApplication(); -$form = $displayData->getForm(); -$input = $app->input; +$app = JFactory::getApplication(); +$form = $displayData->getForm(); +$input = $app->input; $component = $input->getCmd('option', 'com_content'); + if ($component == 'com_categories') { - $extension = $input->getCmd('extension', 'com_content'); - $parts = explode('.', $extension); - $component = $parts[0]; + $extension = $input->getCmd('extension', 'com_content'); + $parts = explode('.', $extension); + $component = $parts[0]; } + $saveHistory = JComponentHelper::getParams($component)->get('save_history', 0); $fields = $displayData->get('fields') ?: array( - array('category', 'catid'), array('parent', 'parent_id'), - 'tags', array('published', 'state', 'enabled'), + array('category', 'catid'), 'featured', 'sticky', 'access', 'language', + 'tags', 'note', - 'version_note' + 'version_note', ); $hiddenFields = $displayData->get('hidden_fields') ?: array(); -// Multilanguage check: -/*if (!JLanguageMultilang::isEnabled()) -{ - $hiddenFields[] = 'language'; -}*/ if (!$saveHistory) { $hiddenFields[] = 'version_note'; } -$html = array(); +$html = array(); $html[] = '
    '; foreach ($fields as $field) { $field = is_array($field) ? $field : array($field); + foreach ($field as $f) { if ($form->getField($f)) diff --git a/layouts/joomla/editors/buttons/button.php b/layouts/joomla/editors/buttons/button.php index a502c26572295..704bb3b3ad2dc 100644 --- a/layouts/joomla/editors/buttons/button.php +++ b/layouts/joomla/editors/buttons/button.php @@ -17,10 +17,10 @@ $class = ($button->get('class')) ? $button->get('class') : null; $class .= ($button->get('modal')) ? ' modal-button' : null; $href = ($button->get('link')) ? ' href="' . JUri::base() . $button->get('link') . '"' : null; - $onclick = ($button->get('onclick')) ? ' onclick="' . $button->get('onclick') . '"' : ' onclick="IeCursorFix(); return false;"'; + $onclick = ($button->get('onclick')) ? ' onclick="' . $button->get('onclick') . '"' : ''; $title = ($button->get('title')) ? $button->get('title') : $button->get('text'); ?> - rel="get('options'); ?>"> - get('text'); ?> + rel="get('options'); ?>"> + get('text'); ?> - > > - +
  • diff --git a/layouts/joomla/modal/main.php b/layouts/joomla/modal/main.php index 6c2a2aa448438..a0465c70e7704 100644 --- a/layouts/joomla/modal/main.php +++ b/layouts/joomla/modal/main.php @@ -52,25 +52,33 @@ $modalAttributes['data-keyboard'] = (is_bool($params['keyboard']) ? ($params['keyboard'] ? 'true' : 'false') : 'true'); } +/** + * These lines below are for disabling scrolling of parent window. + * $('body').addClass('modal-open'); + * $('body').removeClass('modal-open') + * + * Specific hack for Bootstrap 2.3.x + */ +$script[] = "jQuery(document).ready(function($) {"; +$script[] = " $('#" . $selector . "').on('show', function() {"; +$script[] = " $('body').addClass('modal-open');"; + if (isset($params['url'])) { $iframeHtml = JLayoutHelper::render('joomla.modal.iframe', $displayData); - JFactory::getDocument()->addScriptDeclaration(" - jQuery(document).ready(function($) { - $('#" . $selector . "').on('show', function() { - var modalBody = $(this).find('.modal-body'); - - // Destroy previous iframe if loaded - modalBody.find('iframe').remove(); + // Script for destroying and reloading the iframe + $script[] = " var modalBody = $(this).find('.modal-body');"; + $script[] = " modalBody.find('iframe').remove();"; + $script[] = " modalBody.prepend('" . trim($iframeHtml) . "');"; +} - // Load iframe - modalBody.prepend('" . trim($iframeHtml) . "'); +$script[] = " }).on('hidden', function () {"; +$script[] = " $('body').removeClass('modal-open');"; +$script[] = " });"; +$script[] = "});"; - }); - }); - "); -} +JFactory::getDocument()->addScriptDeclaration(implode("\n", $script)); ?>
    > '; + $display = ''; } if ($displayData['active']) diff --git a/layouts/joomla/quickicons/icon.php b/layouts/joomla/quickicons/icon.php index 5d05a8927b1b5..bf05cc09034b8 100644 --- a/layouts/joomla/quickicons/icon.php +++ b/layouts/joomla/quickicons/icon.php @@ -19,7 +19,7 @@ diff --git a/layouts/joomla/searchtools/default/bar.php b/layouts/joomla/searchtools/default/bar.php index 93b14dd053e0c..35b8a9f62dc49 100644 --- a/layouts/joomla/searchtools/default/bar.php +++ b/layouts/joomla/searchtools/default/bar.php @@ -35,14 +35,17 @@
    input; ?> + description) : ?> + JText::_($filters['filter_search']->description))); ?> +
    diff --git a/layouts/joomla/searchtools/grid/sort.php b/layouts/joomla/searchtools/grid/sort.php index 272101cc2b304..b109e3b26156b 100644 --- a/layouts/joomla/searchtools/grid/sort.php +++ b/layouts/joomla/searchtools/grid/sort.php @@ -16,12 +16,12 @@ ?> icon)) : ?> - + title)) : ?> title); ?> order == $data->selected) : ?> - + diff --git a/layouts/joomla/sidebars/submenu.php b/layouts/joomla/sidebars/submenu.php index dfd5614b07573..b3d8b3e1de8d8 100644 --- a/layouts/joomla/sidebars/submenu.php +++ b/layouts/joomla/sidebars/submenu.php @@ -31,9 +31,6 @@
    -
    - -
    \ No newline at end of file diff --git a/layouts/joomla/toolbar/batch.php b/layouts/joomla/toolbar/batch.php index bfaa7155cb1e2..e15cb682d023b 100644 --- a/layouts/joomla/toolbar/batch.php +++ b/layouts/joomla/toolbar/batch.php @@ -16,7 +16,7 @@ $message = addslashes($message); ?> diff --git a/layouts/joomla/toolbar/popup.php b/layouts/joomla/toolbar/popup.php index a604f2b0d0417..296e1b2bb920c 100644 --- a/layouts/joomla/toolbar/popup.php +++ b/layouts/joomla/toolbar/popup.php @@ -17,6 +17,6 @@ $name = $displayData['name']; ?> diff --git a/layouts/joomla/toolbar/slider.php b/layouts/joomla/toolbar/slider.php index ec72ec68236c1..2444212ab6bf1 100644 --- a/layouts/joomla/toolbar/slider.php +++ b/layouts/joomla/toolbar/slider.php @@ -18,6 +18,6 @@ $onClose = $displayData['onClose']; ?> diff --git a/layouts/joomla/toolbar/versions.php b/layouts/joomla/toolbar/versions.php index 66b855541fe59..9cf4a3d3cf594 100644 --- a/layouts/joomla/toolbar/versions.php +++ b/layouts/joomla/toolbar/versions.php @@ -15,5 +15,5 @@ - + diff --git a/libraries/ClassLoader.php b/libraries/classloader.php similarity index 51% rename from libraries/ClassLoader.php rename to libraries/classloader.php index e95d59a63a198..6de6ebdcf6d26 100644 --- a/libraries/ClassLoader.php +++ b/libraries/classloader.php @@ -6,45 +6,57 @@ * @license GNU General Public License version 2 or later; see LICENSE */ -namespace Composer\Autoload; - defined('_JEXEC') or die; -// We have to manually require the base ClassLoader as the autoloader isn't loaded yet, but only if it doesn't exist -if (!class_exists('Composer\\Autoload\\ClassLoader')) -{ - require_once __DIR__ . '/vendor/composer/ClassLoader.php'; -} +use Composer\Autoload\ClassLoader; /** - * Extended Composer ClassLoader for Joomla! + * Decorate Composer ClassLoader for Joomla! * * For backward compatibility due to class aliasing in the CMS, the loadClass() method was modified to call * the JLoader::applyAliasFor() method. * - * @author Nicholas Dionysopoulos + * @author Johan Janssens * @since 3.4 */ -class ClassLoaderJoomla extends ClassLoader +class JClassLoader { + /** + * The composer class loader + * + * @var ClassLoader + * @since 3.4 + */ + private $loader; + + /** + * Constructor + * + * @param ClassLoader $loader Composer autoloader + * + * @since 3.4 + */ + public function __construct(ClassLoader $loader) + { + $this->loader = $loader; + } + /** * Loads the given class or interface. * * @param string $class The name of the class * - * @return bool|null True if loaded, null otherwise + * @return boolean|null True if loaded, null otherwise * * @since 3.4 */ public function loadClass($class) { - if ($file = $this->findFile($class)) + if ($result = $this->loader->loadClass($class)) { - includeFile($file); - - \JLoader::applyAliasFor($class); - - return true; + JLoader::applyAliasFor($class); } + + return $result; } } diff --git a/libraries/cms.php b/libraries/cms.php index 88525f6d4a511..a23e8de60e2a2 100644 --- a/libraries/cms.php +++ b/libraries/cms.php @@ -29,11 +29,16 @@ // Register the library base path for CMS libraries. JLoader::registerPrefix('J', JPATH_PLATFORM . '/cms', false, true); -// Add the Composer autoloader -require_once JPATH_LIBRARIES . '/composer_autoload.php'; +// Create the Composer autoloader +$loader = require_once JPATH_LIBRARIES . '/vendor/autoload.php'; +$loader->unregister(); + +// Decorate Composer autoloader +require_once JPATH_LIBRARIES . '/classloader.php'; +spl_autoload_register(array(new JClassLoader($loader), 'loadClass'), true, true); // Register the class aliases for Framework classes that have replaced their Platform equivilents -require_once __DIR__ . '/classmap.php'; +require_once JPATH_LIBRARIES . '/classmap.php'; // Ensure FOF autoloader included - needed for things like content versioning where we need to get an FOFTable Instance if (!class_exists('FOFAutoloaderFof')) diff --git a/libraries/cms/application/administrator.php b/libraries/cms/application/administrator.php index 3140c46af9913..d8ff923ce5e81 100644 --- a/libraries/cms/application/administrator.php +++ b/libraries/cms/application/administrator.php @@ -449,7 +449,7 @@ protected function route() { // Forward to https $uri->setScheme('https'); - $this->redirect((string) $uri); + $this->redirect((string) $uri, 301); } // Trigger the onAfterRoute event. diff --git a/libraries/cms/application/cms.php b/libraries/cms/application/cms.php index 58070a96d1cdf..6a3c9788dcc2e 100644 --- a/libraries/cms/application/cms.php +++ b/libraries/cms/application/cms.php @@ -159,6 +159,7 @@ public function afterSessionStart() * @return void * * @since 3.2 + * @throws RuntimeException */ public function checkSession() { @@ -208,7 +209,7 @@ public function checkSession() } catch (RuntimeException $e) { - jexit($e->getMessage()); + throw new RuntimeException(JText::_('JERROR_SESSION_STARTUP')); } } } diff --git a/libraries/cms/component/helper.php b/libraries/cms/component/helper.php index 7d44b1576ad1c..b0d7f71edbea7 100644 --- a/libraries/cms/component/helper.php +++ b/libraries/cms/component/helper.php @@ -100,6 +100,7 @@ public static function isInstalled($option) ->select('COUNT(extension_id)') ->from('#__extensions') ->where('element = ' . $db->quote($option)) + ->where('type = ' . $db->quote('component')) )->loadResult(); } diff --git a/libraries/cms/editor/editor.php b/libraries/cms/editor/editor.php index 07da515c5f6a4..701629126cbcc 100644 --- a/libraries/cms/editor/editor.php +++ b/libraries/cms/editor/editor.php @@ -489,18 +489,13 @@ protected function _loadEditor($config = array()) // Build the path to the needed editor plugin $name = JFilterInput::getInstance()->clean($this->_name, 'cmd'); - $path = JPATH_PLUGINS . '/editors/' . $name . '.php'; + $path = JPATH_PLUGINS . '/editors/' . $name . '/' . $name . '.php'; if (!is_file($path)) { - $path = JPATH_PLUGINS . '/editors/' . $name . '/' . $name . '.php'; + JLog::add(JText::_('JLIB_HTML_EDITOR_CANNOT_LOAD'), JLog::WARNING, 'jerror'); - if (!is_file($path)) - { - JLog::add(JText::_('JLIB_HTML_EDITOR_CANNOT_LOAD'), JLog::WARNING, 'jerror'); - - return false; - } + return false; } // Require plugin file diff --git a/libraries/cms/error/page.php b/libraries/cms/error/page.php index 4f1488786b4a2..5f46a07b7d7d8 100644 --- a/libraries/cms/error/page.php +++ b/libraries/cms/error/page.php @@ -35,11 +35,9 @@ public static function render(Exception $error) if (!$document) { // We're probably in an CLI environment - exit($error->getMessage()); + jexit($error->getMessage()); } - $config = JFactory::getConfig(); - // Get the current template from the application $template = $app->getTemplate(); @@ -52,26 +50,28 @@ public static function render(Exception $error) } $document->setTitle(JText::_('Error') . ': ' . $error->getCode()); + $data = $document->render( false, - array('template' => $template, - 'directory' => JPATH_THEMES, - 'debug' => $config->get('debug')) + array( + 'template' => $template, + 'directory' => JPATH_THEMES, + 'debug' => JDEBUG + ) ); - // Failsafe to get the error displayed. + // Do not allow cache + $app->allowCache(false); + + // If nothing was rendered, just use the message from the Exception if (empty($data)) { - exit($error->getMessage()); + $data = $error->getMessage(); } - else - { - // Do not allow cache - $app->allowCache(false); - $app->setBody($data); - echo $app->toString(); - } + $app->setBody($data); + + echo $app->toString(); } catch (Exception $e) { @@ -81,7 +81,7 @@ public static function render(Exception $error) header('HTTP/1.1 500 Internal Server Error'); } - exit('Error displaying the error page: ' . $e->getMessage() . ': ' . $error->getMessage()); + jexit('Error displaying the error page: ' . $e->getMessage() . ': ' . $error->getMessage()); } } } diff --git a/libraries/cms/form/field/contenthistory.php b/libraries/cms/form/field/contenthistory.php index 7564853ce870b..bd35755d9d1e5 100644 --- a/libraries/cms/form/field/contenthistory.php +++ b/libraries/cms/form/field/contenthistory.php @@ -46,7 +46,7 @@ protected function getInput() $html[] = ' '; diff --git a/libraries/cms/form/field/media.php b/libraries/cms/form/field/media.php index a35720b65e86d..0ca2e91d3c69f 100644 --- a/libraries/cms/form/field/media.php +++ b/libraries/cms/form/field/media.php @@ -232,7 +232,7 @@ protected function getInput() $script[] = ' $("#" + id + "_preview_empty").hide();'; $script[] = ' $("#" + id + "_preview_img").show()'; $script[] = ' } else { '; - $script[] = ' $img.attr("src", "")'; + $script[] = ' $img.attr("src", "");'; $script[] = ' $("#" + id + "_preview_empty").show();'; $script[] = ' $("#" + id + "_preview_img").hide();'; $script[] = ' } '; @@ -363,7 +363,7 @@ protected function getInput() $tooltip = $previewImgEmpty . $previewImg; $options = array( 'title' => JText::_('JLIB_FORM_MEDIA_PREVIEW_SELECTED_IMAGE'), - 'text' => '', + 'text' => '', 'class' => 'hasTipPreview' ); @@ -414,7 +414,7 @@ protected function getInput() $html[] = 'jInsertFieldValue(\'\', \'' . $this->id . '\');'; $html[] = 'return false;'; $html[] = '">'; - $html[] = ''; + $html[] = ''; } $html[] = '
    '; diff --git a/libraries/cms/form/field/tag.php b/libraries/cms/form/field/tag.php index ec6e5003aadd8..f2e796707d875 100644 --- a/libraries/cms/form/field/tag.php +++ b/libraries/cms/form/field/tag.php @@ -118,15 +118,6 @@ protected function getOptions() ->from('#__tags AS a') ->join('LEFT', $db->qn('#__tags') . ' AS b ON a.lft > b.lft AND a.rgt < b.rgt'); - // Ajax tag only loads assigned values - if (!$this->isNested() && !empty($this->value)) - { - // Only item assigned values - $values = (array) $this->value; - JArrayHelper::toInteger($values); - $query->where('a.id IN (' . implode(',', $values) . ')'); - } - // Filter language if (!empty($this->element['language'])) { diff --git a/libraries/cms/form/field/user.php b/libraries/cms/form/field/user.php index cb4f2d2fa7d0f..d2cbb578032e3 100644 --- a/libraries/cms/form/field/user.php +++ b/libraries/cms/form/field/user.php @@ -94,7 +94,7 @@ protected function getInput() { $html[] = ' '; - $html[] = ''; + $html[] = ''; } $html[] = ''; diff --git a/libraries/cms/form/field/usergrouplist.php b/libraries/cms/form/field/usergrouplist.php index 7f73f65dc674d..106a14ed3a36c 100644 --- a/libraries/cms/form/field/usergrouplist.php +++ b/libraries/cms/form/field/usergrouplist.php @@ -12,7 +12,7 @@ JFormHelper::loadFieldClass('list'); /** - * Field to load a list of available users statuses + * Field to load a drop down list of available user groups * * @since 3.2 */ diff --git a/libraries/cms/form/rule/captcha.php b/libraries/cms/form/rule/captcha.php index 49a108672acb6..7e9676edf2738 100644 --- a/libraries/cms/form/rule/captcha.php +++ b/libraries/cms/form/rule/captcha.php @@ -45,7 +45,7 @@ public function test(SimpleXMLElement $element, $value, $group = null, Registry } else { - $captcha = JCaptcha::getInstance($plugin, array('namespace' => (string) $namespace)); + $captcha = JCaptcha::getInstance((string) $plugin, array('namespace' => (string) $namespace)); } // Test the value. diff --git a/libraries/cms/form/rule/notequals.php b/libraries/cms/form/rule/notequals.php index f225f9940c5ce..b7508333fe06a 100644 --- a/libraries/cms/form/rule/notequals.php +++ b/libraries/cms/form/rule/notequals.php @@ -1,6 +1,6 @@ addScriptDeclaration( - "(function($){ - $('#$selector').collapse($options); - })(jQuery);" - ); + JFactory::getDocument()->addScriptDeclaration(implode("\n", $script)); // Set static array - static::$loaded[__METHOD__][$sig] = true; - static::$loaded[__METHOD__]['active'] = $opt['active']; - } + static::$loaded[__METHOD__][$selector] = $opt; - return '
    '; + return '
    '; + } } /** @@ -643,12 +675,14 @@ public static function endAccordion() */ public static function addSlide($selector, $text, $id, $class = '') { - $in = (static::$loaded['JHtmlBootstrap::startAccordion']['active'] == $id) ? ' in' : ''; + $in = (static::$loaded[__CLASS__ . '::startAccordion'][$selector]['active'] == $id) ? ' in' : ''; + $parent = static::$loaded[__CLASS__ . '::startAccordion'][$selector]['parent'] ? + ' data-parent="' . static::$loaded[__CLASS__ . '::startAccordion'][$selector]['parent'] . '"' : ''; $class = (!empty($class)) ? ' ' . $class : ''; $html = '
    ' . '' diff --git a/libraries/cms/html/grid.php b/libraries/cms/html/grid.php index 29f4c5fd5f605..cbab740c7f280 100644 --- a/libraries/cms/html/grid.php +++ b/libraries/cms/html/grid.php @@ -1,6 +1,6 @@ '; + $html .= ' '; } $html .= ''; @@ -273,7 +273,7 @@ public static function order($rows, $image = 'filesave.png', $task = 'saveorder' { return ''; + . JText::_('JLIB_HTML_SAVE_ORDER') . '">'; } /** diff --git a/libraries/cms/html/html.php b/libraries/cms/html/html.php index 5c1c4a95aafbd..a96d93a9c2538 100644 --- a/libraries/cms/html/html.php +++ b/libraries/cms/html/html.php @@ -1019,7 +1019,7 @@ public static function calendar($value, $name, $id, $format = '%Y-%m-%d', $attri return '' . '' - . '' + . '' . '
    '; } @@ -1057,10 +1057,14 @@ public static function addIncludePath($path = '') * * @return string JavaScript object notation representation of the array * + * @deprecated 4.0 use json_encode or JRegistry::toString('json') + * * @since 3.0 */ public static function getJSObject(array $array = array()) { + JLog::add(__METHOD__ . ' is deprecated. Use json_encode instead.', JLog::WARNING, 'deprecated'); + $elements = array(); foreach ($array as $k => $v) diff --git a/libraries/cms/html/jgrid.php b/libraries/cms/html/jgrid.php index 7cd4eda93cb13..6a5dcc9873e99 100644 --- a/libraries/cms/html/jgrid.php +++ b/libraries/cms/html/jgrid.php @@ -68,8 +68,7 @@ public static function action($i, $task, $prefix = '', $text = '', $active_title $html[] = ' href="javascript:void(0);" onclick="return listItemTask(\'' . $checkbox . $i . '\',\'' . $prefix . $task . '\')"'; $html[] = $tip ? ' title="' . $title . '"' : ''; $html[] = '>'; - $html[] = ''; - $html[] = ''; + $html[] = ''; $html[] = ''; } else @@ -80,11 +79,11 @@ public static function action($i, $task, $prefix = '', $text = '', $active_title if ($active_class == "protected") { - $html[] = ''; + $html[] = ''; } else { - $html[] = ''; + $html[] = ''; } $html[] = ''; diff --git a/libraries/cms/html/language/en-GB/en-GB.jhtmldate.ini b/libraries/cms/html/language/en-GB/en-GB.jhtmldate.ini index 7bc4dd89d866a..82d7b69bab2f3 100644 --- a/libraries/cms/html/language/en-GB/en-GB.jhtmldate.ini +++ b/libraries/cms/html/language/en-GB/en-GB.jhtmldate.ini @@ -1,7 +1,7 @@ ; Joomla! Project ; Copyright (C) 2005 - 2015 Open Source Matters. All rights reserved. ; 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 - No BOM +; Note : All ini files need to be saved as UTF-8 JLIB_HTML_DATE_RELATIVE_DAYS="%s days ago" JLIB_HTML_DATE_RELATIVE_DAYS_1="%s day ago" diff --git a/libraries/cms/html/select.php b/libraries/cms/html/select.php index d68125c8d710e..5e13878abfbcc 100644 --- a/libraries/cms/html/select.php +++ b/libraries/cms/html/select.php @@ -22,7 +22,7 @@ abstract class JHtmlSelect * @var array * @since 1.5 */ - static protected $optionDefaults = array( + protected static $optionDefaults = array( 'option' => array('option.attr' => null, 'option.disable' => 'disable', 'option.id' => null, 'option.key' => 'value', 'option.key.toHtml' => true, 'option.label' => null, 'option.label.toHtml' => true, 'option.text' => 'text', 'option.text.toHtml' => true, 'option.class' => 'class', 'option.onclick' => 'onclick')); @@ -464,8 +464,8 @@ public static function option($value, $text = '', $optKey = 'value', $optText = } $obj = new stdClass; - $obj->$options['option.key'] = $value; - $obj->$options['option.text'] = trim($text) ? $text : $value; + $obj->{$options['option.key']} = $value; + $obj->{$options['option.text']} = trim($text) ? $text : $value; /* * If a label is provided, save it. If no label is provided and there is @@ -480,19 +480,19 @@ public static function option($value, $text = '', $optKey = 'value', $optText = } elseif ($hasProperty) { - $obj->$options['option.label'] = ''; + $obj->{$options['option.label']} = ''; } // Set attributes only if there is a property and a value if ($options['attr'] !== null) { - $obj->$options['option.attr'] = $options['attr']; + $obj->{$options['option.attr']} = $options['attr']; } // Set disable only if it has a property and a value if ($options['disable'] !== null) { - $obj->$options['option.disable'] = $options['disable']; + $obj->{$options['option.disable']} = $options['disable']; } return $obj; @@ -600,37 +600,37 @@ public static function options($arr, $optKey = 'value', $optText = 'text', $sele } elseif (is_object($element)) { - $key = $options['option.key'] === null ? $elementKey : $element->$options['option.key']; - $text = $element->$options['option.text']; + $key = $options['option.key'] === null ? $elementKey : $element->{$options['option.key']}; + $text = $element->{$options['option.text']}; - if (isset($element->$options['option.attr'])) + if (isset($element->{$options['option.attr']})) { - $attr = $element->$options['option.attr']; + $attr = $element->{$options['option.attr']}; } - if (isset($element->$options['option.id'])) + if (isset($element->{$options['option.id']})) { - $id = $element->$options['option.id']; + $id = $element->{$options['option.id']}; } - if (isset($element->$options['option.label'])) + if (isset($element->{$options['option.label']})) { - $label = $element->$options['option.label']; + $label = $element->{$options['option.label']}; } - if (isset($element->$options['option.disable']) && $element->$options['option.disable']) + if (isset($element->{$options['option.disable']}) && $element->{$options['option.disable']}) { $extra .= ' disabled="disabled"'; } - if (isset($element->$options['option.class']) && $element->$options['option.class']) + if (isset($element->{$options['option.class']}) && $element->{$options['option.class']}) { - $extra .= ' class="' . $element->$options['option.class'] . '"'; + $extra .= ' class="' . $element->{$options['option.class']} . '"'; } - if (isset($element->$options['option.onclick']) && $element->$options['option.onclick']) + if (isset($element->{$options['option.onclick']}) && $element->{$options['option.onclick']}) { - $extra .= ' onclick="' . $element->$options['option.onclick'] . '"'; + $extra .= ' onclick="' . $element->{$options['option.onclick']} . '"'; } } else @@ -745,7 +745,6 @@ public static function options($arr, $optKey = 'value', $optText = 'text', $sele public static function radiolist($data, $name, $attribs = null, $optKey = 'value', $optText = 'text', $selected = null, $idtag = false, $translate = false) { - reset($data); if (is_array($attribs)) { diff --git a/libraries/cms/html/string.php b/libraries/cms/html/string.php index 7f7653218422f..b040da011e196 100644 --- a/libraries/cms/html/string.php +++ b/libraries/cms/html/string.php @@ -1,6 +1,6 @@ #iU", $tmp, $result); + preg_match_all("#]*?)>#iU", $tmp, $result); $closedTags = $result[1]; $numOpened = count($openedTags); diff --git a/libraries/cms/html/tabs.php b/libraries/cms/html/tabs.php index 32ec4520e623a..a9385c3bf75b8 100644 --- a/libraries/cms/html/tabs.php +++ b/libraries/cms/html/tabs.php @@ -82,7 +82,7 @@ protected static function loadBehavior($group, $params = array()) $opt['onActive'] = (isset($params['onActive'])) ? '\\' . $params['onActive'] : null; $opt['onBackground'] = (isset($params['onBackground'])) ? '\\' . $params['onBackground'] : null; $opt['display'] = (isset($params['startOffset'])) ? (int) $params['startOffset'] : null; - $opt['useStorage'] = (isset($params['useCookie']) && $params['useCookie']) ? 'true' : 'false'; + $opt['useStorage'] = (isset($params['useCookie']) && $params['useCookie']) ? true : false; $opt['titleSelector'] = "dt.tabs"; $opt['descriptionSelector'] = "dd.tabs"; diff --git a/libraries/cms/installer/adapter/component.php b/libraries/cms/installer/adapter/component.php index a5e90d19253ed..fc18f1da74ed0 100644 --- a/libraries/cms/installer/adapter/component.php +++ b/libraries/cms/installer/adapter/component.php @@ -309,6 +309,13 @@ protected function finaliseInstall() JLog::add(JText::_('JLIB_INSTALLER_ABORT_COMP_BUILDADMINMENUS_FAILED'), JLog::WARNING, 'jerror'); } + // Make sure that menu items pointing to the component have correct component id assigned to them. + // Prevents message "Component 'com_extension' does not exist." after uninstalling / re-installing component. + if (!$this->_updateSiteMenus($this->extension->extension_id)) + { + JLog::add(JText::_('JLIB_INSTALLER_ABORT_COMP_UPDATESITEMENUS_FAILED'), JLog::WARNING, 'jerror'); + } + /** @var JTableAsset $asset */ $asset = JTable::getInstance('Asset'); @@ -1104,6 +1111,44 @@ protected function _removeAdminMenus($id) return $result; } + /** + * Method to update menu database entries for a component in case if the component has been uninstalled before. + * + * @param int|null $component_id The component ID. + * + * @return boolean True if successful + * + * @since 3.4.2 + */ + protected function _updateSiteMenus($component_id = null) + { + $db = $this->parent->getDbo(); + $option = $this->get('element'); + + // Update all menu items which contain 'index.php?option=com_extension' or 'index.php?option=com_extension&...' + // to use the new component id. + $query = $db->getQuery(true) + ->update('#__menu AS m') + ->set('m.component_id = ' . $db->quote($component_id)) + ->where("m.type = " . $db->quote('component')) + ->where('m.client_id = 0') + ->where('m.link LIKE ' . $db->quote('index.php?option=' . $option) + . " OR m.link LIKE '" . $db->escape('index.php?option=' . $option . '&') . "%'"); + + $db->setQuery($query); + + try + { + $db->execute(); + } + catch (RuntimeException $e) + { + return false; + } + + return true; + } + /** * Custom rollback method * - Roll back the component menu item diff --git a/libraries/cms/installer/adapter/file.php b/libraries/cms/installer/adapter/file.php index d52e9f33c3f4a..8e51a8bec20cb 100644 --- a/libraries/cms/installer/adapter/file.php +++ b/libraries/cms/installer/adapter/file.php @@ -171,7 +171,7 @@ public function getElement($element = null) */ public function loadLanguage($path) { - $extension = 'files_' . strtolower(str_replace('files_', '', $this->name)); + $extension = 'files_' . strtolower(str_replace('files_', '', $this->getElement())); $this->doLoadLanguage($extension, $path, JPATH_SITE); } diff --git a/libraries/cms/installer/adapter/module.php b/libraries/cms/installer/adapter/module.php index 53567e393d870..f845c7e151d0b 100644 --- a/libraries/cms/installer/adapter/module.php +++ b/libraries/cms/installer/adapter/module.php @@ -430,32 +430,38 @@ public function discover() foreach ($site_list as $module) { - $manifest_details = JInstaller::parseXMLInstallFile(JPATH_SITE . "/modules/$module/$module.xml"); - $extension = JTable::getInstance('extension'); - $extension->set('type', 'module'); - $extension->set('client_id', $site_info->id); - $extension->set('element', $module); - $extension->set('folder', ''); - $extension->set('name', $module); - $extension->set('state', -1); - $extension->set('manifest_cache', json_encode($manifest_details)); - $extension->set('params', '{}'); - $results[] = clone $extension; + if (file_exists(JPATH_SITE . "/modules/$module/$module.xml")) + { + $manifest_details = JInstaller::parseXMLInstallFile(JPATH_SITE . "/modules/$module/$module.xml"); + $extension = JTable::getInstance('extension'); + $extension->set('type', 'module'); + $extension->set('client_id', $site_info->id); + $extension->set('element', $module); + $extension->set('folder', ''); + $extension->set('name', $module); + $extension->set('state', -1); + $extension->set('manifest_cache', json_encode($manifest_details)); + $extension->set('params', '{}'); + $results[] = clone $extension; + } } foreach ($admin_list as $module) { - $manifest_details = JInstaller::parseXMLInstallFile(JPATH_ADMINISTRATOR . "/modules/$module/$module.xml"); - $extension = JTable::getInstance('extension'); - $extension->set('type', 'module'); - $extension->set('client_id', $admin_info->id); - $extension->set('element', $module); - $extension->set('folder', ''); - $extension->set('name', $module); - $extension->set('state', -1); - $extension->set('manifest_cache', json_encode($manifest_details)); - $extension->set('params', '{}'); - $results[] = clone $extension; + if (file_exists(JPATH_ADMINISTRATOR . "/modules/$module/$module.xml")) + { + $manifest_details = JInstaller::parseXMLInstallFile(JPATH_ADMINISTRATOR . "/modules/$module/$module.xml"); + $extension = JTable::getInstance('extension'); + $extension->set('type', 'module'); + $extension->set('client_id', $admin_info->id); + $extension->set('element', $module); + $extension->set('folder', ''); + $extension->set('name', $module); + $extension->set('state', -1); + $extension->set('manifest_cache', json_encode($manifest_details)); + $extension->set('params', '{}'); + $results[] = clone $extension; + } } return $results; diff --git a/libraries/cms/installer/adapter/template.php b/libraries/cms/installer/adapter/template.php index 54893b53ed337..31cfb917f927f 100644 --- a/libraries/cms/installer/adapter/template.php +++ b/libraries/cms/installer/adapter/template.php @@ -188,10 +188,11 @@ public function loadLanguage($path = null) $client = 'ADMINISTRATOR'; } + $base = constant('JPATH_' . strtoupper($client)); $extension = 'tpl_' . $this->getName(); - $source = $path ? $path : ($client) . '/templates/' . $this->getName(); + $source = $path ? $path : $base . '/templates/' . $this->getName(); - $this->doLoadLanguage($extension, $source, constant('JPATH_' . strtoupper($client))); + $this->doLoadLanguage($extension, $source, $base); } /** @@ -526,44 +527,50 @@ public function discover() foreach ($site_list as $template) { - if ($template == 'system') + if (file_exists(JPATH_SITE . "/templates/$template/templateDetails.xml")) { - // Ignore special system template - continue; - } + if ($template == 'system') + { + // Ignore special system template + continue; + } - $manifest_details = JInstaller::parseXMLInstallFile(JPATH_SITE . "/templates/$template/templateDetails.xml"); - $extension = JTable::getInstance('extension'); - $extension->set('type', 'template'); - $extension->set('client_id', $site_info->id); - $extension->set('element', $template); - $extension->set('folder', ''); - $extension->set('name', $template); - $extension->set('state', -1); - $extension->set('manifest_cache', json_encode($manifest_details)); - $extension->set('params', '{}'); - $results[] = $extension; + $manifest_details = JInstaller::parseXMLInstallFile(JPATH_SITE . "/templates/$template/templateDetails.xml"); + $extension = JTable::getInstance('extension'); + $extension->set('type', 'template'); + $extension->set('client_id', $site_info->id); + $extension->set('element', $template); + $extension->set('folder', ''); + $extension->set('name', $template); + $extension->set('state', -1); + $extension->set('manifest_cache', json_encode($manifest_details)); + $extension->set('params', '{}'); + $results[] = $extension; + } } foreach ($admin_list as $template) { - if ($template == 'system') + if (file_exists(JPATH_ADMINISTRATOR . "/templates/$template/templateDetails.xml")) { - // Ignore special system template - continue; - } + if ($template == 'system') + { + // Ignore special system template + continue; + } - $manifest_details = JInstaller::parseXMLInstallFile(JPATH_ADMINISTRATOR . "/templates/$template/templateDetails.xml"); - $extension = JTable::getInstance('extension'); - $extension->set('type', 'template'); - $extension->set('client_id', $admin_info->id); - $extension->set('element', $template); - $extension->set('folder', ''); - $extension->set('name', $template); - $extension->set('state', -1); - $extension->set('manifest_cache', json_encode($manifest_details)); - $extension->set('params', '{}'); - $results[] = $extension; + $manifest_details = JInstaller::parseXMLInstallFile(JPATH_ADMINISTRATOR . "/templates/$template/templateDetails.xml"); + $extension = JTable::getInstance('extension'); + $extension->set('type', 'template'); + $extension->set('client_id', $admin_info->id); + $extension->set('element', $template); + $extension->set('folder', ''); + $extension->set('name', $template); + $extension->set('state', -1); + $extension->set('manifest_cache', json_encode($manifest_details)); + $extension->set('params', '{}'); + $results[] = $extension; + } } return $results; diff --git a/libraries/cms/installer/installer.php b/libraries/cms/installer/installer.php index 0b73aa1b3950a..eca2c47d8eb3e 100644 --- a/libraries/cms/installer/installer.php +++ b/libraries/cms/installer/installer.php @@ -914,7 +914,7 @@ public function parseSQLFiles($element) // Check that sql files exists before reading. Otherwise raise error for rollback if (!file_exists($sqlfile)) { - JLog::add(JText::sprintf('JLIB_INSTALLER_ERROR_SQL_ERROR', $db->stderr(true)), JLog::WARNING, 'jerror'); + JLog::add(JText::sprintf('JLIB_INSTALLER_ERROR_SQL_FILENOTFOUND', $sqlfile), JLog::WARNING, 'jerror'); return false; } @@ -1865,6 +1865,12 @@ public function copyManifest($cid = 1) */ public function findManifest() { + // Do nothing if folder does not exist for some reason + if (!JFolder::exists($this->getPath('source'))) + { + return false; + } + // Main folder manifests (higher priority) $parentXmlfiles = JFolder::files($this->getPath('source'), '.xml$', false, true); diff --git a/libraries/cms/helper/extensionscript.php b/libraries/cms/installer/script.php similarity index 78% rename from libraries/cms/helper/extensionscript.php rename to libraries/cms/installer/script.php index 96a42d016062e..034b415fc3e74 100644 --- a/libraries/cms/helper/extensionscript.php +++ b/libraries/cms/installer/script.php @@ -13,77 +13,95 @@ jimport('joomla.filesystem.folder'); /** - * Helper class to aid with extension installs. + * Base install script for use by extensions providing helper methods for common behaviours. * - * @since 3.4 + * @since 3.5 */ -class JHelperExtensionscript +class JInstallerScript { /** - * @var string The version number of the extension. - * @since 3.4 + * The version number of the extension. + * + * @var string + * @since 3.5 */ protected $release; /** - * @var string The table the parameters are stored in. - * @since 3.4 + * The table the parameters are stored in. + * + * @var string + * @since 3.5 */ protected $paramTable; /** - * @var string The extension name. This should be set in the installer script. - * @since 3.4 + * The extension name. This should be set in the installer script. + * + * @var string + * @since 3.5 */ protected $extension; /** - * @var array A list of files to be deleted. - * @since 3.4 + * A list of files to be deleted + * + * @var array + * @since 3.5 */ protected $deleteFiles = array(); /** - * @var array A list of folders to be deleted. - * @since 3.4 + * A list of folders to be deleted + * + * @var array + * @since 3.5 */ protected $deleteFolders = array(); /** - * @var array A list of cli script files to be copied to the cli directory - * @since 3.4 + * A list of CLI script files to be copied to the cli directory + * + * @var array + * @since 3.5 */ protected $cliScriptFiles = array(); /** - * @var string Minimum PHP version required to install the extension - * @since 3.4 + * Minimum PHP version required to install the extension + * + * @var string + * @since 3.5 */ protected $minimumPhp; /** - * @var string Minimum Joomla version required to install the extension - * @since 3.4 + * Minimum Joomla! version required to install the extension + * + * @var string + * @since 3.5 */ protected $minimumJoomla; /** - * @var boolean Allow downgrades of your extension. Use at your own risk - * as if there is a change in functionality people may wish - * to downgrade + * Allow downgrades of your extension + * + * Use at your own risk as if there is a change in functionality people may wish to downgrade. + * + * @var boolean + * @since 3.5 */ protected $allowDowngrades = false; /** * Function called before extension installation/update/removal procedure commences * - * @param string $type The type of change (install, update or discover_install, - * not uninstall) - * @param JAdapterInstance $parent The class calling this method + * @param string $type The type of change (install, update or discover_install, not uninstall) + * @param JInstallerAdapter $parent The class calling this method * - * @return boolean true on success and false on failure + * @return boolean True on success * - * @since 3.4 + * @since 3.5 */ public function preflight($type, $parent) { @@ -137,7 +155,7 @@ public function preflight($type, $parent) * * @return array An array of ID's of the extension * - * @since 3.4 + * @since 3.5 */ public function getInstances($isModule) { @@ -150,19 +168,16 @@ public function getInstances($isModule) if ($isModule) { $query->from($db->quoteName('#__modules')) - ->where($db->quoteName('module') . ' = ' . $db->Quote($this->extension)); + ->where($db->quoteName('module') . ' = ' . $db->quote($this->extension)); } else { $query->from($db->quoteName('#__extensions')) - ->where($db->quoteName('element') . ' = ' . $db->Quote($this->extension)); + ->where($db->quoteName('element') . ' = ' . $db->quote($this->extension)); } // Set the query and obtain an array of id's - $db->setQuery($query); - $items = $db->loadColumn(); - - return $items; + return $db->setQuery($query)->loadColumn(); } /** @@ -173,7 +188,7 @@ public function getInstances($isModule) * * @return string The parameter desired * - * @since 3.4 + * @since 3.5 */ public function getParam($name, $id = 0) { @@ -197,9 +212,9 @@ public function getParam($name, $id = 0) * @param string $type The type of change to be made to the param (edit/remove) * @param integer $id The id of the item in the relevant table * - * @return mixed false on failure, void otherwise + * @return boolean True on success * - * @since 3.4 + * @since 3.5 */ public function setParams($param_array = null, $type = 'edit', $id = 0) { @@ -240,14 +255,13 @@ public function setParams($param_array = null, $type = 'edit', $id = 0) $paramsString = json_encode($params); $db = JFactory::getDbo(); - $query = $db->getQuery(true); - $query->update($db->quoteName($this->paramTable)) + $query = $db->getQuery(true) + ->update($db->quoteName($this->paramTable)) ->set('params = ' . $db->quote($paramsString)) ->where('id = ' . $id); // Update table - $db->setQuery($query); - $db->execute(); + $db->setQuery($query)->execute(); return true; } @@ -262,34 +276,32 @@ public function setParams($param_array = null, $type = 'edit', $id = 0) * @param string $column The column of the database to search from * @param mixed $identifier The integer id or the already quoted string * - * @return array associated array containing data from the cell + * @return array Associated array containing data from the cell * - * @since 3.4 + * @since 3.5 */ public function getItemArray($element, $table, $column, $identifier) { // Get the DB and query objects $db = JFactory::getDbo(); - $query = $db->getQuery(true); // Build the query - $query->select($db->quoteName($element)) + $query = $db->getQuery(true) + ->select($db->quoteName($element)) ->from($db->quoteName($table)) ->where($db->quoteName($column) . ' = ' . $identifier); $db->setQuery($query); // Load the single cell and json_decode data - $array = json_decode($db->loadResult(), true); - - return $array; + return json_decode($db->loadResult(), true); } /** * Remove the files and folders in the given array from * - * @return null + * @return void * - * @since 3.4 + * @since 3.5 */ public function removeFiles() { @@ -319,9 +331,9 @@ public function removeFiles() /** * Moves the CLI scripts into the CLI folder in the CMS * - * @return null + * @return void * - * @since 3.4 + * @since 3.5 */ public function moveCliFiles() { diff --git a/libraries/cms/menu/menu.php b/libraries/cms/menu/menu.php index 36ff71099dc1a..cda1173011682 100644 --- a/libraries/cms/menu/menu.php +++ b/libraries/cms/menu/menu.php @@ -266,7 +266,7 @@ public function getItems($attributes, $values, $firstonly = false) { if (is_array($values[$i])) { - if (!in_array($item->$attributes[$i], $values[$i])) + if (!in_array($item->{$attributes[$i]}, $values[$i])) { $test = false; break; @@ -274,7 +274,7 @@ public function getItems($attributes, $values, $firstonly = false) } else { - if ($item->$attributes[$i] != $values[$i]) + if ($item->{$attributes[$i]} != $values[$i]) { $test = false; break; diff --git a/libraries/cms/module/helper.php b/libraries/cms/module/helper.php index 32773e425b51c..bf6740239280f 100644 --- a/libraries/cms/module/helper.php +++ b/libraries/cms/module/helper.php @@ -231,6 +231,14 @@ public static function renderModule($module, $attribs = array()) $attribs['style'] .= ' outline'; } + // If the $module is nulled it will return an empty content, otherwise it will render the module normally. + $app->triggerEvent('onRenderModule', array(&$module, &$attribs)); + + if (is_null($module) || !isset($module->content)) + { + return ''; + } + foreach (explode(' ', $attribs['style']) as $style) { $chromeMethod = 'modChrome_' . $style; @@ -324,17 +332,44 @@ protected static function &_load() */ protected static function &load() { - static $clean; + static $modules; - if (isset($clean)) + if (isset($modules)) { - return $clean; + return $modules; } + $app = JFactory::getApplication(); + + $modules = null; + + $app->triggerEvent('onPrepareModuleList', array(&$modules)); + + // If the onPrepareModuleList event returns an array of modules, then ignore the default module list creation + if (!is_array($modules)) + { + $modules = static::getModuleList(); + } + + $app->triggerEvent('onAfterModuleList', array(&$modules)); + + $modules = static::cleanModuleList($modules); + + $app->triggerEvent('onAfterCleanModuleList', array(&$modules)); + + return $modules; + } + + /** + * Module list + * + * @return array + */ + public static function getModuleList() + { $app = JFactory::getApplication(); $Itemid = $app->input->getInt('Itemid'); - $user = JFactory::getUser(); - $groups = implode(',', $user->getAuthorisedViewLevels()); + $groups = implode(',', JFactory::getUser()->getAuthorisedViewLevels()); $lang = JFactory::getLanguage()->getTag(); $clientId = (int) $app->getClientId(); @@ -345,7 +380,6 @@ protected static function &load() ->from('#__modules AS m') ->join('LEFT', '#__modules_menu AS mm ON mm.moduleid = m.id') ->where('m.published = 1') - ->join('LEFT', '#__extensions AS e ON e.element = m.module AND e.client_id = m.client_id') ->where('e.enabled = 1'); @@ -354,7 +388,6 @@ protected static function &load() $nullDate = $db->getNullDate(); $query->where('(m.publish_up = ' . $db->quote($nullDate) . ' OR m.publish_up <= ' . $db->quote($now) . ')') ->where('(m.publish_down = ' . $db->quote($nullDate) . ' OR m.publish_down >= ' . $db->quote($now) . ')') - ->where('m.access IN (' . $groups . ')') ->where('m.client_id = ' . $clientId) ->where('(mm.menuid = ' . (int) $Itemid . ' OR mm.menuid <= 0)'); @@ -369,7 +402,6 @@ protected static function &load() // Set the query $db->setQuery($query); - $clean = array(); try { @@ -379,24 +411,36 @@ protected static function &load() { JLog::add(JText::sprintf('JLIB_APPLICATION_ERROR_MODULE_LOAD', $e->getMessage()), JLog::WARNING, 'jerror'); - return $clean; + return array(); } + return $modules; + } + + /** + * Clean the module list + * + * @param array $modules Array with module objects + * + * @return array + */ + public static function cleanModuleList($modules) + { // Apply negative selections and eliminate duplicates + $Itemid = JFactory::getApplication()->input->getInt('Itemid'); $negId = $Itemid ? -(int) $Itemid : false; + $clean = array(); $dupes = array(); - for ($i = 0, $n = count($modules); $i < $n; $i++) + foreach ($modules as $i => $module) { - $module = &$modules[$i]; - // The module is excluded if there is an explicit prohibition $negHit = ($negId === (int) $module->menuid); if (isset($dupes[$module->id])) { // If this item has been excluded, keep the duplicate flag set, - // but remove any item from the cleaned array. + // but remove any item from the modules array. if ($negHit) { unset($clean[$module->id]); @@ -408,21 +452,22 @@ protected static function &load() $dupes[$module->id] = true; // Only accept modules without explicit exclusions. - if (!$negHit) + if ($negHit) { - $module->name = substr($module->module, 4); - $module->style = null; - $module->position = strtolower($module->position); - $clean[$module->id] = $module; + continue; } + + $module->name = substr($module->module, 4); + $module->style = null; + $module->position = strtolower($module->position); + + $clean[$module->id] = $module; } unset($dupes); // Return to simple indexing that matches the query order. - $clean = array_values($clean); - - return $clean; + return array_values($clean); } /** diff --git a/libraries/cms/pagination/pagination.php b/libraries/cms/pagination/pagination.php index e4a5774a6619e..1ad4d18ddb3e8 100644 --- a/libraries/cms/pagination/pagination.php +++ b/libraries/cms/pagination/pagination.php @@ -453,9 +453,9 @@ public function getPaginationLinks($layoutId = 'joomla.pagination.links', $optio } /** - * Create and return the pagination page list string, ie. Previous, Next, 1 2 3 ... x. + * Create and return the pagination pages list, ie. Previous, Next, 1 2 3 ... x. * - * @return string Pagination page list string. + * @return array Pagination pages list. * * @since 3.3 */ diff --git a/libraries/cms/pathway/pathway.php b/libraries/cms/pathway/pathway.php index 44a83526abc13..7dba234020d0a 100644 --- a/libraries/cms/pathway/pathway.php +++ b/libraries/cms/pathway/pathway.php @@ -209,6 +209,7 @@ public function setItemName($id, $name) * * @since 1.5 * @deprecated 4.0 Use makeItem() instead + * @codeCoverageIgnore */ protected function _makeItem($name, $link) { diff --git a/libraries/cms/pathway/site.php b/libraries/cms/pathway/site.php index 5f9738eb2de97..28f8ecf38e3fc 100644 --- a/libraries/cms/pathway/site.php +++ b/libraries/cms/pathway/site.php @@ -49,7 +49,6 @@ public function __construct($options = array()) { foreach ($item->tree as $menupath) { - $url = ''; $link = $menu->getItem($menupath); switch ($link->type) @@ -77,16 +76,7 @@ public function __construct($options = array()) break; default: - $router = $app::getRouter(); - - if ($router->getMode() == JROUTER_MODE_SEF) - { - $url = 'index.php?Itemid=' . $link->id; - } - else - { - $url .= $link->link . '&Itemid=' . $link->id; - } + $url = $link->link . '&Itemid=' . $link->id; break; } diff --git a/libraries/cms/plugin/plugin.php b/libraries/cms/plugin/plugin.php index 4dfad06a685f7..223cbd5c9e0e6 100644 --- a/libraries/cms/plugin/plugin.php +++ b/libraries/cms/plugin/plugin.php @@ -1,6 +1,6 @@ setScheme('https'); - $this->app->redirect((string) $uri); + $this->app->redirect((string) $uri, 301); } // Get the path - // Decode URL to convert punycode to unicode so that strings match when routing. + // Decode URL to convert percent-encoding to unicode so that strings match when routing. $path = urldecode($uri->getPath()); // Remove the base URI path. diff --git a/libraries/cms/schema/changeitem.php b/libraries/cms/schema/changeitem.php index dafd1bf6d4993..a7dee9ee18582 100644 --- a/libraries/cms/schema/changeitem.php +++ b/libraries/cms/schema/changeitem.php @@ -195,7 +195,18 @@ public function check() if ($this->checkQuery) { $this->db->setQuery($this->checkQuery); - $rows = $this->db->loadObject(); + + try + { + $rows = $this->db->loadObject(); + } + catch (RuntimeException $e) + { + $rows = false; + + // Still render the error message from the Exception object + JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); + } if ($rows !== false) { diff --git a/libraries/cms/toolbar/button/popup.php b/libraries/cms/toolbar/button/popup.php index c2e2026680633..07d81da63ee0f 100644 --- a/libraries/cms/toolbar/button/popup.php +++ b/libraries/cms/toolbar/button/popup.php @@ -36,13 +36,14 @@ class JToolbarButtonPopup extends JToolbarButton * @param integer $left Left attribute. [@deprecated Unused, will be removed in 4.0] * @param string $onClose JavaScript for the onClose event. * @param string $title The title text + * @param string $footer The footer html * * @return string HTML string for the button * * @since 3.0 */ public function fetchButton($type = 'Modal', $name = '', $text = '', $url = '', $width = 640, $height = 480, $top = 0, $left = 0, - $onClose = '', $title = '') + $onClose = '', $title = '', $footer = null) { // If no $title is set, use the $text element if (strlen($title) == 0) @@ -73,6 +74,12 @@ public function fetchButton($type = 'Modal', $name = '', $text = '', $url = '', $params['url'] = $options['doTask']; $params['height'] = $height; $params['width'] = $width; + + if (isset($footer)) + { + $params['footer'] = $footer; + } + $html[] = JHtml::_('bootstrap.renderModal', 'modal-' . $name, $params); // If an $onClose event is passed, add it to the modal JS object diff --git a/libraries/cms/version/version.php b/libraries/cms/version/version.php index 1a2e6ba6b512f..8ebfb8a7944a8 100644 --- a/libraries/cms/version/version.php +++ b/libraries/cms/version/version.php @@ -23,10 +23,10 @@ final class JVersion public $RELEASE = '3.4'; /** @var string Maintenance version. */ - public $DEV_LEVEL = '1-dev'; + public $DEV_LEVEL = '2-rc2-dev'; /** @var string Development STATUS. */ - public $DEV_STATUS = 'Development'; + public $DEV_STATUS = 'Release Candidate'; /** @var string Build number. */ public $BUILD = ''; @@ -35,10 +35,10 @@ final class JVersion public $CODENAME = 'Ember'; /** @var string Release date. */ - public $RELDATE = '24-February-2015'; + public $RELDATE = '20-June-2015'; /** @var string Release time. */ - public $RELTIME = '23:00'; + public $RELTIME = '23:30'; /** @var string Release timezone. */ public $RELTZ = 'GMT'; diff --git a/libraries/composer_autoload.php b/libraries/composer_autoload.php deleted file mode 100644 index 7a68ec2d23636..0000000000000 --- a/libraries/composer_autoload.php +++ /dev/null @@ -1,76 +0,0 @@ - $path) - { - $loader->set($namespace, $path); - } - - $map = require __DIR__ . '/vendor/composer/autoload_psr4.php'; - - foreach ($map as $namespace => $path) - { - $loader->setPsr4($namespace, $path); - } - - $classMap = require __DIR__ . '/vendor/composer/autoload_classmap.php'; - - if ($classMap) - { - $loader->addClassMap($classMap); - } - - $loader->register(true); - - $includeFiles = require __DIR__ . '/vendor/composer/autoload_files.php'; - - foreach ($includeFiles as $file) - { - composerJoomlaRequire($file); - } - - return $loader; - } -} - -function composerJoomlaRequire($file) -{ - require $file; -} - -JAutoloaderComposer::getLoader(); \ No newline at end of file diff --git a/libraries/fof/LICENSE.txt b/libraries/fof/LICENSE.txt deleted file mode 100644 index 56e598d43901e..0000000000000 --- a/libraries/fof/LICENSE.txt +++ /dev/null @@ -1,345 +0,0 @@ -================================================================================ -Historical note -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -On February 21st, 2013 FOF changed its license to GPLv2 or later. -================================================================================ - - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. \ No newline at end of file diff --git a/libraries/fof/database/installer.php b/libraries/fof/database/installer.php index 481d053abab41..b14ea25eecac7 100644 --- a/libraries/fof/database/installer.php +++ b/libraries/fof/database/installer.php @@ -336,6 +336,7 @@ protected function findSchemaXml() $driverType = $this->db->name; $xml = null; + // And now look for the file foreach ($this->xmlFiles as $baseName) { // Remove any accidental whitespace @@ -383,6 +384,7 @@ protected function findSchemaXml() /** @var SimpleXMLElement $drivers */ $drivers = $xml->meta->drivers; + // Strict driver name match foreach ($drivers->children() as $driverTypeTag) { $thisDriverType = (string)$driverTypeTag; @@ -393,6 +395,22 @@ protected function findSchemaXml() } } + // Some custom database drivers use a non-standard $name variable. Let try a relaxed match. + foreach ($drivers->children() as $driverTypeTag) + { + $thisDriverType = (string)$driverTypeTag; + + if ( + // e.g. $driverType = 'mysqlistupid', $thisDriverType = 'mysqli' => driver matched + strpos($driverType, $thisDriverType) === 0 + // e.g. $driverType = 'stupidmysqli', $thisDriverType = 'mysqli' => driver matched + || (substr($driverType, -strlen($thisDriverType)) == $thisDriverType) + ) + { + return $xml; + } + } + $xml = null; } diff --git a/libraries/fof/download/adapter/cacert.pem b/libraries/fof/download/adapter/cacert.pem deleted file mode 100644 index 1a0aa6d3d6c7f..0000000000000 --- a/libraries/fof/download/adapter/cacert.pem +++ /dev/null @@ -1,3869 +0,0 @@ -## -## Bundle of CA Root Certificates -## -## Certificate data from Mozilla downloaded on: Wed Aug 13 21:49:32 2014 -## -## This is a bundle of X.509 certificates of public Certificate Authorities -## (CA). These were automatically extracted from Mozilla's root certificates -## file (certdata.txt). This file can be found in the mozilla source tree: -## http://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt -## -## It contains the certificates in PEM format and therefore -## can be directly used with curl / libcurl / php_curl, or with -## an Apache+mod_ssl webserver for SSL client authentication. -## Just configure this file as the SSLCACertificateFile. -## -## Conversion done with mk-ca-bundle.pl verison 1.22. -## SHA1: bf2c15b3019e696660321d2227d942936dc50aa7 -## - - -GTE CyberTrust Global Root -========================== ------BEGIN CERTIFICATE----- -MIICWjCCAcMCAgGlMA0GCSqGSIb3DQEBBAUAMHUxCzAJBgNVBAYTAlVTMRgwFgYDVQQKEw9HVEUg -Q29ycG9yYXRpb24xJzAlBgNVBAsTHkdURSBDeWJlclRydXN0IFNvbHV0aW9ucywgSW5jLjEjMCEG -A1UEAxMaR1RFIEN5YmVyVHJ1c3QgR2xvYmFsIFJvb3QwHhcNOTgwODEzMDAyOTAwWhcNMTgwODEz -MjM1OTAwWjB1MQswCQYDVQQGEwJVUzEYMBYGA1UEChMPR1RFIENvcnBvcmF0aW9uMScwJQYDVQQL -Ex5HVEUgQ3liZXJUcnVzdCBTb2x1dGlvbnMsIEluYy4xIzAhBgNVBAMTGkdURSBDeWJlclRydXN0 -IEdsb2JhbCBSb290MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCVD6C28FCc6HrHiM3dFw4u -sJTQGz0O9pTAipTHBsiQl8i4ZBp6fmw8U+E3KHNgf7KXUwefU/ltWJTSr41tiGeA5u2ylc9yMcql -HHK6XALnZELn+aks1joNrI1CqiQBOeacPwGFVw1Yh0X404Wqk2kmhXBIgD8SFcd5tB8FLztimQID -AQABMA0GCSqGSIb3DQEBBAUAA4GBAG3rGwnpXtlR22ciYaQqPEh346B8pt5zohQDhT37qw4wxYMW -M4ETCJ57NE7fQMh017l93PR2VX2bY1QY6fDq81yx2YtCHrnAlU66+tXifPVoYb+O7AWXX1uw16OF -NMQkpw0PlZPvy5TYnh+dXIVtx6quTx8itc2VrbqnzPmrC3p/ ------END CERTIFICATE----- - -Thawte Server CA -================ ------BEGIN CERTIFICATE----- -MIIDEzCCAnygAwIBAgIBATANBgkqhkiG9w0BAQQFADCBxDELMAkGA1UEBhMCWkExFTATBgNVBAgT -DFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMR0wGwYDVQQKExRUaGF3dGUgQ29uc3Vs -dGluZyBjYzEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjEZMBcGA1UE -AxMQVGhhd3RlIFNlcnZlciBDQTEmMCQGCSqGSIb3DQEJARYXc2VydmVyLWNlcnRzQHRoYXd0ZS5j -b20wHhcNOTYwODAxMDAwMDAwWhcNMjAxMjMxMjM1OTU5WjCBxDELMAkGA1UEBhMCWkExFTATBgNV -BAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMR0wGwYDVQQKExRUaGF3dGUgQ29u -c3VsdGluZyBjYzEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjEZMBcG -A1UEAxMQVGhhd3RlIFNlcnZlciBDQTEmMCQGCSqGSIb3DQEJARYXc2VydmVyLWNlcnRzQHRoYXd0 -ZS5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANOkUG7I/1Zr5s9dtuoMaHVHoqrC2oQl -/Kj0R1HahbUgdJSGHg91yekIYfUGbTBuFRkC6VLAYttNmZ7iagxEOM3+vuNkCXDF/rFrKbYvScg7 -1CcEJRCXL+eQbcAoQpnXTEPew/UhbVSfXcNY4cDk2VuwuNy0e982OsK1ZiIS1ocNAgMBAAGjEzAR -MA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEEBQADgYEAB/pMaVz7lcxG7oWDTSEwjsrZqG9J -GubaUeNgcGyEYRGhGshIPllDfU+VPaGLtwtimHp1it2ITk6eQNuozDJ0uW8NxuOzRAvZim+aKZuZ -GCg70eNAKJpaPNW15yAbi8qkq43pUdniTCxZqdq5snUb9kLy78fyGPmJvKP/iiMucEc= ------END CERTIFICATE----- - -Thawte Premium Server CA -======================== ------BEGIN CERTIFICATE----- -MIIDJzCCApCgAwIBAgIBATANBgkqhkiG9w0BAQQFADCBzjELMAkGA1UEBhMCWkExFTATBgNVBAgT -DFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMR0wGwYDVQQKExRUaGF3dGUgQ29uc3Vs -dGluZyBjYzEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjEhMB8GA1UE -AxMYVGhhd3RlIFByZW1pdW0gU2VydmVyIENBMSgwJgYJKoZIhvcNAQkBFhlwcmVtaXVtLXNlcnZl -ckB0aGF3dGUuY29tMB4XDTk2MDgwMTAwMDAwMFoXDTIwMTIzMTIzNTk1OVowgc4xCzAJBgNVBAYT -AlpBMRUwEwYDVQQIEwxXZXN0ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEdMBsGA1UEChMU -VGhhd3RlIENvbnN1bHRpbmcgY2MxKDAmBgNVBAsTH0NlcnRpZmljYXRpb24gU2VydmljZXMgRGl2 -aXNpb24xITAfBgNVBAMTGFRoYXd0ZSBQcmVtaXVtIFNlcnZlciBDQTEoMCYGCSqGSIb3DQEJARYZ -cHJlbWl1bS1zZXJ2ZXJAdGhhd3RlLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA0jY2 -aovXwlue2oFBYo847kkEVdbQ7xwblRZH7xhINTpS9CtqBo87L+pW46+GjZ4X9560ZXUCTe/LCaIh -Udib0GfQug2SBhRz1JPLlyoAnFxODLz6FVL88kRu2hFKbgifLy3j+ao6hnO2RlNYyIkFvYMRuHM/ -qgeN9EJN50CdHDcCAwEAAaMTMBEwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQQFAAOBgQAm -SCwWwlj66BZ0DKqqX1Q/8tfJeGBeXm43YyJ3Nn6yF8Q0ufUIhfzJATj/Tb7yFkJD57taRvvBxhEf -8UqwKEbJw8RCfbz6q1lu1bdRiBHjpIUZa4JMpAwSremkrj/xw0llmozFyD4lt5SZu5IycQfwhl7t -UCemDaYj+bvLpgcUQg== ------END CERTIFICATE----- - -Equifax Secure CA -================= ------BEGIN CERTIFICATE----- -MIIDIDCCAomgAwIBAgIENd70zzANBgkqhkiG9w0BAQUFADBOMQswCQYDVQQGEwJVUzEQMA4GA1UE -ChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2VydGlmaWNhdGUgQXV0aG9yaXR5 -MB4XDTk4MDgyMjE2NDE1MVoXDTE4MDgyMjE2NDE1MVowTjELMAkGA1UEBhMCVVMxEDAOBgNVBAoT -B0VxdWlmYXgxLTArBgNVBAsTJEVxdWlmYXggU2VjdXJlIENlcnRpZmljYXRlIEF1dGhvcml0eTCB -nzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAwV2xWGcIYu6gmi0fCG2RFGiYCh7+2gRvE4RiIcPR -fM6fBeC4AfBONOziipUEZKzxa1NfBbPLZ4C/QgKO/t0BCezhABRP/PvwDN1Dulsr4R+AcJkVV5MW -8Q+XarfCaCMczE1ZMKxRHjuvK9buY0V7xdlfUNLjUA86iOe/FP3gx7kCAwEAAaOCAQkwggEFMHAG -A1UdHwRpMGcwZaBjoGGkXzBdMQswCQYDVQQGEwJVUzEQMA4GA1UEChMHRXF1aWZheDEtMCsGA1UE -CxMkRXF1aWZheCBTZWN1cmUgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMBoG -A1UdEAQTMBGBDzIwMTgwODIyMTY0MTUxWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAUSOZo+SvS -spXXR9gjIBBPM5iQn9QwHQYDVR0OBBYEFEjmaPkr0rKV10fYIyAQTzOYkJ/UMAwGA1UdEwQFMAMB -Af8wGgYJKoZIhvZ9B0EABA0wCxsFVjMuMGMDAgbAMA0GCSqGSIb3DQEBBQUAA4GBAFjOKer89961 -zgK5F7WF0bnj4JXMJTENAKaSbn+2kmOeUJXRmm/kEd5jhW6Y7qj/WsjTVbJmcVfewCHrPSqnI0kB -BIZCe/zuf6IWUrVnZ9NA2zsmWLIodz2uFHdh1voqZiegDfqnc1zqcPGUIWVEX/r87yloqaKHee95 -70+sB3c4 ------END CERTIFICATE----- - -Verisign Class 3 Public Primary Certification Authority -======================================================= ------BEGIN CERTIFICATE----- -MIICPDCCAaUCEHC65B0Q2Sk0tjjKewPMur8wDQYJKoZIhvcNAQECBQAwXzELMAkGA1UEBhMCVVMx -FzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAzIFB1YmxpYyBQcmltYXJ5 -IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2MDEyOTAwMDAwMFoXDTI4MDgwMTIzNTk1OVow -XzELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAz -IFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUA -A4GNADCBiQKBgQDJXFme8huKARS0EN8EQNvjV69qRUCPhAwL0TPZ2RHP7gJYHyX3KqhEBarsAx94 -f56TuZoAqiN91qyFomNFx3InzPRMxnVx0jnvT0Lwdd8KkMaOIG+YD/isI19wKTakyYbnsZogy1Ol -hec9vn2a/iRFM9x2Fe0PonFkTGUugWhFpwIDAQABMA0GCSqGSIb3DQEBAgUAA4GBALtMEivPLCYA -TxQT3ab7/AoRhIzzKBxnki98tsX63/Dolbwdj2wsqFHMc9ikwFPwTtYmwHYBV4GSXiHx0bH/59Ah -WM1pF+NEHJwZRDmJXNycAA9WjQKZ7aKQRUzkuxCkPfAyAw7xzvjoyVGM5mKf5p/AfbdynMk2Omuf -Tqj/ZA1k ------END CERTIFICATE----- - -Verisign Class 3 Public Primary Certification Authority - G2 -============================================================ ------BEGIN CERTIFICATE----- -MIIDAjCCAmsCEH3Z/gfPqB63EHln+6eJNMYwDQYJKoZIhvcNAQEFBQAwgcExCzAJBgNVBAYTAlVT -MRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE8MDoGA1UECxMzQ2xhc3MgMyBQdWJsaWMgUHJpbWFy -eSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMTowOAYDVQQLEzEoYykgMTk5OCBWZXJpU2ln -biwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MR8wHQYDVQQLExZWZXJpU2lnbiBUcnVz -dCBOZXR3b3JrMB4XDTk4MDUxODAwMDAwMFoXDTI4MDgwMTIzNTk1OVowgcExCzAJBgNVBAYTAlVT -MRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE8MDoGA1UECxMzQ2xhc3MgMyBQdWJsaWMgUHJpbWFy -eSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMTowOAYDVQQLEzEoYykgMTk5OCBWZXJpU2ln -biwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MR8wHQYDVQQLExZWZXJpU2lnbiBUcnVz -dCBOZXR3b3JrMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDMXtERXVxp0KvTuWpMmR9ZmDCO -FoUgRm1HP9SFIIThbbP4pO0M8RcPO/mn+SXXwc+EY/J8Y8+iR/LGWzOOZEAEaMGAuWQcRXfH2G71 -lSk8UOg013gfqLptQ5GVj0VXXn7F+8qkBOvqlzdUMG+7AUcyM83cV5tkaWH4mx0ciU9cZwIDAQAB -MA0GCSqGSIb3DQEBBQUAA4GBAFFNzb5cy5gZnBWyATl4Lk0PZ3BwmcYQWpSkU01UbSuvDV1Ai2TT -1+7eVmGSX6bEHRBhNtMsJzzoKQm5EWR0zLVznxxIqbxhAe7iF6YM40AIOw7n60RzKprxaZLvcRTD -Oaxxp5EJb+RxBrO6WVcmeQD2+A2iMzAo1KpYoJ2daZH9 ------END CERTIFICATE----- - -GlobalSign Root CA -================== ------BEGIN CERTIFICATE----- -MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkGA1UEBhMCQkUx -GTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jvb3QgQ0ExGzAZBgNVBAMTEkds -b2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAwMDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNV -BAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYD -VQQDExJHbG9iYWxTaWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDa -DuaZjc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavpxy0Sy6sc -THAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp1Wrjsok6Vjk4bwY8iGlb -Kk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdGsnUOhugZitVtbNV4FpWi6cgKOOvyJBNP -c1STE4U6G7weNLWLBYy5d4ux2x8gkasJU26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrX -gzT/LCrBbBlDSgeF59N89iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV -HRMBAf8EBTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0BAQUF -AAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOzyj1hTdNGCbM+w6Dj -Y1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE38NflNUVyRRBnMRddWQVDf9VMOyG -j/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymPAbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhH -hm4qxFYxldBniYUr+WymXUadDKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveC -X4XSQRjbgbMEHMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A== ------END CERTIFICATE----- - -GlobalSign Root CA - R2 -======================= ------BEGIN CERTIFICATE----- -MIIDujCCAqKgAwIBAgILBAAAAAABD4Ym5g0wDQYJKoZIhvcNAQEFBQAwTDEgMB4GA1UECxMXR2xv -YmFsU2lnbiBSb290IENBIC0gUjIxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh -bFNpZ24wHhcNMDYxMjE1MDgwMDAwWhcNMjExMjE1MDgwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT -aWduIFJvb3QgQ0EgLSBSMjETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln -bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKbPJA6+Lm8omUVCxKs+IVSbC9N/hHD6 -ErPLv4dfxn+G07IwXNb9rfF73OX4YJYJkhD10FPe+3t+c4isUoh7SqbKSaZeqKeMWhG8eoLrvozp -s6yWJQeXSpkqBy+0Hne/ig+1AnwblrjFuTosvNYSuetZfeLQBoZfXklqtTleiDTsvHgMCJiEbKjN -S7SgfQx5TfC4LcshytVsW33hoCmEofnTlEnLJGKRILzdC9XZzPnqJworc5HGnRusyMvo4KD0L5CL -TfuwNhv2GXqF4G3yYROIXJ/gkwpRl4pazq+r1feqCapgvdzZX99yqWATXgAByUr6P6TqBwMhAo6C -ygPCm48CAwEAAaOBnDCBmTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E -FgQUm+IHV2ccHsBqBt5ZtJot39wZhi4wNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL2NybC5nbG9i -YWxzaWduLm5ldC9yb290LXIyLmNybDAfBgNVHSMEGDAWgBSb4gdXZxwewGoG3lm0mi3f3BmGLjAN -BgkqhkiG9w0BAQUFAAOCAQEAmYFThxxol4aR7OBKuEQLq4GsJ0/WwbgcQ3izDJr86iw8bmEbTUsp -9Z8FHSbBuOmDAGJFtqkIk7mpM0sYmsL4h4hO291xNBrBVNpGP+DTKqttVCL1OmLNIG+6KYnX3ZHu -01yiPqFbQfXf5WRDLenVOavSot+3i9DAgBkcRcAtjOj4LaR0VknFBbVPFd5uRHg5h6h+u/N5GJG7 -9G+dwfCMNYxdAfvDbbnvRG15RjF+Cv6pgsH/76tuIMRQyV+dTZsXjAzlAcmgQWpzU/qlULRuJQ/7 -TBj0/VLZjmmx6BEP3ojY+x1J96relc8geMJgEtslQIxq/H5COEBkEveegeGTLg== ------END CERTIFICATE----- - -ValiCert Class 1 VA -=================== ------BEGIN CERTIFICATE----- -MIIC5zCCAlACAQEwDQYJKoZIhvcNAQEFBQAwgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRp -b24gTmV0d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENs -YXNzIDEgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZh -bGljZXJ0LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMB4XDTk5MDYyNTIy -MjM0OFoXDTE5MDYyNTIyMjM0OFowgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRpb24gTmV0 -d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENsYXNzIDEg -UG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZhbGljZXJ0 -LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMIGfMA0GCSqGSIb3DQEBAQUA -A4GNADCBiQKBgQDYWYJ6ibiWuqYvaG9YLqdUHAZu9OqNSLwxlBfw8068srg1knaw0KWlAdcAAxIi -GQj4/xEjm84H9b9pGib+TunRf50sQB1ZaG6m+FiwnRqP0z/x3BkGgagO4DrdyFNFCQbmD3DD+kCm -DuJWBQ8YTfwggtFzVXSNdnKgHZ0dwN0/cQIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFBoPUn0LBwG -lN+VYH+Wexf+T3GtZMjdd9LvWVXoP+iOBSoh8gfStadS/pyxtuJbdxdA6nLWI8sogTLDAHkY7FkX -icnGah5xyf23dKUlRWnFSKsZ4UWKJWsZ7uW7EvV/96aNUcPwnXS3qT6gpf+2SQMT2iLM7XGCK5nP -Orf1LXLI ------END CERTIFICATE----- - -ValiCert Class 2 VA -=================== ------BEGIN CERTIFICATE----- -MIIC5zCCAlACAQEwDQYJKoZIhvcNAQEFBQAwgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRp -b24gTmV0d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENs -YXNzIDIgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZh -bGljZXJ0LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMB4XDTk5MDYyNjAw -MTk1NFoXDTE5MDYyNjAwMTk1NFowgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRpb24gTmV0 -d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENsYXNzIDIg -UG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZhbGljZXJ0 -LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMIGfMA0GCSqGSIb3DQEBAQUA -A4GNADCBiQKBgQDOOnHK5avIWZJV16vYdA757tn2VUdZZUcOBVXc65g2PFxTXdMwzzjsvUGJ7SVC -CSRrCl6zfN1SLUzm1NZ9WlmpZdRJEy0kTRxQb7XBhVQ7/nHk01xC+YDgkRoKWzk2Z/M/VXwbP7Rf -ZHM047QSv4dk+NoS/zcnwbNDu+97bi5p9wIDAQABMA0GCSqGSIb3DQEBBQUAA4GBADt/UG9vUJSZ -SWI4OB9L+KXIPqeCgfYrx+jFzug6EILLGACOTb2oWH+heQC1u+mNr0HZDzTuIYEZoDJJKPTEjlbV -UjP9UNV+mWwD5MlM/Mtsq2azSiGM5bUMMj4QssxsodyamEwCW/POuZ6lcg5Ktz885hZo+L7tdEy8 -W9ViH0Pd ------END CERTIFICATE----- - -RSA Root Certificate 1 -====================== ------BEGIN CERTIFICATE----- -MIIC5zCCAlACAQEwDQYJKoZIhvcNAQEFBQAwgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRp -b24gTmV0d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENs -YXNzIDMgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZh -bGljZXJ0LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMB4XDTk5MDYyNjAw -MjIzM1oXDTE5MDYyNjAwMjIzM1owgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRpb24gTmV0 -d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENsYXNzIDMg -UG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZhbGljZXJ0 -LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMIGfMA0GCSqGSIb3DQEBAQUA -A4GNADCBiQKBgQDjmFGWHOjVsQaBalfDcnWTq8+epvzzFlLWLU2fNUSoLgRNB0mKOCn1dzfnt6td -3zZxFJmP3MKS8edgkpfs2Ejcv8ECIMYkpChMMFp2bbFc893enhBxoYjHW5tBbcqwuI4V7q0zK89H -BFx1cQqYJJgpp0lZpd34t0NiYfPT4tBVPwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFa7AliEZwgs -3x/be0kz9dNnnfS0ChCzycUs4pJqcXgn8nCDQtM+z6lU9PHYkhaM0QTLS6vJn0WuPIqpsHEzXcjF -V9+vqDWzf4mH6eglkrh/hXqu1rweN1gqZ8mRzyqBPu3GOd/APhmcGcwTTYJBtYze4D1gCCAPRX5r -on+jjBXu ------END CERTIFICATE----- - -Verisign Class 3 Public Primary Certification Authority - G3 -============================================================ ------BEGIN CERTIFICATE----- -MIIEGjCCAwICEQCbfgZJoz5iudXukEhxKe9XMA0GCSqGSIb3DQEBBQUAMIHKMQswCQYDVQQGEwJV -UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv -cmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl -IG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkgQ2VydGlmaWNh -dGlvbiBBdXRob3JpdHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMIHKMQsw -CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRy -dXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhv -cml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkg -Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC -ggEBAMu6nFL8eB8aHm8bN3O9+MlrlBIwT/A2R/XQkQr1F8ilYcEWQE37imGQ5XYgwREGfassbqb1 -EUGO+i2tKmFZpGcmTNDovFJbcCAEWNF6yaRpvIMXZK0Fi7zQWM6NjPXr8EJJC52XJ2cybuGukxUc -cLwgTS8Y3pKI6GyFVxEa6X7jJhFUokWWVYPKMIno3Nij7SqAP395ZVc+FSBmCC+Vk7+qRy+oRpfw -EuL+wgorUeZ25rdGt+INpsyow0xZVYnm6FNcHOqd8GIWC6fJXwzw3sJ2zq/3avL6QaaiMxTJ5Xpj -055iN9WFZZ4O5lMkdBteHRJTW8cs54NJOxWuimi5V5cCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEA -ERSWwauSCPc/L8my/uRan2Te2yFPhpk0djZX3dAVL8WtfxUfN2JzPtTnX84XA9s1+ivbrmAJXx5f -j267Cz3qWhMeDGBvtcC1IyIuBwvLqXTLR7sdwdela8wv0kL9Sd2nic9TutoAWii/gt/4uhMdUIaC -/Y4wjylGsB49Ndo4YhYYSq3mtlFs3q9i6wHQHiT+eo8SGhJouPtmmRQURVyu565pF4ErWjfJXir0 -xuKhXFSbplQAz/DxwceYMBo7Nhbbo27q/a2ywtrvAkcTisDxszGtTxzhT5yvDwyd93gN2PQ1VoDa -t20Xj50egWTh/sVFuq1ruQp6Tk9LhO5L8X3dEQ== ------END CERTIFICATE----- - -Verisign Class 4 Public Primary Certification Authority - G3 -============================================================ ------BEGIN CERTIFICATE----- -MIIEGjCCAwICEQDsoKeLbnVqAc/EfMwvlF7XMA0GCSqGSIb3DQEBBQUAMIHKMQswCQYDVQQGEwJV -UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv -cmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl -IG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDQgUHVibGljIFByaW1hcnkgQ2VydGlmaWNh -dGlvbiBBdXRob3JpdHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMIHKMQsw -CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRy -dXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhv -cml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDQgUHVibGljIFByaW1hcnkg -Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC -ggEBAK3LpRFpxlmr8Y+1GQ9Wzsy1HyDkniYlS+BzZYlZ3tCD5PUPtbut8XzoIfzk6AzufEUiGXaS -tBO3IFsJ+mGuqPKljYXCKtbeZjbSmwL0qJJgfJxptI8kHtCGUvYynEFYHiK9zUVilQhu0GbdU6LM -8BDcVHOLBKFGMzNcF0C5nk3T875Vg+ixiY5afJqWIpA7iCXy0lOIAgwLePLmNxdLMEYH5IBtptiW -Lugs+BGzOA1mppvqySNb247i8xOOGlktqgLw7KSHZtzBP/XYufTsgsbSPZUd5cBPhMnZo0QoBmrX -Razwa2rvTl/4EYIeOGM0ZlDUPpNz+jDDZq3/ky2X7wMCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEA -j/ola09b5KROJ1WrIhVZPMq1CtRK26vdoV9TxaBXOcLORyu+OshWv8LZJxA6sQU8wHcxuzrTBXtt -mhwwjIDLk5Mqg6sFUYICABFna/OIYUdfA5PVWw3g8dShMjWFsjrbsIKr0csKvE+MW8VLADsfKoKm -fjaF3H48ZwC15DtS4KjrXRX5xm3wrR0OhbepmnMUWluPQSjA1egtTaRezarZ7c7c2NU8Qh0XwRJd -RTjDOPP8hS6DRkiy1yBfkjaP53kPmF6Z6PDQpLv1U70qzlmwr25/bLvSHgCwIe34QWKCudiyxLtG -UPMxxY8BqHTr9Xgn2uf3ZkPznoM+IKrDNWCRzg== ------END CERTIFICATE----- - -Entrust.net Secure Server CA -============================ ------BEGIN CERTIFICATE----- -MIIE2DCCBEGgAwIBAgIEN0rSQzANBgkqhkiG9w0BAQUFADCBwzELMAkGA1UEBhMCVVMxFDASBgNV -BAoTC0VudHJ1c3QubmV0MTswOQYDVQQLEzJ3d3cuZW50cnVzdC5uZXQvQ1BTIGluY29ycC4gYnkg -cmVmLiAobGltaXRzIGxpYWIuKTElMCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRl -ZDE6MDgGA1UEAxMxRW50cnVzdC5uZXQgU2VjdXJlIFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhv -cml0eTAeFw05OTA1MjUxNjA5NDBaFw0xOTA1MjUxNjM5NDBaMIHDMQswCQYDVQQGEwJVUzEUMBIG -A1UEChMLRW50cnVzdC5uZXQxOzA5BgNVBAsTMnd3dy5lbnRydXN0Lm5ldC9DUFMgaW5jb3JwLiBi -eSByZWYuIChsaW1pdHMgbGlhYi4pMSUwIwYDVQQLExwoYykgMTk5OSBFbnRydXN0Lm5ldCBMaW1p -dGVkMTowOAYDVQQDEzFFbnRydXN0Lm5ldCBTZWN1cmUgU2VydmVyIENlcnRpZmljYXRpb24gQXV0 -aG9yaXR5MIGdMA0GCSqGSIb3DQEBAQUAA4GLADCBhwKBgQDNKIM0VBuJ8w+vN5Ex/68xYMmo6LIQ -aO2f55M28Qpku0f1BBc/I0dNxScZgSYMVHINiC3ZH5oSn7yzcdOAGT9HZnuMNSjSuQrfJNqc1lB5 -gXpa0zf3wkrYKZImZNHkmGw6AIr1NJtl+O3jEP/9uElY3KDegjlrgbEWGWG5VLbmQwIBA6OCAdcw -ggHTMBEGCWCGSAGG+EIBAQQEAwIABzCCARkGA1UdHwSCARAwggEMMIHeoIHboIHYpIHVMIHSMQsw -CQYDVQQGEwJVUzEUMBIGA1UEChMLRW50cnVzdC5uZXQxOzA5BgNVBAsTMnd3dy5lbnRydXN0Lm5l -dC9DUFMgaW5jb3JwLiBieSByZWYuIChsaW1pdHMgbGlhYi4pMSUwIwYDVQQLExwoYykgMTk5OSBF -bnRydXN0Lm5ldCBMaW1pdGVkMTowOAYDVQQDEzFFbnRydXN0Lm5ldCBTZWN1cmUgU2VydmVyIENl -cnRpZmljYXRpb24gQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMCmgJ6AlhiNodHRwOi8vd3d3LmVu -dHJ1c3QubmV0L0NSTC9uZXQxLmNybDArBgNVHRAEJDAigA8xOTk5MDUyNTE2MDk0MFqBDzIwMTkw -NTI1MTYwOTQwWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAU8BdiE1U9s/8KAGv7UISX8+1i0Bow -HQYDVR0OBBYEFPAXYhNVPbP/CgBr+1CEl/PtYtAaMAwGA1UdEwQFMAMBAf8wGQYJKoZIhvZ9B0EA -BAwwChsEVjQuMAMCBJAwDQYJKoZIhvcNAQEFBQADgYEAkNwwAvpkdMKnCqV8IY00F6j7Rw7/JXyN -Ewr75Ji174z4xRAN95K+8cPV1ZVqBLssziY2ZcgxxufuP+NXdYR6Ee9GTxj005i7qIcyunL2POI9 -n9cd2cNgQ4xYDiKWL2KjLB+6rQXvqzJ4h6BUcxm1XAX5Uj5tLUUL9wqT6u0G+bI= ------END CERTIFICATE----- - -Entrust.net Premium 2048 Secure Server CA -========================================= ------BEGIN CERTIFICATE----- -MIIEKjCCAxKgAwIBAgIEOGPe+DANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChMLRW50cnVzdC5u -ZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBpbmNvcnAuIGJ5IHJlZi4gKGxp -bWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNV -BAMTKkVudHJ1c3QubmV0IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw05OTEyMjQx -NzUwNTFaFw0yOTA3MjQxNDE1MTJaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3 -d3d3LmVudHJ1c3QubmV0L0NQU18yMDQ4IGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTEl -MCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEGA1UEAxMqRW50cnVzdC5u -ZXQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgKDIwNDgpMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A -MIIBCgKCAQEArU1LqRKGsuqjIAcVFmQqK0vRvwtKTY7tgHalZ7d4QMBzQshowNtTK91euHaYNZOL -Gp18EzoOH1u3Hs/lJBQesYGpjX24zGtLA/ECDNyrpUAkAH90lKGdCCmziAv1h3edVc3kw37XamSr -hRSGlVuXMlBvPci6Zgzj/L24ScF2iUkZ/cCovYmjZy/Gn7xxGWC4LeksyZB2ZnuU4q941mVTXTzW -nLLPKQP5L6RQstRIzgUyVYr9smRMDuSYB3Xbf9+5CFVghTAp+XtIpGmG4zU/HoZdenoVve8AjhUi -VBcAkCaTvA5JaJG/+EfTnZVCwQ5N328mz8MYIWJmQ3DW1cAH4QIDAQABo0IwQDAOBgNVHQ8BAf8E -BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUVeSB0RGAvtiJuQijMfmhJAkWuXAwDQYJ -KoZIhvcNAQEFBQADggEBADubj1abMOdTmXx6eadNl9cZlZD7Bh/KM3xGY4+WZiT6QBshJ8rmcnPy -T/4xmf3IDExoU8aAghOY+rat2l098c5u9hURlIIM7j+VrxGrD9cv3h8Dj1csHsm7mhpElesYT6Yf -zX1XEC+bBAlahLVu2B064dae0Wx5XnkcFMXj0EyTO2U87d89vqbllRrDtRnDvV5bu/8j72gZyxKT -J1wDLW8w0B62GqzeWvfRqqgnpv55gcR5mTNXuhKwqeBCbJPKVt7+bYQLCIt+jerXmCHG8+c8eS9e -nNFMFY3h7CI3zJpDC5fcgJCNs2ebb0gIFVbPv/ErfF6adulZkMV8gzURZVE= ------END CERTIFICATE----- - -Baltimore CyberTrust Root -========================= ------BEGIN CERTIFICATE----- -MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJRTESMBAGA1UE -ChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYDVQQDExlCYWx0aW1vcmUgQ3li -ZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoXDTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMC -SUUxEjAQBgNVBAoTCUJhbHRpbW9yZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFs -dGltb3JlIEN5YmVyVHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKME -uyKrmD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjrIZ3AQSsB -UnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeKmpYcqWe4PwzV9/lSEy/C -G9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSuXmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9 -XbIGevOF6uvUA65ehD5f/xXtabz5OTZydc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjpr -l3RjM71oGDHweI12v/yejl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoI -VDaGezq1BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEB -BQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT929hkTI7gQCvlYpNRh -cL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3WgxjkzSswF07r51XgdIGn9w/xZchMB5 -hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsa -Y71k5h+3zvDyny67G7fyUIhzksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9H -RCwBXbsdtTLSR9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp ------END CERTIFICATE----- - -Equifax Secure Global eBusiness CA -================================== ------BEGIN CERTIFICATE----- -MIICkDCCAfmgAwIBAgIBATANBgkqhkiG9w0BAQQFADBaMQswCQYDVQQGEwJVUzEcMBoGA1UEChMT -RXF1aWZheCBTZWN1cmUgSW5jLjEtMCsGA1UEAxMkRXF1aWZheCBTZWN1cmUgR2xvYmFsIGVCdXNp -bmVzcyBDQS0xMB4XDTk5MDYyMTA0MDAwMFoXDTIwMDYyMTA0MDAwMFowWjELMAkGA1UEBhMCVVMx -HDAaBgNVBAoTE0VxdWlmYXggU2VjdXJlIEluYy4xLTArBgNVBAMTJEVxdWlmYXggU2VjdXJlIEds -b2JhbCBlQnVzaW5lc3MgQ0EtMTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAuucXkAJlsTRV -PEnCUdXfp9E3j9HngXNBUmCbnaEXJnitx7HoJpQytd4zjTov2/KaelpzmKNc6fuKcxtc58O/gGzN -qfTWK8D3+ZmqY6KxRwIP1ORROhI8bIpaVIRw28HFkM9yRcuoWcDNM50/o5brhTMhHD4ePmBudpxn -hcXIw2ECAwEAAaNmMGQwEQYJYIZIAYb4QgEBBAQDAgAHMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0j -BBgwFoAUvqigdHJQa0S3ySPY+6j/s1draGwwHQYDVR0OBBYEFL6ooHRyUGtEt8kj2Puo/7NXa2hs -MA0GCSqGSIb3DQEBBAUAA4GBADDiAVGqx+pf2rnQZQ8w1j7aDRRJbpGTJxQx78T3LUX47Me/okEN -I7SS+RkAZ70Br83gcfxaz2TE4JaY0KNA4gGK7ycH8WUBikQtBmV1UsCGECAhX2xrD2yuCRyv8qIY -NMR1pHMc8Y3c7635s3a0kr/clRAevsvIO1qEYBlWlKlV ------END CERTIFICATE----- - -Equifax Secure eBusiness CA 1 -============================= ------BEGIN CERTIFICATE----- -MIICgjCCAeugAwIBAgIBBDANBgkqhkiG9w0BAQQFADBTMQswCQYDVQQGEwJVUzEcMBoGA1UEChMT -RXF1aWZheCBTZWN1cmUgSW5jLjEmMCQGA1UEAxMdRXF1aWZheCBTZWN1cmUgZUJ1c2luZXNzIENB -LTEwHhcNOTkwNjIxMDQwMDAwWhcNMjAwNjIxMDQwMDAwWjBTMQswCQYDVQQGEwJVUzEcMBoGA1UE -ChMTRXF1aWZheCBTZWN1cmUgSW5jLjEmMCQGA1UEAxMdRXF1aWZheCBTZWN1cmUgZUJ1c2luZXNz -IENBLTEwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAM4vGbwXt3fek6lfWg0XTzQaDJj0ItlZ -1MRoRvC0NcWFAyDGr0WlIVFFQesWWDYyb+JQYmT5/VGcqiTZ9J2DKocKIdMSODRsjQBuWqDZQu4a -IZX5UkxVWsUPOE9G+m34LjXWHXzr4vCwdYDIqROsvojvOm6rXyo4YgKwEnv+j6YDAgMBAAGjZjBk -MBEGCWCGSAGG+EIBAQQEAwIABzAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFEp4MlIR21kW -Nl7fwRQ2QGpHfEyhMB0GA1UdDgQWBBRKeDJSEdtZFjZe38EUNkBqR3xMoTANBgkqhkiG9w0BAQQF -AAOBgQB1W6ibAxHm6VZMzfmpTMANmvPMZWnmJXbMWbfWVMMdzZmsGd20hdXgPfxiIKeES1hl8eL5 -lSE/9dR+WB5Hh1Q+WKG1tfgq73HnvMP2sUlG4tega+VWeponmHxGYhTnyfxuAxJ5gDgdSIKN/Bf+ -KpYrtWKmpj29f5JZzVoqgrI3eQ== ------END CERTIFICATE----- - -AddTrust Low-Value Services Root -================================ ------BEGIN CERTIFICATE----- -MIIEGDCCAwCgAwIBAgIBATANBgkqhkiG9w0BAQUFADBlMQswCQYDVQQGEwJTRTEUMBIGA1UEChML -QWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3b3JrMSEwHwYDVQQDExhBZGRU -cnVzdCBDbGFzcyAxIENBIFJvb3QwHhcNMDAwNTMwMTAzODMxWhcNMjAwNTMwMTAzODMxWjBlMQsw -CQYDVQQGEwJTRTEUMBIGA1UEChMLQWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBO -ZXR3b3JrMSEwHwYDVQQDExhBZGRUcnVzdCBDbGFzcyAxIENBIFJvb3QwggEiMA0GCSqGSIb3DQEB -AQUAA4IBDwAwggEKAoIBAQCWltQhSWDia+hBBwzexODcEyPNwTXH+9ZOEQpnXvUGW2ulCDtbKRY6 -54eyNAbFvAWlA3yCyykQruGIgb3WntP+LVbBFc7jJp0VLhD7Bo8wBN6ntGO0/7Gcrjyvd7ZWxbWr -oulpOj0OM3kyP3CCkplhbY0wCI9xP6ZIVxn4JdxLZlyldI+Yrsj5wAYi56xz36Uu+1LcsRVlIPo1 -Zmne3yzxbrww2ywkEtvrNTVokMsAsJchPXQhI2U0K7t4WaPW4XY5mqRJjox0r26kmqPZm9I4XJui -GMx1I4S+6+JNM3GOGvDC+Mcdoq0Dlyz4zyXG9rgkMbFjXZJ/Y/AlyVMuH79NAgMBAAGjgdIwgc8w -HQYDVR0OBBYEFJWxtPCUtr3H2tERCSG+wa9J/RB7MAsGA1UdDwQEAwIBBjAPBgNVHRMBAf8EBTAD -AQH/MIGPBgNVHSMEgYcwgYSAFJWxtPCUtr3H2tERCSG+wa9J/RB7oWmkZzBlMQswCQYDVQQGEwJT -RTEUMBIGA1UEChMLQWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3b3JrMSEw -HwYDVQQDExhBZGRUcnVzdCBDbGFzcyAxIENBIFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBACxt -ZBsfzQ3duQH6lmM0MkhHma6X7f1yFqZzR1r0693p9db7RcwpiURdv0Y5PejuvE1Uhh4dbOMXJ0Ph -iVYrqW9yTkkz43J8KiOavD7/KCrto/8cI7pDVwlnTUtiBi34/2ydYB7YHEt9tTEv2dB8Xfjea4MY -eDdXL+gzB2ffHsdrKpV2ro9Xo/D0UrSpUwjP4E/TelOL/bscVjby/rK25Xa71SJlpz/+0WatC7xr -mYbvP33zGDLKe8bjq2RGlfgmadlVg3sslgf/WSxEo8bl6ancoWOAWiFeIc9TVPC6b4nbqKqVz4vj -ccweGyBECMB6tkD9xOQ14R0WHNC8K47Wcdk= ------END CERTIFICATE----- - -AddTrust External Root -====================== ------BEGIN CERTIFICATE----- -MIIENjCCAx6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBvMQswCQYDVQQGEwJTRTEUMBIGA1UEChML -QWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4dGVybmFsIFRUUCBOZXR3b3JrMSIwIAYD -VQQDExlBZGRUcnVzdCBFeHRlcm5hbCBDQSBSb290MB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEw -NDgzOFowbzELMAkGA1UEBhMCU0UxFDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRU -cnVzdCBFeHRlcm5hbCBUVFAgTmV0d29yazEiMCAGA1UEAxMZQWRkVHJ1c3QgRXh0ZXJuYWwgQ0Eg -Um9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALf3GjPm8gAELTngTlvtH7xsD821 -+iO2zt6bETOXpClMfZOfvUq8k+0DGuOPz+VtUFrWlymUWoCwSXrbLpX9uMq/NzgtHj6RQa1wVsfw -Tz/oMp50ysiQVOnGXw94nZpAPA6sYapeFI+eh6FqUNzXmk6vBbOmcZSccbNQYArHE504B4YCqOmo -aSYYkKtMsE8jqzpPhNjfzp/haW+710LXa0Tkx63ubUFfclpxCDezeWWkWaCUN/cALw3CknLa0Dhy -2xSoRcRdKn23tNbE7qzNE0S3ySvdQwAl+mG5aWpYIxG3pzOPVnVZ9c0p10a3CitlttNCbxWyuHv7 -7+ldU9U0WicCAwEAAaOB3DCB2TAdBgNVHQ4EFgQUrb2YejS0Jvf6xCZU7wO94CTLVBowCwYDVR0P -BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wgZkGA1UdIwSBkTCBjoAUrb2YejS0Jvf6xCZU7wO94CTL -VBqhc6RxMG8xCzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEmMCQGA1UECxMdQWRk -VHJ1c3QgRXh0ZXJuYWwgVFRQIE5ldHdvcmsxIjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENB -IFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBALCb4IUlwtYj4g+WBpKdQZic2YR5gdkeWxQHIzZl -j7DYd7usQWxHYINRsPkyPef89iYTx4AWpb9a/IfPeHmJIZriTAcKhjW88t5RxNKWt9x+Tu5w/Rw5 -6wwCURQtjr0W4MHfRnXnJK3s9EK0hZNwEGe6nQY1ShjTK3rMUUKhemPR5ruhxSvCNr4TDea9Y355 -e6cJDUCrat2PisP29owaQgVR1EX1n6diIWgVIEM8med8vSTYqZEXc4g/VhsxOBi0cQ+azcgOno4u -G+GMmIPLHzHxREzGBHNJdmAPx/i9F4BrLunMTA5amnkPIAou1Z5jJh5VkpTYghdae9C8x49OhgQ= ------END CERTIFICATE----- - -AddTrust Public Services Root -============================= ------BEGIN CERTIFICATE----- -MIIEFTCCAv2gAwIBAgIBATANBgkqhkiG9w0BAQUFADBkMQswCQYDVQQGEwJTRTEUMBIGA1UEChML -QWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3b3JrMSAwHgYDVQQDExdBZGRU -cnVzdCBQdWJsaWMgQ0EgUm9vdDAeFw0wMDA1MzAxMDQxNTBaFw0yMDA1MzAxMDQxNTBaMGQxCzAJ -BgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEdMBsGA1UECxMUQWRkVHJ1c3QgVFRQIE5l -dHdvcmsxIDAeBgNVBAMTFOFkZFRydXN0IFB1YmxpYyBDQSBSb290MIIBIjANBgkqhkiG9w0BAQEF -AAOCAQ8AMIIBCgKCAQEA6Rowj4OIFMEg2Dybjxt+A3S72mnTRqX4jsIMEZBRpS9mVEBV6tsfSlbu -nyNu9DnLoblv8n75XYcmYZ4c+OLspoH4IcUkzBEMP9smcnrHAZcHF/nXGCwwfQ56HmIexkvA/X1i -d9NEHif2P0tEs7c42TkfYNVRknMDtABp4/MUTu7R3AnPdzRGULD4EfL+OHn3Bzn+UZKXC1sIXzSG -Aa2Il+tmzV7R/9x98oTaunet3IAIx6eH1lWfl2royBFkuucZKT8Rs3iQhCBSWxHveNCD9tVIkNAw -HM+A+WD+eeSI8t0A65RF62WUaUC6wNW0uLp9BBGo6zEFlpROWCGOn9Bg/QIDAQABo4HRMIHOMB0G -A1UdDgQWBBSBPjfYkrAfd59ctKtzquf2NGAv+jALBgNVHQ8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB -/zCBjgYDVR0jBIGGMIGDgBSBPjfYkrAfd59ctKtzquf2NGAv+qFopGYwZDELMAkGA1UEBhMCU0Ux -FDASBgNVBAoTC0FkZFRydXN0IEFCMR0wGwYDVQQLExRBZGRUcnVzdCBUVFAgTmV0d29yazEgMB4G -A1UEAxMXQWRkVHJ1c3QgUHVibGljIENBIFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBAAP3FUr4 -JNojVhaTdt02KLmuG7jD8WS6IBh4lSknVwW8fCr0uVFV2ocC3g8WFzH4qnkuCRO7r7IgGRLlk/lL -+YPoRNWyQSW/iHVv/xD8SlTQX/D67zZzfRs2RcYhbbQVuE7PnFylPVoAjgbjPGsye/Kf8Lb93/Ao -GEjwxrzQvzSAlsJKsW2Ox5BF3i9nrEUEo3rcVZLJR2bYGozH7ZxOmuASu7VqTITh4SINhwBk/ox9 -Yjllpu9CtoAlEmEBqCQTcAARJl/6NVDFSMwGR+gn2HCNX2TmoUQmXiLsks3/QppEIW1cxeMiHV9H -EufOX1362KqxMy3ZdvJOOjMMK7MtkAY= ------END CERTIFICATE----- - -AddTrust Qualified Certificates Root -==================================== ------BEGIN CERTIFICATE----- -MIIEHjCCAwagAwIBAgIBATANBgkqhkiG9w0BAQUFADBnMQswCQYDVQQGEwJTRTEUMBIGA1UEChML -QWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3b3JrMSMwIQYDVQQDExpBZGRU -cnVzdCBRdWFsaWZpZWQgQ0EgUm9vdDAeFw0wMDA1MzAxMDQ0NTBaFw0yMDA1MzAxMDQ0NTBaMGcx -CzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEdMBsGA1UECxMUQWRkVHJ1c3QgVFRQ -IE5ldHdvcmsxIzAhBgNVBAMTGkFkZFRydXN0IFF1YWxpZmllZCBDQSBSb290MIIBIjANBgkqhkiG -9w0BAQEFAAOCAQ8AMIIBCgKCAQEA5B6a/twJWoekn0e+EV+vhDTbYjx5eLfpMLXsDBwqxBb/4Oxx -64r1EW7tTw2R0hIYLUkVAcKkIhPHEWT/IhKauY5cLwjPcWqzZwFZ8V1G87B4pfYOQnrjfxvM0PC3 -KP0q6p6zsLkEqv32x7SxuCqg+1jxGaBvcCV+PmlKfw8i2O+tCBGaKZnhqkRFmhJePp1tUvznoD1o -L/BLcHwTOK28FSXx1s6rosAx1i+f4P8UWfyEk9mHfExUE+uf0S0R+Bg6Ot4l2ffTQO2kBhLEO+GR -wVY18BTcZTYJbqukB8c10cIDMzZbdSZtQvESa0NvS3GU+jQd7RNuyoB/mC9suWXY6QIDAQABo4HU -MIHRMB0GA1UdDgQWBBQ5lYtii1zJ1IC6WA+XPxUIQ8yYpzALBgNVHQ8EBAMCAQYwDwYDVR0TAQH/ -BAUwAwEB/zCBkQYDVR0jBIGJMIGGgBQ5lYtii1zJ1IC6WA+XPxUIQ8yYp6FrpGkwZzELMAkGA1UE -BhMCU0UxFDASBgNVBAoTC0FkZFRydXN0IEFCMR0wGwYDVQQLExRBZGRUcnVzdCBUVFAgTmV0d29y -azEjMCEGA1UEAxMaQWRkVHJ1c3QgUXVhbGlmaWVkIENBIFJvb3SCAQEwDQYJKoZIhvcNAQEFBQAD -ggEBABmrder4i2VhlRO6aQTvhsoToMeqT2QbPxj2qC0sVY8FtzDqQmodwCVRLae/DLPt7wh/bDxG -GuoYQ992zPlmhpwsaPXpF/gxsxjE1kh9I0xowX67ARRvxdlu3rsEQmr49lx95dr6h+sNNVJn0J6X -dgWTP5XHAeZpVTh/EGGZyeNfpso+gmNIquIISD6q8rKFYqa0p9m9N5xotS1WfbC3P6CxB9bpT9ze -RXEwMn8bLgn5v1Kh7sKAPgZcLlVAwRv1cEWw3F369nJad9Jjzc9YiQBCYz95OdBEsIJuQRno3eDB -iFrRHnGTHyQwdOUeqN48Jzd/g66ed8/wMLH/S5noxqE= ------END CERTIFICATE----- - -Entrust Root Certification Authority -==================================== ------BEGIN CERTIFICATE----- -MIIEkTCCA3mgAwIBAgIERWtQVDANBgkqhkiG9w0BAQUFADCBsDELMAkGA1UEBhMCVVMxFjAUBgNV -BAoTDUVudHJ1c3QsIEluYy4xOTA3BgNVBAsTMHd3dy5lbnRydXN0Lm5ldC9DUFMgaXMgaW5jb3Jw -b3JhdGVkIGJ5IHJlZmVyZW5jZTEfMB0GA1UECxMWKGMpIDIwMDYgRW50cnVzdCwgSW5jLjEtMCsG -A1UEAxMkRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA2MTEyNzIwMjM0 -MloXDTI2MTEyNzIwNTM0MlowgbAxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMu -MTkwNwYDVQQLEzB3d3cuZW50cnVzdC5uZXQvQ1BTIGlzIGluY29ycG9yYXRlZCBieSByZWZlcmVu -Y2UxHzAdBgNVBAsTFihjKSAyMDA2IEVudHJ1c3QsIEluYy4xLTArBgNVBAMTJEVudHJ1c3QgUm9v -dCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB -ALaVtkNC+sZtKm9I35RMOVcF7sN5EUFoNu3s/poBj6E4KPz3EEZmLk0eGrEaTsbRwJWIsMn/MYsz -A9u3g3s+IIRe7bJWKKf44LlAcTfFy0cOlypowCKVYhXbR9n10Cv/gkvJrT7eTNuQgFA/CYqEAOww -Cj0Yzfv9KlmaI5UXLEWeH25DeW0MXJj+SKfFI0dcXv1u5x609mhF0YaDW6KKjbHjKYD+JXGIrb68 -j6xSlkuqUY3kEzEZ6E5Nn9uss2rVvDlUccp6en+Q3X0dgNmBu1kmwhH+5pPi94DkZfs0Nw4pgHBN -rziGLp5/V6+eF67rHMsoIV+2HNjnogQi+dPa2MsCAwEAAaOBsDCBrTAOBgNVHQ8BAf8EBAMCAQYw -DwYDVR0TAQH/BAUwAwEB/zArBgNVHRAEJDAigA8yMDA2MTEyNzIwMjM0MlqBDzIwMjYxMTI3MjA1 -MzQyWjAfBgNVHSMEGDAWgBRokORnpKZTgMeGZqTx90tD+4S9bTAdBgNVHQ4EFgQUaJDkZ6SmU4DH -hmak8fdLQ/uEvW0wHQYJKoZIhvZ9B0EABBAwDhsIVjcuMTo0LjADAgSQMA0GCSqGSIb3DQEBBQUA -A4IBAQCT1DCw1wMgKtD5Y+iRDAUgqV8ZyntyTtSx29CW+1RaGSwMCPeyvIWonX9tO1KzKtvn1ISM -Y/YPyyYBkVBs9F8U4pN0wBOeMDpQ47RgxRzwIkSNcUesyBrJ6ZuaAGAT/3B+XxFNSRuzFVJ7yVTa -v52Vr2ua2J7p8eRDjeIRRDq/r72DQnNSi6q7pynP9WQcCk3RvKqsnyrQ/39/2n3qse0wJcGE2jTS -W3iDVuycNsMm4hH2Z0kdkquM++v/eu6FSqdQgPCnXEqULl8FmTxSQeDNtGPPAUO6nIPcj2A781q0 -tHuu2guQOHXvgR1m0vdXcDazv/wor3ElhVsT/h5/WrQ8 ------END CERTIFICATE----- - -RSA Security 2048 v3 -==================== ------BEGIN CERTIFICATE----- -MIIDYTCCAkmgAwIBAgIQCgEBAQAAAnwAAAAKAAAAAjANBgkqhkiG9w0BAQUFADA6MRkwFwYDVQQK -ExBSU0EgU2VjdXJpdHkgSW5jMR0wGwYDVQQLExRSU0EgU2VjdXJpdHkgMjA0OCBWMzAeFw0wMTAy -MjIyMDM5MjNaFw0yNjAyMjIyMDM5MjNaMDoxGTAXBgNVBAoTEFJTQSBTZWN1cml0eSBJbmMxHTAb -BgNVBAsTFFJTQSBTZWN1cml0eSAyMDQ4IFYzMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC -AQEAt49VcdKA3XtpeafwGFAyPGJn9gqVB93mG/Oe2dJBVGutn3y+Gc37RqtBaB4Y6lXIL5F4iSj7 -Jylg/9+PjDvJSZu1pJTOAeo+tWN7fyb9Gd3AIb2E0S1PRsNO3Ng3OTsor8udGuorryGlwSMiuLgb -WhOHV4PR8CDn6E8jQrAApX2J6elhc5SYcSa8LWrg903w8bYqODGBDSnhAMFRD0xS+ARaqn1y07iH -KrtjEAMqs6FPDVpeRrc9DvV07Jmf+T0kgYim3WBU6JU2PcYJk5qjEoAAVZkZR73QpXzDuvsf9/UP -+Ky5tfQ3mBMY3oVbtwyCO4dvlTlYMNpuAWgXIszACwIDAQABo2MwYTAPBgNVHRMBAf8EBTADAQH/ -MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBQHw1EwpKrpRa41JPr/JCwz0LGdjDAdBgNVHQ4E -FgQUB8NRMKSq6UWuNST6/yQsM9CxnYwwDQYJKoZIhvcNAQEFBQADggEBAF8+hnZuuDU8TjYcHnmY -v/3VEhF5Ug7uMYm83X/50cYVIeiKAVQNOvtUudZj1LGqlk2iQk3UUx+LEN5/Zb5gEydxiKRz44Rj -0aRV4VCT5hsOedBnvEbIvz8XDZXmxpBp3ue0L96VfdASPz0+f00/FGj1EVDVwfSQpQgdMWD/YIwj -VAqv/qFuxdF6Kmh4zx6CCiC0H63lhbJqaHVOrSU3lIW+vaHU6rcMSzyd6BIA8F+sDeGscGNz9395 -nzIlQnQFgCi/vcEkllgVsRch6YlL2weIZ/QVrXA+L02FO8K32/6YaCOJ4XQP3vTFhGMpG8zLB8kA -pKnXwiJPZ9d37CAFYd4= ------END CERTIFICATE----- - -GeoTrust Global CA -================== ------BEGIN CERTIFICATE----- -MIIDVDCCAjygAwIBAgIDAjRWMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVTMRYwFAYDVQQK -Ew1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9iYWwgQ0EwHhcNMDIwNTIxMDQw -MDAwWhcNMjIwNTIxMDQwMDAwWjBCMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5j -LjEbMBkGA1UEAxMSR2VvVHJ1c3QgR2xvYmFsIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB -CgKCAQEA2swYYzD99BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9mOSm9BXiLnTjo -BbdqfnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIuT8rxh0PBFpVXLVDviS2Aelet -8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6cJmTM386DGXHKTubU1XupGc1V3sjs0l44U+Vc -T4wt/lAjNvxm5suOpDkZALeVAjmRCw7+OC7RHQWa9k0+bw8HHa8sHo9gOeL6NlMTOdReJivbPagU -vTLrGAMoUgRx5aszPeE4uwc2hGKceeoWMPRfwCvocWvk+QIDAQABo1MwUTAPBgNVHRMBAf8EBTAD -AQH/MB0GA1UdDgQWBBTAephojYn7qwVkDBF9qn1luMrMTjAfBgNVHSMEGDAWgBTAephojYn7qwVk -DBF9qn1luMrMTjANBgkqhkiG9w0BAQUFAAOCAQEANeMpauUvXVSOKVCUn5kaFOSPeCpilKInZ57Q -zxpeR+nBsqTP3UEaBU6bS+5Kb1VSsyShNwrrZHYqLizz/Tt1kL/6cdjHPTfStQWVYrmm3ok9Nns4 -d0iXrKYgjy6myQzCsplFAMfOEVEiIuCl6rYVSAlk6l5PdPcFPseKUgzbFbS9bZvlxrFUaKnjaZC2 -mqUPuLk/IH2uSrW4nOQdtqvmlKXBx4Ot2/Unhw4EbNX/3aBd7YdStysVAq45pmp06drE57xNNB6p -XE0zX5IJL4hmXXeXxx12E6nV5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvm -Mw== ------END CERTIFICATE----- - -GeoTrust Global CA 2 -==================== ------BEGIN CERTIFICATE----- -MIIDZjCCAk6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBEMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN -R2VvVHJ1c3QgSW5jLjEdMBsGA1UEAxMUR2VvVHJ1c3QgR2xvYmFsIENBIDIwHhcNMDQwMzA0MDUw -MDAwWhcNMTkwMzA0MDUwMDAwWjBEMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5j -LjEdMBsGA1UEAxMUR2VvVHJ1c3QgR2xvYmFsIENBIDIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw -ggEKAoIBAQDvPE1APRDfO1MA4Wf+lGAVPoWI8YkNkMgoI5kF6CsgncbzYEbYwbLVjDHZ3CB5JIG/ -NTL8Y2nbsSpr7iFY8gjpeMtvy/wWUsiRxP89c96xPqfCfWbB9X5SJBri1WeR0IIQ13hLTytCOb1k -LUCgsBDTOEhGiKEMuzozKmKY+wCdE1l/bztyqu6mD4b5BWHqZ38MN5aL5mkWRxHCJ1kDs6ZgwiFA -Vvqgx306E+PsV8ez1q6diYD3Aecs9pYrEw15LNnA5IZ7S4wMcoKK+xfNAGw6EzywhIdLFnopsk/b -HdQL82Y3vdj2V7teJHq4PIu5+pIaGoSe2HSPqht/XvT+RSIhAgMBAAGjYzBhMA8GA1UdEwEB/wQF -MAMBAf8wHQYDVR0OBBYEFHE4NvICMVNHK266ZUapEBVYIAUJMB8GA1UdIwQYMBaAFHE4NvICMVNH -K266ZUapEBVYIAUJMA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQUFAAOCAQEAA/e1K6tdEPx7 -srJerJsOflN4WT5CBP51o62sgU7XAotexC3IUnbHLB/8gTKY0UvGkpMzNTEv/NgdRN3ggX+d6Yvh -ZJFiCzkIjKx0nVnZellSlxG5FntvRdOW2TF9AjYPnDtuzywNA0ZF66D0f0hExghAzN4bcLUprbqL -OzRldRtxIR0sFAqwlpW41uryZfspuk/qkZN0abby/+Ea0AzRdoXLiiW9l14sbxWZJue2Kf8i7MkC -x1YAzUm5s2x7UwQa4qjJqhIFI8LO57sEAszAR6LkxCkvW0VXiVHuPOtSCP8HNR6fNWpHSlaY0VqF -H4z1Ir+rzoPz4iIprn2DQKi6bA== ------END CERTIFICATE----- - -GeoTrust Universal CA -===================== ------BEGIN CERTIFICATE----- -MIIFaDCCA1CgAwIBAgIBATANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN -R2VvVHJ1c3QgSW5jLjEeMBwGA1UEAxMVR2VvVHJ1c3QgVW5pdmVyc2FsIENBMB4XDTA0MDMwNDA1 -MDAwMFoXDTI5MDMwNDA1MDAwMFowRTELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IElu -Yy4xHjAcBgNVBAMTFUdlb1RydXN0IFVuaXZlcnNhbCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIP -ADCCAgoCggIBAKYVVaCjxuAfjJ0hUNfBvitbtaSeodlyWL0AG0y/YckUHUWCq8YdgNY96xCcOq9t -JPi8cQGeBvV8Xx7BDlXKg5pZMK4ZyzBIle0iN430SppyZj6tlcDgFgDgEB8rMQ7XlFTTQjOgNB0e -RXbdT8oYN+yFFXoZCPzVx5zw8qkuEKmS5j1YPakWaDwvdSEYfyh3peFhF7em6fgemdtzbvQKoiFs -7tqqhZJmr/Z6a4LauiIINQ/PQvE1+mrufislzDoR5G2vc7J2Ha3QsnhnGqQ5HFELZ1aD/ThdDc7d -8Lsrlh/eezJS/R27tQahsiFepdaVaH/wmZ7cRQg+59IJDTWU3YBOU5fXtQlEIGQWFwMCTFMNaN7V -qnJNk22CDtucvc+081xdVHppCZbW2xHBjXWotM85yM48vCR85mLK4b19p71XZQvk/iXttmkQ3Cga -Rr0BHdCXteGYO8A3ZNY9lO4L4fUorgtWv3GLIylBjobFS1J72HGrH4oVpjuDWtdYAVHGTEHZf9hB -Z3KiKN9gg6meyHv8U3NyWfWTehd2Ds735VzZC1U0oqpbtWpU5xPKV+yXbfReBi9Fi1jUIxaS5BZu -KGNZMN9QAZxjiRqf2xeUgnA3wySemkfWWspOqGmJch+RbNt+nhutxx9z3SxPGWX9f5NAEC7S8O08 -ni4oPmkmM8V7AgMBAAGjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNq7LqqwDLiIJlF0 -XG0D08DYj3rWMB8GA1UdIwQYMBaAFNq7LqqwDLiIJlF0XG0D08DYj3rWMA4GA1UdDwEB/wQEAwIB -hjANBgkqhkiG9w0BAQUFAAOCAgEAMXjmx7XfuJRAyXHEqDXsRh3ChfMoWIawC/yOsjmPRFWrZIRc -aanQmjg8+uUfNeVE44B5lGiku8SfPeE0zTBGi1QrlaXv9z+ZhP015s8xxtxqv6fXIwjhmF7DWgh2 -qaavdy+3YL1ERmrvl/9zlcGO6JP7/TG37FcREUWbMPEaiDnBTzynANXH/KttgCJwpQzgXQQpAvvL -oJHRfNbDflDVnVi+QTjruXU8FdmbyUqDWcDaU/0zuzYYm4UPFd3uLax2k7nZAY1IEKj79TiG8dsK -xr2EoyNB3tZ3b4XUhRxQ4K5RirqNPnbiucon8l+f725ZDQbYKxek0nxru18UGkiPGkzns0ccjkxF -KyDuSN/n3QmOGKjaQI2SJhFTYXNd673nxE0pN2HrrDktZy4W1vUAg4WhzH92xH3kt0tm7wNFYGm2 -DFKWkoRepqO1pD4r2czYG0eq8kTaT/kD6PAUyz/zg97QwVTjt+gKN02LIFkDMBmhLMi9ER/frslK -xfMnZmaGrGiR/9nmUxwPi1xpZQomyB40w11Re9epnAahNt3ViZS82eQtDF4JbAiXfKM9fJP/P6EU -p8+1Xevb2xzEdt+Iub1FBZUbrvxGakyvSOPOrg/SfuvmbJxPgWp6ZKy7PtXny3YuxadIwVyQD8vI -P/rmMuGNG2+k5o7Y+SlIis5z/iw= ------END CERTIFICATE----- - -GeoTrust Universal CA 2 -======================= ------BEGIN CERTIFICATE----- -MIIFbDCCA1SgAwIBAgIBATANBgkqhkiG9w0BAQUFADBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN -R2VvVHJ1c3QgSW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwHhcNMDQwMzA0 -MDUwMDAwWhcNMjkwMzA0MDUwMDAwWjBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3Qg -SW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwggIiMA0GCSqGSIb3DQEBAQUA -A4ICDwAwggIKAoICAQCzVFLByT7y2dyxUxpZKeexw0Uo5dfR7cXFS6GqdHtXr0om/Nj1XqduGdt0 -DE81WzILAePb63p3NeqqWuDW6KFXlPCQo3RWlEQwAx5cTiuFJnSCegx2oG9NzkEtoBUGFF+3Qs17 -j1hhNNwqCPkuwwGmIkQcTAeC5lvO0Ep8BNMZcyfwqph/Lq9O64ceJHdqXbboW0W63MOhBW9Wjo8Q -JqVJwy7XQYci4E+GymC16qFjwAGXEHm9ADwSbSsVsaxLse4YuU6W3Nx2/zu+z18DwPw76L5GG//a -QMJS9/7jOvdqdzXQ2o3rXhhqMcceujwbKNZrVMaqW9eiLBsZzKIC9ptZvTdrhrVtgrrY6slWvKk2 -WP0+GfPtDCapkzj4T8FdIgbQl+rhrcZV4IErKIM6+vR7IVEAvlI4zs1meaj0gVbi0IMJR1FbUGrP -20gaXT73y/Zl92zxlfgCOzJWgjl6W70viRu/obTo/3+NjN8D8WBOWBFM66M/ECuDmgFz2ZRthAAn -ZqzwcEAJQpKtT5MNYQlRJNiS1QuUYbKHsu3/mjX/hVTK7URDrBs8FmtISgocQIgfksILAAX/8sgC -SqSqqcyZlpwvWOB94b67B9xfBHJcMTTD7F8t4D1kkCLm0ey4Lt1ZrtmhN79UNdxzMk+MBB4zsslG -8dhcyFVQyWi9qLo2CQIDAQABo2MwYTAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR281Xh+qQ2 -+/CfXGJx7Tz0RzgQKzAfBgNVHSMEGDAWgBR281Xh+qQ2+/CfXGJx7Tz0RzgQKzAOBgNVHQ8BAf8E -BAMCAYYwDQYJKoZIhvcNAQEFBQADggIBAGbBxiPz2eAubl/oz66wsCVNK/g7WJtAJDday6sWSf+z -dXkzoS9tcBc0kf5nfo/sm+VegqlVHy/c1FEHEv6sFj4sNcZj/NwQ6w2jqtB8zNHQL1EuxBRa3ugZ -4T7GzKQp5y6EqgYweHZUcyiYWTjgAA1i00J9IZ+uPTqM1fp3DRgrFg5fNuH8KrUwJM/gYwx7WBr+ -mbpCErGR9Hxo4sjoryzqyX6uuyo9DRXcNJW2GHSoag/HtPQTxORb7QrSpJdMKu0vbBKJPfEncKpq -A1Ihn0CoZ1Dy81of398j9tx4TuaYT1U6U+Pv8vSfx3zYWK8pIpe44L2RLrB27FcRz+8pRPPphXpg -Y+RdM4kX2TGq2tbzGDVyz4crL2MjhF2EjD9XoIj8mZEoJmmZ1I+XRL6O1UixpCgp8RW04eWe3fiP -pm8m1wk8OhwRDqZsN/etRIcsKMfYdIKz0G9KV7s1KSegi+ghp4dkNl3M2Basx7InQJJVOCiNUW7d -FGdTbHFcJoRNdVq2fmBWqU2t+5sel/MN2dKXVHfaPRK34B7vCAas+YWH6aLcr34YEoP9VhdBLtUp -gn2Z9DH2canPLAEnpQW5qrJITirvn5NSUZU8UnOOVkwXQMAJKOSLakhT2+zNVVXxxvjpoixMptEm -X36vWkzaH6byHCx+rgIW0lbQL1dTR+iS ------END CERTIFICATE----- - -America Online Root Certification Authority 1 -============================================= ------BEGIN CERTIFICATE----- -MIIDpDCCAoygAwIBAgIBATANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEcMBoGA1UEChMT -QW1lcmljYSBPbmxpbmUgSW5jLjE2MDQGA1UEAxMtQW1lcmljYSBPbmxpbmUgUm9vdCBDZXJ0aWZp -Y2F0aW9uIEF1dGhvcml0eSAxMB4XDTAyMDUyODA2MDAwMFoXDTM3MTExOTIwNDMwMFowYzELMAkG -A1UEBhMCVVMxHDAaBgNVBAoTE0FtZXJpY2EgT25saW5lIEluYy4xNjA0BgNVBAMTLUFtZXJpY2Eg -T25saW5lIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgMTCCASIwDQYJKoZIhvcNAQEBBQAD -ggEPADCCAQoCggEBAKgv6KRpBgNHw+kqmP8ZonCaxlCyfqXfaE0bfA+2l2h9LaaLl+lkhsmj76CG -v2BlnEtUiMJIxUo5vxTjWVXlGbR0yLQFOVwWpeKVBeASrlmLojNoWBym1BW32J/X3HGrfpq/m44z -DyL9Hy7nBzbvYjnF3cu6JRQj3gzGPTzOggjmZj7aUTsWOqMFf6Dch9Wc/HKpoH145LcxVR5lu9Rh -sCFg7RAycsWSJR74kEoYeEfffjA3PlAb2xzTa5qGUwew76wGePiEmf4hjUyAtgyC9mZweRrTT6PP -8c9GsEsPPt2IYriMqQkoO3rHl+Ee5fSfwMCuJKDIodkP1nsmgmkyPacCAwEAAaNjMGEwDwYDVR0T -AQH/BAUwAwEB/zAdBgNVHQ4EFgQUAK3Zo/Z59m50qX8zPYEX10zPM94wHwYDVR0jBBgwFoAUAK3Z -o/Z59m50qX8zPYEX10zPM94wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBBQUAA4IBAQB8itEf -GDeC4Liwo+1WlchiYZwFos3CYiZhzRAW18y0ZTTQEYqtqKkFZu90821fnZmv9ov761KyBZiibyrF -VL0lvV+uyIbqRizBs73B6UlwGBaXCBOMIOAbLjpHyx7kADCVW/RFo8AasAFOq73AI25jP4BKxQft -3OJvx8Fi8eNy1gTIdGcL+oiroQHIb/AUr9KZzVGTfu0uOMe9zkZQPXLjeSWdm4grECDdpbgyn43g -Kd8hdIaC2y+CMMbHNYaz+ZZfRtsMRf3zUMNvxsNIrUam4SdHCh0Om7bCd39j8uB9Gr784N/Xx6ds -sPmuujz9dLQR6FgNgLzTqIA6me11zEZ7 ------END CERTIFICATE----- - -America Online Root Certification Authority 2 -============================================= ------BEGIN CERTIFICATE----- -MIIFpDCCA4ygAwIBAgIBATANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEcMBoGA1UEChMT -QW1lcmljYSBPbmxpbmUgSW5jLjE2MDQGA1UEAxMtQW1lcmljYSBPbmxpbmUgUm9vdCBDZXJ0aWZp -Y2F0aW9uIEF1dGhvcml0eSAyMB4XDTAyMDUyODA2MDAwMFoXDTM3MDkyOTE0MDgwMFowYzELMAkG -A1UEBhMCVVMxHDAaBgNVBAoTE0FtZXJpY2EgT25saW5lIEluYy4xNjA0BgNVBAMTLUFtZXJpY2Eg -T25saW5lIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgMjCCAiIwDQYJKoZIhvcNAQEBBQAD -ggIPADCCAgoCggIBAMxBRR3pPU0Q9oyxQcngXssNt79Hc9PwVU3dxgz6sWYFas14tNwC206B89en -fHG8dWOgXeMHDEjsJcQDIPT/DjsS/5uN4cbVG7RtIuOx238hZK+GvFciKtZHgVdEglZTvYYUAQv8 -f3SkWq7xuhG1m1hagLQ3eAkzfDJHA1zEpYNI9FdWboE2JxhP7JsowtS013wMPgwr38oE18aO6lhO -qKSlGBxsRZijQdEt0sdtjRnxrXm3gT+9BoInLRBYBbV4Bbkv2wxrkJB+FFk4u5QkE+XRnRTf04JN -RvCAOVIyD+OEsnpD8l7eXz8d3eOyG6ChKiMDbi4BFYdcpnV1x5dhvt6G3NRI270qv0pV2uh9UPu0 -gBe4lL8BPeraunzgWGcXuVjgiIZGZ2ydEEdYMtA1fHkqkKJaEBEjNa0vzORKW6fIJ/KD3l67Xnfn -6KVuY8INXWHQjNJsWiEOyiijzirplcdIz5ZvHZIlyMbGwcEMBawmxNJ10uEqZ8A9W6Wa6897Gqid -FEXlD6CaZd4vKL3Ob5Rmg0gp2OpljK+T2WSfVVcmv2/LNzGZo2C7HK2JNDJiuEMhBnIMoVxtRsX6 -Kc8w3onccVvdtjc+31D1uAclJuW8tf48ArO3+L5DwYcRlJ4jbBeKuIonDFRH8KmzwICMoCfrHRnj -B453cMor9H124HhnAgMBAAGjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFE1FwWg4u3Op -aaEg5+31IqEjFNeeMB8GA1UdIwQYMBaAFE1FwWg4u3OpaaEg5+31IqEjFNeeMA4GA1UdDwEB/wQE -AwIBhjANBgkqhkiG9w0BAQUFAAOCAgEAZ2sGuV9FOypLM7PmG2tZTiLMubekJcmnxPBUlgtk87FY -T15R/LKXeydlwuXK5w0MJXti4/qftIe3RUavg6WXSIylvfEWK5t2LHo1YGwRgJfMqZJS5ivmae2p -+DYtLHe/YUjRYwu5W1LtGLBDQiKmsXeu3mnFzcccobGlHBD7GL4acN3Bkku+KVqdPzW+5X1R+FXg -JXUjhx5c3LqdsKyzadsXg8n33gy8CNyRnqjQ1xU3c6U1uPx+xURABsPr+CKAXEfOAuMRn0T//Zoy -zH1kUQ7rVyZ2OuMeIjzCpjbdGe+n/BLzJsBZMYVMnNjP36TMzCmT/5RtdlwTCJfy7aULTd3oyWgO -ZtMADjMSW7yV5TKQqLPGbIOtd+6Lfn6xqavT4fG2wLHqiMDn05DpKJKUe2h7lyoKZy2FAjgQ5ANh -1NolNscIWC2hp1GvMApJ9aZphwctREZ2jirlmjvXGKL8nDgQzMY70rUXOm/9riW99XJZZLF0Kjhf -GEzfz3EEWjbUvy+ZnOjZurGV5gJLIaFb1cFPj65pbVPbAZO1XB4Y3WRayhgoPmMEEf0cjQAPuDff -Z4qdZqkCapH/E8ovXYO8h5Ns3CRRFgQlZvqz2cK6Kb6aSDiCmfS/O0oxGfm/jiEzFMpPVF/7zvuP -cX/9XhmgD0uRuMRUvAawRY8mkaKO/qk= ------END CERTIFICATE----- - -Visa eCommerce Root -=================== ------BEGIN CERTIFICATE----- -MIIDojCCAoqgAwIBAgIQE4Y1TR0/BvLB+WUF1ZAcYjANBgkqhkiG9w0BAQUFADBrMQswCQYDVQQG -EwJVUzENMAsGA1UEChMEVklTQTEvMC0GA1UECxMmVmlzYSBJbnRlcm5hdGlvbmFsIFNlcnZpY2Ug -QXNzb2NpYXRpb24xHDAaBgNVBAMTE1Zpc2EgZUNvbW1lcmNlIFJvb3QwHhcNMDIwNjI2MDIxODM2 -WhcNMjIwNjI0MDAxNjEyWjBrMQswCQYDVQQGEwJVUzENMAsGA1UEChMEVklTQTEvMC0GA1UECxMm -VmlzYSBJbnRlcm5hdGlvbmFsIFNlcnZpY2UgQXNzb2NpYXRpb24xHDAaBgNVBAMTE1Zpc2EgZUNv -bW1lcmNlIFJvb3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvV95WHm6h2mCxlCfL -F9sHP4CFT8icttD0b0/Pmdjh28JIXDqsOTPHH2qLJj0rNfVIsZHBAk4ElpF7sDPwsRROEW+1QK8b -RaVK7362rPKgH1g/EkZgPI2h4H3PVz4zHvtH8aoVlwdVZqW1LS7YgFmypw23RuwhY/81q6UCzyr0 -TP579ZRdhE2o8mCP2w4lPJ9zcc+U30rq299yOIzzlr3xF7zSujtFWsan9sYXiwGd/BmoKoMWuDpI -/k4+oKsGGelT84ATB+0tvz8KPFUgOSwsAGl0lUq8ILKpeeUYiZGo3BxN77t+Nwtd/jmliFKMAGzs -GHxBvfaLdXe6YJ2E5/4tAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEG -MB0GA1UdDgQWBBQVOIMPPyw/cDMezUb+B4wg4NfDtzANBgkqhkiG9w0BAQUFAAOCAQEAX/FBfXxc -CLkr4NWSR/pnXKUTwwMhmytMiUbPWU3J/qVAtmPN3XEolWcRzCSs00Rsca4BIGsDoo8Ytyk6feUW -YFN4PMCvFYP3j1IzJL1kk5fui/fbGKhtcbP3LBfQdCVp9/5rPJS+TUtBjE7ic9DjkCJzQ83z7+pz -zkWKsKZJ/0x9nXGIxHYdkFsd7v3M9+79YKWxehZx0RbQfBI8bGmX265fOZpwLwU8GUYEmSA20GBu -YQa7FkKMcPcw++DbZqMAAb3mLNqRX6BGi01qnD093QVG/na/oAo85ADmJ7f/hC3euiInlhBx6yLt -398znM/jra6O1I7mT1GvFpLgXPYHDw== ------END CERTIFICATE----- - -Certum Root CA -============== ------BEGIN CERTIFICATE----- -MIIDDDCCAfSgAwIBAgIDAQAgMA0GCSqGSIb3DQEBBQUAMD4xCzAJBgNVBAYTAlBMMRswGQYDVQQK -ExJVbml6ZXRvIFNwLiB6IG8uby4xEjAQBgNVBAMTCUNlcnR1bSBDQTAeFw0wMjA2MTExMDQ2Mzla -Fw0yNzA2MTExMDQ2MzlaMD4xCzAJBgNVBAYTAlBMMRswGQYDVQQKExJVbml6ZXRvIFNwLiB6IG8u -by4xEjAQBgNVBAMTCUNlcnR1bSBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAM6x -wS7TT3zNJc4YPk/EjG+AanPIW1H4m9LcuwBcsaD8dQPugfCI7iNS6eYVM42sLQnFdvkrOYCJ5JdL -kKWoePhzQ3ukYbDYWMzhbGZ+nPMJXlVjhNWo7/OxLjBos8Q82KxujZlakE403Daaj4GIULdtlkIJ -89eVgw1BS7Bqa/j8D35in2fE7SZfECYPCE/wpFcozo+47UX2bu4lXapuOb7kky/ZR6By6/qmW6/K -Uz/iDsaWVhFu9+lmqSbYf5VT7QqFiLpPKaVCjF62/IUgAKpoC6EahQGcxEZjgoi2IrHu/qpGWX7P -NSzVttpd90gzFFS269lvzs2I1qsb2pY7HVkCAwEAAaMTMBEwDwYDVR0TAQH/BAUwAwEB/zANBgkq -hkiG9w0BAQUFAAOCAQEAuI3O7+cUus/usESSbLQ5PqKEbq24IXfS1HeCh+YgQYHu4vgRt2PRFze+ -GXYkHAQaTOs9qmdvLdTN/mUxcMUbpgIKumB7bVjCmkn+YzILa+M6wKyrO7Do0wlRjBCDxjTgxSvg -GrZgFCdsMneMvLJymM/NzD+5yCRCFNZX/OYmQ6kd5YCQzgNUKD73P9P4Te1qCjqTE5s7FCMTY5w/ -0YcneeVMUeMBrYVdGjux1XMQpNPyvG5k9VpWkKjHDkx0Dy5xO/fIR/RpbxXyEV6DHpx8Uq79AtoS -qFlnGNu8cN2bsWntgM6JQEhqDjXKKWYVIZQs6GAqm4VKQPNriiTsBhYscw== ------END CERTIFICATE----- - -Comodo AAA Services root -======================== ------BEGIN CERTIFICATE----- -MIIEMjCCAxqgAwIBAgIBATANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS -R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg -TGltaXRlZDEhMB8GA1UEAwwYQUFBIENlcnRpZmljYXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAw -MFoXDTI4MTIzMTIzNTk1OVowezELMAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hl -c3RlcjEQMA4GA1UEBwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxITAfBgNV -BAMMGEFBQSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC -ggEBAL5AnfRu4ep2hxxNRUSOvkbIgwadwSr+GB+O5AL686tdUIoWMQuaBtDFcCLNSS1UY8y2bmhG -C1Pqy0wkwLxyTurxFa70VJoSCsN6sjNg4tqJVfMiWPPe3M/vg4aijJRPn2jymJBGhCfHdr/jzDUs -i14HZGWCwEiwqJH5YZ92IFCokcdmtet4YgNW8IoaE+oxox6gmf049vYnMlhvB/VruPsUK6+3qszW -Y19zjNoFmag4qMsXeDZRrOme9Hg6jc8P2ULimAyrL58OAd7vn5lJ8S3frHRNG5i1R8XlKdH5kBjH -Ypy+g8cmez6KJcfA3Z3mNWgQIJ2P2N7Sw4ScDV7oL8kCAwEAAaOBwDCBvTAdBgNVHQ4EFgQUoBEK -Iz6W8Qfs4q8p74Klf9AwpLQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wewYDVR0f -BHQwcjA4oDagNIYyaHR0cDovL2NybC5jb21vZG9jYS5jb20vQUFBQ2VydGlmaWNhdGVTZXJ2aWNl -cy5jcmwwNqA0oDKGMGh0dHA6Ly9jcmwuY29tb2RvLm5ldC9BQUFDZXJ0aWZpY2F0ZVNlcnZpY2Vz -LmNybDANBgkqhkiG9w0BAQUFAAOCAQEACFb8AvCb6P+k+tZ7xkSAzk/ExfYAWMymtrwUSWgEdujm -7l3sAg9g1o1QGE8mTgHj5rCl7r+8dFRBv/38ErjHT1r0iWAFf2C3BUrz9vHCv8S5dIa2LX1rzNLz -Rt0vxuBqw8M0Ayx9lt1awg6nCpnBBYurDC/zXDrPbDdVCYfeU0BsWO/8tqtlbgT2G9w84FoVxp7Z -8VlIMCFlA2zs6SFz7JsDoeA3raAVGI/6ugLOpyypEBMs1OUIJqsil2D4kF501KKaU73yqWjgom7C -12yxow+ev+to51byrvLjKzg6CYG1a4XXvi3tPxq3smPi9WIsgtRqAEFQ8TmDn5XpNpaYbg== ------END CERTIFICATE----- - -Comodo Secure Services root -=========================== ------BEGIN CERTIFICATE----- -MIIEPzCCAyegAwIBAgIBATANBgkqhkiG9w0BAQUFADB+MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS -R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg -TGltaXRlZDEkMCIGA1UEAwwbU2VjdXJlIENlcnRpZmljYXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAw -MDAwMFoXDTI4MTIzMTIzNTk1OVowfjELMAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFu -Y2hlc3RlcjEQMA4GA1UEBwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxJDAi -BgNVBAMMG1NlY3VyZSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEP -ADCCAQoCggEBAMBxM4KK0HDrc4eCQNUd5MvJDkKQ+d40uaG6EfQlhfPMcm3ye5drswfxdySRXyWP -9nQ95IDC+DwN879A6vfIUtFyb+/Iq0G4bi4XKpVpDM3SHpR7LZQdqnXXs5jLrLxkU0C8j6ysNstc -rbvd4JQX7NFc0L/vpZXJkMWwrPsbQ996CF23uPJAGysnnlDOXmWCiIxe004MeuoIkbY2qitC++rC -oznl2yY4rYsK7hljxxwk3wN42ubqwUcaCwtGCd0C/N7Lh1/XMGNooa7cMqG6vv5Eq2i2pRcV/b3V -p6ea5EQz6YiO/O1R65NxTq0B50SOqy3LqP4BSUjwwN3HaNiS/j0CAwEAAaOBxzCBxDAdBgNVHQ4E -FgQUPNiTiMLAggnMAZkGkyDpnnAJY08wDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8w -gYEGA1UdHwR6MHgwO6A5oDeGNWh0dHA6Ly9jcmwuY29tb2RvY2EuY29tL1NlY3VyZUNlcnRpZmlj -YXRlU2VydmljZXMuY3JsMDmgN6A1hjNodHRwOi8vY3JsLmNvbW9kby5uZXQvU2VjdXJlQ2VydGlm -aWNhdGVTZXJ2aWNlcy5jcmwwDQYJKoZIhvcNAQEFBQADggEBAIcBbSMdflsXfcFhMs+P5/OKlFlm -4J4oqF7Tt/Q05qo5spcWxYJvMqTpjOev/e/C6LlLqqP05tqNZSH7uoDrJiiFGv45jN5bBAS0VPmj -Z55B+glSzAVIqMk/IQQezkhr/IXownuvf7fM+F86/TXGDe+X3EyrEeFryzHRbPtIgKvcnDe4IRRL -DXE97IMzbtFuMhbsmMcWi1mmNKsFVy2T96oTy9IT4rcuO81rUBcJaD61JlfutuC23bkpgHl9j6Pw -pCikFcSF9CfUa7/lXORlAnZUtOM3ZiTTGWHIUhDlizeauan5Hb/qmZJhlv8BzaFfDbxxvA6sCx1H -RR3B7Hzs/Sk= ------END CERTIFICATE----- - -Comodo Trusted Services root -============================ ------BEGIN CERTIFICATE----- -MIIEQzCCAyugAwIBAgIBATANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS -R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg -TGltaXRlZDElMCMGA1UEAwwcVHJ1c3RlZCBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczAeFw0wNDAxMDEw -MDAwMDBaFw0yODEyMzEyMzU5NTlaMH8xCzAJBgNVBAYTAkdCMRswGQYDVQQIDBJHcmVhdGVyIE1h -bmNoZXN0ZXIxEDAOBgNVBAcMB1NhbGZvcmQxGjAYBgNVBAoMEUNvbW9kbyBDQSBMaW1pdGVkMSUw -IwYDVQQDDBxUcnVzdGVkIENlcnRpZmljYXRlIFNlcnZpY2VzMIIBIjANBgkqhkiG9w0BAQEFAAOC -AQ8AMIIBCgKCAQEA33FvNlhTWvI2VFeAxHQIIO0Yfyod5jWaHiWsnOWWfnJSoBVC21ndZHoa0Lh7 -3TkVvFVIxO06AOoxEbrycXQaZ7jPM8yoMa+j49d/vzMtTGo87IvDktJTdyR0nAducPy9C1t2ul/y -/9c3S0pgePfw+spwtOpZqqPOSC+pw7ILfhdyFgymBwwbOM/JYrc/oJOlh0Hyt3BAd9i+FHzjqMB6 -juljatEPmsbS9Is6FARW1O24zG71++IsWL1/T2sr92AkWCTOJu80kTrV44HQsvAEAtdbtz6SrGsS -ivnkBbA7kUlcsutT6vifR4buv5XAwAaf0lteERv0xwQ1KdJVXOTt6wIDAQABo4HJMIHGMB0GA1Ud -DgQWBBTFe1i97doladL3WRaoszLAeydb9DAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB -/zCBgwYDVR0fBHwwejA8oDqgOIY2aHR0cDovL2NybC5jb21vZG9jYS5jb20vVHJ1c3RlZENlcnRp -ZmljYXRlU2VydmljZXMuY3JsMDqgOKA2hjRodHRwOi8vY3JsLmNvbW9kby5uZXQvVHJ1c3RlZENl -cnRpZmljYXRlU2VydmljZXMuY3JsMA0GCSqGSIb3DQEBBQUAA4IBAQDIk4E7ibSvuIQSTI3S8Ntw -uleGFTQQuS9/HrCoiWChisJ3DFBKmwCL2Iv0QeLQg4pKHBQGsKNoBXAxMKdTmw7pSqBYaWcOrp32 -pSxBvzwGa+RZzG0Q8ZZvH9/0BAKkn0U+yNj6NkZEUD+Cl5EfKNsYEYwq5GWDVxISjBc/lDb+XbDA -BHcTuPQV1T84zJQ6VdCsmPW6AF/ghhmBeC8owH7TzEIK9a5QoNE+xqFx7D+gIIxmOom0jtTYsU0l -R+4viMi14QVFwL4Ucd56/Y57fU0IlqUSc/AtyjcndBInTMu2l+nZrghtWjlA3QVHdWpaIbOjGM9O -9y5Xt5hwXsjEeLBi ------END CERTIFICATE----- - -QuoVadis Root CA -================ ------BEGIN CERTIFICATE----- -MIIF0DCCBLigAwIBAgIEOrZQizANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJCTTEZMBcGA1UE -ChMQUXVvVmFkaXMgTGltaXRlZDElMCMGA1UECxMcUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0 -eTEuMCwGA1UEAxMlUXVvVmFkaXMgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wMTAz -MTkxODMzMzNaFw0yMTAzMTcxODMzMzNaMH8xCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRp -cyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MS4wLAYDVQQD -EyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEF -AAOCAQ8AMIIBCgKCAQEAv2G1lVO6V/z68mcLOhrfEYBklbTRvM16z/Ypli4kVEAkOPcahdxYTMuk -J0KX0J+DisPkBgNbAKVRHnAEdOLB1Dqr1607BxgFjv2DrOpm2RgbaIr1VxqYuvXtdj182d6UajtL -F8HVj71lODqV0D1VNk7feVcxKh7YWWVJWCCYfqtffp/p1k3sg3Spx2zY7ilKhSoGFPlU5tPaZQeL -YzcS19Dsw3sgQUSj7cugF+FxZc4dZjH3dgEZyH0DWLaVSR2mEiboxgx24ONmy+pdpibu5cxfvWen -AScOospUxbF6lR1xHkopigPcakXBpBlebzbNw6Kwt/5cOOJSvPhEQ+aQuwIDAQABo4ICUjCCAk4w -PQYIKwYBBQUHAQEEMTAvMC0GCCsGAQUFBzABhiFodHRwczovL29jc3AucXVvdmFkaXNvZmZzaG9y -ZS5jb20wDwYDVR0TAQH/BAUwAwEB/zCCARoGA1UdIASCAREwggENMIIBCQYJKwYBBAG+WAABMIH7 -MIHUBggrBgEFBQcCAjCBxxqBxFJlbGlhbmNlIG9uIHRoZSBRdW9WYWRpcyBSb290IENlcnRpZmlj -YXRlIGJ5IGFueSBwYXJ0eSBhc3N1bWVzIGFjY2VwdGFuY2Ugb2YgdGhlIHRoZW4gYXBwbGljYWJs -ZSBzdGFuZGFyZCB0ZXJtcyBhbmQgY29uZGl0aW9ucyBvZiB1c2UsIGNlcnRpZmljYXRpb24gcHJh -Y3RpY2VzLCBhbmQgdGhlIFF1b1ZhZGlzIENlcnRpZmljYXRlIFBvbGljeS4wIgYIKwYBBQUHAgEW -Fmh0dHA6Ly93d3cucXVvdmFkaXMuYm0wHQYDVR0OBBYEFItLbe3TKbkGGew5Oanwl4Rqy+/fMIGu -BgNVHSMEgaYwgaOAFItLbe3TKbkGGew5Oanwl4Rqy+/foYGEpIGBMH8xCzAJBgNVBAYTAkJNMRkw -FwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0 -aG9yaXR5MS4wLAYDVQQDEyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggQ6 -tlCLMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAitQUtf70mpKnGdSkfnIYj9lo -fFIk3WdvOXrEql494liwTXCYhGHoG+NpGA7O+0dQoE7/8CQfvbLO9Sf87C9TqnN7Az10buYWnuul -LsS/VidQK2K6vkscPFVcQR0kvoIgR13VRH56FmjffU1RcHhXHTMe/QKZnAzNCgVPx7uOpHX6Sm2x -gI4JVrmcGmD+XcHXetwReNDWXcG31a0ymQM6isxUJTkxgXsTIlG6Rmyhu576BGxJJnSP0nPrzDCi -5upZIof4l/UO/erMkqQWxFIY6iHOsfHmhIHluqmGKPJDWl0Snawe2ajlCmqnf6CHKc/yiU3U7MXi -5nrQNiOKSnQ2+Q== ------END CERTIFICATE----- - -QuoVadis Root CA 2 -================== ------BEGIN CERTIFICATE----- -MIIFtzCCA5+gAwIBAgICBQkwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT -EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMjAeFw0wNjExMjQx -ODI3MDBaFw0zMTExMjQxODIzMzNaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM -aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDIwggIiMA0GCSqGSIb3DQEBAQUAA4IC -DwAwggIKAoICAQCaGMpLlA0ALa8DKYrwD4HIrkwZhR0In6spRIXzL4GtMh6QRr+jhiYaHv5+HBg6 -XJxgFyo6dIMzMH1hVBHL7avg5tKifvVrbxi3Cgst/ek+7wrGsxDp3MJGF/hd/aTa/55JWpzmM+Yk -lvc/ulsrHHo1wtZn/qtmUIttKGAr79dgw8eTvI02kfN/+NsRE8Scd3bBrrcCaoF6qUWD4gXmuVbB -lDePSHFjIuwXZQeVikvfj8ZaCuWw419eaxGrDPmF60Tp+ARz8un+XJiM9XOva7R+zdRcAitMOeGy -lZUtQofX1bOQQ7dsE/He3fbE+Ik/0XX1ksOR1YqI0JDs3G3eicJlcZaLDQP9nL9bFqyS2+r+eXyt -66/3FsvbzSUr5R/7mp/iUcw6UwxI5g69ybR2BlLmEROFcmMDBOAENisgGQLodKcftslWZvB1Jdxn -wQ5hYIizPtGo/KPaHbDRsSNU30R2be1B2MGyIrZTHN81Hdyhdyox5C315eXbyOD/5YDXC2Og/zOh -D7osFRXql7PSorW+8oyWHhqPHWykYTe5hnMz15eWniN9gqRMgeKh0bpnX5UHoycR7hYQe7xFSkyy -BNKr79X9DFHOUGoIMfmR2gyPZFwDwzqLID9ujWc9Otb+fVuIyV77zGHcizN300QyNQliBJIWENie -J0f7OyHj+OsdWwIDAQABo4GwMIGtMA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1Ud -DgQWBBQahGK8SEwzJQTU7tD2A8QZRtGUazBuBgNVHSMEZzBlgBQahGK8SEwzJQTU7tD2A8QZRtGU -a6FJpEcwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMT -ElF1b1ZhZGlzIFJvb3QgQ0EgMoICBQkwDQYJKoZIhvcNAQEFBQADggIBAD4KFk2fBluornFdLwUv -Z+YTRYPENvbzwCYMDbVHZF34tHLJRqUDGCdViXh9duqWNIAXINzng/iN/Ae42l9NLmeyhP3ZRPx3 -UIHmfLTJDQtyU/h2BwdBR5YM++CCJpNVjP4iH2BlfF/nJrP3MpCYUNQ3cVX2kiF495V5+vgtJodm -VjB3pjd4M1IQWK4/YY7yarHvGH5KWWPKjaJW1acvvFYfzznB4vsKqBUsfU16Y8Zsl0Q80m/DShcK -+JDSV6IZUaUtl0HaB0+pUNqQjZRG4T7wlP0QADj1O+hA4bRuVhogzG9Yje0uRY/W6ZM/57Es3zrW -IozchLsib9D45MY56QSIPMO661V6bYCZJPVsAfv4l7CUW+v90m/xd2gNNWQjrLhVoQPRTUIZ3Ph1 -WVaj+ahJefivDrkRoHy3au000LYmYjgahwz46P0u05B/B5EqHdZ+XIWDmbA4CD/pXvk1B+TJYm5X -f6dQlfe6yJvmjqIBxdZmv3lh8zwc4bmCXF2gw+nYSL0ZohEUGW6yhhtoPkg3Goi3XZZenMfvJ2II -4pEZXNLxId26F0KCl3GBUzGpn/Z9Yr9y4aOTHcyKJloJONDO1w2AFrR4pTqHTI2KpdVGl/IsELm8 -VCLAAVBpQ570su9t+Oza8eOx79+Rj1QqCyXBJhnEUhAFZdWCEOrCMc0u ------END CERTIFICATE----- - -QuoVadis Root CA 3 -================== ------BEGIN CERTIFICATE----- -MIIGnTCCBIWgAwIBAgICBcYwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT -EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMzAeFw0wNjExMjQx -OTExMjNaFw0zMTExMjQxOTA2NDRaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM -aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4IC -DwAwggIKAoICAQDMV0IWVJzmmNPTTe7+7cefQzlKZbPoFog02w1ZkXTPkrgEQK0CSzGrvI2RaNgg -DhoB4hp7Thdd4oq3P5kazethq8Jlph+3t723j/z9cI8LoGe+AaJZz3HmDyl2/7FWeUUrH556VOij -KTVopAFPD6QuN+8bv+OPEKhyq1hX51SGyMnzW9os2l2ObjyjPtr7guXd8lyyBTNvijbO0BNO/79K -DDRMpsMhvVAEVeuxu537RR5kFd5VAYwCdrXLoT9CabwvvWhDFlaJKjdhkf2mrk7AyxRllDdLkgbv -BNDInIjbC3uBr7E9KsRlOni27tyAsdLTmZw67mtaa7ONt9XOnMK+pUsvFrGeaDsGb659n/je7Mwp -p5ijJUMv7/FfJuGITfhebtfZFG4ZM2mnO4SJk8RTVROhUXhA+LjJou57ulJCg54U7QVSWllWp5f8 -nT8KKdjcT5EOE7zelaTfi5m+rJsziO+1ga8bxiJTyPbH7pcUsMV8eFLI8M5ud2CEpukqdiDtWAEX -MJPpGovgc2PZapKUSU60rUqFxKMiMPwJ7Wgic6aIDFUhWMXhOp8q3crhkODZc6tsgLjoC2SToJyM -Gf+z0gzskSaHirOi4XCPLArlzW1oUevaPwV/izLmE1xr/l9A4iLItLRkT9a6fUg+qGkM17uGcclz -uD87nSVL2v9A6wIDAQABo4IBlTCCAZEwDwYDVR0TAQH/BAUwAwEB/zCB4QYDVR0gBIHZMIHWMIHT -BgkrBgEEAb5YAAMwgcUwgZMGCCsGAQUFBwICMIGGGoGDQW55IHVzZSBvZiB0aGlzIENlcnRpZmlj -YXRlIGNvbnN0aXR1dGVzIGFjY2VwdGFuY2Ugb2YgdGhlIFF1b1ZhZGlzIFJvb3QgQ0EgMyBDZXJ0 -aWZpY2F0ZSBQb2xpY3kgLyBDZXJ0aWZpY2F0aW9uIFByYWN0aWNlIFN0YXRlbWVudC4wLQYIKwYB -BQUHAgEWIWh0dHA6Ly93d3cucXVvdmFkaXNnbG9iYWwuY29tL2NwczALBgNVHQ8EBAMCAQYwHQYD -VR0OBBYEFPLAE+CCQz777i9nMpY1XNu4ywLQMG4GA1UdIwRnMGWAFPLAE+CCQz777i9nMpY1XNu4 -ywLQoUmkRzBFMQswCQYDVQQGEwJCTTEZMBcGA1UEChMQUXVvVmFkaXMgTGltaXRlZDEbMBkGA1UE -AxMSUXVvVmFkaXMgUm9vdCBDQSAzggIFxjANBgkqhkiG9w0BAQUFAAOCAgEAT62gLEz6wPJv92ZV -qyM07ucp2sNbtrCD2dDQ4iH782CnO11gUyeim/YIIirnv6By5ZwkajGxkHon24QRiSemd1o417+s -hvzuXYO8BsbRd2sPbSQvS3pspweWyuOEn62Iix2rFo1bZhfZFvSLgNLd+LJ2w/w4E6oM3kJpK27z -POuAJ9v1pkQNn1pVWQvVDVJIxa6f8i+AxeoyUDUSly7B4f/xI4hROJ/yZlZ25w9Rl6VSDE1JUZU2 -Pb+iSwwQHYaZTKrzchGT5Or2m9qoXadNt54CrnMAyNojA+j56hl0YgCUyyIgvpSnWbWCar6ZeXqp -8kokUvd0/bpO5qgdAm6xDYBEwa7TIzdfu4V8K5Iu6H6li92Z4b8nby1dqnuH/grdS/yO9SbkbnBC -bjPsMZ57k8HkyWkaPcBrTiJt7qtYTcbQQcEr6k8Sh17rRdhs9ZgC06DYVYoGmRmioHfRMJ6szHXu -g/WwYjnPbFfiTNKRCw51KBuav/0aQ/HKd/s7j2G4aSgWQgRecCocIdiP4b0jWy10QJLZYxkNc91p -vGJHvOB0K7Lrfb5BG7XARsWhIstfTsEokt4YutUqKLsRixeTmJlglFwjz1onl14LBQaTNx47aTbr -qZ5hHY8y2o4M1nQ+ewkk2gF3R8Q7zTSMmfXK4SVhM7JZG+Ju1zdXtg2pEto= ------END CERTIFICATE----- - -Security Communication Root CA -============================== ------BEGIN CERTIFICATE----- -MIIDWjCCAkKgAwIBAgIBADANBgkqhkiG9w0BAQUFADBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP -U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw -HhcNMDMwOTMwMDQyMDQ5WhcNMjMwOTMwMDQyMDQ5WjBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP -U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw -ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCzs/5/022x7xZ8V6UMbXaKL0u/ZPtM7orw -8yl89f/uKuDp6bpbZCKamm8sOiZpUQWZJtzVHGpxxpp9Hp3dfGzGjGdnSj74cbAZJ6kJDKaVv0uM -DPpVmDvY6CKhS3E4eayXkmmziX7qIWgGmBSWh9JhNrxtJ1aeV+7AwFb9Ms+k2Y7CI9eNqPPYJayX -5HA49LY6tJ07lyZDo6G8SVlyTCMwhwFY9k6+HGhWZq/NQV3Is00qVUarH9oe4kA92819uZKAnDfd -DJZkndwi92SL32HeFZRSFaB9UslLqCHJxrHty8OVYNEP8Ktw+N/LTX7s1vqr2b1/VPKl6Xn62dZ2 -JChzAgMBAAGjPzA9MB0GA1UdDgQWBBSgc0mZaNyFW2XjmygvV5+9M7wHSDALBgNVHQ8EBAMCAQYw -DwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAaECpqLvkT115swW1F7NgE+vGkl3g -0dNq/vu+m22/xwVtWSDEHPC32oRYAmP6SBbvT6UL90qY8j+eG61Ha2POCEfrUj94nK9NrvjVT8+a -mCoQQTlSxN3Zmw7vkwGusi7KaEIkQmywszo+zenaSMQVy+n5Bw+SUEmK3TGXX8npN6o7WWWXlDLJ -s58+OmJYxUmtYg5xpTKqL8aJdkNAExNnPaJUJRDL8Try2frbSVa7pv6nQTXD4IhhyYjH3zYQIphZ -6rBK+1YWc26sTfcioU+tHXotRSflMMFe8toTyyVCUZVHA4xsIcx0Qu1T/zOLjw9XARYvz6buyXAi -FL39vmwLAw== ------END CERTIFICATE----- - -Sonera Class 2 Root CA -====================== ------BEGIN CERTIFICATE----- -MIIDIDCCAgigAwIBAgIBHTANBgkqhkiG9w0BAQUFADA5MQswCQYDVQQGEwJGSTEPMA0GA1UEChMG -U29uZXJhMRkwFwYDVQQDExBTb25lcmEgQ2xhc3MyIENBMB4XDTAxMDQwNjA3Mjk0MFoXDTIxMDQw -NjA3Mjk0MFowOTELMAkGA1UEBhMCRkkxDzANBgNVBAoTBlNvbmVyYTEZMBcGA1UEAxMQU29uZXJh -IENsYXNzMiBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJAXSjWdyvANlsdE+hY3 -/Ei9vX+ALTU74W+oZ6m/AxxNjG8yR9VBaKQTBME1DJqEQ/xcHf+Js+gXGM2RX/uJ4+q/Tl18GybT -dXnt5oTjV+WtKcT0OijnpXuENmmz/V52vaMtmdOQTiMofRhj8VQ7Jp12W5dCsv+u8E7s3TmVToMG -f+dJQMjFAbJUWmYdPfz56TwKnoG4cPABi+QjVHzIrviQHgCWctRUz2EjvOr7nQKV0ba5cTppCD8P -tOFCx4j1P5iop7oc4HFx71hXgVB6XGt0Rg6DA5jDjqhu8nYybieDwnPz3BjotJPqdURrBGAgcVeH -nfO+oJAjPYok4doh28MCAwEAAaMzMDEwDwYDVR0TAQH/BAUwAwEB/zARBgNVHQ4ECgQISqCqWITT -XjwwCwYDVR0PBAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQBazof5FnIVV0sd2ZvnoiYw7JNn39Yt -0jSv9zilzqsWuasvfDXLrNAPtEwr/IDva4yRXzZ299uzGxnq9LIR/WFxRL8oszodv7ND6J+/3DEI -cbCdjdY0RzKQxmUk96BKfARzjzlvF4xytb1LyHr4e4PDKE6cCepnP7JnBBvDFNr450kkkdAdavph -Oe9r5yF1BgfYErQhIHBCcYHaPJo2vqZbDWpsmh+Re/n570K6Tk6ezAyNlNzZRZxe7EJQY670XcSx -EtzKO6gunRRaBXW37Ndj4ro1tgQIkejanZz2ZrUYrAqmVCY0M9IbwdR/GjqOC6oybtv8TyWf2TLH -llpwrN9M ------END CERTIFICATE----- - -Staat der Nederlanden Root CA -============================= ------BEGIN CERTIFICATE----- -MIIDujCCAqKgAwIBAgIEAJiWijANBgkqhkiG9w0BAQUFADBVMQswCQYDVQQGEwJOTDEeMBwGA1UE -ChMVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSYwJAYDVQQDEx1TdGFhdCBkZXIgTmVkZXJsYW5kZW4g -Um9vdCBDQTAeFw0wMjEyMTcwOTIzNDlaFw0xNTEyMTYwOTE1MzhaMFUxCzAJBgNVBAYTAk5MMR4w -HAYDVQQKExVTdGFhdCBkZXIgTmVkZXJsYW5kZW4xJjAkBgNVBAMTHVN0YWF0IGRlciBOZWRlcmxh -bmRlbiBSb290IENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmNK1URF6gaYUmHFt -vsznExvWJw56s2oYHLZhWtVhCb/ekBPHZ+7d89rFDBKeNVU+LCeIQGv33N0iYfXCxw719tV2U02P -jLwYdjeFnejKScfST5gTCaI+Ioicf9byEGW07l8Y1Rfj+MX94p2i71MOhXeiD+EwR+4A5zN9RGca -C1Hoi6CeUJhoNFIfLm0B8mBF8jHrqTFoKbt6QZ7GGX+UtFE5A3+y3qcym7RHjm+0Sq7lr7HcsBth -vJly3uSJt3omXdozSVtSnA71iq3DuD3oBmrC1SoLbHuEvVYFy4ZlkuxEK7COudxwC0barbxjiDn6 -22r+I/q85Ej0ZytqERAhSQIDAQABo4GRMIGOMAwGA1UdEwQFMAMBAf8wTwYDVR0gBEgwRjBEBgRV -HSAAMDwwOgYIKwYBBQUHAgEWLmh0dHA6Ly93d3cucGtpb3ZlcmhlaWQubmwvcG9saWNpZXMvcm9v -dC1wb2xpY3kwDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBSofeu8Y6R0E3QA7Jbg0zTBLL9s+DAN -BgkqhkiG9w0BAQUFAAOCAQEABYSHVXQ2YcG70dTGFagTtJ+k/rvuFbQvBgwp8qiSpGEN/KtcCFtR -EytNwiphyPgJWPwtArI5fZlmgb9uXJVFIGzmeafR2Bwp/MIgJ1HI8XxdNGdphREwxgDS1/PTfLbw -MVcoEoJz6TMvplW0C5GUR5z6u3pCMuiufi3IvKwUv9kP2Vv8wfl6leF9fpb8cbDCTMjfRTTJzg3y -nGQI0DvDKcWy7ZAEwbEpkcUwb8GpcjPM/l0WFywRaed+/sWDCN+83CI6LiBpIzlWYGeQiy52OfsR -iJf2fL1LuCAWZwWN4jvBcj+UlTfHXbme2JOhF4//DGYVwSR8MnwDHTuhWEUykw== ------END CERTIFICATE----- - -TDC Internet Root CA -==================== ------BEGIN CERTIFICATE----- -MIIEKzCCAxOgAwIBAgIEOsylTDANBgkqhkiG9w0BAQUFADBDMQswCQYDVQQGEwJESzEVMBMGA1UE -ChMMVERDIEludGVybmV0MR0wGwYDVQQLExRUREMgSW50ZXJuZXQgUm9vdCBDQTAeFw0wMTA0MDUx -NjMzMTdaFw0yMTA0MDUxNzAzMTdaMEMxCzAJBgNVBAYTAkRLMRUwEwYDVQQKEwxUREMgSW50ZXJu -ZXQxHTAbBgNVBAsTFFREQyBJbnRlcm5ldCBSb290IENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A -MIIBCgKCAQEAxLhAvJHVYx/XmaCLDEAedLdInUaMArLgJF/wGROnN4NrXceO+YQwzho7+vvOi20j -xsNuZp+Jpd/gQlBn+h9sHvTQBda/ytZO5GhgbEaqHF1j4QeGDmUApy6mcca8uYGoOn0a0vnRrEvL -znWv3Hv6gXPU/Lq9QYjUdLP5Xjg6PEOo0pVOd20TDJ2PeAG3WiAfAzc14izbSysseLlJ28TQx5yc -5IogCSEWVmb/Bexb4/DPqyQkXsN/cHoSxNK1EKC2IeGNeGlVRGn1ypYcNIUXJXfi9i8nmHj9eQY6 -otZaQ8H/7AQ77hPv01ha/5Lr7K7a8jcDR0G2l8ktCkEiu7vmpwIDAQABo4IBJTCCASEwEQYJYIZI -AYb4QgEBBAQDAgAHMGUGA1UdHwReMFwwWqBYoFakVDBSMQswCQYDVQQGEwJESzEVMBMGA1UEChMM -VERDIEludGVybmV0MR0wGwYDVQQLExRUREMgSW50ZXJuZXQgUm9vdCBDQTENMAsGA1UEAxMEQ1JM -MTArBgNVHRAEJDAigA8yMDAxMDQwNTE2MzMxN1qBDzIwMjEwNDA1MTcwMzE3WjALBgNVHQ8EBAMC -AQYwHwYDVR0jBBgwFoAUbGQBx/2FbazI2p5QCIUItTxWqFAwHQYDVR0OBBYEFGxkAcf9hW2syNqe -UAiFCLU8VqhQMAwGA1UdEwQFMAMBAf8wHQYJKoZIhvZ9B0EABBAwDhsIVjUuMDo0LjADAgSQMA0G -CSqGSIb3DQEBBQUAA4IBAQBOQ8zR3R0QGwZ/t6T609lN+yOfI1Rb5osvBCiLtSdtiaHsmGnc540m -gwV5dOy0uaOXwTUA/RXaOYE6lTGQ3pfphqiZdwzlWqCE/xIWrG64jcN7ksKsLtB9KOy282A4aW8+ -2ARVPp7MVdK6/rtHBNcK2RYKNCn1WBPVT8+PVkuzHu7TmHnaCB4Mb7j4Fifvwm899qNLPg7kbWzb -O0ESm70NRyN/PErQr8Cv9u8btRXE64PECV90i9kR+8JWsTz4cMo0jUNAE4z9mQNUecYu6oah9jrU -Cbz0vGbMPVjQV0kK7iXiQe4T+Zs4NNEA9X7nlB38aQNiuJkFBT1reBK9sG9l ------END CERTIFICATE----- - -UTN DATACorp SGC Root CA -======================== ------BEGIN CERTIFICATE----- -MIIEXjCCA0agAwIBAgIQRL4Mi1AAIbQR0ypoBqmtaTANBgkqhkiG9w0BAQUFADCBkzELMAkGA1UE -BhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2UgQ2l0eTEeMBwGA1UEChMVVGhl -IFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExhodHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xGzAZ -BgNVBAMTElVUTiAtIERBVEFDb3JwIFNHQzAeFw05OTA2MjQxODU3MjFaFw0xOTA2MjQxOTA2MzBa -MIGTMQswCQYDVQQGEwJVUzELMAkGA1UECBMCVVQxFzAVBgNVBAcTDlNhbHQgTGFrZSBDaXR5MR4w -HAYDVQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxITAfBgNVBAsTGGh0dHA6Ly93d3cudXNlcnRy -dXN0LmNvbTEbMBkGA1UEAxMSVVROIC0gREFUQUNvcnAgU0dDMIIBIjANBgkqhkiG9w0BAQEFAAOC -AQ8AMIIBCgKCAQEA3+5YEKIrblXEjr8uRgnn4AgPLit6E5Qbvfa2gI5lBZMAHryv4g+OGQ0SR+ys -raP6LnD43m77VkIVni5c7yPeIbkFdicZD0/Ww5y0vpQZY/KmEQrrU0icvvIpOxboGqBMpsn0GFlo -wHDyUwDAXlCCpVZvNvlK4ESGoE1O1kduSUrLZ9emxAW5jh70/P/N5zbgnAVssjMiFdC04MwXwLLA -9P4yPykqlXvY8qdOD1R8oQ2AswkDwf9c3V6aPryuvEeKaq5xyh+xKrhfQgUL7EYw0XILyulWbfXv -33i+Ybqypa4ETLyorGkVl73v67SMvzX41MPRKA5cOp9wGDMgd8SirwIDAQABo4GrMIGoMAsGA1Ud -DwQEAwIBxjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRTMtGzz3/64PGgXYVOktKeRR20TzA9 -BgNVHR8ENjA0MDKgMKAuhixodHRwOi8vY3JsLnVzZXJ0cnVzdC5jb20vVVROLURBVEFDb3JwU0dD -LmNybDAqBgNVHSUEIzAhBggrBgEFBQcDAQYKKwYBBAGCNwoDAwYJYIZIAYb4QgQBMA0GCSqGSIb3 -DQEBBQUAA4IBAQAnNZcAiosovcYzMB4p/OL31ZjUQLtgyr+rFywJNn9Q+kHcrpY6CiM+iVnJowft -Gzet/Hy+UUla3joKVAgWRcKZsYfNjGjgaQPpxE6YsjuMFrMOoAyYUJuTqXAJyCyjj98C5OBxOvG0 -I3KgqgHf35g+FFCgMSa9KOlaMCZ1+XtgHI3zzVAmbQQnmt/VDUVHKWss5nbZqSl9Mt3JNjy9rjXx -EZ4du5A/EkdOjtd+D2JzHVImOBwYSf0wdJrE5SIv2MCN7ZF6TACPcn9d2t0bi0Vr591pl6jFVkwP -DPafepE39peC4N1xaf92P2BNPM/3mfnGV/TJVTl4uix5yaaIK/QI ------END CERTIFICATE----- - -UTN USERFirst Hardware Root CA -============================== ------BEGIN CERTIFICATE----- -MIIEdDCCA1ygAwIBAgIQRL4Mi1AAJLQR0zYq/mUK/TANBgkqhkiG9w0BAQUFADCBlzELMAkGA1UE -BhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2UgQ2l0eTEeMBwGA1UEChMVVGhl -IFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExhodHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xHzAd -BgNVBAMTFlVUTi1VU0VSRmlyc3QtSGFyZHdhcmUwHhcNOTkwNzA5MTgxMDQyWhcNMTkwNzA5MTgx -OTIyWjCBlzELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2UgQ2l0 -eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExhodHRwOi8vd3d3LnVz -ZXJ0cnVzdC5jb20xHzAdBgNVBAMTFlVUTi1VU0VSRmlyc3QtSGFyZHdhcmUwggEiMA0GCSqGSIb3 -DQEBAQUAA4IBDwAwggEKAoIBAQCx98M4P7Sof885glFn0G2f0v9Y8+efK+wNiVSZuTiZFvfgIXlI -wrthdBKWHTxqctU8EGc6Oe0rE81m65UJM6Rsl7HoxuzBdXmcRl6Nq9Bq/bkqVRcQVLMZ8Jr28bFd -tqdt++BxF2uiiPsA3/4aMXcMmgF6sTLjKwEHOG7DpV4jvEWbe1DByTCP2+UretNb+zNAHqDVmBe8 -i4fDidNdoI6yqqr2jmmIBsX6iSHzCJ1pLgkzmykNRg+MzEk0sGlRvfkGzWitZky8PqxhvQqIDsjf -Pe58BEydCl5rkdbux+0ojatNh4lz0G6k0B4WixThdkQDf2Os5M1JnMWS9KsyoUhbAgMBAAGjgbkw -gbYwCwYDVR0PBAQDAgHGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFKFyXyYbKJhDlV0HN9WF -lp1L0sNFMEQGA1UdHwQ9MDswOaA3oDWGM2h0dHA6Ly9jcmwudXNlcnRydXN0LmNvbS9VVE4tVVNF -UkZpcnN0LUhhcmR3YXJlLmNybDAxBgNVHSUEKjAoBggrBgEFBQcDAQYIKwYBBQUHAwUGCCsGAQUF -BwMGBggrBgEFBQcDBzANBgkqhkiG9w0BAQUFAAOCAQEARxkP3nTGmZev/K0oXnWO6y1n7k57K9cM -//bey1WiCuFMVGWTYGufEpytXoMs61quwOQt9ABjHbjAbPLPSbtNk28GpgoiskliCE7/yMgUsogW -XecB5BKV5UU0s4tpvc+0hY91UZ59Ojg6FEgSxvunOxqNDYJAB+gECJChicsZUN/KHAG8HQQZexB2 -lzvukJDKxA4fFm517zP4029bHpbj4HR3dHuKom4t3XbWOTCC8KucUvIqx69JXn7HaOWCgchqJ/kn -iCrVWFCVH/A7HFe7fRQ5YiuayZSSKqMiDP+JJn1fIytH1xUdqWqeUQ0qUZ6B+dQ7XnASfxAynB67 -nfhmqA== ------END CERTIFICATE----- - -Camerfirma Chambers of Commerce Root -==================================== ------BEGIN CERTIFICATE----- -MIIEvTCCA6WgAwIBAgIBADANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJFVTEnMCUGA1UEChMe -QUMgQ2FtZXJmaXJtYSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQLExpodHRwOi8vd3d3LmNoYW1i -ZXJzaWduLm9yZzEiMCAGA1UEAxMZQ2hhbWJlcnMgb2YgQ29tbWVyY2UgUm9vdDAeFw0wMzA5MzAx -NjEzNDNaFw0zNzA5MzAxNjEzNDRaMH8xCzAJBgNVBAYTAkVVMScwJQYDVQQKEx5BQyBDYW1lcmZp -cm1hIFNBIENJRiBBODI3NDMyODcxIzAhBgNVBAsTGmh0dHA6Ly93d3cuY2hhbWJlcnNpZ24ub3Jn -MSIwIAYDVQQDExlDaGFtYmVycyBvZiBDb21tZXJjZSBSb290MIIBIDANBgkqhkiG9w0BAQEFAAOC -AQ0AMIIBCAKCAQEAtzZV5aVdGDDg2olUkfzIx1L4L1DZ77F1c2VHfRtbunXF/KGIJPov7coISjlU -xFF6tdpg6jg8gbLL8bvZkSM/SAFwdakFKq0fcfPJVD0dBmpAPrMMhe5cG3nCYsS4No41XQEMIwRH -NaqbYE6gZj3LJgqcQKH0XZi/caulAGgq7YN6D6IUtdQis4CwPAxaUWktWBiP7Zme8a7ileb2R6jW -DA+wWFjbw2Y3npuRVDM30pQcakjJyfKl2qUMI/cjDpwyVV5xnIQFUZot/eZOKjRa3spAN2cMVCFV -d9oKDMyXroDclDZK9D7ONhMeU+SsTjoF7Nuucpw4i9A5O4kKPnf+dQIBA6OCAUQwggFAMBIGA1Ud -EwEB/wQIMAYBAf8CAQwwPAYDVR0fBDUwMzAxoC+gLYYraHR0cDovL2NybC5jaGFtYmVyc2lnbi5v -cmcvY2hhbWJlcnNyb290LmNybDAdBgNVHQ4EFgQU45T1sU3p26EpW1eLTXYGduHRooowDgYDVR0P -AQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzAnBgNVHREEIDAegRxjaGFtYmVyc3Jvb3RAY2hh -bWJlcnNpZ24ub3JnMCcGA1UdEgQgMB6BHGNoYW1iZXJzcm9vdEBjaGFtYmVyc2lnbi5vcmcwWAYD -VR0gBFEwTzBNBgsrBgEEAYGHLgoDATA+MDwGCCsGAQUFBwIBFjBodHRwOi8vY3BzLmNoYW1iZXJz -aWduLm9yZy9jcHMvY2hhbWJlcnNyb290Lmh0bWwwDQYJKoZIhvcNAQEFBQADggEBAAxBl8IahsAi -fJ/7kPMa0QOx7xP5IV8EnNrJpY0nbJaHkb5BkAFyk+cefV/2icZdp0AJPaxJRUXcLo0waLIJuvvD -L8y6C98/d3tGfToSJI6WjzwFCm/SlCgdbQzALogi1djPHRPH8EjX1wWnz8dHnjs8NMiAT9QUu/wN -UPf6s+xCX6ndbcj0dc97wXImsQEcXCz9ek60AcUFV7nnPKoF2YjpB0ZBzu9Bga5Y34OirsrXdx/n -ADydb47kMgkdTXg0eDQ8lJsm7U9xxhl6vSAiSFr+S30Dt+dYvsYyTnQeaN2oaFuzPu5ifdmA6Ap1 -erfutGWaIZDgqtCYvDi1czyL+Nw= ------END CERTIFICATE----- - -Camerfirma Global Chambersign Root -================================== ------BEGIN CERTIFICATE----- -MIIExTCCA62gAwIBAgIBADANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJFVTEnMCUGA1UEChMe -QUMgQ2FtZXJmaXJtYSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQLExpodHRwOi8vd3d3LmNoYW1i -ZXJzaWduLm9yZzEgMB4GA1UEAxMXR2xvYmFsIENoYW1iZXJzaWduIFJvb3QwHhcNMDMwOTMwMTYx -NDE4WhcNMzcwOTMwMTYxNDE4WjB9MQswCQYDVQQGEwJFVTEnMCUGA1UEChMeQUMgQ2FtZXJmaXJt -YSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQLExpodHRwOi8vd3d3LmNoYW1iZXJzaWduLm9yZzEg -MB4GA1UEAxMXR2xvYmFsIENoYW1iZXJzaWduIFJvb3QwggEgMA0GCSqGSIb3DQEBAQUAA4IBDQAw -ggEIAoIBAQCicKLQn0KuWxfH2H3PFIP8T8mhtxOviteePgQKkotgVvq0Mi+ITaFgCPS3CU6gSS9J -1tPfnZdan5QEcOw/Wdm3zGaLmFIoCQLfxS+EjXqXd7/sQJ0lcqu1PzKY+7e3/HKE5TWH+VX6ox8O -by4o3Wmg2UIQxvi1RMLQQ3/bvOSiPGpVeAp3qdjqGTK3L/5cPxvusZjsyq16aUXjlg9V9ubtdepl -6DJWk0aJqCWKZQbua795B9Dxt6/tLE2Su8CoX6dnfQTyFQhwrJLWfQTSM/tMtgsL+xrJxI0DqX5c -8lCrEqWhz0hQpe/SyBoT+rB/sYIcd2oPX9wLlY/vQ37mRQklAgEDo4IBUDCCAUwwEgYDVR0TAQH/ -BAgwBgEB/wIBDDA/BgNVHR8EODA2MDSgMqAwhi5odHRwOi8vY3JsLmNoYW1iZXJzaWduLm9yZy9j -aGFtYmVyc2lnbnJvb3QuY3JsMB0GA1UdDgQWBBRDnDafsJ4wTcbOX60Qq+UDpfqpFDAOBgNVHQ8B -Af8EBAMCAQYwEQYJYIZIAYb4QgEBBAQDAgAHMCoGA1UdEQQjMCGBH2NoYW1iZXJzaWducm9vdEBj -aGFtYmVyc2lnbi5vcmcwKgYDVR0SBCMwIYEfY2hhbWJlcnNpZ25yb290QGNoYW1iZXJzaWduLm9y -ZzBbBgNVHSAEVDBSMFAGCysGAQQBgYcuCgEBMEEwPwYIKwYBBQUHAgEWM2h0dHA6Ly9jcHMuY2hh -bWJlcnNpZ24ub3JnL2Nwcy9jaGFtYmVyc2lnbnJvb3QuaHRtbDANBgkqhkiG9w0BAQUFAAOCAQEA -PDtwkfkEVCeR4e3t/mh/YV3lQWVPMvEYBZRqHN4fcNs+ezICNLUMbKGKfKX0j//U2K0X1S0E0T9Y -gOKBWYi+wONGkyT+kL0mojAt6JcmVzWJdJYY9hXiryQZVgICsroPFOrGimbBhkVVi76SvpykBMdJ -PJ7oKXqJ1/6v/2j1pReQvayZzKWGVwlnRtvWFsJG8eSpUPWP0ZIV018+xgBJOm5YstHRJw0lyDL4 -IBHNfTIzSJRUTN3cecQwn+uOuFW114hcxWokPbLTBQNRxgfvzBRydD1ucs4YKIxKoHflCStFREes -t2d/AYoFWpO+ocH/+OcOZ6RHSXZddZAa9SaP8A== ------END CERTIFICATE----- - -NetLock Notary (Class A) Root -============================= ------BEGIN CERTIFICATE----- -MIIGfTCCBWWgAwIBAgICAQMwDQYJKoZIhvcNAQEEBQAwga8xCzAJBgNVBAYTAkhVMRAwDgYDVQQI -EwdIdW5nYXJ5MREwDwYDVQQHEwhCdWRhcGVzdDEnMCUGA1UEChMeTmV0TG9jayBIYWxvemF0Yml6 -dG9uc2FnaSBLZnQuMRowGAYDVQQLExFUYW51c2l0dmFueWtpYWRvazE2MDQGA1UEAxMtTmV0TG9j -ayBLb3pqZWd5em9pIChDbGFzcyBBKSBUYW51c2l0dmFueWtpYWRvMB4XDTk5MDIyNDIzMTQ0N1oX -DTE5MDIxOTIzMTQ0N1owga8xCzAJBgNVBAYTAkhVMRAwDgYDVQQIEwdIdW5nYXJ5MREwDwYDVQQH -EwhCdWRhcGVzdDEnMCUGA1UEChMeTmV0TG9jayBIYWxvemF0Yml6dG9uc2FnaSBLZnQuMRowGAYD -VQQLExFUYW51c2l0dmFueWtpYWRvazE2MDQGA1UEAxMtTmV0TG9jayBLb3pqZWd5em9pIChDbGFz -cyBBKSBUYW51c2l0dmFueWtpYWRvMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvHSM -D7tM9DceqQWC2ObhbHDqeLVu0ThEDaiDzl3S1tWBxdRL51uUcCbbO51qTGL3cfNk1mE7PetzozfZ -z+qMkjvN9wfcZnSX9EUi3fRc4L9t875lM+QVOr/bmJBVOMTtplVjC7B4BPTjbsE/jvxReB+SnoPC -/tmwqcm8WgD/qaiYdPv2LD4VOQ22BFWoDpggQrOxJa1+mm9dU7GrDPzr4PN6s6iz/0b2Y6LYOph7 -tqyF/7AlT3Rj5xMHpQqPBffAZG9+pyeAlt7ULoZgx2srXnN7F+eRP2QM2EsiNCubMvJIH5+hCoR6 -4sKtlz2O1cH5VqNQ6ca0+pii7pXmKgOM3wIDAQABo4ICnzCCApswDgYDVR0PAQH/BAQDAgAGMBIG -A1UdEwEB/wQIMAYBAf8CAQQwEQYJYIZIAYb4QgEBBAQDAgAHMIICYAYJYIZIAYb4QgENBIICURaC -Ak1GSUdZRUxFTSEgRXplbiB0YW51c2l0dmFueSBhIE5ldExvY2sgS2Z0LiBBbHRhbGFub3MgU3pv -bGdhbHRhdGFzaSBGZWx0ZXRlbGVpYmVuIGxlaXJ0IGVsamFyYXNvayBhbGFwamFuIGtlc3p1bHQu -IEEgaGl0ZWxlc2l0ZXMgZm9seWFtYXRhdCBhIE5ldExvY2sgS2Z0LiB0ZXJtZWtmZWxlbG9zc2Vn -LWJpenRvc2l0YXNhIHZlZGkuIEEgZGlnaXRhbGlzIGFsYWlyYXMgZWxmb2dhZGFzYW5hayBmZWx0 -ZXRlbGUgYXogZWxvaXJ0IGVsbGVub3J6ZXNpIGVsamFyYXMgbWVndGV0ZWxlLiBBeiBlbGphcmFz -IGxlaXJhc2EgbWVndGFsYWxoYXRvIGEgTmV0TG9jayBLZnQuIEludGVybmV0IGhvbmxhcGphbiBh -IGh0dHBzOi8vd3d3Lm5ldGxvY2submV0L2RvY3MgY2ltZW4gdmFneSBrZXJoZXRvIGF6IGVsbGVu -b3J6ZXNAbmV0bG9jay5uZXQgZS1tYWlsIGNpbWVuLiBJTVBPUlRBTlQhIFRoZSBpc3N1YW5jZSBh -bmQgdGhlIHVzZSBvZiB0aGlzIGNlcnRpZmljYXRlIGlzIHN1YmplY3QgdG8gdGhlIE5ldExvY2sg -Q1BTIGF2YWlsYWJsZSBhdCBodHRwczovL3d3dy5uZXRsb2NrLm5ldC9kb2NzIG9yIGJ5IGUtbWFp -bCBhdCBjcHNAbmV0bG9jay5uZXQuMA0GCSqGSIb3DQEBBAUAA4IBAQBIJEb3ulZv+sgoA0BO5TE5 -ayZrU3/b39/zcT0mwBQOxmd7I6gMc90Bu8bKbjc5VdXHjFYgDigKDtIqpLBJUsY4B/6+CgmM0ZjP -ytoUMaFP0jn8DxEsQ8Pdq5PHVT5HfBgaANzze9jyf1JsIPQLX2lS9O74silg6+NJMSEN1rUQQeJB -CWziGppWS3cC9qCbmieH6FUpccKQn0V4GuEVZD3QDtigdp+uxdAu6tYPVuxkf1qbFFgBJ34TUMdr -KuZoPL9coAob4Q566eKAw+np9v1sEZ7Q5SgnK1QyQhSCdeZK8CtmdWOMovsEPoMOmzbwGOQmIMOM -8CgHrTwXZoi1/baI ------END CERTIFICATE----- - -NetLock Business (Class B) Root -=============================== ------BEGIN CERTIFICATE----- -MIIFSzCCBLSgAwIBAgIBaTANBgkqhkiG9w0BAQQFADCBmTELMAkGA1UEBhMCSFUxETAPBgNVBAcT -CEJ1ZGFwZXN0MScwJQYDVQQKEx5OZXRMb2NrIEhhbG96YXRiaXp0b25zYWdpIEtmdC4xGjAYBgNV -BAsTEVRhbnVzaXR2YW55a2lhZG9rMTIwMAYDVQQDEylOZXRMb2NrIFV6bGV0aSAoQ2xhc3MgQikg -VGFudXNpdHZhbnlraWFkbzAeFw05OTAyMjUxNDEwMjJaFw0xOTAyMjAxNDEwMjJaMIGZMQswCQYD -VQQGEwJIVTERMA8GA1UEBxMIQnVkYXBlc3QxJzAlBgNVBAoTHk5ldExvY2sgSGFsb3phdGJpenRv -bnNhZ2kgS2Z0LjEaMBgGA1UECxMRVGFudXNpdHZhbnlraWFkb2sxMjAwBgNVBAMTKU5ldExvY2sg -VXpsZXRpIChDbGFzcyBCKSBUYW51c2l0dmFueWtpYWRvMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCB -iQKBgQCx6gTsIKAjwo84YM/HRrPVG/77uZmeBNwcf4xKgZjupNTKihe5In+DCnVMm8Bp2GQ5o+2S -o/1bXHQawEfKOml2mrriRBf8TKPV/riXiK+IA4kfpPIEPsgHC+b5sy96YhQJRhTKZPWLgLViqNhr -1nGTLbO/CVRY7QbrqHvcQ7GhaQIDAQABo4ICnzCCApswEgYDVR0TAQH/BAgwBgEB/wIBBDAOBgNV -HQ8BAf8EBAMCAAYwEQYJYIZIAYb4QgEBBAQDAgAHMIICYAYJYIZIAYb4QgENBIICURaCAk1GSUdZ -RUxFTSEgRXplbiB0YW51c2l0dmFueSBhIE5ldExvY2sgS2Z0LiBBbHRhbGFub3MgU3pvbGdhbHRh -dGFzaSBGZWx0ZXRlbGVpYmVuIGxlaXJ0IGVsamFyYXNvayBhbGFwamFuIGtlc3p1bHQuIEEgaGl0 -ZWxlc2l0ZXMgZm9seWFtYXRhdCBhIE5ldExvY2sgS2Z0LiB0ZXJtZWtmZWxlbG9zc2VnLWJpenRv -c2l0YXNhIHZlZGkuIEEgZGlnaXRhbGlzIGFsYWlyYXMgZWxmb2dhZGFzYW5hayBmZWx0ZXRlbGUg -YXogZWxvaXJ0IGVsbGVub3J6ZXNpIGVsamFyYXMgbWVndGV0ZWxlLiBBeiBlbGphcmFzIGxlaXJh -c2EgbWVndGFsYWxoYXRvIGEgTmV0TG9jayBLZnQuIEludGVybmV0IGhvbmxhcGphbiBhIGh0dHBz -Oi8vd3d3Lm5ldGxvY2submV0L2RvY3MgY2ltZW4gdmFneSBrZXJoZXRvIGF6IGVsbGVub3J6ZXNA -bmV0bG9jay5uZXQgZS1tYWlsIGNpbWVuLiBJTVBPUlRBTlQhIFRoZSBpc3N1YW5jZSBhbmQgdGhl -IHVzZSBvZiB0aGlzIGNlcnRpZmljYXRlIGlzIHN1YmplY3QgdG8gdGhlIE5ldExvY2sgQ1BTIGF2 -YWlsYWJsZSBhdCBodHRwczovL3d3dy5uZXRsb2NrLm5ldC9kb2NzIG9yIGJ5IGUtbWFpbCBhdCBj -cHNAbmV0bG9jay5uZXQuMA0GCSqGSIb3DQEBBAUAA4GBAATbrowXr/gOkDFOzT4JwG06sPgzTEdM -43WIEJessDgVkcYplswhwG08pXTP2IKlOcNl40JwuyKQ433bNXbhoLXan3BukxowOR0w2y7jfLKR -stE3Kfq51hdcR0/jHTjrn9V7lagonhVK0dHQKwCXoOKSNitjrFgBazMpUIaD8QFI ------END CERTIFICATE----- - -NetLock Express (Class C) Root -============================== ------BEGIN CERTIFICATE----- -MIIFTzCCBLigAwIBAgIBaDANBgkqhkiG9w0BAQQFADCBmzELMAkGA1UEBhMCSFUxETAPBgNVBAcT -CEJ1ZGFwZXN0MScwJQYDVQQKEx5OZXRMb2NrIEhhbG96YXRiaXp0b25zYWdpIEtmdC4xGjAYBgNV -BAsTEVRhbnVzaXR2YW55a2lhZG9rMTQwMgYDVQQDEytOZXRMb2NrIEV4cHJlc3N6IChDbGFzcyBD -KSBUYW51c2l0dmFueWtpYWRvMB4XDTk5MDIyNTE0MDgxMVoXDTE5MDIyMDE0MDgxMVowgZsxCzAJ -BgNVBAYTAkhVMREwDwYDVQQHEwhCdWRhcGVzdDEnMCUGA1UEChMeTmV0TG9jayBIYWxvemF0Yml6 -dG9uc2FnaSBLZnQuMRowGAYDVQQLExFUYW51c2l0dmFueWtpYWRvazE0MDIGA1UEAxMrTmV0TG9j -ayBFeHByZXNzeiAoQ2xhc3MgQykgVGFudXNpdHZhbnlraWFkbzCBnzANBgkqhkiG9w0BAQEFAAOB -jQAwgYkCgYEA6+ywbGGKIyWvYCDj2Z/8kwvbXY2wobNAOoLO/XXgeDIDhlqGlZHtU/qdQPzm6N3Z -W3oDvV3zOwzDUXmbrVWg6dADEK8KuhRC2VImESLH0iDMgqSaqf64gXadarfSNnU+sYYJ9m5tfk63 -euyucYT2BDMIJTLrdKwWRMbkQJMdf60CAwEAAaOCAp8wggKbMBIGA1UdEwEB/wQIMAYBAf8CAQQw -DgYDVR0PAQH/BAQDAgAGMBEGCWCGSAGG+EIBAQQEAwIABzCCAmAGCWCGSAGG+EIBDQSCAlEWggJN -RklHWUVMRU0hIEV6ZW4gdGFudXNpdHZhbnkgYSBOZXRMb2NrIEtmdC4gQWx0YWxhbm9zIFN6b2xn -YWx0YXRhc2kgRmVsdGV0ZWxlaWJlbiBsZWlydCBlbGphcmFzb2sgYWxhcGphbiBrZXN6dWx0LiBB -IGhpdGVsZXNpdGVzIGZvbHlhbWF0YXQgYSBOZXRMb2NrIEtmdC4gdGVybWVrZmVsZWxvc3NlZy1i -aXp0b3NpdGFzYSB2ZWRpLiBBIGRpZ2l0YWxpcyBhbGFpcmFzIGVsZm9nYWRhc2FuYWsgZmVsdGV0 -ZWxlIGF6IGVsb2lydCBlbGxlbm9yemVzaSBlbGphcmFzIG1lZ3RldGVsZS4gQXogZWxqYXJhcyBs -ZWlyYXNhIG1lZ3RhbGFsaGF0byBhIE5ldExvY2sgS2Z0LiBJbnRlcm5ldCBob25sYXBqYW4gYSBo -dHRwczovL3d3dy5uZXRsb2NrLm5ldC9kb2NzIGNpbWVuIHZhZ3kga2VyaGV0byBheiBlbGxlbm9y -emVzQG5ldGxvY2submV0IGUtbWFpbCBjaW1lbi4gSU1QT1JUQU5UISBUaGUgaXNzdWFuY2UgYW5k -IHRoZSB1c2Ugb2YgdGhpcyBjZXJ0aWZpY2F0ZSBpcyBzdWJqZWN0IHRvIHRoZSBOZXRMb2NrIENQ -UyBhdmFpbGFibGUgYXQgaHR0cHM6Ly93d3cubmV0bG9jay5uZXQvZG9jcyBvciBieSBlLW1haWwg -YXQgY3BzQG5ldGxvY2submV0LjANBgkqhkiG9w0BAQQFAAOBgQAQrX/XDDKACtiG8XmYta3UzbM2 -xJZIwVzNmtkFLp++UOv0JhQQLdRmF/iewSf98e3ke0ugbLWrmldwpu2gpO0u9f38vf5NNwgMvOOW -gyL1SRt/Syu0VMGAfJlOHdCM7tCs5ZL6dVb+ZKATj7i4Fp1hBWeAyNDYpQcCNJgEjTME1A== ------END CERTIFICATE----- - -XRamp Global CA Root -==================== ------BEGIN CERTIFICATE----- -MIIEMDCCAxigAwIBAgIQUJRs7Bjq1ZxN1ZfvdY+grTANBgkqhkiG9w0BAQUFADCBgjELMAkGA1UE -BhMCVVMxHjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2Vj -dXJpdHkgU2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBB -dXRob3JpdHkwHhcNMDQxMTAxMTcxNDA0WhcNMzUwMTAxMDUzNzE5WjCBgjELMAkGA1UEBhMCVVMx -HjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2VjdXJpdHkg -U2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBBdXRob3Jp -dHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCYJB69FbS638eMpSe2OAtp87ZOqCwu -IR1cRN8hXX4jdP5efrRKt6atH67gBhbim1vZZ3RrXYCPKZ2GG9mcDZhtdhAoWORlsH9KmHmf4MMx -foArtYzAQDsRhtDLooY2YKTVMIJt2W7QDxIEM5dfT2Fa8OT5kavnHTu86M/0ay00fOJIYRyO82FE -zG+gSqmUsE3a56k0enI4qEHMPJQRfevIpoy3hsvKMzvZPTeL+3o+hiznc9cKV6xkmxnr9A8ECIqs -AxcZZPRaJSKNNCyy9mgdEm3Tih4U2sSPpuIjhdV6Db1q4Ons7Be7QhtnqiXtRYMh/MHJfNViPvry -xS3T/dRlAgMBAAGjgZ8wgZwwEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud -EwEB/wQFMAMBAf8wHQYDVR0OBBYEFMZPoj0GY4QJnM5i5ASsjVy16bYbMDYGA1UdHwQvMC0wK6Ap -oCeGJWh0dHA6Ly9jcmwueHJhbXBzZWN1cml0eS5jb20vWEdDQS5jcmwwEAYJKwYBBAGCNxUBBAMC -AQEwDQYJKoZIhvcNAQEFBQADggEBAJEVOQMBG2f7Shz5CmBbodpNl2L5JFMn14JkTpAuw0kbK5rc -/Kh4ZzXxHfARvbdI4xD2Dd8/0sm2qlWkSLoC295ZLhVbO50WfUfXN+pfTXYSNrsf16GBBEYgoyxt -qZ4Bfj8pzgCT3/3JknOJiWSe5yvkHJEs0rnOfc5vMZnT5r7SHpDwCRR5XCOrTdLaIR9NmXmd4c8n -nxCbHIgNsIpkQTG4DmyQJKSbXHGPurt+HBvbaoAPIbzp26a3QPSyi6mx5O+aGtA9aZnuqCij4Tyz -8LIRnM98QObd50N9otg6tamN8jSZxNQQ4Qb9CYQQO+7ETPTsJ3xCwnR8gooJybQDJbw= ------END CERTIFICATE----- - -Go Daddy Class 2 CA -=================== ------BEGIN CERTIFICATE----- -MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMY -VGhlIEdvIERhZGR5IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRp -ZmljYXRpb24gQXV0aG9yaXR5MB4XDTA0MDYyOTE3MDYyMFoXDTM0MDYyOTE3MDYyMFowYzELMAkG -A1UEBhMCVVMxITAfBgNVBAoTGFRoZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28g -RGFkZHkgQ2xhc3MgMiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQAD -ggENADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XCAPVYYYwhv -2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6wwdhFJ2+qN1j3hybX2C32 -qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXiEqITLdiOr18SPaAIBQi2XKVlOARFmR6j -YGB0xUGlcmIbYsUfb18aQr4CUWWoriMYavx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmY -vLEHZ6IVDd2gWMZEewo+YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjgcAwgb0wHQYDVR0O -BBYEFNLEsNKR1EwRcbNhyz2h/t2oatTjMIGNBgNVHSMEgYUwgYKAFNLEsNKR1EwRcbNhyz2h/t2o -atTjoWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5IEdyb3VwLCBJbmMu -MTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggEAMAwG -A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wim -PQoZ+YeAEW5p5JYXMP80kWNyOO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKt -I3lpjbi2Tc7PTMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheabIZ0KbIIOqPjCDPoQ -HmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzrTia2cyvk0/ZM/iZx4mERdEr/VxqHD3VI -Ls9RaRegAhJhldXRQLIQTO7ErBBDpqWeCtWVYpoNz4iCxTIM5CufReYNnyicsbkqWletNw+vHX/b -vZ8= ------END CERTIFICATE----- - -Starfield Class 2 CA -==================== ------BEGIN CERTIFICATE----- -MIIEDzCCAvegAwIBAgIBADANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJVUzElMCMGA1UEChMc -U3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMpU3RhcmZpZWxkIENsYXNzIDIg -Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQwNjI5MTczOTE2WhcNMzQwNjI5MTczOTE2WjBo -MQswCQYDVQQGEwJVUzElMCMGA1UEChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAG -A1UECxMpU3RhcmZpZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEgMA0GCSqG -SIb3DQEBAQUAA4IBDQAwggEIAoIBAQC3Msj+6XGmBIWtDBFk385N78gDGIc/oav7PKaf8MOh2tTY -bitTkPskpD6E8J7oX+zlJ0T1KKY/e97gKvDIr1MvnsoFAZMej2YcOadN+lq2cwQlZut3f+dZxkqZ -JRRU6ybH838Z1TBwj6+wRir/resp7defqgSHo9T5iaU0X9tDkYI22WY8sbi5gv2cOj4QyDvvBmVm -epsZGD3/cVE8MC5fvj13c7JdBmzDI1aaK4UmkhynArPkPw2vCHmCuDY96pzTNbO8acr1zJ3o/WSN -F4Azbl5KXZnJHoe0nRrA1W4TNSNe35tfPe/W93bC6j67eA0cQmdrBNj41tpvi/JEoAGrAgEDo4HF -MIHCMB0GA1UdDgQWBBS/X7fRzt0fhvRbVazc1xDCDqmI5zCBkgYDVR0jBIGKMIGHgBS/X7fRzt0f -hvRbVazc1xDCDqmI56FspGowaDELMAkGA1UEBhMCVVMxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNo -bm9sb2dpZXMsIEluYy4xMjAwBgNVBAsTKVN0YXJmaWVsZCBDbGFzcyAyIENlcnRpZmljYXRpb24g -QXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAAWdP4id0ckaVaGs -afPzWdqbAYcaT1epoXkJKtv3L7IezMdeatiDh6GX70k1PncGQVhiv45YuApnP+yz3SFmH8lU+nLM -PUxA2IGvd56Deruix/U0F47ZEUD0/CwqTRV/p2JdLiXTAAsgGh1o+Re49L2L7ShZ3U0WixeDyLJl -xy16paq8U4Zt3VekyvggQQto8PT7dL5WXXp59fkdheMtlb71cZBDzI0fmgAKhynpVSJYACPq4xJD -KVtHCN2MQWplBqjlIapBtJUhlbl90TSrE9atvNziPTnNvT51cKEYWQPJIrSPnNVeKtelttQKbfi3 -QBFGmh95DmK/D5fs4C8fF5Q= ------END CERTIFICATE----- - -StartCom Certification Authority -================================ ------BEGIN CERTIFICATE----- -MIIHyTCCBbGgAwIBAgIBATANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJJTDEWMBQGA1UEChMN -U3RhcnRDb20gTHRkLjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmlu -ZzEpMCcGA1UEAxMgU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDYwOTE3MTk0 -NjM2WhcNMzYwOTE3MTk0NjM2WjB9MQswCQYDVQQGEwJJTDEWMBQGA1UEChMNU3RhcnRDb20gTHRk -LjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmluZzEpMCcGA1UEAxMg -U3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw -ggIKAoICAQDBiNsJvGxGfHiflXu1M5DycmLWwTYgIiRezul38kMKogZkpMyONvg45iPwbm2xPN1y -o4UcodM9tDMr0y+v/uqwQVlntsQGfQqedIXWeUyAN3rfOQVSWff0G0ZDpNKFhdLDcfN1YjS6LIp/ -Ho/u7TTQEceWzVI9ujPW3U3eCztKS5/CJi/6tRYccjV3yjxd5srhJosaNnZcAdt0FCX+7bWgiA/d -eMotHweXMAEtcnn6RtYTKqi5pquDSR3l8u/d5AGOGAqPY1MWhWKpDhk6zLVmpsJrdAfkK+F2PrRt -2PZE4XNiHzvEvqBTViVsUQn3qqvKv3b9bZvzndu/PWa8DFaqr5hIlTpL36dYUNk4dalb6kMMAv+Z -6+hsTXBbKWWc3apdzK8BMewM69KN6Oqce+Zu9ydmDBpI125C4z/eIT574Q1w+2OqqGwaVLRcJXrJ -osmLFqa7LH4XXgVNWG4SHQHuEhANxjJ/GP/89PrNbpHoNkm+Gkhpi8KWTRoSsmkXwQqQ1vp5Iki/ -untp+HDH+no32NgN0nZPV/+Qt+OR0t3vwmC3Zzrd/qqc8NSLf3Iizsafl7b4r4qgEKjZ+xjGtrVc -UjyJthkqcwEKDwOzEmDyei+B26Nu/yYwl/WL3YlXtq09s68rxbd2AvCl1iuahhQqcvbjM4xdCUsT -37uMdBNSSwIDAQABo4ICUjCCAk4wDAYDVR0TBAUwAwEB/zALBgNVHQ8EBAMCAa4wHQYDVR0OBBYE -FE4L7xqkQFulF2mHMMo0aEPQQa7yMGQGA1UdHwRdMFswLKAqoCiGJmh0dHA6Ly9jZXJ0LnN0YXJ0 -Y29tLm9yZy9zZnNjYS1jcmwuY3JsMCugKaAnhiVodHRwOi8vY3JsLnN0YXJ0Y29tLm9yZy9zZnNj -YS1jcmwuY3JsMIIBXQYDVR0gBIIBVDCCAVAwggFMBgsrBgEEAYG1NwEBATCCATswLwYIKwYBBQUH -AgEWI2h0dHA6Ly9jZXJ0LnN0YXJ0Y29tLm9yZy9wb2xpY3kucGRmMDUGCCsGAQUFBwIBFilodHRw -Oi8vY2VydC5zdGFydGNvbS5vcmcvaW50ZXJtZWRpYXRlLnBkZjCB0AYIKwYBBQUHAgIwgcMwJxYg -U3RhcnQgQ29tbWVyY2lhbCAoU3RhcnRDb20pIEx0ZC4wAwIBARqBl0xpbWl0ZWQgTGlhYmlsaXR5 -LCByZWFkIHRoZSBzZWN0aW9uICpMZWdhbCBMaW1pdGF0aW9ucyogb2YgdGhlIFN0YXJ0Q29tIENl -cnRpZmljYXRpb24gQXV0aG9yaXR5IFBvbGljeSBhdmFpbGFibGUgYXQgaHR0cDovL2NlcnQuc3Rh -cnRjb20ub3JnL3BvbGljeS5wZGYwEQYJYIZIAYb4QgEBBAQDAgAHMDgGCWCGSAGG+EIBDQQrFilT -dGFydENvbSBGcmVlIFNTTCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTANBgkqhkiG9w0BAQUFAAOC -AgEAFmyZ9GYMNPXQhV59CuzaEE44HF7fpiUFS5Eyweg78T3dRAlbB0mKKctmArexmvclmAk8jhvh -3TaHK0u7aNM5Zj2gJsfyOZEdUauCe37Vzlrk4gNXcGmXCPleWKYK34wGmkUWFjgKXlf2Ysd6AgXm -vB618p70qSmD+LIU424oh0TDkBreOKk8rENNZEXO3SipXPJzewT4F+irsfMuXGRuczE6Eri8sxHk -fY+BUZo7jYn0TZNmezwD7dOaHZrzZVD1oNB1ny+v8OqCQ5j4aZyJecRDjkZy42Q2Eq/3JR44iZB3 -fsNrarnDy0RLrHiQi+fHLB5LEUTINFInzQpdn4XBidUaePKVEFMy3YCEZnXZtWgo+2EuvoSoOMCZ -EoalHmdkrQYuL6lwhceWD3yJZfWOQ1QOq92lgDmUYMA0yZZwLKMS9R9Ie70cfmu3nZD0Ijuu+Pwq -yvqCUqDvr0tVk+vBtfAii6w0TiYiBKGHLHVKt+V9E9e4DGTANtLJL4YSjCMJwRuCO3NJo2pXh5Tl -1njFmUNj403gdy3hZZlyaQQaRwnmDwFWJPsfvw55qVguucQJAX6Vum0ABj6y6koQOdjQK/W/7HW/ -lwLFCRsI3FU34oH7N4RDYiDK51ZLZer+bMEkkyShNOsF/5oirpt9P/FlUQqmMGqz9IgcgA38coro -g14= ------END CERTIFICATE----- - -Taiwan GRCA -=========== ------BEGIN CERTIFICATE----- -MIIFcjCCA1qgAwIBAgIQH51ZWtcvwgZEpYAIaeNe9jANBgkqhkiG9w0BAQUFADA/MQswCQYDVQQG -EwJUVzEwMC4GA1UECgwnR292ZXJubWVudCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4X -DTAyMTIwNTEzMjMzM1oXDTMyMTIwNTEzMjMzM1owPzELMAkGA1UEBhMCVFcxMDAuBgNVBAoMJ0dv -dmVybm1lbnQgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCAiIwDQYJKoZIhvcNAQEBBQAD -ggIPADCCAgoCggIBAJoluOzMonWoe/fOW1mKydGGEghU7Jzy50b2iPN86aXfTEc2pBsBHH8eV4qN -w8XRIePaJD9IK/ufLqGU5ywck9G/GwGHU5nOp/UKIXZ3/6m3xnOUT0b3EEk3+qhZSV1qgQdW8or5 -BtD3cCJNtLdBuTK4sfCxw5w/cP1T3YGq2GN49thTbqGsaoQkclSGxtKyyhwOeYHWtXBiCAEuTk8O -1RGvqa/lmr/czIdtJuTJV6L7lvnM4T9TjGxMfptTCAtsF/tnyMKtsc2AtJfcdgEWFelq16TheEfO -htX7MfP6Mb40qij7cEwdScevLJ1tZqa2jWR+tSBqnTuBto9AAGdLiYa4zGX+FVPpBMHWXx1E1wov -J5pGfaENda1UhhXcSTvxls4Pm6Dso3pdvtUqdULle96ltqqvKKyskKw4t9VoNSZ63Pc78/1Fm9G7 -Q3hub/FCVGqY8A2tl+lSXunVanLeavcbYBT0peS2cWeqH+riTcFCQP5nRhc4L0c/cZyu5SHKYS1t -B6iEfC3uUSXxY5Ce/eFXiGvviiNtsea9P63RPZYLhY3Naye7twWb7LuRqQoHEgKXTiCQ8P8NHuJB -O9NAOueNXdpm5AKwB1KYXA6OM5zCppX7VRluTI6uSw+9wThNXo+EHWbNxWCWtFJaBYmOlXqYwZE8 -lSOyDvR5tMl8wUohAgMBAAGjajBoMB0GA1UdDgQWBBTMzO/MKWCkO7GStjz6MmKPrCUVOzAMBgNV -HRMEBTADAQH/MDkGBGcqBwAEMTAvMC0CAQAwCQYFKw4DAhoFADAHBgVnKgMAAAQUA5vwIhP/lSg2 -09yewDL7MTqKUWUwDQYJKoZIhvcNAQEFBQADggIBAECASvomyc5eMN1PhnR2WPWus4MzeKR6dBcZ -TulStbngCnRiqmjKeKBMmo4sIy7VahIkv9Ro04rQ2JyftB8M3jh+Vzj8jeJPXgyfqzvS/3WXy6Tj -Zwj/5cAWtUgBfen5Cv8b5Wppv3ghqMKnI6mGq3ZW6A4M9hPdKmaKZEk9GhiHkASfQlK3T8v+R0F2 -Ne//AHY2RTKbxkaFXeIksB7jSJaYV0eUVXoPQbFEJPPB/hprv4j9wabak2BegUqZIJxIZhm1AHlU -D7gsL0u8qV1bYH+Mh6XgUmMqvtg7hUAV/h62ZT/FS9p+tXo1KaMuephgIqP0fSdOLeq0dDzpD6Qz -DxARvBMB1uUO07+1EqLhRSPAzAhuYbeJq4PjJB7mXQfnHyA+z2fI56wwbSdLaG5LKlwCCDTb+Hbk -Z6MmnD+iMsJKxYEYMRBWqoTvLQr/uB930r+lWKBi5NdLkXWNiYCYfm3LU05er/ayl4WXudpVBrkk -7tfGOB5jGxI7leFYrPLfhNVfmS8NVVvmONsuP3LpSIXLuykTjx44VbnzssQwmSNOXfJIoRIM3BKQ -CZBUkQM8R+XVyWXgt0t97EfTsws+rZ7QdAAO671RrcDeLMDDav7v3Aun+kbfYNucpllQdSNpc5Oy -+fwC00fmcc4QAu4njIT/rEUNE1yDMuAlpYYsfPQS ------END CERTIFICATE----- - -Swisscom Root CA 1 -================== ------BEGIN CERTIFICATE----- -MIIF2TCCA8GgAwIBAgIQXAuFXAvnWUHfV8w/f52oNjANBgkqhkiG9w0BAQUFADBkMQswCQYDVQQG -EwJjaDERMA8GA1UEChMIU3dpc3Njb20xJTAjBgNVBAsTHERpZ2l0YWwgQ2VydGlmaWNhdGUgU2Vy -dmljZXMxGzAZBgNVBAMTElN3aXNzY29tIFJvb3QgQ0EgMTAeFw0wNTA4MTgxMjA2MjBaFw0yNTA4 -MTgyMjA2MjBaMGQxCzAJBgNVBAYTAmNoMREwDwYDVQQKEwhTd2lzc2NvbTElMCMGA1UECxMcRGln -aXRhbCBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczEbMBkGA1UEAxMSU3dpc3Njb20gUm9vdCBDQSAxMIIC -IjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0LmwqAzZuz8h+BvVM5OAFmUgdbI9m2BtRsiM -MW8Xw/qabFbtPMWRV8PNq5ZJkCoZSx6jbVfd8StiKHVFXqrWW/oLJdihFvkcxC7mlSpnzNApbjyF -NDhhSbEAn9Y6cV9Nbc5fuankiX9qUvrKm/LcqfmdmUc/TilftKaNXXsLmREDA/7n29uj/x2lzZAe -AR81sH8A25Bvxn570e56eqeqDFdvpG3FEzuwpdntMhy0XmeLVNxzh+XTF3xmUHJd1BpYwdnP2IkC -b6dJtDZd0KTeByy2dbcokdaXvij1mB7qWybJvbCXc9qukSbraMH5ORXWZ0sKbU/Lz7DkQnGMU3nn -7uHbHaBuHYwadzVcFh4rUx80i9Fs/PJnB3r1re3WmquhsUvhzDdf/X/NTa64H5xD+SpYVUNFvJbN -cA78yeNmuk6NO4HLFWR7uZToXTNShXEuT46iBhFRyePLoW4xCGQMwtI89Tbo19AOeCMgkckkKmUp -WyL3Ic6DXqTz3kvTaI9GdVyDCW4pa8RwjPWd1yAv/0bSKzjCL3UcPX7ape8eYIVpQtPM+GP+HkM5 -haa2Y0EQs3MevNP6yn0WR+Kn1dCjigoIlmJWbjTb2QK5MHXjBNLnj8KwEUAKrNVxAmKLMb7dxiNY -MUJDLXT5xp6mig/p/r+D5kNXJLrvRjSq1xIBOO0CAwEAAaOBhjCBgzAOBgNVHQ8BAf8EBAMCAYYw -HQYDVR0hBBYwFDASBgdghXQBUwABBgdghXQBUwABMBIGA1UdEwEB/wQIMAYBAf8CAQcwHwYDVR0j -BBgwFoAUAyUv3m+CATpcLNwroWm1Z9SM0/0wHQYDVR0OBBYEFAMlL95vggE6XCzcK6FptWfUjNP9 -MA0GCSqGSIb3DQEBBQUAA4ICAQA1EMvspgQNDQ/NwNurqPKIlwzfky9NfEBWMXrrpA9gzXrzvsMn -jgM+pN0S734edAY8PzHyHHuRMSG08NBsl9Tpl7IkVh5WwzW9iAUPWxAaZOHHgjD5Mq2eUCzneAXQ -MbFamIp1TpBcahQq4FJHgmDmHtqBsfsUC1rxn9KVuj7QG9YVHaO+htXbD8BJZLsuUBlL0iT43R4H -VtA4oJVwIHaM190e3p9xxCPvgxNcoyQVTSlAPGrEqdi3pkSlDfTgnXceQHAm/NrZNuR55LU/vJtl -vrsRls/bxig5OgjOR1tTWsWZ/l2p3e9M1MalrQLmjAcSHm8D0W+go/MpvRLHUKKwf4ipmXeascCl -OS5cfGniLLDqN2qk4Vrh9VDlg++luyqI54zb/W1elxmofmZ1a3Hqv7HHb6D0jqTsNFFbjCYDcKF3 -1QESVwA12yPeDooomf2xEG9L/zgtYE4snOtnta1J7ksfrK/7DZBaZmBwXarNeNQk7shBoJMBkpxq -nvy5JMWzFYJ+vq6VK+uxwNrjAWALXmmshFZhvnEX/h0TD/7Gh0Xp/jKgGg0TpJRVcaUWi7rKibCy -x/yP2FS1k2Kdzs9Z+z0YzirLNRWCXf9UIltxUvu3yf5gmwBBZPCqKuy2QkPOiWaByIufOVQDJdMW -NY6E0F/6MBr1mmz0DlP5OlvRHA== ------END CERTIFICATE----- - -DigiCert Assured ID Root CA -=========================== ------BEGIN CERTIFICATE----- -MIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0BAQUFADBlMQswCQYDVQQG -EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw -IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzEx -MTEwMDAwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL -ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0Ew -ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtDhXO5EOAXLGH87dg+XESpa7cJpSIqvTO -9SA5KFhgDPiA2qkVlTJhPLWxKISKityfCgyDF3qPkKyK53lTXDGEKvYPmDI2dsze3Tyoou9q+yHy -UmHfnyDXH+Kx2f4YZNISW1/5WBg1vEfNoTb5a3/UsDg+wRvDjDPZ2C8Y/igPs6eD1sNuRMBhNZYW -/lmci3Zt1/GiSw0r/wty2p5g0I6QNcZ4VYcgoc/lbQrISXwxmDNsIumH0DJaoroTghHtORedmTpy -oeb6pNnVFzF1roV9Iq4/AUaG9ih5yLHa5FcXxH4cDrC0kqZWs72yl+2qp/C3xag/lRbQ/6GW6whf -GHdPAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRF -66Kv9JLLgjEtUYunpyGd823IDzAfBgNVHSMEGDAWgBRF66Kv9JLLgjEtUYunpyGd823IDzANBgkq -hkiG9w0BAQUFAAOCAQEAog683+Lt8ONyc3pklL/3cmbYMuRCdWKuh+vy1dneVrOfzM4UKLkNl2Bc -EkxY5NM9g0lFWJc1aRqoR+pWxnmrEthngYTffwk8lOa4JiwgvT2zKIn3X/8i4peEH+ll74fg38Fn -SbNd67IJKusm7Xi+fT8r87cmNW1fiQG2SVufAQWbqz0lwcy2f8Lxb4bG+mRo64EtlOtCt/qMHt1i -8b5QZ7dsvfPxH2sMNgcWfzd8qVttevESRmCD1ycEvkvOl77DZypoEd+A5wwzZr8TDRRu838fYxAe -+o0bJW1sj6W3YQGx0qMmoRBxna3iw/nDmVG3KwcIzi7mULKn+gpFL6Lw8g== ------END CERTIFICATE----- - -DigiCert Global Root CA -======================= ------BEGIN CERTIFICATE----- -MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBhMQswCQYDVQQG -EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw -HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBDQTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAw -MDAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3 -dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkq -hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsBCSDMAZOn -TjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97nh6Vfe63SKMI2tavegw5 -BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt43C/dxC//AH2hdmoRBBYMql1GNXRor5H -4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7PT19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y -7vrTC0LUq7dBMtoM1O/4gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQAB -o2MwYTAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbRTLtm -8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUwDQYJKoZIhvcNAQEF -BQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/EsrhMAtudXH/vTBH1jLuG2cenTnmCmr -EbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIt -tep3Sp+dWOIrWcBAI+0tKIJFPnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886 -UAb3LujEV0lsYSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk -CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4= ------END CERTIFICATE----- - -DigiCert High Assurance EV Root CA -================================== ------BEGIN CERTIFICATE----- -MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBsMQswCQYDVQQG -EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSsw -KQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5jZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAw -MFoXDTMxMTExMDAwMDAwMFowbDELMAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZ -MBcGA1UECxMQd3d3LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFu -Y2UgRVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm+9S75S0t -Mqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTWPNt0OKRKzE0lgvdKpVMS -OO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEMxChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3 -MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFBIk5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQ -NAQTXKFx01p8VdteZOE3hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUe -h10aUAsgEsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMB -Af8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaAFLE+w2kD+L9HAdSY -JhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3NecnzyIZgYIVyHbIUf4KmeqvxgydkAQ -V8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6zeM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFp -myPInngiK3BD41VHMWEZ71jFhS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkK -mNEVX58Svnw2Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe -vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep+OkuE6N36B9K ------END CERTIFICATE----- - -Certplus Class 2 Primary CA -=========================== ------BEGIN CERTIFICATE----- -MIIDkjCCAnqgAwIBAgIRAIW9S/PY2uNp9pTXX8OlRCMwDQYJKoZIhvcNAQEFBQAwPTELMAkGA1UE -BhMCRlIxETAPBgNVBAoTCENlcnRwbHVzMRswGQYDVQQDExJDbGFzcyAyIFByaW1hcnkgQ0EwHhcN -OTkwNzA3MTcwNTAwWhcNMTkwNzA2MjM1OTU5WjA9MQswCQYDVQQGEwJGUjERMA8GA1UEChMIQ2Vy -dHBsdXMxGzAZBgNVBAMTEkNsYXNzIDIgUHJpbWFyeSBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEP -ADCCAQoCggEBANxQltAS+DXSCHh6tlJw/W/uz7kRy1134ezpfgSN1sxvc0NXYKwzCkTsA18cgCSR -5aiRVhKC9+Ar9NuuYS6JEI1rbLqzAr3VNsVINyPi8Fo3UjMXEuLRYE2+L0ER4/YXJQyLkcAbmXuZ -Vg2v7tK8R1fjeUl7NIknJITesezpWE7+Tt9avkGtrAjFGA7v0lPubNCdEgETjdyAYveVqUSISnFO -YFWe2yMZeVYHDD9jC1yw4r5+FfyUM1hBOHTE4Y+L3yasH7WLO7dDWWuwJKZtkIvEcupdM5i3y95e -e++U8Rs+yskhwcWYAqqi9lt3m/V+llU0HGdpwPFC40es/CgcZlUCAwEAAaOBjDCBiTAPBgNVHRME -CDAGAQH/AgEKMAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQU43Mt38sOKAze3bOkynm4jrvoMIkwEQYJ -YIZIAYb4QgEBBAQDAgEGMDcGA1UdHwQwMC4wLKAqoCiGJmh0dHA6Ly93d3cuY2VydHBsdXMuY29t -L0NSTC9jbGFzczIuY3JsMA0GCSqGSIb3DQEBBQUAA4IBAQCnVM+IRBnL39R/AN9WM2K191EBkOvD -P9GIROkkXe/nFL0gt5o8AP5tn9uQ3Nf0YtaLcF3n5QRIqWh8yfFC82x/xXp8HVGIutIKPidd3i1R -TtMTZGnkLuPT55sJmabglZvOGtd/vjzOUrMRFcEPF80Du5wlFbqidon8BvEY0JNLDnyCt6X09l/+ -7UCmnYR0ObncHoUW2ikbhiMAybuJfm6AiB4vFLQDJKgybwOaRywwvlbGp0ICcBvqQNi6BQNwB6SW -//1IMwrh3KWBkJtN3X3n57LNXMhqlfil9o3EXXgIvnsG1knPGTZQIy4I5p4FTUcY1Rbpsda2ENW7 -l7+ijrRU ------END CERTIFICATE----- - -DST Root CA X3 -============== ------BEGIN CERTIFICATE----- -MIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/MSQwIgYDVQQK -ExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMTDkRTVCBSb290IENBIFgzMB4X -DTAwMDkzMDIxMTIxOVoXDTIxMDkzMDE0MDExNVowPzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1 -cmUgVHJ1c3QgQ28uMRcwFQYDVQQDEw5EU1QgUm9vdCBDQSBYMzCCASIwDQYJKoZIhvcNAQEBBQAD -ggEPADCCAQoCggEBAN+v6ZdQCINXtMxiZfaQguzH0yxrMMpb7NnDfcdAwRgUi+DoM3ZJKuM/IUmT -rE4Orz5Iy2Xu/NMhD2XSKtkyj4zl93ewEnu1lcCJo6m67XMuegwGMoOifooUMM0RoOEqOLl5CjH9 -UL2AZd+3UWODyOKIYepLYYHsUmu5ouJLGiifSKOeDNoJjj4XLh7dIN9bxiqKqy69cK3FCxolkHRy -xXtqqzTWMIn/5WgTe1QLyNau7Fqckh49ZLOMxt+/yUFw7BZy1SbsOFU5Q9D8/RhcQPGX69Wam40d -utolucbY38EVAjqr2m7xPi71XAicPNaDaeQQmxkqtilX4+U9m5/wAl0CAwEAAaNCMEAwDwYDVR0T -AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMSnsaR7LHH62+FLkHX/xBVghYkQ -MA0GCSqGSIb3DQEBBQUAA4IBAQCjGiybFwBcqR7uKGY3Or+Dxz9LwwmglSBd49lZRNI+DT69ikug -dB/OEIKcdBodfpga3csTS7MgROSR6cz8faXbauX+5v3gTt23ADq1cEmv8uXrAvHRAosZy5Q6XkjE -GB5YGV8eAlrwDPGxrancWYaLbumR9YbK+rlmM6pZW87ipxZzR8srzJmwN0jP41ZL9c8PDHIyh8bw -RLtTcm1D9SZImlJnt1ir/md2cXjbDaJWFBM5JDGFoqgCWjBH4d1QB7wCCZAA62RjYJsWvIjJEubS -fZGL+T0yjWW06XyxV3bqxbYoOb8VZRzI9neWagqNdwvYkQsEjgfbKbYK7p2CNTUQ ------END CERTIFICATE----- - -DST ACES CA X6 -============== ------BEGIN CERTIFICATE----- -MIIECTCCAvGgAwIBAgIQDV6ZCtadt3js2AdWO4YV2TANBgkqhkiG9w0BAQUFADBbMQswCQYDVQQG -EwJVUzEgMB4GA1UEChMXRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3QxETAPBgNVBAsTCERTVCBBQ0VT -MRcwFQYDVQQDEw5EU1QgQUNFUyBDQSBYNjAeFw0wMzExMjAyMTE5NThaFw0xNzExMjAyMTE5NTha -MFsxCzAJBgNVBAYTAlVTMSAwHgYDVQQKExdEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdDERMA8GA1UE -CxMIRFNUIEFDRVMxFzAVBgNVBAMTDkRTVCBBQ0VTIENBIFg2MIIBIjANBgkqhkiG9w0BAQEFAAOC -AQ8AMIIBCgKCAQEAuT31LMmU3HWKlV1j6IR3dma5WZFcRt2SPp/5DgO0PWGSvSMmtWPuktKe1jzI -DZBfZIGxqAgNTNj50wUoUrQBJcWVHAx+PhCEdc/BGZFjz+iokYi5Q1K7gLFViYsx+tC3dr5BPTCa -pCIlF3PoHuLTrCq9Wzgh1SpL11V94zpVvddtawJXa+ZHfAjIgrrep4c9oW24MFbCswKBXy314pow -GCi4ZtPLAZZv6opFVdbgnf9nKxcCpk4aahELfrd755jWjHZvwTvbUJN+5dCOHze4vbrGn2zpfDPy -MjwmR/onJALJfh1biEITajV8fTXpLmaRcpPVMibEdPVTo7NdmvYJywIDAQABo4HIMIHFMA8GA1Ud -EwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgHGMB8GA1UdEQQYMBaBFHBraS1vcHNAdHJ1c3Rkc3Qu -Y29tMGIGA1UdIARbMFkwVwYKYIZIAWUDAgEBATBJMEcGCCsGAQUFBwIBFjtodHRwOi8vd3d3LnRy -dXN0ZHN0LmNvbS9jZXJ0aWZpY2F0ZXMvcG9saWN5L0FDRVMtaW5kZXguaHRtbDAdBgNVHQ4EFgQU -CXIGThhDD+XWzMNqizF7eI+og7gwDQYJKoZIhvcNAQEFBQADggEBAKPYjtay284F5zLNAdMEA+V2 -5FYrnJmQ6AgwbN99Pe7lv7UkQIRJ4dEorsTCOlMwiPH1d25Ryvr/ma8kXxug/fKshMrfqfBfBC6t -Fr8hlxCBPeP/h40y3JTlR4peahPJlJU90u7INJXQgNStMgiAVDzgvVJT11J8smk/f3rPanTK+gQq -nExaBqXpIK1FZg9p8d2/6eMyi/rgwYZNcjwu2JN4Cir42NInPRmJX1p7ijvMDNpRrscL9yuwNwXs -vFcj4jjSm2jzVhKIT0J8uDHEtdvkyCE06UgRNe76x5JXxZ805Mf29w4LTJxoeHtxMcfrHuBnQfO3 -oKfN5XozNmr6mis= ------END CERTIFICATE----- - -TURKTRUST Certificate Services Provider Root 1 -============================================== ------BEGIN CERTIFICATE----- -MIID+zCCAuOgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBtzE/MD0GA1UEAww2VMOcUktUUlVTVCBF -bGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxMQswCQYDVQQGDAJUUjEP -MA0GA1UEBwwGQU5LQVJBMVYwVAYDVQQKDE0oYykgMjAwNSBUw5xSS1RSVVNUIEJpbGdpIMSwbGV0 -acWfaW0gdmUgQmlsacWfaW0gR8O8dmVubGnEn2kgSGl6bWV0bGVyaSBBLsWeLjAeFw0wNTA1MTMx -MDI3MTdaFw0xNTAzMjIxMDI3MTdaMIG3MT8wPQYDVQQDDDZUw5xSS1RSVVNUIEVsZWt0cm9uaWsg -U2VydGlmaWthIEhpem1ldCBTYcSfbGF5xLFjxLFzxLExCzAJBgNVBAYMAlRSMQ8wDQYDVQQHDAZB -TktBUkExVjBUBgNVBAoMTShjKSAyMDA1IFTDnFJLVFJVU1QgQmlsZ2kgxLBsZXRpxZ9pbSB2ZSBC -aWxpxZ9pbSBHw7x2ZW5sacSfaSBIaXptZXRsZXJpIEEuxZ4uMIIBIjANBgkqhkiG9w0BAQEFAAOC -AQ8AMIIBCgKCAQEAylIF1mMD2Bxf3dJ7XfIMYGFbazt0K3gNfUW9InTojAPBxhEqPZW8qZSwu5GX -yGl8hMW0kWxsE2qkVa2kheiVfrMArwDCBRj1cJ02i67L5BuBf5OI+2pVu32Fks66WJ/bMsW9Xe8i -Si9BB35JYbOG7E6mQW6EvAPs9TscyB/C7qju6hJKjRTP8wrgUDn5CDX4EVmt5yLqS8oUBt5CurKZ -8y1UiBAG6uEaPj1nH/vO+3yC6BFdSsG5FOpU2WabfIl9BJpiyelSPJ6c79L1JuTm5Rh8i27fbMx4 -W09ysstcP4wFjdFMjK2Sx+F4f2VsSQZQLJ4ywtdKxnWKWU51b0dewQIDAQABoxAwDjAMBgNVHRME -BTADAQH/MA0GCSqGSIb3DQEBBQUAA4IBAQAV9VX/N5aAWSGk/KEVTCD21F/aAyT8z5Aa9CEKmu46 -sWrv7/hg0Uw2ZkUd82YCdAR7kjCo3gp2D++Vbr3JN+YaDayJSFvMgzbC9UZcWYJWtNX+I7TYVBxE -q8Sn5RTOPEFhfEPmzcSBCYsk+1Ql1haolgxnB2+zUEfjHCQo3SqYpGH+2+oSN7wBGjSFvW5P55Fy -B0SFHljKVETd96y5y4khctuPwGkplyqjrhgjlxxBKot8KsF8kOipKMDTkcatKIdAaLX/7KfS0zgY -nNN9aV3wxqUeJBujR/xpB2jn5Jq07Q+hh4cCzofSSE7hvP/L8XKSRGQDJereW26fyfJOrN3H ------END CERTIFICATE----- - -TURKTRUST Certificate Services Provider Root 2 -============================================== ------BEGIN CERTIFICATE----- -MIIEPDCCAySgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBvjE/MD0GA1UEAww2VMOcUktUUlVTVCBF -bGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxMQswCQYDVQQGEwJUUjEP -MA0GA1UEBwwGQW5rYXJhMV0wWwYDVQQKDFRUw5xSS1RSVVNUIEJpbGdpIMSwbGV0acWfaW0gdmUg -QmlsacWfaW0gR8O8dmVubGnEn2kgSGl6bWV0bGVyaSBBLsWeLiAoYykgS2FzxLFtIDIwMDUwHhcN -MDUxMTA3MTAwNzU3WhcNMTUwOTE2MTAwNzU3WjCBvjE/MD0GA1UEAww2VMOcUktUUlVTVCBFbGVr -dHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxMQswCQYDVQQGEwJUUjEPMA0G -A1UEBwwGQW5rYXJhMV0wWwYDVQQKDFRUw5xSS1RSVVNUIEJpbGdpIMSwbGV0acWfaW0gdmUgQmls -acWfaW0gR8O8dmVubGnEn2kgSGl6bWV0bGVyaSBBLsWeLiAoYykgS2FzxLFtIDIwMDUwggEiMA0G -CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCpNn7DkUNMwxmYCMjHWHtPFoylzkkBH3MOrHUTpvqe -LCDe2JAOCtFp0if7qnefJ1Il4std2NiDUBd9irWCPwSOtNXwSadktx4uXyCcUHVPr+G1QRT0mJKI -x+XlZEdhR3n9wFHxwZnn3M5q+6+1ATDcRhzviuyV79z/rxAc653YsKpqhRgNF8k+v/Gb0AmJQv2g -QrSdiVFVKc8bcLyEVK3BEx+Y9C52YItdP5qtygy/p1Zbj3e41Z55SZI/4PGXJHpsmxcPbe9TmJEr -5A++WXkHeLuXlfSfadRYhwqp48y2WBmfJiGxxFmNskF1wK1pzpwACPI2/z7woQ8arBT9pmAPAgMB -AAGjQzBBMB0GA1UdDgQWBBTZN7NOBf3Zz58SFq62iS/rJTqIHDAPBgNVHQ8BAf8EBQMDBwYAMA8G -A1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAHJglrfJ3NgpXiOFX7KzLXb7iNcX/ntt -Rbj2hWyfIvwqECLsqrkw9qtY1jkQMZkpAL2JZkH7dN6RwRgLn7Vhy506vvWolKMiVW4XSf/SKfE4 -Jl3vpao6+XF75tpYHdN0wgH6PmlYX63LaL4ULptswLbcoCb6dxriJNoaN+BnrdFzgw2lGh1uEpJ+ -hGIAF728JRhX8tepb1mIvDS3LoV4nZbcFMMsilKbloxSZj2GFotHuFEJjOp9zYhys2AzsfAKRO8P -9Qk3iCQOLGsgOqL6EfJANZxEaGM7rDNvY7wsu/LSy3Z9fYjYHcgFHW68lKlmjHdxx/qR+i9Rnuk5 -UrbnBEI= ------END CERTIFICATE----- - -SwissSign Gold CA - G2 -====================== ------BEGIN CERTIFICATE----- -MIIFujCCA6KgAwIBAgIJALtAHEP1Xk+wMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNVBAYTAkNIMRUw -EwYDVQQKEwxTd2lzc1NpZ24gQUcxHzAdBgNVBAMTFlN3aXNzU2lnbiBHb2xkIENBIC0gRzIwHhcN -MDYxMDI1MDgzMDM1WhcNMzYxMDI1MDgzMDM1WjBFMQswCQYDVQQGEwJDSDEVMBMGA1UEChMMU3dp -c3NTaWduIEFHMR8wHQYDVQQDExZTd2lzc1NpZ24gR29sZCBDQSAtIEcyMIICIjANBgkqhkiG9w0B -AQEFAAOCAg8AMIICCgKCAgEAr+TufoskDhJuqVAtFkQ7kpJcyrhdhJJCEyq8ZVeCQD5XJM1QiyUq -t2/876LQwB8CJEoTlo8jE+YoWACjR8cGp4QjK7u9lit/VcyLwVcfDmJlD909Vopz2q5+bbqBHH5C -jCA12UNNhPqE21Is8w4ndwtrvxEvcnifLtg+5hg3Wipy+dpikJKVyh+c6bM8K8vzARO/Ws/BtQpg -vd21mWRTuKCWs2/iJneRjOBiEAKfNA+k1ZIzUd6+jbqEemA8atufK+ze3gE/bk3lUIbLtK/tREDF -ylqM2tIrfKjuvqblCqoOpd8FUrdVxyJdMmqXl2MT28nbeTZ7hTpKxVKJ+STnnXepgv9VHKVxaSvR -AiTysybUa9oEVeXBCsdtMDeQKuSeFDNeFhdVxVu1yzSJkvGdJo+hB9TGsnhQ2wwMC3wLjEHXuend -jIj3o02yMszYF9rNt85mndT9Xv+9lz4pded+p2JYryU0pUHHPbwNUMoDAw8IWh+Vc3hiv69yFGkO -peUDDniOJihC8AcLYiAQZzlG+qkDzAQ4embvIIO1jEpWjpEA/I5cgt6IoMPiaG59je883WX0XaxR -7ySArqpWl2/5rX3aYT+YdzylkbYcjCbaZaIJbcHiVOO5ykxMgI93e2CaHt+28kgeDrpOVG2Y4OGi -GqJ3UM/EY5LsRxmd6+ZrzsECAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUw -AwEB/zAdBgNVHQ4EFgQUWyV7lqRlUX64OfPAeGZe6Drn8O4wHwYDVR0jBBgwFoAUWyV7lqRlUX64 -OfPAeGZe6Drn8O4wRgYDVR0gBD8wPTA7BglghXQBWQECAQEwLjAsBggrBgEFBQcCARYgaHR0cDov -L3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBACe645R88a7A3hfm -5djV9VSwg/S7zV4Fe0+fdWavPOhWfvxyeDgD2StiGwC5+OlgzczOUYrHUDFu4Up+GC9pWbY9ZIEr -44OE5iKHjn3g7gKZYbge9LgriBIWhMIxkziWMaa5O1M/wySTVltpkuzFwbs4AOPsF6m43Md8AYOf -Mke6UiI0HTJ6CVanfCU2qT1L2sCCbwq7EsiHSycR+R4tx5M/nttfJmtS2S6K8RTGRI0Vqbe/vd6m -Gu6uLftIdxf+u+yvGPUqUfA5hJeVbG4bwyvEdGB5JbAKJ9/fXtI5z0V9QkvfsywexcZdylU6oJxp -mo/a77KwPJ+HbBIrZXAVUjEaJM9vMSNQH4xPjyPDdEFjHFWoFN0+4FFQz/EbMFYOkrCChdiDyyJk -vC24JdVUorgG6q2SpCSgwYa1ShNqR88uC1aVVMvOmttqtKay20EIhid392qgQmwLOM7XdVAyksLf -KzAiSNDVQTglXaTpXZ/GlHXQRf0wl0OPkKsKx4ZzYEppLd6leNcG2mqeSz53OiATIgHQv2ieY2Br -NU0LbbqhPcCT4H8js1WtciVORvnSFu+wZMEBnunKoGqYDs/YYPIvSbjkQuE4NRb0yG5P94FW6Lqj -viOvrv1vA+ACOzB2+httQc8Bsem4yWb02ybzOqR08kkkW8mw0FfB+j564ZfJ ------END CERTIFICATE----- - -SwissSign Silver CA - G2 -======================== ------BEGIN CERTIFICATE----- -MIIFvTCCA6WgAwIBAgIITxvUL1S7L0swDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCQ0gxFTAT -BgNVBAoTDFN3aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMB4X -DTA2MTAyNTA4MzI0NloXDTM2MTAyNTA4MzI0NlowRzELMAkGA1UEBhMCQ0gxFTATBgNVBAoTDFN3 -aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMIICIjANBgkqhkiG -9w0BAQEFAAOCAg8AMIICCgKCAgEAxPGHf9N4Mfc4yfjDmUO8x/e8N+dOcbpLj6VzHVxumK4DV644 -N0MvFz0fyM5oEMF4rhkDKxD6LHmD9ui5aLlV8gREpzn5/ASLHvGiTSf5YXu6t+WiE7brYT7QbNHm -+/pe7R20nqA1W6GSy/BJkv6FCgU+5tkL4k+73JU3/JHpMjUi0R86TieFnbAVlDLaYQ1HTWBCrpJH -6INaUFjpiou5XaHc3ZlKHzZnu0jkg7Y360g6rw9njxcH6ATK72oxh9TAtvmUcXtnZLi2kUpCe2Uu -MGoM9ZDulebyzYLs2aFK7PayS+VFheZteJMELpyCbTapxDFkH4aDCyr0NQp4yVXPQbBH6TCfmb5h -qAaEuSh6XzjZG6k4sIN/c8HDO0gqgg8hm7jMqDXDhBuDsz6+pJVpATqJAHgE2cn0mRmrVn5bi4Y5 -FZGkECwJMoBgs5PAKrYYC51+jUnyEEp/+dVGLxmSo5mnJqy7jDzmDrxHB9xzUfFwZC8I+bRHHTBs -ROopN4WSaGa8gzj+ezku01DwH/teYLappvonQfGbGHLy9YR0SslnxFSuSGTfjNFusB3hB48IHpmc -celM2KX3RxIfdNFRnobzwqIjQAtz20um53MGjMGg6cFZrEb65i/4z3GcRm25xBWNOHkDRUjvxF3X -CO6HOSKGsg0PWEP3calILv3q1h8CAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/ -BAUwAwEB/zAdBgNVHQ4EFgQUF6DNweRBtjpbO8tFnb0cwpj6hlgwHwYDVR0jBBgwFoAUF6DNweRB -tjpbO8tFnb0cwpj6hlgwRgYDVR0gBD8wPTA7BglghXQBWQEDAQEwLjAsBggrBgEFBQcCARYgaHR0 -cDovL3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBAHPGgeAn0i0P -4JUw4ppBf1AsX19iYamGamkYDHRJ1l2E6kFSGG9YrVBWIGrGvShpWJHckRE1qTodvBqlYJ7YH39F -kWnZfrt4csEGDyrOj4VwYaygzQu4OSlWhDJOhrs9xCrZ1x9y7v5RoSJBsXECYxqCsGKrXlcSH9/L -3XWgwF15kIwb4FDm3jH+mHtwX6WQ2K34ArZv02DdQEsixT2tOnqfGhpHkXkzuoLcMmkDlm4fS/Bx -/uNncqCxv1yL5PqZIseEuRuNI5c/7SXgz2W79WEE790eslpBIlqhn10s6FvJbakMDHiqYMZWjwFa -DGi8aRl5xB9+lwW/xekkUV7U1UtT7dkjWjYDZaPBA61BMPNGG4WQr2W11bHkFlt4dR2Xem1ZqSqP -e97Dh4kQmUlzeMg9vVE1dCrV8X5pGyq7O70luJpaPXJhkGaH7gzWTdQRdAtq/gsD/KNVV4n+Ssuu -WxcFyPKNIzFTONItaj+CuY0IavdeQXRuwxF+B6wpYJE/OMpXEA29MC/HpeZBoNquBYeaoKRlbEwJ -DIm6uNO5wJOKMPqN5ZprFQFOZ6raYlY+hAhm0sQ2fac+EPyI4NSA5QC9qvNOBqN6avlicuMJT+ub -DgEj8Z+7fNzcbBGXJbLytGMU0gYqZ4yD9c7qB9iaah7s5Aq7KkzrCWA5zspi2C5u ------END CERTIFICATE----- - -GeoTrust Primary Certification Authority -======================================== ------BEGIN CERTIFICATE----- -MIIDfDCCAmSgAwIBAgIQGKy1av1pthU6Y2yv2vrEoTANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQG -EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjExMC8GA1UEAxMoR2VvVHJ1c3QgUHJpbWFyeSBD -ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjExMjcwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMFgx -CzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTEwLwYDVQQDEyhHZW9UcnVzdCBQ -cmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB -CgKCAQEAvrgVe//UfH1nrYNke8hCUy3f9oQIIGHWAVlqnEQRr+92/ZV+zmEwu3qDXwK9AWbK7hWN -b6EwnL2hhZ6UOvNWiAAxz9juapYC2e0DjPt1befquFUWBRaa9OBesYjAZIVcFU2Ix7e64HXprQU9 -nceJSOC7KMgD4TCTZF5SwFlwIjVXiIrxlQqD17wxcwE07e9GceBrAqg1cmuXm2bgyxx5X9gaBGge -RwLmnWDiNpcB3841kt++Z8dtd1k7j53WkBWUvEI0EME5+bEnPn7WinXFsq+W06Lem+SYvn3h6YGt -tm/81w7a4DSwDRp35+MImO9Y+pyEtzavwt+s0vQQBnBxNQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD -AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQULNVQQZcVi/CPNmFbSvtr2ZnJM5IwDQYJKoZI -hvcNAQEFBQADggEBAFpwfyzdtzRP9YZRqSa+S7iq8XEN3GHHoOo0Hnp3DwQ16CePbJC/kRYkRj5K -Ts4rFtULUh38H2eiAkUxT87z+gOneZ1TatnaYzr4gNfTmeGl4b7UVXGYNTq+k+qurUKykG/g/CFN -NWMziUnWm07Kx+dOCQD32sfvmWKZd7aVIl6KoKv0uHiYyjgZmclynnjNS6yvGaBzEi38wkG6gZHa -Floxt/m0cYASSJlyc1pZU8FjUjPtp8nSOQJw+uCxQmYpqptR7TBUIhRf2asdweSU8Pj1K/fqynhG -1riR/aYNKxoUAT6A8EKglQdebc3MS6RFjasS6LPeWuWgfOgPIh1a6Vk= ------END CERTIFICATE----- - -thawte Primary Root CA -====================== ------BEGIN CERTIFICATE----- -MIIEIDCCAwigAwIBAgIQNE7VVyDV7exJ9C/ON9srbTANBgkqhkiG9w0BAQUFADCBqTELMAkGA1UE -BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2 -aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv -cml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMTFnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwHhcNMDYxMTE3 -MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCBqTELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwg -SW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMv -KGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMT -FnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCs -oPD7gFnUnMekz52hWXMJEEUMDSxuaPFsW0hoSVk3/AszGcJ3f8wQLZU0HObrTQmnHNK4yZc2AreJ -1CRfBsDMRJSUjQJib+ta3RGNKJpchJAQeg29dGYvajig4tVUROsdB58Hum/u6f1OCyn1PoSgAfGc -q/gcfomk6KHYcWUNo1F77rzSImANuVud37r8UVsLr5iy6S7pBOhih94ryNdOwUxkHt3Ph1i6Sk/K -aAcdHJ1KxtUvkcx8cXIcxcBn6zL9yZJclNqFwJu/U30rCfSMnZEfl2pSy94JNqR32HuHUETVPm4p -afs5SSYeCaWAe0At6+gnhcn+Yf1+5nyXHdWdAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYD -VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBR7W0XPr87Lev0xkhpqtvNG61dIUDANBgkqhkiG9w0BAQUF -AAOCAQEAeRHAS7ORtvzw6WfUDW5FvlXok9LOAz/t2iWwHVfLHjp2oEzsUHboZHIMpKnxuIvW1oeE -uzLlQRHAd9mzYJ3rG9XRbkREqaYB7FViHXe4XI5ISXycO1cRrK1zN44veFyQaEfZYGDm/Ac9IiAX -xPcW6cTYcvnIc3zfFi8VqT79aie2oetaupgf1eNNZAqdE8hhuvU5HIe6uL17In/2/qxAeeWsEG89 -jxt5dovEN7MhGITlNgDrYyCZuen+MwS7QcjBAvlEYyCegc5C09Y/LHbTY5xZ3Y+m4Q6gLkH3LpVH -z7z9M/P2C2F+fpErgUfCJzDupxBdN49cOSvkBPB7jVaMaA== ------END CERTIFICATE----- - -VeriSign Class 3 Public Primary Certification Authority - G5 -============================================================ ------BEGIN CERTIFICATE----- -MIIE0zCCA7ugAwIBAgIQGNrRniZ96LtKIVjNzGs7SjANBgkqhkiG9w0BAQUFADCByjELMAkGA1UE -BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO -ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk -IHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRp -ZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwHhcNMDYxMTA4MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCB -yjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2ln -biBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBh -dXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmlt -YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw -ggEKAoIBAQCvJAgIKXo1nmAMqudLO07cfLw8RRy7K+D+KQL5VwijZIUVJ/XxrcgxiV0i6CqqpkKz -j/i5Vbext0uz/o9+B1fs70PbZmIVYc9gDaTY3vjgw2IIPVQT60nKWVSFJuUrjxuf6/WhkcIzSdhD -Y2pSS9KP6HBRTdGJaXvHcPaz3BJ023tdS1bTlr8Vd6Gw9KIl8q8ckmcY5fQGBO+QueQA5N06tRn/ -Arr0PO7gi+s3i+z016zy9vA9r911kTMZHRxAy3QkGSGT2RT+rCpSx4/VBEnkjWNHiDxpg8v+R70r -fk/Fla4OndTRQ8Bnc+MUCH7lP59zuDMKz10/NIeWiu5T6CUVAgMBAAGjgbIwga8wDwYDVR0TAQH/ -BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2Uv -Z2lmMCEwHzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVy -aXNpZ24uY29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFH/TZafC3ey78DAJ80M5+gKvMzEzMA0GCSqG -SIb3DQEBBQUAA4IBAQCTJEowX2LP2BqYLz3q3JktvXf2pXkiOOzEp6B4Eq1iDkVwZMXnl2YtmAl+ -X6/WzChl8gGqCBpH3vn5fJJaCGkgDdk+bW48DW7Y5gaRQBi5+MHt39tBquCWIMnNZBU4gcmU7qKE -KQsTb47bDN0lAtukixlE0kF6BWlKWE9gyn6CagsCqiUXObXbf+eEZSqVir2G3l6BFoMtEMze/aiC -Km0oHw0LxOXnGiYZ4fQRbxC1lfznQgUy286dUV4otp6F01vvpX1FQHKOtw5rDgb7MzVIcbidJ4vE -ZV8NhnacRHr2lVz2XTIIM6RUthg/aFzyQkqFOFSDX9HoLPKsEdao7WNq ------END CERTIFICATE----- - -SecureTrust CA -============== ------BEGIN CERTIFICATE----- -MIIDuDCCAqCgAwIBAgIQDPCOXAgWpa1Cf/DrJxhZ0DANBgkqhkiG9w0BAQUFADBIMQswCQYDVQQG -EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xFzAVBgNVBAMTDlNlY3VyZVRy -dXN0IENBMB4XDTA2MTEwNzE5MzExOFoXDTI5MTIzMTE5NDA1NVowSDELMAkGA1UEBhMCVVMxIDAe -BgNVBAoTF1NlY3VyZVRydXN0IENvcnBvcmF0aW9uMRcwFQYDVQQDEw5TZWN1cmVUcnVzdCBDQTCC -ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKukgeWVzfX2FI7CT8rU4niVWJxB4Q2ZQCQX -OZEzZum+4YOvYlyJ0fwkW2Gz4BERQRwdbvC4u/jep4G6pkjGnx29vo6pQT64lO0pGtSO0gMdA+9t -DWccV9cGrcrI9f4Or2YlSASWC12juhbDCE/RRvgUXPLIXgGZbf2IzIaowW8xQmxSPmjL8xk037uH -GFaAJsTQ3MBv396gwpEWoGQRS0S8Hvbn+mPeZqx2pHGj7DaUaHp3pLHnDi+BeuK1cobvomuL8A/b -01k/unK8RCSc43Oz969XL0Imnal0ugBS8kvNU3xHCzaFDmapCJcWNFfBZveA4+1wVMeT4C4oFVmH -ursCAwEAAaOBnTCBmjATBgkrBgEEAYI3FAIEBh4EAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/ -BAUwAwEB/zAdBgNVHQ4EFgQUQjK2FvoE/f5dS3rD/fdMQB1aQ68wNAYDVR0fBC0wKzApoCegJYYj -aHR0cDovL2NybC5zZWN1cmV0cnVzdC5jb20vU1RDQS5jcmwwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ -KoZIhvcNAQEFBQADggEBADDtT0rhWDpSclu1pqNlGKa7UTt36Z3q059c4EVlew3KW+JwULKUBRSu -SceNQQcSc5R+DCMh/bwQf2AQWnL1mA6s7Ll/3XpvXdMc9P+IBWlCqQVxyLesJugutIxq/3HcuLHf -mbx8IVQr5Fiiu1cprp6poxkmD5kuCLDv/WnPmRoJjeOnnyvJNjR7JLN4TJUXpAYmHrZkUjZfYGfZ -nMUFdAvnZyPSCPyI6a6Lf+Ew9Dd+/cYy2i2eRDAwbO4H3tI0/NL/QPZL9GZGBlSm8jIKYyYwa5vR -3ItHuuG51WLQoqD0ZwV4KWMabwTW+MZMo5qxN7SN5ShLHZ4swrhovO0C7jE= ------END CERTIFICATE----- - -Secure Global CA -================ ------BEGIN CERTIFICATE----- -MIIDvDCCAqSgAwIBAgIQB1YipOjUiolN9BPI8PjqpTANBgkqhkiG9w0BAQUFADBKMQswCQYDVQQG -EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBH -bG9iYWwgQ0EwHhcNMDYxMTA3MTk0MjI4WhcNMjkxMjMxMTk1MjA2WjBKMQswCQYDVQQGEwJVUzEg -MB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwg -Q0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvNS7YrGxVaQZx5RNoJLNP2MwhR/jx -YDiJiQPpvepeRlMJ3Fz1Wuj3RSoC6zFh1ykzTM7HfAo3fg+6MpjhHZevj8fcyTiW89sa/FHtaMbQ -bqR8JNGuQsiWUGMu4P51/pinX0kuleM5M2SOHqRfkNJnPLLZ/kG5VacJjnIFHovdRIWCQtBJwB1g -8NEXLJXr9qXBkqPFwqcIYA1gBBCWeZ4WNOaptvolRTnIHmX5k/Wq8VLcmZg9pYYaDDUz+kulBAYV -HDGA76oYa8J719rO+TMg1fW9ajMtgQT7sFzUnKPiXB3jqUJ1XnvUd+85VLrJChgbEplJL4hL/VBi -0XPnj3pDAgMBAAGjgZ0wgZowEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud -EwEB/wQFMAMBAf8wHQYDVR0OBBYEFK9EBMJBfkiD2045AuzshHrmzsmkMDQGA1UdHwQtMCswKaAn -oCWGI2h0dHA6Ly9jcmwuc2VjdXJldHJ1c3QuY29tL1NHQ0EuY3JsMBAGCSsGAQQBgjcVAQQDAgEA -MA0GCSqGSIb3DQEBBQUAA4IBAQBjGghAfaReUw132HquHw0LURYD7xh8yOOvaliTFGCRsoTciE6+ -OYo68+aCiV0BN7OrJKQVDpI1WkpEXk5X+nXOH0jOZvQ8QCaSmGwb7iRGDBezUqXbpZGRzzfTb+cn -CDpOGR86p1hcF895P4vkp9MmI50mD1hp/Ed+stCNi5O/KU9DaXR2Z0vPB4zmAve14bRDtUstFJ/5 -3CYNv6ZHdAbYiNE6KTCEztI5gGIbqMdXSbxqVVFnFUq+NQfk1XWYN3kwFNspnWzFacxHVaIw98xc -f8LDmBxrThaA63p4ZUWiABqvDA1VZDRIuJK58bRQKfJPIx/abKwfROHdI3hRW8cW ------END CERTIFICATE----- - -COMODO Certification Authority -============================== ------BEGIN CERTIFICATE----- -MIIEHTCCAwWgAwIBAgIQToEtioJl4AsC7j41AkblPTANBgkqhkiG9w0BAQUFADCBgTELMAkGA1UE -BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG -A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxJzAlBgNVBAMTHkNPTU9ETyBDZXJ0aWZpY2F0aW9uIEF1 -dGhvcml0eTAeFw0wNjEyMDEwMDAwMDBaFw0yOTEyMzEyMzU5NTlaMIGBMQswCQYDVQQGEwJHQjEb -MBkGA1UECBMSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHEwdTYWxmb3JkMRowGAYDVQQKExFD -T01PRE8gQ0EgTGltaXRlZDEnMCUGA1UEAxMeQ09NT0RPIENlcnRpZmljYXRpb24gQXV0aG9yaXR5 -MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0ECLi3LjkRv3UcEbVASY06m/weaKXTuH -+7uIzg3jLz8GlvCiKVCZrts7oVewdFFxze1CkU1B/qnI2GqGd0S7WWaXUF601CxwRM/aN5VCaTww -xHGzUvAhTaHYujl8HJ6jJJ3ygxaYqhZ8Q5sVW7euNJH+1GImGEaaP+vB+fGQV+useg2L23IwambV -4EajcNxo2f8ESIl33rXp+2dtQem8Ob0y2WIC8bGoPW43nOIv4tOiJovGuFVDiOEjPqXSJDlqR6sA -1KGzqSX+DT+nHbrTUcELpNqsOO9VUCQFZUaTNE8tja3G1CEZ0o7KBWFxB3NH5YoZEr0ETc5OnKVI -rLsm9wIDAQABo4GOMIGLMB0GA1UdDgQWBBQLWOWLxkwVN6RAqTCpIb5HNlpW/zAOBgNVHQ8BAf8E -BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zBJBgNVHR8EQjBAMD6gPKA6hjhodHRwOi8vY3JsLmNvbW9k -b2NhLmNvbS9DT01PRE9DZXJ0aWZpY2F0aW9uQXV0aG9yaXR5LmNybDANBgkqhkiG9w0BAQUFAAOC -AQEAPpiem/Yb6dc5t3iuHXIYSdOH5EOC6z/JqvWote9VfCFSZfnVDeFs9D6Mk3ORLgLETgdxb8CP -OGEIqB6BCsAvIC9Bi5HcSEW88cbeunZrM8gALTFGTO3nnc+IlP8zwFboJIYmuNg4ON8qa90SzMc/ -RxdMosIGlgnW2/4/PEZB31jiVg88O8EckzXZOFKs7sjsLjBOlDW0JB9LeGna8gI4zJVSk/BwJVmc -IGfE7vmLV2H0knZ9P4SNVbfo5azV8fUZVqZa+5Acr5Pr5RzUZ5ddBA6+C4OmF4O5MBKgxTMVBbkN -+8cFduPYSo38NBejxiEovjBFMR7HeL5YYTisO+IBZQ== ------END CERTIFICATE----- - -Network Solutions Certificate Authority -======================================= ------BEGIN CERTIFICATE----- -MIID5jCCAs6gAwIBAgIQV8szb8JcFuZHFhfjkDFo4DANBgkqhkiG9w0BAQUFADBiMQswCQYDVQQG -EwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMuMTAwLgYDVQQDEydOZXR3b3Jr -IFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMDYxMjAxMDAwMDAwWhcNMjkxMjMx -MjM1OTU5WjBiMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMu -MTAwLgYDVQQDEydOZXR3b3JrIFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggEiMA0G -CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDkvH6SMG3G2I4rC7xGzuAnlt7e+foS0zwzc7MEL7xx -jOWftiJgPl9dzgn/ggwbmlFQGiaJ3dVhXRncEg8tCqJDXRfQNJIg6nPPOCwGJgl6cvf6UDL4wpPT -aaIjzkGxzOTVHzbRijr4jGPiFFlp7Q3Tf2vouAPlT2rlmGNpSAW+Lv8ztumXWWn4Zxmuk2GWRBXT -crA/vGp97Eh/jcOrqnErU2lBUzS1sLnFBgrEsEX1QV1uiUV7PTsmjHTC5dLRfbIR1PtYMiKagMnc -/Qzpf14Dl847ABSHJ3A4qY5usyd2mFHgBeMhqxrVhSI8KbWaFsWAqPS7azCPL0YCorEMIuDTAgMB -AAGjgZcwgZQwHQYDVR0OBBYEFCEwyfsA106Y2oeqKtCnLrFAMadMMA4GA1UdDwEB/wQEAwIBBjAP -BgNVHRMBAf8EBTADAQH/MFIGA1UdHwRLMEkwR6BFoEOGQWh0dHA6Ly9jcmwubmV0c29sc3NsLmNv -bS9OZXR3b3JrU29sdXRpb25zQ2VydGlmaWNhdGVBdXRob3JpdHkuY3JsMA0GCSqGSIb3DQEBBQUA -A4IBAQC7rkvnt1frf6ott3NHhWrB5KUd5Oc86fRZZXe1eltajSU24HqXLjjAV2CDmAaDn7l2em5Q -4LqILPxFzBiwmZVRDuwduIj/h1AcgsLj4DKAv6ALR8jDMe+ZZzKATxcheQxpXN5eNK4CtSbqUN9/ -GGUsyfJj4akH/nxxH2szJGoeBfcFaMBqEssuXmHLrijTfsK0ZpEmXzwuJF/LWA/rKOyvEZbz3Htv -wKeI8lN3s2Berq4o2jUsbzRF0ybh3uxbTydrFny9RAQYgrOJeRcQcT16ohZO9QHNpGxlaKFJdlxD -ydi8NmdspZS11My5vWo1ViHe2MPr+8ukYEywVaCge1ey ------END CERTIFICATE----- - -WellsSecure Public Root Certificate Authority -============================================= ------BEGIN CERTIFICATE----- -MIIEvTCCA6WgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBhTELMAkGA1UEBhMCVVMxIDAeBgNVBAoM -F1dlbGxzIEZhcmdvIFdlbGxzU2VjdXJlMRwwGgYDVQQLDBNXZWxscyBGYXJnbyBCYW5rIE5BMTYw -NAYDVQQDDC1XZWxsc1NlY3VyZSBQdWJsaWMgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcN -MDcxMjEzMTcwNzU0WhcNMjIxMjE0MDAwNzU0WjCBhTELMAkGA1UEBhMCVVMxIDAeBgNVBAoMF1dl -bGxzIEZhcmdvIFdlbGxzU2VjdXJlMRwwGgYDVQQLDBNXZWxscyBGYXJnbyBCYW5rIE5BMTYwNAYD -VQQDDC1XZWxsc1NlY3VyZSBQdWJsaWMgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggEiMA0G -CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDub7S9eeKPCCGeOARBJe+rWxxTkqxtnt3CxC5FlAM1 -iGd0V+PfjLindo8796jE2yljDpFoNoqXjopxaAkH5OjUDk/41itMpBb570OYj7OeUt9tkTmPOL13 -i0Nj67eT/DBMHAGTthP796EfvyXhdDcsHqRePGj4S78NuR4uNuip5Kf4D8uCdXw1LSLWwr8L87T8 -bJVhHlfXBIEyg1J55oNjz7fLY4sR4r1e6/aN7ZVyKLSsEmLpSjPmgzKuBXWVvYSV2ypcm44uDLiB -K0HmOFafSZtsdvqKXfcBeYF8wYNABf5x/Qw/zE5gCQ5lRxAvAcAFP4/4s0HvWkJ+We/SlwxlAgMB -AAGjggE0MIIBMDAPBgNVHRMBAf8EBTADAQH/MDkGA1UdHwQyMDAwLqAsoCqGKGh0dHA6Ly9jcmwu -cGtpLndlbGxzZmFyZ28uY29tL3dzcHJjYS5jcmwwDgYDVR0PAQH/BAQDAgHGMB0GA1UdDgQWBBQm -lRkQ2eihl5H/3BnZtQQ+0nMKajCBsgYDVR0jBIGqMIGngBQmlRkQ2eihl5H/3BnZtQQ+0nMKaqGB -i6SBiDCBhTELMAkGA1UEBhMCVVMxIDAeBgNVBAoMF1dlbGxzIEZhcmdvIFdlbGxzU2VjdXJlMRww -GgYDVQQLDBNXZWxscyBGYXJnbyBCYW5rIE5BMTYwNAYDVQQDDC1XZWxsc1NlY3VyZSBQdWJsaWMg -Um9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHmCAQEwDQYJKoZIhvcNAQEFBQADggEBALkVsUSRzCPI -K0134/iaeycNzXK7mQDKfGYZUMbVmO2rvwNa5U3lHshPcZeG1eMd/ZDJPHV3V3p9+N701NX3leZ0 -bh08rnyd2wIDBSxxSyU+B+NemvVmFymIGjifz6pBA4SXa5M4esowRBskRDPQ5NHcKDj0E0M1NSlj -qHyita04pO2t/caaH/+Xc/77szWnk4bGdpEA5qxRFsQnMlzbc9qlk1eOPm01JghZ1edE13YgY+es -E2fDbbFwRnzVlhE9iW9dqKHrjQrawx0zbKPqZxmamX9LPYNRKh3KL4YMon4QLSvUFpULB6ouFJJJ -tylv2G0xffX8oRAHh84vWdw+WNs= ------END CERTIFICATE----- - -COMODO ECC Certification Authority -================================== ------BEGIN CERTIFICATE----- -MIICiTCCAg+gAwIBAgIQH0evqmIAcFBUTAGem2OZKjAKBggqhkjOPQQDAzCBhTELMAkGA1UEBhMC -R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE -ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBB -dXRob3JpdHkwHhcNMDgwMzA2MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMCR0Ix -GzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMR -Q09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBBdXRo -b3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQDR3svdcmCFYX7deSRFtSrYpn1PlILBs5BAH+X -4QokPB0BBO490o0JlwzgdeT6+3eKKvUDYEs2ixYjFq0JcfRK9ChQtP6IHG4/bC8vCVlbpVsLM5ni -wz2J+Wos77LTBumjQjBAMB0GA1UdDgQWBBR1cacZSBm8nZ3qQUfflMRId5nTeTAOBgNVHQ8BAf8E -BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjEA7wNbeqy3eApyt4jf/7VG -FAkK+qDmfQjGGoe9GKhzvSbKYAydzpmfz1wPMOG+FDHqAjAU9JM8SaczepBGR7NjfRObTrdvGDeA -U/7dIOA1mjbRxwG55tzd8/8dLDoWV9mSOdY= ------END CERTIFICATE----- - -IGC/A -===== ------BEGIN CERTIFICATE----- -MIIEAjCCAuqgAwIBAgIFORFFEJQwDQYJKoZIhvcNAQEFBQAwgYUxCzAJBgNVBAYTAkZSMQ8wDQYD -VQQIEwZGcmFuY2UxDjAMBgNVBAcTBVBhcmlzMRAwDgYDVQQKEwdQTS9TR0ROMQ4wDAYDVQQLEwVE -Q1NTSTEOMAwGA1UEAxMFSUdDL0ExIzAhBgkqhkiG9w0BCQEWFGlnY2FAc2dkbi5wbS5nb3V2LmZy -MB4XDTAyMTIxMzE0MjkyM1oXDTIwMTAxNzE0MjkyMlowgYUxCzAJBgNVBAYTAkZSMQ8wDQYDVQQI -EwZGcmFuY2UxDjAMBgNVBAcTBVBhcmlzMRAwDgYDVQQKEwdQTS9TR0ROMQ4wDAYDVQQLEwVEQ1NT -STEOMAwGA1UEAxMFSUdDL0ExIzAhBgkqhkiG9w0BCQEWFGlnY2FAc2dkbi5wbS5nb3V2LmZyMIIB -IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsh/R0GLFMzvABIaIs9z4iPf930Pfeo2aSVz2 -TqrMHLmh6yeJ8kbpO0px1R2OLc/mratjUMdUC24SyZA2xtgv2pGqaMVy/hcKshd+ebUyiHDKcMCW -So7kVc0dJ5S/znIq7Fz5cyD+vfcuiWe4u0dzEvfRNWk68gq5rv9GQkaiv6GFGvm/5P9JhfejcIYy -HF2fYPepraX/z9E0+X1bF8bc1g4oa8Ld8fUzaJ1O/Id8NhLWo4DoQw1VYZTqZDdH6nfK0LJYBcNd -frGoRpAxVs5wKpayMLh35nnAvSk7/ZR3TL0gzUEl4C7HG7vupARB0l2tEmqKm0f7yd1GQOGdPDPQ -tQIDAQABo3cwdTAPBgNVHRMBAf8EBTADAQH/MAsGA1UdDwQEAwIBRjAVBgNVHSAEDjAMMAoGCCqB -egF5AQEBMB0GA1UdDgQWBBSjBS8YYFDCiQrdKyFP/45OqDAxNjAfBgNVHSMEGDAWgBSjBS8YYFDC -iQrdKyFP/45OqDAxNjANBgkqhkiG9w0BAQUFAAOCAQEABdwm2Pp3FURo/C9mOnTgXeQp/wYHE4RK -q89toB9RlPhJy3Q2FLwV3duJL92PoF189RLrn544pEfMs5bZvpwlqwN+Mw+VgQ39FuCIvjfwbF3Q -MZsyK10XZZOYYLxuj7GoPB7ZHPOpJkL5ZB3C55L29B5aqhlSXa/oovdgoPaN8In1buAKBQGVyYsg -Crpa/JosPL3Dt8ldeCUFP1YUmwza+zpI/pdpXsoQhvdOlgQITeywvl3cO45Pwf2aNjSaTFR+FwNI -lQgRHAdvhQh+XU3Endv7rs6y0bO4g2wdsrN58dhwmX7wEwLOXt1R0982gaEbeC9xs/FZTEYYKKuF -0mBWWg== ------END CERTIFICATE----- - -Security Communication EV RootCA1 -================================= ------BEGIN CERTIFICATE----- -MIIDfTCCAmWgAwIBAgIBADANBgkqhkiG9w0BAQUFADBgMQswCQYDVQQGEwJKUDElMCMGA1UEChMc -U0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEqMCgGA1UECxMhU2VjdXJpdHkgQ29tbXVuaWNh -dGlvbiBFViBSb290Q0ExMB4XDTA3MDYwNjAyMTIzMloXDTM3MDYwNjAyMTIzMlowYDELMAkGA1UE -BhMCSlAxJTAjBgNVBAoTHFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xKjAoBgNVBAsTIVNl -Y3VyaXR5IENvbW11bmljYXRpb24gRVYgUm9vdENBMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC -AQoCggEBALx/7FebJOD+nLpCeamIivqA4PUHKUPqjgo0No0c+qe1OXj/l3X3L+SqawSERMqm4miO -/VVQYg+kcQ7OBzgtQoVQrTyWb4vVog7P3kmJPdZkLjjlHmy1V4qe70gOzXppFodEtZDkBp2uoQSX -WHnvIEqCa4wiv+wfD+mEce3xDuS4GBPMVjZd0ZoeUWs5bmB2iDQL87PRsJ3KYeJkHcFGB7hj3R4z -ZbOOCVVSPbW9/wfrrWFVGCypaZhKqkDFMxRldAD5kd6vA0jFQFTcD4SQaCDFkpbcLuUCRarAX1T4 -bepJz11sS6/vmsJWXMY1VkJqMF/Cq/biPT+zyRGPMUzXn0kCAwEAAaNCMEAwHQYDVR0OBBYEFDVK -9U2vP9eCOKyrcWUXdYydVZPmMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqG -SIb3DQEBBQUAA4IBAQCoh+ns+EBnXcPBZsdAS5f8hxOQWsTvoMpfi7ent/HWtWS3irO4G8za+6xm -iEHO6Pzk2x6Ipu0nUBsCMCRGef4Eh3CXQHPRwMFXGZpppSeZq51ihPZRwSzJIxXYKLerJRO1RuGG -Av8mjMSIkh1W/hln8lXkgKNrnKt34VFxDSDbEJrbvXZ5B3eZKK2aXtqxT0QsNY6llsf9g/BYxnnW -mHyojf6GPgcWkuF75x3sM3Z+Qi5KhfmRiWiEA4Glm5q+4zfFVKtWOxgtQaQM+ELbmaDgcm+7XeEW -T1MKZPlO9L9OVL14bIjqv5wTJMJwaaJ/D8g8rQjJsJhAoyrniIPtd490 ------END CERTIFICATE----- - -OISTE WISeKey Global Root GA CA -=============================== ------BEGIN CERTIFICATE----- -MIID8TCCAtmgAwIBAgIQQT1yx/RrH4FDffHSKFTfmjANBgkqhkiG9w0BAQUFADCBijELMAkGA1UE -BhMCQ0gxEDAOBgNVBAoTB1dJU2VLZXkxGzAZBgNVBAsTEkNvcHlyaWdodCAoYykgMjAwNTEiMCAG -A1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNlZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBH -bG9iYWwgUm9vdCBHQSBDQTAeFw0wNTEyMTExNjAzNDRaFw0zNzEyMTExNjA5NTFaMIGKMQswCQYD -VQQGEwJDSDEQMA4GA1UEChMHV0lTZUtleTEbMBkGA1UECxMSQ29weXJpZ2h0IChjKSAyMDA1MSIw -IAYDVQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5 -IEdsb2JhbCBSb290IEdBIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAy0+zAJs9 -Nt350UlqaxBJH+zYK7LG+DKBKUOVTJoZIyEVRd7jyBxRVVuuk+g3/ytr6dTqvirdqFEr12bDYVxg -Asj1znJ7O7jyTmUIms2kahnBAbtzptf2w93NvKSLtZlhuAGio9RN1AU9ka34tAhxZK9w8RxrfvbD -d50kc3vkDIzh2TbhmYsFmQvtRTEJysIA2/dyoJaqlYfQjse2YXMNdmaM3Bu0Y6Kff5MTMPGhJ9vZ -/yxViJGg4E8HsChWjBgbl0SOid3gF27nKu+POQoxhILYQBRJLnpB5Kf+42TMwVlxSywhp1t94B3R -LoGbw9ho972WG6xwsRYUC9tguSYBBQIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUw -AwEB/zAdBgNVHQ4EFgQUswN+rja8sHnR3JQmthG+IbJphpQwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ -KoZIhvcNAQEFBQADggEBAEuh/wuHbrP5wUOxSPMowB0uyQlB+pQAHKSkq0lPjz0e701vvbyk9vIm -MMkQyh2I+3QZH4VFvbBsUfk2ftv1TDI6QU9bR8/oCy22xBmddMVHxjtqD6wU2zz0c5ypBd8A3HR4 -+vg1YFkCExh8vPtNsCBtQ7tgMHpnM1zFmdH4LTlSc/uMqpclXHLZCB6rTjzjgTGfA6b7wP4piFXa -hNVQA7bihKOmNqoROgHhGEvWRGizPflTdISzRpFGlgC3gCy24eMQ4tui5yiPAZZiFj4A4xylNoEY -okxSdsARo27mHbrjWr42U8U+dY+GaSlYU7Wcu2+fXMUY7N0v4ZjJ/L7fCg0= ------END CERTIFICATE----- - -Microsec e-Szigno Root CA -========================= ------BEGIN CERTIFICATE----- -MIIHqDCCBpCgAwIBAgIRAMy4579OKRr9otxmpRwsDxEwDQYJKoZIhvcNAQEFBQAwcjELMAkGA1UE -BhMCSFUxETAPBgNVBAcTCEJ1ZGFwZXN0MRYwFAYDVQQKEw1NaWNyb3NlYyBMdGQuMRQwEgYDVQQL -EwtlLVN6aWdubyBDQTEiMCAGA1UEAxMZTWljcm9zZWMgZS1Temlnbm8gUm9vdCBDQTAeFw0wNTA0 -MDYxMjI4NDRaFw0xNzA0MDYxMjI4NDRaMHIxCzAJBgNVBAYTAkhVMREwDwYDVQQHEwhCdWRhcGVz -dDEWMBQGA1UEChMNTWljcm9zZWMgTHRkLjEUMBIGA1UECxMLZS1Temlnbm8gQ0ExIjAgBgNVBAMT -GU1pY3Jvc2VjIGUtU3ppZ25vIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB -AQDtyADVgXvNOABHzNuEwSFpLHSQDCHZU4ftPkNEU6+r+ICbPHiN1I2uuO/TEdyB5s87lozWbxXG -d36hL+BfkrYn13aaHUM86tnsL+4582pnS4uCzyL4ZVX+LMsvfUh6PXX5qqAnu3jCBspRwn5mS6/N -oqdNAoI/gqyFxuEPkEeZlApxcpMqyabAvjxWTHOSJ/FrtfX9/DAFYJLG65Z+AZHCabEeHXtTRbjc -QR/Ji3HWVBTji1R4P770Yjtb9aPs1ZJ04nQw7wHb4dSrmZsqa/i9phyGI0Jf7Enemotb9HI6QMVJ -PqW+jqpx62z69Rrkav17fVVA71hu5tnVvCSrwe+3AgMBAAGjggQ3MIIEMzBnBggrBgEFBQcBAQRb -MFkwKAYIKwYBBQUHMAGGHGh0dHBzOi8vcmNhLmUtc3ppZ25vLmh1L29jc3AwLQYIKwYBBQUHMAKG -IWh0dHA6Ly93d3cuZS1zemlnbm8uaHUvUm9vdENBLmNydDAPBgNVHRMBAf8EBTADAQH/MIIBcwYD -VR0gBIIBajCCAWYwggFiBgwrBgEEAYGoGAIBAQEwggFQMCgGCCsGAQUFBwIBFhxodHRwOi8vd3d3 -LmUtc3ppZ25vLmh1L1NaU1ovMIIBIgYIKwYBBQUHAgIwggEUHoIBEABBACAAdABhAG4A+gBzAO0A -dAB2AOEAbgB5ACAA6QByAHQAZQBsAG0AZQB6AOkAcwDpAGgAZQB6ACAA6QBzACAAZQBsAGYAbwBn -AGEAZADhAHMA4QBoAG8AegAgAGEAIABTAHoAbwBsAGcA4QBsAHQAYQB0APMAIABTAHoAbwBsAGcA -4QBsAHQAYQB0AOEAcwBpACAAUwB6AGEAYgDhAGwAeQB6AGEAdABhACAAcwB6AGUAcgBpAG4AdAAg -AGsAZQBsAGwAIABlAGwAagDhAHIAbgBpADoAIABoAHQAdABwADoALwAvAHcAdwB3AC4AZQAtAHMA -egBpAGcAbgBvAC4AaAB1AC8AUwBaAFMAWgAvMIHIBgNVHR8EgcAwgb0wgbqggbeggbSGIWh0dHA6 -Ly93d3cuZS1zemlnbm8uaHUvUm9vdENBLmNybIaBjmxkYXA6Ly9sZGFwLmUtc3ppZ25vLmh1L0NO -PU1pY3Jvc2VjJTIwZS1Temlnbm8lMjBSb290JTIwQ0EsT1U9ZS1Temlnbm8lMjBDQSxPPU1pY3Jv -c2VjJTIwTHRkLixMPUJ1ZGFwZXN0LEM9SFU/Y2VydGlmaWNhdGVSZXZvY2F0aW9uTGlzdDtiaW5h -cnkwDgYDVR0PAQH/BAQDAgEGMIGWBgNVHREEgY4wgYuBEGluZm9AZS1zemlnbm8uaHWkdzB1MSMw -IQYDVQQDDBpNaWNyb3NlYyBlLVN6aWduw7MgUm9vdCBDQTEWMBQGA1UECwwNZS1TemlnbsOzIEhT -WjEWMBQGA1UEChMNTWljcm9zZWMgS2Z0LjERMA8GA1UEBxMIQnVkYXBlc3QxCzAJBgNVBAYTAkhV -MIGsBgNVHSMEgaQwgaGAFMegSXUWYYTbMUuE0vE3QJDvTtz3oXakdDByMQswCQYDVQQGEwJIVTER -MA8GA1UEBxMIQnVkYXBlc3QxFjAUBgNVBAoTDU1pY3Jvc2VjIEx0ZC4xFDASBgNVBAsTC2UtU3pp -Z25vIENBMSIwIAYDVQQDExlNaWNyb3NlYyBlLVN6aWdubyBSb290IENBghEAzLjnv04pGv2i3Gal -HCwPETAdBgNVHQ4EFgQUx6BJdRZhhNsxS4TS8TdAkO9O3PcwDQYJKoZIhvcNAQEFBQADggEBANMT -nGZjWS7KXHAM/IO8VbH0jgdsZifOwTsgqRy7RlRw7lrMoHfqaEQn6/Ip3Xep1fvj1KcExJW4C+FE -aGAHQzAxQmHl7tnlJNUb3+FKG6qfx1/4ehHqE5MAyopYse7tDk2016g2JnzgOsHVV4Lxdbb9iV/a -86g4nzUGCM4ilb7N1fy+W955a9x6qWVmvrElWl/tftOsRm1M9DKHtCAE4Gx4sHfRhUZLphK3dehK -yVZs15KrnfVJONJPU+NVkBHbmJbGSfI+9J8b4PeI3CVimUTYc78/MPMMNz7UwiiAc7EBt51alhQB -S6kRnSlqLtBdgcDPsiBDxwPgN05dCtxZICU= ------END CERTIFICATE----- - -Certigna -======== ------BEGIN CERTIFICATE----- -MIIDqDCCApCgAwIBAgIJAP7c4wEPyUj/MA0GCSqGSIb3DQEBBQUAMDQxCzAJBgNVBAYTAkZSMRIw -EAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hMB4XDTA3MDYyOTE1MTMwNVoXDTI3 -MDYyOTE1MTMwNVowNDELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczERMA8GA1UEAwwI -Q2VydGlnbmEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDIaPHJ1tazNHUmgh7stL7q -XOEm7RFHYeGifBZ4QCHkYJ5ayGPhxLGWkv8YbWkj4Sti993iNi+RB7lIzw7sebYs5zRLcAglozyH -GxnygQcPOJAZ0xH+hrTy0V4eHpbNgGzOOzGTtvKg0KmVEn2lmsxryIRWijOp5yIVUxbwzBfsV1/p -ogqYCd7jX5xv3EjjhQsVWqa6n6xI4wmy9/Qy3l40vhx4XUJbzg4ij02Q130yGLMLLGq/jj8UEYkg -DncUtT2UCIf3JR7VsmAA7G8qKCVuKj4YYxclPz5EIBb2JsglrgVKtOdjLPOMFlN+XPsRGgjBRmKf -Irjxwo1p3Po6WAbfAgMBAAGjgbwwgbkwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUGu3+QTmQ -tCRZvgHyUtVF9lo53BEwZAYDVR0jBF0wW4AUGu3+QTmQtCRZvgHyUtVF9lo53BGhOKQ2MDQxCzAJ -BgNVBAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hggkA/tzjAQ/J -SP8wDgYDVR0PAQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzANBgkqhkiG9w0BAQUFAAOCAQEA -hQMeknH2Qq/ho2Ge6/PAD/Kl1NqV5ta+aDY9fm4fTIrv0Q8hbV6lUmPOEvjvKtpv6zf+EwLHyzs+ -ImvaYS5/1HI93TDhHkxAGYwP15zRgzB7mFncfca5DClMoTOi62c6ZYTTluLtdkVwj7Ur3vkj1klu -PBS1xp81HlDQwY9qcEQCYsuuHWhBp6pX6FOqB9IG9tUUBguRA3UsbHK1YZWaDYu5Def131TN3ubY -1gkIl2PlwS6wt0QmwCbAr1UwnjvVNioZBPRcHv/PLLf/0P2HQBHVESO7SMAhqaQoLf0V+LBOK/Qw -WyH8EZE0vkHve52Xdf+XlcCWWC/qu0bXu+TZLg== ------END CERTIFICATE----- - -AC Ra\xC3\xADz Certic\xC3\xA1mara S.A. -====================================== ------BEGIN CERTIFICATE----- -MIIGZjCCBE6gAwIBAgIPB35Sk3vgFeNX8GmMy+wMMA0GCSqGSIb3DQEBBQUAMHsxCzAJBgNVBAYT -AkNPMUcwRQYDVQQKDD5Tb2NpZWRhZCBDYW1lcmFsIGRlIENlcnRpZmljYWNpw7NuIERpZ2l0YWwg -LSBDZXJ0aWPDoW1hcmEgUy5BLjEjMCEGA1UEAwwaQUMgUmHDrXogQ2VydGljw6FtYXJhIFMuQS4w -HhcNMDYxMTI3MjA0NjI5WhcNMzAwNDAyMjE0MjAyWjB7MQswCQYDVQQGEwJDTzFHMEUGA1UECgw+ -U29jaWVkYWQgQ2FtZXJhbCBkZSBDZXJ0aWZpY2FjacOzbiBEaWdpdGFsIC0gQ2VydGljw6FtYXJh -IFMuQS4xIzAhBgNVBAMMGkFDIFJhw616IENlcnRpY8OhbWFyYSBTLkEuMIICIjANBgkqhkiG9w0B -AQEFAAOCAg8AMIICCgKCAgEAq2uJo1PMSCMI+8PPUZYILrgIem08kBeGqentLhM0R7LQcNzJPNCN -yu5LF6vQhbCnIwTLqKL85XXbQMpiiY9QngE9JlsYhBzLfDe3fezTf3MZsGqy2IiKLUV0qPezuMDU -2s0iiXRNWhU5cxh0T7XrmafBHoi0wpOQY5fzp6cSsgkiBzPZkc0OnB8OIMfuuzONj8LSWKdf/WU3 -4ojC2I+GdV75LaeHM/J4Ny+LvB2GNzmxlPLYvEqcgxhaBvzz1NS6jBUJJfD5to0EfhcSM2tXSExP -2yYe68yQ54v5aHxwD6Mq0Do43zeX4lvegGHTgNiRg0JaTASJaBE8rF9ogEHMYELODVoqDA+bMMCm -8Ibbq0nXl21Ii/kDwFJnmxL3wvIumGVC2daa49AZMQyth9VXAnow6IYm+48jilSH5L887uvDdUhf -HjlvgWJsxS3EF1QZtzeNnDeRyPYL1epjb4OsOMLzP96a++EjYfDIJss2yKHzMI+ko6Kh3VOz3vCa -Mh+DkXkwwakfU5tTohVTP92dsxA7SH2JD/ztA/X7JWR1DhcZDY8AFmd5ekD8LVkH2ZD6mq093ICK -5lw1omdMEWux+IBkAC1vImHFrEsm5VoQgpukg3s0956JkSCXjrdCx2bD0Omk1vUgjcTDlaxECp1b -czwmPS9KvqfJpxAe+59QafMCAwEAAaOB5jCB4zAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQE -AwIBBjAdBgNVHQ4EFgQU0QnQ6dfOeXRU+Tows/RtLAMDG2gwgaAGA1UdIASBmDCBlTCBkgYEVR0g -ADCBiTArBggrBgEFBQcCARYfaHR0cDovL3d3dy5jZXJ0aWNhbWFyYS5jb20vZHBjLzBaBggrBgEF -BQcCAjBOGkxMaW1pdGFjaW9uZXMgZGUgZ2FyYW507WFzIGRlIGVzdGUgY2VydGlmaWNhZG8gc2Ug -cHVlZGVuIGVuY29udHJhciBlbiBsYSBEUEMuMA0GCSqGSIb3DQEBBQUAA4ICAQBclLW4RZFNjmEf -AygPU3zmpFmps4p6xbD/CHwso3EcIRNnoZUSQDWDg4902zNc8El2CoFS3UnUmjIz75uny3XlesuX -EpBcunvFm9+7OSPI/5jOCk0iAUgHforA1SBClETvv3eiiWdIG0ADBaGJ7M9i4z0ldma/Jre7Ir5v -/zlXdLp6yQGVwZVR6Kss+LGGIOk/yzVb0hfpKv6DExdA7ohiZVvVO2Dpezy4ydV/NgIlqmjCMRW3 -MGXrfx1IebHPOeJCgBbT9ZMj/EyXyVo3bHwi2ErN0o42gzmRkBDI8ck1fj+404HGIGQatlDCIaR4 -3NAvO2STdPCWkPHv+wlaNECW8DYSwaN0jJN+Qd53i+yG2dIPPy3RzECiiWZIHiCznCNZc6lEc7wk -eZBWN7PGKX6jD/EpOe9+XCgycDWs2rjIdWb8m0w5R44bb5tNAlQiM+9hup4phO9OSzNHdpdqy35f -/RWmnkJDW2ZaiogN9xa5P1FlK2Zqi9E4UqLWRhH6/JocdJ6PlwsCT2TG9WjTSy3/pDceiz+/RL5h -RqGEPQgnTIEgd4kI6mdAXmwIUV80WoyWaM3X94nCHNMyAK9Sy9NgWyo6R35rMDOhYil/SrnhLecU -Iw4OGEfhefwVVdCx/CVxY3UzHCMrr1zZ7Ud3YA47Dx7SwNxkBYn8eNZcLCZDqQ== ------END CERTIFICATE----- - -TC TrustCenter Class 2 CA II -============================ ------BEGIN CERTIFICATE----- -MIIEqjCCA5KgAwIBAgIOLmoAAQACH9dSISwRXDswDQYJKoZIhvcNAQEFBQAwdjELMAkGA1UEBhMC -REUxHDAaBgNVBAoTE1RDIFRydXN0Q2VudGVyIEdtYkgxIjAgBgNVBAsTGVRDIFRydXN0Q2VudGVy -IENsYXNzIDIgQ0ExJTAjBgNVBAMTHFRDIFRydXN0Q2VudGVyIENsYXNzIDIgQ0EgSUkwHhcNMDYw -MTEyMTQzODQzWhcNMjUxMjMxMjI1OTU5WjB2MQswCQYDVQQGEwJERTEcMBoGA1UEChMTVEMgVHJ1 -c3RDZW50ZXIgR21iSDEiMCAGA1UECxMZVEMgVHJ1c3RDZW50ZXIgQ2xhc3MgMiBDQTElMCMGA1UE -AxMcVEMgVHJ1c3RDZW50ZXIgQ2xhc3MgMiBDQSBJSTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC -AQoCggEBAKuAh5uO8MN8h9foJIIRszzdQ2Lu+MNF2ujhoF/RKrLqk2jftMjWQ+nEdVl//OEd+DFw -IxuInie5e/060smp6RQvkL4DUsFJzfb95AhmC1eKokKguNV/aVyQMrKXDcpK3EY+AlWJU+MaWss2 -xgdW94zPEfRMuzBwBJWl9jmM/XOBCH2JXjIeIqkiRUuwZi4wzJ9l/fzLganx4Duvo4bRierERXlQ -Xa7pIXSSTYtZgo+U4+lK8edJsBTj9WLL1XK9H7nSn6DNqPoByNkN39r8R52zyFTfSUrxIan+GE7u -SNQZu+995OKdy1u2bv/jzVrndIIFuoAlOMvkaZ6vQaoahPUCAwEAAaOCATQwggEwMA8GA1UdEwEB -/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTjq1RMgKHbVkO3kUrL84J6E1wIqzCB -7QYDVR0fBIHlMIHiMIHfoIHcoIHZhjVodHRwOi8vd3d3LnRydXN0Y2VudGVyLmRlL2NybC92Mi90 -Y19jbGFzc18yX2NhX0lJLmNybIaBn2xkYXA6Ly93d3cudHJ1c3RjZW50ZXIuZGUvQ049VEMlMjBU -cnVzdENlbnRlciUyMENsYXNzJTIwMiUyMENBJTIwSUksTz1UQyUyMFRydXN0Q2VudGVyJTIwR21i -SCxPVT1yb290Y2VydHMsREM9dHJ1c3RjZW50ZXIsREM9ZGU/Y2VydGlmaWNhdGVSZXZvY2F0aW9u -TGlzdD9iYXNlPzANBgkqhkiG9w0BAQUFAAOCAQEAjNfffu4bgBCzg/XbEeprS6iSGNn3Bzn1LL4G -dXpoUxUc6krtXvwjshOg0wn/9vYua0Fxec3ibf2uWWuFHbhOIprtZjluS5TmVfwLG4t3wVMTZonZ -KNaL80VKY7f9ewthXbhtvsPcW3nS7Yblok2+XnR8au0WOB9/WIFaGusyiC2y8zl3gK9etmF1Kdsj -TYjKUCjLhdLTEKJZbtOTVAB6okaVhgWcqRmY5TFyDADiZ9lA4CQze28suVyrZZ0srHbqNZn1l7kP -JOzHdiEoZa5X6AeIdUpWoNIFOqTmjZKILPPy4cHGYdtBxceb9w4aUUXCYWvcZCcXjFq32nQozZfk -vQ== ------END CERTIFICATE----- - -TC TrustCenter Class 3 CA II -============================ ------BEGIN CERTIFICATE----- -MIIEqjCCA5KgAwIBAgIOSkcAAQAC5aBd1j8AUb8wDQYJKoZIhvcNAQEFBQAwdjELMAkGA1UEBhMC -REUxHDAaBgNVBAoTE1RDIFRydXN0Q2VudGVyIEdtYkgxIjAgBgNVBAsTGVRDIFRydXN0Q2VudGVy -IENsYXNzIDMgQ0ExJTAjBgNVBAMTHFRDIFRydXN0Q2VudGVyIENsYXNzIDMgQ0EgSUkwHhcNMDYw -MTEyMTQ0MTU3WhcNMjUxMjMxMjI1OTU5WjB2MQswCQYDVQQGEwJERTEcMBoGA1UEChMTVEMgVHJ1 -c3RDZW50ZXIgR21iSDEiMCAGA1UECxMZVEMgVHJ1c3RDZW50ZXIgQ2xhc3MgMyBDQTElMCMGA1UE -AxMcVEMgVHJ1c3RDZW50ZXIgQ2xhc3MgMyBDQSBJSTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC -AQoCggEBALTgu1G7OVyLBMVMeRwjhjEQY0NVJz/GRcekPewJDRoeIMJWHt4bNwcwIi9v8Qbxq63W -yKthoy9DxLCyLfzDlml7forkzMA5EpBCYMnMNWju2l+QVl/NHE1bWEnrDgFPZPosPIlY2C8u4rBo -6SI7dYnWRBpl8huXJh0obazovVkdKyT21oQDZogkAHhg8fir/gKya/si+zXmFtGt9i4S5Po1auUZ -uV3bOx4a+9P/FRQI2AlqukWdFHlgfa9Aigdzs5OW03Q0jTo3Kd5c7PXuLjHCINy+8U9/I1LZW+Jk -2ZyqBwi1Rb3R0DHBq1SfqdLDYmAD8bs5SpJKPQq5ncWg/jcCAwEAAaOCATQwggEwMA8GA1UdEwEB -/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTUovyfs8PYA9NXXAek0CSnwPIA1DCB -7QYDVR0fBIHlMIHiMIHfoIHcoIHZhjVodHRwOi8vd3d3LnRydXN0Y2VudGVyLmRlL2NybC92Mi90 -Y19jbGFzc18zX2NhX0lJLmNybIaBn2xkYXA6Ly93d3cudHJ1c3RjZW50ZXIuZGUvQ049VEMlMjBU -cnVzdENlbnRlciUyMENsYXNzJTIwMyUyMENBJTIwSUksTz1UQyUyMFRydXN0Q2VudGVyJTIwR21i -SCxPVT1yb290Y2VydHMsREM9dHJ1c3RjZW50ZXIsREM9ZGU/Y2VydGlmaWNhdGVSZXZvY2F0aW9u -TGlzdD9iYXNlPzANBgkqhkiG9w0BAQUFAAOCAQEANmDkcPcGIEPZIxpC8vijsrlNirTzwppVMXzE -O2eatN9NDoqTSheLG43KieHPOh6sHfGcMrSOWXaiQYUlN6AT0PV8TtXqluJucsG7Kv5sbviRmEb8 -yRtXW+rIGjs/sFGYPAfaLFkB2otE6OF0/ado3VS6g0bsyEa1+K+XwDsJHI/OcpY9M1ZwvJbL2NV9 -IJqDnxrcOfHFcqMRA/07QlIp2+gB95tejNaNhk4Z+rwcvsUhpYeeeC422wlxo3I0+GzjBgnyXlal -092Y+tTmBvTwtiBjS+opvaqCZh77gaqnN60TGOaSw4HBM7uIHqHn4rS9MWwOUT1v+5ZWgOI2F9Hc -5A== ------END CERTIFICATE----- - -TC TrustCenter Universal CA I -============================= ------BEGIN CERTIFICATE----- -MIID3TCCAsWgAwIBAgIOHaIAAQAC7LdggHiNtgYwDQYJKoZIhvcNAQEFBQAweTELMAkGA1UEBhMC -REUxHDAaBgNVBAoTE1RDIFRydXN0Q2VudGVyIEdtYkgxJDAiBgNVBAsTG1RDIFRydXN0Q2VudGVy -IFVuaXZlcnNhbCBDQTEmMCQGA1UEAxMdVEMgVHJ1c3RDZW50ZXIgVW5pdmVyc2FsIENBIEkwHhcN -MDYwMzIyMTU1NDI4WhcNMjUxMjMxMjI1OTU5WjB5MQswCQYDVQQGEwJERTEcMBoGA1UEChMTVEMg -VHJ1c3RDZW50ZXIgR21iSDEkMCIGA1UECxMbVEMgVHJ1c3RDZW50ZXIgVW5pdmVyc2FsIENBMSYw -JAYDVQQDEx1UQyBUcnVzdENlbnRlciBVbml2ZXJzYWwgQ0EgSTCCASIwDQYJKoZIhvcNAQEBBQAD -ggEPADCCAQoCggEBAKR3I5ZEr5D0MacQ9CaHnPM42Q9e3s9B6DGtxnSRJJZ4Hgmgm5qVSkr1YnwC -qMqs+1oEdjneX/H5s7/zA1hV0qq34wQi0fiU2iIIAI3TfCZdzHd55yx4Oagmcw6iXSVphU9VDprv -xrlE4Vc93x9UIuVvZaozhDrzznq+VZeujRIPFDPiUHDDSYcTvFHe15gSWu86gzOSBnWLknwSaHtw -ag+1m7Z3W0hZneTvWq3zwZ7U10VOylY0Ibw+F1tvdwxIAUMpsN0/lm7mlaoMwCC2/T42J5zjXM9O -gdwZu5GQfezmlwQek8wiSdeXhrYTCjxDI3d+8NzmzSQfO4ObNDqDNOMCAwEAAaNjMGEwHwYDVR0j -BBgwFoAUkqR1LKSevoFE63n8isWVpesQdXMwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC -AYYwHQYDVR0OBBYEFJKkdSyknr6BROt5/IrFlaXrEHVzMA0GCSqGSIb3DQEBBQUAA4IBAQAo0uCG -1eb4e/CX3CJrO5UUVg8RMKWaTzqwOuAGy2X17caXJ/4l8lfmXpWMPmRgFVp/Lw0BxbFg/UU1z/Cy -vwbZ71q+s2IhtNerNXxTPqYn8aEt2hojnczd7Dwtnic0XQ/CNnm8yUpiLe1r2X1BQ3y2qsrtYbE3 -ghUJGooWMNjsydZHcnhLEEYUjl8Or+zHL6sQ17bxbuyGssLoDZJz3KL0Dzq/YSMQiZxIQG5wALPT -ujdEWBF6AmqI8Dc08BnprNRlc/ZpjGSUOnmFKbAWKwyCPwacx/0QK54PLLae4xW/2TYcuiUaUj0a -7CIMHOCkoj3w6DnPgcB77V0fb8XQC9eY ------END CERTIFICATE----- - -Deutsche Telekom Root CA 2 -========================== ------BEGIN CERTIFICATE----- -MIIDnzCCAoegAwIBAgIBJjANBgkqhkiG9w0BAQUFADBxMQswCQYDVQQGEwJERTEcMBoGA1UEChMT -RGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0GA1UECxMWVC1UZWxlU2VjIFRydXN0IENlbnRlcjEjMCEG -A1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBSb290IENBIDIwHhcNOTkwNzA5MTIxMTAwWhcNMTkwNzA5 -MjM1OTAwWjBxMQswCQYDVQQGEwJERTEcMBoGA1UEChMTRGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0G -A1UECxMWVC1UZWxlU2VjIFRydXN0IENlbnRlcjEjMCEGA1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBS -b290IENBIDIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCrC6M14IspFLEUha88EOQ5 -bzVdSq7d6mGNlUn0b2SjGmBmpKlAIoTZ1KXleJMOaAGtuU1cOs7TuKhCQN/Po7qCWWqSG6wcmtoI -KyUn+WkjR/Hg6yx6m/UTAtB+NHzCnjwAWav12gz1MjwrrFDa1sPeg5TKqAyZMg4ISFZbavva4VhY -AUlfckE8FQYBjl2tqriTtM2e66foai1SNNs671x1Udrb8zH57nGYMsRUFUQM+ZtV7a3fGAigo4aK -Se5TBY8ZTNXeWHmb0mocQqvF1afPaA+W5OFhmHZhyJF81j4A4pFQh+GdCuatl9Idxjp9y7zaAzTV -jlsB9WoHtxa2bkp/AgMBAAGjQjBAMB0GA1UdDgQWBBQxw3kbuvVT1xfgiXotF2wKsyudMzAPBgNV -HRMECDAGAQH/AgEFMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAlGRZrTlk5ynr -E/5aw4sTV8gEJPB0d8Bg42f76Ymmg7+Wgnxu1MM9756AbrsptJh6sTtU6zkXR34ajgv8HzFZMQSy -zhfzLMdiNlXiItiJVbSYSKpk+tYcNthEeFpaIzpXl/V6ME+un2pMSyuOoAPjPuCp1NJ70rOo4nI8 -rZ7/gFnkm0W09juwzTkZmDLl6iFhkOQxIY40sfcvNUqFENrnijchvllj4PKFiDFT1FQUhXB59C4G -dyd1Lx+4ivn+xbrYNuSD7Odlt79jWvNGr4GUN9RBjNYj1h7P9WgbRGOiWrqnNVmh5XAFmw4jV5mU -Cm26OWMohpLzGITY+9HPBVZkVw== ------END CERTIFICATE----- - -ComSign Secured CA -================== ------BEGIN CERTIFICATE----- -MIIDqzCCApOgAwIBAgIRAMcoRwmzuGxFjB36JPU2TukwDQYJKoZIhvcNAQEFBQAwPDEbMBkGA1UE -AxMSQ29tU2lnbiBTZWN1cmVkIENBMRAwDgYDVQQKEwdDb21TaWduMQswCQYDVQQGEwJJTDAeFw0w -NDAzMjQxMTM3MjBaFw0yOTAzMTYxNTA0NTZaMDwxGzAZBgNVBAMTEkNvbVNpZ24gU2VjdXJlZCBD -QTEQMA4GA1UEChMHQ29tU2lnbjELMAkGA1UEBhMCSUwwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw -ggEKAoIBAQDGtWhfHZQVw6QIVS3joFd67+l0Kru5fFdJGhFeTymHDEjWaueP1H5XJLkGieQcPOqs -49ohgHMhCu95mGwfCP+hUH3ymBvJVG8+pSjsIQQPRbsHPaHA+iqYHU4Gk/v1iDurX8sWv+bznkqH -7Rnqwp9D5PGBpX8QTz7RSmKtUxvLg/8HZaWSLWapW7ha9B20IZFKF3ueMv5WJDmyVIRD9YTC2LxB -kMyd1mja6YJQqTtoz7VdApRgFrFD2UNd3V2Hbuq7s8lr9gOUCXDeFhF6K+h2j0kQmHe5Y1yLM5d1 -9guMsqtb3nQgJT/j8xH5h2iGNXHDHYwt6+UarA9z1YJZQIDTAgMBAAGjgacwgaQwDAYDVR0TBAUw -AwEB/zBEBgNVHR8EPTA7MDmgN6A1hjNodHRwOi8vZmVkaXIuY29tc2lnbi5jby5pbC9jcmwvQ29t -U2lnblNlY3VyZWRDQS5jcmwwDgYDVR0PAQH/BAQDAgGGMB8GA1UdIwQYMBaAFMFL7XC29z58ADsA -j8c+DkWfHl3sMB0GA1UdDgQWBBTBS+1wtvc+fAA7AI/HPg5Fnx5d7DANBgkqhkiG9w0BAQUFAAOC -AQEAFs/ukhNQq3sUnjO2QiBq1BW9Cav8cujvR3qQrFHBZE7piL1DRYHjZiM/EoZNGeQFsOY3wo3a -BijJD4mkU6l1P7CW+6tMM1X5eCZGbxs2mPtCdsGCuY7e+0X5YxtiOzkGynd6qDwJz2w2PQ8KRUtp -FhpFfTMDZflScZAmlaxMDPWLkz/MdXSFmLr/YnpNH4n+rr2UAJm/EaXc4HnFFgt9AmEd6oX5AhVP -51qJThRv4zdLhfXBPGHg/QVBspJ/wx2g0K5SZGBrGMYmnNj1ZOQ2GmKfig8+/21OGVZOIJFsnzQz -OjRXUDpvgV4GxvU+fE6OK85lBi5d0ipTdF7Tbieejw== ------END CERTIFICATE----- - -Cybertrust Global Root -====================== ------BEGIN CERTIFICATE----- -MIIDoTCCAomgAwIBAgILBAAAAAABD4WqLUgwDQYJKoZIhvcNAQEFBQAwOzEYMBYGA1UEChMPQ3li -ZXJ0cnVzdCwgSW5jMR8wHQYDVQQDExZDeWJlcnRydXN0IEdsb2JhbCBSb290MB4XDTA2MTIxNTA4 -MDAwMFoXDTIxMTIxNTA4MDAwMFowOzEYMBYGA1UEChMPQ3liZXJ0cnVzdCwgSW5jMR8wHQYDVQQD -ExZDeWJlcnRydXN0IEdsb2JhbCBSb290MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA -+Mi8vRRQZhP/8NN57CPytxrHjoXxEnOmGaoQ25yiZXRadz5RfVb23CO21O1fWLE3TdVJDm71aofW -0ozSJ8bi/zafmGWgE07GKmSb1ZASzxQG9Dvj1Ci+6A74q05IlG2OlTEQXO2iLb3VOm2yHLtgwEZL -AfVJrn5GitB0jaEMAs7u/OePuGtm839EAL9mJRQr3RAwHQeWP032a7iPt3sMpTjr3kfb1V05/Iin -89cqdPHoWqI7n1C6poxFNcJQZZXcY4Lv3b93TZxiyWNzFtApD0mpSPCzqrdsxacwOUBdrsTiXSZT -8M4cIwhhqJQZugRiQOwfOHB3EgZxpzAYXSUnpQIDAQABo4GlMIGiMA4GA1UdDwEB/wQEAwIBBjAP -BgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBS2CHsNesysIEyGVjJez6tuhS1wVzA/BgNVHR8EODA2 -MDSgMqAwhi5odHRwOi8vd3d3Mi5wdWJsaWMtdHJ1c3QuY29tL2NybC9jdC9jdHJvb3QuY3JsMB8G -A1UdIwQYMBaAFLYIew16zKwgTIZWMl7Pq26FLXBXMA0GCSqGSIb3DQEBBQUAA4IBAQBW7wojoFRO -lZfJ+InaRcHUowAl9B8Tq7ejhVhpwjCt2BWKLePJzYFa+HMjWqd8BfP9IjsO0QbE2zZMcwSO5bAi -5MXzLqXZI+O4Tkogp24CJJ8iYGd7ix1yCcUxXOl5n4BHPa2hCwcUPUf/A2kaDAtE52Mlp3+yybh2 -hO0j9n0Hq0V+09+zv+mKts2oomcrUtW3ZfA5TGOgkXmTUg9U3YO7n9GPp1Nzw8v/MOx8BLjYRB+T -X3EJIrduPuocA06dGiBh+4E37F78CkWr1+cXVdCg6mCbpvbjjFspwgZgFJ0tl0ypkxWdYcQBX0jW -WL1WMRJOEcgh4LMRkWXbtKaIOM5V ------END CERTIFICATE----- - -ePKI Root Certification Authority -================================= ------BEGIN CERTIFICATE----- -MIIFsDCCA5igAwIBAgIQFci9ZUdcr7iXAF7kBtK8nTANBgkqhkiG9w0BAQUFADBeMQswCQYDVQQG -EwJUVzEjMCEGA1UECgwaQ2h1bmdod2EgVGVsZWNvbSBDby4sIEx0ZC4xKjAoBgNVBAsMIWVQS0kg -Um9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNDEyMjAwMjMxMjdaFw0zNDEyMjAwMjMx -MjdaMF4xCzAJBgNVBAYTAlRXMSMwIQYDVQQKDBpDaHVuZ2h3YSBUZWxlY29tIENvLiwgTHRkLjEq -MCgGA1UECwwhZVBLSSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0B -AQEFAAOCAg8AMIICCgKCAgEA4SUP7o3biDN1Z82tH306Tm2d0y8U82N0ywEhajfqhFAHSyZbCUNs -IZ5qyNUD9WBpj8zwIuQf5/dqIjG3LBXy4P4AakP/h2XGtRrBp0xtInAhijHyl3SJCRImHJ7K2RKi -lTza6We/CKBk49ZCt0Xvl/T29de1ShUCWH2YWEtgvM3XDZoTM1PRYfl61dd4s5oz9wCGzh1NlDiv -qOx4UXCKXBCDUSH3ET00hl7lSM2XgYI1TBnsZfZrxQWh7kcT1rMhJ5QQCtkkO7q+RBNGMD+XPNjX -12ruOzjjK9SXDrkb5wdJfzcq+Xd4z1TtW0ado4AOkUPB1ltfFLqfpo0kR0BZv3I4sjZsN/+Z0V0O -WQqraffAsgRFelQArr5T9rXn4fg8ozHSqf4hUmTFpmfwdQcGlBSBVcYn5AGPF8Fqcde+S/uUWH1+ -ETOxQvdibBjWzwloPn9s9h6PYq2lY9sJpx8iQkEeb5mKPtf5P0B6ebClAZLSnT0IFaUQAS2zMnao -lQ2zepr7BxB4EW/hj8e6DyUadCrlHJhBmd8hh+iVBmoKs2pHdmX2Os+PYhcZewoozRrSgx4hxyy/ -vv9haLdnG7t4TY3OZ+XkwY63I2binZB1NJipNiuKmpS5nezMirH4JYlcWrYvjB9teSSnUmjDhDXi -Zo1jDiVN1Rmy5nk3pyKdVDECAwEAAaNqMGgwHQYDVR0OBBYEFB4M97Zn8uGSJglFwFU5Lnc/Qkqi -MAwGA1UdEwQFMAMBAf8wOQYEZyoHAAQxMC8wLQIBADAJBgUrDgMCGgUAMAcGBWcqAwAABBRFsMLH -ClZ87lt4DJX5GFPBphzYEDANBgkqhkiG9w0BAQUFAAOCAgEACbODU1kBPpVJufGBuvl2ICO1J2B0 -1GqZNF5sAFPZn/KmsSQHRGoqxqWOeBLoR9lYGxMqXnmbnwoqZ6YlPwZpVnPDimZI+ymBV3QGypzq -KOg4ZyYr8dW1P2WT+DZdjo2NQCCHGervJ8A9tDkPJXtoUHRVnAxZfVo9QZQlUgjgRywVMRnVvwdV -xrsStZf0X4OFunHB2WyBEXYKCrC/gpf36j36+uwtqSiUO1bd0lEursC9CBWMd1I0ltabrNMdjmEP -NXubrjlpC2JgQCA2j6/7Nu4tCEoduL+bXPjqpRugc6bY+G7gMwRfaKonh+3ZwZCc7b3jajWvY9+r -GNm65ulK6lCKD2GTHuItGeIwlDWSXQ62B68ZgI9HkFFLLk3dheLSClIKF5r8GrBQAuUBo2M3IUxE -xJtRmREOc5wGj1QupyheRDmHVi03vYVElOEMSyycw5KFNGHLD7ibSkNS/jQ6fbjpKdx2qcgw+BRx -gMYeNkh0IkFch4LoGHGLQYlE535YW6i4jRPpp2zDR+2zGp1iro2C6pSe3VkQw63d4k3jMdXH7Ojy -sP6SHhYKGvzZ8/gntsm+HbRsZJB/9OTEW9c3rkIO3aQab3yIVMUWbuF6aC74Or8NpDyJO3inTmOD -BCEIZ43ygknQW/2xzQ+DhNQ+IIX3Sj0rnP0qCglN6oH4EZw= ------END CERTIFICATE----- - -T\xc3\x9c\x42\xC4\xB0TAK UEKAE K\xC3\xB6k Sertifika Hizmet Sa\xC4\x9Flay\xc4\xb1\x63\xc4\xb1s\xc4\xb1 - S\xC3\xBCr\xC3\xBCm 3 -============================================================================================================================= ------BEGIN CERTIFICATE----- -MIIFFzCCA/+gAwIBAgIBETANBgkqhkiG9w0BAQUFADCCASsxCzAJBgNVBAYTAlRSMRgwFgYDVQQH -DA9HZWJ6ZSAtIEtvY2FlbGkxRzBFBgNVBAoMPlTDvHJraXllIEJpbGltc2VsIHZlIFRla25vbG9q -aWsgQXJhxZ90xLFybWEgS3VydW11IC0gVMOcQsSwVEFLMUgwRgYDVQQLDD9VbHVzYWwgRWxla3Ry -b25payB2ZSBLcmlwdG9sb2ppIEFyYcWfdMSxcm1hIEVuc3RpdMO8c8O8IC0gVUVLQUUxIzAhBgNV -BAsMGkthbXUgU2VydGlmaWthc3lvbiBNZXJrZXppMUowSAYDVQQDDEFUw5xCxLBUQUsgVUVLQUUg -S8O2ayBTZXJ0aWZpa2EgSGl6bWV0IFNhxJ9sYXnEsWPEsXPEsSAtIFPDvHLDvG0gMzAeFw0wNzA4 -MjQxMTM3MDdaFw0xNzA4MjExMTM3MDdaMIIBKzELMAkGA1UEBhMCVFIxGDAWBgNVBAcMD0dlYnpl -IC0gS29jYWVsaTFHMEUGA1UECgw+VMO8cmtpeWUgQmlsaW1zZWwgdmUgVGVrbm9sb2ppayBBcmHF -n3TEsXJtYSBLdXJ1bXUgLSBUw5xCxLBUQUsxSDBGBgNVBAsMP1VsdXNhbCBFbGVrdHJvbmlrIHZl -IEtyaXB0b2xvamkgQXJhxZ90xLFybWEgRW5zdGl0w7xzw7wgLSBVRUtBRTEjMCEGA1UECwwaS2Ft -dSBTZXJ0aWZpa2FzeW9uIE1lcmtlemkxSjBIBgNVBAMMQVTDnELEsFRBSyBVRUtBRSBLw7ZrIFNl -cnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxIC0gU8O8csO8bSAzMIIBIjANBgkqhkiG9w0B -AQEFAAOCAQ8AMIIBCgKCAQEAim1L/xCIOsP2fpTo6iBkcK4hgb46ezzb8R1Sf1n68yJMlaCQvEhO -Eav7t7WNeoMojCZG2E6VQIdhn8WebYGHV2yKO7Rm6sxA/OOqbLLLAdsyv9Lrhc+hDVXDWzhXcLh1 -xnnRFDDtG1hba+818qEhTsXOfJlfbLm4IpNQp81McGq+agV/E5wrHur+R84EpW+sky58K5+eeROR -6Oqeyjh1jmKwlZMq5d/pXpduIF9fhHpEORlAHLpVK/swsoHvhOPc7Jg4OQOFCKlUAwUp8MmPi+oL -hmUZEdPpCSPeaJMDyTYcIW7OjGbxmTDY17PDHfiBLqi9ggtm/oLL4eAagsNAgQIDAQABo0IwQDAd -BgNVHQ4EFgQUvYiHyY/2pAoLquvF/pEjnatKijIwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF -MAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAB18+kmPNOm3JpIWmgV050vQbTlswyb2zrgxvMTfvCr4 -N5EY3ATIZJkrGG2AA1nJrvhY0D7twyOfaTyGOBye79oneNGEN3GKPEs5z35FBtYt2IpNeBLWrcLT -y9LQQfMmNkqblWwM7uXRQydmwYj3erMgbOqwaSvHIOgMA8RBBZniP+Rr+KCGgceExh/VS4ESshYh -LBOhgLJeDEoTniDYYkCrkOpkSi+sDQESeUWoL4cZaMjihccwsnX5OD+ywJO0a+IDRM5noN+J1q2M -dqMTw5RhK2vZbMEHCiIHhWyFJEapvj+LeISCfiQMnf2BN+MlqO02TpUsyZyQ2uypQjyttgI= ------END CERTIFICATE----- - -Buypass Class 2 CA 1 -==================== ------BEGIN CERTIFICATE----- -MIIDUzCCAjugAwIBAgIBATANBgkqhkiG9w0BAQUFADBLMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU -QnV5cGFzcyBBUy05ODMxNjMzMjcxHTAbBgNVBAMMFEJ1eXBhc3MgQ2xhc3MgMiBDQSAxMB4XDTA2 -MTAxMzEwMjUwOVoXDTE2MTAxMzEwMjUwOVowSzELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1eXBh -c3MgQVMtOTgzMTYzMzI3MR0wGwYDVQQDDBRCdXlwYXNzIENsYXNzIDIgQ0EgMTCCASIwDQYJKoZI -hvcNAQEBBQADggEPADCCAQoCggEBAIs8B0XY9t/mx8q6jUPFR42wWsE425KEHK8T1A9vNkYgxC7M -cXA0ojTTNy7Y3Tp3L8DrKehc0rWpkTSHIln+zNvnma+WwajHQN2lFYxuyHyXA8vmIPLXl18xoS83 -0r7uvqmtqEyeIWZDO6i88wmjONVZJMHCR3axiFyCO7srpgTXjAePzdVBHfCuuCkslFJgNJQ72uA4 -0Z0zPhX0kzLFANq1KWYOOngPIVJfAuWSeyXTkh4vFZ2B5J2O6O+JzhRMVB0cgRJNcKi+EAUXfh/R -uFdV7c27UsKwHnjCTTZoy1YmwVLBvXb3WNVyfh9EdrsAiR0WnVE1703CVu9r4Iw7DekCAwEAAaNC -MEAwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUP42aWYv8e3uco684sDntkHGA1sgwDgYDVR0P -AQH/BAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQAVGn4TirnoB6NLJzKyQJHyIdFkhb5jatLPgcIV -1Xp+DCmsNx4cfHZSldq1fyOhKXdlyTKdqC5Wq2B2zha0jX94wNWZUYN/Xtm+DKhQ7SLHrQVMdvvt -7h5HZPb3J31cKA9FxVxiXqaakZG3Uxcu3K1gnZZkOb1naLKuBctN518fV4bVIJwo+28TOPX2EZL2 -fZleHwzoq0QkKXJAPTZSr4xYkHPB7GEseaHsh7U/2k3ZIQAw3pDaDtMaSKk+hQsUi4y8QZ5q9w5w -wDX3OaJdZtB7WZ+oRxKaJyOkLY4ng5IgodcVf/EuGO70SH8vf/GhGLWhC5SgYiAynB321O+/TIho ------END CERTIFICATE----- - -Buypass Class 3 CA 1 -==================== ------BEGIN CERTIFICATE----- -MIIDUzCCAjugAwIBAgIBAjANBgkqhkiG9w0BAQUFADBLMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU -QnV5cGFzcyBBUy05ODMxNjMzMjcxHTAbBgNVBAMMFEJ1eXBhc3MgQ2xhc3MgMyBDQSAxMB4XDTA1 -MDUwOTE0MTMwM1oXDTE1MDUwOTE0MTMwM1owSzELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1eXBh -c3MgQVMtOTgzMTYzMzI3MR0wGwYDVQQDDBRCdXlwYXNzIENsYXNzIDMgQ0EgMTCCASIwDQYJKoZI -hvcNAQEBBQADggEPADCCAQoCggEBAKSO13TZKWTeXx+HgJHqTjnmGcZEC4DVC69TB4sSveZn8AKx -ifZgisRbsELRwCGoy+Gb72RRtqfPFfV0gGgEkKBYouZ0plNTVUhjP5JW3SROjvi6K//zNIqeKNc0 -n6wv1g/xpC+9UrJJhW05NfBEMJNGJPO251P7vGGvqaMU+8IXF4Rs4HyI+MkcVyzwPX6UvCWThOia -AJpFBUJXgPROztmuOfbIUxAMZTpHe2DC1vqRycZxbL2RhzyRhkmr8w+gbCZ2Xhysm3HljbybIR6c -1jh+JIAVMYKWsUnTYjdbiAwKYjT+p0h+mbEwi5A3lRyoH6UsjfRVyNvdWQrCrXig9IsCAwEAAaNC -MEAwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUOBTmyPCppAP0Tj4io1vy1uCtQHQwDgYDVR0P -AQH/BAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQABZ6OMySU9E2NdFm/soT4JXJEVKirZgCFPBdy7 -pYmrEzMqnji3jG8CcmPHc3ceCQa6Oyh7pEfJYWsICCD8igWKH7y6xsL+z27sEzNxZy5p+qksP2bA -EllNC1QCkoS72xLvg3BweMhT+t/Gxv/ciC8HwEmdMldg0/L2mSlf56oBzKwzqBwKu5HEA6BvtjT5 -htOzdlSY9EqBs1OdTUDs5XcTRa9bqh/YL0yCe/4qxFi7T/ye/QNlGioOw6UgFpRreaaiErS7GqQj -el/wroQk5PMr+4okoyeYZdowdXb8GZHo2+ubPzK/QJcHJrrM85SFSnonk8+QQtS4Wxam58tAA915 ------END CERTIFICATE----- - -EBG Elektronik Sertifika Hizmet Sa\xC4\x9Flay\xc4\xb1\x63\xc4\xb1s\xc4\xb1 -========================================================================== ------BEGIN CERTIFICATE----- -MIIF5zCCA8+gAwIBAgIITK9zQhyOdAIwDQYJKoZIhvcNAQEFBQAwgYAxODA2BgNVBAMML0VCRyBF -bGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxMTcwNQYDVQQKDC5FQkcg -QmlsacWfaW0gVGVrbm9sb2ppbGVyaSB2ZSBIaXptZXRsZXJpIEEuxZ4uMQswCQYDVQQGEwJUUjAe -Fw0wNjA4MTcwMDIxMDlaFw0xNjA4MTQwMDMxMDlaMIGAMTgwNgYDVQQDDC9FQkcgRWxla3Ryb25p -ayBTZXJ0aWZpa2EgSGl6bWV0IFNhxJ9sYXnEsWPEsXPEsTE3MDUGA1UECgwuRUJHIEJpbGnFn2lt -IFRla25vbG9qaWxlcmkgdmUgSGl6bWV0bGVyaSBBLsWeLjELMAkGA1UEBhMCVFIwggIiMA0GCSqG -SIb3DQEBAQUAA4ICDwAwggIKAoICAQDuoIRh0DpqZhAy2DE4f6en5f2h4fuXd7hxlugTlkaDT7by -X3JWbhNgpQGR4lvFzVcfd2NR/y8927k/qqk153nQ9dAktiHq6yOU/im/+4mRDGSaBUorzAzu8T2b -gmmkTPiab+ci2hC6X5L8GCcKqKpE+i4stPtGmggDg3KriORqcsnlZR9uKg+ds+g75AxuetpX/dfr -eYteIAbTdgtsApWjluTLdlHRKJ2hGvxEok3MenaoDT2/F08iiFD9rrbskFBKW5+VQarKD7JK/oCZ -TqNGFav4c0JqwmZ2sQomFd2TkuzbqV9UIlKRcF0T6kjsbgNs2d1s/OsNA/+mgxKb8amTD8UmTDGy -Y5lhcucqZJnSuOl14nypqZoaqsNW2xCaPINStnuWt6yHd6i58mcLlEOzrz5z+kI2sSXFCjEmN1Zn -uqMLfdb3ic1nobc6HmZP9qBVFCVMLDMNpkGMvQQxahByCp0OLna9XvNRiYuoP1Vzv9s6xiQFlpJI -qkuNKgPlV5EQ9GooFW5Hd4RcUXSfGenmHmMWOeMRFeNYGkS9y8RsZteEBt8w9DeiQyJ50hBs37vm -ExH8nYQKE3vwO9D8owrXieqWfo1IhR5kX9tUoqzVegJ5a9KK8GfaZXINFHDk6Y54jzJ0fFfy1tb0 -Nokb+Clsi7n2l9GkLqq+CxnCRelwXQIDAJ3Zo2MwYTAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB -/wQEAwIBBjAdBgNVHQ4EFgQU587GT/wWZ5b6SqMHwQSny2re2kcwHwYDVR0jBBgwFoAU587GT/wW -Z5b6SqMHwQSny2re2kcwDQYJKoZIhvcNAQEFBQADggIBAJuYml2+8ygjdsZs93/mQJ7ANtyVDR2t -FcU22NU57/IeIl6zgrRdu0waypIN30ckHrMk2pGI6YNw3ZPX6bqz3xZaPt7gyPvT/Wwp+BVGoGgm -zJNSroIBk5DKd8pNSe/iWtkqvTDOTLKBtjDOWU/aWR1qeqRFsIImgYZ29fUQALjuswnoT4cCB64k -XPBfrAowzIpAoHMEwfuJJPaaHFy3PApnNgUIMbOv2AFoKuB4j3TeuFGkjGwgPaL7s9QJ/XvCgKqT -bCmYIai7FvOpEl90tYeY8pUm3zTvilORiF0alKM/fCL414i6poyWqD1SNGKfAB5UVUJnxk1Gj7sU -RT0KlhaOEKGXmdXTMIXM3rRyt7yKPBgpaP3ccQfuJDlq+u2lrDgv+R4QDgZxGhBM/nV+/x5XOULK -1+EVoVZVWRvRo68R2E7DpSvvkL/A7IITW43WciyTTo9qKd+FPNMN4KIYEsxVL0e3p5sC/kH2iExt -2qkBR4NkJ2IQgtYSe14DHzSpyZH+r11thie3I6p1GMog57AP14kOpmciY/SDQSsGS7tY1dHXt7kQ -Y9iJSrSq3RZj9W6+YKH47ejWkE8axsWgKdOnIaj1Wjz3x0miIZpKlVIglnKaZsv30oZDfCK+lvm9 -AahH3eU7QPl1K5srRmSGjR70j/sHd9DqSaIcjVIUpgqT ------END CERTIFICATE----- - -certSIGN ROOT CA -================ ------BEGIN CERTIFICATE----- -MIIDODCCAiCgAwIBAgIGIAYFFnACMA0GCSqGSIb3DQEBBQUAMDsxCzAJBgNVBAYTAlJPMREwDwYD -VQQKEwhjZXJ0U0lHTjEZMBcGA1UECxMQY2VydFNJR04gUk9PVCBDQTAeFw0wNjA3MDQxNzIwMDRa -Fw0zMTA3MDQxNzIwMDRaMDsxCzAJBgNVBAYTAlJPMREwDwYDVQQKEwhjZXJ0U0lHTjEZMBcGA1UE -CxMQY2VydFNJR04gUk9PVCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALczuX7I -JUqOtdu0KBuqV5Do0SLTZLrTk+jUrIZhQGpgV2hUhE28alQCBf/fm5oqrl0Hj0rDKH/v+yv6efHH -rfAQUySQi2bJqIirr1qjAOm+ukbuW3N7LBeCgV5iLKECZbO9xSsAfsT8AzNXDe3i+s5dRdY4zTW2 -ssHQnIFKquSyAVwdj1+ZxLGt24gh65AIgoDzMKND5pCCrlUoSe1b16kQOA7+j0xbm0bqQfWwCHTD -0IgztnzXdN/chNFDDnU5oSVAKOp4yw4sLjmdjItuFhwvJoIQ4uNllAoEwF73XVv4EOLQunpL+943 -AAAaWyjj0pxzPjKHmKHJUS/X3qwzs08CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8B -Af8EBAMCAcYwHQYDVR0OBBYEFOCMm9slSbPxfIbWskKHC9BroNnkMA0GCSqGSIb3DQEBBQUAA4IB -AQA+0hyJLjX8+HXd5n9liPRyTMks1zJO890ZeUe9jjtbkw9QSSQTaxQGcu8J06Gh40CEyecYMnQ8 -SG4Pn0vU9x7Tk4ZkVJdjclDVVc/6IJMCopvDI5NOFlV2oHB5bc0hH88vLbwZ44gx+FkagQnIl6Z0 -x2DEW8xXjrJ1/RsCCdtZb3KTafcxQdaIOL+Hsr0Wefmq5L6IJd1hJyMctTEHBDa0GpC9oHRxUIlt -vBTjD4au8as+x6AJzKNI0eDbZOeStc+vckNwi/nDhDwTqn6Sm1dTk/pwwpEOMfmbZ13pljheX7Nz -TogVZ96edhBiIL5VaZVDADlN9u6wWk5JRFRYX0KD ------END CERTIFICATE----- - -CNNIC ROOT -========== ------BEGIN CERTIFICATE----- -MIIDVTCCAj2gAwIBAgIESTMAATANBgkqhkiG9w0BAQUFADAyMQswCQYDVQQGEwJDTjEOMAwGA1UE -ChMFQ05OSUMxEzARBgNVBAMTCkNOTklDIFJPT1QwHhcNMDcwNDE2MDcwOTE0WhcNMjcwNDE2MDcw -OTE0WjAyMQswCQYDVQQGEwJDTjEOMAwGA1UEChMFQ05OSUMxEzARBgNVBAMTCkNOTklDIFJPT1Qw -ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDTNfc/c3et6FtzF8LRb+1VvG7q6KR5smzD -o+/hn7E7SIX1mlwhIhAsxYLO2uOabjfhhyzcuQxauohV3/2q2x8x6gHx3zkBwRP9SFIhxFXf2tiz -VHa6dLG3fdfA6PZZxU3Iva0fFNrfWEQlMhkqx35+jq44sDB7R3IJMfAw28Mbdim7aXZOV/kbZKKT -VrdvmW7bCgScEeOAH8tjlBAKqeFkgjH5jCftppkA9nCTGPihNIaj3XrCGHn2emU1z5DrvTOTn1Or -czvmmzQgLx3vqR1jGqCA2wMv+SYahtKNu6m+UjqHZ0gNv7Sg2Ca+I19zN38m5pIEo3/PIKe38zrK -y5nLAgMBAAGjczBxMBEGCWCGSAGG+EIBAQQEAwIABzAfBgNVHSMEGDAWgBRl8jGtKvf33VKWCscC -wQ7vptU7ETAPBgNVHRMBAf8EBTADAQH/MAsGA1UdDwQEAwIB/jAdBgNVHQ4EFgQUZfIxrSr3991S -lgrHAsEO76bVOxEwDQYJKoZIhvcNAQEFBQADggEBAEs17szkrr/Dbq2flTtLP1se31cpolnKOOK5 -Gv+e5m4y3R6u6jW39ZORTtpC4cMXYFDy0VwmuYK36m3knITnA3kXr5g9lNvHugDnuL8BV8F3RTIM -O/G0HAiw/VGgod2aHRM2mm23xzy54cXZF/qD1T0VoDy7HgviyJA/qIYM/PmLXoXLT1tLYhFHxUV8 -BS9BsZ4QaRuZluBVeftOhpm4lNqGOGqTo+fLbuXf6iFViZx9fX+Y9QCJ7uOEwFyWtcVG6kbghVW2 -G8kS1sHNzYDzAgE8yGnLRUhj2JTQ7IUOO04RZfSCjKY9ri4ilAnIXOo8gV0WKgOXFlUJ24pBgp5m -mxE= ------END CERTIFICATE----- - -ApplicationCA - Japanese Government -=================================== ------BEGIN CERTIFICATE----- -MIIDoDCCAoigAwIBAgIBMTANBgkqhkiG9w0BAQUFADBDMQswCQYDVQQGEwJKUDEcMBoGA1UEChMT -SmFwYW5lc2UgR292ZXJubWVudDEWMBQGA1UECxMNQXBwbGljYXRpb25DQTAeFw0wNzEyMTIxNTAw -MDBaFw0xNzEyMTIxNTAwMDBaMEMxCzAJBgNVBAYTAkpQMRwwGgYDVQQKExNKYXBhbmVzZSBHb3Zl -cm5tZW50MRYwFAYDVQQLEw1BcHBsaWNhdGlvbkNBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB -CgKCAQEAp23gdE6Hj6UG3mii24aZS2QNcfAKBZuOquHMLtJqO8F6tJdhjYq+xpqcBrSGUeQ3DnR4 -fl+Kf5Sk10cI/VBaVuRorChzoHvpfxiSQE8tnfWuREhzNgaeZCw7NCPbXCbkcXmP1G55IrmTwcrN -wVbtiGrXoDkhBFcsovW8R0FPXjQilbUfKW1eSvNNcr5BViCH/OlQR9cwFO5cjFW6WY2H/CPek9AE -jP3vbb3QesmlOmpyM8ZKDQUXKi17safY1vC+9D/qDihtQWEjdnjDuGWk81quzMKq2edY3rZ+nYVu -nyoKb58DKTCXKB28t89UKU5RMfkntigm/qJj5kEW8DOYRwIDAQABo4GeMIGbMB0GA1UdDgQWBBRU -WssmP3HMlEYNllPqa0jQk/5CdTAOBgNVHQ8BAf8EBAMCAQYwWQYDVR0RBFIwUKROMEwxCzAJBgNV -BAYTAkpQMRgwFgYDVQQKDA/ml6XmnKzlm73mlL/lupwxIzAhBgNVBAsMGuOCouODl+ODquOCseOD -vOOCt+ODp+ODs0NBMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBADlqRHZ3ODrs -o2dGD/mLBqj7apAxzn7s2tGJfHrrLgy9mTLnsCTWw//1sogJhyzjVOGjprIIC8CFqMjSnHH2HZ9g -/DgzE+Ge3Atf2hZQKXsvcJEPmbo0NI2VdMV+eKlmXb3KIXdCEKxmJj3ekav9FfBv7WxfEPjzFvYD -io+nEhEMy/0/ecGc/WLuo89UDNErXxc+4z6/wCs+CZv+iKZ+tJIX/COUgb1up8WMwusRRdv4QcmW -dupwX3kSa+SjB1oF7ydJzyGfikwJcGapJsErEU4z0g781mzSDjJkaP+tBXhfAx2o45CsJOAPQKdL -rosot4LKGAfmt1t06SAZf7IbiVQ= ------END CERTIFICATE----- - -GeoTrust Primary Certification Authority - G3 -============================================= ------BEGIN CERTIFICATE----- -MIID/jCCAuagAwIBAgIQFaxulBmyeUtB9iepwxgPHzANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UE -BhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA4IEdlb1RydXN0 -IEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFy -eSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEczMB4XDTA4MDQwMjAwMDAwMFoXDTM3MTIwMTIz -NTk1OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAo -YykgMjAwOCBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMT -LUdlb1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZI -hvcNAQEBBQADggEPADCCAQoCggEBANziXmJYHTNXOTIz+uvLh4yn1ErdBojqZI4xmKU4kB6Yzy5j -K/BGvESyiaHAKAxJcCGVn2TAppMSAmUmhsalifD614SgcK9PGpc/BkTVyetyEH3kMSj7HGHmKAdE -c5IiaacDiGydY8hS2pgn5whMcD60yRLBxWeDXTPzAxHsatBT4tG6NmCUgLthY2xbF37fQJQeqw3C -IShwiP/WJmxsYAQlTlV+fe+/lEjetx3dcI0FX4ilm/LC7urRQEFtYjgdVgbFA0dRIBn8exALDmKu -dlW/X3e+PkkBUz2YJQN2JFodtNuJ6nnltrM7P7pMKEF/BqxqjsHQ9gUdfeZChuOl1UcCAwEAAaNC -MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMR5yo6hTgMdHNxr -2zFblD4/MH8tMA0GCSqGSIb3DQEBCwUAA4IBAQAtxRPPVoB7eni9n64smefv2t+UXglpp+duaIy9 -cr5HqQ6XErhK8WTTOd8lNNTBzU6B8A8ExCSzNJbGpqow32hhc9f5joWJ7w5elShKKiePEI4ufIbE -Ap7aDHdlDkQNkv39sxY2+hENHYwOB4lqKVb3cvTdFZx3NWZXqxNT2I7BQMXXExZacse3aQHEerGD -AWh9jUGhlBjBJVz88P6DAod8DQ3PLghcSkANPuyBYeYk28rgDi0Hsj5W3I31QYUHSJsMC8tJP33s -t/3LjWeJGqvtux6jAAgIFyqCXDFdRootD4abdNlF+9RAsXqqaC2Gspki4cErx5z481+oghLrGREt ------END CERTIFICATE----- - -thawte Primary Root CA - G2 -=========================== ------BEGIN CERTIFICATE----- -MIICiDCCAg2gAwIBAgIQNfwmXNmET8k9Jj1Xm67XVjAKBggqhkjOPQQDAzCBhDELMAkGA1UEBhMC -VVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjE4MDYGA1UECxMvKGMpIDIwMDcgdGhhd3RlLCBJbmMu -IC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3Qg -Q0EgLSBHMjAeFw0wNzExMDUwMDAwMDBaFw0zODAxMTgyMzU5NTlaMIGEMQswCQYDVQQGEwJVUzEV -MBMGA1UEChMMdGhhd3RlLCBJbmMuMTgwNgYDVQQLEy8oYykgMjAwNyB0aGF3dGUsIEluYy4gLSBG -b3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIGA1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAt -IEcyMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEotWcgnuVnfFSeIf+iha/BebfowJPDQfGAFG6DAJS -LSKkQjnE/o/qycG+1E3/n3qe4rF8mq2nhglzh9HnmuN6papu+7qzcMBniKI11KOasf2twu8x+qi5 -8/sIxpHR+ymVo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU -mtgAMADna3+FGO6Lts6KDPgR4bswCgYIKoZIzj0EAwMDaQAwZgIxAN344FdHW6fmCsO99YCKlzUN -G4k8VIZ3KMqh9HneteY4sPBlcIx/AlTCv//YoT7ZzwIxAMSNlPzcU9LcnXgWHxUzI1NS41oxXZ3K -rr0TKUQNJ1uo52icEvdYPy5yAlejj6EULg== ------END CERTIFICATE----- - -thawte Primary Root CA - G3 -=========================== ------BEGIN CERTIFICATE----- -MIIEKjCCAxKgAwIBAgIQYAGXt0an6rS0mtZLL/eQ+zANBgkqhkiG9w0BAQsFADCBrjELMAkGA1UE -BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2 -aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDggdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv -cml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EgLSBHMzAeFw0w -ODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIGuMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMdGhh -d3RlLCBJbmMuMSgwJgYDVQQLEx9DZXJ0aWZpY2F0aW9uIFNlcnZpY2VzIERpdmlzaW9uMTgwNgYD -VQQLEy8oYykgMjAwOCB0aGF3dGUsIEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIG -A1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAtIEczMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A -MIIBCgKCAQEAsr8nLPvb2FvdeHsbnndmgcs+vHyu86YnmjSjaDFxODNi5PNxZnmxqWWjpYvVj2At -P0LMqmsywCPLLEHd5N/8YZzic7IilRFDGF/Eth9XbAoFWCLINkw6fKXRz4aviKdEAhN0cXMKQlkC -+BsUa0Lfb1+6a4KinVvnSr0eAXLbS3ToO39/fR8EtCab4LRarEc9VbjXsCZSKAExQGbY2SS99irY -7CFJXJv2eul/VTV+lmuNk5Mny5K76qxAwJ/C+IDPXfRa3M50hqY+bAtTyr2SzhkGcuYMXDhpxwTW -vGzOW/b3aJzcJRVIiKHpqfiYnODz1TEoYRFsZ5aNOZnLwkUkOQIDAQABo0IwQDAPBgNVHRMBAf8E -BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUrWyqlGCc7eT/+j4KdCtjA/e2Wb8wDQYJ -KoZIhvcNAQELBQADggEBABpA2JVlrAmSicY59BDlqQ5mU1143vokkbvnRFHfxhY0Cu9qRFHqKweK -A3rD6z8KLFIWoCtDuSWQP3CpMyVtRRooOyfPqsMpQhvfO0zAMzRbQYi/aytlryjvsvXDqmbOe1bu -t8jLZ8HJnBoYuMTDSQPxYA5QzUbF83d597YV4Djbxy8ooAw/dyZ02SUS2jHaGh7cKUGRIjxpp7sC -8rZcJwOJ9Abqm+RyguOhCcHpABnTPtRwa7pxpqpYrvS76Wy274fMm7v/OeZWYdMKp8RcTGB7BXcm -er/YB1IsYvdwY9k5vG8cwnncdimvzsUsZAReiDZuMdRAGmI0Nj81Aa6sY6A= ------END CERTIFICATE----- - -GeoTrust Primary Certification Authority - G2 -============================================= ------BEGIN CERTIFICATE----- -MIICrjCCAjWgAwIBAgIQPLL0SAoA4v7rJDteYD7DazAKBggqhkjOPQQDAzCBmDELMAkGA1UEBhMC -VVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA3IEdlb1RydXN0IElu -Yy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFyeSBD -ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMB4XDTA3MTEwNTAwMDAwMFoXDTM4MDExODIzNTk1 -OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAoYykg -MjAwNyBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMTLUdl -b1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMjB2MBAGByqGSM49AgEG -BSuBBAAiA2IABBWx6P0DFUPlrOuHNxFi79KDNlJ9RVcLSo17VDs6bl8VAsBQps8lL33KSLjHUGMc -KiEIfJo22Av+0SbFWDEwKCXzXV2juLaltJLtbCyf691DiaI8S0iRHVDsJt/WYC69IaNCMEAwDwYD -VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBVfNVdRVfslsq0DafwBo/q+ -EVXVMAoGCCqGSM49BAMDA2cAMGQCMGSWWaboCd6LuvpaiIjwH5HTRqjySkwCY/tsXzjbLkGTqQ7m -ndwxHLKgpxgceeHHNgIwOlavmnRs9vuD4DPTCF+hnMJbn0bWtsuRBmOiBuczrD6ogRLQy7rQkgu2 -npaqBA+K ------END CERTIFICATE----- - -VeriSign Universal Root Certification Authority -=============================================== ------BEGIN CERTIFICATE----- -MIIEuTCCA6GgAwIBAgIQQBrEZCGzEyEDDrvkEhrFHTANBgkqhkiG9w0BAQsFADCBvTELMAkGA1UE -BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO -ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwOCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk -IHVzZSBvbmx5MTgwNgYDVQQDEy9WZXJpU2lnbiBVbml2ZXJzYWwgUm9vdCBDZXJ0aWZpY2F0aW9u -IEF1dGhvcml0eTAeFw0wODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIG9MQswCQYDVQQGEwJV -UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv -cmsxOjA4BgNVBAsTMShjKSAyMDA4IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl -IG9ubHkxODA2BgNVBAMTL1ZlcmlTaWduIFVuaXZlcnNhbCBSb290IENlcnRpZmljYXRpb24gQXV0 -aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx2E3XrEBNNti1xWb/1hajCMj -1mCOkdeQmIN65lgZOIzF9uVkhbSicfvtvbnazU0AtMgtc6XHaXGVHzk8skQHnOgO+k1KxCHfKWGP -MiJhgsWHH26MfF8WIFFE0XBPV+rjHOPMee5Y2A7Cs0WTwCznmhcrewA3ekEzeOEz4vMQGn+HLL72 -9fdC4uW/h2KJXwBL38Xd5HVEMkE6HnFuacsLdUYI0crSK5XQz/u5QGtkjFdN/BMReYTtXlT2NJ8I -AfMQJQYXStrxHXpma5hgZqTZ79IugvHw7wnqRMkVauIDbjPTrJ9VAMf2CGqUuV/c4DPxhGD5WycR -tPwW8rtWaoAljQIDAQABo4GyMIGvMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMG0G -CCsGAQUFBwEMBGEwX6FdoFswWTBXMFUWCWltYWdlL2dpZjAhMB8wBwYFKw4DAhoEFI/l0xqGrI2O -a8PPgGrUSBgsexkuMCUWI2h0dHA6Ly9sb2dvLnZlcmlzaWduLmNvbS92c2xvZ28uZ2lmMB0GA1Ud -DgQWBBS2d/ppSEefUxLVwuoHMnYH0ZcHGTANBgkqhkiG9w0BAQsFAAOCAQEASvj4sAPmLGd75JR3 -Y8xuTPl9Dg3cyLk1uXBPY/ok+myDjEedO2Pzmvl2MpWRsXe8rJq+seQxIcaBlVZaDrHC1LGmWazx -Y8u4TB1ZkErvkBYoH1quEPuBUDgMbMzxPcP1Y+Oz4yHJJDnp/RVmRvQbEdBNc6N9Rvk97ahfYtTx -P/jgdFcrGJ2BtMQo2pSXpXDrrB2+BxHw1dvd5Yzw1TKwg+ZX4o+/vqGqvz0dtdQ46tewXDpPaj+P -wGZsY6rp2aQW9IHRlRQOfc2VNNnSj3BzgXucfr2YYdhFh5iQxeuGMMY1v/D/w1WIg0vvBZIGcfK4 -mJO37M2CYfE45k+XmCpajQ== ------END CERTIFICATE----- - -VeriSign Class 3 Public Primary Certification Authority - G4 -============================================================ ------BEGIN CERTIFICATE----- -MIIDhDCCAwqgAwIBAgIQL4D+I4wOIg9IZxIokYesszAKBggqhkjOPQQDAzCByjELMAkGA1UEBhMC -VVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3 -b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVz -ZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmlj -YXRpb24gQXV0aG9yaXR5IC0gRzQwHhcNMDcxMTA1MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCByjEL -MAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBU -cnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRo -b3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5 -IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzQwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAASnVnp8 -Utpkmw4tXNherJI9/gHmGUo9FANL+mAnINmDiWn6VMaaGF5VKmTeBvaNSjutEDxlPZCIBIngMGGz -rl0Bp3vefLK+ymVhAIau2o970ImtTR1ZmkGxvEeA3J5iw/mjgbIwga8wDwYDVR0TAQH/BAUwAwEB -/zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2UvZ2lmMCEw -HzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVyaXNpZ24u -Y29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFLMWkf3upm7ktS5Jj4d4gYDs5bG1MAoGCCqGSM49BAMD -A2gAMGUCMGYhDBgmYFo4e1ZC4Kf8NoRRkSAsdk1DPcQdhCPQrNZ8NQbOzWm9kA3bbEhCHQ6qQgIx -AJw9SDkjOVgaFRJZap7v1VmyHVIsmXHNxynfGyphe3HR3vPA5Q06Sqotp9iGKt0uEA== ------END CERTIFICATE----- - -NetLock Arany (Class Gold) Főtanúsítvány -============================================ ------BEGIN CERTIFICATE----- -MIIEFTCCAv2gAwIBAgIGSUEs5AAQMA0GCSqGSIb3DQEBCwUAMIGnMQswCQYDVQQGEwJIVTERMA8G -A1UEBwwIQnVkYXBlc3QxFTATBgNVBAoMDE5ldExvY2sgS2Z0LjE3MDUGA1UECwwuVGFuw7pzw610 -dsOhbnlraWFkw7NrIChDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzKTE1MDMGA1UEAwwsTmV0TG9jayBB -cmFueSAoQ2xhc3MgR29sZCkgRsWRdGFuw7pzw610dsOhbnkwHhcNMDgxMjExMTUwODIxWhcNMjgx -MjA2MTUwODIxWjCBpzELMAkGA1UEBhMCSFUxETAPBgNVBAcMCEJ1ZGFwZXN0MRUwEwYDVQQKDAxO -ZXRMb2NrIEtmdC4xNzA1BgNVBAsMLlRhbsO6c8OtdHbDoW55a2lhZMOzayAoQ2VydGlmaWNhdGlv -biBTZXJ2aWNlcykxNTAzBgNVBAMMLE5ldExvY2sgQXJhbnkgKENsYXNzIEdvbGQpIEbFkXRhbsO6 -c8OtdHbDoW55MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxCRec75LbRTDofTjl5Bu -0jBFHjzuZ9lk4BqKf8owyoPjIMHj9DrTlF8afFttvzBPhCf2nx9JvMaZCpDyD/V/Q4Q3Y1GLeqVw -/HpYzY6b7cNGbIRwXdrzAZAj/E4wqX7hJ2Pn7WQ8oLjJM2P+FpD/sLj916jAwJRDC7bVWaaeVtAk -H3B5r9s5VA1lddkVQZQBr17s9o3x/61k/iCa11zr/qYfCGSji3ZVrR47KGAuhyXoqq8fxmRGILdw -fzzeSNuWU7c5d+Qa4scWhHaXWy+7GRWF+GmF9ZmnqfI0p6m2pgP8b4Y9VHx2BJtr+UBdADTHLpl1 -neWIA6pN+APSQnbAGwIDAKiLo0UwQzASBgNVHRMBAf8ECDAGAQH/AgEEMA4GA1UdDwEB/wQEAwIB -BjAdBgNVHQ4EFgQUzPpnk/C2uNClwB7zU/2MU9+D15YwDQYJKoZIhvcNAQELBQADggEBAKt/7hwW -qZw8UQCgwBEIBaeZ5m8BiFRhbvG5GK1Krf6BQCOUL/t1fC8oS2IkgYIL9WHxHG64YTjrgfpioTta -YtOUZcTh5m2C+C8lcLIhJsFyUR+MLMOEkMNaj7rP9KdlpeuY0fsFskZ1FSNqb4VjMIDw1Z4fKRzC -bLBQWV2QWzuoDTDPv31/zvGdg73JRm4gpvlhUbohL3u+pRVjodSVh/GeufOJ8z2FuLjbvrW5Kfna -NwUASZQDhETnv0Mxz3WLJdH0pmT1kvarBes96aULNmLazAZfNou2XjG4Kvte9nHfRCaexOYNkbQu -dZWAUWpLMKawYqGT8ZvYzsRjdT9ZR7E= ------END CERTIFICATE----- - -Staat der Nederlanden Root CA - G2 -================================== ------BEGIN CERTIFICATE----- -MIIFyjCCA7KgAwIBAgIEAJiWjDANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJOTDEeMBwGA1UE -CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSswKQYDVQQDDCJTdGFhdCBkZXIgTmVkZXJsYW5kZW4g -Um9vdCBDQSAtIEcyMB4XDTA4MDMyNjExMTgxN1oXDTIwMDMyNTExMDMxMFowWjELMAkGA1UEBhMC -TkwxHjAcBgNVBAoMFVN0YWF0IGRlciBOZWRlcmxhbmRlbjErMCkGA1UEAwwiU3RhYXQgZGVyIE5l -ZGVybGFuZGVuIFJvb3QgQ0EgLSBHMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMVZ -5291qj5LnLW4rJ4L5PnZyqtdj7U5EILXr1HgO+EASGrP2uEGQxGZqhQlEq0i6ABtQ8SpuOUfiUtn -vWFI7/3S4GCI5bkYYCjDdyutsDeqN95kWSpGV+RLufg3fNU254DBtvPUZ5uW6M7XxgpT0GtJlvOj -CwV3SPcl5XCsMBQgJeN/dVrlSPhOewMHBPqCYYdu8DvEpMfQ9XQ+pV0aCPKbJdL2rAQmPlU6Yiil -e7Iwr/g3wtG61jj99O9JMDeZJiFIhQGp5Rbn3JBV3w/oOM2ZNyFPXfUib2rFEhZgF1XyZWampzCR -OME4HYYEhLoaJXhena/MUGDWE4dS7WMfbWV9whUYdMrhfmQpjHLYFhN9C0lK8SgbIHRrxT3dsKpI -CT0ugpTNGmXZK4iambwYfp/ufWZ8Pr2UuIHOzZgweMFvZ9C+X+Bo7d7iscksWXiSqt8rYGPy5V65 -48r6f1CGPqI0GAwJaCgRHOThuVw+R7oyPxjMW4T182t0xHJ04eOLoEq9jWYv6q012iDTiIJh8BIi -trzQ1aTsr1SIJSQ8p22xcik/Plemf1WvbibG/ufMQFxRRIEKeN5KzlW/HdXZt1bv8Hb/C3m1r737 -qWmRRpdogBQ2HbN/uymYNqUg+oJgYjOk7Na6B6duxc8UpufWkjTYgfX8HV2qXB72o007uPc5AgMB -AAGjgZcwgZQwDwYDVR0TAQH/BAUwAwEB/zBSBgNVHSAESzBJMEcGBFUdIAAwPzA9BggrBgEFBQcC -ARYxaHR0cDovL3d3dy5wa2lvdmVyaGVpZC5ubC9wb2xpY2llcy9yb290LXBvbGljeS1HMjAOBgNV -HQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJFoMocVHYnitfGsNig0jQt8YojrMA0GCSqGSIb3DQEBCwUA -A4ICAQCoQUpnKpKBglBu4dfYszk78wIVCVBR7y29JHuIhjv5tLySCZa59sCrI2AGeYwRTlHSeYAz -+51IvuxBQ4EffkdAHOV6CMqqi3WtFMTC6GY8ggen5ieCWxjmD27ZUD6KQhgpxrRW/FYQoAUXvQwj -f/ST7ZwaUb7dRUG/kSS0H4zpX897IZmflZ85OkYcbPnNe5yQzSipx6lVu6xiNGI1E0sUOlWDuYaN -kqbG9AclVMwWVxJKgnjIFNkXgiYtXSAfea7+1HAWFpWD2DU5/1JddRwWxRNVz0fMdWVSSt7wsKfk -CpYL+63C4iWEst3kvX5ZbJvw8NjnyvLplzh+ib7M+zkXYT9y2zqR2GUBGR2tUKRXCnxLvJxxcypF -URmFzI79R6d0lR2o0a9OF7FpJsKqeFdbxU2n5Z4FF5TKsl+gSRiNNOkmbEgeqmiSBeGCc1qb3Adb -CG19ndeNIdn8FCCqwkXfP+cAslHkwvgFuXkajDTznlvkN1trSt8sV4pAWja63XVECDdCcAz+3F4h -oKOKwJCcaNpQ5kUQR3i2TtJlycM33+FCY7BXN0Ute4qcvwXqZVUz9zkQxSgqIXobisQk+T8VyJoV -IPVVYpbtbZNQvOSqeK3Zywplh6ZmwcSBo3c6WB4L7oOLnR7SUqTMHW+wmG2UMbX4cQrcufx9MmDm -66+KAQ== ------END CERTIFICATE----- - -CA Disig -======== ------BEGIN CERTIFICATE----- -MIIEDzCCAvegAwIBAgIBATANBgkqhkiG9w0BAQUFADBKMQswCQYDVQQGEwJTSzETMBEGA1UEBxMK -QnJhdGlzbGF2YTETMBEGA1UEChMKRGlzaWcgYS5zLjERMA8GA1UEAxMIQ0EgRGlzaWcwHhcNMDYw -MzIyMDEzOTM0WhcNMTYwMzIyMDEzOTM0WjBKMQswCQYDVQQGEwJTSzETMBEGA1UEBxMKQnJhdGlz -bGF2YTETMBEGA1UEChMKRGlzaWcgYS5zLjERMA8GA1UEAxMIQ0EgRGlzaWcwggEiMA0GCSqGSIb3 -DQEBAQUAA4IBDwAwggEKAoIBAQCS9jHBfYj9mQGp2HvycXXxMcbzdWb6UShGhJd4NLxs/LxFWYgm -GErENx+hSkS943EE9UQX4j/8SFhvXJ56CbpRNyIjZkMhsDxkovhqFQ4/61HhVKndBpnXmjxUizkD -Pw/Fzsbrg3ICqB9x8y34dQjbYkzo+s7552oftms1grrijxaSfQUMbEYDXcDtab86wYqg6I7ZuUUo -hwjstMoVvoLdtUSLLa2GDGhibYVW8qwUYzrG0ZmsNHhWS8+2rT+MitcE5eN4TPWGqvWP+j1scaMt -ymfraHtuM6kMgiioTGohQBUgDCZbg8KpFhXAJIJdKxatymP2dACw30PEEGBWZ2NFAgMBAAGjgf8w -gfwwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUjbJJaJ1yCCW5wCf1UJNWSEZx+Y8wDgYDVR0P -AQH/BAQDAgEGMDYGA1UdEQQvMC2BE2Nhb3BlcmF0b3JAZGlzaWcuc2uGFmh0dHA6Ly93d3cuZGlz -aWcuc2svY2EwZgYDVR0fBF8wXTAtoCugKYYnaHR0cDovL3d3dy5kaXNpZy5zay9jYS9jcmwvY2Ff -ZGlzaWcuY3JsMCygKqAohiZodHRwOi8vY2EuZGlzaWcuc2svY2EvY3JsL2NhX2Rpc2lnLmNybDAa -BgNVHSAEEzARMA8GDSuBHpGT5goAAAABAQEwDQYJKoZIhvcNAQEFBQADggEBAF00dGFMrzvY/59t -WDYcPQuBDRIrRhCA/ec8J9B6yKm2fnQwM6M6int0wHl5QpNt/7EpFIKrIYwvF/k/Ji/1WcbvgAa3 -mkkp7M5+cTxqEEHA9tOasnxakZzArFvITV734VP/Q3f8nktnbNfzg9Gg4H8l37iYC5oyOGwwoPP/ -CBUz91BKez6jPiCp3C9WgArtQVCwyfTssuMmRAAOb54GvCKWU3BlxFAKRmukLyeBEicTXxChds6K -ezfqwzlhA5WYOudsiCUI/HloDYd9Yvi0X/vF2Ey9WLw/Q1vUHgFNPGO+I++MzVpQuGhU+QqZMxEA -4Z7CRneC9VkGjCFMhwnN5ag= ------END CERTIFICATE----- - -Juur-SK -======= ------BEGIN CERTIFICATE----- -MIIE5jCCA86gAwIBAgIEO45L/DANBgkqhkiG9w0BAQUFADBdMRgwFgYJKoZIhvcNAQkBFglwa2lA -c2suZWUxCzAJBgNVBAYTAkVFMSIwIAYDVQQKExlBUyBTZXJ0aWZpdHNlZXJpbWlza2Vza3VzMRAw -DgYDVQQDEwdKdXVyLVNLMB4XDTAxMDgzMDE0MjMwMVoXDTE2MDgyNjE0MjMwMVowXTEYMBYGCSqG -SIb3DQEJARYJcGtpQHNrLmVlMQswCQYDVQQGEwJFRTEiMCAGA1UEChMZQVMgU2VydGlmaXRzZWVy -aW1pc2tlc2t1czEQMA4GA1UEAxMHSnV1ci1TSzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC -ggEBAIFxNj4zB9bjMI0TfncyRsvPGbJgMUaXhvSYRqTCZUXP00B841oiqBB4M8yIsdOBSvZiF3tf -TQou0M+LI+5PAk676w7KvRhj6IAcjeEcjT3g/1tf6mTll+g/mX8MCgkzABpTpyHhOEvWgxutr2TC -+Rx6jGZITWYfGAriPrsfB2WThbkasLnE+w0R9vXW+RvHLCu3GFH+4Hv2qEivbDtPL+/40UceJlfw -UR0zlv/vWT3aTdEVNMfqPxZIe5EcgEMPPbgFPtGzlc3Yyg/CQ2fbt5PgIoIuvvVoKIO5wTtpeyDa -Tpxt4brNj3pssAki14sL2xzVWiZbDcDq5WDQn/413z8CAwEAAaOCAawwggGoMA8GA1UdEwEB/wQF -MAMBAf8wggEWBgNVHSAEggENMIIBCTCCAQUGCisGAQQBzh8BAQEwgfYwgdAGCCsGAQUFBwICMIHD -HoHAAFMAZQBlACAAcwBlAHIAdABpAGYAaQBrAGEAYQB0ACAAbwBuACAAdgDkAGwAagBhAHMAdABh -AHQAdQBkACAAQQBTAC0AaQBzACAAUwBlAHIAdABpAGYAaQB0AHMAZQBlAHIAaQBtAGkAcwBrAGUA -cwBrAHUAcwAgAGEAbABhAG0ALQBTAEsAIABzAGUAcgB0AGkAZgBpAGsAYQBhAHQAaQBkAGUAIABr -AGkAbgBuAGkAdABhAG0AaQBzAGUAawBzMCEGCCsGAQUFBwIBFhVodHRwOi8vd3d3LnNrLmVlL2Nw -cy8wKwYDVR0fBCQwIjAgoB6gHIYaaHR0cDovL3d3dy5zay5lZS9qdXVyL2NybC8wHQYDVR0OBBYE -FASqekej5ImvGs8KQKcYP2/v6X2+MB8GA1UdIwQYMBaAFASqekej5ImvGs8KQKcYP2/v6X2+MA4G -A1UdDwEB/wQEAwIB5jANBgkqhkiG9w0BAQUFAAOCAQEAe8EYlFOiCfP+JmeaUOTDBS8rNXiRTHyo -ERF5TElZrMj3hWVcRrs7EKACr81Ptcw2Kuxd/u+gkcm2k298gFTsxwhwDY77guwqYHhpNjbRxZyL -abVAyJRld/JXIWY7zoVAtjNjGr95HvxcHdMdkxuLDF2FvZkwMhgJkVLpfKG6/2SSmuz+Ne6ML678 -IIbsSt4beDI3poHSna9aEhbKmVv8b20OxaAehsmR0FyYgl9jDIpaq9iVpszLita/ZEuOyoqysOkh -Mp6qqIWYNIE5ITuoOlIyPfZrN4YGWhWY3PARZv40ILcD9EEQfTmEeZZyY7aWAuVrua0ZTbvGRNs2 -yyqcjg== ------END CERTIFICATE----- - -Hongkong Post Root CA 1 -======================= ------BEGIN CERTIFICATE----- -MIIDMDCCAhigAwIBAgICA+gwDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoT -DUhvbmdrb25nIFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMB4XDTAzMDUx -NTA1MTMxNFoXDTIzMDUxNTA0NTIyOVowRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoTDUhvbmdrb25n -IFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMIIBIjANBgkqhkiG9w0BAQEF -AAOCAQ8AMIIBCgKCAQEArP84tulmAknjorThkPlAj3n54r15/gK97iSSHSL22oVyaf7XPwnU3ZG1 -ApzQjVrhVcNQhrkpJsLj2aDxaQMoIIBFIi1WpztUlVYiWR8o3x8gPW2iNr4joLFutbEnPzlTCeqr -auh0ssJlXI6/fMN4hM2eFvz1Lk8gKgifd/PFHsSaUmYeSF7jEAaPIpjhZY4bXSNmO7ilMlHIhqqh -qZ5/dpTCpmy3QfDVyAY45tQM4vM7TG1QjMSDJ8EThFk9nnV0ttgCXjqQesBCNnLsak3c78QA3xMY -V18meMjWCnl3v/evt3a5pQuEF10Q6m/hq5URX208o1xNg1vysxmKgIsLhwIDAQABoyYwJDASBgNV -HRMBAf8ECDAGAQH/AgEDMA4GA1UdDwEB/wQEAwIBxjANBgkqhkiG9w0BAQUFAAOCAQEADkbVPK7i -h9legYsCmEEIjEy82tvuJxuC52pF7BaLT4Wg87JwvVqWuspube5Gi27nKi6Wsxkz67SfqLI37pio -l7Yutmcn1KZJ/RyTZXaeQi/cImyaT/JaFTmxcdcrUehtHJjA2Sr0oYJ71clBoiMBdDhViw+5Lmei -IAQ32pwL0xch4I+XeTRvhEgCIDMb5jREn5Fw9IBehEPCKdJsEhTkYY2sEJCehFC78JZvRZ+K88ps -T/oROhUVRsPNH4NbLUES7VBnQRM9IauUiqpOfMGx+6fWtScvl6tu4B3i0RwsH0Ti/L6RoZz71ilT -c4afU9hDDl3WY4JxHYB0yvbiAmvZWg== ------END CERTIFICATE----- - -SecureSign RootCA11 -=================== ------BEGIN CERTIFICATE----- -MIIDbTCCAlWgAwIBAgIBATANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQGEwJKUDErMCkGA1UEChMi -SmFwYW4gQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcywgSW5jLjEcMBoGA1UEAxMTU2VjdXJlU2lnbiBS -b290Q0ExMTAeFw0wOTA0MDgwNDU2NDdaFw0yOTA0MDgwNDU2NDdaMFgxCzAJBgNVBAYTAkpQMSsw -KQYDVQQKEyJKYXBhbiBDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzLCBJbmMuMRwwGgYDVQQDExNTZWN1 -cmVTaWduIFJvb3RDQTExMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA/XeqpRyQBTvL -TJszi1oURaTnkBbR31fSIRCkF/3frNYfp+TbfPfs37gD2pRY/V1yfIw/XwFndBWW4wI8h9uuywGO -wvNmxoVF9ALGOrVisq/6nL+k5tSAMJjzDbaTj6nU2DbysPyKyiyhFTOVMdrAG/LuYpmGYz+/3ZMq -g6h2uRMft85OQoWPIucuGvKVCbIFtUROd6EgvanyTgp9UK31BQ1FT0Zx/Sg+U/sE2C3XZR1KG/rP -O7AxmjVuyIsG0wCR8pQIZUyxNAYAeoni8McDWc/V1uinMrPmmECGxc0nEovMe863ETxiYAcjPitA -bpSACW22s293bzUIUPsCh8U+iQIDAQABo0IwQDAdBgNVHQ4EFgQUW/hNT7KlhtQ60vFjmqC+CfZX -t94wDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAKCh -OBZmLqdWHyGcBvod7bkixTgm2E5P7KN/ed5GIaGHd48HCJqypMWvDzKYC3xmKbabfSVSSUOrTC4r -bnpwrxYO4wJs+0LmGJ1F2FXI6Dvd5+H0LgscNFxsWEr7jIhQX5Ucv+2rIrVls4W6ng+4reV6G4pQ -Oh29Dbx7VFALuUKvVaAYga1lme++5Jy/xIWrQbJUb9wlze144o4MjQlJ3WN7WmmWAiGovVJZ6X01 -y8hSyn+B/tlr0/cR7SXf+Of5pPpyl4RTDaXQMhhRdlkUbA/r7F+AjHVDg8OFmP9Mni0N5HeDk061 -lgeLKBObjBmNQSdJQO7e5iNEOdyhIta6A/I= ------END CERTIFICATE----- - -ACEDICOM Root -============= ------BEGIN CERTIFICATE----- -MIIFtTCCA52gAwIBAgIIYY3HhjsBggUwDQYJKoZIhvcNAQEFBQAwRDEWMBQGA1UEAwwNQUNFRElD -T00gUm9vdDEMMAoGA1UECwwDUEtJMQ8wDQYDVQQKDAZFRElDT00xCzAJBgNVBAYTAkVTMB4XDTA4 -MDQxODE2MjQyMloXDTI4MDQxMzE2MjQyMlowRDEWMBQGA1UEAwwNQUNFRElDT00gUm9vdDEMMAoG -A1UECwwDUEtJMQ8wDQYDVQQKDAZFRElDT00xCzAJBgNVBAYTAkVTMIICIjANBgkqhkiG9w0BAQEF -AAOCAg8AMIICCgKCAgEA/5KV4WgGdrQsyFhIyv2AVClVYyT/kGWbEHV7w2rbYgIB8hiGtXxaOLHk -WLn709gtn70yN78sFW2+tfQh0hOR2QetAQXW8713zl9CgQr5auODAKgrLlUTY4HKRxx7XBZXehuD -YAQ6PmXDzQHe3qTWDLqO3tkE7hdWIpuPY/1NFgu3e3eM+SW10W2ZEi5PGrjm6gSSrj0RuVFCPYew -MYWveVqc/udOXpJPQ/yrOq2lEiZmueIM15jO1FillUAKt0SdE3QrwqXrIhWYENiLxQSfHY9g5QYb -m8+5eaA9oiM/Qj9r+hwDezCNzmzAv+YbX79nuIQZ1RXve8uQNjFiybwCq0Zfm/4aaJQ0PZCOrfbk -HQl/Sog4P75n/TSW9R28MHTLOO7VbKvU/PQAtwBbhTIWdjPp2KOZnQUAqhbm84F9b32qhm2tFXTT -xKJxqvQUfecyuB+81fFOvW8XAjnXDpVCOscAPukmYxHqC9FK/xidstd7LzrZlvvoHpKuE1XI2Sf2 -3EgbsCTBheN3nZqk8wwRHQ3ItBTutYJXCb8gWH8vIiPYcMt5bMlL8qkqyPyHK9caUPgn6C9D4zq9 -2Fdx/c6mUlv53U3t5fZvie27k5x2IXXwkkwp9y+cAS7+UEaeZAwUswdbxcJzbPEHXEUkFDWug/Fq -TYl6+rPYLWbwNof1K1MCAwEAAaOBqjCBpzAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFKaz -4SsrSbbXc6GqlPUB53NlTKxQMA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUprPhKytJttdzoaqU -9QHnc2VMrFAwRAYDVR0gBD0wOzA5BgRVHSAAMDEwLwYIKwYBBQUHAgEWI2h0dHA6Ly9hY2VkaWNv -bS5lZGljb21ncm91cC5jb20vZG9jMA0GCSqGSIb3DQEBBQUAA4ICAQDOLAtSUWImfQwng4/F9tqg -aHtPkl7qpHMyEVNEskTLnewPeUKzEKbHDZ3Ltvo/Onzqv4hTGzz3gvoFNTPhNahXwOf9jU8/kzJP -eGYDdwdY6ZXIfj7QeQCM8htRM5u8lOk6e25SLTKeI6RF+7YuE7CLGLHdztUdp0J/Vb77W7tH1Pwk -zQSulgUV1qzOMPPKC8W64iLgpq0i5ALudBF/TP94HTXa5gI06xgSYXcGCRZj6hitoocf8seACQl1 -ThCojz2GuHURwCRiipZ7SkXp7FnFvmuD5uHorLUwHv4FB4D54SMNUI8FmP8sX+g7tq3PgbUhh8oI -KiMnMCArz+2UW6yyetLHKKGKC5tNSixthT8Jcjxn4tncB7rrZXtaAWPWkFtPF2Y9fwsZo5NjEFIq -nxQWWOLcpfShFosOkYuByptZ+thrkQdlVV9SH686+5DdaaVbnG0OLLb6zqylfDJKZ0DcMDQj3dcE -I2bw/FWAp/tmGYI1Z2JwOV5vx+qQQEQIHriy1tvuWacNGHk0vFQYXlPKNFHtRQrmjseCNj6nOGOp -MCwXEGCSn1WHElkQwg9naRHMTh5+Spqtr0CodaxWkHS4oJyleW/c6RrIaQXpuvoDs3zk4E7Czp3o -tkYNbn5XOmeUwssfnHdKZ05phkOTOPu220+DkdRgfks+KzgHVZhepA== ------END CERTIFICATE----- - -Verisign Class 3 Public Primary Certification Authority -======================================================= ------BEGIN CERTIFICATE----- -MIICPDCCAaUCEDyRMcsf9tAbDpq40ES/Er4wDQYJKoZIhvcNAQEFBQAwXzELMAkGA1UEBhMCVVMx -FzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAzIFB1YmxpYyBQcmltYXJ5 -IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2MDEyOTAwMDAwMFoXDTI4MDgwMjIzNTk1OVow -XzELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAz -IFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUA -A4GNADCBiQKBgQDJXFme8huKARS0EN8EQNvjV69qRUCPhAwL0TPZ2RHP7gJYHyX3KqhEBarsAx94 -f56TuZoAqiN91qyFomNFx3InzPRMxnVx0jnvT0Lwdd8KkMaOIG+YD/isI19wKTakyYbnsZogy1Ol -hec9vn2a/iRFM9x2Fe0PonFkTGUugWhFpwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBABByUqkFFBky -CEHwxWsKzH4PIRnN5GfcX6kb5sroc50i2JhucwNhkcV8sEVAbkSdjbCxlnRhLQ2pRdKkkirWmnWX -bj9T/UWZYB2oK0z5XqcJ2HUw19JlYD1n1khVdWk/kfVIC0dpImmClr7JyDiGSnoscxlIaU5rfGW/ -D/xwzoiQ ------END CERTIFICATE----- - -Microsec e-Szigno Root CA 2009 -============================== ------BEGIN CERTIFICATE----- -MIIECjCCAvKgAwIBAgIJAMJ+QwRORz8ZMA0GCSqGSIb3DQEBCwUAMIGCMQswCQYDVQQGEwJIVTER -MA8GA1UEBwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jv -c2VjIGUtU3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5o -dTAeFw0wOTA2MTYxMTMwMThaFw0yOTEyMzAxMTMwMThaMIGCMQswCQYDVQQGEwJIVTERMA8GA1UE -BwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jvc2VjIGUt -U3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5odTCCASIw -DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOn4j/NjrdqG2KfgQvvPkd6mJviZpWNwrZuuyjNA -fW2WbqEORO7hE52UQlKavXWFdCyoDh2Tthi3jCyoz/tccbna7P7ofo/kLx2yqHWH2Leh5TvPmUpG -0IMZfcChEhyVbUr02MelTTMuhTlAdX4UfIASmFDHQWe4oIBhVKZsTh/gnQ4H6cm6M+f+wFUoLAKA -pxn1ntxVUwOXewdI/5n7N4okxFnMUBBjjqqpGrCEGob5X7uxUG6k0QrM1XF+H6cbfPVTbiJfyyvm -1HxdrtbCxkzlBQHZ7Vf8wSN5/PrIJIOV87VqUQHQd9bpEqH5GoP7ghu5sJf0dgYzQ0mg/wu1+rUC -AwEAAaOBgDB+MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTLD8bf -QkPMPcu1SCOhGnqmKrs0aDAfBgNVHSMEGDAWgBTLD8bfQkPMPcu1SCOhGnqmKrs0aDAbBgNVHREE -FDASgRBpbmZvQGUtc3ppZ25vLmh1MA0GCSqGSIb3DQEBCwUAA4IBAQDJ0Q5eLtXMs3w+y/w9/w0o -lZMEyL/azXm4Q5DwpL7v8u8hmLzU1F0G9u5C7DBsoKqpyvGvivo/C3NqPuouQH4frlRheesuCDfX -I/OMn74dseGkddug4lQUsbocKaQY9hK6ohQU4zE1yED/t+AFdlfBHFny+L/k7SViXITwfn4fs775 -tyERzAMBVnCnEJIeGzSBHq2cGsMEPO0CYdYeBvNfOofyK/FFh+U9rNHHV4S9a67c2Pm2G2JwCz02 -yULyMtd6YebS2z3PyKnJm9zbWETXbzivf3jTo60adbocwTZ8jx5tHMN1Rq41Bab2XD0h7lbwyYIi -LXpUq3DDfSJlgnCW ------END CERTIFICATE----- - -E-Guven Kok Elektronik Sertifika Hizmet Saglayicisi -=================================================== ------BEGIN CERTIFICATE----- -MIIDtjCCAp6gAwIBAgIQRJmNPMADJ72cdpW56tustTANBgkqhkiG9w0BAQUFADB1MQswCQYDVQQG -EwJUUjEoMCYGA1UEChMfRWxla3Ryb25payBCaWxnaSBHdXZlbmxpZ2kgQS5TLjE8MDoGA1UEAxMz -ZS1HdXZlbiBLb2sgRWxla3Ryb25payBTZXJ0aWZpa2EgSGl6bWV0IFNhZ2xheWljaXNpMB4XDTA3 -MDEwNDExMzI0OFoXDTE3MDEwNDExMzI0OFowdTELMAkGA1UEBhMCVFIxKDAmBgNVBAoTH0VsZWt0 -cm9uaWsgQmlsZ2kgR3V2ZW5saWdpIEEuUy4xPDA6BgNVBAMTM2UtR3V2ZW4gS29rIEVsZWt0cm9u -aWsgU2VydGlmaWthIEhpem1ldCBTYWdsYXlpY2lzaTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC -AQoCggEBAMMSIJ6wXgBljU5Gu4Bc6SwGl9XzcslwuedLZYDBS75+PNdUMZTe1RK6UxYC6lhj71vY -8+0qGqpxSKPcEC1fX+tcS5yWCEIlKBHMilpiAVDV6wlTL/jDj/6z/P2douNffb7tC+Bg62nsM+3Y -jfsSSYMAyYuXjDtzKjKzEve5TfL0TW3H5tYmNwjy2f1rXKPlSFxYvEK+A1qBuhw1DADT9SN+cTAI -JjjcJRFHLfO6IxClv7wC90Nex/6wN1CZew+TzuZDLMN+DfIcQ2Zgy2ExR4ejT669VmxMvLz4Bcpk -9Ok0oSy1c+HCPujIyTQlCFzz7abHlJ+tiEMl1+E5YP6sOVkCAwEAAaNCMEAwDgYDVR0PAQH/BAQD -AgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFJ/uRLOU1fqRTy7ZVZoEVtstxNulMA0GCSqG -SIb3DQEBBQUAA4IBAQB/X7lTW2M9dTLn+sR0GstG30ZpHFLPqk/CaOv/gKlR6D1id4k9CnU58W5d -F4dvaAXBlGzZXd/aslnLpRCKysw5zZ/rTt5S/wzw9JKp8mxTq5vSR6AfdPebmvEvFZ96ZDAYBzwq -D2fK/A+JYZ1lpTzlvBNbCNvj/+27BrtqBrF6T2XGgv0enIu1De5Iu7i9qgi0+6N8y5/NkHZchpZ4 -Vwpm+Vganf2XKWDeEaaQHBkc7gGWIjQ0LpH5t8Qn0Xvmv/uARFoW5evg1Ao4vOSR49XrXMGs3xtq -fJ7lddK2l4fbzIcrQzqECK+rPNv3PGYxhrCdU3nt+CPeQuMtgvEP5fqX ------END CERTIFICATE----- - -GlobalSign Root CA - R3 -======================= ------BEGIN CERTIFICATE----- -MIIDXzCCAkegAwIBAgILBAAAAAABIVhTCKIwDQYJKoZIhvcNAQELBQAwTDEgMB4GA1UECxMXR2xv -YmFsU2lnbiBSb290IENBIC0gUjMxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh -bFNpZ24wHhcNMDkwMzE4MTAwMDAwWhcNMjkwMzE4MTAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT -aWduIFJvb3QgQ0EgLSBSMzETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln -bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMwldpB5BngiFvXAg7aEyiie/QV2EcWt -iHL8RgJDx7KKnQRfJMsuS+FggkbhUqsMgUdwbN1k0ev1LKMPgj0MK66X17YUhhB5uzsTgHeMCOFJ -0mpiLx9e+pZo34knlTifBtc+ycsmWQ1z3rDI6SYOgxXG71uL0gRgykmmKPZpO/bLyCiR5Z2KYVc3 -rHQU3HTgOu5yLy6c+9C7v/U9AOEGM+iCK65TpjoWc4zdQQ4gOsC0p6Hpsk+QLjJg6VfLuQSSaGjl -OCZgdbKfd/+RFO+uIEn8rUAVSNECMWEZXriX7613t2Saer9fwRPvm2L7DWzgVGkWqQPabumDk3F2 -xmmFghcCAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE -FI/wS3+oLkUkrk1Q+mOai97i3Ru8MA0GCSqGSIb3DQEBCwUAA4IBAQBLQNvAUKr+yAzv95ZURUm7 -lgAJQayzE4aGKAczymvmdLm6AC2upArT9fHxD4q/c2dKg8dEe3jgr25sbwMpjjM5RcOO5LlXbKr8 -EpbsU8Yt5CRsuZRj+9xTaGdWPoO4zzUhw8lo/s7awlOqzJCK6fBdRoyV3XpYKBovHd7NADdBj+1E -bddTKJd+82cEHhXXipa0095MJ6RMG3NzdvQXmcIfeg7jLQitChws/zyrVQ4PkX4268NXSb7hLi18 -YIvDQVETI53O9zJrlAGomecsMx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7r -kpeDMdmztcpHWD9f ------END CERTIFICATE----- - -Autoridad de Certificacion Firmaprofesional CIF A62634068 -========================================================= ------BEGIN CERTIFICATE----- -MIIGFDCCA/ygAwIBAgIIU+w77vuySF8wDQYJKoZIhvcNAQEFBQAwUTELMAkGA1UEBhMCRVMxQjBA -BgNVBAMMOUF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1hcHJvZmVzaW9uYWwgQ0lGIEE2 -MjYzNDA2ODAeFw0wOTA1MjAwODM4MTVaFw0zMDEyMzEwODM4MTVaMFExCzAJBgNVBAYTAkVTMUIw -QAYDVQQDDDlBdXRvcmlkYWQgZGUgQ2VydGlmaWNhY2lvbiBGaXJtYXByb2Zlc2lvbmFsIENJRiBB -NjI2MzQwNjgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKlmuO6vj78aI14H9M2uDD -Utd9thDIAl6zQyrET2qyyhxdKJp4ERppWVevtSBC5IsP5t9bpgOSL/UR5GLXMnE42QQMcas9UX4P -B99jBVzpv5RvwSmCwLTaUbDBPLutN0pcyvFLNg4kq7/DhHf9qFD0sefGL9ItWY16Ck6WaVICqjaY -7Pz6FIMMNx/Jkjd/14Et5cS54D40/mf0PmbR0/RAz15iNA9wBj4gGFrO93IbJWyTdBSTo3OxDqqH -ECNZXyAFGUftaI6SEspd/NYrspI8IM/hX68gvqB2f3bl7BqGYTM+53u0P6APjqK5am+5hyZvQWyI -plD9amML9ZMWGxmPsu2bm8mQ9QEM3xk9Dz44I8kvjwzRAv4bVdZO0I08r0+k8/6vKtMFnXkIoctX -MbScyJCyZ/QYFpM6/EfY0XiWMR+6KwxfXZmtY4laJCB22N/9q06mIqqdXuYnin1oKaPnirjaEbsX -LZmdEyRG98Xi2J+Of8ePdG1asuhy9azuJBCtLxTa/y2aRnFHvkLfuwHb9H/TKI8xWVvTyQKmtFLK -bpf7Q8UIJm+K9Lv9nyiqDdVF8xM6HdjAeI9BZzwelGSuewvF6NkBiDkal4ZkQdU7hwxu+g/GvUgU -vzlN1J5Bto+WHWOWk9mVBngxaJ43BjuAiUVhOSPHG0SjFeUc+JIwuwIDAQABo4HvMIHsMBIGA1Ud -EwEB/wQIMAYBAf8CAQEwDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRlzeurNR4APn7VdMActHNH -DhpkLzCBpgYDVR0gBIGeMIGbMIGYBgRVHSAAMIGPMC8GCCsGAQUFBwIBFiNodHRwOi8vd3d3LmZp -cm1hcHJvZmVzaW9uYWwuY29tL2NwczBcBggrBgEFBQcCAjBQHk4AUABhAHMAZQBvACAAZABlACAA -bABhACAAQgBvAG4AYQBuAG8AdgBhACAANAA3ACAAQgBhAHIAYwBlAGwAbwBuAGEAIAAwADgAMAAx -ADcwDQYJKoZIhvcNAQEFBQADggIBABd9oPm03cXF661LJLWhAqvdpYhKsg9VSytXjDvlMd3+xDLx -51tkljYyGOylMnfX40S2wBEqgLk9am58m9Ot/MPWo+ZkKXzR4Tgegiv/J2Wv+xYVxC5xhOW1//qk -R71kMrv2JYSiJ0L1ILDCExARzRAVukKQKtJE4ZYm6zFIEv0q2skGz3QeqUvVhyj5eTSSPi5E6PaP -T481PyWzOdxjKpBrIF/EUhJOlywqrJ2X3kjyo2bbwtKDlaZmp54lD+kLM5FlClrD2VQS3a/DTg4f -Jl4N3LON7NWBcN7STyQF82xO9UxJZo3R/9ILJUFI/lGExkKvgATP0H5kSeTy36LssUzAKh3ntLFl -osS88Zj0qnAHY7S42jtM+kAiMFsRpvAFDsYCA0irhpuF3dvd6qJ2gHN99ZwExEWN57kci57q13XR -crHedUTnQn3iV2t93Jm8PYMo6oCTjcVMZcFwgbg4/EMxsvYDNEeyrPsiBsse3RdHHF9mudMaotoR -saS8I8nkvof/uZS2+F0gStRf571oe2XyFR7SOqkt6dhrJKyXWERHrVkY8SFlcN7ONGCoQPHzPKTD -KCOM/iczQ0CgFzzr6juwcqajuUpLXhZI9LK8yIySxZ2frHI2vDSANGupi5LAuBft7HZT9SQBjLMi -6Et8Vcad+qMUu2WFbm5PEn4KPJ2V ------END CERTIFICATE----- - -Izenpe.com -========== ------BEGIN CERTIFICATE----- -MIIF8TCCA9mgAwIBAgIQALC3WhZIX7/hy/WL1xnmfTANBgkqhkiG9w0BAQsFADA4MQswCQYDVQQG -EwJFUzEUMBIGA1UECgwLSVpFTlBFIFMuQS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wHhcNMDcxMjEz -MTMwODI4WhcNMzcxMjEzMDgyNzI1WjA4MQswCQYDVQQGEwJFUzEUMBIGA1UECgwLSVpFTlBFIFMu -QS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDJ -03rKDx6sp4boFmVqscIbRTJxldn+EFvMr+eleQGPicPK8lVx93e+d5TzcqQsRNiekpsUOqHnJJAK -ClaOxdgmlOHZSOEtPtoKct2jmRXagaKH9HtuJneJWK3W6wyyQXpzbm3benhB6QiIEn6HLmYRY2xU -+zydcsC8Lv/Ct90NduM61/e0aL6i9eOBbsFGb12N4E3GVFWJGjMxCrFXuaOKmMPsOzTFlUFpfnXC -PCDFYbpRR6AgkJOhkEvzTnyFRVSa0QUmQbC1TR0zvsQDyCV8wXDbO/QJLVQnSKwv4cSsPsjLkkxT -OTcj7NMB+eAJRE1NZMDhDVqHIrytG6P+JrUV86f8hBnp7KGItERphIPzidF0BqnMC9bC3ieFUCbK -F7jJeodWLBoBHmy+E60QrLUk9TiRodZL2vG70t5HtfG8gfZZa88ZU+mNFctKy6lvROUbQc/hhqfK -0GqfvEyNBjNaooXlkDWgYlwWTvDjovoDGrQscbNYLN57C9saD+veIR8GdwYDsMnvmfzAuU8Lhij+ -0rnq49qlw0dpEuDb8PYZi+17cNcC1u2HGCgsBCRMd+RIihrGO5rUD8r6ddIBQFqNeb+Lz0vPqhbB -leStTIo+F5HUsWLlguWABKQDfo2/2n+iD5dPDNMN+9fR5XJ+HMh3/1uaD7euBUbl8agW7EekFwID -AQABo4H2MIHzMIGwBgNVHREEgagwgaWBD2luZm9AaXplbnBlLmNvbaSBkTCBjjFHMEUGA1UECgw+ -SVpFTlBFIFMuQS4gLSBDSUYgQTAxMzM3MjYwLVJNZXJjLlZpdG9yaWEtR2FzdGVpeiBUMTA1NSBG -NjIgUzgxQzBBBgNVBAkMOkF2ZGEgZGVsIE1lZGl0ZXJyYW5lbyBFdG9yYmlkZWEgMTQgLSAwMTAx -MCBWaXRvcmlhLUdhc3RlaXowDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O -BBYEFB0cZQ6o8iV7tJHP5LGx5r1VdGwFMA0GCSqGSIb3DQEBCwUAA4ICAQB4pgwWSp9MiDrAyw6l -Fn2fuUhfGI8NYjb2zRlrrKvV9pF9rnHzP7MOeIWblaQnIUdCSnxIOvVFfLMMjlF4rJUT3sb9fbga -kEyrkgPH7UIBzg/YsfqikuFgba56awmqxinuaElnMIAkejEWOVt+8Rwu3WwJrfIxwYJOubv5vr8q -hT/AQKM6WfxZSzwoJNu0FXWuDYi6LnPAvViH5ULy617uHjAimcs30cQhbIHsvm0m5hzkQiCeR7Cs -g1lwLDXWrzY0tM07+DKo7+N4ifuNRSzanLh+QBxh5z6ikixL8s36mLYp//Pye6kfLqCTVyvehQP5 -aTfLnnhqBbTFMXiJ7HqnheG5ezzevh55hM6fcA5ZwjUukCox2eRFekGkLhObNA5me0mrZJfQRsN5 -nXJQY6aYWwa9SG3YOYNw6DXwBdGqvOPbyALqfP2C2sJbUjWumDqtujWTI6cfSN01RpiyEGjkpTHC -ClguGYEQyVB1/OpaFs4R1+7vUIgtYf8/QnMFlEPVjjxOAToZpR9GTnfQXeWBIiGH/pR9hNiTrdZo -Q0iy2+tzJOeRf1SktoA+naM8THLCV8Sg1Mw4J87VBp6iSNnpn86CcDaTmjvfliHjWbcM2pE38P1Z -WrOZyGlsQyYBNWNgVYkDOnXYukrZVP/u3oDYLdE41V4tC5h9Pmzb/CaIxw== ------END CERTIFICATE----- - -Chambers of Commerce Root - 2008 -================================ ------BEGIN CERTIFICATE----- -MIIHTzCCBTegAwIBAgIJAKPaQn6ksa7aMA0GCSqGSIb3DQEBBQUAMIGuMQswCQYDVQQGEwJFVTFD -MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv -bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu -QS4xKTAnBgNVBAMTIENoYW1iZXJzIG9mIENvbW1lcmNlIFJvb3QgLSAyMDA4MB4XDTA4MDgwMTEy -Mjk1MFoXDTM4MDczMTEyMjk1MFowga4xCzAJBgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNl -ZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNhbWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQF -EwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENhbWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJl -cnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC -AQCvAMtwNyuAWko6bHiUfaN/Gh/2NdW928sNRHI+JrKQUrpjOyhYb6WzbZSm891kDFX29ufyIiKA -XuFixrYp4YFs8r/lfTJqVKAyGVn+H4vXPWCGhSRv4xGzdz4gljUha7MI2XAuZPeEklPWDrCQiorj -h40G072QDuKZoRuGDtqaCrsLYVAGUvGef3bsyw/QHg3PmTA9HMRFEFis1tPo1+XqxQEHd9ZR5gN/ -ikilTWh1uem8nk4ZcfUyS5xtYBkL+8ydddy/Js2Pk3g5eXNeJQ7KXOt3EgfLZEFHcpOrUMPrCXZk -NNI5t3YRCQ12RcSprj1qr7V9ZS+UWBDsXHyvfuK2GNnQm05aSd+pZgvMPMZ4fKecHePOjlO+Bd5g -D2vlGts/4+EhySnB8esHnFIbAURRPHsl18TlUlRdJQfKFiC4reRB7noI/plvg6aRArBsNlVq5331 -lubKgdaX8ZSD6e2wsWsSaR6s+12pxZjptFtYer49okQ6Y1nUCyXeG0+95QGezdIp1Z8XGQpvvwyQ -0wlf2eOKNcx5Wk0ZN5K3xMGtr/R5JJqyAQuxr1yW84Ay+1w9mPGgP0revq+ULtlVmhduYJ1jbLhj -ya6BXBg14JC7vjxPNyK5fuvPnnchpj04gftI2jE9K+OJ9dC1vX7gUMQSibMjmhAxhduub+84Mxh2 -EQIDAQABo4IBbDCCAWgwEgYDVR0TAQH/BAgwBgEB/wIBDDAdBgNVHQ4EFgQU+SSsD7K1+HnA+mCI -G8TZTQKeFxkwgeMGA1UdIwSB2zCB2IAU+SSsD7K1+HnA+mCIG8TZTQKeFxmhgbSkgbEwga4xCzAJ -BgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNlZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNh -bWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQFEwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENh -bWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJlcnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDiC -CQCj2kJ+pLGu2jAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUH -AgEWHGh0dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAJASryI1 -wqM58C7e6bXpeHxIvj99RZJe6dqxGfwWPJ+0W2aeaufDuV2I6A+tzyMP3iU6XsxPpcG1Lawk0lgH -3qLPaYRgM+gQDROpI9CF5Y57pp49chNyM/WqfcZjHwj0/gF/JM8rLFQJ3uIrbZLGOU8W6jx+ekbU -RWpGqOt1glanq6B8aBMz9p0w8G8nOSQjKpD9kCk18pPfNKXG9/jvjA9iSnyu0/VU+I22mlaHFoI6 -M6taIgj3grrqLuBHmrS1RaMFO9ncLkVAO+rcf+g769HsJtg1pDDFOqxXnrN2pSB7+R5KBWIBpih1 -YJeSDW4+TTdDDZIVnBgizVGZoCkaPF+KMjNbMMeJL0eYD6MDxvbxrN8y8NmBGuScvfaAFPDRLLmF -9dijscilIeUcE5fuDr3fKanvNFNb0+RqE4QGtjICxFKuItLcsiFCGtpA8CnJ7AoMXOLQusxI0zcK -zBIKinmwPQN/aUv0NCB9szTqjktk9T79syNnFQ0EuPAtwQlRPLJsFfClI9eDdOTlLsn+mCdCxqvG -nrDQWzilm1DefhiYtUU79nm06PcaewaD+9CL2rvHvRirCG88gGtAPxkZumWK5r7VXNM21+9AUiRg -OGcEMeyP84LG3rlV8zsxkVrctQgVrXYlCg17LofiDKYGvCYQbTed7N14jHyAxfDZd0jQ ------END CERTIFICATE----- - -Global Chambersign Root - 2008 -============================== ------BEGIN CERTIFICATE----- -MIIHSTCCBTGgAwIBAgIJAMnN0+nVfSPOMA0GCSqGSIb3DQEBBQUAMIGsMQswCQYDVQQGEwJFVTFD -MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv -bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu -QS4xJzAlBgNVBAMTHkdsb2JhbCBDaGFtYmVyc2lnbiBSb290IC0gMjAwODAeFw0wODA4MDExMjMx -NDBaFw0zODA3MzExMjMxNDBaMIGsMQswCQYDVQQGEwJFVTFDMEEGA1UEBxM6TWFkcmlkIChzZWUg -Y3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNvbS9hZGRyZXNzKTESMBAGA1UEBRMJ -QTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMuQS4xJzAlBgNVBAMTHkdsb2JhbCBD -aGFtYmVyc2lnbiBSb290IC0gMjAwODCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMDf -VtPkOpt2RbQT2//BthmLN0EYlVJH6xedKYiONWwGMi5HYvNJBL99RDaxccy9Wglz1dmFRP+RVyXf -XjaOcNFccUMd2drvXNL7G706tcuto8xEpw2uIRU/uXpbknXYpBI4iRmKt4DS4jJvVpyR1ogQC7N0 -ZJJ0YPP2zxhPYLIj0Mc7zmFLmY/CDNBAspjcDahOo7kKrmCgrUVSY7pmvWjg+b4aqIG7HkF4ddPB -/gBVsIdU6CeQNR1MM62X/JcumIS/LMmjv9GYERTtY/jKmIhYF5ntRQOXfjyGHoiMvvKRhI9lNNgA -TH23MRdaKXoKGCQwoze1eqkBfSbW+Q6OWfH9GzO1KTsXO0G2Id3UwD2ln58fQ1DJu7xsepeY7s2M -H/ucUa6LcL0nn3HAa6x9kGbo1106DbDVwo3VyJ2dwW3Q0L9R5OP4wzg2rtandeavhENdk5IMagfe -Ox2YItaswTXbo6Al/3K1dh3ebeksZixShNBFks4c5eUzHdwHU1SjqoI7mjcv3N2gZOnm3b2u/GSF -HTynyQbehP9r6GsaPMWis0L7iwk+XwhSx2LE1AVxv8Rk5Pihg+g+EpuoHtQ2TS9x9o0o9oOpE9Jh -wZG7SMA0j0GMS0zbaRL/UJScIINZc+18ofLx/d33SdNDWKBWY8o9PeU1VlnpDsogzCtLkykPAgMB -AAGjggFqMIIBZjASBgNVHRMBAf8ECDAGAQH/AgEMMB0GA1UdDgQWBBS5CcqcHtvTbDprru1U8VuT -BjUuXjCB4QYDVR0jBIHZMIHWgBS5CcqcHtvTbDprru1U8VuTBjUuXqGBsqSBrzCBrDELMAkGA1UE -BhMCRVUxQzBBBgNVBAcTOk1hZHJpZCAoc2VlIGN1cnJlbnQgYWRkcmVzcyBhdCB3d3cuY2FtZXJm -aXJtYS5jb20vYWRkcmVzcykxEjAQBgNVBAUTCUE4Mjc0MzI4NzEbMBkGA1UEChMSQUMgQ2FtZXJm -aXJtYSBTLkEuMScwJQYDVQQDEx5HbG9iYWwgQ2hhbWJlcnNpZ24gUm9vdCAtIDIwMDiCCQDJzdPp -1X0jzjAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUHAgEWHGh0 -dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAICIf3DekijZBZRG -/5BXqfEv3xoNa/p8DhxJJHkn2EaqbylZUohwEurdPfWbU1Rv4WCiqAm57OtZfMY18dwY6fFn5a+6 -ReAJ3spED8IXDneRRXozX1+WLGiLwUePmJs9wOzL9dWCkoQ10b42OFZyMVtHLaoXpGNR6woBrX/s -dZ7LoR/xfxKxueRkf2fWIyr0uDldmOghp+G9PUIadJpwr2hsUF1Jz//7Dl3mLEfXgTpZALVza2Mg -9jFFCDkO9HB+QHBaP9BrQql0PSgvAm11cpUJjUhjxsYjV5KTXjXBjfkK9yydYhz2rXzdpjEetrHH -foUm+qRqtdpjMNHvkzeyZi99Bffnt0uYlDXA2TopwZ2yUDMdSqlapskD7+3056huirRXhOukP9Du -qqqHW2Pok+JrqNS4cnhrG+055F3Lm6qH1U9OAP7Zap88MQ8oAgF9mOinsKJknnn4SPIVqczmyETr -P3iZ8ntxPjzxmKfFGBI/5rsoM0LpRQp8bfKGeS/Fghl9CYl8slR2iK7ewfPM4W7bMdaTrpmg7yVq -c5iJWzouE4gev8CSlDQb4ye3ix5vQv/n6TebUB0tovkC7stYWDpxvGjjqsGvHCgfotwjZT+B6q6Z -09gwzxMNTxXJhLynSC34MCN32EZLeW32jO06f2ARePTpm67VVMB0gNELQp/B ------END CERTIFICATE----- - -Go Daddy Root Certificate Authority - G2 -======================================== ------BEGIN CERTIFICATE----- -MIIDxTCCAq2gAwIBAgIBADANBgkqhkiG9w0BAQsFADCBgzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT -B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoTEUdvRGFkZHkuY29tLCBJbmMu -MTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5 -MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgYMxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6 -b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMRowGAYDVQQKExFHb0RhZGR5LmNvbSwgSW5jLjExMC8G -A1UEAxMoR28gRGFkZHkgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZI -hvcNAQEBBQADggEPADCCAQoCggEBAL9xYgjx+lk09xvJGKP3gElY6SKDE6bFIEMBO4Tx5oVJnyfq -9oQbTqC023CYxzIBsQU+B07u9PpPL1kwIuerGVZr4oAH/PMWdYA5UXvl+TW2dE6pjYIT5LY/qQOD -+qK+ihVqf94Lw7YZFAXK6sOoBJQ7RnwyDfMAZiLIjWltNowRGLfTshxgtDj6AozO091GB94KPutd -fMh8+7ArU6SSYmlRJQVhGkSBjCypQ5Yj36w6gZoOKcUcqeldHraenjAKOc7xiID7S13MMuyFYkMl -NAJWJwGRtDtwKj9useiciAF9n9T521NtYJ2/LOdYq7hfRvzOxBsDPAnrSTFcaUaz4EcCAwEAAaNC -MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFDqahQcQZyi27/a9 -BUFuIMGU2g/eMA0GCSqGSIb3DQEBCwUAA4IBAQCZ21151fmXWWcDYfF+OwYxdS2hII5PZYe096ac -vNjpL9DbWu7PdIxztDhC2gV7+AJ1uP2lsdeu9tfeE8tTEH6KRtGX+rcuKxGrkLAngPnon1rpN5+r -5N9ss4UXnT3ZJE95kTXWXwTrgIOrmgIttRD02JDHBHNA7XIloKmf7J6raBKZV8aPEjoJpL1E/QYV -N8Gb5DKj7Tjo2GTzLH4U/ALqn83/B2gX2yKQOC16jdFU8WnjXzPKej17CuPKf1855eJ1usV2GDPO -LPAvTK33sefOT6jEm0pUBsV/fdUID+Ic/n4XuKxe9tQWskMJDE32p2u0mYRlynqI4uJEvlz36hz1 ------END CERTIFICATE----- - -Starfield Root Certificate Authority - G2 -========================================= ------BEGIN CERTIFICATE----- -MIID3TCCAsWgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT -B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s -b2dpZXMsIEluYy4xMjAwBgNVBAMTKVN0YXJmaWVsZCBSb290IENlcnRpZmljYXRlIEF1dGhvcml0 -eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgY8xCzAJBgNVBAYTAlVTMRAw -DgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFyZmllbGQg -VGVjaG5vbG9naWVzLCBJbmMuMTIwMAYDVQQDEylTdGFyZmllbGQgUm9vdCBDZXJ0aWZpY2F0ZSBB -dXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL3twQP89o/8ArFv -W59I2Z154qK3A2FWGMNHttfKPTUuiUP3oWmb3ooa/RMgnLRJdzIpVv257IzdIvpy3Cdhl+72WoTs -bhm5iSzchFvVdPtrX8WJpRBSiUZV9Lh1HOZ/5FSuS/hVclcCGfgXcVnrHigHdMWdSL5stPSksPNk -N3mSwOxGXn/hbVNMYq/NHwtjuzqd+/x5AJhhdM8mgkBj87JyahkNmcrUDnXMN/uLicFZ8WJ/X7Nf -ZTD4p7dNdloedl40wOiWVpmKs/B/pM293DIxfJHP4F8R+GuqSVzRmZTRouNjWwl2tVZi4Ut0HZbU -JtQIBFnQmA4O5t78w+wfkPECAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC -AQYwHQYDVR0OBBYEFHwMMh+n2TB/xH1oo2Kooc6rB1snMA0GCSqGSIb3DQEBCwUAA4IBAQARWfol -TwNvlJk7mh+ChTnUdgWUXuEok21iXQnCoKjUsHU48TRqneSfioYmUeYs0cYtbpUgSpIB7LiKZ3sx -4mcujJUDJi5DnUox9g61DLu34jd/IroAow57UvtruzvE03lRTs2Q9GcHGcg8RnoNAX3FWOdt5oUw -F5okxBDgBPfg8n/Uqgr/Qh037ZTlZFkSIHc40zI+OIF1lnP6aI+xy84fxez6nH7PfrHxBy22/L/K -pL/QlwVKvOoYKAKQvVR4CSFx09F9HdkWsKlhPdAKACL8x3vLCWRFCztAgfd9fDL1mMpYjn0q7pBZ -c2T5NnReJaH1ZgUufzkVqSr7UIuOhWn0 ------END CERTIFICATE----- - -Starfield Services Root Certificate Authority - G2 -================================================== ------BEGIN CERTIFICATE----- -MIID7zCCAtegAwIBAgIBADANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UEBhMCVVMxEDAOBgNVBAgT -B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s -b2dpZXMsIEluYy4xOzA5BgNVBAMTMlN0YXJmaWVsZCBTZXJ2aWNlcyBSb290IENlcnRpZmljYXRl -IEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgZgxCzAJBgNV -BAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxT -dGFyZmllbGQgVGVjaG5vbG9naWVzLCBJbmMuMTswOQYDVQQDEzJTdGFyZmllbGQgU2VydmljZXMg -Um9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC -AQoCggEBANUMOsQq+U7i9b4Zl1+OiFOxHz/Lz58gE20pOsgPfTz3a3Y4Y9k2YKibXlwAgLIvWX/2 -h/klQ4bnaRtSmpDhcePYLQ1Ob/bISdm28xpWriu2dBTrz/sm4xq6HZYuajtYlIlHVv8loJNwU4Pa -hHQUw2eeBGg6345AWh1KTs9DkTvnVtYAcMtS7nt9rjrnvDH5RfbCYM8TWQIrgMw0R9+53pBlbQLP -LJGmpufehRhJfGZOozptqbXuNC66DQO4M99H67FrjSXZm86B0UVGMpZwh94CDklDhbZsc7tk6mFB -rMnUVN+HL8cisibMn1lUaJ/8viovxFUcdUBgF4UCVTmLfwUCAwEAAaNCMEAwDwYDVR0TAQH/BAUw -AwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJxfAN+qAdcwKziIorhtSpzyEZGDMA0GCSqG -SIb3DQEBCwUAA4IBAQBLNqaEd2ndOxmfZyMIbw5hyf2E3F/YNoHN2BtBLZ9g3ccaaNnRbobhiCPP -E95Dz+I0swSdHynVv/heyNXBve6SbzJ08pGCL72CQnqtKrcgfU28elUSwhXqvfdqlS5sdJ/PHLTy -xQGjhdByPq1zqwubdQxtRbeOlKyWN7Wg0I8VRw7j6IPdj/3vQQF3zCepYoUz8jcI73HPdwbeyBkd -iEDPfUYd/x7H4c7/I9vG+o1VTqkC50cRRj70/b17KSa7qWFiNyi2LSr2EIZkyXCn0q23KXB56jza -YyWf/Wi3MOxw+3WKt21gZ7IeyLnp2KhvAotnDU0mV3HaIPzBSlCNsSi6 ------END CERTIFICATE----- - -AffirmTrust Commercial -====================== ------BEGIN CERTIFICATE----- -MIIDTDCCAjSgAwIBAgIId3cGJyapsXwwDQYJKoZIhvcNAQELBQAwRDELMAkGA1UEBhMCVVMxFDAS -BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMB4XDTEw -MDEyOTE0MDYwNloXDTMwMTIzMTE0MDYwNlowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly -bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMIIBIjANBgkqhkiG9w0BAQEF -AAOCAQ8AMIIBCgKCAQEA9htPZwcroRX1BiLLHwGy43NFBkRJLLtJJRTWzsO3qyxPxkEylFf6Eqdb -DuKPHx6GGaeqtS25Xw2Kwq+FNXkyLbscYjfysVtKPcrNcV/pQr6U6Mje+SJIZMblq8Yrba0F8PrV -C8+a5fBQpIs7R6UjW3p6+DM/uO+Zl+MgwdYoic+U+7lF7eNAFxHUdPALMeIrJmqbTFeurCA+ukV6 -BfO9m2kVrn1OIGPENXY6BwLJN/3HR+7o8XYdcxXyl6S1yHp52UKqK39c/s4mT6NmgTWvRLpUHhww -MmWd5jyTXlBOeuM61G7MGvv50jeuJCqrVwMiKA1JdX+3KNp1v47j3A55MQIDAQABo0IwQDAdBgNV -HQ4EFgQUnZPGU4teyq8/nx4P5ZmVvCT2lI8wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC -AQYwDQYJKoZIhvcNAQELBQADggEBAFis9AQOzcAN/wr91LoWXym9e2iZWEnStB03TX8nfUYGXUPG -hi4+c7ImfU+TqbbEKpqrIZcUsd6M06uJFdhrJNTxFq7YpFzUf1GO7RgBsZNjvbz4YYCanrHOQnDi -qX0GJX0nof5v7LMeJNrjS1UaADs1tDvZ110w/YETifLCBivtZ8SOyUOyXGsViQK8YvxO8rUzqrJv -0wqiUOP2O+guRMLbZjipM1ZI8W0bM40NjD9gN53Tym1+NH4Nn3J2ixufcv1SNUFFApYvHLKac0kh -sUlHRUe072o0EclNmsxZt9YCnlpOZbWUrhvfKbAW8b8Angc6F2S1BLUjIZkKlTuXfO8= ------END CERTIFICATE----- - -AffirmTrust Networking -====================== ------BEGIN CERTIFICATE----- -MIIDTDCCAjSgAwIBAgIIfE8EORzUmS0wDQYJKoZIhvcNAQEFBQAwRDELMAkGA1UEBhMCVVMxFDAS -BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMB4XDTEw -MDEyOTE0MDgyNFoXDTMwMTIzMTE0MDgyNFowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly -bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMIIBIjANBgkqhkiG9w0BAQEF -AAOCAQ8AMIIBCgKCAQEAtITMMxcua5Rsa2FSoOujz3mUTOWUgJnLVWREZY9nZOIG41w3SfYvm4SE -Hi3yYJ0wTsyEheIszx6e/jarM3c1RNg1lho9Nuh6DtjVR6FqaYvZ/Ls6rnla1fTWcbuakCNrmreI -dIcMHl+5ni36q1Mr3Lt2PpNMCAiMHqIjHNRqrSK6mQEubWXLviRmVSRLQESxG9fhwoXA3hA/Pe24 -/PHxI1Pcv2WXb9n5QHGNfb2V1M6+oF4nI979ptAmDgAp6zxG8D1gvz9Q0twmQVGeFDdCBKNwV6gb -h+0t+nvujArjqWaJGctB+d1ENmHP4ndGyH329JKBNv3bNPFyfvMMFr20FQIDAQABo0IwQDAdBgNV -HQ4EFgQUBx/S55zawm6iQLSwelAQUHTEyL0wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC -AQYwDQYJKoZIhvcNAQEFBQADggEBAIlXshZ6qML91tmbmzTCnLQyFE2npN/svqe++EPbkTfOtDIu -UFUaNU52Q3Eg75N3ThVwLofDwR1t3Mu1J9QsVtFSUzpE0nPIxBsFZVpikpzuQY0x2+c06lkh1QF6 -12S4ZDnNye2v7UsDSKegmQGA3GWjNq5lWUhPgkvIZfFXHeVZLgo/bNjR9eUJtGxUAArgFU2HdW23 -WJZa3W3SAKD0m0i+wzekujbgfIeFlxoVot4uolu9rxj5kFDNcFn4J2dHy8egBzp90SxdbBk6ZrV9 -/ZFvgrG+CJPbFEfxojfHRZ48x3evZKiT3/Zpg4Jg8klCNO1aAFSFHBY2kgxc+qatv9s= ------END CERTIFICATE----- - -AffirmTrust Premium -=================== ------BEGIN CERTIFICATE----- -MIIFRjCCAy6gAwIBAgIIbYwURrGmCu4wDQYJKoZIhvcNAQEMBQAwQTELMAkGA1UEBhMCVVMxFDAS -BgNVBAoMC0FmZmlybVRydXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMB4XDTEwMDEy -OTE0MTAzNloXDTQwMTIzMTE0MTAzNlowQTELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRy -dXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A -MIICCgKCAgEAxBLfqV/+Qd3d9Z+K4/as4Tx4mrzY8H96oDMq3I0gW64tb+eT2TZwamjPjlGjhVtn -BKAQJG9dKILBl1fYSCkTtuG+kU3fhQxTGJoeJKJPj/CihQvL9Cl/0qRY7iZNyaqoe5rZ+jjeRFcV -5fiMyNlI4g0WJx0eyIOFJbe6qlVBzAMiSy2RjYvmia9mx+n/K+k8rNrSs8PhaJyJ+HoAVt70VZVs -+7pk3WKL3wt3MutizCaam7uqYoNMtAZ6MMgpv+0GTZe5HMQxK9VfvFMSF5yZVylmd2EhMQcuJUmd -GPLu8ytxjLW6OQdJd/zvLpKQBY0tL3d770O/Nbua2Plzpyzy0FfuKE4mX4+QaAkvuPjcBukumj5R -p9EixAqnOEhss/n/fauGV+O61oV4d7pD6kh/9ti+I20ev9E2bFhc8e6kGVQa9QPSdubhjL08s9NI -S+LI+H+SqHZGnEJlPqQewQcDWkYtuJfzt9WyVSHvutxMAJf7FJUnM7/oQ0dG0giZFmA7mn7S5u04 -6uwBHjxIVkkJx0w3AJ6IDsBz4W9m6XJHMD4Q5QsDyZpCAGzFlH5hxIrff4IaC1nEWTJ3s7xgaVY5 -/bQGeyzWZDbZvUjthB9+pSKPKrhC9IK31FOQeE4tGv2Bb0TXOwF0lkLgAOIua+rF7nKsu7/+6qqo -+Nz2snmKtmcCAwEAAaNCMEAwHQYDVR0OBBYEFJ3AZ6YMItkm9UWrpmVSESfYRaxjMA8GA1UdEwEB -/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBDAUAA4ICAQCzV00QYk465KzquByv -MiPIs0laUZx2KI15qldGF9X1Uva3ROgIRL8YhNILgM3FEv0AVQVhh0HctSSePMTYyPtwni94loMg -Nt58D2kTiKV1NpgIpsbfrM7jWNa3Pt668+s0QNiigfV4Py/VpfzZotReBA4Xrf5B8OWycvpEgjNC -6C1Y91aMYj+6QrCcDFx+LmUmXFNPALJ4fqENmS2NuB2OosSw/WDQMKSOyARiqcTtNd56l+0OOF6S -L5Nwpamcb6d9Ex1+xghIsV5n61EIJenmJWtSKZGc0jlzCFfemQa0W50QBuHCAKi4HEoCChTQwUHK -+4w1IX2COPKpVJEZNZOUbWo6xbLQu4mGk+ibyQ86p3q4ofB4Rvr8Ny/lioTz3/4E2aFooC8k4gmV -BtWVyuEklut89pMFu+1z6S3RdTnX5yTb2E5fQ4+e0BQ5v1VwSJlXMbSc7kqYA5YwH2AG7hsj/oFg -IxpHYoWlzBk0gG+zrBrjn/B7SK3VAdlntqlyk+otZrWyuOQ9PLLvTIzq6we/qzWaVYa8GKa1qF60 -g2xraUDTn9zxw2lrueFtCfTxqlB2Cnp9ehehVZZCmTEJ3WARjQUwfuaORtGdFNrHF+QFlozEJLUb -zxQHskD4o55BhrwE0GuWyCqANP2/7waj3VjFhT0+j/6eKeC2uAloGRwYQw== ------END CERTIFICATE----- - -AffirmTrust Premium ECC -======================= ------BEGIN CERTIFICATE----- -MIIB/jCCAYWgAwIBAgIIdJclisc/elQwCgYIKoZIzj0EAwMwRTELMAkGA1UEBhMCVVMxFDASBgNV -BAoMC0FmZmlybVRydXN0MSAwHgYDVQQDDBdBZmZpcm1UcnVzdCBQcmVtaXVtIEVDQzAeFw0xMDAx -MjkxNDIwMjRaFw00MDEyMzExNDIwMjRaMEUxCzAJBgNVBAYTAlVTMRQwEgYDVQQKDAtBZmZpcm1U -cnVzdDEgMB4GA1UEAwwXQWZmaXJtVHJ1c3QgUHJlbWl1bSBFQ0MwdjAQBgcqhkjOPQIBBgUrgQQA -IgNiAAQNMF4bFZ0D0KF5Nbc6PJJ6yhUczWLznCZcBz3lVPqj1swS6vQUX+iOGasvLkjmrBhDeKzQ -N8O9ss0s5kfiGuZjuD0uL3jET9v0D6RoTFVya5UdThhClXjMNzyR4ptlKymjQjBAMB0GA1UdDgQW -BBSaryl6wBE1NSZRMADDav5A1a7WPDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAK -BggqhkjOPQQDAwNnADBkAjAXCfOHiFBar8jAQr9HX/VsaobgxCd05DhT1wV/GzTjxi+zygk8N53X -57hG8f2h4nECMEJZh0PUUd+60wkyWs6Iflc9nF9Ca/UHLbXwgpP5WW+uZPpY5Yse42O+tYHNbwKM -eQ== ------END CERTIFICATE----- - -Certum Trusted Network CA -========================= ------BEGIN CERTIFICATE----- -MIIDuzCCAqOgAwIBAgIDBETAMA0GCSqGSIb3DQEBBQUAMH4xCzAJBgNVBAYTAlBMMSIwIAYDVQQK -ExlVbml6ZXRvIFRlY2hub2xvZ2llcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlv -biBBdXRob3JpdHkxIjAgBgNVBAMTGUNlcnR1bSBUcnVzdGVkIE5ldHdvcmsgQ0EwHhcNMDgxMDIy -MTIwNzM3WhcNMjkxMjMxMTIwNzM3WjB+MQswCQYDVQQGEwJQTDEiMCAGA1UEChMZVW5pemV0byBU -ZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENlcnRpZmljYXRpb24gQXV0aG9yaXR5 -MSIwIAYDVQQDExlDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENBMIIBIjANBgkqhkiG9w0BAQEFAAOC -AQ8AMIIBCgKCAQEA4/t9o3K6wvDJFIf1awFO4W5AB7ptJ11/91sts1rHUV+rpDKmYYe2bg+G0jAC -l/jXaVehGDldamR5xgFZrDwxSjh80gTSSyjoIF87B6LMTXPb865Px1bVWqeWifrzq2jUI4ZZJ88J -J7ysbnKDHDBy3+Ci6dLhdHUZvSqeexVUBBvXQzmtVSjF4hq79MDkrjhJM8x2hZ85RdKknvISjFH4 -fOQtf/WsX+sWn7Et0brMkUJ3TCXJkDhv2/DM+44el1k+1WBO5gUo7Ul5E0u6SNsv+XLTOcr+H9g0 -cvW0QM8xAcPs3hEtF10fuFDRXhmnad4HMyjKUJX5p1TLVIZQRan5SQIDAQABo0IwQDAPBgNVHRMB -Af8EBTADAQH/MB0GA1UdDgQWBBQIds3LB/8k9sXN7buQvOKEN0Z19zAOBgNVHQ8BAf8EBAMCAQYw -DQYJKoZIhvcNAQEFBQADggEBAKaorSLOAT2mo/9i0Eidi15ysHhE49wcrwn9I0j6vSrEuVUEtRCj -jSfeC4Jj0O7eDDd5QVsisrCaQVymcODU0HfLI9MA4GxWL+FpDQ3Zqr8hgVDZBqWo/5U30Kr+4rP1 -mS1FhIrlQgnXdAIv94nYmem8J9RHjboNRhx3zxSkHLmkMcScKHQDNP8zGSal6Q10tz6XxnboJ5aj -Zt3hrvJBW8qYVoNzcOSGGtIxQbovvi0TWnZvTuhOgQ4/WwMioBK+ZlgRSssDxLQqKi2WF+A5VLxI -03YnnZotBqbJ7DnSq9ufmgsnAjUpsUCV5/nonFWIGUbWtzT1fs45mtk48VH3Tyw= ------END CERTIFICATE----- - -Certinomis - Autorité Racine -============================= ------BEGIN CERTIFICATE----- -MIIFnDCCA4SgAwIBAgIBATANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJGUjETMBEGA1UEChMK -Q2VydGlub21pczEXMBUGA1UECxMOMDAwMiA0MzM5OTg5MDMxJjAkBgNVBAMMHUNlcnRpbm9taXMg -LSBBdXRvcml0w6kgUmFjaW5lMB4XDTA4MDkxNzA4Mjg1OVoXDTI4MDkxNzA4Mjg1OVowYzELMAkG -A1UEBhMCRlIxEzARBgNVBAoTCkNlcnRpbm9taXMxFzAVBgNVBAsTDjAwMDIgNDMzOTk4OTAzMSYw -JAYDVQQDDB1DZXJ0aW5vbWlzIC0gQXV0b3JpdMOpIFJhY2luZTCCAiIwDQYJKoZIhvcNAQEBBQAD -ggIPADCCAgoCggIBAJ2Fn4bT46/HsmtuM+Cet0I0VZ35gb5j2CN2DpdUzZlMGvE5x4jYF1AMnmHa -wE5V3udauHpOd4cN5bjr+p5eex7Ezyh0x5P1FMYiKAT5kcOrJ3NqDi5N8y4oH3DfVS9O7cdxbwly -Lu3VMpfQ8Vh30WC8Tl7bmoT2R2FFK/ZQpn9qcSdIhDWerP5pqZ56XjUl+rSnSTV3lqc2W+HN3yNw -2F1MpQiD8aYkOBOo7C+ooWfHpi2GR+6K/OybDnT0K0kCe5B1jPyZOQE51kqJ5Z52qz6WKDgmi92N -jMD2AR5vpTESOH2VwnHu7XSu5DaiQ3XV8QCb4uTXzEIDS3h65X27uK4uIJPT5GHfceF2Z5c/tt9q -c1pkIuVC28+BA5PY9OMQ4HL2AHCs8MF6DwV/zzRpRbWT5BnbUhYjBYkOjUjkJW+zeL9i9Qf6lSTC -lrLooyPCXQP8w9PlfMl1I9f09bze5N/NgL+RiH2nE7Q5uiy6vdFrzPOlKO1Enn1So2+WLhl+HPNb -xxaOu2B9d2ZHVIIAEWBsMsGoOBvrbpgT1u449fCfDu/+MYHB0iSVL1N6aaLwD4ZFjliCK0wi1F6g -530mJ0jfJUaNSih8hp75mxpZuWW/Bd22Ql095gBIgl4g9xGC3srYn+Y3RyYe63j3YcNBZFgCQfna -4NH4+ej9Uji29YnfAgMBAAGjWzBZMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0G -A1UdDgQWBBQNjLZh2kS40RR9w759XkjwzspqsDAXBgNVHSAEEDAOMAwGCiqBegFWAgIAAQEwDQYJ -KoZIhvcNAQEFBQADggIBACQ+YAZ+He86PtvqrxyaLAEL9MW12Ukx9F1BjYkMTv9sov3/4gbIOZ/x -WqndIlgVqIrTseYyCYIDbNc/CMf4uboAbbnW/FIyXaR/pDGUu7ZMOH8oMDX/nyNTt7buFHAAQCva -R6s0fl6nVjBhK4tDrP22iCj1a7Y+YEq6QpA0Z43q619FVDsXrIvkxmUP7tCMXWY5zjKn2BCXwH40 -nJ+U8/aGH88bc62UeYdocMMzpXDn2NU4lG9jeeu/Cg4I58UvD0KgKxRA/yHgBcUn4YQRE7rWhh1B -CxMjidPJC+iKunqjo3M3NYB9Ergzd0A4wPpeMNLytqOx1qKVl4GbUu1pTP+A5FPbVFsDbVRfsbjv -JL1vnxHDx2TCDyhihWZeGnuyt++uNckZM6i4J9szVb9o4XVIRFb7zdNIu0eJOqxp9YDG5ERQL1TE -qkPFMTFYvZbF6nVsmnWxTfj3l/+WFvKXTej28xH5On2KOG4Ey+HTRRWqpdEdnV1j6CTmNhTih60b -WfVEm/vXd3wfAXBioSAaosUaKPQhA+4u2cGA6rnZgtZbdsLLO7XSAPCjDuGtbkD326C00EauFddE -wk01+dIL8hf2rGbVJLJP0RyZwG71fet0BLj5TXcJ17TPBzAJ8bgAVtkXFhYKK4bfjwEZGuW7gmP/ -vgt2Fl43N+bYdJeimUV5 ------END CERTIFICATE----- - -Root CA Generalitat Valenciana -============================== ------BEGIN CERTIFICATE----- -MIIGizCCBXOgAwIBAgIEO0XlaDANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJFUzEfMB0GA1UE -ChMWR2VuZXJhbGl0YXQgVmFsZW5jaWFuYTEPMA0GA1UECxMGUEtJR1ZBMScwJQYDVQQDEx5Sb290 -IENBIEdlbmVyYWxpdGF0IFZhbGVuY2lhbmEwHhcNMDEwNzA2MTYyMjQ3WhcNMjEwNzAxMTUyMjQ3 -WjBoMQswCQYDVQQGEwJFUzEfMB0GA1UEChMWR2VuZXJhbGl0YXQgVmFsZW5jaWFuYTEPMA0GA1UE -CxMGUEtJR1ZBMScwJQYDVQQDEx5Sb290IENBIEdlbmVyYWxpdGF0IFZhbGVuY2lhbmEwggEiMA0G -CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDGKqtXETcvIorKA3Qdyu0togu8M1JAJke+WmmmO3I2 -F0zo37i7L3bhQEZ0ZQKQUgi0/6iMweDHiVYQOTPvaLRfX9ptI6GJXiKjSgbwJ/BXufjpTjJ3Cj9B -ZPPrZe52/lSqfR0grvPXdMIKX/UIKFIIzFVd0g/bmoGlu6GzwZTNVOAydTGRGmKy3nXiz0+J2ZGQ -D0EbtFpKd71ng+CT516nDOeB0/RSrFOyA8dEJvt55cs0YFAQexvba9dHq198aMpunUEDEO5rmXte -JajCq+TA81yc477OMUxkHl6AovWDfgzWyoxVjr7gvkkHD6MkQXpYHYTqWBLI4bft75PelAgxAgMB -AAGjggM7MIIDNzAyBggrBgEFBQcBAQQmMCQwIgYIKwYBBQUHMAGGFmh0dHA6Ly9vY3NwLnBraS5n -dmEuZXMwEgYDVR0TAQH/BAgwBgEB/wIBAjCCAjQGA1UdIASCAiswggInMIICIwYKKwYBBAG/VQIB -ADCCAhMwggHoBggrBgEFBQcCAjCCAdoeggHWAEEAdQB0AG8AcgBpAGQAYQBkACAAZABlACAAQwBl -AHIAdABpAGYAaQBjAGEAYwBpAPMAbgAgAFIAYQDtAHoAIABkAGUAIABsAGEAIABHAGUAbgBlAHIA -YQBsAGkAdABhAHQAIABWAGEAbABlAG4AYwBpAGEAbgBhAC4ADQAKAEwAYQAgAEQAZQBjAGwAYQBy -AGEAYwBpAPMAbgAgAGQAZQAgAFAAcgDhAGMAdABpAGMAYQBzACAAZABlACAAQwBlAHIAdABpAGYA -aQBjAGEAYwBpAPMAbgAgAHEAdQBlACAAcgBpAGcAZQAgAGUAbAAgAGYAdQBuAGMAaQBvAG4AYQBt -AGkAZQBuAHQAbwAgAGQAZQAgAGwAYQAgAHAAcgBlAHMAZQBuAHQAZQAgAEEAdQB0AG8AcgBpAGQA -YQBkACAAZABlACAAQwBlAHIAdABpAGYAaQBjAGEAYwBpAPMAbgAgAHMAZQAgAGUAbgBjAHUAZQBu -AHQAcgBhACAAZQBuACAAbABhACAAZABpAHIAZQBjAGMAaQDzAG4AIAB3AGUAYgAgAGgAdAB0AHAA -OgAvAC8AdwB3AHcALgBwAGsAaQAuAGcAdgBhAC4AZQBzAC8AYwBwAHMwJQYIKwYBBQUHAgEWGWh0 -dHA6Ly93d3cucGtpLmd2YS5lcy9jcHMwHQYDVR0OBBYEFHs100DSHHgZZu90ECjcPk+yeAT8MIGV -BgNVHSMEgY0wgYqAFHs100DSHHgZZu90ECjcPk+yeAT8oWykajBoMQswCQYDVQQGEwJFUzEfMB0G -A1UEChMWR2VuZXJhbGl0YXQgVmFsZW5jaWFuYTEPMA0GA1UECxMGUEtJR1ZBMScwJQYDVQQDEx5S -b290IENBIEdlbmVyYWxpdGF0IFZhbGVuY2lhbmGCBDtF5WgwDQYJKoZIhvcNAQEFBQADggEBACRh -TvW1yEICKrNcda3FbcrnlD+laJWIwVTAEGmiEi8YPyVQqHxK6sYJ2fR1xkDar1CdPaUWu20xxsdz -Ckj+IHLtb8zog2EWRpABlUt9jppSCS/2bxzkoXHPjCpaF3ODR00PNvsETUlR4hTJZGH71BTg9J63 -NI8KJr2XXPR5OkowGcytT6CYirQxlyric21+eLj4iIlPsSKRZEv1UN4D2+XFducTZnV+ZfsBn5OH -iJ35Rld8TWCvmHMTI6QgkYH60GFmuH3Rr9ZvHmw96RH9qfmCIoaZM3Fa6hlXPZHNqcCjbgcTpsnt -+GijnsNacgmHKNHEc8RzGF9QdRYxn7fofMM= ------END CERTIFICATE----- - -A-Trust-nQual-03 -================ ------BEGIN CERTIFICATE----- -MIIDzzCCAregAwIBAgIDAWweMA0GCSqGSIb3DQEBBQUAMIGNMQswCQYDVQQGEwJBVDFIMEYGA1UE -Cgw/QS1UcnVzdCBHZXMuIGYuIFNpY2hlcmhlaXRzc3lzdGVtZSBpbSBlbGVrdHIuIERhdGVudmVy -a2VociBHbWJIMRkwFwYDVQQLDBBBLVRydXN0LW5RdWFsLTAzMRkwFwYDVQQDDBBBLVRydXN0LW5R -dWFsLTAzMB4XDTA1MDgxNzIyMDAwMFoXDTE1MDgxNzIyMDAwMFowgY0xCzAJBgNVBAYTAkFUMUgw -RgYDVQQKDD9BLVRydXN0IEdlcy4gZi4gU2ljaGVyaGVpdHNzeXN0ZW1lIGltIGVsZWt0ci4gRGF0 -ZW52ZXJrZWhyIEdtYkgxGTAXBgNVBAsMEEEtVHJ1c3QtblF1YWwtMDMxGTAXBgNVBAMMEEEtVHJ1 -c3QtblF1YWwtMDMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtPWFuA/OQO8BBC4SA -zewqo51ru27CQoT3URThoKgtUaNR8t4j8DRE/5TrzAUjlUC5B3ilJfYKvUWG6Nm9wASOhURh73+n -yfrBJcyFLGM/BWBzSQXgYHiVEEvc+RFZznF/QJuKqiTfC0Li21a8StKlDJu3Qz7dg9MmEALP6iPE -SU7l0+m0iKsMrmKS1GWH2WrX9IWf5DMiJaXlyDO6w8dB3F/GaswADm0yqLaHNgBid5seHzTLkDx4 -iHQF63n1k3Flyp3HaxgtPVxO59X4PzF9j4fsCiIvI+n+u33J4PTs63zEsMMtYrWacdaxaujs2e3V -cuy+VwHOBVWf3tFgiBCzAgMBAAGjNjA0MA8GA1UdEwEB/wQFMAMBAf8wEQYDVR0OBAoECERqlWdV -eRFPMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAVdRU0VlIXLOThaq/Yy/kgM40 -ozRiPvbY7meIMQQDbwvUB/tOdQ/TLtPAF8fGKOwGDREkDg6lXb+MshOWcdzUzg4NCmgybLlBMRmr -sQd7TZjTXLDR8KdCoLXEjq/+8T/0709GAHbrAvv5ndJAlseIOrifEXnzgGWovR/TeIGgUUw3tKZd -JXDRZslo+S4RFGjxVJgIrCaSD96JntT6s3kr0qN51OyLrIdTaEJMUVF0HhsnLuP1Hyl0Te2v9+GS -mYHovjrHF1D2t8b8m7CKa9aIA5GPBnc6hQLdmNVDeD/GMBWsm2vLV7eJUYs66MmEDNuxUCAKGkq6 -ahq97BvIxYSazQ== ------END CERTIFICATE----- - -TWCA Root Certification Authority -================================= ------BEGIN CERTIFICATE----- -MIIDezCCAmOgAwIBAgIBATANBgkqhkiG9w0BAQUFADBfMQswCQYDVQQGEwJUVzESMBAGA1UECgwJ -VEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NBIFJvb3QgQ2VydGlmaWNh -dGlvbiBBdXRob3JpdHkwHhcNMDgwODI4MDcyNDMzWhcNMzAxMjMxMTU1OTU5WjBfMQswCQYDVQQG -EwJUVzESMBAGA1UECgwJVEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NB -IFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK -AoIBAQCwfnK4pAOU5qfeCTiRShFAh6d8WWQUe7UREN3+v9XAu1bihSX0NXIP+FPQQeFEAcK0HMMx -QhZHhTMidrIKbw/lJVBPhYa+v5guEGcevhEFhgWQxFnQfHgQsIBct+HHK3XLfJ+utdGdIzdjp9xC -oi2SBBtQwXu4PhvJVgSLL1KbralW6cH/ralYhzC2gfeXRfwZVzsrb+RH9JlF/h3x+JejiB03HFyP -4HYlmlD4oFT/RJB2I9IyxsOrBr/8+7/zrX2SYgJbKdM1o5OaQ2RgXbL6Mv87BK9NQGr5x+PvI/1r -y+UPizgN7gr8/g+YnzAx3WxSZfmLgb4i4RxYA7qRG4kHAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIB -BjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqOFsmjd6LWvJPelSDGRjjCDWmujANBgkqhkiG -9w0BAQUFAAOCAQEAPNV3PdrfibqHDAhUaiBQkr6wQT25JmSDCi/oQMCXKCeCMErJk/9q56YAf4lC -mtYR5VPOL8zy2gXE/uJQxDqGfczafhAJO5I1KlOy/usrBdlsXebQ79NqZp4VKIV66IIArB6nCWlW -QtNoURi+VJq/REG6Sb4gumlc7rh3zc5sH62Dlhh9DrUUOYTxKOkto557HnpyWoOzeW/vtPzQCqVY -T0bf+215WfKEIlKuD8z7fDvnaspHYcN6+NOSBB+4IIThNlQWx0DeO4pz3N/GCUzf7Nr/1FNCocny -Yh0igzyXxfkZYiesZSLX0zzG5Y6yU8xJzrww/nsOM5D77dIUkR8Hrw== ------END CERTIFICATE----- - -Security Communication RootCA2 -============================== ------BEGIN CERTIFICATE----- -MIIDdzCCAl+gAwIBAgIBADANBgkqhkiG9w0BAQsFADBdMQswCQYDVQQGEwJKUDElMCMGA1UEChMc -U0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEnMCUGA1UECxMeU2VjdXJpdHkgQ29tbXVuaWNh -dGlvbiBSb290Q0EyMB4XDTA5MDUyOTA1MDAzOVoXDTI5MDUyOTA1MDAzOVowXTELMAkGA1UEBhMC -SlAxJTAjBgNVBAoTHFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xJzAlBgNVBAsTHlNlY3Vy -aXR5IENvbW11bmljYXRpb24gUm9vdENBMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB -ANAVOVKxUrO6xVmCxF1SrjpDZYBLx/KWvNs2l9amZIyoXvDjChz335c9S672XewhtUGrzbl+dp++ -+T42NKA7wfYxEUV0kz1XgMX5iZnK5atq1LXaQZAQwdbWQonCv/Q4EpVMVAX3NuRFg3sUZdbcDE3R -3n4MqzvEFb46VqZab3ZpUql6ucjrappdUtAtCms1FgkQhNBqyjoGADdH5H5XTz+L62e4iKrFvlNV -spHEfbmwhRkGeC7bYRr6hfVKkaHnFtWOojnflLhwHyg/i/xAXmODPIMqGplrz95Zajv8bxbXH/1K -EOtOghY6rCcMU/Gt1SSwawNQwS08Ft1ENCcadfsCAwEAAaNCMEAwHQYDVR0OBBYEFAqFqXdlBZh8 -QIH4D5csOPEK7DzPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEB -CwUAA4IBAQBMOqNErLlFsceTfsgLCkLfZOoc7llsCLqJX2rKSpWeeo8HxdpFcoJxDjrSzG+ntKEj -u/Ykn8sX/oymzsLS28yN/HH8AynBbF0zX2S2ZTuJbxh2ePXcokgfGT+Ok+vx+hfuzU7jBBJV1uXk -3fs+BXziHV7Gp7yXT2g69ekuCkO2r1dcYmh8t/2jioSgrGK+KwmHNPBqAbubKVY8/gA3zyNs8U6q -tnRGEmyR7jTV7JqR50S+kDFy1UkC9gLl9B/rfNmWVan/7Ir5mUf/NVoCqgTLiluHcSmRvaS0eg29 -mvVXIwAHIRc/SjnRBUkLp7Y3gaVdjKozXoEofKd9J+sAro03 ------END CERTIFICATE----- - -EC-ACC -====== ------BEGIN CERTIFICATE----- -MIIFVjCCBD6gAwIBAgIQ7is969Qh3hSoYqwE893EATANBgkqhkiG9w0BAQUFADCB8zELMAkGA1UE -BhMCRVMxOzA5BgNVBAoTMkFnZW5jaWEgQ2F0YWxhbmEgZGUgQ2VydGlmaWNhY2lvIChOSUYgUS0w -ODAxMTc2LUkpMSgwJgYDVQQLEx9TZXJ2ZWlzIFB1YmxpY3MgZGUgQ2VydGlmaWNhY2lvMTUwMwYD -VQQLEyxWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5ldC92ZXJhcnJlbCAoYykwMzE1MDMGA1UE -CxMsSmVyYXJxdWlhIEVudGl0YXRzIGRlIENlcnRpZmljYWNpbyBDYXRhbGFuZXMxDzANBgNVBAMT -BkVDLUFDQzAeFw0wMzAxMDcyMzAwMDBaFw0zMTAxMDcyMjU5NTlaMIHzMQswCQYDVQQGEwJFUzE7 -MDkGA1UEChMyQWdlbmNpYSBDYXRhbGFuYSBkZSBDZXJ0aWZpY2FjaW8gKE5JRiBRLTA4MDExNzYt -SSkxKDAmBgNVBAsTH1NlcnZlaXMgUHVibGljcyBkZSBDZXJ0aWZpY2FjaW8xNTAzBgNVBAsTLFZl -Z2V1IGh0dHBzOi8vd3d3LmNhdGNlcnQubmV0L3ZlcmFycmVsIChjKTAzMTUwMwYDVQQLEyxKZXJh -cnF1aWEgRW50aXRhdHMgZGUgQ2VydGlmaWNhY2lvIENhdGFsYW5lczEPMA0GA1UEAxMGRUMtQUND -MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsyLHT+KXQpWIR4NA9h0X84NzJB5R85iK -w5K4/0CQBXCHYMkAqbWUZRkiFRfCQ2xmRJoNBD45b6VLeqpjt4pEndljkYRm4CgPukLjbo73FCeT -ae6RDqNfDrHrZqJyTxIThmV6PttPB/SnCWDaOkKZx7J/sxaVHMf5NLWUhdWZXqBIoH7nF2W4onW4 -HvPlQn2v7fOKSGRdghST2MDk/7NQcvJ29rNdQlB50JQ+awwAvthrDk4q7D7SzIKiGGUzE3eeml0a -E9jD2z3Il3rucO2n5nzbcc8tlGLfbdb1OL4/pYUKGbio2Al1QnDE6u/LDsg0qBIimAy4E5S2S+zw -0JDnJwIDAQABo4HjMIHgMB0GA1UdEQQWMBSBEmVjX2FjY0BjYXRjZXJ0Lm5ldDAPBgNVHRMBAf8E -BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUoMOLRKo3pUW/l4Ba0fF4opvpXY0wfwYD -VR0gBHgwdjB0BgsrBgEEAfV4AQMBCjBlMCwGCCsGAQUFBwIBFiBodHRwczovL3d3dy5jYXRjZXJ0 -Lm5ldC92ZXJhcnJlbDA1BggrBgEFBQcCAjApGidWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5l -dC92ZXJhcnJlbCAwDQYJKoZIhvcNAQEFBQADggEBAKBIW4IB9k1IuDlVNZyAelOZ1Vr/sXE7zDkJ -lF7W2u++AVtd0x7Y/X1PzaBB4DSTv8vihpw3kpBWHNzrKQXlxJ7HNd+KDM3FIUPpqojlNcAZQmNa -Al6kSBg6hW/cnbw/nZzBh7h6YQjpdwt/cKt63dmXLGQehb+8dJahw3oS7AwaboMMPOhyRp/7SNVe -l+axofjk70YllJyJ22k4vuxcDlbHZVHlUIiIv0LVKz3l+bqeLrPK9HOSAgu+TGbrIP65y7WZf+a2 -E/rKS03Z7lNGBjvGTq2TWoF+bCpLagVFjPIhpDGQh2xlnJ2lYJU6Un/10asIbvPuW/mIPX64b24D -5EI= ------END CERTIFICATE----- - -Hellenic Academic and Research Institutions RootCA 2011 -======================================================= ------BEGIN CERTIFICATE----- -MIIEMTCCAxmgAwIBAgIBADANBgkqhkiG9w0BAQUFADCBlTELMAkGA1UEBhMCR1IxRDBCBgNVBAoT -O0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9y -aXR5MUAwPgYDVQQDEzdIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25z -IFJvb3RDQSAyMDExMB4XDTExMTIwNjEzNDk1MloXDTMxMTIwMTEzNDk1MlowgZUxCzAJBgNVBAYT -AkdSMUQwQgYDVQQKEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25z -IENlcnQuIEF1dGhvcml0eTFAMD4GA1UEAxM3SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNo -IEluc3RpdHV0aW9ucyBSb290Q0EgMjAxMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB -AKlTAOMupvaO+mDYLZU++CwqVE7NuYRhlFhPjz2L5EPzdYmNUeTDN9KKiE15HrcS3UN4SoqS5tdI -1Q+kOilENbgH9mgdVc04UfCMJDGFr4PJfel3r+0ae50X+bOdOFAPplp5kYCvN66m0zH7tSYJnTxa -71HFK9+WXesyHgLacEnsbgzImjeN9/E2YEsmLIKe0HjzDQ9jpFEw4fkrJxIH2Oq9GGKYsFk3fb7u -8yBRQlqD75O6aRXxYp2fmTmCobd0LovUxQt7L/DICto9eQqakxylKHJzkUOap9FNhYS5qXSPFEDH -3N6sQWRstBmbAmNtJGSPRLIl6s5ddAxjMlyNh+UCAwEAAaOBiTCBhjAPBgNVHRMBAf8EBTADAQH/ -MAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQUppFC/RNhSiOeCKQp5dgTBCPuQSUwRwYDVR0eBEAwPqA8 -MAWCAy5ncjAFggMuZXUwBoIELmVkdTAGggQub3JnMAWBAy5ncjAFgQMuZXUwBoEELmVkdTAGgQQu -b3JnMA0GCSqGSIb3DQEBBQUAA4IBAQAf73lB4XtuP7KMhjdCSk4cNx6NZrokgclPEg8hwAOXhiVt -XdMiKahsog2p6z0GW5k6x8zDmjR/qw7IThzh+uTczQ2+vyT+bOdrwg3IBp5OjWEopmr95fZi6hg8 -TqBTnbI6nOulnJEWtk2C4AwFSKls9cz4y51JtPACpf1wA+2KIaWuE4ZJwzNzvoc7dIsXRSZMFpGD -/md9zU1jZ/rzAxKWeAaNsWftjj++n08C9bMJL/NMh98qy5V8AcysNnq/onN694/BtZqhFLKPM58N -7yLcZnuEvUUXBj08yrl3NI/K6s8/MT7jiOOASSXIl7WdmplNsDz4SgCbZN2fOUvRJ9e4 ------END CERTIFICATE----- - -Actalis Authentication Root CA -============================== ------BEGIN CERTIFICATE----- -MIIFuzCCA6OgAwIBAgIIVwoRl0LE48wwDQYJKoZIhvcNAQELBQAwazELMAkGA1UEBhMCSVQxDjAM -BgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlzIFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UE -AwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290IENBMB4XDTExMDkyMjExMjIwMloXDTMwMDky -MjExMjIwMlowazELMAkGA1UEBhMCSVQxDjAMBgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlz -IFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UEAwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290 -IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAp8bEpSmkLO/lGMWwUKNvUTufClrJ -wkg4CsIcoBh/kbWHuUA/3R1oHwiD1S0eiKD4j1aPbZkCkpAW1V8IbInX4ay8IMKx4INRimlNAJZa -by/ARH6jDuSRzVju3PvHHkVH3Se5CAGfpiEd9UEtL0z9KK3giq0itFZljoZUj5NDKd45RnijMCO6 -zfB9E1fAXdKDa0hMxKufgFpbOr3JpyI/gCczWw63igxdBzcIy2zSekciRDXFzMwujt0q7bd9Zg1f -YVEiVRvjRuPjPdA1YprbrxTIW6HMiRvhMCb8oJsfgadHHwTrozmSBp+Z07/T6k9QnBn+locePGX2 -oxgkg4YQ51Q+qDp2JE+BIcXjDwL4k5RHILv+1A7TaLndxHqEguNTVHnd25zS8gebLra8Pu2Fbe8l -EfKXGkJh90qX6IuxEAf6ZYGyojnP9zz/GPvG8VqLWeICrHuS0E4UT1lF9gxeKF+w6D9Fz8+vm2/7 -hNN3WpVvrJSEnu68wEqPSpP4RCHiMUVhUE4Q2OM1fEwZtN4Fv6MGn8i1zeQf1xcGDXqVdFUNaBr8 -EBtiZJ1t4JWgw5QHVw0U5r0F+7if5t+L4sbnfpb2U8WANFAoWPASUHEXMLrmeGO89LKtmyuy/uE5 -jF66CyCU3nuDuP/jVo23Eek7jPKxwV2dpAtMK9myGPW1n0sCAwEAAaNjMGEwHQYDVR0OBBYEFFLY -iDrIn3hm7YnzezhwlMkCAjbQMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUUtiIOsifeGbt -ifN7OHCUyQICNtAwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBCwUAA4ICAQALe3KHwGCmSUyI -WOYdiPcUZEim2FgKDk8TNd81HdTtBjHIgT5q1d07GjLukD0R0i70jsNjLiNmsGe+b7bAEzlgqqI0 -JZN1Ut6nna0Oh4lScWoWPBkdg/iaKWW+9D+a2fDzWochcYBNy+A4mz+7+uAwTc+G02UQGRjRlwKx -K3JCaKygvU5a2hi/a5iB0P2avl4VSM0RFbnAKVy06Ij3Pjaut2L9HmLecHgQHEhb2rykOLpn7VU+ -Xlff1ANATIGk0k9jpwlCCRT8AKnCgHNPLsBA2RF7SOp6AsDT6ygBJlh0wcBzIm2Tlf05fbsq4/aC -4yyXX04fkZT6/iyj2HYauE2yOE+b+h1IYHkm4vP9qdCa6HCPSXrW5b0KDtst842/6+OkfcvHlXHo -2qN8xcL4dJIEG4aspCJTQLas/kx2z/uUMsA1n3Y/buWQbqCmJqK4LL7RK4X9p2jIugErsWx0Hbhz -lefut8cl8ABMALJ+tguLHPPAUJ4lueAI3jZm/zel0btUZCzJJ7VLkn5l/9Mt4blOvH+kQSGQQXem -OR/qnuOf0GZvBeyqdn6/axag67XH/JJULysRJyU3eExRarDzzFhdFPFqSBX/wge2sY0PjlxQRrM9 -vwGYT7JZVEc+NHt4bVaTLnPqZih4zR0Uv6CPLy64Lo7yFIrM6bV8+2ydDKXhlg== ------END CERTIFICATE----- - -Trustis FPS Root CA -=================== ------BEGIN CERTIFICATE----- -MIIDZzCCAk+gAwIBAgIQGx+ttiD5JNM2a/fH8YygWTANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQG -EwJHQjEYMBYGA1UEChMPVHJ1c3RpcyBMaW1pdGVkMRwwGgYDVQQLExNUcnVzdGlzIEZQUyBSb290 -IENBMB4XDTAzMTIyMzEyMTQwNloXDTI0MDEyMTExMzY1NFowRTELMAkGA1UEBhMCR0IxGDAWBgNV -BAoTD1RydXN0aXMgTGltaXRlZDEcMBoGA1UECxMTVHJ1c3RpcyBGUFMgUm9vdCBDQTCCASIwDQYJ -KoZIhvcNAQEBBQADggEPADCCAQoCggEBAMVQe547NdDfxIzNjpvto8A2mfRC6qc+gIMPpqdZh8mQ -RUN+AOqGeSoDvT03mYlmt+WKVoaTnGhLaASMk5MCPjDSNzoiYYkchU59j9WvezX2fihHiTHcDnlk -H5nSW7r+f2C/revnPDgpai/lkQtV/+xvWNUtyd5MZnGPDNcE2gfmHhjjvSkCqPoc4Vu5g6hBSLwa -cY3nYuUtsuvffM/bq1rKMfFMIvMFE/eC+XN5DL7XSxzA0RU8k0Fk0ea+IxciAIleH2ulrG6nS4zt -o3Lmr2NNL4XSFDWaLk6M6jKYKIahkQlBOrTh4/L68MkKokHdqeMDx4gVOxzUGpTXn2RZEm0CAwEA -AaNTMFEwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBS6+nEleYtXQSUhhgtx67JkDoshZzAd -BgNVHQ4EFgQUuvpxJXmLV0ElIYYLceuyZA6LIWcwDQYJKoZIhvcNAQEFBQADggEBAH5Y//01GX2c -GE+esCu8jowU/yyg2kdbw++BLa8F6nRIW/M+TgfHbcWzk88iNVy2P3UnXwmWzaD+vkAMXBJV+JOC -yinpXj9WV4s4NvdFGkwozZ5BuO1WTISkQMi4sKUraXAEasP41BIy+Q7DsdwyhEQsb8tGD+pmQQ9P -8Vilpg0ND2HepZ5dfWWhPBfnqFVO76DH7cZEf1T1o+CP8HxVIo8ptoGj4W1OLBuAZ+ytIJ8MYmHV -l/9D7S3B2l0pKoU/rGXuhg8FjZBf3+6f9L/uHfuY5H+QK4R4EA5sSVPvFVtlRkpdr7r7OnIdzfYl -iB6XzCGcKQENZetX2fNXlrtIzYE= ------END CERTIFICATE----- - -StartCom Certification Authority -================================ ------BEGIN CERTIFICATE----- -MIIHhzCCBW+gAwIBAgIBLTANBgkqhkiG9w0BAQsFADB9MQswCQYDVQQGEwJJTDEWMBQGA1UEChMN -U3RhcnRDb20gTHRkLjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmlu -ZzEpMCcGA1UEAxMgU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDYwOTE3MTk0 -NjM3WhcNMzYwOTE3MTk0NjM2WjB9MQswCQYDVQQGEwJJTDEWMBQGA1UEChMNU3RhcnRDb20gTHRk -LjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmluZzEpMCcGA1UEAxMg -U3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw -ggIKAoICAQDBiNsJvGxGfHiflXu1M5DycmLWwTYgIiRezul38kMKogZkpMyONvg45iPwbm2xPN1y -o4UcodM9tDMr0y+v/uqwQVlntsQGfQqedIXWeUyAN3rfOQVSWff0G0ZDpNKFhdLDcfN1YjS6LIp/ -Ho/u7TTQEceWzVI9ujPW3U3eCztKS5/CJi/6tRYccjV3yjxd5srhJosaNnZcAdt0FCX+7bWgiA/d -eMotHweXMAEtcnn6RtYTKqi5pquDSR3l8u/d5AGOGAqPY1MWhWKpDhk6zLVmpsJrdAfkK+F2PrRt -2PZE4XNiHzvEvqBTViVsUQn3qqvKv3b9bZvzndu/PWa8DFaqr5hIlTpL36dYUNk4dalb6kMMAv+Z -6+hsTXBbKWWc3apdzK8BMewM69KN6Oqce+Zu9ydmDBpI125C4z/eIT574Q1w+2OqqGwaVLRcJXrJ -osmLFqa7LH4XXgVNWG4SHQHuEhANxjJ/GP/89PrNbpHoNkm+Gkhpi8KWTRoSsmkXwQqQ1vp5Iki/ -untp+HDH+no32NgN0nZPV/+Qt+OR0t3vwmC3Zzrd/qqc8NSLf3Iizsafl7b4r4qgEKjZ+xjGtrVc -UjyJthkqcwEKDwOzEmDyei+B26Nu/yYwl/WL3YlXtq09s68rxbd2AvCl1iuahhQqcvbjM4xdCUsT -37uMdBNSSwIDAQABo4ICEDCCAgwwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYD -VR0OBBYEFE4L7xqkQFulF2mHMMo0aEPQQa7yMB8GA1UdIwQYMBaAFE4L7xqkQFulF2mHMMo0aEPQ -Qa7yMIIBWgYDVR0gBIIBUTCCAU0wggFJBgsrBgEEAYG1NwEBATCCATgwLgYIKwYBBQUHAgEWImh0 -dHA6Ly93d3cuc3RhcnRzc2wuY29tL3BvbGljeS5wZGYwNAYIKwYBBQUHAgEWKGh0dHA6Ly93d3cu -c3RhcnRzc2wuY29tL2ludGVybWVkaWF0ZS5wZGYwgc8GCCsGAQUFBwICMIHCMCcWIFN0YXJ0IENv -bW1lcmNpYWwgKFN0YXJ0Q29tKSBMdGQuMAMCAQEagZZMaW1pdGVkIExpYWJpbGl0eSwgcmVhZCB0 -aGUgc2VjdGlvbiAqTGVnYWwgTGltaXRhdGlvbnMqIG9mIHRoZSBTdGFydENvbSBDZXJ0aWZpY2F0 -aW9uIEF1dGhvcml0eSBQb2xpY3kgYXZhaWxhYmxlIGF0IGh0dHA6Ly93d3cuc3RhcnRzc2wuY29t -L3BvbGljeS5wZGYwEQYJYIZIAYb4QgEBBAQDAgAHMDgGCWCGSAGG+EIBDQQrFilTdGFydENvbSBG -cmVlIFNTTCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTANBgkqhkiG9w0BAQsFAAOCAgEAjo/n3JR5 -fPGFf59Jb2vKXfuM/gTFwWLRfUKKvFO3lANmMD+x5wqnUCBVJX92ehQN6wQOQOY+2IirByeDqXWm -N3PH/UvSTa0XQMhGvjt/UfzDtgUx3M2FIk5xt/JxXrAaxrqTi3iSSoX4eA+D/i+tLPfkpLst0OcN -Org+zvZ49q5HJMqjNTbOx8aHmNrs++myziebiMMEofYLWWivydsQD032ZGNcpRJvkrKTlMeIFw6T -tn5ii5B/q06f/ON1FE8qMt9bDeD1e5MNq6HPh+GlBEXoPBKlCcWw0bdT82AUuoVpaiF8H3VhFyAX -e2w7QSlc4axa0c2Mm+tgHRns9+Ww2vl5GKVFP0lDV9LdJNUso/2RjSe15esUBppMeyG7Oq0wBhjA -2MFrLH9ZXF2RsXAiV+uKa0hK1Q8p7MZAwC+ITGgBF3f0JBlPvfrhsiAhS90a2Cl9qrjeVOwhVYBs -HvUwyKMQ5bLmKhQxw4UtjJixhlpPiVktucf3HMiKf8CdBUrmQk9io20ppB+Fq9vlgcitKj1MXVuE -JnHEhV5xJMqlG2zYYdMa4FTbzrqpMrUi9nNBCV24F10OD5mQ1kfabwo6YigUZ4LZ8dCAWZvLMdib -D4x3TrVoivJs9iQOLWxwxXPR3hTQcY+203sC9uO41Alua551hDnmfyWl8kgAwKQB2j8= ------END CERTIFICATE----- - -StartCom Certification Authority G2 -=================================== ------BEGIN CERTIFICATE----- -MIIFYzCCA0ugAwIBAgIBOzANBgkqhkiG9w0BAQsFADBTMQswCQYDVQQGEwJJTDEWMBQGA1UEChMN -U3RhcnRDb20gTHRkLjEsMCoGA1UEAxMjU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkg -RzIwHhcNMTAwMTAxMDEwMDAxWhcNMzkxMjMxMjM1OTAxWjBTMQswCQYDVQQGEwJJTDEWMBQGA1UE -ChMNU3RhcnRDb20gTHRkLjEsMCoGA1UEAxMjU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3Jp -dHkgRzIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2iTZbB7cgNr2Cu+EWIAOVeq8O -o1XJJZlKxdBWQYeQTSFgpBSHO839sj60ZwNq7eEPS8CRhXBF4EKe3ikj1AENoBB5uNsDvfOpL9HG -4A/LnooUCri99lZi8cVytjIl2bLzvWXFDSxu1ZJvGIsAQRSCb0AgJnooD/Uefyf3lLE3PbfHkffi -Aez9lInhzG7TNtYKGXmu1zSCZf98Qru23QumNK9LYP5/Q0kGi4xDuFby2X8hQxfqp0iVAXV16iul -Q5XqFYSdCI0mblWbq9zSOdIxHWDirMxWRST1HFSr7obdljKF+ExP6JV2tgXdNiNnvP8V4so75qbs -O+wmETRIjfaAKxojAuuKHDp2KntWFhxyKrOq42ClAJ8Em+JvHhRYW6Vsi1g8w7pOOlz34ZYrPu8H -vKTlXcxNnw3h3Kq74W4a7I/htkxNeXJdFzULHdfBR9qWJODQcqhaX2YtENwvKhOuJv4KHBnM0D4L -nMgJLvlblnpHnOl68wVQdJVznjAJ85eCXuaPOQgeWeU1FEIT/wCc976qUM/iUUjXuG+v+E5+M5iS -FGI6dWPPe/regjupuznixL0sAA7IF6wT700ljtizkC+p2il9Ha90OrInwMEePnWjFqmveiJdnxMa -z6eg6+OGCtP95paV1yPIN93EfKo2rJgaErHgTuixO/XWb/Ew1wIDAQABo0IwQDAPBgNVHRMBAf8E -BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUS8W0QGutHLOlHGVuRjaJhwUMDrYwDQYJ -KoZIhvcNAQELBQADggIBAHNXPyzVlTJ+N9uWkusZXn5T50HsEbZH77Xe7XRcxfGOSeD8bpkTzZ+K -2s06Ctg6Wgk/XzTQLwPSZh0avZyQN8gMjgdalEVGKua+etqhqaRpEpKwfTbURIfXUfEpY9Z1zRbk -J4kd+MIySP3bmdCPX1R0zKxnNBFi2QwKN4fRoxdIjtIXHfbX/dtl6/2o1PXWT6RbdejF0mCy2wl+ -JYt7ulKSnj7oxXehPOBKc2thz4bcQ///If4jXSRK9dNtD2IEBVeC2m6kMyV5Sy5UGYvMLD0w6dEG -/+gyRr61M3Z3qAFdlsHB1b6uJcDJHgoJIIihDsnzb02CVAAgp9KP5DlUFy6NHrgbuxu9mk47EDTc -nIhT76IxW1hPkWLIwpqazRVdOKnWvvgTtZ8SafJQYqz7Fzf07rh1Z2AQ+4NQ+US1dZxAF7L+/Xld -blhYXzD8AK6vM8EOTmy6p6ahfzLbOOCxchcKK5HsamMm7YnUeMx0HgX4a/6ManY5Ka5lIxKVCCIc -l85bBu4M4ru8H0ST9tg4RQUh7eStqxK2A6RCLi3ECToDZ2mEmuFZkIoohdVddLHRDiBYmxOlsGOm -7XtH/UVVMKTumtTm4ofvmMkyghEpIrwACjFeLQ/Ajulrso8uBtjRkcfGEvRM/TAXw8HaOFvjqerm -obp573PYtlNXLfbQ4ddI ------END CERTIFICATE----- - -Buypass Class 2 Root CA -======================= ------BEGIN CERTIFICATE----- -MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU -QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMiBSb290IENBMB4X -DTEwMTAyNjA4MzgwM1oXDTQwMTAyNjA4MzgwM1owTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1 -eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDIgUm9vdCBDQTCCAiIw -DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANfHXvfBB9R3+0Mh9PT1aeTuMgHbo4Yf5FkNuud1 -g1Lr6hxhFUi7HQfKjK6w3Jad6sNgkoaCKHOcVgb/S2TwDCo3SbXlzwx87vFKu3MwZfPVL4O2fuPn -9Z6rYPnT8Z2SdIrkHJasW4DptfQxh6NR/Md+oW+OU3fUl8FVM5I+GC911K2GScuVr1QGbNgGE41b -/+EmGVnAJLqBcXmQRFBoJJRfuLMR8SlBYaNByyM21cHxMlAQTn/0hpPshNOOvEu/XAFOBz3cFIqU -CqTqc/sLUegTBxj6DvEr0VQVfTzh97QZQmdiXnfgolXsttlpF9U6r0TtSsWe5HonfOV116rLJeff -awrbD02TTqigzXsu8lkBarcNuAeBfos4GzjmCleZPe4h6KP1DBbdi+w0jpwqHAAVF41og9JwnxgI -zRFo1clrUs3ERo/ctfPYV3Me6ZQ5BL/T3jjetFPsaRyifsSP5BtwrfKi+fv3FmRmaZ9JUaLiFRhn -Bkp/1Wy1TbMz4GHrXb7pmA8y1x1LPC5aAVKRCfLf6o3YBkBjqhHk/sM3nhRSP/TizPJhk9H9Z2vX -Uq6/aKtAQ6BXNVN48FP4YUIHZMbXb5tMOA1jrGKvNouicwoN9SG9dKpN6nIDSdvHXx1iY8f93ZHs -M+71bbRuMGjeyNYmsHVee7QHIJihdjK4TWxPAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD -VR0OBBYEFMmAd+BikoL1RpzzuvdMw964o605MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF -AAOCAgEAU18h9bqwOlI5LJKwbADJ784g7wbylp7ppHR/ehb8t/W2+xUbP6umwHJdELFx7rxP462s -A20ucS6vxOOto70MEae0/0qyexAQH6dXQbLArvQsWdZHEIjzIVEpMMpghq9Gqx3tOluwlN5E40EI -osHsHdb9T7bWR9AUC8rmyrV7d35BH16Dx7aMOZawP5aBQW9gkOLo+fsicdl9sz1Gv7SEr5AcD48S -aq/v7h56rgJKihcrdv6sVIkkLE8/trKnToyokZf7KcZ7XC25y2a2t6hbElGFtQl+Ynhw/qlqYLYd -DnkM/crqJIByw5c/8nerQyIKx+u2DISCLIBrQYoIwOula9+ZEsuK1V6ADJHgJgg2SMX6OBE1/yWD -LfJ6v9r9jv6ly0UsH8SIU653DtmadsWOLB2jutXsMq7Aqqz30XpN69QH4kj3Io6wpJ9qzo6ysmD0 -oyLQI+uUWnpp3Q+/QFesa1lQ2aOZ4W7+jQF5JyMV3pKdewlNWudLSDBaGOYKbeaP4NK75t98biGC -wWg5TbSYWGZizEqQXsP6JwSxeRV0mcy+rSDeJmAc61ZRpqPq5KM/p/9h3PFaTWwyI0PurKju7koS -CTxdccK+efrCh2gdC/1cacwG0Jp9VJkqyTkaGa9LKkPzY11aWOIv4x3kqdbQCtCev9eBCfHJxyYN -rJgWVqA= ------END CERTIFICATE----- - -Buypass Class 3 Root CA -======================= ------BEGIN CERTIFICATE----- -MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU -QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMyBSb290IENBMB4X -DTEwMTAyNjA4Mjg1OFoXDTQwMTAyNjA4Mjg1OFowTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1 -eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDMgUm9vdCBDQTCCAiIw -DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAKXaCpUWUOOV8l6ddjEGMnqb8RB2uACatVI2zSRH -sJ8YZLya9vrVediQYkwiL944PdbgqOkcLNt4EemOaFEVcsfzM4fkoF0LXOBXByow9c3EN3coTRiR -5r/VUv1xLXA+58bEiuPwKAv0dpihi4dVsjoT/Lc+JzeOIuOoTyrvYLs9tznDDgFHmV0ST9tD+leh -7fmdvhFHJlsTmKtdFoqwNxxXnUX/iJY2v7vKB3tvh2PX0DJq1l1sDPGzbjniazEuOQAnFN44wOwZ -ZoYS6J1yFhNkUsepNxz9gjDthBgd9K5c/3ATAOux9TN6S9ZV+AWNS2mw9bMoNlwUxFFzTWsL8TQH -2xc519woe2v1n/MuwU8XKhDzzMro6/1rqy6any2CbgTUUgGTLT2G/H783+9CHaZr77kgxve9oKeV -/afmiSTYzIw0bOIjL9kSGiG5VZFvC5F5GQytQIgLcOJ60g7YaEi7ghM5EFjp2CoHxhLbWNvSO1UQ -RwUVZ2J+GGOmRj8JDlQyXr8NYnon74Do29lLBlo3WiXQCBJ31G8JUJc9yB3D34xFMFbG02SrZvPA -Xpacw8Tvw3xrizp5f7NJzz3iiZ+gMEuFuZyUJHmPfWupRWgPK9Dx2hzLabjKSWJtyNBjYt1gD1iq -j6G8BaVmos8bdrKEZLFMOVLAMLrwjEsCsLa3AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD -VR0OBBYEFEe4zf/lb+74suwvTg75JbCOPGvDMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF -AAOCAgEAACAjQTUEkMJAYmDv4jVM1z+s4jSQuKFvdvoWFqRINyzpkMLyPPgKn9iB5btb2iUspKdV -cSQy9sgL8rxq+JOssgfCX5/bzMiKqr5qb+FJEMwx14C7u8jYog5kV+qi9cKpMRXSIGrs/CIBKM+G -uIAeqcwRpTzyFrNHnfzSgCHEy9BHcEGhyoMZCCxt8l13nIoUE9Q2HJLw5QY33KbmkJs4j1xrG0aG -Q0JfPgEHU1RdZX33inOhmlRaHylDFCfChQ+1iHsaO5S3HWCntZznKWlXWpuTekMwGwPXYshApqr8 -ZORK15FTAaggiG6cX0S5y2CBNOxv033aSF/rtJC8LakcC6wc1aJoIIAE1vyxjy+7SjENSoYc6+I2 -KSb12tjE8nVhz36udmNKekBlk4f4HoCMhuWG1o8O/FMsYOgWYRqiPkN7zTlgVGr18okmAWiDSKIz -6MkEkbIRNBE+6tBDGR8Dk5AM/1E9V/RBbuHLoL7ryWPNbczk+DaqaJ3tvV2XcEQNtg413OEMXbug -UZTLfhbrES+jkkXITHHZvMmZUldGL1DPvTVp9D0VzgalLA8+9oG6lLvDu79leNKGef9JOxqDDPDe -eOzI8k1MGt6CKfjBWtrt7uYnXuhF0J0cUahoq0Tj0Itq4/g7u9xN12TyUb7mqqta6THuBrxzvxNi -Cp/HuZc= ------END CERTIFICATE----- - -T-TeleSec GlobalRoot Class 3 -============================ ------BEGIN CERTIFICATE----- -MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM -IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU -cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwHhcNMDgx -MDAxMTAyOTU2WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz -dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD -ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwggEiMA0GCSqGSIb3 -DQEBAQUAA4IBDwAwggEKAoIBAQC9dZPwYiJvJK7genasfb3ZJNW4t/zN8ELg63iIVl6bmlQdTQyK -9tPPcPRStdiTBONGhnFBSivwKixVA9ZIw+A5OO3yXDw/RLyTPWGrTs0NvvAgJ1gORH8EGoel15YU -NpDQSXuhdfsaa3Ox+M6pCSzyU9XDFES4hqX2iys52qMzVNn6chr3IhUciJFrf2blw2qAsCTz34ZF -iP0Zf3WHHx+xGwpzJFu5ZeAsVMhg02YXP+HMVDNzkQI6pn97djmiH5a2OK61yJN0HZ65tOVgnS9W -0eDrXltMEnAMbEQgqxHY9Bn20pxSN+f6tsIxO0rUFJmtxxr1XV/6B7h8DR/Wgx6zAgMBAAGjQjBA -MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS1A/d2O2GCahKqGFPr -AyGUv/7OyjANBgkqhkiG9w0BAQsFAAOCAQEAVj3vlNW92nOyWL6ukK2YJ5f+AbGwUgC4TeQbIXQb -fsDuXmkqJa9c1h3a0nnJ85cp4IaH3gRZD/FZ1GSFS5mvJQQeyUapl96Cshtwn5z2r3Ex3XsFpSzT -ucpH9sry9uetuUg/vBa3wW306gmv7PO15wWeph6KU1HWk4HMdJP2udqmJQV0eVp+QD6CSyYRMG7h -P0HHRwA11fXT91Q+gT3aSWqas+8QPebrb9HIIkfLzM8BMZLZGOMivgkeGj5asuRrDFR6fUNOuIml -e9eiPZaGzPImNC1qkp2aGtAw4l1OBLBfiyB+d8E9lYLRRpo7PHi4b6HQDWSieB4pTpPDpFQUWw== ------END CERTIFICATE----- - -EE Certification Centre Root CA -=============================== ------BEGIN CERTIFICATE----- -MIIEAzCCAuugAwIBAgIQVID5oHPtPwBMyonY43HmSjANBgkqhkiG9w0BAQUFADB1MQswCQYDVQQG -EwJFRTEiMCAGA1UECgwZQVMgU2VydGlmaXRzZWVyaW1pc2tlc2t1czEoMCYGA1UEAwwfRUUgQ2Vy -dGlmaWNhdGlvbiBDZW50cmUgUm9vdCBDQTEYMBYGCSqGSIb3DQEJARYJcGtpQHNrLmVlMCIYDzIw -MTAxMDMwMTAxMDMwWhgPMjAzMDEyMTcyMzU5NTlaMHUxCzAJBgNVBAYTAkVFMSIwIAYDVQQKDBlB -UyBTZXJ0aWZpdHNlZXJpbWlza2Vza3VzMSgwJgYDVQQDDB9FRSBDZXJ0aWZpY2F0aW9uIENlbnRy -ZSBSb290IENBMRgwFgYJKoZIhvcNAQkBFglwa2lAc2suZWUwggEiMA0GCSqGSIb3DQEBAQUAA4IB -DwAwggEKAoIBAQDIIMDs4MVLqwd4lfNE7vsLDP90jmG7sWLqI9iroWUyeuuOF0+W2Ap7kaJjbMeM -TC55v6kF/GlclY1i+blw7cNRfdCT5mzrMEvhvH2/UpvObntl8jixwKIy72KyaOBhU8E2lf/slLo2 -rpwcpzIP5Xy0xm90/XsY6KxX7QYgSzIwWFv9zajmofxwvI6Sc9uXp3whrj3B9UiHbCe9nyV0gVWw -93X2PaRka9ZP585ArQ/dMtO8ihJTmMmJ+xAdTX7Nfh9WDSFwhfYggx/2uh8Ej+p3iDXE/+pOoYtN -P2MbRMNE1CV2yreN1x5KZmTNXMWcg+HCCIia7E6j8T4cLNlsHaFLAgMBAAGjgYowgYcwDwYDVR0T -AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBLyWj7qVhy/zQas8fElyalL1BSZ -MEUGA1UdJQQ+MDwGCCsGAQUFBwMCBggrBgEFBQcDAQYIKwYBBQUHAwMGCCsGAQUFBwMEBggrBgEF -BQcDCAYIKwYBBQUHAwkwDQYJKoZIhvcNAQEFBQADggEBAHv25MANqhlHt01Xo/6tu7Fq1Q+e2+Rj -xY6hUFaTlrg4wCQiZrxTFGGVv9DHKpY5P30osxBAIWrEr7BSdxjhlthWXePdNl4dp1BUoMUq5KqM -lIpPnTX/dqQGE5Gion0ARD9V04I8GtVbvFZMIi5GQ4okQC3zErg7cBqklrkar4dBGmoYDQZPxz5u -uSlNDUmJEYcyW+ZLBMjkXOZ0c5RdFpgTlf7727FE5TpwrDdr5rMzcijJs1eg9gIWiAYLtqZLICjU -3j2LrTcFU3T+bsy8QxdxXvnFzBqpYe73dgzzcvRyrc9yAjYHR8/vGVCJYMzpJJUPwssd8m92kMfM -dcGWxZ0= ------END CERTIFICATE----- - -TURKTRUST Certificate Services Provider Root 2007 -================================================= ------BEGIN CERTIFICATE----- -MIIEPTCCAyWgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBvzE/MD0GA1UEAww2VMOcUktUUlVTVCBF -bGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxMQswCQYDVQQGEwJUUjEP -MA0GA1UEBwwGQW5rYXJhMV4wXAYDVQQKDFVUw5xSS1RSVVNUIEJpbGdpIMSwbGV0acWfaW0gdmUg -QmlsacWfaW0gR8O8dmVubGnEn2kgSGl6bWV0bGVyaSBBLsWeLiAoYykgQXJhbMSxayAyMDA3MB4X -DTA3MTIyNTE4MzcxOVoXDTE3MTIyMjE4MzcxOVowgb8xPzA9BgNVBAMMNlTDnFJLVFJVU1QgRWxl -a3Ryb25payBTZXJ0aWZpa2EgSGl6bWV0IFNhxJ9sYXnEsWPEsXPEsTELMAkGA1UEBhMCVFIxDzAN -BgNVBAcMBkFua2FyYTFeMFwGA1UECgxVVMOcUktUUlVTVCBCaWxnaSDEsGxldGnFn2ltIHZlIEJp -bGnFn2ltIEfDvHZlbmxpxJ9pIEhpem1ldGxlcmkgQS7Fni4gKGMpIEFyYWzEsWsgMjAwNzCCASIw -DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKu3PgqMyKVYFeaK7yc9SrToJdPNM8Ig3BnuiD9N -YvDdE3ePYakqtdTyuTFYKTsvP2qcb3N2Je40IIDu6rfwxArNK4aUyeNgsURSsloptJGXg9i3phQv -KUmi8wUG+7RP2qFsmmaf8EMJyupyj+sA1zU511YXRxcw9L6/P8JorzZAwan0qafoEGsIiveGHtya -KhUG9qPw9ODHFNRRf8+0222vR5YXm3dx2KdxnSQM9pQ/hTEST7ruToK4uT6PIzdezKKqdfcYbwnT -rqdUKDT74eA7YH2gvnmJhsifLfkKS8RQouf9eRbHegsYz85M733WB2+Y8a+xwXrXgTW4qhe04MsC -AwEAAaNCMEAwHQYDVR0OBBYEFCnFkKslrxHkYb+j/4hhkeYO/pyBMA4GA1UdDwEB/wQEAwIBBjAP -BgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBBQUAA4IBAQAQDdr4Ouwo0RSVgrESLFF6QSU2TJ/s -Px+EnWVUXKgWAkD6bho3hO9ynYYKVZ1WKKxmLNA6VpM0ByWtCLCPyA8JWcqdmBzlVPi5RX9ql2+I -aE1KBiY3iAIOtsbWcpnOa3faYjGkVh+uX4132l32iPwa2Z61gfAyuOOI0JzzaqC5mxRZNTZPz/OO -Xl0XrRWV2N2y1RVuAE6zS89mlOTgzbUF2mNXi+WzqtvALhyQRNsaXRik7r4EW5nVcV9VZWRi1aKb -BFmGyGJ353yCRWo9F7/snXUMrqNvWtMvmDb08PUZqxFdyKbjKlhqQgnDvZImZjINXQhVdP+MmNAK -poRq0Tl9 ------END CERTIFICATE----- - -D-TRUST Root Class 3 CA 2 2009 -============================== ------BEGIN CERTIFICATE----- -MIIEMzCCAxugAwIBAgIDCYPzMA0GCSqGSIb3DQEBCwUAME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQK -DAxELVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTAe -Fw0wOTExMDUwODM1NThaFw0yOTExMDUwODM1NThaME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQKDAxE -LVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTCCASIw -DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANOySs96R+91myP6Oi/WUEWJNTrGa9v+2wBoqOAD -ER03UAifTUpolDWzU9GUY6cgVq/eUXjsKj3zSEhQPgrfRlWLJ23DEE0NkVJD2IfgXU42tSHKXzlA -BF9bfsyjxiupQB7ZNoTWSPOSHjRGICTBpFGOShrvUD9pXRl/RcPHAY9RySPocq60vFYJfxLLHLGv -KZAKyVXMD9O0Gu1HNVpK7ZxzBCHQqr0ME7UAyiZsxGsMlFqVlNpQmvH/pStmMaTJOKDfHR+4CS7z -p+hnUquVH+BGPtikw8paxTGA6Eian5Rp/hnd2HN8gcqW3o7tszIFZYQ05ub9VxC1X3a/L7AQDcUC -AwEAAaOCARowggEWMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFP3aFMSfMN4hvR5COfyrYyNJ -4PGEMA4GA1UdDwEB/wQEAwIBBjCB0wYDVR0fBIHLMIHIMIGAoH6gfIZ6bGRhcDovL2RpcmVjdG9y -eS5kLXRydXN0Lm5ldC9DTj1ELVRSVVNUJTIwUm9vdCUyMENsYXNzJTIwMyUyMENBJTIwMiUyMDIw -MDksTz1ELVRydXN0JTIwR21iSCxDPURFP2NlcnRpZmljYXRlcmV2b2NhdGlvbmxpc3QwQ6BBoD+G -PWh0dHA6Ly93d3cuZC10cnVzdC5uZXQvY3JsL2QtdHJ1c3Rfcm9vdF9jbGFzc18zX2NhXzJfMjAw -OS5jcmwwDQYJKoZIhvcNAQELBQADggEBAH+X2zDI36ScfSF6gHDOFBJpiBSVYEQBrLLpME+bUMJm -2H6NMLVwMeniacfzcNsgFYbQDfC+rAF1hM5+n02/t2A7nPPKHeJeaNijnZflQGDSNiH+0LS4F9p0 -o3/U37CYAqxva2ssJSRyoWXuJVrl5jLn8t+rSfrzkGkj2wTZ51xY/GXUl77M/C4KzCUqNQT4YJEV -dT1B/yMfGchs64JTBKbkTCJNjYy6zltz7GRUUG3RnFX7acM2w4y8PIWmawomDeCTmGCufsYkl4ph -X5GOZpIJhzbNi5stPvZR1FDUWSi9g/LMKHtThm3YJohw1+qRzT65ysCQblrGXnRl11z+o+I= ------END CERTIFICATE----- - -D-TRUST Root Class 3 CA 2 EV 2009 -================================= ------BEGIN CERTIFICATE----- -MIIEQzCCAyugAwIBAgIDCYP0MA0GCSqGSIb3DQEBCwUAMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK -DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw -OTAeFw0wOTExMDUwODUwNDZaFw0yOTExMDUwODUwNDZaMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK -DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw -OTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJnxhDRwui+3MKCOvXwEz75ivJn9gpfS -egpnljgJ9hBOlSJzmY3aFS3nBfwZcyK3jpgAvDw9rKFs+9Z5JUut8Mxk2og+KbgPCdM03TP1YtHh -zRnp7hhPTFiu4h7WDFsVWtg6uMQYZB7jM7K1iXdODL/ZlGsTl28So/6ZqQTMFexgaDbtCHu39b+T -7WYxg4zGcTSHThfqr4uRjRxWQa4iN1438h3Z0S0NL2lRp75mpoo6Kr3HGrHhFPC+Oh25z1uxav60 -sUYgovseO3Dvk5h9jHOW8sXvhXCtKSb8HgQ+HKDYD8tSg2J87otTlZCpV6LqYQXY+U3EJ/pure35 -11H3a6UCAwEAAaOCASQwggEgMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNOUikxiEyoZLsyv -cop9NteaHNxnMA4GA1UdDwEB/wQEAwIBBjCB3QYDVR0fBIHVMIHSMIGHoIGEoIGBhn9sZGFwOi8v -ZGlyZWN0b3J5LmQtdHJ1c3QubmV0L0NOPUQtVFJVU1QlMjBSb290JTIwQ2xhc3MlMjAzJTIwQ0El -MjAyJTIwRVYlMjAyMDA5LE89RC1UcnVzdCUyMEdtYkgsQz1ERT9jZXJ0aWZpY2F0ZXJldm9jYXRp -b25saXN0MEagRKBChkBodHRwOi8vd3d3LmQtdHJ1c3QubmV0L2NybC9kLXRydXN0X3Jvb3RfY2xh -c3NfM19jYV8yX2V2XzIwMDkuY3JsMA0GCSqGSIb3DQEBCwUAA4IBAQA07XtaPKSUiO8aEXUHL7P+ -PPoeUSbrh/Yp3uDx1MYkCenBz1UbtDDZzhr+BlGmFaQt77JLvyAoJUnRpjZ3NOhk31KxEcdzes05 -nsKtjHEh8lprr988TlWvsoRlFIm5d8sqMb7Po23Pb0iUMkZv53GMoKaEGTcH8gNFCSuGdXzfX2lX -ANtu2KZyIktQ1HWYVt+3GP9DQ1CuekR78HlR10M9p9OB0/DJT7naxpeG0ILD5EJt/rDiZE4OJudA -NCa1CInXCGNjOCd1HjPqbqjdn5lPdE2BiYBL3ZqXKVwvvoFBuYz/6n1gBp7N1z3TLqMVvKjmJuVv -w9y4AyHqnxbxLFS1 ------END CERTIFICATE----- - -PSCProcert -========== ------BEGIN CERTIFICATE----- -MIIJhjCCB26gAwIBAgIBCzANBgkqhkiG9w0BAQsFADCCAR4xPjA8BgNVBAMTNUF1dG9yaWRhZCBk -ZSBDZXJ0aWZpY2FjaW9uIFJhaXogZGVsIEVzdGFkbyBWZW5lem9sYW5vMQswCQYDVQQGEwJWRTEQ -MA4GA1UEBxMHQ2FyYWNhczEZMBcGA1UECBMQRGlzdHJpdG8gQ2FwaXRhbDE2MDQGA1UEChMtU2lz -dGVtYSBOYWNpb25hbCBkZSBDZXJ0aWZpY2FjaW9uIEVsZWN0cm9uaWNhMUMwQQYDVQQLEzpTdXBl -cmludGVuZGVuY2lhIGRlIFNlcnZpY2lvcyBkZSBDZXJ0aWZpY2FjaW9uIEVsZWN0cm9uaWNhMSUw -IwYJKoZIhvcNAQkBFhZhY3JhaXpAc3VzY2VydGUuZ29iLnZlMB4XDTEwMTIyODE2NTEwMFoXDTIw -MTIyNTIzNTk1OVowgdExJjAkBgkqhkiG9w0BCQEWF2NvbnRhY3RvQHByb2NlcnQubmV0LnZlMQ8w -DQYDVQQHEwZDaGFjYW8xEDAOBgNVBAgTB01pcmFuZGExKjAoBgNVBAsTIVByb3ZlZWRvciBkZSBD -ZXJ0aWZpY2Fkb3MgUFJPQ0VSVDE2MDQGA1UEChMtU2lzdGVtYSBOYWNpb25hbCBkZSBDZXJ0aWZp -Y2FjaW9uIEVsZWN0cm9uaWNhMQswCQYDVQQGEwJWRTETMBEGA1UEAxMKUFNDUHJvY2VydDCCAiIw -DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANW39KOUM6FGqVVhSQ2oh3NekS1wwQYalNo97BVC -wfWMrmoX8Yqt/ICV6oNEolt6Vc5Pp6XVurgfoCfAUFM+jbnADrgV3NZs+J74BCXfgI8Qhd19L3uA -3VcAZCP4bsm+lU/hdezgfl6VzbHvvnpC2Mks0+saGiKLt38GieU89RLAu9MLmV+QfI4tL3czkkoh -RqipCKzx9hEC2ZUWno0vluYC3XXCFCpa1sl9JcLB/KpnheLsvtF8PPqv1W7/U0HU9TI4seJfxPmO -EO8GqQKJ/+MMbpfg353bIdD0PghpbNjU5Db4g7ayNo+c7zo3Fn2/omnXO1ty0K+qP1xmk6wKImG2 -0qCZyFSTXai20b1dCl53lKItwIKOvMoDKjSuc/HUtQy9vmebVOvh+qBa7Dh+PsHMosdEMXXqP+UH -0quhJZb25uSgXTcYOWEAM11G1ADEtMo88aKjPvM6/2kwLkDd9p+cJsmWN63nOaK/6mnbVSKVUyqU -td+tFjiBdWbjxywbk5yqjKPK2Ww8F22c3HxT4CAnQzb5EuE8XL1mv6JpIzi4mWCZDlZTOpx+FIyw -Bm/xhnaQr/2v/pDGj59/i5IjnOcVdo/Vi5QTcmn7K2FjiO/mpF7moxdqWEfLcU8UC17IAggmosvp -r2uKGcfLFFb14dq12fy/czja+eevbqQ34gcnAgMBAAGjggMXMIIDEzASBgNVHRMBAf8ECDAGAQH/ -AgEBMDcGA1UdEgQwMC6CD3N1c2NlcnRlLmdvYi52ZaAbBgVghl4CAqASDBBSSUYtRy0yMDAwNDAz -Ni0wMB0GA1UdDgQWBBRBDxk4qpl/Qguk1yeYVKIXTC1RVDCCAVAGA1UdIwSCAUcwggFDgBStuyId -xuDSAaj9dlBSk+2YwU2u06GCASakggEiMIIBHjE+MDwGA1UEAxM1QXV0b3JpZGFkIGRlIENlcnRp -ZmljYWNpb24gUmFpeiBkZWwgRXN0YWRvIFZlbmV6b2xhbm8xCzAJBgNVBAYTAlZFMRAwDgYDVQQH -EwdDYXJhY2FzMRkwFwYDVQQIExBEaXN0cml0byBDYXBpdGFsMTYwNAYDVQQKEy1TaXN0ZW1hIE5h -Y2lvbmFsIGRlIENlcnRpZmljYWNpb24gRWxlY3Ryb25pY2ExQzBBBgNVBAsTOlN1cGVyaW50ZW5k -ZW5jaWEgZGUgU2VydmljaW9zIGRlIENlcnRpZmljYWNpb24gRWxlY3Ryb25pY2ExJTAjBgkqhkiG -9w0BCQEWFmFjcmFpekBzdXNjZXJ0ZS5nb2IudmWCAQowDgYDVR0PAQH/BAQDAgEGME0GA1UdEQRG -MESCDnByb2NlcnQubmV0LnZloBUGBWCGXgIBoAwMClBTQy0wMDAwMDKgGwYFYIZeAgKgEgwQUklG -LUotMzE2MzUzNzMtNzB2BgNVHR8EbzBtMEagRKBChkBodHRwOi8vd3d3LnN1c2NlcnRlLmdvYi52 -ZS9sY3IvQ0VSVElGSUNBRE8tUkFJWi1TSEEzODRDUkxERVIuY3JsMCOgIaAfhh1sZGFwOi8vYWNy -YWl6LnN1c2NlcnRlLmdvYi52ZTA3BggrBgEFBQcBAQQrMCkwJwYIKwYBBQUHMAGGG2h0dHA6Ly9v -Y3NwLnN1c2NlcnRlLmdvYi52ZTBBBgNVHSAEOjA4MDYGBmCGXgMBAjAsMCoGCCsGAQUFBwIBFh5o -dHRwOi8vd3d3LnN1c2NlcnRlLmdvYi52ZS9kcGMwDQYJKoZIhvcNAQELBQADggIBACtZ6yKZu4Sq -T96QxtGGcSOeSwORR3C7wJJg7ODU523G0+1ng3dS1fLld6c2suNUvtm7CpsR72H0xpkzmfWvADmN -g7+mvTV+LFwxNG9s2/NkAZiqlCxB3RWGymspThbASfzXg0gTB1GEMVKIu4YXx2sviiCtxQuPcD4q -uxtxj7mkoP3YldmvWb8lK5jpY5MvYB7Eqvh39YtsL+1+LrVPQA3uvFd359m21D+VJzog1eWuq2w1 -n8GhHVnchIHuTQfiSLaeS5UtQbHh6N5+LwUeaO6/u5BlOsju6rEYNxxik6SgMexxbJHmpHmJWhSn -FFAFTKQAVzAswbVhltw+HoSvOULP5dAssSS830DD7X9jSr3hTxJkhpXzsOfIt+FTvZLm8wyWuevo -5pLtp4EJFAv8lXrPj9Y0TzYS3F7RNHXGRoAvlQSMx4bEqCaJqD8Zm4G7UaRKhqsLEQ+xrmNTbSjq -3TNWOByyrYDT13K9mmyZY+gAu0F2BbdbmRiKw7gSXFbPVgx96OLP7bx0R/vu0xdOIk9W/1DzLuY5 -poLWccret9W6aAjtmcz9opLLabid+Qqkpj5PkygqYWwHJgD/ll9ohri4zspV4KuxPX+Y1zMOWj3Y -eMLEYC/HYvBhkdI4sPaeVdtAgAUSM84dkpvRabP/v/GSCmE1P93+hvS84Bpxs2Km ------END CERTIFICATE----- - -China Internet Network Information Center EV Certificates Root -============================================================== ------BEGIN CERTIFICATE----- -MIID9zCCAt+gAwIBAgIESJ8AATANBgkqhkiG9w0BAQUFADCBijELMAkGA1UEBhMCQ04xMjAwBgNV -BAoMKUNoaW5hIEludGVybmV0IE5ldHdvcmsgSW5mb3JtYXRpb24gQ2VudGVyMUcwRQYDVQQDDD5D -aGluYSBJbnRlcm5ldCBOZXR3b3JrIEluZm9ybWF0aW9uIENlbnRlciBFViBDZXJ0aWZpY2F0ZXMg -Um9vdDAeFw0xMDA4MzEwNzExMjVaFw0zMDA4MzEwNzExMjVaMIGKMQswCQYDVQQGEwJDTjEyMDAG -A1UECgwpQ2hpbmEgSW50ZXJuZXQgTmV0d29yayBJbmZvcm1hdGlvbiBDZW50ZXIxRzBFBgNVBAMM -PkNoaW5hIEludGVybmV0IE5ldHdvcmsgSW5mb3JtYXRpb24gQ2VudGVyIEVWIENlcnRpZmljYXRl -cyBSb290MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAm35z7r07eKpkQ0H1UN+U8i6y -jUqORlTSIRLIOTJCBumD1Z9S7eVnAztUwYyZmczpwA//DdmEEbK40ctb3B75aDFk4Zv6dOtouSCV -98YPjUesWgbdYavi7NifFy2cyjw1l1VxzUOFsUcW9SxTgHbP0wBkvUCZ3czY28Sf1hNfQYOL+Q2H -klY0bBoQCxfVWhyXWIQ8hBouXJE0bhlffxdpxWXvayHG1VA6v2G5BY3vbzQ6sm8UY78WO5upKv23 -KzhmBsUs4qpnHkWnjQRmQvaPK++IIGmPMowUc9orhpFjIpryp9vOiYurXccUwVswah+xt54ugQEC -7c+WXmPbqOY4twIDAQABo2MwYTAfBgNVHSMEGDAWgBR8cks5x8DbYqVPm6oYNJKiyoOCWTAPBgNV -HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUfHJLOcfA22KlT5uqGDSSosqD -glkwDQYJKoZIhvcNAQEFBQADggEBACrDx0M3j92tpLIM7twUbY8opJhJywyA6vPtI2Z1fcXTIWd5 -0XPFtQO3WKwMVC/GVhMPMdoG52U7HW8228gd+f2ABsqjPWYWqJ1MFn3AlUa1UeTiH9fqBk1jjZaM -7+czV0I664zBechNdn3e9rG3geCg+aF4RhcaVpjwTj2rHO3sOdwHSPdj/gauwqRcalsyiMXHM4Ws -ZkJHwlgkmeHlPuV1LI5D1l08eB6olYIpUNHRFrrvwb562bTYzB5MRuF3sTGrvSrIzo9uoV1/A3U0 -5K2JRVRevq4opbs/eHnrc7MKDf2+yfdWrPa37S+bISnHOLaVxATywy39FCqQmbkHzJ8= ------END CERTIFICATE----- - -Swisscom Root CA 2 -================== ------BEGIN CERTIFICATE----- -MIIF2TCCA8GgAwIBAgIQHp4o6Ejy5e/DfEoeWhhntjANBgkqhkiG9w0BAQsFADBkMQswCQYDVQQG -EwJjaDERMA8GA1UEChMIU3dpc3Njb20xJTAjBgNVBAsTHERpZ2l0YWwgQ2VydGlmaWNhdGUgU2Vy -dmljZXMxGzAZBgNVBAMTElN3aXNzY29tIFJvb3QgQ0EgMjAeFw0xMTA2MjQwODM4MTRaFw0zMTA2 -MjUwNzM4MTRaMGQxCzAJBgNVBAYTAmNoMREwDwYDVQQKEwhTd2lzc2NvbTElMCMGA1UECxMcRGln -aXRhbCBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczEbMBkGA1UEAxMSU3dpc3Njb20gUm9vdCBDQSAyMIIC -IjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAlUJOhJ1R5tMJ6HJaI2nbeHCOFvErjw0DzpPM -LgAIe6szjPTpQOYXTKueuEcUMncy3SgM3hhLX3af+Dk7/E6J2HzFZ++r0rk0X2s682Q2zsKwzxNo -ysjL67XiPS4h3+os1OD5cJZM/2pYmLcX5BtS5X4HAB1f2uY+lQS3aYg5oUFgJWFLlTloYhyxCwWJ -wDaCFCE/rtuh/bxvHGCGtlOUSbkrRsVPACu/obvLP+DHVxxX6NZp+MEkUp2IVd3Chy50I9AU/SpH -Wrumnf2U5NGKpV+GY3aFy6//SSj8gO1MedK75MDvAe5QQQg1I3ArqRa0jG6F6bYRzzHdUyYb3y1a -SgJA/MTAtukxGggo5WDDH8SQjhBiYEQN7Aq+VRhxLKX0srwVYv8c474d2h5Xszx+zYIdkeNL6yxS -NLCK/RJOlrDrcH+eOfdmQrGrrFLadkBXeyq96G4DsguAhYidDMfCd7Camlf0uPoTXGiTOmekl9Ab -mbeGMktg2M7v0Ax/lZ9vh0+Hio5fCHyqW/xavqGRn1V9TrALacywlKinh/LTSlDcX3KwFnUey7QY -Ypqwpzmqm59m2I2mbJYV4+by+PGDYmy7Velhk6M99bFXi08jsJvllGov34zflVEpYKELKeRcVVi3 -qPyZ7iVNTA6z00yPhOgpD/0QVAKFyPnlw4vP5w8CAwEAAaOBhjCBgzAOBgNVHQ8BAf8EBAMCAYYw -HQYDVR0hBBYwFDASBgdghXQBUwIBBgdghXQBUwIBMBIGA1UdEwEB/wQIMAYBAf8CAQcwHQYDVR0O -BBYEFE0mICKJS9PVpAqhb97iEoHF8TwuMB8GA1UdIwQYMBaAFE0mICKJS9PVpAqhb97iEoHF8Twu -MA0GCSqGSIb3DQEBCwUAA4ICAQAyCrKkG8t9voJXiblqf/P0wS4RfbgZPnm3qKhyN2abGu2sEzsO -v2LwnN+ee6FTSA5BesogpxcbtnjsQJHzQq0Qw1zv/2BZf82Fo4s9SBwlAjxnffUy6S8w5X2lejjQ -82YqZh6NM4OKb3xuqFp1mrjX2lhIREeoTPpMSQpKwhI3qEAMw8jh0FcNlzKVxzqfl9NX+Ave5XLz -o9v/tdhZsnPdTSpxsrpJ9csc1fV5yJmz/MFMdOO0vSk3FQQoHt5FRnDsr7p4DooqzgB53MBfGWcs -a0vvaGgLQ+OswWIJ76bdZWGgr4RVSJFSHMYlkSrQwSIjYVmvRRGFHQEkNI/Ps/8XciATwoCqISxx -OQ7Qj1zB09GOInJGTB2Wrk9xseEFKZZZ9LuedT3PDTcNYtsmjGOpI99nBjx8Oto0QuFmtEYE3saW -mA9LSHokMnWRn6z3aOkquVVlzl1h0ydw2Df+n7mvoC5Wt6NlUe07qxS/TFED6F+KBZvuim6c779o -+sjaC+NCydAXFJy3SuCvkychVSa1ZC+N8f+mQAWFBVzKBxlcCxMoTFh/wqXvRdpg065lYZ1Tg3TC -rvJcwhbtkj6EPnNgiLx29CzP0H1907he0ZESEOnN3col49XtmS++dYFLJPlFRpTJKSFTnCZFqhMX -5OfNeOI5wSsSnqaeG8XmDtkx2Q== ------END CERTIFICATE----- - -Swisscom Root EV CA 2 -===================== ------BEGIN CERTIFICATE----- -MIIF4DCCA8igAwIBAgIRAPL6ZOJ0Y9ON/RAdBB92ylgwDQYJKoZIhvcNAQELBQAwZzELMAkGA1UE -BhMCY2gxETAPBgNVBAoTCFN3aXNzY29tMSUwIwYDVQQLExxEaWdpdGFsIENlcnRpZmljYXRlIFNl -cnZpY2VzMR4wHAYDVQQDExVTd2lzc2NvbSBSb290IEVWIENBIDIwHhcNMTEwNjI0MDk0NTA4WhcN -MzEwNjI1MDg0NTA4WjBnMQswCQYDVQQGEwJjaDERMA8GA1UEChMIU3dpc3Njb20xJTAjBgNVBAsT -HERpZ2l0YWwgQ2VydGlmaWNhdGUgU2VydmljZXMxHjAcBgNVBAMTFVN3aXNzY29tIFJvb3QgRVYg -Q0EgMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMT3HS9X6lds93BdY7BxUglgRCgz -o3pOCvrY6myLURYaVa5UJsTMRQdBTxB5f3HSek4/OE6zAMaVylvNwSqD1ycfMQ4jFrclyxy0uYAy -Xhqdk/HoPGAsp15XGVhRXrwsVgu42O+LgrQ8uMIkqBPHoCE2G3pXKSinLr9xJZDzRINpUKTk4Rti -GZQJo/PDvO/0vezbE53PnUgJUmfANykRHvvSEaeFGHR55E+FFOtSN+KxRdjMDUN/rhPSays/p8Li -qG12W0OfvrSdsyaGOx9/5fLoZigWJdBLlzin5M8J0TbDC77aO0RYjb7xnglrPvMyxyuHxuxenPaH -Za0zKcQvidm5y8kDnftslFGXEBuGCxobP/YCfnvUxVFkKJ3106yDgYjTdLRZncHrYTNaRdHLOdAG -alNgHa/2+2m8atwBz735j9m9W8E6X47aD0upm50qKGsaCnw8qyIL5XctcfaCNYGu+HuB5ur+rPQa -m3Rc6I8k9l2dRsQs0h4rIWqDJ2dVSqTjyDKXZpBy2uPUZC5f46Fq9mDU5zXNysRojddxyNMkM3Ox -bPlq4SjbX8Y96L5V5jcb7STZDxmPX2MYWFCBUWVv8p9+agTnNCRxunZLWB4ZvRVgRaoMEkABnRDi -xzgHcgplwLa7JSnaFp6LNYth7eVxV4O1PHGf40+/fh6Bn0GXAgMBAAGjgYYwgYMwDgYDVR0PAQH/ -BAQDAgGGMB0GA1UdIQQWMBQwEgYHYIV0AVMCAgYHYIV0AVMCAjASBgNVHRMBAf8ECDAGAQH/AgED -MB0GA1UdDgQWBBRF2aWBbj2ITY1x0kbBbkUe88SAnTAfBgNVHSMEGDAWgBRF2aWBbj2ITY1x0kbB -bkUe88SAnTANBgkqhkiG9w0BAQsFAAOCAgEAlDpzBp9SSzBc1P6xXCX5145v9Ydkn+0UjrgEjihL -j6p7jjm02Vj2e6E1CqGdivdj5eu9OYLU43otb98TPLr+flaYC/NUn81ETm484T4VvwYmneTwkLbU -wp4wLh/vx3rEUMfqe9pQy3omywC0Wqu1kx+AiYQElY2NfwmTv9SoqORjbdlk5LgpWgi/UOGED1V7 -XwgiG/W9mR4U9s70WBCCswo9GcG/W6uqmdjyMb3lOGbcWAXH7WMaLgqXfIeTK7KK4/HsGOV1timH -59yLGn602MnTihdsfSlEvoqq9X46Lmgxk7lq2prg2+kupYTNHAq4Sgj5nPFhJpiTt3tm7JFe3VE/ -23MPrQRYCd0EApUKPtN236YQHoA96M2kZNEzx5LH4k5E4wnJTsJdhw4Snr8PyQUQ3nqjsTzyP6Wq -J3mtMX0f/fwZacXduT98zca0wjAefm6S139hdlqP65VNvBFuIXxZN5nQBrz5Bm0yFqXZaajh3DyA -HmBR3NdUIR7KYndP+tiPsys6DXhyyWhBWkdKwqPrGtcKqzwyVcgKEZzfdNbwQBUdyLmPtTbFr/gi -uMod89a2GQ+fYWVq6nTIfI/DT11lgh/ZDYnadXL77/FHZxOzyNEZiCcmmpl5fx7kLD977vHeTYuW -l8PVP3wbI+2ksx0WckNLIOFZfsLorSa/ovc= ------END CERTIFICATE----- - -CA Disig Root R1 -================ ------BEGIN CERTIFICATE----- -MIIFaTCCA1GgAwIBAgIJAMMDmu5QkG4oMA0GCSqGSIb3DQEBBQUAMFIxCzAJBgNVBAYTAlNLMRMw -EQYDVQQHEwpCcmF0aXNsYXZhMRMwEQYDVQQKEwpEaXNpZyBhLnMuMRkwFwYDVQQDExBDQSBEaXNp -ZyBSb290IFIxMB4XDTEyMDcxOTA5MDY1NloXDTQyMDcxOTA5MDY1NlowUjELMAkGA1UEBhMCU0sx -EzARBgNVBAcTCkJyYXRpc2xhdmExEzARBgNVBAoTCkRpc2lnIGEucy4xGTAXBgNVBAMTEENBIERp -c2lnIFJvb3QgUjEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCqw3j33Jijp1pedxiy -3QRkD2P9m5YJgNXoqqXinCaUOuiZc4yd39ffg/N4T0Dhf9Kn0uXKE5Pn7cZ3Xza1lK/oOI7bm+V8 -u8yN63Vz4STN5qctGS7Y1oprFOsIYgrY3LMATcMjfF9DCCMyEtztDK3AfQ+lekLZWnDZv6fXARz2 -m6uOt0qGeKAeVjGu74IKgEH3G8muqzIm1Cxr7X1r5OJeIgpFy4QxTaz+29FHuvlglzmxZcfe+5nk -CiKxLU3lSCZpq+Kq8/v8kiky6bM+TR8noc2OuRf7JT7JbvN32g0S9l3HuzYQ1VTW8+DiR0jm3hTa -YVKvJrT1cU/J19IG32PK/yHoWQbgCNWEFVP3Q+V8xaCJmGtzxmjOZd69fwX3se72V6FglcXM6pM6 -vpmumwKjrckWtc7dXpl4fho5frLABaTAgqWjR56M6ly2vGfb5ipN0gTco65F97yLnByn1tUD3AjL -LhbKXEAz6GfDLuemROoRRRw1ZS0eRWEkG4IupZ0zXWX4Qfkuy5Q/H6MMMSRE7cderVC6xkGbrPAX -ZcD4XW9boAo0PO7X6oifmPmvTiT6l7Jkdtqr9O3jw2Dv1fkCyC2fg69naQanMVXVz0tv/wQFx1is -XxYb5dKj6zHbHzMVTdDypVP1y+E9Tmgt2BLdqvLmTZtJ5cUoobqwWsagtQIDAQABo0IwQDAPBgNV -HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUiQq0OJMa5qvum5EY+fU8PjXQ -04IwDQYJKoZIhvcNAQEFBQADggIBADKL9p1Kyb4U5YysOMo6CdQbzoaz3evUuii+Eq5FLAR0rBNR -xVgYZk2C2tXck8An4b58n1KeElb21Zyp9HWc+jcSjxyT7Ff+Bw+r1RL3D65hXlaASfX8MPWbTx9B -LxyE04nH4toCdu0Jz2zBuByDHBb6lM19oMgY0sidbvW9adRtPTXoHqJPYNcHKfyyo6SdbhWSVhlM -CrDpfNIZTUJG7L399ldb3Zh+pE3McgODWF3vkzpBemOqfDqo9ayk0d2iLbYq/J8BjuIQscTK5Gfb -VSUZP/3oNn6z4eGBrxEWi1CXYBmCAMBrTXO40RMHPuq2MU/wQppt4hF05ZSsjYSVPCGvxdpHyN85 -YmLLW1AL14FABZyb7bq2ix4Eb5YgOe2kfSnbSM6C3NQCjR0EMVrHS/BsYVLXtFHCgWzN4funodKS -ds+xDzdYpPJScWc/DIh4gInByLUfkmO+p3qKViwaqKactV2zY9ATIKHrkWzQjX2v3wvkF7mGnjix -lAxYjOBVqjtjbZqJYLhkKpLGN/R+Q0O3c+gB53+XD9fyexn9GtePyfqFa3qdnom2piiZk4hA9z7N -UaPK6u95RyG1/jLix8NRb76AdPCkwzryT+lf3xkK8jsTQ6wxpLPn6/wY1gGp8yqPNg7rtLG8t0zJ -a7+h89n07eLw4+1knj0vllJPgFOL ------END CERTIFICATE----- - -CA Disig Root R2 -================ ------BEGIN CERTIFICATE----- -MIIFaTCCA1GgAwIBAgIJAJK4iNuwisFjMA0GCSqGSIb3DQEBCwUAMFIxCzAJBgNVBAYTAlNLMRMw -EQYDVQQHEwpCcmF0aXNsYXZhMRMwEQYDVQQKEwpEaXNpZyBhLnMuMRkwFwYDVQQDExBDQSBEaXNp -ZyBSb290IFIyMB4XDTEyMDcxOTA5MTUzMFoXDTQyMDcxOTA5MTUzMFowUjELMAkGA1UEBhMCU0sx -EzARBgNVBAcTCkJyYXRpc2xhdmExEzARBgNVBAoTCkRpc2lnIGEucy4xGTAXBgNVBAMTEENBIERp -c2lnIFJvb3QgUjIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCio8QACdaFXS1tFPbC -w3OeNcJxVX6B+6tGUODBfEl45qt5WDza/3wcn9iXAng+a0EE6UG9vgMsRfYvZNSrXaNHPWSb6Wia -xswbP7q+sos0Ai6YVRn8jG+qX9pMzk0DIaPY0jSTVpbLTAwAFjxfGs3Ix2ymrdMxp7zo5eFm1tL7 -A7RBZckQrg4FY8aAamkw/dLukO8NJ9+flXP04SXabBbeQTg06ov80egEFGEtQX6sx3dOy1FU+16S -GBsEWmjGycT6txOgmLcRK7fWV8x8nhfRyyX+hk4kLlYMeE2eARKmK6cBZW58Yh2EhN/qwGu1pSqV -g8NTEQxzHQuyRpDRQjrOQG6Vrf/GlK1ul4SOfW+eioANSW1z4nuSHsPzwfPrLgVv2RvPN3YEyLRa -5Beny912H9AZdugsBbPWnDTYltxhh5EF5EQIM8HauQhl1K6yNg3ruji6DOWbnuuNZt2Zz9aJQfYE -koopKW1rOhzndX0CcQ7zwOe9yxndnWCywmZgtrEE7snmhrmaZkCo5xHtgUUDi/ZnWejBBhG93c+A -Ak9lQHhcR1DIm+YfgXvkRKhbhZri3lrVx/k6RGZL5DJUfORsnLMOPReisjQS1n6yqEm70XooQL6i -Fh/f5DcfEXP7kAplQ6INfPgGAVUzfbANuPT1rqVCV3w2EYx7XsQDnYx5nQIDAQABo0IwQDAPBgNV -HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUtZn4r7CU9eMg1gqtzk5WpC5u -Qu0wDQYJKoZIhvcNAQELBQADggIBACYGXnDnZTPIgm7ZnBc6G3pmsgH2eDtpXi/q/075KMOYKmFM -tCQSin1tERT3nLXK5ryeJ45MGcipvXrA1zYObYVybqjGom32+nNjf7xueQgcnYqfGopTpti72TVV -sRHFqQOzVju5hJMiXn7B9hJSi+osZ7z+Nkz1uM/Rs0mSO9MpDpkblvdhuDvEK7Z4bLQjb/D907Je -dR+Zlais9trhxTF7+9FGs9K8Z7RiVLoJ92Owk6Ka+elSLotgEqv89WBW7xBci8QaQtyDW2QOy7W8 -1k/BfDxujRNt+3vrMNDcTa/F1balTFtxyegxvug4BkihGuLq0t4SOVga/4AOgnXmt8kHbA7v/zjx -mHHEt38OFdAlab0inSvtBfZGR6ztwPDUO+Ls7pZbkBNOHlY667DvlruWIxG68kOGdGSVyCh13x01 -utI3gzhTODY7z2zp+WsO0PsE6E9312UBeIYMej4hYvF/Y3EMyZ9E26gnonW+boE+18DrG5gPcFw0 -sorMwIUY6256s/daoQe/qUKS82Ail+QUoQebTnbAjn39pCXHR+3/H3OszMOl6W8KjptlwlCFtaOg -UxLMVYdh84GuEEZhvUQhuMI9dM9+JDX6HAcOmz0iyu8xL4ysEr3vQCj8KWefshNPZiTEUxnpHikV -7+ZtsH8tZ/3zbBt1RqPlShfppNcL ------END CERTIFICATE----- - -ACCVRAIZ1 -========= ------BEGIN CERTIFICATE----- -MIIH0zCCBbugAwIBAgIIXsO3pkN/pOAwDQYJKoZIhvcNAQEFBQAwQjESMBAGA1UEAwwJQUNDVlJB -SVoxMRAwDgYDVQQLDAdQS0lBQ0NWMQ0wCwYDVQQKDARBQ0NWMQswCQYDVQQGEwJFUzAeFw0xMTA1 -MDUwOTM3MzdaFw0zMDEyMzEwOTM3MzdaMEIxEjAQBgNVBAMMCUFDQ1ZSQUlaMTEQMA4GA1UECwwH -UEtJQUNDVjENMAsGA1UECgwEQUNDVjELMAkGA1UEBhMCRVMwggIiMA0GCSqGSIb3DQEBAQUAA4IC -DwAwggIKAoICAQCbqau/YUqXry+XZpp0X9DZlv3P4uRm7x8fRzPCRKPfmt4ftVTdFXxpNRFvu8gM -jmoYHtiP2Ra8EEg2XPBjs5BaXCQ316PWywlxufEBcoSwfdtNgM3802/J+Nq2DoLSRYWoG2ioPej0 -RGy9ocLLA76MPhMAhN9KSMDjIgro6TenGEyxCQ0jVn8ETdkXhBilyNpAlHPrzg5XPAOBOp0KoVdD -aaxXbXmQeOW1tDvYvEyNKKGno6e6Ak4l0Squ7a4DIrhrIA8wKFSVf+DuzgpmndFALW4ir50awQUZ -0m/A8p/4e7MCQvtQqR0tkw8jq8bBD5L/0KIV9VMJcRz/RROE5iZe+OCIHAr8Fraocwa48GOEAqDG -WuzndN9wrqODJerWx5eHk6fGioozl2A3ED6XPm4pFdahD9GILBKfb6qkxkLrQaLjlUPTAYVtjrs7 -8yM2x/474KElB0iryYl0/wiPgL/AlmXz7uxLaL2diMMxs0Dx6M/2OLuc5NF/1OVYm3z61PMOm3WR -5LpSLhl+0fXNWhn8ugb2+1KoS5kE3fj5tItQo05iifCHJPqDQsGH+tUtKSpacXpkatcnYGMN285J -9Y0fkIkyF/hzQ7jSWpOGYdbhdQrqeWZ2iE9x6wQl1gpaepPluUsXQA+xtrn13k/c4LOsOxFwYIRK -Q26ZIMApcQrAZQIDAQABo4ICyzCCAscwfQYIKwYBBQUHAQEEcTBvMEwGCCsGAQUFBzAChkBodHRw -Oi8vd3d3LmFjY3YuZXMvZmlsZWFkbWluL0FyY2hpdm9zL2NlcnRpZmljYWRvcy9yYWl6YWNjdjEu -Y3J0MB8GCCsGAQUFBzABhhNodHRwOi8vb2NzcC5hY2N2LmVzMB0GA1UdDgQWBBTSh7Tj3zcnk1X2 -VuqB5TbMjB4/vTAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFNKHtOPfNyeTVfZW6oHlNsyM -Hj+9MIIBcwYDVR0gBIIBajCCAWYwggFiBgRVHSAAMIIBWDCCASIGCCsGAQUFBwICMIIBFB6CARAA -QQB1AHQAbwByAGkAZABhAGQAIABkAGUAIABDAGUAcgB0AGkAZgBpAGMAYQBjAGkA8wBuACAAUgBh -AO0AegAgAGQAZQAgAGwAYQAgAEEAQwBDAFYAIAAoAEEAZwBlAG4AYwBpAGEAIABkAGUAIABUAGUA -YwBuAG8AbABvAGcA7QBhACAAeQAgAEMAZQByAHQAaQBmAGkAYwBhAGMAaQDzAG4AIABFAGwAZQBj -AHQAcgDzAG4AaQBjAGEALAAgAEMASQBGACAAUQA0ADYAMAAxADEANQA2AEUAKQAuACAAQwBQAFMA -IABlAG4AIABoAHQAdABwADoALwAvAHcAdwB3AC4AYQBjAGMAdgAuAGUAczAwBggrBgEFBQcCARYk -aHR0cDovL3d3dy5hY2N2LmVzL2xlZ2lzbGFjaW9uX2MuaHRtMFUGA1UdHwROMEwwSqBIoEaGRGh0 -dHA6Ly93d3cuYWNjdi5lcy9maWxlYWRtaW4vQXJjaGl2b3MvY2VydGlmaWNhZG9zL3JhaXphY2N2 -MV9kZXIuY3JsMA4GA1UdDwEB/wQEAwIBBjAXBgNVHREEEDAOgQxhY2N2QGFjY3YuZXMwDQYJKoZI -hvcNAQEFBQADggIBAJcxAp/n/UNnSEQU5CmH7UwoZtCPNdpNYbdKl02125DgBS4OxnnQ8pdpD70E -R9m+27Up2pvZrqmZ1dM8MJP1jaGo/AaNRPTKFpV8M9xii6g3+CfYCS0b78gUJyCpZET/LtZ1qmxN -YEAZSUNUY9rizLpm5U9EelvZaoErQNV/+QEnWCzI7UiRfD+mAM/EKXMRNt6GGT6d7hmKG9Ww7Y49 -nCrADdg9ZuM8Db3VlFzi4qc1GwQA9j9ajepDvV+JHanBsMyZ4k0ACtrJJ1vnE5Bc5PUzolVt3OAJ -TS+xJlsndQAJxGJ3KQhfnlmstn6tn1QwIgPBHnFk/vk4CpYY3QIUrCPLBhwepH2NDd4nQeit2hW3 -sCPdK6jT2iWH7ehVRE2I9DZ+hJp4rPcOVkkO1jMl1oRQQmwgEh0q1b688nCBpHBgvgW1m54ERL5h -I6zppSSMEYCUWqKiuUnSwdzRp+0xESyeGabu4VXhwOrPDYTkF7eifKXeVSUG7szAh1xA2syVP1Xg -Nce4hL60Xc16gwFy7ofmXx2utYXGJt/mwZrpHgJHnyqobalbz+xFd3+YJ5oyXSrjhO7FmGYvliAd -3djDJ9ew+f7Zfc3Qn48LFFhRny+Lwzgt3uiP1o2HpPVWQxaZLPSkVrQ0uGE3ycJYgBugl6H8WY3p -EfbRD0tVNEYqi4Y7 ------END CERTIFICATE----- - -TWCA Global Root CA -=================== ------BEGIN CERTIFICATE----- -MIIFQTCCAymgAwIBAgICDL4wDQYJKoZIhvcNAQELBQAwUTELMAkGA1UEBhMCVFcxEjAQBgNVBAoT -CVRBSVdBTi1DQTEQMA4GA1UECxMHUm9vdCBDQTEcMBoGA1UEAxMTVFdDQSBHbG9iYWwgUm9vdCBD -QTAeFw0xMjA2MjcwNjI4MzNaFw0zMDEyMzExNTU5NTlaMFExCzAJBgNVBAYTAlRXMRIwEAYDVQQK -EwlUQUlXQU4tQ0ExEDAOBgNVBAsTB1Jvb3QgQ0ExHDAaBgNVBAMTE1RXQ0EgR2xvYmFsIFJvb3Qg -Q0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCwBdvI64zEbooh745NnHEKH1Jw7W2C -nJfF10xORUnLQEK1EjRsGcJ0pDFfhQKX7EMzClPSnIyOt7h52yvVavKOZsTuKwEHktSz0ALfUPZV -r2YOy+BHYC8rMjk1Ujoog/h7FsYYuGLWRyWRzvAZEk2tY/XTP3VfKfChMBwqoJimFb3u/Rk28OKR -Q4/6ytYQJ0lM793B8YVwm8rqqFpD/G2Gb3PpN0Wp8DbHzIh1HrtsBv+baz4X7GGqcXzGHaL3SekV -tTzWoWH1EfcFbx39Eb7QMAfCKbAJTibc46KokWofwpFFiFzlmLhxpRUZyXx1EcxwdE8tmx2RRP1W -KKD+u4ZqyPpcC1jcxkt2yKsi2XMPpfRaAok/T54igu6idFMqPVMnaR1sjjIsZAAmY2E2TqNGtz99 -sy2sbZCilaLOz9qC5wc0GZbpuCGqKX6mOL6OKUohZnkfs8O1CWfe1tQHRvMq2uYiN2DLgbYPoA/p -yJV/v1WRBXrPPRXAb94JlAGD1zQbzECl8LibZ9WYkTunhHiVJqRaCPgrdLQABDzfuBSO6N+pjWxn -kjMdwLfS7JLIvgm/LCkFbwJrnu+8vyq8W8BQj0FwcYeyTbcEqYSjMq+u7msXi7Kx/mzhkIyIqJdI -zshNy/MGz19qCkKxHh53L46g5pIOBvwFItIm4TFRfTLcDwIDAQABoyMwITAOBgNVHQ8BAf8EBAMC -AQYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAgEAXzSBdu+WHdXltdkCY4QWwa6g -cFGn90xHNcgL1yg9iXHZqjNB6hQbbCEAwGxCGX6faVsgQt+i0trEfJdLjbDorMjupWkEmQqSpqsn -LhpNgb+E1HAerUf+/UqdM+DyucRFCCEK2mlpc3INvjT+lIutwx4116KD7+U4x6WFH6vPNOw/KP4M -8VeGTslV9xzU2KV9Bnpv1d8Q34FOIWWxtuEXeZVFBs5fzNxGiWNoRI2T9GRwoD2dKAXDOXC4Ynsg -/eTb6QihuJ49CcdP+yz4k3ZB3lLg4VfSnQO8d57+nile98FRYB/e2guyLXW3Q0iT5/Z5xoRdgFlg -lPx4mI88k1HtQJAH32RjJMtOcQWh15QaiDLxInQirqWm2BJpTGCjAu4r7NRjkgtevi92a6O2JryP -A9gK8kxkRr05YuWW6zRjESjMlfGt7+/cgFhI6Uu46mWs6fyAtbXIRfmswZ/ZuepiiI7E8UuDEq3m -i4TWnsLrgxifarsbJGAzcMzs9zLzXNl5fe+epP7JI8Mk7hWSsT2RTyaGvWZzJBPqpK5jwa19hAM8 -EHiGG3njxPPyBJUgriOCxLM6AGK/5jYk4Ve6xx6QddVfP5VhK8E7zeWzaGHQRiapIVJpLesux+t3 -zqY6tQMzT3bR51xUAV3LePTJDL/PEo4XLSNolOer/qmyKwbQBM0= ------END CERTIFICATE----- - -TeliaSonera Root CA v1 -====================== ------BEGIN CERTIFICATE----- -MIIFODCCAyCgAwIBAgIRAJW+FqD3LkbxezmCcvqLzZYwDQYJKoZIhvcNAQEFBQAwNzEUMBIGA1UE -CgwLVGVsaWFTb25lcmExHzAdBgNVBAMMFlRlbGlhU29uZXJhIFJvb3QgQ0EgdjEwHhcNMDcxMDE4 -MTIwMDUwWhcNMzIxMDE4MTIwMDUwWjA3MRQwEgYDVQQKDAtUZWxpYVNvbmVyYTEfMB0GA1UEAwwW -VGVsaWFTb25lcmEgUm9vdCBDQSB2MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMK+ -6yfwIaPzaSZVfp3FVRaRXP3vIb9TgHot0pGMYzHw7CTww6XScnwQbfQ3t+XmfHnqjLWCi65ItqwA -3GV17CpNX8GH9SBlK4GoRz6JI5UwFpB/6FcHSOcZrr9FZ7E3GwYq/t75rH2D+1665I+XZ75Ljo1k -B1c4VWk0Nj0TSO9P4tNmHqTPGrdeNjPUtAa9GAH9d4RQAEX1jF3oI7x+/jXh7VB7qTCNGdMJjmhn -Xb88lxhTuylixcpecsHHltTbLaC0H2kD7OriUPEMPPCs81Mt8Bz17Ww5OXOAFshSsCPN4D7c3TxH -oLs1iuKYaIu+5b9y7tL6pe0S7fyYGKkmdtwoSxAgHNN/Fnct7W+A90m7UwW7XWjH1Mh1Fj+JWov3 -F0fUTPHSiXk+TT2YqGHeOh7S+F4D4MHJHIzTjU3TlTazN19jY5szFPAtJmtTfImMMsJu7D0hADnJ -oWjiUIMusDor8zagrC/kb2HCUQk5PotTubtn2txTuXZZNp1D5SDgPTJghSJRt8czu90VL6R4pgd7 -gUY2BIbdeTXHlSw7sKMXNeVzH7RcWe/a6hBle3rQf5+ztCo3O3CLm1u5K7fsslESl1MpWtTwEhDc -TwK7EpIvYtQ/aUN8Ddb8WHUBiJ1YFkveupD/RwGJBmr2X7KQarMCpgKIv7NHfirZ1fpoeDVNAgMB -AAGjPzA9MA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1UdDgQWBBTwj1k4ALP1j5qW -DNXr+nuqF+gTEjANBgkqhkiG9w0BAQUFAAOCAgEAvuRcYk4k9AwI//DTDGjkk0kiP0Qnb7tt3oNm -zqjMDfz1mgbldxSR651Be5kqhOX//CHBXfDkH1e3damhXwIm/9fH907eT/j3HEbAek9ALCI18Bmx -0GtnLLCo4MBANzX2hFxc469CeP6nyQ1Q6g2EdvZR74NTxnr/DlZJLo961gzmJ1TjTQpgcmLNkQfW -pb/ImWvtxBnmq0wROMVvMeJuScg/doAmAyYp4Db29iBT4xdwNBedY2gea+zDTYa4EzAvXUYNR0PV -G6pZDrlcjQZIrXSHX8f8MVRBE+LHIQ6e4B4N4cB7Q4WQxYpYxmUKeFfyxiMPAdkgS94P+5KFdSpc -c41teyWRyu5FrgZLAMzTsVlQ2jqIOylDRl6XK1TOU2+NSueW+r9xDkKLfP0ooNBIytrEgUy7onOT -JsjrDNYmiLbAJM+7vVvrdX3pCI6GMyx5dwlppYn8s3CQh3aP0yK7Qs69cwsgJirQmz1wHiRszYd2 -qReWt88NkvuOGKmYSdGe/mBEciG5Ge3C9THxOUiIkCR1VBatzvT4aRRkOfujuLpwQMcnHL/EVlP6 -Y2XQ8xwOFvVrhlhNGNTkDY6lnVuR3HYkUD/GKvvZt5y11ubQ2egZixVxSK236thZiNSQvxaz2ems -WWFUyBy6ysHK4bkgTI86k4mloMy/0/Z1pHWWbVY= ------END CERTIFICATE----- - -E-Tugra Certification Authority -=============================== ------BEGIN CERTIFICATE----- -MIIGSzCCBDOgAwIBAgIIamg+nFGby1MwDQYJKoZIhvcNAQELBQAwgbIxCzAJBgNVBAYTAlRSMQ8w -DQYDVQQHDAZBbmthcmExQDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamls -ZXJpIHZlIEhpem1ldGxlcmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBN -ZXJrZXppMSgwJgYDVQQDDB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTEzMDMw -NTEyMDk0OFoXDTIzMDMwMzEyMDk0OFowgbIxCzAJBgNVBAYTAlRSMQ8wDQYDVQQHDAZBbmthcmEx -QDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamlsZXJpIHZlIEhpem1ldGxl -cmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBNZXJrZXppMSgwJgYDVQQD -DB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0BAQEFAAOCAg8A -MIICCgKCAgEA4vU/kwVRHoViVF56C/UYB4Oufq9899SKa6VjQzm5S/fDxmSJPZQuVIBSOTkHS0vd -hQd2h8y/L5VMzH2nPbxHD5hw+IyFHnSOkm0bQNGZDbt1bsipa5rAhDGvykPL6ys06I+XawGb1Q5K -CKpbknSFQ9OArqGIW66z6l7LFpp3RMih9lRozt6Plyu6W0ACDGQXwLWTzeHxE2bODHnv0ZEoq1+g -ElIwcxmOj+GMB6LDu0rw6h8VqO4lzKRG+Bsi77MOQ7osJLjFLFzUHPhdZL3Dk14opz8n8Y4e0ypQ -BaNV2cvnOVPAmJ6MVGKLJrD3fY185MaeZkJVgkfnsliNZvcHfC425lAcP9tDJMW/hkd5s3kc91r0 -E+xs+D/iWR+V7kI+ua2oMoVJl0b+SzGPWsutdEcf6ZG33ygEIqDUD13ieU/qbIWGvaimzuT6w+Gz -rt48Ue7LE3wBf4QOXVGUnhMMti6lTPk5cDZvlsouDERVxcr6XQKj39ZkjFqzAQqptQpHF//vkUAq -jqFGOjGY5RH8zLtJVor8udBhmm9lbObDyz51Sf6Pp+KJxWfXnUYTTjF2OySznhFlhqt/7x3U+Lzn -rFpct1pHXFXOVbQicVtbC/DP3KBhZOqp12gKY6fgDT+gr9Oq0n7vUaDmUStVkhUXU8u3Zg5mTPj5 -dUyQ5xJwx0UCAwEAAaNjMGEwHQYDVR0OBBYEFC7j27JJ0JxUeVz6Jyr+zE7S6E5UMA8GA1UdEwEB -/wQFMAMBAf8wHwYDVR0jBBgwFoAULuPbsknQnFR5XPonKv7MTtLoTlQwDgYDVR0PAQH/BAQDAgEG -MA0GCSqGSIb3DQEBCwUAA4ICAQAFNzr0TbdF4kV1JI+2d1LoHNgQk2Xz8lkGpD4eKexd0dCrfOAK -kEh47U6YA5n+KGCRHTAduGN8qOY1tfrTYXbm1gdLymmasoR6d5NFFxWfJNCYExL/u6Au/U5Mh/jO -XKqYGwXgAEZKgoClM4so3O0409/lPun++1ndYYRP0lSWE2ETPo+Aab6TR7U1Q9Jauz1c77NCR807 -VRMGsAnb/WP2OogKmW9+4c4bU2pEZiNRCHu8W1Ki/QY3OEBhj0qWuJA3+GbHeJAAFS6LrVE1Uweo -a2iu+U48BybNCAVwzDk/dr2l02cmAYamU9JgO3xDf1WKvJUawSg5TB9D0pH0clmKuVb8P7Sd2nCc -dlqMQ1DujjByTd//SffGqWfZbawCEeI6FiWnWAjLb1NBnEg4R2gz0dfHj9R0IdTDBZB6/86WiLEV -KV0jq9BgoRJP3vQXzTLlyb/IQ639Lo7xr+L0mPoSHyDYwKcMhcWQ9DstliaxLL5Mq+ux0orJ23gT -Dx4JnW2PAJ8C2sH6H3p6CcRK5ogql5+Ji/03X186zjhZhkuvcQu02PJwT58yE+Owp1fl2tpDy4Q0 -8ijE6m30Ku/Ba3ba+367hTzSU8JNvnHhRdH9I2cNE3X7z2VnIp2usAnRCf8dNL/+I5c30jn6PQ0G -C7TbO6Orb1wdtn7os4I07QZcJA== ------END CERTIFICATE----- - -T-TeleSec GlobalRoot Class 2 -============================ ------BEGIN CERTIFICATE----- -MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM -IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU -cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwHhcNMDgx -MDAxMTA0MDE0WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz -dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD -ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwggEiMA0GCSqGSIb3 -DQEBAQUAA4IBDwAwggEKAoIBAQCqX9obX+hzkeXaXPSi5kfl82hVYAUdAqSzm1nzHoqvNK38DcLZ -SBnuaY/JIPwhqgcZ7bBcrGXHX+0CfHt8LRvWurmAwhiCFoT6ZrAIxlQjgeTNuUk/9k9uN0goOA/F -vudocP05l03Sx5iRUKrERLMjfTlH6VJi1hKTXrcxlkIF+3anHqP1wvzpesVsqXFP6st4vGCvx970 -2cu+fjOlbpSD8DT6IavqjnKgP6TeMFvvhk1qlVtDRKgQFRzlAVfFmPHmBiiRqiDFt1MmUUOyCxGV -WOHAD3bZwI18gfNycJ5v/hqO2V81xrJvNHy+SE/iWjnX2J14np+GPgNeGYtEotXHAgMBAAGjQjBA -MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS/WSA2AHmgoCJrjNXy -YdK4LMuCSjANBgkqhkiG9w0BAQsFAAOCAQEAMQOiYQsfdOhyNsZt+U2e+iKo4YFWz827n+qrkRk4 -r6p8FU3ztqONpfSO9kSpp+ghla0+AGIWiPACuvxhI+YzmzB6azZie60EI4RYZeLbK4rnJVM3YlNf -vNoBYimipidx5joifsFvHZVwIEoHNN/q/xWA5brXethbdXwFeilHfkCoMRN3zUA7tFFHei4R40cR -3p1m0IvVVGb6g1XqfMIpiRvpb7PO4gWEyS8+eIVibslfwXhjdFjASBgMmTnrpMwatXlajRWc2BQN -9noHV8cigwUtPJslJj0Ys6lDfMjIq2SPDqO/nBudMNva0Bkuqjzx+zOAduTNrRlPBSeOE6Fuwg== ------END CERTIFICATE----- - -Atos TrustedRoot 2011 -===================== ------BEGIN CERTIFICATE----- -MIIDdzCCAl+gAwIBAgIIXDPLYixfszIwDQYJKoZIhvcNAQELBQAwPDEeMBwGA1UEAwwVQXRvcyBU -cnVzdGVkUm9vdCAyMDExMQ0wCwYDVQQKDARBdG9zMQswCQYDVQQGEwJERTAeFw0xMTA3MDcxNDU4 -MzBaFw0zMDEyMzEyMzU5NTlaMDwxHjAcBgNVBAMMFUF0b3MgVHJ1c3RlZFJvb3QgMjAxMTENMAsG -A1UECgwEQXRvczELMAkGA1UEBhMCREUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCV -hTuXbyo7LjvPpvMpNb7PGKw+qtn4TaA+Gke5vJrf8v7MPkfoepbCJI419KkM/IL9bcFyYie96mvr -54rMVD6QUM+A1JX76LWC1BTFtqlVJVfbsVD2sGBkWXppzwO3bw2+yj5vdHLqqjAqc2K+SZFhyBH+ -DgMq92og3AIVDV4VavzjgsG1xZ1kCWyjWZgHJ8cblithdHFsQ/H3NYkQ4J7sVaE3IqKHBAUsR320 -HLliKWYoyrfhk/WklAOZuXCFteZI6o1Q/NnezG8HDt0Lcp2AMBYHlT8oDv3FdU9T1nSatCQujgKR -z3bFmx5VdJx4IbHwLfELn8LVlhgf8FQieowHAgMBAAGjfTB7MB0GA1UdDgQWBBSnpQaxLKYJYO7R -l+lwrrw7GWzbITAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFKelBrEspglg7tGX6XCuvDsZ -bNshMBgGA1UdIAQRMA8wDQYLKwYBBAGwLQMEAQEwDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEB -CwUAA4IBAQAmdzTblEiGKkGdLD4GkGDEjKwLVLgfuXvTBznk+j57sj1O7Z8jvZfza1zv7v1Apt+h -k6EKhqzvINB5Ab149xnYJDE0BAGmuhWawyfc2E8PzBhj/5kPDpFrdRbhIfzYJsdHt6bPWHJxfrrh -TZVHO8mvbaG0weyJ9rQPOLXiZNwlz6bb65pcmaHFCN795trV1lpFDMS3wrUU77QR/w4VtfX128a9 -61qn8FYiqTxlVMYVqL2Gns2Dlmh6cYGJ4Qvh6hEbaAjMaZ7snkGeRDImeuKHCnE96+RapNLbxc3G -3mB/ufNPRJLvKrcYPqcZ2Qt9sTdBQrC6YB3y/gkRsPCHe6ed ------END CERTIFICATE----- \ No newline at end of file diff --git a/libraries/fof/download/adapter/curl.php b/libraries/fof/download/adapter/curl.php index 04260c8e00d2c..3f6af8f92c8f5 100644 --- a/libraries/fof/download/adapter/curl.php +++ b/libraries/fof/download/adapter/curl.php @@ -13,6 +13,8 @@ */ class FOFDownloadAdapterCurl extends FOFDownloadAdapterAbstract implements FOFDownloadInterface { + protected $headers = array(); + public function __construct() { $this->priority = 110; @@ -75,7 +77,8 @@ public function downloadAndReturn($url, $from = null, $to = null, array $params CURLOPT_BINARYTRANSFER => 1, CURLOPT_RETURNTRANSFER => 1, CURLOPT_FOLLOWLOCATION => 1, - CURLOPT_CAINFO => __DIR__ . '/cacert.pem' + CURLOPT_CAINFO => JPATH_LIBRARIES . 'joomla/http/transport/cacert.pem', + CURLOPT_HEADERFUNCTION => array($this, 'reponseHeaderCallback') ); if (!(empty($from) && empty($to))) @@ -89,6 +92,8 @@ public function downloadAndReturn($url, $from = null, $to = null, array $params @curl_setopt_array($ch, $options); + $this->headers = array(); + $result = curl_exec($ch); $errno = curl_errno($ch); @@ -99,7 +104,11 @@ public function downloadAndReturn($url, $from = null, $to = null, array $params { $error = JText::sprintf('LIB_FOF_DOWNLOAD_ERR_CURL_ERROR', $errno, $errmsg); } - elseif ($http_status > 299) + elseif (($http_status >= 300) && ($http_status <= 399) && isset($this->headers['Location']) && !empty($this->headers['Location'])) + { + return $this->downloadAndReturn($this->headers['Location'], $from, $to, $params); + } + elseif ($http_status > 399) { $result = false; $errno = $http_status; @@ -141,7 +150,7 @@ public function getFileSize($url) curl_setopt($ch, CURLOPT_HEADER, true ); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true ); @curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true ); - @curl_setopt($ch, CURLOPT_CAINFO, __DIR__ . '/cacert.pem'); + @curl_setopt($ch, CURLOPT_CAINFO, JPATH_LIBRARIES . 'joomla/http/transport/cacert.pem'); $data = curl_exec($ch); curl_close($ch); @@ -150,6 +159,7 @@ public function getFileSize($url) { $content_length = "unknown"; $status = "unknown"; + $redirection = null; if (preg_match( "/^HTTP\/1\.[01] (\d\d\d)/", $data, $matches)) { @@ -161,12 +171,56 @@ public function getFileSize($url) $content_length = (int)$matches[1]; } - if( $status == 200 || ($status > 300 && $status <= 308) ) + if (preg_match( "/Location: (.*)/", $data, $matches)) + { + $redirection = (int)$matches[1]; + } + + if ($status == 200) { $result = $content_length; } + + if (($status > 300) && ($status <= 308)) + { + if (!empty($redirection)) + { + return $this->getFileSize($redirection); + } + + return -1; + } } return $result; } + + /** + * Handles the HTTP headers returned by cURL + * + * @param resource $ch cURL resource handle (unused) + * @param string $data Each header line, as returned by the server + * + * @return int The length of the $data string + */ + protected function reponseHeaderCallback(&$ch, &$data) + { + $strlen = strlen($data); + + if (($strlen) <= 2) + { + return $strlen; + } + + if (substr($data, 0, 4) == 'HTTP') + { + return $strlen; + } + + list($header, $value) = explode(': ', trim($data), 2); + + $this->headers[$header] = $value; + + return $strlen; + } } \ No newline at end of file diff --git a/libraries/fof/download/adapter/fopen.php b/libraries/fof/download/adapter/fopen.php index 0fe035ab3abe8..ffbef825651da 100644 --- a/libraries/fof/download/adapter/fopen.php +++ b/libraries/fof/download/adapter/fopen.php @@ -81,7 +81,7 @@ public function downloadAndReturn($url, $from = null, $to = null, array $params ), 'ssl' => array( 'verify_peer' => true, - 'cafile' => __DIR__ . '/cacert.pem', + 'cafile' => JPATH_LIBRARIES . 'joomla/http/transport/cacert.pem', 'verify_depth' => 5, ) ); @@ -99,7 +99,7 @@ public function downloadAndReturn($url, $from = null, $to = null, array $params ), 'ssl' => array( 'verify_peer' => true, - 'cafile' => __DIR__ . '/cacert.pem', + 'cafile' => JPATH_LIBRARIES . 'joomla/http/transport/cacert.pem', 'verify_depth' => 5, ) ); diff --git a/libraries/fof/form/field/model.php b/libraries/fof/form/field/model.php index 81bfbb39d532a..53f0d8b7f89b6 100644 --- a/libraries/fof/form/field/model.php +++ b/libraries/fof/form/field/model.php @@ -187,7 +187,7 @@ protected function getOptions() if (!empty($nonePlaceholder)) { - $options[] = JHtml::_('select.option', JText::_($nonePlaceholder), null); + $options[] = JHtml::_('select.option', null, JText::_($nonePlaceholder)); } // Process field atrtibutes diff --git a/libraries/fof/form/field/tag.php b/libraries/fof/form/field/tag.php index 513eac7f10c21..17e8b6957151c 100644 --- a/libraries/fof/form/field/tag.php +++ b/libraries/fof/form/field/tag.php @@ -241,7 +241,7 @@ public function getRepeatable() $html .= ''; } - return '' . + return '' . $html . ''; } diff --git a/libraries/fof/form/header/model.php b/libraries/fof/form/header/model.php index ebce52d440442..de1a9981f483d 100644 --- a/libraries/fof/form/header/model.php +++ b/libraries/fof/form/header/model.php @@ -42,7 +42,7 @@ protected function getOptions() if (!empty($nonePlaceholder)) { - $options[] = JHtml::_('select.option', JText::_($nonePlaceholder), null); + $options[] = JHtml::_('select.option', null, JText::_($nonePlaceholder)); } // Process field atrtibutes diff --git a/libraries/fof/include.php b/libraries/fof/include.php index 17e3781fabe0f..3f07c4982356d 100644 --- a/libraries/fof/include.php +++ b/libraries/fof/include.php @@ -12,7 +12,7 @@ if (!defined('FOF_INCLUDED')) { - define('FOF_INCLUDED', '2.4.2'); + define('FOF_INCLUDED', '2.4.3'); // Register the FOF autoloader require_once __DIR__ . '/autoloader/fof.php'; diff --git a/libraries/fof/utils/array/array.php b/libraries/fof/utils/array/array.php index a57ed3a2ebe02..9f5b2808b382e 100644 --- a/libraries/fof/utils/array/array.php +++ b/libraries/fof/utils/array/array.php @@ -521,8 +521,8 @@ protected static function _sortObjects(&$a, &$b) $locale = self::$sortLocale[$i]; } - $va = $a->$key[$i]; - $vb = $b->$key[$i]; + $va = $a->{$key[$i]}; + $vb = $b->{$key[$i]}; if ((is_bool($va) || is_numeric($va)) && (is_bool($vb) || is_numeric($vb))) { diff --git a/libraries/fof/utils/installscript/installscript.php b/libraries/fof/utils/installscript/installscript.php index f17f9df91de8f..d97479cef2101 100644 --- a/libraries/fof/utils/installscript/installscript.php +++ b/libraries/fof/utils/installscript/installscript.php @@ -779,6 +779,76 @@ protected function bugfixCantBuildAdminMenus() } } } + + // Remove #__menu records for good measure! –– I think this is not necessary and causes the menu item to + // disappear on extension update. + /** + $query = $db->getQuery(true); + $query->select('id') + ->from('#__menu') + ->where($db->qn('type') . ' = ' . $db->q('component')) + ->where($db->qn('menutype') . ' = ' . $db->q('main')) + ->where($db->qn('link') . ' LIKE ' . $db->q('index.php?option=' . $this->componentName)); + $db->setQuery($query); + + try + { + $ids1 = $db->loadColumn(); + } + catch (Exception $exc) + { + $ids1 = array(); + } + + if (empty($ids1)) + { + $ids1 = array(); + } + + $query = $db->getQuery(true); + $query->select('id') + ->from('#__menu') + ->where($db->qn('type') . ' = ' . $db->q('component')) + ->where($db->qn('menutype') . ' = ' . $db->q('main')) + ->where($db->qn('link') . ' LIKE ' . $db->q('index.php?option=' . $this->componentName . '&%')); + $db->setQuery($query); + + try + { + $ids2 = $db->loadColumn(); + } + catch (Exception $exc) + { + $ids2 = array(); + } + + if (empty($ids2)) + { + $ids2 = array(); + } + + $ids = array_merge($ids1, $ids2); + + if (!empty($ids)) + { + foreach ($ids as $id) + { + $query = $db->getQuery(true); + $query->delete('#__menu') + ->where($db->qn('id') . ' = ' . $db->q($id)); + $db->setQuery($query); + + try + { + $db->execute(); + } + catch (Exception $exc) + { + // Nothing + } + } + } + /**/ } /** diff --git a/libraries/fof/version.txt b/libraries/fof/version.txt index a7d3e3ef2bbcb..71a2b24a23f6b 100644 --- a/libraries/fof/version.txt +++ b/libraries/fof/version.txt @@ -1,2 +1,2 @@ -2.4.2 -2015-03-02 16:26:53 \ No newline at end of file +2.4.3 +2015-04-22 13:15:32 \ No newline at end of file diff --git a/libraries/joomla/cache/controller/callback.php b/libraries/joomla/cache/controller/callback.php index d0e6cee34b578..c699359b44b56 100644 --- a/libraries/joomla/cache/controller/callback.php +++ b/libraries/joomla/cache/controller/callback.php @@ -141,7 +141,10 @@ public function get($callback, $args = array(), $id = false, $wrkarounds = false { $document = JFactory::getDocument(); $coptions['modulemode'] = 1; - $coptions['headerbefore'] = $document->getHeadData(); + if (method_exists($document, 'getHeadData')) + { + $coptions['headerbefore'] = $document->getHeadData(); + } } else { diff --git a/libraries/joomla/cache/controller/output.php b/libraries/joomla/cache/controller/output.php index 5122ee33a05d5..f6dbdfeb324b3 100644 --- a/libraries/joomla/cache/controller/output.php +++ b/libraries/joomla/cache/controller/output.php @@ -81,23 +81,21 @@ public function start($id, $group = null) return true; } - else + + // Nothing in cache... let's start the output buffer and start collecting data for next time. + if ($this->_locktest->locked == false) { - // Nothing in cache... let's start the output buffer and start collecting data for next time. - if ($this->_locktest->locked == false) - { - $this->_locktest = $this->cache->lock($id, $group); - } + $this->_locktest = $this->cache->lock($id, $group); + } - ob_start(); - ob_implicit_flush(false); + ob_start(); + ob_implicit_flush(false); - // Set id and group placeholders - $this->_id = $id; - $this->_group = $group; + // Set id and group placeholders + $this->_id = $id; + $this->_group = $group; - return false; - } + return false; } /** diff --git a/libraries/joomla/cache/storage/file.php b/libraries/joomla/cache/storage/file.php index 1aa32409cdabf..98cc64b14c664 100644 --- a/libraries/joomla/cache/storage/file.php +++ b/libraries/joomla/cache/storage/file.php @@ -53,7 +53,6 @@ public function __construct($options = array()) public function get($id, $group, $checkTime = true) { $data = false; - $path = $this->_getFilePath($id, $group); if ($checkTime == false || ($checkTime == true && $this->_checkExpire($id, $group) === true)) @@ -88,14 +87,14 @@ public function getAll() { parent::getAll(); - $path = $this->_root; + $path = $this->_root; $folders = $this->_folders($path); - $data = array(); + $data = array(); foreach ($folders as $folder) { $files = $this->_filesInFolder($path . '/' . $folder); - $item = new JCacheStorageHelper($folder); + $item = new JCacheStorageHelper($folder); foreach ($files as $file) { @@ -122,8 +121,8 @@ public function getAll() public function store($id, $group, $data) { $written = false; - $path = $this->_getFilePath($id, $group); - $die = '#x#'; + $path = $this->_getFilePath($id, $group); + $die = '#x#'; // Prepend a die string $data = $die . $data; @@ -194,7 +193,7 @@ public function clean($group, $mode = null) switch ($mode) { - case 'notgroup': + case 'notgroup' : $folders = $this->_folders($this->_root); for ($i = 0, $n = count($folders); $i < $n; $i++) @@ -205,8 +204,8 @@ public function clean($group, $mode = null) } } break; - case 'group': - default: + case 'group' : + default : if (is_dir($this->_root . '/' . $folder)) { $return = $this->_deleteFolder($this->_root . '/' . $folder); @@ -274,9 +273,8 @@ public function lock($id, $group, $locktime) $returning = new stdClass; $returning->locklooped = false; - $looptime = $locktime * 10; - $path = $this->_getFilePath($id, $group); - + $looptime = $locktime * 10; + $path = $this->_getFilePath($id, $group); $_fileopen = @fopen($path, "r+b"); if ($_fileopen) @@ -298,7 +296,7 @@ public function lock($id, $group, $locktime) { if ($lock_counter > $looptime) { - $returning->locked = false; + $returning->locked = false; $returning->locklooped = true; break; } @@ -326,8 +324,7 @@ public function lock($id, $group, $locktime) */ public function unlock($id, $group = null) { - $path = $this->_getFilePath($id, $group); - + $path = $this->_getFilePath($id, $group); $_fileopen = @fopen($path, "r+b"); if ($_fileopen) @@ -335,6 +332,11 @@ public function unlock($id, $group = null) $ret = @flock($_fileopen, LOCK_UN); @fclose($_fileopen); } + else + { + // Expect true if $_fileopen is false. Ref: http://issues.joomla.org/tracker/joomla-cms/2535 + $ret = true; + } return $ret; } @@ -384,14 +386,14 @@ protected function _checkExpire($id, $group) protected function _getFilePath($id, $group) { $name = $this->_getCacheId($id, $group); - $dir = $this->_root . '/' . $group; + $dir = $this->_root . '/' . $group; // If the folder doesn't exist try to create it if (!is_dir($dir)) { // Make sure the index file is there $indexFile = $dir . '/index.html'; - @ mkdir($dir) && file_put_contents($indexFile, ''); + @mkdir($dir) && file_put_contents($indexFile, ''); } // Make sure the folder exists @@ -495,6 +497,7 @@ protected function _deleteFolder($path) else { JLog::add('JCacheStorageFile::_deleteFolder' . JText::sprintf('JLIB_FILESYSTEM_ERROR_FOLDER_DELETE', $path), JLog::WARNING, 'jerror'); + $ret = false; } @@ -579,7 +582,7 @@ protected function _filesInFolder($path, $filter = '.', $recurse = false, $fullp { if (($file != '.') && ($file != '..') && (!in_array($file, $exclude)) && (!$excludefilter || !preg_match($excludefilter, $file))) { - $dir = $path . '/' . $file; + $dir = $path . '/' . $file; $isDir = is_dir($dir); if ($isDir) @@ -671,7 +674,7 @@ protected function _folders($path, $filter = '.', $recurse = false, $fullpath = && (!in_array($file, $exclude)) && (empty($excludefilter_string) || !preg_match($excludefilter_string, $file))) { - $dir = $path . '/' . $file; + $dir = $path . '/' . $file; $isDir = is_dir($dir); if ($isDir) diff --git a/libraries/joomla/database/driver.php b/libraries/joomla/database/driver.php index 8f24b1542f640..7e005a3a28d0e 100644 --- a/libraries/joomla/database/driver.php +++ b/libraries/joomla/database/driver.php @@ -255,6 +255,45 @@ public static function getInstance($options = array()) $options['database'] = (isset($options['database'])) ? $options['database'] : null; $options['select'] = (isset($options['select'])) ? $options['select'] : true; + // If the selected driver is `mysql` and we are on PHP 7 or greater, switch to the `mysqli` driver. + if ($options['driver'] == 'mysql' && PHP_MAJOR_VERSION >= 7) + { + // Check if we have support for the other MySQL drivers + $mysqliSupported = JDatabaseDriverMysqli::isSupported(); + $pdoMysqlSupported = JDatabaseDriverPdomysql::isSupported(); + + // If neither is supported, then the user cannot use MySQL; throw an exception + if (!$mysqliSupported && !$pdoMysqlSupported) + { + throw new RuntimeException( + 'The PHP `ext/mysql` extension is removed in PHP 7, cannot use the `mysql` driver.' + . ' Also, this system does not support MySQLi or PDO MySQL. Cannot instantiate database driver.' + ); + } + + // Prefer MySQLi as it is a closer replacement for the removed MySQL driver, otherwise use the PDO driver + if ($mysqliSupported) + { + JLog::add( + 'The PHP `ext/mysql` extension is removed in PHP 7, cannot use the `mysql` driver. Trying `mysqli` instead.', + JLog::WARNING, + 'deprecated' + ); + + $options['driver'] = 'mysqli'; + } + else + { + JLog::add( + 'The PHP `ext/mysql` extension is removed in PHP 7, cannot use the `mysql` driver. Trying `pdomysql` instead.', + JLog::WARNING, + 'deprecated' + ); + + $options['driver'] = 'pdomysql'; + } + } + // Get the options signature for the database connector. $signature = md5(serialize($options)); diff --git a/libraries/joomla/database/driver/mysql.php b/libraries/joomla/database/driver/mysql.php index dfc9fdb664f7d..33e2e2b897320 100644 --- a/libraries/joomla/database/driver/mysql.php +++ b/libraries/joomla/database/driver/mysql.php @@ -35,6 +35,14 @@ class JDatabaseDriverMysql extends JDatabaseDriverMysqli */ public function __construct($options) { + // PHP's `mysql` extension is not present in PHP 7, block instantiation in this environment + if (PHP_MAJOR_VERSION >= 7) + { + throw new RuntimeException( + 'This driver is unsupported in PHP 7, please use the MySQLi or PDO MySQL driver instead.' + ); + } + // Get some basic values from the options. $options['host'] = (isset($options['host'])) ? $options['host'] : 'localhost'; $options['user'] = (isset($options['user'])) ? $options['user'] : 'root'; @@ -72,7 +80,7 @@ public function connect() } // Make sure the MySQL extension for PHP is installed and enabled. - if (!function_exists('mysql_connect')) + if (!self::isSupported()) { throw new RuntimeException('Could not connect to MySQL.'); } @@ -317,7 +325,7 @@ public function execute() catch (RuntimeException $e) { // Throw the normal query exception. - JLog::add(JText::sprintf('JLIB_DATABASE_QUERY_FAILED', $this->errorNum, $this->errorMsg), JLog::ERROR, 'databasequery'); + JLog::add(JText::sprintf('JLIB_DATABASE_QUERY_FAILED', $this->errorNum, $this->errorMsg), JLog::ERROR, 'database-error'); throw new RuntimeException($this->errorMsg, $this->errorNum); } @@ -328,7 +336,7 @@ public function execute() else { // Throw the normal query exception. - JLog::add(JText::sprintf('JLIB_DATABASE_QUERY_FAILED', $this->errorNum, $this->errorMsg), JLog::ERROR, 'databasequery'); + JLog::add(JText::sprintf('JLIB_DATABASE_QUERY_FAILED', $this->errorNum, $this->errorMsg), JLog::ERROR, 'database-error'); throw new RuntimeException($this->errorMsg, $this->errorNum); } } diff --git a/libraries/joomla/database/driver/mysqli.php b/libraries/joomla/database/driver/mysqli.php index e3fa8a0cf9c6a..0424496b1ec6b 100644 --- a/libraries/joomla/database/driver/mysqli.php +++ b/libraries/joomla/database/driver/mysqli.php @@ -596,7 +596,7 @@ public function execute() // If connect fails, ignore that exception and throw the normal exception. catch (RuntimeException $e) { - JLog::add(JText::sprintf('JLIB_DATABASE_QUERY_FAILED', $this->errorNum, $this->errorMsg), JLog::ERROR, 'databasequery'); + JLog::add(JText::sprintf('JLIB_DATABASE_QUERY_FAILED', $this->errorNum, $this->errorMsg), JLog::ERROR, 'database-error'); throw new RuntimeException($this->errorMsg, $this->errorNum); } @@ -606,7 +606,7 @@ public function execute() // The server was not disconnected. else { - JLog::add(JText::sprintf('JLIB_DATABASE_QUERY_FAILED', $this->errorNum, $this->errorMsg), JLog::ERROR, 'databasequery'); + JLog::add(JText::sprintf('JLIB_DATABASE_QUERY_FAILED', $this->errorNum, $this->errorMsg), JLog::ERROR, 'database-error'); throw new RuntimeException($this->errorMsg, $this->errorNum); } } diff --git a/libraries/joomla/database/driver/pdo.php b/libraries/joomla/database/driver/pdo.php index 0bd7a717b2661..588850b06d80a 100644 --- a/libraries/joomla/database/driver/pdo.php +++ b/libraries/joomla/database/driver/pdo.php @@ -450,7 +450,7 @@ public function execute() $this->errorMsg = (string) 'SQL: ' . implode(", ", $this->connection->errorInfo()); // Throw the normal query exception. - JLog::add(JText::sprintf('JLIB_DATABASE_QUERY_FAILED', $this->errorNum, $this->errorMsg), JLog::ERROR, 'databasequery'); + JLog::add(JText::sprintf('JLIB_DATABASE_QUERY_FAILED', $this->errorNum, $this->errorMsg), JLog::ERROR, 'database-error'); throw new RuntimeException($this->errorMsg, $this->errorNum); } @@ -465,7 +465,7 @@ public function execute() $this->errorMsg = $errorMsg; // Throw the normal query exception. - JLog::add(JText::sprintf('JLIB_DATABASE_QUERY_FAILED', $this->errorNum, $this->errorMsg), JLog::ERROR, 'databasequery'); + JLog::add(JText::sprintf('JLIB_DATABASE_QUERY_FAILED', $this->errorNum, $this->errorMsg), JLog::ERROR, 'database-error'); throw new RuntimeException($this->errorMsg, $this->errorNum); } } @@ -699,11 +699,14 @@ public function setQuery($query, $offset = null, $limit = null, $driverOptions = $query->setLimit($limit, $offset); } - $query = $this->replacePrefix((string) $query); + // Create a stringified version of the query (with prefixes replaced): + $sql = $this->replacePrefix((string) $query); - $this->prepared = $this->connection->prepare($query, $driverOptions); + // Use the stringified version in the prepare call: + $this->prepared = $this->connection->prepare($sql, $driverOptions); - // Store reference to the JDatabaseQuery instance: + // Store reference to the original JDatabaseQuery instance within the class. + // This is important since binding variables depends on it within execute(): parent::setQuery($query, $offset, $limit); return $this; diff --git a/libraries/joomla/database/driver/postgresql.php b/libraries/joomla/database/driver/postgresql.php index 67bc47b6076d2..1da95b5816346 100644 --- a/libraries/joomla/database/driver/postgresql.php +++ b/libraries/joomla/database/driver/postgresql.php @@ -707,7 +707,7 @@ public function execute() $this->errorMsg = pg_last_error($this->connection) . "SQL=" . $query; // Throw the normal query exception. - JLog::add(JText::sprintf('JLIB_DATABASE_QUERY_FAILED', $this->errorNum, $this->errorMsg), JLog::ERROR, 'databasequery'); + JLog::add(JText::sprintf('JLIB_DATABASE_QUERY_FAILED', $this->errorNum, $this->errorMsg), JLog::ERROR, 'database-error'); throw new RuntimeException($this->errorMsg); } @@ -722,7 +722,7 @@ public function execute() $this->errorMsg = pg_last_error($this->connection) . "SQL=" . $query; // Throw the normal query exception. - JLog::add(JText::sprintf('JLIB_DATABASE_QUERY_FAILED', $this->errorNum, $this->errorMsg), JLog::ERROR, 'databasequery'); + JLog::add(JText::sprintf('JLIB_DATABASE_QUERY_FAILED', $this->errorNum, $this->errorMsg), JLog::ERROR, 'database-error'); throw new RuntimeException($this->errorMsg); } } diff --git a/libraries/joomla/database/driver/sqlsrv.php b/libraries/joomla/database/driver/sqlsrv.php index 4a6664726b65d..8ba5d02c7a631 100644 --- a/libraries/joomla/database/driver/sqlsrv.php +++ b/libraries/joomla/database/driver/sqlsrv.php @@ -647,7 +647,7 @@ public function execute() $this->errorMsg = $errors[0]['message'] . 'SQL=' . $query; // Throw the normal query exception. - JLog::add(JText::sprintf('JLIB_DATABASE_QUERY_FAILED', $this->errorNum, $this->errorMsg), JLog::ERROR, 'databasequery'); + JLog::add(JText::sprintf('JLIB_DATABASE_QUERY_FAILED', $this->errorNum, $this->errorMsg), JLog::ERROR, 'database-error'); throw new RuntimeException($this->errorMsg, $this->errorNum); } @@ -663,7 +663,7 @@ public function execute() $this->errorMsg = $errors[0]['message'] . 'SQL=' . $query; // Throw the normal query exception. - JLog::add(JText::sprintf('JLIB_DATABASE_QUERY_FAILED', $this->errorNum, $this->errorMsg), JLog::ERROR, 'databasequery'); + JLog::add(JText::sprintf('JLIB_DATABASE_QUERY_FAILED', $this->errorNum, $this->errorMsg), JLog::ERROR, 'database-error'); throw new RuntimeException($this->errorMsg, $this->errorNum); } } diff --git a/libraries/joomla/database/importer.php b/libraries/joomla/database/importer.php index 5f815c02c6843..a46e471f46dc7 100644 --- a/libraries/joomla/database/importer.php +++ b/libraries/joomla/database/importer.php @@ -161,7 +161,7 @@ protected function getRealTableName($table) * @since 13.1 * @throws RuntimeException on error. */ - protected function mergeStructure() + public function mergeStructure() { $prefix = $this->db->getPrefix(); $tables = $this->db->getTableList(); diff --git a/libraries/joomla/database/query/sqlsrv.php b/libraries/joomla/database/query/sqlsrv.php index 46ff6ddaf056c..0454c877b1bdf 100644 --- a/libraries/joomla/database/query/sqlsrv.php +++ b/libraries/joomla/database/query/sqlsrv.php @@ -331,6 +331,7 @@ public function processLimit($query, $limit, $offset = 0) $rowNumberText = ', ROW_NUMBER() OVER (' . $orderBy . ') AS RowNumber FROM '; $query = preg_replace('/\sFROM\s/i', $rowNumberText, $query, 1); + $query = 'SELECT * FROM (' . $query . ') A WHERE A.RowNumber BETWEEN ' . $start . ' AND ' . $end; return $query; } diff --git a/libraries/joomla/document/document.php b/libraries/joomla/document/document.php index c05aaba0c1ef0..def8a4f227320 100644 --- a/libraries/joomla/document/document.php +++ b/libraries/joomla/document/document.php @@ -390,8 +390,6 @@ public function setBuffer($content, $options = array()) */ public function getMetaData($name, $httpEquiv = false) { - $name = strtolower($name); - if ($name == 'generator') { $result = $this->getGenerator(); @@ -428,8 +426,6 @@ public function getMetaData($name, $httpEquiv = false) */ public function setMetaData($name, $content, $http_equiv = false) { - $name = strtolower($name); - if ($name == 'generator') { $this->setGenerator($content); diff --git a/libraries/joomla/feed/factory.php b/libraries/joomla/feed/factory.php index fa9b1c2828187..252fa9a0eda85 100644 --- a/libraries/joomla/feed/factory.php +++ b/libraries/joomla/feed/factory.php @@ -64,12 +64,13 @@ public function getFeed($uri) try { // Skip ahead to the root node. - do + while ($reader->read()) { - $reader->read(); + if ($reader->nodeType == XMLReader::ELEMENT) + { + break; + } } - - while ($reader->nodeType !== XMLReader::ELEMENT); } catch (Exception $e) { diff --git a/libraries/joomla/filesystem/file.php b/libraries/joomla/filesystem/file.php index cc14b9c69109d..0480e26a02b05 100644 --- a/libraries/joomla/filesystem/file.php +++ b/libraries/joomla/filesystem/file.php @@ -249,7 +249,9 @@ public static function move($src, $dest, $path = '', $use_streams = false) // Check src path if (!is_readable($src)) { - return JText::_('JLIB_FILESYSTEM_CANNOT_FIND_SOURCE_FILE'); + JLog::add(JText::_('JLIB_FILESYSTEM_CANNOT_FIND_SOURCE_FILE'), JLog::WARNING, 'jerror'); + + return false; } if ($use_streams) diff --git a/libraries/joomla/filesystem/meta/language/en-GB/en-GB.lib_joomla_filesystem_patcher.ini b/libraries/joomla/filesystem/meta/language/en-GB/en-GB.lib_joomla_filesystem_patcher.ini index 86430b51fc43a..a44704a44503d 100644 --- a/libraries/joomla/filesystem/meta/language/en-GB/en-GB.lib_joomla_filesystem_patcher.ini +++ b/libraries/joomla/filesystem/meta/language/en-GB/en-GB.lib_joomla_filesystem_patcher.ini @@ -1,7 +1,7 @@ ; Joomla! Project ; Copyright (C) 2005 - 2015 Open Source Matters. All rights reserved. ; 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 - No BOM +; Note : All ini files need to be saved as UTF-8 JLIB_FILESYSTEM_PATCHER_FAILED_VERIFY="Failed source verification of file %s at line %d" JLIB_FILESYSTEM_PATCHER_INVALID_DIFF="Invalid unified diff block" diff --git a/libraries/joomla/filter/input.php b/libraries/joomla/filter/input.php index 17a663049a5f8..821055051d22a 100644 --- a/libraries/joomla/filter/input.php +++ b/libraries/joomla/filter/input.php @@ -257,8 +257,8 @@ public function clean($source, $type = 'string') case 'TRIM': $result = (string) trim($source); - $result = trim($result, chr(0xE3) . chr(0x80) . chr(0x80)); - $result = trim($result, chr(0xC2) . chr(0xA0)); + $result = JString::trim($result, chr(0xE3) . chr(0x80) . chr(0x80)); + $result = JString::trim($result, chr(0xC2) . chr(0xA0)); break; case 'USERNAME': @@ -327,7 +327,6 @@ public static function checkAttribute($attrSubSet) * Checks an uploaded for suspicious naming and potential PHP contents which could indicate a hacking attempt. * * The options you can define are: - * * null_byte Prevent files with a null byte in their name (buffer overflow attack) * forbidden_extensions Do not allow these strings anywhere in the file's extension * php_tag_in_content Do not allow $value) + // This is a nested descriptor. We have to recurse. + if (!self::isSafeFile($fileDescriptor, $options)) { - $files[] = array( - 'name' => $descriptor['name'][$key], - 'type' => $descriptor['type'][$key], - 'tmp_name' => $descriptor['tmp_name'][$key], - 'error' => $descriptor['error'][$key], - 'size' => $descriptor['size'][$key], - ); + return false; } + + continue; } - else + + $tempNames = $fileDescriptor['tmp_name']; + $intendedNames = $fileDescriptor['name']; + + if (!is_array($tempNames)) { - $files[] = $descriptor; + $tempNames = array($tempNames); } - // Scan each file in the descriptor - foreach ($files as $fileDescriptor) + if (!is_array($intendedNames)) { - $tempNames = $fileDescriptor['tmp_name']; - $intendedNames = $fileDescriptor['name']; + $intendedNames = array($intendedNames); + } - if (!is_array($tempNames)) - { - $tempNames = array($tempNames); - } + $len = count($tempNames); + + for ($i = 0; $i < $len; $i++) + { + $tempName = array_shift($tempNames); + $intendedName = array_shift($intendedNames); - if (!is_array($intendedNames)) + // 1. Null byte check + if ($options['null_byte']) { - $intendedNames = array($intendedNames); + if (strstr($intendedName, "\x00")) + { + return false; + } } - $len = count($tempNames); - - for ($i = 0; $i < $len; $i++) + // 2. PHP-in-extension check (.php, .php.xxx[.yyy[.zzz[...]]], .xxx[.yyy[.zzz[...]]].php) + if (!empty($options['forbidden_extensions'])) { - $tempName = array_shift($tempNames); - $intendedName = array_shift($intendedNames); - - // 1. Null byte check - if ($options['null_byte']) + $explodedName = explode('.', $intendedName); + array_reverse($explodedName); + array_pop($explodedName); + array_map('strtolower', $explodedName); + + /* + * DO NOT USE array_intersect HERE! array_intersect expects the two arrays to + * be set, i.e. they should have unique values. + */ + foreach ($options['forbidden_extensions'] as $ext) { - if (strstr($intendedName, "\x00")) + if (in_array($ext, $explodedName)) { return false; } } + } + + // 3. File contents scanner (PHP tag in file contents) + if ($options['php_tag_in_content'] || $options['shorttag_in_content'] + || ($options['fobidden_ext_in_content'] && !empty($options['forbidden_extensions']))) + { + $fp = @fopen($tempName, 'r'); - // 2. PHP-in-extension check (.php, .php.xxx[.yyy[.zzz[...]]], .xxx[.yyy[.zzz[...]]].php) - if (!empty($options['forbidden_extensions'])) + if ($fp !== false) { - $explodedName = explode('.', $intendedName); - array_reverse($explodedName); - array_pop($explodedName); - array_map('strtolower', $explodedName); - - /* - * DO NOT USE array_intersect HERE! array_intersect expects the two arrays to - * be set, i.e. they should have unique values. - */ - foreach ($options['forbidden_extensions'] as $ext) + $data = ''; + + while (!feof($fp)) { - if (in_array($ext, $explodedName)) + $buffer = @fread($fp, 131072); + $data .= $buffer; + + if ($options['php_tag_in_content'] && strstr($buffer, ' $v) + { + $result[$k] = self::decodeFileData(array($data[0][$k], $data[1][$k], $data[2][$k], $data[3][$k], $data[4][$k])); + } + + return $result; + } + + return array('name' => $data[0], 'type' => $data[1], 'tmp_name' => $data[2], 'error' => $data[3], 'size' => $data[4]); + } + /** * Internal method to iteratively remove all unwanted tags and attributes * diff --git a/libraries/joomla/form/field.php b/libraries/joomla/form/field.php index f19115c8628ef..f6aad9ef8253c 100644 --- a/libraries/joomla/form/field.php +++ b/libraries/joomla/form/field.php @@ -913,6 +913,7 @@ public function renderField($options = array()) $showon = explode(':', $showon, 2); $options['class'] .= ' showon_' . implode(' showon_', explode(',', $showon[1])); $id = $this->getName($showon[0]); + $id = $this->multiple ? str_replace('[]', '', $id) : $id; $options['rel'] = ' rel="showon_' . $id . '"'; $options['showonEnabled'] = true; } diff --git a/libraries/joomla/form/fields/repeatable.php b/libraries/joomla/form/fields/repeatable.php index 785de3d822203..e1f39141e863e 100644 --- a/libraries/joomla/form/fields/repeatable.php +++ b/libraries/joomla/form/fields/repeatable.php @@ -99,7 +99,7 @@ protected function getInput() // Button for display the modal window $select = (string) $this->element['select'] ? JText::_((string) $this->element['select']) : JText::_('JLIB_FORM_BUTTON_SELECT'); - $icon = $this->element['icon'] ? ' ' : ''; + $icon = $this->element['icon'] ? ' ' : ''; $str[] = ''; if (is_array($this->value)) diff --git a/libraries/joomla/form/fields/rules.php b/libraries/joomla/form/fields/rules.php index fd3e9e573616a..84337e1305ee8 100644 --- a/libraries/joomla/form/fields/rules.php +++ b/libraries/joomla/form/fields/rules.php @@ -323,14 +323,14 @@ protected function getInput() } else { - $html[] = ' ' . JText::_('JLIB_RULES_NOT_ALLOWED_LOCKED') + $html[] = ' ' . JText::_('JLIB_RULES_NOT_ALLOWED_LOCKED') . ''; } } } elseif (!empty($component)) { - $html[] = ' ' . JText::_('JLIB_RULES_ALLOWED_ADMIN') + $html[] = ' ' . JText::_('JLIB_RULES_ALLOWED_ADMIN') . ''; } else @@ -344,12 +344,12 @@ protected function getInput() elseif ($inheritedRule === false) { // Other actions cannot be changed. - $html[] = ' ' + $html[] = ' ' . JText::_('JLIB_RULES_NOT_ALLOWED_ADMIN_CONFLICT') . ''; } else { - $html[] = ' ' . JText::_('JLIB_RULES_ALLOWED_ADMIN') + $html[] = ' ' . JText::_('JLIB_RULES_ALLOWED_ADMIN') . ''; } } diff --git a/libraries/joomla/form/fields/textarea.php b/libraries/joomla/form/fields/textarea.php index 1d2079d513b9b..16d3a2091bef1 100644 --- a/libraries/joomla/form/fields/textarea.php +++ b/libraries/joomla/form/fields/textarea.php @@ -42,6 +42,14 @@ class JFormFieldTextarea extends JFormField */ protected $columns; + /** + * The maximum number of characters in textarea. + * + * @var mixed + * @since 3.4 + */ + protected $maxlength; + /** * Method to get certain otherwise inaccessible properties from the form field object. * @@ -57,6 +65,7 @@ public function __get($name) { case 'rows': case 'columns': + case 'maxlength': return $this->$name; } @@ -79,6 +88,7 @@ public function __set($name, $value) { case 'rows': case 'columns': + case 'maxlength': $this->$name = (int) $value; break; @@ -107,8 +117,9 @@ public function setup(SimpleXMLElement $element, $value, $group = null) if ($return) { - $this->rows = isset($this->element['rows']) ? (int) $this->element['rows'] : false; - $this->columns = isset($this->element['cols']) ? (int) $this->element['cols'] : false; + $this->rows = isset($this->element['rows']) ? (int) $this->element['rows'] : false; + $this->columns = isset($this->element['cols']) ? (int) $this->element['cols'] : false; + $this->maxlength = isset($this->element['maxlength']) ? (int) $this->element['maxlength'] : false; } return $return; @@ -139,6 +150,7 @@ protected function getInput() $autocomplete = $autocomplete == ' autocomplete="on"' ? '' : $autocomplete; $autofocus = $this->autofocus ? ' autofocus' : ''; $spellcheck = $this->spellcheck ? '' : ' spellcheck="false"'; + $maxlength = $this->maxlength ? ' maxlength="' . $this->maxlength . '"' : ''; // Initialize JavaScript field attributes. $onchange = $this->onchange ? ' onchange="' . $this->onchange . '"' : ''; @@ -149,7 +161,7 @@ protected function getInput() JHtml::_('script', 'system/html5fallback.js', false, true); return ''; } } diff --git a/libraries/joomla/form/form.php b/libraries/joomla/form/form.php index 1e7c8b9c21fb0..e62efd2e66ade 100644 --- a/libraries/joomla/form/form.php +++ b/libraries/joomla/form/form.php @@ -235,22 +235,22 @@ public function filter($data, $group = null) $groups = array_map('strval', $attrs ? $attrs : array()); $group = implode('.', $groups); - // Get the field value from the data input. - if ($group) + $key = $group ? $group . '.' . $name : $name; + + // Filter the value if it exists. + if ($input->exists($key)) { - // Filter the value if it exists. - if ($input->exists($group . '.' . $name)) - { - $output->set($group . '.' . $name, $this->filterField($field, $input->get($group . '.' . $name, (string) $field['default']))); - } + $output->set($key, $this->filterField($field, $input->get($key, (string) $field['default']))); } - else + + // Get the JFormField object for this field, only it knows if it is supposed to be multiple. + $jfield = $this->getField($name, $group); + + // Fields supporting multiple values must be stored as empty arrays when no values are selected. + // If not, they will appear to be unset and then revert to their default value. + if ($jfield && $jfield->multiple && !$output->exists($key)) { - // Filter the value if it exists. - if ($input->exists($name)) - { - $output->set($name, $this->filterField($field, $input->get($name, (string) $field['default']))); - } + $output->set($key, array()); } } @@ -817,7 +817,7 @@ public function load($data, $replace = true, $xpath = false) { $olddom = dom_import_simplexml($current); $loadeddom = dom_import_simplexml($field); - $addeddom = $olddom->ownerDocument->importNode($loadeddom); + $addeddom = $olddom->ownerDocument->importNode($loadeddom, true); $olddom->parentNode->replaceChild($addeddom, $olddom); $loadeddom->parentNode->removeChild($loadeddom); } @@ -882,7 +882,7 @@ public function loadFile($file, $reset = true, $xpath = false) * @param string $name The name of the form field for which remove. * @param string $group The optional dot-separated form group path on which to find the field. * - * @return boolean True on success. + * @return boolean True on success, false otherwise. * * @since 11.1 * @throws UnexpectedValueException @@ -903,9 +903,11 @@ public function removeField($name, $group = null) { $dom = dom_import_simplexml($element); $dom->parentNode->removeChild($dom); + + return true; } - return true; + return false; } /** @@ -913,7 +915,7 @@ public function removeField($name, $group = null) * * @param string $group The dot-separated form group path for the group to remove. * - * @return boolean True on success. + * @return boolean True on success, false otherwise. * * @since 11.1 * @throws UnexpectedValueException @@ -933,9 +935,11 @@ public function removeGroup($group) { $dom = dom_import_simplexml($element); $dom->parentNode->removeChild($dom); + + return true; } - return true; + return false; } /** diff --git a/libraries/joomla/form/rule/options.php b/libraries/joomla/form/rule/options.php index 8590546c1ee95..7b98ffb5bef67 100644 --- a/libraries/joomla/form/rule/options.php +++ b/libraries/joomla/form/rule/options.php @@ -35,15 +35,25 @@ class JFormRuleOptions extends JFormRule */ public function test(SimpleXMLElement $element, $value, $group = null, Registry $input = null, JForm $form = null) { - // Check each value and return true if we get a match - foreach ($element->option as $option) + // Make an array of all available option values. + $options = array(); + + foreach ($element->option as $opt) { - if ($value == (string) $option->attributes()->value) - { - return true; - } + $options[] = $opt->attributes()->value; } - return false; + // There may be multiple values in the form of an array (if the element is checkboxes, for example). + if (is_array($value)) + { + // If all values are in the $options array, $diff will be empty and the options valid. + $diff = array_diff($value, $options); + + return empty($diff); + } + else + { + return in_array($value, $options); + } } } diff --git a/libraries/joomla/google/embed/maps.php b/libraries/joomla/google/embed/maps.php index c474e8cb00c0c..798cbe78e47be 100644 --- a/libraries/joomla/google/embed/maps.php +++ b/libraries/joomla/google/embed/maps.php @@ -687,6 +687,11 @@ public function geocodeAddress($address) if ($data['status'] != 'OK') { + if (!empty($data['error_message'])) + { + throw new RuntimeException($data['error_message']); + } + return null; } diff --git a/libraries/joomla/http/transport/cacert.pem b/libraries/joomla/http/transport/cacert.pem index 36875beaca6dd..23f4a8bcb7a58 100644 --- a/libraries/joomla/http/transport/cacert.pem +++ b/libraries/joomla/http/transport/cacert.pem @@ -1,7 +1,7 @@ ## ## Bundle of CA Root Certificates ## -## Certificate data from Mozilla downloaded on: Wed Sep 3 03:12:03 2014 +## Certificate data from Mozilla as of: Wed Apr 22 03:12:04 2015 ## ## This is a bundle of X.509 certificates of public Certificate Authorities ## (CA). These were automatically extracted from Mozilla's root certificates @@ -13,66 +13,11 @@ ## an Apache+mod_ssl webserver for SSL client authentication. ## Just configure this file as the SSLCACertificateFile. ## -## Conversion done with mk-ca-bundle.pl verison 1.22. -## SHA1: c4540021427a6fa29e5f50db9f12d48c97d33889 +## Conversion done with mk-ca-bundle.pl version 1.25. +## SHA1: ed3c0bbfb7912bcc00cd2033b0cb85c98d10559c ## -GTE CyberTrust Global Root -========================== ------BEGIN CERTIFICATE----- -MIICWjCCAcMCAgGlMA0GCSqGSIb3DQEBBAUAMHUxCzAJBgNVBAYTAlVTMRgwFgYDVQQKEw9HVEUg -Q29ycG9yYXRpb24xJzAlBgNVBAsTHkdURSBDeWJlclRydXN0IFNvbHV0aW9ucywgSW5jLjEjMCEG -A1UEAxMaR1RFIEN5YmVyVHJ1c3QgR2xvYmFsIFJvb3QwHhcNOTgwODEzMDAyOTAwWhcNMTgwODEz -MjM1OTAwWjB1MQswCQYDVQQGEwJVUzEYMBYGA1UEChMPR1RFIENvcnBvcmF0aW9uMScwJQYDVQQL -Ex5HVEUgQ3liZXJUcnVzdCBTb2x1dGlvbnMsIEluYy4xIzAhBgNVBAMTGkdURSBDeWJlclRydXN0 -IEdsb2JhbCBSb290MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCVD6C28FCc6HrHiM3dFw4u -sJTQGz0O9pTAipTHBsiQl8i4ZBp6fmw8U+E3KHNgf7KXUwefU/ltWJTSr41tiGeA5u2ylc9yMcql -HHK6XALnZELn+aks1joNrI1CqiQBOeacPwGFVw1Yh0X404Wqk2kmhXBIgD8SFcd5tB8FLztimQID -AQABMA0GCSqGSIb3DQEBBAUAA4GBAG3rGwnpXtlR22ciYaQqPEh346B8pt5zohQDhT37qw4wxYMW -M4ETCJ57NE7fQMh017l93PR2VX2bY1QY6fDq81yx2YtCHrnAlU66+tXifPVoYb+O7AWXX1uw16OF -NMQkpw0PlZPvy5TYnh+dXIVtx6quTx8itc2VrbqnzPmrC3p/ ------END CERTIFICATE----- - -Thawte Server CA -================ ------BEGIN CERTIFICATE----- -MIIDEzCCAnygAwIBAgIBATANBgkqhkiG9w0BAQQFADCBxDELMAkGA1UEBhMCWkExFTATBgNVBAgT -DFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMR0wGwYDVQQKExRUaGF3dGUgQ29uc3Vs -dGluZyBjYzEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjEZMBcGA1UE -AxMQVGhhd3RlIFNlcnZlciBDQTEmMCQGCSqGSIb3DQEJARYXc2VydmVyLWNlcnRzQHRoYXd0ZS5j -b20wHhcNOTYwODAxMDAwMDAwWhcNMjAxMjMxMjM1OTU5WjCBxDELMAkGA1UEBhMCWkExFTATBgNV -BAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMR0wGwYDVQQKExRUaGF3dGUgQ29u -c3VsdGluZyBjYzEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjEZMBcG -A1UEAxMQVGhhd3RlIFNlcnZlciBDQTEmMCQGCSqGSIb3DQEJARYXc2VydmVyLWNlcnRzQHRoYXd0 -ZS5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANOkUG7I/1Zr5s9dtuoMaHVHoqrC2oQl -/Kj0R1HahbUgdJSGHg91yekIYfUGbTBuFRkC6VLAYttNmZ7iagxEOM3+vuNkCXDF/rFrKbYvScg7 -1CcEJRCXL+eQbcAoQpnXTEPew/UhbVSfXcNY4cDk2VuwuNy0e982OsK1ZiIS1ocNAgMBAAGjEzAR -MA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEEBQADgYEAB/pMaVz7lcxG7oWDTSEwjsrZqG9J -GubaUeNgcGyEYRGhGshIPllDfU+VPaGLtwtimHp1it2ITk6eQNuozDJ0uW8NxuOzRAvZim+aKZuZ -GCg70eNAKJpaPNW15yAbi8qkq43pUdniTCxZqdq5snUb9kLy78fyGPmJvKP/iiMucEc= ------END CERTIFICATE----- - -Thawte Premium Server CA -======================== ------BEGIN CERTIFICATE----- -MIIDJzCCApCgAwIBAgIBATANBgkqhkiG9w0BAQQFADCBzjELMAkGA1UEBhMCWkExFTATBgNVBAgT -DFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMR0wGwYDVQQKExRUaGF3dGUgQ29uc3Vs -dGluZyBjYzEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjEhMB8GA1UE -AxMYVGhhd3RlIFByZW1pdW0gU2VydmVyIENBMSgwJgYJKoZIhvcNAQkBFhlwcmVtaXVtLXNlcnZl -ckB0aGF3dGUuY29tMB4XDTk2MDgwMTAwMDAwMFoXDTIwMTIzMTIzNTk1OVowgc4xCzAJBgNVBAYT -AlpBMRUwEwYDVQQIEwxXZXN0ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEdMBsGA1UEChMU -VGhhd3RlIENvbnN1bHRpbmcgY2MxKDAmBgNVBAsTH0NlcnRpZmljYXRpb24gU2VydmljZXMgRGl2 -aXNpb24xITAfBgNVBAMTGFRoYXd0ZSBQcmVtaXVtIFNlcnZlciBDQTEoMCYGCSqGSIb3DQEJARYZ -cHJlbWl1bS1zZXJ2ZXJAdGhhd3RlLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA0jY2 -aovXwlue2oFBYo847kkEVdbQ7xwblRZH7xhINTpS9CtqBo87L+pW46+GjZ4X9560ZXUCTe/LCaIh -Udib0GfQug2SBhRz1JPLlyoAnFxODLz6FVL88kRu2hFKbgifLy3j+ao6hnO2RlNYyIkFvYMRuHM/ -qgeN9EJN50CdHDcCAwEAAaMTMBEwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQQFAAOBgQAm -SCwWwlj66BZ0DKqqX1Q/8tfJeGBeXm43YyJ3Nn6yF8Q0ufUIhfzJATj/Tb7yFkJD57taRvvBxhEf -8UqwKEbJw8RCfbz6q1lu1bdRiBHjpIUZa4JMpAwSremkrj/xw0llmozFyD4lt5SZu5IycQfwhl7t -UCemDaYj+bvLpgcUQg== ------END CERTIFICATE----- - Equifax Secure CA ================= -----BEGIN CERTIFICATE----- @@ -93,25 +38,6 @@ BIZCe/zuf6IWUrVnZ9NA2zsmWLIodz2uFHdh1voqZiegDfqnc1zqcPGUIWVEX/r87yloqaKHee95 70+sB3c4 -----END CERTIFICATE----- -Verisign Class 3 Public Primary Certification Authority - G2 -============================================================ ------BEGIN CERTIFICATE----- -MIIDAjCCAmsCEH3Z/gfPqB63EHln+6eJNMYwDQYJKoZIhvcNAQEFBQAwgcExCzAJBgNVBAYTAlVT -MRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE8MDoGA1UECxMzQ2xhc3MgMyBQdWJsaWMgUHJpbWFy -eSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMTowOAYDVQQLEzEoYykgMTk5OCBWZXJpU2ln -biwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MR8wHQYDVQQLExZWZXJpU2lnbiBUcnVz -dCBOZXR3b3JrMB4XDTk4MDUxODAwMDAwMFoXDTI4MDgwMTIzNTk1OVowgcExCzAJBgNVBAYTAlVT -MRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE8MDoGA1UECxMzQ2xhc3MgMyBQdWJsaWMgUHJpbWFy -eSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMTowOAYDVQQLEzEoYykgMTk5OCBWZXJpU2ln -biwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MR8wHQYDVQQLExZWZXJpU2lnbiBUcnVz -dCBOZXR3b3JrMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDMXtERXVxp0KvTuWpMmR9ZmDCO -FoUgRm1HP9SFIIThbbP4pO0M8RcPO/mn+SXXwc+EY/J8Y8+iR/LGWzOOZEAEaMGAuWQcRXfH2G71 -lSk8UOg013gfqLptQ5GVj0VXXn7F+8qkBOvqlzdUMG+7AUcyM83cV5tkaWH4mx0ciU9cZwIDAQAB -MA0GCSqGSIb3DQEBBQUAA4GBAFFNzb5cy5gZnBWyATl4Lk0PZ3BwmcYQWpSkU01UbSuvDV1Ai2TT -1+7eVmGSX6bEHRBhNtMsJzzoKQm5EWR0zLVznxxIqbxhAe7iF6YM40AIOw7n60RzKprxaZLvcRTD -Oaxxp5EJb+RxBrO6WVcmeQD2+A2iMzAo1KpYoJ2daZH9 ------END CERTIFICATE----- - GlobalSign Root CA ================== -----BEGIN CERTIFICATE----- @@ -248,40 +174,6 @@ Y71k5h+3zvDyny67G7fyUIhzksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9H RCwBXbsdtTLSR9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp -----END CERTIFICATE----- -Equifax Secure Global eBusiness CA -================================== ------BEGIN CERTIFICATE----- -MIICkDCCAfmgAwIBAgIBATANBgkqhkiG9w0BAQQFADBaMQswCQYDVQQGEwJVUzEcMBoGA1UEChMT -RXF1aWZheCBTZWN1cmUgSW5jLjEtMCsGA1UEAxMkRXF1aWZheCBTZWN1cmUgR2xvYmFsIGVCdXNp -bmVzcyBDQS0xMB4XDTk5MDYyMTA0MDAwMFoXDTIwMDYyMTA0MDAwMFowWjELMAkGA1UEBhMCVVMx -HDAaBgNVBAoTE0VxdWlmYXggU2VjdXJlIEluYy4xLTArBgNVBAMTJEVxdWlmYXggU2VjdXJlIEds -b2JhbCBlQnVzaW5lc3MgQ0EtMTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAuucXkAJlsTRV -PEnCUdXfp9E3j9HngXNBUmCbnaEXJnitx7HoJpQytd4zjTov2/KaelpzmKNc6fuKcxtc58O/gGzN -qfTWK8D3+ZmqY6KxRwIP1ORROhI8bIpaVIRw28HFkM9yRcuoWcDNM50/o5brhTMhHD4ePmBudpxn -hcXIw2ECAwEAAaNmMGQwEQYJYIZIAYb4QgEBBAQDAgAHMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0j -BBgwFoAUvqigdHJQa0S3ySPY+6j/s1draGwwHQYDVR0OBBYEFL6ooHRyUGtEt8kj2Puo/7NXa2hs -MA0GCSqGSIb3DQEBBAUAA4GBADDiAVGqx+pf2rnQZQ8w1j7aDRRJbpGTJxQx78T3LUX47Me/okEN -I7SS+RkAZ70Br83gcfxaz2TE4JaY0KNA4gGK7ycH8WUBikQtBmV1UsCGECAhX2xrD2yuCRyv8qIY -NMR1pHMc8Y3c7635s3a0kr/clRAevsvIO1qEYBlWlKlV ------END CERTIFICATE----- - -Equifax Secure eBusiness CA 1 -============================= ------BEGIN CERTIFICATE----- -MIICgjCCAeugAwIBAgIBBDANBgkqhkiG9w0BAQQFADBTMQswCQYDVQQGEwJVUzEcMBoGA1UEChMT -RXF1aWZheCBTZWN1cmUgSW5jLjEmMCQGA1UEAxMdRXF1aWZheCBTZWN1cmUgZUJ1c2luZXNzIENB -LTEwHhcNOTkwNjIxMDQwMDAwWhcNMjAwNjIxMDQwMDAwWjBTMQswCQYDVQQGEwJVUzEcMBoGA1UE -ChMTRXF1aWZheCBTZWN1cmUgSW5jLjEmMCQGA1UEAxMdRXF1aWZheCBTZWN1cmUgZUJ1c2luZXNz -IENBLTEwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAM4vGbwXt3fek6lfWg0XTzQaDJj0ItlZ -1MRoRvC0NcWFAyDGr0WlIVFFQesWWDYyb+JQYmT5/VGcqiTZ9J2DKocKIdMSODRsjQBuWqDZQu4a -IZX5UkxVWsUPOE9G+m34LjXWHXzr4vCwdYDIqROsvojvOm6rXyo4YgKwEnv+j6YDAgMBAAGjZjBk -MBEGCWCGSAGG+EIBAQQEAwIABzAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFEp4MlIR21kW -Nl7fwRQ2QGpHfEyhMB0GA1UdDgQWBBRKeDJSEdtZFjZe38EUNkBqR3xMoTANBgkqhkiG9w0BAQQF -AAOBgQB1W6ibAxHm6VZMzfmpTMANmvPMZWnmJXbMWbfWVMMdzZmsGd20hdXgPfxiIKeES1hl8eL5 -lSE/9dR+WB5Hh1Q+WKG1tfgq73HnvMP2sUlG4tega+VWeponmHxGYhTnyfxuAxJ5gDgdSIKN/Bf+ -KpYrtWKmpj29f5JZzVoqgrI3eQ== ------END CERTIFICATE----- - AddTrust Low-Value Services Root ================================ -----BEGIN CERTIFICATE----- @@ -527,59 +419,6 @@ gn2Z9DH2canPLAEnpQW5qrJITirvn5NSUZU8UnOOVkwXQMAJKOSLakhT2+zNVVXxxvjpoixMptEm X36vWkzaH6byHCx+rgIW0lbQL1dTR+iS -----END CERTIFICATE----- -America Online Root Certification Authority 1 -============================================= ------BEGIN CERTIFICATE----- -MIIDpDCCAoygAwIBAgIBATANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEcMBoGA1UEChMT -QW1lcmljYSBPbmxpbmUgSW5jLjE2MDQGA1UEAxMtQW1lcmljYSBPbmxpbmUgUm9vdCBDZXJ0aWZp -Y2F0aW9uIEF1dGhvcml0eSAxMB4XDTAyMDUyODA2MDAwMFoXDTM3MTExOTIwNDMwMFowYzELMAkG -A1UEBhMCVVMxHDAaBgNVBAoTE0FtZXJpY2EgT25saW5lIEluYy4xNjA0BgNVBAMTLUFtZXJpY2Eg -T25saW5lIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgMTCCASIwDQYJKoZIhvcNAQEBBQAD -ggEPADCCAQoCggEBAKgv6KRpBgNHw+kqmP8ZonCaxlCyfqXfaE0bfA+2l2h9LaaLl+lkhsmj76CG -v2BlnEtUiMJIxUo5vxTjWVXlGbR0yLQFOVwWpeKVBeASrlmLojNoWBym1BW32J/X3HGrfpq/m44z -DyL9Hy7nBzbvYjnF3cu6JRQj3gzGPTzOggjmZj7aUTsWOqMFf6Dch9Wc/HKpoH145LcxVR5lu9Rh -sCFg7RAycsWSJR74kEoYeEfffjA3PlAb2xzTa5qGUwew76wGePiEmf4hjUyAtgyC9mZweRrTT6PP -8c9GsEsPPt2IYriMqQkoO3rHl+Ee5fSfwMCuJKDIodkP1nsmgmkyPacCAwEAAaNjMGEwDwYDVR0T -AQH/BAUwAwEB/zAdBgNVHQ4EFgQUAK3Zo/Z59m50qX8zPYEX10zPM94wHwYDVR0jBBgwFoAUAK3Z -o/Z59m50qX8zPYEX10zPM94wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBBQUAA4IBAQB8itEf -GDeC4Liwo+1WlchiYZwFos3CYiZhzRAW18y0ZTTQEYqtqKkFZu90821fnZmv9ov761KyBZiibyrF -VL0lvV+uyIbqRizBs73B6UlwGBaXCBOMIOAbLjpHyx7kADCVW/RFo8AasAFOq73AI25jP4BKxQft -3OJvx8Fi8eNy1gTIdGcL+oiroQHIb/AUr9KZzVGTfu0uOMe9zkZQPXLjeSWdm4grECDdpbgyn43g -Kd8hdIaC2y+CMMbHNYaz+ZZfRtsMRf3zUMNvxsNIrUam4SdHCh0Om7bCd39j8uB9Gr784N/Xx6ds -sPmuujz9dLQR6FgNgLzTqIA6me11zEZ7 ------END CERTIFICATE----- - -America Online Root Certification Authority 2 -============================================= ------BEGIN CERTIFICATE----- -MIIFpDCCA4ygAwIBAgIBATANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEcMBoGA1UEChMT -QW1lcmljYSBPbmxpbmUgSW5jLjE2MDQGA1UEAxMtQW1lcmljYSBPbmxpbmUgUm9vdCBDZXJ0aWZp -Y2F0aW9uIEF1dGhvcml0eSAyMB4XDTAyMDUyODA2MDAwMFoXDTM3MDkyOTE0MDgwMFowYzELMAkG -A1UEBhMCVVMxHDAaBgNVBAoTE0FtZXJpY2EgT25saW5lIEluYy4xNjA0BgNVBAMTLUFtZXJpY2Eg -T25saW5lIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgMjCCAiIwDQYJKoZIhvcNAQEBBQAD -ggIPADCCAgoCggIBAMxBRR3pPU0Q9oyxQcngXssNt79Hc9PwVU3dxgz6sWYFas14tNwC206B89en -fHG8dWOgXeMHDEjsJcQDIPT/DjsS/5uN4cbVG7RtIuOx238hZK+GvFciKtZHgVdEglZTvYYUAQv8 -f3SkWq7xuhG1m1hagLQ3eAkzfDJHA1zEpYNI9FdWboE2JxhP7JsowtS013wMPgwr38oE18aO6lhO -qKSlGBxsRZijQdEt0sdtjRnxrXm3gT+9BoInLRBYBbV4Bbkv2wxrkJB+FFk4u5QkE+XRnRTf04JN -RvCAOVIyD+OEsnpD8l7eXz8d3eOyG6ChKiMDbi4BFYdcpnV1x5dhvt6G3NRI270qv0pV2uh9UPu0 -gBe4lL8BPeraunzgWGcXuVjgiIZGZ2ydEEdYMtA1fHkqkKJaEBEjNa0vzORKW6fIJ/KD3l67Xnfn -6KVuY8INXWHQjNJsWiEOyiijzirplcdIz5ZvHZIlyMbGwcEMBawmxNJ10uEqZ8A9W6Wa6897Gqid -FEXlD6CaZd4vKL3Ob5Rmg0gp2OpljK+T2WSfVVcmv2/LNzGZo2C7HK2JNDJiuEMhBnIMoVxtRsX6 -Kc8w3onccVvdtjc+31D1uAclJuW8tf48ArO3+L5DwYcRlJ4jbBeKuIonDFRH8KmzwICMoCfrHRnj -B453cMor9H124HhnAgMBAAGjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFE1FwWg4u3Op -aaEg5+31IqEjFNeeMB8GA1UdIwQYMBaAFE1FwWg4u3OpaaEg5+31IqEjFNeeMA4GA1UdDwEB/wQE -AwIBhjANBgkqhkiG9w0BAQUFAAOCAgEAZ2sGuV9FOypLM7PmG2tZTiLMubekJcmnxPBUlgtk87FY -T15R/LKXeydlwuXK5w0MJXti4/qftIe3RUavg6WXSIylvfEWK5t2LHo1YGwRgJfMqZJS5ivmae2p -+DYtLHe/YUjRYwu5W1LtGLBDQiKmsXeu3mnFzcccobGlHBD7GL4acN3Bkku+KVqdPzW+5X1R+FXg -JXUjhx5c3LqdsKyzadsXg8n33gy8CNyRnqjQ1xU3c6U1uPx+xURABsPr+CKAXEfOAuMRn0T//Zoy -zH1kUQ7rVyZ2OuMeIjzCpjbdGe+n/BLzJsBZMYVMnNjP36TMzCmT/5RtdlwTCJfy7aULTd3oyWgO -ZtMADjMSW7yV5TKQqLPGbIOtd+6Lfn6xqavT4fG2wLHqiMDn05DpKJKUe2h7lyoKZy2FAjgQ5ANh -1NolNscIWC2hp1GvMApJ9aZphwctREZ2jirlmjvXGKL8nDgQzMY70rUXOm/9riW99XJZZLF0Kjhf -GEzfz3EEWjbUvy+ZnOjZurGV5gJLIaFb1cFPj65pbVPbAZO1XB4Y3WRayhgoPmMEEf0cjQAPuDff -Z4qdZqkCapH/E8ovXYO8h5Ns3CRRFgQlZvqz2cK6Kb6aSDiCmfS/O0oxGfm/jiEzFMpPVF/7zvuP -cX/9XhmgD0uRuMRUvAawRY8mkaKO/qk= ------END CERTIFICATE----- - Visa eCommerce Root =================== -----BEGIN CERTIFICATE----- @@ -1777,33 +1616,6 @@ JOzHdiEoZa5X6AeIdUpWoNIFOqTmjZKILPPy4cHGYdtBxceb9w4aUUXCYWvcZCcXjFq32nQozZfk vQ== -----END CERTIFICATE----- -TC TrustCenter Class 3 CA II -============================ ------BEGIN CERTIFICATE----- -MIIEqjCCA5KgAwIBAgIOSkcAAQAC5aBd1j8AUb8wDQYJKoZIhvcNAQEFBQAwdjELMAkGA1UEBhMC -REUxHDAaBgNVBAoTE1RDIFRydXN0Q2VudGVyIEdtYkgxIjAgBgNVBAsTGVRDIFRydXN0Q2VudGVy -IENsYXNzIDMgQ0ExJTAjBgNVBAMTHFRDIFRydXN0Q2VudGVyIENsYXNzIDMgQ0EgSUkwHhcNMDYw -MTEyMTQ0MTU3WhcNMjUxMjMxMjI1OTU5WjB2MQswCQYDVQQGEwJERTEcMBoGA1UEChMTVEMgVHJ1 -c3RDZW50ZXIgR21iSDEiMCAGA1UECxMZVEMgVHJ1c3RDZW50ZXIgQ2xhc3MgMyBDQTElMCMGA1UE -AxMcVEMgVHJ1c3RDZW50ZXIgQ2xhc3MgMyBDQSBJSTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC -AQoCggEBALTgu1G7OVyLBMVMeRwjhjEQY0NVJz/GRcekPewJDRoeIMJWHt4bNwcwIi9v8Qbxq63W -yKthoy9DxLCyLfzDlml7forkzMA5EpBCYMnMNWju2l+QVl/NHE1bWEnrDgFPZPosPIlY2C8u4rBo -6SI7dYnWRBpl8huXJh0obazovVkdKyT21oQDZogkAHhg8fir/gKya/si+zXmFtGt9i4S5Po1auUZ -uV3bOx4a+9P/FRQI2AlqukWdFHlgfa9Aigdzs5OW03Q0jTo3Kd5c7PXuLjHCINy+8U9/I1LZW+Jk -2ZyqBwi1Rb3R0DHBq1SfqdLDYmAD8bs5SpJKPQq5ncWg/jcCAwEAAaOCATQwggEwMA8GA1UdEwEB -/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTUovyfs8PYA9NXXAek0CSnwPIA1DCB -7QYDVR0fBIHlMIHiMIHfoIHcoIHZhjVodHRwOi8vd3d3LnRydXN0Y2VudGVyLmRlL2NybC92Mi90 -Y19jbGFzc18zX2NhX0lJLmNybIaBn2xkYXA6Ly93d3cudHJ1c3RjZW50ZXIuZGUvQ049VEMlMjBU -cnVzdENlbnRlciUyMENsYXNzJTIwMyUyMENBJTIwSUksTz1UQyUyMFRydXN0Q2VudGVyJTIwR21i -SCxPVT1yb290Y2VydHMsREM9dHJ1c3RjZW50ZXIsREM9ZGU/Y2VydGlmaWNhdGVSZXZvY2F0aW9u -TGlzdD9iYXNlPzANBgkqhkiG9w0BAQUFAAOCAQEANmDkcPcGIEPZIxpC8vijsrlNirTzwppVMXzE -O2eatN9NDoqTSheLG43KieHPOh6sHfGcMrSOWXaiQYUlN6AT0PV8TtXqluJucsG7Kv5sbviRmEb8 -yRtXW+rIGjs/sFGYPAfaLFkB2otE6OF0/ado3VS6g0bsyEa1+K+XwDsJHI/OcpY9M1ZwvJbL2NV9 -IJqDnxrcOfHFcqMRA/07QlIp2+gB95tejNaNhk4Z+rwcvsUhpYeeeC422wlxo3I0+GzjBgnyXlal -092Y+tTmBvTwtiBjS+opvaqCZh77gaqnN60TGOaSw4HBM7uIHqHn4rS9MWwOUT1v+5ZWgOI2F9Hc -5A== ------END CERTIFICATE----- - TC TrustCenter Universal CA I ============================= -----BEGIN CERTIFICATE----- @@ -2421,28 +2233,6 @@ yULyMtd6YebS2z3PyKnJm9zbWETXbzivf3jTo60adbocwTZ8jx5tHMN1Rq41Bab2XD0h7lbwyYIi LXpUq3DDfSJlgnCW -----END CERTIFICATE----- -E-Guven Kok Elektronik Sertifika Hizmet Saglayicisi -=================================================== ------BEGIN CERTIFICATE----- -MIIDtjCCAp6gAwIBAgIQRJmNPMADJ72cdpW56tustTANBgkqhkiG9w0BAQUFADB1MQswCQYDVQQG -EwJUUjEoMCYGA1UEChMfRWxla3Ryb25payBCaWxnaSBHdXZlbmxpZ2kgQS5TLjE8MDoGA1UEAxMz -ZS1HdXZlbiBLb2sgRWxla3Ryb25payBTZXJ0aWZpa2EgSGl6bWV0IFNhZ2xheWljaXNpMB4XDTA3 -MDEwNDExMzI0OFoXDTE3MDEwNDExMzI0OFowdTELMAkGA1UEBhMCVFIxKDAmBgNVBAoTH0VsZWt0 -cm9uaWsgQmlsZ2kgR3V2ZW5saWdpIEEuUy4xPDA6BgNVBAMTM2UtR3V2ZW4gS29rIEVsZWt0cm9u -aWsgU2VydGlmaWthIEhpem1ldCBTYWdsYXlpY2lzaTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC -AQoCggEBAMMSIJ6wXgBljU5Gu4Bc6SwGl9XzcslwuedLZYDBS75+PNdUMZTe1RK6UxYC6lhj71vY -8+0qGqpxSKPcEC1fX+tcS5yWCEIlKBHMilpiAVDV6wlTL/jDj/6z/P2douNffb7tC+Bg62nsM+3Y -jfsSSYMAyYuXjDtzKjKzEve5TfL0TW3H5tYmNwjy2f1rXKPlSFxYvEK+A1qBuhw1DADT9SN+cTAI -JjjcJRFHLfO6IxClv7wC90Nex/6wN1CZew+TzuZDLMN+DfIcQ2Zgy2ExR4ejT669VmxMvLz4Bcpk -9Ok0oSy1c+HCPujIyTQlCFzz7abHlJ+tiEMl1+E5YP6sOVkCAwEAAaNCMEAwDgYDVR0PAQH/BAQD -AgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFJ/uRLOU1fqRTy7ZVZoEVtstxNulMA0GCSqG -SIb3DQEBBQUAA4IBAQB/X7lTW2M9dTLn+sR0GstG30ZpHFLPqk/CaOv/gKlR6D1id4k9CnU58W5d -F4dvaAXBlGzZXd/aslnLpRCKysw5zZ/rTt5S/wzw9JKp8mxTq5vSR6AfdPebmvEvFZ96ZDAYBzwq -D2fK/A+JYZ1lpTzlvBNbCNvj/+27BrtqBrF6T2XGgv0enIu1De5Iu7i9qgi0+6N8y5/NkHZchpZ4 -Vwpm+Vganf2XKWDeEaaQHBkc7gGWIjQ0LpH5t8Qn0Xvmv/uARFoW5evg1Ao4vOSR49XrXMGs3xtq -fJ7lddK2l4fbzIcrQzqECK+rPNv3PGYxhrCdU3nt+CPeQuMtgvEP5fqX ------END CERTIFICATE----- - GlobalSign Root CA - R3 ======================= -----BEGIN CERTIFICATE----- @@ -3892,3 +3682,307 @@ ONFLAzkopR6RctR9q5czxNM+4Gm2KHmgCY0c0f9BckgG/Jou5yD5m6Leie2uPAmvylezkolwQOQv T8Jwg0DXJCxr5wkf09XHwQj02w47HAcLQxGEIYbpgNR12KvxAmLBsX5VYc8T1yaw15zLKYs4SgsO kI26oQ== -----END CERTIFICATE----- + +COMODO RSA Certification Authority +================================== +-----BEGIN CERTIFICATE----- +MIIF2DCCA8CgAwIBAgIQTKr5yttjb+Af907YWwOGnTANBgkqhkiG9w0BAQwFADCBhTELMAkGA1UE +BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG +A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlv +biBBdXRob3JpdHkwHhcNMTAwMTE5MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMC +R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE +ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlvbiBB +dXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCR6FSS0gpWsawNJN3Fz0Rn +dJkrN6N9I3AAcbxT38T6KhKPS38QVr2fcHK3YX/JSw8Xpz3jsARh7v8Rl8f0hj4K+j5c+ZPmNHrZ +FGvnnLOFoIJ6dq9xkNfs/Q36nGz637CC9BR++b7Epi9Pf5l/tfxnQ3K9DADWietrLNPtj5gcFKt+ +5eNu/Nio5JIk2kNrYrhV/erBvGy2i/MOjZrkm2xpmfh4SDBF1a3hDTxFYPwyllEnvGfDyi62a+pG +x8cgoLEfZd5ICLqkTqnyg0Y3hOvozIFIQ2dOciqbXL1MGyiKXCJ7tKuY2e7gUYPDCUZObT6Z+pUX +2nwzV0E8jVHtC7ZcryxjGt9XyD+86V3Em69FmeKjWiS0uqlWPc9vqv9JWL7wqP/0uK3pN/u6uPQL +OvnoQ0IeidiEyxPx2bvhiWC4jChWrBQdnArncevPDt09qZahSL0896+1DSJMwBGB7FY79tOi4lu3 +sgQiUpWAk2nojkxl8ZEDLXB0AuqLZxUpaVICu9ffUGpVRr+goyhhf3DQw6KqLCGqR84onAZFdr+C +GCe01a60y1Dma/RMhnEw6abfFobg2P9A3fvQQoh/ozM6LlweQRGBY84YcWsr7KaKtzFcOmpH4MN5 +WdYgGq/yapiqcrxXStJLnbsQ/LBMQeXtHT1eKJ2czL+zUdqnR+WEUwIDAQABo0IwQDAdBgNVHQ4E +FgQUu69+Aj36pvE8hI6t7jiY7NkyMtQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8w +DQYJKoZIhvcNAQEMBQADggIBAArx1UaEt65Ru2yyTUEUAJNMnMvlwFTPoCWOAvn9sKIN9SCYPBMt +rFaisNZ+EZLpLrqeLppysb0ZRGxhNaKatBYSaVqM4dc+pBroLwP0rmEdEBsqpIt6xf4FpuHA1sj+ +nq6PK7o9mfjYcwlYRm6mnPTXJ9OV2jeDchzTc+CiR5kDOF3VSXkAKRzH7JsgHAckaVd4sjn8OoSg +tZx8jb8uk2IntznaFxiuvTwJaP+EmzzV1gsD41eeFPfR60/IvYcjt7ZJQ3mFXLrrkguhxuhoqEwW +sRqZCuhTLJK7oQkYdQxlqHvLI7cawiiFwxv/0Cti76R7CZGYZ4wUAc1oBmpjIXUDgIiKboHGhfKp +pC3n9KUkEEeDys30jXlYsQab5xoq2Z0B15R97QNKyvDb6KkBPvVWmckejkk9u+UJueBPSZI9FoJA +zMxZxuY67RIuaTxslbH9qh17f4a+Hg4yRvv7E491f0yLS0Zj/gA0QHDBw7mh3aZw4gSzQbzpgJHq +ZJx64SIDqZxubw5lT2yHh17zbqD5daWbQOhTsiedSrnAdyGN/4fy3ryM7xfft0kL0fJuMAsaDk52 +7RH89elWsn2/x20Kk4yl0MC2Hb46TpSi125sC8KKfPog88Tk5c0NqMuRkrF8hey1FGlmDoLnzc7I +LaZRfyHBNVOFBkpdn627G190 +-----END CERTIFICATE----- + +USERTrust RSA Certification Authority +===================================== +-----BEGIN CERTIFICATE----- +MIIF3jCCA8agAwIBAgIQAf1tMPyjylGoG7xkDjUDLTANBgkqhkiG9w0BAQwFADCBiDELMAkGA1UE +BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK +ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh +dGlvbiBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UE +BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK +ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh +dGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCAEmUXNg7D2wiz +0KxXDXbtzSfTTK1Qg2HiqiBNCS1kCdzOiZ/MPans9s/B3PHTsdZ7NygRK0faOca8Ohm0X6a9fZ2j +Y0K2dvKpOyuR+OJv0OwWIJAJPuLodMkYtJHUYmTbf6MG8YgYapAiPLz+E/CHFHv25B+O1ORRxhFn +RghRy4YUVD+8M/5+bJz/Fp0YvVGONaanZshyZ9shZrHUm3gDwFA66Mzw3LyeTP6vBZY1H1dat//O ++T23LLb2VN3I5xI6Ta5MirdcmrS3ID3KfyI0rn47aGYBROcBTkZTmzNg95S+UzeQc0PzMsNT79uq +/nROacdrjGCT3sTHDN/hMq7MkztReJVni+49Vv4M0GkPGw/zJSZrM233bkf6c0Plfg6lZrEpfDKE +Y1WJxA3Bk1QwGROs0303p+tdOmw1XNtB1xLaqUkL39iAigmTYo61Zs8liM2EuLE/pDkP2QKe6xJM +lXzzawWpXhaDzLhn4ugTncxbgtNMs+1b/97lc6wjOy0AvzVVdAlJ2ElYGn+SNuZRkg7zJn0cTRe8 +yexDJtC/QV9AqURE9JnnV4eeUB9XVKg+/XRjL7FQZQnmWEIuQxpMtPAlR1n6BB6T1CZGSlCBst6+ +eLf8ZxXhyVeEHg9j1uliutZfVS7qXMYoCAQlObgOK6nyTJccBz8NUvXt7y+CDwIDAQABo0IwQDAd +BgNVHQ4EFgQUU3m/WqorSs9UgOHYm8Cd8rIDZsswDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF +MAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAFzUfA3P9wF9QZllDHPFUp/L+M+ZBn8b2kMVn54CVVeW +FPFSPCeHlCjtHzoBN6J2/FNQwISbxmtOuowhT6KOVWKR82kV2LyI48SqC/3vqOlLVSoGIG1VeCkZ +7l8wXEskEVX/JJpuXior7gtNn3/3ATiUFJVDBwn7YKnuHKsSjKCaXqeYalltiz8I+8jRRa8YFWSQ +Eg9zKC7F4iRO/Fjs8PRF/iKz6y+O0tlFYQXBl2+odnKPi4w2r78NBc5xjeambx9spnFixdjQg3IM +8WcRiQycE0xyNN+81XHfqnHd4blsjDwSXWXavVcStkNr/+XeTWYRUc+ZruwXtuhxkYzeSf7dNXGi +FSeUHM9h4ya7b6NnJSFd5t0dCy5oGzuCr+yDZ4XUmFF0sbmZgIn/f3gZXHlKYC6SQK5MNyosycdi +yA5d9zZbyuAlJQG03RoHnHcAP9Dc1ew91Pq7P8yF1m9/qS3fuQL39ZeatTXaw2ewh0qpKJ4jjv9c +J2vhsE/zB+4ALtRZh8tSQZXq9EfX7mRBVXyNWQKV3WKdwrnuWih0hKWbt5DHDAff9Yk2dDLWKMGw +sAvgnEzDHNb842m1R0aBL6KCq9NjRHDEjf8tM7qtj3u1cIiuPhnPQCjY/MiQu12ZIvVS5ljFH4gx +Q+6IHdfGjjxDah2nGN59PRbxYvnKkKj9 +-----END CERTIFICATE----- + +USERTrust ECC Certification Authority +===================================== +-----BEGIN CERTIFICATE----- +MIICjzCCAhWgAwIBAgIQXIuZxVqUxdJxVt7NiYDMJjAKBggqhkjOPQQDAzCBiDELMAkGA1UEBhMC +VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU +aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv +biBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UEBhMC +VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU +aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv +biBBdXRob3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQarFRaqfloI+d61SRvU8Za2EurxtW2 +0eZzca7dnNYMYf3boIkDuAUU7FfO7l0/4iGzzvfUinngo4N+LZfQYcTxmdwlkWOrfzCjtHDix6Ez +nPO/LlxTsV+zfTJ/ijTjeXmjQjBAMB0GA1UdDgQWBBQ64QmG1M8ZwpZ2dEl23OA1xmNjmjAOBgNV +HQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjA2Z6EWCNzklwBB +HU6+4WMBzzuqQhFkoJ2UOQIReVx7Hfpkue4WQrO/isIJxOzksU0CMQDpKmFHjFJKS04YcPbWRNZu +9YO6bVi9JNlWSOrvxKJGgYhqOkbRqZtNyWHa0V1Xahg= +-----END CERTIFICATE----- + +GlobalSign ECC Root CA - R4 +=========================== +-----BEGIN CERTIFICATE----- +MIIB4TCCAYegAwIBAgIRKjikHJYKBN5CsiilC+g0mAIwCgYIKoZIzj0EAwIwUDEkMCIGA1UECxMb +R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD +EwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMb +R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD +EwpHbG9iYWxTaWduMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEuMZ5049sJQ6fLjkZHAOkrprl +OQcJFspjsbmG+IpXwVfOQvpzofdlQv8ewQCybnMO/8ch5RikqtlxP6jUuc6MHaNCMEAwDgYDVR0P +AQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFFSwe61FuOJAf/sKbvu+M8k8o4TV +MAoGCCqGSM49BAMCA0gAMEUCIQDckqGgE6bPA7DmxCGXkPoUVy0D7O48027KqGx2vKLeuwIgJ6iF +JzWbVsaj8kfSt24bAgAXqmemFZHe+pTsewv4n4Q= +-----END CERTIFICATE----- + +GlobalSign ECC Root CA - R5 +=========================== +-----BEGIN CERTIFICATE----- +MIICHjCCAaSgAwIBAgIRYFlJ4CYuu1X5CneKcflK2GwwCgYIKoZIzj0EAwMwUDEkMCIGA1UECxMb +R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD +EwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMb +R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD +EwpHbG9iYWxTaWduMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAER0UOlvt9Xb/pOdEh+J8LttV7HpI6 +SFkc8GIxLcB6KP4ap1yztsyX50XUWPrRd21DosCHZTQKH3rd6zwzocWdTaRvQZU4f8kehOvRnkmS +h5SHDDqFSmafnVmTTZdhBoZKo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAd +BgNVHQ4EFgQUPeYpSJvqB8ohREom3m7e0oPQn1kwCgYIKoZIzj0EAwMDaAAwZQIxAOVpEslu28Yx +uglB4Zf4+/2a4n0Sye18ZNPLBSWLVtmg515dTguDnFt2KaAJJiFqYgIwcdK1j1zqO+F4CYWodZI7 +yFz9SO8NdCKoCOJuxUnOxwy8p2Fp8fc74SrL+SvzZpA3 +-----END CERTIFICATE----- + +Staat der Nederlanden Root CA - G3 +================================== +-----BEGIN CERTIFICATE----- +MIIFdDCCA1ygAwIBAgIEAJiiOTANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJOTDEeMBwGA1UE +CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSswKQYDVQQDDCJTdGFhdCBkZXIgTmVkZXJsYW5kZW4g +Um9vdCBDQSAtIEczMB4XDTEzMTExNDExMjg0MloXDTI4MTExMzIzMDAwMFowWjELMAkGA1UEBhMC +TkwxHjAcBgNVBAoMFVN0YWF0IGRlciBOZWRlcmxhbmRlbjErMCkGA1UEAwwiU3RhYXQgZGVyIE5l +ZGVybGFuZGVuIFJvb3QgQ0EgLSBHMzCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAL4y +olQPcPssXFnrbMSkUeiFKrPMSjTysF/zDsccPVMeiAho2G89rcKezIJnByeHaHE6n3WWIkYFsO2t +x1ueKt6c/DrGlaf1F2cY5y9JCAxcz+bMNO14+1Cx3Gsy8KL+tjzk7FqXxz8ecAgwoNzFs21v0IJy +EavSgWhZghe3eJJg+szeP4TrjTgzkApyI/o1zCZxMdFyKJLZWyNtZrVtB0LrpjPOktvA9mxjeM3K +Tj215VKb8b475lRgsGYeCasH/lSJEULR9yS6YHgamPfJEf0WwTUaVHXvQ9Plrk7O53vDxk5hUUur +mkVLoR9BvUhTFXFkC4az5S6+zqQbwSmEorXLCCN2QyIkHxcE1G6cxvx/K2Ya7Irl1s9N9WMJtxU5 +1nus6+N86U78dULI7ViVDAZCopz35HCz33JvWjdAidiFpNfxC95DGdRKWCyMijmev4SH8RY7Ngzp +07TKbBlBUgmhHbBqv4LvcFEhMtwFdozL92TkA1CvjJFnq8Xy7ljY3r735zHPbMk7ccHViLVlvMDo +FxcHErVc0qsgk7TmgoNwNsXNo42ti+yjwUOH5kPiNL6VizXtBznaqB16nzaeErAMZRKQFWDZJkBE +41ZgpRDUajz9QdwOWke275dhdU/Z/seyHdTtXUmzqWrLZoQT1Vyg3N9udwbRcXXIV2+vD3dbAgMB +AAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRUrfrHkleu +yjWcLhL75LpdINyUVzANBgkqhkiG9w0BAQsFAAOCAgEAMJmdBTLIXg47mAE6iqTnB/d6+Oea31BD +U5cqPco8R5gu4RV78ZLzYdqQJRZlwJ9UXQ4DO1t3ApyEtg2YXzTdO2PCwyiBwpwpLiniyMMB8jPq +KqrMCQj3ZWfGzd/TtiunvczRDnBfuCPRy5FOCvTIeuXZYzbB1N/8Ipf3YF3qKS9Ysr1YvY2WTxB1 +v0h7PVGHoTx0IsL8B3+A3MSs/mrBcDCw6Y5p4ixpgZQJut3+TcCDjJRYwEYgr5wfAvg1VUkvRtTA +8KCWAg8zxXHzniN9lLf9OtMJgwYh/WA9rjLA0u6NpvDntIJ8CsxwyXmA+P5M9zWEGYox+wrZ13+b +8KKaa8MFSu1BYBQw0aoRQm7TIwIEC8Zl3d1Sd9qBa7Ko+gE4uZbqKmxnl4mUnrzhVNXkanjvSr0r +mj1AfsbAddJu+2gw7OyLnflJNZoaLNmzlTnVHpL3prllL+U9bTpITAjc5CgSKL59NVzq4BZ+Extq +1z7XnvwtdbLBFNUjA9tbbws+eC8N3jONFrdI54OagQ97wUNNVQQXOEpR1VmiiXTTn74eS9fGbbeI +JG9gkaSChVtWQbzQRKtqE77RLFi3EjNYsjdj3BP1lB0/QFH1T/U67cjF68IeHRaVesd+QnGTbksV +tzDfqu1XhUisHWrdOWnk4Xl4vs4Fv6EM94B7IWcnMFk= +-----END CERTIFICATE----- + +Staat der Nederlanden EV Root CA +================================ +-----BEGIN CERTIFICATE----- +MIIFcDCCA1igAwIBAgIEAJiWjTANBgkqhkiG9w0BAQsFADBYMQswCQYDVQQGEwJOTDEeMBwGA1UE +CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSkwJwYDVQQDDCBTdGFhdCBkZXIgTmVkZXJsYW5kZW4g +RVYgUm9vdCBDQTAeFw0xMDEyMDgxMTE5MjlaFw0yMjEyMDgxMTEwMjhaMFgxCzAJBgNVBAYTAk5M +MR4wHAYDVQQKDBVTdGFhdCBkZXIgTmVkZXJsYW5kZW4xKTAnBgNVBAMMIFN0YWF0IGRlciBOZWRl +cmxhbmRlbiBFViBSb290IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA48d+ifkk +SzrSM4M1LGns3Amk41GoJSt5uAg94JG6hIXGhaTK5skuU6TJJB79VWZxXSzFYGgEt9nCUiY4iKTW +O0Cmws0/zZiTs1QUWJZV1VD+hq2kY39ch/aO5ieSZxeSAgMs3NZmdO3dZ//BYY1jTw+bbRcwJu+r +0h8QoPnFfxZpgQNH7R5ojXKhTbImxrpsX23Wr9GxE46prfNeaXUmGD5BKyF/7otdBwadQ8QpCiv8 +Kj6GyzyDOvnJDdrFmeK8eEEzduG/L13lpJhQDBXd4Pqcfzho0LKmeqfRMb1+ilgnQ7O6M5HTp5gV +XJrm0w912fxBmJc+qiXbj5IusHsMX/FjqTf5m3VpTCgmJdrV8hJwRVXj33NeN/UhbJCONVrJ0yPr +08C+eKxCKFhmpUZtcALXEPlLVPxdhkqHz3/KRawRWrUgUY0viEeXOcDPusBCAUCZSCELa6fS/ZbV +0b5GnUngC6agIk440ME8MLxwjyx1zNDFjFE7PZQIZCZhfbnDZY8UnCHQqv0XcgOPvZuM5l5Tnrmd +74K74bzickFbIZTTRTeU0d8JOV3nI6qaHcptqAqGhYqCvkIH1vI4gnPah1vlPNOePqc7nvQDs/nx +fRN0Av+7oeX6AHkcpmZBiFxgV6YuCcS6/ZrPpx9Aw7vMWgpVSzs4dlG4Y4uElBbmVvMCAwEAAaNC +MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFP6rAJCYniT8qcwa +ivsnuL8wbqg7MA0GCSqGSIb3DQEBCwUAA4ICAQDPdyxuVr5Os7aEAJSrR8kN0nbHhp8dB9O2tLsI +eK9p0gtJ3jPFrK3CiAJ9Brc1AsFgyb/E6JTe1NOpEyVa/m6irn0F3H3zbPB+po3u2dfOWBfoqSmu +c0iH55vKbimhZF8ZE/euBhD/UcabTVUlT5OZEAFTdfETzsemQUHSv4ilf0X8rLiltTMMgsT7B/Zq +5SWEXwbKwYY5EdtYzXc7LMJMD16a4/CrPmEbUCTCwPTxGfARKbalGAKb12NMcIxHowNDXLldRqAN +b/9Zjr7dn3LDWyvfjFvO5QxGbJKyCqNMVEIYFRIYvdr8unRu/8G2oGTYqV9Vrp9canaW2HNnh/tN +f1zuacpzEPuKqf2evTY4SUmH9A4U8OmHuD+nT3pajnnUk+S7aFKErGzp85hwVXIy+TSrK0m1zSBi +5Dp6Z2Orltxtrpfs/J92VoguZs9btsmksNcFuuEnL5O7Jiqik7Ab846+HUCjuTaPPoIaGl6I6lD4 +WeKDRikL40Rc4ZW2aZCaFG+XroHPaO+Zmr615+F/+PoTRxZMzG0IQOeLeG9QgkRQP2YGiqtDhFZK +DyAthg710tvSeopLzaXoTvFeJiUBWSOgftL2fiFX1ye8FVdMpEbB4IMeDExNH08GGeL5qPQ6gqGy +eUN51q1veieQA6TqJIc/2b3Z6fJfUEkc7uzXLg== +-----END CERTIFICATE----- + +IdenTrust Commercial Root CA 1 +============================== +-----BEGIN CERTIFICATE----- +MIIFYDCCA0igAwIBAgIQCgFCgAAAAUUjyES1AAAAAjANBgkqhkiG9w0BAQsFADBKMQswCQYDVQQG +EwJVUzESMBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBS +b290IENBIDEwHhcNMTQwMTE2MTgxMjIzWhcNMzQwMTE2MTgxMjIzWjBKMQswCQYDVQQGEwJVUzES +MBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBSb290IENB +IDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCnUBneP5k91DNG8W9RYYKyqU+PZ4ld +hNlT3Qwo2dfw/66VQ3KZ+bVdfIrBQuExUHTRgQ18zZshq0PirK1ehm7zCYofWjK9ouuU+ehcCuz/ +mNKvcbO0U59Oh++SvL3sTzIwiEsXXlfEU8L2ApeN2WIrvyQfYo3fw7gpS0l4PJNgiCL8mdo2yMKi +1CxUAGc1bnO/AljwpN3lsKImesrgNqUZFvX9t++uP0D1bVoE/c40yiTcdCMbXTMTEl3EASX2MN0C +XZ/g1Ue9tOsbobtJSdifWwLziuQkkORiT0/Br4sOdBeo0XKIanoBScy0RnnGF7HamB4HWfp1IYVl +3ZBWzvurpWCdxJ35UrCLvYf5jysjCiN2O/cz4ckA82n5S6LgTrx+kzmEB/dEcH7+B1rlsazRGMzy +NeVJSQjKVsk9+w8YfYs7wRPCTY/JTw436R+hDmrfYi7LNQZReSzIJTj0+kuniVyc0uMNOYZKdHzV +WYfCP04MXFL0PfdSgvHqo6z9STQaKPNBiDoT7uje/5kdX7rL6B7yuVBgwDHTc+XvvqDtMwt0viAg +xGds8AgDelWAf0ZOlqf0Hj7h9tgJ4TNkK2PXMl6f+cB7D3hvl7yTmvmcEpB4eoCHFddydJxVdHix +uuFucAS6T6C6aMN7/zHwcz09lCqxC0EOoP5NiGVreTO01wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMC +AQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU7UQZwNPwBovupHu+QucmVMiONnYwDQYJKoZI +hvcNAQELBQADggIBAA2ukDL2pkt8RHYZYR4nKM1eVO8lvOMIkPkp165oCOGUAFjvLi5+U1KMtlwH +6oi6mYtQlNeCgN9hCQCTrQ0U5s7B8jeUeLBfnLOic7iPBZM4zY0+sLj7wM+x8uwtLRvM7Kqas6pg +ghstO8OEPVeKlh6cdbjTMM1gCIOQ045U8U1mwF10A0Cj7oV+wh93nAbowacYXVKV7cndJZ5t+qnt +ozo00Fl72u1Q8zW/7esUTTHHYPTa8Yec4kjixsU3+wYQ+nVZZjFHKdp2mhzpgq7vmrlR94gjmmmV +YjzlVYA211QC//G5Xc7UI2/YRYRKW2XviQzdFKcgyxilJbQN+QHwotL0AMh0jqEqSI5l2xPE4iUX +feu+h1sXIFRRk0pTAwvsXcoz7WL9RccvW9xYoIA55vrX/hMUpu09lEpCdNTDd1lzzY9GvlU47/ro +kTLql1gEIt44w8y8bckzOmoKaT+gyOpyj4xjhiO9bTyWnpXgSUyqorkqG5w2gXjtw+hG4iZZRHUe +2XWJUc0QhJ1hYMtd+ZciTY6Y5uN/9lu7rs3KSoFrXgvzUeF0K+l+J6fZmUlO+KWA2yUPHGNiiskz +Z2s8EIPGrd6ozRaOjfAHN3Gf8qv8QfXBi+wAN10J5U6A7/qxXDgGpRtK4dw4LTzcqx+QGtVKnO7R +cGzM7vRX+Bi6hG6H +-----END CERTIFICATE----- + +IdenTrust Public Sector Root CA 1 +================================= +-----BEGIN CERTIFICATE----- +MIIFZjCCA06gAwIBAgIQCgFCgAAAAUUjz0Z8AAAAAjANBgkqhkiG9w0BAQsFADBNMQswCQYDVQQG +EwJVUzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3Rv +ciBSb290IENBIDEwHhcNMTQwMTE2MTc1MzMyWhcNMzQwMTE2MTc1MzMyWjBNMQswCQYDVQQGEwJV +UzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3RvciBS +b290IENBIDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2IpT8pEiv6EdrCvsnduTy +P4o7ekosMSqMjbCpwzFrqHd2hCa2rIFCDQjrVVi7evi8ZX3yoG2LqEfpYnYeEe4IFNGyRBb06tD6 +Hi9e28tzQa68ALBKK0CyrOE7S8ItneShm+waOh7wCLPQ5CQ1B5+ctMlSbdsHyo+1W/CD80/HLaXI +rcuVIKQxKFdYWuSNG5qrng0M8gozOSI5Cpcu81N3uURF/YTLNiCBWS2ab21ISGHKTN9T0a9SvESf +qy9rg3LvdYDaBjMbXcjaY8ZNzaxmMc3R3j6HEDbhuaR672BQssvKplbgN6+rNBM5Jeg5ZuSYeqoS +mJxZZoY+rfGwyj4GD3vwEUs3oERte8uojHH01bWRNszwFcYr3lEXsZdMUD2xlVl8BX0tIdUAvwFn +ol57plzy9yLxkA2T26pEUWbMfXYD62qoKjgZl3YNa4ph+bz27nb9cCvdKTz4Ch5bQhyLVi9VGxyh +LrXHFub4qjySjmm2AcG1hp2JDws4lFTo6tyePSW8Uybt1as5qsVATFSrsrTZ2fjXctscvG29ZV/v +iDUqZi/u9rNl8DONfJhBaUYPQxxp+pu10GFqzcpL2UyQRqsVWaFHVCkugyhfHMKiq3IXAAaOReyL +4jM9f9oZRORicsPfIsbyVtTdX5Vy7W1f90gDW/3FKqD2cyOEEBsB5wIDAQABo0IwQDAOBgNVHQ8B +Af8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU43HgntinQtnbcZFrlJPrw6PRFKMw +DQYJKoZIhvcNAQELBQADggIBAEf63QqwEZE4rU1d9+UOl1QZgkiHVIyqZJnYWv6IAcVYpZmxI1Qj +t2odIFflAWJBF9MJ23XLblSQdf4an4EKwt3X9wnQW3IV5B4Jaj0z8yGa5hV+rVHVDRDtfULAj+7A +mgjVQdZcDiFpboBhDhXAuM/FSRJSzL46zNQuOAXeNf0fb7iAaJg9TaDKQGXSc3z1i9kKlT/YPyNt +GtEqJBnZhbMX73huqVjRI9PHE+1yJX9dsXNw0H8GlwmEKYBhHfpe/3OsoOOJuBxxFcbeMX8S3OFt +m6/n6J91eEyrRjuazr8FGF1NFTwWmhlQBJqymm9li1JfPFgEKCXAZmExfrngdbkaqIHWchezxQMx +NRF4eKLg6TCMf4DfWN88uieW4oA0beOY02QnrEh+KHdcxiVhJfiFDGX6xDIvpZgF5PgLZxYWxoK4 +Mhn5+bl53B/N66+rDt0b20XkeucC4pVd/GnwU2lhlXV5C15V5jgclKlZM57IcXR5f1GJtshquDDI +ajjDbp7hNxbqBWJMWxJH7ae0s1hWx0nzfxJoCTFx8G34Tkf71oXuxVhAGaQdp/lLQzfcaFpPz+vC +ZHTetBXZ9FRUGi8c15dxVJCO2SCdUyt/q4/i6jC8UDfv8Ue1fXwsBOxonbRJRBD0ckscZOf85muQ +3Wl9af0AVqW3rLatt8o+Ae+c +-----END CERTIFICATE----- + +Entrust Root Certification Authority - G2 +========================================= +-----BEGIN CERTIFICATE----- +MIIEPjCCAyagAwIBAgIESlOMKDANBgkqhkiG9w0BAQsFADCBvjELMAkGA1UEBhMCVVMxFjAUBgNV +BAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVy +bXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ug +b25seTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIw +HhcNMDkwNzA3MTcyNTU0WhcNMzAxMjA3MTc1NTU0WjCBvjELMAkGA1UEBhMCVVMxFjAUBgNVBAoT +DUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVybXMx +OTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25s +eTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIwggEi +MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC6hLZy254Ma+KZ6TABp3bqMriVQRrJ2mFOWHLP +/vaCeb9zYQYKpSfYs1/TRU4cctZOMvJyig/3gxnQaoCAAEUesMfnmr8SVycco2gvCoe9amsOXmXz +HHfV1IWNcCG0szLni6LVhjkCsbjSR87kyUnEO6fe+1R9V77w6G7CebI6C1XiUJgWMhNcL3hWwcKU +s/Ja5CeanyTXxuzQmyWC48zCxEXFjJd6BmsqEZ+pCm5IO2/b1BEZQvePB7/1U1+cPvQXLOZprE4y +TGJ36rfo5bs0vBmLrpxR57d+tVOxMyLlbc9wPBr64ptntoP0jaWvYkxN4FisZDQSA/i2jZRjJKRx +AgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqciZ6 +0B7vfec7aVHUbI2fkBJmqzANBgkqhkiG9w0BAQsFAAOCAQEAeZ8dlsa2eT8ijYfThwMEYGprmi5Z +iXMRrEPR9RP/jTkrwPK9T3CMqS/qF8QLVJ7UG5aYMzyorWKiAHarWWluBh1+xLlEjZivEtRh2woZ +Rkfz6/djwUAFQKXSt/S1mja/qYh2iARVBCuch38aNzx+LaUa2NSJXsq9rD1s2G2v1fN2D807iDgi +nWyTmsQ9v4IbZT+mD12q/OWyFcq1rca8PdCE6OoGcrBNOTJ4vz4RnAuknZoh8/CbCzB428Hch0P+ +vGOaysXCHMnHjf87ElgI5rY97HosTvuDls4MPGmHVHOkc8KT/1EQrBVUAdj8BbGJoX90g5pJ19xO +e4pIb4tF9g== +-----END CERTIFICATE----- + +Entrust Root Certification Authority - EC1 +========================================== +-----BEGIN CERTIFICATE----- +MIIC+TCCAoCgAwIBAgINAKaLeSkAAAAAUNCR+TAKBggqhkjOPQQDAzCBvzELMAkGA1UEBhMCVVMx +FjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVn +YWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDEyIEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXpl +ZCB1c2Ugb25seTEzMDEGA1UEAxMqRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5 +IC0gRUMxMB4XDTEyMTIxODE1MjUzNloXDTM3MTIxODE1NTUzNlowgb8xCzAJBgNVBAYTAlVTMRYw +FAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3QubmV0L2xlZ2Fs +LXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxMiBFbnRydXN0LCBJbmMuIC0gZm9yIGF1dGhvcml6ZWQg +dXNlIG9ubHkxMzAxBgNVBAMTKkVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAt +IEVDMTB2MBAGByqGSM49AgEGBSuBBAAiA2IABIQTydC6bUF74mzQ61VfZgIaJPRbiWlH47jCffHy +AsWfoPZb1YsGGYZPUxBtByQnoaD41UcZYUx9ypMn6nQM72+WCf5j7HBdNq1nd67JnXxVRDqiY1Ef +9eNi1KlHBz7MIKNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE +FLdj5xrdjekIplWDpOBqUEFlEUJJMAoGCCqGSM49BAMDA2cAMGQCMGF52OVCR98crlOZF7ZvHH3h +vxGU0QOIdeSNiaSKd0bebWHvAvX7td/M/k7//qnmpwIwW5nXhTcGtXsI/esni0qU+eH6p44mCOh8 +kmhtc9hvJqwhAriZtyZBWyVgrtBIGu4G +-----END CERTIFICATE----- + +CFCA EV ROOT +============ +-----BEGIN CERTIFICATE----- +MIIFjTCCA3WgAwIBAgIEGErM1jANBgkqhkiG9w0BAQsFADBWMQswCQYDVQQGEwJDTjEwMC4GA1UE +CgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQDDAxDRkNB +IEVWIFJPT1QwHhcNMTIwODA4MDMwNzAxWhcNMjkxMjMxMDMwNzAxWjBWMQswCQYDVQQGEwJDTjEw +MC4GA1UECgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQD +DAxDRkNBIEVWIFJPT1QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDXXWvNED8fBVnV +BU03sQ7smCuOFR36k0sXgiFxEFLXUWRwFsJVaU2OFW2fvwwbwuCjZ9YMrM8irq93VCpLTIpTUnrD +7i7es3ElweldPe6hL6P3KjzJIx1qqx2hp/Hz7KDVRM8Vz3IvHWOX6Jn5/ZOkVIBMUtRSqy5J35DN +uF++P96hyk0g1CXohClTt7GIH//62pCfCqktQT+x8Rgp7hZZLDRJGqgG16iI0gNyejLi6mhNbiyW +ZXvKWfry4t3uMCz7zEasxGPrb382KzRzEpR/38wmnvFyXVBlWY9ps4deMm/DGIq1lY+wejfeWkU7 +xzbh72fROdOXW3NiGUgthxwG+3SYIElz8AXSG7Ggo7cbcNOIabla1jj0Ytwli3i/+Oh+uFzJlU9f +py25IGvPa931DfSCt/SyZi4QKPaXWnuWFo8BGS1sbn85WAZkgwGDg8NNkt0yxoekN+kWzqotaK8K +gWU6cMGbrU1tVMoqLUuFG7OA5nBFDWteNfB/O7ic5ARwiRIlk9oKmSJgamNgTnYGmE69g60dWIol +hdLHZR4tjsbftsbhf4oEIRUpdPA+nJCdDC7xij5aqgwJHsfVPKPtl8MeNPo4+QgO48BdK4PRVmrJ +tqhUUy54Mmc9gn900PvhtgVguXDbjgv5E1hvcWAQUhC5wUEJ73IfZzF4/5YFjQIDAQABo2MwYTAf +BgNVHSMEGDAWgBTj/i39KNALtbq2osS/BqoFjJP7LzAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB +/wQEAwIBBjAdBgNVHQ4EFgQU4/4t/SjQC7W6tqLEvwaqBYyT+y8wDQYJKoZIhvcNAQELBQADggIB +ACXGumvrh8vegjmWPfBEp2uEcwPenStPuiB/vHiyz5ewG5zz13ku9Ui20vsXiObTej/tUxPQ4i9q +ecsAIyjmHjdXNYmEwnZPNDatZ8POQQaIxffu2Bq41gt/UP+TqhdLjOztUmCypAbqTuv0axn96/Ua +4CUqmtzHQTb3yHQFhDmVOdYLO6Qn+gjYXB74BGBSESgoA//vU2YApUo0FmZ8/Qmkrp5nGm9BC2sG +E5uPhnEFtC+NiWYzKXZUmhH4J/qyP5Hgzg0b8zAarb8iXRvTvyUFTeGSGn+ZnzxEk8rUQElsgIfX +BDrDMlI1Dlb4pd19xIsNER9Tyx6yF7Zod1rg1MvIB671Oi6ON7fQAUtDKXeMOZePglr4UeWJoBjn +aH9dCi77o0cOPaYjesYBx4/IXr9tgFa+iiS6M+qf4TIRnvHST4D2G0CvOJ4RUHlzEhLN5mydLIhy +PDCBBpEi6lmt2hkuIsKNuYyH4Ga8cyNfIWRjgEj1oDwYPZTISEEdQLpe/v5WOaHIz16eGWRGENoX +kbcFgKyLmZJ956LYBws2J+dIeWCKw9cTXPhyQN9Ky8+ZAAoACxGV2lZFA4gKn2fQ1XmxqI1AbQ3C +ekD6819kR5LLU7m7Wc5P/dAVUwHY3+vZ5nbv0CO7O6l5s9UCKc2Jo5YPSjXnTkLAdc0Hz+Ys63su +-----END CERTIFICATE----- diff --git a/libraries/joomla/http/transport/curl.php b/libraries/joomla/http/transport/curl.php index e96af9c33e4ec..aef422cfaa69f 100644 --- a/libraries/joomla/http/transport/curl.php +++ b/libraries/joomla/http/transport/curl.php @@ -75,9 +75,6 @@ public function request($method, JUri $uri, $data = null, array $headers = null, break; case 'PUT': - $options[CURLOPT_PUT] = true; - break; - default: $options[CURLOPT_CUSTOMREQUEST] = strtoupper($method); break; diff --git a/libraries/joomla/image/image.php b/libraries/joomla/image/image.php index 4e469dd663427..9654d46e98adc 100644 --- a/libraries/joomla/image/image.php +++ b/libraries/joomla/image/image.php @@ -52,6 +52,24 @@ class JImage */ const SCALE_FIT = 6; + /** + * @const string + * @since 3.4.2 + */ + const ORIENTATION_LANDSCAPE = 'landscape'; + + /** + * @const string + * @since 3.4.2 + */ + const ORIENTATION_PORTRAIT = 'portrait'; + + /** + * @const string + * @since 3.4.2 + */ + const ORIENTATION_SQUARE = 'square'; + /** * @var resource The image resource handle. * @since 11.3 @@ -95,8 +113,8 @@ public function __construct($source = null) { $info = gd_info(); self::$formats[IMAGETYPE_JPEG] = ($info['JPEG Support']) ? true : false; - self::$formats[IMAGETYPE_PNG] = ($info['PNG Support']) ? true : false; - self::$formats[IMAGETYPE_GIF] = ($info['GIF Read Support']) ? true : false; + self::$formats[IMAGETYPE_PNG] = ($info['PNG Support']) ? true : false; + self::$formats[IMAGETYPE_GIF] = ($info['GIF Read Support']) ? true : false; } // If the source input is a resource, set it as the image handle. @@ -112,15 +130,15 @@ public function __construct($source = null) } /** - * Method to return a properties object for an image given a filesystem path. The - * result object has values for image width, height, type, attributes, mime type, bits, - * and channels. + * Method to return a properties object for an image given a filesystem path. + * The result object has values for image width, height, type, attributes, bits, channels, mime type, file size and orientation. * * @param string $path The filesystem path to the image for which to get properties. * * @return stdClass * * @since 11.3 + * * @throws InvalidArgumentException * @throws RuntimeException */ @@ -145,18 +163,63 @@ public static function getImageFileProperties($path) // Build the response object. $properties = (object) array( - 'width' => $info[0], - 'height' => $info[1], - 'type' => $info[2], - 'attributes' => $info[3], - 'bits' => isset($info['bits']) ? $info['bits'] : null, - 'channels' => isset($info['channels']) ? $info['channels'] : null, - 'mime' => $info['mime'] + 'width' => $info[0], + 'height' => $info[1], + 'type' => $info[2], + 'attributes' => $info[3], + 'bits' => isset($info['bits']) ? $info['bits'] : null, + 'channels' => isset($info['channels']) ? $info['channels'] : null, + 'mime' => $info['mime'], + 'filesize' => filesize($path), + 'orientation' => self::getOrientationString((int) $info[0], (int) $info[1]) ); return $properties; } + /** + * Method to detect whether an image's orientation is landscape, portrait or square. + * The orientation will be returned as a string. + * + * @return mixed Orientation string or null. + * + * @since 3.4.2 + */ + public function getOrientation() + { + if ($this->isLoaded()) + { + return self::getOrientationString($this->getWidth(), $this->getHeight()); + } + + return null; + } + + /** + * Compare width and height integers to determine image orientation. + * + * @param integer $width The width value to use for calculation + * @param integer $height The height value to use for calculation + * + * @return string Orientation string + * + * @since 3.4.2 + */ + static private function getOrientationString($width, $height) + { + if ($width > $height) + { + return self::ORIENTATION_LANDSCAPE; + } + + if ($width < $height) + { + return self::ORIENTATION_PORTRAIT; + } + + return self::ORIENTATION_SQUARE; + } + /** * Method to generate thumbnails from the current image. It allows * creation by resizing or cropping the original image. @@ -272,13 +335,13 @@ public function createThumbs($thumbSizes, $creationMethod = self::SCALE_INSIDE, foreach ($thumbs as $thumb) { // Get thumb properties - $thumbWidth = $thumb->getWidth(); - $thumbHeight = $thumb->getHeight(); + $thumbWidth = $thumb->getWidth(); + $thumbHeight = $thumb->getHeight(); // Generate thumb name - $filename = pathinfo($this->getPath(), PATHINFO_FILENAME); - $fileExtension = pathinfo($this->getPath(), PATHINFO_EXTENSION); - $thumbFileName = $filename . '_' . $thumbWidth . 'x' . $thumbHeight . '.' . $fileExtension; + $filename = pathinfo($this->getPath(), PATHINFO_FILENAME); + $fileExtension = pathinfo($this->getPath(), PATHINFO_EXTENSION); + $thumbFileName = $filename . '_' . $thumbWidth . 'x' . $thumbHeight . '.' . $fileExtension; // Save thumb file to disk $thumbFileName = $thumbsFolder . '/' . $thumbFileName; @@ -286,7 +349,7 @@ public function createThumbs($thumbSizes, $creationMethod = self::SCALE_INSIDE, if ($thumb->toFile($thumbFileName, $imgProperties->type)) { // Return JImage object with thumb path to ease further manipulation - $thumb->path = $thumbFileName; + $thumb->path = $thumbFileName; $thumbsCreated[] = $thumb; } } @@ -351,7 +414,7 @@ public function crop($width, $height, $left = null, $top = null, $createNew = tr if ($this->isTransparent()) { // Get the transparent color values for the current image. - $rgba = imageColorsForIndex($this->handle, imagecolortransparent($this->handle)); + $rgba = imageColorsForIndex($this->handle, imagecolortransparent($this->handle)); $color = imageColorAllocateAlpha($handle, $rgba['red'], $rgba['green'], $rgba['blue'], $rgba['alpha']); // Set the transparent color values for the new image. @@ -658,15 +721,15 @@ public function resize($width, $height, $createNew = true, $scaleMethod = self:: $dimensions = $this->prepareDimensions($width, $height, $scaleMethod); // Instantiate offset. - $offset = new stdClass; + $offset = new stdClass; $offset->x = $offset->y = 0; // Center image if needed and create the new truecolor image handle. if ($scaleMethod == self::SCALE_FIT) { // Get the offsets - $offset->x = round(($width - $dimensions->width) / 2); - $offset->y = round(($height - $dimensions->height) / 2); + $offset->x = round(($width - $dimensions->width) / 2); + $offset->y = round(($height - $dimensions->height) / 2); $handle = imagecreatetruecolor($width, $height); @@ -689,7 +752,7 @@ public function resize($width, $height, $createNew = true, $scaleMethod = self:: if ($this->isTransparent()) { // Get the transparent color values for the current image. - $rgba = imageColorsForIndex($this->handle, imagecolortransparent($this->handle)); + $rgba = imageColorsForIndex($this->handle, imagecolortransparent($this->handle)); $color = imageColorAllocateAlpha($handle, $rgba['red'], $rgba['green'], $rgba['blue'], $rgba['alpha']); // Set the transparent color values for the new image. @@ -761,10 +824,10 @@ public function resize($width, $height, $createNew = true, $scaleMethod = self:: */ public function cropResize($width, $height, $createNew = true) { - $width = $this->sanitizeWidth($width, $height); - $height = $this->sanitizeHeight($height, $width); + $width = $this->sanitizeWidth($width, $height); + $height = $this->sanitizeHeight($height, $width); - $resizewidth = $width; + $resizewidth = $width; $resizeheight = $height; if (($this->getWidth() / $width) < ($this->getHeight() / $height)) @@ -960,7 +1023,7 @@ protected function prepareDimensions($width, $height, $scaleMethod) $ratio = min($rx, $ry); } - $dimensions->width = (int) round($this->getWidth() / $ratio); + $dimensions->width = (int) round($this->getWidth() / $ratio); $dimensions->height = (int) round($this->getHeight() / $ratio); break; diff --git a/libraries/joomla/input/files.php b/libraries/joomla/input/files.php index 23aeceffd8c3f..06654a5be2bde 100644 --- a/libraries/joomla/input/files.php +++ b/libraries/joomla/input/files.php @@ -47,15 +47,6 @@ public function __construct(array $source = null, array $options = array()) // Set the data source. $this->data = & $_FILES; - // Scan the files in the array - if (!empty($this->data)) - { - foreach ($this->data as $name => &$descriptor) - { - $descriptor['safe'] = JFilterInput::isSafeFile($descriptor); - } - } - // Set the options for the class. $this->options = $options; } @@ -76,15 +67,6 @@ public function get($name, $default = null, $filter = 'cmd') { if (isset($this->data[$name])) { - // Prevent returning an unsafe file unless specifically requested - if (!$this->data[$name]['safe']) - { - if ($filter != 'raw') - { - return $default; - } - } - $results = $this->decodeData( array( $this->data[$name]['name'], @@ -95,6 +77,17 @@ public function get($name, $default = null, $filter = 'cmd') ) ); + // Prevent returning an unsafe file unless speciffically requested + if ($filter != 'raw') + { + $isSafe = JFilterInput::isSafeFile($results); + + if (!$isSafe) + { + return $default; + } + } + return $results; } diff --git a/libraries/joomla/input/input.php b/libraries/joomla/input/input.php index 110c739fb8e19..0ed0f735402b4 100644 --- a/libraries/joomla/input/input.php +++ b/libraries/joomla/input/input.php @@ -176,21 +176,54 @@ public function get($name, $default = null, $filter = 'cmd') /** * Gets an array of values from the request. * - * @param array $vars Associative array of keys and filter types to apply. - * If empty and datasource is null, all the input data will be returned - * but filtered using the default case in JFilterInput::clean. - * @param mixed $datasource Array to retrieve data from, or null + * @param array $vars Associative array of keys and filter types to apply. + * If empty and datasource is null, all the input data will be returned + * but filtered using the filter given by the parameter defaultFilter in + * JFilterInput::clean. + * @param mixed $datasource Array to retrieve data from, or null. + * @param string $defaultFilter Default filter used in JFilterInput::clean if vars is empty and + * datasource is null. If 'unknown', the default case is used in + * JFilterInput::clean. * * @return mixed The filtered input data. * * @since 11.1 */ - public function getArray(array $vars = array(), $datasource = null) + public function getArray(array $vars = array(), $datasource = null, $defaultFilter = 'unknown') + { + return $this->getArrayRecursive($vars, $datasource, $defaultFilter, false); + } + + /** + * Gets an array of values from the request. + * + * @param array $vars Associative array of keys and filter types to apply. + * If empty and datasource is null, all the input data will be returned + * but filtered using the filter given by the parameter defaultFilter in + * JFilterInput::clean. + * @param mixed $datasource Array to retrieve data from, or null. + * @param string $defaultFilter Default filter used in JFilterInput::clean if vars is empty and + * datasource is null. If 'unknown', the default case is used in + * JFilterInput::clean. + * @param bool $recursion Flag to indicate a recursive function call. + * + * @return mixed The filtered input data. + * + * @since 3.4.2 + */ + protected function getArrayRecursive(array $vars = array(), $datasource = null, $defaultFilter = 'unknown', $recursion = false) { if (empty($vars) && is_null($datasource)) { $vars = $this->data; } + else + { + if (!$recursion) + { + $defaultFilter = null; + } + } $results = array(); @@ -200,26 +233,28 @@ public function getArray(array $vars = array(), $datasource = null) { if (is_null($datasource)) { - $results[$k] = $this->getArray($v, $this->get($k, null, 'array')); + $results[$k] = $this->getArrayRecursive($v, $this->get($k, null, 'array'), $defaultFilter, true); } else { - $results[$k] = $this->getArray($v, $datasource[$k]); + $results[$k] = $this->getArrayRecursive($v, $datasource[$k], $defaultFilter, true); } } else { + $filter = isset($defaultFilter) ? $defaultFilter : $v; + if (is_null($datasource)) { - $results[$k] = $this->get($k, null, $v); + $results[$k] = $this->get($k, null, $filter); } elseif (isset($datasource[$k])) { - $results[$k] = $this->filter->clean($datasource[$k], $v); + $results[$k] = $this->filter->clean($datasource[$k], $filter); } else { - $results[$k] = $this->filter->clean(null, $v); + $results[$k] = $this->filter->clean(null, $filter); } } } @@ -298,7 +333,9 @@ public function __call($name, $arguments) */ public function getMethod() { - $method = strtoupper($_SERVER['REQUEST_METHOD']); + // Get method if exist + $method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : ''; + $method = strtoupper($method); return $method; } diff --git a/libraries/joomla/keychain/keychain.php b/libraries/joomla/keychain/keychain.php index a591e1f98a8d4..ea86d9a7bef5e 100644 --- a/libraries/joomla/keychain/keychain.php +++ b/libraries/joomla/keychain/keychain.php @@ -84,17 +84,17 @@ public function deleteValue($path) // Traverse the registry to find the correct node for the result. for ($i = 0, $n = count($nodes) - 1; $i < $n; $i++) { - if (!isset($node->$nodes[$i]) && ($i != $n)) + if (!isset($node->{$nodes[$i]}) && ($i != $n)) { - $node->$nodes[$i] = new stdClass; + $node->{$nodes[$i]} = new stdClass; } - $node = $node->$nodes[$i]; + $node = $node->{$nodes[$i]}; } // Get the old value if exists so we can return it - $result = $node->$nodes[$i]; - unset($node->$nodes[$i]); + $result = $node->{$nodes[$i]}; + unset($node->{$nodes[$i]}); } return $result; diff --git a/libraries/joomla/session/storage/memcache.php b/libraries/joomla/session/storage/memcache.php index 893583efe6250..7abe812fc9052 100644 --- a/libraries/joomla/session/storage/memcache.php +++ b/libraries/joomla/session/storage/memcache.php @@ -74,7 +74,7 @@ public function register() * * @since 12.1 */ - static public function isSupported() + public static function isSupported() { return (extension_loaded('memcache') && class_exists('Memcache')); } diff --git a/libraries/joomla/session/storage/memcached.php b/libraries/joomla/session/storage/memcached.php index 71b3233ec1f7d..f44fdc008062d 100644 --- a/libraries/joomla/session/storage/memcached.php +++ b/libraries/joomla/session/storage/memcached.php @@ -74,7 +74,7 @@ public function register() * * @since 12.1 */ - static public function isSupported() + public static function isSupported() { return (extension_loaded('memcached') && class_exists('Memcached')); } diff --git a/libraries/joomla/session/storage/wincache.php b/libraries/joomla/session/storage/wincache.php index 28c84d9353493..ff53c3a7e9551 100644 --- a/libraries/joomla/session/storage/wincache.php +++ b/libraries/joomla/session/storage/wincache.php @@ -53,7 +53,7 @@ public function register() * * @since 12.1 */ - static public function isSupported() + public static function isSupported() { return (extension_loaded('wincache') && function_exists('wincache_ucache_get') && !strcmp(ini_get('wincache.ucenabled'), "1")); } diff --git a/libraries/joomla/session/storage/xcache.php b/libraries/joomla/session/storage/xcache.php index 7995ae7ad6dfb..80935af031660 100644 --- a/libraries/joomla/session/storage/xcache.php +++ b/libraries/joomla/session/storage/xcache.php @@ -101,7 +101,7 @@ public function destroy($id) * * @since 12.1 */ - static public function isSupported() + public static function isSupported() { return (extension_loaded('xcache')); } diff --git a/libraries/joomla/string/punycode.php b/libraries/joomla/string/punycode.php index b463bd646c79d..4efbf624639f9 100644 --- a/libraries/joomla/string/punycode.php +++ b/libraries/joomla/string/punycode.php @@ -9,7 +9,7 @@ defined('JPATH_PLATFORM') or die; -JLoader::register('idna_convert', JPATH_ROOT . '/libraries/idna_convert/idna_convert.class.php'); +JLoader::register('idna_convert', JPATH_LIBRARIES . '/idna_convert/idna_convert.class.php'); /** * Joomla Platform String Punycode Class diff --git a/libraries/joomla/string/wrapper/punycode.php b/libraries/joomla/string/wrapper/punycode.php index 1b12d3ad2ea33..036935aa65a7e 100644 --- a/libraries/joomla/string/wrapper/punycode.php +++ b/libraries/joomla/string/wrapper/punycode.php @@ -9,7 +9,7 @@ defined('JPATH_PLATFORM') or die; -JLoader::register('idna_convert', JPATH_ROOT . '/libraries/idna_convert/idna_convert.class.php'); +JLoader::register('idna_convert', JPATH_LIBRARIES . '/idna_convert/idna_convert.class.php'); /** * Wrapper class for JStringPunycode diff --git a/libraries/joomla/table/asset.php b/libraries/joomla/table/asset.php index 4c29a284f71bd..37b8ddca433f5 100644 --- a/libraries/joomla/table/asset.php +++ b/libraries/joomla/table/asset.php @@ -119,6 +119,10 @@ public function check() return false; } + if (empty($this->rules)) + { + $this->rules = '{}'; + } } return true; diff --git a/libraries/joomla/table/table.php b/libraries/joomla/table/table.php index a5803c356f3fd..9918273970a42 100644 --- a/libraries/joomla/table/table.php +++ b/libraries/joomla/table/table.php @@ -260,7 +260,7 @@ public function getFields() * @param string $prefix An optional prefix for the table class name. * @param array $config An optional array of configuration values for the JTable object. * - * @return mixed A JTable object if found or boolean false if one could not be found. + * @return JTable|boolean A JTable object if found or boolean false on failure. * * @link https://docs.joomla.org/JTable/getInstance * @since 11.1 @@ -441,7 +441,7 @@ public function appendPrimaryKeys($query, $pk = null) $pk = (object) $pk; - foreach ($this->_tbl_keys AS $k) + foreach ($this->_tbl_keys as $k) { $query->where($this->_db->quoteName($k) . ' = ' . $this->_db->quote($pk->$k)); } @@ -1520,11 +1520,18 @@ public function move($delta, $where = '') */ public function publish($pks = null, $state = 1, $userId = 0) { - $k = $this->_tbl_keys; + // Sanitize input + $userId = (int) $userId; + $state = (int) $state; if (!is_null($pks)) { - foreach ($pks AS $key => $pk) + if (!is_array($pks)) + { + $pks = array($pks); + } + + foreach ($pks as $key => $pk) { if (!is_array($pk)) { @@ -1533,9 +1540,6 @@ public function publish($pks = null, $state = 1, $userId = 0) } } - $userId = (int) $userId; - $state = (int) $state; - // If there are no primary keys set check to see if the instance key is set. if (empty($pks)) { @@ -1545,11 +1549,13 @@ public function publish($pks = null, $state = 1, $userId = 0) { if ($this->$key) { - $pk[$this->$key] = $this->$key; + $pk[$key] = $this->$key; } // We don't have a full primary key - return false else { + $this->setError(JText::_('JLIB_DATABASE_ERROR_NO_ROWS_SELECTED')); + return false; } } @@ -1557,7 +1563,7 @@ public function publish($pks = null, $state = 1, $userId = 0) $pks = array($pk); } - foreach ($pks AS $pk) + foreach ($pks as $pk) { // Update the publishing state for rows with the given primary keys. $query = $this->_db->getQuery(true) @@ -1579,7 +1585,17 @@ public function publish($pks = null, $state = 1, $userId = 0) $this->appendPrimaryKeys($query, $pk); $this->_db->setQuery($query); - $this->_db->execute(); + + try + { + $this->_db->execute(); + } + catch (RuntimeException $e) + { + $this->setError($e->getMessage()); + + return false; + } // If checkin is supported and all rows were adjusted, check them in. if ($checkin && (count($pks) == $this->_db->getAffectedRows())) @@ -1587,6 +1603,7 @@ public function publish($pks = null, $state = 1, $userId = 0) $this->checkin($pk); } + // If the JTable instance value is in the list of primary keys that were set, set the instance. $ours = true; foreach ($this->_tbl_keys AS $key) @@ -1599,7 +1616,8 @@ public function publish($pks = null, $state = 1, $userId = 0) if ($ours) { - $this->published = $state; + $publishedField = $this->getColumnAlias('published'); + $this->$publishedField = $state; } } diff --git a/libraries/joomla/twitter/users.php b/libraries/joomla/twitter/users.php index b17ce6297fbfc..c667550381f50 100644 --- a/libraries/joomla/twitter/users.php +++ b/libraries/joomla/twitter/users.php @@ -160,7 +160,7 @@ public function searchUsers($query, $page = 0, $count = 0, $entities = null) public function getUser($user, $entities = null) { // Check the rate limit for remaining hits - $this->checkRateLimit('users', 'show'); + $this->checkRateLimit('users', 'show/:id'); // Determine which type of data was passed for $user if (is_numeric($user)) diff --git a/libraries/joomla/uri/uri.php b/libraries/joomla/uri/uri.php index ccff0b6619cbd..d42031c3b4b0d 100644 --- a/libraries/joomla/uri/uri.php +++ b/libraries/joomla/uri/uri.php @@ -57,7 +57,7 @@ class JUri extends Uri */ public static function getInstance($uri = 'SERVER') { - if (empty(self::$instances[$uri])) + if (empty(static::$instances[$uri])) { // Are we obtaining the URI from the server? if ($uri == 'SERVER') @@ -111,10 +111,10 @@ public static function getInstance($uri = 'SERVER') $theURI = $uri; } - self::$instances[$uri] = new JUri($theURI); + static::$instances[$uri] = new static($theURI); } - return self::$instances[$uri]; + return static::$instances[$uri]; } /** @@ -129,29 +129,29 @@ public static function getInstance($uri = 'SERVER') public static function base($pathonly = false) { // Get the base request path. - if (empty(self::$base)) + if (empty(static::$base)) { $config = JFactory::getConfig(); - $uri = self::getInstance(); + $uri = static::getInstance(); $live_site = ($uri->isSSL()) ? str_replace("http://", "https://", $config->get('live_site')) : $config->get('live_site'); if (trim($live_site) != '') { - $uri = self::getInstance($live_site); - self::$base['prefix'] = $uri->toString(array('scheme', 'host', 'port')); - self::$base['path'] = rtrim($uri->toString(array('path')), '/\\'); + $uri = static::getInstance($live_site); + static::$base['prefix'] = $uri->toString(array('scheme', 'host', 'port')); + static::$base['path'] = rtrim($uri->toString(array('path')), '/\\'); if (defined('JPATH_BASE') && defined('JPATH_ADMINISTRATOR')) { if (JPATH_BASE == JPATH_ADMINISTRATOR) { - self::$base['path'] .= '/administrator'; + static::$base['path'] .= '/administrator'; } } } else { - self::$base['prefix'] = $uri->toString(array('scheme', 'host', 'port')); + static::$base['prefix'] = $uri->toString(array('scheme', 'host', 'port')); if (strpos(php_sapi_name(), 'cgi') !== false && !ini_get('cgi.fix_pathinfo') && !empty($_SERVER['REQUEST_URI'])) { @@ -167,11 +167,11 @@ public static function base($pathonly = false) $script_name = $_SERVER['SCRIPT_NAME']; } - self::$base['path'] = rtrim(dirname($script_name), '/\\'); + static::$base['path'] = rtrim(dirname($script_name), '/\\'); } } - return $pathonly === false ? self::$base['prefix'] . self::$base['path'] . '/' : self::$base['path']; + return $pathonly === false ? static::$base['prefix'] . static::$base['path'] . '/' : static::$base['path']; } /** @@ -187,20 +187,20 @@ public static function base($pathonly = false) public static function root($pathonly = false, $path = null) { // Get the scheme - if (empty(self::$root)) + if (empty(static::$root)) { - $uri = self::getInstance(self::base()); - self::$root['prefix'] = $uri->toString(array('scheme', 'host', 'port')); - self::$root['path'] = rtrim($uri->toString(array('path')), '/\\'); + $uri = static::getInstance(static::base()); + static::$root['prefix'] = $uri->toString(array('scheme', 'host', 'port')); + static::$root['path'] = rtrim($uri->toString(array('path')), '/\\'); } // Get the scheme if (isset($path)) { - self::$root['path'] = $path; + static::$root['path'] = $path; } - return $pathonly === false ? self::$root['prefix'] . self::$root['path'] . '/' : self::$root['path']; + return $pathonly === false ? static::$root['prefix'] . static::$root['path'] . '/' : static::$root['path']; } /** @@ -213,13 +213,13 @@ public static function root($pathonly = false, $path = null) public static function current() { // Get the current URL. - if (empty(self::$current)) + if (empty(static::$current)) { - $uri = self::getInstance(); - self::$current = $uri->toString(array('scheme', 'host', 'port', 'path')); + $uri = static::getInstance(); + static::$current = $uri->toString(array('scheme', 'host', 'port', 'path')); } - return self::$current; + return static::$current; } /** @@ -231,10 +231,10 @@ public static function current() */ public static function reset() { - self::$instances = array(); - self::$base = array(); - self::$root = array(); - self::$current = ''; + static::$instances = array(); + static::$base = array(); + static::$root = array(); + static::$current = ''; } /** @@ -264,11 +264,11 @@ public function setPath($path) */ public static function isInternal($url) { - $uri = self::getInstance($url); + $uri = static::getInstance($url); $base = $uri->toString(array('scheme', 'host', 'port', 'path')); $host = $uri->toString(array('scheme', 'host', 'port')); - if (stripos($base, self::base()) !== 0 && !empty($host)) + if (stripos($base, static::base()) !== 0 && !empty($host)) { return false; } diff --git a/libraries/joomla/utilities/arrayhelper.php b/libraries/joomla/utilities/arrayhelper.php index b26823b9ad3a7..3b73a1253792c 100644 --- a/libraries/joomla/utilities/arrayhelper.php +++ b/libraries/joomla/utilities/arrayhelper.php @@ -457,8 +457,8 @@ protected static function _sortObjects(&$a, &$b) $locale = self::$sortLocale[$i]; } - $va = $a->$key[$i]; - $vb = $b->$key[$i]; + $va = $a->{$key[$i]}; + $vb = $b->{$key[$i]}; if ((is_bool($va) || is_numeric($va)) && (is_bool($vb) || is_numeric($vb))) { diff --git a/libraries/legacy/application/application.php b/libraries/legacy/application/application.php index e6f18c8b85cb3..ea3c9684cfb14 100644 --- a/libraries/legacy/application/application.php +++ b/libraries/legacy/application/application.php @@ -809,7 +809,7 @@ public function getTemplate($params = false) * @since 11.1 * @deprecated 4.0 */ - static public function getRouter($name = null, array $options = array()) + public static function getRouter($name = null, array $options = array()) { if (!isset($name)) { @@ -841,7 +841,7 @@ static public function getRouter($name = null, array $options = array()) * @since 11.1 * @deprecated 4.0 Use JApplicationHelper::stringURLSafe instead */ - static public function stringURLSafe($string) + public static function stringURLSafe($string) { return JApplicationHelper::stringURLSafe($string); } diff --git a/libraries/legacy/categories/categories.php b/libraries/legacy/categories/categories.php index 9f94840291b65..6e0e68692255a 100644 --- a/libraries/legacy/categories/categories.php +++ b/libraries/legacy/categories/categories.php @@ -106,6 +106,8 @@ public function __construct($options) $this->_statefield = (isset($options['statefield'])) ? $options['statefield'] : 'state'; $options['access'] = (isset($options['access'])) ? $options['access'] : 'true'; $options['published'] = (isset($options['published'])) ? $options['published'] : 1; + $options['countItems'] = (isset($options['countItems'])) ? $options['countItems'] : 0; + $options['currentlang'] = JLanguageMultilang::isEnabled() ? JFactory::getLanguage()->getTag() : 0; $this->_options = $options; return true; @@ -259,20 +261,21 @@ protected function _load($id) ->where('badcats.id is null'); // Note: i for item - if (isset($this->_options['countItems']) && $this->_options['countItems'] == 1) + if ($this->_options['currentlang'] !== 0 || $this->_options['countItems'] == 1) { + $queryjoin = $db->quoteName($this->_table) . ' AS i ON i.' . $db->quoteName($this->_field) . ' = c.id'; + if ($this->_options['published'] == 1) { - $query->join( - 'LEFT', - $db->quoteName($this->_table) . ' AS i ON i.' . $db->quoteName($this->_field) . ' = c.id AND i.' . $this->_statefield . ' = 1' - ); + $queryjoin .= ' AND i.' . $this->_statefield . ' = 1'; } - else + + if ($this->_options['currentlang'] !== 0) { - $query->join('LEFT', $db->quoteName($this->_table) . ' AS i ON i.' . $db->quoteName($this->_field) . ' = c.id'); + $queryjoin .= ' AND (i.language = ' . $db->quote('*') . ' OR i.language = ' . $db->quote($this->_options['currentlang']) . ')'; } + $query->join('LEFT', $queryjoin); $query->select('COUNT(i.' . $db->quoteName($this->_key) . ') AS numitems'); } @@ -344,7 +347,9 @@ protected function _load($id) $this->_nodes[$result->id]->setParent($this->_nodes[$result->parent_id]); } - if (!isset($this->_nodes[$result->parent_id])) + // If the node's parent id is not in the _nodes list and the node is not root (doesn't have parent_id == 0), + // then remove the node from the list + if (!(isset($this->_nodes[$result->parent_id]) || $result->parent_id == 0)) { unset($this->_nodes[$result->id]); continue; diff --git a/libraries/legacy/controller/admin.php b/libraries/legacy/controller/admin.php index c6e8456315d14..0aee760a29b55 100644 --- a/libraries/legacy/controller/admin.php +++ b/libraries/legacy/controller/admin.php @@ -135,9 +135,10 @@ public function delete() { $this->setMessage($model->getError(), 'error'); } + + // Invoke the postDelete method to allow for the child class to access the model. + $this->postDeleteHook($model, $cid); } - // Invoke the postDelete method to allow for the child class to access the model. - $this->postDeleteHook($model, $cid); $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list, false)); } diff --git a/libraries/legacy/model/legacy.php b/libraries/legacy/model/legacy.php index 0ec4a216e3019..08f65707d66c7 100644 --- a/libraries/legacy/model/legacy.php +++ b/libraries/legacy/model/legacy.php @@ -30,7 +30,7 @@ abstract class JModelLegacy extends JObject /** * Database Connector * - * @var object + * @var JDatabaseDriver * @since 12.2 */ protected $_db; @@ -54,7 +54,7 @@ abstract class JModelLegacy extends JObject /** * A state object * - * @var string + * @var JObject * @since 12.2 */ protected $state; diff --git a/libraries/legacy/model/list.php b/libraries/legacy/model/list.php index 408094fb863b8..d57e69167572c 100644 --- a/libraries/legacy/model/list.php +++ b/libraries/legacy/model/list.php @@ -660,6 +660,18 @@ public function getUserStateFromRequest($key, $request, $default = null, $type = $cur_state = (!is_null($old_state)) ? $old_state : $default; $new_state = $input->get($request, null, $type); + // BC for Search Tools which uses different naming + if ($new_state === null && strpos($request, 'filter_') === 0) + { + $name = substr($request, 7); + $filters = $app->input->get('filter', array(), 'array'); + + if (!empty($filters[$name])) + { + $new_state = $filters[$name]; + } + } + if (($cur_state != $new_state) && ($resetPage)) { $input->set('limitstart', 0); diff --git a/libraries/legacy/request/request.php b/libraries/legacy/request/request.php index 1ada59f926036..1c657a009b21b 100644 --- a/libraries/legacy/request/request.php +++ b/libraries/legacy/request/request.php @@ -379,10 +379,10 @@ public static function setVar($name, $value = null, $hash = 'method', $overwrite $_FILES[$name] = $value; break; case 'ENV': - $_ENV['name'] = $value; + $_ENV[$name] = $value; break; case 'SERVER': - $_SERVER['name'] = $value; + $_SERVER[$name] = $value; break; } diff --git a/libraries/legacy/table/content.php b/libraries/legacy/table/content.php index 6f7b7f6ed5f81..57fd36c3c0e15 100644 --- a/libraries/legacy/table/content.php +++ b/libraries/legacy/table/content.php @@ -32,6 +32,9 @@ public function __construct(JDatabaseDriver $db) JTableObserverTags::createObserver($this, array('typeAlias' => 'com_content.article')); JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_content.article')); + + // Set the alias since the column is called state + $this->setColumnAlias('published', 'state'); } /** @@ -225,7 +228,7 @@ public function check() } // If we don't have any access rules set at this point just use an empty JAccessRules class - if (!isset($this->rules)) + if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_content'); $this->setRules($rules); @@ -342,94 +345,4 @@ public function store($updateNulls = false) return parent::store($updateNulls); } - - /** - * Method to set the publishing state for a row or list of rows in the database - * table. The method respects checked out rows by other users and will attempt - * to checkin rows that it can after adjustments are made. - * - * @param mixed $pks An optional array of primary key values to update. If not set the instance property value is used. - * @param integer $state The publishing state. eg. [0 = unpublished, 1 = published] - * @param integer $userId The user id of the user performing the operation. - * - * @return boolean True on success. - * - * @since 11.1 - */ - public function publish($pks = null, $state = 1, $userId = 0) - { - $k = $this->_tbl_key; - - // Sanitize input. - JArrayHelper::toInteger($pks); - $userId = (int) $userId; - $state = (int) $state; - - // If there are no primary keys set check to see if the instance key is set. - if (empty($pks)) - { - if ($this->$k) - { - $pks = array($this->$k); - } - // Nothing to set publishing state on, return false. - else - { - $this->setError(JText::_('JLIB_DATABASE_ERROR_NO_ROWS_SELECTED')); - - return false; - } - } - - // Build the WHERE clause for the primary keys. - $where = $k . '=' . implode(' OR ' . $k . '=', $pks); - - // Determine if there is checkin support for the table. - if (!property_exists($this, 'checked_out') || !property_exists($this, 'checked_out_time')) - { - $checkin = ''; - } - else - { - $checkin = ' AND (checked_out = 0 OR checked_out = ' . (int) $userId . ')'; - } - - // Update the publishing state for rows with the given primary keys. - $query = $this->_db->getQuery(true) - ->update($this->_db->quoteName($this->_tbl)) - ->set($this->_db->quoteName('state') . ' = ' . (int) $state) - ->where('(' . $where . ')' . $checkin); - $this->_db->setQuery($query); - - try - { - $this->_db->execute(); - } - catch (RuntimeException $e) - { - $this->setError($e->getMessage()); - - return false; - } - - // If checkin is supported and all rows were adjusted, check them in. - if ($checkin && (count($pks) == $this->_db->getAffectedRows())) - { - // Checkin the rows. - foreach ($pks as $pk) - { - $this->checkin($pk); - } - } - - // If the JTable instance value is in the list of primary keys that were set, set the instance. - if (in_array($this->$k, $pks)) - { - $this->state = $state; - } - - $this->setError(''); - - return true; - } } diff --git a/libraries/legacy/table/menu.php b/libraries/legacy/table/menu.php index db14dae2e000f..238cae7e8f3a3 100644 --- a/libraries/legacy/table/menu.php +++ b/libraries/legacy/table/menu.php @@ -90,6 +90,13 @@ public function bind($array, $ignore = '') */ public function check() { + // Check for a title. + if (trim($this->title) == '') + { + $this->setError(JText::_('JLIB_DATABASE_ERROR_MUSTCONTAIN_A_TITLE_MENUITEM')); + + return false; + } // Set correct component id to ensure proper 404 messages with separator items if ($this->type == "separator") { diff --git a/libraries/vendor/autoload.php b/libraries/vendor/autoload.php index 23ca6f1ceed47..baecd9740292a 100644 --- a/libraries/vendor/autoload.php +++ b/libraries/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer' . '/autoload_real.php'; -return ComposerAutoloaderInit49c8bb076e4b3d05954030bb4161f348::getLoader(); +return ComposerAutoloaderInitf9aed076f12471aff0049364a504b3f7::getLoader(); diff --git a/libraries/vendor/composer/autoload_real.php b/libraries/vendor/composer/autoload_real.php index f9735f4861856..60bdad1198a32 100644 --- a/libraries/vendor/composer/autoload_real.php +++ b/libraries/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit49c8bb076e4b3d05954030bb4161f348 +class ComposerAutoloaderInitf9aed076f12471aff0049364a504b3f7 { private static $loader; @@ -19,9 +19,9 @@ public static function getLoader() return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit49c8bb076e4b3d05954030bb4161f348', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInitf9aed076f12471aff0049364a504b3f7', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInit49c8bb076e4b3d05954030bb4161f348', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInitf9aed076f12471aff0049364a504b3f7', 'loadClassLoader')); $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { @@ -42,14 +42,14 @@ public static function getLoader() $includeFiles = require __DIR__ . '/autoload_files.php'; foreach ($includeFiles as $file) { - composerRequire49c8bb076e4b3d05954030bb4161f348($file); + composerRequiref9aed076f12471aff0049364a504b3f7($file); } return $loader; } } -function composerRequire49c8bb076e4b3d05954030bb4161f348($file) +function composerRequiref9aed076f12471aff0049364a504b3f7($file) { require $file; } diff --git a/libraries/vendor/composer/installed.json b/libraries/vendor/composer/installed.json index adbc004a2b002..1f834aefe431c 100644 --- a/libraries/vendor/composer/installed.json +++ b/libraries/vendor/composer/installed.json @@ -245,104 +245,6 @@ "description": "lessphp is a compiler for LESS written in PHP.", "homepage": "http://leafo.net/lessphp/" }, - { - "name": "joomla/utilities", - "version": "1.2.0", - "version_normalized": "1.2.0.0", - "source": { - "type": "git", - "url": "https://github.com/joomla-framework/utilities.git", - "reference": "f749a9bd6f2fc5ad376687651478273dac105051" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/joomla-framework/utilities/zipball/f749a9bd6f2fc5ad376687651478273dac105051", - "reference": "f749a9bd6f2fc5ad376687651478273dac105051", - "shasum": "" - }, - "require": { - "joomla/string": "~1.0", - "php": ">=5.3.10" - }, - "require-dev": { - "phpunit/phpunit": "4.*", - "squizlabs/php_codesniffer": "1.*" - }, - "time": "2014-09-03 21:44:44", - "type": "joomla-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Joomla\\Utilities\\": "src/", - "Joomla\\Utilities\\Tests\\": "Tests/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "GPL-2.0+" - ], - "description": "Joomla Utilities Package", - "homepage": "https://github.com/joomla-framework/utilities", - "keywords": [ - "framework", - "joomla", - "utilities" - ] - }, - { - "name": "joomla/string", - "version": "1.2.1", - "version_normalized": "1.2.1.0", - "source": { - "type": "git", - "url": "https://github.com/joomla-framework/string.git", - "reference": "edc67e83f8e603ac7b55bf32b87d5b53fe1acd8a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/joomla-framework/string/zipball/edc67e83f8e603ac7b55bf32b87d5b53fe1acd8a", - "reference": "edc67e83f8e603ac7b55bf32b87d5b53fe1acd8a", - "shasum": "" - }, - "require": { - "php": ">=5.3.10" - }, - "require-dev": { - "joomla/test": "~1.0", - "phpunit/phpunit": "4.*", - "squizlabs/php_codesniffer": "1.*" - }, - "time": "2014-09-18 12:21:47", - "type": "joomla-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Joomla\\String\\": "src/", - "Joomla\\String\\Tests\\": "Tests/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "GPL-2.0+" - ], - "description": "Joomla String Package", - "homepage": "https://github.com/joomla-framework/string", - "keywords": [ - "framework", - "joomla", - "string" - ] - }, { "name": "joomla/input", "version": "1.2.0", @@ -701,19 +603,68 @@ "joomla" ] }, + { + "name": "joomla/string", + "version": "1.2.2", + "version_normalized": "1.2.2.0", + "source": { + "type": "git", + "url": "https://github.com/joomla-framework/string.git", + "reference": "9f7b27d6b2d48d65b2fe81b5c6d72225629ad692" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/joomla-framework/string/zipball/9f7b27d6b2d48d65b2fe81b5c6d72225629ad692", + "reference": "9f7b27d6b2d48d65b2fe81b5c6d72225629ad692", + "shasum": "" + }, + "require": { + "php": ">=5.3.10" + }, + "require-dev": { + "joomla/test": "~1.0", + "phpunit/phpunit": "4.*", + "squizlabs/php_codesniffer": "1.*" + }, + "time": "2015-03-13 12:29:00", + "type": "joomla-package", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Joomla\\String\\": "src/", + "Joomla\\String\\Tests\\": "Tests/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0+" + ], + "description": "Joomla String Package", + "homepage": "https://github.com/joomla-framework/string", + "keywords": [ + "framework", + "joomla", + "string" + ] + }, { "name": "joomla/registry", - "version": "1.4.2", - "version_normalized": "1.4.2.0", + "version": "1.4.4", + "version_normalized": "1.4.4.0", "source": { "type": "git", "url": "https://github.com/joomla-framework/registry.git", - "reference": "5c2e607ff61f8df07c3c0630ed62a8c3d892469e" + "reference": "730467978ad52677903e973bb33be2306eb161eb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/joomla-framework/registry/zipball/5c2e607ff61f8df07c3c0630ed62a8c3d892469e", - "reference": "5c2e607ff61f8df07c3c0630ed62a8c3d892469e", + "url": "https://api.github.com/repos/joomla-framework/registry/zipball/730467978ad52677903e973bb33be2306eb161eb", + "reference": "730467978ad52677903e973bb33be2306eb161eb", "shasum": "" }, "require": { @@ -731,7 +682,7 @@ "suggest": { "symfony/yaml": "Install 2.* if you require YAML support." }, - "time": "2015-03-07 18:48:26", + "time": "2015-03-16 18:49:29", "type": "joomla-package", "extra": { "branch-alias": { @@ -756,5 +707,54 @@ "joomla", "registry" ] + }, + { + "name": "joomla/utilities", + "version": "1.3.2", + "version_normalized": "1.3.2.0", + "source": { + "type": "git", + "url": "https://github.com/joomla-framework/utilities.git", + "reference": "2e7f37a69162fea02059c764a318a920121f8b4a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/joomla-framework/utilities/zipball/2e7f37a69162fea02059c764a318a920121f8b4a", + "reference": "2e7f37a69162fea02059c764a318a920121f8b4a", + "shasum": "" + }, + "require": { + "joomla/string": "~1.0", + "php": ">=5.3.10" + }, + "require-dev": { + "phpunit/phpunit": "4.*", + "squizlabs/php_codesniffer": "1.*" + }, + "time": "2015-03-16 18:50:58", + "type": "joomla-package", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Joomla\\Utilities\\": "src/", + "Joomla\\Utilities\\Tests\\": "Tests/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0+" + ], + "description": "Joomla Utilities Package", + "homepage": "https://github.com/joomla-framework/utilities", + "keywords": [ + "framework", + "joomla", + "utilities" + ] } ] diff --git a/libraries/vendor/joomla/registry/src/Format/Xml.php b/libraries/vendor/joomla/registry/src/Format/Xml.php index 8dc59cf6bf4cc..e42b185f8e3aa 100644 --- a/libraries/vendor/joomla/registry/src/Format/Xml.php +++ b/libraries/vendor/joomla/registry/src/Format/Xml.php @@ -64,7 +64,7 @@ public function stringToObject($data, array $options = array()) foreach ($xml->children() as $node) { - $obj->$node['name'] = $this->getValueFromNode($node); + $obj->{$node['name']} = $this->getValueFromNode($node); } return $obj; @@ -120,7 +120,7 @@ protected function getValueFromNode($node) foreach ($node->children() as $child) { - $value->$child['name'] = $this->getValueFromNode($child); + $value->{$child['name']} = $this->getValueFromNode($child); } break; diff --git a/libraries/vendor/joomla/registry/src/Registry.php b/libraries/vendor/joomla/registry/src/Registry.php index 8c970b8f1d636..3f59af6974021 100644 --- a/libraries/vendor/joomla/registry/src/Registry.php +++ b/libraries/vendor/joomla/registry/src/Registry.php @@ -500,13 +500,13 @@ public function set($path, $value, $separator = null) { if (is_object($node)) { - if (!isset($node->$nodes[$i]) && ($i != $n)) + if (!isset($node->{$nodes[$i]}) && ($i != $n)) { - $node->$nodes[$i] = new \stdClass; + $node->{$nodes[$i]} = new \stdClass; } // Pass the child as pointer in case it is an object - $node = &$node->$nodes[$i]; + $node = &$node->{$nodes[$i]}; continue; } @@ -527,7 +527,7 @@ public function set($path, $value, $separator = null) switch (true) { case (is_object($node)): - $result = $node->$nodes[$i] = $value; + $result = $node->{$nodes[$i]} = $value; break; case (is_array($node)): @@ -574,13 +574,13 @@ public function append($path, $value) { if (is_object($node)) { - if (!isset($node->$nodes[$i]) && ($i != $n)) + if (!isset($node->{$nodes[$i]}) && ($i != $n)) { - $node->$nodes[$i] = new \stdClass; + $node->{$nodes[$i]} = new \stdClass; } // Pass the child as pointer in case it is an array - $node = &$node->$nodes[$i]; + $node = &$node->{$nodes[$i]}; } elseif (is_array($node)) { diff --git a/libraries/vendor/joomla/string/src/Inflector.php b/libraries/vendor/joomla/string/src/Inflector.php index 89b35aec5e892..4100b1c514de2 100644 --- a/libraries/vendor/joomla/string/src/Inflector.php +++ b/libraries/vendor/joomla/string/src/Inflector.php @@ -2,7 +2,7 @@ /** * Part of the Joomla Framework String Package * - * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. + * @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ diff --git a/libraries/vendor/joomla/string/src/Normalise.php b/libraries/vendor/joomla/string/src/Normalise.php index ca73c8bdccd27..e11437666a058 100644 --- a/libraries/vendor/joomla/string/src/Normalise.php +++ b/libraries/vendor/joomla/string/src/Normalise.php @@ -2,7 +2,7 @@ /** * Part of the Joomla Framework String Package * - * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. + * @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ diff --git a/libraries/vendor/joomla/string/src/String.php b/libraries/vendor/joomla/string/src/String.php index 569fa9085eddb..4eb3a2d1a113c 100644 --- a/libraries/vendor/joomla/string/src/String.php +++ b/libraries/vendor/joomla/string/src/String.php @@ -2,36 +2,33 @@ /** * Part of the Joomla Framework String Package * - * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. + * @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ namespace Joomla\String; // PHP mbstring and iconv local configuration - -// Check if mbstring extension is loaded and attempt to load it if not present except for windows -if (extension_loaded('mbstring')) +if (version_compare(PHP_VERSION, '5.6', '>=')) { - // Make sure to suppress the output in case ini_set is disabled - @ini_set('mbstring.internal_encoding', 'UTF-8'); - @ini_set('mbstring.http_input', 'UTF-8'); - @ini_set('mbstring.http_output', 'UTF-8'); + @ini_set('default_charset', 'UTF-8'); } - -// Same for iconv -if (function_exists('iconv')) +else { - // These are settings that can be set inside code - if (version_compare(PHP_VERSION, '5.6', '>=')) + // Check if mbstring extension is loaded and attempt to load it if not present except for windows + if (extension_loaded('mbstring')) { - @ini_set('default_charset', 'UTF-8'); + @ini_set('mbstring.internal_encoding', 'UTF-8'); + @ini_set('mbstring.http_input', 'UTF-8'); + @ini_set('mbstring.http_output', 'UTF-8'); } - else + + // Same for iconv + if (function_exists('iconv')) { - iconv_set_encoding("internal_encoding", "UTF-8"); - iconv_set_encoding("input_encoding", "UTF-8"); - iconv_set_encoding("output_encoding", "UTF-8"); + iconv_set_encoding('internal_encoding', 'UTF-8'); + iconv_set_encoding('input_encoding', 'UTF-8'); + iconv_set_encoding('output_encoding', 'UTF-8'); } } @@ -157,8 +154,9 @@ public static function increment($string, $style = 'default', $n = 0) */ public static function is_ascii($str) { - // Search for any bytes which are outside the ASCII range... - return (preg_match('/(?:[^\x00-\x7F])/', $str) !== 1); + require_once __DIR__ . '/phputf8/utils/ascii.php'; + + return utf8_is_ascii($str); } /** @@ -181,10 +179,8 @@ public static function strpos($str, $search, $offset = false) { return utf8_strpos($str, $search); } - else - { - return utf8_strpos($str, $search, $offset); - } + + return utf8_strpos($str, $search, $offset); } /** @@ -224,10 +220,8 @@ public static function substr($str, $offset, $length = false) { return utf8_substr($str, $offset); } - else - { - return utf8_substr($str, $offset, $length); - } + + return utf8_substr($str, $offset, $length); } /** @@ -310,10 +304,8 @@ public static function str_ireplace($search, $replace, $str, $count = null) { return utf8_ireplace($search, $replace, $str); } - else - { - return utf8_ireplace($search, $replace, $str, $count); - } + + return utf8_ireplace($search, $replace, $str, $count); } /** @@ -381,18 +373,14 @@ public static function strcasecmp($str1, $str2, $locale = false) { return strcoll(utf8_strtolower($str1), utf8_strtolower($str2)); } - else - { - return strcoll( - self::transcode(utf8_strtolower($str1), 'UTF-8', $encoding), - self::transcode(utf8_strtolower($str2), 'UTF-8', $encoding) - ); - } - } - else - { - return utf8_strcasecmp($str1, $str2); + + return strcoll( + self::transcode(utf8_strtolower($str1), 'UTF-8', $encoding), + self::transcode(utf8_strtolower($str2), 'UTF-8', $encoding) + ); } + + return utf8_strcasecmp($str1, $str2); } /** @@ -441,15 +429,11 @@ public static function strcmp($str1, $str2, $locale = false) { return strcoll($str1, $str2); } - else - { - return strcoll(self::transcode($str1, 'UTF-8', $encoding), self::transcode($str2, 'UTF-8', $encoding)); - } - } - else - { - return strcmp($str1, $str2); + + return strcoll(self::transcode($str1, 'UTF-8', $encoding), self::transcode($str2, 'UTF-8', $encoding)); } + + return strcmp($str1, $str2); } /** @@ -474,14 +458,13 @@ public static function strcspn($str, $mask, $start = null, $length = null) { return utf8_strcspn($str, $mask); } - elseif ($length === false) + + if ($length === false) { return utf8_strcspn($str, $mask, $start); } - else - { - return utf8_strcspn($str, $mask, $start, $length); - } + + return utf8_strcspn($str, $mask, $start, $length); } /** @@ -545,14 +528,13 @@ public static function strspn($str, $mask, $start = null, $length = null) { return utf8_strspn($str, $mask); } - elseif ($length === null) + + if ($length === null) { return utf8_strspn($str, $mask, $start); } - else - { - return utf8_strspn($str, $mask, $start, $length); - } + + return utf8_strspn($str, $mask, $start, $length); } /** @@ -576,10 +558,8 @@ public static function substr_replace($str, $repl, $start, $length = null) { return utf8_substr_replace($str, $repl, $start); } - else - { - return utf8_substr_replace($str, $repl, $start, $length); - } + + return utf8_substr_replace($str, $repl, $start, $length); } /** @@ -611,10 +591,8 @@ public static function ltrim($str, $charlist = false) { return utf8_ltrim($str); } - else - { - return utf8_ltrim($str, $charlist); - } + + return utf8_ltrim($str, $charlist); } /** @@ -645,10 +623,8 @@ public static function rtrim($str, $charlist = false) { return utf8_rtrim($str); } - else - { - return utf8_rtrim($str, $charlist); - } + + return utf8_rtrim($str, $charlist); } /** @@ -679,10 +655,8 @@ public static function trim($str, $charlist = false) { return utf8_trim($str); } - else - { - return utf8_trim($str, $charlist); - } + + return utf8_trim($str, $charlist); } /** @@ -708,15 +682,13 @@ public static function ucfirst($str, $delimiter = null, $newDelimiter = null) { return utf8_ucfirst($str); } - else - { - if ($newDelimiter === null) - { - $newDelimiter = $delimiter; - } - return implode($newDelimiter, array_map('utf8_ucfirst', explode($delimiter, $str))); + if ($newDelimiter === null) + { + $newDelimiter = $delimiter; } + + return implode($newDelimiter, array_map('utf8_ucfirst', explode($delimiter, $str))); } /** @@ -784,135 +756,9 @@ public static function transcode($source, $from_encoding, $to_encoding) */ public static function valid($str) { - // Cached expected number of octets after the current octet - // until the beginning of the next UTF8 character sequence - $mState = 0; - - // Cached Unicode character - $mUcs4 = 0; - - // Cached expected number of octets in the current sequence - $mBytes = 1; - - $len = strlen($str); + require_once __DIR__ . '/phputf8/utils/validation.php'; - for ($i = 0; $i < $len; $i++) - { - $in = ord($str{$i}); - - if ($mState == 0) - { - // When mState is zero we expect either a US-ASCII character or a - // multi-octet sequence. - if (0 == (0x80 & ($in))) - { - // US-ASCII, pass straight through. - $mBytes = 1; - } - elseif (0xC0 == (0xE0 & ($in))) - { - // First octet of 2 octet sequence - $mUcs4 = ($in); - $mUcs4 = ($mUcs4 & 0x1F) << 6; - $mState = 1; - $mBytes = 2; - } - elseif (0xE0 == (0xF0 & ($in))) - { - // First octet of 3 octet sequence - $mUcs4 = ($in); - $mUcs4 = ($mUcs4 & 0x0F) << 12; - $mState = 2; - $mBytes = 3; - } - elseif (0xF0 == (0xF8 & ($in))) - { - // First octet of 4 octet sequence - $mUcs4 = ($in); - $mUcs4 = ($mUcs4 & 0x07) << 18; - $mState = 3; - $mBytes = 4; - } - elseif (0xF8 == (0xFC & ($in))) - { - /* First octet of 5 octet sequence. - * - * This is illegal because the encoded codepoint must be either - * (a) not the shortest form or - * (b) outside the Unicode range of 0-0x10FFFF. - * Rather than trying to resynchronize, we will carry on until the end - * of the sequence and let the later error handling code catch it. - */ - $mUcs4 = ($in); - $mUcs4 = ($mUcs4 & 0x03) << 24; - $mState = 4; - $mBytes = 5; - } - elseif (0xFC == (0xFE & ($in))) - { - // First octet of 6 octet sequence, see comments for 5 octet sequence. - $mUcs4 = ($in); - $mUcs4 = ($mUcs4 & 1) << 30; - $mState = 5; - $mBytes = 6; - } - else - { - /* - * Current octet is neither in the US-ASCII range nor a legal first - * octet of a multi-octet sequence. - */ - return false; - } - } - else - { - // When mState is non-zero, we expect a continuation of the multi-octet - // sequence - if (0x80 == (0xC0 & ($in))) - { - // Legal continuation. - $shift = ($mState - 1) * 6; - $tmp = $in; - $tmp = ($tmp & 0x0000003F) << $shift; - $mUcs4 |= $tmp; - - /** - * End of the multi-octet sequence. mUcs4 now contains the final - * Unicode codepoint to be output - */ - if (0 == --$mState) - { - /* - * Check for illegal sequences and codepoints. - */ - // From Unicode 3.1, non-shortest form is illegal - if (((2 == $mBytes) && ($mUcs4 < 0x0080)) || ((3 == $mBytes) && ($mUcs4 < 0x0800)) || ((4 == $mBytes) && ($mUcs4 < 0x10000)) - || (4 < $mBytes) - || (($mUcs4 & 0xFFFFF800) == 0xD800) // From Unicode 3.2, surrogate characters are illegal - || ($mUcs4 > 0x10FFFF)) // Codepoints outside the Unicode range are illegal - { - return false; - } - - // Initialize UTF8 cache. - $mState = 0; - $mUcs4 = 0; - $mBytes = 1; - } - } - else - { - /** - *((0xC0 & (*in) != 0x80) && (mState != 0)) - * Incomplete multi-octet sequence. - */ - return false; - } - } - } - - return true; + return utf8_is_valid($str); } /** @@ -936,18 +782,9 @@ public static function valid($str) */ public static function compliant($str) { - if (strlen($str) == 0) - { - return true; - } + require_once __DIR__ . '/phputf8/utils/validation.php'; - /* - * If even just the first character can be matched, when the /u - * modifier is used, then it's valid UTF-8. If the UTF-8 is somehow - * invalid, nothing at all will match, even if the string contains - * some valid sequences - */ - return (preg_match('/^.{1}/us', $str, $ar) == 1); + return utf8_compliant($str); } /** @@ -972,10 +809,8 @@ function ($match) $str ); } - else - { - return $str; - } + + return $str; } /** @@ -1000,9 +835,7 @@ function ($match) $str ); } - else - { - return $str; - } + + return $str; } } diff --git a/libraries/vendor/joomla/utilities/src/ArrayHelper.php b/libraries/vendor/joomla/utilities/src/ArrayHelper.php index 5493cbc8882e8..ea4e764a63911 100644 --- a/libraries/vendor/joomla/utilities/src/ArrayHelper.php +++ b/libraries/vendor/joomla/utilities/src/ArrayHelper.php @@ -2,7 +2,7 @@ /** * Part of the Joomla Framework Utilities Package * - * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. + * @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ @@ -230,17 +230,24 @@ public static function getColumn(array $array, $index) /** * Utility function to return a value from a named array or a specified default * - * @param array $array A named array - * @param string $name The key to search for - * @param mixed $default The default value to give if no key found - * @param string $type Return type for the variable (INT, FLOAT, STRING, WORD, BOOLEAN, ARRAY) + * @param array|\ArrayAccess $array A named array or object that implements ArrayAccess + * @param string $name The key to search for + * @param mixed $default The default value to give if no key found + * @param string $type Return type for the variable (INT, FLOAT, STRING, WORD, BOOLEAN, ARRAY) * * @return mixed The value from the source array * + * @throws InvalidArgumentException + * * @since 1.0 */ - public static function getValue(array $array, $name, $default = null, $type = '') + public static function getValue($array, $name, $default = null, $type = '') { + if (!is_array($array) && !($array instanceof \ArrayAccess)) + { + throw new \InvalidArgumentException('The object must be an array or a object that implements ArrayAccess'); + } + $result = null; if (isset($array[$name])) @@ -496,8 +503,8 @@ public static function sortObjects(array $a, $k, $direction = 1, $caseSensitive $locale = $sortLocale[$i]; } - $va = $a->$key[$i]; - $vb = $b->$key[$i]; + $va = $a->{$key[$i]}; + $vb = $b->{$key[$i]}; if ((is_bool($va) || is_numeric($va)) && (is_bool($vb) || is_numeric($vb))) { @@ -575,4 +582,43 @@ public static function arraySearch($needle, array $haystack, $caseSensitive = tr return false; } + + /** + * Method to recursively convert data to a one dimension array. + * + * @param array|object $array The array or object to convert. + * @param string $separator The key separator. + * @param string $prefix Last level key prefix. + * + * @return array + * + * @since 1.3.0 + */ + public static function flatten($array, $separator = '.', $prefix = '') + { + if ($array instanceof \Traversable) + { + $array = iterator_to_array($array); + } + elseif (is_object($array)) + { + $array = get_object_vars($array); + } + + foreach ($array as $k => $v) + { + $key = $prefix ? $prefix . $separator . $k : $k; + + if (is_object($v) || is_array($v)) + { + $array = array_merge($array, static::flatten($v, $separator, $key)); + } + else + { + $array[$key] = $v; + } + } + + return $array; + } } diff --git a/media/editors/codemirror/LICENSE b/media/editors/codemirror/LICENSE index d21bbea5a6338..f4a5a4a25f0c8 100644 --- a/media/editors/codemirror/LICENSE +++ b/media/editors/codemirror/LICENSE @@ -1,4 +1,4 @@ -Copyright (C) 2014 by Marijn Haverbeke and others +Copyright (C) 2015 by Marijn Haverbeke and others Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/media/editors/codemirror/addon/comment/comment.min.js b/media/editors/codemirror/addon/comment/comment.min.js new file mode 100644 index 0000000000000..d671250b5a251 --- /dev/null +++ b/media/editors/codemirror/addon/comment/comment.min.js @@ -0,0 +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){var b=a.search(d);return-1==b?0:b}var c={},d=/[^\s\u00a0]/,e=a.Pos;a.commands.toggleComment=function(a){for(var b=1/0,c=a.listSelections(),d=null,f=c.length-1;f>=0;f--){var g=c[f].from(),h=c[f].to();g.line>=b||(h.line>=b&&(h=e(b,0)),b=g.line,null==d?a.uncomment(g,h)?d="un":(a.lineComment(g,h),d="line"):"un"==d?a.uncomment(g,h):a.lineComment(g,h))}},a.defineExtension("lineComment",function(a,f,g){g||(g=c);var h=this,i=h.getModeAt(a),j=g.lineComment||i.lineComment;if(!j)return void((g.blockCommentStart||i.blockCommentStart)&&(g.fullLines=!0,h.blockComment(a,f,g)));var k=h.getLine(a.line);if(null!=k){var l=Math.min(0!=f.ch||f.line==a.line?f.line+1:f.line,h.lastLine()+1),m=null==g.padding?" ":g.padding,n=g.commentBlankLines||a.line==f.line;h.operation(function(){if(g.indent)for(var c=k.slice(0,b(k)),f=a.line;l>f;++f){var i=h.getLine(f),o=c.length;(n||d.test(i))&&(i.slice(0,o)!=c&&(o=b(i)),h.replaceRange(c+j+m,e(f,0),e(f,o)))}else for(var f=a.line;l>f;++f)(n||d.test(h.getLine(f)))&&h.replaceRange(j+m,e(f,0))})}}),a.defineExtension("blockComment",function(a,b,f){f||(f=c);var g=this,h=g.getModeAt(a),i=f.blockCommentStart||h.blockCommentStart,j=f.blockCommentEnd||h.blockCommentEnd;if(!i||!j)return void((f.lineComment||h.lineComment)&&0!=f.fullLines&&g.lineComment(a,b,f));var k=Math.min(b.line,g.lastLine());k!=a.line&&0==b.ch&&d.test(g.getLine(k))&&--k;var l=null==f.padding?" ":f.padding;a.line>k||g.operation(function(){if(0!=f.fullLines){var c=d.test(g.getLine(k));g.replaceRange(l+j,e(k)),g.replaceRange(i+l,e(a.line,0));var m=f.blockCommentLead||h.blockCommentLead;if(null!=m)for(var n=a.line+1;k>=n;++n)(n!=k||c)&&g.replaceRange(m+l,e(n,0))}else g.replaceRange(j,b),g.replaceRange(i,a)})}),a.defineExtension("uncomment",function(a,b,f){f||(f=c);var g,h=this,i=h.getModeAt(a),j=Math.min(0!=b.ch||b.line==a.line?b.line:b.line-1,h.lastLine()),k=Math.min(a.line,j),l=f.lineComment||i.lineComment,m=[],n=null==f.padding?" ":f.padding;a:if(l){for(var o=k;j>=o;++o){var p=h.getLine(o),q=p.indexOf(l);if(q>-1&&!/comment/.test(h.getTokenTypeAt(e(o,q+1)))&&(q=-1),-1==q&&(o!=j||o==k)&&d.test(p))break a;if(q>-1&&d.test(p.slice(0,q)))break a;m.push(p)}if(h.operation(function(){for(var a=k;j>=a;++a){var b=m[a-k],c=b.indexOf(l),d=c+l.length;0>c||(b.slice(d,d+n.length)==n&&(d+=n.length),g=!0,h.replaceRange("",e(a,c),e(a,d)))}}),g)return!0}var r=f.blockCommentStart||i.blockCommentStart,s=f.blockCommentEnd||i.blockCommentEnd;if(!r||!s)return!1;var t=f.blockCommentLead||i.blockCommentLead,u=h.getLine(k),v=j==k?u:h.getLine(j),w=u.indexOf(r),x=v.lastIndexOf(s);if(-1==x&&k!=j&&(v=h.getLine(--j),x=v.lastIndexOf(s)),-1==w||-1==x||!/comment/.test(h.getTokenTypeAt(e(k,w+1)))||!/comment/.test(h.getTokenTypeAt(e(j,x+1))))return!1;var y=u.lastIndexOf(r,a.ch),z=-1==y?-1:u.slice(0,a.ch).indexOf(s,y+r.length);if(-1!=y&&-1!=z&&z+s.length!=a.ch)return!1;z=v.indexOf(s,b.ch);var A=v.slice(b.ch).lastIndexOf(r,z-b.ch);return y=-1==z||-1==A?-1:b.ch+A,-1!=z&&-1!=y&&y!=b.ch?!1:(h.operation(function(){h.replaceRange("",e(j,x-(n&&v.slice(x-n.length,x)==n?n.length:0)),e(j,x+s.length));var a=w+r.length;if(n&&u.slice(a,a+n.length)==n&&(a+=n.length),h.replaceRange("",e(k,w),e(k,a)),t)for(var b=k+1;j>=b;++b){var c=h.getLine(b),f=c.indexOf(t);if(-1!=f&&!d.test(c.slice(0,f))){var g=f+t.length;n&&c.slice(g,g+n.length)==n&&(g+=n.length),h.replaceRange("",e(b,f),e(b,g))}}}),!0)})}); \ No newline at end of file diff --git a/media/editors/codemirror/addon/comment/continuecomment.min.js b/media/editors/codemirror/addon/comment/continuecomment.min.js new file mode 100644 index 0000000000000..36236dbcefdf4 --- /dev/null +++ b/media/editors/codemirror/addon/comment/continuecomment.min.js @@ -0,0 +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){function b(b){if(b.getOption("disableInput"))return a.Pass;for(var d,e=b.listSelections(),f=[],g=0;g=m);else if(0==i.string.indexOf(d.blockCommentStart)){if(k=n.slice(0,i.start),!/^\s*$/.test(k)){k="";for(var o=0;oi.start&&/^\s*$/.test(n.slice(0,l))&&(k=n.slice(0,l));null!=k&&(k+=d.blockCommentContinue)}if(null==k&&d.lineComment&&c(b)){var p=b.getLine(h.line),l=p.indexOf(d.lineComment);l>-1&&(k=p.slice(0,l),/\S/.test(k)?k=null:k+=d.lineComment+p.slice(l+d.lineComment.length).match(/^\s*/)[0])}if(null==k)return a.Pass;f[g]="\n"+k}b.operation(function(){for(var a=e.length-1;a>=0;a--)b.replaceRange(f[a],e[a].from(),e[a].to(),"+insert")})}function c(a){var b=a.getOption("continueComments");return b&&"object"==typeof b?b.continueLineComment!==!1:!0}for(var d=["clike","css","javascript"],e=0;e=l&&g()},200)}),a.on(n,"focus",function(){++l})}}),a.defineExtension("openNotification",function(d,e){function f(){i||(i=!0,clearTimeout(g),h.parentNode.removeChild(h))}c(this,f);var g,h=b(this,d,e&&e.bottom),i=!1,j=e&&"undefined"!=typeof e.duration?e.duration:5e3;return a.on(h,"click",function(b){a.e_preventDefault(b),f()}),j&&(g=setTimeout(f,j)),f})}); \ No newline at end of file diff --git a/media/editors/codemirror/addon/display/fullscreen.min.css b/media/editors/codemirror/addon/display/fullscreen.min.css new file mode 100644 index 0000000000000..a414b022062ec --- /dev/null +++ b/media/editors/codemirror/addon/display/fullscreen.min.css @@ -0,0 +1 @@ +.CodeMirror-fullscreen{position:fixed;top:0;left:0;right:0;bottom:0;height:auto;z-index:9} \ No newline at end of file diff --git a/media/editors/codemirror/addon/display/fullscreen.min.js b/media/editors/codemirror/addon/display/fullscreen.min.js new file mode 100644 index 0000000000000..2c977065a6280 --- /dev/null +++ b/media/editors/codemirror/addon/display/fullscreen.min.js @@ -0,0 +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){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))})}); \ No newline at end of file diff --git a/media/editors/codemirror/addon/display/panel.js b/media/editors/codemirror/addon/display/panel.js index 22c0453e8ff90..ba29484d6c63a 100644 --- a/media/editors/codemirror/addon/display/panel.js +++ b/media/editors/codemirror/addon/display/panel.js @@ -10,13 +10,31 @@ mod(CodeMirror); })(function(CodeMirror) { CodeMirror.defineExtension("addPanel", function(node, options) { + options = options || {}; + if (!this.state.panels) initPanels(this); var info = this.state.panels; - if (options && options.position == "bottom") - info.wrapper.appendChild(node); - else - info.wrapper.insertBefore(node, info.wrapper.firstChild); + var wrapper = info.wrapper; + var cmWrapper = this.getWrapperElement(); + + if (options.after instanceof Panel && !options.after.cleared) { + wrapper.insertBefore(node, options.before.node.nextSibling); + } else if (options.before instanceof Panel && !options.before.cleared) { + wrapper.insertBefore(node, options.before.node); + } else if (options.replace instanceof Panel && !options.replace.cleared) { + wrapper.insertBefore(node, options.replace.node); + options.replace.clear(); + } else if (options.position == "bottom") { + wrapper.appendChild(node); + } else if (options.position == "before-bottom") { + wrapper.insertBefore(node, cmWrapper.nextSibling); + } else if (options.position == "after-top") { + wrapper.insertBefore(node, cmWrapper); + } else { + wrapper.insertBefore(node, wrapper.firstChild); + } + var height = (options && options.height) || node.offsetHeight; this._setSize(null, info.heightLeft -= height); info.panels++; diff --git a/media/editors/codemirror/addon/display/panel.min.js b/media/editors/codemirror/addon/display/panel.min.js new file mode 100644 index 0000000000000..b62dcd09dbc4e --- /dev/null +++ b/media/editors/codemirror/addon/display/panel.min.js @@ -0,0 +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){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}}); \ No newline at end of file diff --git a/media/editors/codemirror/addon/display/placeholder.min.js b/media/editors/codemirror/addon/display/placeholder.min.js new file mode 100644 index 0000000000000..862fcb1f68bc6 --- /dev/null +++ b/media/editors/codemirror/addon/display/placeholder.min.js @@ -0,0 +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){function b(a){a.state.placeholder&&(a.state.placeholder.parentNode.removeChild(a.state.placeholder),a.state.placeholder=null)}function c(a){b(a);var c=a.state.placeholder=document.createElement("pre");c.style.cssText="height: 0; overflow: visible",c.className="CodeMirror-placeholder",c.appendChild(document.createTextNode(a.getOption("placeholder"))),a.display.lineSpace.insertBefore(c,a.display.lineSpace.firstChild)}function d(a){f(a)&&c(a)}function e(a){var d=a.getWrapperElement(),e=f(a);d.className=d.className.replace(" CodeMirror-empty","")+(e?" CodeMirror-empty":""),e?c(a):b(a)}function f(a){return 1===a.lineCount()&&""===a.getLine(0)}a.defineOption("placeholder","",function(c,f,g){var h=g&&g!=a.Init;if(f&&!h)c.on("blur",d),c.on("change",e),e(c);else if(!f&&h){c.off("blur",d),c.off("change",e),b(c);var i=c.getWrapperElement();i.className=i.className.replace(" CodeMirror-empty","")}f&&!c.hasFocus()&&d(c)})}); \ No newline at end of file diff --git a/media/editors/codemirror/addon/display/rulers.js b/media/editors/codemirror/addon/display/rulers.js index 13185d30b4e89..01f65667c4813 100644 --- a/media/editors/codemirror/addon/display/rulers.js +++ b/media/editors/codemirror/addon/display/rulers.js @@ -38,7 +38,7 @@ for (var i = 0; i < val.length; i++) { var elt = document.createElement("div"); elt.className = "CodeMirror-ruler"; - var col, cls = null, conf = val[i]; + var col, conf = val[i]; if (typeof conf == "number") { col = conf; } else { @@ -47,7 +47,6 @@ if (conf.color) elt.style.borderColor = conf.color; if (conf.lineStyle) elt.style.borderLeftStyle = conf.lineStyle; if (conf.width) elt.style.borderLeftWidth = conf.width; - cls = val[i].className; } elt.style.left = (left + col * cw) + "px"; elt.style.top = "-50px"; diff --git a/media/editors/codemirror/addon/display/rulers.min.js b/media/editors/codemirror/addon/display/rulers.min.js new file mode 100644 index 0000000000000..a047c3f227a8e --- /dev/null +++ b/media/editors/codemirror/addon/display/rulers.min.js @@ -0,0 +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){for(var b=a.display.lineSpace.childNodes.length-1;b>=0;b--){var c=a.display.lineSpace.childNodes[b];/(^|\s)CodeMirror-ruler($|\s)/.test(c.className)&&c.parentNode.removeChild(c)}}function c(b){for(var c=b.getOption("rulers"),d=b.defaultCharWidth(),e=b.charCoords(a.Pos(b.firstLine(),0),"div").left,f=b.display.scroller.offsetHeight+30,g=0;g= 0; i--) { + var cur = ranges[i].head; + cm.replaceRange("", Pos(cur.line, cur.ch - 1), Pos(cur.line, cur.ch + 1)); + } + } + + function handleEnter(cm) { + var conf = getConfig(cm); + var explode = conf && getOption(conf, "explode"); + if (!explode || cm.getOption("disableInput")) return CodeMirror.Pass; + + var ranges = cm.listSelections(); + for (var i = 0; i < ranges.length; i++) { + if (!ranges[i].empty()) return CodeMirror.Pass; + var around = charsAround(cm, ranges[i].head); + if (!around || explode.indexOf(around) % 2 != 0) return CodeMirror.Pass; + } + cm.operation(function() { + cm.replaceSelection("\n\n", null); + cm.execCommand("goCharLeft"); + ranges = cm.listSelections(); + for (var i = 0; i < ranges.length; i++) { + var line = ranges[i].head.line; + cm.indentLine(line, null, true); + cm.indentLine(line + 1, null, true); + } + }); + } + + function handleChar(cm, ch) { + var conf = getConfig(cm); + if (!conf || cm.getOption("disableInput")) return CodeMirror.Pass; + + var pairs = getOption(conf, "pairs"); + var pos = pairs.indexOf(ch); + if (pos == -1) return CodeMirror.Pass; + var triples = getOption(conf, "triples"); + + var identical = pairs.charAt(pos + 1) == ch; + var ranges = cm.listSelections(); + var opening = pos % 2 == 0; + + var type, next; + for (var i = 0; i < ranges.length; i++) { + var range = ranges[i], cur = range.head, curType; + var next = cm.getRange(cur, Pos(cur.line, cur.ch + 1)); + if (opening && !range.empty()) { + curType = "surround"; + } else if ((identical || !opening) && next == ch) { + if (triples.indexOf(ch) >= 0 && cm.getRange(cur, Pos(cur.line, cur.ch + 3)) == ch + ch + ch) + curType = "skipThree"; + else + curType = "skip"; + } else if (identical && cur.ch > 1 && triples.indexOf(ch) >= 0 && + cm.getRange(Pos(cur.line, cur.ch - 2), cur) == ch + ch && + (cur.ch <= 2 || cm.getRange(Pos(cur.line, cur.ch - 3), Pos(cur.line, cur.ch - 2)) != ch)) { + curType = "addFour"; + } else if (identical) { + if (!CodeMirror.isWordChar(next) && enteringString(cm, cur, ch)) curType = "both"; + else return CodeMirror.Pass; + } else if (opening && (cm.getLine(cur.line).length == cur.ch || + isClosingBracket(next, pairs) || + /\s/.test(next))) { + curType = "both"; + } else { + return CodeMirror.Pass; + } + if (!type) type = curType; + else if (type != curType) return CodeMirror.Pass; + } + + var left = pos % 2 ? pairs.charAt(pos - 1) : ch; + var right = pos % 2 ? ch : pairs.charAt(pos + 1); + cm.operation(function() { + if (type == "skip") { + cm.execCommand("goCharRight"); + } else if (type == "skipThree") { + for (var i = 0; i < 3; i++) + cm.execCommand("goCharRight"); + } else if (type == "surround") { + var sels = cm.getSelections(); + for (var i = 0; i < sels.length; i++) + sels[i] = left + sels[i] + right; + cm.replaceSelections(sels, "around"); + } else if (type == "both") { + cm.replaceSelection(left + right, null); + cm.triggerElectric(left + right); + cm.execCommand("goCharLeft"); + } else if (type == "addFour") { + cm.replaceSelection(left + left + left + left, "before"); + cm.execCommand("goCharRight"); + } + }); + } + + function isClosingBracket(ch, pairs) { + var pos = pairs.lastIndexOf(ch); + return pos > -1 && pos % 2 == 1; + } + function charsAround(cm, pos) { var str = cm.getRange(Pos(pos.line, pos.ch - 1), Pos(pos.line, pos.ch + 1)); @@ -51,109 +182,4 @@ stream.start = stream.pos; } } - - function buildKeymap(pairs) { - var map = { - name : "autoCloseBrackets", - Backspace: function(cm) { - if (cm.getOption("disableInput")) return CodeMirror.Pass; - var ranges = cm.listSelections(); - for (var i = 0; i < ranges.length; i++) { - if (!ranges[i].empty()) return CodeMirror.Pass; - var around = charsAround(cm, ranges[i].head); - if (!around || pairs.indexOf(around) % 2 != 0) return CodeMirror.Pass; - } - for (var i = ranges.length - 1; i >= 0; i--) { - var cur = ranges[i].head; - cm.replaceRange("", Pos(cur.line, cur.ch - 1), Pos(cur.line, cur.ch + 1)); - } - } - }; - var closingBrackets = ""; - for (var i = 0; i < pairs.length; i += 2) (function(left, right) { - closingBrackets += right; - map["'" + left + "'"] = function(cm) { - if (cm.getOption("disableInput")) return CodeMirror.Pass; - var ranges = cm.listSelections(), type, next; - for (var i = 0; i < ranges.length; i++) { - var range = ranges[i], cur = range.head, curType; - var next = cm.getRange(cur, Pos(cur.line, cur.ch + 1)); - if (!range.empty()) { - curType = "surround"; - } else if (left == right && next == right) { - if (cm.getRange(cur, Pos(cur.line, cur.ch + 3)) == left + left + left) - curType = "skipThree"; - else - curType = "skip"; - } else if (left == right && cur.ch > 1 && - cm.getRange(Pos(cur.line, cur.ch - 2), cur) == left + left && - (cur.ch <= 2 || cm.getRange(Pos(cur.line, cur.ch - 3), Pos(cur.line, cur.ch - 2)) != left)) { - curType = "addFour"; - } else if (left == '"' || left == "'") { - if (!CodeMirror.isWordChar(next) && enteringString(cm, cur, left)) curType = "both"; - else return CodeMirror.Pass; - } else if (cm.getLine(cur.line).length == cur.ch || closingBrackets.indexOf(next) >= 0 || SPACE_CHAR_REGEX.test(next)) { - curType = "both"; - } else { - return CodeMirror.Pass; - } - if (!type) type = curType; - else if (type != curType) return CodeMirror.Pass; - } - - cm.operation(function() { - if (type == "skip") { - cm.execCommand("goCharRight"); - } else if (type == "skipThree") { - for (var i = 0; i < 3; i++) - cm.execCommand("goCharRight"); - } else if (type == "surround") { - var sels = cm.getSelections(); - for (var i = 0; i < sels.length; i++) - sels[i] = left + sels[i] + right; - cm.replaceSelections(sels, "around"); - } else if (type == "both") { - cm.replaceSelection(left + right, null); - cm.execCommand("goCharLeft"); - } else if (type == "addFour") { - cm.replaceSelection(left + left + left + left, "before"); - cm.execCommand("goCharRight"); - } - }); - }; - if (left != right) map["'" + right + "'"] = function(cm) { - var ranges = cm.listSelections(); - for (var i = 0; i < ranges.length; i++) { - var range = ranges[i]; - if (!range.empty() || - cm.getRange(range.head, Pos(range.head.line, range.head.ch + 1)) != right) - return CodeMirror.Pass; - } - cm.execCommand("goCharRight"); - }; - })(pairs.charAt(i), pairs.charAt(i + 1)); - return map; - } - - function buildExplodeHandler(pairs) { - return function(cm) { - if (cm.getOption("disableInput")) return CodeMirror.Pass; - var ranges = cm.listSelections(); - for (var i = 0; i < ranges.length; i++) { - if (!ranges[i].empty()) return CodeMirror.Pass; - var around = charsAround(cm, ranges[i].head); - if (!around || pairs.indexOf(around) % 2 != 0) return CodeMirror.Pass; - } - cm.operation(function() { - cm.replaceSelection("\n\n", null); - cm.execCommand("goCharLeft"); - ranges = cm.listSelections(); - for (var i = 0; i < ranges.length; i++) { - var line = ranges[i].head.line; - cm.indentLine(line, null, true); - cm.indentLine(line + 1, null, true); - } - }); - }; - } }); diff --git a/media/editors/codemirror/addon/edit/closebrackets.min.js b/media/editors/codemirror/addon/edit/closebrackets.min.js new file mode 100644 index 0000000000000..72db8a7e471c7 --- /dev/null +++ b/media/editors/codemirror/addon/edit/closebrackets.min.js @@ -0,0 +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){function b(a,b){return"pairs"==b&&"string"==typeof a?a:"object"==typeof a&&null!=a[b]?a[b]:k[b]}function c(a){return function(b){return g(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("",l(k.line,k.ch-1),l(k.line,k.ch+1))}}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;h1&&n.indexOf(e)>=0&&c.getRange(l(u.line,u.ch-2),u)==e+e&&(u.ch<=2||c.getRange(l(u.line,u.ch-3),l(u.line,u.ch-2))!=e))s="addFour";else if(o){if(a.isWordChar(m)||!j(c,u,e))return a.Pass;s="both"}else{if(!q||c.getLine(u.line).length!=u.ch&&!h(m,g)&&!/\s/.test(m))return a.Pass;s="both"}else s=n.indexOf(e)>=0&&c.getRange(u,l(u.line,u.ch+3))==e+e+e?"skipThree":"skip";if(k){if(k!=s)return a.Pass}else k=s}var v=i%2?g.charAt(i-1):e,w=i%2?e:g.charAt(i+1);c.operation(function(){if("skip"==k)c.execCommand("goCharRight");else if("skipThree"==k)for(var a=0;3>a;a++)c.execCommand("goCharRight");else if("surround"==k){for(var b=c.getSelections(),a=0;a-1&&c%2==1}function i(a,b){var c=a.getRange(l(b.line,b.ch-1),l(b.line,b.ch+1));return 2==c.length?c:null}function j(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 k={pairs:"()[]{}''\"\"",triples:"",explode:"[]{}"},l=a.Pos;a.defineOption("autoCloseBrackets",!1,function(b,c,d){d&&d!=a.Init&&(b.removeKeyMap(n),b.state.closeBrackets=null),c&&(b.state.closeBrackets=c,b.addKeyMap(n))});for(var m=k.pairs+"`",n={Backspace:e,Enter:f},o=0;oj.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?"/":"";else{if("htmlmixed"!=b.getMode().name||"css"!=k.mode.name)return a.Pass;e[h]=g+"style>"}else{if(!l.context||!l.context.tagName||f(b,l.context.tagName,i,l))return a.Pass;e[h]=g+l.context.tagName+">"}}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)}}); \ No newline at end of file diff --git a/media/editors/codemirror/addon/edit/continuelist.js b/media/editors/codemirror/addon/edit/continuelist.js index ca8d26751ac01..86de49c53842a 100644 --- a/media/editors/codemirror/addon/edit/continuelist.js +++ b/media/editors/codemirror/addon/edit/continuelist.js @@ -19,23 +19,23 @@ if (cm.getOption("disableInput")) return CodeMirror.Pass; var ranges = cm.listSelections(), replacements = []; for (var i = 0; i < ranges.length; i++) { - var pos = ranges[i].head, match; + var pos = ranges[i].head; var eolState = cm.getStateAfter(pos.line); var inList = eolState.list !== false; - var inQuote = eolState.quote !== false; + var inQuote = eolState.quote !== 0; - if (!ranges[i].empty() || (!inList && !inQuote) || !(match = cm.getLine(pos.line).match(listRE))) { + var line = cm.getLine(pos.line), match = listRE.exec(line); + if (!ranges[i].empty() || (!inList && !inQuote) || !match) { cm.execCommand("newlineAndIndent"); return; } - if (cm.getLine(pos.line).match(emptyListRE)) { + if (emptyListRE.test(line)) { cm.replaceRange("", { line: pos.line, ch: 0 }, { line: pos.line, ch: pos.ch + 1 }); replacements[i] = "\n"; - } else { var indent = match[1], after = match[4]; var bullet = unorderedListRE.test(match[2]) || match[2].indexOf(">") >= 0 diff --git a/media/editors/codemirror/addon/edit/continuelist.min.js b/media/editors/codemirror/addon/edit/continuelist.min.js new file mode 100644 index 0000000000000..95c28fa7fda92 --- /dev/null +++ b/media/editors/codemirror/addon/edit/continuelist.min.js @@ -0,0 +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";var b=/^(\s*)(>[> ]*|[*+-]\s|(\d+)\.)(\s*)/,c=/^(\s*)(>[> ]*|[*+-]|(\d+)\.)(\s*)$/,d=/[*+-]\s/;a.commands.newlineAndIndentContinueMarkdownList=function(e){if(e.getOption("disableInput"))return a.Pass;for(var f=e.listSelections(),g=[],h=0;h")>=0?n[2]:parseInt(n[3],10)+1+".";g[h]="\n"+o+q+p}}e.replaceSelections(g)}}); \ No newline at end of file diff --git a/media/editors/codemirror/addon/edit/matchbrackets.js b/media/editors/codemirror/addon/edit/matchbrackets.js index fa1ae030a5442..70e1ae18c7481 100644 --- a/media/editors/codemirror/addon/edit/matchbrackets.js +++ b/media/editors/codemirror/addon/edit/matchbrackets.js @@ -81,7 +81,7 @@ if (marks.length) { // Kludge to work around the IE bug from issue #1193, where text // input stops going to the textare whever this fires. - if (ie_lt8 && cm.state.focused) cm.display.input.focus(); + if (ie_lt8 && cm.state.focused) cm.focus(); var clear = function() { cm.operation(function() { diff --git a/media/editors/codemirror/addon/edit/matchbrackets.min.js b/media/editors/codemirror/addon/edit/matchbrackets.min.js new file mode 100644 index 0000000000000..7a0e0c00c73b4 --- /dev/null +++ b/media/editors/codemirror/addon/edit/matchbrackets.min.js @@ -0,0 +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){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)})}); \ No newline at end of file diff --git a/media/editors/codemirror/addon/edit/matchtags.min.js b/media/editors/codemirror/addon/edit/matchtags.min.js new file mode 100644 index 0000000000000..ed9b892c62ffb --- /dev/null +++ b/media/editors/codemirror/addon/edit/matchtags.min.js @@ -0,0 +1 @@ +!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)}}}); \ No newline at end of file diff --git a/media/editors/codemirror/addon/edit/trailingspace.min.js b/media/editors/codemirror/addon/edit/trailingspace.min.js new file mode 100644 index 0000000000000..3751c2cdeeaac --- /dev/null +++ b/media/editors/codemirror/addon/edit/trailingspace.min.js @@ -0,0 +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){a.defineOption("showTrailingSpace",!1,function(b,c,d){d==a.Init&&(d=!1),d&&!c?b.removeOverlay("trailingspace"):!d&&c&&b.addOverlay({token:function(a){for(var b=a.string.length,c=b;c&&/\s/.test(a.string.charAt(c-1));--c);return c>a.pos?(a.pos=c,null):(a.pos=b,"trailingspace")},name:"trailingspace"})})}); \ No newline at end of file diff --git a/media/editors/codemirror/addon/fold/brace-fold.min.js b/media/editors/codemirror/addon/fold/brace-fold.min.js new file mode 100644 index 0000000000000..f8b3056ea8566 --- /dev/null +++ b/media/editors/codemirror/addon/fold/brace-fold.min.js @@ -0,0 +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.registerHelper("fold","brace",function(b,c){function d(d){for(var e=c.ch,i=0;;){var j=0>=e?-1:h.lastIndexOf(d,e-1);if(-1!=j){if(1==i&&j=o;++o)for(var p=b.getLine(o),q=o==g?e:0;;){var r=p.indexOf(i,q),s=p.indexOf(j,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))==f)if(q==r)++m;else if(!--m){k=o,l=q;break a}++q}if(null!=k&&(g!=k||l!=e))return{from:a.Pos(g,e),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,c=c.line,f=d(c);if(!f||d(c-1)||(e=d(c-2))&&e.end.line==c-1)return null;for(var g=f.end;;){var h=d(g.line+1);if(null==h)break;g=h.end}return{from:b.clipPos(a.Pos(c,f.startCh+1)),to:g}}),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 c=c.line,e=d(c);if(null==e||null!=d(c-1))return null;for(var f=c;;){var g=d(f+1);if(null==g)break;++f}return{from:a.Pos(c,e+1),to:b.clipPos(a.Pos(f))}})}); \ No newline at end of file diff --git a/media/editors/codemirror/addon/fold/comment-fold.min.js b/media/editors/codemirror/addon/fold/comment-fold.min.js new file mode 100644 index 0000000000000..8cae02c19b581 --- /dev/null +++ b/media/editors/codemirror/addon/fold/comment-fold.min.js @@ -0,0 +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.registerGlobalHelper("fold","comment",function(a){return a.blockCommentStart&&a.blockCommentEnd},function(b,c){var d=b.getModeAt(c),e=d.blockCommentStart,f=d.blockCommentEnd;if(e&&f){for(var g,h=c.line,i=b.getLine(h),j=c.ch,k=0;;){var l=0>=j?-1:i.lastIndexOf(e,j-1);if(-1!=l){if(1==k&&l=q;++q)for(var r=b.getLine(q),s=q==h?g:0;;){var t=r.indexOf(e,s),u=r.indexOf(f,s);if(0>t&&(t=r.length),0>u&&(u=r.length),s=Math.min(t,u),s==r.length)break;if(s==t)++o;else if(!--o){m=q,n=s;break a}++s}if(null!=m&&(h!=m||n!=g))return{from:a.Pos(h,g),to:a.Pos(m,n)}}})}); \ No newline at end of file diff --git a/media/editors/codemirror/addon/fold/foldcode.min.js b/media/editors/codemirror/addon/fold/foldcode.min.js new file mode 100644 index 0000000000000..d79993bb15608 --- /dev/null +++ b/media/editors/codemirror/addon/fold/foldcode.min.js @@ -0,0 +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(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= state.from && line < state.to) updateFoldInfo(cm, line, line + 1); } diff --git a/media/editors/codemirror/addon/fold/foldgutter.min.css b/media/editors/codemirror/addon/fold/foldgutter.min.css new file mode 100644 index 0000000000000..7ee0f2a4d6a56 --- /dev/null +++ b/media/editors/codemirror/addon/fold/foldgutter.min.css @@ -0,0 +1 @@ +.CodeMirror-foldmarker{color:#00f;text-shadow:#b9f 1px 1px 2px,#b9f -1px -1px 2px,#b9f 1px -1px 2px,#b9f -1px 1px 2px;font-family:arial;line-height:.3;cursor:pointer}.CodeMirror-foldgutter{width:.7em}.CodeMirror-foldgutter-folded,.CodeMirror-foldgutter-open{cursor:pointer}.CodeMirror-foldgutter-open:after{content:"\25BE"}.CodeMirror-foldgutter-folded:after{content:"\25B8"} \ No newline at end of file diff --git a/media/editors/codemirror/addon/fold/foldgutter.min.js b/media/editors/codemirror/addon/fold/foldgutter.min.js new file mode 100644 index 0000000000000..0805fb985dda0 --- /dev/null +++ b/media/editors/codemirror/addon/fold/foldgutter.min.js @@ -0,0 +1 @@ +!function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("./foldcode")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./foldcode"],a):a(CodeMirror)}(function(a){"use strict";function b(a){this.options=a,this.from=this.to=0}function c(a){return a===!0&&(a={}),null==a.gutter&&(a.gutter="CodeMirror-foldgutter"),null==a.indicatorOpen&&(a.indicatorOpen="CodeMirror-foldgutter-open"),null==a.indicatorFolded&&(a.indicatorFolded="CodeMirror-foldgutter-folded"),a}function d(a,b){for(var c=a.findMarksAt(l(b)),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=i;++i){var k=b.getLine(i),l=f(k);if(l>g)h=i;else if(/\S/.test(k))break}return h?{from:a.Pos(c.line,e.length),to:a.Pos(h,b.getLine(h).length)}:void 0}})}); \ No newline at end of file diff --git a/media/editors/codemirror/addon/fold/markdown-fold.min.js b/media/editors/codemirror/addon/fold/markdown-fold.min.js new file mode 100644 index 0000000000000..10f647c4d277b --- /dev/null +++ b/media/editors/codemirror/addon/fold/markdown-fold.min.js @@ -0,0 +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.registerHelper("fold","markdown",function(b,c){function d(c){var d=b.getTokenTypeAt(a.Pos(c,0));return d&&/\bheader\b/.test(d)}function e(a,b,c){var e=b&&b.match(/^#+/);return e&&d(a)?e[0].length:(e=c&&c.match(/^[=\-]+\s*$/),e&&d(a+1)?"="==c[0]?1:2:f)}var f=100,g=b.getLine(c.line),h=b.getLine(c.line+1),i=e(c.line,g,h);if(i===f)return void 0;for(var j=b.lastLine(),k=c.line,l=b.getLine(k+2);j>k&&!(e(k+1,h,l)<=i);)++k,h=l,l=b.getLine(k+2);return{from:a.Pos(c.line,g.length),to:a.Pos(k,b.getLine(k).length)}})}); \ No newline at end of file diff --git a/media/editors/codemirror/addon/fold/xml-fold.min.js b/media/editors/codemirror/addon/fold/xml-fold.min.js new file mode 100644 index 0000000000000..3a7b1056460f3 --- /dev/null +++ b/media/editors/codemirror/addon/fold/xml-fold.min.js @@ -0,0 +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){return a.line-b.line||a.ch-b.ch}function c(a,b,c,d){this.line=b,this.ch=c,this.cm=a,this.text=a.getLine(b),this.min=d?d.from:a.firstLine(),this.max=d?d.to-1:a.lastLine()}function d(a,b){var c=a.cm.getTokenTypeAt(m(a.line,b));return c&&/\btag\b/.test(c)}function e(a){return a.line>=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 b=m(d.line,d.ch),h=k(d,f[2]);return h&&{from:b,to:h.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)}}); \ No newline at end of file diff --git a/media/editors/codemirror/addon/hint/anyword-hint.min.js b/media/editors/codemirror/addon/hint/anyword-hint.min.js new file mode 100644 index 0000000000000..0d99cedd46105 --- /dev/null +++ b/media/editors/codemirror/addon/hint/anyword-hint.min.js @@ -0,0 +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";var b=/[\w$]+/,c=500;a.registerHelper("hint","anyword",function(d,e){for(var f=e&&e.word||b,g=e&&e.range||c,h=d.getCursor(),i=d.getLine(h.line),j=h.ch,k=j;k&&f.test(i.charAt(k-1));)--k;for(var l=k!=j&&i.slice(k,j),m=[],n={},o=new RegExp(f.source,"g"),p=-1;1>=p;p+=2)for(var q=h.line,r=Math.min(Math.max(q+p*g,d.firstLine()),d.lastLine())+p;q!=r;q+=p)for(var s,t=d.getLine(q);s=o.exec(t);)(q!=h.line||s[0]!==l)&&(l&&0!=s[0].lastIndexOf(l,0)||Object.prototype.hasOwnProperty.call(n,s[0])||(n[s[0]]=!0,m.push(s[0])));return{list:m,from:a.Pos(h.line,k),to:a.Pos(h.line,j)}})}); \ No newline at end of file diff --git a/media/editors/codemirror/addon/hint/css-hint.js b/media/editors/codemirror/addon/hint/css-hint.js index 488da3449e8c4..22642727cfa9e 100644 --- a/media/editors/codemirror/addon/hint/css-hint.js +++ b/media/editors/codemirror/addon/hint/css-hint.js @@ -20,6 +20,10 @@ var inner = CodeMirror.innerMode(cm.getMode(), token.state); if (inner.mode.name != "css") return; + if (token.type == "keyword" && "!important".indexOf(token.string) == 0) + return {list: ["!important"], from: CodeMirror.Pos(cur.line, token.start), + to: CodeMirror.Pos(cur.line, token.end)}; + var start = token.start, end = cur.ch, word = token.string.slice(0, end - start); if (/[^\w$_-]/.test(word)) { word = ""; start = end = cur.ch; diff --git a/media/editors/codemirror/addon/hint/css-hint.min.js b/media/editors/codemirror/addon/hint/css-hint.min.js new file mode 100644 index 0000000000000..f2c3f476805c8 --- /dev/null +++ b/media/editors/codemirror/addon/hint/css-hint.min.js @@ -0,0 +1 @@ +!function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("../../mode/css/css")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../../mode/css/css"],a):a(CodeMirror)}(function(a){"use strict";var b={link:1,visited:1,active:1,hover:1,focus:1,"first-letter":1,"first-line":1,"first-child":1,before:1,after:1,lang:1};a.registerHelper("hint","css",function(c){function d(a){for(var b in a)j&&0!=b.lastIndexOf(j,0)||l.push(b)}var e=c.getCursor(),f=c.getTokenAt(e),g=a.innerMode(c.getMode(),f.state);if("css"==g.mode.name){if("keyword"==f.type&&0=="!important".indexOf(f.string))return{list:["!important"],from:a.Pos(e.line,f.start),to:a.Pos(e.line,f.end)};var h=f.start,i=e.ch,j=f.string.slice(0,i-h);/[^\w$_-]/.test(j)&&(j="",h=i=e.ch);var k=a.resolveMode("text/css"),l=[],m=g.state.state;return"pseudo"==m||"variable-3"==f.type?d(b):"block"==m||"maybeprop"==m?d(k.propertyKeywords):"prop"==m||"parens"==m||"at"==m||"params"==m?(d(k.valueKeywords),d(k.colorKeywords)):("media"==m||"media_parens"==m)&&(d(k.mediaTypes),d(k.mediaFeatures)),l.length?{list:l,from:a.Pos(e.line,h),to:a.Pos(e.line,i)}:void 0}})}); \ No newline at end of file diff --git a/media/editors/codemirror/addon/hint/html-hint.min.js b/media/editors/codemirror/addon/hint/html-hint.min.js new file mode 100644 index 0000000000000..30b96ba7d6248 --- /dev/null +++ b/media/editors/codemirror/addon/hint/html-hint.min.js @@ -0,0 +1 @@ +!function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("./xml-hint")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./xml-hint"],a):a(CodeMirror)}(function(a){"use strict";function b(a){for(var b in l)l.hasOwnProperty(b)&&(a.attrs[b]=l[b])}function c(b,c){var d={schemaInfo:k};if(c)for(var e in c)d[e]=c[e];return a.hint.xml(b,d)}var d="ab aa af ak sq am ar an hy as av ae ay az bm ba eu be bn bh bi bs br bg my ca ch ce ny zh cv kw co cr hr cs da dv nl dz en eo et ee fo fj fi fr ff gl ka de el gn gu ht ha he hz hi ho hu ia id ie ga ig ik io is it iu ja jv kl kn kr ks kk km ki rw ky kv kg ko ku kj la lb lg li ln lo lt lu lv gv mk mg ms ml mt mi mr mh mn na nv nb nd ne ng nn no ii nr oc oj cu om or os pa pi fa pl ps pt qu rm rn ro ru sa sc sd se sm sg sr gd sn si sk sl so st es su sw ss sv ta te tg th ti bo tk tl tn to tr ts tt tw ty ug uk ur uz ve vi vo wa cy wo fy xh yi yo za zu".split(" "),e=["_blank","_self","_top","_parent"],f=["ascii","utf-8","utf-16","latin1","latin1"],g=["get","post","put","delete"],h=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],i=["all","screen","print","embossed","braille","handheld","print","projection","screen","tty","tv","speech","3d-glasses","resolution [>][<][=] [X]","device-aspect-ratio: X/Y","orientation:portrait","orientation:landscape","device-height: [X]","device-width: [X]"],j={attrs:{}},k={a:{attrs:{href:null,ping:null,type:null,media:i,target:e,hreflang:d}},abbr:j,acronym:j,address:j,applet:j,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:i,hreflang:d,type:null,shape:["default","rect","circle","poly"]}},article:j,aside:j,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["","autoplay"],loop:["","loop"],controls:["","controls"]}},b:j,base:{attrs:{href:null,target:e}},basefont:j,bdi:j,bdo:j,big:j,blockquote:{attrs:{cite:null}},body:j,br:j,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["","autofocus"],disabled:["","autofocus"],formenctype:h,formmethod:g,formnovalidate:["","novalidate"],formtarget:e,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:j,center:j,cite:j,code:j,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["","disabled"],checked:["","checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["","disabled"],multiple:["","multiple"]}},datalist:{attrs:{data:null}},dd:j,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["","open"]}},dfn:j,dir:j,div:j,dl:j,dt:j,em:j,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["","disabled"],form:null,name:null}},figcaption:j,figure:j,font:j,footer:j,form:{attrs:{action:null,name:null,"accept-charset":f,autocomplete:["on","off"],enctype:h,method:g,novalidate:["","novalidate"],target:e}},frame:j,frameset:j,h1:j,h2:j,h3:j,h4:j,h5:j,h6:j,head:{attrs:{},children:["title","base","link","style","meta","script","noscript","command"]},header:j,hgroup:j,hr:j,html:{attrs:{manifest:null},children:["head","body"]},i:j,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["","seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["","autofocus"],checked:["","checked"],disabled:["","disabled"],formenctype:h,formmethod:g,formnovalidate:["","novalidate"],formtarget:e,multiple:["","multiple"],readonly:["","readonly"],required:["","required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:j,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["","autofocus"],disabled:["","disabled"],keytype:["RSA"]}},label:{attrs:{"for":null,form:null}},legend:j,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:d,media:i,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:j,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:f,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:j,noframes:j,noscript:j,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["","typemustmatch"]}},ol:{attrs:{reversed:["","reversed"],start:null,type:["1","a","A","i","I"]}},optgroup:{attrs:{disabled:["","disabled"],label:null}},option:{attrs:{disabled:["","disabled"],label:null,selected:["","selected"],value:null}},output:{attrs:{"for":null,form:null,name:null}},p:j,param:{attrs:{name:null,value:null}},pre:j,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:j,rt:j,ruby:j,s:j,samp:j,script:{attrs:{type:["text/javascript"],src:null,async:["","async"],defer:["","defer"],charset:f}},section:j,select:{attrs:{form:null,name:null,size:null,autofocus:["","autofocus"],disabled:["","disabled"],multiple:["","multiple"]}},small:j,source:{attrs:{src:null,type:null,media:null}},span:j,strike:j,strong:j,style:{attrs:{type:["text/css"],media:i,scoped:null}},sub:j,summary:j,sup:j,table:j,tbody:j,td:{attrs:{colspan:null,rowspan:null,headers:null}},textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["","autofocus"],disabled:["","disabled"],readonly:["","readonly"],required:["","required"],wrap:["soft","hard"]}},tfoot:j,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:j,time:{attrs:{datetime:null}},title:j,tr:j,track:{attrs:{src:null,label:null,"default":null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:d}},tt:j,u:j,ul:j,"var":j,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["","autoplay"],mediagroup:["movie"],muted:["","muted"],controls:["","controls"]}},wbr:j},l={accesskey:["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9"],"class":null,contenteditable:["true","false"],contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["en","es"],spellcheck:["true","false"],style:null,tabindex:["1","2","3","4","5","6","7","8","9"],title:null,translate:["yes","no"],onclick:null,rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"]};b(j);for(var m in k)k.hasOwnProperty(m)&&k[m]!=j&&b(k[m]);a.htmlSchema=k,a.registerHelper("hint","html",c)}); \ No newline at end of file diff --git a/media/editors/codemirror/addon/hint/javascript-hint.min.js b/media/editors/codemirror/addon/hint/javascript-hint.min.js new file mode 100644 index 0000000000000..ed3d656323785 --- /dev/null +++ b/media/editors/codemirror/addon/hint/javascript-hint.min.js @@ -0,0 +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){function b(a,b){for(var c=0,d=a.length;d>c;++c)b(a[c])}function c(a,b){if(!Array.prototype.indexOf){for(var c=a.length;c--;)if(a[c]===b)return!0;return!1}return-1!=a.indexOf(b)}function d(b,c,d,e){var f=b.getCursor(),g=d(b,f);if(!/\b(?:string|comment)\b/.test(g.type)){g.state=a.innerMode(b.getMode(),g.state).state,/^[\w$_]*$/.test(g.string)?g.end>f.ch&&(g.end=f.ch,g.string=g.string.slice(0,f.ch-g.start)):g={start:f.ch,end:f.ch,string:"",state:g.state,type:"."==g.string?"property":null};for(var j=g;"property"==j.type;){if(j=d(b,i(f.line,j.start)),"."!=j.string)return;if(j=d(b,i(f.line,j.start)),!k)var k=[];k.push(j)}return{list:h(g,k,c,e),from:i(f.line,g.start),to:i(f.line,g.end)}}}function e(a,b){return d(a,m,function(a,b){return a.getTokenAt(b)},b)}function f(a,b){var c=a.getTokenAt(b);return b.ch==c.start+1&&"."==c.string.charAt(0)?(c.end=c.start,c.string=".",c.type="property"):/^\.[\w$_]*$/.test(c.string)&&(c.type="property",c.start++,c.string=c.string.replace(/\./,"")),c}function g(a,b){return d(a,n,f,b)}function h(a,d,e,f){function g(a){0!=a.lastIndexOf(m,0)||c(i,a)||i.push(a)}function h(a){"string"==typeof a?b(j,g):a instanceof Array?b(k,g):a instanceof Function&&b(l,g);for(var c in a)g(c)}var i=[],m=a.string,n=f&&f.globalScope||window;if(d&&d.length){var o,p=d.pop();for(p.type&&0===p.type.indexOf("variable")?(f&&f.additionalContext&&(o=f.additionalContext[p.string]),f&&f.useGlobalScope===!1||(o=o||n[p.string])):"string"==p.type?o="":"atom"==p.type?o=1:"function"==p.type&&(null==n.jQuery||"$"!=p.string&&"jQuery"!=p.string||"function"!=typeof n.jQuery?null!=n._&&"_"==p.string&&"function"==typeof n._&&(o=n._()):o=n.jQuery());null!=o&&d.length;)o=o[d.pop().string];null!=o&&h(o)}else{for(var q=a.state.localVars;q;q=q.next)g(q.name);for(var q=a.state.globalVars;q;q=q.next)g(q.name);f&&f.useGlobalScope===!1||h(n),b(e,g)}return i}var i=a.Pos;a.registerHelper("hint","javascript",e),a.registerHelper("hint","coffeescript",g);var j="charAt charCodeAt indexOf lastIndexOf substring substr slice trim trimLeft trimRight toUpperCase toLowerCase split concat match replace search".split(" "),k="length concat join splice push pop shift unshift slice reverse sort indexOf lastIndexOf every some filter forEach map reduce reduceRight ".split(" "),l="prototype apply call bind".split(" "),m="break case catch continue debugger default delete do else false finally for function if in instanceof new null return switch throw true try typeof var void while with".split(" "),n="and break catch class continue delete do else extends false finally for if in instanceof isnt new no not null of off on or return switch then throw true try typeof until void while with yes".split(" ")}); \ No newline at end of file diff --git a/media/editors/codemirror/addon/hint/show-hint.js b/media/editors/codemirror/addon/hint/show-hint.js index fda5ffaa164bb..d228fc88909cb 100644 --- a/media/editors/codemirror/addon/hint/show-hint.js +++ b/media/editors/codemirror/addon/hint/show-hint.js @@ -30,29 +30,39 @@ if (this.state.completionActive) this.state.completionActive.close(); var completion = this.state.completionActive = new Completion(this, options); - var getHints = completion.options.hint; - if (!getHints) return; + if (!completion.options.hint) return; CodeMirror.signal(this, "startCompletion", this); - if (getHints.async) - getHints(this, function(hints) { completion.showHints(hints); }, completion.options); - else - return completion.showHints(getHints(this, completion.options)); + completion.update(true); }); function Completion(cm, options) { this.cm = cm; this.options = this.buildOptions(options); - this.widget = this.onClose = null; + this.widget = null; + this.debounce = 0; + this.tick = 0; + this.startPos = this.cm.getCursor(); + this.startLen = this.cm.getLine(this.startPos.line).length; + + var self = this; + cm.on("cursorActivity", this.activityFunc = function() { self.cursorActivity(); }); } + var requestAnimationFrame = window.requestAnimationFrame || function(fn) { + return setTimeout(fn, 1000/60); + }; + var cancelAnimationFrame = window.cancelAnimationFrame || clearTimeout; + Completion.prototype = { close: function() { if (!this.active()) return; this.cm.state.completionActive = null; + this.tick = null; + this.cm.off("cursorActivity", this.activityFunc); + if (this.widget && this.data) CodeMirror.signal(this.data, "close"); if (this.widget) this.widget.close(); - if (this.onClose) this.onClose(); CodeMirror.signal(this.cm, "endCompletion", this.cm); }, @@ -69,74 +79,50 @@ this.close(); }, - showHints: function(data) { - if (!data || !data.list.length || !this.active()) return this.close(); - - if (this.options.completeSingle && data.list.length == 1) - this.pick(data, 0); - else - this.showWidget(data); - }, - - showWidget: function(data) { - this.widget = new Widget(this, data); - CodeMirror.signal(data, "shown"); - - var debounce = 0, completion = this, finished; - var closeOn = this.options.closeCharacters; - var startPos = this.cm.getCursor(), startLen = this.cm.getLine(startPos.line).length; - - var requestAnimationFrame = window.requestAnimationFrame || function(fn) { - return setTimeout(fn, 1000/60); - }; - var cancelAnimationFrame = window.cancelAnimationFrame || clearTimeout; - - function done() { - if (finished) return; - finished = true; - completion.close(); - completion.cm.off("cursorActivity", activity); - if (data) CodeMirror.signal(data, "close"); + cursorActivity: function() { + if (this.debounce) { + cancelAnimationFrame(this.debounce); + this.debounce = 0; } - function update() { - if (finished) return; - CodeMirror.signal(data, "update"); - var getHints = completion.options.hint; - if (getHints.async) - getHints(completion.cm, finishUpdate, completion.options); - else - finishUpdate(getHints(completion.cm, completion.options)); - } - function finishUpdate(data_) { - data = data_; - if (finished) return; - if (!data || !data.list.length) return done(); - if (completion.widget) completion.widget.close(); - completion.widget = new Widget(completion, data); + var pos = this.cm.getCursor(), line = this.cm.getLine(pos.line); + if (pos.line != this.startPos.line || line.length - pos.ch != this.startLen - this.startPos.ch || + pos.ch < this.startPos.ch || this.cm.somethingSelected() || + (pos.ch && this.options.closeCharacters.test(line.charAt(pos.ch - 1)))) { + this.close(); + } else { + var self = this; + this.debounce = requestAnimationFrame(function() {self.update();}); + if (this.widget) this.widget.disable(); } + }, - function clearDebounce() { - if (debounce) { - cancelAnimationFrame(debounce); - debounce = 0; - } + update: function(first) { + if (this.tick == null) return; + if (this.data) CodeMirror.signal(this.data, "update"); + if (!this.options.hint.async) { + this.finishUpdate(this.options.hint(this.cm, this.options), first); + } else { + var myTick = ++this.tick, self = this; + this.options.hint(this.cm, function(data) { + if (self.tick == myTick) self.finishUpdate(data, first); + }, this.options); } + }, - function activity() { - clearDebounce(); - var pos = completion.cm.getCursor(), line = completion.cm.getLine(pos.line); - if (pos.line != startPos.line || line.length - pos.ch != startLen - startPos.ch || - pos.ch < startPos.ch || completion.cm.somethingSelected() || - (pos.ch && closeOn.test(line.charAt(pos.ch - 1)))) { - completion.close(); + finishUpdate: function(data, first) { + this.data = data; + + var picked = (this.widget && this.widget.picked) || (first && this.options.completeSingle); + if (this.widget) this.widget.close(); + if (data && data.list.length) { + if (picked && data.list.length == 1) { + this.pick(data, 0); } else { - debounce = requestAnimationFrame(update); - if (completion.widget) completion.widget.close(); + this.widget = new Widget(this, data); + CodeMirror.signal(data, "shown"); } } - this.cm.on("cursorActivity", activity); - this.onClose = done; }, buildOptions: function(options) { @@ -201,6 +187,7 @@ function Widget(completion, data) { this.completion = completion; this.data = data; + this.picked = false; var widget = this, cm = completion.cm; var hints = this.hints = document.createElement("ul"); @@ -315,6 +302,13 @@ cm.off("scroll", this.onScroll); }, + disable: function() { + this.completion.cm.removeKeyMap(this.keyMap); + var widget = this; + this.keyMap = {Enter: function() { widget.picked = true; }}; + this.completion.cm.addKeyMap(this.keyMap); + }, + pick: function() { this.completion.pick(this.data, this.selectedHint); }, diff --git a/media/editors/codemirror/addon/hint/show-hint.min.css b/media/editors/codemirror/addon/hint/show-hint.min.css new file mode 100644 index 0000000000000..86c983eaa6888 --- /dev/null +++ b/media/editors/codemirror/addon/hint/show-hint.min.css @@ -0,0 +1 @@ +.CodeMirror-hints{position:absolute;z-index:10;overflow:hidden;list-style:none;margin:0;padding:2px;-webkit-box-shadow:2px 3px 5px rgba(0,0,0,.2);-moz-box-shadow:2px 3px 5px rgba(0,0,0,.2);box-shadow:2px 3px 5px rgba(0,0,0,.2);border-radius:3px;border:1px solid silver;background:#fff;font-size:90%;font-family:monospace;max-height:20em;overflow-y:auto}.CodeMirror-hint{margin:0;padding:0 4px;border-radius:2px;max-width:19em;overflow:hidden;white-space:pre;color:#000;cursor:pointer}li.CodeMirror-hint-active{background:#08f;color:#fff} \ No newline at end of file diff --git a/media/editors/codemirror/addon/hint/show-hint.min.js b/media/editors/codemirror/addon/hint/show-hint.min.js new file mode 100644 index 0000000000000..c92ce65b3dfd1 --- /dev/null +++ b/media/editors/codemirror/addon/hint/show-hint.min.js @@ -0,0 +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){this.cm=a,this.options=this.buildOptions(b),this.widget=null,this.debounce=0,this.tick=0,this.startPos=this.cm.getCursor(),this.startLen=this.cm.getLine(this.startPos.line).length;var c=this;a.on("cursorActivity",this.activityFunc=function(){c.cursorActivity()})}function c(a){return"string"==typeof a?a:a.text}function d(a,b){function c(a,c){var e;e="string"!=typeof c?function(a){return c(a,b)}:d.hasOwnProperty(c)?d[c]:c,f[a]=e}var d={Up:function(){b.moveFocus(-1)},Down:function(){b.moveFocus(1)},PageUp:function(){b.moveFocus(-b.menuSize()+1,!0)},PageDown:function(){b.moveFocus(b.menuSize()-1,!0)},Home:function(){b.setFocus(0)},End:function(){b.setFocus(b.length-1)},Enter:b.pick,Tab:b.pick,Esc:b.close},e=a.options.customKeys,f=e?{}:d;if(e)for(var g in e)e.hasOwnProperty(g)&&c(g,e[g]);var h=a.options.extraKeys;if(h)for(var g in h)h.hasOwnProperty(g)&&c(g,h[g]);return f}function e(a,b){for(;b&&b!=a;){if("LI"===b.nodeName.toUpperCase()&&b.parentNode==a)return b;b=b.parentNode}}function f(b,f){this.completion=b,this.data=f,this.picked=!1;var i=this,j=b.cm,k=this.hints=document.createElement("ul");k.className="CodeMirror-hints",this.selectedHint=f.selectedHint||0;for(var l=f.list,m=0;m0){var y=w.bottom-w.top,z=q.top-(q.bottom-w.top);if(z-y>0)k.style.top=(s=q.top-y)+"px",t=!1;else if(y>v){k.style.height=v-5+"px",k.style.top=(s=q.bottom-w.top)+"px";var A=j.getCursor();f.from.ch!=A.ch&&(q=j.cursorCoords(A),k.style.left=(r=q.left)+"px",w=k.getBoundingClientRect())}}var B=w.right-u;if(B>0&&(w.right-w.left>u&&(k.style.width=u-5+"px",B-=w.right-w.left-u),k.style.left=(r=q.left-B)+"px"),j.addKeyMap(this.keyMap=d(b,{moveFocus:function(a,b){i.changeActive(i.selectedHint+a,b)},setFocus:function(a){i.changeActive(a)},menuSize:function(){return i.screenAmount()},length:l.length,close:function(){b.close()},pick:function(){i.pick()},data:f})),b.options.closeOnUnfocus){var C;j.on("blur",this.onBlur=function(){C=setTimeout(function(){b.close()},100)}),j.on("focus",this.onFocus=function(){clearTimeout(C)})}var D=j.getScrollInfo();return j.on("scroll",this.onScroll=function(){var a=j.getScrollInfo(),c=j.getWrapperElement().getBoundingClientRect(),d=s+D.top-a.top,e=d-(window.pageYOffset||(document.documentElement||document.body).scrollTop);return t||(e+=k.offsetHeight),e<=c.top||e>=c.bottom?b.close():(k.style.top=d+"px",void(k.style.left=r+D.left-a.left+"px"))}),a.on(k,"dblclick",function(a){var b=e(k,a.target||a.srcElement);b&&null!=b.hintId&&(i.changeActive(b.hintId),i.pick())}),a.on(k,"click",function(a){var c=e(k,a.target||a.srcElement);c&&null!=c.hintId&&(i.changeActive(c.hintId),b.options.completeOnSingleClick&&i.pick())}),a.on(k,"mousedown",function(){setTimeout(function(){j.focus()},20)}),a.signal(f,"select",l[0],k.firstChild),!0}var g="CodeMirror-hint",h="CodeMirror-hint-active";a.showHint=function(a,b,c){if(!b)return a.showHint(c);c&&c.async&&(b.async=!0);var d={hint:b};if(c)for(var e in c)d[e]=c[e];return a.showHint(d)},a.defineExtension("showHint",function(c){if(!(this.listSelections().length>1||this.somethingSelected())){this.state.completionActive&&this.state.completionActive.close();var d=this.state.completionActive=new b(this,c);d.options.hint&&(a.signal(this,"startCompletion",this),d.update(!0))}});var i=window.requestAnimationFrame||function(a){return setTimeout(a,1e3/60)},j=window.cancelAnimationFrame||clearTimeout;b.prototype={close:function(){this.active()&&(this.cm.state.completionActive=null,this.tick=null,this.cm.off("cursorActivity",this.activityFunc),this.widget&&this.data&&a.signal(this.data,"close"),this.widget&&this.widget.close(),a.signal(this.cm,"endCompletion",this.cm))},active:function(){return this.cm.state.completionActive==this},pick:function(b,d){var e=b.list[d];e.hint?e.hint(this.cm,b,e):this.cm.replaceRange(c(e),e.from||b.from,e.to||b.to,"complete"),a.signal(b,"pick",e),this.close()},cursorActivity:function(){this.debounce&&(j(this.debounce),this.debounce=0);var a=this.cm.getCursor(),b=this.cm.getLine(a.line);if(a.line!=this.startPos.line||b.length-a.ch!=this.startLen-this.startPos.ch||a.ch=this.data.list.length?b=c?this.data.list.length-1:0:0>b&&(b=c?0:this.data.list.length-1),this.selectedHint!=b){var d=this.hints.childNodes[this.selectedHint];d.className=d.className.replace(" "+h,""),d=this.hints.childNodes[this.selectedHint=b],d.className+=" "+h,d.offsetTopthis.hints.scrollTop+this.hints.clientHeight&&(this.hints.scrollTop=d.offsetTop+d.offsetHeight-this.hints.clientHeight+3),a.signal(this.data,"select",this.data.list[this.selectedHint],d)}},screenAmount:function(){return Math.floor(this.hints.clientHeight/this.hints.firstChild.offsetHeight)||1}},a.registerHelper("hint","auto",function(b,c){var d,e=b.getHelpers(b.getCursor(),"hint");if(e.length)for(var f=0;f,]/,closeOnUnfocus:!0,completeOnSingleClick:!1,container:null,customKeys:null,extraKeys:null};a.defineOption("hintOptions",null)}); \ No newline at end of file diff --git a/media/editors/codemirror/addon/hint/sql-hint.js b/media/editors/codemirror/addon/hint/sql-hint.js index 92c889e139f21..08051ce74f01d 100644 --- a/media/editors/codemirror/addon/hint/sql-hint.js +++ b/media/editors/codemirror/addon/hint/sql-hint.js @@ -26,71 +26,120 @@ return CodeMirror.resolveMode(mode).keywords; } + function getText(item) { + return typeof item == "string" ? item : item.text; + } + + function getItem(list, item) { + if (!list.slice) return list[item]; + for (var i = list.length - 1; i >= 0; i--) if (getText(list[i]) == item) + return list[i]; + } + + function shallowClone(object) { + var result = {}; + for (var key in object) if (object.hasOwnProperty(key)) + result[key] = object[key]; + return result; + } + function match(string, word) { var len = string.length; - var sub = word.substr(0, len); + var sub = getText(word).substr(0, len); return string.toUpperCase() === sub.toUpperCase(); } function addMatches(result, search, wordlist, formatter) { for (var word in wordlist) { if (!wordlist.hasOwnProperty(word)) continue; - if (Array.isArray(wordlist)) { - word = wordlist[word]; - } - if (match(search, word)) { - result.push(formatter(word)); - } + if (wordlist.slice) word = wordlist[word]; + + if (match(search, word)) result.push(formatter(word)); } } + function cleanName(name) { + // Get rid name from backticks(`) and preceding dot(.) + if (name.charAt(0) == ".") { + name = name.substr(1); + } + return name.replace(/`/g, ""); + } + + function insertBackticks(name) { + var nameParts = getText(name).split("."); + for (var i = 0; i < nameParts.length; i++) + nameParts[i] = "`" + nameParts[i] + "`"; + var escaped = nameParts.join("."); + if (typeof name == "string") return escaped; + name = shallowClone(name); + name.text = escaped; + return name; + } + function nameCompletion(cur, token, result, editor) { - var useBacktick = (token.string.charAt(0) == "`"); - var string = token.string.substr(1); - var prevToken = editor.getTokenAt(Pos(cur.line, token.start)); - if (token.string.charAt(0) == "." || prevToken.string == "."){ - //Suggest colunm names - if (prevToken.string == ".") { - var prevToken = editor.getTokenAt(Pos(cur.line, token.start - 1)); - } - var table = prevToken.string; - //Check if backtick is used in table name. If yes, use it for columns too. - var useBacktickTable = false; - if (table.match(/`/g)) { - useBacktickTable = true; - table = table.replace(/`/g, ""); - } - //Check if table is available. If not, find table by Alias - if (!tables.hasOwnProperty(table)) - table = findTableByAlias(table, editor); - var columns = tables[table]; - if (!columns) return; - - if (useBacktick) { - addMatches(result, string, columns, function(w) {return "`" + w + "`";}); - } - else if(useBacktickTable) { - addMatches(result, string, columns, function(w) {return ".`" + w + "`";}); - } - else { - addMatches(result, string, columns, function(w) {return "." + w;}); + // Try to complete table, colunm names and return start position of completion + var useBacktick = false; + var nameParts = []; + var start = token.start; + var cont = true; + while (cont) { + cont = (token.string.charAt(0) == "."); + useBacktick = useBacktick || (token.string.charAt(0) == "`"); + + start = token.start; + nameParts.unshift(cleanName(token.string)); + + token = editor.getTokenAt(Pos(cur.line, token.start)); + if (token.string == ".") { + cont = true; + token = editor.getTokenAt(Pos(cur.line, token.start)); } } - else { - //Suggest table names or colums in defaultTable - while (token.start && string.charAt(0) == ".") { - token = editor.getTokenAt(Pos(cur.line, token.start - 1)); - string = token.string + string; - } - if (useBacktick) { - addMatches(result, string, tables, function(w) {return "`" + w + "`";}); - addMatches(result, string, defaultTable, function(w) {return "`" + w + "`";}); - } - else { - addMatches(result, string, tables, function(w) {return w;}); - addMatches(result, string, defaultTable, function(w) {return w;}); - } + + // Try to complete table names + var string = nameParts.join("."); + addMatches(result, string, tables, function(w) { + return useBacktick ? insertBackticks(w) : w; + }); + + // Try to complete columns from defaultTable + addMatches(result, string, defaultTable, function(w) { + return useBacktick ? insertBackticks(w) : w; + }); + + // Try to complete columns + string = nameParts.pop(); + var table = nameParts.join("."); + + var alias = false; + var aliasTable = table; + // Check if table is available. If not, find table by Alias + if (!getItem(tables, table)) { + var oldTable = table; + table = findTableByAlias(table, editor); + if (table !== oldTable) alias = true; } + + var columns = getItem(tables, table); + if (columns && columns.columns) + columns = columns.columns; + + if (columns) { + addMatches(result, string, columns, function(w) { + if (typeof w == "string") { + var tableInsert = table; + if (alias == true) tableInsert = aliasTable; + w = tableInsert + "." + w; + } else { + w = shallowClone(w); + w.text = table + "." + w.text; + } + return useBacktick ? insertBackticks(w) : w; + }); + } + + return start; } function eachWord(lineText, f) { @@ -150,12 +199,10 @@ var lineText = query[i]; eachWord(lineText, function(word) { var wordUpperCase = word.toUpperCase(); - if (wordUpperCase === aliasUpperCase && tables.hasOwnProperty(previousWord)) { - table = previousWord; - } - if (wordUpperCase !== CONS.ALIAS_KEYWORD) { + if (wordUpperCase === aliasUpperCase && getItem(tables, previousWord)) + table = previousWord; + if (wordUpperCase !== CONS.ALIAS_KEYWORD) previousWord = word; - } }); if (table) break; } @@ -165,9 +212,18 @@ CodeMirror.registerHelper("hint", "sql", function(editor, options) { tables = (options && options.tables) || {}; var defaultTableName = options && options.defaultTable; - defaultTable = (defaultTableName && tables[defaultTableName] || []); + var disableKeywords = options && options.disableKeywords; + defaultTable = defaultTableName && getItem(tables, defaultTableName); keywords = keywords || getKeywords(editor); + if (defaultTableName && !defaultTable) + defaultTable = findTableByAlias(defaultTableName, editor); + + defaultTable = defaultTable || []; + + if (defaultTable.columns) + defaultTable = defaultTable.columns; + var cur = editor.getCursor(); var result = []; var token = editor.getTokenAt(cur), start, end, search; @@ -185,11 +241,12 @@ search = ""; } if (search.charAt(0) == "." || search.charAt(0) == "`") { - nameCompletion(cur, token, result, editor); + start = nameCompletion(cur, token, result, editor); } else { addMatches(result, search, tables, function(w) {return w;}); addMatches(result, search, defaultTable, function(w) {return w;}); - addMatches(result, search, keywords, function(w) {return w.toUpperCase();}); + if (!disableKeywords) + addMatches(result, search, keywords, function(w) {return w.toUpperCase();}); } return {list: result, from: Pos(cur.line, start), to: Pos(cur.line, end)}; diff --git a/media/editors/codemirror/addon/hint/sql-hint.min.js b/media/editors/codemirror/addon/hint/sql-hint.min.js new file mode 100644 index 0000000000000..12f3828754ab5 --- /dev/null +++ b/media/editors/codemirror/addon/hint/sql-hint.min.js @@ -0,0 +1 @@ +!function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("../../mode/sql/sql")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../../mode/sql/sql"],a):a(CodeMirror)}(function(a){"use strict";function b(b){var c=b.doc.modeOption;return"sql"===c&&(c="text/x-sql"),a.resolveMode(c).keywords}function c(a){return"string"==typeof a?a:a.text}function d(a,b){if(!a.slice)return a[b];for(var d=a.length-1;d>=0;d--)if(c(a[d])==b)return a[d]}function e(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function f(a,b){var d=a.length,e=c(b).substr(0,d);return a.toUpperCase()===e.toUpperCase()}function g(a,b,c,d){for(var e in c)c.hasOwnProperty(e)&&(c.slice&&(e=c[e]),f(b,e)&&a.push(d(e)))}function h(a){return"."==a.charAt(0)&&(a=a.substr(1)),a.replace(/`/g,"")}function i(a){for(var b=c(a).split("."),d=0;dp&&u>=q){j={start:m(p),end:m(u)};break}p=u}for(var v=c.getRange(j.start,j.end,!1),t=0;tl.ch&&(r.end=l.ch,r.string=r.string.slice(0,l.ch-r.start)),r.string.match(/^[.`\w@]\w*$/)?(k=r.string,h=r.start,i=r.end):(h=i=l.ch,k=""),"."==k.charAt(0)||"`"==k.charAt(0)?h=j(l,r,m,a):(g(m,k,o,function(a){return a}),g(m,k,p,function(a){return a}),f||g(m,k,q,function(a){return a.toUpperCase()})),{list:m,from:s(l.line,h),to:s(l.line,i)}})}); \ No newline at end of file diff --git a/media/editors/codemirror/addon/hint/xml-hint.min.js b/media/editors/codemirror/addon/hint/xml-hint.min.js new file mode 100644 index 0000000000000..3ea0a6efcaba4 --- /dev/null +++ b/media/editors/codemirror/addon/hint/xml-hint.min.js @@ -0,0 +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(b,d){var e=d&&d.schemaInfo,f=d&&d.quoteChar||'"';if(e){var g=b.getCursor(),h=b.getTokenAt(g);h.end>g.ch&&(h.end=g.ch,h.string=h.string.slice(0,g.ch-h.start));var i=a.innerMode(b.getMode(),h.state);if("xml"==i.mode.name){var j,k,l=[],m=!1,n=/\btag\b/.test(h.type)&&!/>$/.test(h.string),o=n&&/^\w/.test(h.string);if(o){var p=b.getLine(g.line).slice(Math.max(0,h.start-2),h.start),q=/<\/$/.test(p)?"close":/<$/.test(p)?"open":null;q&&(k=h.start-("close"==q?2:1))}else n&&"<"==h.string?q="open":n&&"")}else{var s=e[i.state.tagName],w=s&&s.attrs,x=e["!attrs"];if(!w&&!x)return;if(w){if(x){var y={};for(var z in x)x.hasOwnProperty(z)&&(y[z]=x[z]);for(var z in w)w.hasOwnProperty(z)&&(y[z]=w[z]);w=y}}else w=x;if("string"==h.type||"="==h.string){var A,p=b.getRange(c(g.line,Math.max(0,g.ch-60)),c(g.line,"string"==h.type?h.start:h.end)),B=p.match(/([^\s\u00a0=<>\"\']+)=$/);if(!B||!w.hasOwnProperty(B[1])||!(A=w[B[1]]))return;if("function"==typeof A&&(A=A.call(this,b)),"string"==h.type){j=h.string;var C=0;/['"]/.test(h.string.charAt(0))&&(f=h.string.charAt(0),j=h.string.slice(1),C++);var D=h.string.length;/['"]/.test(h.string.charAt(D-1))&&(f=h.string.charAt(D-1),j=h.string.substr(C,D-2)),m=!0}for(var u=0;u0){var k=f.character;i.forEach(function(a){k>a&&(k-=1)}),f.character=k}}var l=f.character-1,m=l+1;f.evidence&&(h=f.evidence.substring(l).search(/.\b/),h>-1&&(m+=h)),f.description=f.reason,f.start=f.character,f.end=m,f=c(f),f&&d.push({message:f.description,severity:f.severity,from:a.Pos(f.line-1,l),to:a.Pos(f.line-1,m)})}}}var g=["Dangerous comment"],h=[["Expected '{'","Statement body should be inside '{ }' braces."]],i=["Missing semicolon","Extra comma","Missing property name","Unmatched "," and instead saw"," is not defined","Unclosed string","Stopping, unable to continue"];a.registerHelper("lint","javascript",b)}); \ No newline at end of file diff --git a/media/editors/codemirror/addon/lint/json-lint.min.js b/media/editors/codemirror/addon/lint/json-lint.min.js new file mode 100644 index 0000000000000..dcba6fb002f8d --- /dev/null +++ b/media/editors/codemirror/addon/lint/json-lint.min.js @@ -0,0 +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.registerHelper("lint","json",function(b){var c=[];jsonlint.parseError=function(b,d){var e=d.loc;c.push({from:a.Pos(e.first_line-1,e.first_column),to:a.Pos(e.last_line-1,e.last_column),message:b})};try{jsonlint.parse(b)}catch(d){}return c})}); \ No newline at end of file diff --git a/media/editors/codemirror/addon/lint/lint.js b/media/editors/codemirror/addon/lint/lint.js index 66f187e22eac8..3eea203ce5e53 100644 --- a/media/editors/codemirror/addon/lint/lint.js +++ b/media/editors/codemirror/addon/lint/lint.js @@ -46,6 +46,7 @@ } var poll = setInterval(function() { if (tooltip) for (var n = node;; n = n.parentNode) { + if (n && n.nodeType == 11) n = n.host; if (n == document.body) return; if (!n) { hide(); break; } } @@ -62,11 +63,9 @@ this.onMouseOver = function(e) { onMouseOver(cm, e); }; } - function parseOptions(cm, options) { + function parseOptions(_cm, options) { if (options instanceof Function) return {getAnnotations: options}; if (!options || options === true) options = {}; - if (!options.getAnnotations) options.getAnnotations = cm.getHelper(CodeMirror.Pos(0, 0), "lint"); - if (!options.getAnnotations) throw new Error("Required option 'getAnnotations' missing (lint addon)"); return options; } @@ -119,10 +118,12 @@ function startLinting(cm) { var state = cm.state.lint, options = state.options; var passOptions = options.options || options; // Support deprecated passing of `options` property in options - if (options.async) - options.getAnnotations(cm.getValue(), updateLinting, passOptions, cm); + var getAnnotations = options.getAnnotations || cm.getHelper(CodeMirror.Pos(0, 0), "lint"); + if (!getAnnotations) return; + if (options.async || getAnnotations.async) + getAnnotations(cm.getValue(), updateLinting, passOptions, cm); else - updateLinting(cm, options.getAnnotations(cm.getValue(), passOptions, cm)); + updateLinting(cm, getAnnotations(cm.getValue(), passOptions, cm)); } function updateLinting(cm, annotationsNotSorted) { @@ -162,6 +163,7 @@ function onChange(cm) { var state = cm.state.lint; + if (!state) return; clearTimeout(state.timeout); state.timeout = setTimeout(function(){startLinting(cm);}, state.options.delay || 500); } @@ -187,6 +189,7 @@ clearMarks(cm); cm.off("change", onChange); CodeMirror.off(cm.getWrapperElement(), "mouseover", cm.state.lint.onMouseOver); + clearTimeout(cm.state.lint.timeout); delete cm.state.lint; } diff --git a/media/editors/codemirror/addon/lint/lint.min.css b/media/editors/codemirror/addon/lint/lint.min.css new file mode 100644 index 0000000000000..967f390c811c1 --- /dev/null +++ b/media/editors/codemirror/addon/lint/lint.min.css @@ -0,0 +1 @@ +.CodeMirror-lint-markers{width:16px}.CodeMirror-lint-tooltip{background-color:infobackground;border:1px solid #000;border-radius:4px;color:infotext;font-family:monospace;font-size:10pt;overflow:hidden;padding:2px 5px;position:fixed;white-space:pre;white-space:pre-wrap;z-index:100;max-width:600px;opacity:0;transition:opacity .4s;-moz-transition:opacity .4s;-webkit-transition:opacity .4s;-o-transition:opacity .4s;-ms-transition:opacity .4s}.CodeMirror-lint-mark-error,.CodeMirror-lint-mark-warning{background-position:left bottom;background-repeat:repeat-x}.CodeMirror-lint-mark-error{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJDw4cOCW1/KIAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAHElEQVQI12NggIL/DAz/GdA5/xkY/qPKMDAwAADLZwf5rvm+LQAAAABJRU5ErkJggg==)}.CodeMirror-lint-mark-warning{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJFhQXEbhTg7YAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAMklEQVQI12NkgIIvJ3QXMjAwdDN+OaEbysDA4MPAwNDNwMCwiOHLCd1zX07o6kBVGQEAKBANtobskNMAAAAASUVORK5CYII=)}.CodeMirror-lint-marker-error,.CodeMirror-lint-marker-warning{background-position:center center;background-repeat:no-repeat;cursor:pointer;display:inline-block;height:16px;width:16px;vertical-align:middle;position:relative}.CodeMirror-lint-message-error,.CodeMirror-lint-message-warning{padding-left:18px;background-position:top left;background-repeat:no-repeat}.CodeMirror-lint-marker-error,.CodeMirror-lint-message-error{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAHlBMVEW7AAC7AACxAAC7AAC7AAAAAAC4AAC5AAD///+7AAAUdclpAAAABnRSTlMXnORSiwCK0ZKSAAAATUlEQVR42mWPOQ7AQAgDuQLx/z8csYRmPRIFIwRGnosRrpamvkKi0FTIiMASR3hhKW+hAN6/tIWhu9PDWiTGNEkTtIOucA5Oyr9ckPgAWm0GPBog6v4AAAAASUVORK5CYII=)}.CodeMirror-lint-marker-warning,.CodeMirror-lint-message-warning{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAANlBMVEX/uwDvrwD/uwD/uwD/uwD/uwD/uwD/uwD/uwD6twD/uwAAAADurwD2tQD7uAD+ugAAAAD/uwDhmeTRAAAADHRSTlMJ8mN1EYcbmiixgACm7WbuAAAAVklEQVR42n3PUQqAIBBFUU1LLc3u/jdbOJoW1P08DA9Gba8+YWJ6gNJoNYIBzAA2chBth5kLmG9YUoG0NHAUwFXwO9LuBQL1giCQb8gC9Oro2vp5rncCIY8L8uEx5ZkAAAAASUVORK5CYII=)}.CodeMirror-lint-marker-multiple{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAHCAMAAADzjKfhAAAACVBMVEUAAAAAAAC/v7914kyHAAAAAXRSTlMAQObYZgAAACNJREFUeNo1ioEJAAAIwmz/H90iFFSGJgFMe3gaLZ0od+9/AQZ0ADosbYraAAAAAElFTkSuQmCC);background-repeat:no-repeat;background-position:right bottom;width:100%;height:100%} \ No newline at end of file diff --git a/media/editors/codemirror/addon/lint/lint.min.js b/media/editors/codemirror/addon/lint/lint.min.js new file mode 100644 index 0000000000000..6d347e78653bf --- /dev/null +++ b/media/editors/codemirror/addon/lint/lint.min.js @@ -0,0 +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(b,c){function d(b){return e.parentNode?(e.style.top=Math.max(0,b.clientY-e.offsetHeight-5)+"px",void(e.style.left=b.clientX+5+"px")):a.off(document,"mousemove",d)}var e=document.createElement("div");return e.className="CodeMirror-lint-tooltip",e.appendChild(c.cloneNode(!0)),document.body.appendChild(e),a.on(document,"mousemove",d),d(b),null!=e.style.opacity&&(e.style.opacity=1),e}function c(a){a.parentNode&&a.parentNode.removeChild(a)}function d(a){a.parentNode&&(null==a.style.opacity&&c(a),a.style.opacity=0,setTimeout(function(){c(a)},600))}function e(c,e,f){function g(){a.off(f,"mouseout",g),h&&(d(h),h=null)}var h=b(c,e),i=setInterval(function(){if(h)for(var a=f;;a=a.parentNode){if(a&&11==a.nodeType&&(a=a.host),a==document.body)return;if(!a){g();break}}return h?void 0:clearInterval(i)},400);a.on(f,"mouseout",g)}function f(a,b,c){this.marked=[],this.options=b,this.timeout=null,this.hasGutter=c,this.onMouseOver=function(b){q(a,b)}}function g(a,b){return b instanceof Function?{getAnnotations:b}:(b&&b!==!0||(b={}),b)}function h(a){var b=a.state.lint;b.hasGutter&&a.clearGutter(r);for(var c=0;c1,c.options.tooltips))}}d.onUpdateLinting&&d.onUpdateLinting(b,e,a)}function o(a){var b=a.state.lint;b&&(clearTimeout(b.timeout),b.timeout=setTimeout(function(){m(a)},b.options.delay||500))}function p(a,b){var c=b.target||b.srcElement;e(b,l(a),c)}function q(a,b){var c=b.target||b.srcElement;if(/\bCodeMirror-lint-mark-/.test(c.className))for(var d=c.getBoundingClientRect(),e=(d.left+d.right)/2,f=(d.top+d.bottom)/2,g=a.findMarksAt(a.coordsChar({left:e,top:f},"client")),h=0;h= vpEdit.from && - topOrig <= vpOrig.to && botOrig >= vpOrig.from) - drawConnectorsForChunk(dv, topOrig, botOrig, topEdit, botEdit, sTopOrig, sTopEdit, w); - if (align && (topEdit <= vpEdit.to || topOrig <= vpOrig.to)) { - var above = (botEdit < vpEdit.from && botOrig < vpOrig.from); - alignChunks(dv, topOrig, botOrig, topEdit, botEdit, above && extraSpaceAbove); + for (var i = 0; i < dv.chunks.length; i++) { + var ch = dv.chunks[i]; + if (ch.editFrom <= vpEdit.to && ch.editTo >= vpEdit.from && + ch.origFrom <= vpOrig.to && ch.origTo >= vpOrig.from) + drawConnectorsForChunk(dv, ch, sTopOrig, sTopEdit, w); + } + } + + function getMatchingOrigLine(editLine, chunks) { + var editStart = 0, origStart = 0; + for (var i = 0; i < chunks.length; i++) { + var chunk = chunks[i]; + if (chunk.editTo > editLine && chunk.editFrom <= editLine) return null; + if (chunk.editFrom > editLine) break; + editStart = chunk.editTo; + origStart = chunk.origTo; + } + return origStart + (editLine - editStart); + } + + function findAlignedLines(dv, other) { + var linesToAlign = []; + for (var i = 0; i < dv.chunks.length; i++) { + var chunk = dv.chunks[i]; + linesToAlign.push([chunk.origTo, chunk.editTo, other ? getMatchingOrigLine(chunk.editTo, other.chunks) : null]); + } + if (other) { + for (var i = 0; i < other.chunks.length; i++) { + var chunk = other.chunks[i]; + for (var j = 0; j < linesToAlign.length; j++) { + var align = linesToAlign[j]; + if (align[1] == chunk.editTo) { + j = -1; + break; + } else if (align[1] > chunk.editTo) { + break; + } + } + if (j > -1) + linesToAlign.splice(j - 1, 0, [getMatchingOrigLine(chunk.editTo, dv.chunks), chunk.editTo, chunk.origTo]); } + } + return linesToAlign; + } + + function alignChunks(dv, force) { + if (!dv.dealigned && !force) return; + if (!dv.orig.curOp) return dv.orig.operation(function() { + alignChunks(dv, force); }); - if (align) { - if (extraSpaceAbove.edit) - dv.aligners.push(padBelow(dv.edit, 0, extraSpaceAbove.edit)); - if (extraSpaceAbove.orig) - dv.aligners.push(padBelow(dv.orig, 0, extraSpaceAbove.orig)); - dv.edit.scrollTo(null, oldScrollEdit); - dv.orig.scrollTo(null, oldScrollOrig); + + dv.dealigned = false; + var other = dv.mv.left == dv ? dv.mv.right : dv.mv.left; + if (other) { + ensureDiff(other); + other.dealigned = false; } + var linesToAlign = findAlignedLines(dv, other); + + // Clear old aligners + var aligners = dv.mv.aligners; + for (var i = 0; i < aligners.length; i++) + aligners[i].clear(); + aligners.length = 0; + + var cm = [dv.orig, dv.edit], scroll = []; + if (other) cm.push(other.orig); + for (var i = 0; i < cm.length; i++) + scroll.push(cm[i].getScrollInfo().top); + + for (var ln = 0; ln < linesToAlign.length; ln++) + alignLines(cm, linesToAlign[ln], aligners); + + for (var i = 0; i < cm.length; i++) + cm[i].scrollTo(null, scroll[i]); + } + + function alignLines(cm, lines, aligners) { + var maxOffset = 0, offset = []; + for (var i = 0; i < cm.length; i++) if (lines[i] != null) { + var off = cm[i].heightAtLine(lines[i], "local"); + offset[i] = off; + maxOffset = Math.max(maxOffset, off); + } + for (var i = 0; i < cm.length; i++) if (lines[i] != null) { + var diff = maxOffset - offset[i]; + if (diff > 1) + aligners.push(padAbove(cm[i], lines[i], diff)); + } + } + + function padAbove(cm, line, size) { + var above = true; + if (line > cm.lastLine()) { + line--; + above = false; + } + var elt = document.createElement("div"); + elt.className = "CodeMirror-merge-spacer"; + elt.style.height = size + "px"; elt.style.minWidth = "1px"; + return cm.addLineWidget(line, elt, {height: size, above: above}); } - function drawConnectorsForChunk(dv, topOrig, botOrig, topEdit, botEdit, sTopOrig, sTopEdit, w) { + function drawConnectorsForChunk(dv, chunk, sTopOrig, sTopEdit, w) { var flip = dv.type == "left"; - var top = dv.orig.heightAtLine(topOrig, "local") - sTopOrig; + var top = dv.orig.heightAtLine(chunk.origFrom, "local") - sTopOrig; if (dv.svg) { var topLpx = top; - var topRpx = dv.edit.heightAtLine(topEdit, "local") - sTopEdit; + var topRpx = dv.edit.heightAtLine(chunk.editFrom, "local") - sTopEdit; if (flip) { var tmp = topLpx; topLpx = topRpx; topRpx = tmp; } - var botLpx = dv.orig.heightAtLine(botOrig, "local") - sTopOrig; - var botRpx = dv.edit.heightAtLine(botEdit, "local") - sTopEdit; + var botLpx = dv.orig.heightAtLine(chunk.origTo, "local") - sTopOrig; + var botRpx = dv.edit.heightAtLine(chunk.editTo, "local") - sTopEdit; if (flip) { var tmp = botLpx; botLpx = botRpx; botRpx = tmp; } var curveTop = " C " + w/2 + " " + topRpx + " " + w/2 + " " + topLpx + " " + (w + 2) + " " + topLpx; var curveBot = " C " + w/2 + " " + botLpx + " " + w/2 + " " + botRpx + " -1 " + botRpx; @@ -321,48 +409,26 @@ "CodeMirror-merge-copy")); var editOriginals = dv.mv.options.allowEditingOriginals; copy.title = editOriginals ? "Push to left" : "Revert chunk"; - copy.chunk = {topEdit: topEdit, botEdit: botEdit, topOrig: topOrig, botOrig: botOrig}; + copy.chunk = chunk; copy.style.top = top + "px"; if (editOriginals) { - var topReverse = dv.orig.heightAtLine(topEdit, "local") - sTopEdit; + var topReverse = dv.orig.heightAtLine(chunk.editFrom, "local") - sTopEdit; var copyReverse = dv.copyButtons.appendChild(elt("div", dv.type == "right" ? "\u21dd" : "\u21dc", "CodeMirror-merge-copy-reverse")); copyReverse.title = "Push to right"; - copyReverse.chunk = {topEdit: topOrig, botEdit: botOrig, topOrig: topEdit, botOrig: botEdit}; + copyReverse.chunk = {editFrom: chunk.origFrom, editTo: chunk.origTo, + origFrom: chunk.editFrom, origTo: chunk.editTo}; copyReverse.style.top = topReverse + "px"; dv.type == "right" ? copyReverse.style.left = "2px" : copyReverse.style.right = "2px"; } } } - function alignChunks(dv, topOrig, botOrig, topEdit, botEdit, aboveViewport) { - var topOrigPx = dv.orig.heightAtLine(topOrig, "local"); - var botOrigPx = dv.orig.heightAtLine(botOrig, "local"); - var topEditPx = dv.edit.heightAtLine(topEdit, "local"); - var botEditPx = dv.edit.heightAtLine(botEdit, "local"); - var origH = botOrigPx -topOrigPx, editH = botEditPx - topEditPx; - var diff = editH - origH; - if (diff > 1) { - if (aboveViewport) aboveViewport.orig += diff; - else dv.aligners.push(padBelow(dv.orig, botOrig - 1, diff)); - } else if (diff < -1) { - if (aboveViewport) aboveViewport.edit -= diff; - else dv.aligners.push(padBelow(dv.edit, botEdit - 1, -diff)); - } - return 0; - } - - function padBelow(cm, line, size) { - var elt = document.createElement("div"); - elt.style.height = size + "px"; elt.style.minWidth = "1px"; - return cm.addLineWidget(line, elt, {height: size}); - } - function copyChunk(dv, to, from, chunk) { if (dv.diffOutOfDate) return; - to.replaceRange(from.getRange(Pos(chunk.topOrig, 0), Pos(chunk.botOrig, 0)), - Pos(chunk.topEdit, 0), Pos(chunk.botEdit, 0)); + to.replaceRange(from.getRange(Pos(chunk.origFrom, 0), Pos(chunk.origTo, 0)), + Pos(chunk.editFrom, 0), Pos(chunk.editTo, 0)); } // Merge view, containing 0, 1, or 2 diff views. @@ -372,16 +438,11 @@ this.options = options; var origLeft = options.origLeft, origRight = options.origRight == null ? options.orig : options.origRight; - if (origLeft && origRight) { - if (options.connect == "align") - throw new Error("connect: \"align\" is not supported for three-way merge views"); - if (options.collapseIdentical) - throw new Error("collapseIdentical option is not supported for three-way merge views"); - } var hasLeft = origLeft != null, hasRight = origRight != null; var panes = 1 + (hasLeft ? 1 : 0) + (hasRight ? 1 : 0); var wrap = [], left = this.left = null, right = this.right = null; + var self = this; if (hasLeft) { left = this.left = new DiffView(this, "left"); @@ -410,8 +471,17 @@ if (left) left.init(leftPane, origLeft, options); if (right) right.init(rightPane, origRight, options); - if (options.collapseIdentical) - collapseIdenticalStretches(left || right, options.collapseIdentical); + if (options.collapseIdentical) { + updating = true; + this.editor().operation(function() { + collapseIdenticalStretches(self, options.collapseIdentical); + }); + updating = false; + } + if (options.connect == "align") { + this.aligners = []; + alignChunks(this.left || this.right, true); + } var onResize = function() { if (left) makeConnections(left); @@ -463,10 +533,10 @@ if (this.left) this.left.setShowDifferences(val); }, rightChunks: function() { - return this.right && getChunks(this.right); + if (this.right) { ensureDiff(this.right); return this.right.chunks; } }, leftChunks: function() { - return this.left && getChunks(this.left); + if (this.left) { ensureDiff(this.left); return this.left.chunks; } } }; @@ -494,7 +564,8 @@ return diff; } - function iterateChunks(diff, f) { + function getChunks(diff) { + var chunks = []; var startEdit = 0, startOrig = 0; var edit = Pos(0, 0), orig = Pos(0, 0); for (var i = 0; i < diff.length; ++i) { @@ -506,7 +577,8 @@ var endOff = endOfLineClean(diff, i) ? 1 : 0; var cleanToEdit = edit.line + endOff, cleanToOrig = orig.line + endOff; if (cleanToEdit > cleanFromEdit) { - if (i) f(startOrig, cleanFromOrig, startEdit, cleanFromEdit); + if (i) chunks.push({origFrom: startOrig, origTo: cleanFromOrig, + editFrom: startEdit, editTo: cleanFromEdit}); startEdit = cleanToEdit; startOrig = cleanToOrig; } } else { @@ -514,17 +586,9 @@ } } if (startEdit <= edit.line || startOrig <= orig.line) - f(startOrig, orig.line + 1, startEdit, edit.line + 1); - } - - function getChunks(dv) { - ensureDiff(dv); - var collect = []; - iterateChunks(dv.diff, function(topOrig, botOrig, topEdit, botEdit) { - collect.push({origFrom: topOrig, origTo: botOrig, - editFrom: topEdit, editTo: botEdit}); - }); - return collect; + chunks.push({origFrom: startOrig, origTo: orig.line + 1, + editFrom: startEdit, editTo: edit.line + 1}); + return chunks; } function endOfLineClean(diff, i) { @@ -545,18 +609,19 @@ return last.charCodeAt(last.length - 1) == 10; } - function chunkBoundariesAround(diff, n, nInEdit) { + function chunkBoundariesAround(chunks, n, nInEdit) { var beforeE, afterE, beforeO, afterO; - iterateChunks(diff, function(fromOrig, toOrig, fromEdit, toEdit) { - var fromLocal = nInEdit ? fromEdit : fromOrig; - var toLocal = nInEdit ? toEdit : toOrig; + for (var i = 0; i < chunks.length; i++) { + var chunk = chunks[i]; + var fromLocal = nInEdit ? chunk.editFrom : chunk.origFrom; + var toLocal = nInEdit ? chunk.editTo : chunk.origTo; if (afterE == null) { - if (fromLocal > n) { afterE = fromEdit; afterO = fromOrig; } - else if (toLocal > n) { afterE = toEdit; afterO = toOrig; } + if (fromLocal > n) { afterE = chunk.editFrom; afterO = chunk.origFrom; } + else if (toLocal > n) { afterE = chunk.editTo; afterO = chunk.origTo; } } - if (toLocal <= n) { beforeE = toEdit; beforeO = toOrig; } - else if (fromLocal <= n) { beforeE = fromEdit; beforeO = fromOrig; } - }); + if (toLocal <= n) { beforeE = chunk.editTo; beforeO = chunk.origTo; } + else if (fromLocal <= n) { beforeE = chunk.editFrom; beforeO = chunk.origFrom; } + } return {edit: {before: beforeE, after: afterE}, orig: {before: beforeO, after: afterO}}; } @@ -579,25 +644,50 @@ return {mark: mark, clear: clear}; } - function collapseStretch(dv, origStart, editStart, size) { - var mOrig = collapseSingle(dv.orig, origStart, origStart + size); - var mEdit = collapseSingle(dv.edit, editStart, editStart + size); - mOrig.mark.on("clear", function() { mEdit.clear(); }); - mEdit.mark.on("clear", function() { mOrig.clear(); }); + function collapseStretch(size, editors) { + var marks = []; + function clear() { + for (var i = 0; i < marks.length; i++) marks[i].clear(); + } + for (var i = 0; i < editors.length; i++) { + var editor = editors[i]; + var mark = collapseSingle(editor.cm, editor.line, editor.line + size); + marks.push(mark); + mark.mark.on("clear", clear); + } + return marks[0].mark; + } + + function unclearNearChunks(dv, margin, off, clear) { + for (var i = 0; i < dv.chunks.length; i++) { + var chunk = dv.chunks[i]; + for (var l = chunk.editFrom - margin; l < chunk.editTo + margin; l++) { + var pos = l + off; + if (pos >= 0 && pos < clear.length) clear[pos] = false; + } + } } - function collapseIdenticalStretches(dv, margin) { + function collapseIdenticalStretches(mv, margin) { if (typeof margin != "number") margin = 2; - var lastOrig = dv.orig.firstLine(), lastEdit = dv.edit.firstLine(); - iterateChunks(dv.diff, function(topOrig, botOrig, _topEdit, botEdit) { - var identicalSize = topOrig - margin - lastOrig; - if (identicalSize > margin) - collapseStretch(dv, lastOrig, lastEdit, identicalSize); - lastOrig = botOrig + margin; lastEdit = botEdit + margin; - }); - var bottomSize = dv.orig.lastLine() + 1 - lastOrig; - if (bottomSize > margin) - collapseStretch(dv, lastOrig, lastEdit, bottomSize); + var clear = [], edit = mv.editor(), off = edit.firstLine(); + for (var l = off, e = edit.lastLine(); l <= e; l++) clear.push(true); + if (mv.left) unclearNearChunks(mv.left, margin, off, clear); + if (mv.right) unclearNearChunks(mv.right, margin, off, clear); + + for (var i = 0; i < clear.length; i++) { + if (clear[i]) { + var line = i + off; + for (var size = 1; i < clear.length - 1 && clear[i + 1]; i++, size++) {} + if (size > margin) { + var editors = [{line: line, cm: edit}]; + if (mv.left) editors.push({line: getMatchingOrigLine(line, mv.left.chunks), cm: mv.left.orig}); + if (mv.right) editors.push({line: getMatchingOrigLine(line, mv.right.chunks), cm: mv.right.orig}); + var mark = collapseStretch(size, editors); + if (mv.options.onCollapse) mv.options.onCollapse(mv, line, size, mark); + } + } + } } // General utilities @@ -644,4 +734,42 @@ function posMin(a, b) { return (a.line - b.line || a.ch - b.ch) < 0 ? a : b; } function posMax(a, b) { return (a.line - b.line || a.ch - b.ch) > 0 ? a : b; } function posEq(a, b) { return a.line == b.line && a.ch == b.ch; } + + function findPrevDiff(chunks, start, isOrig) { + for (var i = chunks.length - 1; i >= 0; i--) { + var chunk = chunks[i]; + var to = (isOrig ? chunk.origTo : chunk.editTo) - 1; + if (to < start) return to; + } + } + + function findNextDiff(chunks, start, isOrig) { + for (var i = 0; i < chunks.length; i++) { + var chunk = chunks[i]; + var from = (isOrig ? chunk.origFrom : chunk.editFrom); + if (from > start) return from; + } + } + + function goNearbyDiff(cm, dir) { + var found = null, views = cm.state.diffViews, line = cm.getCursor().line; + if (views) for (var i = 0; i < views.length; i++) { + var dv = views[i], isOrig = cm == dv.orig; + ensureDiff(dv); + var pos = dir < 0 ? findPrevDiff(dv.chunks, line, isOrig) : findNextDiff(dv.chunks, line, isOrig); + if (pos != null && (found == null || (dir < 0 ? pos > found : pos < found))) + found = pos; + } + if (found != null) + cm.setCursor(found, 0); + else + return CodeMirror.Pass; + } + + CodeMirror.commands.goNextDiff = function(cm) { + return goNearbyDiff(cm, 1); + }; + CodeMirror.commands.goPrevDiff = function(cm) { + return goNearbyDiff(cm, -1); + }; }); diff --git a/media/editors/codemirror/addon/merge/merge.min.css b/media/editors/codemirror/addon/merge/merge.min.css new file mode 100644 index 0000000000000..2bc2c22b4294c --- /dev/null +++ b/media/editors/codemirror/addon/merge/merge.min.css @@ -0,0 +1 @@ +.CodeMirror-merge{position:relative;border:1px solid #ddd;white-space:pre}.CodeMirror-merge,.CodeMirror-merge .CodeMirror{height:350px}.CodeMirror-merge-2pane .CodeMirror-merge-pane{width:47%}.CodeMirror-merge-2pane .CodeMirror-merge-gap{width:6%}.CodeMirror-merge-3pane .CodeMirror-merge-pane{width:31%}.CodeMirror-merge-3pane .CodeMirror-merge-gap{width:3.5%}.CodeMirror-merge-pane{display:inline-block;white-space:normal;vertical-align:top}.CodeMirror-merge-pane-rightmost{position:absolute;right:0;z-index:1}.CodeMirror-merge-gap{z-index:2;display:inline-block;height:100%;-moz-box-sizing:border-box;box-sizing:border-box;overflow:hidden;border-left:1px solid #ddd;border-right:1px solid #ddd;position:relative;background:#f8f8f8}.CodeMirror-merge-scrolllock-wrap{position:absolute;bottom:0;left:50%}.CodeMirror-merge-scrolllock{position:relative;left:-50%;cursor:pointer;color:#555;line-height:1}.CodeMirror-merge-copybuttons-left,.CodeMirror-merge-copybuttons-right{position:absolute;left:0;top:0;right:0;bottom:0;line-height:1}.CodeMirror-merge-copy,.CodeMirror-merge-copy-reverse{position:absolute;cursor:pointer;color:#44c}.CodeMirror-merge-copybuttons-left .CodeMirror-merge-copy{left:2px}.CodeMirror-merge-copybuttons-right .CodeMirror-merge-copy{right:2px}.CodeMirror-merge-l-inserted,.CodeMirror-merge-r-inserted{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAACCAYAAACddGYaAAAAGUlEQVQI12MwuCXy3+CWyH8GBgYGJgYkAABZbAQ9ELXurwAAAABJRU5ErkJggg==);background-position:bottom left;background-repeat:repeat-x}.CodeMirror-merge-l-deleted,.CodeMirror-merge-r-deleted{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAACCAYAAACddGYaAAAAGUlEQVQI12M4Kyb2/6yY2H8GBgYGJgYkAABURgPz6Ks7wQAAAABJRU5ErkJggg==);background-position:bottom left;background-repeat:repeat-x}.CodeMirror-merge-r-chunk{background:#ffffe0}.CodeMirror-merge-r-chunk-start{border-top:1px solid #ee8}.CodeMirror-merge-r-chunk-end{border-bottom:1px solid #ee8}.CodeMirror-merge-r-connect{fill:#ffffe0;stroke:#ee8;stroke-width:1px}.CodeMirror-merge-l-chunk{background:#eef}.CodeMirror-merge-l-chunk-start{border-top:1px solid #88e}.CodeMirror-merge-l-chunk-end{border-bottom:1px solid #88e}.CodeMirror-merge-l-connect{fill:#eef;stroke:#88e;stroke-width:1px}.CodeMirror-merge-l-chunk.CodeMirror-merge-r-chunk{background:#dfd}.CodeMirror-merge-l-chunk-start.CodeMirror-merge-r-chunk-start{border-top:1px solid #4e4}.CodeMirror-merge-l-chunk-end.CodeMirror-merge-r-chunk-end{border-bottom:1px solid #4e4}.CodeMirror-merge-collapsed-widget:before{content:"(...)"}.CodeMirror-merge-collapsed-widget{cursor:pointer;color:#88b;background:#eef;border:1px solid #ddf;font-size:90%;padding:0 3px;border-radius:4px}.CodeMirror-merge-collapsed-line .CodeMirror-gutter-elt{display:none} \ No newline at end of file diff --git a/media/editors/codemirror/addon/merge/merge.min.js b/media/editors/codemirror/addon/merge/merge.min.js new file mode 100644 index 0000000000000..c98b851562a0f --- /dev/null +++ b/media/editors/codemirror/addon/merge/merge.min.js @@ -0,0 +1 @@ +!function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("diff_match_patch")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","diff_match_patch"],a):a(CodeMirror,diff_match_patch)}(function(a,b){"use strict";function c(a,b){this.mv=a,this.type=b,this.classes="left"==b?{chunk:"CodeMirror-merge-l-chunk",start:"CodeMirror-merge-l-chunk-start",end:"CodeMirror-merge-l-chunk-end",insert:"CodeMirror-merge-l-inserted",del:"CodeMirror-merge-l-deleted",connect:"CodeMirror-merge-l-connect"}:{chunk:"CodeMirror-merge-r-chunk",start:"CodeMirror-merge-r-chunk-start",end:"CodeMirror-merge-r-chunk-end",insert:"CodeMirror-merge-r-inserted",del:"CodeMirror-merge-r-deleted",connect:"CodeMirror-merge-r-connect"}}function d(b){b.diffOutOfDate&&(b.diff=w(b.orig.getValue(),b.edit.getValue()),b.chunks=x(b.diff),b.diffOutOfDate=!1,a.signal(b.edit,"updateDiff",b.diff))}function e(a){function b(b){S=!0,l=!1,"full"==b&&(a.svg&&G(a.svg),a.copyButtons&&G(a.copyButtons),j(a.edit,h.marked,a.classes),j(a.orig,i.marked,a.classes),h.from=h.to=i.from=i.to=0),d(a),a.showDifferences&&(k(a.edit,a.diff,h,DIFF_INSERT,a.classes),k(a.orig,a.diff,i,DIFF_DELETE,a.classes)),m(a),"align"==a.mv.options.connect&&p(a),S=!1}function c(b){S||(a.dealigned=!0,e(b))}function e(a){S||l||(clearTimeout(g),a===!0&&(l=!0),g=setTimeout(b,a===!0?20:250))}function f(b,d){a.diffOutOfDate||(a.diffOutOfDate=!0,h.from=h.to=i.from=i.to=0),c(d.text.length-1!=d.to.line-d.from.line)}var g,h={from:0,to:0,marked:[]},i={from:0,to:0,marked:[]},l=!1;return a.edit.on("change",f),a.orig.on("change",f),a.edit.on("markerAdded",c),a.edit.on("markerCleared",c),a.orig.on("markerAdded",c),a.orig.on("markerCleared",c),a.edit.on("viewportChange",function(){e(!1)}),a.orig.on("viewportChange",function(){e(!1)}),b(),b}function f(a){a.edit.on("scroll",function(){g(a,DIFF_INSERT)&&m(a)}),a.orig.on("scroll",function(){g(a,DIFF_DELETE)&&m(a)})}function g(a,b){if(a.diffOutOfDate)return!1;if(!a.lockScroll)return!0;var c,d,e=+new Date;if(b==DIFF_INSERT?(c=a.edit,d=a.orig):(c=a.orig,d=a.edit),c.state.scrollSetBy==a&&(c.state.scrollSetAt||0)+50>e)return!1;var f=c.getScrollInfo();if("align"==a.mv.options.connect)q=f.top;else{var g,i,j=.5*f.clientHeight,k=f.top+j,l=c.lineAtHeight(k,"local"),m=A(a.chunks,l,b==DIFF_INSERT),n=h(c,b==DIFF_INSERT?m.edit:m.orig),o=h(d,b==DIFF_INSERT?m.orig:m.edit),p=(k-n.top)/(n.bot-n.top),q=o.top-j+p*(o.bot-o.top);if(q>f.top&&(i=f.top/j)<1)q=q*i+f.top*(1-i);else if((g=f.height-f.clientHeight-f.top)g&&(i=g/j)<1&&(q=q*i+(r.height-r.clientHeight-g)*(1-i))}}return d.scrollTo(f.left,q),d.state.scrollSetAt=e,d.state.scrollSetBy=a,!0}function h(a,b){var c=b.after;return null==c&&(c=a.lastLine()+1),{top:a.heightAtLine(b.before||0,"local"),bot:a.heightAtLine(c,"local")}}function i(a,b,c){a.lockScroll=b,b&&0!=c&&g(a,DIFF_INSERT)&&m(a),a.lockButton.innerHTML=b?"⇛⇚":"⇛  ⇚"}function j(b,c,d){for(var e=0;e20||c.from-f.to>20?(j(a,c.marked,e),l(a,b,d,c.marked,f.from,f.to,e),c.from=f.from,c.to=f.to):(f.fromc.to&&(l(a,b,d,c.marked,c.to,f.to,e),c.to=f.to))})}function l(a,b,c,d,e,f,g){function h(b,c){for(var h=Math.max(e,b),i=Math.min(f,c),j=h;i>j;++j){var k=a.addLineClass(j,"background",g.chunk);j==b&&a.addLineClass(k,"background",g.start),j==c-1&&a.addLineClass(k,"background",g.end),d.push(k)}b==c&&h==c&&i==c&&(h?d.push(a.addLineClass(h-1,"background",g.end)):d.push(a.addLineClass(h,"background",g.start)))}for(var i=Q(0,0),j=Q(e,0),k=a.clipPos(Q(f-1)),l=c==DIFF_DELETE?g.del:g.insert,m=0,n=0;nr&&(n&&h(m,r),m=s)}else if(p==c){var t=J(i,q,!0),u=L(j,i),v=K(k,t);M(u,v)||d.push(a.markText(u,v,{className:l})),i=t}}m<=i.line&&h(m,i.line+1)}function m(a){if(a.showDifferences){if(a.svg){G(a.svg);var b=a.gap.offsetWidth;H(a.svg,"width",b,"height",a.gap.offsetHeight)}a.copyButtons&&G(a.copyButtons);for(var c=a.edit.getViewport(),d=a.orig.getViewport(),e=a.edit.getScrollInfo().top,f=a.orig.getScrollInfo().top,g=0;g=c.from&&h.origFrom<=d.to&&h.origTo>=d.from&&s(a,h,f,e,b)}}}function n(a,b){for(var c=0,d=0,e=0;ea&&f.editFrom<=a)return null;if(f.editFrom>a)break;c=f.editTo,d=f.origTo}return d+(a-c)}function o(a,b){for(var c=[],d=0;de.editTo)break}f>-1&&c.splice(f-1,0,[n(e.editTo,a.chunks),e.editTo,e.origTo])}return c}function p(a,b){if(a.dealigned||b){if(!a.orig.curOp)return a.orig.operation(function(){p(a,b)});a.dealigned=!1;var c=a.mv.left==a?a.mv.right:a.mv.left;c&&(d(c),c.dealigned=!1);for(var e=o(a,c),f=a.mv.aligners,g=0;g1&&c.push(r(a[f],b[f],h))}}function r(a,b,c){var d=!0;b>a.lastLine()&&(b--,d=!1);var e=document.createElement("div");return e.className="CodeMirror-merge-spacer",e.style.height=c+"px",e.style.minWidth="1px",a.addLineWidget(b,e,{height:c,above:d})}function s(a,b,c,d,e){var f="left"==a.type,g=a.orig.heightAtLine(b.origFrom,"local")-c;if(a.svg){var h=g,i=a.edit.heightAtLine(b.editFrom,"local")-d;if(f){var j=h;h=i,i=j}var k=a.orig.heightAtLine(b.origTo,"local")-c,l=a.edit.heightAtLine(b.editTo,"local")-d;if(f){var j=k;k=l,l=j}var m=" C "+e/2+" "+i+" "+e/2+" "+h+" "+(e+2)+" "+h,n=" C "+e/2+" "+k+" "+e/2+" "+l+" -1 "+l;H(a.svg.appendChild(document.createElementNS(R,"path")),"d","M -1 "+i+m+" L "+(e+2)+" "+k+n+" z","class",a.classes.connect)}if(a.copyButtons){var o=a.copyButtons.appendChild(F("div","left"==a.type?"⇝":"⇜","CodeMirror-merge-copy")),p=a.mv.options.allowEditingOriginals;if(o.title=p?"Push to left":"Revert chunk",o.chunk=b,o.style.top=g+"px",p){var q=a.orig.heightAtLine(b.editFrom,"local")-d,r=a.copyButtons.appendChild(F("div","right"==a.type?"⇝":"⇜","CodeMirror-merge-copy-reverse"));r.title="Push to right",r.chunk={editFrom:b.origFrom,editTo:b.origTo,origFrom:b.editFrom,origTo:b.editTo},r.style.top=q+"px","right"==a.type?r.style.left="2px":r.style.right="2px"}}}function t(a,b,c,d){a.diffOutOfDate||b.replaceRange(c.getRange(Q(d.origFrom,0),Q(d.origTo,0)),Q(d.editFrom,0),Q(d.editTo,0))}function u(b){var c=b.lockButton=F("div",null,"CodeMirror-merge-scrolllock");c.title="Toggle locked scrolling";var d=F("div",[c],"CodeMirror-merge-scrolllock-wrap");a.on(c,"click",function(){i(b,!b.lockScroll)});var e=[d];if(b.mv.options.revertButtons!==!1&&(b.copyButtons=F("div",null,"CodeMirror-merge-copybuttons-"+b.type),a.on(b.copyButtons,"click",function(a){var c=a.target||a.srcElement;if(c.chunk)return"CodeMirror-merge-copy-reverse"==c.className?void t(b,b.orig,b.edit,c.chunk):void t(b,b.edit,b.orig,c.chunk)}),e.unshift(b.copyButtons)),"align"!=b.mv.options.connect){var f=document.createElementNS&&document.createElementNS(R,"svg");f&&!f.createSVGRect&&(f=null),b.svg=f,f&&e.push(f)}return b.gap=F("div",e,"CodeMirror-merge-gap")}function v(a){return"string"==typeof a?a:a.getValue()}function w(a,b){var c=U.diff_main(a,b);U.diff_cleanupSemantic(c);for(var d=0;dk&&(g&&b.push({origFrom:d,origTo:l,editFrom:c,editTo:k}),c=n,d=o)}else J(i==DIFF_INSERT?e:f,h[1])}return(c<=e.line||d<=f.line)&&b.push({origFrom:d,origTo:f.line+1,editFrom:c,editTo:e.line+1}),b}function y(a,b){if(b==a.length-1)return!0;var c=a[b+1][1];return 1==c.length||10!=c.charCodeAt(0)?!1:b==a.length-2?!0:(c=a[b+2][1],c.length>1&&10==c.charCodeAt(0))}function z(a,b){if(0==b)return!0;var c=a[b-1][1];return 10!=c.charCodeAt(c.length-1)?!1:1==b?!0:(c=a[b-2][1],10==c.charCodeAt(c.length-1))}function A(a,b,c){for(var d,e,f,g,h=0;hb?(e=i.editFrom,g=i.origFrom):k>b&&(e=i.editTo,g=i.origTo)),b>=k?(d=i.editTo,f=i.origTo):b>=j&&(d=i.editFrom,f=i.origFrom)}return{edit:{before:d,after:e},orig:{before:f,after:g}}}function B(a,b,c){function d(){f.clear(),a.removeLineClass(b,"wrap","CodeMirror-merge-collapsed-line")}a.addLineClass(b,"wrap","CodeMirror-merge-collapsed-line");var e=document.createElement("span");e.className="CodeMirror-merge-collapsed-widget",e.title="Identical text collapsed. Click to expand.";var f=a.markText(Q(b,0),Q(c-1),{inclusiveLeft:!0,inclusiveRight:!0,replacedWith:e,clearOnEnter:!0});return e.addEventListener("click",d),{mark:f,clear:d}}function C(a,b){function c(){for(var a=0;a=0&&h=f;f++)c.push(!0);a.left&&D(a.left,b,e,c),a.right&&D(a.right,b,e,c);for(var h=0;hb){var k=[{line:i,cm:d}];a.left&&k.push({line:n(i,a.left.chunks),cm:a.left.orig}),a.right&&k.push({line:n(i,a.right.chunks),cm:a.right.orig});var l=C(j,k);a.options.onCollapse&&a.options.onCollapse(a,i,j,l)}}}function F(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)}function H(a){for(var b=1;b0?a:b}function M(a,b){return a.line==b.line&&a.ch==b.ch}function N(a,b,c){for(var d=a.length-1;d>=0;d--){var e=a[d],f=(c?e.origTo:e.editTo)-1;if(b>f)return f}}function O(a,b,c){for(var d=0;db)return f}}function P(b,c){var e=null,f=b.state.diffViews,g=b.getCursor().line;if(f)for(var h=0;hc?N(i.chunks,g,j):O(i.chunks,g,j);null==k||null!=e&&!(0>c?k>e:e>k)||(e=k)}return null==e?a.Pass:void b.setCursor(e,0)}var Q=a.Pos,R="http://www.w3.org/2000/svg";c.prototype={constructor:c,init:function(b,c,d){this.edit=this.mv.edit,(this.edit.state.diffViews||(this.edit.state.diffViews=[])).push(this),this.orig=a(b,I({value:c,readOnly:!this.mv.options.allowEditingOriginals},I(d))),this.orig.state.diffViews=[this],this.diff=w(v(c),v(d.value)),this.chunks=x(this.diff),this.diffOutOfDate=this.dealigned=!1,this.showDifferences=d.showDifferences!==!1,this.forceUpdate=e(this),i(this,!0,!1),f(this)},setShowDifferences:function(a){a=a!==!1,a!=this.showDifferences&&(this.showDifferences=a,this.forceUpdate("full"))}};var S=!1,T=a.MergeView=function(b,d){if(!(this instanceof T))return new T(b,d);this.options=d;var e=d.origLeft,f=null==d.origRight?d.orig:d.origRight,g=null!=e,h=null!=f,i=1+(g?1:0)+(h?1:0),j=[],k=this.left=null,l=this.right=null,n=this;if(g){k=this.left=new c(this,"left");var o=F("div",null,"CodeMirror-merge-pane");j.push(o),j.push(u(k))}var q=F("div",null,"CodeMirror-merge-pane");if(j.push(q),h){l=this.right=new c(this,"right"),j.push(u(l));var r=F("div",null,"CodeMirror-merge-pane");j.push(r)}(h?r:q).className+=" CodeMirror-merge-pane-rightmost",j.push(F("div",null,null,"height: 0; clear: both;"));var s=this.wrap=b.appendChild(F("div",j,"CodeMirror-merge CodeMirror-merge-"+i+"pane"));this.edit=a(q,I(d)),k&&k.init(o,e,d),l&&l.init(r,f,d),d.collapseIdentical&&(S=!0,this.editor().operation(function(){E(n,d.collapseIdentical)}),S=!1),"align"==d.connect&&(this.aligners=[],p(this.left||this.right,!0));var t=function(){k&&m(k),l&&m(l)};a.on(window,"resize",t);var v=setInterval(function(){for(var b=s.parentNode;b&&b!=document.body;b=b.parentNode);b||(clearInterval(v),a.off(window,"resize",t))},5e3)};T.prototype={constuctor:T,editor:function(){return this.edit},rightOriginal:function(){return this.right&&this.right.orig},leftOriginal:function(){return this.left&&this.left.orig},setShowDifferences:function(a){this.right&&this.right.setShowDifferences(a),this.left&&this.left.setShowDifferences(a)},rightChunks:function(){return this.right?(d(this.right),this.right.chunks):void 0},leftChunks:function(){return this.left?(d(this.left),this.left.chunks):void 0}};var U=new b;a.commands.goNextDiff=function(a){return P(a,1)},a.commands.goPrevDiff=function(a){return P(a,-1)}}); \ No newline at end of file diff --git a/media/editors/codemirror/addon/mode/loadmode.min.js b/media/editors/codemirror/addon/mode/loadmode.min.js new file mode 100644 index 0000000000000..0434d34ed89c4 --- /dev/null +++ b/media/editors/codemirror/addon/mode/loadmode.min.js @@ -0,0 +1 @@ +!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 ? found + pattern.length : found; + } var m = pattern.exec(from ? string.slice(from) : string); - return m ? m.index + from : -1; + return m ? m.index + from + (returnEnd ? m[0].length : 0) : -1; } return { @@ -42,11 +44,11 @@ CodeMirror.multiplexingMode = function(outer /*, others */) { token: function(stream, state) { if (!state.innerActive) { var cutOff = Infinity, oldContent = stream.string; - for (var i = 0; i < n_others; ++i) { + for (var i = 0; i < others.length; ++i) { var other = others[i]; var found = indexOf(oldContent, other.open, stream.pos); if (found == stream.pos) { - stream.match(other.open); + if (!other.parseDelimiters) stream.match(other.open); state.innerActive = other; state.inner = CodeMirror.startState(other.mode, outer.indent ? outer.indent(state.outer, "") : 0); return other.delimStyle; @@ -64,8 +66,8 @@ CodeMirror.multiplexingMode = function(outer /*, others */) { state.innerActive = state.inner = null; return this.token(stream, state); } - var found = curInner.close ? indexOf(oldContent, curInner.close, stream.pos) : -1; - if (found == stream.pos) { + var found = curInner.close ? indexOf(oldContent, curInner.close, stream.pos, curInner.parseDelimiters) : -1; + if (found == stream.pos && !curInner.parseDelimiters) { stream.match(curInner.close); state.innerActive = state.inner = null; return curInner.delimStyle; @@ -74,6 +76,9 @@ CodeMirror.multiplexingMode = function(outer /*, others */) { var innerToken = curInner.mode.token(stream, state.inner); if (found > -1) stream.string = oldContent; + if (found == stream.pos && curInner.parseDelimiters) + state.innerActive = state.inner = null; + if (curInner.innerStyle) { if (innerToken) innerToken = innerToken + ' ' + curInner.innerStyle; else innerToken = curInner.innerStyle; @@ -95,7 +100,7 @@ CodeMirror.multiplexingMode = function(outer /*, others */) { mode.blankLine(state.innerActive ? state.inner : state.outer); } if (!state.innerActive) { - for (var i = 0; i < n_others; ++i) { + for (var i = 0; i < others.length; ++i) { var other = others[i]; if (other.open === "\n") { state.innerActive = other; diff --git a/media/editors/codemirror/addon/mode/multiplex.min.js b/media/editors/codemirror/addon/mode/multiplex.min.js new file mode 100644 index 0000000000000..11b56f6d20c6a --- /dev/null +++ b/media/editors/codemirror/addon/mode/multiplex.min.js @@ -0,0 +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.multiplexingMode=function(b){function c(a,b,c,d){if("string"==typeof b){var e=a.indexOf(b,c);return d&&e>-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;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;f2){d.pending=[];for(var m=2;m-1)return a.Pass;var g=d.indent.length-1,h=b[d.state];a:for(;;){for(var j=0;jg?0:d.indent[g]}}a.defineSimpleMode=function(b,c){a.defineMode(b,function(b){return a.simpleMode(b,c)})},a.simpleMode=function(c,d){b(d,"start");var g={},h=d.meta||{},i=!1;for(var k in d)if(k!=h&&d.hasOwnProperty(k))for(var l=g[k]=[],m=d[k],n=0;n=this.string.length},sol:function(){return 0==this.pos},peek:function(){return this.string.charAt(this.pos)||null},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.start-this.lineStart},indentation:function(){return 0},match:function(a,b,c){if("string"!=typeof a){var d=this.string.slice(this.pos).match(a);return d&&d.index>0?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}}},CodeMirror.StringStream=b,CodeMirror.startState=function(a,b,c){return a.startState?a.startState(b,c):!0};var c=CodeMirror.modes={},d=CodeMirror.mimeModes={};CodeMirror.defineMode=function(a,b){arguments.length>2&&(b.dependencies=Array.prototype.slice.call(arguments,2)),c[a]=b},CodeMirror.defineMIME=function(a,b){d[a]=b},CodeMirror.resolveMode=function(a){return"string"==typeof a&&d.hasOwnProperty(a)?a=d[a]:a&&"string"==typeof a.name&&d.hasOwnProperty(a.name)&&(a=d[a.name]),"string"==typeof a?{name:a}:a||{name:"null"}},CodeMirror.getMode=function(a,b){b=CodeMirror.resolveMode(b);var d=c[b.name];if(!d)throw new Error("Unknown mode: "+b);return d(a,b)},CodeMirror.registerHelper=CodeMirror.registerGlobalHelper=Math.min,CodeMirror.defineMode("null",function(){return{token:function(a){a.skipToEnd()}}}),CodeMirror.defineMIME("text/plain","null"),CodeMirror.runMode=function(b,c,d,e){var f=CodeMirror.getMode({indentUnit:2},c);if(1==d.nodeType){var g=e&&e.tabSize||4,h=d,i=0;h.innerHTML="",d=function(a,b){if("\n"==a)return h.appendChild(document.createElement("br")),void(i=0);for(var c="",d=0;;){var e=a.indexOf(" ",d);if(-1==e){c+=a.slice(d),i+=a.length-d;break}i+=e-d,c+=a.slice(d,e);var f=g-i%g;i+=f;for(var j=0;f>j;++j)c+=" ";d=e+1}if(b){var k=h.appendChild(document.createElement("span"));k.className="cm-"+b.replace(/ +/g," cm-"),k.appendChild(document.createTextNode(c))}else h.appendChild(document.createTextNode(c))}}for(var j=a(b),k=e&&e.state||CodeMirror.startState(f),l=0,m=j.length;m>l;++l){l&&d("\n");var n=new CodeMirror.StringStream(j[l]);for(!n.string&&f.blankLine&&f.blankLine(k);!n.eol();){var o=f.token(n,k);d(n.current(),o,l,n.start,k),n.start=n.pos}}}}(); \ No newline at end of file diff --git a/media/editors/codemirror/addon/runmode/runmode.min.js b/media/editors/codemirror/addon/runmode/runmode.min.js new file mode 100644 index 0000000000000..f6f7917e577cd --- /dev/null +++ b/media/editors/codemirror/addon/runmode/runmode.min.js @@ -0,0 +1 @@ +function splitLines(a){return a.split(/\r?\n|\r/)}function StringStream(a){this.pos=this.start=0,this.string=a,this.lineStart=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";a.runMode=function(b,c,d,e){var f=a.getMode(a.defaults,c),g=/MSIE \d/.test(navigator.userAgent),h=g&&(null==document.documentMode||document.documentMode<9);if(1==d.nodeType){var i=e&&e.tabSize||a.defaults.tabSize,j=d,k=0;j.innerHTML="",d=function(a,b){if("\n"==a)return j.appendChild(document.createTextNode(h?"\r":a)),void(k=0);for(var c="",d=0;;){var e=a.indexOf(" ",d);if(-1==e){c+=a.slice(d),k+=a.length-d;break}k+=e-d,c+=a.slice(d,e);var f=i-k%i;k+=f;for(var g=0;f>g;++g)c+=" ";d=e+1}if(b){var l=j.appendChild(document.createElement("span"));l.className="cm-"+b.replace(/ +/g," cm-"),l.appendChild(document.createTextNode(c))}else j.appendChild(document.createTextNode(c))}}for(var l=a.splitLines(b),m=e&&e.state||a.startState(f),n=0,o=l.length;o>n;++n){n&&d("\n");var p=new a.StringStream(l[n]);for(!p.string&&f.blankLine&&f.blankLine(m);!p.eol();){var q=f.token(p,m);d(p.current(),q,n,p.start,m),p.start=p.pos}}}}),StringStream.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return 0==this.pos},peek:function(){return this.string.charAt(this.pos)||null},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.start-this.lineStart},indentation:function(){return 0},match:function(a,b,c){if("string"!=typeof a){var d=this.string.slice(this.pos).match(a);return d&&d.index>0?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}}},exports.StringStream=StringStream,exports.startState=function(a,b,c){return a.startState?a.startState(b,c):!0};var modes=exports.modes={},mimeModes=exports.mimeModes={};exports.defineMode=function(a,b){arguments.length>2&&(b.dependencies=Array.prototype.slice.call(arguments,2)),modes[a]=b},exports.defineMIME=function(a,b){mimeModes[a]=b},exports.defineMode("null",function(){return{token:function(a){a.skipToEnd()}}}),exports.defineMIME("text/plain","null"),exports.resolveMode=function(a){return"string"==typeof a&&mimeModes.hasOwnProperty(a)?a=mimeModes[a]:a&&"string"==typeof a.name&&mimeModes.hasOwnProperty(a.name)&&(a=mimeModes[a.name]),"string"==typeof a?{name:a}:a||{name:"null"}},exports.getMode=function(a,b){b=exports.resolveMode(b);var c=modes[b.name];if(!c)throw new Error("Unknown mode: "+b);return c(a,b)},exports.registerHelper=exports.registerGlobalHelper=Math.min,exports.runMode=function(a,b,c,d){for(var e=exports.getMode({indentUnit:2},b),f=splitLines(a),g=d&&d.state||exports.startState(e),h=0,i=f.length;i>h;++h){h&&c("\n");var j=new exports.StringStream(f[h]);for(!j.string&&e.blankLine&&e.blankLine(g);!j.eol();){var k=e.token(j,g);c(j.current(),k,h,j.start,g),j.start=j.pos}}},require.cache[require.resolve("../../lib/codemirror")]=require.cache[require.resolve("./runmode.node")]; \ No newline at end of file diff --git a/media/editors/codemirror/addon/scroll/annotatescrollbar.js b/media/editors/codemirror/addon/scroll/annotatescrollbar.js index 6dfff1a6a4cdd..e62a45acf2083 100644 --- a/media/editors/codemirror/addon/scroll/annotatescrollbar.js +++ b/media/editors/codemirror/addon/scroll/annotatescrollbar.js @@ -11,27 +11,46 @@ })(function(CodeMirror) { "use strict"; - CodeMirror.defineExtension("annotateScrollbar", function(className) { - return new Annotation(this, className); + CodeMirror.defineExtension("annotateScrollbar", function(options) { + if (typeof options == "string") options = {className: options}; + return new Annotation(this, options); }); - function Annotation(cm, className) { + CodeMirror.defineOption("scrollButtonHeight", 0); + + function Annotation(cm, options) { this.cm = cm; - this.className = className; + this.options = options; + this.buttonHeight = options.scrollButtonHeight || cm.getOption("scrollButtonHeight"); this.annotations = []; + this.doRedraw = this.doUpdate = null; this.div = cm.getWrapperElement().appendChild(document.createElement("div")); this.div.style.cssText = "position: absolute; right: 0; top: 0; z-index: 7; pointer-events: none"; this.computeScale(); + function scheduleRedraw(delay) { + clearTimeout(self.doRedraw); + self.doRedraw = setTimeout(function() { self.redraw(); }, delay); + } + var self = this; - cm.on("refresh", this.resizeHandler = function(){ - if (self.computeScale()) self.redraw(); + cm.on("refresh", this.resizeHandler = function() { + clearTimeout(self.doUpdate); + self.doUpdate = setTimeout(function() { + if (self.computeScale()) scheduleRedraw(20); + }, 100); }); + cm.on("markerAdded", this.resizeHandler); + cm.on("markerCleared", this.resizeHandler); + if (options.listenForChanges !== false) + cm.on("change", this.changeHandler = function() { + scheduleRedraw(250); + }); } Annotation.prototype.computeScale = function() { var cm = this.cm; - var hScale = (cm.getWrapperElement().clientHeight - cm.display.barHeight) / + var hScale = (cm.getWrapperElement().clientHeight - cm.display.barHeight - this.buttonHeight * 2) / cm.heightAtLine(cm.lastLine() + 1, "local"); if (hScale != this.hScale) { this.hScale = hScale; @@ -44,26 +63,43 @@ this.redraw(); }; - Annotation.prototype.redraw = function() { + Annotation.prototype.redraw = function(compute) { + if (compute !== false) this.computeScale(); var cm = this.cm, hScale = this.hScale; - if (!cm.display.barWidth) return; var frag = document.createDocumentFragment(), anns = this.annotations; - for (var i = 0, nextTop; i < anns.length; i++) { + + var wrapping = cm.getOption("lineWrapping"); + var singleLineH = wrapping && cm.defaultTextHeight() * 1.5; + var curLine = null, curLineObj = null; + function getY(pos, top) { + if (curLine != pos.line) { + curLine = pos.line; + curLineObj = cm.getLineHandle(curLine); + } + if (wrapping && curLineObj.height > singleLineH) + return cm.charCoords(pos, "local")[top ? "top" : "bottom"]; + var topY = cm.heightAtLine(curLineObj, "local"); + return topY + (top ? 0 : curLineObj.height); + } + + if (cm.display.barWidth) for (var i = 0, nextTop; i < anns.length; i++) { var ann = anns[i]; - var top = nextTop || cm.charCoords(ann.from, "local").top * hScale; - var bottom = cm.charCoords(ann.to, "local").bottom * hScale; + var top = nextTop || getY(ann.from, true) * hScale; + var bottom = getY(ann.to, false) * hScale; while (i < anns.length - 1) { - nextTop = cm.charCoords(anns[i + 1].from, "local").top * hScale; + nextTop = getY(anns[i + 1].from, true) * hScale; if (nextTop > bottom + .9) break; ann = anns[++i]; - bottom = cm.charCoords(ann.to, "local").bottom * hScale; + bottom = getY(ann.to, false) * hScale; } + if (bottom == top) continue; var height = Math.max(bottom - top, 3); var elt = frag.appendChild(document.createElement("div")); - elt.style.cssText = "position: absolute; right: 0px; width: " + Math.max(cm.display.barWidth - 1, 2) + "px; top: " + top + "px; height: " + height + "px"; - elt.className = this.className; + elt.style.cssText = "position: absolute; right: 0px; width: " + Math.max(cm.display.barWidth - 1, 2) + "px; top: " + + (top + this.buttonHeight) + "px; height: " + height + "px"; + elt.className = this.options.className; } this.div.textContent = ""; this.div.appendChild(frag); @@ -71,6 +107,9 @@ Annotation.prototype.clear = function() { this.cm.off("refresh", this.resizeHandler); + this.cm.off("markerAdded", this.resizeHandler); + this.cm.off("markerCleared", this.resizeHandler); + if (this.changeHandler) this.cm.off("change", this.changeHandler); this.div.parentNode.removeChild(this.div); }; }); diff --git a/media/editors/codemirror/addon/scroll/annotatescrollbar.min.js b/media/editors/codemirror/addon/scroll/annotatescrollbar.min.js new file mode 100644 index 0000000000000..b19c0ff6b5b52 --- /dev/null +++ b/media/editors/codemirror/addon/scroll/annotatescrollbar.min.js @@ -0,0 +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){function c(a){clearTimeout(d.doRedraw),d.doRedraw=setTimeout(function(){d.redraw()},a)}this.cm=a,this.options=b,this.buttonHeight=b.scrollButtonHeight||a.getOption("scrollButtonHeight"),this.annotations=[],this.doRedraw=this.doUpdate=null,this.div=a.getWrapperElement().appendChild(document.createElement("div")),this.div.style.cssText="position: absolute; right: 0; top: 0; z-index: 7; pointer-events: none",this.computeScale();var d=this;a.on("refresh",this.resizeHandler=function(){clearTimeout(d.doUpdate),d.doUpdate=setTimeout(function(){d.computeScale()&&c(20)},100)}),a.on("markerAdded",this.resizeHandler),a.on("markerCleared",this.resizeHandler),b.listenForChanges!==!1&&a.on("change",this.changeHandler=function(){c(250)})}a.defineExtension("annotateScrollbar",function(a){return"string"==typeof a&&(a={className:a}),new b(this,a)}),a.defineOption("scrollButtonHeight",0),b.prototype.computeScale=function(){var a=this.cm,b=(a.getWrapperElement().clientHeight-a.display.barHeight-2*this.buttonHeight)/a.heightAtLine(a.lastLine()+1,"local");return b!=this.hScale?(this.hScale=b,!0):void 0},b.prototype.update=function(a){this.annotations=a,this.redraw()},b.prototype.redraw=function(a){function b(a,b){if(i!=a.line&&(i=a.line,j=c.getLineHandle(i)),g&&j.height>h)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}}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)}}); \ No newline at end of file diff --git a/media/editors/codemirror/addon/scroll/scrollpastend.min.js b/media/editors/codemirror/addon/scroll/scrollpastend.min.js new file mode 100644 index 0000000000000..699865a991f7c --- /dev/null +++ b/media/editors/codemirror/addon/scroll/scrollpastend.min.js @@ -0,0 +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(b,d){a.changeEnd(d).line==b.lastLine()&&c(b)}function c(a){var b="";if(a.lineCount()>1){var c=a.display.scroller.clientHeight-30,d=a.getLineHandle(a.lastLine()).height;b=c-d+"px"}a.state.scrollPastEndPadding!=b&&(a.state.scrollPastEndPadding=b,a.display.lineSpace.parentNode.style.paddingBottom=b,a.setSize())}a.defineOption("scrollPastEnd",!1,function(d,e,f){f&&f!=a.Init&&(d.off("change",b),d.off("refresh",c),d.display.lineSpace.parentNode.style.paddingBottom="",d.state.scrollPastEndPadding=null),e&&(d.on("change",b),d.on("refresh",c),c(d))})}); \ No newline at end of file diff --git a/media/editors/codemirror/addon/scroll/simplescrollbars.js b/media/editors/codemirror/addon/scroll/simplescrollbars.js index bb06adb86a11a..f78353a130ce3 100644 --- a/media/editors/codemirror/addon/scroll/simplescrollbars.js +++ b/media/editors/codemirror/addon/scroll/simplescrollbars.js @@ -69,14 +69,20 @@ if (update !== false) this.scroll(pos, this.orientation); }; + var minButtonSize = 10; + Bar.prototype.update = function(scrollSize, clientSize, barSize) { this.screen = clientSize; this.total = scrollSize; this.size = barSize; - // FIXME clip to min size? + var buttonSize = this.screen * (this.size / this.total); + if (buttonSize < minButtonSize) { + this.size -= minButtonSize - buttonSize; + buttonSize = minButtonSize; + } this.inner.style[this.orientation == "horizontal" ? "width" : "height"] = - this.screen * (this.size / this.total) + "px"; + buttonSize + "px"; this.inner.style[this.orientation == "horizontal" ? "left" : "top"] = this.pos * (this.size / this.total) + "px"; }; diff --git a/media/editors/codemirror/addon/scroll/simplescrollbars.min.css b/media/editors/codemirror/addon/scroll/simplescrollbars.min.css new file mode 100644 index 0000000000000..618a2f7344ca0 --- /dev/null +++ b/media/editors/codemirror/addon/scroll/simplescrollbars.min.css @@ -0,0 +1 @@ +.CodeMirror-simplescroll-horizontal div,.CodeMirror-simplescroll-vertical div{position:absolute;background:#ccc;-moz-box-sizing:border-box;box-sizing:border-box;border:1px solid #bbb;border-radius:2px}.CodeMirror-simplescroll-horizontal,.CodeMirror-simplescroll-vertical{position:absolute;z-index:6;background:#eee}.CodeMirror-simplescroll-horizontal{bottom:0;left:0;height:8px}.CodeMirror-simplescroll-horizontal div{bottom:0;height:100%}.CodeMirror-simplescroll-vertical{right:0;top:0;width:8px}.CodeMirror-simplescroll-vertical div{right:0;width:100%}.CodeMirror-overlayscroll .CodeMirror-gutter-filler,.CodeMirror-overlayscroll .CodeMirror-scrollbar-filler{display:none}.CodeMirror-overlayscroll-horizontal div,.CodeMirror-overlayscroll-vertical div{position:absolute;background:#bcd;border-radius:3px}.CodeMirror-overlayscroll-horizontal,.CodeMirror-overlayscroll-vertical{position:absolute;z-index:6}.CodeMirror-overlayscroll-horizontal{bottom:0;left:0;height:6px}.CodeMirror-overlayscroll-horizontal div{bottom:0;height:100%}.CodeMirror-overlayscroll-vertical{right:0;top:0;width:6px}.CodeMirror-overlayscroll-vertical div{right:0;width:100%} \ No newline at end of file diff --git a/media/editors/codemirror/addon/scroll/simplescrollbars.min.js b/media/editors/codemirror/addon/scroll/simplescrollbars.min.js new file mode 100644 index 0000000000000..16af8d358e698 --- /dev/null +++ b/media/editors/codemirror/addon/scroll/simplescrollbars.min.js @@ -0,0 +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(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.moveTo=function(a,b){0>a&&(a=0),a>this.total-this.screen&&(a=this.total-this.screen),a!=this.pos&&(this.pos=a,this.inner.style["horizontal"==this.orientation?"left":"top"]=a*(this.size/this.total)+"px",b!==!1&&this.scroll(a,this.orientation))};var d=10;b.prototype.update=function(a,b,c){this.screen=b,this.total=a,this.size=c;var e=this.screen*(this.size/this.total);d>e&&(this.size-=d-e,e=d),this.inner.style["horizontal"==this.orientation?"width":"height"]=e+"px",this.inner.style["horizontal"==this.orientation?"left":"top"]=this.pos*(this.size/this.total)+"px"},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.display="block",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.moveTo(a,!1)},c.prototype.setScrollLeft=function(a){this.horiz.moveTo(a,!1)},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)}}); \ No newline at end of file diff --git a/media/editors/codemirror/addon/search/match-highlighter.min.js b/media/editors/codemirror/addon/search/match-highlighter.min.js new file mode 100644 index 0000000000000..546dda04b774a --- /dev/null +++ b/media/editors/codemirror/addon/search/match-highlighter.min.js @@ -0,0 +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){"object"==typeof a&&(this.minChars=a.minChars,this.style=a.style,this.showToken=a.showToken,this.delay=a.delay,this.wordsOnly=a.wordsOnly),null==this.style&&(this.style=i),null==this.minChars&&(this.minChars=h),null==this.delay&&(this.delay=j),null==this.wordsOnly&&(this.wordsOnly=k),this.overlay=this.timeout=null}function c(a){var b=a.state.matchHighlighter;clearTimeout(b.timeout),b.timeout=setTimeout(function(){d(a)},b.delay)}function d(a){a.operation(function(){var b=a.state.matchHighlighter;if(b.overlay&&(a.removeOverlay(b.overlay),b.overlay=null),!a.somethingSelected()&&b.showToken){for(var c=b.showToken===!0?/[\w$]/:b.showToken,d=a.getCursor(),f=a.getLine(d.line),h=d.ch,i=h;h&&c.test(f.charAt(h-1));)--h;for(;ih&&a.addOverlay(b.overlay=g(f.slice(h,i),c,b.style)))}var j=a.getCursor("from"),k=a.getCursor("to");if(j.line==k.line&&(!b.wordsOnly||e(a,j,k))){var l=a.getRange(j,k).replace(/^\s+|\s+$/g,"");l.length>=b.minChars&&a.addOverlay(b.overlay=g(l,!1,b.style))}})}function e(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= this.gap.from) this.matches.splice(i--, 1); } var cursor = this.cm.getSearchCursor(this.query, CodeMirror.Pos(this.gap.from, 0), this.caseFold); + var maxMatches = this.options && this.options.maxMatches || MAX_MATCHES; while (cursor.findNext()) { var match = {from: cursor.from(), to: cursor.to()}; if (match.from.line >= this.gap.to) break; this.matches.splice(i++, 0, match); - if (this.matches.length > MAX_MATCHES) break; + if (this.matches.length > maxMatches) break; } this.gap = null; }; diff --git a/media/editors/codemirror/addon/search/matchesonscrollbar.min.css b/media/editors/codemirror/addon/search/matchesonscrollbar.min.css new file mode 100644 index 0000000000000..16ee9050f96a7 --- /dev/null +++ b/media/editors/codemirror/addon/search/matchesonscrollbar.min.css @@ -0,0 +1 @@ +.CodeMirror-search-match{background:gold;border-top:1px solid orange;border-bottom:1px solid orange;-moz-box-sizing:border-box;box-sizing:border-box;opacity:.5} \ No newline at end of file diff --git a/media/editors/codemirror/addon/search/matchesonscrollbar.min.js b/media/editors/codemirror/addon/search/matchesonscrollbar.min.js new file mode 100644 index 0000000000000..d63561ce575e1 --- /dev/null +++ b/media/editors/codemirror/addon/search/matchesonscrollbar.min.js @@ -0,0 +1 @@ +!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;g 0) break; ranges.push({anchor: cur.from(), head: cur.to()}); } diff --git a/media/editors/codemirror/addon/search/searchcursor.min.js b/media/editors/codemirror/addon/search/searchcursor.min.js new file mode 100644 index 0000000000000..ce7c259960056 --- /dev/null +++ b/media/editors/codemirror/addon/search/searchcursor.min.js @@ -0,0 +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,e,f){if(this.atOccurrence=!1,this.doc=a,null==f&&"string"==typeof b&&(f=!1),e=e?a.clipPos(e):d(0,0),this.pos={from:e,to:e},"string"!=typeof b)b.global||(b=new RegExp(b.source,b.ignoreCase?"ig":"g")),this.matches=function(c,e){if(c){b.lastIndex=0;for(var f,g,h=a.getLine(e.line).slice(0,e.ch),i=0;;){b.lastIndex=i;var j=b.exec(h);if(!j)break;if(f=j,g=f.index,i=f.index+(f[0].length||1),i==h.length)break}var k=f&&f[0].length||0;k||(0==g&&0==h.length?f=void 0:g!=a.getLine(e.line).length&&k++)}else{b.lastIndex=e.ch;var h=a.getLine(e.line),f=b.exec(h),k=f&&f[0].length||0,g=f&&f.index;g+k==h.length||k||(k=1)}return f&&k?{from:d(e.line,g),to:d(e.line,g+k),match:f}:void 0};else{var g=b;f&&(b=b.toLowerCase());var h=f?function(a){return a.toLowerCase()}:function(a){return a},i=b.split("\n");if(1==i.length)b.length?this.matches=function(e,f){if(e){var i=a.getLine(f.line).slice(0,f.ch),j=h(i),k=j.lastIndexOf(b);if(k>-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)})}); \ No newline at end of file diff --git a/media/editors/codemirror/addon/selection/active-line.min.js b/media/editors/codemirror/addon/selection/active-line.min.js new file mode 100644 index 0000000000000..466aad0b38e83 --- /dev/null +++ b/media/editors/codemirror/addon/selection/active-line.min.js @@ -0,0 +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){for(var b=0;b=c.line,n=m?c:i(l,0),o=a.markText(k,n,{className:f});if(null==d?e.push(o):e.splice(d++,0,o),m)break;g=l}}function e(a){for(var b=a.state.markedSelection,c=0;c1)return f(a);var b=a.getCursor("start"),c=a.getCursor("end"),g=a.state.markedSelection;if(!g.length)return d(a,b,c);var i=g[0].find(),k=g[g.length-1].find();if(!i||!k||c.line-b.line=0||j(c,i.from)<=0)return f(a);for(;j(b,i.from)>0;)g.shift().clear(),i=g[0].find();for(j(b,i.from)<0&&(i.to.line-b.line0&&(c.line-k.from.line=b.mouseX&&f.top<=b.mouseY&&f.bottom>=b.mouseY&&(d=!0)}var g=d?b.value:"";a.display.lineDiv.style.cursor!=g&&(a.display.lineDiv.style.cursor=g)}}a.defineOption("selectionPointer",!1,function(e,f){var g=e.state.selectionPointer;g&&(a.off(e.getWrapperElement(),"mousemove",g.mousemove),a.off(e.getWrapperElement(),"mouseout",g.mouseout),a.off(window,"scroll",g.windowScroll),e.off("cursorActivity",d),e.off("scroll",d),e.state.selectionPointer=null,e.display.lineDiv.style.cursor=""),f&&(g=e.state.selectionPointer={value:"string"==typeof f?f:"default",mousemove:function(a){b(e,a)},mouseout:function(a){c(e,a)},windowScroll:function(){d(e)},rects:null,mouseX:null,mouseY:null,willUpdate:!1},a.on(e.getWrapperElement(),"mousemove",g.mousemove),a.on(e.getWrapperElement(),"mouseout",g.mouseout),a.on(window,"scroll",g.windowScroll),e.on("cursorActivity",d),e.on("scroll",d))})}); \ No newline at end of file diff --git a/media/editors/codemirror/addon/tern/tern.js b/media/editors/codemirror/addon/tern/tern.js index 86729e2d3f7eb..99b8a64682f78 100644 --- a/media/editors/codemirror/addon/tern/tern.js +++ b/media/editors/codemirror/addon/tern/tern.js @@ -130,6 +130,13 @@ data = self.options.responseFilter(doc, query, request, error, data); c(error, data); }); + }, + + destroy: function () { + if (this.worker) { + this.worker.terminate(); + this.worker = null; + } } }; @@ -252,7 +259,9 @@ tip.appendChild(document.createTextNode(" — " + data.doc)); if (data.url) { tip.appendChild(document.createTextNode(" ")); - tip.appendChild(elt("a", null, "[docs]")).href = data.url; + var child = tip.appendChild(elt("a", null, "[docs]")); + child.href = data.url; + child.target = "_blank"; } } tempTooltip(cm, tip); @@ -434,7 +443,7 @@ function atInterestingExpression(cm) { var pos = cm.getCursor("end"), tok = cm.getTokenAt(pos); if (tok.start < pos.ch && (tok.type == "comment" || tok.type == "string")) return false; - return /\w/.test(cm.getLine(pos.line).slice(Math.max(pos.ch - 1, 0), pos.ch + 1)); + return /[\w)\]]/.test(cm.getLine(pos.line).slice(Math.max(pos.ch - 1, 0), pos.ch + 1)); } // Variable renaming @@ -582,15 +591,33 @@ // Tooltips function tempTooltip(cm, content) { + if (cm.state.ternTooltip) remove(cm.state.ternTooltip); var where = cm.cursorCoords(); - var tip = makeTooltip(where.right + 1, where.bottom, content); + var tip = cm.state.ternTooltip = makeTooltip(where.right + 1, where.bottom, content); + function maybeClear() { + old = true; + if (!mouseOnTip) clear(); + } function clear() { + cm.state.ternTooltip = null; if (!tip.parentNode) return; cm.off("cursorActivity", clear); + cm.off('blur', clear); + cm.off('scroll', clear); fadeOut(tip); } - setTimeout(clear, 1700); + var mouseOnTip = false, old = false; + CodeMirror.on(tip, "mousemove", function() { mouseOnTip = true; }); + CodeMirror.on(tip, "mouseout", function(e) { + if (!CodeMirror.contains(tip, e.relatedTarget || e.toElement)) { + if (old) clear(); + else mouseOnTip = false; + } + }); + setTimeout(maybeClear, 1700); cm.on("cursorActivity", clear); + cm.on('blur', clear); + cm.on('scroll', clear); } function makeTooltip(x, y, content) { @@ -631,7 +658,7 @@ // Worker wrapper function WorkerServer(ts) { - var worker = new Worker(ts.options.workerScript); + var worker = ts.worker = new Worker(ts.options.workerScript); worker.postMessage({type: "init", defs: ts.options.defs, plugins: ts.options.plugins, diff --git a/media/editors/codemirror/addon/tern/tern.min.css b/media/editors/codemirror/addon/tern/tern.min.css new file mode 100644 index 0000000000000..f4ae8b49e0bfa --- /dev/null +++ b/media/editors/codemirror/addon/tern/tern.min.css @@ -0,0 +1 @@ +.CodeMirror-Tern-completion{padding-left:22px;position:relative}.CodeMirror-Tern-completion:before{position:absolute;left:2px;bottom:2px;border-radius:50%;font-size:12px;font-weight:700;height:15px;width:15px;line-height:16px;text-align:center;color:#fff;-moz-box-sizing:border-box;box-sizing:border-box}.CodeMirror-Tern-completion-unknown:before{content:"?";background:#4bb}.CodeMirror-Tern-completion-object:before{content:"O";background:#77c}.CodeMirror-Tern-completion-fn:before{content:"F";background:#7c7}.CodeMirror-Tern-completion-array:before{content:"A";background:#c66}.CodeMirror-Tern-completion-number:before{content:"1";background:#999}.CodeMirror-Tern-completion-string:before{content:"S";background:#999}.CodeMirror-Tern-completion-bool:before{content:"B";background:#999}.CodeMirror-Tern-completion-guess{color:#999}.CodeMirror-Tern-tooltip{border:1px solid silver;border-radius:3px;color:#444;padding:2px 5px;font-size:90%;font-family:monospace;background-color:#fff;white-space:pre-wrap;max-width:40em;position:absolute;z-index:10;-webkit-box-shadow:2px 3px 5px rgba(0,0,0,.2);-moz-box-shadow:2px 3px 5px rgba(0,0,0,.2);box-shadow:2px 3px 5px rgba(0,0,0,.2);transition:opacity 1s;-moz-transition:opacity 1s;-webkit-transition:opacity 1s;-o-transition:opacity 1s;-ms-transition:opacity 1s}.CodeMirror-Tern-hint-doc{max-width:25em;margin-top:-3px}.CodeMirror-Tern-fname{color:#000}.CodeMirror-Tern-farg{color:#70a}.CodeMirror-Tern-farg-current{text-decoration:underline}.CodeMirror-Tern-type{color:#07c}.CodeMirror-Tern-fhint-guess{opacity:.7} \ No newline at end of file diff --git a/media/editors/codemirror/addon/tern/tern.min.js b/media/editors/codemirror/addon/tern/tern.min.js new file mode 100644 index 0000000000000..154b8739e241d --- /dev/null +++ b/media/editors/codemirror/addon/tern/tern.min.js @@ -0,0 +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){var d=a.docs[b];d?c(E(a,d)):a.options.getFile?a.options.getFile(b,c):c(null)}function c(a,b,c){for(var d in a.docs){var e=a.docs[d];if(e.doc==b)return e}if(!c)for(var f=0;;++f)if(d="[doc"+(f||"")+"]",!a.docs[d]){c=d;break}return a.addDoc(c,b)}function d(b,d){return"string"==typeof d?b.docs[d]:(d instanceof a&&(d=d.getDoc()),d instanceof a.Doc?c(b,d):void 0)}function e(a,b,d){var e=c(a,b),g=a.cachedArgHints;g&&g.doc==b&&K(g.start,d.to)<=0&&(a.cachedArgHints=null);var h=e.changed;null==h&&(e.changed=h={from:d.from.line,to:d.from.line});var i=d.from.line+(d.text.length-1);d.from.line=h.to&&(h.to=i+1),h.from>d.from.line&&(h.from=d.from.line),b.lineCount()>I&&d.to-h.from>100&&setTimeout(function(){e.changed&&e.changed.to-e.changed.from>100&&f(a,e)},200)}function f(a,b){a.server.request({files:[{type:"full",name:b.name,text:E(a,b)}]},function(a){a?window.console.error(a):b.changed=null})}function g(b,c,d){b.request(c,{type:"completions",types:!0,docs:!0,urls:!0},function(e,f){if(e)return C(b,c,e);var g=[],i="",j=f.start,k=f.end;'["'==c.getRange(G(j.line,j.ch-2),j)&&'"]'!=c.getRange(k,G(k.line,k.ch+2))&&(i='"]');for(var l=0;l=m;--j){for(var o=c.getLine(j),p=0,q=0;;){var r=o.indexOf(" ",q);if(-1==r)break;p+=i-(r+p)%i-1,q=r+1}if(g=f.column-p,"("==o.charAt(g)){n=!0;break}}if(n){var s=G(j,g),t=b.cachedArgHints;return t&&t.doc==c.getDoc()&&0==K(s,t.start)?k(b,c,h):void b.request(c,{type:"type",preferFunction:!0,end:s},function(a,d){!a&&d.type&&/^fn\(/.test(d.type)&&(b.cachedArgHints={start:q,type:l(d.type),name:d.exprName||d.name||"fn",guess:d.guess,doc:c.getDoc()},k(b,c,h))})}}}}}function k(a,b,c){D(a);for(var d=a.cachedArgHints,e=d.type,f=w("span",d.guess?H+"fhint-guess":null,w("span",H+"fname",d.name),"("),g=0;g ":")")),e.rettype&&f.appendChild(w("span",H+"type",e.rettype));var i=b.cursorCoords(null,"page");a.activeArgHints=z(i.right+1,i.bottom,f)}function l(a){function b(b){for(var c=0,e=d;;){var f=a.charAt(d);if(b.test(f)&&!c)return a.slice(e,d);/[{\[\(]/.test(f)?++c:/[}\]\)]/.test(f)&&--c,++d}}var c=[],d=3;if(")"!=a.charAt(d))for(;;){var e=a.slice(d).match(/^([^, \(\[\{]+): /);if(e&&(d+=e[0].length,e=e[1]),c.push({name:e,type:b(/[\),]/)}),")"==a.charAt(d))break;d+=2}var f=a.slice(d).match(/^\) -> (.*)$/);return{args:c,rettype:f&&f[1]}}function m(a,b){function d(d){var e={type:"definition",variable:d||null},f=c(a,b.getDoc());a.server.request(u(a,f,e),function(c,d){if(c)return C(a,b,c);if(!d.file&&d.url)return void window.open(d.url);if(d.file){var e,g=a.docs[d.file];if(g&&(e=p(g.doc,d)))return a.jumpStack.push({file:f.name,start:b.getCursor("from"),end:b.getCursor("to")}),void o(a,f,g,e.start,e.end)}C(a,b,"Could not find a definition.")})}q(b)?d():x(b,"Jump to variable",function(a){a&&d(a)})}function n(a,b){var d=a.jumpStack.pop(),e=d&&a.docs[d.file];e&&o(a,c(a,b.getDoc()),e,d.start,d.end)}function o(a,b,c,d,e){c.doc.setSelection(d,e),b!=c&&a.options.switchToDoc&&(D(a),a.options.switchToDoc(c.name,c.doc))}function p(a,b){for(var c=b.context.slice(0,b.contextOffset).split("\n"),d=b.start.line-(c.length-1),e=G(d,(1==c.length?b.start.ch:a.getLine(d).length)-c[0].length),f=a.getLine(d).slice(e.ch),g=d+1;gl&&(h=k,j=l)}if(!h)return null;if(1==c.length?h.ch+=c[0].length:h=G(h.line+(c.length-1),c[c.length-1].length),b.start.line==b.end.line)var m=G(h.line,h.ch+(b.end.ch-b.start.ch));else var m=G(h.line+(b.end.line-b.start.line),b.end.ch);return{start:h,end:m}}function q(a){var b=a.getCursor("end"),c=a.getTokenAt(b);return c.start=0&&K(g,i.end)<=0&&(g=f.length-1))}b.setSelections(f,g)})}function t(a,b){for(var c=Object.create(null),d=0;dI&&g!==!1&&b.changed.to-b.changed.from<100&&b.changed.from<=h.line&&b.changed.to>c.end.line){e.push(v(b,h,c.end)),c.file="#0";var f=e[0].offsetLines;null!=c.start&&(c.start=G(c.start.line- -f,c.start.ch)),c.end=G(c.end.line-f,c.end.ch)}else e.push({type:"full",name:b.name,text:E(a,b)}),c.file=b.name,b.changed=null;else c.file=b.name;for(var i in a.docs){var j=a.docs[i];j.changed&&j!=b&&(e.push({type:"full",name:j.name,text:E(a,j)}),j.changed=null)}return{query:c,files:e}}function v(b,c,d){for(var e,f=b.doc,g=null,h=null,i=4,j=c.line-1,k=Math.max(0,j-50);j>=k;--j){var l=f.getLine(j),m=l.search(/\bfunction\b/);if(!(0>m)){var n=a.countColumn(l,null,i);null!=g&&n>=g||(g=n,h=j)}}null==h&&(h=k);var o=Math.min(f.lastLine(),d.line+20);if(null==g||g==a.countColumn(f.getLine(c.line),null,i))e=o;else for(e=d.line+1;o>e;++e){var n=a.countColumn(f.getLine(e),null,i);if(g>=n)break}var p=G(h,0);return{type:"part",name:b.name,offsetLines:p.line,text:f.getRange(p,G(e,0))}}function w(a,b){var c=document.createElement(a);b&&(c.className=b);for(var d=2;d",c):c(prompt(b,""))}function y(b,c){function d(){i=!0,h||e()}function e(){b.state.ternTooltip=null,g.parentNode&&(b.off("cursorActivity",e),b.off("blur",e),b.off("scroll",e),B(g))}b.state.ternTooltip&&A(b.state.ternTooltip);var f=b.cursorCoords(),g=b.state.ternTooltip=z(f.right+1,f.bottom,c),h=!1,i=!1;a.on(g,"mousemove",function(){h=!0}),a.on(g,"mouseout",function(b){a.contains(g,b.relatedTarget||b.toElement)||(i?e():h=!1)}),setTimeout(d,1700),b.on("cursorActivity",e),b.on("blur",e),b.on("scroll",e)}function z(a,b,c){var d=w("div",H+"tooltip",c);return d.style.left=a+"px",d.style.top=b+"px",document.body.appendChild(d),d}function A(a){var b=a&&a.parentNode;b&&b.removeChild(a)}function B(a){a.style.opacity="0",setTimeout(function(){A(a)},1100)}function C(a,b,c){a.options.showError?a.options.showError(b,c):y(b,String(c))}function D(a){a.activeArgHints&&(A(a.activeArgHints),a.activeArgHints=null)}function E(a,b){var c=b.doc.getValue();return a.options.fileFilter&&(c=a.options.fileFilter(c,b.name,b.doc)),c}function F(a){function c(a,b){b&&(a.id=++e,f[e]=b),d.postMessage(a)}var d=a.worker=new Worker(a.options.workerScript);d.postMessage({type:"init",defs:a.options.defs,plugins:a.options.plugins,scripts:a.options.workerDeps});var e=0,f={};d.onmessage=function(d){var e=d.data;"getFile"==e.type?b(a,e.name,function(a,b){c({type:"getFile",err:String(a),text:b,id:e.id})}):"debug"==e.type?window.console.log(e.message):e.id&&f[e.id]&&(f[e.id](e.err,e.body),delete f[e.id])},d.onerror=function(a){for(var b in f)f[b](a);f={}},this.addFile=function(a,b){c({type:"add",name:a,text:b})},this.delFile=function(a){c({type:"del",name:a})},this.request=function(a,b){c({type:"req",body:a},b)}}a.TernServer=function(a){var c=this;this.options=a||{};var d=this.options.plugins||(this.options.plugins={});d.doc_comment||(d.doc_comment=!0),this.options.useWorker?this.server=new F(this):this.server=new tern.Server({getFile:function(a,d){return b(c,a,d)},async:!0,defs:this.options.defs||[],plugins:d}),this.docs=Object.create(null),this.trackChange=function(a,b){e(c,a,b)},this.cachedArgHints=null,this.activeArgHints=null,this.jumpStack=[],this.getHint=function(a,b){return g(c,a,b)},this.getHint.async=!0},a.TernServer.prototype={addDoc:function(b,c){var d={doc:c,name:b,changed:null};return this.server.addFile(b,E(this,d)),a.on(c,"change",this.trackChange),this.docs[b]=d},delDoc:function(b){var c=d(this,b);c&&(a.off(c.doc,"change",this.trackChange),delete this.docs[c.name],this.server.delFile(c.name))},hideDoc:function(a){D(this);var b=d(this,a);b&&b.changed&&f(this,b)},complete:function(a){a.showHint({hint:this.getHint})},showType:function(a,b,c){i(this,a,b,"type",c)},showDocs:function(a,b,c){i(this,a,b,"documentation",c)},updateArgHints:function(a){j(this,a)},jumpToDef:function(a){m(this,a)},jumpBack:function(a){n(this,a)},rename:function(a){r(this,a)},selectName:function(a){s(this,a)},request:function(a,b,d,e){var f=this,g=c(this,a.getDoc()),h=u(this,g,b,e);this.server.request(h,function(a,c){!a&&f.options.responseFilter&&(c=f.options.responseFilter(g,b,h,a,c)),d(a,c)})},destroy:function(){this.worker&&(this.worker.terminate(),this.worker=null)}};var G=a.Pos,H="CodeMirror-Tern-",I=250,J=0,K=a.cmpPos}); \ No newline at end of file diff --git a/media/editors/codemirror/addon/tern/worker.js b/media/editors/codemirror/addon/tern/worker.js index 48277af8e79d8..887f906a44d23 100644 --- a/media/editors/codemirror/addon/tern/worker.js +++ b/media/editors/codemirror/addon/tern/worker.js @@ -39,6 +39,6 @@ function startServer(defs, plugins, scripts) { }); } -var console = { +this.console = { log: function(v) { postMessage({type: "debug", message: v}); } }; diff --git a/media/editors/codemirror/addon/tern/worker.min.js b/media/editors/codemirror/addon/tern/worker.min.js new file mode 100644 index 0000000000000..12d3c4867433d --- /dev/null +++ b/media/editors/codemirror/addon/tern/worker.min.js @@ -0,0 +1 @@ +function getFile(a,b){postMessage({type:"getFile",name:a,id:++nextId}),pending[nextId]=b}function startServer(a,b,c){c&&importScripts.apply(null,c),server=new tern.Server({getFile:getFile,async:!0,defs:a,plugins:b})}var server;this.onmessage=function(a){var b=a.data;switch(b.type){case"init":return startServer(b.defs,b.plugins,b.scripts);case"add":return server.addFile(b.name,b.text);case"del":return server.delFile(b.name);case"req":return server.request(b.body,function(a,c){postMessage({id:b.id,body:c,err:a&&String(a)})});case"getFile":var c=pending[b.id];return delete pending[b.id],c(b.err,b.text);default:throw new Error("Unknown message type: "+b.type)}};var nextId=0,pending={};this.console={log:function(a){postMessage({type:"debug",message:a})}}; \ No newline at end of file diff --git a/media/editors/codemirror/addon/wrap/hardwrap.min.js b/media/editors/codemirror/addon/wrap/hardwrap.min.js new file mode 100644 index 0000000000000..dadc37e392f7a --- /dev/null +++ b/media/editors/codemirror/addon/wrap/hardwrap.min.js @@ -0,0 +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);0==e&&(e=b);var f=e;if(d)for(;" "==a.charAt(f-1);)--f;return{from:f,to:e}}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 a=0;a=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/emacs.min.js b/media/editors/codemirror/keymap/emacs.min.js new file mode 100644 index 0000000000000..90356b950eff3 --- /dev/null +++ b/media/editors/codemirror/keymap/emacs.min.js @@ -0,0 +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){return a.line==b.line&&a.ch==b.ch}function c(a){I.push(a),I.length>50&&I.shift()}function d(a){return I.length?void(I[I.length-1]+=a):c(a)}function e(a){return I[I.length-(a?Math.min(a,1):1)]||""}function f(){return I.length>1&&I.pop(),e()}function g(a,e,f,g,h){null==h&&(h=a.getRange(e,f)),g&&J&&J.cm==a&&b(e,J.pos)&&a.isClean(J.gen)?d(h):c(h),a.replaceRange("",e,f,"+delete"),J=g?{cm:a,pos:e,gen:a.changeGeneration()}:null}function h(a,b,c){return a.findPosH(b,c,"char",!0)}function i(a,b,c){return a.findPosH(b,c,"word",!0)}function j(a,b,c){return a.findPosV(b,c,"line",a.doc.sel.goalColumn)}function k(a,b,c){return a.findPosV(b,c,"page",a.doc.sel.goalColumn)}function l(a,b,c){for(var d=b.line,e=a.getLine(d),f=/\S/.test(0>c?e.slice(0,b.ch):e.slice(b.ch)),g=a.firstLine(),h=a.lastLine();;){if(d+=c,g>d||d>h)return a.clipPos(H(d-c,0>c?0:null));e=a.getLine(d);var i=/\S/.test(e);if(i)f=!0;else if(f)return H(d,0)}}function m(a,b,c){for(var d=b.line,e=b.ch,f=a.getLine(b.line),g=!1;;){var h=f.charAt(e+(0>c?-1:0));if(h){if(g&&/[!?.]/.test(h))return H(d,e+(c>0?1:0));g||(g=/\w/.test(h)),e+=c}else{if(d==(0>c?a.firstLine():a.lastLine()))return H(d,e);if(f=a.getLine(d+c),!/\S/.test(f))return H(d,e);d+=c,e=0>c?f.length:0}}}function n(a,c,d){var e;if(a.findMatchingBracket&&(e=a.findMatchingBracket(c,!0))&&e.match&&(e.forward?1:-1)==d)return d>0?H(e.to.line,e.to.ch+1):e.to;for(var f=!0;;f=!1){var g=a.getTokenAt(c),h=H(c.line,0>d?g.start:g.end);if(!(f&&d>0&&g.end==c.ch)&&/\w/.test(g.string))return h;var i=a.findPosH(h,d,"char");if(b(h,i))return c;c=i}}function o(a,b){var c=a.state.emacsPrefix;return c?(w(a),"-"==c?-1:Number(c)):b?null:1}function p(a){var b="string"==typeof a?function(b){b.execCommand(a)}:a;return function(a){var c=o(a);b(a);for(var d=1;c>d;++d)b(a)}}function q(a,c,d,e){var f=o(a);0>f&&(e=-e,f=-f);for(var g=0;f>g;++g){var h=d(a,c,e);if(b(h,c))break;c=h}return c}function r(a,b){var c=function(c){c.extendSelection(q(c,c.getCursor(),a,b))};return c.motion=!0,c}function s(a,b,c){for(var d,e=a.listSelections(),f=e.length;f--;)d=e[f].head,g(a,d,q(a,d,b,c),!0)}function t(a){if(a.somethingSelected()){for(var b,c=a.listSelections(),d=c.length;d--;)b=c[d],g(a,b.anchor,b.head);return!0}}function u(a,b){return a.state.emacsPrefix?void("-"!=b&&(a.state.emacsPrefix+=b)):(a.state.emacsPrefix=b,a.on("keyHandled",v),void a.on("inputRead",x))}function v(a,b){a.state.emacsPrefixMap||K.hasOwnProperty(b)||w(a)}function w(a){a.state.emacsPrefix=null,a.off("keyHandled",v),a.off("inputRead",x)}function x(a,b){var c=o(a);if(c>1&&"+input"==b.origin){for(var d=b.text.join("\n"),e="",f=1;c>f;++f)e+=d;a.replaceSelection(e)}}function y(a){a.state.emacsPrefixMap=!0,a.addKeyMap(M),a.on("keyHandled",z),a.on("inputRead",z)}function z(a,b){("string"!=typeof b||!/^\d$/.test(b)&&"Ctrl-U"!=b)&&(a.removeKeyMap(M),a.state.emacsPrefixMap=!1,a.off("keyHandled",z),a.off("inputRead",z))}function A(a){a.setCursor(a.getCursor()),a.setExtending(!a.getExtending()),a.on("change",function(){a.setExtending(!1)})}function B(a){a.setExtending(!1),a.setCursor(a.getCursor())}function C(a,b,c){a.openDialog?a.openDialog(b+': ',c,{bottom:!0}):c(prompt(b,""))}function D(a,b){var c=a.getCursor(),d=a.findPosH(c,1,"word");a.replaceRange(b(a.getRange(c,d)),c,d),a.setCursor(d)}function E(a){for(var b=a.getCursor(),c=b.line,d=b.ch,e=[];c>=a.firstLine();){for(var f=a.getLine(c),g=null==d?f.length:d;g>0;){var d=f.charAt(--g);if(")"==d)e.push("(");else if("]"==d)e.push("[");else if("}"==d)e.push("{");else if(/[\(\{\[]/.test(d)&&(!e.length||e.pop()!=d))return a.extendSelection(H(c,g))}--c,d=null}}function F(a){a.execCommand("clearSearch"),B(a)}function G(a){M[a]=function(b){u(b,a)},L["Ctrl-"+a]=function(b){u(b,a)},K["Ctrl-"+a]=!0}for(var H=a.Pos,I=[],J=null,K={"Alt-G":!0,"Ctrl-X":!0,"Ctrl-Q":!0,"Ctrl-U":!0},L=a.keyMap.emacs=a.normalizeKeyMap({"Ctrl-W":function(a){g(a,a.getCursor("start"),a.getCursor("end"))},"Ctrl-K":p(function(a){var b=a.getCursor(),c=a.clipPos(H(b.line)),d=a.getRange(b,c);/\S/.test(d)||(d+="\n",c=H(b.line+1,0)),g(a,b,c,!0,d)}),"Alt-W":function(a){c(a.getSelection()),B(a)},"Ctrl-Y":function(a){var b=a.getCursor();a.replaceRange(e(o(a)),b,b,"paste"),a.setSelection(b,a.getCursor())},"Alt-Y":function(a){a.replaceSelection(f(),"around","paste")},"Ctrl-Space":A,"Ctrl-Shift-2":A,"Ctrl-F":r(h,1),"Ctrl-B":r(h,-1),Right:r(h,1),Left:r(h,-1),"Ctrl-D":function(a){s(a,h,1)},Delete:function(a){t(a)||s(a,h,1)},"Ctrl-H":function(a){s(a,h,-1)},Backspace:function(a){t(a)||s(a,h,-1)},"Alt-F":r(i,1),"Alt-B":r(i,-1),"Alt-D":function(a){s(a,i,1)},"Alt-Backspace":function(a){s(a,i,-1)},"Ctrl-N":r(j,1),"Ctrl-P":r(j,-1),Down:r(j,1),Up:r(j,-1),"Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd",End:"goLineEnd",Home:"goLineStart","Alt-V":r(k,-1),"Ctrl-V":r(k,1),PageUp:r(k,-1),PageDown:r(k,1),"Ctrl-Up":r(l,-1),"Ctrl-Down":r(l,1),"Alt-A":r(m,-1),"Alt-E":r(m,1),"Alt-K":function(a){s(a,m,1)},"Ctrl-Alt-K":function(a){s(a,n,1)},"Ctrl-Alt-Backspace":function(a){s(a,n,-1)},"Ctrl-Alt-F":r(n,1),"Ctrl-Alt-B":r(n,-1),"Shift-Ctrl-Alt-2":function(a){var b=a.getCursor();a.setSelection(q(a,b,n,1),b)},"Ctrl-Alt-T":function(a){var b=n(a,a.getCursor(),-1),c=n(a,b,1),d=n(a,c,1),e=n(a,d,-1);a.replaceRange(a.getRange(e,d)+a.getRange(c,e)+a.getRange(b,c),b,d)},"Ctrl-Alt-U":p(E),"Alt-Space":function(a){for(var b=a.getCursor(),c=b.ch,d=b.ch,e=a.getLine(b.line);c&&/\s/.test(e.charAt(c-1));)--c;for(;d0?a.setCursor(b-1):void C(a,"Goto line",function(b){var c;b&&!isNaN(c=Number(b))&&c==c|0&&c>0&&a.setCursor(c-1)})},"Ctrl-X Tab":function(a){a.indentSelection(o(a,!0)||a.getOption("indentUnit"))},"Ctrl-X Ctrl-X":function(a){a.setSelection(a.getCursor("head"),a.getCursor("anchor"))},"Ctrl-X Ctrl-S":"save","Ctrl-X Ctrl-W":"save","Ctrl-X S":"saveAll","Ctrl-X F":"open","Ctrl-X U":p("undo"),"Ctrl-X K":"close","Ctrl-X Delete":function(a){g(a,a.getCursor(),m(a,a.getCursor(),1),!0)},"Ctrl-X H":"selectAll","Ctrl-Q Tab":p("insertTab"),"Ctrl-U":y}),M={"Ctrl-G":w},N=0;10>N;++N)G(String(N));G("-")}); \ No newline at end of file diff --git a/media/editors/codemirror/keymap/sublime.js b/media/editors/codemirror/keymap/sublime.js index 45936c362892e..441456f58c65b 100644 --- a/media/editors/codemirror/keymap/sublime.js +++ b/media/editors/codemirror/keymap/sublime.js @@ -409,6 +409,19 @@ map[cK + ctrl + "Backspace"] = "delLineLeft"; + cmds[map["Backspace"] = "smartBackspace"] = function(cm) { + if (cm.somethingSelected()) return CodeMirror.Pass; + + var cursor = cm.getCursor(); + var toStartOfLine = cm.getRange({line: cursor.line, ch: 0}, cursor); + var column = CodeMirror.countColumn(toStartOfLine, null, cm.getOption("tabSize")); + + if (toStartOfLine && !/\S/.test(toStartOfLine) && column % cm.getOption("indentUnit") == 0) + return cm.indentSelection("subtract"); + else + return CodeMirror.Pass; + }; + cmds[map[cK + ctrl + "K"] = "delLineRight"] = function(cm) { cm.operation(function() { var ranges = cm.listSelections(); diff --git a/media/editors/codemirror/keymap/sublime.min.js b/media/editors/codemirror/keymap/sublime.min.js new file mode 100644 index 0000000000000..27dc0d1fcdaf2 --- /dev/null +++ b/media/editors/codemirror/keymap/sublime.min.js @@ -0,0 +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(a,b){a.operation(function(){for(var c=a.listSelections().length,d=[],e=-1,f=0;c>f;f++){var g=a.listSelections()[f].head;if(!(g.line<=e)){var h=m(g.line+(b?0:1),0);a.replaceRange("\n",h,null,"+insertLine"),a.indentLine(h.line,null,!0),d.push({head:h,anchor:h}),e=g.line+1}}a.setSelections(d)})}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}),a.replaceRange(k,i,j),c&&d.push({anchor:i,head:j})}c&&a.setSelections(d,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)},l[k[o+"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[o+"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;dd?c.push(h,i):c.length&&(c[c.length-1]=i),d=i}a.operation(function(){for(var b=0;ba.lastLine()?a.replaceRange("\n"+g,m(a.lastLine()),null,"+swapLine"):a.replaceRange(g+"\n",m(f,0),null,"+swapLine")}a.setSelections(e),a.scrollIntoView()})},l[k[q+"Down"]="swapLineDown"]=function(a){for(var b=a.listSelections(),c=[],d=a.lastLine()+1,e=b.length-1;e>=0;e--){var f=b[e],g=f.to().line+1,h=f.from().line;0!=f.to().ch||f.empty()||g--,d>g?c.push(g,h):c.length&&(c[c.length-1]=h),d=h}a.operation(function(){for(var b=c.length-2;b>=0;b-=2){var d=c[b],e=c[b+1],f=a.getLine(d);d==a.lastLine()?a.replaceRange("",m(d-1),m(d),"+swapLine"):a.replaceRange("",m(d,0),m(d+1,0),"+swapLine"),a.replaceRange(f+"\n",m(e,0),null,"+swapLine")}a.scrollIntoView()})},k[o+"/"]="toggleComment",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[r+o+"U"]="upcaseAtCursor"]=function(a){h(a,function(a){return a.toUpperCase()})},l[k[r+o+"L"]="downcaseAtCursor"]=function(a){h(a,function(a){return a.toLowerCase()})},l[k[r+o+"Space"]="setSublimeMark"]=function(a){a.state.sublimeMark&&a.state.sublimeMark.clear(),a.state.sublimeMark=a.setBookmark(a.getCursor())},l[k[r+o+"A"]="selectToSublimeMark"]=function(a){var b=a.state.sublimeMark&&a.state.sublimeMark.find();b&&a.setSelection(a.getCursor(),b)},l[k[r+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[r+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[r+o+"Y"]="sublimeYank"]=function(a){null!=a.state.sublimeKilled&&a.replaceSelection(a.state.sublimeKilled,null,"paste")},k[r+o+"G"]="clearBookmarks",l[k[r+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;c, F, t, T - * $, ^, 0, -, +, _ - * gg, G - * % - * ', ` - * - * Operator: - * d, y, c - * dd, yy, cc - * g~, g~g~ - * >, <, >>, << - * - * Operator-Motion: - * x, X, D, Y, C, ~ - * - * Action: - * a, i, s, A, I, S, o, O - * zz, z., z, zt, zb, z- - * J - * u, Ctrl-r - * m - * r - * - * Modes: - * ESC - leave insert mode, visual mode, and clear input state. - * Ctrl-[, Ctrl-c - same as ESC. + * Supported Ex commands: + * Refer to defaultExCommandMap below. * * Registers: unnamed, -, a-z, A-Z, 0-9 * (Does not respect the special case for number registers when delete * operator is made with these commands: %, (, ), , /, ?, n, N, {, } ) * TODO: Implement the remaining registers. + * * Marks: a-z, A-Z, and 0-9 * TODO: Implement the remaining special marks. They have more complex * behavior. @@ -57,6 +31,7 @@ * 6. Motion, operator, and action implementations * 7. Helper functions for the key handler, motions, operators, and actions * 8. Set up Vim to work as a keymap for CodeMirror. + * 9. Ex command implementations. */ (function(mod) { @@ -227,6 +202,34 @@ { keys: ':', type: 'ex' } ]; + /** + * Ex commands + * Care must be taken when adding to the default Ex command map. For any + * pair of commands that have a shared prefix, at least one of their + * shortNames must not match the prefix of the other command. + */ + var defaultExCommandMap = [ + { 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: true }, + { name: 'nohlsearch', shortName: 'noh' }, + { name: 'delmarks', shortName: 'delm' }, + { name: 'registers', shortName: 'reg', excludeFromCommandHistory: true }, + { name: 'global', shortName: 'g' } + ]; + var Pos = CodeMirror.Pos; var Vim = function() { @@ -336,7 +339,11 @@ } var numberRegex = /[\d]/; - var wordRegexp = [(/\w/), (/[^\w\s]/)], bigWordRegexp = [(/\S/)]; + var wordCharTest = [CodeMirror.isWordChar, function(ch) { + return ch && !CodeMirror.isWordChar(ch) && !/\s/.test(ch); + }], bigWordCharTest = [function(ch) { + return /\S/.test(ch); + }]; function makeKeyRange(start, size) { var keys = []; for (var i = start; i < start + size; i++) { @@ -378,18 +385,30 @@ } var options = {}; - function defineOption(name, defaultValue, type) { - if (defaultValue === undefined) { throw Error('defaultValue is required'); } + function defineOption(name, defaultValue, type, aliases, callback) { + if (defaultValue === undefined && !callback) { + throw Error('defaultValue is required unless callback is provided'); + } if (!type) { type = 'string'; } options[name] = { type: type, - defaultValue: defaultValue + defaultValue: defaultValue, + callback: callback }; - setOption(name, defaultValue); + if (aliases) { + for (var i = 0; i < aliases.length; i++) { + options[aliases[i]] = options[name]; + } + } + if (defaultValue) { + setOption(name, defaultValue); + } } - function setOption(name, value) { + function setOption(name, value, cm, cfg) { var option = options[name]; + cfg = cfg || {}; + var scope = cfg.scope; if (!option) { throw Error('Unknown option: ' + name); } @@ -401,17 +420,60 @@ value = true; } } - option.value = option.type == 'boolean' ? !!value : value; + if (option.callback) { + if (scope !== 'local') { + option.callback(value, undefined); + } + if (scope !== 'global' && cm) { + option.callback(value, cm); + } + } else { + if (scope !== 'local') { + option.value = option.type == 'boolean' ? !!value : value; + } + if (scope !== 'global' && cm) { + cm.state.vim.options[name] = {value: value}; + } + } } - function getOption(name) { + function getOption(name, cm, cfg) { var option = options[name]; + cfg = cfg || {}; + var scope = cfg.scope; if (!option) { throw Error('Unknown option: ' + name); } - return option.value; + if (option.callback) { + var local = cm && option.callback(undefined, cm); + if (scope !== 'global' && local !== undefined) { + return local; + } + if (scope !== 'local') { + return option.callback(); + } + return; + } else { + var local = (scope !== 'global') && (cm && cm.state.vim.options[name]); + return (local || (scope !== 'local') && option || {}).value; + } } + defineOption('filetype', undefined, 'string', ['ft'], function(name, cm) { + // Option is local. Do nothing for global. + if (cm === undefined) { + return; + } + // The 'filetype' option proxies to the CodeMirror 'mode' option. + if (name === undefined) { + var mode = cm.getOption('mode'); + return mode == 'null' ? '' : mode; + } else { + var mode = name == '' ? 'null' : name; + cm.setOption('mode', mode); + } + }); + var createCircularJumpList = function() { var size = 100; var pointer = -1; @@ -564,8 +626,9 @@ visualBlock: false, lastSelection: null, lastPastedText: null, - sel: { - } + sel: {}, + // Buffer-local/window-local values of vim options. + options: {} }; } return cm.state.vim; @@ -623,11 +686,15 @@ // Add user defined key bindings. exCommandDispatcher.map(lhs, rhs, ctx); }, + // TODO: Expose setOption and getOption as instance methods. Need to decide how to namespace + // them, or somehow make them work with the existing CodeMirror setOption/getOption API. setOption: setOption, getOption: getOption, defineOption: defineOption, defineEx: function(name, prefix, func){ - if (name.indexOf(prefix) !== 0) { + if (!prefix) { + prefix = name; + } else if (name.indexOf(prefix) !== 0) { throw new Error('(Vim.defineEx) "'+prefix+'" is not a prefix of "'+name+'", command not registered'); } exCommands[name]=func; @@ -776,7 +843,16 @@ }, handleEx: function(cm, input) { exCommandDispatcher.processCommand(cm, input); - } + }, + + defineMotion: defineMotion, + defineAction: defineAction, + defineOperator: defineOperator, + mapCommand: mapCommand, + _mapCommand: _mapCommand, + + exitVisualMode: exitVisualMode, + exitInsertMode: exitInsertMode }; // Represents the current input state. @@ -1026,12 +1102,10 @@ break; case 'search': this.processSearch(cm, vim, command); - clearInputState(cm); break; case 'ex': case 'keyToEx': this.processEx(cm, vim, command); - clearInputState(cm); break; default: break; @@ -1124,6 +1198,7 @@ updateSearchQuery(cm, query, ignoreCase, smartCase); } catch (e) { showConfirm(cm, 'Invalid regex: ' + query); + clearInputState(cm); return; } commandDispatcher.processMotion(cm, vim, { @@ -1166,15 +1241,21 @@ } function onPromptKeyDown(e, query, close) { var keyName = CodeMirror.keyName(e); - if (keyName == 'Esc' || keyName == 'Ctrl-C' || keyName == 'Ctrl-[') { + if (keyName == 'Esc' || keyName == 'Ctrl-C' || keyName == 'Ctrl-[' || + (keyName == 'Backspace' && query == '')) { vimGlobalState.searchHistoryController.pushInput(query); vimGlobalState.searchHistoryController.reset(); updateSearchQuery(cm, originalQuery); clearSearchHighlight(cm); cm.scrollTo(originalScrollPos.left, originalScrollPos.top); CodeMirror.e_stop(e); + clearInputState(cm); close(); cm.focus(); + } else if (keyName == 'Ctrl-U') { + // Ctrl-U clears input. + CodeMirror.e_stop(e); + close(''); } } switch (command.searchArgs.querySrc) { @@ -1235,10 +1316,12 @@ } function onPromptKeyDown(e, input, close) { var keyName = CodeMirror.keyName(e), up; - if (keyName == 'Esc' || keyName == 'Ctrl-C' || keyName == 'Ctrl-[') { + if (keyName == 'Esc' || keyName == 'Ctrl-C' || keyName == 'Ctrl-[' || + (keyName == 'Backspace' && input == '')) { vimGlobalState.exCommandHistoryController.pushInput(input); vimGlobalState.exCommandHistoryController.reset(); CodeMirror.e_stop(e); + clearInputState(cm); close(); cm.focus(); } @@ -1246,6 +1329,10 @@ up = keyName == 'Up' ? true : false; input = vimGlobalState.exCommandHistoryController.nextMatch(input, up) || ''; close(input); + } else if (keyName == 'Ctrl-U') { + // Ctrl-U clears input. + CodeMirror.e_stop(e); + close(''); } else { if ( keyName != 'Left' && keyName != 'Right' && keyName != 'Ctrl' && keyName != 'Alt' && keyName != 'Shift') vimGlobalState.exCommandHistoryController.reset(); @@ -1275,8 +1362,8 @@ var registerName = inputState.registerName; var sel = vim.sel; // TODO: Make sure cm and vim selections are identical outside visual mode. - var origHead = copyCursor(vim.visualMode ? sel.head: cm.getCursor('head')); - var origAnchor = copyCursor(vim.visualMode ? sel.anchor : cm.getCursor('anchor')); + var origHead = copyCursor(vim.visualMode ? clipCursorToContent(cm, sel.head): cm.getCursor('head')); + var origAnchor = copyCursor(vim.visualMode ? clipCursorToContent(cm, sel.anchor) : cm.getCursor('anchor')); var oldHead = copyCursor(origHead); var oldAnchor = copyCursor(origAnchor); var newHead, newAnchor; @@ -1449,7 +1536,7 @@ var operatorMoveTo = operators[operator]( cm, operatorArgs, cmSel.ranges, oldAnchor, newHead); if (vim.visualMode) { - exitVisualMode(cm); + exitVisualMode(cm, operatorMoveTo != null); } if (operatorMoveTo) { cm.setCursor(operatorMoveTo); @@ -1817,6 +1904,10 @@ } }; + function defineMotion(name, fn) { + motions[name] = fn; + } + function fillArray(val, times) { var arr = []; for (var i = 0; i < times; i++) { @@ -1838,10 +1929,11 @@ var anchor = ranges[0].anchor, head = ranges[0].head; text = cm.getRange(anchor, head); - if (!isWhiteSpaceString(text)) { + var lastState = vim.lastEditInputState || {}; + if (lastState.motion == "moveByWords" && !isWhiteSpaceString(text)) { // Exclude trailing whitespace if the range is not all whitespace. var match = (/\s+$/).exec(text); - if (match) { + if (match && lastState.motionArgs && lastState.motionArgs.forward) { head = offsetCursor(head, 0, - match[0].length); text = text.slice(0, - match[0].length); } @@ -1899,7 +1991,7 @@ vimGlobalState.registerController.pushText( args.registerName, 'delete', text, args.linewise, vim.visualBlock); - return finalHead; + return clipCursorToContent(cm, finalHead); }, indent: function(cm, args, ranges) { var vim = cm.state.vim; @@ -1967,6 +2059,10 @@ } }; + function defineOperator(name, fn) { + operators[name] = fn; + } + var actions = { jumpListWalk: function(cm, actionArgs, vim) { if (vim.visualMode) { @@ -2183,6 +2279,11 @@ if (vim.visualMode) { curStart = cm.getCursor('anchor'); curEnd = cm.getCursor('head'); + if (cursorIsBefore(curEnd, curStart)) { + var tmp = curEnd; + curEnd = curStart; + curStart = tmp; + } curEnd.ch = lineLength(cm, curEnd.line) - 1; } else { // Repeat is the number of lines to join. Minimum 2 lines. @@ -2201,10 +2302,10 @@ cm.replaceRange(text, curStart, tmp); } var curFinalPos = Pos(curStart.line, finalCh); - cm.setCursor(curFinalPos); if (vim.visualMode) { - exitVisualMode(cm); + exitVisualMode(cm, false); } + cm.setCursor(curFinalPos); }, newLineAndEnterInsertMode: function(cm, actionArgs, vim) { vim.insertMode = true; @@ -2367,7 +2468,7 @@ } } if (vim.visualMode) { - exitVisualMode(cm); + exitVisualMode(cm, false); } cm.setCursor(curPosFinal); }, @@ -2425,7 +2526,7 @@ curStart = cursorIsBefore(selections[0].anchor, selections[0].head) ? selections[0].anchor : selections[0].head; cm.setCursor(curStart); - exitVisualMode(cm); + exitVisualMode(cm, false); } else { cm.setCursor(offsetCursor(curEnd, 0, -1)); } @@ -2473,6 +2574,10 @@ exitInsertMode: exitInsertMode }; + function defineAction(name, fn) { + actions[name] = fn; + } + /* * Below are miscellaneous utility functions used by vim.js */ @@ -2602,9 +2707,6 @@ function lineLength(cm, lineNum) { return cm.getLine(lineNum).length; } - function reverse(s){ - return s.split('').reverse().join(''); - } function trim(s) { if (s.trim) { return s.trim(); @@ -2918,59 +3020,38 @@ // Seek to first word or non-whitespace character, depending on if // noSymbol is true. - var textAfterIdx = line.substring(idx); - var firstMatchedChar; - if (noSymbol) { - firstMatchedChar = textAfterIdx.search(/\w/); - } else { - firstMatchedChar = textAfterIdx.search(/\S/); - } - if (firstMatchedChar == -1) { - return null; + var test = noSymbol ? wordCharTest[0] : bigWordCharTest [0]; + while (!test(line.charAt(idx))) { + idx++; + if (idx >= line.length) { return null; } } - idx += firstMatchedChar; - textAfterIdx = line.substring(idx); - var textBeforeIdx = line.substring(0, idx); - var matchRegex; - // Greedy matchers for the "word" we are trying to expand. if (bigWord) { - matchRegex = /^\S+/; + test = bigWordCharTest[0]; } else { - if ((/\w/).test(line.charAt(idx))) { - matchRegex = /^\w+/; - } else { - matchRegex = /^[^\w\s]+/; + test = wordCharTest[0]; + if (!test(line.charAt(idx))) { + test = wordCharTest[1]; } } - var wordAfterRegex = matchRegex.exec(textAfterIdx); - var wordStart = idx; - var wordEnd = idx + wordAfterRegex[0].length; - // TODO: Find a better way to do this. It will be slow on very long lines. - var revTextBeforeIdx = reverse(textBeforeIdx); - var wordBeforeRegex = matchRegex.exec(revTextBeforeIdx); - if (wordBeforeRegex) { - wordStart -= wordBeforeRegex[0].length; - } + var end = idx, start = idx; + while (test(line.charAt(end)) && end < line.length) { end++; } + while (test(line.charAt(start)) && start >= 0) { start--; } + start++; if (inclusive) { - // If present, trim all whitespace after word. - // Otherwise, trim all whitespace before word. - var textAfterWordEnd = line.substring(wordEnd); - var whitespacesAfterWord = textAfterWordEnd.match(/^\s*/)[0].length; - if (whitespacesAfterWord > 0) { - wordEnd += whitespacesAfterWord; - } else { - var revTrim = revTextBeforeIdx.length - wordStart; - var textBeforeWordStart = revTextBeforeIdx.substring(revTrim); - var whitespacesBeforeWord = textBeforeWordStart.match(/^\s*/)[0].length; - wordStart -= whitespacesBeforeWord; + // If present, include all whitespace after word. + // Otherwise, include all whitespace before word, except indentation. + var wordEnd = end; + while (/\s/.test(line.charAt(end)) && end < line.length) { end++; } + if (wordEnd == end) { + var wordStart = start; + while (/\s/.test(line.charAt(start - 1)) && start > 0) { start--; } + if (!start) { start = wordStart; } } } - - return { start: Pos(cur.line, wordStart), - end: Pos(cur.line, wordEnd) }; + return { start: Pos(cur.line, start), end: Pos(cur.line, end) }; } function recordJumpPosition(cm, oldCur, newCur) { @@ -3128,7 +3209,7 @@ var pos = cur.ch; var line = cm.getLine(lineNum); var dir = forward ? 1 : -1; - var regexps = bigWord ? bigWordRegexp : wordRegexp; + var charTests = bigWord ? bigWordCharTest: wordCharTest; if (emptyLineIsWord && line == '') { lineNum += dir; @@ -3148,11 +3229,11 @@ // Find bounds of next word. while (pos != stop) { var foundWord = false; - for (var i = 0; i < regexps.length && !foundWord; ++i) { - if (regexps[i].test(line.charAt(pos))) { + for (var i = 0; i < charTests.length && !foundWord; ++i) { + if (charTests[i](line.charAt(pos))) { wordStart = pos; // Advance to end of word. - while (pos != stop && regexps[i].test(line.charAt(pos))) { + while (pos != stop && charTests[i](line.charAt(pos))) { pos += dir; } wordEnd = pos; @@ -3484,7 +3565,8 @@ function dialog(cm, template, shortText, onClose, options) { if (cm.openDialog) { cm.openDialog(template, onClose, { bottom: true, value: options.value, - onKeyDown: options.onKeyDown, onKeyUp: options.onKeyUp }); + onKeyDown: options.onKeyDown, onKeyUp: options.onKeyUp, + selectValueOnOpen: false}); } else { onClose(prompt(shortText, '')); @@ -3558,13 +3640,17 @@ // Translates the replace part of a search and replace from ex (vim) syntax into // javascript form. Similar to translateRegex, but additionally fixes back references // (translates '\[0..9]' to '$[0..9]') and follows different rules for escaping '$'. + var charUnescapes = {'\\n': '\n', '\\r': '\r', '\\t': '\t'}; function translateRegexReplace(str) { var escapeNextChar = false; var out = []; for (var i = -1; i < str.length; i++) { var c = str.charAt(i) || ''; var n = str.charAt(i+1) || ''; - if (escapeNextChar) { + if (charUnescapes[c + n]) { + out.push(charUnescapes[c+n]); + i++; + } else if (escapeNextChar) { // At any point in the loop, escapeNextChar is true if the previous // character was a '\' and was not escaped. out.push(c); @@ -3592,6 +3678,7 @@ } // Unescape \ and / in the replace part, for PCRE mode. + var unescapes = {'\\/': '/', '\\\\': '\\', '\\n': '\n', '\\r': '\r', '\\t': '\t'}; function unescapeRegexReplace(str) { var stream = new CodeMirror.StringStream(str); var output = []; @@ -3600,13 +3687,15 @@ while (stream.peek() && stream.peek() != '\\') { output.push(stream.next()); } - if (stream.match('\\/', true)) { - // \/ => / - output.push('/'); - } else if (stream.match('\\\\', true)) { - // \\ => \ - output.push('\\'); - } else { + var matched = false; + for (var matcher in unescapes) { + if (stream.match(matcher, true)) { + matched = true; + output.push(unescapes[matcher]); + break; + } + } + if (!matched) { // Don't change anything output.push(stream.next()); } @@ -3836,32 +3925,18 @@ return {top: from.line, bottom: to.line}; } - // Ex command handling - // Care must be taken when adding to the default Ex command map. For any - // pair of commands that have a shared prefix, at least one of their - // shortNames must not match the prefix of the other command. - var defaultExCommandMap = [ - { 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: 'set' }, - { name: 'sort', shortName: 'sor' }, - { name: 'substitute', shortName: 's', possiblyAsync: true }, - { name: 'nohlsearch', shortName: 'noh' }, - { name: 'delmarks', shortName: 'delm' }, - { name: 'registers', shortName: 'reg', excludeFromCommandHistory: true }, - { name: 'global', shortName: 'g' } - ]; var ExCommandDispatcher = function() { this.buildCommandMap_(); }; ExCommandDispatcher.prototype = { processCommand: function(cm, input, opt_params) { + var that = this; + cm.operation(function () { + cm.curOp.isVimOp = true; + that._processCommand(cm, input, opt_params); + }); + }, + _processCommand: function(cm, input, opt_params) { var vim = cm.state.vim; var commandHistoryRegister = vimGlobalState.registerController.getRegister(':'); var previousCommand = commandHistoryRegister.toString(); @@ -4074,6 +4149,13 @@ }; var exCommands = { + colorscheme: function(cm, params) { + if (!params.args || params.args.length < 1) { + showConfirm(cm, cm.getOption('theme')); + return; + } + cm.setOption('theme', params.args[0]); + }, map: function(cm, params, ctx) { var mapArgs = params.args; if (!mapArgs || mapArgs.length < 2) { @@ -4107,6 +4189,9 @@ }, set: function(cm, params) { var setArgs = params.args; + // Options passed through to the setOption/getOption calls. May be passed in by the + // local/global versions of the set command + var setCfg = params.setCfg || {}; if (!setArgs || setArgs.length < 1) { if (cm) { showConfirm(cm, 'Invalid mapping: ' + params.input); @@ -4130,24 +4215,35 @@ optionName = optionName.substring(2); value = false; } + var optionIsBoolean = options[optionName] && options[optionName].type == 'boolean'; if (optionIsBoolean && value == undefined) { // Calling set with a boolean option sets it to true. value = true; } - if (!optionIsBoolean && !value || forceGet) { - var oldValue = getOption(optionName); - // If no value is provided, then we assume this is a get. + // If no value is provided, then we assume this is a get. + if (!optionIsBoolean && value === undefined || forceGet) { + var oldValue = getOption(optionName, cm, setCfg); if (oldValue === true || oldValue === false) { showConfirm(cm, ' ' + (oldValue ? '' : 'no') + optionName); } else { showConfirm(cm, ' ' + optionName + '=' + oldValue); } } else { - setOption(optionName, value); + setOption(optionName, value, cm, setCfg); } }, - registers: function(cm,params) { + setlocal: function (cm, params) { + // setCfg is passed through to setOption + params.setCfg = {scope: 'local'}; + this.set(cm, params); + }, + setglobal: function (cm, params) { + // setCfg is passed through to setOption + params.setCfg = {scope: 'global'}; + this.set(cm, params); + }, + registers: function(cm, params) { var regArgs = params.args; var registers = vimGlobalState.registerController.registers; var regInfo = '----------Registers----------

    '; @@ -4374,6 +4470,9 @@ var query = state.getQuery(); var lineStart = (params.line !== undefined) ? params.line : cm.getCursor().line; var lineEnd = params.lineEnd || lineStart; + if (lineStart == cm.firstLine() && lineEnd == cm.lastLine()) { + lineEnd = Infinity; + } if (count) { lineStart = lineEnd; lineEnd = lineStart + count - 1; @@ -4492,10 +4591,9 @@ searchCursor.replace(newText); } function next() { - var found; // The below only loops to skip over multiple occurrences on the same // line when 'global' is not true. - while(found = searchCursor.findNext() && + while(searchCursor.findNext() && isInRange(searchCursor.from(), lineStart, lineEnd)) { if (!global && lastPos && searchCursor.from().line == lastPos.line) { continue; @@ -4627,6 +4725,19 @@ } } + function _mapCommand(command) { + defaultKeymap.push(command); + } + + function mapCommand(keys, type, name, args, extra) { + var command = {keys: keys, type: type}; + command[type] = name; + command[type + "Args"] = args; + for (var key in extra) + command[key] = extra[key]; + _mapCommand(command); + } + // The timeout in milliseconds for the two-character ESC keymap should be // adjusted according to your typing speed to prevent false positives. defineOption('insertModeEscKeysTimeout', 200, 'number'); @@ -4657,6 +4768,14 @@ function executeMacroRegister(cm, vim, macroModeState, registerName) { var register = vimGlobalState.registerController.getRegister(registerName); + if (registerName == ':') { + // Read-only register containing last Ex command. + if (register.keyBuffer[0]) { + exCommandDispatcher.processCommand(cm, register.keyBuffer[0]); + } + macroModeState.isPlaying = false; + return; + } var keyBuffer = register.keyBuffer; var imc = 0; macroModeState.isPlaying = true; @@ -4756,7 +4875,7 @@ } function updateFakeCursor(cm) { var vim = cm.state.vim; - var from = copyCursor(vim.sel.head); + var from = clipCursorToContent(cm, copyCursor(vim.sel.head)); var to = offsetCursor(from, 0, 1); if (vim.fakeCursor) { vim.fakeCursor.clear(); @@ -4767,7 +4886,7 @@ var anchor = cm.getCursor('anchor'); var head = cm.getCursor('head'); // Enter or exit visual mode to match mouse selection. - if (vim.visualMode && cursorEqual(head, anchor) && lineLength(cm, head.line) > head.ch) { + if (vim.visualMode && !cm.somethingSelected()) { exitVisualMode(cm, false); } else if (!vim.visualMode && !vim.insertMode && cm.somethingSelected()) { vim.visualMode = true; diff --git a/media/editors/codemirror/keymap/vim.min.js b/media/editors/codemirror/keymap/vim.min.js new file mode 100644 index 0000000000000..17b916028432f --- /dev/null +++ b/media/editors/codemirror/keymap/vim.min.js @@ -0,0 +1,3 @@ +!function(a){"object"==typeof exports&&"object"==typeof module?a(require("../lib/codemirror"),require("../addon/search/searchcursor"),require("../addon/dialog/dialog"),require("../addon/edit/matchbrackets.js")):"function"==typeof define&&define.amd?define(["../lib/codemirror","../addon/search/searchcursor","../addon/dialog/dialog","../addon/edit/matchbrackets"],a):a(CodeMirror)}(function(a){"use strict";var b=[{keys:"",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:"xi",context:"visual"},{keys:"S",type:"keyToKey",toKeys:"cc",context:"normal"},{keys:"S",type:"keyToKey",toKeys:"dcc",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:"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:"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",_a),x(b),a.on(b.getInputField(),"paste",k(b))}function f(b){b.setOption("disableInput",!1),b.off("cursorActivity",_a),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("-");/-$/.test(a)&&b.splice(-2,2,"-");var 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(K(a.getCursor(),0,1)),zb.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 ib.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 G(a,b){yb[a]=b}function H(a,b){zb[a]=b}function I(a,b,c){var e=Math.min(Math.max(a.firstLine(),b.line),a.lastLine()),f=W(a,e)-1;f=c?f+1:f;var g=Math.min(Math.max(0,b.ch),f);return d(e,g)}function J(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function K(a,b,c){return"object"==typeof b&&(c=b.ch,b=b.line),d(a.line+b,a.ch+c)}function L(a,b){return{line:b.line-a.line,ch:b.line-a.line}}function M(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 O(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 P(a,b,c){return function(){for(var d=0;c>d;d++)b(a)}}function Q(a){return d(a.line,a.ch)}function R(a,b){return a.ch==b.ch&&a.line==b.line}function S(a,b){return a.line2&&(b=T.apply(void 0,Array.prototype.slice.call(arguments,1))),S(a,b)?a:b}function U(a,b){return arguments.length>2&&(b=U.apply(void 0,Array.prototype.slice.call(arguments,1))),S(a,b)?b:a}function V(a,b,c){var d=S(a,b),e=S(b,c);return d&&e}function W(a,b){return a.getLine(b).length}function X(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function Y(a){return a.replace(/([.?*+$\[\]\/\\(){}|\-])/g,"\\$1")}function Z(a,b,c){var e=W(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=Q(a.clipPos(b)),g=!R(b,f),h=a.getCursor("head"),i=aa(e,h),j=R(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 _(a,b,c){for(var d=[],e=0;c>e;e++){var f=K(b,e,0);d.push({anchor:f,head:f})}a.setSelections(d,0)}function aa(a,b,c){for(var d=0;dj&&(f.line=j),f.ch=W(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 ga(a){var b=a.getCursor("head");return 1==a.getSelection().length&&(b=T(b,a.getCursor("anchor"))),b}function ha(b,c){var d=b.state.vim;c!==!1&&b.setCursor(I(b,d.sel.head)),ca(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 ia(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=W(a,c.line)):c.ch=0}}function ja(a,b,c){b.ch=0,c.ch=0,c.line++}function ka(a){if(!a)return 0;var b=a.search(/\S/);return-1==b?a.length:b}function la(a,b,c,e,f){for(var g=ga(a),h=a.getLine(g.line),i=g.ch,j=f?jb[0]:kb[0];!j(h.charAt(i));)if(i++,i>=h.length)return null;e?j=kb[0]:(j=jb[0],j(h.charAt(i))||(j=jb[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 ma(a,b,c){R(b,c)||tb.jumpList.add(a,b,c)}function na(a,b){tb.lastChararacterSearch.increment=a,tb.lastChararacterSearch.forward=b.forward,tb.lastChararacterSearch.selectedCharacter=b.selectedCharacter}function oa(a,b,c,e){var f=Q(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=Ab[e];if(!m)return f;var n=Bb[m].init,o=Bb[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 pa(a,b,c,d,e){var f=b.line,g=b.ch,h=a.getLine(f),i=c?1:-1,j=d?kb:jb;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}throw new Error("The impossible happened.")}function qa(a,b,c,e,f,g){var h=Q(b),i=[];(e&&!f||!e&&f)&&c++;for(var j=!(e&&f),k=0;c>k;k++){var l=pa(a,b,e,g,j);if(!l){var m=W(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 ra(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=ua(h,j,e,c,!0),-1==f)return null;h=f}return d(a.getCursor().line,f)}function sa(a,b){var c=a.getCursor().line;return I(a,d(c,b-1))}function ta(a,b,c,d){s(c,ob)&&(b.marks[c]&&b.marks[c].clear(),b.marks[c]=a.setBookmark(d))}function ua(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 va(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 wa(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 xa(a,b,c,e){var f,g,h,i,j=Q(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 ya(){}function za(a){var b=a.state.vim;return b.searchState_||(b.searchState_=new ya)}function Aa(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 Ba(a){var b=Ca(a)||[];if(!b.length)return[];var c=[];if(0===b[0]){for(var d=0;d'+b+"
    ",{bottom:!0,duration:5e3}):alert(b)}function Ia(a,b){var c="";return a&&(c+=''+a+""),c+=' ',b&&(c+='',c+=b,c+=""),c}function Ja(a,b){var c=(b.prefix||"")+" "+(b.desc||""),d=Ia(b.prefix,b.desc);Aa(a,d,c,b.onClose,b)}function Ka(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&&R(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 Pa(a){var b=za(a);a.removeOverlay(za(a).getOverlay()),b.setOverlay(null),b.getScrollbarAnnotate()&&(b.getScrollbarAnnotate().clear(),b.setScrollbarAnnotate(null))}function Qa(a,b,c){return"number"!=typeof a&&(a=a.line),b instanceof Array?s(a,b):c?a>=b&&c>=a:a==b}function Ra(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 Sa(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()&&Qa(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 Ha(b,"No matches for "+h.source):c?void Ja(b,{prefix:"replace with "+i+" (y/n/a/q/l)",onKeyDown:o}):(k(),void(j&&j()))}function Ta(b){var c=b.state.vim,d=tb.macroModeState,e=tb.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&&(eb(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&&Ya(d)}function Ua(a){b.push(a)}function Va(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];Ua(f)}function Wa(b,c,d,e){var f=tb.registerController.getRegister(e);if(":"==e)return f.keyBuffer[0]&&Hb.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;tb.macroModeState.lastInsertModeChanges.changes=m,fb(b,m,1),Ta(b)}d.isPlaying=!1}function Xa(a,b){if(!a.isPlaying){var c=a.latestRegister,d=tb.registerController.getRegister(c);d&&d.pushText(b)}}function Ya(a){if(!a.isPlaying){ +var b=a.latestRegister,c=tb.registerController.getRegister(b);c&&c.pushInsertModeChanges(a.lastInsertModeChanges)}}function Za(a,b){if(!a.isPlaying){var c=a.latestRegister,d=tb.registerController.getRegister(c);d&&d.pushSearchQuery(b)}}function $a(a,b){var c=tb.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 _a(a){var b=a.state.vim;if(b.insertMode){var c=tb.macroModeState;if(c.isPlaying)return;var d=c.lastInsertModeChanges;d.expectCursorActivityForChange?d.expectCursorActivityForChange=!1:d.changes=[]}else a.curOp.isVimOp||bb(a,b);b.visualMode&&ab(a)}function ab(a){var b=a.state.vim,c=I(a,Q(b.sel.head)),d=K(c,0,1);b.fakeCursor&&b.fakeCursor.clear(),b.fakeCursor=a.markText(c,d,{className:"cm-animate-fat-cursor"})}function bb(b,c){var d=b.getCursor("anchor"),e=b.getCursor("head");if(c.visualMode&&!b.somethingSelected()?ha(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=S(e,d)?0:-1,g=S(e,d)?-1:0;e=K(e,0,f),d=K(d,0,g),c.sel={anchor:d,head:e},ta(b,c,"<",T(e,d)),ta(b,c,">",U(e,d))}else c.insertMode||(c.lastHPos=b.getCursor().ch)}function cb(a){this.keyName=a}function db(b){function c(){return e.changes.push(new cb(f)),!0}var d=tb.macroModeState,e=d.lastInsertModeChanges,f=a.keyName(b);f&&(-1!=f.indexOf("Delete")||-1!=f.indexOf("Backspace"))&&a.lookupKey(f,"vim-insert",c)}function eb(a,b,c,d){function e(){h?wb.processAction(a,b,b.lastEditActionCommand):wb.evalInput(a,b)}function f(c){if(g.lastInsertModeChanges.changes.length>0){c=b.lastEditActionCommand?c:1;var d=g.lastInsertModeChanges;fb(a,d.changes,c)}}var g=tb.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&&Ta(a),g.isPlaying=!1}function fb(b,c,d){function e(c){return"string"==typeof c?a.commands[c](b):c(b),!0}var f=b.getCursor("head"),g=tb.macroModeState.lastInsertModeChanges.inVisualBlock;if(g){var h=b.state.vim,i=h.lastSelection,j=L(i.anchor,i.head);_(b,f,j.line+1),d=b.listSelections().length,b.setCursor(f)}for(var k=0;d>k;k++){g&&b.setCursor(K(f,k,0));for(var l=0;l"]),pb=[].concat(lb,mb,nb,["-",'"',".",":","/"]),qb={};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 rb=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&&!R(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())&&!R(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}},sb=function(a){return a?{changes:a.changes,expectCursorActivityForChange:a.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};w.prototype={exitMacroRecordMode:function(){var a=tb.macroModeState;a.onRecordingDone&&a.onRecordingDone(),a.onRecordingDone=void 0,a.isRecording=!1},enterMacroRecordMode:function(a,b){var c=tb.registerController.getRegister(b);c&&(c.clear(),this.latestRegister=b,a.openDialog&&(this.onRecordingDone=a.openDialog("(recording)["+b+"]",null,{bottom:!0})),this.isRecording=!0)}};var tb,ub,vb={buildKeyMap:function(){},getRegisterController:function(){return tb.registerController},resetVimGlobalState_:y,getVimGlobalState_:function(){return tb},maybeInitVimState_:x,suppressErrorLogging:!1,InsertModeKey:cb,map:function(a,b,c){Hb.map(a,b,c)},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;Gb[a]=c,Hb.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=tb.macroModeState;if(a.isRecording){if("q"==d)return a.exitMacroRecordMode(),A(c),!0;"mapping"!=e&&Xa(a,d)}}function g(){return""==d?(A(c),l.visualMode?ha(c):l.insertMode&&Ta(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=wb.matchCommand(a,b,l.inputState,"insert");a.length>1&&"full"!=f.type;){var a=l.inputState.keyBuffer=a.slice(1),h=wb.matchCommand(a,b,l.inputState,"insert");"none"!=h.type&&(f=h)}if("none"==f.type)return A(c),!1;if("partial"==f.type)return ub&&window.clearTimeout(ub),ub=window.setTimeout(function(){l.insertMode&&l.inputState.keyBuffer&&A(c)},v("insertModeEscKeysTimeout")),!e;if(ub&&window.clearTimeout(ub),e){var i=c.getCursor();c.replaceRange("",K(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=wb.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):wb.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){Hb.processCommand(a,b)},defineMotion:E,defineAction:H,defineOperator:G,mapCommand:Va,_mapCommand:Ua,exitVisualMode:ha,exitInsertMode:Ta};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(sb(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("")}},C.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,pb)},shiftNumericRegisters_:function(){for(var a=9;a>=2;a--)this.registers[a]=this.getRegister(""+(a-1))}},D.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 wb={matchCommand:function(a,b,c,d){var e=M(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=O(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=J(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=J(c.operatorArgs),b.visualMode&&this.evalInput(a,b)},processOperatorMotion:function(a,b,c){var d=b.visualMode,e=J(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=J(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),zb[c.action](a,g,b)},processSearch:function(b,c,d){function e(a,e,f){tb.searchHistoryController.pushInput(a),tb.searchHistoryController.reset();try{La(b,a,e,f)}catch(g){return Ha(b,"Invalid regex: "+a),void A(b)}wb.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=tb.macroModeState;c.isRecording&&Za(c,a)}function g(c,d,e){var f,g=a.keyName(c);"Up"==g||"Down"==g?(f="Up"==g?!0:!1,d=tb.searchHistoryController.nextMatch(d,f)||"",e(d)):"Left"!=g&&"Right"!=g&&"Ctrl"!=g&&"Alt"!=g&&"Shift"!=g&&tb.searchHistoryController.reset();var h;try{h=La(b,d,!0,!0)}catch(c){}h?b.scrollIntoView(Oa(b,!i,h),30):(Pa(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?(tb.searchHistoryController.pushInput(d),tb.searchHistoryController.reset(),La(b,l),Pa(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;za(b).setReversed(!i);var k=i?"/":"?",l=za(b).getQuery(),m=b.getScrollInfo();switch(d.searchArgs.querySrc){case"prompt":var n=tb.macroModeState;if(n.isPlaying){var o=n.replaySearchQueries.shift();e(o,!0,!1)}else Ja(b,{onClose:f,prefix:k,desc:Eb,onKeyUp:g,onKeyDown:h});break;case"wordUnderCursor":var p=la(b,!1,!0,!1,!0),q=!0;if(p||(p=la(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":Y(o),tb.jumpList.cachedCursor=b.getCursor(),b.setCursor(p.start),e(o,!0,!1)}}},processEx:function(b,c,d){function e(a){tb.exCommandHistoryController.pushInput(a),tb.exCommandHistoryController.reset(),Hb.processCommand(b,a)}function f(c,d,e){var f,g=a.keyName(c);("Esc"==g||"Ctrl-C"==g||"Ctrl-["==g||"Backspace"==g&&""==d)&&(tb.exCommandHistoryController.pushInput(d),tb.exCommandHistoryController.reset(),a.e_stop(c),A(b),e(),b.focus()),"Up"==g||"Down"==g?(f="Up"==g?!0:!1,d=tb.exCommandHistoryController.nextMatch(d,f)||"",e(d)):"Ctrl-U"==g?(a.e_stop(c),e("")):"Left"!=g&&"Right"!=g&&"Ctrl"!=g&&"Alt"!=g&&"Shift"!=g&&tb.exCommandHistoryController.reset()}"keyToEx"==d.type?Hb.processCommand(b,d.exArgs.input):c.visualMode?Ja(b,{onClose:e,prefix:":",value:"'<,'>",onKeyDown:f}):Ja(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=Q(b.visualMode?I(a,m.head):a.getCursor("head")),o=Q(b.visualMode?I(a,m.anchor):a.getCursor("anchor")),p=Q(n),q=Q(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=xb[h](a,n,i,b);if(b.lastMotion=xb[h],!r)return;if(i.toJumplist){var s=tb.jumpList,t=s.cachedCursor;t?(ma(a,t,r),delete s.cachedCursor):ma(a,n,r)}r instanceof Array?(e=r[0],c=r[1]):c=r,c||(c=Q(n)),b.visualMode?(b.visualBlock&&c.ch===1/0||(c=I(a,c,b.visualBlock)),e&&(e=I(a,e,!0)),e=e||q,m.anchor=e,m.head=c,ea(a),ta(a,b,"<",S(e,c)?e:c),ta(a,b,">",S(e,c)?c:e)):j||(c=I(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},ea(a)}else b.visualMode&&(k.lastSel={anchor:Q(m.anchor),head:Q(m.head),visualBlock:b.visualBlock,visualLine:b.visualLine});var x,y,z,B,C;if(b.visualMode){if(x=T(m.head,m.anchor),y=U(m.head,m.anchor),z=b.visualLine||k.linewise,B=b.visualBlock?"block":z?"line":"char",C=fa(a,{anchor:x,head:y},B),z){var D=C.ranges;if("block"==B)for(var E=0;Ei&&f.line==j||i>k&&f.line==k?void 0:(c.toFirstChar&&(g=ka(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 va(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=xb.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 qa(a,b,c.repeat,!!c.forward,!!c.wordEnd,!!c.bigWord)},moveTillCharacter:function(a,b,c){var d=c.repeat,e=ra(a,d,c.forward,c.selectedCharacter),f=c.forward?-1:1;return na(f,c),e?(e.ch+=f,e):null},moveToCharacter:function(a,b,c){var d=c.repeat;return na(0,c),ra(a,d,c.forward,c.selectedCharacter)||b},moveToSymbol:function(a,b,c){var d=c.repeat;return oa(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,sa(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,ka(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,ka(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=wa(a,b,g,i);else if(f[g])h=xa(a,b,g,i);else if("W"===g)h=la(a,i,!0,!0);else if("w"===g)h=la(a,i,!0,!1);else{if("p"!==g)return null;if(h=va(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?da(a,h.start,h.end):[h.start,h.end]},repeatLastCharacterSearch:function(a,b,c){var d=tb.lastChararacterSearch,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=ra(a,e,f,d.selectedCharacter);return h?(h.ch+=g,h):(a.moveH(g,"char"),b)}},yb={change:function(b,c,d){var e,f,g=b.state.vim;if(tb.macroModeState.lastInsertModeChanges.inVisualBlock=g.visualBlock,g.visualMode){f=b.getSelection();var h=F("",d.length);b.replaceSelections(h),e=T(d[0].head,d[0].anchor)}else{var i=d[0].anchor,j=d[0].head;f=b.getRange(i,j);var k=g.lastEditInputState||{};if("moveByWords"==k.motion&&!r(f)){var l=/\s+$/.exec(f);l&&k.motionArgs&&k.motionArgs.forward&&(j=K(j,0,-l[0].length),f=f.slice(0,-l[0].length))}var m=j.line-1==b.lastLine();b.replaceRange("",i,j),c.linewise&&!m&&(a.commands.newlineAndIndent(b),i.ch=null),e=i}tb.registerController.pushText(c.registerName,"change",f,c.linewise,d.length>1),zb.enterInsertMode(b,{head:e},b.state.vim)},"delete":function(a,b,c){var e,f,g=a.state.vim;if(g.visualBlock){f=a.getSelection();var h=F("",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,W(a,i.line-1))),f=a.getRange(i,j),a.replaceRange("",i,j),e=i,b.linewise&&(e=xb.moveToFirstNonWhiteSpaceCharacter(a,i))}return tb.registerController.pushText(b.registerName,"delete",f,b.linewise,g.visualBlock),I(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 xb.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?K(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"})),tb.macroModeState.isPlaying||(b.on("change",$a),a.on(b.getInputField(),"keydown",db)),e.visualMode&&ha(b),_(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":""}),ea(b)):ha(b):(e.visualMode=!0,e.visualLine=!!c.linewise,e.visualBlock=!!c.blockwise,f=I(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":""}),ea(b),ta(b,e,"<",T(h,f)),ta(b,e,">",U(h,f)))},reselectLastSelection:function(b,c,d){var e=d.lastSelection;if(d.visualMode&&ca(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,ea(b),ta(b,d,"<",T(f,g)),ta(b,d,">",U(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"),S(f,e)){var g=f;f=e,e=g}f.ch=W(a,f.line)-1}else{var h=Math.max(b.repeat,2);e=a.getCursor(),f=I(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=W(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=W(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=S(j[0].anchor,j[0].head)?j[0].anchor:j[0].head,b.setCursor(i),ha(b,!1)):b.setCursor(K(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"),ya.prototype={getQuery:function(){return tb.query},setQuery:function(a){tb.query=a},getOverlay:function(){return this.searchOverlay},setOverlay:function(a){this.searchOverlay=a},isReversed:function(){return tb.isReversed},setReversed:function(a){tb.isReversed=a},getScrollbarAnnotate:function(){return this.annotate},setScrollbarAnnotate:function(a){this.annotate=a}};var Cb={"\\n":"\n","\\r":"\r","\\t":" "},Db={"\\/":"/","\\\\":"\\","\\n":"\n","\\r":"\r","\\t":" "},Eb="(Javascript regexp)",Fb=function(){this.buildCommandMap_()};Fb.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=tb.registerController.getRegister(":"),g=f.toString();e.visualMode&&ha(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 Ha(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+"
    ")}Ha(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"}b.eatSpace()&&b.match(/\/.*\//)}}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 Ha(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,W(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 Ha(a,l);var o=0,p=function(){if(o=k)return void Ha(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]}}},Hb=new Fb;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(),vb};a.Vim=e()}); \ No newline at end of file diff --git a/media/editors/codemirror/lib/addons-uncompressed.js b/media/editors/codemirror/lib/addons-uncompressed.js deleted file mode 100644 index d0874e1fb1561..0000000000000 --- a/media/editors/codemirror/lib/addons-uncompressed.js +++ /dev/null @@ -1,6549 +0,0 @@ -/** - * addon/display/fullscreen.js - * addon/display/panel.js - * addon/edit/closebrackets.js - * addon/edit/closetag.js - * addon/edit/matchbrackets.js - * addon/edit/matchtags.js - * addon/fold/brace-fold.js - * addon/fold/foldcode.js - * addon/fold/foldgutter.js - * addon/fold/xml-fold.js - * addon/mode/loadmode.js - * addon/mode/multiplex.js - * addon/scroll/simplescrollbars.js - * addon/selection/active-line.js - * keymap/vim.js -**/ -// CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: http://codemirror.net/LICENSE - -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { - "use strict"; - - CodeMirror.defineOption("fullScreen", false, function(cm, val, old) { - if (old == CodeMirror.Init) old = false; - if (!old == !val) return; - if (val) setFullscreen(cm); - else setNormal(cm); - }); - - function setFullscreen(cm) { - var wrap = cm.getWrapperElement(); - cm.state.fullScreenRestore = {scrollTop: window.pageYOffset, scrollLeft: window.pageXOffset, - width: wrap.style.width, height: wrap.style.height}; - wrap.style.width = ""; - wrap.style.height = "auto"; - wrap.className += " CodeMirror-fullscreen"; - document.documentElement.style.overflow = "hidden"; - cm.refresh(); - } - - function setNormal(cm) { - var wrap = cm.getWrapperElement(); - wrap.className = wrap.className.replace(/\s*CodeMirror-fullscreen\b/, ""); - document.documentElement.style.overflow = ""; - var info = cm.state.fullScreenRestore; - wrap.style.width = info.width; wrap.style.height = info.height; - window.scrollTo(info.scrollLeft, info.scrollTop); - cm.refresh(); - } -}); -// CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: http://codemirror.net/LICENSE - -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { - CodeMirror.defineExtension("addPanel", function(node, options) { - if (!this.state.panels) initPanels(this); - - var info = this.state.panels; - if (options && options.position == "bottom") - info.wrapper.appendChild(node); - else - info.wrapper.insertBefore(node, info.wrapper.firstChild); - var height = (options && options.height) || node.offsetHeight; - this._setSize(null, info.heightLeft -= height); - info.panels++; - return new Panel(this, node, options, height); - }); - - function Panel(cm, node, options, height) { - this.cm = cm; - this.node = node; - this.options = options; - this.height = height; - this.cleared = false; - } - - Panel.prototype.clear = function() { - if (this.cleared) return; - this.cleared = true; - var info = this.cm.state.panels; - this.cm._setSize(null, info.heightLeft += this.height); - info.wrapper.removeChild(this.node); - if (--info.panels == 0) removePanels(this.cm); - }; - - Panel.prototype.changed = function(height) { - var newHeight = height == null ? this.node.offsetHeight : height; - var info = this.cm.state.panels; - this.cm._setSize(null, info.height += (newHeight - this.height)); - this.height = newHeight; - }; - - function initPanels(cm) { - var wrap = cm.getWrapperElement(); - var style = window.getComputedStyle ? window.getComputedStyle(wrap) : wrap.currentStyle; - var height = parseInt(style.height); - var info = cm.state.panels = { - setHeight: wrap.style.height, - heightLeft: height, - panels: 0, - wrapper: document.createElement("div") - }; - wrap.parentNode.insertBefore(info.wrapper, wrap); - var hasFocus = cm.hasFocus(); - info.wrapper.appendChild(wrap); - if (hasFocus) cm.focus(); - - cm._setSize = cm.setSize; - if (height != null) cm.setSize = function(width, newHeight) { - if (newHeight == null) return this._setSize(width, newHeight); - info.setHeight = newHeight; - if (typeof newHeight != "number") { - var px = /^(\d+\.?\d*)px$/.exec(newHeight); - if (px) { - newHeight = Number(px[1]); - } else { - info.wrapper.style.height = newHeight; - newHeight = info.wrapper.offsetHeight; - info.wrapper.style.height = ""; - } - } - cm._setSize(width, info.heightLeft += (newHeight - height)); - height = newHeight; - }; - } - - function removePanels(cm) { - var info = cm.state.panels; - cm.state.panels = null; - - var wrap = cm.getWrapperElement(); - info.wrapper.parentNode.replaceChild(wrap, info.wrapper); - wrap.style.height = info.setHeight; - cm.setSize = cm._setSize; - cm.setSize(); - } -}); -// CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: http://codemirror.net/LICENSE - -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { - var DEFAULT_BRACKETS = "()[]{}''\"\""; - var DEFAULT_EXPLODE_ON_ENTER = "[]{}"; - var SPACE_CHAR_REGEX = /\s/; - - var Pos = CodeMirror.Pos; - - CodeMirror.defineOption("autoCloseBrackets", false, function(cm, val, old) { - if (old != CodeMirror.Init && old) - cm.removeKeyMap("autoCloseBrackets"); - if (!val) return; - var pairs = DEFAULT_BRACKETS, explode = DEFAULT_EXPLODE_ON_ENTER; - if (typeof val == "string") pairs = val; - else if (typeof val == "object") { - if (val.pairs != null) pairs = val.pairs; - if (val.explode != null) explode = val.explode; - } - var map = buildKeymap(pairs); - if (explode) map.Enter = buildExplodeHandler(explode); - cm.addKeyMap(map); - }); - - function charsAround(cm, pos) { - var str = cm.getRange(Pos(pos.line, pos.ch - 1), - Pos(pos.line, pos.ch + 1)); - return str.length == 2 ? str : null; - } - - // Project the token type that will exists after the given char is - // typed, and use it to determine whether it would cause the start - // of a string token. - function enteringString(cm, pos, ch) { - var line = cm.getLine(pos.line); - var token = cm.getTokenAt(pos); - if (/\bstring2?\b/.test(token.type)) return false; - var stream = new CodeMirror.StringStream(line.slice(0, pos.ch) + ch + line.slice(pos.ch), 4); - stream.pos = stream.start = token.start; - for (;;) { - var type1 = cm.getMode().token(stream, token.state); - if (stream.pos >= pos.ch + 1) return /\bstring2?\b/.test(type1); - stream.start = stream.pos; - } - } - - function buildKeymap(pairs) { - var map = { - name : "autoCloseBrackets", - Backspace: function(cm) { - if (cm.getOption("disableInput")) return CodeMirror.Pass; - var ranges = cm.listSelections(); - for (var i = 0; i < ranges.length; i++) { - if (!ranges[i].empty()) return CodeMirror.Pass; - var around = charsAround(cm, ranges[i].head); - if (!around || pairs.indexOf(around) % 2 != 0) return CodeMirror.Pass; - } - for (var i = ranges.length - 1; i >= 0; i--) { - var cur = ranges[i].head; - cm.replaceRange("", Pos(cur.line, cur.ch - 1), Pos(cur.line, cur.ch + 1)); - } - } - }; - var closingBrackets = ""; - for (var i = 0; i < pairs.length; i += 2) (function(left, right) { - closingBrackets += right; - map["'" + left + "'"] = function(cm) { - if (cm.getOption("disableInput")) return CodeMirror.Pass; - var ranges = cm.listSelections(), type, next; - for (var i = 0; i < ranges.length; i++) { - var range = ranges[i], cur = range.head, curType; - var next = cm.getRange(cur, Pos(cur.line, cur.ch + 1)); - if (!range.empty()) { - curType = "surround"; - } else if (left == right && next == right) { - if (cm.getRange(cur, Pos(cur.line, cur.ch + 3)) == left + left + left) - curType = "skipThree"; - else - curType = "skip"; - } else if (left == right && cur.ch > 1 && - cm.getRange(Pos(cur.line, cur.ch - 2), cur) == left + left && - (cur.ch <= 2 || cm.getRange(Pos(cur.line, cur.ch - 3), Pos(cur.line, cur.ch - 2)) != left)) { - curType = "addFour"; - } else if (left == '"' || left == "'") { - if (!CodeMirror.isWordChar(next) && enteringString(cm, cur, left)) curType = "both"; - else return CodeMirror.Pass; - } else if (cm.getLine(cur.line).length == cur.ch || closingBrackets.indexOf(next) >= 0 || SPACE_CHAR_REGEX.test(next)) { - curType = "both"; - } else { - return CodeMirror.Pass; - } - if (!type) type = curType; - else if (type != curType) return CodeMirror.Pass; - } - - cm.operation(function() { - if (type == "skip") { - cm.execCommand("goCharRight"); - } else if (type == "skipThree") { - for (var i = 0; i < 3; i++) - cm.execCommand("goCharRight"); - } else if (type == "surround") { - var sels = cm.getSelections(); - for (var i = 0; i < sels.length; i++) - sels[i] = left + sels[i] + right; - cm.replaceSelections(sels, "around"); - } else if (type == "both") { - cm.replaceSelection(left + right, null); - cm.execCommand("goCharLeft"); - } else if (type == "addFour") { - cm.replaceSelection(left + left + left + left, "before"); - cm.execCommand("goCharRight"); - } - }); - }; - if (left != right) map["'" + right + "'"] = function(cm) { - var ranges = cm.listSelections(); - for (var i = 0; i < ranges.length; i++) { - var range = ranges[i]; - if (!range.empty() || - cm.getRange(range.head, Pos(range.head.line, range.head.ch + 1)) != right) - return CodeMirror.Pass; - } - cm.execCommand("goCharRight"); - }; - })(pairs.charAt(i), pairs.charAt(i + 1)); - return map; - } - - function buildExplodeHandler(pairs) { - return function(cm) { - if (cm.getOption("disableInput")) return CodeMirror.Pass; - var ranges = cm.listSelections(); - for (var i = 0; i < ranges.length; i++) { - if (!ranges[i].empty()) return CodeMirror.Pass; - var around = charsAround(cm, ranges[i].head); - if (!around || pairs.indexOf(around) % 2 != 0) return CodeMirror.Pass; - } - cm.operation(function() { - cm.replaceSelection("\n\n", null); - cm.execCommand("goCharLeft"); - ranges = cm.listSelections(); - for (var i = 0; i < ranges.length; i++) { - var line = ranges[i].head.line; - cm.indentLine(line, null, true); - cm.indentLine(line + 1, null, true); - } - }); - }; - } -}); -// CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: http://codemirror.net/LICENSE - -/** - * Tag-closer extension for CodeMirror. - * - * This extension adds an "autoCloseTags" option that can be set to - * either true to get the default behavior, or an object to further - * configure its behavior. - * - * These are supported options: - * - * `whenClosing` (default true) - * Whether to autoclose when the '/' of a closing tag is typed. - * `whenOpening` (default true) - * Whether to autoclose the tag when the final '>' of an opening - * tag is typed. - * `dontCloseTags` (default is empty tags for HTML, none for XML) - * An array of tag names that should not be autoclosed. - * `indentTags` (default is block tags for HTML, none for XML) - * An array of tag names that should, when opened, cause a - * blank line to be added inside the tag, and the blank line and - * closing line to be indented. - * - * See demos/closetag.html for a usage example. - */ - -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror"), require("../fold/xml-fold")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror", "../fold/xml-fold"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { - CodeMirror.defineOption("autoCloseTags", false, function(cm, val, old) { - if (old != CodeMirror.Init && old) - cm.removeKeyMap("autoCloseTags"); - if (!val) return; - var map = {name: "autoCloseTags"}; - if (typeof val != "object" || val.whenClosing) - map["'/'"] = function(cm) { return autoCloseSlash(cm); }; - if (typeof val != "object" || val.whenOpening) - map["'>'"] = function(cm) { return autoCloseGT(cm); }; - cm.addKeyMap(map); - }); - - var htmlDontClose = ["area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", - "source", "track", "wbr"]; - var htmlIndent = ["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"]; - - function autoCloseGT(cm) { - if (cm.getOption("disableInput")) return CodeMirror.Pass; - var ranges = cm.listSelections(), replacements = []; - for (var i = 0; i < ranges.length; i++) { - if (!ranges[i].empty()) return CodeMirror.Pass; - var pos = ranges[i].head, tok = cm.getTokenAt(pos); - var inner = CodeMirror.innerMode(cm.getMode(), tok.state), state = inner.state; - if (inner.mode.name != "xml" || !state.tagName) return CodeMirror.Pass; - - var opt = cm.getOption("autoCloseTags"), html = inner.mode.configuration == "html"; - var dontCloseTags = (typeof opt == "object" && opt.dontCloseTags) || (html && htmlDontClose); - var indentTags = (typeof opt == "object" && opt.indentTags) || (html && htmlIndent); - - var tagName = state.tagName; - if (tok.end > pos.ch) tagName = tagName.slice(0, tagName.length - tok.end + pos.ch); - var lowerTagName = tagName.toLowerCase(); - // Don't process the '>' at the end of an end-tag or self-closing tag - if (!tagName || - tok.type == "string" && (tok.end != pos.ch || !/[\"\']/.test(tok.string.charAt(tok.string.length - 1)) || tok.string.length == 1) || - tok.type == "tag" && state.type == "closeTag" || - tok.string.indexOf("/") == (tok.string.length - 1) || // match something like - dontCloseTags && indexOf(dontCloseTags, lowerTagName) > -1 || - closingTagExists(cm, tagName, pos, state, true)) - return CodeMirror.Pass; - - var indent = indentTags && indexOf(indentTags, lowerTagName) > -1; - replacements[i] = {indent: indent, - text: ">" + (indent ? "\n\n" : "") + "", - newPos: indent ? CodeMirror.Pos(pos.line + 1, 0) : CodeMirror.Pos(pos.line, pos.ch + 1)}; - } - - for (var i = ranges.length - 1; i >= 0; i--) { - var info = replacements[i]; - cm.replaceRange(info.text, ranges[i].head, ranges[i].anchor, "+insert"); - var sel = cm.listSelections().slice(0); - sel[i] = {head: info.newPos, anchor: info.newPos}; - cm.setSelections(sel); - if (info.indent) { - cm.indentLine(info.newPos.line, null, true); - cm.indentLine(info.newPos.line + 1, null, true); - } - } - } - - function autoCloseCurrent(cm, typingSlash) { - var ranges = cm.listSelections(), replacements = []; - var head = typingSlash ? "/" : ""; - else if (cm.getMode().name == "htmlmixed" && inner.mode.name == "css") - replacements[i] = head + "style>"; - else - return CodeMirror.Pass; - } else { - if (!state.context || !state.context.tagName || - closingTagExists(cm, state.context.tagName, pos, state)) - return CodeMirror.Pass; - replacements[i] = head + state.context.tagName + ">"; - } - } - cm.replaceSelections(replacements); - ranges = cm.listSelections(); - for (var i = 0; i < ranges.length; i++) - if (i == ranges.length - 1 || ranges[i].head.line < ranges[i + 1].head.line) - cm.indentLine(ranges[i].head.line); - } - - function autoCloseSlash(cm) { - if (cm.getOption("disableInput")) return CodeMirror.Pass; - autoCloseCurrent(cm, true); - } - - CodeMirror.commands.closeTag = function(cm) { return autoCloseCurrent(cm); }; - - function indexOf(collection, elt) { - if (collection.indexOf) return collection.indexOf(elt); - for (var i = 0, e = collection.length; i < e; ++i) - if (collection[i] == elt) return i; - return -1; - } - - // If xml-fold is loaded, we use its functionality to try and verify - // whether a given tag is actually unclosed. - function closingTagExists(cm, tagName, pos, state, newTag) { - if (!CodeMirror.scanForClosingTag) return false; - var end = Math.min(cm.lastLine() + 1, pos.line + 500); - var nextClose = CodeMirror.scanForClosingTag(cm, pos, null, end); - if (!nextClose || nextClose.tag != tagName) return false; - var cx = state.context; - // If the immediate wrapping context contains onCx instances of - // the same tag, a closing tag only exists if there are at least - // that many closing tags of that type following. - for (var onCx = newTag ? 1 : 0; cx && cx.tagName == tagName; cx = cx.prev) ++onCx; - pos = nextClose.to; - for (var i = 1; i < onCx; i++) { - var next = CodeMirror.scanForClosingTag(cm, pos, null, end); - if (!next || next.tag != tagName) return false; - pos = next.to; - } - return true; - } -}); -// CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: http://codemirror.net/LICENSE - -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { - var ie_lt8 = /MSIE \d/.test(navigator.userAgent) && - (document.documentMode == null || document.documentMode < 8); - - var Pos = CodeMirror.Pos; - - var matching = {"(": ")>", ")": "(<", "[": "]>", "]": "[<", "{": "}>", "}": "{<"}; - - function findMatchingBracket(cm, where, strict, config) { - var line = cm.getLineHandle(where.line), pos = where.ch - 1; - var match = (pos >= 0 && matching[line.text.charAt(pos)]) || matching[line.text.charAt(++pos)]; - if (!match) return null; - var dir = match.charAt(1) == ">" ? 1 : -1; - if (strict && (dir > 0) != (pos == where.ch)) return null; - var style = cm.getTokenTypeAt(Pos(where.line, pos + 1)); - - var found = scanForBracket(cm, Pos(where.line, pos + (dir > 0 ? 1 : 0)), dir, style || null, config); - if (found == null) return null; - return {from: Pos(where.line, pos), to: found && found.pos, - match: found && found.ch == match.charAt(0), forward: dir > 0}; - } - - // bracketRegex is used to specify which type of bracket to scan - // should be a regexp, e.g. /[[\]]/ - // - // Note: If "where" is on an open bracket, then this bracket is ignored. - // - // Returns false when no bracket was found, null when it reached - // maxScanLines and gave up - function scanForBracket(cm, where, dir, style, config) { - var maxScanLen = (config && config.maxScanLineLength) || 10000; - var maxScanLines = (config && config.maxScanLines) || 1000; - - var stack = []; - var re = config && config.bracketRegex ? config.bracketRegex : /[(){}[\]]/; - var lineEnd = dir > 0 ? Math.min(where.line + maxScanLines, cm.lastLine() + 1) - : Math.max(cm.firstLine() - 1, where.line - maxScanLines); - for (var lineNo = where.line; lineNo != lineEnd; lineNo += dir) { - var line = cm.getLine(lineNo); - if (!line) continue; - var pos = dir > 0 ? 0 : line.length - 1, end = dir > 0 ? line.length : -1; - if (line.length > maxScanLen) continue; - if (lineNo == where.line) pos = where.ch - (dir < 0 ? 1 : 0); - for (; pos != end; pos += dir) { - var ch = line.charAt(pos); - if (re.test(ch) && (style === undefined || cm.getTokenTypeAt(Pos(lineNo, pos + 1)) == style)) { - var match = matching[ch]; - if ((match.charAt(1) == ">") == (dir > 0)) stack.push(ch); - else if (!stack.length) return {pos: Pos(lineNo, pos), ch: ch}; - else stack.pop(); - } - } - } - return lineNo - dir == (dir > 0 ? cm.lastLine() : cm.firstLine()) ? false : null; - } - - function matchBrackets(cm, autoclear, config) { - // Disable brace matching in long lines, since it'll cause hugely slow updates - var maxHighlightLen = cm.state.matchBrackets.maxHighlightLineLength || 1000; - var marks = [], ranges = cm.listSelections(); - for (var i = 0; i < ranges.length; i++) { - var match = ranges[i].empty() && findMatchingBracket(cm, ranges[i].head, false, config); - if (match && cm.getLine(match.from.line).length <= maxHighlightLen) { - var style = match.match ? "CodeMirror-matchingbracket" : "CodeMirror-nonmatchingbracket"; - marks.push(cm.markText(match.from, Pos(match.from.line, match.from.ch + 1), {className: style})); - if (match.to && cm.getLine(match.to.line).length <= maxHighlightLen) - marks.push(cm.markText(match.to, Pos(match.to.line, match.to.ch + 1), {className: style})); - } - } - - if (marks.length) { - // Kludge to work around the IE bug from issue #1193, where text - // input stops going to the textare whever this fires. - if (ie_lt8 && cm.state.focused) cm.display.input.focus(); - - var clear = function() { - cm.operation(function() { - for (var i = 0; i < marks.length; i++) marks[i].clear(); - }); - }; - if (autoclear) setTimeout(clear, 800); - else return clear; - } - } - - var currentlyHighlighted = null; - function doMatchBrackets(cm) { - cm.operation(function() { - if (currentlyHighlighted) {currentlyHighlighted(); currentlyHighlighted = null;} - currentlyHighlighted = matchBrackets(cm, false, cm.state.matchBrackets); - }); - } - - CodeMirror.defineOption("matchBrackets", false, function(cm, val, old) { - if (old && old != CodeMirror.Init) - cm.off("cursorActivity", doMatchBrackets); - if (val) { - cm.state.matchBrackets = typeof val == "object" ? val : {}; - cm.on("cursorActivity", doMatchBrackets); - } - }); - - CodeMirror.defineExtension("matchBrackets", function() {matchBrackets(this, true);}); - CodeMirror.defineExtension("findMatchingBracket", function(pos, strict, config){ - return findMatchingBracket(this, pos, strict, config); - }); - CodeMirror.defineExtension("scanForBracket", function(pos, dir, style, config){ - return scanForBracket(this, pos, dir, style, config); - }); -}); -// CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: http://codemirror.net/LICENSE - -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror"), require("../fold/xml-fold")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror", "../fold/xml-fold"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { - "use strict"; - - CodeMirror.defineOption("matchTags", false, function(cm, val, old) { - if (old && old != CodeMirror.Init) { - cm.off("cursorActivity", doMatchTags); - cm.off("viewportChange", maybeUpdateMatch); - clear(cm); - } - if (val) { - cm.state.matchBothTags = typeof val == "object" && val.bothTags; - cm.on("cursorActivity", doMatchTags); - cm.on("viewportChange", maybeUpdateMatch); - doMatchTags(cm); - } - }); - - function clear(cm) { - if (cm.state.tagHit) cm.state.tagHit.clear(); - if (cm.state.tagOther) cm.state.tagOther.clear(); - cm.state.tagHit = cm.state.tagOther = null; - } - - function doMatchTags(cm) { - cm.state.failedTagMatch = false; - cm.operation(function() { - clear(cm); - if (cm.somethingSelected()) return; - var cur = cm.getCursor(), range = cm.getViewport(); - range.from = Math.min(range.from, cur.line); range.to = Math.max(cur.line + 1, range.to); - var match = CodeMirror.findMatchingTag(cm, cur, range); - if (!match) return; - if (cm.state.matchBothTags) { - var hit = match.at == "open" ? match.open : match.close; - if (hit) cm.state.tagHit = cm.markText(hit.from, hit.to, {className: "CodeMirror-matchingtag"}); - } - var other = match.at == "close" ? match.open : match.close; - if (other) - cm.state.tagOther = cm.markText(other.from, other.to, {className: "CodeMirror-matchingtag"}); - else - cm.state.failedTagMatch = true; - }); - } - - function maybeUpdateMatch(cm) { - if (cm.state.failedTagMatch) doMatchTags(cm); - } - - CodeMirror.commands.toMatchingTag = function(cm) { - var found = CodeMirror.findMatchingTag(cm, cm.getCursor()); - if (found) { - var other = found.at == "close" ? found.open : found.close; - if (other) cm.extendSelection(other.to, other.from); - } - }; -}); -// CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: http://codemirror.net/LICENSE - -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; - -CodeMirror.registerHelper("fold", "brace", function(cm, start) { - var line = start.line, lineText = cm.getLine(line); - var startCh, tokenType; - - function findOpening(openCh) { - for (var at = start.ch, pass = 0;;) { - var found = at <= 0 ? -1 : lineText.lastIndexOf(openCh, at - 1); - if (found == -1) { - if (pass == 1) break; - pass = 1; - at = lineText.length; - continue; - } - if (pass == 1 && found < start.ch) break; - tokenType = cm.getTokenTypeAt(CodeMirror.Pos(line, found + 1)); - if (!/^(comment|string)/.test(tokenType)) return found + 1; - at = found - 1; - } - } - - var startToken = "{", endToken = "}", startCh = findOpening("{"); - if (startCh == null) { - startToken = "[", endToken = "]"; - startCh = findOpening("["); - } - - if (startCh == null) return; - var count = 1, lastLine = cm.lastLine(), end, endCh; - outer: for (var i = line; i <= lastLine; ++i) { - var text = cm.getLine(i), pos = i == line ? startCh : 0; - for (;;) { - var nextOpen = text.indexOf(startToken, pos), nextClose = text.indexOf(endToken, pos); - if (nextOpen < 0) nextOpen = text.length; - if (nextClose < 0) nextClose = text.length; - pos = Math.min(nextOpen, nextClose); - if (pos == text.length) break; - if (cm.getTokenTypeAt(CodeMirror.Pos(i, pos + 1)) == tokenType) { - if (pos == nextOpen) ++count; - else if (!--count) { end = i; endCh = pos; break outer; } - } - ++pos; - } - } - if (end == null || line == end && endCh == startCh) return; - return {from: CodeMirror.Pos(line, startCh), - to: CodeMirror.Pos(end, endCh)}; -}); - -CodeMirror.registerHelper("fold", "import", function(cm, start) { - function hasImport(line) { - if (line < cm.firstLine() || line > cm.lastLine()) return null; - var start = cm.getTokenAt(CodeMirror.Pos(line, 1)); - if (!/\S/.test(start.string)) start = cm.getTokenAt(CodeMirror.Pos(line, start.end + 1)); - if (start.type != "keyword" || start.string != "import") return null; - // Now find closing semicolon, return its position - for (var i = line, e = Math.min(cm.lastLine(), line + 10); i <= e; ++i) { - var text = cm.getLine(i), semi = text.indexOf(";"); - if (semi != -1) return {startCh: start.end, end: CodeMirror.Pos(i, semi)}; - } - } - - var start = start.line, has = hasImport(start), prev; - if (!has || hasImport(start - 1) || ((prev = hasImport(start - 2)) && prev.end.line == start - 1)) - return null; - for (var end = has.end;;) { - var next = hasImport(end.line + 1); - if (next == null) break; - end = next.end; - } - return {from: cm.clipPos(CodeMirror.Pos(start, has.startCh + 1)), to: end}; -}); - -CodeMirror.registerHelper("fold", "include", function(cm, start) { - function hasInclude(line) { - if (line < cm.firstLine() || line > cm.lastLine()) return null; - var start = cm.getTokenAt(CodeMirror.Pos(line, 1)); - if (!/\S/.test(start.string)) start = cm.getTokenAt(CodeMirror.Pos(line, start.end + 1)); - if (start.type == "meta" && start.string.slice(0, 8) == "#include") return start.start + 8; - } - - var start = start.line, has = hasInclude(start); - if (has == null || hasInclude(start - 1) != null) return null; - for (var end = start;;) { - var next = hasInclude(end + 1); - if (next == null) break; - ++end; - } - return {from: CodeMirror.Pos(start, has + 1), - to: cm.clipPos(CodeMirror.Pos(end))}; -}); - -}); -// CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: http://codemirror.net/LICENSE - -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { - "use strict"; - - function doFold(cm, pos, options, force) { - if (options && options.call) { - var finder = options; - options = null; - } else { - var finder = getOption(cm, options, "rangeFinder"); - } - if (typeof pos == "number") pos = CodeMirror.Pos(pos, 0); - var minSize = getOption(cm, options, "minFoldSize"); - - function getRange(allowFolded) { - var range = finder(cm, pos); - if (!range || range.to.line - range.from.line < minSize) return null; - var marks = cm.findMarksAt(range.from); - for (var i = 0; i < marks.length; ++i) { - if (marks[i].__isFold && force !== "fold") { - if (!allowFolded) return null; - range.cleared = true; - marks[i].clear(); - } - } - return range; - } - - var range = getRange(true); - if (getOption(cm, options, "scanUp")) while (!range && pos.line > cm.firstLine()) { - pos = CodeMirror.Pos(pos.line - 1, 0); - range = getRange(false); - } - if (!range || range.cleared || force === "unfold") return; - - var myWidget = makeWidget(cm, options); - CodeMirror.on(myWidget, "mousedown", function(e) { - myRange.clear(); - CodeMirror.e_preventDefault(e); - }); - var myRange = cm.markText(range.from, range.to, { - replacedWith: myWidget, - clearOnEnter: true, - __isFold: true - }); - myRange.on("clear", function(from, to) { - CodeMirror.signal(cm, "unfold", cm, from, to); - }); - CodeMirror.signal(cm, "fold", cm, range.from, range.to); - } - - function makeWidget(cm, options) { - var widget = getOption(cm, options, "widget"); - if (typeof widget == "string") { - var text = document.createTextNode(widget); - widget = document.createElement("span"); - widget.appendChild(text); - widget.className = "CodeMirror-foldmarker"; - } - return widget; - } - - // Clumsy backwards-compatible interface - CodeMirror.newFoldFunction = function(rangeFinder, widget) { - return function(cm, pos) { doFold(cm, pos, {rangeFinder: rangeFinder, widget: widget}); }; - }; - - // New-style interface - CodeMirror.defineExtension("foldCode", function(pos, options, force) { - doFold(this, pos, options, force); - }); - - CodeMirror.defineExtension("isFolded", function(pos) { - var marks = this.findMarksAt(pos); - for (var i = 0; i < marks.length; ++i) - if (marks[i].__isFold) return true; - }); - - CodeMirror.commands.toggleFold = function(cm) { - cm.foldCode(cm.getCursor()); - }; - CodeMirror.commands.fold = function(cm) { - cm.foldCode(cm.getCursor(), null, "fold"); - }; - CodeMirror.commands.unfold = function(cm) { - cm.foldCode(cm.getCursor(), null, "unfold"); - }; - CodeMirror.commands.foldAll = function(cm) { - cm.operation(function() { - for (var i = cm.firstLine(), e = cm.lastLine(); i <= e; i++) - cm.foldCode(CodeMirror.Pos(i, 0), null, "fold"); - }); - }; - CodeMirror.commands.unfoldAll = function(cm) { - cm.operation(function() { - for (var i = cm.firstLine(), e = cm.lastLine(); i <= e; i++) - cm.foldCode(CodeMirror.Pos(i, 0), null, "unfold"); - }); - }; - - CodeMirror.registerHelper("fold", "combine", function() { - var funcs = Array.prototype.slice.call(arguments, 0); - return function(cm, start) { - for (var i = 0; i < funcs.length; ++i) { - var found = funcs[i](cm, start); - if (found) return found; - } - }; - }); - - CodeMirror.registerHelper("fold", "auto", function(cm, start) { - var helpers = cm.getHelpers(start, "fold"); - for (var i = 0; i < helpers.length; i++) { - var cur = helpers[i](cm, start); - if (cur) return cur; - } - }); - - var defaultOptions = { - rangeFinder: CodeMirror.fold.auto, - widget: "\u2194", - minFoldSize: 0, - scanUp: false - }; - - CodeMirror.defineOption("foldOptions", null); - - function getOption(cm, options, name) { - if (options && options[name] !== undefined) - return options[name]; - var editorOptions = cm.options.foldOptions; - if (editorOptions && editorOptions[name] !== undefined) - return editorOptions[name]; - return defaultOptions[name]; - } - - CodeMirror.defineExtension("foldOption", function(options, name) { - return getOption(this, options, name); - }); -}); -// CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: http://codemirror.net/LICENSE - -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror"), require("./foldcode")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror", "./foldcode"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { - "use strict"; - - CodeMirror.defineOption("foldGutter", false, function(cm, val, old) { - if (old && old != CodeMirror.Init) { - cm.clearGutter(cm.state.foldGutter.options.gutter); - cm.state.foldGutter = null; - cm.off("gutterClick", onGutterClick); - cm.off("change", onChange); - cm.off("viewportChange", onViewportChange); - cm.off("fold", onFold); - cm.off("unfold", onFold); - cm.off("swapDoc", updateInViewport); - } - if (val) { - cm.state.foldGutter = new State(parseOptions(val)); - updateInViewport(cm); - cm.on("gutterClick", onGutterClick); - cm.on("change", onChange); - cm.on("viewportChange", onViewportChange); - cm.on("fold", onFold); - cm.on("unfold", onFold); - cm.on("swapDoc", updateInViewport); - } - }); - - var Pos = CodeMirror.Pos; - - function State(options) { - this.options = options; - this.from = this.to = 0; - } - - function parseOptions(opts) { - if (opts === true) opts = {}; - if (opts.gutter == null) opts.gutter = "CodeMirror-foldgutter"; - if (opts.indicatorOpen == null) opts.indicatorOpen = "CodeMirror-foldgutter-open"; - if (opts.indicatorFolded == null) opts.indicatorFolded = "CodeMirror-foldgutter-folded"; - return opts; - } - - function isFolded(cm, line) { - var marks = cm.findMarksAt(Pos(line)); - for (var i = 0; i < marks.length; ++i) - if (marks[i].__isFold && marks[i].find().from.line == line) return true; - } - - function marker(spec) { - if (typeof spec == "string") { - var elt = document.createElement("div"); - elt.className = spec + " CodeMirror-guttermarker-subtle"; - return elt; - } else { - return spec.cloneNode(true); - } - } - - function updateFoldInfo(cm, from, to) { - var opts = cm.state.foldGutter.options, cur = from; - var minSize = cm.foldOption(opts, "minFoldSize"); - var func = cm.foldOption(opts, "rangeFinder"); - cm.eachLine(from, to, function(line) { - var mark = null; - if (isFolded(cm, cur)) { - mark = marker(opts.indicatorFolded); - } else { - var pos = Pos(cur, 0); - var range = func && func(cm, pos); - if (range && range.to.line - range.from.line >= minSize) - mark = marker(opts.indicatorOpen); - } - cm.setGutterMarker(line, opts.gutter, mark); - ++cur; - }); - } - - function updateInViewport(cm) { - var vp = cm.getViewport(), state = cm.state.foldGutter; - if (!state) return; - cm.operation(function() { - updateFoldInfo(cm, vp.from, vp.to); - }); - state.from = vp.from; state.to = vp.to; - } - - function onGutterClick(cm, line, gutter) { - var opts = cm.state.foldGutter.options; - if (gutter != opts.gutter) return; - cm.foldCode(Pos(line, 0), opts.rangeFinder); - } - - function onChange(cm) { - var state = cm.state.foldGutter, opts = cm.state.foldGutter.options; - state.from = state.to = 0; - clearTimeout(state.changeUpdate); - state.changeUpdate = setTimeout(function() { updateInViewport(cm); }, opts.foldOnChangeTimeSpan || 600); - } - - function onViewportChange(cm) { - var state = cm.state.foldGutter, opts = cm.state.foldGutter.options; - clearTimeout(state.changeUpdate); - state.changeUpdate = setTimeout(function() { - var vp = cm.getViewport(); - if (state.from == state.to || vp.from - state.to > 20 || state.from - vp.to > 20) { - updateInViewport(cm); - } else { - cm.operation(function() { - if (vp.from < state.from) { - updateFoldInfo(cm, vp.from, state.from); - state.from = vp.from; - } - if (vp.to > state.to) { - updateFoldInfo(cm, state.to, vp.to); - state.to = vp.to; - } - }); - } - }, opts.updateViewportTimeSpan || 400); - } - - function onFold(cm, from) { - var state = cm.state.foldGutter, line = from.line; - if (line >= state.from && line < state.to) - updateFoldInfo(cm, line, line + 1); - } -}); -// CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: http://codemirror.net/LICENSE - -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { - "use strict"; - - var Pos = CodeMirror.Pos; - function cmp(a, b) { return a.line - b.line || a.ch - b.ch; } - - var nameStartChar = "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"; - var nameChar = nameStartChar + "\-\:\.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040"; - var xmlTagStart = new RegExp("<(/?)([" + nameStartChar + "][" + nameChar + "]*)", "g"); - - function Iter(cm, line, ch, range) { - this.line = line; this.ch = ch; - this.cm = cm; this.text = cm.getLine(line); - this.min = range ? range.from : cm.firstLine(); - this.max = range ? range.to - 1 : cm.lastLine(); - } - - function tagAt(iter, ch) { - var type = iter.cm.getTokenTypeAt(Pos(iter.line, ch)); - return type && /\btag\b/.test(type); - } - - function nextLine(iter) { - if (iter.line >= iter.max) return; - iter.ch = 0; - iter.text = iter.cm.getLine(++iter.line); - return true; - } - function prevLine(iter) { - if (iter.line <= iter.min) return; - iter.text = iter.cm.getLine(--iter.line); - iter.ch = iter.text.length; - return true; - } - - function toTagEnd(iter) { - for (;;) { - var gt = iter.text.indexOf(">", iter.ch); - if (gt == -1) { if (nextLine(iter)) continue; else return; } - if (!tagAt(iter, gt + 1)) { iter.ch = gt + 1; continue; } - var lastSlash = iter.text.lastIndexOf("/", gt); - var selfClose = lastSlash > -1 && !/\S/.test(iter.text.slice(lastSlash + 1, gt)); - iter.ch = gt + 1; - return selfClose ? "selfClose" : "regular"; - } - } - function toTagStart(iter) { - for (;;) { - var lt = iter.ch ? iter.text.lastIndexOf("<", iter.ch - 1) : -1; - if (lt == -1) { if (prevLine(iter)) continue; else return; } - if (!tagAt(iter, lt + 1)) { iter.ch = lt; continue; } - xmlTagStart.lastIndex = lt; - iter.ch = lt; - var match = xmlTagStart.exec(iter.text); - if (match && match.index == lt) return match; - } - } - - function toNextTag(iter) { - for (;;) { - xmlTagStart.lastIndex = iter.ch; - var found = xmlTagStart.exec(iter.text); - if (!found) { if (nextLine(iter)) continue; else return; } - if (!tagAt(iter, found.index + 1)) { iter.ch = found.index + 1; continue; } - iter.ch = found.index + found[0].length; - return found; - } - } - function toPrevTag(iter) { - for (;;) { - var gt = iter.ch ? iter.text.lastIndexOf(">", iter.ch - 1) : -1; - if (gt == -1) { if (prevLine(iter)) continue; else return; } - if (!tagAt(iter, gt + 1)) { iter.ch = gt; continue; } - var lastSlash = iter.text.lastIndexOf("/", gt); - var selfClose = lastSlash > -1 && !/\S/.test(iter.text.slice(lastSlash + 1, gt)); - iter.ch = gt + 1; - return selfClose ? "selfClose" : "regular"; - } - } - - function findMatchingClose(iter, tag) { - var stack = []; - for (;;) { - var next = toNextTag(iter), end, startLine = iter.line, startCh = iter.ch - (next ? next[0].length : 0); - if (!next || !(end = toTagEnd(iter))) return; - if (end == "selfClose") continue; - if (next[1]) { // closing tag - for (var i = stack.length - 1; i >= 0; --i) if (stack[i] == next[2]) { - stack.length = i; - break; - } - if (i < 0 && (!tag || tag == next[2])) return { - tag: next[2], - from: Pos(startLine, startCh), - to: Pos(iter.line, iter.ch) - }; - } else { // opening tag - stack.push(next[2]); - } - } - } - function findMatchingOpen(iter, tag) { - var stack = []; - for (;;) { - var prev = toPrevTag(iter); - if (!prev) return; - if (prev == "selfClose") { toTagStart(iter); continue; } - var endLine = iter.line, endCh = iter.ch; - var start = toTagStart(iter); - if (!start) return; - if (start[1]) { // closing tag - stack.push(start[2]); - } else { // opening tag - for (var i = stack.length - 1; i >= 0; --i) if (stack[i] == start[2]) { - stack.length = i; - break; - } - if (i < 0 && (!tag || tag == start[2])) return { - tag: start[2], - from: Pos(iter.line, iter.ch), - to: Pos(endLine, endCh) - }; - } - } - } - - CodeMirror.registerHelper("fold", "xml", function(cm, start) { - var iter = new Iter(cm, start.line, 0); - for (;;) { - var openTag = toNextTag(iter), end; - if (!openTag || iter.line != start.line || !(end = toTagEnd(iter))) return; - if (!openTag[1] && end != "selfClose") { - var start = Pos(iter.line, iter.ch); - var close = findMatchingClose(iter, openTag[2]); - return close && {from: start, to: close.from}; - } - } - }); - CodeMirror.findMatchingTag = function(cm, pos, range) { - var iter = new Iter(cm, pos.line, pos.ch, range); - if (iter.text.indexOf(">") == -1 && iter.text.indexOf("<") == -1) return; - var end = toTagEnd(iter), to = end && Pos(iter.line, iter.ch); - var start = end && toTagStart(iter); - if (!end || !start || cmp(iter, pos) > 0) return; - var here = {from: Pos(iter.line, iter.ch), to: to, tag: start[2]}; - if (end == "selfClose") return {open: here, close: null, at: "open"}; - - if (start[1]) { // closing tag - return {open: findMatchingOpen(iter, start[2]), close: here, at: "close"}; - } else { // opening tag - iter = new Iter(cm, to.line, to.ch, range); - return {open: here, close: findMatchingClose(iter, start[2]), at: "open"}; - } - }; - - CodeMirror.findEnclosingTag = function(cm, pos, range) { - var iter = new Iter(cm, pos.line, pos.ch, range); - for (;;) { - var open = findMatchingOpen(iter); - if (!open) break; - var forward = new Iter(cm, pos.line, pos.ch, range); - var close = findMatchingClose(forward, open.tag); - if (close) return {open: open, close: close}; - } - }; - - // Used by addon/edit/closetag.js - CodeMirror.scanForClosingTag = function(cm, pos, name, end) { - var iter = new Iter(cm, pos.line, pos.ch, end ? {from: 0, to: end} : null); - return findMatchingClose(iter, name); - }; -}); -// CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: http://codemirror.net/LICENSE - -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror"), "cjs"); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], function(CM) { mod(CM, "amd"); }); - else // Plain browser env - mod(CodeMirror, "plain"); -})(function(CodeMirror, env) { - if (!CodeMirror.modeURL) CodeMirror.modeURL = "../mode/%N/%N.js"; - - var loading = {}; - function splitCallback(cont, n) { - var countDown = n; - return function() { if (--countDown == 0) cont(); }; - } - function ensureDeps(mode, cont) { - var deps = CodeMirror.modes[mode].dependencies; - if (!deps) return cont(); - var missing = []; - for (var i = 0; i < deps.length; ++i) { - if (!CodeMirror.modes.hasOwnProperty(deps[i])) - missing.push(deps[i]); - } - if (!missing.length) return cont(); - var split = splitCallback(cont, missing.length); - for (var i = 0; i < missing.length; ++i) - CodeMirror.requireMode(missing[i], split); - } - - CodeMirror.requireMode = function(mode, cont) { - if (typeof mode != "string") mode = mode.name; - if (CodeMirror.modes.hasOwnProperty(mode)) return ensureDeps(mode, cont); - if (loading.hasOwnProperty(mode)) return loading[mode].push(cont); - - var file = CodeMirror.modeURL.replace(/%N/g, mode); - if (env == "plain") { - var script = document.createElement("script"); - script.src = file; - var others = document.getElementsByTagName("script")[0]; - var list = loading[mode] = [cont]; - CodeMirror.on(script, "load", function() { - ensureDeps(mode, function() { - for (var i = 0; i < list.length; ++i) list[i](); - }); - }); - others.parentNode.insertBefore(script, others); - } else if (env == "cjs") { - require(file); - cont(); - } else if (env == "amd") { - requirejs([file], cont); - } - }; - - CodeMirror.autoLoadMode = function(instance, mode) { - if (!CodeMirror.modes.hasOwnProperty(mode)) - CodeMirror.requireMode(mode, function() { - instance.setOption("mode", instance.getOption("mode")); - }); - }; -}); -// CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: http://codemirror.net/LICENSE - -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; - -CodeMirror.multiplexingMode = function(outer /*, others */) { - // Others should be {open, close, mode [, delimStyle] [, innerStyle]} objects - var others = Array.prototype.slice.call(arguments, 1); - var n_others = others.length; - - function indexOf(string, pattern, from) { - if (typeof pattern == "string") return string.indexOf(pattern, from); - var m = pattern.exec(from ? string.slice(from) : string); - return m ? m.index + from : -1; - } - - return { - startState: function() { - return { - outer: CodeMirror.startState(outer), - innerActive: null, - inner: null - }; - }, - - copyState: function(state) { - return { - outer: CodeMirror.copyState(outer, state.outer), - innerActive: state.innerActive, - inner: state.innerActive && CodeMirror.copyState(state.innerActive.mode, state.inner) - }; - }, - - token: function(stream, state) { - if (!state.innerActive) { - var cutOff = Infinity, oldContent = stream.string; - for (var i = 0; i < n_others; ++i) { - var other = others[i]; - var found = indexOf(oldContent, other.open, stream.pos); - if (found == stream.pos) { - stream.match(other.open); - state.innerActive = other; - state.inner = CodeMirror.startState(other.mode, outer.indent ? outer.indent(state.outer, "") : 0); - return other.delimStyle; - } else if (found != -1 && found < cutOff) { - cutOff = found; - } - } - if (cutOff != Infinity) stream.string = oldContent.slice(0, cutOff); - var outerToken = outer.token(stream, state.outer); - if (cutOff != Infinity) stream.string = oldContent; - return outerToken; - } else { - var curInner = state.innerActive, oldContent = stream.string; - if (!curInner.close && stream.sol()) { - state.innerActive = state.inner = null; - return this.token(stream, state); - } - var found = curInner.close ? indexOf(oldContent, curInner.close, stream.pos) : -1; - if (found == stream.pos) { - stream.match(curInner.close); - state.innerActive = state.inner = null; - return curInner.delimStyle; - } - if (found > -1) stream.string = oldContent.slice(0, found); - var innerToken = curInner.mode.token(stream, state.inner); - if (found > -1) stream.string = oldContent; - - if (curInner.innerStyle) { - if (innerToken) innerToken = innerToken + ' ' + curInner.innerStyle; - else innerToken = curInner.innerStyle; - } - - return innerToken; - } - }, - - indent: function(state, textAfter) { - var mode = state.innerActive ? state.innerActive.mode : outer; - if (!mode.indent) return CodeMirror.Pass; - return mode.indent(state.innerActive ? state.inner : state.outer, textAfter); - }, - - blankLine: function(state) { - var mode = state.innerActive ? state.innerActive.mode : outer; - if (mode.blankLine) { - mode.blankLine(state.innerActive ? state.inner : state.outer); - } - if (!state.innerActive) { - for (var i = 0; i < n_others; ++i) { - var other = others[i]; - if (other.open === "\n") { - state.innerActive = other; - state.inner = CodeMirror.startState(other.mode, mode.indent ? mode.indent(state.outer, "") : 0); - } - } - } else if (state.innerActive.close === "\n") { - state.innerActive = state.inner = null; - } - }, - - electricChars: outer.electricChars, - - innerMode: function(state) { - return state.inner ? {state: state.inner, mode: state.innerActive.mode} : {state: state.outer, mode: outer}; - } - }; -}; - -}); -// CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: http://codemirror.net/LICENSE - -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { - "use strict"; - - function Bar(cls, orientation, scroll) { - this.orientation = orientation; - this.scroll = scroll; - this.screen = this.total = this.size = 1; - this.pos = 0; - - this.node = document.createElement("div"); - this.node.className = cls + "-" + orientation; - this.inner = this.node.appendChild(document.createElement("div")); - - var self = this; - CodeMirror.on(this.inner, "mousedown", function(e) { - if (e.which != 1) return; - CodeMirror.e_preventDefault(e); - var axis = self.orientation == "horizontal" ? "pageX" : "pageY"; - var start = e[axis], startpos = self.pos; - function done() { - CodeMirror.off(document, "mousemove", move); - CodeMirror.off(document, "mouseup", done); - } - function move(e) { - if (e.which != 1) return done(); - self.moveTo(startpos + (e[axis] - start) * (self.total / self.size)); - } - CodeMirror.on(document, "mousemove", move); - CodeMirror.on(document, "mouseup", done); - }); - - CodeMirror.on(this.node, "click", function(e) { - CodeMirror.e_preventDefault(e); - var innerBox = self.inner.getBoundingClientRect(), where; - if (self.orientation == "horizontal") - where = e.clientX < innerBox.left ? -1 : e.clientX > innerBox.right ? 1 : 0; - else - where = e.clientY < innerBox.top ? -1 : e.clientY > innerBox.bottom ? 1 : 0; - self.moveTo(self.pos + where * self.screen); - }); - - function onWheel(e) { - var moved = CodeMirror.wheelEventPixels(e)[self.orientation == "horizontal" ? "x" : "y"]; - var oldPos = self.pos; - self.moveTo(self.pos + moved); - if (self.pos != oldPos) CodeMirror.e_preventDefault(e); - } - CodeMirror.on(this.node, "mousewheel", onWheel); - CodeMirror.on(this.node, "DOMMouseScroll", onWheel); - } - - Bar.prototype.moveTo = function(pos, update) { - if (pos < 0) pos = 0; - if (pos > this.total - this.screen) pos = this.total - this.screen; - if (pos == this.pos) return; - this.pos = pos; - this.inner.style[this.orientation == "horizontal" ? "left" : "top"] = - (pos * (this.size / this.total)) + "px"; - if (update !== false) this.scroll(pos, this.orientation); - }; - - Bar.prototype.update = function(scrollSize, clientSize, barSize) { - this.screen = clientSize; - this.total = scrollSize; - this.size = barSize; - - // FIXME clip to min size? - this.inner.style[this.orientation == "horizontal" ? "width" : "height"] = - this.screen * (this.size / this.total) + "px"; - this.inner.style[this.orientation == "horizontal" ? "left" : "top"] = - this.pos * (this.size / this.total) + "px"; - }; - - function SimpleScrollbars(cls, place, scroll) { - this.addClass = cls; - this.horiz = new Bar(cls, "horizontal", scroll); - place(this.horiz.node); - this.vert = new Bar(cls, "vertical", scroll); - place(this.vert.node); - this.width = null; - } - - SimpleScrollbars.prototype.update = function(measure) { - if (this.width == null) { - var style = window.getComputedStyle ? window.getComputedStyle(this.horiz.node) : this.horiz.node.currentStyle; - if (style) this.width = parseInt(style.height); - } - var width = this.width || 0; - - var needsH = measure.scrollWidth > measure.clientWidth + 1; - var needsV = measure.scrollHeight > measure.clientHeight + 1; - this.vert.node.style.display = needsV ? "block" : "none"; - this.horiz.node.style.display = needsH ? "block" : "none"; - - if (needsV) { - this.vert.update(measure.scrollHeight, measure.clientHeight, - measure.viewHeight - (needsH ? width : 0)); - this.vert.node.style.display = "block"; - this.vert.node.style.bottom = needsH ? width + "px" : "0"; - } - if (needsH) { - this.horiz.update(measure.scrollWidth, measure.clientWidth, - measure.viewWidth - (needsV ? width : 0) - measure.barLeft); - this.horiz.node.style.right = needsV ? width + "px" : "0"; - this.horiz.node.style.left = measure.barLeft + "px"; - } - - return {right: needsV ? width : 0, bottom: needsH ? width : 0}; - }; - - SimpleScrollbars.prototype.setScrollTop = function(pos) { - this.vert.moveTo(pos, false); - }; - - SimpleScrollbars.prototype.setScrollLeft = function(pos) { - this.horiz.moveTo(pos, false); - }; - - SimpleScrollbars.prototype.clear = function() { - var parent = this.horiz.node.parentNode; - parent.removeChild(this.horiz.node); - parent.removeChild(this.vert.node); - }; - - CodeMirror.scrollbarModel.simple = function(place, scroll) { - return new SimpleScrollbars("CodeMirror-simplescroll", place, scroll); - }; - CodeMirror.scrollbarModel.overlay = function(place, scroll) { - return new SimpleScrollbars("CodeMirror-overlayscroll", place, scroll); - }; -}); -// CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: http://codemirror.net/LICENSE - -// Because sometimes you need to style the cursor's line. -// -// Adds an option 'styleActiveLine' which, when enabled, gives the -// active line's wrapping
    the CSS class "CodeMirror-activeline", -// and gives its background
    the class "CodeMirror-activeline-background". - -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { - "use strict"; - var WRAP_CLASS = "CodeMirror-activeline"; - var BACK_CLASS = "CodeMirror-activeline-background"; - - CodeMirror.defineOption("styleActiveLine", false, function(cm, val, old) { - var prev = old && old != CodeMirror.Init; - if (val && !prev) { - cm.state.activeLines = []; - updateActiveLines(cm, cm.listSelections()); - cm.on("beforeSelectionChange", selectionChange); - } else if (!val && prev) { - cm.off("beforeSelectionChange", selectionChange); - clearActiveLines(cm); - delete cm.state.activeLines; - } - }); - - function clearActiveLines(cm) { - for (var i = 0; i < cm.state.activeLines.length; i++) { - cm.removeLineClass(cm.state.activeLines[i], "wrap", WRAP_CLASS); - cm.removeLineClass(cm.state.activeLines[i], "background", BACK_CLASS); - } - } - - function sameArray(a, b) { - if (a.length != b.length) return false; - for (var i = 0; i < a.length; i++) - if (a[i] != b[i]) return false; - return true; - } - - function updateActiveLines(cm, ranges) { - var active = []; - for (var i = 0; i < ranges.length; i++) { - var range = ranges[i]; - if (!range.empty()) continue; - var line = cm.getLineHandleVisualStart(range.head.line); - if (active[active.length - 1] != line) active.push(line); - } - if (sameArray(cm.state.activeLines, active)) return; - cm.operation(function() { - clearActiveLines(cm); - for (var i = 0; i < active.length; i++) { - cm.addLineClass(active[i], "wrap", WRAP_CLASS); - cm.addLineClass(active[i], "background", BACK_CLASS); - } - cm.state.activeLines = active; - }); - } - - function selectionChange(cm, sel) { - updateActiveLines(cm, sel.ranges); - } -}); -// CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: http://codemirror.net/LICENSE - -/** - * Supported keybindings: - * - * Motion: - * h, j, k, l - * gj, gk - * e, E, w, W, b, B, ge, gE - * f, F, t, T - * $, ^, 0, -, +, _ - * gg, G - * % - * ', ` - * - * Operator: - * d, y, c - * dd, yy, cc - * g~, g~g~ - * >, <, >>, << - * - * Operator-Motion: - * x, X, D, Y, C, ~ - * - * Action: - * a, i, s, A, I, S, o, O - * zz, z., z, zt, zb, z- - * J - * u, Ctrl-r - * m - * r - * - * Modes: - * ESC - leave insert mode, visual mode, and clear input state. - * Ctrl-[, Ctrl-c - same as ESC. - * - * Registers: unnamed, -, a-z, A-Z, 0-9 - * (Does not respect the special case for number registers when delete - * operator is made with these commands: %, (, ), , /, ?, n, N, {, } ) - * TODO: Implement the remaining registers. - * Marks: a-z, A-Z, and 0-9 - * TODO: Implement the remaining special marks. They have more complex - * behavior. - * - * Events: - * 'vim-mode-change' - raised on the editor anytime the current mode changes, - * Event object: {mode: "visual", subMode: "linewise"} - * - * Code structure: - * 1. Default keymap - * 2. Variable declarations and short basic helpers - * 3. Instance (External API) implementation - * 4. Internal state tracking objects (input state, counter) implementation - * and instanstiation - * 5. Key handler (the main command dispatcher) implementation - * 6. Motion, operator, and action implementations - * 7. Helper functions for the key handler, motions, operators, and actions - * 8. Set up Vim to work as a keymap for CodeMirror. - */ - -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../lib/codemirror"), require("../addon/search/searchcursor"), require("../addon/dialog/dialog"), require("../addon/edit/matchbrackets.js")); - else if (typeof define == "function" && define.amd) // AMD - define(["../lib/codemirror", "../addon/search/searchcursor", "../addon/dialog/dialog", "../addon/edit/matchbrackets"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { - 'use strict'; - - var defaultKeymap = [ - // Key to key mapping. This goes first to make it possible to override - // existing mappings. - { keys: '', 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: 'xi', context: 'visual'}, - { keys: 'S', type: 'keyToKey', toKeys: 'cc', context: 'normal' }, - { keys: 'S', type: 'keyToKey', toKeys: 'dcc', 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' }, - // Motions - { keys: 'H', type: 'motion', motion: 'moveToTopLine', motionArgs: { linewise: true, toJumplist: true }}, - { keys: 'M', type: 'motion', motion: 'moveToMiddleLine', motionArgs: { linewise: true, toJumplist: true }}, - { keys: 'L', type: 'motion', motion: 'moveToBottomLine', motionArgs: { linewise: true, toJumplist: true }}, - { keys: 'h', type: 'motion', motion: 'moveByCharacters', motionArgs: { forward: false }}, - { keys: 'l', type: 'motion', motion: 'moveByCharacters', motionArgs: { forward: true }}, - { keys: 'j', type: 'motion', motion: 'moveByLines', motionArgs: { forward: true, linewise: true }}, - { keys: 'k', type: 'motion', motion: 'moveByLines', motionArgs: { forward: false, linewise: true }}, - { keys: 'gj', type: 'motion', motion: 'moveByDisplayLines', motionArgs: { forward: true }}, - { keys: 'gk', type: 'motion', motion: 'moveByDisplayLines', motionArgs: { forward: false }}, - { keys: 'w', type: 'motion', motion: 'moveByWords', motionArgs: { forward: true, wordEnd: false }}, - { keys: 'W', type: 'motion', motion: 'moveByWords', motionArgs: { forward: true, wordEnd: false, bigWord: true }}, - { keys: 'e', type: 'motion', motion: 'moveByWords', motionArgs: { forward: true, wordEnd: true, inclusive: true }}, - { keys: 'E', type: 'motion', motion: 'moveByWords', motionArgs: { forward: true, wordEnd: true, bigWord: true, inclusive: true }}, - { keys: 'b', type: 'motion', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: false }}, - { keys: 'B', type: 'motion', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: false, bigWord: true }}, - { keys: 'ge', type: 'motion', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: true, inclusive: true }}, - { keys: 'gE', type: 'motion', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: true, bigWord: true, inclusive: true }}, - { keys: '{', type: 'motion', motion: 'moveByParagraph', motionArgs: { forward: false, toJumplist: true }}, - { keys: '}', type: 'motion', motion: 'moveByParagraph', motionArgs: { forward: true, toJumplist: true }}, - { keys: '', type: 'motion', motion: 'moveByPage', motionArgs: { forward: true }}, - { keys: '', type: 'motion', motion: 'moveByPage', motionArgs: { forward: false }}, - { keys: '', type: 'motion', motion: 'moveByScroll', motionArgs: { forward: true, explicitRepeat: true }}, - { keys: '', type: 'motion', motion: 'moveByScroll', motionArgs: { forward: false, explicitRepeat: true }}, - { keys: 'gg', type: 'motion', motion: 'moveToLineOrEdgeOfDocument', motionArgs: { forward: false, explicitRepeat: true, linewise: true, toJumplist: true }}, - { keys: 'G', type: 'motion', motion: 'moveToLineOrEdgeOfDocument', motionArgs: { forward: true, explicitRepeat: true, linewise: true, toJumplist: true }}, - { keys: '0', type: 'motion', motion: 'moveToStartOfLine' }, - { keys: '^', type: 'motion', motion: 'moveToFirstNonWhiteSpaceCharacter' }, - { keys: '+', type: 'motion', motion: 'moveByLines', motionArgs: { forward: true, toFirstChar:true }}, - { keys: '-', type: 'motion', motion: 'moveByLines', motionArgs: { forward: false, toFirstChar:true }}, - { keys: '_', type: 'motion', motion: 'moveByLines', motionArgs: { forward: true, toFirstChar:true, repeatOffset:-1 }}, - { keys: '$', type: 'motion', motion: 'moveToEol', motionArgs: { inclusive: true }}, - { keys: '%', type: 'motion', motion: 'moveToMatchedSymbol', motionArgs: { inclusive: true, toJumplist: true }}, - { keys: 'f', type: 'motion', motion: 'moveToCharacter', motionArgs: { forward: true , inclusive: true }}, - { keys: 'F', type: 'motion', motion: 'moveToCharacter', motionArgs: { forward: false }}, - { keys: 't', type: 'motion', motion: 'moveTillCharacter', motionArgs: { forward: true, inclusive: true }}, - { keys: 'T', type: 'motion', motion: 'moveTillCharacter', motionArgs: { forward: false }}, - { keys: ';', type: 'motion', motion: 'repeatLastCharacterSearch', motionArgs: { forward: true }}, - { keys: ',', type: 'motion', motion: 'repeatLastCharacterSearch', motionArgs: { forward: false }}, - { keys: '\'', type: 'motion', motion: 'goToMark', motionArgs: {toJumplist: true, linewise: true}}, - { keys: '`', type: 'motion', motion: 'goToMark', motionArgs: {toJumplist: true}}, - { keys: ']`', type: 'motion', motion: 'jumpToMark', motionArgs: { forward: true } }, - { keys: '[`', type: 'motion', motion: 'jumpToMark', motionArgs: { forward: false } }, - { keys: ']\'', type: 'motion', motion: 'jumpToMark', motionArgs: { forward: true, linewise: true } }, - { keys: '[\'', type: 'motion', motion: 'jumpToMark', motionArgs: { forward: false, linewise: true } }, - // the next two aren't motions but must come before more general motion declarations - { keys: ']p', type: 'action', action: 'paste', isEdit: true, actionArgs: { after: true, isEdit: true, matchIndent: true}}, - { keys: '[p', type: 'action', action: 'paste', isEdit: true, actionArgs: { after: false, isEdit: true, matchIndent: true}}, - { keys: ']', type: 'motion', motion: 'moveToSymbol', motionArgs: { forward: true, toJumplist: true}}, - { keys: '[', type: 'motion', motion: 'moveToSymbol', motionArgs: { forward: false, toJumplist: true}}, - { keys: '|', type: 'motion', motion: 'moveToColumn'}, - { keys: 'o', type: 'motion', motion: 'moveToOtherHighlightedEnd', context:'visual'}, - { keys: 'O', type: 'motion', motion: 'moveToOtherHighlightedEnd', motionArgs: {sameLine: true}, context:'visual'}, - // Operators - { 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: true }}, - { keys: '<', type: 'operator', operator: 'indent', operatorArgs: { indentRight: false }}, - { keys: 'g~', type: 'operator', operator: 'changeCase' }, - { keys: 'gu', type: 'operator', operator: 'changeCase', operatorArgs: {toLower: true}, isEdit: true }, - { keys: 'gU', type: 'operator', operator: 'changeCase', operatorArgs: {toLower: false}, isEdit: true }, - { keys: 'n', type: 'motion', motion: 'findNext', motionArgs: { forward: true, toJumplist: true }}, - { keys: 'N', type: 'motion', motion: 'findNext', motionArgs: { forward: false, toJumplist: true }}, - // Operator-Motion dual commands - { keys: 'x', type: 'operatorMotion', operator: 'delete', motion: 'moveByCharacters', motionArgs: { forward: true }, operatorMotionArgs: { visualLine: false }}, - { keys: 'X', type: 'operatorMotion', operator: 'delete', motion: 'moveByCharacters', motionArgs: { forward: false }, operatorMotionArgs: { visualLine: true }}, - { keys: 'D', type: 'operatorMotion', operator: 'delete', motion: 'moveToEol', motionArgs: { inclusive: true }, context: 'normal'}, - { keys: 'D', type: 'operator', operator: 'delete', operatorArgs: { linewise: true }, context: 'visual'}, - { keys: 'Y', type: 'operatorMotion', operator: 'yank', motion: 'moveToEol', motionArgs: { inclusive: true }, context: 'normal'}, - { keys: 'Y', type: 'operator', operator: 'yank', operatorArgs: { linewise: true }, context: 'visual'}, - { keys: 'C', type: 'operatorMotion', operator: 'change', motion: 'moveToEol', motionArgs: { inclusive: true }, context: 'normal'}, - { keys: 'C', type: 'operator', operator: 'change', operatorArgs: { linewise: true }, context: 'visual'}, - { keys: '~', type: 'operatorMotion', operator: 'changeCase', motion: 'moveByCharacters', motionArgs: { forward: true }, operatorArgs: { shouldMoveCursor: true }, context: 'normal'}, - { keys: '~', type: 'operator', operator: 'changeCase', context: 'visual'}, - { keys: '', type: 'operatorMotion', operator: 'delete', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: false }, context: 'insert' }, - // Actions - { keys: '', type: 'action', action: 'jumpListWalk', actionArgs: { forward: true }}, - { keys: '', type: 'action', action: 'jumpListWalk', actionArgs: { forward: false }}, - { keys: '', type: 'action', action: 'scroll', actionArgs: { forward: true, linewise: true }}, - { keys: '', type: 'action', action: 'scroll', actionArgs: { forward: false, linewise: true }}, - { keys: 'a', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'charAfter' }, context: 'normal' }, - { keys: 'A', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'eol' }, context: 'normal' }, - { keys: 'A', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'endOfSelectedArea' }, context: 'visual' }, - { keys: 'i', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'inplace' }, context: 'normal' }, - { keys: 'I', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'firstNonBlank'}, context: 'normal' }, - { keys: 'I', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'startOfSelectedArea' }, context: 'visual' }, - { keys: 'o', type: 'action', action: 'newLineAndEnterInsertMode', isEdit: true, interlaceInsertRepeat: true, actionArgs: { after: true }, context: 'normal' }, - { keys: 'O', type: 'action', action: 'newLineAndEnterInsertMode', isEdit: true, interlaceInsertRepeat: true, actionArgs: { after: false }, context: 'normal' }, - { keys: 'v', type: 'action', action: 'toggleVisualMode' }, - { keys: 'V', type: 'action', action: 'toggleVisualMode', actionArgs: { linewise: true }}, - { keys: '', type: 'action', action: 'toggleVisualMode', actionArgs: { blockwise: true }}, - { keys: 'gv', type: 'action', action: 'reselectLastSelection' }, - { keys: 'J', type: 'action', action: 'joinLines', isEdit: true }, - { keys: 'p', type: 'action', action: 'paste', isEdit: true, actionArgs: { after: true, isEdit: true }}, - { keys: 'P', type: 'action', action: 'paste', isEdit: true, actionArgs: { after: false, isEdit: true }}, - { keys: 'r', type: 'action', action: 'replace', isEdit: true }, - { keys: '@', type: 'action', action: 'replayMacro' }, - { keys: 'q', type: 'action', action: 'enterMacroRecordMode' }, - // Handle Replace-mode as a special case of insert mode. - { keys: 'R', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { replace: true }}, - { keys: 'u', type: 'action', action: 'undo', context: 'normal' }, - { keys: 'u', type: 'operator', operator: 'changeCase', operatorArgs: {toLower: true}, context: 'visual', isEdit: true }, - { keys: 'U', type: 'operator', operator: 'changeCase', operatorArgs: {toLower: false}, context: 'visual', isEdit: true }, - { 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: true, actionArgs: {increase: true, backtrack: false}}, - { keys: '', type: 'action', action: 'incrementNumberToken', isEdit: true, actionArgs: {increase: false, backtrack: false}}, - // Text object motions - { keys: 'a', type: 'motion', motion: 'textObjectManipulation' }, - { keys: 'i', type: 'motion', motion: 'textObjectManipulation', motionArgs: { textObjectInner: true }}, - // Search - { keys: '/', type: 'search', searchArgs: { forward: true, querySrc: 'prompt', toJumplist: true }}, - { keys: '?', type: 'search', searchArgs: { forward: false, querySrc: 'prompt', toJumplist: true }}, - { keys: '*', type: 'search', searchArgs: { forward: true, querySrc: 'wordUnderCursor', wholeWordOnly: true, toJumplist: true }}, - { keys: '#', type: 'search', searchArgs: { forward: false, querySrc: 'wordUnderCursor', wholeWordOnly: true, toJumplist: true }}, - { keys: 'g*', type: 'search', searchArgs: { forward: true, querySrc: 'wordUnderCursor', toJumplist: true }}, - { keys: 'g#', type: 'search', searchArgs: { forward: false, querySrc: 'wordUnderCursor', toJumplist: true }}, - // Ex command - { keys: ':', type: 'ex' } - ]; - - var Pos = CodeMirror.Pos; - - var Vim = function() { - function enterVimMode(cm) { - cm.setOption('disableInput', true); - cm.setOption('showCursorWhenSelecting', false); - CodeMirror.signal(cm, "vim-mode-change", {mode: "normal"}); - cm.on('cursorActivity', onCursorActivity); - maybeInitVimState(cm); - CodeMirror.on(cm.getInputField(), 'paste', getOnPasteFn(cm)); - } - - function leaveVimMode(cm) { - cm.setOption('disableInput', false); - cm.off('cursorActivity', onCursorActivity); - CodeMirror.off(cm.getInputField(), 'paste', getOnPasteFn(cm)); - cm.state.vim = null; - } - - function detachVimMap(cm, next) { - if (this == CodeMirror.keyMap.vim) - CodeMirror.rmClass(cm.getWrapperElement(), "cm-fat-cursor"); - - if (!next || next.attach != attachVimMap) - leaveVimMode(cm, false); - } - function attachVimMap(cm, prev) { - if (this == CodeMirror.keyMap.vim) - CodeMirror.addClass(cm.getWrapperElement(), "cm-fat-cursor"); - - if (!prev || prev.attach != attachVimMap) - enterVimMode(cm); - } - - // Deprecated, simply setting the keymap works again. - CodeMirror.defineOption('vimMode', false, function(cm, val, prev) { - if (val && cm.getOption("keyMap") != "vim") - cm.setOption("keyMap", "vim"); - else if (!val && prev != CodeMirror.Init && /^vim/.test(cm.getOption("keyMap"))) - cm.setOption("keyMap", "default"); - }); - - function cmKey(key, cm) { - if (!cm) { return undefined; } - var vimKey = cmKeyToVimKey(key); - if (!vimKey) { - return false; - } - var cmd = CodeMirror.Vim.findKey(cm, vimKey); - if (typeof cmd == 'function') { - CodeMirror.signal(cm, 'vim-keypress', vimKey); - } - return cmd; - } - - var modifiers = {'Shift': 'S', 'Ctrl': 'C', 'Alt': 'A', 'Cmd': 'D', 'Mod': 'A'}; - var specialKeys = {Enter:'CR',Backspace:'BS',Delete:'Del'}; - function cmKeyToVimKey(key) { - if (key.charAt(0) == '\'') { - // Keypress character binding of format "'a'" - return key.charAt(1); - } - var pieces = key.split('-'); - if (/-$/.test(key)) { - // If the - key was typed, split will result in 2 extra empty strings - // in the array. Replace them with 1 '-'. - pieces.splice(-2, 2, '-'); - } - var lastPiece = pieces[pieces.length - 1]; - if (pieces.length == 1 && pieces[0].length == 1) { - // No-modifier bindings use literal character bindings above. Skip. - return false; - } else if (pieces.length == 2 && pieces[0] == 'Shift' && lastPiece.length == 1) { - // Ignore Shift+char bindings as they should be handled by literal character. - return false; - } - var hasCharacter = false; - for (var i = 0; i < pieces.length; i++) { - var piece = pieces[i]; - if (piece in modifiers) { pieces[i] = modifiers[piece]; } - else { hasCharacter = true; } - if (piece in specialKeys) { pieces[i] = specialKeys[piece]; } - } - if (!hasCharacter) { - // Vim does not support modifier only keys. - return false; - } - // TODO: Current bindings expect the character to be lower case, but - // it looks like vim key notation uses upper case. - if (isUpperCase(lastPiece)) { - pieces[pieces.length - 1] = lastPiece.toLowerCase(); - } - return '<' + pieces.join('-') + '>'; - } - - function getOnPasteFn(cm) { - var vim = cm.state.vim; - if (!vim.onPasteFn) { - vim.onPasteFn = function() { - if (!vim.insertMode) { - cm.setCursor(offsetCursor(cm.getCursor(), 0, 1)); - actions.enterInsertMode(cm, {}, vim); - } - }; - } - return vim.onPasteFn; - } - - var numberRegex = /[\d]/; - var wordRegexp = [(/\w/), (/[^\w\s]/)], bigWordRegexp = [(/\S/)]; - function makeKeyRange(start, size) { - var keys = []; - for (var i = start; i < start + size; i++) { - keys.push(String.fromCharCode(i)); - } - return keys; - } - var upperCaseAlphabet = makeKeyRange(65, 26); - var lowerCaseAlphabet = makeKeyRange(97, 26); - var numbers = makeKeyRange(48, 10); - var validMarks = [].concat(upperCaseAlphabet, lowerCaseAlphabet, numbers, ['<', '>']); - var validRegisters = [].concat(upperCaseAlphabet, lowerCaseAlphabet, numbers, ['-', '"', '.', ':', '/']); - - function isLine(cm, line) { - return line >= cm.firstLine() && line <= cm.lastLine(); - } - function isLowerCase(k) { - return (/^[a-z]$/).test(k); - } - function isMatchableSymbol(k) { - return '()[]{}'.indexOf(k) != -1; - } - function isNumber(k) { - return numberRegex.test(k); - } - function isUpperCase(k) { - return (/^[A-Z]$/).test(k); - } - function isWhiteSpaceString(k) { - return (/^\s*$/).test(k); - } - function inArray(val, arr) { - for (var i = 0; i < arr.length; i++) { - if (arr[i] == val) { - return true; - } - } - return false; - } - - var options = {}; - function defineOption(name, defaultValue, type) { - if (defaultValue === undefined) { throw Error('defaultValue is required'); } - if (!type) { type = 'string'; } - options[name] = { - type: type, - defaultValue: defaultValue - }; - setOption(name, defaultValue); - } - - function setOption(name, value) { - var option = options[name]; - if (!option) { - throw Error('Unknown option: ' + name); - } - if (option.type == 'boolean') { - if (value && value !== true) { - throw Error('Invalid argument: ' + name + '=' + value); - } else if (value !== false) { - // Boolean options are set to true if value is not defined. - value = true; - } - } - option.value = option.type == 'boolean' ? !!value : value; - } - - function getOption(name) { - var option = options[name]; - if (!option) { - throw Error('Unknown option: ' + name); - } - return option.value; - } - - var createCircularJumpList = function() { - var size = 100; - var pointer = -1; - var head = 0; - var tail = 0; - var buffer = new Array(size); - function add(cm, oldCur, newCur) { - var current = pointer % size; - var curMark = buffer[current]; - function useNextSlot(cursor) { - var next = ++pointer % size; - var trashMark = buffer[next]; - if (trashMark) { - trashMark.clear(); - } - buffer[next] = cm.setBookmark(cursor); - } - if (curMark) { - var markPos = curMark.find(); - // avoid recording redundant cursor position - if (markPos && !cursorEqual(markPos, oldCur)) { - useNextSlot(oldCur); - } - } else { - useNextSlot(oldCur); - } - useNextSlot(newCur); - head = pointer; - tail = pointer - size + 1; - if (tail < 0) { - tail = 0; - } - } - function move(cm, offset) { - pointer += offset; - if (pointer > head) { - pointer = head; - } else if (pointer < tail) { - pointer = tail; - } - var mark = buffer[(size + pointer) % size]; - // skip marks that are temporarily removed from text buffer - if (mark && !mark.find()) { - var inc = offset > 0 ? 1 : -1; - var newCur; - var oldCur = cm.getCursor(); - do { - pointer += inc; - mark = buffer[(size + pointer) % size]; - // skip marks that are the same as current position - if (mark && - (newCur = mark.find()) && - !cursorEqual(oldCur, newCur)) { - break; - } - } while (pointer < head && pointer > tail); - } - return mark; - } - return { - cachedCursor: undefined, //used for # and * jumps - add: add, - move: move - }; - }; - - // Returns an object to track the changes associated insert mode. It - // clones the object that is passed in, or creates an empty object one if - // none is provided. - var createInsertModeChanges = function(c) { - if (c) { - // Copy construction - return { - changes: c.changes, - expectCursorActivityForChange: c.expectCursorActivityForChange - }; - } - return { - // Change list - changes: [], - // Set to true on change, false on cursorActivity. - expectCursorActivityForChange: false - }; - }; - - function MacroModeState() { - this.latestRegister = undefined; - this.isPlaying = false; - this.isRecording = false; - this.replaySearchQueries = []; - this.onRecordingDone = undefined; - this.lastInsertModeChanges = createInsertModeChanges(); - } - MacroModeState.prototype = { - exitMacroRecordMode: function() { - var macroModeState = vimGlobalState.macroModeState; - if (macroModeState.onRecordingDone) { - macroModeState.onRecordingDone(); // close dialog - } - macroModeState.onRecordingDone = undefined; - macroModeState.isRecording = false; - }, - enterMacroRecordMode: function(cm, registerName) { - var register = - vimGlobalState.registerController.getRegister(registerName); - if (register) { - register.clear(); - this.latestRegister = registerName; - if (cm.openDialog) { - this.onRecordingDone = cm.openDialog( - '(recording)['+registerName+']', null, {bottom:true}); - } - this.isRecording = true; - } - } - }; - - function maybeInitVimState(cm) { - if (!cm.state.vim) { - // Store instance state in the CodeMirror object. - cm.state.vim = { - inputState: new InputState(), - // Vim's input state that triggered the last edit, used to repeat - // motions and operators with '.'. - lastEditInputState: undefined, - // Vim's action command before the last edit, used to repeat actions - // with '.' and insert mode repeat. - lastEditActionCommand: undefined, - // When using jk for navigation, if you move from a longer line to a - // shorter line, the cursor may clip to the end of the shorter line. - // If j is pressed again and cursor goes to the next line, the - // cursor should go back to its horizontal position on the longer - // line if it can. This is to keep track of the horizontal position. - lastHPos: -1, - // Doing the same with screen-position for gj/gk - lastHSPos: -1, - // The last motion command run. Cleared if a non-motion command gets - // executed in between. - lastMotion: null, - marks: {}, - // Mark for rendering fake cursor for visual mode. - fakeCursor: null, - insertMode: false, - // Repeat count for changes made in insert mode, triggered by key - // sequences like 3,i. Only exists when insertMode is true. - insertModeRepeat: undefined, - visualMode: false, - // If we are in visual line mode. No effect if visualMode is false. - visualLine: false, - visualBlock: false, - lastSelection: null, - lastPastedText: null, - sel: { - } - }; - } - return cm.state.vim; - } - var vimGlobalState; - function resetVimGlobalState() { - vimGlobalState = { - // The current search query. - searchQuery: null, - // Whether we are searching backwards. - searchIsReversed: false, - // Replace part of the last substituted pattern - lastSubstituteReplacePart: undefined, - jumpList: createCircularJumpList(), - macroModeState: new MacroModeState, - // Recording latest f, t, F or T motion command. - lastChararacterSearch: {increment:0, forward:true, selectedCharacter:''}, - registerController: new RegisterController({}), - // search history buffer - searchHistoryController: new HistoryController({}), - // ex Command history buffer - exCommandHistoryController : new HistoryController({}) - }; - for (var optionName in options) { - var option = options[optionName]; - option.value = option.defaultValue; - } - } - - var lastInsertModeKeyTimer; - var vimApi= { - buildKeyMap: function() { - // TODO: Convert keymap into dictionary format for fast lookup. - }, - // Testing hook, though it might be useful to expose the register - // controller anyways. - getRegisterController: function() { - return vimGlobalState.registerController; - }, - // Testing hook. - resetVimGlobalState_: resetVimGlobalState, - - // Testing hook. - getVimGlobalState_: function() { - return vimGlobalState; - }, - - // Testing hook. - maybeInitVimState_: maybeInitVimState, - - suppressErrorLogging: false, - - InsertModeKey: InsertModeKey, - map: function(lhs, rhs, ctx) { - // Add user defined key bindings. - exCommandDispatcher.map(lhs, rhs, ctx); - }, - setOption: setOption, - getOption: getOption, - defineOption: defineOption, - defineEx: function(name, prefix, func){ - if (name.indexOf(prefix) !== 0) { - throw new Error('(Vim.defineEx) "'+prefix+'" is not a prefix of "'+name+'", command not registered'); - } - exCommands[name]=func; - exCommandDispatcher.commandMap_[prefix]={name:name, shortName:prefix, type:'api'}; - }, - handleKey: function (cm, key, origin) { - var command = this.findKey(cm, key, origin); - if (typeof command === 'function') { - return command(); - } - }, - /** - * This is the outermost function called by CodeMirror, after keys have - * been mapped to their Vim equivalents. - * - * Finds a command based on the key (and cached keys if there is a - * multi-key sequence). Returns `undefined` if no key is matched, a noop - * function if a partial match is found (multi-key), and a function to - * execute the bound command if a a key is matched. The function always - * returns true. - */ - findKey: function(cm, key, origin) { - var vim = maybeInitVimState(cm); - function handleMacroRecording() { - var macroModeState = vimGlobalState.macroModeState; - if (macroModeState.isRecording) { - if (key == 'q') { - macroModeState.exitMacroRecordMode(); - clearInputState(cm); - return true; - } - if (origin != 'mapping') { - logKey(macroModeState, key); - } - } - } - function handleEsc() { - if (key == '') { - // Clear input state and get back to normal mode. - clearInputState(cm); - if (vim.visualMode) { - exitVisualMode(cm); - } else if (vim.insertMode) { - exitInsertMode(cm); - } - return true; - } - } - function doKeyToKey(keys) { - // TODO: prevent infinite recursion. - var match; - while (keys) { - // Pull off one command key, which is either a single character - // or a special sequence wrapped in '<' and '>', e.g. ''. - match = (/<\w+-.+?>|<\w+>|./).exec(keys); - key = match[0]; - keys = keys.substring(match.index + key.length); - CodeMirror.Vim.handleKey(cm, key, 'mapping'); - } - } - - function handleKeyInsertMode() { - if (handleEsc()) { return true; } - var keys = vim.inputState.keyBuffer = vim.inputState.keyBuffer + key; - var keysAreChars = key.length == 1; - var match = commandDispatcher.matchCommand(keys, defaultKeymap, vim.inputState, 'insert'); - // Need to check all key substrings in insert mode. - while (keys.length > 1 && match.type != 'full') { - var keys = vim.inputState.keyBuffer = keys.slice(1); - var thisMatch = commandDispatcher.matchCommand(keys, defaultKeymap, vim.inputState, 'insert'); - if (thisMatch.type != 'none') { match = thisMatch; } - } - if (match.type == 'none') { clearInputState(cm); return false; } - else if (match.type == 'partial') { - if (lastInsertModeKeyTimer) { window.clearTimeout(lastInsertModeKeyTimer); } - lastInsertModeKeyTimer = window.setTimeout( - function() { if (vim.insertMode && vim.inputState.keyBuffer) { clearInputState(cm); } }, - getOption('insertModeEscKeysTimeout')); - return !keysAreChars; - } - - if (lastInsertModeKeyTimer) { window.clearTimeout(lastInsertModeKeyTimer); } - if (keysAreChars) { - var here = cm.getCursor(); - cm.replaceRange('', offsetCursor(here, 0, -(keys.length - 1)), here, '+input'); - } - clearInputState(cm); - return match.command; - } - - function handleKeyNonInsertMode() { - if (handleMacroRecording() || handleEsc()) { return true; }; - - var keys = vim.inputState.keyBuffer = vim.inputState.keyBuffer + key; - if (/^[1-9]\d*$/.test(keys)) { return true; } - - var keysMatcher = /^(\d*)(.*)$/.exec(keys); - if (!keysMatcher) { clearInputState(cm); return false; } - var context = vim.visualMode ? 'visual' : - 'normal'; - var match = commandDispatcher.matchCommand(keysMatcher[2] || keysMatcher[1], defaultKeymap, vim.inputState, context); - if (match.type == 'none') { clearInputState(cm); return false; } - else if (match.type == 'partial') { return true; } - - vim.inputState.keyBuffer = ''; - var keysMatcher = /^(\d*)(.*)$/.exec(keys); - if (keysMatcher[1] && keysMatcher[1] != '0') { - vim.inputState.pushRepeatDigit(keysMatcher[1]); - } - return match.command; - } - - var command; - if (vim.insertMode) { command = handleKeyInsertMode(); } - else { command = handleKeyNonInsertMode(); } - if (command === false) { - return undefined; - } else if (command === true) { - // TODO: Look into using CodeMirror's multi-key handling. - // Return no-op since we are caching the key. Counts as handled, but - // don't want act on it just yet. - return function() {}; - } else { - return function() { - return cm.operation(function() { - cm.curOp.isVimOp = true; - try { - if (command.type == 'keyToKey') { - doKeyToKey(command.toKeys); - } else { - commandDispatcher.processCommand(cm, vim, command); - } - } catch (e) { - // clear VIM state in case it's in a bad state. - cm.state.vim = undefined; - maybeInitVimState(cm); - if (!CodeMirror.Vim.suppressErrorLogging) { - console['log'](e); - } - throw e; - } - return true; - }); - }; - } - }, - handleEx: function(cm, input) { - exCommandDispatcher.processCommand(cm, input); - } - }; - - // Represents the current input state. - function InputState() { - this.prefixRepeat = []; - this.motionRepeat = []; - - this.operator = null; - this.operatorArgs = null; - this.motion = null; - this.motionArgs = null; - this.keyBuffer = []; // For matching multi-key commands. - this.registerName = null; // Defaults to the unnamed register. - } - InputState.prototype.pushRepeatDigit = function(n) { - if (!this.operator) { - this.prefixRepeat = this.prefixRepeat.concat(n); - } else { - this.motionRepeat = this.motionRepeat.concat(n); - } - }; - InputState.prototype.getRepeat = function() { - var repeat = 0; - if (this.prefixRepeat.length > 0 || this.motionRepeat.length > 0) { - repeat = 1; - if (this.prefixRepeat.length > 0) { - repeat *= parseInt(this.prefixRepeat.join(''), 10); - } - if (this.motionRepeat.length > 0) { - repeat *= parseInt(this.motionRepeat.join(''), 10); - } - } - return repeat; - }; - - function clearInputState(cm, reason) { - cm.state.vim.inputState = new InputState(); - CodeMirror.signal(cm, 'vim-command-done', reason); - } - - /* - * Register stores information about copy and paste registers. Besides - * text, a register must store whether it is linewise (i.e., when it is - * pasted, should it insert itself into a new line, or should the text be - * inserted at the cursor position.) - */ - function Register(text, linewise, blockwise) { - this.clear(); - this.keyBuffer = [text || '']; - this.insertModeChanges = []; - this.searchQueries = []; - this.linewise = !!linewise; - this.blockwise = !!blockwise; - } - Register.prototype = { - setText: function(text, linewise, blockwise) { - this.keyBuffer = [text || '']; - this.linewise = !!linewise; - this.blockwise = !!blockwise; - }, - pushText: function(text, linewise) { - // if this register has ever been set to linewise, use linewise. - if (linewise) { - if (!this.linewise) { - this.keyBuffer.push('\n'); - } - this.linewise = true; - } - this.keyBuffer.push(text); - }, - pushInsertModeChanges: function(changes) { - this.insertModeChanges.push(createInsertModeChanges(changes)); - }, - pushSearchQuery: function(query) { - this.searchQueries.push(query); - }, - clear: function() { - this.keyBuffer = []; - this.insertModeChanges = []; - this.searchQueries = []; - this.linewise = false; - }, - toString: function() { - return this.keyBuffer.join(''); - } - }; - - /* - * vim registers allow you to keep many independent copy and paste buffers. - * See http://usevim.com/2012/04/13/registers/ for an introduction. - * - * RegisterController keeps the state of all the registers. An initial - * state may be passed in. The unnamed register '"' will always be - * overridden. - */ - function RegisterController(registers) { - this.registers = registers; - this.unnamedRegister = registers['"'] = new Register(); - registers['.'] = new Register(); - registers[':'] = new Register(); - registers['/'] = new Register(); - } - RegisterController.prototype = { - pushText: function(registerName, operator, text, linewise, blockwise) { - if (linewise && text.charAt(0) == '\n') { - text = text.slice(1) + '\n'; - } - if (linewise && text.charAt(text.length - 1) !== '\n'){ - text += '\n'; - } - // Lowercase and uppercase registers refer to the same register. - // Uppercase just means append. - var register = this.isValidRegister(registerName) ? - this.getRegister(registerName) : null; - // if no register/an invalid register was specified, things go to the - // default registers - if (!register) { - switch (operator) { - case 'yank': - // The 0 register contains the text from the most recent yank. - this.registers['0'] = new Register(text, linewise, blockwise); - break; - case 'delete': - case 'change': - if (text.indexOf('\n') == -1) { - // Delete less than 1 line. Update the small delete register. - this.registers['-'] = new Register(text, linewise); - } else { - // Shift down the contents of the numbered registers and put the - // deleted text into register 1. - this.shiftNumericRegisters_(); - this.registers['1'] = new Register(text, linewise); - } - break; - } - // Make sure the unnamed register is set to what just happened - this.unnamedRegister.setText(text, linewise, blockwise); - return; - } - - // If we've gotten to this point, we've actually specified a register - var append = isUpperCase(registerName); - if (append) { - register.pushText(text, linewise); - } else { - register.setText(text, linewise, blockwise); - } - // The unnamed register always has the same value as the last used - // register. - this.unnamedRegister.setText(register.toString(), linewise); - }, - // Gets the register named @name. If one of @name doesn't already exist, - // create it. If @name is invalid, return the unnamedRegister. - getRegister: function(name) { - if (!this.isValidRegister(name)) { - return this.unnamedRegister; - } - name = name.toLowerCase(); - if (!this.registers[name]) { - this.registers[name] = new Register(); - } - return this.registers[name]; - }, - isValidRegister: function(name) { - return name && inArray(name, validRegisters); - }, - shiftNumericRegisters_: function() { - for (var i = 9; i >= 2; i--) { - this.registers[i] = this.getRegister('' + (i - 1)); - } - } - }; - function HistoryController() { - this.historyBuffer = []; - this.iterator; - this.initialPrefix = null; - } - HistoryController.prototype = { - // the input argument here acts a user entered prefix for a small time - // until we start autocompletion in which case it is the autocompleted. - nextMatch: function (input, up) { - var historyBuffer = this.historyBuffer; - var dir = up ? -1 : 1; - if (this.initialPrefix === null) this.initialPrefix = input; - for (var i = this.iterator + dir; up ? i >= 0 : i < historyBuffer.length; i+= dir) { - var element = historyBuffer[i]; - for (var j = 0; j <= element.length; j++) { - if (this.initialPrefix == element.substring(0, j)) { - this.iterator = i; - return element; - } - } - } - // should return the user input in case we reach the end of buffer. - if (i >= historyBuffer.length) { - this.iterator = historyBuffer.length; - return this.initialPrefix; - } - // return the last autocompleted query or exCommand as it is. - if (i < 0 ) return input; - }, - pushInput: function(input) { - var index = this.historyBuffer.indexOf(input); - if (index > -1) this.historyBuffer.splice(index, 1); - if (input.length) this.historyBuffer.push(input); - }, - reset: function() { - this.initialPrefix = null; - this.iterator = this.historyBuffer.length; - } - }; - var commandDispatcher = { - matchCommand: function(keys, keyMap, inputState, context) { - var matches = commandMatches(keys, keyMap, context, inputState); - if (!matches.full && !matches.partial) { - return {type: 'none'}; - } else if (!matches.full && matches.partial) { - return {type: 'partial'}; - } - - var bestMatch; - for (var i = 0; i < matches.full.length; i++) { - var match = matches.full[i]; - if (!bestMatch) { - bestMatch = match; - } - } - if (bestMatch.keys.slice(-11) == '') { - inputState.selectedCharacter = lastChar(keys); - } - return {type: 'full', command: bestMatch}; - }, - processCommand: function(cm, vim, command) { - vim.inputState.repeatOverride = command.repeatOverride; - switch (command.type) { - case 'motion': - this.processMotion(cm, vim, command); - break; - case 'operator': - this.processOperator(cm, vim, command); - break; - case 'operatorMotion': - this.processOperatorMotion(cm, vim, command); - break; - case 'action': - this.processAction(cm, vim, command); - break; - case 'search': - this.processSearch(cm, vim, command); - clearInputState(cm); - break; - case 'ex': - case 'keyToEx': - this.processEx(cm, vim, command); - clearInputState(cm); - break; - default: - break; - } - }, - processMotion: function(cm, vim, command) { - vim.inputState.motion = command.motion; - vim.inputState.motionArgs = copyArgs(command.motionArgs); - this.evalInput(cm, vim); - }, - processOperator: function(cm, vim, command) { - var inputState = vim.inputState; - if (inputState.operator) { - if (inputState.operator == command.operator) { - // Typing an operator twice like 'dd' makes the operator operate - // linewise - inputState.motion = 'expandToLine'; - inputState.motionArgs = { linewise: true }; - this.evalInput(cm, vim); - return; - } else { - // 2 different operators in a row doesn't make sense. - clearInputState(cm); - } - } - inputState.operator = command.operator; - inputState.operatorArgs = copyArgs(command.operatorArgs); - if (vim.visualMode) { - // Operating on a selection in visual mode. We don't need a motion. - this.evalInput(cm, vim); - } - }, - processOperatorMotion: function(cm, vim, command) { - var visualMode = vim.visualMode; - var operatorMotionArgs = copyArgs(command.operatorMotionArgs); - if (operatorMotionArgs) { - // Operator motions may have special behavior in visual mode. - if (visualMode && operatorMotionArgs.visualLine) { - vim.visualLine = true; - } - } - this.processOperator(cm, vim, command); - if (!visualMode) { - this.processMotion(cm, vim, command); - } - }, - processAction: function(cm, vim, command) { - var inputState = vim.inputState; - var repeat = inputState.getRepeat(); - var repeatIsExplicit = !!repeat; - var actionArgs = copyArgs(command.actionArgs) || {}; - if (inputState.selectedCharacter) { - actionArgs.selectedCharacter = inputState.selectedCharacter; - } - // Actions may or may not have motions and operators. Do these first. - if (command.operator) { - this.processOperator(cm, vim, command); - } - if (command.motion) { - this.processMotion(cm, vim, command); - } - if (command.motion || command.operator) { - this.evalInput(cm, vim); - } - actionArgs.repeat = repeat || 1; - actionArgs.repeatIsExplicit = repeatIsExplicit; - actionArgs.registerName = inputState.registerName; - clearInputState(cm); - vim.lastMotion = null; - if (command.isEdit) { - this.recordLastEdit(vim, inputState, command); - } - actions[command.action](cm, actionArgs, vim); - }, - processSearch: function(cm, vim, command) { - if (!cm.getSearchCursor) { - // Search depends on SearchCursor. - return; - } - var forward = command.searchArgs.forward; - var wholeWordOnly = command.searchArgs.wholeWordOnly; - getSearchState(cm).setReversed(!forward); - var promptPrefix = (forward) ? '/' : '?'; - var originalQuery = getSearchState(cm).getQuery(); - var originalScrollPos = cm.getScrollInfo(); - function handleQuery(query, ignoreCase, smartCase) { - vimGlobalState.searchHistoryController.pushInput(query); - vimGlobalState.searchHistoryController.reset(); - try { - updateSearchQuery(cm, query, ignoreCase, smartCase); - } catch (e) { - showConfirm(cm, 'Invalid regex: ' + query); - return; - } - commandDispatcher.processMotion(cm, vim, { - type: 'motion', - motion: 'findNext', - motionArgs: { forward: true, toJumplist: command.searchArgs.toJumplist } - }); - } - function onPromptClose(query) { - cm.scrollTo(originalScrollPos.left, originalScrollPos.top); - handleQuery(query, true /** ignoreCase */, true /** smartCase */); - var macroModeState = vimGlobalState.macroModeState; - if (macroModeState.isRecording) { - logSearchQuery(macroModeState, query); - } - } - function onPromptKeyUp(e, query, close) { - var keyName = CodeMirror.keyName(e), up; - if (keyName == 'Up' || keyName == 'Down') { - up = keyName == 'Up' ? true : false; - query = vimGlobalState.searchHistoryController.nextMatch(query, up) || ''; - close(query); - } else { - if ( keyName != 'Left' && keyName != 'Right' && keyName != 'Ctrl' && keyName != 'Alt' && keyName != 'Shift') - vimGlobalState.searchHistoryController.reset(); - } - var parsedQuery; - try { - parsedQuery = updateSearchQuery(cm, query, - true /** ignoreCase */, true /** smartCase */); - } catch (e) { - // Swallow bad regexes for incremental search. - } - if (parsedQuery) { - cm.scrollIntoView(findNext(cm, !forward, parsedQuery), 30); - } else { - clearSearchHighlight(cm); - cm.scrollTo(originalScrollPos.left, originalScrollPos.top); - } - } - function onPromptKeyDown(e, query, close) { - var keyName = CodeMirror.keyName(e); - if (keyName == 'Esc' || keyName == 'Ctrl-C' || keyName == 'Ctrl-[') { - vimGlobalState.searchHistoryController.pushInput(query); - vimGlobalState.searchHistoryController.reset(); - updateSearchQuery(cm, originalQuery); - clearSearchHighlight(cm); - cm.scrollTo(originalScrollPos.left, originalScrollPos.top); - CodeMirror.e_stop(e); - close(); - cm.focus(); - } - } - switch (command.searchArgs.querySrc) { - case 'prompt': - var macroModeState = vimGlobalState.macroModeState; - if (macroModeState.isPlaying) { - var query = macroModeState.replaySearchQueries.shift(); - handleQuery(query, true /** ignoreCase */, false /** smartCase */); - } else { - showPrompt(cm, { - onClose: onPromptClose, - prefix: promptPrefix, - desc: searchPromptDesc, - onKeyUp: onPromptKeyUp, - onKeyDown: onPromptKeyDown - }); - } - break; - case 'wordUnderCursor': - var word = expandWordUnderCursor(cm, false /** inclusive */, - true /** forward */, false /** bigWord */, - true /** noSymbol */); - var isKeyword = true; - if (!word) { - word = expandWordUnderCursor(cm, false /** inclusive */, - true /** forward */, false /** bigWord */, - false /** noSymbol */); - isKeyword = false; - } - if (!word) { - return; - } - var query = cm.getLine(word.start.line).substring(word.start.ch, - word.end.ch); - if (isKeyword && wholeWordOnly) { - query = '\\b' + query + '\\b'; - } else { - query = escapeRegex(query); - } - - // cachedCursor is used to save the old position of the cursor - // when * or # causes vim to seek for the nearest word and shift - // the cursor before entering the motion. - vimGlobalState.jumpList.cachedCursor = cm.getCursor(); - cm.setCursor(word.start); - - handleQuery(query, true /** ignoreCase */, false /** smartCase */); - break; - } - }, - processEx: function(cm, vim, command) { - function onPromptClose(input) { - // Give the prompt some time to close so that if processCommand shows - // an error, the elements don't overlap. - vimGlobalState.exCommandHistoryController.pushInput(input); - vimGlobalState.exCommandHistoryController.reset(); - exCommandDispatcher.processCommand(cm, input); - } - function onPromptKeyDown(e, input, close) { - var keyName = CodeMirror.keyName(e), up; - if (keyName == 'Esc' || keyName == 'Ctrl-C' || keyName == 'Ctrl-[') { - vimGlobalState.exCommandHistoryController.pushInput(input); - vimGlobalState.exCommandHistoryController.reset(); - CodeMirror.e_stop(e); - close(); - cm.focus(); - } - if (keyName == 'Up' || keyName == 'Down') { - up = keyName == 'Up' ? true : false; - input = vimGlobalState.exCommandHistoryController.nextMatch(input, up) || ''; - close(input); - } else { - if ( keyName != 'Left' && keyName != 'Right' && keyName != 'Ctrl' && keyName != 'Alt' && keyName != 'Shift') - vimGlobalState.exCommandHistoryController.reset(); - } - } - if (command.type == 'keyToEx') { - // Handle user defined Ex to Ex mappings - exCommandDispatcher.processCommand(cm, command.exArgs.input); - } else { - if (vim.visualMode) { - showPrompt(cm, { onClose: onPromptClose, prefix: ':', value: '\'<,\'>', - onKeyDown: onPromptKeyDown}); - } else { - showPrompt(cm, { onClose: onPromptClose, prefix: ':', - onKeyDown: onPromptKeyDown}); - } - } - }, - evalInput: function(cm, vim) { - // If the motion comand is set, execute both the operator and motion. - // Otherwise return. - var inputState = vim.inputState; - var motion = inputState.motion; - var motionArgs = inputState.motionArgs || {}; - var operator = inputState.operator; - var operatorArgs = inputState.operatorArgs || {}; - var registerName = inputState.registerName; - var sel = vim.sel; - // TODO: Make sure cm and vim selections are identical outside visual mode. - var origHead = copyCursor(vim.visualMode ? sel.head: cm.getCursor('head')); - var origAnchor = copyCursor(vim.visualMode ? sel.anchor : cm.getCursor('anchor')); - var oldHead = copyCursor(origHead); - var oldAnchor = copyCursor(origAnchor); - var newHead, newAnchor; - var repeat; - if (operator) { - this.recordLastEdit(vim, inputState); - } - if (inputState.repeatOverride !== undefined) { - // If repeatOverride is specified, that takes precedence over the - // input state's repeat. Used by Ex mode and can be user defined. - repeat = inputState.repeatOverride; - } else { - repeat = inputState.getRepeat(); - } - if (repeat > 0 && motionArgs.explicitRepeat) { - motionArgs.repeatIsExplicit = true; - } else if (motionArgs.noRepeat || - (!motionArgs.explicitRepeat && repeat === 0)) { - repeat = 1; - motionArgs.repeatIsExplicit = false; - } - if (inputState.selectedCharacter) { - // If there is a character input, stick it in all of the arg arrays. - motionArgs.selectedCharacter = operatorArgs.selectedCharacter = - inputState.selectedCharacter; - } - motionArgs.repeat = repeat; - clearInputState(cm); - if (motion) { - var motionResult = motions[motion](cm, origHead, motionArgs, vim); - vim.lastMotion = motions[motion]; - if (!motionResult) { - return; - } - if (motionArgs.toJumplist) { - var jumpList = vimGlobalState.jumpList; - // if the current motion is # or *, use cachedCursor - var cachedCursor = jumpList.cachedCursor; - if (cachedCursor) { - recordJumpPosition(cm, cachedCursor, motionResult); - delete jumpList.cachedCursor; - } else { - recordJumpPosition(cm, origHead, motionResult); - } - } - if (motionResult instanceof Array) { - newAnchor = motionResult[0]; - newHead = motionResult[1]; - } else { - newHead = motionResult; - } - // TODO: Handle null returns from motion commands better. - if (!newHead) { - newHead = copyCursor(origHead); - } - if (vim.visualMode) { - if (!(vim.visualBlock && newHead.ch === Infinity)) { - newHead = clipCursorToContent(cm, newHead, vim.visualBlock); - } - if (newAnchor) { - newAnchor = clipCursorToContent(cm, newAnchor, true); - } - newAnchor = newAnchor || oldAnchor; - sel.anchor = newAnchor; - sel.head = newHead; - updateCmSelection(cm); - updateMark(cm, vim, '<', - cursorIsBefore(newAnchor, newHead) ? newAnchor - : newHead); - updateMark(cm, vim, '>', - cursorIsBefore(newAnchor, newHead) ? newHead - : newAnchor); - } else if (!operator) { - newHead = clipCursorToContent(cm, newHead); - cm.setCursor(newHead.line, newHead.ch); - } - } - if (operator) { - if (operatorArgs.lastSel) { - // Replaying a visual mode operation - newAnchor = oldAnchor; - var lastSel = operatorArgs.lastSel; - var lineOffset = Math.abs(lastSel.head.line - lastSel.anchor.line); - var chOffset = Math.abs(lastSel.head.ch - lastSel.anchor.ch); - if (lastSel.visualLine) { - // Linewise Visual mode: The same number of lines. - newHead = Pos(oldAnchor.line + lineOffset, oldAnchor.ch); - } else if (lastSel.visualBlock) { - // Blockwise Visual mode: The same number of lines and columns. - newHead = Pos(oldAnchor.line + lineOffset, oldAnchor.ch + chOffset); - } else if (lastSel.head.line == lastSel.anchor.line) { - // Normal Visual mode within one line: The same number of characters. - newHead = Pos(oldAnchor.line, oldAnchor.ch + chOffset); - } else { - // Normal Visual mode with several lines: The same number of lines, in the - // last line the same number of characters as in the last line the last time. - newHead = Pos(oldAnchor.line + lineOffset, oldAnchor.ch); - } - vim.visualMode = true; - vim.visualLine = lastSel.visualLine; - vim.visualBlock = lastSel.visualBlock; - sel = vim.sel = { - anchor: newAnchor, - head: newHead - }; - updateCmSelection(cm); - } else if (vim.visualMode) { - operatorArgs.lastSel = { - anchor: copyCursor(sel.anchor), - head: copyCursor(sel.head), - visualBlock: vim.visualBlock, - visualLine: vim.visualLine - }; - } - var curStart, curEnd, linewise, mode; - var cmSel; - if (vim.visualMode) { - // Init visual op - curStart = cursorMin(sel.head, sel.anchor); - curEnd = cursorMax(sel.head, sel.anchor); - linewise = vim.visualLine || operatorArgs.linewise; - mode = vim.visualBlock ? 'block' : - linewise ? 'line' : - 'char'; - cmSel = makeCmSelection(cm, { - anchor: curStart, - head: curEnd - }, mode); - if (linewise) { - var ranges = cmSel.ranges; - if (mode == 'block') { - // Linewise operators in visual block mode extend to end of line - for (var i = 0; i < ranges.length; i++) { - ranges[i].head.ch = lineLength(cm, ranges[i].head.line); - } - } else if (mode == 'line') { - ranges[0].head = Pos(ranges[0].head.line + 1, 0); - } - } - } else { - // Init motion op - curStart = copyCursor(newAnchor || oldAnchor); - curEnd = copyCursor(newHead || oldHead); - if (cursorIsBefore(curEnd, curStart)) { - var tmp = curStart; - curStart = curEnd; - curEnd = tmp; - } - linewise = motionArgs.linewise || operatorArgs.linewise; - if (linewise) { - // Expand selection to entire line. - expandSelectionToLine(cm, curStart, curEnd); - } else if (motionArgs.forward) { - // Clip to trailing newlines only if the motion goes forward. - clipToLine(cm, curStart, curEnd); - } - mode = 'char'; - var exclusive = !motionArgs.inclusive || linewise; - cmSel = makeCmSelection(cm, { - anchor: curStart, - head: curEnd - }, mode, exclusive); - } - cm.setSelections(cmSel.ranges, cmSel.primary); - vim.lastMotion = null; - operatorArgs.repeat = repeat; // For indent in visual mode. - operatorArgs.registerName = registerName; - // Keep track of linewise as it affects how paste and change behave. - operatorArgs.linewise = linewise; - var operatorMoveTo = operators[operator]( - cm, operatorArgs, cmSel.ranges, oldAnchor, newHead); - if (vim.visualMode) { - exitVisualMode(cm); - } - if (operatorMoveTo) { - cm.setCursor(operatorMoveTo); - } - } - }, - recordLastEdit: function(vim, inputState, actionCommand) { - var macroModeState = vimGlobalState.macroModeState; - if (macroModeState.isPlaying) { return; } - vim.lastEditInputState = inputState; - vim.lastEditActionCommand = actionCommand; - macroModeState.lastInsertModeChanges.changes = []; - macroModeState.lastInsertModeChanges.expectCursorActivityForChange = false; - } - }; - - /** - * typedef {Object{line:number,ch:number}} Cursor An object containing the - * position of the cursor. - */ - // All of the functions below return Cursor objects. - var motions = { - moveToTopLine: function(cm, _head, motionArgs) { - var line = getUserVisibleLines(cm).top + motionArgs.repeat -1; - return Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line))); - }, - moveToMiddleLine: function(cm) { - var range = getUserVisibleLines(cm); - var line = Math.floor((range.top + range.bottom) * 0.5); - return Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line))); - }, - moveToBottomLine: function(cm, _head, motionArgs) { - var line = getUserVisibleLines(cm).bottom - motionArgs.repeat +1; - return Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line))); - }, - expandToLine: function(_cm, head, motionArgs) { - // Expands forward to end of line, and then to next line if repeat is - // >1. Does not handle backward motion! - var cur = head; - return Pos(cur.line + motionArgs.repeat - 1, Infinity); - }, - findNext: function(cm, _head, motionArgs) { - var state = getSearchState(cm); - var query = state.getQuery(); - if (!query) { - return; - } - var prev = !motionArgs.forward; - // If search is initiated with ? instead of /, negate direction. - prev = (state.isReversed()) ? !prev : prev; - highlightSearchMatches(cm, query); - return findNext(cm, prev/** prev */, query, motionArgs.repeat); - }, - goToMark: function(cm, _head, motionArgs, vim) { - var mark = vim.marks[motionArgs.selectedCharacter]; - if (mark) { - var pos = mark.find(); - return motionArgs.linewise ? { line: pos.line, ch: findFirstNonWhiteSpaceCharacter(cm.getLine(pos.line)) } : pos; - } - return null; - }, - moveToOtherHighlightedEnd: function(cm, _head, motionArgs, vim) { - if (vim.visualBlock && motionArgs.sameLine) { - var sel = vim.sel; - return [ - clipCursorToContent(cm, Pos(sel.anchor.line, sel.head.ch)), - clipCursorToContent(cm, Pos(sel.head.line, sel.anchor.ch)) - ]; - } else { - return ([vim.sel.head, vim.sel.anchor]); - } - }, - jumpToMark: function(cm, head, motionArgs, vim) { - var best = head; - for (var i = 0; i < motionArgs.repeat; i++) { - var cursor = best; - for (var key in vim.marks) { - if (!isLowerCase(key)) { - continue; - } - var mark = vim.marks[key].find(); - var isWrongDirection = (motionArgs.forward) ? - cursorIsBefore(mark, cursor) : cursorIsBefore(cursor, mark); - - if (isWrongDirection) { - continue; - } - if (motionArgs.linewise && (mark.line == cursor.line)) { - continue; - } - - var equal = cursorEqual(cursor, best); - var between = (motionArgs.forward) ? - cursorIsBetween(cursor, mark, best) : - cursorIsBetween(best, mark, cursor); - - if (equal || between) { - best = mark; - } - } - } - - if (motionArgs.linewise) { - // Vim places the cursor on the first non-whitespace character of - // the line if there is one, else it places the cursor at the end - // of the line, regardless of whether a mark was found. - best = Pos(best.line, findFirstNonWhiteSpaceCharacter(cm.getLine(best.line))); - } - return best; - }, - moveByCharacters: function(_cm, head, motionArgs) { - var cur = head; - var repeat = motionArgs.repeat; - var ch = motionArgs.forward ? cur.ch + repeat : cur.ch - repeat; - return Pos(cur.line, ch); - }, - moveByLines: function(cm, head, motionArgs, vim) { - var cur = head; - var endCh = cur.ch; - // Depending what our last motion was, we may want to do different - // things. If our last motion was moving vertically, we want to - // preserve the HPos from our last horizontal move. If our last motion - // was going to the end of a line, moving vertically we should go to - // the end of the line, etc. - switch (vim.lastMotion) { - case this.moveByLines: - case this.moveByDisplayLines: - case this.moveByScroll: - case this.moveToColumn: - case this.moveToEol: - endCh = vim.lastHPos; - break; - default: - vim.lastHPos = endCh; - } - var repeat = motionArgs.repeat+(motionArgs.repeatOffset||0); - var line = motionArgs.forward ? cur.line + repeat : cur.line - repeat; - var first = cm.firstLine(); - var last = cm.lastLine(); - // Vim cancels linewise motions that start on an edge and move beyond - // that edge. It does not cancel motions that do not start on an edge. - if ((line < first && cur.line == first) || - (line > last && cur.line == last)) { - return; - } - if (motionArgs.toFirstChar){ - endCh=findFirstNonWhiteSpaceCharacter(cm.getLine(line)); - vim.lastHPos = endCh; - } - vim.lastHSPos = cm.charCoords(Pos(line, endCh),'div').left; - return Pos(line, endCh); - }, - moveByDisplayLines: function(cm, head, motionArgs, vim) { - var cur = head; - switch (vim.lastMotion) { - case this.moveByDisplayLines: - case this.moveByScroll: - case this.moveByLines: - case this.moveToColumn: - case this.moveToEol: - break; - default: - vim.lastHSPos = cm.charCoords(cur,'div').left; - } - var repeat = motionArgs.repeat; - var res=cm.findPosV(cur,(motionArgs.forward ? repeat : -repeat),'line',vim.lastHSPos); - if (res.hitSide) { - if (motionArgs.forward) { - var lastCharCoords = cm.charCoords(res, 'div'); - var goalCoords = { top: lastCharCoords.top + 8, left: vim.lastHSPos }; - var res = cm.coordsChar(goalCoords, 'div'); - } else { - var resCoords = cm.charCoords(Pos(cm.firstLine(), 0), 'div'); - resCoords.left = vim.lastHSPos; - res = cm.coordsChar(resCoords, 'div'); - } - } - vim.lastHPos = res.ch; - return res; - }, - moveByPage: function(cm, head, motionArgs) { - // CodeMirror only exposes functions that move the cursor page down, so - // doing this bad hack to move the cursor and move it back. evalInput - // will move the cursor to where it should be in the end. - var curStart = head; - var repeat = motionArgs.repeat; - return cm.findPosV(curStart, (motionArgs.forward ? repeat : -repeat), 'page'); - }, - moveByParagraph: function(cm, head, motionArgs) { - var dir = motionArgs.forward ? 1 : -1; - return findParagraph(cm, head, motionArgs.repeat, dir); - }, - moveByScroll: function(cm, head, motionArgs, vim) { - var scrollbox = cm.getScrollInfo(); - var curEnd = null; - var repeat = motionArgs.repeat; - if (!repeat) { - repeat = scrollbox.clientHeight / (2 * cm.defaultTextHeight()); - } - var orig = cm.charCoords(head, 'local'); - motionArgs.repeat = repeat; - var curEnd = motions.moveByDisplayLines(cm, head, motionArgs, vim); - if (!curEnd) { - return null; - } - var dest = cm.charCoords(curEnd, 'local'); - cm.scrollTo(null, scrollbox.top + dest.top - orig.top); - return curEnd; - }, - moveByWords: function(cm, head, motionArgs) { - return moveToWord(cm, head, motionArgs.repeat, !!motionArgs.forward, - !!motionArgs.wordEnd, !!motionArgs.bigWord); - }, - moveTillCharacter: function(cm, _head, motionArgs) { - var repeat = motionArgs.repeat; - var curEnd = moveToCharacter(cm, repeat, motionArgs.forward, - motionArgs.selectedCharacter); - var increment = motionArgs.forward ? -1 : 1; - recordLastCharacterSearch(increment, motionArgs); - if (!curEnd) return null; - curEnd.ch += increment; - return curEnd; - }, - moveToCharacter: function(cm, head, motionArgs) { - var repeat = motionArgs.repeat; - recordLastCharacterSearch(0, motionArgs); - return moveToCharacter(cm, repeat, motionArgs.forward, - motionArgs.selectedCharacter) || head; - }, - moveToSymbol: function(cm, head, motionArgs) { - var repeat = motionArgs.repeat; - return findSymbol(cm, repeat, motionArgs.forward, - motionArgs.selectedCharacter) || head; - }, - moveToColumn: function(cm, head, motionArgs, vim) { - var repeat = motionArgs.repeat; - // repeat is equivalent to which column we want to move to! - vim.lastHPos = repeat - 1; - vim.lastHSPos = cm.charCoords(head,'div').left; - return moveToColumn(cm, repeat); - }, - moveToEol: function(cm, head, motionArgs, vim) { - var cur = head; - vim.lastHPos = Infinity; - var retval= Pos(cur.line + motionArgs.repeat - 1, Infinity); - var end=cm.clipPos(retval); - end.ch--; - vim.lastHSPos = cm.charCoords(end,'div').left; - return retval; - }, - moveToFirstNonWhiteSpaceCharacter: function(cm, head) { - // Go to the start of the line where the text begins, or the end for - // whitespace-only lines - var cursor = head; - return Pos(cursor.line, - findFirstNonWhiteSpaceCharacter(cm.getLine(cursor.line))); - }, - moveToMatchedSymbol: function(cm, head) { - var cursor = head; - var line = cursor.line; - var ch = cursor.ch; - var lineText = cm.getLine(line); - var symbol; - do { - symbol = lineText.charAt(ch++); - if (symbol && isMatchableSymbol(symbol)) { - var style = cm.getTokenTypeAt(Pos(line, ch)); - if (style !== "string" && style !== "comment") { - break; - } - } - } while (symbol); - if (symbol) { - var matched = cm.findMatchingBracket(Pos(line, ch)); - return matched.to; - } else { - return cursor; - } - }, - moveToStartOfLine: function(_cm, head) { - return Pos(head.line, 0); - }, - moveToLineOrEdgeOfDocument: function(cm, _head, motionArgs) { - var lineNum = motionArgs.forward ? cm.lastLine() : cm.firstLine(); - if (motionArgs.repeatIsExplicit) { - lineNum = motionArgs.repeat - cm.getOption('firstLineNumber'); - } - return Pos(lineNum, - findFirstNonWhiteSpaceCharacter(cm.getLine(lineNum))); - }, - textObjectManipulation: function(cm, head, motionArgs, vim) { - // TODO: lots of possible exceptions that can be thrown here. Try da( - // outside of a () block. - - // TODO: adding <> >< to this map doesn't work, presumably because - // they're operators - var mirroredPairs = {'(': ')', ')': '(', - '{': '}', '}': '{', - '[': ']', ']': '['}; - var selfPaired = {'\'': true, '"': true}; - - var character = motionArgs.selectedCharacter; - // 'b' refers to '()' block. - // 'B' refers to '{}' block. - if (character == 'b') { - character = '('; - } else if (character == 'B') { - character = '{'; - } - - // Inclusive is the difference between a and i - // TODO: Instead of using the additional text object map to perform text - // object operations, merge the map into the defaultKeyMap and use - // motionArgs to define behavior. Define separate entries for 'aw', - // 'iw', 'a[', 'i[', etc. - var inclusive = !motionArgs.textObjectInner; - - var tmp; - if (mirroredPairs[character]) { - tmp = selectCompanionObject(cm, head, character, inclusive); - } else if (selfPaired[character]) { - tmp = findBeginningAndEnd(cm, head, character, inclusive); - } else if (character === 'W') { - tmp = expandWordUnderCursor(cm, inclusive, true /** forward */, - true /** bigWord */); - } else if (character === 'w') { - tmp = expandWordUnderCursor(cm, inclusive, true /** forward */, - false /** bigWord */); - } else if (character === 'p') { - tmp = findParagraph(cm, head, motionArgs.repeat, 0, inclusive); - motionArgs.linewise = true; - if (vim.visualMode) { - if (!vim.visualLine) { vim.visualLine = true; } - } else { - var operatorArgs = vim.inputState.operatorArgs; - if (operatorArgs) { operatorArgs.linewise = true; } - tmp.end.line--; - } - } else { - // No text object defined for this, don't move. - return null; - } - - if (!cm.state.vim.visualMode) { - return [tmp.start, tmp.end]; - } else { - return expandSelection(cm, tmp.start, tmp.end); - } - }, - - repeatLastCharacterSearch: function(cm, head, motionArgs) { - var lastSearch = vimGlobalState.lastChararacterSearch; - var repeat = motionArgs.repeat; - var forward = motionArgs.forward === lastSearch.forward; - var increment = (lastSearch.increment ? 1 : 0) * (forward ? -1 : 1); - cm.moveH(-increment, 'char'); - motionArgs.inclusive = forward ? true : false; - var curEnd = moveToCharacter(cm, repeat, forward, lastSearch.selectedCharacter); - if (!curEnd) { - cm.moveH(increment, 'char'); - return head; - } - curEnd.ch += increment; - return curEnd; - } - }; - - function fillArray(val, times) { - var arr = []; - for (var i = 0; i < times; i++) { - arr.push(val); - } - return arr; - } - /** - * An operator acts on a text selection. It receives the list of selections - * as input. The corresponding CodeMirror selection is guaranteed to - * match the input selection. - */ - var operators = { - change: function(cm, args, ranges) { - var finalHead, text; - var vim = cm.state.vim; - vimGlobalState.macroModeState.lastInsertModeChanges.inVisualBlock = vim.visualBlock; - if (!vim.visualMode) { - var anchor = ranges[0].anchor, - head = ranges[0].head; - text = cm.getRange(anchor, head); - if (!isWhiteSpaceString(text)) { - // Exclude trailing whitespace if the range is not all whitespace. - var match = (/\s+$/).exec(text); - if (match) { - head = offsetCursor(head, 0, - match[0].length); - text = text.slice(0, - match[0].length); - } - } - var wasLastLine = head.line - 1 == cm.lastLine(); - cm.replaceRange('', anchor, head); - if (args.linewise && !wasLastLine) { - // Push the next line back down, if there is a next line. - CodeMirror.commands.newlineAndIndent(cm); - // null ch so setCursor moves to end of line. - anchor.ch = null; - } - finalHead = anchor; - } else { - text = cm.getSelection(); - var replacement = fillArray('', ranges.length); - cm.replaceSelections(replacement); - finalHead = cursorMin(ranges[0].head, ranges[0].anchor); - } - vimGlobalState.registerController.pushText( - args.registerName, 'change', text, - args.linewise, ranges.length > 1); - actions.enterInsertMode(cm, {head: finalHead}, cm.state.vim); - }, - // delete is a javascript keyword. - 'delete': function(cm, args, ranges) { - var finalHead, text; - var vim = cm.state.vim; - if (!vim.visualBlock) { - var anchor = ranges[0].anchor, - head = ranges[0].head; - if (args.linewise && - head.line != cm.firstLine() && - anchor.line == cm.lastLine() && - anchor.line == head.line - 1) { - // Special case for dd on last line (and first line). - if (anchor.line == cm.firstLine()) { - anchor.ch = 0; - } else { - anchor = Pos(anchor.line - 1, lineLength(cm, anchor.line - 1)); - } - } - text = cm.getRange(anchor, head); - cm.replaceRange('', anchor, head); - finalHead = anchor; - if (args.linewise) { - finalHead = motions.moveToFirstNonWhiteSpaceCharacter(cm, anchor); - } - } else { - text = cm.getSelection(); - var replacement = fillArray('', ranges.length); - cm.replaceSelections(replacement); - finalHead = ranges[0].anchor; - } - vimGlobalState.registerController.pushText( - args.registerName, 'delete', text, - args.linewise, vim.visualBlock); - return finalHead; - }, - indent: function(cm, args, ranges) { - var vim = cm.state.vim; - var startLine = ranges[0].anchor.line; - var endLine = vim.visualBlock ? - ranges[ranges.length - 1].anchor.line : - ranges[0].head.line; - // In visual mode, n> shifts the selection right n times, instead of - // shifting n lines right once. - var repeat = (vim.visualMode) ? args.repeat : 1; - if (args.linewise) { - // The only way to delete a newline is to delete until the start of - // the next line, so in linewise mode evalInput will include the next - // line. We don't want this in indent, so we go back a line. - endLine--; - } - for (var i = startLine; i <= endLine; i++) { - for (var j = 0; j < repeat; j++) { - cm.indentLine(i, args.indentRight); - } - } - return motions.moveToFirstNonWhiteSpaceCharacter(cm, ranges[0].anchor); - }, - changeCase: function(cm, args, ranges, oldAnchor, newHead) { - var selections = cm.getSelections(); - var swapped = []; - var toLower = args.toLower; - for (var j = 0; j < selections.length; j++) { - var toSwap = selections[j]; - var text = ''; - if (toLower === true) { - text = toSwap.toLowerCase(); - } else if (toLower === false) { - text = toSwap.toUpperCase(); - } else { - for (var i = 0; i < toSwap.length; i++) { - var character = toSwap.charAt(i); - text += isUpperCase(character) ? character.toLowerCase() : - character.toUpperCase(); - } - } - swapped.push(text); - } - cm.replaceSelections(swapped); - if (args.shouldMoveCursor){ - return newHead; - } else if (!cm.state.vim.visualMode && args.linewise && ranges[0].anchor.line + 1 == ranges[0].head.line) { - return motions.moveToFirstNonWhiteSpaceCharacter(cm, oldAnchor); - } else if (args.linewise){ - return oldAnchor; - } else { - return cursorMin(ranges[0].anchor, ranges[0].head); - } - }, - yank: function(cm, args, ranges, oldAnchor) { - var vim = cm.state.vim; - var text = cm.getSelection(); - var endPos = vim.visualMode - ? cursorMin(vim.sel.anchor, vim.sel.head, ranges[0].head, ranges[0].anchor) - : oldAnchor; - vimGlobalState.registerController.pushText( - args.registerName, 'yank', - text, args.linewise, vim.visualBlock); - return endPos; - } - }; - - var actions = { - jumpListWalk: function(cm, actionArgs, vim) { - if (vim.visualMode) { - return; - } - var repeat = actionArgs.repeat; - var forward = actionArgs.forward; - var jumpList = vimGlobalState.jumpList; - - var mark = jumpList.move(cm, forward ? repeat : -repeat); - var markPos = mark ? mark.find() : undefined; - markPos = markPos ? markPos : cm.getCursor(); - cm.setCursor(markPos); - }, - scroll: function(cm, actionArgs, vim) { - if (vim.visualMode) { - return; - } - var repeat = actionArgs.repeat || 1; - var lineHeight = cm.defaultTextHeight(); - var top = cm.getScrollInfo().top; - var delta = lineHeight * repeat; - var newPos = actionArgs.forward ? top + delta : top - delta; - var cursor = copyCursor(cm.getCursor()); - var cursorCoords = cm.charCoords(cursor, 'local'); - if (actionArgs.forward) { - if (newPos > cursorCoords.top) { - cursor.line += (newPos - cursorCoords.top) / lineHeight; - cursor.line = Math.ceil(cursor.line); - cm.setCursor(cursor); - cursorCoords = cm.charCoords(cursor, 'local'); - cm.scrollTo(null, cursorCoords.top); - } else { - // Cursor stays within bounds. Just reposition the scroll window. - cm.scrollTo(null, newPos); - } - } else { - var newBottom = newPos + cm.getScrollInfo().clientHeight; - if (newBottom < cursorCoords.bottom) { - cursor.line -= (cursorCoords.bottom - newBottom) / lineHeight; - cursor.line = Math.floor(cursor.line); - cm.setCursor(cursor); - cursorCoords = cm.charCoords(cursor, 'local'); - cm.scrollTo( - null, cursorCoords.bottom - cm.getScrollInfo().clientHeight); - } else { - // Cursor stays within bounds. Just reposition the scroll window. - cm.scrollTo(null, newPos); - } - } - }, - scrollToCursor: function(cm, actionArgs) { - var lineNum = cm.getCursor().line; - var charCoords = cm.charCoords(Pos(lineNum, 0), 'local'); - var height = cm.getScrollInfo().clientHeight; - var y = charCoords.top; - var lineHeight = charCoords.bottom - y; - switch (actionArgs.position) { - case 'center': y = y - (height / 2) + lineHeight; - break; - case 'bottom': y = y - height + lineHeight*1.4; - break; - case 'top': y = y + lineHeight*0.4; - break; - } - cm.scrollTo(null, y); - }, - replayMacro: function(cm, actionArgs, vim) { - var registerName = actionArgs.selectedCharacter; - var repeat = actionArgs.repeat; - var macroModeState = vimGlobalState.macroModeState; - if (registerName == '@') { - registerName = macroModeState.latestRegister; - } - while(repeat--){ - executeMacroRegister(cm, vim, macroModeState, registerName); - } - }, - enterMacroRecordMode: function(cm, actionArgs) { - var macroModeState = vimGlobalState.macroModeState; - var registerName = actionArgs.selectedCharacter; - macroModeState.enterMacroRecordMode(cm, registerName); - }, - enterInsertMode: function(cm, actionArgs, vim) { - if (cm.getOption('readOnly')) { return; } - vim.insertMode = true; - vim.insertModeRepeat = actionArgs && actionArgs.repeat || 1; - var insertAt = (actionArgs) ? actionArgs.insertAt : null; - var sel = vim.sel; - var head = actionArgs.head || cm.getCursor('head'); - var height = cm.listSelections().length; - if (insertAt == 'eol') { - head = Pos(head.line, lineLength(cm, head.line)); - } else if (insertAt == 'charAfter') { - head = offsetCursor(head, 0, 1); - } else if (insertAt == 'firstNonBlank') { - head = motions.moveToFirstNonWhiteSpaceCharacter(cm, head); - } else if (insertAt == 'startOfSelectedArea') { - if (!vim.visualBlock) { - if (sel.head.line < sel.anchor.line) { - head = sel.head; - } else { - head = Pos(sel.anchor.line, 0); - } - } else { - head = Pos( - Math.min(sel.head.line, sel.anchor.line), - Math.min(sel.head.ch, sel.anchor.ch)); - height = Math.abs(sel.head.line - sel.anchor.line) + 1; - } - } else if (insertAt == 'endOfSelectedArea') { - if (!vim.visualBlock) { - if (sel.head.line >= sel.anchor.line) { - head = offsetCursor(sel.head, 0, 1); - } else { - head = Pos(sel.anchor.line, 0); - } - } else { - head = Pos( - Math.min(sel.head.line, sel.anchor.line), - Math.max(sel.head.ch + 1, sel.anchor.ch)); - height = Math.abs(sel.head.line - sel.anchor.line) + 1; - } - } else if (insertAt == 'inplace') { - if (vim.visualMode){ - return; - } - } - cm.setOption('keyMap', 'vim-insert'); - cm.setOption('disableInput', false); - if (actionArgs && actionArgs.replace) { - // Handle Replace-mode as a special case of insert mode. - cm.toggleOverwrite(true); - cm.setOption('keyMap', 'vim-replace'); - CodeMirror.signal(cm, "vim-mode-change", {mode: "replace"}); - } else { - cm.setOption('keyMap', 'vim-insert'); - CodeMirror.signal(cm, "vim-mode-change", {mode: "insert"}); - } - if (!vimGlobalState.macroModeState.isPlaying) { - // Only record if not replaying. - cm.on('change', onChange); - CodeMirror.on(cm.getInputField(), 'keydown', onKeyEventTargetKeyDown); - } - if (vim.visualMode) { - exitVisualMode(cm); - } - selectForInsert(cm, head, height); - }, - toggleVisualMode: function(cm, actionArgs, vim) { - var repeat = actionArgs.repeat; - var anchor = cm.getCursor(); - var head; - // TODO: The repeat should actually select number of characters/lines - // equal to the repeat times the size of the previous visual - // operation. - if (!vim.visualMode) { - // Entering visual mode - vim.visualMode = true; - vim.visualLine = !!actionArgs.linewise; - vim.visualBlock = !!actionArgs.blockwise; - head = clipCursorToContent( - cm, Pos(anchor.line, anchor.ch + repeat - 1), - true /** includeLineBreak */); - vim.sel = { - anchor: anchor, - head: head - }; - CodeMirror.signal(cm, "vim-mode-change", {mode: "visual", subMode: vim.visualLine ? "linewise" : vim.visualBlock ? "blockwise" : ""}); - updateCmSelection(cm); - updateMark(cm, vim, '<', cursorMin(anchor, head)); - updateMark(cm, vim, '>', cursorMax(anchor, head)); - } else if (vim.visualLine ^ actionArgs.linewise || - vim.visualBlock ^ actionArgs.blockwise) { - // Toggling between modes - vim.visualLine = !!actionArgs.linewise; - vim.visualBlock = !!actionArgs.blockwise; - CodeMirror.signal(cm, "vim-mode-change", {mode: "visual", subMode: vim.visualLine ? "linewise" : vim.visualBlock ? "blockwise" : ""}); - updateCmSelection(cm); - } else { - exitVisualMode(cm); - } - }, - reselectLastSelection: function(cm, _actionArgs, vim) { - var lastSelection = vim.lastSelection; - if (vim.visualMode) { - updateLastSelection(cm, vim); - } - if (lastSelection) { - var anchor = lastSelection.anchorMark.find(); - var head = lastSelection.headMark.find(); - if (!anchor || !head) { - // If the marks have been destroyed due to edits, do nothing. - return; - } - vim.sel = { - anchor: anchor, - head: head - }; - vim.visualMode = true; - vim.visualLine = lastSelection.visualLine; - vim.visualBlock = lastSelection.visualBlock; - updateCmSelection(cm); - updateMark(cm, vim, '<', cursorMin(anchor, head)); - updateMark(cm, vim, '>', cursorMax(anchor, head)); - CodeMirror.signal(cm, 'vim-mode-change', { - mode: 'visual', - subMode: vim.visualLine ? 'linewise' : - vim.visualBlock ? 'blockwise' : ''}); - } - }, - joinLines: function(cm, actionArgs, vim) { - var curStart, curEnd; - if (vim.visualMode) { - curStart = cm.getCursor('anchor'); - curEnd = cm.getCursor('head'); - curEnd.ch = lineLength(cm, curEnd.line) - 1; - } else { - // Repeat is the number of lines to join. Minimum 2 lines. - var repeat = Math.max(actionArgs.repeat, 2); - curStart = cm.getCursor(); - curEnd = clipCursorToContent(cm, Pos(curStart.line + repeat - 1, - Infinity)); - } - var finalCh = 0; - for (var i = curStart.line; i < curEnd.line; i++) { - finalCh = lineLength(cm, curStart.line); - var tmp = Pos(curStart.line + 1, - lineLength(cm, curStart.line + 1)); - var text = cm.getRange(curStart, tmp); - text = text.replace(/\n\s*/g, ' '); - cm.replaceRange(text, curStart, tmp); - } - var curFinalPos = Pos(curStart.line, finalCh); - cm.setCursor(curFinalPos); - if (vim.visualMode) { - exitVisualMode(cm); - } - }, - newLineAndEnterInsertMode: function(cm, actionArgs, vim) { - vim.insertMode = true; - var insertAt = copyCursor(cm.getCursor()); - if (insertAt.line === cm.firstLine() && !actionArgs.after) { - // Special case for inserting newline before start of document. - cm.replaceRange('\n', Pos(cm.firstLine(), 0)); - cm.setCursor(cm.firstLine(), 0); - } else { - insertAt.line = (actionArgs.after) ? insertAt.line : - insertAt.line - 1; - insertAt.ch = lineLength(cm, insertAt.line); - cm.setCursor(insertAt); - var newlineFn = CodeMirror.commands.newlineAndIndentContinueComment || - CodeMirror.commands.newlineAndIndent; - newlineFn(cm); - } - this.enterInsertMode(cm, { repeat: actionArgs.repeat }, vim); - }, - paste: function(cm, actionArgs, vim) { - var cur = copyCursor(cm.getCursor()); - var register = vimGlobalState.registerController.getRegister( - actionArgs.registerName); - var text = register.toString(); - if (!text) { - return; - } - if (actionArgs.matchIndent) { - var tabSize = cm.getOption("tabSize"); - // length that considers tabs and tabSize - var whitespaceLength = function(str) { - var tabs = (str.split("\t").length - 1); - var spaces = (str.split(" ").length - 1); - return tabs * tabSize + spaces * 1; - }; - var currentLine = cm.getLine(cm.getCursor().line); - var indent = whitespaceLength(currentLine.match(/^\s*/)[0]); - // chomp last newline b/c don't want it to match /^\s*/gm - var chompedText = text.replace(/\n$/, ''); - var wasChomped = text !== chompedText; - var firstIndent = whitespaceLength(text.match(/^\s*/)[0]); - var text = chompedText.replace(/^\s*/gm, function(wspace) { - var newIndent = indent + (whitespaceLength(wspace) - firstIndent); - if (newIndent < 0) { - return ""; - } - else if (cm.getOption("indentWithTabs")) { - var quotient = Math.floor(newIndent / tabSize); - return Array(quotient + 1).join('\t'); - } - else { - return Array(newIndent + 1).join(' '); - } - }); - text += wasChomped ? "\n" : ""; - } - if (actionArgs.repeat > 1) { - var text = Array(actionArgs.repeat + 1).join(text); - } - var linewise = register.linewise; - var blockwise = register.blockwise; - if (linewise) { - if(vim.visualMode) { - text = vim.visualLine ? text.slice(0, -1) : '\n' + text.slice(0, text.length - 1) + '\n'; - } else if (actionArgs.after) { - // Move the newline at the end to the start instead, and paste just - // before the newline character of the line we are on right now. - text = '\n' + text.slice(0, text.length - 1); - cur.ch = lineLength(cm, cur.line); - } else { - cur.ch = 0; - } - } else { - if (blockwise) { - text = text.split('\n'); - for (var i = 0; i < text.length; i++) { - text[i] = (text[i] == '') ? ' ' : text[i]; - } - } - cur.ch += actionArgs.after ? 1 : 0; - } - var curPosFinal; - var idx; - if (vim.visualMode) { - // save the pasted text for reselection if the need arises - vim.lastPastedText = text; - var lastSelectionCurEnd; - var selectedArea = getSelectedAreaRange(cm, vim); - var selectionStart = selectedArea[0]; - var selectionEnd = selectedArea[1]; - var selectedText = cm.getSelection(); - var selections = cm.listSelections(); - var emptyStrings = new Array(selections.length).join('1').split('1'); - // save the curEnd marker before it get cleared due to cm.replaceRange. - if (vim.lastSelection) { - lastSelectionCurEnd = vim.lastSelection.headMark.find(); - } - // push the previously selected text to unnamed register - vimGlobalState.registerController.unnamedRegister.setText(selectedText); - if (blockwise) { - // first delete the selected text - cm.replaceSelections(emptyStrings); - // Set new selections as per the block length of the yanked text - selectionEnd = Pos(selectionStart.line + text.length-1, selectionStart.ch); - cm.setCursor(selectionStart); - selectBlock(cm, selectionEnd); - cm.replaceSelections(text); - curPosFinal = selectionStart; - } else if (vim.visualBlock) { - cm.replaceSelections(emptyStrings); - cm.setCursor(selectionStart); - cm.replaceRange(text, selectionStart, selectionStart); - curPosFinal = selectionStart; - } else { - cm.replaceRange(text, selectionStart, selectionEnd); - curPosFinal = cm.posFromIndex(cm.indexFromPos(selectionStart) + text.length - 1); - } - // restore the the curEnd marker - if(lastSelectionCurEnd) { - vim.lastSelection.headMark = cm.setBookmark(lastSelectionCurEnd); - } - if (linewise) { - curPosFinal.ch=0; - } - } else { - if (blockwise) { - cm.setCursor(cur); - for (var i = 0; i < text.length; i++) { - var line = cur.line+i; - if (line > cm.lastLine()) { - cm.replaceRange('\n', Pos(line, 0)); - } - var lastCh = lineLength(cm, line); - if (lastCh < cur.ch) { - extendLineToColumn(cm, line, cur.ch); - } - } - cm.setCursor(cur); - selectBlock(cm, Pos(cur.line + text.length-1, cur.ch)); - cm.replaceSelections(text); - curPosFinal = cur; - } else { - cm.replaceRange(text, cur); - // Now fine tune the cursor to where we want it. - if (linewise && actionArgs.after) { - curPosFinal = Pos( - cur.line + 1, - findFirstNonWhiteSpaceCharacter(cm.getLine(cur.line + 1))); - } else if (linewise && !actionArgs.after) { - curPosFinal = Pos( - cur.line, - findFirstNonWhiteSpaceCharacter(cm.getLine(cur.line))); - } else if (!linewise && actionArgs.after) { - idx = cm.indexFromPos(cur); - curPosFinal = cm.posFromIndex(idx + text.length - 1); - } else { - idx = cm.indexFromPos(cur); - curPosFinal = cm.posFromIndex(idx + text.length); - } - } - } - if (vim.visualMode) { - exitVisualMode(cm); - } - cm.setCursor(curPosFinal); - }, - undo: function(cm, actionArgs) { - cm.operation(function() { - repeatFn(cm, CodeMirror.commands.undo, actionArgs.repeat)(); - cm.setCursor(cm.getCursor('anchor')); - }); - }, - redo: function(cm, actionArgs) { - repeatFn(cm, CodeMirror.commands.redo, actionArgs.repeat)(); - }, - setRegister: function(_cm, actionArgs, vim) { - vim.inputState.registerName = actionArgs.selectedCharacter; - }, - setMark: function(cm, actionArgs, vim) { - var markName = actionArgs.selectedCharacter; - updateMark(cm, vim, markName, cm.getCursor()); - }, - replace: function(cm, actionArgs, vim) { - var replaceWith = actionArgs.selectedCharacter; - var curStart = cm.getCursor(); - var replaceTo; - var curEnd; - var selections = cm.listSelections(); - if (vim.visualMode) { - curStart = cm.getCursor('start'); - curEnd = cm.getCursor('end'); - } else { - var line = cm.getLine(curStart.line); - replaceTo = curStart.ch + actionArgs.repeat; - if (replaceTo > line.length) { - replaceTo=line.length; - } - curEnd = Pos(curStart.line, replaceTo); - } - if (replaceWith=='\n') { - if (!vim.visualMode) cm.replaceRange('', curStart, curEnd); - // special case, where vim help says to replace by just one line-break - (CodeMirror.commands.newlineAndIndentContinueComment || CodeMirror.commands.newlineAndIndent)(cm); - } else { - var replaceWithStr = cm.getRange(curStart, curEnd); - //replace all characters in range by selected, but keep linebreaks - replaceWithStr = replaceWithStr.replace(/[^\n]/g, replaceWith); - if (vim.visualBlock) { - // Tabs are split in visua block before replacing - var spaces = new Array(cm.getOption("tabSize")+1).join(' '); - replaceWithStr = cm.getSelection(); - replaceWithStr = replaceWithStr.replace(/\t/g, spaces).replace(/[^\n]/g, replaceWith).split('\n'); - cm.replaceSelections(replaceWithStr); - } else { - cm.replaceRange(replaceWithStr, curStart, curEnd); - } - if (vim.visualMode) { - curStart = cursorIsBefore(selections[0].anchor, selections[0].head) ? - selections[0].anchor : selections[0].head; - cm.setCursor(curStart); - exitVisualMode(cm); - } else { - cm.setCursor(offsetCursor(curEnd, 0, -1)); - } - } - }, - incrementNumberToken: function(cm, actionArgs) { - var cur = cm.getCursor(); - var lineStr = cm.getLine(cur.line); - var re = /-?\d+/g; - var match; - var start; - var end; - var numberStr; - var token; - while ((match = re.exec(lineStr)) !== null) { - token = match[0]; - start = match.index; - end = start + token.length; - if (cur.ch < end)break; - } - if (!actionArgs.backtrack && (end <= cur.ch))return; - if (token) { - var increment = actionArgs.increase ? 1 : -1; - var number = parseInt(token) + (increment * actionArgs.repeat); - var from = Pos(cur.line, start); - var to = Pos(cur.line, end); - numberStr = number.toString(); - cm.replaceRange(numberStr, from, to); - } else { - return; - } - cm.setCursor(Pos(cur.line, start + numberStr.length - 1)); - }, - repeatLastEdit: function(cm, actionArgs, vim) { - var lastEditInputState = vim.lastEditInputState; - if (!lastEditInputState) { return; } - var repeat = actionArgs.repeat; - if (repeat && actionArgs.repeatIsExplicit) { - vim.lastEditInputState.repeatOverride = repeat; - } else { - repeat = vim.lastEditInputState.repeatOverride || repeat; - } - repeatLastEdit(cm, vim, repeat, false /** repeatForInsert */); - }, - exitInsertMode: exitInsertMode - }; - - /* - * Below are miscellaneous utility functions used by vim.js - */ - - /** - * Clips cursor to ensure that line is within the buffer's range - * If includeLineBreak is true, then allow cur.ch == lineLength. - */ - function clipCursorToContent(cm, cur, includeLineBreak) { - var line = Math.min(Math.max(cm.firstLine(), cur.line), cm.lastLine() ); - var maxCh = lineLength(cm, line) - 1; - maxCh = (includeLineBreak) ? maxCh + 1 : maxCh; - var ch = Math.min(Math.max(0, cur.ch), maxCh); - return Pos(line, ch); - } - function copyArgs(args) { - var ret = {}; - for (var prop in args) { - if (args.hasOwnProperty(prop)) { - ret[prop] = args[prop]; - } - } - return ret; - } - function offsetCursor(cur, offsetLine, offsetCh) { - if (typeof offsetLine === 'object') { - offsetCh = offsetLine.ch; - offsetLine = offsetLine.line; - } - return Pos(cur.line + offsetLine, cur.ch + offsetCh); - } - function getOffset(anchor, head) { - return { - line: head.line - anchor.line, - ch: head.line - anchor.line - }; - } - function commandMatches(keys, keyMap, context, inputState) { - // Partial matches are not applied. They inform the key handler - // that the current key sequence is a subsequence of a valid key - // sequence, so that the key buffer is not cleared. - var match, partial = [], full = []; - for (var i = 0; i < keyMap.length; i++) { - var command = keyMap[i]; - if (context == 'insert' && command.context != 'insert' || - command.context && command.context != context || - inputState.operator && command.type == 'action' || - !(match = commandMatch(keys, command.keys))) { continue; } - if (match == 'partial') { partial.push(command); } - if (match == 'full') { full.push(command); } - } - return { - partial: partial.length && partial, - full: full.length && full - }; - } - function commandMatch(pressed, mapped) { - if (mapped.slice(-11) == '') { - // Last character matches anything. - var prefixLen = mapped.length - 11; - var pressedPrefix = pressed.slice(0, prefixLen); - var mappedPrefix = mapped.slice(0, prefixLen); - return pressedPrefix == mappedPrefix && pressed.length > prefixLen ? 'full' : - mappedPrefix.indexOf(pressedPrefix) == 0 ? 'partial' : false; - } else { - return pressed == mapped ? 'full' : - mapped.indexOf(pressed) == 0 ? 'partial' : false; - } - } - function lastChar(keys) { - var match = /^.*(<[\w\-]+>)$/.exec(keys); - var selectedCharacter = match ? match[1] : keys.slice(-1); - if (selectedCharacter.length > 1){ - switch(selectedCharacter){ - case '': - selectedCharacter='\n'; - break; - case '': - selectedCharacter=' '; - break; - default: - break; - } - } - return selectedCharacter; - } - function repeatFn(cm, fn, repeat) { - return function() { - for (var i = 0; i < repeat; i++) { - fn(cm); - } - }; - } - function copyCursor(cur) { - return Pos(cur.line, cur.ch); - } - function cursorEqual(cur1, cur2) { - return cur1.ch == cur2.ch && cur1.line == cur2.line; - } - function cursorIsBefore(cur1, cur2) { - if (cur1.line < cur2.line) { - return true; - } - if (cur1.line == cur2.line && cur1.ch < cur2.ch) { - return true; - } - return false; - } - function cursorMin(cur1, cur2) { - if (arguments.length > 2) { - cur2 = cursorMin.apply(undefined, Array.prototype.slice.call(arguments, 1)); - } - return cursorIsBefore(cur1, cur2) ? cur1 : cur2; - } - function cursorMax(cur1, cur2) { - if (arguments.length > 2) { - cur2 = cursorMax.apply(undefined, Array.prototype.slice.call(arguments, 1)); - } - return cursorIsBefore(cur1, cur2) ? cur2 : cur1; - } - function cursorIsBetween(cur1, cur2, cur3) { - // returns true if cur2 is between cur1 and cur3. - var cur1before2 = cursorIsBefore(cur1, cur2); - var cur2before3 = cursorIsBefore(cur2, cur3); - return cur1before2 && cur2before3; - } - function lineLength(cm, lineNum) { - return cm.getLine(lineNum).length; - } - function reverse(s){ - return s.split('').reverse().join(''); - } - function trim(s) { - if (s.trim) { - return s.trim(); - } - return s.replace(/^\s+|\s+$/g, ''); - } - function escapeRegex(s) { - return s.replace(/([.?*+$\[\]\/\\(){}|\-])/g, '\\$1'); - } - function extendLineToColumn(cm, lineNum, column) { - var endCh = lineLength(cm, lineNum); - var spaces = new Array(column-endCh+1).join(' '); - cm.setCursor(Pos(lineNum, endCh)); - cm.replaceRange(spaces, cm.getCursor()); - } - // This functions selects a rectangular block - // of text with selectionEnd as any of its corner - // Height of block: - // Difference in selectionEnd.line and first/last selection.line - // Width of the block: - // Distance between selectionEnd.ch and any(first considered here) selection.ch - function selectBlock(cm, selectionEnd) { - var selections = [], ranges = cm.listSelections(); - var head = copyCursor(cm.clipPos(selectionEnd)); - var isClipped = !cursorEqual(selectionEnd, head); - var curHead = cm.getCursor('head'); - var primIndex = getIndex(ranges, curHead); - var wasClipped = cursorEqual(ranges[primIndex].head, ranges[primIndex].anchor); - var max = ranges.length - 1; - var index = max - primIndex > primIndex ? max : 0; - var base = ranges[index].anchor; - - var firstLine = Math.min(base.line, head.line); - var lastLine = Math.max(base.line, head.line); - var baseCh = base.ch, headCh = head.ch; - - var dir = ranges[index].head.ch - baseCh; - var newDir = headCh - baseCh; - if (dir > 0 && newDir <= 0) { - baseCh++; - if (!isClipped) { headCh--; } - } else if (dir < 0 && newDir >= 0) { - baseCh--; - if (!wasClipped) { headCh++; } - } else if (dir < 0 && newDir == -1) { - baseCh--; - headCh++; - } - for (var line = firstLine; line <= lastLine; line++) { - var range = {anchor: new Pos(line, baseCh), head: new Pos(line, headCh)}; - selections.push(range); - } - primIndex = head.line == lastLine ? selections.length - 1 : 0; - cm.setSelections(selections); - selectionEnd.ch = headCh; - base.ch = baseCh; - return base; - } - function selectForInsert(cm, head, height) { - var sel = []; - for (var i = 0; i < height; i++) { - var lineHead = offsetCursor(head, i, 0); - sel.push({anchor: lineHead, head: lineHead}); - } - cm.setSelections(sel, 0); - } - // getIndex returns the index of the cursor in the selections. - function getIndex(ranges, cursor, end) { - for (var i = 0; i < ranges.length; i++) { - var atAnchor = end != 'head' && cursorEqual(ranges[i].anchor, cursor); - var atHead = end != 'anchor' && cursorEqual(ranges[i].head, cursor); - if (atAnchor || atHead) { - return i; - } - } - return -1; - } - function getSelectedAreaRange(cm, vim) { - var lastSelection = vim.lastSelection; - var getCurrentSelectedAreaRange = function() { - var selections = cm.listSelections(); - var start = selections[0]; - var end = selections[selections.length-1]; - var selectionStart = cursorIsBefore(start.anchor, start.head) ? start.anchor : start.head; - var selectionEnd = cursorIsBefore(end.anchor, end.head) ? end.head : end.anchor; - return [selectionStart, selectionEnd]; - }; - var getLastSelectedAreaRange = function() { - var selectionStart = cm.getCursor(); - var selectionEnd = cm.getCursor(); - var block = lastSelection.visualBlock; - if (block) { - var width = block.width; - var height = block.height; - selectionEnd = Pos(selectionStart.line + height, selectionStart.ch + width); - var selections = []; - // selectBlock creates a 'proper' rectangular block. - // We do not want that in all cases, so we manually set selections. - for (var i = selectionStart.line; i < selectionEnd.line; i++) { - var anchor = Pos(i, selectionStart.ch); - var head = Pos(i, selectionEnd.ch); - var range = {anchor: anchor, head: head}; - selections.push(range); - } - cm.setSelections(selections); - } else { - var start = lastSelection.anchorMark.find(); - var end = lastSelection.headMark.find(); - var line = end.line - start.line; - var ch = end.ch - start.ch; - selectionEnd = {line: selectionEnd.line + line, ch: line ? selectionEnd.ch : ch + selectionEnd.ch}; - if (lastSelection.visualLine) { - selectionStart = Pos(selectionStart.line, 0); - selectionEnd = Pos(selectionEnd.line, lineLength(cm, selectionEnd.line)); - } - cm.setSelection(selectionStart, selectionEnd); - } - return [selectionStart, selectionEnd]; - }; - if (!vim.visualMode) { - // In case of replaying the action. - return getLastSelectedAreaRange(); - } else { - return getCurrentSelectedAreaRange(); - } - } - // Updates the previous selection with the current selection's values. This - // should only be called in visual mode. - function updateLastSelection(cm, vim) { - var anchor = vim.sel.anchor; - var head = vim.sel.head; - // To accommodate the effect of lastPastedText in the last selection - if (vim.lastPastedText) { - head = cm.posFromIndex(cm.indexFromPos(anchor) + vim.lastPastedText.length); - vim.lastPastedText = null; - } - vim.lastSelection = {'anchorMark': cm.setBookmark(anchor), - 'headMark': cm.setBookmark(head), - 'anchor': copyCursor(anchor), - 'head': copyCursor(head), - 'visualMode': vim.visualMode, - 'visualLine': vim.visualLine, - 'visualBlock': vim.visualBlock}; - } - function expandSelection(cm, start, end) { - var sel = cm.state.vim.sel; - var head = sel.head; - var anchor = sel.anchor; - var tmp; - if (cursorIsBefore(end, start)) { - tmp = end; - end = start; - start = tmp; - } - if (cursorIsBefore(head, anchor)) { - head = cursorMin(start, head); - anchor = cursorMax(anchor, end); - } else { - anchor = cursorMin(start, anchor); - head = cursorMax(head, end); - head = offsetCursor(head, 0, -1); - if (head.ch == -1 && head.line != cm.firstLine()) { - head = Pos(head.line - 1, lineLength(cm, head.line - 1)); - } - } - return [anchor, head]; - } - /** - * Updates the CodeMirror selection to match the provided vim selection. - * If no arguments are given, it uses the current vim selection state. - */ - function updateCmSelection(cm, sel, mode) { - var vim = cm.state.vim; - sel = sel || vim.sel; - var mode = mode || - vim.visualLine ? 'line' : vim.visualBlock ? 'block' : 'char'; - var cmSel = makeCmSelection(cm, sel, mode); - cm.setSelections(cmSel.ranges, cmSel.primary); - updateFakeCursor(cm); - } - function makeCmSelection(cm, sel, mode, exclusive) { - var head = copyCursor(sel.head); - var anchor = copyCursor(sel.anchor); - if (mode == 'char') { - var headOffset = !exclusive && !cursorIsBefore(sel.head, sel.anchor) ? 1 : 0; - var anchorOffset = cursorIsBefore(sel.head, sel.anchor) ? 1 : 0; - head = offsetCursor(sel.head, 0, headOffset); - anchor = offsetCursor(sel.anchor, 0, anchorOffset); - return { - ranges: [{anchor: anchor, head: head}], - primary: 0 - }; - } else if (mode == 'line') { - if (!cursorIsBefore(sel.head, sel.anchor)) { - anchor.ch = 0; - - var lastLine = cm.lastLine(); - if (head.line > lastLine) { - head.line = lastLine; - } - head.ch = lineLength(cm, head.line); - } else { - head.ch = 0; - anchor.ch = lineLength(cm, anchor.line); - } - return { - ranges: [{anchor: anchor, head: head}], - primary: 0 - }; - } else if (mode == 'block') { - var top = Math.min(anchor.line, head.line), - left = Math.min(anchor.ch, head.ch), - bottom = Math.max(anchor.line, head.line), - right = Math.max(anchor.ch, head.ch) + 1; - var height = bottom - top + 1; - var primary = head.line == top ? 0 : height - 1; - var ranges = []; - for (var i = 0; i < height; i++) { - ranges.push({ - anchor: Pos(top + i, left), - head: Pos(top + i, right) - }); - } - return { - ranges: ranges, - primary: primary - }; - } - } - function getHead(cm) { - var cur = cm.getCursor('head'); - if (cm.getSelection().length == 1) { - // Small corner case when only 1 character is selected. The "real" - // head is the left of head and anchor. - cur = cursorMin(cur, cm.getCursor('anchor')); - } - return cur; - } - - /** - * If moveHead is set to false, the CodeMirror selection will not be - * touched. The caller assumes the responsibility of putting the cursor - * in the right place. - */ - function exitVisualMode(cm, moveHead) { - var vim = cm.state.vim; - if (moveHead !== false) { - cm.setCursor(clipCursorToContent(cm, vim.sel.head)); - } - updateLastSelection(cm, vim); - vim.visualMode = false; - vim.visualLine = false; - vim.visualBlock = false; - CodeMirror.signal(cm, "vim-mode-change", {mode: "normal"}); - if (vim.fakeCursor) { - vim.fakeCursor.clear(); - } - } - - // Remove any trailing newlines from the selection. For - // example, with the caret at the start of the last word on the line, - // 'dw' should word, but not the newline, while 'w' should advance the - // caret to the first character of the next line. - function clipToLine(cm, curStart, curEnd) { - var selection = cm.getRange(curStart, curEnd); - // Only clip if the selection ends with trailing newline + whitespace - if (/\n\s*$/.test(selection)) { - var lines = selection.split('\n'); - // We know this is all whitepsace. - lines.pop(); - - // Cases: - // 1. Last word is an empty line - do not clip the trailing '\n' - // 2. Last word is not an empty line - clip the trailing '\n' - var line; - // Find the line containing the last word, and clip all whitespace up - // to it. - for (var line = lines.pop(); lines.length > 0 && line && isWhiteSpaceString(line); line = lines.pop()) { - curEnd.line--; - curEnd.ch = 0; - } - // If the last word is not an empty line, clip an additional newline - if (line) { - curEnd.line--; - curEnd.ch = lineLength(cm, curEnd.line); - } else { - curEnd.ch = 0; - } - } - } - - // Expand the selection to line ends. - function expandSelectionToLine(_cm, curStart, curEnd) { - curStart.ch = 0; - curEnd.ch = 0; - curEnd.line++; - } - - function findFirstNonWhiteSpaceCharacter(text) { - if (!text) { - return 0; - } - var firstNonWS = text.search(/\S/); - return firstNonWS == -1 ? text.length : firstNonWS; - } - - function expandWordUnderCursor(cm, inclusive, _forward, bigWord, noSymbol) { - var cur = getHead(cm); - var line = cm.getLine(cur.line); - var idx = cur.ch; - - // Seek to first word or non-whitespace character, depending on if - // noSymbol is true. - var textAfterIdx = line.substring(idx); - var firstMatchedChar; - if (noSymbol) { - firstMatchedChar = textAfterIdx.search(/\w/); - } else { - firstMatchedChar = textAfterIdx.search(/\S/); - } - if (firstMatchedChar == -1) { - return null; - } - idx += firstMatchedChar; - textAfterIdx = line.substring(idx); - var textBeforeIdx = line.substring(0, idx); - - var matchRegex; - // Greedy matchers for the "word" we are trying to expand. - if (bigWord) { - matchRegex = /^\S+/; - } else { - if ((/\w/).test(line.charAt(idx))) { - matchRegex = /^\w+/; - } else { - matchRegex = /^[^\w\s]+/; - } - } - - var wordAfterRegex = matchRegex.exec(textAfterIdx); - var wordStart = idx; - var wordEnd = idx + wordAfterRegex[0].length; - // TODO: Find a better way to do this. It will be slow on very long lines. - var revTextBeforeIdx = reverse(textBeforeIdx); - var wordBeforeRegex = matchRegex.exec(revTextBeforeIdx); - if (wordBeforeRegex) { - wordStart -= wordBeforeRegex[0].length; - } - - if (inclusive) { - // If present, trim all whitespace after word. - // Otherwise, trim all whitespace before word. - var textAfterWordEnd = line.substring(wordEnd); - var whitespacesAfterWord = textAfterWordEnd.match(/^\s*/)[0].length; - if (whitespacesAfterWord > 0) { - wordEnd += whitespacesAfterWord; - } else { - var revTrim = revTextBeforeIdx.length - wordStart; - var textBeforeWordStart = revTextBeforeIdx.substring(revTrim); - var whitespacesBeforeWord = textBeforeWordStart.match(/^\s*/)[0].length; - wordStart -= whitespacesBeforeWord; - } - } - - return { start: Pos(cur.line, wordStart), - end: Pos(cur.line, wordEnd) }; - } - - function recordJumpPosition(cm, oldCur, newCur) { - if (!cursorEqual(oldCur, newCur)) { - vimGlobalState.jumpList.add(cm, oldCur, newCur); - } - } - - function recordLastCharacterSearch(increment, args) { - vimGlobalState.lastChararacterSearch.increment = increment; - vimGlobalState.lastChararacterSearch.forward = args.forward; - vimGlobalState.lastChararacterSearch.selectedCharacter = args.selectedCharacter; - } - - var symbolToMode = { - '(': 'bracket', ')': 'bracket', '{': 'bracket', '}': 'bracket', - '[': 'section', ']': 'section', - '*': 'comment', '/': 'comment', - 'm': 'method', 'M': 'method', - '#': 'preprocess' - }; - var findSymbolModes = { - bracket: { - isComplete: function(state) { - if (state.nextCh === state.symb) { - state.depth++; - if (state.depth >= 1)return true; - } else if (state.nextCh === state.reverseSymb) { - state.depth--; - } - return false; - } - }, - section: { - init: function(state) { - state.curMoveThrough = true; - state.symb = (state.forward ? ']' : '[') === state.symb ? '{' : '}'; - }, - isComplete: function(state) { - return state.index === 0 && state.nextCh === state.symb; - } - }, - comment: { - isComplete: function(state) { - var found = state.lastCh === '*' && state.nextCh === '/'; - state.lastCh = state.nextCh; - return found; - } - }, - // TODO: The original Vim implementation only operates on level 1 and 2. - // The current implementation doesn't check for code block level and - // therefore it operates on any levels. - method: { - init: function(state) { - state.symb = (state.symb === 'm' ? '{' : '}'); - state.reverseSymb = state.symb === '{' ? '}' : '{'; - }, - isComplete: function(state) { - if (state.nextCh === state.symb)return true; - return false; - } - }, - preprocess: { - init: function(state) { - state.index = 0; - }, - isComplete: function(state) { - if (state.nextCh === '#') { - var token = state.lineText.match(/#(\w+)/)[1]; - if (token === 'endif') { - if (state.forward && state.depth === 0) { - return true; - } - state.depth++; - } else if (token === 'if') { - if (!state.forward && state.depth === 0) { - return true; - } - state.depth--; - } - if (token === 'else' && state.depth === 0)return true; - } - return false; - } - } - }; - function findSymbol(cm, repeat, forward, symb) { - var cur = copyCursor(cm.getCursor()); - var increment = forward ? 1 : -1; - var endLine = forward ? cm.lineCount() : -1; - var curCh = cur.ch; - var line = cur.line; - var lineText = cm.getLine(line); - var state = { - lineText: lineText, - nextCh: lineText.charAt(curCh), - lastCh: null, - index: curCh, - symb: symb, - reverseSymb: (forward ? { ')': '(', '}': '{' } : { '(': ')', '{': '}' })[symb], - forward: forward, - depth: 0, - curMoveThrough: false - }; - var mode = symbolToMode[symb]; - if (!mode)return cur; - var init = findSymbolModes[mode].init; - var isComplete = findSymbolModes[mode].isComplete; - if (init) { init(state); } - while (line !== endLine && repeat) { - state.index += increment; - state.nextCh = state.lineText.charAt(state.index); - if (!state.nextCh) { - line += increment; - state.lineText = cm.getLine(line) || ''; - if (increment > 0) { - state.index = 0; - } else { - var lineLen = state.lineText.length; - state.index = (lineLen > 0) ? (lineLen-1) : 0; - } - state.nextCh = state.lineText.charAt(state.index); - } - if (isComplete(state)) { - cur.line = line; - cur.ch = state.index; - repeat--; - } - } - if (state.nextCh || state.curMoveThrough) { - return Pos(line, state.index); - } - return cur; - } - - /* - * Returns the boundaries of the next word. If the cursor in the middle of - * the word, then returns the boundaries of the current word, starting at - * the cursor. If the cursor is at the start/end of a word, and we are going - * forward/backward, respectively, find the boundaries of the next word. - * - * @param {CodeMirror} cm CodeMirror object. - * @param {Cursor} cur The cursor position. - * @param {boolean} forward True to search forward. False to search - * backward. - * @param {boolean} bigWord True if punctuation count as part of the word. - * False if only [a-zA-Z0-9] characters count as part of the word. - * @param {boolean} emptyLineIsWord True if empty lines should be treated - * as words. - * @return {Object{from:number, to:number, line: number}} The boundaries of - * the word, or null if there are no more words. - */ - function findWord(cm, cur, forward, bigWord, emptyLineIsWord) { - var lineNum = cur.line; - var pos = cur.ch; - var line = cm.getLine(lineNum); - var dir = forward ? 1 : -1; - var regexps = bigWord ? bigWordRegexp : wordRegexp; - - if (emptyLineIsWord && line == '') { - lineNum += dir; - line = cm.getLine(lineNum); - if (!isLine(cm, lineNum)) { - return null; - } - pos = (forward) ? 0 : line.length; - } - - while (true) { - if (emptyLineIsWord && line == '') { - return { from: 0, to: 0, line: lineNum }; - } - var stop = (dir > 0) ? line.length : -1; - var wordStart = stop, wordEnd = stop; - // Find bounds of next word. - while (pos != stop) { - var foundWord = false; - for (var i = 0; i < regexps.length && !foundWord; ++i) { - if (regexps[i].test(line.charAt(pos))) { - wordStart = pos; - // Advance to end of word. - while (pos != stop && regexps[i].test(line.charAt(pos))) { - pos += dir; - } - wordEnd = pos; - foundWord = wordStart != wordEnd; - if (wordStart == cur.ch && lineNum == cur.line && - wordEnd == wordStart + dir) { - // We started at the end of a word. Find the next one. - continue; - } else { - return { - from: Math.min(wordStart, wordEnd + 1), - to: Math.max(wordStart, wordEnd), - line: lineNum }; - } - } - } - if (!foundWord) { - pos += dir; - } - } - // Advance to next/prev line. - lineNum += dir; - if (!isLine(cm, lineNum)) { - return null; - } - line = cm.getLine(lineNum); - pos = (dir > 0) ? 0 : line.length; - } - // Should never get here. - throw new Error('The impossible happened.'); - } - - /** - * @param {CodeMirror} cm CodeMirror object. - * @param {Pos} cur The position to start from. - * @param {int} repeat Number of words to move past. - * @param {boolean} forward True to search forward. False to search - * backward. - * @param {boolean} wordEnd True to move to end of word. False to move to - * beginning of word. - * @param {boolean} bigWord True if punctuation count as part of the word. - * False if only alphabet characters count as part of the word. - * @return {Cursor} The position the cursor should move to. - */ - function moveToWord(cm, cur, repeat, forward, wordEnd, bigWord) { - var curStart = copyCursor(cur); - var words = []; - if (forward && !wordEnd || !forward && wordEnd) { - repeat++; - } - // For 'e', empty lines are not considered words, go figure. - var emptyLineIsWord = !(forward && wordEnd); - for (var i = 0; i < repeat; i++) { - var word = findWord(cm, cur, forward, bigWord, emptyLineIsWord); - if (!word) { - var eodCh = lineLength(cm, cm.lastLine()); - words.push(forward - ? {line: cm.lastLine(), from: eodCh, to: eodCh} - : {line: 0, from: 0, to: 0}); - break; - } - words.push(word); - cur = Pos(word.line, forward ? (word.to - 1) : word.from); - } - var shortCircuit = words.length != repeat; - var firstWord = words[0]; - var lastWord = words.pop(); - if (forward && !wordEnd) { - // w - if (!shortCircuit && (firstWord.from != curStart.ch || firstWord.line != curStart.line)) { - // We did not start in the middle of a word. Discard the extra word at the end. - lastWord = words.pop(); - } - return Pos(lastWord.line, lastWord.from); - } else if (forward && wordEnd) { - return Pos(lastWord.line, lastWord.to - 1); - } else if (!forward && wordEnd) { - // ge - if (!shortCircuit && (firstWord.to != curStart.ch || firstWord.line != curStart.line)) { - // We did not start in the middle of a word. Discard the extra word at the end. - lastWord = words.pop(); - } - return Pos(lastWord.line, lastWord.to); - } else { - // b - return Pos(lastWord.line, lastWord.from); - } - } - - function moveToCharacter(cm, repeat, forward, character) { - var cur = cm.getCursor(); - var start = cur.ch; - var idx; - for (var i = 0; i < repeat; i ++) { - var line = cm.getLine(cur.line); - idx = charIdxInLine(start, line, character, forward, true); - if (idx == -1) { - return null; - } - start = idx; - } - return Pos(cm.getCursor().line, idx); - } - - function moveToColumn(cm, repeat) { - // repeat is always >= 1, so repeat - 1 always corresponds - // to the column we want to go to. - var line = cm.getCursor().line; - return clipCursorToContent(cm, Pos(line, repeat - 1)); - } - - function updateMark(cm, vim, markName, pos) { - if (!inArray(markName, validMarks)) { - return; - } - if (vim.marks[markName]) { - vim.marks[markName].clear(); - } - vim.marks[markName] = cm.setBookmark(pos); - } - - function charIdxInLine(start, line, character, forward, includeChar) { - // Search for char in line. - // motion_options: {forward, includeChar} - // If includeChar = true, include it too. - // If forward = true, search forward, else search backwards. - // If char is not found on this line, do nothing - var idx; - if (forward) { - idx = line.indexOf(character, start + 1); - if (idx != -1 && !includeChar) { - idx -= 1; - } - } else { - idx = line.lastIndexOf(character, start - 1); - if (idx != -1 && !includeChar) { - idx += 1; - } - } - return idx; - } - - function findParagraph(cm, head, repeat, dir, inclusive) { - var line = head.line; - var min = cm.firstLine(); - var max = cm.lastLine(); - var start, end, i = line; - function isEmpty(i) { return !cm.getLine(i); } - function isBoundary(i, dir, any) { - if (any) { return isEmpty(i) != isEmpty(i + dir); } - return !isEmpty(i) && isEmpty(i + dir); - } - if (dir) { - while (min <= i && i <= max && repeat > 0) { - if (isBoundary(i, dir)) { repeat--; } - i += dir; - } - return new Pos(i, 0); - } - - var vim = cm.state.vim; - if (vim.visualLine && isBoundary(line, 1, true)) { - var anchor = vim.sel.anchor; - if (isBoundary(anchor.line, -1, true)) { - if (!inclusive || anchor.line != line) { - line += 1; - } - } - } - var startState = isEmpty(line); - for (i = line; i <= max && repeat; i++) { - if (isBoundary(i, 1, true)) { - if (!inclusive || isEmpty(i) != startState) { - repeat--; - } - } - } - end = new Pos(i, 0); - // select boundary before paragraph for the last one - if (i > max && !startState) { startState = true; } - else { inclusive = false; } - for (i = line; i > min; i--) { - if (!inclusive || isEmpty(i) == startState || i == line) { - if (isBoundary(i, -1, true)) { break; } - } - } - start = new Pos(i, 0); - return { start: start, end: end }; - } - - // TODO: perhaps this finagling of start and end positions belonds - // in codmirror/replaceRange? - function selectCompanionObject(cm, head, symb, inclusive) { - var cur = head, start, end; - - var bracketRegexp = ({ - '(': /[()]/, ')': /[()]/, - '[': /[[\]]/, ']': /[[\]]/, - '{': /[{}]/, '}': /[{}]/})[symb]; - var openSym = ({ - '(': '(', ')': '(', - '[': '[', ']': '[', - '{': '{', '}': '{'})[symb]; - var curChar = cm.getLine(cur.line).charAt(cur.ch); - // Due to the behavior of scanForBracket, we need to add an offset if the - // cursor is on a matching open bracket. - var offset = curChar === openSym ? 1 : 0; - - start = cm.scanForBracket(Pos(cur.line, cur.ch + offset), -1, null, {'bracketRegex': bracketRegexp}); - end = cm.scanForBracket(Pos(cur.line, cur.ch + offset), 1, null, {'bracketRegex': bracketRegexp}); - - if (!start || !end) { - return { start: cur, end: cur }; - } - - start = start.pos; - end = end.pos; - - if ((start.line == end.line && start.ch > end.ch) - || (start.line > end.line)) { - var tmp = start; - start = end; - end = tmp; - } - - if (inclusive) { - end.ch += 1; - } else { - start.ch += 1; - } - - return { start: start, end: end }; - } - - // Takes in a symbol and a cursor and tries to simulate text objects that - // have identical opening and closing symbols - // TODO support across multiple lines - function findBeginningAndEnd(cm, head, symb, inclusive) { - var cur = copyCursor(head); - var line = cm.getLine(cur.line); - var chars = line.split(''); - var start, end, i, len; - var firstIndex = chars.indexOf(symb); - - // the decision tree is to always look backwards for the beginning first, - // but if the cursor is in front of the first instance of the symb, - // then move the cursor forward - if (cur.ch < firstIndex) { - cur.ch = firstIndex; - // Why is this line even here??? - // cm.setCursor(cur.line, firstIndex+1); - } - // otherwise if the cursor is currently on the closing symbol - else if (firstIndex < cur.ch && chars[cur.ch] == symb) { - end = cur.ch; // assign end to the current cursor - --cur.ch; // make sure to look backwards - } - - // if we're currently on the symbol, we've got a start - if (chars[cur.ch] == symb && !end) { - start = cur.ch + 1; // assign start to ahead of the cursor - } else { - // go backwards to find the start - for (i = cur.ch; i > -1 && !start; i--) { - if (chars[i] == symb) { - start = i + 1; - } - } - } - - // look forwards for the end symbol - if (start && !end) { - for (i = start, len = chars.length; i < len && !end; i++) { - if (chars[i] == symb) { - end = i; - } - } - } - - // nothing found - if (!start || !end) { - return { start: cur, end: cur }; - } - - // include the symbols - if (inclusive) { - --start; ++end; - } - - return { - start: Pos(cur.line, start), - end: Pos(cur.line, end) - }; - } - - // Search functions - defineOption('pcre', true, 'boolean'); - function SearchState() {} - SearchState.prototype = { - getQuery: function() { - return vimGlobalState.query; - }, - setQuery: function(query) { - vimGlobalState.query = query; - }, - getOverlay: function() { - return this.searchOverlay; - }, - setOverlay: function(overlay) { - this.searchOverlay = overlay; - }, - isReversed: function() { - return vimGlobalState.isReversed; - }, - setReversed: function(reversed) { - vimGlobalState.isReversed = reversed; - }, - getScrollbarAnnotate: function() { - return this.annotate; - }, - setScrollbarAnnotate: function(annotate) { - this.annotate = annotate; - } - }; - function getSearchState(cm) { - var vim = cm.state.vim; - return vim.searchState_ || (vim.searchState_ = new SearchState()); - } - function dialog(cm, template, shortText, onClose, options) { - if (cm.openDialog) { - cm.openDialog(template, onClose, { bottom: true, value: options.value, - onKeyDown: options.onKeyDown, onKeyUp: options.onKeyUp }); - } - else { - onClose(prompt(shortText, '')); - } - } - function splitBySlash(argString) { - var slashes = findUnescapedSlashes(argString) || []; - if (!slashes.length) return []; - var tokens = []; - // in case of strings like foo/bar - if (slashes[0] !== 0) return; - for (var i = 0; i < slashes.length; i++) { - if (typeof slashes[i] == 'number') - tokens.push(argString.substring(slashes[i] + 1, slashes[i+1])); - } - return tokens; - } - - function findUnescapedSlashes(str) { - var escapeNextChar = false; - var slashes = []; - for (var i = 0; i < str.length; i++) { - var c = str.charAt(i); - if (!escapeNextChar && c == '/') { - slashes.push(i); - } - escapeNextChar = !escapeNextChar && (c == '\\'); - } - return slashes; - } - - // Translates a search string from ex (vim) syntax into javascript form. - function translateRegex(str) { - // When these match, add a '\' if unescaped or remove one if escaped. - var specials = '|(){'; - // Remove, but never add, a '\' for these. - var unescape = '}'; - var escapeNextChar = false; - var out = []; - for (var i = -1; i < str.length; i++) { - var c = str.charAt(i) || ''; - var n = str.charAt(i+1) || ''; - var specialComesNext = (n && specials.indexOf(n) != -1); - if (escapeNextChar) { - if (c !== '\\' || !specialComesNext) { - out.push(c); - } - escapeNextChar = false; - } else { - if (c === '\\') { - escapeNextChar = true; - // Treat the unescape list as special for removing, but not adding '\'. - if (n && unescape.indexOf(n) != -1) { - specialComesNext = true; - } - // Not passing this test means removing a '\'. - if (!specialComesNext || n === '\\') { - out.push(c); - } - } else { - out.push(c); - if (specialComesNext && n !== '\\') { - out.push('\\'); - } - } - } - } - return out.join(''); - } - - // Translates the replace part of a search and replace from ex (vim) syntax into - // javascript form. Similar to translateRegex, but additionally fixes back references - // (translates '\[0..9]' to '$[0..9]') and follows different rules for escaping '$'. - function translateRegexReplace(str) { - var escapeNextChar = false; - var out = []; - for (var i = -1; i < str.length; i++) { - var c = str.charAt(i) || ''; - var n = str.charAt(i+1) || ''; - if (escapeNextChar) { - // At any point in the loop, escapeNextChar is true if the previous - // character was a '\' and was not escaped. - out.push(c); - escapeNextChar = false; - } else { - if (c === '\\') { - escapeNextChar = true; - if ((isNumber(n) || n === '$')) { - out.push('$'); - } else if (n !== '/' && n !== '\\') { - out.push('\\'); - } - } else { - if (c === '$') { - out.push('$'); - } - out.push(c); - if (n === '/') { - out.push('\\'); - } - } - } - } - return out.join(''); - } - - // Unescape \ and / in the replace part, for PCRE mode. - function unescapeRegexReplace(str) { - var stream = new CodeMirror.StringStream(str); - var output = []; - while (!stream.eol()) { - // Search for \. - while (stream.peek() && stream.peek() != '\\') { - output.push(stream.next()); - } - if (stream.match('\\/', true)) { - // \/ => / - output.push('/'); - } else if (stream.match('\\\\', true)) { - // \\ => \ - output.push('\\'); - } else { - // Don't change anything - output.push(stream.next()); - } - } - return output.join(''); - } - - /** - * Extract the regular expression from the query and return a Regexp object. - * Returns null if the query is blank. - * If ignoreCase is passed in, the Regexp object will have the 'i' flag set. - * If smartCase is passed in, and the query contains upper case letters, - * then ignoreCase is overridden, and the 'i' flag will not be set. - * If the query contains the /i in the flag part of the regular expression, - * then both ignoreCase and smartCase are ignored, and 'i' will be passed - * through to the Regex object. - */ - function parseQuery(query, ignoreCase, smartCase) { - // First update the last search register - var lastSearchRegister = vimGlobalState.registerController.getRegister('/'); - lastSearchRegister.setText(query); - // Check if the query is already a regex. - if (query instanceof RegExp) { return query; } - // First try to extract regex + flags from the input. If no flags found, - // extract just the regex. IE does not accept flags directly defined in - // the regex string in the form /regex/flags - var slashes = findUnescapedSlashes(query); - var regexPart; - var forceIgnoreCase; - if (!slashes.length) { - // Query looks like 'regexp' - regexPart = query; - } else { - // Query looks like 'regexp/...' - regexPart = query.substring(0, slashes[0]); - var flagsPart = query.substring(slashes[0]); - forceIgnoreCase = (flagsPart.indexOf('i') != -1); - } - if (!regexPart) { - return null; - } - if (!getOption('pcre')) { - regexPart = translateRegex(regexPart); - } - if (smartCase) { - ignoreCase = (/^[^A-Z]*$/).test(regexPart); - } - var regexp = new RegExp(regexPart, - (ignoreCase || forceIgnoreCase) ? 'i' : undefined); - return regexp; - } - function showConfirm(cm, text) { - if (cm.openNotification) { - cm.openNotification('' + text + '', - {bottom: true, duration: 5000}); - } else { - alert(text); - } - } - function makePrompt(prefix, desc) { - var raw = ''; - if (prefix) { - raw += '' + prefix + ''; - } - raw += ' ' + - ''; - if (desc) { - raw += ''; - raw += desc; - raw += ''; - } - return raw; - } - var searchPromptDesc = '(Javascript regexp)'; - function showPrompt(cm, options) { - var shortText = (options.prefix || '') + ' ' + (options.desc || ''); - var prompt = makePrompt(options.prefix, options.desc); - dialog(cm, prompt, shortText, options.onClose, options); - } - function regexEqual(r1, r2) { - if (r1 instanceof RegExp && r2 instanceof RegExp) { - var props = ['global', 'multiline', 'ignoreCase', 'source']; - for (var i = 0; i < props.length; i++) { - var prop = props[i]; - if (r1[prop] !== r2[prop]) { - return false; - } - } - return true; - } - return false; - } - // Returns true if the query is valid. - function updateSearchQuery(cm, rawQuery, ignoreCase, smartCase) { - if (!rawQuery) { - return; - } - var state = getSearchState(cm); - var query = parseQuery(rawQuery, !!ignoreCase, !!smartCase); - if (!query) { - return; - } - highlightSearchMatches(cm, query); - if (regexEqual(query, state.getQuery())) { - return query; - } - state.setQuery(query); - return query; - } - function searchOverlay(query) { - if (query.source.charAt(0) == '^') { - var matchSol = true; - } - return { - token: function(stream) { - if (matchSol && !stream.sol()) { - stream.skipToEnd(); - return; - } - var match = stream.match(query, false); - if (match) { - if (match[0].length == 0) { - // Matched empty string, skip to next. - stream.next(); - return 'searching'; - } - if (!stream.sol()) { - // Backtrack 1 to match \b - stream.backUp(1); - if (!query.exec(stream.next() + match[0])) { - stream.next(); - return null; - } - } - stream.match(query); - return 'searching'; - } - while (!stream.eol()) { - stream.next(); - if (stream.match(query, false)) break; - } - }, - query: query - }; - } - function highlightSearchMatches(cm, query) { - var searchState = getSearchState(cm); - var overlay = searchState.getOverlay(); - if (!overlay || query != overlay.query) { - if (overlay) { - cm.removeOverlay(overlay); - } - overlay = searchOverlay(query); - cm.addOverlay(overlay); - if (cm.showMatchesOnScrollbar) { - if (searchState.getScrollbarAnnotate()) { - searchState.getScrollbarAnnotate().clear(); - } - searchState.setScrollbarAnnotate(cm.showMatchesOnScrollbar(query)); - } - searchState.setOverlay(overlay); - } - } - function findNext(cm, prev, query, repeat) { - if (repeat === undefined) { repeat = 1; } - return cm.operation(function() { - var pos = cm.getCursor(); - var cursor = cm.getSearchCursor(query, pos); - for (var i = 0; i < repeat; i++) { - var found = cursor.find(prev); - if (i == 0 && found && cursorEqual(cursor.from(), pos)) { found = cursor.find(prev); } - if (!found) { - // SearchCursor may have returned null because it hit EOF, wrap - // around and try again. - cursor = cm.getSearchCursor(query, - (prev) ? Pos(cm.lastLine()) : Pos(cm.firstLine(), 0) ); - if (!cursor.find(prev)) { - return; - } - } - } - return cursor.from(); - }); - } - function clearSearchHighlight(cm) { - var state = getSearchState(cm); - cm.removeOverlay(getSearchState(cm).getOverlay()); - state.setOverlay(null); - if (state.getScrollbarAnnotate()) { - state.getScrollbarAnnotate().clear(); - state.setScrollbarAnnotate(null); - } - } - /** - * Check if pos is in the specified range, INCLUSIVE. - * Range can be specified with 1 or 2 arguments. - * If the first range argument is an array, treat it as an array of line - * numbers. Match pos against any of the lines. - * If the first range argument is a number, - * if there is only 1 range argument, check if pos has the same line - * number - * if there are 2 range arguments, then check if pos is in between the two - * range arguments. - */ - function isInRange(pos, start, end) { - if (typeof pos != 'number') { - // Assume it is a cursor position. Get the line number. - pos = pos.line; - } - if (start instanceof Array) { - return inArray(pos, start); - } else { - if (end) { - return (pos >= start && pos <= end); - } else { - return pos == start; - } - } - } - function getUserVisibleLines(cm) { - var scrollInfo = cm.getScrollInfo(); - var occludeToleranceTop = 6; - var occludeToleranceBottom = 10; - var from = cm.coordsChar({left:0, top: occludeToleranceTop + scrollInfo.top}, 'local'); - var bottomY = scrollInfo.clientHeight - occludeToleranceBottom + scrollInfo.top; - var to = cm.coordsChar({left:0, top: bottomY}, 'local'); - return {top: from.line, bottom: to.line}; - } - - // Ex command handling - // Care must be taken when adding to the default Ex command map. For any - // pair of commands that have a shared prefix, at least one of their - // shortNames must not match the prefix of the other command. - var defaultExCommandMap = [ - { 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: 'set' }, - { name: 'sort', shortName: 'sor' }, - { name: 'substitute', shortName: 's', possiblyAsync: true }, - { name: 'nohlsearch', shortName: 'noh' }, - { name: 'delmarks', shortName: 'delm' }, - { name: 'registers', shortName: 'reg', excludeFromCommandHistory: true }, - { name: 'global', shortName: 'g' } - ]; - var ExCommandDispatcher = function() { - this.buildCommandMap_(); - }; - ExCommandDispatcher.prototype = { - processCommand: function(cm, input, opt_params) { - var vim = cm.state.vim; - var commandHistoryRegister = vimGlobalState.registerController.getRegister(':'); - var previousCommand = commandHistoryRegister.toString(); - if (vim.visualMode) { - exitVisualMode(cm); - } - var inputStream = new CodeMirror.StringStream(input); - // update ": with the latest command whether valid or invalid - commandHistoryRegister.setText(input); - var params = opt_params || {}; - params.input = input; - try { - this.parseInput_(cm, inputStream, params); - } catch(e) { - showConfirm(cm, e); - throw e; - } - var command; - var commandName; - if (!params.commandName) { - // If only a line range is defined, move to the line. - if (params.line !== undefined) { - commandName = 'move'; - } - } else { - command = this.matchCommand_(params.commandName); - if (command) { - commandName = command.name; - if (command.excludeFromCommandHistory) { - commandHistoryRegister.setText(previousCommand); - } - this.parseCommandArgs_(inputStream, params, command); - if (command.type == 'exToKey') { - // Handle Ex to Key mapping. - for (var i = 0; i < command.toKeys.length; i++) { - CodeMirror.Vim.handleKey(cm, command.toKeys[i], 'mapping'); - } - return; - } else if (command.type == 'exToEx') { - // Handle Ex to Ex mapping. - this.processCommand(cm, command.toInput); - return; - } - } - } - if (!commandName) { - showConfirm(cm, 'Not an editor command ":' + input + '"'); - return; - } - try { - exCommands[commandName](cm, params); - // Possibly asynchronous commands (e.g. substitute, which might have a - // user confirmation), are responsible for calling the callback when - // done. All others have it taken care of for them here. - if ((!command || !command.possiblyAsync) && params.callback) { - params.callback(); - } - } catch(e) { - showConfirm(cm, e); - throw e; - } - }, - parseInput_: function(cm, inputStream, result) { - inputStream.eatWhile(':'); - // Parse range. - if (inputStream.eat('%')) { - result.line = cm.firstLine(); - result.lineEnd = cm.lastLine(); - } else { - result.line = this.parseLineSpec_(cm, inputStream); - if (result.line !== undefined && inputStream.eat(',')) { - result.lineEnd = this.parseLineSpec_(cm, inputStream); - } - } - - // Parse command name. - var commandMatch = inputStream.match(/^(\w+)/); - if (commandMatch) { - result.commandName = commandMatch[1]; - } else { - result.commandName = inputStream.match(/.*/)[0]; - } - - return result; - }, - parseLineSpec_: function(cm, inputStream) { - var numberMatch = inputStream.match(/^(\d+)/); - if (numberMatch) { - return parseInt(numberMatch[1], 10) - 1; - } - switch (inputStream.next()) { - case '.': - return cm.getCursor().line; - case '$': - return cm.lastLine(); - case '\'': - var mark = cm.state.vim.marks[inputStream.next()]; - if (mark && mark.find()) { - return mark.find().line; - } - throw new Error('Mark not set'); - default: - inputStream.backUp(1); - return undefined; - } - }, - parseCommandArgs_: function(inputStream, params, command) { - if (inputStream.eol()) { - return; - } - params.argString = inputStream.match(/.*/)[0]; - // Parse command-line arguments - var delim = command.argDelimiter || /\s+/; - var args = trim(params.argString).split(delim); - if (args.length && args[0]) { - params.args = args; - } - }, - matchCommand_: function(commandName) { - // Return the command in the command map that matches the shortest - // prefix of the passed in command name. The match is guaranteed to be - // unambiguous if the defaultExCommandMap's shortNames are set up - // correctly. (see @code{defaultExCommandMap}). - for (var i = commandName.length; i > 0; i--) { - var prefix = commandName.substring(0, i); - if (this.commandMap_[prefix]) { - var command = this.commandMap_[prefix]; - if (command.name.indexOf(commandName) === 0) { - return command; - } - } - } - return null; - }, - buildCommandMap_: function() { - this.commandMap_ = {}; - for (var i = 0; i < defaultExCommandMap.length; i++) { - var command = defaultExCommandMap[i]; - var key = command.shortName || command.name; - this.commandMap_[key] = command; - } - }, - map: function(lhs, rhs, ctx) { - if (lhs != ':' && lhs.charAt(0) == ':') { - if (ctx) { throw Error('Mode not supported for ex mappings'); } - var commandName = lhs.substring(1); - if (rhs != ':' && rhs.charAt(0) == ':') { - // Ex to Ex mapping - this.commandMap_[commandName] = { - name: commandName, - type: 'exToEx', - toInput: rhs.substring(1), - user: true - }; - } else { - // Ex to key mapping - this.commandMap_[commandName] = { - name: commandName, - type: 'exToKey', - toKeys: rhs, - user: true - }; - } - } else { - if (rhs != ':' && rhs.charAt(0) == ':') { - // Key to Ex mapping. - var mapping = { - keys: lhs, - type: 'keyToEx', - exArgs: { input: rhs.substring(1) }, - user: true}; - if (ctx) { mapping.context = ctx; } - defaultKeymap.unshift(mapping); - } else { - // Key to key mapping - var mapping = { - keys: lhs, - type: 'keyToKey', - toKeys: rhs, - user: true - }; - if (ctx) { mapping.context = ctx; } - defaultKeymap.unshift(mapping); - } - } - }, - unmap: function(lhs, ctx) { - if (lhs != ':' && lhs.charAt(0) == ':') { - // Ex to Ex or Ex to key mapping - if (ctx) { throw Error('Mode not supported for ex mappings'); } - var commandName = lhs.substring(1); - if (this.commandMap_[commandName] && this.commandMap_[commandName].user) { - delete this.commandMap_[commandName]; - return; - } - } else { - // Key to Ex or key to key mapping - var keys = lhs; - for (var i = 0; i < defaultKeymap.length; i++) { - if (keys == defaultKeymap[i].keys - && defaultKeymap[i].context === ctx - && defaultKeymap[i].user) { - defaultKeymap.splice(i, 1); - return; - } - } - } - throw Error('No such mapping.'); - } - }; - - var exCommands = { - map: function(cm, params, ctx) { - var mapArgs = params.args; - if (!mapArgs || mapArgs.length < 2) { - if (cm) { - showConfirm(cm, 'Invalid mapping: ' + params.input); - } - return; - } - exCommandDispatcher.map(mapArgs[0], mapArgs[1], ctx); - }, - imap: function(cm, params) { this.map(cm, params, 'insert'); }, - nmap: function(cm, params) { this.map(cm, params, 'normal'); }, - vmap: function(cm, params) { this.map(cm, params, 'visual'); }, - unmap: function(cm, params, ctx) { - var mapArgs = params.args; - if (!mapArgs || mapArgs.length < 1) { - if (cm) { - showConfirm(cm, 'No such mapping: ' + params.input); - } - return; - } - exCommandDispatcher.unmap(mapArgs[0], ctx); - }, - move: function(cm, params) { - commandDispatcher.processCommand(cm, cm.state.vim, { - type: 'motion', - motion: 'moveToLineOrEdgeOfDocument', - motionArgs: { forward: false, explicitRepeat: true, - linewise: true }, - repeatOverride: params.line+1}); - }, - set: function(cm, params) { - var setArgs = params.args; - if (!setArgs || setArgs.length < 1) { - if (cm) { - showConfirm(cm, 'Invalid mapping: ' + params.input); - } - return; - } - var expr = setArgs[0].split('='); - var optionName = expr[0]; - var value = expr[1]; - var forceGet = false; - - if (optionName.charAt(optionName.length - 1) == '?') { - // If post-fixed with ?, then the set is actually a get. - if (value) { throw Error('Trailing characters: ' + params.argString); } - optionName = optionName.substring(0, optionName.length - 1); - forceGet = true; - } - if (value === undefined && optionName.substring(0, 2) == 'no') { - // To set boolean options to false, the option name is prefixed with - // 'no'. - optionName = optionName.substring(2); - value = false; - } - var optionIsBoolean = options[optionName] && options[optionName].type == 'boolean'; - if (optionIsBoolean && value == undefined) { - // Calling set with a boolean option sets it to true. - value = true; - } - if (!optionIsBoolean && !value || forceGet) { - var oldValue = getOption(optionName); - // If no value is provided, then we assume this is a get. - if (oldValue === true || oldValue === false) { - showConfirm(cm, ' ' + (oldValue ? '' : 'no') + optionName); - } else { - showConfirm(cm, ' ' + optionName + '=' + oldValue); - } - } else { - setOption(optionName, value); - } - }, - registers: function(cm,params) { - var regArgs = params.args; - var registers = vimGlobalState.registerController.registers; - var regInfo = '----------Registers----------

    '; - if (!regArgs) { - for (var registerName in registers) { - var text = registers[registerName].toString(); - if (text.length) { - regInfo += '"' + registerName + ' ' + text + '
    '; - } - } - } else { - var registerName; - regArgs = regArgs.join(''); - for (var i = 0; i < regArgs.length; i++) { - registerName = regArgs.charAt(i); - if (!vimGlobalState.registerController.isValidRegister(registerName)) { - continue; - } - var register = registers[registerName] || new Register(); - regInfo += '"' + registerName + ' ' + register.toString() + '
    '; - } - } - showConfirm(cm, regInfo); - }, - sort: function(cm, params) { - var reverse, ignoreCase, unique, number; - function parseArgs() { - if (params.argString) { - var args = new CodeMirror.StringStream(params.argString); - if (args.eat('!')) { reverse = true; } - if (args.eol()) { return; } - if (!args.eatSpace()) { return 'Invalid arguments'; } - var opts = args.match(/[a-z]+/); - if (opts) { - opts = opts[0]; - ignoreCase = opts.indexOf('i') != -1; - unique = opts.indexOf('u') != -1; - var decimal = opts.indexOf('d') != -1 && 1; - var hex = opts.indexOf('x') != -1 && 1; - var octal = opts.indexOf('o') != -1 && 1; - if (decimal + hex + octal > 1) { return 'Invalid arguments'; } - number = decimal && 'decimal' || hex && 'hex' || octal && 'octal'; - } - if (args.eatSpace() && args.match(/\/.*\//)) { 'patterns not supported'; } - } - } - var err = parseArgs(); - if (err) { - showConfirm(cm, err + ': ' + params.argString); - return; - } - var lineStart = params.line || cm.firstLine(); - var lineEnd = params.lineEnd || params.line || cm.lastLine(); - if (lineStart == lineEnd) { return; } - var curStart = Pos(lineStart, 0); - var curEnd = Pos(lineEnd, lineLength(cm, lineEnd)); - var text = cm.getRange(curStart, curEnd).split('\n'); - var numberRegex = (number == 'decimal') ? /(-?)([\d]+)/ : - (number == 'hex') ? /(-?)(?:0x)?([0-9a-f]+)/i : - (number == 'octal') ? /([0-7]+)/ : null; - var radix = (number == 'decimal') ? 10 : (number == 'hex') ? 16 : (number == 'octal') ? 8 : null; - var numPart = [], textPart = []; - if (number) { - for (var i = 0; i < text.length; i++) { - if (numberRegex.exec(text[i])) { - numPart.push(text[i]); - } else { - textPart.push(text[i]); - } - } - } else { - textPart = text; - } - function compareFn(a, b) { - if (reverse) { var tmp; tmp = a; a = b; b = tmp; } - if (ignoreCase) { a = a.toLowerCase(); b = b.toLowerCase(); } - var anum = number && numberRegex.exec(a); - var bnum = number && numberRegex.exec(b); - if (!anum) { return a < b ? -1 : 1; } - anum = parseInt((anum[1] + anum[2]).toLowerCase(), radix); - bnum = parseInt((bnum[1] + bnum[2]).toLowerCase(), radix); - return anum - bnum; - } - numPart.sort(compareFn); - textPart.sort(compareFn); - text = (!reverse) ? textPart.concat(numPart) : numPart.concat(textPart); - if (unique) { // Remove duplicate lines - var textOld = text; - var lastLine; - text = []; - for (var i = 0; i < textOld.length; i++) { - if (textOld[i] != lastLine) { - text.push(textOld[i]); - } - lastLine = textOld[i]; - } - } - cm.replaceRange(text.join('\n'), curStart, curEnd); - }, - global: function(cm, params) { - // a global command is of the form - // :[range]g/pattern/[cmd] - // argString holds the string /pattern/[cmd] - var argString = params.argString; - if (!argString) { - showConfirm(cm, 'Regular Expression missing from global'); - return; - } - // range is specified here - var lineStart = (params.line !== undefined) ? params.line : cm.firstLine(); - var lineEnd = params.lineEnd || params.line || cm.lastLine(); - // get the tokens from argString - var tokens = splitBySlash(argString); - var regexPart = argString, cmd; - if (tokens.length) { - regexPart = tokens[0]; - cmd = tokens.slice(1, tokens.length).join('/'); - } - if (regexPart) { - // If regex part is empty, then use the previous query. Otherwise - // use the regex part as the new query. - try { - updateSearchQuery(cm, regexPart, true /** ignoreCase */, - true /** smartCase */); - } catch (e) { - showConfirm(cm, 'Invalid regex: ' + regexPart); - return; - } - } - // now that we have the regexPart, search for regex matches in the - // specified range of lines - var query = getSearchState(cm).getQuery(); - var matchedLines = [], content = ''; - for (var i = lineStart; i <= lineEnd; i++) { - var matched = query.test(cm.getLine(i)); - if (matched) { - matchedLines.push(i+1); - content+= cm.getLine(i) + '
    '; - } - } - // if there is no [cmd], just display the list of matched lines - if (!cmd) { - showConfirm(cm, content); - return; - } - var index = 0; - var nextCommand = function() { - if (index < matchedLines.length) { - var command = matchedLines[index] + cmd; - exCommandDispatcher.processCommand(cm, command, { - callback: nextCommand - }); - } - index++; - }; - nextCommand(); - }, - substitute: function(cm, params) { - if (!cm.getSearchCursor) { - throw new Error('Search feature not available. Requires searchcursor.js or ' + - 'any other getSearchCursor implementation.'); - } - var argString = params.argString; - var tokens = argString ? splitBySlash(argString) : []; - var regexPart, replacePart = '', trailing, flagsPart, count; - var confirm = false; // Whether to confirm each replace. - var global = false; // True to replace all instances on a line, false to replace only 1. - if (tokens.length) { - regexPart = tokens[0]; - replacePart = tokens[1]; - if (replacePart !== undefined) { - if (getOption('pcre')) { - replacePart = unescapeRegexReplace(replacePart); - } else { - replacePart = translateRegexReplace(replacePart); - } - vimGlobalState.lastSubstituteReplacePart = replacePart; - } - trailing = tokens[2] ? tokens[2].split(' ') : []; - } else { - // either the argString is empty or its of the form ' hello/world' - // actually splitBySlash returns a list of tokens - // only if the string starts with a '/' - if (argString && argString.length) { - showConfirm(cm, 'Substitutions should be of the form ' + - ':s/pattern/replace/'); - return; - } - } - // After the 3rd slash, we can have flags followed by a space followed - // by count. - if (trailing) { - flagsPart = trailing[0]; - count = parseInt(trailing[1]); - if (flagsPart) { - if (flagsPart.indexOf('c') != -1) { - confirm = true; - flagsPart.replace('c', ''); - } - if (flagsPart.indexOf('g') != -1) { - global = true; - flagsPart.replace('g', ''); - } - regexPart = regexPart + '/' + flagsPart; - } - } - if (regexPart) { - // If regex part is empty, then use the previous query. Otherwise use - // the regex part as the new query. - try { - updateSearchQuery(cm, regexPart, true /** ignoreCase */, - true /** smartCase */); - } catch (e) { - showConfirm(cm, 'Invalid regex: ' + regexPart); - return; - } - } - replacePart = replacePart || vimGlobalState.lastSubstituteReplacePart; - if (replacePart === undefined) { - showConfirm(cm, 'No previous substitute regular expression'); - return; - } - var state = getSearchState(cm); - var query = state.getQuery(); - var lineStart = (params.line !== undefined) ? params.line : cm.getCursor().line; - var lineEnd = params.lineEnd || lineStart; - if (count) { - lineStart = lineEnd; - lineEnd = lineStart + count - 1; - } - var startPos = clipCursorToContent(cm, Pos(lineStart, 0)); - var cursor = cm.getSearchCursor(query, startPos); - doReplace(cm, confirm, global, lineStart, lineEnd, cursor, query, replacePart, params.callback); - }, - redo: CodeMirror.commands.redo, - undo: CodeMirror.commands.undo, - write: function(cm) { - if (CodeMirror.commands.save) { - // If a save command is defined, call it. - CodeMirror.commands.save(cm); - } else { - // Saves to text area if no save command is defined. - cm.save(); - } - }, - nohlsearch: function(cm) { - clearSearchHighlight(cm); - }, - delmarks: function(cm, params) { - if (!params.argString || !trim(params.argString)) { - showConfirm(cm, 'Argument required'); - return; - } - - var state = cm.state.vim; - var stream = new CodeMirror.StringStream(trim(params.argString)); - while (!stream.eol()) { - stream.eatSpace(); - - // Record the streams position at the beginning of the loop for use - // in error messages. - var count = stream.pos; - - if (!stream.match(/[a-zA-Z]/, false)) { - showConfirm(cm, 'Invalid argument: ' + params.argString.substring(count)); - return; - } - - var sym = stream.next(); - // Check if this symbol is part of a range - if (stream.match('-', true)) { - // This symbol is part of a range. - - // The range must terminate at an alphabetic character. - if (!stream.match(/[a-zA-Z]/, false)) { - showConfirm(cm, 'Invalid argument: ' + params.argString.substring(count)); - return; - } - - var startMark = sym; - var finishMark = stream.next(); - // The range must terminate at an alphabetic character which - // shares the same case as the start of the range. - if (isLowerCase(startMark) && isLowerCase(finishMark) || - isUpperCase(startMark) && isUpperCase(finishMark)) { - var start = startMark.charCodeAt(0); - var finish = finishMark.charCodeAt(0); - if (start >= finish) { - showConfirm(cm, 'Invalid argument: ' + params.argString.substring(count)); - return; - } - - // Because marks are always ASCII values, and we have - // determined that they are the same case, we can use - // their char codes to iterate through the defined range. - for (var j = 0; j <= finish - start; j++) { - var mark = String.fromCharCode(start + j); - delete state.marks[mark]; - } - } else { - showConfirm(cm, 'Invalid argument: ' + startMark + '-'); - return; - } - } else { - // This symbol is a valid mark, and is not part of a range. - delete state.marks[sym]; - } - } - } - }; - - var exCommandDispatcher = new ExCommandDispatcher(); - - /** - * @param {CodeMirror} cm CodeMirror instance we are in. - * @param {boolean} confirm Whether to confirm each replace. - * @param {Cursor} lineStart Line to start replacing from. - * @param {Cursor} lineEnd Line to stop replacing at. - * @param {RegExp} query Query for performing matches with. - * @param {string} replaceWith Text to replace matches with. May contain $1, - * $2, etc for replacing captured groups using Javascript replace. - * @param {function()} callback A callback for when the replace is done. - */ - function doReplace(cm, confirm, global, lineStart, lineEnd, searchCursor, query, - replaceWith, callback) { - // Set up all the functions. - cm.state.vim.exMode = true; - var done = false; - var lastPos = searchCursor.from(); - function replaceAll() { - cm.operation(function() { - while (!done) { - replace(); - next(); - } - stop(); - }); - } - function replace() { - var text = cm.getRange(searchCursor.from(), searchCursor.to()); - var newText = text.replace(query, replaceWith); - searchCursor.replace(newText); - } - function next() { - var found; - // The below only loops to skip over multiple occurrences on the same - // line when 'global' is not true. - while(found = searchCursor.findNext() && - isInRange(searchCursor.from(), lineStart, lineEnd)) { - if (!global && lastPos && searchCursor.from().line == lastPos.line) { - continue; - } - cm.scrollIntoView(searchCursor.from(), 30); - cm.setSelection(searchCursor.from(), searchCursor.to()); - lastPos = searchCursor.from(); - done = false; - return; - } - done = true; - } - function stop(close) { - if (close) { close(); } - cm.focus(); - if (lastPos) { - cm.setCursor(lastPos); - var vim = cm.state.vim; - vim.exMode = false; - vim.lastHPos = vim.lastHSPos = lastPos.ch; - } - if (callback) { callback(); } - } - function onPromptKeyDown(e, _value, close) { - // Swallow all keys. - CodeMirror.e_stop(e); - var keyName = CodeMirror.keyName(e); - switch (keyName) { - case 'Y': - replace(); next(); break; - case 'N': - next(); break; - case 'A': - // replaceAll contains a call to close of its own. We don't want it - // to fire too early or multiple times. - var savedCallback = callback; - callback = undefined; - cm.operation(replaceAll); - callback = savedCallback; - break; - case 'L': - replace(); - // fall through and exit. - case 'Q': - case 'Esc': - case 'Ctrl-C': - case 'Ctrl-[': - stop(close); - break; - } - if (done) { stop(close); } - return true; - } - - // Actually do replace. - next(); - if (done) { - showConfirm(cm, 'No matches for ' + query.source); - return; - } - if (!confirm) { - replaceAll(); - if (callback) { callback(); }; - return; - } - showPrompt(cm, { - prefix: 'replace with ' + replaceWith + ' (y/n/a/q/l)', - onKeyDown: onPromptKeyDown - }); - } - - CodeMirror.keyMap.vim = { - attach: attachVimMap, - detach: detachVimMap, - call: cmKey - }; - - function exitInsertMode(cm) { - var vim = cm.state.vim; - var macroModeState = vimGlobalState.macroModeState; - var insertModeChangeRegister = vimGlobalState.registerController.getRegister('.'); - var isPlaying = macroModeState.isPlaying; - var lastChange = macroModeState.lastInsertModeChanges; - // In case of visual block, the insertModeChanges are not saved as a - // single word, so we convert them to a single word - // so as to update the ". register as expected in real vim. - var text = []; - if (!isPlaying) { - var selLength = lastChange.inVisualBlock ? vim.lastSelection.visualBlock.height : 1; - var changes = lastChange.changes; - var text = []; - var i = 0; - // In case of multiple selections in blockwise visual, - // the inserted text, for example: 'foo', is stored as - // 'f', 'f', InsertModeKey 'o', 'o', 'o', 'o'. (if you have a block with 2 lines). - // We push the contents of the changes array as per the following: - // 1. In case of InsertModeKey, just increment by 1. - // 2. In case of a character, jump by selLength (2 in the example). - while (i < changes.length) { - // This loop will convert 'ffoooo' to 'foo'. - text.push(changes[i]); - if (changes[i] instanceof InsertModeKey) { - i++; - } else { - i+= selLength; - } - } - lastChange.changes = text; - cm.off('change', onChange); - CodeMirror.off(cm.getInputField(), 'keydown', onKeyEventTargetKeyDown); - } - if (!isPlaying && vim.insertModeRepeat > 1) { - // Perform insert mode repeat for commands like 3,a and 3,o. - repeatLastEdit(cm, vim, vim.insertModeRepeat - 1, - true /** repeatForInsert */); - vim.lastEditInputState.repeatOverride = vim.insertModeRepeat; - } - delete vim.insertModeRepeat; - vim.insertMode = false; - cm.setCursor(cm.getCursor().line, cm.getCursor().ch-1); - cm.setOption('keyMap', 'vim'); - cm.setOption('disableInput', true); - cm.toggleOverwrite(false); // exit replace mode if we were in it. - // update the ". register before exiting insert mode - insertModeChangeRegister.setText(lastChange.changes.join('')); - CodeMirror.signal(cm, "vim-mode-change", {mode: "normal"}); - if (macroModeState.isRecording) { - logInsertModeChange(macroModeState); - } - } - - // The timeout in milliseconds for the two-character ESC keymap should be - // adjusted according to your typing speed to prevent false positives. - defineOption('insertModeEscKeysTimeout', 200, 'number'); - - CodeMirror.keyMap['vim-insert'] = { - // TODO: override navigation keys so that Esc will cancel automatic - // indentation from o, O, i_ - 'Ctrl-N': 'autocomplete', - 'Ctrl-P': 'autocomplete', - 'Enter': function(cm) { - var fn = CodeMirror.commands.newlineAndIndentContinueComment || - CodeMirror.commands.newlineAndIndent; - fn(cm); - }, - fallthrough: ['default'], - attach: attachVimMap, - detach: detachVimMap, - call: cmKey - }; - - CodeMirror.keyMap['vim-replace'] = { - 'Backspace': 'goCharLeft', - fallthrough: ['vim-insert'], - attach: attachVimMap, - detach: detachVimMap, - call: cmKey - }; - - function executeMacroRegister(cm, vim, macroModeState, registerName) { - var register = vimGlobalState.registerController.getRegister(registerName); - var keyBuffer = register.keyBuffer; - var imc = 0; - macroModeState.isPlaying = true; - macroModeState.replaySearchQueries = register.searchQueries.slice(0); - for (var i = 0; i < keyBuffer.length; i++) { - var text = keyBuffer[i]; - var match, key; - while (text) { - // Pull off one command key, which is either a single character - // or a special sequence wrapped in '<' and '>', e.g. ''. - match = (/<\w+-.+?>|<\w+>|./).exec(text); - key = match[0]; - text = text.substring(match.index + key.length); - CodeMirror.Vim.handleKey(cm, key, 'macro'); - if (vim.insertMode) { - var changes = register.insertModeChanges[imc++].changes; - vimGlobalState.macroModeState.lastInsertModeChanges.changes = - changes; - repeatInsertModeChanges(cm, changes, 1); - exitInsertMode(cm); - } - } - }; - macroModeState.isPlaying = false; - } - - function logKey(macroModeState, key) { - if (macroModeState.isPlaying) { return; } - var registerName = macroModeState.latestRegister; - var register = vimGlobalState.registerController.getRegister(registerName); - if (register) { - register.pushText(key); - } - } - - function logInsertModeChange(macroModeState) { - if (macroModeState.isPlaying) { return; } - var registerName = macroModeState.latestRegister; - var register = vimGlobalState.registerController.getRegister(registerName); - if (register) { - register.pushInsertModeChanges(macroModeState.lastInsertModeChanges); - } - } - - function logSearchQuery(macroModeState, query) { - if (macroModeState.isPlaying) { return; } - var registerName = macroModeState.latestRegister; - var register = vimGlobalState.registerController.getRegister(registerName); - if (register) { - register.pushSearchQuery(query); - } - } - - /** - * Listens for changes made in insert mode. - * Should only be active in insert mode. - */ - function onChange(_cm, changeObj) { - var macroModeState = vimGlobalState.macroModeState; - var lastChange = macroModeState.lastInsertModeChanges; - if (!macroModeState.isPlaying) { - while(changeObj) { - lastChange.expectCursorActivityForChange = true; - if (changeObj.origin == '+input' || changeObj.origin == 'paste' - || changeObj.origin === undefined /* only in testing */) { - var text = changeObj.text.join('\n'); - lastChange.changes.push(text); - } - // Change objects may be chained with next. - changeObj = changeObj.next; - } - } - } - - /** - * Listens for any kind of cursor activity on CodeMirror. - */ - function onCursorActivity(cm) { - var vim = cm.state.vim; - if (vim.insertMode) { - // Tracking cursor activity in insert mode (for macro support). - var macroModeState = vimGlobalState.macroModeState; - if (macroModeState.isPlaying) { return; } - var lastChange = macroModeState.lastInsertModeChanges; - if (lastChange.expectCursorActivityForChange) { - lastChange.expectCursorActivityForChange = false; - } else { - // Cursor moved outside the context of an edit. Reset the change. - lastChange.changes = []; - } - } else if (!cm.curOp.isVimOp) { - handleExternalSelection(cm, vim); - } - if (vim.visualMode) { - updateFakeCursor(cm); - } - } - function updateFakeCursor(cm) { - var vim = cm.state.vim; - var from = copyCursor(vim.sel.head); - var to = offsetCursor(from, 0, 1); - if (vim.fakeCursor) { - vim.fakeCursor.clear(); - } - vim.fakeCursor = cm.markText(from, to, {className: 'cm-animate-fat-cursor'}); - } - function handleExternalSelection(cm, vim) { - var anchor = cm.getCursor('anchor'); - var head = cm.getCursor('head'); - // Enter or exit visual mode to match mouse selection. - if (vim.visualMode && cursorEqual(head, anchor) && lineLength(cm, head.line) > head.ch) { - exitVisualMode(cm, false); - } else if (!vim.visualMode && !vim.insertMode && cm.somethingSelected()) { - vim.visualMode = true; - vim.visualLine = false; - CodeMirror.signal(cm, "vim-mode-change", {mode: "visual"}); - } - if (vim.visualMode) { - // Bind CodeMirror selection model to vim selection model. - // Mouse selections are considered visual characterwise. - var headOffset = !cursorIsBefore(head, anchor) ? -1 : 0; - var anchorOffset = cursorIsBefore(head, anchor) ? -1 : 0; - head = offsetCursor(head, 0, headOffset); - anchor = offsetCursor(anchor, 0, anchorOffset); - vim.sel = { - anchor: anchor, - head: head - }; - updateMark(cm, vim, '<', cursorMin(head, anchor)); - updateMark(cm, vim, '>', cursorMax(head, anchor)); - } else if (!vim.insertMode) { - // Reset lastHPos if selection was modified by something outside of vim mode e.g. by mouse. - vim.lastHPos = cm.getCursor().ch; - } - } - - /** Wrapper for special keys pressed in insert mode */ - function InsertModeKey(keyName) { - this.keyName = keyName; - } - - /** - * Handles raw key down events from the text area. - * - Should only be active in insert mode. - * - For recording deletes in insert mode. - */ - function onKeyEventTargetKeyDown(e) { - var macroModeState = vimGlobalState.macroModeState; - var lastChange = macroModeState.lastInsertModeChanges; - var keyName = CodeMirror.keyName(e); - if (!keyName) { return; } - function onKeyFound() { - lastChange.changes.push(new InsertModeKey(keyName)); - return true; - } - if (keyName.indexOf('Delete') != -1 || keyName.indexOf('Backspace') != -1) { - CodeMirror.lookupKey(keyName, 'vim-insert', onKeyFound); - } - } - - /** - * Repeats the last edit, which includes exactly 1 command and at most 1 - * insert. Operator and motion commands are read from lastEditInputState, - * while action commands are read from lastEditActionCommand. - * - * If repeatForInsert is true, then the function was called by - * exitInsertMode to repeat the insert mode changes the user just made. The - * corresponding enterInsertMode call was made with a count. - */ - function repeatLastEdit(cm, vim, repeat, repeatForInsert) { - var macroModeState = vimGlobalState.macroModeState; - macroModeState.isPlaying = true; - var isAction = !!vim.lastEditActionCommand; - var cachedInputState = vim.inputState; - function repeatCommand() { - if (isAction) { - commandDispatcher.processAction(cm, vim, vim.lastEditActionCommand); - } else { - commandDispatcher.evalInput(cm, vim); - } - } - function repeatInsert(repeat) { - if (macroModeState.lastInsertModeChanges.changes.length > 0) { - // For some reason, repeat cw in desktop VIM does not repeat - // insert mode changes. Will conform to that behavior. - repeat = !vim.lastEditActionCommand ? 1 : repeat; - var changeObject = macroModeState.lastInsertModeChanges; - repeatInsertModeChanges(cm, changeObject.changes, repeat); - } - } - vim.inputState = vim.lastEditInputState; - if (isAction && vim.lastEditActionCommand.interlaceInsertRepeat) { - // o and O repeat have to be interlaced with insert repeats so that the - // insertions appear on separate lines instead of the last line. - for (var i = 0; i < repeat; i++) { - repeatCommand(); - repeatInsert(1); - } - } else { - if (!repeatForInsert) { - // Hack to get the cursor to end up at the right place. If I is - // repeated in insert mode repeat, cursor will be 1 insert - // change set left of where it should be. - repeatCommand(); - } - repeatInsert(repeat); - } - vim.inputState = cachedInputState; - if (vim.insertMode && !repeatForInsert) { - // Don't exit insert mode twice. If repeatForInsert is set, then we - // were called by an exitInsertMode call lower on the stack. - exitInsertMode(cm); - } - macroModeState.isPlaying = false; - }; - - function repeatInsertModeChanges(cm, changes, repeat) { - function keyHandler(binding) { - if (typeof binding == 'string') { - CodeMirror.commands[binding](cm); - } else { - binding(cm); - } - return true; - } - var head = cm.getCursor('head'); - var inVisualBlock = vimGlobalState.macroModeState.lastInsertModeChanges.inVisualBlock; - if (inVisualBlock) { - // Set up block selection again for repeating the changes. - var vim = cm.state.vim; - var lastSel = vim.lastSelection; - var offset = getOffset(lastSel.anchor, lastSel.head); - selectForInsert(cm, head, offset.line + 1); - repeat = cm.listSelections().length; - cm.setCursor(head); - } - for (var i = 0; i < repeat; i++) { - if (inVisualBlock) { - cm.setCursor(offsetCursor(head, i, 0)); - } - for (var j = 0; j < changes.length; j++) { - var change = changes[j]; - if (change instanceof InsertModeKey) { - CodeMirror.lookupKey(change.keyName, 'vim-insert', keyHandler); - } else { - var cur = cm.getCursor(); - cm.replaceRange(change, cur, cur); - } - } - } - if (inVisualBlock) { - cm.setCursor(offsetCursor(head, 0, 1)); - } - } - - resetVimGlobalState(); - return vimApi; - }; - // Initialize Vim and make it available as an API. - CodeMirror.Vim = Vim(); -}); diff --git a/media/editors/codemirror/lib/addons.css b/media/editors/codemirror/lib/addons.css new file mode 100644 index 0000000000000..cd6f285bdcc89 --- /dev/null +++ b/media/editors/codemirror/lib/addons.css @@ -0,0 +1,94 @@ +.CodeMirror-fullscreen { + position: fixed; + top: 0; left: 0; right: 0; bottom: 0; + height: auto; + z-index: 9; +} + +.CodeMirror-foldmarker { + color: blue; + text-shadow: #b9f 1px 1px 2px, #b9f -1px -1px 2px, #b9f 1px -1px 2px, #b9f -1px 1px 2px; + font-family: arial; + line-height: .3; + cursor: pointer; +} +.CodeMirror-foldgutter { + width: .7em; +} +.CodeMirror-foldgutter-open, +.CodeMirror-foldgutter-folded { + cursor: pointer; +} +.CodeMirror-foldgutter-open:after { + content: "\25BE"; +} +.CodeMirror-foldgutter-folded:after { + content: "\25B8"; +} + +.CodeMirror-simplescroll-horizontal div, .CodeMirror-simplescroll-vertical div { + position: absolute; + background: #ccc; + -moz-box-sizing: border-box; + box-sizing: border-box; + border: 1px solid #bbb; + border-radius: 2px; +} + +.CodeMirror-simplescroll-horizontal, .CodeMirror-simplescroll-vertical { + position: absolute; + z-index: 6; + background: #eee; +} + +.CodeMirror-simplescroll-horizontal { + bottom: 0; left: 0; + height: 8px; +} +.CodeMirror-simplescroll-horizontal div { + bottom: 0; + height: 100%; +} + +.CodeMirror-simplescroll-vertical { + right: 0; top: 0; + width: 8px; +} +.CodeMirror-simplescroll-vertical div { + right: 0; + width: 100%; +} + + +.CodeMirror-overlayscroll .CodeMirror-scrollbar-filler, .CodeMirror-overlayscroll .CodeMirror-gutter-filler { + display: none; +} + +.CodeMirror-overlayscroll-horizontal div, .CodeMirror-overlayscroll-vertical div { + position: absolute; + background: #bcd; + border-radius: 3px; +} + +.CodeMirror-overlayscroll-horizontal, .CodeMirror-overlayscroll-vertical { + position: absolute; + z-index: 6; +} + +.CodeMirror-overlayscroll-horizontal { + bottom: 0; left: 0; + height: 6px; +} +.CodeMirror-overlayscroll-horizontal div { + bottom: 0; + height: 100%; +} + +.CodeMirror-overlayscroll-vertical { + right: 0; top: 0; + width: 6px; +} +.CodeMirror-overlayscroll-vertical div { + right: 0; + width: 100%; +} diff --git a/media/editors/codemirror/lib/addons.js b/media/editors/codemirror/lib/addons.js index 8071e546e9597..027f9bb085b62 100644 --- a/media/editors/codemirror/lib/addons.js +++ b/media/editors/codemirror/lib/addons.js @@ -1 +1,6730 @@ -(function(a){if(typeof exports=="object"&&typeof module=="object"){a(require("../../lib/codemirror"))}else{if(typeof define=="function"&&define.amd){define(["../../lib/codemirror"],a)}else{a(CodeMirror)}}})(function(a){a.defineOption("fullScreen",false,function(d,f,e){if(e==a.Init){e=false}if(!e==!f){return}if(f){b(d)}else{c(d)}});function b(d){var e=d.getWrapperElement();d.state.fullScreenRestore={scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,width:e.style.width,height:e.style.height};e.style.width="";e.style.height="auto";e.className+=" CodeMirror-fullscreen";document.documentElement.style.overflow="hidden";d.refresh()}function c(d){var e=d.getWrapperElement();e.className=e.className.replace(/\s*CodeMirror-fullscreen\b/,"");document.documentElement.style.overflow="";var f=d.state.fullScreenRestore;e.style.width=f.width;e.style.height=f.height;window.scrollTo(f.scrollLeft,f.scrollTop);d.refresh()}});(function(a){if(typeof exports=="object"&&typeof module=="object"){a(require("../../lib/codemirror"))}else{if(typeof define=="function"&&define.amd){define(["../../lib/codemirror"],a)}else{a(CodeMirror)}}})(function(a){a.defineExtension("addPanel",function(g,f){if(!this.state.panels){b(this)}var h=this.state.panels;if(f&&f.position=="bottom"){h.wrapper.appendChild(g)}else{h.wrapper.insertBefore(g,h.wrapper.firstChild)}var e=(f&&f.height)||g.offsetHeight;this._setSize(null,h.heightLeft-=e);h.panels++;return new d(this,g,f,e)});function d(f,h,g,e){this.cm=f;this.node=h;this.options=g;this.height=e;this.cleared=false}d.prototype.clear=function(){if(this.cleared){return}this.cleared=true;var e=this.cm.state.panels;this.cm._setSize(null,e.heightLeft+=this.height);e.wrapper.removeChild(this.node);if(--e.panels==0){c(this.cm)}};d.prototype.changed=function(e){var f=e==null?this.node.offsetHeight:e;var g=this.cm.state.panels;this.cm._setSize(null,g.height+=(f-this.height));this.height=f};function b(f){var h=f.getWrapperElement();var g=window.getComputedStyle?window.getComputedStyle(h):h.currentStyle;var e=parseInt(g.height);var i=f.state.panels={setHeight:h.style.height,heightLeft:e,panels:0,wrapper:document.createElement("div")};h.parentNode.insertBefore(i.wrapper,h);var j=f.hasFocus();i.wrapper.appendChild(h);if(j){f.focus()}f._setSize=f.setSize;if(e!=null){f.setSize=function(m,k){if(k==null){return this._setSize(m,k)}i.setHeight=k;if(typeof k!="number"){var l=/^(\d+\.?\d*)px$/.exec(k);if(l){k=Number(l[1])}else{i.wrapper.style.height=k;k=i.wrapper.offsetHeight;i.wrapper.style.height=""}}f._setSize(m,i.heightLeft+=(k-e));e=k}}}function c(e){var g=e.state.panels;e.state.panels=null;var f=e.getWrapperElement();g.wrapper.parentNode.replaceChild(f,g.wrapper);f.style.height=g.setHeight;e.setSize=e._setSize;e.setSize()}});(function(a){if(typeof exports=="object"&&typeof module=="object"){a(require("../../lib/codemirror"))}else{if(typeof define=="function"&&define.amd){define(["../../lib/codemirror"],a)}else{a(CodeMirror)}}})(function(c){var h="()[]{}''\"\"";var g="[]{}";var i=/\s/;var f=c.Pos;c.defineOption("autoCloseBrackets",false,function(j,o,k){if(k!=c.Init&&k){j.removeKeyMap("autoCloseBrackets")}if(!o){return}var m=h,l=g;if(typeof o=="string"){m=o}else{if(typeof o=="object"){if(o.pairs!=null){m=o.pairs}if(o.explode!=null){l=o.explode}}}var n=b(m);if(l){n.Enter=a(l)}j.addKeyMap(n)});function d(j,l){var k=j.getRange(f(l.line,l.ch-1),f(l.line,l.ch+1));return k.length==2?k:null}function e(j,p,n){var k=j.getLine(p.line);var m=j.getTokenAt(p);if(/\bstring2?\b/.test(m.type)){return false}var o=new c.StringStream(k.slice(0,p.ch)+n+k.slice(p.ch),4);o.pos=o.start=m.start;for(;;){var l=j.getMode().token(o,m.state);if(o.pos>=p.ch+1){return/\bstring2?\b/.test(l)}o.start=o.pos}}function b(l){var m={name:"autoCloseBrackets",Backspace:function(n){if(n.getOption("disableInput")){return c.Pass}var o=n.listSelections();for(var p=0;p=0;p--){var r=o[p].head;n.replaceRange("",f(r.line,r.ch-1),f(r.line,r.ch+1))}}};var k="";for(var j=0;j1&&p.getRange(f(w.line,w.ch-2),w)==o+o&&(w.ch<=2||p.getRange(f(w.line,w.ch-3),f(w.line,w.ch-2))!=o)){s="addFour"}else{if(o=='"'||o=="'"){if(!c.isWordChar(u)&&e(p,w,o)){s="both"}else{return c.Pass}}else{if(p.getLine(w.line).length==w.ch||k.indexOf(u)>=0||i.test(u)){s="both"}else{return c.Pass}}}}}if(!v){v=s}else{if(v!=s){return c.Pass}}}p.operation(function(){if(v=="skip"){p.execCommand("goCharRight")}else{if(v=="skipThree"){for(var y=0;y<3;y++){p.execCommand("goCharRight")}}else{if(v=="surround"){var x=p.getSelections();for(var y=0;y'"]=function(m){return a(m)}}i.addKeyMap(k)});var d=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"];var c=["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"];function a(x){if(x.getOption("disableInput")){return b.Pass}var k=x.listSelections(),r=[];for(var s=0;sw.ch){q=q.slice(0,q.length-y.end+w.ch)}var u=q.toLowerCase();if(!q||y.type=="string"&&(y.end!=w.ch||!/[\"\']/.test(y.string.charAt(y.string.length-1))||y.string.length==1)||y.type=="tag"&&j.type=="closeTag"||y.string.indexOf("/")==(y.string.length-1)||n&&g(n,u)>-1||f(x,q,w,j,true)){return b.Pass}var p=v&&g(v,u)>-1;r[s]={indent:p,text:">"+(p?"\n\n":"")+"",newPos:p?b.Pos(w.line+1,0):b.Pos(w.line,w.ch+1)}}for(var s=k.length-1;s>=0;s--){var o=r[s];x.replaceRange(o.text,k[s].head,k[s].anchor,"+insert");var m=x.listSelections().slice(0);m[s]={head:o.newPos,anchor:o.newPos};x.setSelections(m);if(o.indent){x.indentLine(o.newPos.line,null,true);x.indentLine(o.newPos.line+1,null,true)}}}function h(q,m){var k=q.listSelections(),l=[];var p=m?"/":""}else{if(q.getMode().name=="htmlmixed"&&s.mode.name=="css"){l[n]=p+"style>"}else{return b.Pass}}}else{if(!j.context||!j.context.tagName||f(q,j.context.tagName,o,j)){return b.Pass}l[n]=p+j.context.tagName+">"}}q.replaceSelections(l);k=q.listSelections();for(var n=0;n",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"};function f(q,m,p,k){var s=q.getLineHandle(m.line),o=m.ch-1;var n=(o>=0&&a[s.text.charAt(o)])||a[s.text.charAt(++o)];if(!n){return null}var l=n.charAt(1)==">"?1:-1;if(p&&(l>0)!=(o==m.ch)){return null}var j=q.getTokenTypeAt(i(m.line,o+1));var r=g(q,i(m.line,o+(l>0?1:0)),l,j||null,k);if(r==null){return null}return{from:i(m.line,o),to:r&&r.pos,match:r&&r.ch==n.charAt(0),forward:l>0}}function g(w,r,n,k,m){var l=(m&&m.maxScanLineLength)||10000;var t=(m&&m.maxScanLines)||1000;var v=[];var x=m&&m.bracketRegex?m.bracketRegex:/[(){}[\]]/;var q=n>0?Math.min(r.line+t,w.lastLine()+1):Math.max(w.firstLine()-1,r.line-t);for(var o=r.line;o!=q;o+=n){var y=w.getLine(o);if(!y){continue}var u=n>0?0:y.length-1,p=n>0?y.length:-1;if(y.length>l){continue}if(o==r.line){u=r.ch-(n<0?1:0)}for(;u!=p;u+=n){var j=y.charAt(u);if(x.test(j)&&(k===undefined||w.getTokenTypeAt(i(o,u+1))==k)){var s=a[j];if((s.charAt(1)==">")==(n>0)){v.push(j)}else{if(!v.length){return{pos:i(o,u),ch:j}}else{v.pop()}}}}}return o-n==(n>0?w.lastLine():w.firstLine())?false:null}function b(s,n,m){var k=s.state.matchBrackets.maxHighlightLineLength||1000;var r=[],l=s.listSelections();for(var o=0;ob.lastLine()){return null}var o=b.getTokenAt(a.Pos(k,1));if(!/\S/.test(o.string)){o=b.getTokenAt(a.Pos(k,o.end+1))}if(o.type!="keyword"||o.string!="import"){return null}for(var l=k,m=Math.min(b.lastLine(),k+10);l<=m;++l){var n=b.getLine(l),j=n.indexOf(";");if(j!=-1){return{startCh:o.end,end:a.Pos(l,j)}}}}var h=h.line,d=g(h),f;if(!d||g(h-1)||((f=g(h-2))&&f.end.line==h-1)){return null}for(var c=d.end;;){var e=g(c.line+1);if(e==null){break}c=e.end}return{from:b.clipPos(a.Pos(h,d.startCh+1)),to:c}});a.registerHelper("fold","include",function(b,g){function f(h){if(hb.lastLine()){return null}var i=b.getTokenAt(a.Pos(h,1));if(!/\S/.test(i.string)){i=b.getTokenAt(a.Pos(h,i.end+1))}if(i.type=="meta"&&i.string.slice(0,8)=="#include"){return i.start+8}}var g=g.line,d=f(g);if(d==null||f(g-1)!=null){return null}for(var c=g;;){var e=f(c+1);if(e==null){break}++c}return{from:a.Pos(g,d+1),to:b.clipPos(a.Pos(c))}})});(function(a){if(typeof exports=="object"&&typeof module=="object"){a(require("../../lib/codemirror"))}else{if(typeof define=="function"&&define.amd){define(["../../lib/codemirror"],a)}else{a(CodeMirror)}}})(function(b){function d(n,m,o,i){if(o&&o.call){var g=o;o=null}else{var g=c(n,o,"rangeFinder")}if(typeof m=="number"){m=b.Pos(m,0)}var h=c(n,o,"minFoldSize");function f(p){var q=g(n,m);if(!q||q.to.line-q.from.linen.firstLine()){m=b.Pos(m.line-1,0);k=f(false)}}if(!k||k.cleared||i==="unfold"){return}var l=e(n,o);b.on(l,"mousedown",function(p){j.clear();b.e_preventDefault(p)});var j=n.markText(k.from,k.to,{replacedWith:l,clearOnEnter:true,__isFold:true});j.on("clear",function(q,p){b.signal(n,"unfold",n,q,p)});b.signal(n,"fold",n,k.from,k.to)}function e(f,g){var h=c(f,g,"widget");if(typeof h=="string"){var i=document.createTextNode(h);h=document.createElement("span");h.appendChild(i);h.className="CodeMirror-foldmarker"}return h}b.newFoldFunction=function(g,f){return function(h,i){d(h,i,{rangeFinder:g,widget:f})}};b.defineExtension("foldCode",function(h,f,g){d(this,h,f,g)});b.defineExtension("isFolded",function(h){var g=this.findMarksAt(h);for(var f=0;f=p){w=f(o.indicatorOpen)}}m.setGutterMarker(t,o.gutter,w);++q})}function b(m){var n=m.getViewport(),o=m.state.foldGutter;if(!o){return}m.operation(function(){a(m,n.from,n.to)});o.from=n.from;o.to=n.to}function k(m,n,p){var o=m.state.foldGutter.options;if(p!=o.gutter){return}m.foldCode(h(n,0),o.rangeFinder)}function g(m){var o=m.state.foldGutter,n=m.state.foldGutter.options;o.from=o.to=0;clearTimeout(o.changeUpdate);o.changeUpdate=setTimeout(function(){b(m)},n.foldOnChangeTimeSpan||600)}function l(m){var o=m.state.foldGutter,n=m.state.foldGutter.options;clearTimeout(o.changeUpdate);o.changeUpdate=setTimeout(function(){var p=m.getViewport();if(o.from==o.to||p.from-o.to>20||o.from-p.to>20){b(m)}else{m.operation(function(){if(p.fromo.to){a(m,o.to,p.to);o.to=p.to}})}},n.updateViewportTimeSpan||400)}function e(m,p){var o=m.state.foldGutter,n=p.line;if(n>=o.from&&n=q.max){return}q.ch=0;q.text=q.cm.getLine(++q.line);return true}function n(q){if(q.line<=q.min){return}q.text=q.cm.getLine(--q.line);q.ch=q.text.length;return true}function g(s){for(;;){var r=s.text.indexOf(">",s.ch);if(r==-1){if(a(s)){continue}else{return}}if(!h(s,r+1)){s.ch=r+1;continue}var q=s.text.lastIndexOf("/",r);var t=q>-1&&!/\S/.test(s.text.slice(q+1,r));s.ch=r+1;return t?"selfClose":"regular"}}function k(r){for(;;){var q=r.ch?r.text.lastIndexOf("<",r.ch-1):-1;if(q==-1){if(n(r)){continue}else{return}}if(!h(r,q+1)){r.ch=q;continue}d.lastIndex=q;r.ch=q;var s=d.exec(r.text);if(s&&s.index==q){return s}}}function p(q){for(;;){d.lastIndex=q.ch;var r=d.exec(q.text);if(!r){if(a(q)){continue}else{return}}if(!h(q,r.index+1)){q.ch=r.index+1;continue}q.ch=r.index+r[0].length;return r}}function e(s){for(;;){var r=s.ch?s.text.lastIndexOf(">",s.ch-1):-1;if(r==-1){if(n(s)){continue}else{return}}if(!h(s,r+1)){s.ch=r;continue}var q=s.text.lastIndexOf("/",r);var t=q>-1&&!/\S/.test(s.text.slice(q+1,r));s.ch=r+1;return t?"selfClose":"regular"}}function f(t,r){var q=[];for(;;){var v=p(t),s,x=t.line,w=t.ch-(v?v[0].length:0);if(!v||!(s=g(t))){return}if(s=="selfClose"){continue}if(v[1]){for(var u=q.length-1;u>=0;--u){if(q[u]==v[2]){q.length=u;break}}if(u<0&&(!r||r==v[2])){return{tag:v[2],from:m(x,w),to:m(t.line,t.ch)}}}else{q.push(v[2])}}}function c(s,r){var q=[];for(;;){var w=e(s);if(!w){return}if(w=="selfClose"){k(s);continue}var v=s.line,u=s.ch;var x=k(s);if(!x){return}if(x[1]){q.push(x[2])}else{for(var t=q.length-1;t>=0;--t){if(q[t]==x[2]){q.length=t;break}}if(t<0&&(!r||r==x[2])){return{tag:x[2],from:m(s.line,s.ch),to:m(v,u)}}}}}i.registerHelper("fold","xml",function(q,v){var s=new b(q,v.line,0);for(;;){var t=p(s),r;if(!t||s.line!=v.line||!(r=g(s))){return}if(!t[1]&&r!="selfClose"){var v=m(s.line,s.ch);var u=f(s,t[2]);return u&&{from:v,to:u.from}}}});i.findMatchingTag=function(q,x,t){var s=new b(q,x.line,x.ch,t);if(s.text.indexOf(">")==-1&&s.text.indexOf("<")==-1){return}var r=g(s),w=r&&m(s.line,s.ch);var v=r&&k(s);if(!r||!v||l(s,x)>0){return}var u={from:m(s.line,s.ch),to:w,tag:v[2]};if(r=="selfClose"){return{open:u,close:null,at:"open"}}if(v[1]){return{open:c(s,v[2]),close:u,at:"close"}}else{s=new b(q,w.line,w.ch,t);return{open:u,close:f(s,v[2]),at:"open"}}};i.findEnclosingTag=function(q,w,s){var r=new b(q,w.line,w.ch,s);for(;;){var u=c(r);if(!u){break}var t=new b(q,w.line,w.ch,s);var v=f(t,u.tag);if(v){return{open:u,close:v}}}};i.scanForClosingTag=function(q,u,t,s){var r=new b(q,u.line,u.ch,s?{from:0,to:s}:null);return f(r,t)}});(function(a){if(typeof exports=="object"&&typeof module=="object"){a(require("../../lib/codemirror"),"cjs")}else{if(typeof define=="function"&&define.amd){define(["../../lib/codemirror"],function(b){a(b,"amd")})}else{a(CodeMirror,"plain")}}})(function(a,c){if(!a.modeURL){a.modeURL="../mode/%N/%N.js"}var e={};function d(f,h){var g=h;return function(){if(--g==0){f()}}}function b(l,f){var k=a.modes[l].dependencies;if(!k){return f()}var j=[];for(var h=0;h-1){o.string=m.slice(0,p)}var n=k.mode.token(o,f.inner);if(p>-1){o.string=m}if(k.innerStyle){if(n){n=n+" "+k.innerStyle}else{n=k.innerStyle}}return n}},indent:function(g,f){var h=g.innerActive?g.innerActive.mode:c;if(!h.indent){return a.Pass}return h.indent(g.innerActive?g.inner:g.outer,f)},blankLine:function(h){var j=h.innerActive?h.innerActive.mode:c;if(j.blankLine){j.blankLine(h.innerActive?h.inner:h.outer)}if(!h.innerActive){for(var g=0;gi.right?1:0}else{j=k.clientYi.bottom?1:0}f.moveTo(f.pos+j*f.screen)});function h(k){var j=b.wheelEventPixels(k)[f.orientation=="horizontal"?"x":"y"];var i=f.pos;f.moveTo(f.pos+j);if(f.pos!=i){b.e_preventDefault(k)}}b.on(this.node,"mousewheel",h);b.on(this.node,"DOMMouseScroll",h)}a.prototype.moveTo=function(e,d){if(e<0){e=0}if(e>this.total-this.screen){e=this.total-this.screen}if(e==this.pos){return}this.pos=e;this.inner.style[this.orientation=="horizontal"?"left":"top"]=(e*(this.size/this.total))+"px";if(d!==false){this.scroll(e,this.orientation)}};a.prototype.update=function(d,e,f){this.screen=e;this.total=d;this.size=f;this.inner.style[this.orientation=="horizontal"?"width":"height"]=this.screen*(this.size/this.total)+"px";this.inner.style[this.orientation=="horizontal"?"left":"top"]=this.pos*(this.size/this.total)+"px"};function c(f,e,d){this.addClass=f;this.horiz=new a(f,"horizontal",d);e(this.horiz.node);this.vert=new a(f,"vertical",d);e(this.vert.node);this.width=null}c.prototype.update=function(g){if(this.width==null){var f=window.getComputedStyle?window.getComputedStyle(this.horiz.node):this.horiz.node.currentStyle;if(f){this.width=parseInt(f.height)}}var e=this.width||0;var h=g.scrollWidth>g.clientWidth+1;var d=g.scrollHeight>g.clientHeight+1;this.vert.node.style.display=d?"block":"none";this.horiz.node.style.display=h?"block":"none";if(d){this.vert.update(g.scrollHeight,g.clientHeight,g.viewHeight-(h?e:0));this.vert.node.style.display="block";this.vert.node.style.bottom=h?e+"px":"0"}if(h){this.horiz.update(g.scrollWidth,g.clientWidth,g.viewWidth-(d?e:0)-g.barLeft);this.horiz.node.style.right=d?e+"px":"0";this.horiz.node.style.left=g.barLeft+"px"}return{right:d?e:0,bottom:h?e:0}};c.prototype.setScrollTop=function(d){this.vert.moveTo(d,false)};c.prototype.setScrollLeft=function(d){this.horiz.moveTo(d,false)};c.prototype.clear=function(){var d=this.horiz.node.parentNode;d.removeChild(this.horiz.node);d.removeChild(this.vert.node)};b.scrollbarModel.simple=function(e,d){return new c("CodeMirror-simplescroll",e,d)};b.scrollbarModel.overlay=function(e,d){return new c("CodeMirror-overlayscroll",e,d)}});(function(a){if(typeof exports=="object"&&typeof module=="object"){a(require("../../lib/codemirror"))}else{if(typeof define=="function"&&define.amd){define(["../../lib/codemirror"],a)}else{a(CodeMirror)}}})(function(c){var g="CodeMirror-activeline";var f="CodeMirror-activeline-background";c.defineOption("styleActiveLine",false,function(h,k,i){var j=i&&i!=c.Init;if(k&&!j){h.state.activeLines=[];e(h,h.listSelections());h.on("beforeSelectionChange",b)}else{if(!k&&j){h.off("beforeSelectionChange",b);d(h);delete h.state.activeLines}}});function d(h){for(var j=0;j",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:"xi",context:"visual"},{keys:"S",type:"keyToKey",toKeys:"cc",context:"normal"},{keys:"S",type:"keyToKey",toKeys:"dcc",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:true,toJumplist:true}},{keys:"M",type:"motion",motion:"moveToMiddleLine",motionArgs:{linewise:true,toJumplist:true}},{keys:"L",type:"motion",motion:"moveToBottomLine",motionArgs:{linewise:true,toJumplist:true}},{keys:"h",type:"motion",motion:"moveByCharacters",motionArgs:{forward:false}},{keys:"l",type:"motion",motion:"moveByCharacters",motionArgs:{forward:true}},{keys:"j",type:"motion",motion:"moveByLines",motionArgs:{forward:true,linewise:true}},{keys:"k",type:"motion",motion:"moveByLines",motionArgs:{forward:false,linewise:true}},{keys:"gj",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:true}},{keys:"gk",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:false}},{keys:"w",type:"motion",motion:"moveByWords",motionArgs:{forward:true,wordEnd:false}},{keys:"W",type:"motion",motion:"moveByWords",motionArgs:{forward:true,wordEnd:false,bigWord:true}},{keys:"e",type:"motion",motion:"moveByWords",motionArgs:{forward:true,wordEnd:true,inclusive:true}},{keys:"E",type:"motion",motion:"moveByWords",motionArgs:{forward:true,wordEnd:true,bigWord:true,inclusive:true}},{keys:"b",type:"motion",motion:"moveByWords",motionArgs:{forward:false,wordEnd:false}},{keys:"B",type:"motion",motion:"moveByWords",motionArgs:{forward:false,wordEnd:false,bigWord:true}},{keys:"ge",type:"motion",motion:"moveByWords",motionArgs:{forward:false,wordEnd:true,inclusive:true}},{keys:"gE",type:"motion",motion:"moveByWords",motionArgs:{forward:false,wordEnd:true,bigWord:true,inclusive:true}},{keys:"{",type:"motion",motion:"moveByParagraph",motionArgs:{forward:false,toJumplist:true}},{keys:"}",type:"motion",motion:"moveByParagraph",motionArgs:{forward:true,toJumplist:true}},{keys:"",type:"motion",motion:"moveByPage",motionArgs:{forward:true}},{keys:"",type:"motion",motion:"moveByPage",motionArgs:{forward:false}},{keys:"",type:"motion",motion:"moveByScroll",motionArgs:{forward:true,explicitRepeat:true}},{keys:"",type:"motion",motion:"moveByScroll",motionArgs:{forward:false,explicitRepeat:true}},{keys:"gg",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:false,explicitRepeat:true,linewise:true,toJumplist:true}},{keys:"G",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:true,explicitRepeat:true,linewise:true,toJumplist:true}},{keys:"0",type:"motion",motion:"moveToStartOfLine"},{keys:"^",type:"motion",motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"+",type:"motion",motion:"moveByLines",motionArgs:{forward:true,toFirstChar:true}},{keys:"-",type:"motion",motion:"moveByLines",motionArgs:{forward:false,toFirstChar:true}},{keys:"_",type:"motion",motion:"moveByLines",motionArgs:{forward:true,toFirstChar:true,repeatOffset:-1}},{keys:"$",type:"motion",motion:"moveToEol",motionArgs:{inclusive:true}},{keys:"%",type:"motion",motion:"moveToMatchedSymbol",motionArgs:{inclusive:true,toJumplist:true}},{keys:"f",type:"motion",motion:"moveToCharacter",motionArgs:{forward:true,inclusive:true}},{keys:"F",type:"motion",motion:"moveToCharacter",motionArgs:{forward:false}},{keys:"t",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:true,inclusive:true}},{keys:"T",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:false}},{keys:";",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:true}},{keys:",",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:false}},{keys:"'",type:"motion",motion:"goToMark",motionArgs:{toJumplist:true,linewise:true}},{keys:"`",type:"motion",motion:"goToMark",motionArgs:{toJumplist:true}},{keys:"]`",type:"motion",motion:"jumpToMark",motionArgs:{forward:true}},{keys:"[`",type:"motion",motion:"jumpToMark",motionArgs:{forward:false}},{keys:"]'",type:"motion",motion:"jumpToMark",motionArgs:{forward:true,linewise:true}},{keys:"['",type:"motion",motion:"jumpToMark",motionArgs:{forward:false,linewise:true}},{keys:"]p",type:"action",action:"paste",isEdit:true,actionArgs:{after:true,isEdit:true,matchIndent:true}},{keys:"[p",type:"action",action:"paste",isEdit:true,actionArgs:{after:false,isEdit:true,matchIndent:true}},{keys:"]",type:"motion",motion:"moveToSymbol",motionArgs:{forward:true,toJumplist:true}},{keys:"[",type:"motion",motion:"moveToSymbol",motionArgs:{forward:false,toJumplist:true}},{keys:"|",type:"motion",motion:"moveToColumn"},{keys:"o",type:"motion",motion:"moveToOtherHighlightedEnd",context:"visual"},{keys:"O",type:"motion",motion:"moveToOtherHighlightedEnd",motionArgs:{sameLine:true},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:true}},{keys:"<",type:"operator",operator:"indent",operatorArgs:{indentRight:false}},{keys:"g~",type:"operator",operator:"changeCase"},{keys:"gu",type:"operator",operator:"changeCase",operatorArgs:{toLower:true},isEdit:true},{keys:"gU",type:"operator",operator:"changeCase",operatorArgs:{toLower:false},isEdit:true},{keys:"n",type:"motion",motion:"findNext",motionArgs:{forward:true,toJumplist:true}},{keys:"N",type:"motion",motion:"findNext",motionArgs:{forward:false,toJumplist:true}},{keys:"x",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:true},operatorMotionArgs:{visualLine:false}},{keys:"X",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:false},operatorMotionArgs:{visualLine:true}},{keys:"D",type:"operatorMotion",operator:"delete",motion:"moveToEol",motionArgs:{inclusive:true},context:"normal"},{keys:"D",type:"operator",operator:"delete",operatorArgs:{linewise:true},context:"visual"},{keys:"Y",type:"operatorMotion",operator:"yank",motion:"moveToEol",motionArgs:{inclusive:true},context:"normal"},{keys:"Y",type:"operator",operator:"yank",operatorArgs:{linewise:true},context:"visual"},{keys:"C",type:"operatorMotion",operator:"change",motion:"moveToEol",motionArgs:{inclusive:true},context:"normal"},{keys:"C",type:"operator",operator:"change",operatorArgs:{linewise:true},context:"visual"},{keys:"~",type:"operatorMotion",operator:"changeCase",motion:"moveByCharacters",motionArgs:{forward:true},operatorArgs:{shouldMoveCursor:true},context:"normal"},{keys:"~",type:"operator",operator:"changeCase",context:"visual"},{keys:"",type:"operatorMotion",operator:"delete",motion:"moveByWords",motionArgs:{forward:false,wordEnd:false},context:"insert"},{keys:"",type:"action",action:"jumpListWalk",actionArgs:{forward:true}},{keys:"",type:"action",action:"jumpListWalk",actionArgs:{forward:false}},{keys:"",type:"action",action:"scroll",actionArgs:{forward:true,linewise:true}},{keys:"",type:"action",action:"scroll",actionArgs:{forward:false,linewise:true}},{keys:"a",type:"action",action:"enterInsertMode",isEdit:true,actionArgs:{insertAt:"charAfter"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:true,actionArgs:{insertAt:"eol"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:true,actionArgs:{insertAt:"endOfSelectedArea"},context:"visual"},{keys:"i",type:"action",action:"enterInsertMode",isEdit:true,actionArgs:{insertAt:"inplace"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:true,actionArgs:{insertAt:"firstNonBlank"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:true,actionArgs:{insertAt:"startOfSelectedArea"},context:"visual"},{keys:"o",type:"action",action:"newLineAndEnterInsertMode",isEdit:true,interlaceInsertRepeat:true,actionArgs:{after:true},context:"normal"},{keys:"O",type:"action",action:"newLineAndEnterInsertMode",isEdit:true,interlaceInsertRepeat:true,actionArgs:{after:false},context:"normal"},{keys:"v",type:"action",action:"toggleVisualMode"},{keys:"V",type:"action",action:"toggleVisualMode",actionArgs:{linewise:true}},{keys:"",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:true}},{keys:"gv",type:"action",action:"reselectLastSelection"},{keys:"J",type:"action",action:"joinLines",isEdit:true},{keys:"p",type:"action",action:"paste",isEdit:true,actionArgs:{after:true,isEdit:true}},{keys:"P",type:"action",action:"paste",isEdit:true,actionArgs:{after:false,isEdit:true}},{keys:"r",type:"action",action:"replace",isEdit:true},{keys:"@",type:"action",action:"replayMacro"},{keys:"q",type:"action",action:"enterMacroRecordMode"},{keys:"R",type:"action",action:"enterInsertMode",isEdit:true,actionArgs:{replace:true}},{keys:"u",type:"action",action:"undo",context:"normal"},{keys:"u",type:"operator",operator:"changeCase",operatorArgs:{toLower:true},context:"visual",isEdit:true},{keys:"U",type:"operator",operator:"changeCase",operatorArgs:{toLower:false},context:"visual",isEdit:true},{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:true,actionArgs:{increase:true,backtrack:false}},{keys:"",type:"action",action:"incrementNumberToken",isEdit:true,actionArgs:{increase:false,backtrack:false}},{keys:"a",type:"motion",motion:"textObjectManipulation"},{keys:"i",type:"motion",motion:"textObjectManipulation",motionArgs:{textObjectInner:true}},{keys:"/",type:"search",searchArgs:{forward:true,querySrc:"prompt",toJumplist:true}},{keys:"?",type:"search",searchArgs:{forward:false,querySrc:"prompt",toJumplist:true}},{keys:"*",type:"search",searchArgs:{forward:true,querySrc:"wordUnderCursor",wholeWordOnly:true,toJumplist:true}},{keys:"#",type:"search",searchArgs:{forward:false,querySrc:"wordUnderCursor",wholeWordOnly:true,toJumplist:true}},{keys:"g*",type:"search",searchArgs:{forward:true,querySrc:"wordUnderCursor",toJumplist:true}},{keys:"g#",type:"search",searchArgs:{forward:false,querySrc:"wordUnderCursor",toJumplist:true}},{keys:":",type:"ex"}];var c=b.Pos;var d=function(){function aU(by){by.setOption("disableInput",true);by.setOption("showCursorWhenSelecting",false);b.signal(by,"vim-mode-change",{mode:"normal"});by.on("cursorActivity",aa);G(by);b.on(by.getInputField(),"paste",U(by))}function aQ(by){by.setOption("disableInput",false);by.off("cursorActivity",aa);b.off(by.getInputField(),"paste",U(by));by.state.vim=null}function h(by,bz){if(this==b.keyMap.vim){b.rmClass(by.getWrapperElement(),"cm-fat-cursor")}if(!bz||bz.attach!=s){aQ(by,false)}}function s(by,bz){if(this==b.keyMap.vim){b.addClass(by.getWrapperElement(),"cm-fat-cursor")}if(!bz||bz.attach!=s){aU(by)}}b.defineOption("vimMode",false,function(by,bA,bz){if(bA&&by.getOption("keyMap")!="vim"){by.setOption("keyMap","vim")}else{if(!bA&&bz!=b.Init&&/^vim/.test(by.getOption("keyMap"))){by.setOption("keyMap","default")}}});function a2(bA,bz){if(!bz){return undefined}var by=L(bA);if(!by){return false}var bB=b.Vim.findKey(bz,by);if(typeof bB=="function"){b.signal(bz,"vim-keypress",by)}return bB}var az={Shift:"S",Ctrl:"C",Alt:"A",Cmd:"D",Mod:"A"};var aT={Enter:"CR",Backspace:"BS",Delete:"Del"};function L(bA){if(bA.charAt(0)=="'"){return bA.charAt(1)}var bD=bA.split("-");if(/-$/.test(bA)){bD.splice(-2,2,"-")}var by=bD[bD.length-1];if(bD.length==1&&bD[0].length==1){return false}else{if(bD.length==2&&bD[0]=="Shift"&&by.length==1){return false}}var bC=false;for(var bz=0;bz"}function U(by){var bz=by.state.vim;if(!bz.onPasteFn){bz.onPasteFn=function(){if(!bz.insertMode){by.setCursor(D(by.getCursor(),0,1));p.enterInsertMode(by,{},bz)}}}return bz.onPasteFn}var aY=/[\d]/;var aq=[(/\w/),(/[^\w\s]/)],bl=[(/\S/)];function ap(bB,bz){var bA=[];for(var by=bB;by"]);var l=[].concat(ah,am,V,["-",'"',".",":","/"]);function f(by,bz){return bz>=by.firstLine()&&bz<=by.lastLine()}function E(by){return(/^[a-z]$/).test(by)}function N(by){return"()[]{}".indexOf(by)!=-1}function ag(by){return aY.test(by)}function A(by){return(/^[A-Z]$/).test(by)}function T(by){return(/^\s*$/).test(by)}function J(bA,by){for(var bz=0;bzbB){bE=bB}else{if(bE0?1:-1;var bH;var bG=bF.getCursor();do{bE+=bI;bK=bz[(bC+bE)%bC];if(bK&&(bH=bK.find())&&!bv(bG,bH)){break}}while(bEbA)}return bK}return{cachedCursor:undefined,add:bD,move:by}};var i=function(by){if(by){return{changes:by.changes,expectCursorActivityForChange:by.expectCursorActivityForChange}}return{changes:[],expectCursorActivityForChange:false}};function ax(){this.latestRegister=undefined;this.isPlaying=false;this.isRecording=false;this.replaySearchQueries=[];this.onRecordingDone=undefined;this.lastInsertModeChanges=i()}ax.prototype={exitMacroRecordMode:function(){var by=q.macroModeState;if(by.onRecordingDone){by.onRecordingDone()}by.onRecordingDone=undefined;by.isRecording=false},enterMacroRecordMode:function(by,bA){var bz=q.registerController.getRegister(bA);if(bz){bz.clear();this.latestRegister=bA;if(by.openDialog){this.onRecordingDone=by.openDialog("(recording)["+bA+"]",null,{bottom:true})}this.isRecording=true}}};function G(by){if(!by.state.vim){by.state.vim={inputState:new aA(),lastEditInputState:undefined,lastEditActionCommand:undefined,lastHPos:-1,lastHSPos:-1,lastMotion:null,marks:{},fakeCursor:null,insertMode:false,insertModeRepeat:undefined,visualMode:false,visualLine:false,visualBlock:false,lastSelection:null,lastPastedText:null,sel:{}}}return by.state.vim}var q;function z(){q={searchQuery:null,searchIsReversed:false,lastSubstituteReplacePart:undefined,jumpList:ao(),macroModeState:new ax,lastChararacterSearch:{increment:0,forward:true,selectedCharacter:""},registerController:new ai({}),searchHistoryController:new a3({}),exCommandHistoryController:new a3({})};for(var by in at){var bz=at[by];bz.value=bz.defaultValue}}var bt;var aN={buildKeyMap:function(){},getRegisterController:function(){return q.registerController},resetVimGlobalState_:z,getVimGlobalState_:function(){return q},maybeInitVimState_:G,suppressErrorLogging:false,InsertModeKey:bi,map:function(bz,bA,by){m.map(bz,bA,by)},setOption:aH,getOption:o,defineOption:aJ,defineEx:function(by,bA,bz){if(by.indexOf(bA)!==0){throw new Error('(Vim.defineEx) "'+bA+'" is not a prefix of "'+by+'", command not registered')}a4[by]=bz;m.commandMap_[bA]={name:by,shortName:bA,type:"api"}},handleKey:function(by,bA,bz){var bB=this.findKey(by,bA,bz);if(typeof bB==="function"){return bB()}},findKey:function(bE,bF,bD){var bB=G(bE);function bG(){var bI=q.macroModeState;if(bI.isRecording){if(bF=="q"){bI.exitMacroRecordMode();j(bE);return true}if(bD!="mapping"){I(bI,bF)}}}function bH(){if(bF==""){j(bE);if(bB.visualMode){aR(bE)}else{if(bB.insertMode){v(bE)}}return true}}function by(bJ){var bI;while(bJ){bI=(/<\w+-.+?>|<\w+>|./).exec(bJ);bF=bI[0];bJ=bJ.substring(bI.index+bF.length);b.Vim.handleKey(bE,bF,"mapping")}}function bC(){if(bH()){return true}var bK=bB.inputState.keyBuffer=bB.inputState.keyBuffer+bF;var bL=bF.length==1;var bI=ba.matchCommand(bK,a,bB.inputState,"insert");while(bK.length>1&&bI.type!="full"){var bK=bB.inputState.keyBuffer=bK.slice(1);var bM=ba.matchCommand(bK,a,bB.inputState,"insert");if(bM.type!="none"){bI=bM}}if(bI.type=="none"){j(bE);return false}else{if(bI.type=="partial"){if(bt){window.clearTimeout(bt)}bt=window.setTimeout(function(){if(bB.insertMode&&bB.inputState.keyBuffer){j(bE)}},o("insertModeEscKeysTimeout"));return !bL}}if(bt){window.clearTimeout(bt)}if(bL){var bJ=bE.getCursor();bE.replaceRange("",D(bJ,0,-(bK.length-1)),bJ,"+input")}j(bE);return bI.command}function bA(){if(bG()||bH()){return true}var bK=bB.inputState.keyBuffer=bB.inputState.keyBuffer+bF;if(/^[1-9]\d*$/.test(bK)){return true}var bL=/^(\d*)(.*)$/.exec(bK);if(!bL){j(bE);return false}var bJ=bB.visualMode?"visual":"normal";var bI=ba.matchCommand(bL[2]||bL[1],a,bB.inputState,bJ);if(bI.type=="none"){j(bE);return false}else{if(bI.type=="partial"){return true}}bB.inputState.keyBuffer="";var bL=/^(\d*)(.*)$/.exec(bK);if(bL[1]&&bL[1]!="0"){bB.inputState.pushRepeatDigit(bL[1])}return bI.command}var bz;if(bB.insertMode){bz=bC()}else{bz=bA()}if(bz===false){return undefined}else{if(bz===true){return function(){}}else{return function(){return bE.operation(function(){bE.curOp.isVimOp=true;try{if(bz.type=="keyToKey"){by(bz.toKeys)}else{ba.processCommand(bE,bB,bz)}}catch(bI){bE.state.vim=undefined;G(bE);if(!b.Vim.suppressErrorLogging){console.log(bI)}throw bI}return true})}}}},handleEx:function(by,bz){m.processCommand(by,bz)}};function aA(){this.prefixRepeat=[];this.motionRepeat=[];this.operator=null;this.operatorArgs=null;this.motion=null;this.motionArgs=null;this.keyBuffer=[];this.registerName=null}aA.prototype.pushRepeatDigit=function(by){if(!this.operator){this.prefixRepeat=this.prefixRepeat.concat(by)}else{this.motionRepeat=this.motionRepeat.concat(by)}};aA.prototype.getRepeat=function(){var by=0;if(this.prefixRepeat.length>0||this.motionRepeat.length>0){by=1;if(this.prefixRepeat.length>0){by*=parseInt(this.prefixRepeat.join(""),10)}if(this.motionRepeat.length>0){by*=parseInt(this.motionRepeat.join(""),10)}}return by};function j(by,bz){by.state.vim.inputState=new aA();b.signal(by,"vim-command-done",bz)}function bn(bA,bz,by){this.clear();this.keyBuffer=[bA||""];this.insertModeChanges=[];this.searchQueries=[];this.linewise=!!bz;this.blockwise=!!by}bn.prototype={setText:function(bA,bz,by){this.keyBuffer=[bA||""];this.linewise=!!bz;this.blockwise=!!by},pushText:function(bz,by){if(by){if(!this.linewise){this.keyBuffer.push("\n")}this.linewise=true}this.keyBuffer.push(bz)},pushInsertModeChanges:function(by){this.insertModeChanges.push(i(by))},pushSearchQuery:function(by){this.searchQueries.push(by)},clear:function(){this.keyBuffer=[];this.insertModeChanges=[];this.searchQueries=[];this.linewise=false},toString:function(){return this.keyBuffer.join("")}};function ai(by){this.registers=by;this.unnamedRegister=by['"']=new bn();by["."]=new bn();by[":"]=new bn();by["/"]=new bn()}ai.prototype={pushText:function(bC,bz,bE,bD,bA){if(bD&&bE.charAt(0)=="\n"){bE=bE.slice(1)+"\n"}if(bD&&bE.charAt(bE.length-1)!=="\n"){bE+="\n"}var bB=this.isValidRegister(bC)?this.getRegister(bC):null;if(!bB){switch(bz){case"yank":this.registers["0"]=new bn(bE,bD,bA);break;case"delete":case"change":if(bE.indexOf("\n")==-1){this.registers["-"]=new bn(bE,bD)}else{this.shiftNumericRegisters_();this.registers["1"]=new bn(bE,bD)}break}this.unnamedRegister.setText(bE,bD,bA);return}var by=A(bC);if(by){bB.pushText(bE,bD)}else{bB.setText(bE,bD,bA)}this.unnamedRegister.setText(bB.toString(),bD)},getRegister:function(by){if(!this.isValidRegister(by)){return this.unnamedRegister}by=by.toLowerCase();if(!this.registers[by]){this.registers[by]=new bn()}return this.registers[by]},isValidRegister:function(by){return by&&J(by,l)},shiftNumericRegisters_:function(){for(var by=9;by>=2;by--){this.registers[by]=this.getRegister(""+(by-1))}}};function a3(){this.historyBuffer=[];this.iterator;this.initialPrefix=null}a3.prototype={nextMatch:function(bz,by){var bE=this.historyBuffer;var bB=by?-1:1;if(this.initialPrefix===null){this.initialPrefix=bz}for(var bD=this.iterator+bB;by?bD>=0:bD=bE.length){this.iterator=bE.length;return this.initialPrefix}if(bD<0){return bz}},pushInput:function(by){var bz=this.historyBuffer.indexOf(by);if(bz>-1){this.historyBuffer.splice(bz,1)}if(by.length){this.historyBuffer.push(by)}},reset:function(){this.initialPrefix=null;this.iterator=this.historyBuffer.length}};var ba={matchCommand:function(bD,bF,by,bB){var bE=bj(bD,bF,bB,by);if(!bE.full&&!bE.partial){return{type:"none"}}else{if(!bE.full&&bE.partial){return{type:"partial"}}}var bC;for(var bA=0;bA"){by.selectedCharacter=Q(bD)}return{type:"full",command:bC}},processCommand:function(by,bz,bA){bz.inputState.repeatOverride=bA.repeatOverride;switch(bA.type){case"motion":this.processMotion(by,bz,bA);break;case"operator":this.processOperator(by,bz,bA);break;case"operatorMotion":this.processOperatorMotion(by,bz,bA);break;case"action":this.processAction(by,bz,bA);break;case"search":this.processSearch(by,bz,bA);j(by);break;case"ex":case"keyToEx":this.processEx(by,bz,bA);j(by);break;default:break}},processMotion:function(by,bz,bA){bz.inputState.motion=bA.motion;bz.inputState.motionArgs=bh(bA.motionArgs);this.evalInput(by,bz)},processOperator:function(bz,bA,bB){var by=bA.inputState;if(by.operator){if(by.operator==bB.operator){by.motion="expandToLine";by.motionArgs={linewise:true};this.evalInput(bz,bA);return}else{j(bz)}}by.operator=bB.operator;by.operatorArgs=bh(bB.operatorArgs);if(bA.visualMode){this.evalInput(bz,bA)}},processOperatorMotion:function(by,bB,bC){var bA=bB.visualMode;var bz=bh(bC.operatorMotionArgs);if(bz){if(bA&&bz.visualLine){bB.visualLine=true}}this.processOperator(by,bB,bC);if(!bA){this.processMotion(by,bB,bC)}},processAction:function(bz,bB,bE){var by=bB.inputState;var bD=by.getRepeat();var bC=!!bD;var bA=bh(bE.actionArgs)||{};if(by.selectedCharacter){bA.selectedCharacter=by.selectedCharacter}if(bE.operator){this.processOperator(bz,bB,bE)}if(bE.motion){this.processMotion(bz,bB,bE)}if(bE.motion||bE.operator){this.evalInput(bz,bB)}bA.repeat=bD||1;bA.repeatIsExplicit=bC;bA.registerName=by.registerName;j(bz);bB.lastMotion=null;if(bE.isEdit){this.recordLastEdit(bB,by,bE)}p[bE.action](bz,bA,bB)},processSearch:function(bN,bG,bF){if(!bN.getSearchCursor){return}var bI=bF.searchArgs.forward;var bD=bF.searchArgs.wholeWordOnly;aG(bN).setReversed(!bI);var bJ=(bI)?"/":"?";var bL=aG(bN).getQuery();var bA=bN.getScrollInfo();function bE(bQ,bO,bP){q.searchHistoryController.pushInput(bQ);q.searchHistoryController.reset();try{bu(bN,bQ,bO,bP)}catch(bR){bk(bN,"Invalid regex: "+bQ);return}ba.processMotion(bN,bG,{type:"motion",motion:"findNext",motionArgs:{forward:true,toJumplist:bF.searchArgs.toJumplist}})}function bM(bO){bN.scrollTo(bA.left,bA.top);bE(bO,true,true);var bP=q.macroModeState;if(bP.isRecording){O(bP,bO)}}function bC(bS,bR,bT){var bQ=b.keyName(bS),bO;if(bQ=="Up"||bQ=="Down"){bO=bQ=="Up"?true:false;bR=q.searchHistoryController.nextMatch(bR,bO)||"";bT(bR)}else{if(bQ!="Left"&&bQ!="Right"&&bQ!="Ctrl"&&bQ!="Alt"&&bQ!="Shift"){q.searchHistoryController.reset()}}var bP;try{bP=bu(bN,bR,true,true)}catch(bS){}if(bP){bN.scrollIntoView(bw(bN,!bI,bP),30)}else{aK(bN);bN.scrollTo(bA.left,bA.top)}}function bz(bQ,bP,bR){var bO=b.keyName(bQ);if(bO=="Esc"||bO=="Ctrl-C"||bO=="Ctrl-["){q.searchHistoryController.pushInput(bP);q.searchHistoryController.reset();bu(bN,bL);aK(bN);bN.scrollTo(bA.left,bA.top);b.e_stop(bQ);bR();bN.focus()}}switch(bF.searchArgs.querySrc){case"prompt":var bH=q.macroModeState;if(bH.isPlaying){var bK=bH.replaySearchQueries.shift();bE(bK,true,false)}else{a0(bN,{onClose:bM,prefix:bJ,desc:P,onKeyUp:bC,onKeyDown:bz})}break;case"wordUnderCursor":var bB=aD(bN,false,true,false,true);var by=true;if(!bB){bB=aD(bN,false,true,false,false);by=false}if(!bB){return}var bK=bN.getLine(bB.start.line).substring(bB.start.ch,bB.end.ch);if(by&&bD){bK="\\b"+bK+"\\b"}else{bK=g(bK)}q.jumpList.cachedCursor=bN.getCursor();bN.setCursor(bB.start);bE(bK,true,false);break}},processEx:function(by,bz,bC){function bB(bD){q.exCommandHistoryController.pushInput(bD);q.exCommandHistoryController.reset();m.processCommand(by,bD)}function bA(bG,bE,bH){var bF=b.keyName(bG),bD;if(bF=="Esc"||bF=="Ctrl-C"||bF=="Ctrl-["){q.exCommandHistoryController.pushInput(bE);q.exCommandHistoryController.reset();b.e_stop(bG);bH();by.focus()}if(bF=="Up"||bF=="Down"){bD=bF=="Up"?true:false;bE=q.exCommandHistoryController.nextMatch(bE,bD)||"";bH(bE)}else{if(bF!="Left"&&bF!="Right"&&bF!="Ctrl"&&bF!="Alt"&&bF!="Shift"){q.exCommandHistoryController.reset()}}}if(bC.type=="keyToEx"){m.processCommand(by,bC.exArgs.input)}else{if(bz.visualMode){a0(by,{onClose:bB,prefix:":",value:"'<,'>",onKeyDown:bA})}else{a0(by,{onClose:bB,prefix:":",onKeyDown:bA})}}},evalInput:function(bG,bS){var bL=bS.inputState;var bP=bL.motion;var bM=bL.motionArgs||{};var bH=bL.operator;var b2=bL.operatorArgs||{};var bN=bL.registerName;var bT=bS.sel;var b3=C(bS.visualMode?bT.head:bG.getCursor("head"));var bE=C(bS.visualMode?bT.anchor:bG.getCursor("anchor"));var bB=C(b3);var bA=C(bE);var bR,bK;var bI;if(bH){this.recordLastEdit(bS,bL)}if(bL.repeatOverride!==undefined){bI=bL.repeatOverride}else{bI=bL.getRepeat()}if(bI>0&&bM.explicitRepeat){bM.repeatIsExplicit=true}else{if(bM.noRepeat||(!bM.explicitRepeat&&bI===0)){bI=1;bM.repeatIsExplicit=false}}if(bL.selectedCharacter){bM.selectedCharacter=b2.selectedCharacter=bL.selectedCharacter}bM.repeat=bI;j(bG);if(bP){var bQ=a1[bP](bG,b3,bM,bS);bS.lastMotion=a1[bP];if(!bQ){return}if(bM.toJumplist){var b1=q.jumpList;var bJ=b1.cachedCursor;if(bJ){be(bG,bJ,bQ);delete b1.cachedCursor}else{be(bG,b3,bQ)}}if(bQ instanceof Array){bK=bQ[0];bR=bQ[1]}else{bR=bQ}if(!bR){bR=C(b3)}if(bS.visualMode){if(!(bS.visualBlock&&bR.ch===Infinity)){bR=Z(bG,bR,bS.visualBlock)}if(bK){bK=Z(bG,bK,true)}bK=bK||bA;bT.anchor=bK;bT.head=bR;M(bG);aP(bG,bS,"<",aM(bK,bR)?bK:bR);aP(bG,bS,">",aM(bK,bR)?bR:bK)}else{if(!bH){bR=Z(bG,bR);bG.setCursor(bR.line,bR.ch)}}}if(bH){if(b2.lastSel){bK=bA;var by=b2.lastSel;var bY=Math.abs(by.head.line-by.anchor.line);var b0=Math.abs(by.head.ch-by.anchor.ch);if(by.visualLine){bR=c(bA.line+bY,bA.ch)}else{if(by.visualBlock){bR=c(bA.line+bY,bA.ch+b0)}else{if(by.head.line==by.anchor.line){bR=c(bA.line,bA.ch+b0)}else{bR=c(bA.line+bY,bA.ch)}}}bS.visualMode=true;bS.visualLine=by.visualLine;bS.visualBlock=by.visualBlock;bT=bS.sel={anchor:bK,head:bR};M(bG)}else{if(bS.visualMode){b2.lastSel={anchor:C(bT.anchor),head:C(bT.head),visualBlock:bS.visualBlock,visualLine:bS.visualLine}}}var bF,bU,bC,bO;var bD;if(bS.visualMode){bF=av(bT.head,bT.anchor);bU=a8(bT.head,bT.anchor);bC=bS.visualLine||b2.linewise;bO=bS.visualBlock?"block":bC?"line":"char";bD=bx(bG,{anchor:bF,head:bU},bO);if(bC){var bz=bD.ranges;if(bO=="block"){for(var bV=0;bVbF&&bG.line==bF)){return}if(bz.toFirstChar){bB=aZ(bE.getLine(bH));bA.lastHPos=bB}bA.lastHSPos=bE.charCoords(c(bH,bB),"div").left;return c(bH,bB)},moveByDisplayLines:function(bG,bF,bA,bB){var bH=bF;switch(bB.lastMotion){case this.moveByDisplayLines:case this.moveByScroll:case this.moveByLines:case this.moveToColumn:case this.moveToEol:break;default:bB.lastHSPos=bG.charCoords(bH,"div").left}var by=bA.repeat;var bE=bG.findPosV(bH,(bA.forward?by:-by),"line",bB.lastHSPos);if(bE.hitSide){if(bA.forward){var bz=bG.charCoords(bE,"div");var bC={top:bz.top+8,left:bB.lastHSPos};var bE=bG.coordsChar(bC,"div")}else{var bD=bG.charCoords(c(bG.firstLine(),0),"div");bD.left=bB.lastHSPos;bE=bG.coordsChar(bD,"div")}}bB.lastHPos=bE.ch;return bE},moveByPage:function(bz,bB,bA){var by=bB;var bC=bA.repeat;return bz.findPosV(by,(bA.forward?bC:-bC),"page")},moveByParagraph:function(by,bB,bA){var bz=bA.forward?1:-1;return bm(by,bB,bA.repeat,bz)},moveByScroll:function(bE,bB,bz,bA){var bF=bE.getScrollInfo();var bG=null;var by=bz.repeat;if(!by){by=bF.clientHeight/(2*bE.defaultTextHeight())}var bD=bE.charCoords(bB,"local");bz.repeat=by;var bG=a1.moveByDisplayLines(bE,bB,bz,bA);if(!bG){return null}var bC=bE.charCoords(bG,"local");bE.scrollTo(null,bF.top+bC.top-bD.top);return bG},moveByWords:function(by,bA,bz){return aB(by,bA,bz.repeat,!!bz.forward,!!bz.wordEnd,!!bz.bigWord)},moveTillCharacter:function(bz,bA,bB){var bD=bB.repeat;var bC=bp(bz,bD,bB.forward,bB.selectedCharacter);var by=bB.forward?-1:1;aC(by,bB);if(!bC){return null}bC.ch+=by;return bC},moveToCharacter:function(by,bA,bz){var bB=bz.repeat;aC(0,bz);return bp(by,bB,bz.forward,bz.selectedCharacter)||bA},moveToSymbol:function(by,bA,bz){var bB=bz.repeat;return bq(by,bB,bz.forward,bz.selectedCharacter)||bA},moveToColumn:function(by,bB,bA,bz){var bC=bA.repeat;bz.lastHPos=bC-1;bz.lastHSPos=by.charCoords(bB,"div").left;return aj(by,bC)},moveToEol:function(by,bD,bC,bB){var bE=bD;bB.lastHPos=Infinity;var bA=c(bE.line+bC.repeat-1,Infinity);var bz=by.clipPos(bA);bz.ch--;bB.lastHSPos=by.charCoords(bz,"div").left;return bA},moveToFirstNonWhiteSpaceCharacter:function(by,bz){var bA=bz;return c(bA.line,aZ(by.getLine(bA.line)))},moveToMatchedSymbol:function(bE,bC){var bF=bC;var bG=bF.line;var by=bF.ch;var bD=bE.getLine(bG);var bB;do{bB=bD.charAt(by++);if(bB&&N(bB)){var bz=bE.getTokenTypeAt(c(bG,by));if(bz!=="string"&&bz!=="comment"){break}}}while(bB);if(bB){var bA=bE.findMatchingBracket(c(bG,by));return bA.to}else{return bF}},moveToStartOfLine:function(bz,by){return c(by.line,0)},moveToLineOrEdgeOfDocument:function(by,bz,bA){var bB=bA.forward?by.lastLine():by.firstLine();if(bA.repeatIsExplicit){bB=bA.repeat-by.getOption("firstLineNumber")}return c(bB,aZ(by.getLine(bB)))},textObjectManipulation:function(bG,bE,bA,bB){var by={"(":")",")":"(","{":"}","}":"{","[":"]","]":"["};var bH={"'":true,'"':true};var bD=bA.selectedCharacter;if(bD=="b"){bD="("}else{if(bD=="B"){bD="{"}}var bF=!bA.textObjectInner;var bC;if(by[bD]){bC=n(bG,bE,bD,bF)}else{if(bH[bD]){bC=aO(bG,bE,bD,bF)}else{if(bD==="W"){bC=aD(bG,bF,true,true)}else{if(bD==="w"){bC=aD(bG,bF,true,false)}else{if(bD==="p"){bC=bm(bG,bE,bA.repeat,0,bF);bA.linewise=true;if(bB.visualMode){if(!bB.visualLine){bB.visualLine=true}}else{var bz=bB.inputState.operatorArgs;if(bz){bz.linewise=true}bC.end.line--}}else{return null}}}}}if(!bG.state.vim.visualMode){return[bC.start,bC.end]}else{return t(bG,bC.start,bC.end)}},repeatLastCharacterSearch:function(bA,bD,bC){var bz=q.lastChararacterSearch;var bF=bC.repeat;var bB=bC.forward===bz.forward;var by=(bz.increment?1:0)*(bB?-1:1);bA.moveH(-by,"char");bC.inclusive=bB?true:false;var bE=bp(bA,bF,bB,bz.selectedCharacter);if(!bE){bA.moveH(by,"char");return bD}bE.ch+=by;return bE}};function y(bB,bA){var by=[];for(var bz=0;bz1);p.enterInsertMode(bH,{head:bE},bH.state.vim)},"delete":function(bF,bD,by){var bC,bG;var bA=bF.state.vim;if(!bA.visualBlock){var bB=by[0].anchor,bE=by[0].head;if(bD.linewise&&bE.line!=bF.firstLine()&&bB.line==bF.lastLine()&&bB.line==bE.line-1){if(bB.line==bF.firstLine()){bB.ch=0}else{bB=c(bB.line-1,aV(bF,bB.line-1))}}bG=bF.getRange(bB,bE);bF.replaceRange("",bB,bE);bC=bB;if(bD.linewise){bC=a1.moveToFirstNonWhiteSpaceCharacter(bF,bB)}}else{bG=bF.getSelection();var bz=y("",by.length);bF.replaceSelections(bz);bC=by[0].anchor}q.registerController.pushText(bD.registerName,"delete",bG,bD.linewise,bA.visualBlock);return bC},indent:function(bF,bE,by){var bC=bF.state.vim;var bG=by[0].anchor.line;var bA=bC.visualBlock?by[by.length-1].anchor.line:by[0].head.line;var bz=(bC.visualMode)?bE.repeat:1;if(bE.linewise){bA--}for(var bD=bG;bD<=bA;bD++){for(var bB=0;bBbB.top){bI.line+=(bD-bB.top)/bF;bI.line=Math.ceil(bI.line);bG.setCursor(bI);bB=bG.charCoords(bI,"local");bG.scrollTo(null,bB.top)}else{bG.scrollTo(null,bD)}}else{var bz=bD+bG.getScrollInfo().clientHeight;if(bz=bE.anchor.line){bC=D(bE.head,0,1)}else{bC=c(bE.anchor.line,0)}}else{bC=c(Math.min(bE.head.line,bE.anchor.line),Math.max(bE.head.ch+1,bE.anchor.ch));by=Math.abs(bE.head.line-bE.anchor.line)+1}}else{if(bD=="inplace"){if(bB.visualMode){return}}}}}}}bz.setOption("keyMap","vim-insert");bz.setOption("disableInput",false);if(bA&&bA.replace){bz.toggleOverwrite(true);bz.setOption("keyMap","vim-replace");b.signal(bz,"vim-mode-change",{mode:"replace"})}else{bz.setOption("keyMap","vim-insert");b.signal(bz,"vim-mode-change",{mode:"insert"})}if(!q.macroModeState.isPlaying){bz.on("change",bg);b.on(bz.getInputField(),"keydown",W)}if(bB.visualMode){aR(bz)}aS(bz,bC,by)},toggleVisualMode:function(by,bz,bA){var bD=bz.repeat;var bB=by.getCursor();var bC;if(!bA.visualMode){bA.visualMode=true;bA.visualLine=!!bz.linewise;bA.visualBlock=!!bz.blockwise;bC=Z(by,c(bB.line,bB.ch+bD-1),true);bA.sel={anchor:bB,head:bC};b.signal(by,"vim-mode-change",{mode:"visual",subMode:bA.visualLine?"linewise":bA.visualBlock?"blockwise":""});M(by);aP(by,bA,"<",av(bB,bC));aP(by,bA,">",a8(bB,bC))}else{if(bA.visualLine^bz.linewise||bA.visualBlock^bz.blockwise){bA.visualLine=!!bz.linewise;bA.visualBlock=!!bz.blockwise;b.signal(by,"vim-mode-change",{mode:"visual",subMode:bA.visualLine?"linewise":bA.visualBlock?"blockwise":""});M(by)}else{aR(by)}}},reselectLastSelection:function(by,bD,bA){var bz=bA.lastSelection;if(bA.visualMode){bf(by,bA)}if(bz){var bB=bz.anchorMark.find();var bC=bz.headMark.find();if(!bB||!bC){return}bA.sel={anchor:bB,head:bC};bA.visualMode=true;bA.visualLine=bz.visualLine;bA.visualBlock=bz.visualBlock;M(by);aP(by,bA,"<",av(bB,bC));aP(by,bA,">",a8(bB,bC));b.signal(by,"vim-mode-change",{mode:"visual",subMode:bA.visualLine?"linewise":bA.visualBlock?"blockwise":""})}},joinLines:function(bF,bz,bB){var bE,bH;if(bB.visualMode){bE=bF.getCursor("anchor");bH=bF.getCursor("head");bH.ch=aV(bF,bH.line)-1}else{var by=Math.max(bz.repeat,2);bE=bF.getCursor();bH=Z(bF,c(bE.line+by-1,Infinity))}var bA=0;for(var bD=bE.line;bD1){var bP=Array(bL.repeat+1).join(bP)}var bI=bz.linewise;var bK=bz.blockwise;if(bI){if(bU.visualMode){bP=bU.visualLine?bP.slice(0,-1):"\n"+bP.slice(0,bP.length-1)+"\n"}else{if(bL.after){bP="\n"+bP.slice(0,bP.length-1);bF.ch=aV(bM,bF.line)}else{bF.ch=0}}}else{if(bK){bP=bP.split("\n");for(var bV=0;bVbM.lastLine()){bM.replaceRange("\n",c(bN,0))}var bX=aV(bM,bN);if(bXbI.length){bE=bI.length}bH=c(bF.line,bE)}if(bB=="\n"){if(!bC.visualMode){bG.replaceRange("",bF,bH)}(b.commands.newlineAndIndentContinueComment||b.commands.newlineAndIndent)(bG)}else{var by=bG.getRange(bF,bH);by=by.replace(/[^\n]/g,bB);if(bC.visualBlock){var bD=new Array(bG.getOption("tabSize")+1).join(" ");by=bG.getSelection();by=by.replace(/\t/g,bD).replace(/[^\n]/g,bB).split("\n");bG.replaceSelections(by)}else{bG.replaceRange(by,bF,bH)}if(bC.visualMode){bF=aM(bz[0].anchor,bz[0].head)?bz[0].anchor:bz[0].head;bG.setCursor(bF);aR(bG)}else{bG.setCursor(D(bH,0,-1))}}},incrementNumberToken:function(bI,bz){var bJ=bI.getCursor();var bE=bI.getLine(bJ.line);var bL=/-?\d+/g;var bD;var by;var bC;var bK;var bA;while((bD=bL.exec(bE))!==null){bA=bD[0];by=bD.index;bC=by+bA.length;if(bJ.ch"){var bz=by.length-11;var bC=bB.slice(0,bz);var bA=by.slice(0,bz);return bC==bA&&bB.length>bz?"full":bA.indexOf(bC)==0?"partial":false}else{return bB==by?"full":by.indexOf(bB)==0?"partial":false}}function Q(bA){var bz=/^.*(<[\w\-]+>)$/.exec(bA);var by=bz?bz[1]:bA.slice(-1);if(by.length>1){switch(by){case"":by="\n";break;case"":by=" ";break;default:break}}return by}function aw(by,bz,bA){return function(){for(var bB=0;bB2){by=av.apply(undefined,Array.prototype.slice.call(arguments,1))}return aM(bz,by)?bz:by}function a8(bz,by){if(arguments.length>2){by=a8.apply(undefined,Array.prototype.slice.call(arguments,1))}return aM(bz,by)?by:bz}function au(bB,bA,bz){var bC=aM(bB,bA);var by=aM(bA,bz);return bC&&by}function aV(by,bz){return by.getLine(bz).length}function k(by){return by.split("").reverse().join("")}function a7(by){if(by.trim){return by.trim()}return by.replace(/^\s+|\s+$/g,"")}function g(by){return by.replace(/([.?*+$\[\]\/\\(){}|\-])/g,"\\$1")}function aW(by,bC,bB){var bA=aV(by,bC);var bz=new Array(bB-bA+1).join(" ");by.setCursor(c(bC,bA));by.replaceRange(bz,by.getCursor())}function F(bG,bz){var bB=[],bA=bG.listSelections();var bC=C(bG.clipPos(bz));var bR=!bv(bz,bC);var bE=bG.getCursor("head");var bQ=u(bA,bE);var bH=bv(bA[bQ].head,bA[bQ].anchor);var bP=bA.length-1;var bF=bP-bQ>bQ?bP:0;var bD=bA[bF].anchor;var bM=Math.min(bD.line,bC.line);var by=Math.max(bD.line,bC.line);var bI=bD.ch,bJ=bC.ch;var bO=bA[bF].head.ch-bI;var bL=bJ-bI;if(bO>0&&bL<=0){bI++;if(!bR){bJ--}}else{if(bO<0&&bL>=0){bI--;if(!bH){bJ++}}else{if(bO<0&&bL==-1){bI--;bJ++}}}for(var bK=bM;bK<=by;bK++){var bN={anchor:new c(bK,bI),head:new c(bK,bJ)};bB.push(bN)}bQ=bC.line==by?bB.length-1:0;bG.setSelections(bB);bz.ch=bJ;bD.ch=bI;return bD}function aS(bz,bB,by){var bD=[];for(var bA=0;bAbL){bJ.line=bL}bJ.ch=aV(bM,bJ.line)}else{bJ.ch=0;bG.ch=aV(bM,bG.line)}return{ranges:[{anchor:bG,head:bJ}],primary:0}}else{if(bH=="block"){var bI=Math.min(bG.line,bJ.line),bE=Math.min(bG.ch,bJ.ch),by=Math.max(bG.line,bJ.line),bN=Math.max(bG.ch,bJ.ch)+1;var bO=by-bI+1;var bD=bJ.line==bI?0:bO-1;var bz=[];for(var bF=0;bF0&&bA&&T(bA);bA=bB.pop()){bD.line--;bD.ch=0}if(bA){bD.line--;bD.ch=aV(bz,bD.line)}else{bD.ch=0}}}function bc(bz,by,bA){by.ch=0;bA.ch=0;bA.line++}function aZ(bz){if(!bz){return 0}var by=bz.search(/\S/);return by==-1?bz.length:by}function aD(bH,bD,bR,bz,bS){var bB=e(bH);var bK=bH.getLine(bB.line);var bN=bB.ch;var bM=bK.substring(bN);var bO;if(bS){bO=bM.search(/\w/)}else{bO=bM.search(/\S/)}if(bO==-1){return null}bN+=bO;bM=bK.substring(bN);var bQ=bK.substring(0,bN);var bT;if(bz){bT=/^\S+/}else{if((/\w/).test(bK.charAt(bN))){bT=/^\w+/}else{bT=/^[^\w\s]+/}}var bE=bT.exec(bM);var bL=bN;var bA=bN+bE[0].length;var bC=k(bQ);var bI=bT.exec(bC);if(bI){bL-=bI[0].length}if(bD){var bJ=bK.substring(bA);var by=bJ.match(/^\s*/)[0].length;if(by>0){bA+=by}else{var bG=bC.length-bL;var bF=bC.substring(bG);var bP=bF.match(/^\s*/)[0].length;bL-=bP}}return{start:c(bB.line,bL),end:c(bB.line,bA)}}function be(by,bz,bA){if(!bv(bz,bA)){q.jumpList.add(by,bz,bA)}}function aC(by,bz){q.lastChararacterSearch.increment=by;q.lastChararacterSearch.forward=bz.forward;q.lastChararacterSearch.selectedCharacter=bz.selectedCharacter}var S={"(":"bracket",")":"bracket","{":"bracket","}":"bracket","[":"section","]":"section","*":"comment","/":"comment",m:"method",M:"method","#":"preprocess"};var aX={bracket:{isComplete:function(by){if(by.nextCh===by.symb){by.depth++;if(by.depth>=1){return true}}else{if(by.nextCh===by.reverseSymb){by.depth--}}return false}},section:{init:function(by){by.curMoveThrough=true;by.symb=(by.forward?"]":"[")===by.symb?"{":"}"},isComplete:function(by){return by.index===0&&by.nextCh===by.symb}},comment:{isComplete:function(bz){var by=bz.lastCh==="*"&&bz.nextCh==="/";bz.lastCh=bz.nextCh;return by}},method:{init:function(by){by.symb=(by.symb==="m"?"{":"}");by.reverseSymb=by.symb==="{"?"}":"{"},isComplete:function(by){if(by.nextCh===by.symb){return true}return false}},preprocess:{init:function(by){by.index=0},isComplete:function(bz){if(bz.nextCh==="#"){var by=bz.lineText.match(/#(\w+)/)[1];if(by==="endif"){if(bz.forward&&bz.depth===0){return true}bz.depth++}else{if(by==="if"){if(!bz.forward&&bz.depth===0){return true}bz.depth--}}if(by==="else"&&bz.depth===0){return true}}return false}}};function bq(bH,bz,bC,bA){var bK=C(bH.getCursor());var bI=bC?1:-1;var bB=bC?bH.lineCount():-1;var bG=bK.ch;var bM=bK.line;var bF=bH.getLine(bM);var by={lineText:bF,nextCh:bF.charAt(bG),lastCh:null,index:bG,symb:bA,reverseSymb:(bC?{")":"(","}":"{"}:{"(":")","{":"}"})[bA],forward:bC,depth:0,curMoveThrough:false};var bD=S[bA];if(!bD){return bK}var bL=aX[bD].init;var bJ=aX[bD].isComplete;if(bL){bL(by)}while(bM!==bB&&bz){by.index+=bI;by.nextCh=by.lineText.charAt(by.index);if(!by.nextCh){bM+=bI;by.lineText=bH.getLine(bM)||"";if(bI>0){by.index=0}else{var bE=by.lineText.length;by.index=(bE>0)?(bE-1):0}by.nextCh=by.lineText.charAt(by.index)}if(bJ(by)){bK.line=bM;bK.ch=by.index;bz--}}if(by.nextCh||by.curMoveThrough){return c(bM,by.index)}return bK}function bs(bI,bJ,bB,bG,bH){var bC=bJ.line;var bF=bJ.ch;var bM=bI.getLine(bC);var bz=bB?1:-1;var bD=bG?bl:aq;if(bH&&bM==""){bC+=bz;bM=bI.getLine(bC);if(!f(bI,bC)){return null}bF=(bB)?0:bM.length}while(true){if(bH&&bM==""){return{from:0,to:0,line:bC}}var bE=(bz>0)?bM.length:-1;var bL=bE,bK=bE;while(bF!=bE){var by=false;for(var bA=0;bA0)?0:bM.length}throw new Error("The impossible happened.")}function aB(bI,bK,bz,bD,bM,bG){var bE=C(bK);var bF=[];if(bD&&!bM||!bD&&bM){bz++}var bH=!(bD&&bM);for(var bB=0;bB0){if(bI(bH,bA)){bz--}bH+=bA}return new c(bH,0)}var bD=bM.state.vim;if(bD.visualLine&&bI(bN,1,true)){var bF=bD.sel.anchor;if(bI(bF.line,-1,true)){if(!bL||bF.line!=bN){bN+=1}}}var bC=bG(bN);for(bH=bN;bH<=bK&&bz;bH++){if(bI(bH,1,true)){if(!bL||bG(bH)!=bC){bz--}}}bB=new c(bH,0);if(bH>bK&&!bC){bC=true}else{bL=false}for(bH=bN;bH>bE;bH--){if(!bL||bG(bH)==bC||bH==bN){if(bI(bH,-1,true)){break}}}by=new c(bH,0);return{start:by,end:bB}}function n(bI,bG,bA,bH){var bJ=bG,bz,bC;var bF=({"(":/[()]/,")":/[()]/,"[":/[[\]]/,"]":/[[\]]/,"{":/[{}]/,"}":/[{}]/})[bA];var bB=({"(":"(",")":"(","[":"[","]":"[","{":"{","}":"{"})[bA];var by=bI.getLine(bJ.line).charAt(bJ.ch);var bD=by===bB?1:0;bz=bI.scanForBracket(c(bJ.line,bJ.ch+bD),-1,null,{bracketRegex:bF});bC=bI.scanForBracket(c(bJ.line,bJ.ch+bD),1,null,{bracketRegex:bF});if(!bz||!bC){return{start:bJ,end:bJ}}bz=bz.pos;bC=bC.pos;if((bz.line==bC.line&&bz.ch>bC.ch)||(bz.line>bC.line)){var bE=bz;bz=bC;bC=bE}if(bH){bC.ch+=1}else{bz.ch+=1}return{start:bz,end:bC}}function aO(bH,bF,bA,bG){var bI=C(bF);var bJ=bH.getLine(bI.line);var bE=bJ.split("");var bz,bB,bC,bD;var by=bE.indexOf(bA);if(bI.ch-1&&!bz;bC--){if(bE[bC]==bA){bz=bC+1}}}if(bz&&!bB){for(bC=bz,bD=bE.length;bC'+bz+"
    ",{bottom:true,duration:5000})}else{alert(bz)}}function aF(bz,bA){var by="";if(bz){by+=''+bz+""}by+=' ';if(bA){by+='';by+=bA;by+=""}return by}var P="(Javascript regexp)";function a0(bz,bA){var bB=(bA.prefix||"")+" "+(bA.desc||"");var by=aF(bA.prefix,bA.desc);ab(bz,by,bB,bA.onClose,bA)}function X(bz,by){if(bz instanceof RegExp&&by instanceof RegExp){var bB=["global","multiline","ignoreCase","source"];for(var bA=0;bA=bz&&bA<=by)}else{return bA==bz}}}function bb(by){var bB=by.getScrollInfo();var bA=6;var bE=10;var bD=by.coordsChar({left:0,top:bA+bB.top},"local");var bz=bB.clientHeight-bE+bB.top;var bC=by.coordsChar({left:0,top:bz},"local");return{top:bD.line,bottom:bC.line}}var B=[{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:"set"},{name:"sort",shortName:"sor"},{name:"substitute",shortName:"s",possiblyAsync:true},{name:"nohlsearch",shortName:"noh"},{name:"delmarks",shortName:"delm"},{name:"registers",shortName:"reg",excludeFromCommandHistory:true},{name:"global",shortName:"g"}];var Y=function(){this.buildCommandMap_()};Y.prototype={processCommand:function(bJ,bI,bz){var bD=bJ.state.vim;var bA=q.registerController.getRegister(":");var bG=bA.toString();if(bD.visualMode){aR(bJ)}var by=new b.StringStream(bI);bA.setText(bI);var bC=bz||{};bC.input=bI;try{this.parseInput_(bJ,by,bC)}catch(bH){bk(bJ,bH);throw bH}var bB;var bF;if(!bC.commandName){if(bC.line!==undefined){bF="move"}}else{bB=this.matchCommand_(bC.commandName);if(bB){bF=bB.name;if(bB.excludeFromCommandHistory){bA.setText(bG)}this.parseCommandArgs_(by,bC,bB);if(bB.type=="exToKey"){for(var bE=0;bE0;by--){var bA=bz.substring(0,by);if(this.commandMap_[bA]){var bB=this.commandMap_[bA];if(bB.name.indexOf(bz)===0){return bB}}}return null},buildCommandMap_:function(){this.commandMap_={};for(var bz=0;bz
    ";if(!bF){for(var by in bC){var bG=bC[by].toString();if(bG.length){bA+='"'+by+" "+bG+"
    "}}}else{var by;bF=bF.join("");for(var bB=0;bB"}}bk(bD,bA)},sort:function(bH,bR){var bI,bB,bz,bA;function bC(){if(bR.argString){var bV=new b.StringStream(bR.argString);if(bV.eat("!")){bI=true}if(bV.eol()){return}if(!bV.eatSpace()){return"Invalid arguments"}var bX=bV.match(/[a-z]+/);if(bX){bX=bX[0];bB=bX.indexOf("i")!=-1;bz=bX.indexOf("u")!=-1;var bU=bX.indexOf("d")!=-1&&1;var bW=bX.indexOf("x")!=-1&&1;var bT=bX.indexOf("o")!=-1&&1;if(bU+bW+bT>1){return"Invalid arguments"}bA=bU&&"decimal"||bW&&"hex"||bT&&"octal"}if(bV.eatSpace()&&bV.match(/\/.*\//)){"patterns not supported"}}}var bD=bC();if(bD){bk(bH,bD+": "+bR.argString);return}var bM=bR.line||bH.firstLine();var bQ=bR.lineEnd||bR.line||bH.lastLine();if(bM==bQ){return}var bG=c(bM,0);var bO=c(bQ,aV(bH,bQ));var bL=bH.getRange(bG,bO).split("\n");var bE=(bA=="decimal")?/(-?)([\d]+)/:(bA=="hex")?/(-?)(?:0x)?([0-9a-f]+)/i:(bA=="octal")?/([0-7]+)/:null;var bF=(bA=="decimal")?10:(bA=="hex")?16:(bA=="octal")?8:null;var bJ=[],bN=[];if(bA){for(var bP=0;bP"}}if(!bB){bk(bL,bH);return}var bG=0;var bM=function(){if(bG=bH){bk(bI,"Invalid argument: "+bD.argString.substring(bG));return}for(var bE=0;bE<=bH-bz;bE++){var bC=String.fromCharCode(bz+bE);delete by.marks[bC]}}else{bk(bI,"Invalid argument: "+bB+"-");return}}else{delete by.marks[bA]}}}};var m=new Y();function a6(bM,bz,bB,bH,bF,bA,bJ,bD,bN){bM.state.vim.exMode=true;var bE=false;var bL=bA.from();function bI(){bM.operation(function(){while(!bE){bC();bG()}bK()})}function bC(){var bP=bM.getRange(bA.from(),bA.to());var bO=bP.replace(bJ,bD);bA.replace(bO)}function bG(){var bO;while(bO=bA.findNext()&&ae(bA.from(),bH,bF)){if(!bB&&bL&&bA.from().line==bL.line){continue}bM.scrollIntoView(bA.from(),30);bM.setSelection(bA.from(),bA.to());bL=bA.from();bE=false;return}bE=true}function bK(bP){if(bP){bP()}bM.focus();if(bL){bM.setCursor(bL);var bO=bM.state.vim;bO.exMode=false;bO.lastHPos=bO.lastHSPos=bL.ch}if(bN){bN()}}function by(bR,bO,bS){b.e_stop(bR);var bP=b.keyName(bR);switch(bP){case"Y":bC();bG();break;case"N":bG();break;case"A":var bQ=bN;bN=undefined;bM.operation(bI);bN=bQ;break;case"L":bC();case"Q":case"Esc":case"Ctrl-C":case"Ctrl-[":bK(bS);break}if(bE){bK(bS)}return true}bG();if(bE){bk(bM,"No matches for "+bJ.source);return}if(!bz){bI();if(bN){bN()}return}a0(bM,{prefix:"replace with "+bD+" (y/n/a/q/l)",onKeyDown:by})}b.keyMap.vim={attach:s,detach:h,call:a2};function v(bG){var bz=bG.state.vim;var bB=q.macroModeState;var bE=q.registerController.getRegister(".");var by=bB.isPlaying;var bC=bB.lastInsertModeChanges;var bH=[];if(!by){var bD=bC.inVisualBlock?bz.lastSelection.visualBlock.height:1;var bF=bC.changes;var bH=[];var bA=0;while(bA1){x(bG,bz,bz.insertModeRepeat-1,true);bz.lastEditInputState.repeatOverride=bz.insertModeRepeat}delete bz.insertModeRepeat;bz.insertMode=false;bG.setCursor(bG.getCursor().line,bG.getCursor().ch-1);bG.setOption("keyMap","vim");bG.setOption("disableInput",true);bG.toggleOverwrite(false);bE.setText(bC.changes.join(""));b.signal(bG,"vim-mode-change",{mode:"normal"});if(bB.isRecording){an(bB)}}aJ("insertModeEscKeysTimeout",200,"number");b.keyMap["vim-insert"]={"Ctrl-N":"autocomplete","Ctrl-P":"autocomplete",Enter:function(by){var bz=b.commands.newlineAndIndentContinueComment||b.commands.newlineAndIndent;bz(by)},fallthrough:["default"],attach:s,detach:h,call:a2};b.keyMap["vim-replace"]={Backspace:"goCharLeft",fallthrough:["vim-insert"],attach:s,detach:h,call:a2};function H(bG,bA,bB,by){var bI=q.registerController.getRegister(by);var bz=bI.keyBuffer;var bE=0;bB.isPlaying=true;bB.replaySearchQueries=bI.searchQueries.slice(0);for(var bC=0;bC|<\w+>|./).exec(bJ);bH=bD[0];bJ=bJ.substring(bD.index+bH.length);b.Vim.handleKey(bG,bH,"macro");if(bA.insertMode){var bF=bI.insertModeChanges[bE++].changes;q.macroModeState.lastInsertModeChanges.changes=bF;ar(bG,bF,1);v(bG)}}}bB.isPlaying=false}function I(bB,by){if(bB.isPlaying){return}var bA=bB.latestRegister;var bz=q.registerController.getRegister(bA);if(bz){bz.pushText(by)}}function an(bA){if(bA.isPlaying){return}var bz=bA.latestRegister;var by=q.registerController.getRegister(bz);if(by){by.pushInsertModeChanges(bA.lastInsertModeChanges)}}function O(bB,bA){if(bB.isPlaying){return}var bz=bB.latestRegister;var by=q.registerController.getRegister(bz);if(by){by.pushSearchQuery(bA)}}function bg(bz,by){var bB=q.macroModeState;var bA=bB.lastInsertModeChanges;if(!bB.isPlaying){while(by){bA.expectCursorActivityForChange=true;if(by.origin=="+input"||by.origin=="paste"||by.origin===undefined){var bC=by.text.join("\n");bA.changes.push(bC)}by=by.next}}}function aa(by){var bz=by.state.vim;if(bz.insertMode){var bB=q.macroModeState;if(bB.isPlaying){return}var bA=bB.lastInsertModeChanges;if(bA.expectCursorActivityForChange){bA.expectCursorActivityForChange=false}else{bA.changes=[]}}else{if(!by.curOp.isVimOp){r(by,bz)}}if(bz.visualMode){ac(by)}}function ac(by){var bz=by.state.vim;var bB=C(bz.sel.head);var bA=D(bB,0,1);if(bz.fakeCursor){bz.fakeCursor.clear()}bz.fakeCursor=by.markText(bB,bA,{className:"cm-animate-fat-cursor"})}function r(by,bz){var bA=by.getCursor("anchor");var bB=by.getCursor("head");if(bz.visualMode&&bv(bB,bA)&&aV(by,bB.line)>bB.ch){aR(by,false)}else{if(!bz.visualMode&&!bz.insertMode&&by.somethingSelected()){bz.visualMode=true;bz.visualLine=false;b.signal(by,"vim-mode-change",{mode:"visual"})}}if(bz.visualMode){var bC=!aM(bB,bA)?-1:0;var bD=aM(bB,bA)?-1:0;bB=D(bB,0,bC);bA=D(bA,0,bD);bz.sel={anchor:bA,head:bB};aP(by,bz,"<",av(bB,bA));aP(by,bz,">",a8(bB,bA))}else{if(!bz.insertMode){bz.lastHPos=by.getCursor().ch}}}function bi(by){this.keyName=by}function W(bC){var bB=q.macroModeState;var bA=bB.lastInsertModeChanges;var bz=b.keyName(bC);if(!bz){return}function by(){bA.changes.push(new bi(bz));return true}if(bz.indexOf("Delete")!=-1||bz.indexOf("Backspace")!=-1){b.lookupKey(bz,"vim-insert",by)}}function x(bG,bB,bz,by){var bD=q.macroModeState;bD.isPlaying=true;var bH=!!bB.lastEditActionCommand;var bE=bB.inputState;function bA(){if(bH){ba.processAction(bG,bB,bB.lastEditActionCommand)}else{ba.evalInput(bG,bB)}}function bF(bJ){if(bD.lastInsertModeChanges.changes.length>0){bJ=!bB.lastEditActionCommand?1:bJ;var bI=bD.lastInsertModeChanges;ar(bG,bI.changes,bJ)}}bB.inputState=bB.lastEditInputState;if(bH&&bB.lastEditActionCommand.interlaceInsertRepeat){for(var bC=0;bC= 0; i--) { + var cur = ranges[i].head; + cm.replaceRange("", Pos(cur.line, cur.ch - 1), Pos(cur.line, cur.ch + 1)); + } + } + + function handleEnter(cm) { + var conf = getConfig(cm); + var explode = conf && getOption(conf, "explode"); + if (!explode || cm.getOption("disableInput")) return CodeMirror.Pass; + + var ranges = cm.listSelections(); + for (var i = 0; i < ranges.length; i++) { + if (!ranges[i].empty()) return CodeMirror.Pass; + var around = charsAround(cm, ranges[i].head); + if (!around || explode.indexOf(around) % 2 != 0) return CodeMirror.Pass; + } + cm.operation(function() { + cm.replaceSelection("\n\n", null); + cm.execCommand("goCharLeft"); + ranges = cm.listSelections(); + for (var i = 0; i < ranges.length; i++) { + var line = ranges[i].head.line; + cm.indentLine(line, null, true); + cm.indentLine(line + 1, null, true); + } + }); + } + + function handleChar(cm, ch) { + var conf = getConfig(cm); + if (!conf || cm.getOption("disableInput")) return CodeMirror.Pass; + + var pairs = getOption(conf, "pairs"); + var pos = pairs.indexOf(ch); + if (pos == -1) return CodeMirror.Pass; + var triples = getOption(conf, "triples"); + + var identical = pairs.charAt(pos + 1) == ch; + var ranges = cm.listSelections(); + var opening = pos % 2 == 0; + + var type, next; + for (var i = 0; i < ranges.length; i++) { + var range = ranges[i], cur = range.head, curType; + var next = cm.getRange(cur, Pos(cur.line, cur.ch + 1)); + if (opening && !range.empty()) { + curType = "surround"; + } else if ((identical || !opening) && next == ch) { + if (triples.indexOf(ch) >= 0 && cm.getRange(cur, Pos(cur.line, cur.ch + 3)) == ch + ch + ch) + curType = "skipThree"; + else + curType = "skip"; + } else if (identical && cur.ch > 1 && triples.indexOf(ch) >= 0 && + cm.getRange(Pos(cur.line, cur.ch - 2), cur) == ch + ch && + (cur.ch <= 2 || cm.getRange(Pos(cur.line, cur.ch - 3), Pos(cur.line, cur.ch - 2)) != ch)) { + curType = "addFour"; + } else if (identical) { + if (!CodeMirror.isWordChar(next) && enteringString(cm, cur, ch)) curType = "both"; + else return CodeMirror.Pass; + } else if (opening && (cm.getLine(cur.line).length == cur.ch || + isClosingBracket(next, pairs) || + /\s/.test(next))) { + curType = "both"; + } else { + return CodeMirror.Pass; + } + if (!type) type = curType; + else if (type != curType) return CodeMirror.Pass; + } + + var left = pos % 2 ? pairs.charAt(pos - 1) : ch; + var right = pos % 2 ? ch : pairs.charAt(pos + 1); + cm.operation(function() { + if (type == "skip") { + cm.execCommand("goCharRight"); + } else if (type == "skipThree") { + for (var i = 0; i < 3; i++) + cm.execCommand("goCharRight"); + } else if (type == "surround") { + var sels = cm.getSelections(); + for (var i = 0; i < sels.length; i++) + sels[i] = left + sels[i] + right; + cm.replaceSelections(sels, "around"); + } else if (type == "both") { + cm.replaceSelection(left + right, null); + cm.triggerElectric(left + right); + cm.execCommand("goCharLeft"); + } else if (type == "addFour") { + cm.replaceSelection(left + left + left + left, "before"); + cm.execCommand("goCharRight"); + } + }); + } + + function isClosingBracket(ch, pairs) { + var pos = pairs.lastIndexOf(ch); + return pos > -1 && pos % 2 == 1; + } + + function charsAround(cm, pos) { + var str = cm.getRange(Pos(pos.line, pos.ch - 1), + Pos(pos.line, pos.ch + 1)); + return str.length == 2 ? str : null; + } + + // Project the token type that will exists after the given char is + // typed, and use it to determine whether it would cause the start + // of a string token. + function enteringString(cm, pos, ch) { + var line = cm.getLine(pos.line); + var token = cm.getTokenAt(pos); + if (/\bstring2?\b/.test(token.type)) return false; + var stream = new CodeMirror.StringStream(line.slice(0, pos.ch) + ch + line.slice(pos.ch), 4); + stream.pos = stream.start = token.start; + for (;;) { + var type1 = cm.getMode().token(stream, token.state); + if (stream.pos >= pos.ch + 1) return /\bstring2?\b/.test(type1); + stream.start = stream.pos; + } + } +}); + +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +/** + * Tag-closer extension for CodeMirror. + * + * This extension adds an "autoCloseTags" option that can be set to + * either true to get the default behavior, or an object to further + * configure its behavior. + * + * These are supported options: + * + * `whenClosing` (default true) + * Whether to autoclose when the '/' of a closing tag is typed. + * `whenOpening` (default true) + * Whether to autoclose the tag when the final '>' of an opening + * tag is typed. + * `dontCloseTags` (default is empty tags for HTML, none for XML) + * An array of tag names that should not be autoclosed. + * `indentTags` (default is block tags for HTML, none for XML) + * An array of tag names that should, when opened, cause a + * blank line to be added inside the tag, and the blank line and + * closing line to be indented. + * + * See demos/closetag.html for a usage example. + */ + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror"), require("../fold/xml-fold")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror", "../fold/xml-fold"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + CodeMirror.defineOption("autoCloseTags", false, function(cm, val, old) { + if (old != CodeMirror.Init && old) + cm.removeKeyMap("autoCloseTags"); + if (!val) return; + var map = {name: "autoCloseTags"}; + if (typeof val != "object" || val.whenClosing) + map["'/'"] = function(cm) { return autoCloseSlash(cm); }; + if (typeof val != "object" || val.whenOpening) + map["'>'"] = function(cm) { return autoCloseGT(cm); }; + cm.addKeyMap(map); + }); + + var htmlDontClose = ["area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", + "source", "track", "wbr"]; + var htmlIndent = ["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"]; + + function autoCloseGT(cm) { + if (cm.getOption("disableInput")) return CodeMirror.Pass; + var ranges = cm.listSelections(), replacements = []; + for (var i = 0; i < ranges.length; i++) { + if (!ranges[i].empty()) return CodeMirror.Pass; + var pos = ranges[i].head, tok = cm.getTokenAt(pos); + var inner = CodeMirror.innerMode(cm.getMode(), tok.state), state = inner.state; + if (inner.mode.name != "xml" || !state.tagName) return CodeMirror.Pass; + + var opt = cm.getOption("autoCloseTags"), html = inner.mode.configuration == "html"; + var dontCloseTags = (typeof opt == "object" && opt.dontCloseTags) || (html && htmlDontClose); + var indentTags = (typeof opt == "object" && opt.indentTags) || (html && htmlIndent); + + var tagName = state.tagName; + if (tok.end > pos.ch) tagName = tagName.slice(0, tagName.length - tok.end + pos.ch); + var lowerTagName = tagName.toLowerCase(); + // Don't process the '>' at the end of an end-tag or self-closing tag + if (!tagName || + tok.type == "string" && (tok.end != pos.ch || !/[\"\']/.test(tok.string.charAt(tok.string.length - 1)) || tok.string.length == 1) || + tok.type == "tag" && state.type == "closeTag" || + tok.string.indexOf("/") == (tok.string.length - 1) || // match something like + dontCloseTags && indexOf(dontCloseTags, lowerTagName) > -1 || + closingTagExists(cm, tagName, pos, state, true)) + return CodeMirror.Pass; + + var indent = indentTags && indexOf(indentTags, lowerTagName) > -1; + replacements[i] = {indent: indent, + text: ">" + (indent ? "\n\n" : "") + "", + newPos: indent ? CodeMirror.Pos(pos.line + 1, 0) : CodeMirror.Pos(pos.line, pos.ch + 1)}; + } + + for (var i = ranges.length - 1; i >= 0; i--) { + var info = replacements[i]; + cm.replaceRange(info.text, ranges[i].head, ranges[i].anchor, "+insert"); + var sel = cm.listSelections().slice(0); + sel[i] = {head: info.newPos, anchor: info.newPos}; + cm.setSelections(sel); + if (info.indent) { + cm.indentLine(info.newPos.line, null, true); + cm.indentLine(info.newPos.line + 1, null, true); + } + } + } + + function autoCloseCurrent(cm, typingSlash) { + var ranges = cm.listSelections(), replacements = []; + var head = typingSlash ? "/" : ""; + else if (cm.getMode().name == "htmlmixed" && inner.mode.name == "css") + replacements[i] = head + "style>"; + else + return CodeMirror.Pass; + } else { + if (!state.context || !state.context.tagName || + closingTagExists(cm, state.context.tagName, pos, state)) + return CodeMirror.Pass; + replacements[i] = head + state.context.tagName + ">"; + } + } + cm.replaceSelections(replacements); + ranges = cm.listSelections(); + for (var i = 0; i < ranges.length; i++) + if (i == ranges.length - 1 || ranges[i].head.line < ranges[i + 1].head.line) + cm.indentLine(ranges[i].head.line); + } + + function autoCloseSlash(cm) { + if (cm.getOption("disableInput")) return CodeMirror.Pass; + return autoCloseCurrent(cm, true); + } + + CodeMirror.commands.closeTag = function(cm) { return autoCloseCurrent(cm); }; + + function indexOf(collection, elt) { + if (collection.indexOf) return collection.indexOf(elt); + for (var i = 0, e = collection.length; i < e; ++i) + if (collection[i] == elt) return i; + return -1; + } + + // If xml-fold is loaded, we use its functionality to try and verify + // whether a given tag is actually unclosed. + function closingTagExists(cm, tagName, pos, state, newTag) { + if (!CodeMirror.scanForClosingTag) return false; + var end = Math.min(cm.lastLine() + 1, pos.line + 500); + var nextClose = CodeMirror.scanForClosingTag(cm, pos, null, end); + if (!nextClose || nextClose.tag != tagName) return false; + var cx = state.context; + // If the immediate wrapping context contains onCx instances of + // the same tag, a closing tag only exists if there are at least + // that many closing tags of that type following. + for (var onCx = newTag ? 1 : 0; cx && cx.tagName == tagName; cx = cx.prev) ++onCx; + pos = nextClose.to; + for (var i = 1; i < onCx; i++) { + var next = CodeMirror.scanForClosingTag(cm, pos, null, end); + if (!next || next.tag != tagName) return false; + pos = next.to; + } + return true; + } +}); + +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + var ie_lt8 = /MSIE \d/.test(navigator.userAgent) && + (document.documentMode == null || document.documentMode < 8); + + var Pos = CodeMirror.Pos; + + var matching = {"(": ")>", ")": "(<", "[": "]>", "]": "[<", "{": "}>", "}": "{<"}; + + function findMatchingBracket(cm, where, strict, config) { + var line = cm.getLineHandle(where.line), pos = where.ch - 1; + var match = (pos >= 0 && matching[line.text.charAt(pos)]) || matching[line.text.charAt(++pos)]; + if (!match) return null; + var dir = match.charAt(1) == ">" ? 1 : -1; + if (strict && (dir > 0) != (pos == where.ch)) return null; + var style = cm.getTokenTypeAt(Pos(where.line, pos + 1)); + + var found = scanForBracket(cm, Pos(where.line, pos + (dir > 0 ? 1 : 0)), dir, style || null, config); + if (found == null) return null; + return {from: Pos(where.line, pos), to: found && found.pos, + match: found && found.ch == match.charAt(0), forward: dir > 0}; + } + + // bracketRegex is used to specify which type of bracket to scan + // should be a regexp, e.g. /[[\]]/ + // + // Note: If "where" is on an open bracket, then this bracket is ignored. + // + // Returns false when no bracket was found, null when it reached + // maxScanLines and gave up + function scanForBracket(cm, where, dir, style, config) { + var maxScanLen = (config && config.maxScanLineLength) || 10000; + var maxScanLines = (config && config.maxScanLines) || 1000; + + var stack = []; + var re = config && config.bracketRegex ? config.bracketRegex : /[(){}[\]]/; + var lineEnd = dir > 0 ? Math.min(where.line + maxScanLines, cm.lastLine() + 1) + : Math.max(cm.firstLine() - 1, where.line - maxScanLines); + for (var lineNo = where.line; lineNo != lineEnd; lineNo += dir) { + var line = cm.getLine(lineNo); + if (!line) continue; + var pos = dir > 0 ? 0 : line.length - 1, end = dir > 0 ? line.length : -1; + if (line.length > maxScanLen) continue; + if (lineNo == where.line) pos = where.ch - (dir < 0 ? 1 : 0); + for (; pos != end; pos += dir) { + var ch = line.charAt(pos); + if (re.test(ch) && (style === undefined || cm.getTokenTypeAt(Pos(lineNo, pos + 1)) == style)) { + var match = matching[ch]; + if ((match.charAt(1) == ">") == (dir > 0)) stack.push(ch); + else if (!stack.length) return {pos: Pos(lineNo, pos), ch: ch}; + else stack.pop(); + } + } + } + return lineNo - dir == (dir > 0 ? cm.lastLine() : cm.firstLine()) ? false : null; + } + + function matchBrackets(cm, autoclear, config) { + // Disable brace matching in long lines, since it'll cause hugely slow updates + var maxHighlightLen = cm.state.matchBrackets.maxHighlightLineLength || 1000; + var marks = [], ranges = cm.listSelections(); + for (var i = 0; i < ranges.length; i++) { + var match = ranges[i].empty() && findMatchingBracket(cm, ranges[i].head, false, config); + if (match && cm.getLine(match.from.line).length <= maxHighlightLen) { + var style = match.match ? "CodeMirror-matchingbracket" : "CodeMirror-nonmatchingbracket"; + marks.push(cm.markText(match.from, Pos(match.from.line, match.from.ch + 1), {className: style})); + if (match.to && cm.getLine(match.to.line).length <= maxHighlightLen) + marks.push(cm.markText(match.to, Pos(match.to.line, match.to.ch + 1), {className: style})); + } + } + + if (marks.length) { + // Kludge to work around the IE bug from issue #1193, where text + // input stops going to the textare whever this fires. + if (ie_lt8 && cm.state.focused) cm.focus(); + + var clear = function() { + cm.operation(function() { + for (var i = 0; i < marks.length; i++) marks[i].clear(); + }); + }; + if (autoclear) setTimeout(clear, 800); + else return clear; + } + } + + var currentlyHighlighted = null; + function doMatchBrackets(cm) { + cm.operation(function() { + if (currentlyHighlighted) {currentlyHighlighted(); currentlyHighlighted = null;} + currentlyHighlighted = matchBrackets(cm, false, cm.state.matchBrackets); + }); + } + + CodeMirror.defineOption("matchBrackets", false, function(cm, val, old) { + if (old && old != CodeMirror.Init) + cm.off("cursorActivity", doMatchBrackets); + if (val) { + cm.state.matchBrackets = typeof val == "object" ? val : {}; + cm.on("cursorActivity", doMatchBrackets); + } + }); + + CodeMirror.defineExtension("matchBrackets", function() {matchBrackets(this, true);}); + CodeMirror.defineExtension("findMatchingBracket", function(pos, strict, config){ + return findMatchingBracket(this, pos, strict, config); + }); + CodeMirror.defineExtension("scanForBracket", function(pos, dir, style, config){ + return scanForBracket(this, pos, dir, style, config); + }); +}); + +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror"), require("../fold/xml-fold")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror", "../fold/xml-fold"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + CodeMirror.defineOption("matchTags", false, function(cm, val, old) { + if (old && old != CodeMirror.Init) { + cm.off("cursorActivity", doMatchTags); + cm.off("viewportChange", maybeUpdateMatch); + clear(cm); + } + if (val) { + cm.state.matchBothTags = typeof val == "object" && val.bothTags; + cm.on("cursorActivity", doMatchTags); + cm.on("viewportChange", maybeUpdateMatch); + doMatchTags(cm); + } + }); + + function clear(cm) { + if (cm.state.tagHit) cm.state.tagHit.clear(); + if (cm.state.tagOther) cm.state.tagOther.clear(); + cm.state.tagHit = cm.state.tagOther = null; + } + + function doMatchTags(cm) { + cm.state.failedTagMatch = false; + cm.operation(function() { + clear(cm); + if (cm.somethingSelected()) return; + var cur = cm.getCursor(), range = cm.getViewport(); + range.from = Math.min(range.from, cur.line); range.to = Math.max(cur.line + 1, range.to); + var match = CodeMirror.findMatchingTag(cm, cur, range); + if (!match) return; + if (cm.state.matchBothTags) { + var hit = match.at == "open" ? match.open : match.close; + if (hit) cm.state.tagHit = cm.markText(hit.from, hit.to, {className: "CodeMirror-matchingtag"}); + } + var other = match.at == "close" ? match.open : match.close; + if (other) + cm.state.tagOther = cm.markText(other.from, other.to, {className: "CodeMirror-matchingtag"}); + else + cm.state.failedTagMatch = true; + }); + } + + function maybeUpdateMatch(cm) { + if (cm.state.failedTagMatch) doMatchTags(cm); + } + + CodeMirror.commands.toMatchingTag = function(cm) { + var found = CodeMirror.findMatchingTag(cm, cm.getCursor()); + if (found) { + var other = found.at == "close" ? found.open : found.close; + if (other) cm.extendSelection(other.to, other.from); + } + }; +}); + +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.registerHelper("fold", "brace", function(cm, start) { + var line = start.line, lineText = cm.getLine(line); + var startCh, tokenType; + + function findOpening(openCh) { + for (var at = start.ch, pass = 0;;) { + var found = at <= 0 ? -1 : lineText.lastIndexOf(openCh, at - 1); + if (found == -1) { + if (pass == 1) break; + pass = 1; + at = lineText.length; + continue; + } + if (pass == 1 && found < start.ch) break; + tokenType = cm.getTokenTypeAt(CodeMirror.Pos(line, found + 1)); + if (!/^(comment|string)/.test(tokenType)) return found + 1; + at = found - 1; + } + } + + var startToken = "{", endToken = "}", startCh = findOpening("{"); + if (startCh == null) { + startToken = "[", endToken = "]"; + startCh = findOpening("["); + } + + if (startCh == null) return; + var count = 1, lastLine = cm.lastLine(), end, endCh; + outer: for (var i = line; i <= lastLine; ++i) { + var text = cm.getLine(i), pos = i == line ? startCh : 0; + for (;;) { + var nextOpen = text.indexOf(startToken, pos), nextClose = text.indexOf(endToken, pos); + if (nextOpen < 0) nextOpen = text.length; + if (nextClose < 0) nextClose = text.length; + pos = Math.min(nextOpen, nextClose); + if (pos == text.length) break; + if (cm.getTokenTypeAt(CodeMirror.Pos(i, pos + 1)) == tokenType) { + if (pos == nextOpen) ++count; + else if (!--count) { end = i; endCh = pos; break outer; } + } + ++pos; + } + } + if (end == null || line == end && endCh == startCh) return; + return {from: CodeMirror.Pos(line, startCh), + to: CodeMirror.Pos(end, endCh)}; +}); + +CodeMirror.registerHelper("fold", "import", function(cm, start) { + function hasImport(line) { + if (line < cm.firstLine() || line > cm.lastLine()) return null; + var start = cm.getTokenAt(CodeMirror.Pos(line, 1)); + if (!/\S/.test(start.string)) start = cm.getTokenAt(CodeMirror.Pos(line, start.end + 1)); + if (start.type != "keyword" || start.string != "import") return null; + // Now find closing semicolon, return its position + for (var i = line, e = Math.min(cm.lastLine(), line + 10); i <= e; ++i) { + var text = cm.getLine(i), semi = text.indexOf(";"); + if (semi != -1) return {startCh: start.end, end: CodeMirror.Pos(i, semi)}; + } + } + + var start = start.line, has = hasImport(start), prev; + if (!has || hasImport(start - 1) || ((prev = hasImport(start - 2)) && prev.end.line == start - 1)) + return null; + for (var end = has.end;;) { + var next = hasImport(end.line + 1); + if (next == null) break; + end = next.end; + } + return {from: cm.clipPos(CodeMirror.Pos(start, has.startCh + 1)), to: end}; +}); + +CodeMirror.registerHelper("fold", "include", function(cm, start) { + function hasInclude(line) { + if (line < cm.firstLine() || line > cm.lastLine()) return null; + var start = cm.getTokenAt(CodeMirror.Pos(line, 1)); + if (!/\S/.test(start.string)) start = cm.getTokenAt(CodeMirror.Pos(line, start.end + 1)); + if (start.type == "meta" && start.string.slice(0, 8) == "#include") return start.start + 8; + } + + var start = start.line, has = hasInclude(start); + if (has == null || hasInclude(start - 1) != null) return null; + for (var end = start;;) { + var next = hasInclude(end + 1); + if (next == null) break; + ++end; + } + return {from: CodeMirror.Pos(start, has + 1), + to: cm.clipPos(CodeMirror.Pos(end))}; +}); + +}); + +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + function doFold(cm, pos, options, force) { + if (options && options.call) { + var finder = options; + options = null; + } else { + var finder = getOption(cm, options, "rangeFinder"); + } + if (typeof pos == "number") pos = CodeMirror.Pos(pos, 0); + var minSize = getOption(cm, options, "minFoldSize"); + + function getRange(allowFolded) { + var range = finder(cm, pos); + if (!range || range.to.line - range.from.line < minSize) return null; + var marks = cm.findMarksAt(range.from); + for (var i = 0; i < marks.length; ++i) { + if (marks[i].__isFold && force !== "fold") { + if (!allowFolded) return null; + range.cleared = true; + marks[i].clear(); + } + } + return range; + } + + var range = getRange(true); + if (getOption(cm, options, "scanUp")) while (!range && pos.line > cm.firstLine()) { + pos = CodeMirror.Pos(pos.line - 1, 0); + range = getRange(false); + } + if (!range || range.cleared || force === "unfold") return; + + var myWidget = makeWidget(cm, options); + CodeMirror.on(myWidget, "mousedown", function(e) { + myRange.clear(); + CodeMirror.e_preventDefault(e); + }); + var myRange = cm.markText(range.from, range.to, { + replacedWith: myWidget, + clearOnEnter: true, + __isFold: true + }); + myRange.on("clear", function(from, to) { + CodeMirror.signal(cm, "unfold", cm, from, to); + }); + CodeMirror.signal(cm, "fold", cm, range.from, range.to); + } + + function makeWidget(cm, options) { + var widget = getOption(cm, options, "widget"); + if (typeof widget == "string") { + var text = document.createTextNode(widget); + widget = document.createElement("span"); + widget.appendChild(text); + widget.className = "CodeMirror-foldmarker"; + } + return widget; + } + + // Clumsy backwards-compatible interface + CodeMirror.newFoldFunction = function(rangeFinder, widget) { + return function(cm, pos) { doFold(cm, pos, {rangeFinder: rangeFinder, widget: widget}); }; + }; + + // New-style interface + CodeMirror.defineExtension("foldCode", function(pos, options, force) { + doFold(this, pos, options, force); + }); + + CodeMirror.defineExtension("isFolded", function(pos) { + var marks = this.findMarksAt(pos); + for (var i = 0; i < marks.length; ++i) + if (marks[i].__isFold) return true; + }); + + CodeMirror.commands.toggleFold = function(cm) { + cm.foldCode(cm.getCursor()); + }; + CodeMirror.commands.fold = function(cm) { + cm.foldCode(cm.getCursor(), null, "fold"); + }; + CodeMirror.commands.unfold = function(cm) { + cm.foldCode(cm.getCursor(), null, "unfold"); + }; + CodeMirror.commands.foldAll = function(cm) { + cm.operation(function() { + for (var i = cm.firstLine(), e = cm.lastLine(); i <= e; i++) + cm.foldCode(CodeMirror.Pos(i, 0), null, "fold"); + }); + }; + CodeMirror.commands.unfoldAll = function(cm) { + cm.operation(function() { + for (var i = cm.firstLine(), e = cm.lastLine(); i <= e; i++) + cm.foldCode(CodeMirror.Pos(i, 0), null, "unfold"); + }); + }; + + CodeMirror.registerHelper("fold", "combine", function() { + var funcs = Array.prototype.slice.call(arguments, 0); + return function(cm, start) { + for (var i = 0; i < funcs.length; ++i) { + var found = funcs[i](cm, start); + if (found) return found; + } + }; + }); + + CodeMirror.registerHelper("fold", "auto", function(cm, start) { + var helpers = cm.getHelpers(start, "fold"); + for (var i = 0; i < helpers.length; i++) { + var cur = helpers[i](cm, start); + if (cur) return cur; + } + }); + + var defaultOptions = { + rangeFinder: CodeMirror.fold.auto, + widget: "\u2194", + minFoldSize: 0, + scanUp: false + }; + + CodeMirror.defineOption("foldOptions", null); + + function getOption(cm, options, name) { + if (options && options[name] !== undefined) + return options[name]; + var editorOptions = cm.options.foldOptions; + if (editorOptions && editorOptions[name] !== undefined) + return editorOptions[name]; + return defaultOptions[name]; + } + + CodeMirror.defineExtension("foldOption", function(options, name) { + return getOption(this, options, name); + }); +}); + +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror"), require("./foldcode")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror", "./foldcode"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + CodeMirror.defineOption("foldGutter", false, function(cm, val, old) { + if (old && old != CodeMirror.Init) { + cm.clearGutter(cm.state.foldGutter.options.gutter); + cm.state.foldGutter = null; + cm.off("gutterClick", onGutterClick); + cm.off("change", onChange); + cm.off("viewportChange", onViewportChange); + cm.off("fold", onFold); + cm.off("unfold", onFold); + cm.off("swapDoc", updateInViewport); + } + if (val) { + cm.state.foldGutter = new State(parseOptions(val)); + updateInViewport(cm); + cm.on("gutterClick", onGutterClick); + cm.on("change", onChange); + cm.on("viewportChange", onViewportChange); + cm.on("fold", onFold); + cm.on("unfold", onFold); + cm.on("swapDoc", updateInViewport); + } + }); + + var Pos = CodeMirror.Pos; + + function State(options) { + this.options = options; + this.from = this.to = 0; + } + + function parseOptions(opts) { + if (opts === true) opts = {}; + if (opts.gutter == null) opts.gutter = "CodeMirror-foldgutter"; + if (opts.indicatorOpen == null) opts.indicatorOpen = "CodeMirror-foldgutter-open"; + if (opts.indicatorFolded == null) opts.indicatorFolded = "CodeMirror-foldgutter-folded"; + return opts; + } + + function isFolded(cm, line) { + var marks = cm.findMarksAt(Pos(line)); + for (var i = 0; i < marks.length; ++i) + if (marks[i].__isFold && marks[i].find().from.line == line) return marks[i]; + } + + function marker(spec) { + if (typeof spec == "string") { + var elt = document.createElement("div"); + elt.className = spec + " CodeMirror-guttermarker-subtle"; + return elt; + } else { + return spec.cloneNode(true); + } + } + + function updateFoldInfo(cm, from, to) { + var opts = cm.state.foldGutter.options, cur = from; + var minSize = cm.foldOption(opts, "minFoldSize"); + var func = cm.foldOption(opts, "rangeFinder"); + cm.eachLine(from, to, function(line) { + var mark = null; + if (isFolded(cm, cur)) { + mark = marker(opts.indicatorFolded); + } else { + var pos = Pos(cur, 0); + var range = func && func(cm, pos); + if (range && range.to.line - range.from.line >= minSize) + mark = marker(opts.indicatorOpen); + } + cm.setGutterMarker(line, opts.gutter, mark); + ++cur; + }); + } + + function updateInViewport(cm) { + var vp = cm.getViewport(), state = cm.state.foldGutter; + if (!state) return; + cm.operation(function() { + updateFoldInfo(cm, vp.from, vp.to); + }); + state.from = vp.from; state.to = vp.to; + } + + function onGutterClick(cm, line, gutter) { + var state = cm.state.foldGutter; + if (!state) return; + var opts = state.options; + if (gutter != opts.gutter) return; + var folded = isFolded(cm, line); + if (folded) folded.clear(); + else cm.foldCode(Pos(line, 0), opts.rangeFinder); + } + + function onChange(cm) { + var state = cm.state.foldGutter; + if (!state) return; + var opts = state.options; + state.from = state.to = 0; + clearTimeout(state.changeUpdate); + state.changeUpdate = setTimeout(function() { updateInViewport(cm); }, opts.foldOnChangeTimeSpan || 600); + } + + function onViewportChange(cm) { + var state = cm.state.foldGutter; + if (!state) return; + var opts = state.options; + clearTimeout(state.changeUpdate); + state.changeUpdate = setTimeout(function() { + var vp = cm.getViewport(); + if (state.from == state.to || vp.from - state.to > 20 || state.from - vp.to > 20) { + updateInViewport(cm); + } else { + cm.operation(function() { + if (vp.from < state.from) { + updateFoldInfo(cm, vp.from, state.from); + state.from = vp.from; + } + if (vp.to > state.to) { + updateFoldInfo(cm, state.to, vp.to); + state.to = vp.to; + } + }); + } + }, opts.updateViewportTimeSpan || 400); + } + + function onFold(cm, from) { + var state = cm.state.foldGutter; + if (!state) return; + var line = from.line; + if (line >= state.from && line < state.to) + updateFoldInfo(cm, line, line + 1); + } +}); + +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + var Pos = CodeMirror.Pos; + function cmp(a, b) { return a.line - b.line || a.ch - b.ch; } + + var nameStartChar = "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"; + var nameChar = nameStartChar + "\-\:\.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040"; + var xmlTagStart = new RegExp("<(/?)([" + nameStartChar + "][" + nameChar + "]*)", "g"); + + function Iter(cm, line, ch, range) { + this.line = line; this.ch = ch; + this.cm = cm; this.text = cm.getLine(line); + this.min = range ? range.from : cm.firstLine(); + this.max = range ? range.to - 1 : cm.lastLine(); + } + + function tagAt(iter, ch) { + var type = iter.cm.getTokenTypeAt(Pos(iter.line, ch)); + return type && /\btag\b/.test(type); + } + + function nextLine(iter) { + if (iter.line >= iter.max) return; + iter.ch = 0; + iter.text = iter.cm.getLine(++iter.line); + return true; + } + function prevLine(iter) { + if (iter.line <= iter.min) return; + iter.text = iter.cm.getLine(--iter.line); + iter.ch = iter.text.length; + return true; + } + + function toTagEnd(iter) { + for (;;) { + var gt = iter.text.indexOf(">", iter.ch); + if (gt == -1) { if (nextLine(iter)) continue; else return; } + if (!tagAt(iter, gt + 1)) { iter.ch = gt + 1; continue; } + var lastSlash = iter.text.lastIndexOf("/", gt); + var selfClose = lastSlash > -1 && !/\S/.test(iter.text.slice(lastSlash + 1, gt)); + iter.ch = gt + 1; + return selfClose ? "selfClose" : "regular"; + } + } + function toTagStart(iter) { + for (;;) { + var lt = iter.ch ? iter.text.lastIndexOf("<", iter.ch - 1) : -1; + if (lt == -1) { if (prevLine(iter)) continue; else return; } + if (!tagAt(iter, lt + 1)) { iter.ch = lt; continue; } + xmlTagStart.lastIndex = lt; + iter.ch = lt; + var match = xmlTagStart.exec(iter.text); + if (match && match.index == lt) return match; + } + } + + function toNextTag(iter) { + for (;;) { + xmlTagStart.lastIndex = iter.ch; + var found = xmlTagStart.exec(iter.text); + if (!found) { if (nextLine(iter)) continue; else return; } + if (!tagAt(iter, found.index + 1)) { iter.ch = found.index + 1; continue; } + iter.ch = found.index + found[0].length; + return found; + } + } + function toPrevTag(iter) { + for (;;) { + var gt = iter.ch ? iter.text.lastIndexOf(">", iter.ch - 1) : -1; + if (gt == -1) { if (prevLine(iter)) continue; else return; } + if (!tagAt(iter, gt + 1)) { iter.ch = gt; continue; } + var lastSlash = iter.text.lastIndexOf("/", gt); + var selfClose = lastSlash > -1 && !/\S/.test(iter.text.slice(lastSlash + 1, gt)); + iter.ch = gt + 1; + return selfClose ? "selfClose" : "regular"; + } + } + + function findMatchingClose(iter, tag) { + var stack = []; + for (;;) { + var next = toNextTag(iter), end, startLine = iter.line, startCh = iter.ch - (next ? next[0].length : 0); + if (!next || !(end = toTagEnd(iter))) return; + if (end == "selfClose") continue; + if (next[1]) { // closing tag + for (var i = stack.length - 1; i >= 0; --i) if (stack[i] == next[2]) { + stack.length = i; + break; + } + if (i < 0 && (!tag || tag == next[2])) return { + tag: next[2], + from: Pos(startLine, startCh), + to: Pos(iter.line, iter.ch) + }; + } else { // opening tag + stack.push(next[2]); + } + } + } + function findMatchingOpen(iter, tag) { + var stack = []; + for (;;) { + var prev = toPrevTag(iter); + if (!prev) return; + if (prev == "selfClose") { toTagStart(iter); continue; } + var endLine = iter.line, endCh = iter.ch; + var start = toTagStart(iter); + if (!start) return; + if (start[1]) { // closing tag + stack.push(start[2]); + } else { // opening tag + for (var i = stack.length - 1; i >= 0; --i) if (stack[i] == start[2]) { + stack.length = i; + break; + } + if (i < 0 && (!tag || tag == start[2])) return { + tag: start[2], + from: Pos(iter.line, iter.ch), + to: Pos(endLine, endCh) + }; + } + } + } + + CodeMirror.registerHelper("fold", "xml", function(cm, start) { + var iter = new Iter(cm, start.line, 0); + for (;;) { + var openTag = toNextTag(iter), end; + if (!openTag || iter.line != start.line || !(end = toTagEnd(iter))) return; + if (!openTag[1] && end != "selfClose") { + var start = Pos(iter.line, iter.ch); + var close = findMatchingClose(iter, openTag[2]); + return close && {from: start, to: close.from}; + } + } + }); + CodeMirror.findMatchingTag = function(cm, pos, range) { + var iter = new Iter(cm, pos.line, pos.ch, range); + if (iter.text.indexOf(">") == -1 && iter.text.indexOf("<") == -1) return; + var end = toTagEnd(iter), to = end && Pos(iter.line, iter.ch); + var start = end && toTagStart(iter); + if (!end || !start || cmp(iter, pos) > 0) return; + var here = {from: Pos(iter.line, iter.ch), to: to, tag: start[2]}; + if (end == "selfClose") return {open: here, close: null, at: "open"}; + + if (start[1]) { // closing tag + return {open: findMatchingOpen(iter, start[2]), close: here, at: "close"}; + } else { // opening tag + iter = new Iter(cm, to.line, to.ch, range); + return {open: here, close: findMatchingClose(iter, start[2]), at: "open"}; + } + }; + + CodeMirror.findEnclosingTag = function(cm, pos, range) { + var iter = new Iter(cm, pos.line, pos.ch, range); + for (;;) { + var open = findMatchingOpen(iter); + if (!open) break; + var forward = new Iter(cm, pos.line, pos.ch, range); + var close = findMatchingClose(forward, open.tag); + if (close) return {open: open, close: close}; + } + }; + + // Used by addon/edit/closetag.js + CodeMirror.scanForClosingTag = function(cm, pos, name, end) { + var iter = new Iter(cm, pos.line, pos.ch, end ? {from: 0, to: end} : null); + return findMatchingClose(iter, name); + }; +}); + +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror"), "cjs"); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], function(CM) { mod(CM, "amd"); }); + else // Plain browser env + mod(CodeMirror, "plain"); +})(function(CodeMirror, env) { + if (!CodeMirror.modeURL) CodeMirror.modeURL = "../mode/%N/%N.js"; + + var loading = {}; + function splitCallback(cont, n) { + var countDown = n; + return function() { if (--countDown == 0) cont(); }; + } + function ensureDeps(mode, cont) { + var deps = CodeMirror.modes[mode].dependencies; + if (!deps) return cont(); + var missing = []; + for (var i = 0; i < deps.length; ++i) { + if (!CodeMirror.modes.hasOwnProperty(deps[i])) + missing.push(deps[i]); + } + if (!missing.length) return cont(); + var split = splitCallback(cont, missing.length); + for (var i = 0; i < missing.length; ++i) + CodeMirror.requireMode(missing[i], split); + } + + CodeMirror.requireMode = function(mode, cont) { + if (typeof mode != "string") mode = mode.name; + if (CodeMirror.modes.hasOwnProperty(mode)) return ensureDeps(mode, cont); + if (loading.hasOwnProperty(mode)) return loading[mode].push(cont); + + var file = CodeMirror.modeURL.replace(/%N/g, mode); + if (env == "plain") { + var script = document.createElement("script"); + script.src = file; + var others = document.getElementsByTagName("script")[0]; + var list = loading[mode] = [cont]; + CodeMirror.on(script, "load", function() { + ensureDeps(mode, function() { + for (var i = 0; i < list.length; ++i) list[i](); + }); + }); + others.parentNode.insertBefore(script, others); + } else if (env == "cjs") { + require(file); + cont(); + } else if (env == "amd") { + requirejs([file], cont); + } + }; + + CodeMirror.autoLoadMode = function(instance, mode) { + if (!CodeMirror.modes.hasOwnProperty(mode)) + CodeMirror.requireMode(mode, function() { + instance.setOption("mode", instance.getOption("mode")); + }); + }; +}); + +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.multiplexingMode = function(outer /*, others */) { + // Others should be {open, close, mode [, delimStyle] [, innerStyle]} objects + var others = Array.prototype.slice.call(arguments, 1); + + function indexOf(string, pattern, from, returnEnd) { + if (typeof pattern == "string") { + var found = string.indexOf(pattern, from); + return returnEnd && found > -1 ? found + pattern.length : found; + } + var m = pattern.exec(from ? string.slice(from) : string); + return m ? m.index + from + (returnEnd ? m[0].length : 0) : -1; + } + + return { + startState: function() { + return { + outer: CodeMirror.startState(outer), + innerActive: null, + inner: null + }; + }, + + copyState: function(state) { + return { + outer: CodeMirror.copyState(outer, state.outer), + innerActive: state.innerActive, + inner: state.innerActive && CodeMirror.copyState(state.innerActive.mode, state.inner) + }; + }, + + token: function(stream, state) { + if (!state.innerActive) { + var cutOff = Infinity, oldContent = stream.string; + for (var i = 0; i < others.length; ++i) { + var other = others[i]; + var found = indexOf(oldContent, other.open, stream.pos); + if (found == stream.pos) { + if (!other.parseDelimiters) stream.match(other.open); + state.innerActive = other; + state.inner = CodeMirror.startState(other.mode, outer.indent ? outer.indent(state.outer, "") : 0); + return other.delimStyle; + } else if (found != -1 && found < cutOff) { + cutOff = found; + } + } + if (cutOff != Infinity) stream.string = oldContent.slice(0, cutOff); + var outerToken = outer.token(stream, state.outer); + if (cutOff != Infinity) stream.string = oldContent; + return outerToken; + } else { + var curInner = state.innerActive, oldContent = stream.string; + if (!curInner.close && stream.sol()) { + state.innerActive = state.inner = null; + return this.token(stream, state); + } + var found = curInner.close ? indexOf(oldContent, curInner.close, stream.pos, curInner.parseDelimiters) : -1; + if (found == stream.pos && !curInner.parseDelimiters) { + stream.match(curInner.close); + state.innerActive = state.inner = null; + return curInner.delimStyle; + } + if (found > -1) stream.string = oldContent.slice(0, found); + var innerToken = curInner.mode.token(stream, state.inner); + if (found > -1) stream.string = oldContent; + + if (found == stream.pos && curInner.parseDelimiters) + state.innerActive = state.inner = null; + + if (curInner.innerStyle) { + if (innerToken) innerToken = innerToken + ' ' + curInner.innerStyle; + else innerToken = curInner.innerStyle; + } + + return innerToken; + } + }, + + indent: function(state, textAfter) { + var mode = state.innerActive ? state.innerActive.mode : outer; + if (!mode.indent) return CodeMirror.Pass; + return mode.indent(state.innerActive ? state.inner : state.outer, textAfter); + }, + + blankLine: function(state) { + var mode = state.innerActive ? state.innerActive.mode : outer; + if (mode.blankLine) { + mode.blankLine(state.innerActive ? state.inner : state.outer); + } + if (!state.innerActive) { + for (var i = 0; i < others.length; ++i) { + var other = others[i]; + if (other.open === "\n") { + state.innerActive = other; + state.inner = CodeMirror.startState(other.mode, mode.indent ? mode.indent(state.outer, "") : 0); + } + } + } else if (state.innerActive.close === "\n") { + state.innerActive = state.inner = null; + } + }, + + electricChars: outer.electricChars, + + innerMode: function(state) { + return state.inner ? {state: state.inner, mode: state.innerActive.mode} : {state: state.outer, mode: outer}; + } + }; +}; + +}); + +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + function Bar(cls, orientation, scroll) { + this.orientation = orientation; + this.scroll = scroll; + this.screen = this.total = this.size = 1; + this.pos = 0; + + this.node = document.createElement("div"); + this.node.className = cls + "-" + orientation; + this.inner = this.node.appendChild(document.createElement("div")); + + var self = this; + CodeMirror.on(this.inner, "mousedown", function(e) { + if (e.which != 1) return; + CodeMirror.e_preventDefault(e); + var axis = self.orientation == "horizontal" ? "pageX" : "pageY"; + var start = e[axis], startpos = self.pos; + function done() { + CodeMirror.off(document, "mousemove", move); + CodeMirror.off(document, "mouseup", done); + } + function move(e) { + if (e.which != 1) return done(); + self.moveTo(startpos + (e[axis] - start) * (self.total / self.size)); + } + CodeMirror.on(document, "mousemove", move); + CodeMirror.on(document, "mouseup", done); + }); + + CodeMirror.on(this.node, "click", function(e) { + CodeMirror.e_preventDefault(e); + var innerBox = self.inner.getBoundingClientRect(), where; + if (self.orientation == "horizontal") + where = e.clientX < innerBox.left ? -1 : e.clientX > innerBox.right ? 1 : 0; + else + where = e.clientY < innerBox.top ? -1 : e.clientY > innerBox.bottom ? 1 : 0; + self.moveTo(self.pos + where * self.screen); + }); + + function onWheel(e) { + var moved = CodeMirror.wheelEventPixels(e)[self.orientation == "horizontal" ? "x" : "y"]; + var oldPos = self.pos; + self.moveTo(self.pos + moved); + if (self.pos != oldPos) CodeMirror.e_preventDefault(e); + } + CodeMirror.on(this.node, "mousewheel", onWheel); + CodeMirror.on(this.node, "DOMMouseScroll", onWheel); + } + + Bar.prototype.moveTo = function(pos, update) { + if (pos < 0) pos = 0; + if (pos > this.total - this.screen) pos = this.total - this.screen; + if (pos == this.pos) return; + this.pos = pos; + this.inner.style[this.orientation == "horizontal" ? "left" : "top"] = + (pos * (this.size / this.total)) + "px"; + if (update !== false) this.scroll(pos, this.orientation); + }; + + var minButtonSize = 10; + + Bar.prototype.update = function(scrollSize, clientSize, barSize) { + this.screen = clientSize; + this.total = scrollSize; + this.size = barSize; + + var buttonSize = this.screen * (this.size / this.total); + if (buttonSize < minButtonSize) { + this.size -= minButtonSize - buttonSize; + buttonSize = minButtonSize; + } + this.inner.style[this.orientation == "horizontal" ? "width" : "height"] = + buttonSize + "px"; + this.inner.style[this.orientation == "horizontal" ? "left" : "top"] = + this.pos * (this.size / this.total) + "px"; + }; + + function SimpleScrollbars(cls, place, scroll) { + this.addClass = cls; + this.horiz = new Bar(cls, "horizontal", scroll); + place(this.horiz.node); + this.vert = new Bar(cls, "vertical", scroll); + place(this.vert.node); + this.width = null; + } + + SimpleScrollbars.prototype.update = function(measure) { + if (this.width == null) { + var style = window.getComputedStyle ? window.getComputedStyle(this.horiz.node) : this.horiz.node.currentStyle; + if (style) this.width = parseInt(style.height); + } + var width = this.width || 0; + + var needsH = measure.scrollWidth > measure.clientWidth + 1; + var needsV = measure.scrollHeight > measure.clientHeight + 1; + this.vert.node.style.display = needsV ? "block" : "none"; + this.horiz.node.style.display = needsH ? "block" : "none"; + + if (needsV) { + this.vert.update(measure.scrollHeight, measure.clientHeight, + measure.viewHeight - (needsH ? width : 0)); + this.vert.node.style.display = "block"; + this.vert.node.style.bottom = needsH ? width + "px" : "0"; + } + if (needsH) { + this.horiz.update(measure.scrollWidth, measure.clientWidth, + measure.viewWidth - (needsV ? width : 0) - measure.barLeft); + this.horiz.node.style.right = needsV ? width + "px" : "0"; + this.horiz.node.style.left = measure.barLeft + "px"; + } + + return {right: needsV ? width : 0, bottom: needsH ? width : 0}; + }; + + SimpleScrollbars.prototype.setScrollTop = function(pos) { + this.vert.moveTo(pos, false); + }; + + SimpleScrollbars.prototype.setScrollLeft = function(pos) { + this.horiz.moveTo(pos, false); + }; + + SimpleScrollbars.prototype.clear = function() { + var parent = this.horiz.node.parentNode; + parent.removeChild(this.horiz.node); + parent.removeChild(this.vert.node); + }; + + CodeMirror.scrollbarModel.simple = function(place, scroll) { + return new SimpleScrollbars("CodeMirror-simplescroll", place, scroll); + }; + CodeMirror.scrollbarModel.overlay = function(place, scroll) { + return new SimpleScrollbars("CodeMirror-overlayscroll", place, scroll); + }; +}); + +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +// Because sometimes you need to style the cursor's line. +// +// Adds an option 'styleActiveLine' which, when enabled, gives the +// active line's wrapping
    the CSS class "CodeMirror-activeline", +// and gives its background
    the class "CodeMirror-activeline-background". + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + var WRAP_CLASS = "CodeMirror-activeline"; + var BACK_CLASS = "CodeMirror-activeline-background"; + + CodeMirror.defineOption("styleActiveLine", false, function(cm, val, old) { + var prev = old && old != CodeMirror.Init; + if (val && !prev) { + cm.state.activeLines = []; + updateActiveLines(cm, cm.listSelections()); + cm.on("beforeSelectionChange", selectionChange); + } else if (!val && prev) { + cm.off("beforeSelectionChange", selectionChange); + clearActiveLines(cm); + delete cm.state.activeLines; + } + }); + + function clearActiveLines(cm) { + for (var i = 0; i < cm.state.activeLines.length; i++) { + cm.removeLineClass(cm.state.activeLines[i], "wrap", WRAP_CLASS); + cm.removeLineClass(cm.state.activeLines[i], "background", BACK_CLASS); + } + } + + function sameArray(a, b) { + if (a.length != b.length) return false; + for (var i = 0; i < a.length; i++) + if (a[i] != b[i]) return false; + return true; + } + + function updateActiveLines(cm, ranges) { + var active = []; + for (var i = 0; i < ranges.length; i++) { + var range = ranges[i]; + if (!range.empty()) continue; + var line = cm.getLineHandleVisualStart(range.head.line); + if (active[active.length - 1] != line) active.push(line); + } + if (sameArray(cm.state.activeLines, active)) return; + cm.operation(function() { + clearActiveLines(cm); + for (var i = 0; i < active.length; i++) { + cm.addLineClass(active[i], "wrap", WRAP_CLASS); + cm.addLineClass(active[i], "background", BACK_CLASS); + } + cm.state.activeLines = active; + }); + } + + function selectionChange(cm, sel) { + updateActiveLines(cm, sel.ranges); + } +}); + +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +/** + * Supported keybindings: + * Too many to list. Refer to defaultKeyMap below. + * + * Supported Ex commands: + * Refer to defaultExCommandMap below. + * + * Registers: unnamed, -, a-z, A-Z, 0-9 + * (Does not respect the special case for number registers when delete + * operator is made with these commands: %, (, ), , /, ?, n, N, {, } ) + * TODO: Implement the remaining registers. + * + * Marks: a-z, A-Z, and 0-9 + * TODO: Implement the remaining special marks. They have more complex + * behavior. + * + * Events: + * 'vim-mode-change' - raised on the editor anytime the current mode changes, + * Event object: {mode: "visual", subMode: "linewise"} + * + * Code structure: + * 1. Default keymap + * 2. Variable declarations and short basic helpers + * 3. Instance (External API) implementation + * 4. Internal state tracking objects (input state, counter) implementation + * and instanstiation + * 5. Key handler (the main command dispatcher) implementation + * 6. Motion, operator, and action implementations + * 7. Helper functions for the key handler, motions, operators, and actions + * 8. Set up Vim to work as a keymap for CodeMirror. + * 9. Ex command implementations. + */ + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../lib/codemirror"), require("../addon/search/searchcursor"), require("../addon/dialog/dialog"), require("../addon/edit/matchbrackets.js")); + else if (typeof define == "function" && define.amd) // AMD + define(["../lib/codemirror", "../addon/search/searchcursor", "../addon/dialog/dialog", "../addon/edit/matchbrackets"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + 'use strict'; + + var defaultKeymap = [ + // Key to key mapping. This goes first to make it possible to override + // existing mappings. + { keys: '', 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: 'xi', context: 'visual'}, + { keys: 'S', type: 'keyToKey', toKeys: 'cc', context: 'normal' }, + { keys: 'S', type: 'keyToKey', toKeys: 'dcc', 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' }, + // Motions + { keys: 'H', type: 'motion', motion: 'moveToTopLine', motionArgs: { linewise: true, toJumplist: true }}, + { keys: 'M', type: 'motion', motion: 'moveToMiddleLine', motionArgs: { linewise: true, toJumplist: true }}, + { keys: 'L', type: 'motion', motion: 'moveToBottomLine', motionArgs: { linewise: true, toJumplist: true }}, + { keys: 'h', type: 'motion', motion: 'moveByCharacters', motionArgs: { forward: false }}, + { keys: 'l', type: 'motion', motion: 'moveByCharacters', motionArgs: { forward: true }}, + { keys: 'j', type: 'motion', motion: 'moveByLines', motionArgs: { forward: true, linewise: true }}, + { keys: 'k', type: 'motion', motion: 'moveByLines', motionArgs: { forward: false, linewise: true }}, + { keys: 'gj', type: 'motion', motion: 'moveByDisplayLines', motionArgs: { forward: true }}, + { keys: 'gk', type: 'motion', motion: 'moveByDisplayLines', motionArgs: { forward: false }}, + { keys: 'w', type: 'motion', motion: 'moveByWords', motionArgs: { forward: true, wordEnd: false }}, + { keys: 'W', type: 'motion', motion: 'moveByWords', motionArgs: { forward: true, wordEnd: false, bigWord: true }}, + { keys: 'e', type: 'motion', motion: 'moveByWords', motionArgs: { forward: true, wordEnd: true, inclusive: true }}, + { keys: 'E', type: 'motion', motion: 'moveByWords', motionArgs: { forward: true, wordEnd: true, bigWord: true, inclusive: true }}, + { keys: 'b', type: 'motion', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: false }}, + { keys: 'B', type: 'motion', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: false, bigWord: true }}, + { keys: 'ge', type: 'motion', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: true, inclusive: true }}, + { keys: 'gE', type: 'motion', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: true, bigWord: true, inclusive: true }}, + { keys: '{', type: 'motion', motion: 'moveByParagraph', motionArgs: { forward: false, toJumplist: true }}, + { keys: '}', type: 'motion', motion: 'moveByParagraph', motionArgs: { forward: true, toJumplist: true }}, + { keys: '', type: 'motion', motion: 'moveByPage', motionArgs: { forward: true }}, + { keys: '', type: 'motion', motion: 'moveByPage', motionArgs: { forward: false }}, + { keys: '', type: 'motion', motion: 'moveByScroll', motionArgs: { forward: true, explicitRepeat: true }}, + { keys: '', type: 'motion', motion: 'moveByScroll', motionArgs: { forward: false, explicitRepeat: true }}, + { keys: 'gg', type: 'motion', motion: 'moveToLineOrEdgeOfDocument', motionArgs: { forward: false, explicitRepeat: true, linewise: true, toJumplist: true }}, + { keys: 'G', type: 'motion', motion: 'moveToLineOrEdgeOfDocument', motionArgs: { forward: true, explicitRepeat: true, linewise: true, toJumplist: true }}, + { keys: '0', type: 'motion', motion: 'moveToStartOfLine' }, + { keys: '^', type: 'motion', motion: 'moveToFirstNonWhiteSpaceCharacter' }, + { keys: '+', type: 'motion', motion: 'moveByLines', motionArgs: { forward: true, toFirstChar:true }}, + { keys: '-', type: 'motion', motion: 'moveByLines', motionArgs: { forward: false, toFirstChar:true }}, + { keys: '_', type: 'motion', motion: 'moveByLines', motionArgs: { forward: true, toFirstChar:true, repeatOffset:-1 }}, + { keys: '$', type: 'motion', motion: 'moveToEol', motionArgs: { inclusive: true }}, + { keys: '%', type: 'motion', motion: 'moveToMatchedSymbol', motionArgs: { inclusive: true, toJumplist: true }}, + { keys: 'f', type: 'motion', motion: 'moveToCharacter', motionArgs: { forward: true , inclusive: true }}, + { keys: 'F', type: 'motion', motion: 'moveToCharacter', motionArgs: { forward: false }}, + { keys: 't', type: 'motion', motion: 'moveTillCharacter', motionArgs: { forward: true, inclusive: true }}, + { keys: 'T', type: 'motion', motion: 'moveTillCharacter', motionArgs: { forward: false }}, + { keys: ';', type: 'motion', motion: 'repeatLastCharacterSearch', motionArgs: { forward: true }}, + { keys: ',', type: 'motion', motion: 'repeatLastCharacterSearch', motionArgs: { forward: false }}, + { keys: '\'', type: 'motion', motion: 'goToMark', motionArgs: {toJumplist: true, linewise: true}}, + { keys: '`', type: 'motion', motion: 'goToMark', motionArgs: {toJumplist: true}}, + { keys: ']`', type: 'motion', motion: 'jumpToMark', motionArgs: { forward: true } }, + { keys: '[`', type: 'motion', motion: 'jumpToMark', motionArgs: { forward: false } }, + { keys: ']\'', type: 'motion', motion: 'jumpToMark', motionArgs: { forward: true, linewise: true } }, + { keys: '[\'', type: 'motion', motion: 'jumpToMark', motionArgs: { forward: false, linewise: true } }, + // the next two aren't motions but must come before more general motion declarations + { keys: ']p', type: 'action', action: 'paste', isEdit: true, actionArgs: { after: true, isEdit: true, matchIndent: true}}, + { keys: '[p', type: 'action', action: 'paste', isEdit: true, actionArgs: { after: false, isEdit: true, matchIndent: true}}, + { keys: ']', type: 'motion', motion: 'moveToSymbol', motionArgs: { forward: true, toJumplist: true}}, + { keys: '[', type: 'motion', motion: 'moveToSymbol', motionArgs: { forward: false, toJumplist: true}}, + { keys: '|', type: 'motion', motion: 'moveToColumn'}, + { keys: 'o', type: 'motion', motion: 'moveToOtherHighlightedEnd', context:'visual'}, + { keys: 'O', type: 'motion', motion: 'moveToOtherHighlightedEnd', motionArgs: {sameLine: true}, context:'visual'}, + // Operators + { 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: true }}, + { keys: '<', type: 'operator', operator: 'indent', operatorArgs: { indentRight: false }}, + { keys: 'g~', type: 'operator', operator: 'changeCase' }, + { keys: 'gu', type: 'operator', operator: 'changeCase', operatorArgs: {toLower: true}, isEdit: true }, + { keys: 'gU', type: 'operator', operator: 'changeCase', operatorArgs: {toLower: false}, isEdit: true }, + { keys: 'n', type: 'motion', motion: 'findNext', motionArgs: { forward: true, toJumplist: true }}, + { keys: 'N', type: 'motion', motion: 'findNext', motionArgs: { forward: false, toJumplist: true }}, + // Operator-Motion dual commands + { keys: 'x', type: 'operatorMotion', operator: 'delete', motion: 'moveByCharacters', motionArgs: { forward: true }, operatorMotionArgs: { visualLine: false }}, + { keys: 'X', type: 'operatorMotion', operator: 'delete', motion: 'moveByCharacters', motionArgs: { forward: false }, operatorMotionArgs: { visualLine: true }}, + { keys: 'D', type: 'operatorMotion', operator: 'delete', motion: 'moveToEol', motionArgs: { inclusive: true }, context: 'normal'}, + { keys: 'D', type: 'operator', operator: 'delete', operatorArgs: { linewise: true }, context: 'visual'}, + { keys: 'Y', type: 'operatorMotion', operator: 'yank', motion: 'moveToEol', motionArgs: { inclusive: true }, context: 'normal'}, + { keys: 'Y', type: 'operator', operator: 'yank', operatorArgs: { linewise: true }, context: 'visual'}, + { keys: 'C', type: 'operatorMotion', operator: 'change', motion: 'moveToEol', motionArgs: { inclusive: true }, context: 'normal'}, + { keys: 'C', type: 'operator', operator: 'change', operatorArgs: { linewise: true }, context: 'visual'}, + { keys: '~', type: 'operatorMotion', operator: 'changeCase', motion: 'moveByCharacters', motionArgs: { forward: true }, operatorArgs: { shouldMoveCursor: true }, context: 'normal'}, + { keys: '~', type: 'operator', operator: 'changeCase', context: 'visual'}, + { keys: '', type: 'operatorMotion', operator: 'delete', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: false }, context: 'insert' }, + // Actions + { keys: '', type: 'action', action: 'jumpListWalk', actionArgs: { forward: true }}, + { keys: '', type: 'action', action: 'jumpListWalk', actionArgs: { forward: false }}, + { keys: '', type: 'action', action: 'scroll', actionArgs: { forward: true, linewise: true }}, + { keys: '', type: 'action', action: 'scroll', actionArgs: { forward: false, linewise: true }}, + { keys: 'a', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'charAfter' }, context: 'normal' }, + { keys: 'A', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'eol' }, context: 'normal' }, + { keys: 'A', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'endOfSelectedArea' }, context: 'visual' }, + { keys: 'i', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'inplace' }, context: 'normal' }, + { keys: 'I', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'firstNonBlank'}, context: 'normal' }, + { keys: 'I', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'startOfSelectedArea' }, context: 'visual' }, + { keys: 'o', type: 'action', action: 'newLineAndEnterInsertMode', isEdit: true, interlaceInsertRepeat: true, actionArgs: { after: true }, context: 'normal' }, + { keys: 'O', type: 'action', action: 'newLineAndEnterInsertMode', isEdit: true, interlaceInsertRepeat: true, actionArgs: { after: false }, context: 'normal' }, + { keys: 'v', type: 'action', action: 'toggleVisualMode' }, + { keys: 'V', type: 'action', action: 'toggleVisualMode', actionArgs: { linewise: true }}, + { keys: '', type: 'action', action: 'toggleVisualMode', actionArgs: { blockwise: true }}, + { keys: 'gv', type: 'action', action: 'reselectLastSelection' }, + { keys: 'J', type: 'action', action: 'joinLines', isEdit: true }, + { keys: 'p', type: 'action', action: 'paste', isEdit: true, actionArgs: { after: true, isEdit: true }}, + { keys: 'P', type: 'action', action: 'paste', isEdit: true, actionArgs: { after: false, isEdit: true }}, + { keys: 'r', type: 'action', action: 'replace', isEdit: true }, + { keys: '@', type: 'action', action: 'replayMacro' }, + { keys: 'q', type: 'action', action: 'enterMacroRecordMode' }, + // Handle Replace-mode as a special case of insert mode. + { keys: 'R', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { replace: true }}, + { keys: 'u', type: 'action', action: 'undo', context: 'normal' }, + { keys: 'u', type: 'operator', operator: 'changeCase', operatorArgs: {toLower: true}, context: 'visual', isEdit: true }, + { keys: 'U', type: 'operator', operator: 'changeCase', operatorArgs: {toLower: false}, context: 'visual', isEdit: true }, + { 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: true, actionArgs: {increase: true, backtrack: false}}, + { keys: '', type: 'action', action: 'incrementNumberToken', isEdit: true, actionArgs: {increase: false, backtrack: false}}, + // Text object motions + { keys: 'a', type: 'motion', motion: 'textObjectManipulation' }, + { keys: 'i', type: 'motion', motion: 'textObjectManipulation', motionArgs: { textObjectInner: true }}, + // Search + { keys: '/', type: 'search', searchArgs: { forward: true, querySrc: 'prompt', toJumplist: true }}, + { keys: '?', type: 'search', searchArgs: { forward: false, querySrc: 'prompt', toJumplist: true }}, + { keys: '*', type: 'search', searchArgs: { forward: true, querySrc: 'wordUnderCursor', wholeWordOnly: true, toJumplist: true }}, + { keys: '#', type: 'search', searchArgs: { forward: false, querySrc: 'wordUnderCursor', wholeWordOnly: true, toJumplist: true }}, + { keys: 'g*', type: 'search', searchArgs: { forward: true, querySrc: 'wordUnderCursor', toJumplist: true }}, + { keys: 'g#', type: 'search', searchArgs: { forward: false, querySrc: 'wordUnderCursor', toJumplist: true }}, + // Ex command + { keys: ':', type: 'ex' } + ]; + + /** + * Ex commands + * Care must be taken when adding to the default Ex command map. For any + * pair of commands that have a shared prefix, at least one of their + * shortNames must not match the prefix of the other command. + */ + var defaultExCommandMap = [ + { 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: true }, + { name: 'nohlsearch', shortName: 'noh' }, + { name: 'delmarks', shortName: 'delm' }, + { name: 'registers', shortName: 'reg', excludeFromCommandHistory: true }, + { name: 'global', shortName: 'g' } + ]; + + var Pos = CodeMirror.Pos; + + var Vim = function() { + function enterVimMode(cm) { + cm.setOption('disableInput', true); + cm.setOption('showCursorWhenSelecting', false); + CodeMirror.signal(cm, "vim-mode-change", {mode: "normal"}); + cm.on('cursorActivity', onCursorActivity); + maybeInitVimState(cm); + CodeMirror.on(cm.getInputField(), 'paste', getOnPasteFn(cm)); + } + + function leaveVimMode(cm) { + cm.setOption('disableInput', false); + cm.off('cursorActivity', onCursorActivity); + CodeMirror.off(cm.getInputField(), 'paste', getOnPasteFn(cm)); + cm.state.vim = null; + } + + function detachVimMap(cm, next) { + if (this == CodeMirror.keyMap.vim) + CodeMirror.rmClass(cm.getWrapperElement(), "cm-fat-cursor"); + + if (!next || next.attach != attachVimMap) + leaveVimMode(cm, false); + } + function attachVimMap(cm, prev) { + if (this == CodeMirror.keyMap.vim) + CodeMirror.addClass(cm.getWrapperElement(), "cm-fat-cursor"); + + if (!prev || prev.attach != attachVimMap) + enterVimMode(cm); + } + + // Deprecated, simply setting the keymap works again. + CodeMirror.defineOption('vimMode', false, function(cm, val, prev) { + if (val && cm.getOption("keyMap") != "vim") + cm.setOption("keyMap", "vim"); + else if (!val && prev != CodeMirror.Init && /^vim/.test(cm.getOption("keyMap"))) + cm.setOption("keyMap", "default"); + }); + + function cmKey(key, cm) { + if (!cm) { return undefined; } + var vimKey = cmKeyToVimKey(key); + if (!vimKey) { + return false; + } + var cmd = CodeMirror.Vim.findKey(cm, vimKey); + if (typeof cmd == 'function') { + CodeMirror.signal(cm, 'vim-keypress', vimKey); + } + return cmd; + } + + var modifiers = {'Shift': 'S', 'Ctrl': 'C', 'Alt': 'A', 'Cmd': 'D', 'Mod': 'A'}; + var specialKeys = {Enter:'CR',Backspace:'BS',Delete:'Del'}; + function cmKeyToVimKey(key) { + if (key.charAt(0) == '\'') { + // Keypress character binding of format "'a'" + return key.charAt(1); + } + var pieces = key.split('-'); + if (/-$/.test(key)) { + // If the - key was typed, split will result in 2 extra empty strings + // in the array. Replace them with 1 '-'. + pieces.splice(-2, 2, '-'); + } + var lastPiece = pieces[pieces.length - 1]; + if (pieces.length == 1 && pieces[0].length == 1) { + // No-modifier bindings use literal character bindings above. Skip. + return false; + } else if (pieces.length == 2 && pieces[0] == 'Shift' && lastPiece.length == 1) { + // Ignore Shift+char bindings as they should be handled by literal character. + return false; + } + var hasCharacter = false; + for (var i = 0; i < pieces.length; i++) { + var piece = pieces[i]; + if (piece in modifiers) { pieces[i] = modifiers[piece]; } + else { hasCharacter = true; } + if (piece in specialKeys) { pieces[i] = specialKeys[piece]; } + } + if (!hasCharacter) { + // Vim does not support modifier only keys. + return false; + } + // TODO: Current bindings expect the character to be lower case, but + // it looks like vim key notation uses upper case. + if (isUpperCase(lastPiece)) { + pieces[pieces.length - 1] = lastPiece.toLowerCase(); + } + return '<' + pieces.join('-') + '>'; + } + + function getOnPasteFn(cm) { + var vim = cm.state.vim; + if (!vim.onPasteFn) { + vim.onPasteFn = function() { + if (!vim.insertMode) { + cm.setCursor(offsetCursor(cm.getCursor(), 0, 1)); + actions.enterInsertMode(cm, {}, vim); + } + }; + } + return vim.onPasteFn; + } + + var numberRegex = /[\d]/; + var wordCharTest = [CodeMirror.isWordChar, function(ch) { + return ch && !CodeMirror.isWordChar(ch) && !/\s/.test(ch); + }], bigWordCharTest = [function(ch) { + return /\S/.test(ch); + }]; + function makeKeyRange(start, size) { + var keys = []; + for (var i = start; i < start + size; i++) { + keys.push(String.fromCharCode(i)); + } + return keys; + } + var upperCaseAlphabet = makeKeyRange(65, 26); + var lowerCaseAlphabet = makeKeyRange(97, 26); + var numbers = makeKeyRange(48, 10); + var validMarks = [].concat(upperCaseAlphabet, lowerCaseAlphabet, numbers, ['<', '>']); + var validRegisters = [].concat(upperCaseAlphabet, lowerCaseAlphabet, numbers, ['-', '"', '.', ':', '/']); + + function isLine(cm, line) { + return line >= cm.firstLine() && line <= cm.lastLine(); + } + function isLowerCase(k) { + return (/^[a-z]$/).test(k); + } + function isMatchableSymbol(k) { + return '()[]{}'.indexOf(k) != -1; + } + function isNumber(k) { + return numberRegex.test(k); + } + function isUpperCase(k) { + return (/^[A-Z]$/).test(k); + } + function isWhiteSpaceString(k) { + return (/^\s*$/).test(k); + } + function inArray(val, arr) { + for (var i = 0; i < arr.length; i++) { + if (arr[i] == val) { + return true; + } + } + return false; + } + + var options = {}; + function defineOption(name, defaultValue, type, aliases, callback) { + if (defaultValue === undefined && !callback) { + throw Error('defaultValue is required unless callback is provided'); + } + if (!type) { type = 'string'; } + options[name] = { + type: type, + defaultValue: defaultValue, + callback: callback + }; + if (aliases) { + for (var i = 0; i < aliases.length; i++) { + options[aliases[i]] = options[name]; + } + } + if (defaultValue) { + setOption(name, defaultValue); + } + } + + function setOption(name, value, cm, cfg) { + var option = options[name]; + cfg = cfg || {}; + var scope = cfg.scope; + if (!option) { + throw Error('Unknown option: ' + name); + } + if (option.type == 'boolean') { + if (value && value !== true) { + throw Error('Invalid argument: ' + name + '=' + value); + } else if (value !== false) { + // Boolean options are set to true if value is not defined. + value = true; + } + } + if (option.callback) { + if (scope !== 'local') { + option.callback(value, undefined); + } + if (scope !== 'global' && cm) { + option.callback(value, cm); + } + } else { + if (scope !== 'local') { + option.value = option.type == 'boolean' ? !!value : value; + } + if (scope !== 'global' && cm) { + cm.state.vim.options[name] = {value: value}; + } + } + } + + function getOption(name, cm, cfg) { + var option = options[name]; + cfg = cfg || {}; + var scope = cfg.scope; + if (!option) { + throw Error('Unknown option: ' + name); + } + if (option.callback) { + var local = cm && option.callback(undefined, cm); + if (scope !== 'global' && local !== undefined) { + return local; + } + if (scope !== 'local') { + return option.callback(); + } + return; + } else { + var local = (scope !== 'global') && (cm && cm.state.vim.options[name]); + return (local || (scope !== 'local') && option || {}).value; + } + } + + defineOption('filetype', undefined, 'string', ['ft'], function(name, cm) { + // Option is local. Do nothing for global. + if (cm === undefined) { + return; + } + // The 'filetype' option proxies to the CodeMirror 'mode' option. + if (name === undefined) { + var mode = cm.getOption('mode'); + return mode == 'null' ? '' : mode; + } else { + var mode = name == '' ? 'null' : name; + cm.setOption('mode', mode); + } + }); + + var createCircularJumpList = function() { + var size = 100; + var pointer = -1; + var head = 0; + var tail = 0; + var buffer = new Array(size); + function add(cm, oldCur, newCur) { + var current = pointer % size; + var curMark = buffer[current]; + function useNextSlot(cursor) { + var next = ++pointer % size; + var trashMark = buffer[next]; + if (trashMark) { + trashMark.clear(); + } + buffer[next] = cm.setBookmark(cursor); + } + if (curMark) { + var markPos = curMark.find(); + // avoid recording redundant cursor position + if (markPos && !cursorEqual(markPos, oldCur)) { + useNextSlot(oldCur); + } + } else { + useNextSlot(oldCur); + } + useNextSlot(newCur); + head = pointer; + tail = pointer - size + 1; + if (tail < 0) { + tail = 0; + } + } + function move(cm, offset) { + pointer += offset; + if (pointer > head) { + pointer = head; + } else if (pointer < tail) { + pointer = tail; + } + var mark = buffer[(size + pointer) % size]; + // skip marks that are temporarily removed from text buffer + if (mark && !mark.find()) { + var inc = offset > 0 ? 1 : -1; + var newCur; + var oldCur = cm.getCursor(); + do { + pointer += inc; + mark = buffer[(size + pointer) % size]; + // skip marks that are the same as current position + if (mark && + (newCur = mark.find()) && + !cursorEqual(oldCur, newCur)) { + break; + } + } while (pointer < head && pointer > tail); + } + return mark; + } + return { + cachedCursor: undefined, //used for # and * jumps + add: add, + move: move + }; + }; + + // Returns an object to track the changes associated insert mode. It + // clones the object that is passed in, or creates an empty object one if + // none is provided. + var createInsertModeChanges = function(c) { + if (c) { + // Copy construction + return { + changes: c.changes, + expectCursorActivityForChange: c.expectCursorActivityForChange + }; + } + return { + // Change list + changes: [], + // Set to true on change, false on cursorActivity. + expectCursorActivityForChange: false + }; + }; + + function MacroModeState() { + this.latestRegister = undefined; + this.isPlaying = false; + this.isRecording = false; + this.replaySearchQueries = []; + this.onRecordingDone = undefined; + this.lastInsertModeChanges = createInsertModeChanges(); + } + MacroModeState.prototype = { + exitMacroRecordMode: function() { + var macroModeState = vimGlobalState.macroModeState; + if (macroModeState.onRecordingDone) { + macroModeState.onRecordingDone(); // close dialog + } + macroModeState.onRecordingDone = undefined; + macroModeState.isRecording = false; + }, + enterMacroRecordMode: function(cm, registerName) { + var register = + vimGlobalState.registerController.getRegister(registerName); + if (register) { + register.clear(); + this.latestRegister = registerName; + if (cm.openDialog) { + this.onRecordingDone = cm.openDialog( + '(recording)['+registerName+']', null, {bottom:true}); + } + this.isRecording = true; + } + } + }; + + function maybeInitVimState(cm) { + if (!cm.state.vim) { + // Store instance state in the CodeMirror object. + cm.state.vim = { + inputState: new InputState(), + // Vim's input state that triggered the last edit, used to repeat + // motions and operators with '.'. + lastEditInputState: undefined, + // Vim's action command before the last edit, used to repeat actions + // with '.' and insert mode repeat. + lastEditActionCommand: undefined, + // When using jk for navigation, if you move from a longer line to a + // shorter line, the cursor may clip to the end of the shorter line. + // If j is pressed again and cursor goes to the next line, the + // cursor should go back to its horizontal position on the longer + // line if it can. This is to keep track of the horizontal position. + lastHPos: -1, + // Doing the same with screen-position for gj/gk + lastHSPos: -1, + // The last motion command run. Cleared if a non-motion command gets + // executed in between. + lastMotion: null, + marks: {}, + // Mark for rendering fake cursor for visual mode. + fakeCursor: null, + insertMode: false, + // Repeat count for changes made in insert mode, triggered by key + // sequences like 3,i. Only exists when insertMode is true. + insertModeRepeat: undefined, + visualMode: false, + // If we are in visual line mode. No effect if visualMode is false. + visualLine: false, + visualBlock: false, + lastSelection: null, + lastPastedText: null, + sel: {}, + // Buffer-local/window-local values of vim options. + options: {} + }; + } + return cm.state.vim; + } + var vimGlobalState; + function resetVimGlobalState() { + vimGlobalState = { + // The current search query. + searchQuery: null, + // Whether we are searching backwards. + searchIsReversed: false, + // Replace part of the last substituted pattern + lastSubstituteReplacePart: undefined, + jumpList: createCircularJumpList(), + macroModeState: new MacroModeState, + // Recording latest f, t, F or T motion command. + lastChararacterSearch: {increment:0, forward:true, selectedCharacter:''}, + registerController: new RegisterController({}), + // search history buffer + searchHistoryController: new HistoryController({}), + // ex Command history buffer + exCommandHistoryController : new HistoryController({}) + }; + for (var optionName in options) { + var option = options[optionName]; + option.value = option.defaultValue; + } + } + + var lastInsertModeKeyTimer; + var vimApi= { + buildKeyMap: function() { + // TODO: Convert keymap into dictionary format for fast lookup. + }, + // Testing hook, though it might be useful to expose the register + // controller anyways. + getRegisterController: function() { + return vimGlobalState.registerController; + }, + // Testing hook. + resetVimGlobalState_: resetVimGlobalState, + + // Testing hook. + getVimGlobalState_: function() { + return vimGlobalState; + }, + + // Testing hook. + maybeInitVimState_: maybeInitVimState, + + suppressErrorLogging: false, + + InsertModeKey: InsertModeKey, + map: function(lhs, rhs, ctx) { + // Add user defined key bindings. + exCommandDispatcher.map(lhs, rhs, ctx); + }, + // TODO: Expose setOption and getOption as instance methods. Need to decide how to namespace + // them, or somehow make them work with the existing CodeMirror setOption/getOption API. + setOption: setOption, + getOption: getOption, + defineOption: defineOption, + defineEx: function(name, prefix, func){ + if (!prefix) { + prefix = name; + } else if (name.indexOf(prefix) !== 0) { + throw new Error('(Vim.defineEx) "'+prefix+'" is not a prefix of "'+name+'", command not registered'); + } + exCommands[name]=func; + exCommandDispatcher.commandMap_[prefix]={name:name, shortName:prefix, type:'api'}; + }, + handleKey: function (cm, key, origin) { + var command = this.findKey(cm, key, origin); + if (typeof command === 'function') { + return command(); + } + }, + /** + * This is the outermost function called by CodeMirror, after keys have + * been mapped to their Vim equivalents. + * + * Finds a command based on the key (and cached keys if there is a + * multi-key sequence). Returns `undefined` if no key is matched, a noop + * function if a partial match is found (multi-key), and a function to + * execute the bound command if a a key is matched. The function always + * returns true. + */ + findKey: function(cm, key, origin) { + var vim = maybeInitVimState(cm); + function handleMacroRecording() { + var macroModeState = vimGlobalState.macroModeState; + if (macroModeState.isRecording) { + if (key == 'q') { + macroModeState.exitMacroRecordMode(); + clearInputState(cm); + return true; + } + if (origin != 'mapping') { + logKey(macroModeState, key); + } + } + } + function handleEsc() { + if (key == '') { + // Clear input state and get back to normal mode. + clearInputState(cm); + if (vim.visualMode) { + exitVisualMode(cm); + } else if (vim.insertMode) { + exitInsertMode(cm); + } + return true; + } + } + function doKeyToKey(keys) { + // TODO: prevent infinite recursion. + var match; + while (keys) { + // Pull off one command key, which is either a single character + // or a special sequence wrapped in '<' and '>', e.g. ''. + match = (/<\w+-.+?>|<\w+>|./).exec(keys); + key = match[0]; + keys = keys.substring(match.index + key.length); + CodeMirror.Vim.handleKey(cm, key, 'mapping'); + } + } + + function handleKeyInsertMode() { + if (handleEsc()) { return true; } + var keys = vim.inputState.keyBuffer = vim.inputState.keyBuffer + key; + var keysAreChars = key.length == 1; + var match = commandDispatcher.matchCommand(keys, defaultKeymap, vim.inputState, 'insert'); + // Need to check all key substrings in insert mode. + while (keys.length > 1 && match.type != 'full') { + var keys = vim.inputState.keyBuffer = keys.slice(1); + var thisMatch = commandDispatcher.matchCommand(keys, defaultKeymap, vim.inputState, 'insert'); + if (thisMatch.type != 'none') { match = thisMatch; } + } + if (match.type == 'none') { clearInputState(cm); return false; } + else if (match.type == 'partial') { + if (lastInsertModeKeyTimer) { window.clearTimeout(lastInsertModeKeyTimer); } + lastInsertModeKeyTimer = window.setTimeout( + function() { if (vim.insertMode && vim.inputState.keyBuffer) { clearInputState(cm); } }, + getOption('insertModeEscKeysTimeout')); + return !keysAreChars; + } + + if (lastInsertModeKeyTimer) { window.clearTimeout(lastInsertModeKeyTimer); } + if (keysAreChars) { + var here = cm.getCursor(); + cm.replaceRange('', offsetCursor(here, 0, -(keys.length - 1)), here, '+input'); + } + clearInputState(cm); + return match.command; + } + + function handleKeyNonInsertMode() { + if (handleMacroRecording() || handleEsc()) { return true; }; + + var keys = vim.inputState.keyBuffer = vim.inputState.keyBuffer + key; + if (/^[1-9]\d*$/.test(keys)) { return true; } + + var keysMatcher = /^(\d*)(.*)$/.exec(keys); + if (!keysMatcher) { clearInputState(cm); return false; } + var context = vim.visualMode ? 'visual' : + 'normal'; + var match = commandDispatcher.matchCommand(keysMatcher[2] || keysMatcher[1], defaultKeymap, vim.inputState, context); + if (match.type == 'none') { clearInputState(cm); return false; } + else if (match.type == 'partial') { return true; } + + vim.inputState.keyBuffer = ''; + var keysMatcher = /^(\d*)(.*)$/.exec(keys); + if (keysMatcher[1] && keysMatcher[1] != '0') { + vim.inputState.pushRepeatDigit(keysMatcher[1]); + } + return match.command; + } + + var command; + if (vim.insertMode) { command = handleKeyInsertMode(); } + else { command = handleKeyNonInsertMode(); } + if (command === false) { + return undefined; + } else if (command === true) { + // TODO: Look into using CodeMirror's multi-key handling. + // Return no-op since we are caching the key. Counts as handled, but + // don't want act on it just yet. + return function() {}; + } else { + return function() { + return cm.operation(function() { + cm.curOp.isVimOp = true; + try { + if (command.type == 'keyToKey') { + doKeyToKey(command.toKeys); + } else { + commandDispatcher.processCommand(cm, vim, command); + } + } catch (e) { + // clear VIM state in case it's in a bad state. + cm.state.vim = undefined; + maybeInitVimState(cm); + if (!CodeMirror.Vim.suppressErrorLogging) { + console['log'](e); + } + throw e; + } + return true; + }); + }; + } + }, + handleEx: function(cm, input) { + exCommandDispatcher.processCommand(cm, input); + }, + + defineMotion: defineMotion, + defineAction: defineAction, + defineOperator: defineOperator, + mapCommand: mapCommand, + _mapCommand: _mapCommand, + + exitVisualMode: exitVisualMode, + exitInsertMode: exitInsertMode + }; + + // Represents the current input state. + function InputState() { + this.prefixRepeat = []; + this.motionRepeat = []; + + this.operator = null; + this.operatorArgs = null; + this.motion = null; + this.motionArgs = null; + this.keyBuffer = []; // For matching multi-key commands. + this.registerName = null; // Defaults to the unnamed register. + } + InputState.prototype.pushRepeatDigit = function(n) { + if (!this.operator) { + this.prefixRepeat = this.prefixRepeat.concat(n); + } else { + this.motionRepeat = this.motionRepeat.concat(n); + } + }; + InputState.prototype.getRepeat = function() { + var repeat = 0; + if (this.prefixRepeat.length > 0 || this.motionRepeat.length > 0) { + repeat = 1; + if (this.prefixRepeat.length > 0) { + repeat *= parseInt(this.prefixRepeat.join(''), 10); + } + if (this.motionRepeat.length > 0) { + repeat *= parseInt(this.motionRepeat.join(''), 10); + } + } + return repeat; + }; + + function clearInputState(cm, reason) { + cm.state.vim.inputState = new InputState(); + CodeMirror.signal(cm, 'vim-command-done', reason); + } + + /* + * Register stores information about copy and paste registers. Besides + * text, a register must store whether it is linewise (i.e., when it is + * pasted, should it insert itself into a new line, or should the text be + * inserted at the cursor position.) + */ + function Register(text, linewise, blockwise) { + this.clear(); + this.keyBuffer = [text || '']; + this.insertModeChanges = []; + this.searchQueries = []; + this.linewise = !!linewise; + this.blockwise = !!blockwise; + } + Register.prototype = { + setText: function(text, linewise, blockwise) { + this.keyBuffer = [text || '']; + this.linewise = !!linewise; + this.blockwise = !!blockwise; + }, + pushText: function(text, linewise) { + // if this register has ever been set to linewise, use linewise. + if (linewise) { + if (!this.linewise) { + this.keyBuffer.push('\n'); + } + this.linewise = true; + } + this.keyBuffer.push(text); + }, + pushInsertModeChanges: function(changes) { + this.insertModeChanges.push(createInsertModeChanges(changes)); + }, + pushSearchQuery: function(query) { + this.searchQueries.push(query); + }, + clear: function() { + this.keyBuffer = []; + this.insertModeChanges = []; + this.searchQueries = []; + this.linewise = false; + }, + toString: function() { + return this.keyBuffer.join(''); + } + }; + + /* + * vim registers allow you to keep many independent copy and paste buffers. + * See http://usevim.com/2012/04/13/registers/ for an introduction. + * + * RegisterController keeps the state of all the registers. An initial + * state may be passed in. The unnamed register '"' will always be + * overridden. + */ + function RegisterController(registers) { + this.registers = registers; + this.unnamedRegister = registers['"'] = new Register(); + registers['.'] = new Register(); + registers[':'] = new Register(); + registers['/'] = new Register(); + } + RegisterController.prototype = { + pushText: function(registerName, operator, text, linewise, blockwise) { + if (linewise && text.charAt(0) == '\n') { + text = text.slice(1) + '\n'; + } + if (linewise && text.charAt(text.length - 1) !== '\n'){ + text += '\n'; + } + // Lowercase and uppercase registers refer to the same register. + // Uppercase just means append. + var register = this.isValidRegister(registerName) ? + this.getRegister(registerName) : null; + // if no register/an invalid register was specified, things go to the + // default registers + if (!register) { + switch (operator) { + case 'yank': + // The 0 register contains the text from the most recent yank. + this.registers['0'] = new Register(text, linewise, blockwise); + break; + case 'delete': + case 'change': + if (text.indexOf('\n') == -1) { + // Delete less than 1 line. Update the small delete register. + this.registers['-'] = new Register(text, linewise); + } else { + // Shift down the contents of the numbered registers and put the + // deleted text into register 1. + this.shiftNumericRegisters_(); + this.registers['1'] = new Register(text, linewise); + } + break; + } + // Make sure the unnamed register is set to what just happened + this.unnamedRegister.setText(text, linewise, blockwise); + return; + } + + // If we've gotten to this point, we've actually specified a register + var append = isUpperCase(registerName); + if (append) { + register.pushText(text, linewise); + } else { + register.setText(text, linewise, blockwise); + } + // The unnamed register always has the same value as the last used + // register. + this.unnamedRegister.setText(register.toString(), linewise); + }, + // Gets the register named @name. If one of @name doesn't already exist, + // create it. If @name is invalid, return the unnamedRegister. + getRegister: function(name) { + if (!this.isValidRegister(name)) { + return this.unnamedRegister; + } + name = name.toLowerCase(); + if (!this.registers[name]) { + this.registers[name] = new Register(); + } + return this.registers[name]; + }, + isValidRegister: function(name) { + return name && inArray(name, validRegisters); + }, + shiftNumericRegisters_: function() { + for (var i = 9; i >= 2; i--) { + this.registers[i] = this.getRegister('' + (i - 1)); + } + } + }; + function HistoryController() { + this.historyBuffer = []; + this.iterator; + this.initialPrefix = null; + } + HistoryController.prototype = { + // the input argument here acts a user entered prefix for a small time + // until we start autocompletion in which case it is the autocompleted. + nextMatch: function (input, up) { + var historyBuffer = this.historyBuffer; + var dir = up ? -1 : 1; + if (this.initialPrefix === null) this.initialPrefix = input; + for (var i = this.iterator + dir; up ? i >= 0 : i < historyBuffer.length; i+= dir) { + var element = historyBuffer[i]; + for (var j = 0; j <= element.length; j++) { + if (this.initialPrefix == element.substring(0, j)) { + this.iterator = i; + return element; + } + } + } + // should return the user input in case we reach the end of buffer. + if (i >= historyBuffer.length) { + this.iterator = historyBuffer.length; + return this.initialPrefix; + } + // return the last autocompleted query or exCommand as it is. + if (i < 0 ) return input; + }, + pushInput: function(input) { + var index = this.historyBuffer.indexOf(input); + if (index > -1) this.historyBuffer.splice(index, 1); + if (input.length) this.historyBuffer.push(input); + }, + reset: function() { + this.initialPrefix = null; + this.iterator = this.historyBuffer.length; + } + }; + var commandDispatcher = { + matchCommand: function(keys, keyMap, inputState, context) { + var matches = commandMatches(keys, keyMap, context, inputState); + if (!matches.full && !matches.partial) { + return {type: 'none'}; + } else if (!matches.full && matches.partial) { + return {type: 'partial'}; + } + + var bestMatch; + for (var i = 0; i < matches.full.length; i++) { + var match = matches.full[i]; + if (!bestMatch) { + bestMatch = match; + } + } + if (bestMatch.keys.slice(-11) == '') { + inputState.selectedCharacter = lastChar(keys); + } + return {type: 'full', command: bestMatch}; + }, + processCommand: function(cm, vim, command) { + vim.inputState.repeatOverride = command.repeatOverride; + switch (command.type) { + case 'motion': + this.processMotion(cm, vim, command); + break; + case 'operator': + this.processOperator(cm, vim, command); + break; + case 'operatorMotion': + this.processOperatorMotion(cm, vim, command); + break; + case 'action': + this.processAction(cm, vim, command); + break; + case 'search': + this.processSearch(cm, vim, command); + break; + case 'ex': + case 'keyToEx': + this.processEx(cm, vim, command); + break; + default: + break; + } + }, + processMotion: function(cm, vim, command) { + vim.inputState.motion = command.motion; + vim.inputState.motionArgs = copyArgs(command.motionArgs); + this.evalInput(cm, vim); + }, + processOperator: function(cm, vim, command) { + var inputState = vim.inputState; + if (inputState.operator) { + if (inputState.operator == command.operator) { + // Typing an operator twice like 'dd' makes the operator operate + // linewise + inputState.motion = 'expandToLine'; + inputState.motionArgs = { linewise: true }; + this.evalInput(cm, vim); + return; + } else { + // 2 different operators in a row doesn't make sense. + clearInputState(cm); + } + } + inputState.operator = command.operator; + inputState.operatorArgs = copyArgs(command.operatorArgs); + if (vim.visualMode) { + // Operating on a selection in visual mode. We don't need a motion. + this.evalInput(cm, vim); + } + }, + processOperatorMotion: function(cm, vim, command) { + var visualMode = vim.visualMode; + var operatorMotionArgs = copyArgs(command.operatorMotionArgs); + if (operatorMotionArgs) { + // Operator motions may have special behavior in visual mode. + if (visualMode && operatorMotionArgs.visualLine) { + vim.visualLine = true; + } + } + this.processOperator(cm, vim, command); + if (!visualMode) { + this.processMotion(cm, vim, command); + } + }, + processAction: function(cm, vim, command) { + var inputState = vim.inputState; + var repeat = inputState.getRepeat(); + var repeatIsExplicit = !!repeat; + var actionArgs = copyArgs(command.actionArgs) || {}; + if (inputState.selectedCharacter) { + actionArgs.selectedCharacter = inputState.selectedCharacter; + } + // Actions may or may not have motions and operators. Do these first. + if (command.operator) { + this.processOperator(cm, vim, command); + } + if (command.motion) { + this.processMotion(cm, vim, command); + } + if (command.motion || command.operator) { + this.evalInput(cm, vim); + } + actionArgs.repeat = repeat || 1; + actionArgs.repeatIsExplicit = repeatIsExplicit; + actionArgs.registerName = inputState.registerName; + clearInputState(cm); + vim.lastMotion = null; + if (command.isEdit) { + this.recordLastEdit(vim, inputState, command); + } + actions[command.action](cm, actionArgs, vim); + }, + processSearch: function(cm, vim, command) { + if (!cm.getSearchCursor) { + // Search depends on SearchCursor. + return; + } + var forward = command.searchArgs.forward; + var wholeWordOnly = command.searchArgs.wholeWordOnly; + getSearchState(cm).setReversed(!forward); + var promptPrefix = (forward) ? '/' : '?'; + var originalQuery = getSearchState(cm).getQuery(); + var originalScrollPos = cm.getScrollInfo(); + function handleQuery(query, ignoreCase, smartCase) { + vimGlobalState.searchHistoryController.pushInput(query); + vimGlobalState.searchHistoryController.reset(); + try { + updateSearchQuery(cm, query, ignoreCase, smartCase); + } catch (e) { + showConfirm(cm, 'Invalid regex: ' + query); + clearInputState(cm); + return; + } + commandDispatcher.processMotion(cm, vim, { + type: 'motion', + motion: 'findNext', + motionArgs: { forward: true, toJumplist: command.searchArgs.toJumplist } + }); + } + function onPromptClose(query) { + cm.scrollTo(originalScrollPos.left, originalScrollPos.top); + handleQuery(query, true /** ignoreCase */, true /** smartCase */); + var macroModeState = vimGlobalState.macroModeState; + if (macroModeState.isRecording) { + logSearchQuery(macroModeState, query); + } + } + function onPromptKeyUp(e, query, close) { + var keyName = CodeMirror.keyName(e), up; + if (keyName == 'Up' || keyName == 'Down') { + up = keyName == 'Up' ? true : false; + query = vimGlobalState.searchHistoryController.nextMatch(query, up) || ''; + close(query); + } else { + if ( keyName != 'Left' && keyName != 'Right' && keyName != 'Ctrl' && keyName != 'Alt' && keyName != 'Shift') + vimGlobalState.searchHistoryController.reset(); + } + var parsedQuery; + try { + parsedQuery = updateSearchQuery(cm, query, + true /** ignoreCase */, true /** smartCase */); + } catch (e) { + // Swallow bad regexes for incremental search. + } + if (parsedQuery) { + cm.scrollIntoView(findNext(cm, !forward, parsedQuery), 30); + } else { + clearSearchHighlight(cm); + cm.scrollTo(originalScrollPos.left, originalScrollPos.top); + } + } + function onPromptKeyDown(e, query, close) { + var keyName = CodeMirror.keyName(e); + if (keyName == 'Esc' || keyName == 'Ctrl-C' || keyName == 'Ctrl-[' || + (keyName == 'Backspace' && query == '')) { + vimGlobalState.searchHistoryController.pushInput(query); + vimGlobalState.searchHistoryController.reset(); + updateSearchQuery(cm, originalQuery); + clearSearchHighlight(cm); + cm.scrollTo(originalScrollPos.left, originalScrollPos.top); + CodeMirror.e_stop(e); + clearInputState(cm); + close(); + cm.focus(); + } else if (keyName == 'Ctrl-U') { + // Ctrl-U clears input. + CodeMirror.e_stop(e); + close(''); + } + } + switch (command.searchArgs.querySrc) { + case 'prompt': + var macroModeState = vimGlobalState.macroModeState; + if (macroModeState.isPlaying) { + var query = macroModeState.replaySearchQueries.shift(); + handleQuery(query, true /** ignoreCase */, false /** smartCase */); + } else { + showPrompt(cm, { + onClose: onPromptClose, + prefix: promptPrefix, + desc: searchPromptDesc, + onKeyUp: onPromptKeyUp, + onKeyDown: onPromptKeyDown + }); + } + break; + case 'wordUnderCursor': + var word = expandWordUnderCursor(cm, false /** inclusive */, + true /** forward */, false /** bigWord */, + true /** noSymbol */); + var isKeyword = true; + if (!word) { + word = expandWordUnderCursor(cm, false /** inclusive */, + true /** forward */, false /** bigWord */, + false /** noSymbol */); + isKeyword = false; + } + if (!word) { + return; + } + var query = cm.getLine(word.start.line).substring(word.start.ch, + word.end.ch); + if (isKeyword && wholeWordOnly) { + query = '\\b' + query + '\\b'; + } else { + query = escapeRegex(query); + } + + // cachedCursor is used to save the old position of the cursor + // when * or # causes vim to seek for the nearest word and shift + // the cursor before entering the motion. + vimGlobalState.jumpList.cachedCursor = cm.getCursor(); + cm.setCursor(word.start); + + handleQuery(query, true /** ignoreCase */, false /** smartCase */); + break; + } + }, + processEx: function(cm, vim, command) { + function onPromptClose(input) { + // Give the prompt some time to close so that if processCommand shows + // an error, the elements don't overlap. + vimGlobalState.exCommandHistoryController.pushInput(input); + vimGlobalState.exCommandHistoryController.reset(); + exCommandDispatcher.processCommand(cm, input); + } + function onPromptKeyDown(e, input, close) { + var keyName = CodeMirror.keyName(e), up; + if (keyName == 'Esc' || keyName == 'Ctrl-C' || keyName == 'Ctrl-[' || + (keyName == 'Backspace' && input == '')) { + vimGlobalState.exCommandHistoryController.pushInput(input); + vimGlobalState.exCommandHistoryController.reset(); + CodeMirror.e_stop(e); + clearInputState(cm); + close(); + cm.focus(); + } + if (keyName == 'Up' || keyName == 'Down') { + up = keyName == 'Up' ? true : false; + input = vimGlobalState.exCommandHistoryController.nextMatch(input, up) || ''; + close(input); + } else if (keyName == 'Ctrl-U') { + // Ctrl-U clears input. + CodeMirror.e_stop(e); + close(''); + } else { + if ( keyName != 'Left' && keyName != 'Right' && keyName != 'Ctrl' && keyName != 'Alt' && keyName != 'Shift') + vimGlobalState.exCommandHistoryController.reset(); + } + } + if (command.type == 'keyToEx') { + // Handle user defined Ex to Ex mappings + exCommandDispatcher.processCommand(cm, command.exArgs.input); + } else { + if (vim.visualMode) { + showPrompt(cm, { onClose: onPromptClose, prefix: ':', value: '\'<,\'>', + onKeyDown: onPromptKeyDown}); + } else { + showPrompt(cm, { onClose: onPromptClose, prefix: ':', + onKeyDown: onPromptKeyDown}); + } + } + }, + evalInput: function(cm, vim) { + // If the motion comand is set, execute both the operator and motion. + // Otherwise return. + var inputState = vim.inputState; + var motion = inputState.motion; + var motionArgs = inputState.motionArgs || {}; + var operator = inputState.operator; + var operatorArgs = inputState.operatorArgs || {}; + var registerName = inputState.registerName; + var sel = vim.sel; + // TODO: Make sure cm and vim selections are identical outside visual mode. + var origHead = copyCursor(vim.visualMode ? clipCursorToContent(cm, sel.head): cm.getCursor('head')); + var origAnchor = copyCursor(vim.visualMode ? clipCursorToContent(cm, sel.anchor) : cm.getCursor('anchor')); + var oldHead = copyCursor(origHead); + var oldAnchor = copyCursor(origAnchor); + var newHead, newAnchor; + var repeat; + if (operator) { + this.recordLastEdit(vim, inputState); + } + if (inputState.repeatOverride !== undefined) { + // If repeatOverride is specified, that takes precedence over the + // input state's repeat. Used by Ex mode and can be user defined. + repeat = inputState.repeatOverride; + } else { + repeat = inputState.getRepeat(); + } + if (repeat > 0 && motionArgs.explicitRepeat) { + motionArgs.repeatIsExplicit = true; + } else if (motionArgs.noRepeat || + (!motionArgs.explicitRepeat && repeat === 0)) { + repeat = 1; + motionArgs.repeatIsExplicit = false; + } + if (inputState.selectedCharacter) { + // If there is a character input, stick it in all of the arg arrays. + motionArgs.selectedCharacter = operatorArgs.selectedCharacter = + inputState.selectedCharacter; + } + motionArgs.repeat = repeat; + clearInputState(cm); + if (motion) { + var motionResult = motions[motion](cm, origHead, motionArgs, vim); + vim.lastMotion = motions[motion]; + if (!motionResult) { + return; + } + if (motionArgs.toJumplist) { + var jumpList = vimGlobalState.jumpList; + // if the current motion is # or *, use cachedCursor + var cachedCursor = jumpList.cachedCursor; + if (cachedCursor) { + recordJumpPosition(cm, cachedCursor, motionResult); + delete jumpList.cachedCursor; + } else { + recordJumpPosition(cm, origHead, motionResult); + } + } + if (motionResult instanceof Array) { + newAnchor = motionResult[0]; + newHead = motionResult[1]; + } else { + newHead = motionResult; + } + // TODO: Handle null returns from motion commands better. + if (!newHead) { + newHead = copyCursor(origHead); + } + if (vim.visualMode) { + if (!(vim.visualBlock && newHead.ch === Infinity)) { + newHead = clipCursorToContent(cm, newHead, vim.visualBlock); + } + if (newAnchor) { + newAnchor = clipCursorToContent(cm, newAnchor, true); + } + newAnchor = newAnchor || oldAnchor; + sel.anchor = newAnchor; + sel.head = newHead; + updateCmSelection(cm); + updateMark(cm, vim, '<', + cursorIsBefore(newAnchor, newHead) ? newAnchor + : newHead); + updateMark(cm, vim, '>', + cursorIsBefore(newAnchor, newHead) ? newHead + : newAnchor); + } else if (!operator) { + newHead = clipCursorToContent(cm, newHead); + cm.setCursor(newHead.line, newHead.ch); + } + } + if (operator) { + if (operatorArgs.lastSel) { + // Replaying a visual mode operation + newAnchor = oldAnchor; + var lastSel = operatorArgs.lastSel; + var lineOffset = Math.abs(lastSel.head.line - lastSel.anchor.line); + var chOffset = Math.abs(lastSel.head.ch - lastSel.anchor.ch); + if (lastSel.visualLine) { + // Linewise Visual mode: The same number of lines. + newHead = Pos(oldAnchor.line + lineOffset, oldAnchor.ch); + } else if (lastSel.visualBlock) { + // Blockwise Visual mode: The same number of lines and columns. + newHead = Pos(oldAnchor.line + lineOffset, oldAnchor.ch + chOffset); + } else if (lastSel.head.line == lastSel.anchor.line) { + // Normal Visual mode within one line: The same number of characters. + newHead = Pos(oldAnchor.line, oldAnchor.ch + chOffset); + } else { + // Normal Visual mode with several lines: The same number of lines, in the + // last line the same number of characters as in the last line the last time. + newHead = Pos(oldAnchor.line + lineOffset, oldAnchor.ch); + } + vim.visualMode = true; + vim.visualLine = lastSel.visualLine; + vim.visualBlock = lastSel.visualBlock; + sel = vim.sel = { + anchor: newAnchor, + head: newHead + }; + updateCmSelection(cm); + } else if (vim.visualMode) { + operatorArgs.lastSel = { + anchor: copyCursor(sel.anchor), + head: copyCursor(sel.head), + visualBlock: vim.visualBlock, + visualLine: vim.visualLine + }; + } + var curStart, curEnd, linewise, mode; + var cmSel; + if (vim.visualMode) { + // Init visual op + curStart = cursorMin(sel.head, sel.anchor); + curEnd = cursorMax(sel.head, sel.anchor); + linewise = vim.visualLine || operatorArgs.linewise; + mode = vim.visualBlock ? 'block' : + linewise ? 'line' : + 'char'; + cmSel = makeCmSelection(cm, { + anchor: curStart, + head: curEnd + }, mode); + if (linewise) { + var ranges = cmSel.ranges; + if (mode == 'block') { + // Linewise operators in visual block mode extend to end of line + for (var i = 0; i < ranges.length; i++) { + ranges[i].head.ch = lineLength(cm, ranges[i].head.line); + } + } else if (mode == 'line') { + ranges[0].head = Pos(ranges[0].head.line + 1, 0); + } + } + } else { + // Init motion op + curStart = copyCursor(newAnchor || oldAnchor); + curEnd = copyCursor(newHead || oldHead); + if (cursorIsBefore(curEnd, curStart)) { + var tmp = curStart; + curStart = curEnd; + curEnd = tmp; + } + linewise = motionArgs.linewise || operatorArgs.linewise; + if (linewise) { + // Expand selection to entire line. + expandSelectionToLine(cm, curStart, curEnd); + } else if (motionArgs.forward) { + // Clip to trailing newlines only if the motion goes forward. + clipToLine(cm, curStart, curEnd); + } + mode = 'char'; + var exclusive = !motionArgs.inclusive || linewise; + cmSel = makeCmSelection(cm, { + anchor: curStart, + head: curEnd + }, mode, exclusive); + } + cm.setSelections(cmSel.ranges, cmSel.primary); + vim.lastMotion = null; + operatorArgs.repeat = repeat; // For indent in visual mode. + operatorArgs.registerName = registerName; + // Keep track of linewise as it affects how paste and change behave. + operatorArgs.linewise = linewise; + var operatorMoveTo = operators[operator]( + cm, operatorArgs, cmSel.ranges, oldAnchor, newHead); + if (vim.visualMode) { + exitVisualMode(cm, operatorMoveTo != null); + } + if (operatorMoveTo) { + cm.setCursor(operatorMoveTo); + } + } + }, + recordLastEdit: function(vim, inputState, actionCommand) { + var macroModeState = vimGlobalState.macroModeState; + if (macroModeState.isPlaying) { return; } + vim.lastEditInputState = inputState; + vim.lastEditActionCommand = actionCommand; + macroModeState.lastInsertModeChanges.changes = []; + macroModeState.lastInsertModeChanges.expectCursorActivityForChange = false; + } + }; + + /** + * typedef {Object{line:number,ch:number}} Cursor An object containing the + * position of the cursor. + */ + // All of the functions below return Cursor objects. + var motions = { + moveToTopLine: function(cm, _head, motionArgs) { + var line = getUserVisibleLines(cm).top + motionArgs.repeat -1; + return Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line))); + }, + moveToMiddleLine: function(cm) { + var range = getUserVisibleLines(cm); + var line = Math.floor((range.top + range.bottom) * 0.5); + return Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line))); + }, + moveToBottomLine: function(cm, _head, motionArgs) { + var line = getUserVisibleLines(cm).bottom - motionArgs.repeat +1; + return Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line))); + }, + expandToLine: function(_cm, head, motionArgs) { + // Expands forward to end of line, and then to next line if repeat is + // >1. Does not handle backward motion! + var cur = head; + return Pos(cur.line + motionArgs.repeat - 1, Infinity); + }, + findNext: function(cm, _head, motionArgs) { + var state = getSearchState(cm); + var query = state.getQuery(); + if (!query) { + return; + } + var prev = !motionArgs.forward; + // If search is initiated with ? instead of /, negate direction. + prev = (state.isReversed()) ? !prev : prev; + highlightSearchMatches(cm, query); + return findNext(cm, prev/** prev */, query, motionArgs.repeat); + }, + goToMark: function(cm, _head, motionArgs, vim) { + var mark = vim.marks[motionArgs.selectedCharacter]; + if (mark) { + var pos = mark.find(); + return motionArgs.linewise ? { line: pos.line, ch: findFirstNonWhiteSpaceCharacter(cm.getLine(pos.line)) } : pos; + } + return null; + }, + moveToOtherHighlightedEnd: function(cm, _head, motionArgs, vim) { + if (vim.visualBlock && motionArgs.sameLine) { + var sel = vim.sel; + return [ + clipCursorToContent(cm, Pos(sel.anchor.line, sel.head.ch)), + clipCursorToContent(cm, Pos(sel.head.line, sel.anchor.ch)) + ]; + } else { + return ([vim.sel.head, vim.sel.anchor]); + } + }, + jumpToMark: function(cm, head, motionArgs, vim) { + var best = head; + for (var i = 0; i < motionArgs.repeat; i++) { + var cursor = best; + for (var key in vim.marks) { + if (!isLowerCase(key)) { + continue; + } + var mark = vim.marks[key].find(); + var isWrongDirection = (motionArgs.forward) ? + cursorIsBefore(mark, cursor) : cursorIsBefore(cursor, mark); + + if (isWrongDirection) { + continue; + } + if (motionArgs.linewise && (mark.line == cursor.line)) { + continue; + } + + var equal = cursorEqual(cursor, best); + var between = (motionArgs.forward) ? + cursorIsBetween(cursor, mark, best) : + cursorIsBetween(best, mark, cursor); + + if (equal || between) { + best = mark; + } + } + } + + if (motionArgs.linewise) { + // Vim places the cursor on the first non-whitespace character of + // the line if there is one, else it places the cursor at the end + // of the line, regardless of whether a mark was found. + best = Pos(best.line, findFirstNonWhiteSpaceCharacter(cm.getLine(best.line))); + } + return best; + }, + moveByCharacters: function(_cm, head, motionArgs) { + var cur = head; + var repeat = motionArgs.repeat; + var ch = motionArgs.forward ? cur.ch + repeat : cur.ch - repeat; + return Pos(cur.line, ch); + }, + moveByLines: function(cm, head, motionArgs, vim) { + var cur = head; + var endCh = cur.ch; + // Depending what our last motion was, we may want to do different + // things. If our last motion was moving vertically, we want to + // preserve the HPos from our last horizontal move. If our last motion + // was going to the end of a line, moving vertically we should go to + // the end of the line, etc. + switch (vim.lastMotion) { + case this.moveByLines: + case this.moveByDisplayLines: + case this.moveByScroll: + case this.moveToColumn: + case this.moveToEol: + endCh = vim.lastHPos; + break; + default: + vim.lastHPos = endCh; + } + var repeat = motionArgs.repeat+(motionArgs.repeatOffset||0); + var line = motionArgs.forward ? cur.line + repeat : cur.line - repeat; + var first = cm.firstLine(); + var last = cm.lastLine(); + // Vim cancels linewise motions that start on an edge and move beyond + // that edge. It does not cancel motions that do not start on an edge. + if ((line < first && cur.line == first) || + (line > last && cur.line == last)) { + return; + } + if (motionArgs.toFirstChar){ + endCh=findFirstNonWhiteSpaceCharacter(cm.getLine(line)); + vim.lastHPos = endCh; + } + vim.lastHSPos = cm.charCoords(Pos(line, endCh),'div').left; + return Pos(line, endCh); + }, + moveByDisplayLines: function(cm, head, motionArgs, vim) { + var cur = head; + switch (vim.lastMotion) { + case this.moveByDisplayLines: + case this.moveByScroll: + case this.moveByLines: + case this.moveToColumn: + case this.moveToEol: + break; + default: + vim.lastHSPos = cm.charCoords(cur,'div').left; + } + var repeat = motionArgs.repeat; + var res=cm.findPosV(cur,(motionArgs.forward ? repeat : -repeat),'line',vim.lastHSPos); + if (res.hitSide) { + if (motionArgs.forward) { + var lastCharCoords = cm.charCoords(res, 'div'); + var goalCoords = { top: lastCharCoords.top + 8, left: vim.lastHSPos }; + var res = cm.coordsChar(goalCoords, 'div'); + } else { + var resCoords = cm.charCoords(Pos(cm.firstLine(), 0), 'div'); + resCoords.left = vim.lastHSPos; + res = cm.coordsChar(resCoords, 'div'); + } + } + vim.lastHPos = res.ch; + return res; + }, + moveByPage: function(cm, head, motionArgs) { + // CodeMirror only exposes functions that move the cursor page down, so + // doing this bad hack to move the cursor and move it back. evalInput + // will move the cursor to where it should be in the end. + var curStart = head; + var repeat = motionArgs.repeat; + return cm.findPosV(curStart, (motionArgs.forward ? repeat : -repeat), 'page'); + }, + moveByParagraph: function(cm, head, motionArgs) { + var dir = motionArgs.forward ? 1 : -1; + return findParagraph(cm, head, motionArgs.repeat, dir); + }, + moveByScroll: function(cm, head, motionArgs, vim) { + var scrollbox = cm.getScrollInfo(); + var curEnd = null; + var repeat = motionArgs.repeat; + if (!repeat) { + repeat = scrollbox.clientHeight / (2 * cm.defaultTextHeight()); + } + var orig = cm.charCoords(head, 'local'); + motionArgs.repeat = repeat; + var curEnd = motions.moveByDisplayLines(cm, head, motionArgs, vim); + if (!curEnd) { + return null; + } + var dest = cm.charCoords(curEnd, 'local'); + cm.scrollTo(null, scrollbox.top + dest.top - orig.top); + return curEnd; + }, + moveByWords: function(cm, head, motionArgs) { + return moveToWord(cm, head, motionArgs.repeat, !!motionArgs.forward, + !!motionArgs.wordEnd, !!motionArgs.bigWord); + }, + moveTillCharacter: function(cm, _head, motionArgs) { + var repeat = motionArgs.repeat; + var curEnd = moveToCharacter(cm, repeat, motionArgs.forward, + motionArgs.selectedCharacter); + var increment = motionArgs.forward ? -1 : 1; + recordLastCharacterSearch(increment, motionArgs); + if (!curEnd) return null; + curEnd.ch += increment; + return curEnd; + }, + moveToCharacter: function(cm, head, motionArgs) { + var repeat = motionArgs.repeat; + recordLastCharacterSearch(0, motionArgs); + return moveToCharacter(cm, repeat, motionArgs.forward, + motionArgs.selectedCharacter) || head; + }, + moveToSymbol: function(cm, head, motionArgs) { + var repeat = motionArgs.repeat; + return findSymbol(cm, repeat, motionArgs.forward, + motionArgs.selectedCharacter) || head; + }, + moveToColumn: function(cm, head, motionArgs, vim) { + var repeat = motionArgs.repeat; + // repeat is equivalent to which column we want to move to! + vim.lastHPos = repeat - 1; + vim.lastHSPos = cm.charCoords(head,'div').left; + return moveToColumn(cm, repeat); + }, + moveToEol: function(cm, head, motionArgs, vim) { + var cur = head; + vim.lastHPos = Infinity; + var retval= Pos(cur.line + motionArgs.repeat - 1, Infinity); + var end=cm.clipPos(retval); + end.ch--; + vim.lastHSPos = cm.charCoords(end,'div').left; + return retval; + }, + moveToFirstNonWhiteSpaceCharacter: function(cm, head) { + // Go to the start of the line where the text begins, or the end for + // whitespace-only lines + var cursor = head; + return Pos(cursor.line, + findFirstNonWhiteSpaceCharacter(cm.getLine(cursor.line))); + }, + moveToMatchedSymbol: function(cm, head) { + var cursor = head; + var line = cursor.line; + var ch = cursor.ch; + var lineText = cm.getLine(line); + var symbol; + do { + symbol = lineText.charAt(ch++); + if (symbol && isMatchableSymbol(symbol)) { + var style = cm.getTokenTypeAt(Pos(line, ch)); + if (style !== "string" && style !== "comment") { + break; + } + } + } while (symbol); + if (symbol) { + var matched = cm.findMatchingBracket(Pos(line, ch)); + return matched.to; + } else { + return cursor; + } + }, + moveToStartOfLine: function(_cm, head) { + return Pos(head.line, 0); + }, + moveToLineOrEdgeOfDocument: function(cm, _head, motionArgs) { + var lineNum = motionArgs.forward ? cm.lastLine() : cm.firstLine(); + if (motionArgs.repeatIsExplicit) { + lineNum = motionArgs.repeat - cm.getOption('firstLineNumber'); + } + return Pos(lineNum, + findFirstNonWhiteSpaceCharacter(cm.getLine(lineNum))); + }, + textObjectManipulation: function(cm, head, motionArgs, vim) { + // TODO: lots of possible exceptions that can be thrown here. Try da( + // outside of a () block. + + // TODO: adding <> >< to this map doesn't work, presumably because + // they're operators + var mirroredPairs = {'(': ')', ')': '(', + '{': '}', '}': '{', + '[': ']', ']': '['}; + var selfPaired = {'\'': true, '"': true}; + + var character = motionArgs.selectedCharacter; + // 'b' refers to '()' block. + // 'B' refers to '{}' block. + if (character == 'b') { + character = '('; + } else if (character == 'B') { + character = '{'; + } + + // Inclusive is the difference between a and i + // TODO: Instead of using the additional text object map to perform text + // object operations, merge the map into the defaultKeyMap and use + // motionArgs to define behavior. Define separate entries for 'aw', + // 'iw', 'a[', 'i[', etc. + var inclusive = !motionArgs.textObjectInner; + + var tmp; + if (mirroredPairs[character]) { + tmp = selectCompanionObject(cm, head, character, inclusive); + } else if (selfPaired[character]) { + tmp = findBeginningAndEnd(cm, head, character, inclusive); + } else if (character === 'W') { + tmp = expandWordUnderCursor(cm, inclusive, true /** forward */, + true /** bigWord */); + } else if (character === 'w') { + tmp = expandWordUnderCursor(cm, inclusive, true /** forward */, + false /** bigWord */); + } else if (character === 'p') { + tmp = findParagraph(cm, head, motionArgs.repeat, 0, inclusive); + motionArgs.linewise = true; + if (vim.visualMode) { + if (!vim.visualLine) { vim.visualLine = true; } + } else { + var operatorArgs = vim.inputState.operatorArgs; + if (operatorArgs) { operatorArgs.linewise = true; } + tmp.end.line--; + } + } else { + // No text object defined for this, don't move. + return null; + } + + if (!cm.state.vim.visualMode) { + return [tmp.start, tmp.end]; + } else { + return expandSelection(cm, tmp.start, tmp.end); + } + }, + + repeatLastCharacterSearch: function(cm, head, motionArgs) { + var lastSearch = vimGlobalState.lastChararacterSearch; + var repeat = motionArgs.repeat; + var forward = motionArgs.forward === lastSearch.forward; + var increment = (lastSearch.increment ? 1 : 0) * (forward ? -1 : 1); + cm.moveH(-increment, 'char'); + motionArgs.inclusive = forward ? true : false; + var curEnd = moveToCharacter(cm, repeat, forward, lastSearch.selectedCharacter); + if (!curEnd) { + cm.moveH(increment, 'char'); + return head; + } + curEnd.ch += increment; + return curEnd; + } + }; + + function defineMotion(name, fn) { + motions[name] = fn; + } + + function fillArray(val, times) { + var arr = []; + for (var i = 0; i < times; i++) { + arr.push(val); + } + return arr; + } + /** + * An operator acts on a text selection. It receives the list of selections + * as input. The corresponding CodeMirror selection is guaranteed to + * match the input selection. + */ + var operators = { + change: function(cm, args, ranges) { + var finalHead, text; + var vim = cm.state.vim; + vimGlobalState.macroModeState.lastInsertModeChanges.inVisualBlock = vim.visualBlock; + if (!vim.visualMode) { + var anchor = ranges[0].anchor, + head = ranges[0].head; + text = cm.getRange(anchor, head); + var lastState = vim.lastEditInputState || {}; + if (lastState.motion == "moveByWords" && !isWhiteSpaceString(text)) { + // Exclude trailing whitespace if the range is not all whitespace. + var match = (/\s+$/).exec(text); + if (match && lastState.motionArgs && lastState.motionArgs.forward) { + head = offsetCursor(head, 0, - match[0].length); + text = text.slice(0, - match[0].length); + } + } + var wasLastLine = head.line - 1 == cm.lastLine(); + cm.replaceRange('', anchor, head); + if (args.linewise && !wasLastLine) { + // Push the next line back down, if there is a next line. + CodeMirror.commands.newlineAndIndent(cm); + // null ch so setCursor moves to end of line. + anchor.ch = null; + } + finalHead = anchor; + } else { + text = cm.getSelection(); + var replacement = fillArray('', ranges.length); + cm.replaceSelections(replacement); + finalHead = cursorMin(ranges[0].head, ranges[0].anchor); + } + vimGlobalState.registerController.pushText( + args.registerName, 'change', text, + args.linewise, ranges.length > 1); + actions.enterInsertMode(cm, {head: finalHead}, cm.state.vim); + }, + // delete is a javascript keyword. + 'delete': function(cm, args, ranges) { + var finalHead, text; + var vim = cm.state.vim; + if (!vim.visualBlock) { + var anchor = ranges[0].anchor, + head = ranges[0].head; + if (args.linewise && + head.line != cm.firstLine() && + anchor.line == cm.lastLine() && + anchor.line == head.line - 1) { + // Special case for dd on last line (and first line). + if (anchor.line == cm.firstLine()) { + anchor.ch = 0; + } else { + anchor = Pos(anchor.line - 1, lineLength(cm, anchor.line - 1)); + } + } + text = cm.getRange(anchor, head); + cm.replaceRange('', anchor, head); + finalHead = anchor; + if (args.linewise) { + finalHead = motions.moveToFirstNonWhiteSpaceCharacter(cm, anchor); + } + } else { + text = cm.getSelection(); + var replacement = fillArray('', ranges.length); + cm.replaceSelections(replacement); + finalHead = ranges[0].anchor; + } + vimGlobalState.registerController.pushText( + args.registerName, 'delete', text, + args.linewise, vim.visualBlock); + return clipCursorToContent(cm, finalHead); + }, + indent: function(cm, args, ranges) { + var vim = cm.state.vim; + var startLine = ranges[0].anchor.line; + var endLine = vim.visualBlock ? + ranges[ranges.length - 1].anchor.line : + ranges[0].head.line; + // In visual mode, n> shifts the selection right n times, instead of + // shifting n lines right once. + var repeat = (vim.visualMode) ? args.repeat : 1; + if (args.linewise) { + // The only way to delete a newline is to delete until the start of + // the next line, so in linewise mode evalInput will include the next + // line. We don't want this in indent, so we go back a line. + endLine--; + } + for (var i = startLine; i <= endLine; i++) { + for (var j = 0; j < repeat; j++) { + cm.indentLine(i, args.indentRight); + } + } + return motions.moveToFirstNonWhiteSpaceCharacter(cm, ranges[0].anchor); + }, + changeCase: function(cm, args, ranges, oldAnchor, newHead) { + var selections = cm.getSelections(); + var swapped = []; + var toLower = args.toLower; + for (var j = 0; j < selections.length; j++) { + var toSwap = selections[j]; + var text = ''; + if (toLower === true) { + text = toSwap.toLowerCase(); + } else if (toLower === false) { + text = toSwap.toUpperCase(); + } else { + for (var i = 0; i < toSwap.length; i++) { + var character = toSwap.charAt(i); + text += isUpperCase(character) ? character.toLowerCase() : + character.toUpperCase(); + } + } + swapped.push(text); + } + cm.replaceSelections(swapped); + if (args.shouldMoveCursor){ + return newHead; + } else if (!cm.state.vim.visualMode && args.linewise && ranges[0].anchor.line + 1 == ranges[0].head.line) { + return motions.moveToFirstNonWhiteSpaceCharacter(cm, oldAnchor); + } else if (args.linewise){ + return oldAnchor; + } else { + return cursorMin(ranges[0].anchor, ranges[0].head); + } + }, + yank: function(cm, args, ranges, oldAnchor) { + var vim = cm.state.vim; + var text = cm.getSelection(); + var endPos = vim.visualMode + ? cursorMin(vim.sel.anchor, vim.sel.head, ranges[0].head, ranges[0].anchor) + : oldAnchor; + vimGlobalState.registerController.pushText( + args.registerName, 'yank', + text, args.linewise, vim.visualBlock); + return endPos; + } + }; + + function defineOperator(name, fn) { + operators[name] = fn; + } + + var actions = { + jumpListWalk: function(cm, actionArgs, vim) { + if (vim.visualMode) { + return; + } + var repeat = actionArgs.repeat; + var forward = actionArgs.forward; + var jumpList = vimGlobalState.jumpList; + + var mark = jumpList.move(cm, forward ? repeat : -repeat); + var markPos = mark ? mark.find() : undefined; + markPos = markPos ? markPos : cm.getCursor(); + cm.setCursor(markPos); + }, + scroll: function(cm, actionArgs, vim) { + if (vim.visualMode) { + return; + } + var repeat = actionArgs.repeat || 1; + var lineHeight = cm.defaultTextHeight(); + var top = cm.getScrollInfo().top; + var delta = lineHeight * repeat; + var newPos = actionArgs.forward ? top + delta : top - delta; + var cursor = copyCursor(cm.getCursor()); + var cursorCoords = cm.charCoords(cursor, 'local'); + if (actionArgs.forward) { + if (newPos > cursorCoords.top) { + cursor.line += (newPos - cursorCoords.top) / lineHeight; + cursor.line = Math.ceil(cursor.line); + cm.setCursor(cursor); + cursorCoords = cm.charCoords(cursor, 'local'); + cm.scrollTo(null, cursorCoords.top); + } else { + // Cursor stays within bounds. Just reposition the scroll window. + cm.scrollTo(null, newPos); + } + } else { + var newBottom = newPos + cm.getScrollInfo().clientHeight; + if (newBottom < cursorCoords.bottom) { + cursor.line -= (cursorCoords.bottom - newBottom) / lineHeight; + cursor.line = Math.floor(cursor.line); + cm.setCursor(cursor); + cursorCoords = cm.charCoords(cursor, 'local'); + cm.scrollTo( + null, cursorCoords.bottom - cm.getScrollInfo().clientHeight); + } else { + // Cursor stays within bounds. Just reposition the scroll window. + cm.scrollTo(null, newPos); + } + } + }, + scrollToCursor: function(cm, actionArgs) { + var lineNum = cm.getCursor().line; + var charCoords = cm.charCoords(Pos(lineNum, 0), 'local'); + var height = cm.getScrollInfo().clientHeight; + var y = charCoords.top; + var lineHeight = charCoords.bottom - y; + switch (actionArgs.position) { + case 'center': y = y - (height / 2) + lineHeight; + break; + case 'bottom': y = y - height + lineHeight*1.4; + break; + case 'top': y = y + lineHeight*0.4; + break; + } + cm.scrollTo(null, y); + }, + replayMacro: function(cm, actionArgs, vim) { + var registerName = actionArgs.selectedCharacter; + var repeat = actionArgs.repeat; + var macroModeState = vimGlobalState.macroModeState; + if (registerName == '@') { + registerName = macroModeState.latestRegister; + } + while(repeat--){ + executeMacroRegister(cm, vim, macroModeState, registerName); + } + }, + enterMacroRecordMode: function(cm, actionArgs) { + var macroModeState = vimGlobalState.macroModeState; + var registerName = actionArgs.selectedCharacter; + macroModeState.enterMacroRecordMode(cm, registerName); + }, + enterInsertMode: function(cm, actionArgs, vim) { + if (cm.getOption('readOnly')) { return; } + vim.insertMode = true; + vim.insertModeRepeat = actionArgs && actionArgs.repeat || 1; + var insertAt = (actionArgs) ? actionArgs.insertAt : null; + var sel = vim.sel; + var head = actionArgs.head || cm.getCursor('head'); + var height = cm.listSelections().length; + if (insertAt == 'eol') { + head = Pos(head.line, lineLength(cm, head.line)); + } else if (insertAt == 'charAfter') { + head = offsetCursor(head, 0, 1); + } else if (insertAt == 'firstNonBlank') { + head = motions.moveToFirstNonWhiteSpaceCharacter(cm, head); + } else if (insertAt == 'startOfSelectedArea') { + if (!vim.visualBlock) { + if (sel.head.line < sel.anchor.line) { + head = sel.head; + } else { + head = Pos(sel.anchor.line, 0); + } + } else { + head = Pos( + Math.min(sel.head.line, sel.anchor.line), + Math.min(sel.head.ch, sel.anchor.ch)); + height = Math.abs(sel.head.line - sel.anchor.line) + 1; + } + } else if (insertAt == 'endOfSelectedArea') { + if (!vim.visualBlock) { + if (sel.head.line >= sel.anchor.line) { + head = offsetCursor(sel.head, 0, 1); + } else { + head = Pos(sel.anchor.line, 0); + } + } else { + head = Pos( + Math.min(sel.head.line, sel.anchor.line), + Math.max(sel.head.ch + 1, sel.anchor.ch)); + height = Math.abs(sel.head.line - sel.anchor.line) + 1; + } + } else if (insertAt == 'inplace') { + if (vim.visualMode){ + return; + } + } + cm.setOption('keyMap', 'vim-insert'); + cm.setOption('disableInput', false); + if (actionArgs && actionArgs.replace) { + // Handle Replace-mode as a special case of insert mode. + cm.toggleOverwrite(true); + cm.setOption('keyMap', 'vim-replace'); + CodeMirror.signal(cm, "vim-mode-change", {mode: "replace"}); + } else { + cm.setOption('keyMap', 'vim-insert'); + CodeMirror.signal(cm, "vim-mode-change", {mode: "insert"}); + } + if (!vimGlobalState.macroModeState.isPlaying) { + // Only record if not replaying. + cm.on('change', onChange); + CodeMirror.on(cm.getInputField(), 'keydown', onKeyEventTargetKeyDown); + } + if (vim.visualMode) { + exitVisualMode(cm); + } + selectForInsert(cm, head, height); + }, + toggleVisualMode: function(cm, actionArgs, vim) { + var repeat = actionArgs.repeat; + var anchor = cm.getCursor(); + var head; + // TODO: The repeat should actually select number of characters/lines + // equal to the repeat times the size of the previous visual + // operation. + if (!vim.visualMode) { + // Entering visual mode + vim.visualMode = true; + vim.visualLine = !!actionArgs.linewise; + vim.visualBlock = !!actionArgs.blockwise; + head = clipCursorToContent( + cm, Pos(anchor.line, anchor.ch + repeat - 1), + true /** includeLineBreak */); + vim.sel = { + anchor: anchor, + head: head + }; + CodeMirror.signal(cm, "vim-mode-change", {mode: "visual", subMode: vim.visualLine ? "linewise" : vim.visualBlock ? "blockwise" : ""}); + updateCmSelection(cm); + updateMark(cm, vim, '<', cursorMin(anchor, head)); + updateMark(cm, vim, '>', cursorMax(anchor, head)); + } else if (vim.visualLine ^ actionArgs.linewise || + vim.visualBlock ^ actionArgs.blockwise) { + // Toggling between modes + vim.visualLine = !!actionArgs.linewise; + vim.visualBlock = !!actionArgs.blockwise; + CodeMirror.signal(cm, "vim-mode-change", {mode: "visual", subMode: vim.visualLine ? "linewise" : vim.visualBlock ? "blockwise" : ""}); + updateCmSelection(cm); + } else { + exitVisualMode(cm); + } + }, + reselectLastSelection: function(cm, _actionArgs, vim) { + var lastSelection = vim.lastSelection; + if (vim.visualMode) { + updateLastSelection(cm, vim); + } + if (lastSelection) { + var anchor = lastSelection.anchorMark.find(); + var head = lastSelection.headMark.find(); + if (!anchor || !head) { + // If the marks have been destroyed due to edits, do nothing. + return; + } + vim.sel = { + anchor: anchor, + head: head + }; + vim.visualMode = true; + vim.visualLine = lastSelection.visualLine; + vim.visualBlock = lastSelection.visualBlock; + updateCmSelection(cm); + updateMark(cm, vim, '<', cursorMin(anchor, head)); + updateMark(cm, vim, '>', cursorMax(anchor, head)); + CodeMirror.signal(cm, 'vim-mode-change', { + mode: 'visual', + subMode: vim.visualLine ? 'linewise' : + vim.visualBlock ? 'blockwise' : ''}); + } + }, + joinLines: function(cm, actionArgs, vim) { + var curStart, curEnd; + if (vim.visualMode) { + curStart = cm.getCursor('anchor'); + curEnd = cm.getCursor('head'); + if (cursorIsBefore(curEnd, curStart)) { + var tmp = curEnd; + curEnd = curStart; + curStart = tmp; + } + curEnd.ch = lineLength(cm, curEnd.line) - 1; + } else { + // Repeat is the number of lines to join. Minimum 2 lines. + var repeat = Math.max(actionArgs.repeat, 2); + curStart = cm.getCursor(); + curEnd = clipCursorToContent(cm, Pos(curStart.line + repeat - 1, + Infinity)); + } + var finalCh = 0; + for (var i = curStart.line; i < curEnd.line; i++) { + finalCh = lineLength(cm, curStart.line); + var tmp = Pos(curStart.line + 1, + lineLength(cm, curStart.line + 1)); + var text = cm.getRange(curStart, tmp); + text = text.replace(/\n\s*/g, ' '); + cm.replaceRange(text, curStart, tmp); + } + var curFinalPos = Pos(curStart.line, finalCh); + if (vim.visualMode) { + exitVisualMode(cm, false); + } + cm.setCursor(curFinalPos); + }, + newLineAndEnterInsertMode: function(cm, actionArgs, vim) { + vim.insertMode = true; + var insertAt = copyCursor(cm.getCursor()); + if (insertAt.line === cm.firstLine() && !actionArgs.after) { + // Special case for inserting newline before start of document. + cm.replaceRange('\n', Pos(cm.firstLine(), 0)); + cm.setCursor(cm.firstLine(), 0); + } else { + insertAt.line = (actionArgs.after) ? insertAt.line : + insertAt.line - 1; + insertAt.ch = lineLength(cm, insertAt.line); + cm.setCursor(insertAt); + var newlineFn = CodeMirror.commands.newlineAndIndentContinueComment || + CodeMirror.commands.newlineAndIndent; + newlineFn(cm); + } + this.enterInsertMode(cm, { repeat: actionArgs.repeat }, vim); + }, + paste: function(cm, actionArgs, vim) { + var cur = copyCursor(cm.getCursor()); + var register = vimGlobalState.registerController.getRegister( + actionArgs.registerName); + var text = register.toString(); + if (!text) { + return; + } + if (actionArgs.matchIndent) { + var tabSize = cm.getOption("tabSize"); + // length that considers tabs and tabSize + var whitespaceLength = function(str) { + var tabs = (str.split("\t").length - 1); + var spaces = (str.split(" ").length - 1); + return tabs * tabSize + spaces * 1; + }; + var currentLine = cm.getLine(cm.getCursor().line); + var indent = whitespaceLength(currentLine.match(/^\s*/)[0]); + // chomp last newline b/c don't want it to match /^\s*/gm + var chompedText = text.replace(/\n$/, ''); + var wasChomped = text !== chompedText; + var firstIndent = whitespaceLength(text.match(/^\s*/)[0]); + var text = chompedText.replace(/^\s*/gm, function(wspace) { + var newIndent = indent + (whitespaceLength(wspace) - firstIndent); + if (newIndent < 0) { + return ""; + } + else if (cm.getOption("indentWithTabs")) { + var quotient = Math.floor(newIndent / tabSize); + return Array(quotient + 1).join('\t'); + } + else { + return Array(newIndent + 1).join(' '); + } + }); + text += wasChomped ? "\n" : ""; + } + if (actionArgs.repeat > 1) { + var text = Array(actionArgs.repeat + 1).join(text); + } + var linewise = register.linewise; + var blockwise = register.blockwise; + if (linewise) { + if(vim.visualMode) { + text = vim.visualLine ? text.slice(0, -1) : '\n' + text.slice(0, text.length - 1) + '\n'; + } else if (actionArgs.after) { + // Move the newline at the end to the start instead, and paste just + // before the newline character of the line we are on right now. + text = '\n' + text.slice(0, text.length - 1); + cur.ch = lineLength(cm, cur.line); + } else { + cur.ch = 0; + } + } else { + if (blockwise) { + text = text.split('\n'); + for (var i = 0; i < text.length; i++) { + text[i] = (text[i] == '') ? ' ' : text[i]; + } + } + cur.ch += actionArgs.after ? 1 : 0; + } + var curPosFinal; + var idx; + if (vim.visualMode) { + // save the pasted text for reselection if the need arises + vim.lastPastedText = text; + var lastSelectionCurEnd; + var selectedArea = getSelectedAreaRange(cm, vim); + var selectionStart = selectedArea[0]; + var selectionEnd = selectedArea[1]; + var selectedText = cm.getSelection(); + var selections = cm.listSelections(); + var emptyStrings = new Array(selections.length).join('1').split('1'); + // save the curEnd marker before it get cleared due to cm.replaceRange. + if (vim.lastSelection) { + lastSelectionCurEnd = vim.lastSelection.headMark.find(); + } + // push the previously selected text to unnamed register + vimGlobalState.registerController.unnamedRegister.setText(selectedText); + if (blockwise) { + // first delete the selected text + cm.replaceSelections(emptyStrings); + // Set new selections as per the block length of the yanked text + selectionEnd = Pos(selectionStart.line + text.length-1, selectionStart.ch); + cm.setCursor(selectionStart); + selectBlock(cm, selectionEnd); + cm.replaceSelections(text); + curPosFinal = selectionStart; + } else if (vim.visualBlock) { + cm.replaceSelections(emptyStrings); + cm.setCursor(selectionStart); + cm.replaceRange(text, selectionStart, selectionStart); + curPosFinal = selectionStart; + } else { + cm.replaceRange(text, selectionStart, selectionEnd); + curPosFinal = cm.posFromIndex(cm.indexFromPos(selectionStart) + text.length - 1); + } + // restore the the curEnd marker + if(lastSelectionCurEnd) { + vim.lastSelection.headMark = cm.setBookmark(lastSelectionCurEnd); + } + if (linewise) { + curPosFinal.ch=0; + } + } else { + if (blockwise) { + cm.setCursor(cur); + for (var i = 0; i < text.length; i++) { + var line = cur.line+i; + if (line > cm.lastLine()) { + cm.replaceRange('\n', Pos(line, 0)); + } + var lastCh = lineLength(cm, line); + if (lastCh < cur.ch) { + extendLineToColumn(cm, line, cur.ch); + } + } + cm.setCursor(cur); + selectBlock(cm, Pos(cur.line + text.length-1, cur.ch)); + cm.replaceSelections(text); + curPosFinal = cur; + } else { + cm.replaceRange(text, cur); + // Now fine tune the cursor to where we want it. + if (linewise && actionArgs.after) { + curPosFinal = Pos( + cur.line + 1, + findFirstNonWhiteSpaceCharacter(cm.getLine(cur.line + 1))); + } else if (linewise && !actionArgs.after) { + curPosFinal = Pos( + cur.line, + findFirstNonWhiteSpaceCharacter(cm.getLine(cur.line))); + } else if (!linewise && actionArgs.after) { + idx = cm.indexFromPos(cur); + curPosFinal = cm.posFromIndex(idx + text.length - 1); + } else { + idx = cm.indexFromPos(cur); + curPosFinal = cm.posFromIndex(idx + text.length); + } + } + } + if (vim.visualMode) { + exitVisualMode(cm, false); + } + cm.setCursor(curPosFinal); + }, + undo: function(cm, actionArgs) { + cm.operation(function() { + repeatFn(cm, CodeMirror.commands.undo, actionArgs.repeat)(); + cm.setCursor(cm.getCursor('anchor')); + }); + }, + redo: function(cm, actionArgs) { + repeatFn(cm, CodeMirror.commands.redo, actionArgs.repeat)(); + }, + setRegister: function(_cm, actionArgs, vim) { + vim.inputState.registerName = actionArgs.selectedCharacter; + }, + setMark: function(cm, actionArgs, vim) { + var markName = actionArgs.selectedCharacter; + updateMark(cm, vim, markName, cm.getCursor()); + }, + replace: function(cm, actionArgs, vim) { + var replaceWith = actionArgs.selectedCharacter; + var curStart = cm.getCursor(); + var replaceTo; + var curEnd; + var selections = cm.listSelections(); + if (vim.visualMode) { + curStart = cm.getCursor('start'); + curEnd = cm.getCursor('end'); + } else { + var line = cm.getLine(curStart.line); + replaceTo = curStart.ch + actionArgs.repeat; + if (replaceTo > line.length) { + replaceTo=line.length; + } + curEnd = Pos(curStart.line, replaceTo); + } + if (replaceWith=='\n') { + if (!vim.visualMode) cm.replaceRange('', curStart, curEnd); + // special case, where vim help says to replace by just one line-break + (CodeMirror.commands.newlineAndIndentContinueComment || CodeMirror.commands.newlineAndIndent)(cm); + } else { + var replaceWithStr = cm.getRange(curStart, curEnd); + //replace all characters in range by selected, but keep linebreaks + replaceWithStr = replaceWithStr.replace(/[^\n]/g, replaceWith); + if (vim.visualBlock) { + // Tabs are split in visua block before replacing + var spaces = new Array(cm.getOption("tabSize")+1).join(' '); + replaceWithStr = cm.getSelection(); + replaceWithStr = replaceWithStr.replace(/\t/g, spaces).replace(/[^\n]/g, replaceWith).split('\n'); + cm.replaceSelections(replaceWithStr); + } else { + cm.replaceRange(replaceWithStr, curStart, curEnd); + } + if (vim.visualMode) { + curStart = cursorIsBefore(selections[0].anchor, selections[0].head) ? + selections[0].anchor : selections[0].head; + cm.setCursor(curStart); + exitVisualMode(cm, false); + } else { + cm.setCursor(offsetCursor(curEnd, 0, -1)); + } + } + }, + incrementNumberToken: function(cm, actionArgs) { + var cur = cm.getCursor(); + var lineStr = cm.getLine(cur.line); + var re = /-?\d+/g; + var match; + var start; + var end; + var numberStr; + var token; + while ((match = re.exec(lineStr)) !== null) { + token = match[0]; + start = match.index; + end = start + token.length; + if (cur.ch < end)break; + } + if (!actionArgs.backtrack && (end <= cur.ch))return; + if (token) { + var increment = actionArgs.increase ? 1 : -1; + var number = parseInt(token) + (increment * actionArgs.repeat); + var from = Pos(cur.line, start); + var to = Pos(cur.line, end); + numberStr = number.toString(); + cm.replaceRange(numberStr, from, to); + } else { + return; + } + cm.setCursor(Pos(cur.line, start + numberStr.length - 1)); + }, + repeatLastEdit: function(cm, actionArgs, vim) { + var lastEditInputState = vim.lastEditInputState; + if (!lastEditInputState) { return; } + var repeat = actionArgs.repeat; + if (repeat && actionArgs.repeatIsExplicit) { + vim.lastEditInputState.repeatOverride = repeat; + } else { + repeat = vim.lastEditInputState.repeatOverride || repeat; + } + repeatLastEdit(cm, vim, repeat, false /** repeatForInsert */); + }, + exitInsertMode: exitInsertMode + }; + + function defineAction(name, fn) { + actions[name] = fn; + } + + /* + * Below are miscellaneous utility functions used by vim.js + */ + + /** + * Clips cursor to ensure that line is within the buffer's range + * If includeLineBreak is true, then allow cur.ch == lineLength. + */ + function clipCursorToContent(cm, cur, includeLineBreak) { + var line = Math.min(Math.max(cm.firstLine(), cur.line), cm.lastLine() ); + var maxCh = lineLength(cm, line) - 1; + maxCh = (includeLineBreak) ? maxCh + 1 : maxCh; + var ch = Math.min(Math.max(0, cur.ch), maxCh); + return Pos(line, ch); + } + function copyArgs(args) { + var ret = {}; + for (var prop in args) { + if (args.hasOwnProperty(prop)) { + ret[prop] = args[prop]; + } + } + return ret; + } + function offsetCursor(cur, offsetLine, offsetCh) { + if (typeof offsetLine === 'object') { + offsetCh = offsetLine.ch; + offsetLine = offsetLine.line; + } + return Pos(cur.line + offsetLine, cur.ch + offsetCh); + } + function getOffset(anchor, head) { + return { + line: head.line - anchor.line, + ch: head.line - anchor.line + }; + } + function commandMatches(keys, keyMap, context, inputState) { + // Partial matches are not applied. They inform the key handler + // that the current key sequence is a subsequence of a valid key + // sequence, so that the key buffer is not cleared. + var match, partial = [], full = []; + for (var i = 0; i < keyMap.length; i++) { + var command = keyMap[i]; + if (context == 'insert' && command.context != 'insert' || + command.context && command.context != context || + inputState.operator && command.type == 'action' || + !(match = commandMatch(keys, command.keys))) { continue; } + if (match == 'partial') { partial.push(command); } + if (match == 'full') { full.push(command); } + } + return { + partial: partial.length && partial, + full: full.length && full + }; + } + function commandMatch(pressed, mapped) { + if (mapped.slice(-11) == '') { + // Last character matches anything. + var prefixLen = mapped.length - 11; + var pressedPrefix = pressed.slice(0, prefixLen); + var mappedPrefix = mapped.slice(0, prefixLen); + return pressedPrefix == mappedPrefix && pressed.length > prefixLen ? 'full' : + mappedPrefix.indexOf(pressedPrefix) == 0 ? 'partial' : false; + } else { + return pressed == mapped ? 'full' : + mapped.indexOf(pressed) == 0 ? 'partial' : false; + } + } + function lastChar(keys) { + var match = /^.*(<[\w\-]+>)$/.exec(keys); + var selectedCharacter = match ? match[1] : keys.slice(-1); + if (selectedCharacter.length > 1){ + switch(selectedCharacter){ + case '': + selectedCharacter='\n'; + break; + case '': + selectedCharacter=' '; + break; + default: + break; + } + } + return selectedCharacter; + } + function repeatFn(cm, fn, repeat) { + return function() { + for (var i = 0; i < repeat; i++) { + fn(cm); + } + }; + } + function copyCursor(cur) { + return Pos(cur.line, cur.ch); + } + function cursorEqual(cur1, cur2) { + return cur1.ch == cur2.ch && cur1.line == cur2.line; + } + function cursorIsBefore(cur1, cur2) { + if (cur1.line < cur2.line) { + return true; + } + if (cur1.line == cur2.line && cur1.ch < cur2.ch) { + return true; + } + return false; + } + function cursorMin(cur1, cur2) { + if (arguments.length > 2) { + cur2 = cursorMin.apply(undefined, Array.prototype.slice.call(arguments, 1)); + } + return cursorIsBefore(cur1, cur2) ? cur1 : cur2; + } + function cursorMax(cur1, cur2) { + if (arguments.length > 2) { + cur2 = cursorMax.apply(undefined, Array.prototype.slice.call(arguments, 1)); + } + return cursorIsBefore(cur1, cur2) ? cur2 : cur1; + } + function cursorIsBetween(cur1, cur2, cur3) { + // returns true if cur2 is between cur1 and cur3. + var cur1before2 = cursorIsBefore(cur1, cur2); + var cur2before3 = cursorIsBefore(cur2, cur3); + return cur1before2 && cur2before3; + } + function lineLength(cm, lineNum) { + return cm.getLine(lineNum).length; + } + function trim(s) { + if (s.trim) { + return s.trim(); + } + return s.replace(/^\s+|\s+$/g, ''); + } + function escapeRegex(s) { + return s.replace(/([.?*+$\[\]\/\\(){}|\-])/g, '\\$1'); + } + function extendLineToColumn(cm, lineNum, column) { + var endCh = lineLength(cm, lineNum); + var spaces = new Array(column-endCh+1).join(' '); + cm.setCursor(Pos(lineNum, endCh)); + cm.replaceRange(spaces, cm.getCursor()); + } + // This functions selects a rectangular block + // of text with selectionEnd as any of its corner + // Height of block: + // Difference in selectionEnd.line and first/last selection.line + // Width of the block: + // Distance between selectionEnd.ch and any(first considered here) selection.ch + function selectBlock(cm, selectionEnd) { + var selections = [], ranges = cm.listSelections(); + var head = copyCursor(cm.clipPos(selectionEnd)); + var isClipped = !cursorEqual(selectionEnd, head); + var curHead = cm.getCursor('head'); + var primIndex = getIndex(ranges, curHead); + var wasClipped = cursorEqual(ranges[primIndex].head, ranges[primIndex].anchor); + var max = ranges.length - 1; + var index = max - primIndex > primIndex ? max : 0; + var base = ranges[index].anchor; + + var firstLine = Math.min(base.line, head.line); + var lastLine = Math.max(base.line, head.line); + var baseCh = base.ch, headCh = head.ch; + + var dir = ranges[index].head.ch - baseCh; + var newDir = headCh - baseCh; + if (dir > 0 && newDir <= 0) { + baseCh++; + if (!isClipped) { headCh--; } + } else if (dir < 0 && newDir >= 0) { + baseCh--; + if (!wasClipped) { headCh++; } + } else if (dir < 0 && newDir == -1) { + baseCh--; + headCh++; + } + for (var line = firstLine; line <= lastLine; line++) { + var range = {anchor: new Pos(line, baseCh), head: new Pos(line, headCh)}; + selections.push(range); + } + primIndex = head.line == lastLine ? selections.length - 1 : 0; + cm.setSelections(selections); + selectionEnd.ch = headCh; + base.ch = baseCh; + return base; + } + function selectForInsert(cm, head, height) { + var sel = []; + for (var i = 0; i < height; i++) { + var lineHead = offsetCursor(head, i, 0); + sel.push({anchor: lineHead, head: lineHead}); + } + cm.setSelections(sel, 0); + } + // getIndex returns the index of the cursor in the selections. + function getIndex(ranges, cursor, end) { + for (var i = 0; i < ranges.length; i++) { + var atAnchor = end != 'head' && cursorEqual(ranges[i].anchor, cursor); + var atHead = end != 'anchor' && cursorEqual(ranges[i].head, cursor); + if (atAnchor || atHead) { + return i; + } + } + return -1; + } + function getSelectedAreaRange(cm, vim) { + var lastSelection = vim.lastSelection; + var getCurrentSelectedAreaRange = function() { + var selections = cm.listSelections(); + var start = selections[0]; + var end = selections[selections.length-1]; + var selectionStart = cursorIsBefore(start.anchor, start.head) ? start.anchor : start.head; + var selectionEnd = cursorIsBefore(end.anchor, end.head) ? end.head : end.anchor; + return [selectionStart, selectionEnd]; + }; + var getLastSelectedAreaRange = function() { + var selectionStart = cm.getCursor(); + var selectionEnd = cm.getCursor(); + var block = lastSelection.visualBlock; + if (block) { + var width = block.width; + var height = block.height; + selectionEnd = Pos(selectionStart.line + height, selectionStart.ch + width); + var selections = []; + // selectBlock creates a 'proper' rectangular block. + // We do not want that in all cases, so we manually set selections. + for (var i = selectionStart.line; i < selectionEnd.line; i++) { + var anchor = Pos(i, selectionStart.ch); + var head = Pos(i, selectionEnd.ch); + var range = {anchor: anchor, head: head}; + selections.push(range); + } + cm.setSelections(selections); + } else { + var start = lastSelection.anchorMark.find(); + var end = lastSelection.headMark.find(); + var line = end.line - start.line; + var ch = end.ch - start.ch; + selectionEnd = {line: selectionEnd.line + line, ch: line ? selectionEnd.ch : ch + selectionEnd.ch}; + if (lastSelection.visualLine) { + selectionStart = Pos(selectionStart.line, 0); + selectionEnd = Pos(selectionEnd.line, lineLength(cm, selectionEnd.line)); + } + cm.setSelection(selectionStart, selectionEnd); + } + return [selectionStart, selectionEnd]; + }; + if (!vim.visualMode) { + // In case of replaying the action. + return getLastSelectedAreaRange(); + } else { + return getCurrentSelectedAreaRange(); + } + } + // Updates the previous selection with the current selection's values. This + // should only be called in visual mode. + function updateLastSelection(cm, vim) { + var anchor = vim.sel.anchor; + var head = vim.sel.head; + // To accommodate the effect of lastPastedText in the last selection + if (vim.lastPastedText) { + head = cm.posFromIndex(cm.indexFromPos(anchor) + vim.lastPastedText.length); + vim.lastPastedText = null; + } + vim.lastSelection = {'anchorMark': cm.setBookmark(anchor), + 'headMark': cm.setBookmark(head), + 'anchor': copyCursor(anchor), + 'head': copyCursor(head), + 'visualMode': vim.visualMode, + 'visualLine': vim.visualLine, + 'visualBlock': vim.visualBlock}; + } + function expandSelection(cm, start, end) { + var sel = cm.state.vim.sel; + var head = sel.head; + var anchor = sel.anchor; + var tmp; + if (cursorIsBefore(end, start)) { + tmp = end; + end = start; + start = tmp; + } + if (cursorIsBefore(head, anchor)) { + head = cursorMin(start, head); + anchor = cursorMax(anchor, end); + } else { + anchor = cursorMin(start, anchor); + head = cursorMax(head, end); + head = offsetCursor(head, 0, -1); + if (head.ch == -1 && head.line != cm.firstLine()) { + head = Pos(head.line - 1, lineLength(cm, head.line - 1)); + } + } + return [anchor, head]; + } + /** + * Updates the CodeMirror selection to match the provided vim selection. + * If no arguments are given, it uses the current vim selection state. + */ + function updateCmSelection(cm, sel, mode) { + var vim = cm.state.vim; + sel = sel || vim.sel; + var mode = mode || + vim.visualLine ? 'line' : vim.visualBlock ? 'block' : 'char'; + var cmSel = makeCmSelection(cm, sel, mode); + cm.setSelections(cmSel.ranges, cmSel.primary); + updateFakeCursor(cm); + } + function makeCmSelection(cm, sel, mode, exclusive) { + var head = copyCursor(sel.head); + var anchor = copyCursor(sel.anchor); + if (mode == 'char') { + var headOffset = !exclusive && !cursorIsBefore(sel.head, sel.anchor) ? 1 : 0; + var anchorOffset = cursorIsBefore(sel.head, sel.anchor) ? 1 : 0; + head = offsetCursor(sel.head, 0, headOffset); + anchor = offsetCursor(sel.anchor, 0, anchorOffset); + return { + ranges: [{anchor: anchor, head: head}], + primary: 0 + }; + } else if (mode == 'line') { + if (!cursorIsBefore(sel.head, sel.anchor)) { + anchor.ch = 0; + + var lastLine = cm.lastLine(); + if (head.line > lastLine) { + head.line = lastLine; + } + head.ch = lineLength(cm, head.line); + } else { + head.ch = 0; + anchor.ch = lineLength(cm, anchor.line); + } + return { + ranges: [{anchor: anchor, head: head}], + primary: 0 + }; + } else if (mode == 'block') { + var top = Math.min(anchor.line, head.line), + left = Math.min(anchor.ch, head.ch), + bottom = Math.max(anchor.line, head.line), + right = Math.max(anchor.ch, head.ch) + 1; + var height = bottom - top + 1; + var primary = head.line == top ? 0 : height - 1; + var ranges = []; + for (var i = 0; i < height; i++) { + ranges.push({ + anchor: Pos(top + i, left), + head: Pos(top + i, right) + }); + } + return { + ranges: ranges, + primary: primary + }; + } + } + function getHead(cm) { + var cur = cm.getCursor('head'); + if (cm.getSelection().length == 1) { + // Small corner case when only 1 character is selected. The "real" + // head is the left of head and anchor. + cur = cursorMin(cur, cm.getCursor('anchor')); + } + return cur; + } + + /** + * If moveHead is set to false, the CodeMirror selection will not be + * touched. The caller assumes the responsibility of putting the cursor + * in the right place. + */ + function exitVisualMode(cm, moveHead) { + var vim = cm.state.vim; + if (moveHead !== false) { + cm.setCursor(clipCursorToContent(cm, vim.sel.head)); + } + updateLastSelection(cm, vim); + vim.visualMode = false; + vim.visualLine = false; + vim.visualBlock = false; + CodeMirror.signal(cm, "vim-mode-change", {mode: "normal"}); + if (vim.fakeCursor) { + vim.fakeCursor.clear(); + } + } + + // Remove any trailing newlines from the selection. For + // example, with the caret at the start of the last word on the line, + // 'dw' should word, but not the newline, while 'w' should advance the + // caret to the first character of the next line. + function clipToLine(cm, curStart, curEnd) { + var selection = cm.getRange(curStart, curEnd); + // Only clip if the selection ends with trailing newline + whitespace + if (/\n\s*$/.test(selection)) { + var lines = selection.split('\n'); + // We know this is all whitepsace. + lines.pop(); + + // Cases: + // 1. Last word is an empty line - do not clip the trailing '\n' + // 2. Last word is not an empty line - clip the trailing '\n' + var line; + // Find the line containing the last word, and clip all whitespace up + // to it. + for (var line = lines.pop(); lines.length > 0 && line && isWhiteSpaceString(line); line = lines.pop()) { + curEnd.line--; + curEnd.ch = 0; + } + // If the last word is not an empty line, clip an additional newline + if (line) { + curEnd.line--; + curEnd.ch = lineLength(cm, curEnd.line); + } else { + curEnd.ch = 0; + } + } + } + + // Expand the selection to line ends. + function expandSelectionToLine(_cm, curStart, curEnd) { + curStart.ch = 0; + curEnd.ch = 0; + curEnd.line++; + } + + function findFirstNonWhiteSpaceCharacter(text) { + if (!text) { + return 0; + } + var firstNonWS = text.search(/\S/); + return firstNonWS == -1 ? text.length : firstNonWS; + } + + function expandWordUnderCursor(cm, inclusive, _forward, bigWord, noSymbol) { + var cur = getHead(cm); + var line = cm.getLine(cur.line); + var idx = cur.ch; + + // Seek to first word or non-whitespace character, depending on if + // noSymbol is true. + var test = noSymbol ? wordCharTest[0] : bigWordCharTest [0]; + while (!test(line.charAt(idx))) { + idx++; + if (idx >= line.length) { return null; } + } + + if (bigWord) { + test = bigWordCharTest[0]; + } else { + test = wordCharTest[0]; + if (!test(line.charAt(idx))) { + test = wordCharTest[1]; + } + } + + var end = idx, start = idx; + while (test(line.charAt(end)) && end < line.length) { end++; } + while (test(line.charAt(start)) && start >= 0) { start--; } + start++; + + if (inclusive) { + // If present, include all whitespace after word. + // Otherwise, include all whitespace before word, except indentation. + var wordEnd = end; + while (/\s/.test(line.charAt(end)) && end < line.length) { end++; } + if (wordEnd == end) { + var wordStart = start; + while (/\s/.test(line.charAt(start - 1)) && start > 0) { start--; } + if (!start) { start = wordStart; } + } + } + return { start: Pos(cur.line, start), end: Pos(cur.line, end) }; + } + + function recordJumpPosition(cm, oldCur, newCur) { + if (!cursorEqual(oldCur, newCur)) { + vimGlobalState.jumpList.add(cm, oldCur, newCur); + } + } + + function recordLastCharacterSearch(increment, args) { + vimGlobalState.lastChararacterSearch.increment = increment; + vimGlobalState.lastChararacterSearch.forward = args.forward; + vimGlobalState.lastChararacterSearch.selectedCharacter = args.selectedCharacter; + } + + var symbolToMode = { + '(': 'bracket', ')': 'bracket', '{': 'bracket', '}': 'bracket', + '[': 'section', ']': 'section', + '*': 'comment', '/': 'comment', + 'm': 'method', 'M': 'method', + '#': 'preprocess' + }; + var findSymbolModes = { + bracket: { + isComplete: function(state) { + if (state.nextCh === state.symb) { + state.depth++; + if (state.depth >= 1)return true; + } else if (state.nextCh === state.reverseSymb) { + state.depth--; + } + return false; + } + }, + section: { + init: function(state) { + state.curMoveThrough = true; + state.symb = (state.forward ? ']' : '[') === state.symb ? '{' : '}'; + }, + isComplete: function(state) { + return state.index === 0 && state.nextCh === state.symb; + } + }, + comment: { + isComplete: function(state) { + var found = state.lastCh === '*' && state.nextCh === '/'; + state.lastCh = state.nextCh; + return found; + } + }, + // TODO: The original Vim implementation only operates on level 1 and 2. + // The current implementation doesn't check for code block level and + // therefore it operates on any levels. + method: { + init: function(state) { + state.symb = (state.symb === 'm' ? '{' : '}'); + state.reverseSymb = state.symb === '{' ? '}' : '{'; + }, + isComplete: function(state) { + if (state.nextCh === state.symb)return true; + return false; + } + }, + preprocess: { + init: function(state) { + state.index = 0; + }, + isComplete: function(state) { + if (state.nextCh === '#') { + var token = state.lineText.match(/#(\w+)/)[1]; + if (token === 'endif') { + if (state.forward && state.depth === 0) { + return true; + } + state.depth++; + } else if (token === 'if') { + if (!state.forward && state.depth === 0) { + return true; + } + state.depth--; + } + if (token === 'else' && state.depth === 0)return true; + } + return false; + } + } + }; + function findSymbol(cm, repeat, forward, symb) { + var cur = copyCursor(cm.getCursor()); + var increment = forward ? 1 : -1; + var endLine = forward ? cm.lineCount() : -1; + var curCh = cur.ch; + var line = cur.line; + var lineText = cm.getLine(line); + var state = { + lineText: lineText, + nextCh: lineText.charAt(curCh), + lastCh: null, + index: curCh, + symb: symb, + reverseSymb: (forward ? { ')': '(', '}': '{' } : { '(': ')', '{': '}' })[symb], + forward: forward, + depth: 0, + curMoveThrough: false + }; + var mode = symbolToMode[symb]; + if (!mode)return cur; + var init = findSymbolModes[mode].init; + var isComplete = findSymbolModes[mode].isComplete; + if (init) { init(state); } + while (line !== endLine && repeat) { + state.index += increment; + state.nextCh = state.lineText.charAt(state.index); + if (!state.nextCh) { + line += increment; + state.lineText = cm.getLine(line) || ''; + if (increment > 0) { + state.index = 0; + } else { + var lineLen = state.lineText.length; + state.index = (lineLen > 0) ? (lineLen-1) : 0; + } + state.nextCh = state.lineText.charAt(state.index); + } + if (isComplete(state)) { + cur.line = line; + cur.ch = state.index; + repeat--; + } + } + if (state.nextCh || state.curMoveThrough) { + return Pos(line, state.index); + } + return cur; + } + + /* + * Returns the boundaries of the next word. If the cursor in the middle of + * the word, then returns the boundaries of the current word, starting at + * the cursor. If the cursor is at the start/end of a word, and we are going + * forward/backward, respectively, find the boundaries of the next word. + * + * @param {CodeMirror} cm CodeMirror object. + * @param {Cursor} cur The cursor position. + * @param {boolean} forward True to search forward. False to search + * backward. + * @param {boolean} bigWord True if punctuation count as part of the word. + * False if only [a-zA-Z0-9] characters count as part of the word. + * @param {boolean} emptyLineIsWord True if empty lines should be treated + * as words. + * @return {Object{from:number, to:number, line: number}} The boundaries of + * the word, or null if there are no more words. + */ + function findWord(cm, cur, forward, bigWord, emptyLineIsWord) { + var lineNum = cur.line; + var pos = cur.ch; + var line = cm.getLine(lineNum); + var dir = forward ? 1 : -1; + var charTests = bigWord ? bigWordCharTest: wordCharTest; + + if (emptyLineIsWord && line == '') { + lineNum += dir; + line = cm.getLine(lineNum); + if (!isLine(cm, lineNum)) { + return null; + } + pos = (forward) ? 0 : line.length; + } + + while (true) { + if (emptyLineIsWord && line == '') { + return { from: 0, to: 0, line: lineNum }; + } + var stop = (dir > 0) ? line.length : -1; + var wordStart = stop, wordEnd = stop; + // Find bounds of next word. + while (pos != stop) { + var foundWord = false; + for (var i = 0; i < charTests.length && !foundWord; ++i) { + if (charTests[i](line.charAt(pos))) { + wordStart = pos; + // Advance to end of word. + while (pos != stop && charTests[i](line.charAt(pos))) { + pos += dir; + } + wordEnd = pos; + foundWord = wordStart != wordEnd; + if (wordStart == cur.ch && lineNum == cur.line && + wordEnd == wordStart + dir) { + // We started at the end of a word. Find the next one. + continue; + } else { + return { + from: Math.min(wordStart, wordEnd + 1), + to: Math.max(wordStart, wordEnd), + line: lineNum }; + } + } + } + if (!foundWord) { + pos += dir; + } + } + // Advance to next/prev line. + lineNum += dir; + if (!isLine(cm, lineNum)) { + return null; + } + line = cm.getLine(lineNum); + pos = (dir > 0) ? 0 : line.length; + } + // Should never get here. + throw new Error('The impossible happened.'); + } + + /** + * @param {CodeMirror} cm CodeMirror object. + * @param {Pos} cur The position to start from. + * @param {int} repeat Number of words to move past. + * @param {boolean} forward True to search forward. False to search + * backward. + * @param {boolean} wordEnd True to move to end of word. False to move to + * beginning of word. + * @param {boolean} bigWord True if punctuation count as part of the word. + * False if only alphabet characters count as part of the word. + * @return {Cursor} The position the cursor should move to. + */ + function moveToWord(cm, cur, repeat, forward, wordEnd, bigWord) { + var curStart = copyCursor(cur); + var words = []; + if (forward && !wordEnd || !forward && wordEnd) { + repeat++; + } + // For 'e', empty lines are not considered words, go figure. + var emptyLineIsWord = !(forward && wordEnd); + for (var i = 0; i < repeat; i++) { + var word = findWord(cm, cur, forward, bigWord, emptyLineIsWord); + if (!word) { + var eodCh = lineLength(cm, cm.lastLine()); + words.push(forward + ? {line: cm.lastLine(), from: eodCh, to: eodCh} + : {line: 0, from: 0, to: 0}); + break; + } + words.push(word); + cur = Pos(word.line, forward ? (word.to - 1) : word.from); + } + var shortCircuit = words.length != repeat; + var firstWord = words[0]; + var lastWord = words.pop(); + if (forward && !wordEnd) { + // w + if (!shortCircuit && (firstWord.from != curStart.ch || firstWord.line != curStart.line)) { + // We did not start in the middle of a word. Discard the extra word at the end. + lastWord = words.pop(); + } + return Pos(lastWord.line, lastWord.from); + } else if (forward && wordEnd) { + return Pos(lastWord.line, lastWord.to - 1); + } else if (!forward && wordEnd) { + // ge + if (!shortCircuit && (firstWord.to != curStart.ch || firstWord.line != curStart.line)) { + // We did not start in the middle of a word. Discard the extra word at the end. + lastWord = words.pop(); + } + return Pos(lastWord.line, lastWord.to); + } else { + // b + return Pos(lastWord.line, lastWord.from); + } + } + + function moveToCharacter(cm, repeat, forward, character) { + var cur = cm.getCursor(); + var start = cur.ch; + var idx; + for (var i = 0; i < repeat; i ++) { + var line = cm.getLine(cur.line); + idx = charIdxInLine(start, line, character, forward, true); + if (idx == -1) { + return null; + } + start = idx; + } + return Pos(cm.getCursor().line, idx); + } + + function moveToColumn(cm, repeat) { + // repeat is always >= 1, so repeat - 1 always corresponds + // to the column we want to go to. + var line = cm.getCursor().line; + return clipCursorToContent(cm, Pos(line, repeat - 1)); + } + + function updateMark(cm, vim, markName, pos) { + if (!inArray(markName, validMarks)) { + return; + } + if (vim.marks[markName]) { + vim.marks[markName].clear(); + } + vim.marks[markName] = cm.setBookmark(pos); + } + + function charIdxInLine(start, line, character, forward, includeChar) { + // Search for char in line. + // motion_options: {forward, includeChar} + // If includeChar = true, include it too. + // If forward = true, search forward, else search backwards. + // If char is not found on this line, do nothing + var idx; + if (forward) { + idx = line.indexOf(character, start + 1); + if (idx != -1 && !includeChar) { + idx -= 1; + } + } else { + idx = line.lastIndexOf(character, start - 1); + if (idx != -1 && !includeChar) { + idx += 1; + } + } + return idx; + } + + function findParagraph(cm, head, repeat, dir, inclusive) { + var line = head.line; + var min = cm.firstLine(); + var max = cm.lastLine(); + var start, end, i = line; + function isEmpty(i) { return !cm.getLine(i); } + function isBoundary(i, dir, any) { + if (any) { return isEmpty(i) != isEmpty(i + dir); } + return !isEmpty(i) && isEmpty(i + dir); + } + if (dir) { + while (min <= i && i <= max && repeat > 0) { + if (isBoundary(i, dir)) { repeat--; } + i += dir; + } + return new Pos(i, 0); + } + + var vim = cm.state.vim; + if (vim.visualLine && isBoundary(line, 1, true)) { + var anchor = vim.sel.anchor; + if (isBoundary(anchor.line, -1, true)) { + if (!inclusive || anchor.line != line) { + line += 1; + } + } + } + var startState = isEmpty(line); + for (i = line; i <= max && repeat; i++) { + if (isBoundary(i, 1, true)) { + if (!inclusive || isEmpty(i) != startState) { + repeat--; + } + } + } + end = new Pos(i, 0); + // select boundary before paragraph for the last one + if (i > max && !startState) { startState = true; } + else { inclusive = false; } + for (i = line; i > min; i--) { + if (!inclusive || isEmpty(i) == startState || i == line) { + if (isBoundary(i, -1, true)) { break; } + } + } + start = new Pos(i, 0); + return { start: start, end: end }; + } + + // TODO: perhaps this finagling of start and end positions belonds + // in codmirror/replaceRange? + function selectCompanionObject(cm, head, symb, inclusive) { + var cur = head, start, end; + + var bracketRegexp = ({ + '(': /[()]/, ')': /[()]/, + '[': /[[\]]/, ']': /[[\]]/, + '{': /[{}]/, '}': /[{}]/})[symb]; + var openSym = ({ + '(': '(', ')': '(', + '[': '[', ']': '[', + '{': '{', '}': '{'})[symb]; + var curChar = cm.getLine(cur.line).charAt(cur.ch); + // Due to the behavior of scanForBracket, we need to add an offset if the + // cursor is on a matching open bracket. + var offset = curChar === openSym ? 1 : 0; + + start = cm.scanForBracket(Pos(cur.line, cur.ch + offset), -1, null, {'bracketRegex': bracketRegexp}); + end = cm.scanForBracket(Pos(cur.line, cur.ch + offset), 1, null, {'bracketRegex': bracketRegexp}); + + if (!start || !end) { + return { start: cur, end: cur }; + } + + start = start.pos; + end = end.pos; + + if ((start.line == end.line && start.ch > end.ch) + || (start.line > end.line)) { + var tmp = start; + start = end; + end = tmp; + } + + if (inclusive) { + end.ch += 1; + } else { + start.ch += 1; + } + + return { start: start, end: end }; + } + + // Takes in a symbol and a cursor and tries to simulate text objects that + // have identical opening and closing symbols + // TODO support across multiple lines + function findBeginningAndEnd(cm, head, symb, inclusive) { + var cur = copyCursor(head); + var line = cm.getLine(cur.line); + var chars = line.split(''); + var start, end, i, len; + var firstIndex = chars.indexOf(symb); + + // the decision tree is to always look backwards for the beginning first, + // but if the cursor is in front of the first instance of the symb, + // then move the cursor forward + if (cur.ch < firstIndex) { + cur.ch = firstIndex; + // Why is this line even here??? + // cm.setCursor(cur.line, firstIndex+1); + } + // otherwise if the cursor is currently on the closing symbol + else if (firstIndex < cur.ch && chars[cur.ch] == symb) { + end = cur.ch; // assign end to the current cursor + --cur.ch; // make sure to look backwards + } + + // if we're currently on the symbol, we've got a start + if (chars[cur.ch] == symb && !end) { + start = cur.ch + 1; // assign start to ahead of the cursor + } else { + // go backwards to find the start + for (i = cur.ch; i > -1 && !start; i--) { + if (chars[i] == symb) { + start = i + 1; + } + } + } + + // look forwards for the end symbol + if (start && !end) { + for (i = start, len = chars.length; i < len && !end; i++) { + if (chars[i] == symb) { + end = i; + } + } + } + + // nothing found + if (!start || !end) { + return { start: cur, end: cur }; + } + + // include the symbols + if (inclusive) { + --start; ++end; + } + + return { + start: Pos(cur.line, start), + end: Pos(cur.line, end) + }; + } + + // Search functions + defineOption('pcre', true, 'boolean'); + function SearchState() {} + SearchState.prototype = { + getQuery: function() { + return vimGlobalState.query; + }, + setQuery: function(query) { + vimGlobalState.query = query; + }, + getOverlay: function() { + return this.searchOverlay; + }, + setOverlay: function(overlay) { + this.searchOverlay = overlay; + }, + isReversed: function() { + return vimGlobalState.isReversed; + }, + setReversed: function(reversed) { + vimGlobalState.isReversed = reversed; + }, + getScrollbarAnnotate: function() { + return this.annotate; + }, + setScrollbarAnnotate: function(annotate) { + this.annotate = annotate; + } + }; + function getSearchState(cm) { + var vim = cm.state.vim; + return vim.searchState_ || (vim.searchState_ = new SearchState()); + } + function dialog(cm, template, shortText, onClose, options) { + if (cm.openDialog) { + cm.openDialog(template, onClose, { bottom: true, value: options.value, + onKeyDown: options.onKeyDown, onKeyUp: options.onKeyUp, + selectValueOnOpen: false}); + } + else { + onClose(prompt(shortText, '')); + } + } + function splitBySlash(argString) { + var slashes = findUnescapedSlashes(argString) || []; + if (!slashes.length) return []; + var tokens = []; + // in case of strings like foo/bar + if (slashes[0] !== 0) return; + for (var i = 0; i < slashes.length; i++) { + if (typeof slashes[i] == 'number') + tokens.push(argString.substring(slashes[i] + 1, slashes[i+1])); + } + return tokens; + } + + function findUnescapedSlashes(str) { + var escapeNextChar = false; + var slashes = []; + for (var i = 0; i < str.length; i++) { + var c = str.charAt(i); + if (!escapeNextChar && c == '/') { + slashes.push(i); + } + escapeNextChar = !escapeNextChar && (c == '\\'); + } + return slashes; + } + + // Translates a search string from ex (vim) syntax into javascript form. + function translateRegex(str) { + // When these match, add a '\' if unescaped or remove one if escaped. + var specials = '|(){'; + // Remove, but never add, a '\' for these. + var unescape = '}'; + var escapeNextChar = false; + var out = []; + for (var i = -1; i < str.length; i++) { + var c = str.charAt(i) || ''; + var n = str.charAt(i+1) || ''; + var specialComesNext = (n && specials.indexOf(n) != -1); + if (escapeNextChar) { + if (c !== '\\' || !specialComesNext) { + out.push(c); + } + escapeNextChar = false; + } else { + if (c === '\\') { + escapeNextChar = true; + // Treat the unescape list as special for removing, but not adding '\'. + if (n && unescape.indexOf(n) != -1) { + specialComesNext = true; + } + // Not passing this test means removing a '\'. + if (!specialComesNext || n === '\\') { + out.push(c); + } + } else { + out.push(c); + if (specialComesNext && n !== '\\') { + out.push('\\'); + } + } + } + } + return out.join(''); + } + + // Translates the replace part of a search and replace from ex (vim) syntax into + // javascript form. Similar to translateRegex, but additionally fixes back references + // (translates '\[0..9]' to '$[0..9]') and follows different rules for escaping '$'. + var charUnescapes = {'\\n': '\n', '\\r': '\r', '\\t': '\t'}; + function translateRegexReplace(str) { + var escapeNextChar = false; + var out = []; + for (var i = -1; i < str.length; i++) { + var c = str.charAt(i) || ''; + var n = str.charAt(i+1) || ''; + if (charUnescapes[c + n]) { + out.push(charUnescapes[c+n]); + i++; + } else if (escapeNextChar) { + // At any point in the loop, escapeNextChar is true if the previous + // character was a '\' and was not escaped. + out.push(c); + escapeNextChar = false; + } else { + if (c === '\\') { + escapeNextChar = true; + if ((isNumber(n) || n === '$')) { + out.push('$'); + } else if (n !== '/' && n !== '\\') { + out.push('\\'); + } + } else { + if (c === '$') { + out.push('$'); + } + out.push(c); + if (n === '/') { + out.push('\\'); + } + } + } + } + return out.join(''); + } + + // Unescape \ and / in the replace part, for PCRE mode. + var unescapes = {'\\/': '/', '\\\\': '\\', '\\n': '\n', '\\r': '\r', '\\t': '\t'}; + function unescapeRegexReplace(str) { + var stream = new CodeMirror.StringStream(str); + var output = []; + while (!stream.eol()) { + // Search for \. + while (stream.peek() && stream.peek() != '\\') { + output.push(stream.next()); + } + var matched = false; + for (var matcher in unescapes) { + if (stream.match(matcher, true)) { + matched = true; + output.push(unescapes[matcher]); + break; + } + } + if (!matched) { + // Don't change anything + output.push(stream.next()); + } + } + return output.join(''); + } + + /** + * Extract the regular expression from the query and return a Regexp object. + * Returns null if the query is blank. + * If ignoreCase is passed in, the Regexp object will have the 'i' flag set. + * If smartCase is passed in, and the query contains upper case letters, + * then ignoreCase is overridden, and the 'i' flag will not be set. + * If the query contains the /i in the flag part of the regular expression, + * then both ignoreCase and smartCase are ignored, and 'i' will be passed + * through to the Regex object. + */ + function parseQuery(query, ignoreCase, smartCase) { + // First update the last search register + var lastSearchRegister = vimGlobalState.registerController.getRegister('/'); + lastSearchRegister.setText(query); + // Check if the query is already a regex. + if (query instanceof RegExp) { return query; } + // First try to extract regex + flags from the input. If no flags found, + // extract just the regex. IE does not accept flags directly defined in + // the regex string in the form /regex/flags + var slashes = findUnescapedSlashes(query); + var regexPart; + var forceIgnoreCase; + if (!slashes.length) { + // Query looks like 'regexp' + regexPart = query; + } else { + // Query looks like 'regexp/...' + regexPart = query.substring(0, slashes[0]); + var flagsPart = query.substring(slashes[0]); + forceIgnoreCase = (flagsPart.indexOf('i') != -1); + } + if (!regexPart) { + return null; + } + if (!getOption('pcre')) { + regexPart = translateRegex(regexPart); + } + if (smartCase) { + ignoreCase = (/^[^A-Z]*$/).test(regexPart); + } + var regexp = new RegExp(regexPart, + (ignoreCase || forceIgnoreCase) ? 'i' : undefined); + return regexp; + } + function showConfirm(cm, text) { + if (cm.openNotification) { + cm.openNotification('' + text + '', + {bottom: true, duration: 5000}); + } else { + alert(text); + } + } + function makePrompt(prefix, desc) { + var raw = ''; + if (prefix) { + raw += '' + prefix + ''; + } + raw += ' ' + + ''; + if (desc) { + raw += ''; + raw += desc; + raw += ''; + } + return raw; + } + var searchPromptDesc = '(Javascript regexp)'; + function showPrompt(cm, options) { + var shortText = (options.prefix || '') + ' ' + (options.desc || ''); + var prompt = makePrompt(options.prefix, options.desc); + dialog(cm, prompt, shortText, options.onClose, options); + } + function regexEqual(r1, r2) { + if (r1 instanceof RegExp && r2 instanceof RegExp) { + var props = ['global', 'multiline', 'ignoreCase', 'source']; + for (var i = 0; i < props.length; i++) { + var prop = props[i]; + if (r1[prop] !== r2[prop]) { + return false; + } + } + return true; + } + return false; + } + // Returns true if the query is valid. + function updateSearchQuery(cm, rawQuery, ignoreCase, smartCase) { + if (!rawQuery) { + return; + } + var state = getSearchState(cm); + var query = parseQuery(rawQuery, !!ignoreCase, !!smartCase); + if (!query) { + return; + } + highlightSearchMatches(cm, query); + if (regexEqual(query, state.getQuery())) { + return query; + } + state.setQuery(query); + return query; + } + function searchOverlay(query) { + if (query.source.charAt(0) == '^') { + var matchSol = true; + } + return { + token: function(stream) { + if (matchSol && !stream.sol()) { + stream.skipToEnd(); + return; + } + var match = stream.match(query, false); + if (match) { + if (match[0].length == 0) { + // Matched empty string, skip to next. + stream.next(); + return 'searching'; + } + if (!stream.sol()) { + // Backtrack 1 to match \b + stream.backUp(1); + if (!query.exec(stream.next() + match[0])) { + stream.next(); + return null; + } + } + stream.match(query); + return 'searching'; + } + while (!stream.eol()) { + stream.next(); + if (stream.match(query, false)) break; + } + }, + query: query + }; + } + function highlightSearchMatches(cm, query) { + var searchState = getSearchState(cm); + var overlay = searchState.getOverlay(); + if (!overlay || query != overlay.query) { + if (overlay) { + cm.removeOverlay(overlay); + } + overlay = searchOverlay(query); + cm.addOverlay(overlay); + if (cm.showMatchesOnScrollbar) { + if (searchState.getScrollbarAnnotate()) { + searchState.getScrollbarAnnotate().clear(); + } + searchState.setScrollbarAnnotate(cm.showMatchesOnScrollbar(query)); + } + searchState.setOverlay(overlay); + } + } + function findNext(cm, prev, query, repeat) { + if (repeat === undefined) { repeat = 1; } + return cm.operation(function() { + var pos = cm.getCursor(); + var cursor = cm.getSearchCursor(query, pos); + for (var i = 0; i < repeat; i++) { + var found = cursor.find(prev); + if (i == 0 && found && cursorEqual(cursor.from(), pos)) { found = cursor.find(prev); } + if (!found) { + // SearchCursor may have returned null because it hit EOF, wrap + // around and try again. + cursor = cm.getSearchCursor(query, + (prev) ? Pos(cm.lastLine()) : Pos(cm.firstLine(), 0) ); + if (!cursor.find(prev)) { + return; + } + } + } + return cursor.from(); + }); + } + function clearSearchHighlight(cm) { + var state = getSearchState(cm); + cm.removeOverlay(getSearchState(cm).getOverlay()); + state.setOverlay(null); + if (state.getScrollbarAnnotate()) { + state.getScrollbarAnnotate().clear(); + state.setScrollbarAnnotate(null); + } + } + /** + * Check if pos is in the specified range, INCLUSIVE. + * Range can be specified with 1 or 2 arguments. + * If the first range argument is an array, treat it as an array of line + * numbers. Match pos against any of the lines. + * If the first range argument is a number, + * if there is only 1 range argument, check if pos has the same line + * number + * if there are 2 range arguments, then check if pos is in between the two + * range arguments. + */ + function isInRange(pos, start, end) { + if (typeof pos != 'number') { + // Assume it is a cursor position. Get the line number. + pos = pos.line; + } + if (start instanceof Array) { + return inArray(pos, start); + } else { + if (end) { + return (pos >= start && pos <= end); + } else { + return pos == start; + } + } + } + function getUserVisibleLines(cm) { + var scrollInfo = cm.getScrollInfo(); + var occludeToleranceTop = 6; + var occludeToleranceBottom = 10; + var from = cm.coordsChar({left:0, top: occludeToleranceTop + scrollInfo.top}, 'local'); + var bottomY = scrollInfo.clientHeight - occludeToleranceBottom + scrollInfo.top; + var to = cm.coordsChar({left:0, top: bottomY}, 'local'); + return {top: from.line, bottom: to.line}; + } + + var ExCommandDispatcher = function() { + this.buildCommandMap_(); + }; + ExCommandDispatcher.prototype = { + processCommand: function(cm, input, opt_params) { + var that = this; + cm.operation(function () { + cm.curOp.isVimOp = true; + that._processCommand(cm, input, opt_params); + }); + }, + _processCommand: function(cm, input, opt_params) { + var vim = cm.state.vim; + var commandHistoryRegister = vimGlobalState.registerController.getRegister(':'); + var previousCommand = commandHistoryRegister.toString(); + if (vim.visualMode) { + exitVisualMode(cm); + } + var inputStream = new CodeMirror.StringStream(input); + // update ": with the latest command whether valid or invalid + commandHistoryRegister.setText(input); + var params = opt_params || {}; + params.input = input; + try { + this.parseInput_(cm, inputStream, params); + } catch(e) { + showConfirm(cm, e); + throw e; + } + var command; + var commandName; + if (!params.commandName) { + // If only a line range is defined, move to the line. + if (params.line !== undefined) { + commandName = 'move'; + } + } else { + command = this.matchCommand_(params.commandName); + if (command) { + commandName = command.name; + if (command.excludeFromCommandHistory) { + commandHistoryRegister.setText(previousCommand); + } + this.parseCommandArgs_(inputStream, params, command); + if (command.type == 'exToKey') { + // Handle Ex to Key mapping. + for (var i = 0; i < command.toKeys.length; i++) { + CodeMirror.Vim.handleKey(cm, command.toKeys[i], 'mapping'); + } + return; + } else if (command.type == 'exToEx') { + // Handle Ex to Ex mapping. + this.processCommand(cm, command.toInput); + return; + } + } + } + if (!commandName) { + showConfirm(cm, 'Not an editor command ":' + input + '"'); + return; + } + try { + exCommands[commandName](cm, params); + // Possibly asynchronous commands (e.g. substitute, which might have a + // user confirmation), are responsible for calling the callback when + // done. All others have it taken care of for them here. + if ((!command || !command.possiblyAsync) && params.callback) { + params.callback(); + } + } catch(e) { + showConfirm(cm, e); + throw e; + } + }, + parseInput_: function(cm, inputStream, result) { + inputStream.eatWhile(':'); + // Parse range. + if (inputStream.eat('%')) { + result.line = cm.firstLine(); + result.lineEnd = cm.lastLine(); + } else { + result.line = this.parseLineSpec_(cm, inputStream); + if (result.line !== undefined && inputStream.eat(',')) { + result.lineEnd = this.parseLineSpec_(cm, inputStream); + } + } + + // Parse command name. + var commandMatch = inputStream.match(/^(\w+)/); + if (commandMatch) { + result.commandName = commandMatch[1]; + } else { + result.commandName = inputStream.match(/.*/)[0]; + } + + return result; + }, + parseLineSpec_: function(cm, inputStream) { + var numberMatch = inputStream.match(/^(\d+)/); + if (numberMatch) { + return parseInt(numberMatch[1], 10) - 1; + } + switch (inputStream.next()) { + case '.': + return cm.getCursor().line; + case '$': + return cm.lastLine(); + case '\'': + var mark = cm.state.vim.marks[inputStream.next()]; + if (mark && mark.find()) { + return mark.find().line; + } + throw new Error('Mark not set'); + default: + inputStream.backUp(1); + return undefined; + } + }, + parseCommandArgs_: function(inputStream, params, command) { + if (inputStream.eol()) { + return; + } + params.argString = inputStream.match(/.*/)[0]; + // Parse command-line arguments + var delim = command.argDelimiter || /\s+/; + var args = trim(params.argString).split(delim); + if (args.length && args[0]) { + params.args = args; + } + }, + matchCommand_: function(commandName) { + // Return the command in the command map that matches the shortest + // prefix of the passed in command name. The match is guaranteed to be + // unambiguous if the defaultExCommandMap's shortNames are set up + // correctly. (see @code{defaultExCommandMap}). + for (var i = commandName.length; i > 0; i--) { + var prefix = commandName.substring(0, i); + if (this.commandMap_[prefix]) { + var command = this.commandMap_[prefix]; + if (command.name.indexOf(commandName) === 0) { + return command; + } + } + } + return null; + }, + buildCommandMap_: function() { + this.commandMap_ = {}; + for (var i = 0; i < defaultExCommandMap.length; i++) { + var command = defaultExCommandMap[i]; + var key = command.shortName || command.name; + this.commandMap_[key] = command; + } + }, + map: function(lhs, rhs, ctx) { + if (lhs != ':' && lhs.charAt(0) == ':') { + if (ctx) { throw Error('Mode not supported for ex mappings'); } + var commandName = lhs.substring(1); + if (rhs != ':' && rhs.charAt(0) == ':') { + // Ex to Ex mapping + this.commandMap_[commandName] = { + name: commandName, + type: 'exToEx', + toInput: rhs.substring(1), + user: true + }; + } else { + // Ex to key mapping + this.commandMap_[commandName] = { + name: commandName, + type: 'exToKey', + toKeys: rhs, + user: true + }; + } + } else { + if (rhs != ':' && rhs.charAt(0) == ':') { + // Key to Ex mapping. + var mapping = { + keys: lhs, + type: 'keyToEx', + exArgs: { input: rhs.substring(1) }, + user: true}; + if (ctx) { mapping.context = ctx; } + defaultKeymap.unshift(mapping); + } else { + // Key to key mapping + var mapping = { + keys: lhs, + type: 'keyToKey', + toKeys: rhs, + user: true + }; + if (ctx) { mapping.context = ctx; } + defaultKeymap.unshift(mapping); + } + } + }, + unmap: function(lhs, ctx) { + if (lhs != ':' && lhs.charAt(0) == ':') { + // Ex to Ex or Ex to key mapping + if (ctx) { throw Error('Mode not supported for ex mappings'); } + var commandName = lhs.substring(1); + if (this.commandMap_[commandName] && this.commandMap_[commandName].user) { + delete this.commandMap_[commandName]; + return; + } + } else { + // Key to Ex or key to key mapping + var keys = lhs; + for (var i = 0; i < defaultKeymap.length; i++) { + if (keys == defaultKeymap[i].keys + && defaultKeymap[i].context === ctx + && defaultKeymap[i].user) { + defaultKeymap.splice(i, 1); + return; + } + } + } + throw Error('No such mapping.'); + } + }; + + var exCommands = { + colorscheme: function(cm, params) { + if (!params.args || params.args.length < 1) { + showConfirm(cm, cm.getOption('theme')); + return; + } + cm.setOption('theme', params.args[0]); + }, + map: function(cm, params, ctx) { + var mapArgs = params.args; + if (!mapArgs || mapArgs.length < 2) { + if (cm) { + showConfirm(cm, 'Invalid mapping: ' + params.input); + } + return; + } + exCommandDispatcher.map(mapArgs[0], mapArgs[1], ctx); + }, + imap: function(cm, params) { this.map(cm, params, 'insert'); }, + nmap: function(cm, params) { this.map(cm, params, 'normal'); }, + vmap: function(cm, params) { this.map(cm, params, 'visual'); }, + unmap: function(cm, params, ctx) { + var mapArgs = params.args; + if (!mapArgs || mapArgs.length < 1) { + if (cm) { + showConfirm(cm, 'No such mapping: ' + params.input); + } + return; + } + exCommandDispatcher.unmap(mapArgs[0], ctx); + }, + move: function(cm, params) { + commandDispatcher.processCommand(cm, cm.state.vim, { + type: 'motion', + motion: 'moveToLineOrEdgeOfDocument', + motionArgs: { forward: false, explicitRepeat: true, + linewise: true }, + repeatOverride: params.line+1}); + }, + set: function(cm, params) { + var setArgs = params.args; + // Options passed through to the setOption/getOption calls. May be passed in by the + // local/global versions of the set command + var setCfg = params.setCfg || {}; + if (!setArgs || setArgs.length < 1) { + if (cm) { + showConfirm(cm, 'Invalid mapping: ' + params.input); + } + return; + } + var expr = setArgs[0].split('='); + var optionName = expr[0]; + var value = expr[1]; + var forceGet = false; + + if (optionName.charAt(optionName.length - 1) == '?') { + // If post-fixed with ?, then the set is actually a get. + if (value) { throw Error('Trailing characters: ' + params.argString); } + optionName = optionName.substring(0, optionName.length - 1); + forceGet = true; + } + if (value === undefined && optionName.substring(0, 2) == 'no') { + // To set boolean options to false, the option name is prefixed with + // 'no'. + optionName = optionName.substring(2); + value = false; + } + + var optionIsBoolean = options[optionName] && options[optionName].type == 'boolean'; + if (optionIsBoolean && value == undefined) { + // Calling set with a boolean option sets it to true. + value = true; + } + // If no value is provided, then we assume this is a get. + if (!optionIsBoolean && value === undefined || forceGet) { + var oldValue = getOption(optionName, cm, setCfg); + if (oldValue === true || oldValue === false) { + showConfirm(cm, ' ' + (oldValue ? '' : 'no') + optionName); + } else { + showConfirm(cm, ' ' + optionName + '=' + oldValue); + } + } else { + setOption(optionName, value, cm, setCfg); + } + }, + setlocal: function (cm, params) { + // setCfg is passed through to setOption + params.setCfg = {scope: 'local'}; + this.set(cm, params); + }, + setglobal: function (cm, params) { + // setCfg is passed through to setOption + params.setCfg = {scope: 'global'}; + this.set(cm, params); + }, + registers: function(cm, params) { + var regArgs = params.args; + var registers = vimGlobalState.registerController.registers; + var regInfo = '----------Registers----------

    '; + if (!regArgs) { + for (var registerName in registers) { + var text = registers[registerName].toString(); + if (text.length) { + regInfo += '"' + registerName + ' ' + text + '
    '; + } + } + } else { + var registerName; + regArgs = regArgs.join(''); + for (var i = 0; i < regArgs.length; i++) { + registerName = regArgs.charAt(i); + if (!vimGlobalState.registerController.isValidRegister(registerName)) { + continue; + } + var register = registers[registerName] || new Register(); + regInfo += '"' + registerName + ' ' + register.toString() + '
    '; + } + } + showConfirm(cm, regInfo); + }, + sort: function(cm, params) { + var reverse, ignoreCase, unique, number; + function parseArgs() { + if (params.argString) { + var args = new CodeMirror.StringStream(params.argString); + if (args.eat('!')) { reverse = true; } + if (args.eol()) { return; } + if (!args.eatSpace()) { return 'Invalid arguments'; } + var opts = args.match(/[a-z]+/); + if (opts) { + opts = opts[0]; + ignoreCase = opts.indexOf('i') != -1; + unique = opts.indexOf('u') != -1; + var decimal = opts.indexOf('d') != -1 && 1; + var hex = opts.indexOf('x') != -1 && 1; + var octal = opts.indexOf('o') != -1 && 1; + if (decimal + hex + octal > 1) { return 'Invalid arguments'; } + number = decimal && 'decimal' || hex && 'hex' || octal && 'octal'; + } + if (args.eatSpace() && args.match(/\/.*\//)) { 'patterns not supported'; } + } + } + var err = parseArgs(); + if (err) { + showConfirm(cm, err + ': ' + params.argString); + return; + } + var lineStart = params.line || cm.firstLine(); + var lineEnd = params.lineEnd || params.line || cm.lastLine(); + if (lineStart == lineEnd) { return; } + var curStart = Pos(lineStart, 0); + var curEnd = Pos(lineEnd, lineLength(cm, lineEnd)); + var text = cm.getRange(curStart, curEnd).split('\n'); + var numberRegex = (number == 'decimal') ? /(-?)([\d]+)/ : + (number == 'hex') ? /(-?)(?:0x)?([0-9a-f]+)/i : + (number == 'octal') ? /([0-7]+)/ : null; + var radix = (number == 'decimal') ? 10 : (number == 'hex') ? 16 : (number == 'octal') ? 8 : null; + var numPart = [], textPart = []; + if (number) { + for (var i = 0; i < text.length; i++) { + if (numberRegex.exec(text[i])) { + numPart.push(text[i]); + } else { + textPart.push(text[i]); + } + } + } else { + textPart = text; + } + function compareFn(a, b) { + if (reverse) { var tmp; tmp = a; a = b; b = tmp; } + if (ignoreCase) { a = a.toLowerCase(); b = b.toLowerCase(); } + var anum = number && numberRegex.exec(a); + var bnum = number && numberRegex.exec(b); + if (!anum) { return a < b ? -1 : 1; } + anum = parseInt((anum[1] + anum[2]).toLowerCase(), radix); + bnum = parseInt((bnum[1] + bnum[2]).toLowerCase(), radix); + return anum - bnum; + } + numPart.sort(compareFn); + textPart.sort(compareFn); + text = (!reverse) ? textPart.concat(numPart) : numPart.concat(textPart); + if (unique) { // Remove duplicate lines + var textOld = text; + var lastLine; + text = []; + for (var i = 0; i < textOld.length; i++) { + if (textOld[i] != lastLine) { + text.push(textOld[i]); + } + lastLine = textOld[i]; + } + } + cm.replaceRange(text.join('\n'), curStart, curEnd); + }, + global: function(cm, params) { + // a global command is of the form + // :[range]g/pattern/[cmd] + // argString holds the string /pattern/[cmd] + var argString = params.argString; + if (!argString) { + showConfirm(cm, 'Regular Expression missing from global'); + return; + } + // range is specified here + var lineStart = (params.line !== undefined) ? params.line : cm.firstLine(); + var lineEnd = params.lineEnd || params.line || cm.lastLine(); + // get the tokens from argString + var tokens = splitBySlash(argString); + var regexPart = argString, cmd; + if (tokens.length) { + regexPart = tokens[0]; + cmd = tokens.slice(1, tokens.length).join('/'); + } + if (regexPart) { + // If regex part is empty, then use the previous query. Otherwise + // use the regex part as the new query. + try { + updateSearchQuery(cm, regexPart, true /** ignoreCase */, + true /** smartCase */); + } catch (e) { + showConfirm(cm, 'Invalid regex: ' + regexPart); + return; + } + } + // now that we have the regexPart, search for regex matches in the + // specified range of lines + var query = getSearchState(cm).getQuery(); + var matchedLines = [], content = ''; + for (var i = lineStart; i <= lineEnd; i++) { + var matched = query.test(cm.getLine(i)); + if (matched) { + matchedLines.push(i+1); + content+= cm.getLine(i) + '
    '; + } + } + // if there is no [cmd], just display the list of matched lines + if (!cmd) { + showConfirm(cm, content); + return; + } + var index = 0; + var nextCommand = function() { + if (index < matchedLines.length) { + var command = matchedLines[index] + cmd; + exCommandDispatcher.processCommand(cm, command, { + callback: nextCommand + }); + } + index++; + }; + nextCommand(); + }, + substitute: function(cm, params) { + if (!cm.getSearchCursor) { + throw new Error('Search feature not available. Requires searchcursor.js or ' + + 'any other getSearchCursor implementation.'); + } + var argString = params.argString; + var tokens = argString ? splitBySlash(argString) : []; + var regexPart, replacePart = '', trailing, flagsPart, count; + var confirm = false; // Whether to confirm each replace. + var global = false; // True to replace all instances on a line, false to replace only 1. + if (tokens.length) { + regexPart = tokens[0]; + replacePart = tokens[1]; + if (replacePart !== undefined) { + if (getOption('pcre')) { + replacePart = unescapeRegexReplace(replacePart); + } else { + replacePart = translateRegexReplace(replacePart); + } + vimGlobalState.lastSubstituteReplacePart = replacePart; + } + trailing = tokens[2] ? tokens[2].split(' ') : []; + } else { + // either the argString is empty or its of the form ' hello/world' + // actually splitBySlash returns a list of tokens + // only if the string starts with a '/' + if (argString && argString.length) { + showConfirm(cm, 'Substitutions should be of the form ' + + ':s/pattern/replace/'); + return; + } + } + // After the 3rd slash, we can have flags followed by a space followed + // by count. + if (trailing) { + flagsPart = trailing[0]; + count = parseInt(trailing[1]); + if (flagsPart) { + if (flagsPart.indexOf('c') != -1) { + confirm = true; + flagsPart.replace('c', ''); + } + if (flagsPart.indexOf('g') != -1) { + global = true; + flagsPart.replace('g', ''); + } + regexPart = regexPart + '/' + flagsPart; + } + } + if (regexPart) { + // If regex part is empty, then use the previous query. Otherwise use + // the regex part as the new query. + try { + updateSearchQuery(cm, regexPart, true /** ignoreCase */, + true /** smartCase */); + } catch (e) { + showConfirm(cm, 'Invalid regex: ' + regexPart); + return; + } + } + replacePart = replacePart || vimGlobalState.lastSubstituteReplacePart; + if (replacePart === undefined) { + showConfirm(cm, 'No previous substitute regular expression'); + return; + } + var state = getSearchState(cm); + var query = state.getQuery(); + var lineStart = (params.line !== undefined) ? params.line : cm.getCursor().line; + var lineEnd = params.lineEnd || lineStart; + if (lineStart == cm.firstLine() && lineEnd == cm.lastLine()) { + lineEnd = Infinity; + } + if (count) { + lineStart = lineEnd; + lineEnd = lineStart + count - 1; + } + var startPos = clipCursorToContent(cm, Pos(lineStart, 0)); + var cursor = cm.getSearchCursor(query, startPos); + doReplace(cm, confirm, global, lineStart, lineEnd, cursor, query, replacePart, params.callback); + }, + redo: CodeMirror.commands.redo, + undo: CodeMirror.commands.undo, + write: function(cm) { + if (CodeMirror.commands.save) { + // If a save command is defined, call it. + CodeMirror.commands.save(cm); + } else { + // Saves to text area if no save command is defined. + cm.save(); + } + }, + nohlsearch: function(cm) { + clearSearchHighlight(cm); + }, + delmarks: function(cm, params) { + if (!params.argString || !trim(params.argString)) { + showConfirm(cm, 'Argument required'); + return; + } + + var state = cm.state.vim; + var stream = new CodeMirror.StringStream(trim(params.argString)); + while (!stream.eol()) { + stream.eatSpace(); + + // Record the streams position at the beginning of the loop for use + // in error messages. + var count = stream.pos; + + if (!stream.match(/[a-zA-Z]/, false)) { + showConfirm(cm, 'Invalid argument: ' + params.argString.substring(count)); + return; + } + + var sym = stream.next(); + // Check if this symbol is part of a range + if (stream.match('-', true)) { + // This symbol is part of a range. + + // The range must terminate at an alphabetic character. + if (!stream.match(/[a-zA-Z]/, false)) { + showConfirm(cm, 'Invalid argument: ' + params.argString.substring(count)); + return; + } + + var startMark = sym; + var finishMark = stream.next(); + // The range must terminate at an alphabetic character which + // shares the same case as the start of the range. + if (isLowerCase(startMark) && isLowerCase(finishMark) || + isUpperCase(startMark) && isUpperCase(finishMark)) { + var start = startMark.charCodeAt(0); + var finish = finishMark.charCodeAt(0); + if (start >= finish) { + showConfirm(cm, 'Invalid argument: ' + params.argString.substring(count)); + return; + } + + // Because marks are always ASCII values, and we have + // determined that they are the same case, we can use + // their char codes to iterate through the defined range. + for (var j = 0; j <= finish - start; j++) { + var mark = String.fromCharCode(start + j); + delete state.marks[mark]; + } + } else { + showConfirm(cm, 'Invalid argument: ' + startMark + '-'); + return; + } + } else { + // This symbol is a valid mark, and is not part of a range. + delete state.marks[sym]; + } + } + } + }; + + var exCommandDispatcher = new ExCommandDispatcher(); + + /** + * @param {CodeMirror} cm CodeMirror instance we are in. + * @param {boolean} confirm Whether to confirm each replace. + * @param {Cursor} lineStart Line to start replacing from. + * @param {Cursor} lineEnd Line to stop replacing at. + * @param {RegExp} query Query for performing matches with. + * @param {string} replaceWith Text to replace matches with. May contain $1, + * $2, etc for replacing captured groups using Javascript replace. + * @param {function()} callback A callback for when the replace is done. + */ + function doReplace(cm, confirm, global, lineStart, lineEnd, searchCursor, query, + replaceWith, callback) { + // Set up all the functions. + cm.state.vim.exMode = true; + var done = false; + var lastPos = searchCursor.from(); + function replaceAll() { + cm.operation(function() { + while (!done) { + replace(); + next(); + } + stop(); + }); + } + function replace() { + var text = cm.getRange(searchCursor.from(), searchCursor.to()); + var newText = text.replace(query, replaceWith); + searchCursor.replace(newText); + } + function next() { + // The below only loops to skip over multiple occurrences on the same + // line when 'global' is not true. + while(searchCursor.findNext() && + isInRange(searchCursor.from(), lineStart, lineEnd)) { + if (!global && lastPos && searchCursor.from().line == lastPos.line) { + continue; + } + cm.scrollIntoView(searchCursor.from(), 30); + cm.setSelection(searchCursor.from(), searchCursor.to()); + lastPos = searchCursor.from(); + done = false; + return; + } + done = true; + } + function stop(close) { + if (close) { close(); } + cm.focus(); + if (lastPos) { + cm.setCursor(lastPos); + var vim = cm.state.vim; + vim.exMode = false; + vim.lastHPos = vim.lastHSPos = lastPos.ch; + } + if (callback) { callback(); } + } + function onPromptKeyDown(e, _value, close) { + // Swallow all keys. + CodeMirror.e_stop(e); + var keyName = CodeMirror.keyName(e); + switch (keyName) { + case 'Y': + replace(); next(); break; + case 'N': + next(); break; + case 'A': + // replaceAll contains a call to close of its own. We don't want it + // to fire too early or multiple times. + var savedCallback = callback; + callback = undefined; + cm.operation(replaceAll); + callback = savedCallback; + break; + case 'L': + replace(); + // fall through and exit. + case 'Q': + case 'Esc': + case 'Ctrl-C': + case 'Ctrl-[': + stop(close); + break; + } + if (done) { stop(close); } + return true; + } + + // Actually do replace. + next(); + if (done) { + showConfirm(cm, 'No matches for ' + query.source); + return; + } + if (!confirm) { + replaceAll(); + if (callback) { callback(); }; + return; + } + showPrompt(cm, { + prefix: 'replace with ' + replaceWith + ' (y/n/a/q/l)', + onKeyDown: onPromptKeyDown + }); + } + + CodeMirror.keyMap.vim = { + attach: attachVimMap, + detach: detachVimMap, + call: cmKey + }; + + function exitInsertMode(cm) { + var vim = cm.state.vim; + var macroModeState = vimGlobalState.macroModeState; + var insertModeChangeRegister = vimGlobalState.registerController.getRegister('.'); + var isPlaying = macroModeState.isPlaying; + var lastChange = macroModeState.lastInsertModeChanges; + // In case of visual block, the insertModeChanges are not saved as a + // single word, so we convert them to a single word + // so as to update the ". register as expected in real vim. + var text = []; + if (!isPlaying) { + var selLength = lastChange.inVisualBlock ? vim.lastSelection.visualBlock.height : 1; + var changes = lastChange.changes; + var text = []; + var i = 0; + // In case of multiple selections in blockwise visual, + // the inserted text, for example: 'foo', is stored as + // 'f', 'f', InsertModeKey 'o', 'o', 'o', 'o'. (if you have a block with 2 lines). + // We push the contents of the changes array as per the following: + // 1. In case of InsertModeKey, just increment by 1. + // 2. In case of a character, jump by selLength (2 in the example). + while (i < changes.length) { + // This loop will convert 'ffoooo' to 'foo'. + text.push(changes[i]); + if (changes[i] instanceof InsertModeKey) { + i++; + } else { + i+= selLength; + } + } + lastChange.changes = text; + cm.off('change', onChange); + CodeMirror.off(cm.getInputField(), 'keydown', onKeyEventTargetKeyDown); + } + if (!isPlaying && vim.insertModeRepeat > 1) { + // Perform insert mode repeat for commands like 3,a and 3,o. + repeatLastEdit(cm, vim, vim.insertModeRepeat - 1, + true /** repeatForInsert */); + vim.lastEditInputState.repeatOverride = vim.insertModeRepeat; + } + delete vim.insertModeRepeat; + vim.insertMode = false; + cm.setCursor(cm.getCursor().line, cm.getCursor().ch-1); + cm.setOption('keyMap', 'vim'); + cm.setOption('disableInput', true); + cm.toggleOverwrite(false); // exit replace mode if we were in it. + // update the ". register before exiting insert mode + insertModeChangeRegister.setText(lastChange.changes.join('')); + CodeMirror.signal(cm, "vim-mode-change", {mode: "normal"}); + if (macroModeState.isRecording) { + logInsertModeChange(macroModeState); + } + } + + function _mapCommand(command) { + defaultKeymap.push(command); + } + + function mapCommand(keys, type, name, args, extra) { + var command = {keys: keys, type: type}; + command[type] = name; + command[type + "Args"] = args; + for (var key in extra) + command[key] = extra[key]; + _mapCommand(command); + } + + // The timeout in milliseconds for the two-character ESC keymap should be + // adjusted according to your typing speed to prevent false positives. + defineOption('insertModeEscKeysTimeout', 200, 'number'); + + CodeMirror.keyMap['vim-insert'] = { + // TODO: override navigation keys so that Esc will cancel automatic + // indentation from o, O, i_ + 'Ctrl-N': 'autocomplete', + 'Ctrl-P': 'autocomplete', + 'Enter': function(cm) { + var fn = CodeMirror.commands.newlineAndIndentContinueComment || + CodeMirror.commands.newlineAndIndent; + fn(cm); + }, + fallthrough: ['default'], + attach: attachVimMap, + detach: detachVimMap, + call: cmKey + }; + + CodeMirror.keyMap['vim-replace'] = { + 'Backspace': 'goCharLeft', + fallthrough: ['vim-insert'], + attach: attachVimMap, + detach: detachVimMap, + call: cmKey + }; + + function executeMacroRegister(cm, vim, macroModeState, registerName) { + var register = vimGlobalState.registerController.getRegister(registerName); + if (registerName == ':') { + // Read-only register containing last Ex command. + if (register.keyBuffer[0]) { + exCommandDispatcher.processCommand(cm, register.keyBuffer[0]); + } + macroModeState.isPlaying = false; + return; + } + var keyBuffer = register.keyBuffer; + var imc = 0; + macroModeState.isPlaying = true; + macroModeState.replaySearchQueries = register.searchQueries.slice(0); + for (var i = 0; i < keyBuffer.length; i++) { + var text = keyBuffer[i]; + var match, key; + while (text) { + // Pull off one command key, which is either a single character + // or a special sequence wrapped in '<' and '>', e.g. ''. + match = (/<\w+-.+?>|<\w+>|./).exec(text); + key = match[0]; + text = text.substring(match.index + key.length); + CodeMirror.Vim.handleKey(cm, key, 'macro'); + if (vim.insertMode) { + var changes = register.insertModeChanges[imc++].changes; + vimGlobalState.macroModeState.lastInsertModeChanges.changes = + changes; + repeatInsertModeChanges(cm, changes, 1); + exitInsertMode(cm); + } + } + }; + macroModeState.isPlaying = false; + } + + function logKey(macroModeState, key) { + if (macroModeState.isPlaying) { return; } + var registerName = macroModeState.latestRegister; + var register = vimGlobalState.registerController.getRegister(registerName); + if (register) { + register.pushText(key); + } + } + + function logInsertModeChange(macroModeState) { + if (macroModeState.isPlaying) { return; } + var registerName = macroModeState.latestRegister; + var register = vimGlobalState.registerController.getRegister(registerName); + if (register) { + register.pushInsertModeChanges(macroModeState.lastInsertModeChanges); + } + } + + function logSearchQuery(macroModeState, query) { + if (macroModeState.isPlaying) { return; } + var registerName = macroModeState.latestRegister; + var register = vimGlobalState.registerController.getRegister(registerName); + if (register) { + register.pushSearchQuery(query); + } + } + + /** + * Listens for changes made in insert mode. + * Should only be active in insert mode. + */ + function onChange(_cm, changeObj) { + var macroModeState = vimGlobalState.macroModeState; + var lastChange = macroModeState.lastInsertModeChanges; + if (!macroModeState.isPlaying) { + while(changeObj) { + lastChange.expectCursorActivityForChange = true; + if (changeObj.origin == '+input' || changeObj.origin == 'paste' + || changeObj.origin === undefined /* only in testing */) { + var text = changeObj.text.join('\n'); + lastChange.changes.push(text); + } + // Change objects may be chained with next. + changeObj = changeObj.next; + } + } + } + + /** + * Listens for any kind of cursor activity on CodeMirror. + */ + function onCursorActivity(cm) { + var vim = cm.state.vim; + if (vim.insertMode) { + // Tracking cursor activity in insert mode (for macro support). + var macroModeState = vimGlobalState.macroModeState; + if (macroModeState.isPlaying) { return; } + var lastChange = macroModeState.lastInsertModeChanges; + if (lastChange.expectCursorActivityForChange) { + lastChange.expectCursorActivityForChange = false; + } else { + // Cursor moved outside the context of an edit. Reset the change. + lastChange.changes = []; + } + } else if (!cm.curOp.isVimOp) { + handleExternalSelection(cm, vim); + } + if (vim.visualMode) { + updateFakeCursor(cm); + } + } + function updateFakeCursor(cm) { + var vim = cm.state.vim; + var from = clipCursorToContent(cm, copyCursor(vim.sel.head)); + var to = offsetCursor(from, 0, 1); + if (vim.fakeCursor) { + vim.fakeCursor.clear(); + } + vim.fakeCursor = cm.markText(from, to, {className: 'cm-animate-fat-cursor'}); + } + function handleExternalSelection(cm, vim) { + var anchor = cm.getCursor('anchor'); + var head = cm.getCursor('head'); + // Enter or exit visual mode to match mouse selection. + if (vim.visualMode && !cm.somethingSelected()) { + exitVisualMode(cm, false); + } else if (!vim.visualMode && !vim.insertMode && cm.somethingSelected()) { + vim.visualMode = true; + vim.visualLine = false; + CodeMirror.signal(cm, "vim-mode-change", {mode: "visual"}); + } + if (vim.visualMode) { + // Bind CodeMirror selection model to vim selection model. + // Mouse selections are considered visual characterwise. + var headOffset = !cursorIsBefore(head, anchor) ? -1 : 0; + var anchorOffset = cursorIsBefore(head, anchor) ? -1 : 0; + head = offsetCursor(head, 0, headOffset); + anchor = offsetCursor(anchor, 0, anchorOffset); + vim.sel = { + anchor: anchor, + head: head + }; + updateMark(cm, vim, '<', cursorMin(head, anchor)); + updateMark(cm, vim, '>', cursorMax(head, anchor)); + } else if (!vim.insertMode) { + // Reset lastHPos if selection was modified by something outside of vim mode e.g. by mouse. + vim.lastHPos = cm.getCursor().ch; + } + } + + /** Wrapper for special keys pressed in insert mode */ + function InsertModeKey(keyName) { + this.keyName = keyName; + } + + /** + * Handles raw key down events from the text area. + * - Should only be active in insert mode. + * - For recording deletes in insert mode. + */ + function onKeyEventTargetKeyDown(e) { + var macroModeState = vimGlobalState.macroModeState; + var lastChange = macroModeState.lastInsertModeChanges; + var keyName = CodeMirror.keyName(e); + if (!keyName) { return; } + function onKeyFound() { + lastChange.changes.push(new InsertModeKey(keyName)); + return true; + } + if (keyName.indexOf('Delete') != -1 || keyName.indexOf('Backspace') != -1) { + CodeMirror.lookupKey(keyName, 'vim-insert', onKeyFound); + } + } + + /** + * Repeats the last edit, which includes exactly 1 command and at most 1 + * insert. Operator and motion commands are read from lastEditInputState, + * while action commands are read from lastEditActionCommand. + * + * If repeatForInsert is true, then the function was called by + * exitInsertMode to repeat the insert mode changes the user just made. The + * corresponding enterInsertMode call was made with a count. + */ + function repeatLastEdit(cm, vim, repeat, repeatForInsert) { + var macroModeState = vimGlobalState.macroModeState; + macroModeState.isPlaying = true; + var isAction = !!vim.lastEditActionCommand; + var cachedInputState = vim.inputState; + function repeatCommand() { + if (isAction) { + commandDispatcher.processAction(cm, vim, vim.lastEditActionCommand); + } else { + commandDispatcher.evalInput(cm, vim); + } + } + function repeatInsert(repeat) { + if (macroModeState.lastInsertModeChanges.changes.length > 0) { + // For some reason, repeat cw in desktop VIM does not repeat + // insert mode changes. Will conform to that behavior. + repeat = !vim.lastEditActionCommand ? 1 : repeat; + var changeObject = macroModeState.lastInsertModeChanges; + repeatInsertModeChanges(cm, changeObject.changes, repeat); + } + } + vim.inputState = vim.lastEditInputState; + if (isAction && vim.lastEditActionCommand.interlaceInsertRepeat) { + // o and O repeat have to be interlaced with insert repeats so that the + // insertions appear on separate lines instead of the last line. + for (var i = 0; i < repeat; i++) { + repeatCommand(); + repeatInsert(1); + } + } else { + if (!repeatForInsert) { + // Hack to get the cursor to end up at the right place. If I is + // repeated in insert mode repeat, cursor will be 1 insert + // change set left of where it should be. + repeatCommand(); + } + repeatInsert(repeat); + } + vim.inputState = cachedInputState; + if (vim.insertMode && !repeatForInsert) { + // Don't exit insert mode twice. If repeatForInsert is set, then we + // were called by an exitInsertMode call lower on the stack. + exitInsertMode(cm); + } + macroModeState.isPlaying = false; + }; + + function repeatInsertModeChanges(cm, changes, repeat) { + function keyHandler(binding) { + if (typeof binding == 'string') { + CodeMirror.commands[binding](cm); + } else { + binding(cm); + } + return true; + } + var head = cm.getCursor('head'); + var inVisualBlock = vimGlobalState.macroModeState.lastInsertModeChanges.inVisualBlock; + if (inVisualBlock) { + // Set up block selection again for repeating the changes. + var vim = cm.state.vim; + var lastSel = vim.lastSelection; + var offset = getOffset(lastSel.anchor, lastSel.head); + selectForInsert(cm, head, offset.line + 1); + repeat = cm.listSelections().length; + cm.setCursor(head); + } + for (var i = 0; i < repeat; i++) { + if (inVisualBlock) { + cm.setCursor(offsetCursor(head, i, 0)); + } + for (var j = 0; j < changes.length; j++) { + var change = changes[j]; + if (change instanceof InsertModeKey) { + CodeMirror.lookupKey(change.keyName, 'vim-insert', keyHandler); + } else { + var cur = cm.getCursor(); + cm.replaceRange(change, cur, cur); + } + } + } + if (inVisualBlock) { + cm.setCursor(offsetCursor(head, 0, 1)); + } + } + + resetVimGlobalState(); + return vimApi; + }; + // Initialize Vim and make it available as an API. + CodeMirror.Vim = Vim(); +}); diff --git a/media/editors/codemirror/lib/addons.min.css b/media/editors/codemirror/lib/addons.min.css new file mode 100644 index 0000000000000..e81039a5d0e24 --- /dev/null +++ b/media/editors/codemirror/lib/addons.min.css @@ -0,0 +1 @@ +.CodeMirror-fullscreen{position:fixed;top:0;left:0;right:0;bottom:0;height:auto;z-index:9}.CodeMirror-foldmarker{color:#00f;text-shadow:#b9f 1px 1px 2px,#b9f -1px -1px 2px,#b9f 1px -1px 2px,#b9f -1px 1px 2px;font-family:arial;line-height:.3;cursor:pointer}.CodeMirror-foldgutter{width:.7em}.CodeMirror-foldgutter-folded,.CodeMirror-foldgutter-open{cursor:pointer}.CodeMirror-foldgutter-open:after{content:"\25BE"}.CodeMirror-foldgutter-folded:after{content:"\25B8"}.CodeMirror-simplescroll-horizontal div,.CodeMirror-simplescroll-vertical div{position:absolute;background:#ccc;-moz-box-sizing:border-box;box-sizing:border-box;border:1px solid #bbb;border-radius:2px}.CodeMirror-simplescroll-horizontal,.CodeMirror-simplescroll-vertical{position:absolute;z-index:6;background:#eee}.CodeMirror-simplescroll-horizontal{bottom:0;left:0;height:8px}.CodeMirror-simplescroll-horizontal div{bottom:0;height:100%}.CodeMirror-simplescroll-vertical{right:0;top:0;width:8px}.CodeMirror-simplescroll-vertical div{right:0;width:100%}.CodeMirror-overlayscroll .CodeMirror-gutter-filler,.CodeMirror-overlayscroll .CodeMirror-scrollbar-filler{display:none}.CodeMirror-overlayscroll-horizontal div,.CodeMirror-overlayscroll-vertical div{position:absolute;background:#bcd;border-radius:3px}.CodeMirror-overlayscroll-horizontal,.CodeMirror-overlayscroll-vertical{position:absolute;z-index:6}.CodeMirror-overlayscroll-horizontal{bottom:0;left:0;height:6px}.CodeMirror-overlayscroll-horizontal div{bottom:0;height:100%}.CodeMirror-overlayscroll-vertical{right:0;top:0;width:6px}.CodeMirror-overlayscroll-vertical div{right:0;width:100%} \ No newline at end of file diff --git a/media/editors/codemirror/lib/addons.min.js b/media/editors/codemirror/lib/addons.min.js new file mode 100644 index 0000000000000..f789dcf576232 --- /dev/null +++ b/media/editors/codemirror/lib/addons.min.js @@ -0,0 +1,4 @@ +!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]:k[b]}function c(a){return function(b){return g(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("",l(k.line,k.ch-1),l(k.line,k.ch+1))}}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;h1&&n.indexOf(e)>=0&&c.getRange(l(u.line,u.ch-2),u)==e+e&&(u.ch<=2||c.getRange(l(u.line,u.ch-3),l(u.line,u.ch-2))!=e))s="addFour";else if(o){if(a.isWordChar(m)||!j(c,u,e))return a.Pass;s="both"}else{if(!q||c.getLine(u.line).length!=u.ch&&!h(m,g)&&!/\s/.test(m))return a.Pass;s="both"}else s=n.indexOf(e)>=0&&c.getRange(u,l(u.line,u.ch+3))==e+e+e?"skipThree":"skip";if(k){if(k!=s)return a.Pass}else k=s}var v=i%2?g.charAt(i-1):e,w=i%2?e:g.charAt(i+1);c.operation(function(){if("skip"==k)c.execCommand("goCharRight");else if("skipThree"==k)for(var a=0;3>a;a++)c.execCommand("goCharRight");else if("surround"==k){for(var b=c.getSelections(),a=0;a-1&&c%2==1}function i(a,b){var c=a.getRange(l(b.line,b.ch-1),l(b.line,b.ch+1));return 2==c.length?c:null}function j(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 k={pairs:"()[]{}''\"\"",triples:"",explode:"[]{}"},l=a.Pos;a.defineOption("autoCloseBrackets",!1,function(b,c,d){d&&d!=a.Init&&(b.removeKeyMap(n),b.state.closeBrackets=null),c&&(b.state.closeBrackets=c,b.addKeyMap(n))});for(var m=k.pairs+"`",n={Backspace:e,Enter:f},o=0;oj.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?"/":"";else{if("htmlmixed"!=b.getMode().name||"css"!=k.mode.name)return a.Pass;e[h]=g+"style>"}else{if(!l.context||!l.context.tagName||f(b,l.context.tagName,i,l))return a.Pass;e[h]=g+l.context.tagName+">"}}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 e=c.ch,i=0;;){var j=0>=e?-1:h.lastIndexOf(d,e-1);if(-1!=j){if(1==i&&j=o;++o)for(var p=b.getLine(o),q=o==g?e:0;;){var r=p.indexOf(i,q),s=p.indexOf(j,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))==f)if(q==r)++m;else if(!--m){k=o,l=q;break a}++q}if(null!=k&&(g!=k||l!=e))return{from:a.Pos(g,e),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,c=c.line,f=d(c);if(!f||d(c-1)||(e=d(c-2))&&e.end.line==c-1)return null;for(var g=f.end;;){var h=d(g.line+1);if(null==h)break;g=h.end}return{from:b.clipPos(a.Pos(c,f.startCh+1)),to:g}}),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 c=c.line,e=d(c);if(null==e||null!=d(c-1))return null;for(var f=c;;){var g=d(f+1);if(null==g)break;++f}return{from:a.Pos(c,e+1),to:b.clipPos(a.Pos(f))}})}),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 b=m(d.line,d.ch),h=k(d,f[2]);return h&&{from:b,to:h.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;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;fd.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.moveTo=function(a,b){0>a&&(a=0),a>this.total-this.screen&&(a=this.total-this.screen),a!=this.pos&&(this.pos=a,this.inner.style["horizontal"==this.orientation?"left":"top"]=a*(this.size/this.total)+"px",b!==!1&&this.scroll(a,this.orientation))};var d=10;b.prototype.update=function(a,b,c){this.screen=b,this.total=a,this.size=c;var e=this.screen*(this.size/this.total);d>e&&(this.size-=d-e,e=d),this.inner.style["horizontal"==this.orientation?"width":"height"]=e+"px",this.inner.style["horizontal"==this.orientation?"left":"top"]=this.pos*(this.size/this.total)+"px"},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.display="block",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.moveTo(a,!1)},c.prototype.setScrollLeft=function(a){this.horiz.moveTo(a,!1)},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")):"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:"xi",context:"visual" +},{keys:"S",type:"keyToKey",toKeys:"cc",context:"normal"},{keys:"S",type:"keyToKey",toKeys:"dcc",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:"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:"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",_a),x(b),a.on(b.getInputField(),"paste",k(b))}function f(b){b.setOption("disableInput",!1),b.off("cursorActivity",_a),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("-");/-$/.test(a)&&b.splice(-2,2,"-");var 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(K(a.getCursor(),0,1)),zb.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 ib.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 G(a,b){yb[a]=b}function H(a,b){zb[a]=b}function I(a,b,c){var e=Math.min(Math.max(a.firstLine(),b.line),a.lastLine()),f=W(a,e)-1;f=c?f+1:f;var g=Math.min(Math.max(0,b.ch),f);return d(e,g)}function J(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function K(a,b,c){return"object"==typeof b&&(c=b.ch,b=b.line),d(a.line+b,a.ch+c)}function L(a,b){return{line:b.line-a.line,ch:b.line-a.line}}function M(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 O(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 P(a,b,c){return function(){for(var d=0;c>d;d++)b(a)}}function Q(a){return d(a.line,a.ch)}function R(a,b){return a.ch==b.ch&&a.line==b.line}function S(a,b){return a.line2&&(b=T.apply(void 0,Array.prototype.slice.call(arguments,1))),S(a,b)?a:b}function U(a,b){return arguments.length>2&&(b=U.apply(void 0,Array.prototype.slice.call(arguments,1))),S(a,b)?b:a}function V(a,b,c){var d=S(a,b),e=S(b,c);return d&&e}function W(a,b){return a.getLine(b).length}function X(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function Y(a){return a.replace(/([.?*+$\[\]\/\\(){}|\-])/g,"\\$1")}function Z(a,b,c){var e=W(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=Q(a.clipPos(b)),g=!R(b,f),h=a.getCursor("head"),i=aa(e,h),j=R(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 _(a,b,c){for(var d=[],e=0;c>e;e++){var f=K(b,e,0);d.push({anchor:f,head:f})}a.setSelections(d,0)}function aa(a,b,c){for(var d=0;dj&&(f.line=j),f.ch=W(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 ga(a){var b=a.getCursor("head");return 1==a.getSelection().length&&(b=T(b,a.getCursor("anchor"))),b}function ha(b,c){var d=b.state.vim;c!==!1&&b.setCursor(I(b,d.sel.head)),ca(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 ia(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=W(a,c.line)):c.ch=0}}function ja(a,b,c){b.ch=0,c.ch=0,c.line++}function ka(a){if(!a)return 0;var b=a.search(/\S/);return-1==b?a.length:b}function la(a,b,c,e,f){for(var g=ga(a),h=a.getLine(g.line),i=g.ch,j=f?jb[0]:kb[0];!j(h.charAt(i));)if(i++,i>=h.length)return null;e?j=kb[0]:(j=jb[0],j(h.charAt(i))||(j=jb[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 ma(a,b,c){R(b,c)||tb.jumpList.add(a,b,c)}function na(a,b){tb.lastChararacterSearch.increment=a,tb.lastChararacterSearch.forward=b.forward,tb.lastChararacterSearch.selectedCharacter=b.selectedCharacter}function oa(a,b,c,e){var f=Q(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=Ab[e];if(!m)return f;var n=Bb[m].init,o=Bb[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 pa(a,b,c,d,e){var f=b.line,g=b.ch,h=a.getLine(f),i=c?1:-1,j=d?kb:jb;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}throw new Error("The impossible happened.")}function qa(a,b,c,e,f,g){var h=Q(b),i=[];(e&&!f||!e&&f)&&c++;for(var j=!(e&&f),k=0;c>k;k++){var l=pa(a,b,e,g,j);if(!l){var m=W(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 ra(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=ua(h,j,e,c,!0),-1==f)return null;h=f}return d(a.getCursor().line,f)}function sa(a,b){var c=a.getCursor().line;return I(a,d(c,b-1))}function ta(a,b,c,d){s(c,ob)&&(b.marks[c]&&b.marks[c].clear(),b.marks[c]=a.setBookmark(d))}function ua(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 va(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 wa(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 xa(a,b,c,e){var f,g,h,i,j=Q(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 ya(){}function za(a){var b=a.state.vim;return b.searchState_||(b.searchState_=new ya)}function Aa(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 Ba(a){var b=Ca(a)||[];if(!b.length)return[];var c=[];if(0===b[0]){for(var d=0;d'+b+"
    ",{bottom:!0,duration:5e3}):alert(b)}function Ia(a,b){var c="";return a&&(c+=''+a+""),c+=' ',b&&(c+='',c+=b,c+=""),c}function Ja(a,b){var c=(b.prefix||"")+" "+(b.desc||""),d=Ia(b.prefix,b.desc);Aa(a,d,c,b.onClose,b)}function Ka(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&&R(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 Pa(a){var b=za(a);a.removeOverlay(za(a).getOverlay()),b.setOverlay(null),b.getScrollbarAnnotate()&&(b.getScrollbarAnnotate().clear(),b.setScrollbarAnnotate(null))}function Qa(a,b,c){return"number"!=typeof a&&(a=a.line),b instanceof Array?s(a,b):c?a>=b&&c>=a:a==b}function Ra(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 Sa(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()&&Qa(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 Ha(b,"No matches for "+h.source):c?void Ja(b,{prefix:"replace with "+i+" (y/n/a/q/l)",onKeyDown:o}):(k(),void(j&&j()))}function Ta(b){var c=b.state.vim,d=tb.macroModeState,e=tb.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&&(eb(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&&Ya(d)}function Ua(a){b.push(a)}function Va(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];Ua(f)}function Wa(b,c,d,e){var f=tb.registerController.getRegister(e);if(":"==e)return f.keyBuffer[0]&&Hb.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;tb.macroModeState.lastInsertModeChanges.changes=m,fb(b,m,1),Ta(b)}d.isPlaying=!1}function Xa(a,b){if(!a.isPlaying){var c=a.latestRegister,d=tb.registerController.getRegister(c);d&&d.pushText(b)}}function Ya(a){if(!a.isPlaying){var b=a.latestRegister,c=tb.registerController.getRegister(b);c&&c.pushInsertModeChanges(a.lastInsertModeChanges)}}function Za(a,b){if(!a.isPlaying){var c=a.latestRegister,d=tb.registerController.getRegister(c);d&&d.pushSearchQuery(b)}}function $a(a,b){var c=tb.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 _a(a){var b=a.state.vim;if(b.insertMode){var c=tb.macroModeState;if(c.isPlaying)return;var d=c.lastInsertModeChanges;d.expectCursorActivityForChange?d.expectCursorActivityForChange=!1:d.changes=[]}else a.curOp.isVimOp||bb(a,b);b.visualMode&&ab(a)}function ab(a){var b=a.state.vim,c=I(a,Q(b.sel.head)),d=K(c,0,1);b.fakeCursor&&b.fakeCursor.clear(),b.fakeCursor=a.markText(c,d,{className:"cm-animate-fat-cursor"})}function bb(b,c){var d=b.getCursor("anchor"),e=b.getCursor("head");if(c.visualMode&&!b.somethingSelected()?ha(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=S(e,d)?0:-1,g=S(e,d)?-1:0;e=K(e,0,f),d=K(d,0,g),c.sel={anchor:d,head:e},ta(b,c,"<",T(e,d)),ta(b,c,">",U(e,d))}else c.insertMode||(c.lastHPos=b.getCursor().ch); +}function cb(a){this.keyName=a}function db(b){function c(){return e.changes.push(new cb(f)),!0}var d=tb.macroModeState,e=d.lastInsertModeChanges,f=a.keyName(b);f&&(-1!=f.indexOf("Delete")||-1!=f.indexOf("Backspace"))&&a.lookupKey(f,"vim-insert",c)}function eb(a,b,c,d){function e(){h?wb.processAction(a,b,b.lastEditActionCommand):wb.evalInput(a,b)}function f(c){if(g.lastInsertModeChanges.changes.length>0){c=b.lastEditActionCommand?c:1;var d=g.lastInsertModeChanges;fb(a,d.changes,c)}}var g=tb.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&&Ta(a),g.isPlaying=!1}function fb(b,c,d){function e(c){return"string"==typeof c?a.commands[c](b):c(b),!0}var f=b.getCursor("head"),g=tb.macroModeState.lastInsertModeChanges.inVisualBlock;if(g){var h=b.state.vim,i=h.lastSelection,j=L(i.anchor,i.head);_(b,f,j.line+1),d=b.listSelections().length,b.setCursor(f)}for(var k=0;d>k;k++){g&&b.setCursor(K(f,k,0));for(var l=0;l"]),pb=[].concat(lb,mb,nb,["-",'"',".",":","/"]),qb={};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 rb=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&&!R(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())&&!R(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}},sb=function(a){return a?{changes:a.changes,expectCursorActivityForChange:a.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};w.prototype={exitMacroRecordMode:function(){var a=tb.macroModeState;a.onRecordingDone&&a.onRecordingDone(),a.onRecordingDone=void 0,a.isRecording=!1},enterMacroRecordMode:function(a,b){var c=tb.registerController.getRegister(b);c&&(c.clear(),this.latestRegister=b,a.openDialog&&(this.onRecordingDone=a.openDialog("(recording)["+b+"]",null,{bottom:!0})),this.isRecording=!0)}};var tb,ub,vb={buildKeyMap:function(){},getRegisterController:function(){return tb.registerController},resetVimGlobalState_:y,getVimGlobalState_:function(){return tb},maybeInitVimState_:x,suppressErrorLogging:!1,InsertModeKey:cb,map:function(a,b,c){Hb.map(a,b,c)},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;Gb[a]=c,Hb.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=tb.macroModeState;if(a.isRecording){if("q"==d)return a.exitMacroRecordMode(),A(c),!0;"mapping"!=e&&Xa(a,d)}}function g(){return""==d?(A(c),l.visualMode?ha(c):l.insertMode&&Ta(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=wb.matchCommand(a,b,l.inputState,"insert");a.length>1&&"full"!=f.type;){var a=l.inputState.keyBuffer=a.slice(1),h=wb.matchCommand(a,b,l.inputState,"insert");"none"!=h.type&&(f=h)}if("none"==f.type)return A(c),!1;if("partial"==f.type)return ub&&window.clearTimeout(ub),ub=window.setTimeout(function(){l.insertMode&&l.inputState.keyBuffer&&A(c)},v("insertModeEscKeysTimeout")),!e;if(ub&&window.clearTimeout(ub),e){var i=c.getCursor();c.replaceRange("",K(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=wb.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):wb.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){Hb.processCommand(a,b)},defineMotion:E,defineAction:H,defineOperator:G,mapCommand:Va,_mapCommand:Ua,exitVisualMode:ha,exitInsertMode:Ta};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(sb(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("")}},C.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,pb)},shiftNumericRegisters_:function(){for(var a=9;a>=2;a--)this.registers[a]=this.getRegister(""+(a-1))}},D.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 wb={matchCommand:function(a,b,c,d){var e=M(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=O(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=J(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=J(c.operatorArgs),b.visualMode&&this.evalInput(a,b)},processOperatorMotion:function(a,b,c){var d=b.visualMode,e=J(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=J(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),zb[c.action](a,g,b)},processSearch:function(b,c,d){function e(a,e,f){tb.searchHistoryController.pushInput(a),tb.searchHistoryController.reset();try{La(b,a,e,f)}catch(g){return Ha(b,"Invalid regex: "+a),void A(b)}wb.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=tb.macroModeState;c.isRecording&&Za(c,a)}function g(c,d,e){var f,g=a.keyName(c);"Up"==g||"Down"==g?(f="Up"==g?!0:!1,d=tb.searchHistoryController.nextMatch(d,f)||"",e(d)):"Left"!=g&&"Right"!=g&&"Ctrl"!=g&&"Alt"!=g&&"Shift"!=g&&tb.searchHistoryController.reset();var h;try{h=La(b,d,!0,!0)}catch(c){}h?b.scrollIntoView(Oa(b,!i,h),30):(Pa(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?(tb.searchHistoryController.pushInput(d),tb.searchHistoryController.reset(),La(b,l),Pa(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;za(b).setReversed(!i);var k=i?"/":"?",l=za(b).getQuery(),m=b.getScrollInfo();switch(d.searchArgs.querySrc){case"prompt":var n=tb.macroModeState;if(n.isPlaying){var o=n.replaySearchQueries.shift();e(o,!0,!1)}else Ja(b,{onClose:f,prefix:k,desc:Eb,onKeyUp:g,onKeyDown:h});break;case"wordUnderCursor":var p=la(b,!1,!0,!1,!0),q=!0;if(p||(p=la(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":Y(o),tb.jumpList.cachedCursor=b.getCursor(),b.setCursor(p.start),e(o,!0,!1)}}},processEx:function(b,c,d){function e(a){tb.exCommandHistoryController.pushInput(a),tb.exCommandHistoryController.reset(),Hb.processCommand(b,a)}function f(c,d,e){var f,g=a.keyName(c);("Esc"==g||"Ctrl-C"==g||"Ctrl-["==g||"Backspace"==g&&""==d)&&(tb.exCommandHistoryController.pushInput(d),tb.exCommandHistoryController.reset(),a.e_stop(c),A(b),e(),b.focus()),"Up"==g||"Down"==g?(f="Up"==g?!0:!1,d=tb.exCommandHistoryController.nextMatch(d,f)||"",e(d)):"Ctrl-U"==g?(a.e_stop(c),e("")):"Left"!=g&&"Right"!=g&&"Ctrl"!=g&&"Alt"!=g&&"Shift"!=g&&tb.exCommandHistoryController.reset()}"keyToEx"==d.type?Hb.processCommand(b,d.exArgs.input):c.visualMode?Ja(b,{onClose:e,prefix:":",value:"'<,'>",onKeyDown:f}):Ja(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=Q(b.visualMode?I(a,m.head):a.getCursor("head")),o=Q(b.visualMode?I(a,m.anchor):a.getCursor("anchor")),p=Q(n),q=Q(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=xb[h](a,n,i,b);if(b.lastMotion=xb[h],!r)return;if(i.toJumplist){var s=tb.jumpList,t=s.cachedCursor;t?(ma(a,t,r),delete s.cachedCursor):ma(a,n,r)}r instanceof Array?(e=r[0],c=r[1]):c=r,c||(c=Q(n)),b.visualMode?(b.visualBlock&&c.ch===1/0||(c=I(a,c,b.visualBlock)),e&&(e=I(a,e,!0)),e=e||q,m.anchor=e,m.head=c,ea(a),ta(a,b,"<",S(e,c)?e:c),ta(a,b,">",S(e,c)?c:e)):j||(c=I(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},ea(a)}else b.visualMode&&(k.lastSel={anchor:Q(m.anchor),head:Q(m.head),visualBlock:b.visualBlock,visualLine:b.visualLine});var x,y,z,B,C;if(b.visualMode){if(x=T(m.head,m.anchor),y=U(m.head,m.anchor),z=b.visualLine||k.linewise,B=b.visualBlock?"block":z?"line":"char",C=fa(a,{anchor:x,head:y},B),z){var D=C.ranges;if("block"==B)for(var E=0;Ei&&f.line==j||i>k&&f.line==k?void 0:(c.toFirstChar&&(g=ka(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 va(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=xb.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 qa(a,b,c.repeat,!!c.forward,!!c.wordEnd,!!c.bigWord)},moveTillCharacter:function(a,b,c){var d=c.repeat,e=ra(a,d,c.forward,c.selectedCharacter),f=c.forward?-1:1;return na(f,c),e?(e.ch+=f,e):null},moveToCharacter:function(a,b,c){var d=c.repeat;return na(0,c),ra(a,d,c.forward,c.selectedCharacter)||b},moveToSymbol:function(a,b,c){var d=c.repeat;return oa(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,sa(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,ka(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,ka(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=wa(a,b,g,i);else if(f[g])h=xa(a,b,g,i);else if("W"===g)h=la(a,i,!0,!0);else if("w"===g)h=la(a,i,!0,!1);else{if("p"!==g)return null;if(h=va(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?da(a,h.start,h.end):[h.start,h.end]},repeatLastCharacterSearch:function(a,b,c){var d=tb.lastChararacterSearch,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=ra(a,e,f,d.selectedCharacter);return h?(h.ch+=g,h):(a.moveH(g,"char"),b)}},yb={change:function(b,c,d){var e,f,g=b.state.vim;if(tb.macroModeState.lastInsertModeChanges.inVisualBlock=g.visualBlock,g.visualMode){f=b.getSelection();var h=F("",d.length);b.replaceSelections(h),e=T(d[0].head,d[0].anchor)}else{var i=d[0].anchor,j=d[0].head;f=b.getRange(i,j);var k=g.lastEditInputState||{};if("moveByWords"==k.motion&&!r(f)){var l=/\s+$/.exec(f);l&&k.motionArgs&&k.motionArgs.forward&&(j=K(j,0,-l[0].length),f=f.slice(0,-l[0].length))}var m=j.line-1==b.lastLine();b.replaceRange("",i,j),c.linewise&&!m&&(a.commands.newlineAndIndent(b),i.ch=null),e=i}tb.registerController.pushText(c.registerName,"change",f,c.linewise,d.length>1),zb.enterInsertMode(b,{head:e},b.state.vim)},"delete":function(a,b,c){var e,f,g=a.state.vim;if(g.visualBlock){f=a.getSelection();var h=F("",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,W(a,i.line-1))),f=a.getRange(i,j),a.replaceRange("",i,j),e=i,b.linewise&&(e=xb.moveToFirstNonWhiteSpaceCharacter(a,i))}return tb.registerController.pushText(b.registerName,"delete",f,b.linewise,g.visualBlock),I(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 xb.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?K(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"})),tb.macroModeState.isPlaying||(b.on("change",$a),a.on(b.getInputField(),"keydown",db)),e.visualMode&&ha(b),_(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":""}),ea(b)):ha(b):(e.visualMode=!0,e.visualLine=!!c.linewise,e.visualBlock=!!c.blockwise,f=I(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":""}),ea(b),ta(b,e,"<",T(h,f)),ta(b,e,">",U(h,f)))},reselectLastSelection:function(b,c,d){var e=d.lastSelection;if(d.visualMode&&ca(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,ea(b),ta(b,d,"<",T(f,g)),ta(b,d,">",U(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"),S(f,e)){var g=f;f=e,e=g}f.ch=W(a,f.line)-1}else{var h=Math.max(b.repeat,2);e=a.getCursor(),f=I(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=W(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=W(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=S(j[0].anchor,j[0].head)?j[0].anchor:j[0].head,b.setCursor(i),ha(b,!1)):b.setCursor(K(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"),ya.prototype={getQuery:function(){return tb.query},setQuery:function(a){tb.query=a},getOverlay:function(){return this.searchOverlay},setOverlay:function(a){this.searchOverlay=a},isReversed:function(){return tb.isReversed},setReversed:function(a){tb.isReversed=a},getScrollbarAnnotate:function(){return this.annotate},setScrollbarAnnotate:function(a){this.annotate=a}};var Cb={"\\n":"\n","\\r":"\r","\\t":" "},Db={"\\/":"/","\\\\":"\\","\\n":"\n","\\r":"\r","\\t":" "},Eb="(Javascript regexp)",Fb=function(){this.buildCommandMap_()};Fb.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=tb.registerController.getRegister(":"),g=f.toString();e.visualMode&&ha(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 Ha(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+"
    ")}Ha(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"}b.eatSpace()&&b.match(/\/.*\//)}}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 Ha(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,W(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 Ha(a,l);var o=0,p=function(){if(o=k)return void Ha(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]}}},Hb=new Fb;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(),vb};a.Vim=e()}); \ No newline at end of file diff --git a/media/editors/codemirror/lib/codemirror-uncompressed.css b/media/editors/codemirror/lib/codemirror-uncompressed.css deleted file mode 100644 index cb4110a2daac2..0000000000000 --- a/media/editors/codemirror/lib/codemirror-uncompressed.css +++ /dev/null @@ -1,406 +0,0 @@ -/* BASICS */ - -.CodeMirror { - /* Set height, width, borders, and global font properties here */ - font-family: monospace; - height: 300px; -} - -/* PADDING */ - -.CodeMirror-lines { - padding: 4px 0; /* Vertical padding around content */ -} -.CodeMirror pre { - padding: 0 4px; /* Horizontal padding of content */ -} - -.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler { - background-color: white; /* The little square between H and V scrollbars */ -} - -/* GUTTER */ - -.CodeMirror-gutters { - border-right: 1px solid #ddd; - background-color: #f7f7f7; - white-space: nowrap; -} -.CodeMirror-linenumbers {} -.CodeMirror-linenumber { - padding: 0 3px 0 5px; - min-width: 20px; - text-align: right; - color: #999; - -moz-box-sizing: content-box; - box-sizing: content-box; -} - -.CodeMirror-guttermarker { color: black; } -.CodeMirror-guttermarker-subtle { color: #999; } - -/* CURSOR */ - -.CodeMirror div.CodeMirror-cursor { - border-left: 1px solid black; -} -/* Shown when moving in bi-directional text */ -.CodeMirror div.CodeMirror-secondarycursor { - border-left: 1px solid silver; -} -.CodeMirror.cm-fat-cursor div.CodeMirror-cursor { - width: auto; - border: 0; - background: #7e7; -} -.CodeMirror.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; -} -@-moz-keyframes blink { - 0% { background: #7e7; } - 50% { background: none; } - 100% { background: #7e7; } -} -@-webkit-keyframes blink { - 0% { background: #7e7; } - 50% { background: none; } - 100% { background: #7e7; } -} -@keyframes blink { - 0% { background: #7e7; } - 50% { background: none; } - 100% { background: #7e7; } -} - -/* Can style cursor different in overwrite (non-insert) mode */ -div.CodeMirror-overwrite div.CodeMirror-cursor {} - -.cm-tab { display: inline-block; text-decoration: inherit; } - -.CodeMirror-ruler { - border-left: 1px solid #ccc; - position: absolute; -} - -/* DEFAULT THEME */ - -.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, -.cm-s-default .cm-punctuation, -.cm-s-default .cm-property, -.cm-s-default .cm-operator {} -.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 {color: #555;} -.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-header {color: blue;} -.cm-s-default .cm-quote {color: #090;} -.cm-s-default .cm-hr {color: #999;} -.cm-s-default .cm-link {color: #00c;} - -.cm-negative {color: #d44;} -.cm-positive {color: #292;} -.cm-header, .cm-strong {font-weight: bold;} -.cm-em {font-style: italic;} -.cm-link {text-decoration: underline;} -.cm-strikethrough {text-decoration: line-through;} - -.cm-s-default .cm-error {color: #f00;} -.cm-invalidchar {color: #f00;} - -/* Default styles for common addons */ - -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;} - -/* STOP */ - -/* The rest of this file contains styles related to the mechanics of - the editor. You probably shouldn't touch them. */ - -.CodeMirror { - line-height: 1; - position: relative; - overflow: hidden; - background: white; - color: black; -} - -.CodeMirror-scroll { - overflow: scroll !important; /* Things will break if this is overridden */ - /* 30px is the magic margin used to hide the element's real scrollbars */ - /* See overflow: hidden in .CodeMirror */ - margin-bottom: -30px; margin-right: -30px; - padding-bottom: 30px; - height: 100%; - outline: none; /* Prevent dragging from highlighting the element */ - position: relative; - -moz-box-sizing: content-box; - box-sizing: content-box; -} -.CodeMirror-sizer { - position: relative; - border-right: 30px solid transparent; - -moz-box-sizing: content-box; - box-sizing: content-box; -} - -/* The fake, visible scrollbars. Used to force redraw during scrolling - before actuall scrolling happens, thus preventing shaking and - flickering artifacts. */ -.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler { - 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; - z-index: 3; -} -.CodeMirror-gutter { - white-space: normal; - height: 100%; - -moz-box-sizing: content-box; - box-sizing: content-box; - display: inline-block; - margin-bottom: -30px; - /* Hack to make IE7 behave */ - *zoom:1; - *display:inline; -} -.CodeMirror-gutter-wrapper { - position: absolute; - z-index: 4; - height: 100%; -} -.CodeMirror-gutter-elt { - position: absolute; - cursor: default; - z-index: 4; -} - -.CodeMirror-lines { - cursor: text; - min-height: 1px; /* prevents collapsing before first draw */ -} -.CodeMirror pre { - /* Reset some styles that the rest of the page might have set */ - -moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0; - border-width: 0; - background: transparent; - 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; -} -.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-widget {} - -.CodeMirror-measure { - position: absolute; - width: 100%; - height: 0; - overflow: hidden; - visibility: hidden; -} -.CodeMirror-measure pre { position: static; } - -.CodeMirror div.CodeMirror-cursor { - position: absolute; - border-right: none; - width: 0; -} - -div.CodeMirror-cursors { - visibility: hidden; - position: relative; - z-index: 3; -} -.CodeMirror-focused div.CodeMirror-cursors { - visibility: visible; -} - -.CodeMirror-selected { background: #d9d9d9; } -.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; } -.CodeMirror-crosshair { cursor: crosshair; } - -.cm-searching { - background: #ffa; - background: rgba(255, 255, 0, .4); -} - -/* IE7 hack to prevent it from returning funny offsetTops on the spans */ -.CodeMirror span { *vertical-align: text-bottom; } - -/* Used to force a border model for a node */ -.cm-force-border { padding-right: .1px; } - -@media print { - /* Hide the cursor when printing */ - .CodeMirror div.CodeMirror-cursors { - visibility: hidden; - } -} - -/* See issue #2901 */ -.cm-tab-wrap-hack:after { content: ''; } - -/* Help users use markselection to safely style text background */ -span.CodeMirror-selectedtext { background: none; } -/** - * addon/display/fullscreen.css - * addon/fold/foldgutter.css - * addon/scroll/simplescrollbars.css -**/ -.CodeMirror-fullscreen { - position: fixed; - top: 0; left: 0; right: 0; bottom: 0; - height: auto; - z-index: 9; -} -.CodeMirror-foldmarker { - color: blue; - text-shadow: #b9f 1px 1px 2px, #b9f -1px -1px 2px, #b9f 1px -1px 2px, #b9f -1px 1px 2px; - font-family: arial; - line-height: .3; - cursor: pointer; -} -.CodeMirror-foldgutter { - width: .7em; -} -.CodeMirror-foldgutter-open, -.CodeMirror-foldgutter-folded { - cursor: pointer; -} -.CodeMirror-foldgutter-open:after { - content: "\25BE"; -} -.CodeMirror-foldgutter-folded:after { - content: "\25B8"; -} -.CodeMirror-simplescroll-horizontal div, .CodeMirror-simplescroll-vertical div { - position: absolute; - background: #ccc; - -moz-box-sizing: border-box; - box-sizing: border-box; - border: 1px solid #bbb; - border-radius: 2px; -} - -.CodeMirror-simplescroll-horizontal, .CodeMirror-simplescroll-vertical { - position: absolute; - z-index: 6; - background: #eee; -} - -.CodeMirror-simplescroll-horizontal { - bottom: 0; left: 0; - height: 8px; -} -.CodeMirror-simplescroll-horizontal div { - bottom: 0; - height: 100%; -} - -.CodeMirror-simplescroll-vertical { - right: 0; top: 0; - width: 8px; -} -.CodeMirror-simplescroll-vertical div { - right: 0; - width: 100%; -} - - -.CodeMirror-overlayscroll .CodeMirror-scrollbar-filler, .CodeMirror-overlayscroll .CodeMirror-gutter-filler { - display: none; -} - -.CodeMirror-overlayscroll-horizontal div, .CodeMirror-overlayscroll-vertical div { - position: absolute; - background: #bcd; - border-radius: 3px; -} - -.CodeMirror-overlayscroll-horizontal, .CodeMirror-overlayscroll-vertical { - position: absolute; - z-index: 6; -} - -.CodeMirror-overlayscroll-horizontal { - bottom: 0; left: 0; - height: 6px; -} -.CodeMirror-overlayscroll-horizontal div { - bottom: 0; - height: 100%; -} - -.CodeMirror-overlayscroll-vertical { - right: 0; top: 0; - width: 6px; -} -.CodeMirror-overlayscroll-vertical div { - right: 0; - width: 100%; -} diff --git a/media/editors/codemirror/lib/codemirror-uncompressed.js b/media/editors/codemirror/lib/codemirror-uncompressed.js deleted file mode 100644 index 03a34dbbfb78b..0000000000000 --- a/media/editors/codemirror/lib/codemirror-uncompressed.js +++ /dev/null @@ -1,8045 +0,0 @@ -// CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: http://codemirror.net/LICENSE - -// This is CodeMirror (http://codemirror.net), a code editor -// implemented in JavaScript on top of the browser's DOM. -// -// You can find some technical background for some of the code below -// at http://marijnhaverbeke.nl/blog/#cm-internals . - -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - module.exports = mod(); - else if (typeof define == "function" && define.amd) // AMD - return define([], mod); - else // Plain browser env - this.CodeMirror = mod(); -})(function() { - "use strict"; - - // BROWSER SNIFFING - - // Kludges for bugs and behavior differences that can't be feature - // detected are enabled based on userAgent etc sniffing. - - var gecko = /gecko\/\d/i.test(navigator.userAgent); - // ie_uptoN means Internet Explorer version N or lower - var ie_upto10 = /MSIE \d/.test(navigator.userAgent); - var ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent); - var ie = ie_upto10 || ie_11up; - var ie_version = ie && (ie_upto10 ? document.documentMode || 6 : ie_11up[1]); - var webkit = /WebKit\//.test(navigator.userAgent); - var qtwebkit = webkit && /Qt\/\d+\.\d+/.test(navigator.userAgent); - var chrome = /Chrome\//.test(navigator.userAgent); - var presto = /Opera\//.test(navigator.userAgent); - var safari = /Apple Computer/.test(navigator.vendor); - var khtml = /KHTML\//.test(navigator.userAgent); - var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent); - var phantom = /PhantomJS/.test(navigator.userAgent); - - var ios = /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent); - // This is woefully incomplete. Suggestions for alternative methods welcome. - var mobile = ios || /Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent); - var mac = ios || /Mac/.test(navigator.platform); - var windows = /win/i.test(navigator.platform); - - var presto_version = presto && navigator.userAgent.match(/Version\/(\d*\.\d*)/); - if (presto_version) presto_version = Number(presto_version[1]); - if (presto_version && presto_version >= 15) { presto = false; webkit = true; } - // Some browsers use the wrong event properties to signal cmd/ctrl on OS X - var flipCtrlCmd = mac && (qtwebkit || presto && (presto_version == null || presto_version < 12.11)); - var captureRightClick = gecko || (ie && ie_version >= 9); - - // Optimize some code when these features are not used. - var sawReadOnlySpans = false, sawCollapsedSpans = false; - - // EDITOR CONSTRUCTOR - - // A CodeMirror instance represents an editor. This is the object - // that user code is usually dealing with. - - function CodeMirror(place, options) { - if (!(this instanceof CodeMirror)) return new CodeMirror(place, options); - - this.options = options = options ? copyObj(options) : {}; - // Determine effective options based on given values and defaults. - copyObj(defaults, options, false); - setGuttersForLineNumbers(options); - - var doc = options.value; - if (typeof doc == "string") doc = new Doc(doc, options.mode); - this.doc = doc; - - var display = this.display = new Display(place, doc); - display.wrapper.CodeMirror = this; - updateGutters(this); - themeChanged(this); - if (options.lineWrapping) - this.display.wrapper.className += " CodeMirror-wrap"; - if (options.autofocus && !mobile) focusInput(this); - initScrollbars(this); - - this.state = { - keyMaps: [], // stores maps added by addKeyMap - overlays: [], // highlighting overlays, as added by addOverlay - modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info - overwrite: false, focused: false, - suppressEdits: false, // used to disable editing during key handlers when in readOnly mode - pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in readInput - draggingText: false, - highlight: new Delayed(), // stores highlight worker timeout - keySeq: null // Unfinished key sequence - }; - - // Override magic textarea content restore that IE sometimes does - // on our hidden textarea on reload - if (ie && ie_version < 11) setTimeout(bind(resetInput, this, true), 20); - - registerEventHandlers(this); - ensureGlobalHandlers(); - - startOperation(this); - this.curOp.forceUpdate = true; - attachDoc(this, doc); - - if ((options.autofocus && !mobile) || activeElt() == display.input) - setTimeout(bind(onFocus, this), 20); - else - onBlur(this); - - for (var opt in optionHandlers) if (optionHandlers.hasOwnProperty(opt)) - optionHandlers[opt](this, options[opt], Init); - maybeUpdateLineNumberWidth(this); - for (var i = 0; i < initHooks.length; ++i) initHooks[i](this); - endOperation(this); - // Suppress optimizelegibility in Webkit, since it breaks text - // measuring on line wrapping boundaries. - if (webkit && options.lineWrapping && - getComputedStyle(display.lineDiv).textRendering == "optimizelegibility") - display.lineDiv.style.textRendering = "auto"; - } - - // DISPLAY CONSTRUCTOR - - // The display handles the DOM integration, both for input reading - // and content drawing. It holds references to DOM nodes and - // display-related state. - - function Display(place, doc) { - var d = this; - - // The semihidden textarea that is focused when the editor is - // focused, and receives input. - var input = d.input = elt("textarea", null, null, "position: absolute; padding: 0; width: 1px; height: 1em; outline: none"); - // The textarea is kept positioned near the cursor to prevent the - // fact that it'll be scrolled into view on input from scrolling - // our fake cursor out of view. On webkit, when wrap=off, paste is - // very slow. So make the area wide instead. - if (webkit) input.style.width = "1000px"; - else input.setAttribute("wrap", "off"); - // If border: 0; -- iOS fails to open keyboard (issue #1287) - if (ios) input.style.border = "1px solid black"; - input.setAttribute("autocorrect", "off"); input.setAttribute("autocapitalize", "off"); input.setAttribute("spellcheck", "false"); - - // Wraps and hides input textarea - d.inputDiv = elt("div", [input], null, "overflow: hidden; position: relative; width: 3px; height: 0px;"); - // Covers bottom-right square when both scrollbars are present. - d.scrollbarFiller = elt("div", null, "CodeMirror-scrollbar-filler"); - d.scrollbarFiller.setAttribute("not-content", "true"); - // Covers bottom of gutter when coverGutterNextToScrollbar is on - // and h scrollbar is present. - d.gutterFiller = elt("div", null, "CodeMirror-gutter-filler"); - d.gutterFiller.setAttribute("not-content", "true"); - // Will contain the actual code, positioned to cover the viewport. - d.lineDiv = elt("div", null, "CodeMirror-code"); - // Elements are added to these to represent selection and cursors. - d.selectionDiv = elt("div", null, null, "position: relative; z-index: 1"); - d.cursorDiv = elt("div", null, "CodeMirror-cursors"); - // A visibility: hidden element used to find the size of things. - d.measure = elt("div", null, "CodeMirror-measure"); - // When lines outside of the viewport are measured, they are drawn in this. - d.lineMeasure = elt("div", null, "CodeMirror-measure"); - // Wraps everything that needs to exist inside the vertically-padded coordinate system - d.lineSpace = elt("div", [d.measure, d.lineMeasure, d.selectionDiv, d.cursorDiv, d.lineDiv], - null, "position: relative; outline: none"); - // Moved around its parent to cover visible view. - d.mover = elt("div", [elt("div", [d.lineSpace], "CodeMirror-lines")], null, "position: relative"); - // Set to the height of the document, allowing scrolling. - d.sizer = elt("div", [d.mover], "CodeMirror-sizer"); - d.sizerWidth = null; - // Behavior of elts with overflow: auto and padding is - // inconsistent across browsers. This is used to ensure the - // scrollable area is big enough. - d.heightForcer = elt("div", null, null, "position: absolute; height: " + scrollerGap + "px; width: 1px;"); - // Will contain the gutters, if any. - d.gutters = elt("div", null, "CodeMirror-gutters"); - d.lineGutter = null; - // Actual scrollable element. - d.scroller = elt("div", [d.sizer, d.heightForcer, d.gutters], "CodeMirror-scroll"); - d.scroller.setAttribute("tabIndex", "-1"); - // The element in which the editor lives. - d.wrapper = elt("div", [d.inputDiv, d.scrollbarFiller, d.gutterFiller, d.scroller], "CodeMirror"); - - // Work around IE7 z-index bug (not perfect, hence IE7 not really being supported) - if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0; } - // Needed to hide big blue blinking cursor on Mobile Safari - if (ios) input.style.width = "0px"; - if (!webkit) d.scroller.draggable = true; - // Needed to handle Tab key in KHTML - if (khtml) { d.inputDiv.style.height = "1px"; d.inputDiv.style.position = "absolute"; } - - if (place) { - if (place.appendChild) place.appendChild(d.wrapper); - else place(d.wrapper); - } - - // Current rendered range (may be bigger than the view window). - d.viewFrom = d.viewTo = doc.first; - d.reportedViewFrom = d.reportedViewTo = doc.first; - // Information about the rendered lines. - d.view = []; - d.renderedView = null; - // Holds info about a single rendered line when it was rendered - // for measurement, while not in view. - d.externalMeasured = null; - // Empty space (in pixels) above the view - d.viewOffset = 0; - d.lastWrapHeight = d.lastWrapWidth = 0; - d.updateLineNumbers = null; - - d.nativeBarWidth = d.barHeight = d.barWidth = 0; - d.scrollbarsClipped = false; - - // Used to only resize the line number gutter when necessary (when - // the amount of lines crosses a boundary that makes its width change) - d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null; - // See readInput and resetInput - d.prevInput = ""; - // Set to true when a non-horizontal-scrolling line widget is - // added. As an optimization, line widget aligning is skipped when - // this is false. - d.alignWidgets = false; - // Flag that indicates whether we expect input to appear real soon - // now (after some event like 'keypress' or 'input') and are - // polling intensively. - d.pollingFast = false; - // Self-resetting timeout for the poller - d.poll = new Delayed(); - - d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null; - - // Tracks when resetInput has punted to just putting a short - // string into the textarea instead of the full selection. - d.inaccurateSelection = false; - - // Tracks the maximum line length so that the horizontal scrollbar - // can be kept static when scrolling. - d.maxLine = null; - d.maxLineLength = 0; - d.maxLineChanged = false; - - // Used for measuring wheel scrolling granularity - d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null; - - // True when shift is held down. - d.shift = false; - - // Used to track whether anything happened since the context menu - // was opened. - d.selForContextMenu = null; - } - - // STATE UPDATES - - // Used to get the editor into a consistent state again when options change. - - function loadMode(cm) { - cm.doc.mode = CodeMirror.getMode(cm.options, cm.doc.modeOption); - resetModeState(cm); - } - - function resetModeState(cm) { - cm.doc.iter(function(line) { - if (line.stateAfter) line.stateAfter = null; - if (line.styles) line.styles = null; - }); - cm.doc.frontier = cm.doc.first; - startWorker(cm, 100); - cm.state.modeGen++; - if (cm.curOp) regChange(cm); - } - - function wrappingChanged(cm) { - if (cm.options.lineWrapping) { - addClass(cm.display.wrapper, "CodeMirror-wrap"); - cm.display.sizer.style.minWidth = ""; - cm.display.sizerWidth = null; - } else { - rmClass(cm.display.wrapper, "CodeMirror-wrap"); - findMaxLine(cm); - } - estimateLineHeights(cm); - regChange(cm); - clearCaches(cm); - setTimeout(function(){updateScrollbars(cm);}, 100); - } - - // Returns a function that estimates the height of a line, to use as - // first approximation until the line becomes visible (and is thus - // properly measurable). - function estimateHeight(cm) { - var th = textHeight(cm.display), wrapping = cm.options.lineWrapping; - var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3); - return function(line) { - if (lineIsHidden(cm.doc, line)) return 0; - - var widgetsHeight = 0; - if (line.widgets) for (var i = 0; i < line.widgets.length; i++) { - if (line.widgets[i].height) widgetsHeight += line.widgets[i].height; - } - - if (wrapping) - return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th; - else - return widgetsHeight + th; - }; - } - - function estimateLineHeights(cm) { - var doc = cm.doc, est = estimateHeight(cm); - doc.iter(function(line) { - var estHeight = est(line); - if (estHeight != line.height) updateLineHeight(line, estHeight); - }); - } - - function themeChanged(cm) { - cm.display.wrapper.className = cm.display.wrapper.className.replace(/\s*cm-s-\S+/g, "") + - cm.options.theme.replace(/(^|\s)\s*/g, " cm-s-"); - clearCaches(cm); - } - - function guttersChanged(cm) { - updateGutters(cm); - regChange(cm); - setTimeout(function(){alignHorizontally(cm);}, 20); - } - - // Rebuild the gutter elements, ensure the margin to the left of the - // code matches their width. - function updateGutters(cm) { - var gutters = cm.display.gutters, specs = cm.options.gutters; - removeChildren(gutters); - for (var i = 0; i < specs.length; ++i) { - var gutterClass = specs[i]; - var gElt = gutters.appendChild(elt("div", null, "CodeMirror-gutter " + gutterClass)); - if (gutterClass == "CodeMirror-linenumbers") { - cm.display.lineGutter = gElt; - gElt.style.width = (cm.display.lineNumWidth || 1) + "px"; - } - } - gutters.style.display = i ? "" : "none"; - updateGutterSpace(cm); - } - - function updateGutterSpace(cm) { - var width = cm.display.gutters.offsetWidth; - cm.display.sizer.style.marginLeft = width + "px"; - } - - // Compute the character length of a line, taking into account - // collapsed ranges (see markText) that might hide parts, and join - // other lines onto it. - function lineLength(line) { - if (line.height == 0) return 0; - var len = line.text.length, merged, cur = line; - while (merged = collapsedSpanAtStart(cur)) { - var found = merged.find(0, true); - cur = found.from.line; - len += found.from.ch - found.to.ch; - } - cur = line; - while (merged = collapsedSpanAtEnd(cur)) { - var found = merged.find(0, true); - len -= cur.text.length - found.from.ch; - cur = found.to.line; - len += cur.text.length - found.to.ch; - } - return len; - } - - // Find the longest line in the document. - function findMaxLine(cm) { - var d = cm.display, doc = cm.doc; - d.maxLine = getLine(doc, doc.first); - d.maxLineLength = lineLength(d.maxLine); - d.maxLineChanged = true; - doc.iter(function(line) { - var len = lineLength(line); - if (len > d.maxLineLength) { - d.maxLineLength = len; - d.maxLine = line; - } - }); - } - - // Make sure the gutters options contains the element - // "CodeMirror-linenumbers" when the lineNumbers option is true. - function setGuttersForLineNumbers(options) { - var found = indexOf(options.gutters, "CodeMirror-linenumbers"); - if (found == -1 && options.lineNumbers) { - options.gutters = options.gutters.concat(["CodeMirror-linenumbers"]); - } else if (found > -1 && !options.lineNumbers) { - options.gutters = options.gutters.slice(0); - options.gutters.splice(found, 1); - } - } - - // SCROLLBARS - - // Prepare DOM reads needed to update the scrollbars. Done in one - // shot to minimize update/measure roundtrips. - function measureForScrollbars(cm) { - var d = cm.display, gutterW = d.gutters.offsetWidth; - var docH = Math.round(cm.doc.height + paddingVert(cm.display)); - return { - clientHeight: d.scroller.clientHeight, - viewHeight: d.wrapper.clientHeight, - scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth, - viewWidth: d.wrapper.clientWidth, - barLeft: cm.options.fixedGutter ? gutterW : 0, - docHeight: docH, - scrollHeight: docH + scrollGap(cm) + d.barHeight, - nativeBarWidth: d.nativeBarWidth, - gutterWidth: gutterW - }; - } - - function NativeScrollbars(place, scroll, cm) { - this.cm = cm; - var vert = this.vert = elt("div", [elt("div", null, null, "min-width: 1px")], "CodeMirror-vscrollbar"); - var horiz = this.horiz = elt("div", [elt("div", null, null, "height: 100%; min-height: 1px")], "CodeMirror-hscrollbar"); - place(vert); place(horiz); - - on(vert, "scroll", function() { - if (vert.clientHeight) scroll(vert.scrollTop, "vertical"); - }); - on(horiz, "scroll", function() { - if (horiz.clientWidth) scroll(horiz.scrollLeft, "horizontal"); - }); - - this.checkedOverlay = false; - // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8). - if (ie && ie_version < 8) this.horiz.style.minHeight = this.vert.style.minWidth = "18px"; - } - - NativeScrollbars.prototype = copyObj({ - update: function(measure) { - var needsH = measure.scrollWidth > measure.clientWidth + 1; - var needsV = measure.scrollHeight > measure.clientHeight + 1; - var sWidth = measure.nativeBarWidth; - - if (needsV) { - this.vert.style.display = "block"; - this.vert.style.bottom = needsH ? sWidth + "px" : "0"; - var totalHeight = measure.viewHeight - (needsH ? sWidth : 0); - // A bug in IE8 can cause this value to be negative, so guard it. - this.vert.firstChild.style.height = - Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + "px"; - } else { - this.vert.style.display = ""; - this.vert.firstChild.style.height = "0"; - } - - if (needsH) { - this.horiz.style.display = "block"; - this.horiz.style.right = needsV ? sWidth + "px" : "0"; - this.horiz.style.left = measure.barLeft + "px"; - var totalWidth = measure.viewWidth - measure.barLeft - (needsV ? sWidth : 0); - this.horiz.firstChild.style.width = - (measure.scrollWidth - measure.clientWidth + totalWidth) + "px"; - } else { - this.horiz.style.display = ""; - this.horiz.firstChild.style.width = "0"; - } - - if (!this.checkedOverlay && measure.clientHeight > 0) { - if (sWidth == 0) this.overlayHack(); - this.checkedOverlay = true; - } - - return {right: needsV ? sWidth : 0, bottom: needsH ? sWidth : 0}; - }, - setScrollLeft: function(pos) { - if (this.horiz.scrollLeft != pos) this.horiz.scrollLeft = pos; - }, - setScrollTop: function(pos) { - if (this.vert.scrollTop != pos) this.vert.scrollTop = pos; - }, - overlayHack: function() { - var w = mac && !mac_geMountainLion ? "12px" : "18px"; - this.horiz.style.minHeight = this.vert.style.minWidth = w; - var self = this; - var barMouseDown = function(e) { - if (e_target(e) != self.vert && e_target(e) != self.horiz) - operation(self.cm, onMouseDown)(e); - }; - on(this.vert, "mousedown", barMouseDown); - on(this.horiz, "mousedown", barMouseDown); - }, - clear: function() { - var parent = this.horiz.parentNode; - parent.removeChild(this.horiz); - parent.removeChild(this.vert); - } - }, NativeScrollbars.prototype); - - function NullScrollbars() {} - - NullScrollbars.prototype = copyObj({ - update: function() { return {bottom: 0, right: 0}; }, - setScrollLeft: function() {}, - setScrollTop: function() {}, - clear: function() {} - }, NullScrollbars.prototype); - - CodeMirror.scrollbarModel = {"native": NativeScrollbars, "null": NullScrollbars}; - - function initScrollbars(cm) { - if (cm.display.scrollbars) { - cm.display.scrollbars.clear(); - if (cm.display.scrollbars.addClass) - rmClass(cm.display.wrapper, cm.display.scrollbars.addClass); - } - - cm.display.scrollbars = new CodeMirror.scrollbarModel[cm.options.scrollbarStyle](function(node) { - cm.display.wrapper.insertBefore(node, cm.display.scrollbarFiller); - on(node, "mousedown", function() { - if (cm.state.focused) setTimeout(bind(focusInput, cm), 0); - }); - node.setAttribute("not-content", "true"); - }, function(pos, axis) { - if (axis == "horizontal") setScrollLeft(cm, pos); - else setScrollTop(cm, pos); - }, cm); - if (cm.display.scrollbars.addClass) - addClass(cm.display.wrapper, cm.display.scrollbars.addClass); - } - - function updateScrollbars(cm, measure) { - if (!measure) measure = measureForScrollbars(cm); - var startWidth = cm.display.barWidth, startHeight = cm.display.barHeight; - updateScrollbarsInner(cm, measure); - for (var i = 0; i < 4 && startWidth != cm.display.barWidth || startHeight != cm.display.barHeight; i++) { - if (startWidth != cm.display.barWidth && cm.options.lineWrapping) - updateHeightsInViewport(cm); - updateScrollbarsInner(cm, measureForScrollbars(cm)); - startWidth = cm.display.barWidth; startHeight = cm.display.barHeight; - } - } - - // Re-synchronize the fake scrollbars with the actual size of the - // content. - function updateScrollbarsInner(cm, measure) { - var d = cm.display; - var sizes = d.scrollbars.update(measure); - - d.sizer.style.paddingRight = (d.barWidth = sizes.right) + "px"; - d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + "px"; - - if (sizes.right && sizes.bottom) { - d.scrollbarFiller.style.display = "block"; - d.scrollbarFiller.style.height = sizes.bottom + "px"; - d.scrollbarFiller.style.width = sizes.right + "px"; - } else d.scrollbarFiller.style.display = ""; - if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) { - d.gutterFiller.style.display = "block"; - d.gutterFiller.style.height = sizes.bottom + "px"; - d.gutterFiller.style.width = measure.gutterWidth + "px"; - } else d.gutterFiller.style.display = ""; - } - - // Compute the lines that are visible in a given viewport (defaults - // the the current scroll position). viewport may contain top, - // height, and ensure (see op.scrollToPos) properties. - function visibleLines(display, doc, viewport) { - var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop; - top = Math.floor(top - paddingTop(display)); - var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight; - - var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom); - // Ensure is a {from: {line, ch}, to: {line, ch}} object, and - // forces those lines into the viewport (if possible). - if (viewport && viewport.ensure) { - var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line; - if (ensureFrom < from) { - from = ensureFrom; - to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight); - } else if (Math.min(ensureTo, doc.lastLine()) >= to) { - from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight); - to = ensureTo; - } - } - return {from: from, to: Math.max(to, from + 1)}; - } - - // LINE NUMBERS - - // Re-align line numbers and gutter marks to compensate for - // horizontal scrolling. - function alignHorizontally(cm) { - var display = cm.display, view = display.view; - if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return; - var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft; - var gutterW = display.gutters.offsetWidth, left = comp + "px"; - for (var i = 0; i < view.length; i++) if (!view[i].hidden) { - if (cm.options.fixedGutter && view[i].gutter) - view[i].gutter.style.left = left; - var align = view[i].alignable; - if (align) for (var j = 0; j < align.length; j++) - align[j].style.left = left; - } - if (cm.options.fixedGutter) - display.gutters.style.left = (comp + gutterW) + "px"; - } - - // Used to ensure that the line number gutter is still the right - // size for the current document size. Returns true when an update - // is needed. - function maybeUpdateLineNumberWidth(cm) { - if (!cm.options.lineNumbers) return false; - var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display; - if (last.length != display.lineNumChars) { - var test = display.measure.appendChild(elt("div", [elt("div", last)], - "CodeMirror-linenumber CodeMirror-gutter-elt")); - var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW; - display.lineGutter.style.width = ""; - display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding); - display.lineNumWidth = display.lineNumInnerWidth + padding; - display.lineNumChars = display.lineNumInnerWidth ? last.length : -1; - display.lineGutter.style.width = display.lineNumWidth + "px"; - updateGutterSpace(cm); - return true; - } - return false; - } - - function lineNumberFor(options, i) { - return String(options.lineNumberFormatter(i + options.firstLineNumber)); - } - - // Computes display.scroller.scrollLeft + display.gutters.offsetWidth, - // but using getBoundingClientRect to get a sub-pixel-accurate - // result. - function compensateForHScroll(display) { - return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left; - } - - // DISPLAY DRAWING - - function DisplayUpdate(cm, viewport, force) { - var display = cm.display; - - this.viewport = viewport; - // Store some values that we'll need later (but don't want to force a relayout for) - this.visible = visibleLines(display, cm.doc, viewport); - this.editorIsHidden = !display.wrapper.offsetWidth; - this.wrapperHeight = display.wrapper.clientHeight; - this.wrapperWidth = display.wrapper.clientWidth; - this.oldDisplayWidth = displayWidth(cm); - this.force = force; - this.dims = getDimensions(cm); - } - - function maybeClipScrollbars(cm) { - var display = cm.display; - if (!display.scrollbarsClipped && display.scroller.offsetWidth) { - display.nativeBarWidth = display.scroller.offsetWidth - display.scroller.clientWidth; - display.heightForcer.style.height = scrollGap(cm) + "px"; - display.sizer.style.marginBottom = -display.nativeBarWidth + "px"; - display.sizer.style.borderRightWidth = scrollGap(cm) + "px"; - display.scrollbarsClipped = true; - } - } - - // Does the actual updating of the line display. Bails out - // (returning false) when there is nothing to be done and forced is - // false. - function updateDisplayIfNeeded(cm, update) { - var display = cm.display, doc = cm.doc; - - if (update.editorIsHidden) { - resetView(cm); - return false; - } - - // Bail out if the visible area is already rendered and nothing changed. - if (!update.force && - update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo && - (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) && - display.renderedView == display.view && countDirtyView(cm) == 0) - return false; - - if (maybeUpdateLineNumberWidth(cm)) { - resetView(cm); - update.dims = getDimensions(cm); - } - - // Compute a suitable new viewport (from & to) - var end = doc.first + doc.size; - var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first); - var to = Math.min(end, update.visible.to + cm.options.viewportMargin); - if (display.viewFrom < from && from - display.viewFrom < 20) from = Math.max(doc.first, display.viewFrom); - if (display.viewTo > to && display.viewTo - to < 20) to = Math.min(end, display.viewTo); - if (sawCollapsedSpans) { - from = visualLineNo(cm.doc, from); - to = visualLineEndNo(cm.doc, to); - } - - var different = from != display.viewFrom || to != display.viewTo || - display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth; - adjustView(cm, from, to); - - display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom)); - // Position the mover div to align with the current scroll position - cm.display.mover.style.top = display.viewOffset + "px"; - - var toUpdate = countDirtyView(cm); - if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view && - (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo)) - return false; - - // For big changes, we hide the enclosing element during the - // update, since that speeds up the operations on most browsers. - var focused = activeElt(); - if (toUpdate > 4) display.lineDiv.style.display = "none"; - patchDisplay(cm, display.updateLineNumbers, update.dims); - if (toUpdate > 4) display.lineDiv.style.display = ""; - display.renderedView = display.view; - // There might have been a widget with a focused element that got - // hidden or updated, if so re-focus it. - if (focused && activeElt() != focused && focused.offsetHeight) focused.focus(); - - // Prevent selection and cursors from interfering with the scroll - // width and height. - removeChildren(display.cursorDiv); - removeChildren(display.selectionDiv); - display.gutters.style.height = 0; - - if (different) { - display.lastWrapHeight = update.wrapperHeight; - display.lastWrapWidth = update.wrapperWidth; - startWorker(cm, 400); - } - - display.updateLineNumbers = null; - - return true; - } - - function postUpdateDisplay(cm, update) { - var force = update.force, viewport = update.viewport; - for (var first = true;; first = false) { - if (first && cm.options.lineWrapping && update.oldDisplayWidth != displayWidth(cm)) { - force = true; - } else { - force = false; - // Clip forced viewport to actual scrollable area. - if (viewport && viewport.top != null) - viewport = {top: Math.min(cm.doc.height + paddingVert(cm.display) - displayHeight(cm), viewport.top)}; - // Updated line heights might result in the drawn area not - // actually covering the viewport. Keep looping until it does. - update.visible = visibleLines(cm.display, cm.doc, viewport); - if (update.visible.from >= cm.display.viewFrom && update.visible.to <= cm.display.viewTo) - break; - } - if (!updateDisplayIfNeeded(cm, update)) break; - updateHeightsInViewport(cm); - var barMeasure = measureForScrollbars(cm); - updateSelection(cm); - setDocumentHeight(cm, barMeasure); - updateScrollbars(cm, barMeasure); - } - - signalLater(cm, "update", cm); - if (cm.display.viewFrom != cm.display.reportedViewFrom || cm.display.viewTo != cm.display.reportedViewTo) { - signalLater(cm, "viewportChange", cm, cm.display.viewFrom, cm.display.viewTo); - cm.display.reportedViewFrom = cm.display.viewFrom; cm.display.reportedViewTo = cm.display.viewTo; - } - } - - function updateDisplaySimple(cm, viewport) { - var update = new DisplayUpdate(cm, viewport); - if (updateDisplayIfNeeded(cm, update)) { - updateHeightsInViewport(cm); - postUpdateDisplay(cm, update); - var barMeasure = measureForScrollbars(cm); - updateSelection(cm); - setDocumentHeight(cm, barMeasure); - updateScrollbars(cm, barMeasure); - } - } - - function setDocumentHeight(cm, measure) { - cm.display.sizer.style.minHeight = measure.docHeight + "px"; - var total = measure.docHeight + cm.display.barHeight; - cm.display.heightForcer.style.top = total + "px"; - cm.display.gutters.style.height = Math.max(total + scrollGap(cm), measure.clientHeight) + "px"; - } - - // Read the actual heights of the rendered lines, and update their - // stored heights to match. - function updateHeightsInViewport(cm) { - var display = cm.display; - var prevBottom = display.lineDiv.offsetTop; - for (var i = 0; i < display.view.length; i++) { - var cur = display.view[i], height; - if (cur.hidden) continue; - if (ie && ie_version < 8) { - var bot = cur.node.offsetTop + cur.node.offsetHeight; - height = bot - prevBottom; - prevBottom = bot; - } else { - var box = cur.node.getBoundingClientRect(); - height = box.bottom - box.top; - } - var diff = cur.line.height - height; - if (height < 2) height = textHeight(display); - if (diff > .001 || diff < -.001) { - updateLineHeight(cur.line, height); - updateWidgetHeight(cur.line); - if (cur.rest) for (var j = 0; j < cur.rest.length; j++) - updateWidgetHeight(cur.rest[j]); - } - } - } - - // Read and store the height of line widgets associated with the - // given line. - function updateWidgetHeight(line) { - if (line.widgets) for (var i = 0; i < line.widgets.length; ++i) - line.widgets[i].height = line.widgets[i].node.offsetHeight; - } - - // Do a bulk-read of the DOM positions and sizes needed to draw the - // view, so that we don't interleave reading and writing to the DOM. - function getDimensions(cm) { - var d = cm.display, left = {}, width = {}; - var gutterLeft = d.gutters.clientLeft; - for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) { - left[cm.options.gutters[i]] = n.offsetLeft + n.clientLeft + gutterLeft; - width[cm.options.gutters[i]] = n.clientWidth; - } - return {fixedPos: compensateForHScroll(d), - gutterTotalWidth: d.gutters.offsetWidth, - gutterLeft: left, - gutterWidth: width, - wrapperWidth: d.wrapper.clientWidth}; - } - - // Sync the actual display DOM structure with display.view, removing - // nodes for lines that are no longer in view, and creating the ones - // that are not there yet, and updating the ones that are out of - // date. - function patchDisplay(cm, updateNumbersFrom, dims) { - var display = cm.display, lineNumbers = cm.options.lineNumbers; - var container = display.lineDiv, cur = container.firstChild; - - function rm(node) { - var next = node.nextSibling; - // Works around a throw-scroll bug in OS X Webkit - if (webkit && mac && cm.display.currentWheelTarget == node) - node.style.display = "none"; - else - node.parentNode.removeChild(node); - return next; - } - - var view = display.view, lineN = display.viewFrom; - // Loop over the elements in the view, syncing cur (the DOM nodes - // in display.lineDiv) with the view as we go. - for (var i = 0; i < view.length; i++) { - var lineView = view[i]; - if (lineView.hidden) { - } else if (!lineView.node) { // Not drawn yet - var node = buildLineElement(cm, lineView, lineN, dims); - container.insertBefore(node, cur); - } else { // Already drawn - while (cur != lineView.node) cur = rm(cur); - var updateNumber = lineNumbers && updateNumbersFrom != null && - updateNumbersFrom <= lineN && lineView.lineNumber; - if (lineView.changes) { - if (indexOf(lineView.changes, "gutter") > -1) updateNumber = false; - updateLineForChanges(cm, lineView, lineN, dims); - } - if (updateNumber) { - removeChildren(lineView.lineNumber); - lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN))); - } - cur = lineView.node.nextSibling; - } - lineN += lineView.size; - } - while (cur) cur = rm(cur); - } - - // When an aspect of a line changes, a string is added to - // lineView.changes. This updates the relevant part of the line's - // DOM structure. - function updateLineForChanges(cm, lineView, lineN, dims) { - for (var j = 0; j < lineView.changes.length; j++) { - var type = lineView.changes[j]; - if (type == "text") updateLineText(cm, lineView); - else if (type == "gutter") updateLineGutter(cm, lineView, lineN, dims); - else if (type == "class") updateLineClasses(lineView); - else if (type == "widget") updateLineWidgets(lineView, dims); - } - lineView.changes = null; - } - - // Lines with gutter elements, widgets or a background class need to - // be wrapped, and have the extra elements added to the wrapper div - function ensureLineWrapped(lineView) { - if (lineView.node == lineView.text) { - lineView.node = elt("div", null, null, "position: relative"); - if (lineView.text.parentNode) - lineView.text.parentNode.replaceChild(lineView.node, lineView.text); - lineView.node.appendChild(lineView.text); - if (ie && ie_version < 8) lineView.node.style.zIndex = 2; - } - return lineView.node; - } - - function updateLineBackground(lineView) { - var cls = lineView.bgClass ? lineView.bgClass + " " + (lineView.line.bgClass || "") : lineView.line.bgClass; - if (cls) cls += " CodeMirror-linebackground"; - if (lineView.background) { - if (cls) lineView.background.className = cls; - else { lineView.background.parentNode.removeChild(lineView.background); lineView.background = null; } - } else if (cls) { - var wrap = ensureLineWrapped(lineView); - lineView.background = wrap.insertBefore(elt("div", null, cls), wrap.firstChild); - } - } - - // Wrapper around buildLineContent which will reuse the structure - // in display.externalMeasured when possible. - function getLineContent(cm, lineView) { - var ext = cm.display.externalMeasured; - if (ext && ext.line == lineView.line) { - cm.display.externalMeasured = null; - lineView.measure = ext.measure; - return ext.built; - } - return buildLineContent(cm, lineView); - } - - // Redraw the line's text. Interacts with the background and text - // classes because the mode may output tokens that influence these - // classes. - function updateLineText(cm, lineView) { - var cls = lineView.text.className; - var built = getLineContent(cm, lineView); - if (lineView.text == lineView.node) lineView.node = built.pre; - lineView.text.parentNode.replaceChild(built.pre, lineView.text); - lineView.text = built.pre; - if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) { - lineView.bgClass = built.bgClass; - lineView.textClass = built.textClass; - updateLineClasses(lineView); - } else if (cls) { - lineView.text.className = cls; - } - } - - function updateLineClasses(lineView) { - updateLineBackground(lineView); - if (lineView.line.wrapClass) - ensureLineWrapped(lineView).className = lineView.line.wrapClass; - else if (lineView.node != lineView.text) - lineView.node.className = ""; - var textClass = lineView.textClass ? lineView.textClass + " " + (lineView.line.textClass || "") : lineView.line.textClass; - lineView.text.className = textClass || ""; - } - - function updateLineGutter(cm, lineView, lineN, dims) { - if (lineView.gutter) { - lineView.node.removeChild(lineView.gutter); - lineView.gutter = null; - } - var markers = lineView.line.gutterMarkers; - if (cm.options.lineNumbers || markers) { - var wrap = ensureLineWrapped(lineView); - var gutterWrap = lineView.gutter = - wrap.insertBefore(elt("div", null, "CodeMirror-gutter-wrapper", "left: " + - (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + - "px; width: " + dims.gutterTotalWidth + "px"), - lineView.text); - if (lineView.line.gutterClass) - gutterWrap.className += " " + lineView.line.gutterClass; - if (cm.options.lineNumbers && (!markers || !markers["CodeMirror-linenumbers"])) - lineView.lineNumber = gutterWrap.appendChild( - elt("div", lineNumberFor(cm.options, lineN), - "CodeMirror-linenumber CodeMirror-gutter-elt", - "left: " + dims.gutterLeft["CodeMirror-linenumbers"] + "px; width: " - + cm.display.lineNumInnerWidth + "px")); - if (markers) for (var k = 0; k < cm.options.gutters.length; ++k) { - var id = cm.options.gutters[k], found = markers.hasOwnProperty(id) && markers[id]; - if (found) - gutterWrap.appendChild(elt("div", [found], "CodeMirror-gutter-elt", "left: " + - dims.gutterLeft[id] + "px; width: " + dims.gutterWidth[id] + "px")); - } - } - } - - function updateLineWidgets(lineView, dims) { - if (lineView.alignable) lineView.alignable = null; - for (var node = lineView.node.firstChild, next; node; node = next) { - var next = node.nextSibling; - if (node.className == "CodeMirror-linewidget") - lineView.node.removeChild(node); - } - insertLineWidgets(lineView, dims); - } - - // Build a line's DOM representation from scratch - function buildLineElement(cm, lineView, lineN, dims) { - var built = getLineContent(cm, lineView); - lineView.text = lineView.node = built.pre; - if (built.bgClass) lineView.bgClass = built.bgClass; - if (built.textClass) lineView.textClass = built.textClass; - - updateLineClasses(lineView); - updateLineGutter(cm, lineView, lineN, dims); - insertLineWidgets(lineView, dims); - return lineView.node; - } - - // A lineView may contain multiple logical lines (when merged by - // collapsed spans). The widgets for all of them need to be drawn. - function insertLineWidgets(lineView, dims) { - insertLineWidgetsFor(lineView.line, lineView, dims, true); - if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++) - insertLineWidgetsFor(lineView.rest[i], lineView, dims, false); - } - - function insertLineWidgetsFor(line, lineView, dims, allowAbove) { - if (!line.widgets) return; - var wrap = ensureLineWrapped(lineView); - for (var i = 0, ws = line.widgets; i < ws.length; ++i) { - var widget = ws[i], node = elt("div", [widget.node], "CodeMirror-linewidget"); - if (!widget.handleMouseEvents) node.setAttribute("cm-ignore-events", "true"); - positionLineWidget(widget, node, lineView, dims); - if (allowAbove && widget.above) - wrap.insertBefore(node, lineView.gutter || lineView.text); - else - wrap.appendChild(node); - signalLater(widget, "redraw"); - } - } - - function positionLineWidget(widget, node, lineView, dims) { - if (widget.noHScroll) { - (lineView.alignable || (lineView.alignable = [])).push(node); - var width = dims.wrapperWidth; - node.style.left = dims.fixedPos + "px"; - if (!widget.coverGutter) { - width -= dims.gutterTotalWidth; - node.style.paddingLeft = dims.gutterTotalWidth + "px"; - } - node.style.width = width + "px"; - } - if (widget.coverGutter) { - node.style.zIndex = 5; - node.style.position = "relative"; - if (!widget.noHScroll) node.style.marginLeft = -dims.gutterTotalWidth + "px"; - } - } - - // POSITION OBJECT - - // A Pos instance represents a position within the text. - var Pos = CodeMirror.Pos = function(line, ch) { - if (!(this instanceof Pos)) return new Pos(line, ch); - this.line = line; this.ch = ch; - }; - - // Compare two positions, return 0 if they are the same, a negative - // number when a is less, and a positive number otherwise. - var cmp = CodeMirror.cmpPos = function(a, b) { return a.line - b.line || a.ch - b.ch; }; - - function copyPos(x) {return Pos(x.line, x.ch);} - function maxPos(a, b) { return cmp(a, b) < 0 ? b : a; } - function minPos(a, b) { return cmp(a, b) < 0 ? a : b; } - - // SELECTION / CURSOR - - // Selection objects are immutable. A new one is created every time - // the selection changes. A selection is one or more non-overlapping - // (and non-touching) ranges, sorted, and an integer that indicates - // which one is the primary selection (the one that's scrolled into - // view, that getCursor returns, etc). - function Selection(ranges, primIndex) { - this.ranges = ranges; - this.primIndex = primIndex; - } - - Selection.prototype = { - primary: function() { return this.ranges[this.primIndex]; }, - equals: function(other) { - if (other == this) return true; - if (other.primIndex != this.primIndex || other.ranges.length != this.ranges.length) return false; - for (var i = 0; i < this.ranges.length; i++) { - var here = this.ranges[i], there = other.ranges[i]; - if (cmp(here.anchor, there.anchor) != 0 || cmp(here.head, there.head) != 0) return false; - } - return true; - }, - deepCopy: function() { - for (var out = [], i = 0; i < this.ranges.length; i++) - out[i] = new Range(copyPos(this.ranges[i].anchor), copyPos(this.ranges[i].head)); - return new Selection(out, this.primIndex); - }, - somethingSelected: function() { - for (var i = 0; i < this.ranges.length; i++) - if (!this.ranges[i].empty()) return true; - return false; - }, - contains: function(pos, end) { - if (!end) end = pos; - for (var i = 0; i < this.ranges.length; i++) { - var range = this.ranges[i]; - if (cmp(end, range.from()) >= 0 && cmp(pos, range.to()) <= 0) - return i; - } - return -1; - } - }; - - function Range(anchor, head) { - this.anchor = anchor; this.head = head; - } - - Range.prototype = { - from: function() { return minPos(this.anchor, this.head); }, - to: function() { return maxPos(this.anchor, this.head); }, - empty: function() { - return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch; - } - }; - - // Take an unsorted, potentially overlapping set of ranges, and - // build a selection out of it. 'Consumes' ranges array (modifying - // it). - function normalizeSelection(ranges, primIndex) { - var prim = ranges[primIndex]; - ranges.sort(function(a, b) { return cmp(a.from(), b.from()); }); - primIndex = indexOf(ranges, prim); - for (var i = 1; i < ranges.length; i++) { - var cur = ranges[i], prev = ranges[i - 1]; - if (cmp(prev.to(), cur.from()) >= 0) { - var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to()); - var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head; - if (i <= primIndex) --primIndex; - ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to)); - } - } - return new Selection(ranges, primIndex); - } - - function simpleSelection(anchor, head) { - return new Selection([new Range(anchor, head || anchor)], 0); - } - - // Most of the external API clips given positions to make sure they - // actually exist within the document. - function clipLine(doc, n) {return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1));} - function clipPos(doc, pos) { - if (pos.line < doc.first) return Pos(doc.first, 0); - var last = doc.first + doc.size - 1; - if (pos.line > last) return Pos(last, getLine(doc, last).text.length); - return clipToLen(pos, getLine(doc, pos.line).text.length); - } - function clipToLen(pos, linelen) { - var ch = pos.ch; - if (ch == null || ch > linelen) return Pos(pos.line, linelen); - else if (ch < 0) return Pos(pos.line, 0); - else return pos; - } - function isLine(doc, l) {return l >= doc.first && l < doc.first + doc.size;} - function clipPosArray(doc, array) { - for (var out = [], i = 0; i < array.length; i++) out[i] = clipPos(doc, array[i]); - return out; - } - - // SELECTION UPDATES - - // The 'scroll' parameter given to many of these indicated whether - // the new cursor position should be scrolled into view after - // modifying the selection. - - // If shift is held or the extend flag is set, extends a range to - // include a given position (and optionally a second position). - // Otherwise, simply returns the range between the given positions. - // Used for cursor motion and such. - function extendRange(doc, range, head, other) { - if (doc.cm && doc.cm.display.shift || doc.extend) { - var anchor = range.anchor; - if (other) { - var posBefore = cmp(head, anchor) < 0; - if (posBefore != (cmp(other, anchor) < 0)) { - anchor = head; - head = other; - } else if (posBefore != (cmp(head, other) < 0)) { - head = other; - } - } - return new Range(anchor, head); - } else { - return new Range(other || head, head); - } - } - - // Extend the primary selection range, discard the rest. - function extendSelection(doc, head, other, options) { - setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options); - } - - // Extend all selections (pos is an array of selections with length - // equal the number of selections) - function extendSelections(doc, heads, options) { - for (var out = [], i = 0; i < doc.sel.ranges.length; i++) - out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null); - var newSel = normalizeSelection(out, doc.sel.primIndex); - setSelection(doc, newSel, options); - } - - // Updates a single range in the selection. - function replaceOneSelection(doc, i, range, options) { - var ranges = doc.sel.ranges.slice(0); - ranges[i] = range; - setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options); - } - - // Reset the selection to a single range. - function setSimpleSelection(doc, anchor, head, options) { - setSelection(doc, simpleSelection(anchor, head), options); - } - - // Give beforeSelectionChange handlers a change to influence a - // selection update. - function filterSelectionChange(doc, sel) { - var obj = { - ranges: sel.ranges, - update: function(ranges) { - this.ranges = []; - for (var i = 0; i < ranges.length; i++) - this.ranges[i] = new Range(clipPos(doc, ranges[i].anchor), - clipPos(doc, ranges[i].head)); - } - }; - signal(doc, "beforeSelectionChange", doc, obj); - if (doc.cm) signal(doc.cm, "beforeSelectionChange", doc.cm, obj); - if (obj.ranges != sel.ranges) return normalizeSelection(obj.ranges, obj.ranges.length - 1); - else return sel; - } - - function setSelectionReplaceHistory(doc, sel, options) { - var done = doc.history.done, last = lst(done); - if (last && last.ranges) { - done[done.length - 1] = sel; - setSelectionNoUndo(doc, sel, options); - } else { - setSelection(doc, sel, options); - } - } - - // Set a new selection. - function setSelection(doc, sel, options) { - setSelectionNoUndo(doc, sel, options); - addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options); - } - - function setSelectionNoUndo(doc, sel, options) { - if (hasHandler(doc, "beforeSelectionChange") || doc.cm && hasHandler(doc.cm, "beforeSelectionChange")) - sel = filterSelectionChange(doc, sel); - - var bias = options && options.bias || - (cmp(sel.primary().head, doc.sel.primary().head) < 0 ? -1 : 1); - setSelectionInner(doc, skipAtomicInSelection(doc, sel, bias, true)); - - if (!(options && options.scroll === false) && doc.cm) - ensureCursorVisible(doc.cm); - } - - function setSelectionInner(doc, sel) { - if (sel.equals(doc.sel)) return; - - doc.sel = sel; - - if (doc.cm) { - doc.cm.curOp.updateInput = doc.cm.curOp.selectionChanged = true; - signalCursorActivity(doc.cm); - } - signalLater(doc, "cursorActivity", doc); - } - - // Verify that the selection does not partially select any atomic - // marked ranges. - function reCheckSelection(doc) { - setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false), sel_dontScroll); - } - - // Return a selection that does not partially select any atomic - // ranges. - function skipAtomicInSelection(doc, sel, bias, mayClear) { - var out; - for (var i = 0; i < sel.ranges.length; i++) { - var range = sel.ranges[i]; - var newAnchor = skipAtomic(doc, range.anchor, bias, mayClear); - var newHead = skipAtomic(doc, range.head, bias, mayClear); - if (out || newAnchor != range.anchor || newHead != range.head) { - if (!out) out = sel.ranges.slice(0, i); - out[i] = new Range(newAnchor, newHead); - } - } - return out ? normalizeSelection(out, sel.primIndex) : sel; - } - - // Ensure a given position is not inside an atomic range. - function skipAtomic(doc, pos, bias, mayClear) { - var flipped = false, curPos = pos; - var dir = bias || 1; - doc.cantEdit = false; - search: for (;;) { - var line = getLine(doc, curPos.line); - if (line.markedSpans) { - for (var i = 0; i < line.markedSpans.length; ++i) { - var sp = line.markedSpans[i], m = sp.marker; - if ((sp.from == null || (m.inclusiveLeft ? sp.from <= curPos.ch : sp.from < curPos.ch)) && - (sp.to == null || (m.inclusiveRight ? sp.to >= curPos.ch : sp.to > curPos.ch))) { - if (mayClear) { - signal(m, "beforeCursorEnter"); - if (m.explicitlyCleared) { - if (!line.markedSpans) break; - else {--i; continue;} - } - } - if (!m.atomic) continue; - var newPos = m.find(dir < 0 ? -1 : 1); - if (cmp(newPos, curPos) == 0) { - newPos.ch += dir; - if (newPos.ch < 0) { - if (newPos.line > doc.first) newPos = clipPos(doc, Pos(newPos.line - 1)); - else newPos = null; - } else if (newPos.ch > line.text.length) { - if (newPos.line < doc.first + doc.size - 1) newPos = Pos(newPos.line + 1, 0); - else newPos = null; - } - if (!newPos) { - if (flipped) { - // Driven in a corner -- no valid cursor position found at all - // -- try again *with* clearing, if we didn't already - if (!mayClear) return skipAtomic(doc, pos, bias, true); - // Otherwise, turn off editing until further notice, and return the start of the doc - doc.cantEdit = true; - return Pos(doc.first, 0); - } - flipped = true; newPos = pos; dir = -dir; - } - } - curPos = newPos; - continue search; - } - } - } - return curPos; - } - } - - // SELECTION DRAWING - - // Redraw the selection and/or cursor - function drawSelection(cm) { - var display = cm.display, doc = cm.doc, result = {}; - var curFragment = result.cursors = document.createDocumentFragment(); - var selFragment = result.selection = document.createDocumentFragment(); - - for (var i = 0; i < doc.sel.ranges.length; i++) { - var range = doc.sel.ranges[i]; - var collapsed = range.empty(); - if (collapsed || cm.options.showCursorWhenSelecting) - drawSelectionCursor(cm, range, curFragment); - if (!collapsed) - drawSelectionRange(cm, range, selFragment); - } - - // Move the hidden textarea near the cursor to prevent scrolling artifacts - if (cm.options.moveInputWithCursor) { - var headPos = cursorCoords(cm, doc.sel.primary().head, "div"); - var wrapOff = display.wrapper.getBoundingClientRect(), lineOff = display.lineDiv.getBoundingClientRect(); - result.teTop = Math.max(0, Math.min(display.wrapper.clientHeight - 10, - headPos.top + lineOff.top - wrapOff.top)); - result.teLeft = Math.max(0, Math.min(display.wrapper.clientWidth - 10, - headPos.left + lineOff.left - wrapOff.left)); - } - - return result; - } - - function showSelection(cm, drawn) { - removeChildrenAndAdd(cm.display.cursorDiv, drawn.cursors); - removeChildrenAndAdd(cm.display.selectionDiv, drawn.selection); - if (drawn.teTop != null) { - cm.display.inputDiv.style.top = drawn.teTop + "px"; - cm.display.inputDiv.style.left = drawn.teLeft + "px"; - } - } - - function updateSelection(cm) { - showSelection(cm, drawSelection(cm)); - } - - // Draws a cursor for the given range - function drawSelectionCursor(cm, range, output) { - var pos = cursorCoords(cm, range.head, "div", null, null, !cm.options.singleCursorHeightPerLine); - - var cursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor")); - cursor.style.left = pos.left + "px"; - cursor.style.top = pos.top + "px"; - cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px"; - - if (pos.other) { - // Secondary cursor, shown when on a 'jump' in bi-directional text - var otherCursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor")); - otherCursor.style.display = ""; - otherCursor.style.left = pos.other.left + "px"; - otherCursor.style.top = pos.other.top + "px"; - otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + "px"; - } - } - - // Draws the given range as a highlighted selection - function drawSelectionRange(cm, range, output) { - var display = cm.display, doc = cm.doc; - var fragment = document.createDocumentFragment(); - var padding = paddingH(cm.display), leftSide = padding.left; - var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right; - - function add(left, top, width, bottom) { - if (top < 0) top = 0; - top = Math.round(top); - bottom = Math.round(bottom); - fragment.appendChild(elt("div", null, "CodeMirror-selected", "position: absolute; left: " + left + - "px; top: " + top + "px; width: " + (width == null ? rightSide - left : width) + - "px; height: " + (bottom - top) + "px")); - } - - function drawForLine(line, fromArg, toArg) { - var lineObj = getLine(doc, line); - var lineLen = lineObj.text.length; - var start, end; - function coords(ch, bias) { - return charCoords(cm, Pos(line, ch), "div", lineObj, bias); - } - - iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function(from, to, dir) { - var leftPos = coords(from, "left"), rightPos, left, right; - if (from == to) { - rightPos = leftPos; - left = right = leftPos.left; - } else { - rightPos = coords(to - 1, "right"); - if (dir == "rtl") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; } - left = leftPos.left; - right = rightPos.right; - } - if (fromArg == null && from == 0) left = leftSide; - if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part - add(left, leftPos.top, null, leftPos.bottom); - left = leftSide; - if (leftPos.bottom < rightPos.top) add(left, leftPos.bottom, null, rightPos.top); - } - if (toArg == null && to == lineLen) right = rightSide; - if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left) - start = leftPos; - if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right) - end = rightPos; - if (left < leftSide + 1) left = leftSide; - add(left, rightPos.top, right - left, rightPos.bottom); - }); - return {start: start, end: end}; - } - - var sFrom = range.from(), sTo = range.to(); - if (sFrom.line == sTo.line) { - drawForLine(sFrom.line, sFrom.ch, sTo.ch); - } else { - var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line); - var singleVLine = visualLine(fromLine) == visualLine(toLine); - var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end; - var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start; - if (singleVLine) { - if (leftEnd.top < rightStart.top - 2) { - add(leftEnd.right, leftEnd.top, null, leftEnd.bottom); - add(leftSide, rightStart.top, rightStart.left, rightStart.bottom); - } else { - add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom); - } - } - if (leftEnd.bottom < rightStart.top) - add(leftSide, leftEnd.bottom, null, rightStart.top); - } - - output.appendChild(fragment); - } - - // Cursor-blinking - function restartBlink(cm) { - if (!cm.state.focused) return; - var display = cm.display; - clearInterval(display.blinker); - var on = true; - display.cursorDiv.style.visibility = ""; - if (cm.options.cursorBlinkRate > 0) - display.blinker = setInterval(function() { - display.cursorDiv.style.visibility = (on = !on) ? "" : "hidden"; - }, cm.options.cursorBlinkRate); - else if (cm.options.cursorBlinkRate < 0) - display.cursorDiv.style.visibility = "hidden"; - } - - // HIGHLIGHT WORKER - - function startWorker(cm, time) { - if (cm.doc.mode.startState && cm.doc.frontier < cm.display.viewTo) - cm.state.highlight.set(time, bind(highlightWorker, cm)); - } - - function highlightWorker(cm) { - var doc = cm.doc; - if (doc.frontier < doc.first) doc.frontier = doc.first; - if (doc.frontier >= cm.display.viewTo) return; - var end = +new Date + cm.options.workTime; - var state = copyState(doc.mode, getStateBefore(cm, doc.frontier)); - var changedLines = []; - - doc.iter(doc.frontier, Math.min(doc.first + doc.size, cm.display.viewTo + 500), function(line) { - if (doc.frontier >= cm.display.viewFrom) { // Visible - var oldStyles = line.styles; - var highlighted = highlightLine(cm, line, state, true); - line.styles = highlighted.styles; - var oldCls = line.styleClasses, newCls = highlighted.classes; - if (newCls) line.styleClasses = newCls; - else if (oldCls) line.styleClasses = null; - var ischange = !oldStyles || oldStyles.length != line.styles.length || - oldCls != newCls && (!oldCls || !newCls || oldCls.bgClass != newCls.bgClass || oldCls.textClass != newCls.textClass); - for (var i = 0; !ischange && i < oldStyles.length; ++i) ischange = oldStyles[i] != line.styles[i]; - if (ischange) changedLines.push(doc.frontier); - line.stateAfter = copyState(doc.mode, state); - } else { - processLine(cm, line.text, state); - line.stateAfter = doc.frontier % 5 == 0 ? copyState(doc.mode, state) : null; - } - ++doc.frontier; - if (+new Date > end) { - startWorker(cm, cm.options.workDelay); - return true; - } - }); - if (changedLines.length) runInOp(cm, function() { - for (var i = 0; i < changedLines.length; i++) - regLineChange(cm, changedLines[i], "text"); - }); - } - - // Finds the line to start with when starting a parse. Tries to - // find a line with a stateAfter, so that it can start with a - // valid state. If that fails, it returns the line with the - // smallest indentation, which tends to need the least context to - // parse correctly. - function findStartLine(cm, n, precise) { - var minindent, minline, doc = cm.doc; - var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100); - for (var search = n; search > lim; --search) { - if (search <= doc.first) return doc.first; - var line = getLine(doc, search - 1); - if (line.stateAfter && (!precise || search <= doc.frontier)) return search; - var indented = countColumn(line.text, null, cm.options.tabSize); - if (minline == null || minindent > indented) { - minline = search - 1; - minindent = indented; - } - } - return minline; - } - - function getStateBefore(cm, n, precise) { - var doc = cm.doc, display = cm.display; - if (!doc.mode.startState) return true; - var pos = findStartLine(cm, n, precise), state = pos > doc.first && getLine(doc, pos-1).stateAfter; - if (!state) state = startState(doc.mode); - else state = copyState(doc.mode, state); - doc.iter(pos, n, function(line) { - processLine(cm, line.text, state); - var save = pos == n - 1 || pos % 5 == 0 || pos >= display.viewFrom && pos < display.viewTo; - line.stateAfter = save ? copyState(doc.mode, state) : null; - ++pos; - }); - if (precise) doc.frontier = pos; - return state; - } - - // POSITION MEASUREMENT - - function paddingTop(display) {return display.lineSpace.offsetTop;} - function paddingVert(display) {return display.mover.offsetHeight - display.lineSpace.offsetHeight;} - function paddingH(display) { - if (display.cachedPaddingH) return display.cachedPaddingH; - var e = removeChildrenAndAdd(display.measure, elt("pre", "x")); - var style = window.getComputedStyle ? window.getComputedStyle(e) : e.currentStyle; - var data = {left: parseInt(style.paddingLeft), right: parseInt(style.paddingRight)}; - if (!isNaN(data.left) && !isNaN(data.right)) display.cachedPaddingH = data; - return data; - } - - function scrollGap(cm) { return scrollerGap - cm.display.nativeBarWidth; } - function displayWidth(cm) { - return cm.display.scroller.clientWidth - scrollGap(cm) - cm.display.barWidth; - } - function displayHeight(cm) { - return cm.display.scroller.clientHeight - scrollGap(cm) - cm.display.barHeight; - } - - // Ensure the lineView.wrapping.heights array is populated. This is - // an array of bottom offsets for the lines that make up a drawn - // line. When lineWrapping is on, there might be more than one - // height. - function ensureLineHeights(cm, lineView, rect) { - var wrapping = cm.options.lineWrapping; - var curWidth = wrapping && displayWidth(cm); - if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) { - var heights = lineView.measure.heights = []; - if (wrapping) { - lineView.measure.width = curWidth; - var rects = lineView.text.firstChild.getClientRects(); - for (var i = 0; i < rects.length - 1; i++) { - var cur = rects[i], next = rects[i + 1]; - if (Math.abs(cur.bottom - next.bottom) > 2) - heights.push((cur.bottom + next.top) / 2 - rect.top); - } - } - heights.push(rect.bottom - rect.top); - } - } - - // Find a line map (mapping character offsets to text nodes) and a - // measurement cache for the given line number. (A line view might - // contain multiple lines when collapsed ranges are present.) - function mapFromLineView(lineView, line, lineN) { - if (lineView.line == line) - return {map: lineView.measure.map, cache: lineView.measure.cache}; - for (var i = 0; i < lineView.rest.length; i++) - if (lineView.rest[i] == line) - return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]}; - for (var i = 0; i < lineView.rest.length; i++) - if (lineNo(lineView.rest[i]) > lineN) - return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i], before: true}; - } - - // Render a line into the hidden node display.externalMeasured. Used - // when measurement is needed for a line that's not in the viewport. - function updateExternalMeasurement(cm, line) { - line = visualLine(line); - var lineN = lineNo(line); - var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN); - view.lineN = lineN; - var built = view.built = buildLineContent(cm, view); - view.text = built.pre; - removeChildrenAndAdd(cm.display.lineMeasure, built.pre); - return view; - } - - // Get a {top, bottom, left, right} box (in line-local coordinates) - // for a given character. - function measureChar(cm, line, ch, bias) { - return measureCharPrepared(cm, prepareMeasureForLine(cm, line), ch, bias); - } - - // Find a line view that corresponds to the given line number. - function findViewForLine(cm, lineN) { - if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo) - return cm.display.view[findViewIndex(cm, lineN)]; - var ext = cm.display.externalMeasured; - if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size) - return ext; - } - - // Measurement can be split in two steps, the set-up work that - // applies to the whole line, and the measurement of the actual - // character. Functions like coordsChar, that need to do a lot of - // measurements in a row, can thus ensure that the set-up work is - // only done once. - function prepareMeasureForLine(cm, line) { - var lineN = lineNo(line); - var view = findViewForLine(cm, lineN); - if (view && !view.text) - view = null; - else if (view && view.changes) - updateLineForChanges(cm, view, lineN, getDimensions(cm)); - if (!view) - view = updateExternalMeasurement(cm, line); - - var info = mapFromLineView(view, line, lineN); - return { - line: line, view: view, rect: null, - map: info.map, cache: info.cache, before: info.before, - hasHeights: false - }; - } - - // Given a prepared measurement object, measures the position of an - // actual character (or fetches it from the cache). - function measureCharPrepared(cm, prepared, ch, bias, varHeight) { - if (prepared.before) ch = -1; - var key = ch + (bias || ""), found; - if (prepared.cache.hasOwnProperty(key)) { - found = prepared.cache[key]; - } else { - if (!prepared.rect) - prepared.rect = prepared.view.text.getBoundingClientRect(); - if (!prepared.hasHeights) { - ensureLineHeights(cm, prepared.view, prepared.rect); - prepared.hasHeights = true; - } - found = measureCharInner(cm, prepared, ch, bias); - if (!found.bogus) prepared.cache[key] = found; - } - return {left: found.left, right: found.right, - top: varHeight ? found.rtop : found.top, - bottom: varHeight ? found.rbottom : found.bottom}; - } - - var nullRect = {left: 0, right: 0, top: 0, bottom: 0}; - - function measureCharInner(cm, prepared, ch, bias) { - var map = prepared.map; - - var node, start, end, collapse; - // First, search the line map for the text node corresponding to, - // or closest to, the target character. - for (var i = 0; i < map.length; i += 3) { - var mStart = map[i], mEnd = map[i + 1]; - if (ch < mStart) { - start = 0; end = 1; - collapse = "left"; - } else if (ch < mEnd) { - start = ch - mStart; - end = start + 1; - } else if (i == map.length - 3 || ch == mEnd && map[i + 3] > ch) { - end = mEnd - mStart; - start = end - 1; - if (ch >= mEnd) collapse = "right"; - } - if (start != null) { - node = map[i + 2]; - if (mStart == mEnd && bias == (node.insertLeft ? "left" : "right")) - collapse = bias; - if (bias == "left" && start == 0) - while (i && map[i - 2] == map[i - 3] && map[i - 1].insertLeft) { - node = map[(i -= 3) + 2]; - collapse = "left"; - } - if (bias == "right" && start == mEnd - mStart) - while (i < map.length - 3 && map[i + 3] == map[i + 4] && !map[i + 5].insertLeft) { - node = map[(i += 3) + 2]; - collapse = "right"; - } - break; - } - } - - var rect; - if (node.nodeType == 3) { // If it is a text node, use a range to retrieve the coordinates. - for (var i = 0; i < 4; i++) { // Retry a maximum of 4 times when nonsense rectangles are returned - while (start && isExtendingChar(prepared.line.text.charAt(mStart + start))) --start; - while (mStart + end < mEnd && isExtendingChar(prepared.line.text.charAt(mStart + end))) ++end; - if (ie && ie_version < 9 && start == 0 && end == mEnd - mStart) { - rect = node.parentNode.getBoundingClientRect(); - } else if (ie && cm.options.lineWrapping) { - var rects = range(node, start, end).getClientRects(); - if (rects.length) - rect = rects[bias == "right" ? rects.length - 1 : 0]; - else - rect = nullRect; - } else { - rect = range(node, start, end).getBoundingClientRect() || nullRect; - } - if (rect.left || rect.right || start == 0) break; - end = start; - start = start - 1; - collapse = "right"; - } - if (ie && ie_version < 11) rect = maybeUpdateRectForZooming(cm.display.measure, rect); - } else { // If it is a widget, simply get the box for the whole widget. - if (start > 0) collapse = bias = "right"; - var rects; - if (cm.options.lineWrapping && (rects = node.getClientRects()).length > 1) - rect = rects[bias == "right" ? rects.length - 1 : 0]; - else - rect = node.getBoundingClientRect(); - } - if (ie && ie_version < 9 && !start && (!rect || !rect.left && !rect.right)) { - var rSpan = node.parentNode.getClientRects()[0]; - if (rSpan) - rect = {left: rSpan.left, right: rSpan.left + charWidth(cm.display), top: rSpan.top, bottom: rSpan.bottom}; - else - rect = nullRect; - } - - var rtop = rect.top - prepared.rect.top, rbot = rect.bottom - prepared.rect.top; - var mid = (rtop + rbot) / 2; - var heights = prepared.view.measure.heights; - for (var i = 0; i < heights.length - 1; i++) - if (mid < heights[i]) break; - var top = i ? heights[i - 1] : 0, bot = heights[i]; - var result = {left: (collapse == "right" ? rect.right : rect.left) - prepared.rect.left, - right: (collapse == "left" ? rect.left : rect.right) - prepared.rect.left, - top: top, bottom: bot}; - if (!rect.left && !rect.right) result.bogus = true; - if (!cm.options.singleCursorHeightPerLine) { result.rtop = rtop; result.rbottom = rbot; } - - return result; - } - - // Work around problem with bounding client rects on ranges being - // returned incorrectly when zoomed on IE10 and below. - function maybeUpdateRectForZooming(measure, rect) { - if (!window.screen || screen.logicalXDPI == null || - screen.logicalXDPI == screen.deviceXDPI || !hasBadZoomedRects(measure)) - return rect; - var scaleX = screen.logicalXDPI / screen.deviceXDPI; - var scaleY = screen.logicalYDPI / screen.deviceYDPI; - return {left: rect.left * scaleX, right: rect.right * scaleX, - top: rect.top * scaleY, bottom: rect.bottom * scaleY}; - } - - function clearLineMeasurementCacheFor(lineView) { - if (lineView.measure) { - lineView.measure.cache = {}; - lineView.measure.heights = null; - if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++) - lineView.measure.caches[i] = {}; - } - } - - function clearLineMeasurementCache(cm) { - cm.display.externalMeasure = null; - removeChildren(cm.display.lineMeasure); - for (var i = 0; i < cm.display.view.length; i++) - clearLineMeasurementCacheFor(cm.display.view[i]); - } - - function clearCaches(cm) { - clearLineMeasurementCache(cm); - cm.display.cachedCharWidth = cm.display.cachedTextHeight = cm.display.cachedPaddingH = null; - if (!cm.options.lineWrapping) cm.display.maxLineChanged = true; - cm.display.lineNumChars = null; - } - - function pageScrollX() { return window.pageXOffset || (document.documentElement || document.body).scrollLeft; } - function pageScrollY() { return window.pageYOffset || (document.documentElement || document.body).scrollTop; } - - // Converts a {top, bottom, left, right} box from line-local - // coordinates into another coordinate system. Context may be one of - // "line", "div" (display.lineDiv), "local"/null (editor), "window", - // or "page". - function intoCoordSystem(cm, lineObj, rect, context) { - if (lineObj.widgets) for (var i = 0; i < lineObj.widgets.length; ++i) if (lineObj.widgets[i].above) { - var size = widgetHeight(lineObj.widgets[i]); - rect.top += size; rect.bottom += size; - } - if (context == "line") return rect; - if (!context) context = "local"; - var yOff = heightAtLine(lineObj); - if (context == "local") yOff += paddingTop(cm.display); - else yOff -= cm.display.viewOffset; - if (context == "page" || context == "window") { - var lOff = cm.display.lineSpace.getBoundingClientRect(); - yOff += lOff.top + (context == "window" ? 0 : pageScrollY()); - var xOff = lOff.left + (context == "window" ? 0 : pageScrollX()); - rect.left += xOff; rect.right += xOff; - } - rect.top += yOff; rect.bottom += yOff; - return rect; - } - - // Coverts a box from "div" coords to another coordinate system. - // Context may be "window", "page", "div", or "local"/null. - function fromCoordSystem(cm, coords, context) { - if (context == "div") return coords; - var left = coords.left, top = coords.top; - // First move into "page" coordinate system - if (context == "page") { - left -= pageScrollX(); - top -= pageScrollY(); - } else if (context == "local" || !context) { - var localBox = cm.display.sizer.getBoundingClientRect(); - left += localBox.left; - top += localBox.top; - } - - var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect(); - return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}; - } - - function charCoords(cm, pos, context, lineObj, bias) { - if (!lineObj) lineObj = getLine(cm.doc, pos.line); - return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch, bias), context); - } - - // Returns a box for a given cursor position, which may have an - // 'other' property containing the position of the secondary cursor - // on a bidi boundary. - function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) { - lineObj = lineObj || getLine(cm.doc, pos.line); - if (!preparedMeasure) preparedMeasure = prepareMeasureForLine(cm, lineObj); - function get(ch, right) { - var m = measureCharPrepared(cm, preparedMeasure, ch, right ? "right" : "left", varHeight); - if (right) m.left = m.right; else m.right = m.left; - return intoCoordSystem(cm, lineObj, m, context); - } - function getBidi(ch, partPos) { - var part = order[partPos], right = part.level % 2; - if (ch == bidiLeft(part) && partPos && part.level < order[partPos - 1].level) { - part = order[--partPos]; - ch = bidiRight(part) - (part.level % 2 ? 0 : 1); - right = true; - } else if (ch == bidiRight(part) && partPos < order.length - 1 && part.level < order[partPos + 1].level) { - part = order[++partPos]; - ch = bidiLeft(part) - part.level % 2; - right = false; - } - if (right && ch == part.to && ch > part.from) return get(ch - 1); - return get(ch, right); - } - var order = getOrder(lineObj), ch = pos.ch; - if (!order) return get(ch); - var partPos = getBidiPartAt(order, ch); - var val = getBidi(ch, partPos); - if (bidiOther != null) val.other = getBidi(ch, bidiOther); - return val; - } - - // Used to cheaply estimate the coordinates for a position. Used for - // intermediate scroll updates. - function estimateCoords(cm, pos) { - var left = 0, pos = clipPos(cm.doc, pos); - if (!cm.options.lineWrapping) left = charWidth(cm.display) * pos.ch; - var lineObj = getLine(cm.doc, pos.line); - var top = heightAtLine(lineObj) + paddingTop(cm.display); - return {left: left, right: left, top: top, bottom: top + lineObj.height}; - } - - // Positions returned by coordsChar contain some extra information. - // xRel is the relative x position of the input coordinates compared - // to the found position (so xRel > 0 means the coordinates are to - // the right of the character position, for example). When outside - // is true, that means the coordinates lie outside the line's - // vertical range. - function PosWithInfo(line, ch, outside, xRel) { - var pos = Pos(line, ch); - pos.xRel = xRel; - if (outside) pos.outside = true; - return pos; - } - - // Compute the character position closest to the given coordinates. - // Input must be lineSpace-local ("div" coordinate system). - function coordsChar(cm, x, y) { - var doc = cm.doc; - y += cm.display.viewOffset; - if (y < 0) return PosWithInfo(doc.first, 0, true, -1); - var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1; - if (lineN > last) - return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1); - if (x < 0) x = 0; - - var lineObj = getLine(doc, lineN); - for (;;) { - var found = coordsCharInner(cm, lineObj, lineN, x, y); - var merged = collapsedSpanAtEnd(lineObj); - var mergedPos = merged && merged.find(0, true); - if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0)) - lineN = lineNo(lineObj = mergedPos.to.line); - else - return found; - } - } - - function coordsCharInner(cm, lineObj, lineNo, x, y) { - var innerOff = y - heightAtLine(lineObj); - var wrongLine = false, adjust = 2 * cm.display.wrapper.clientWidth; - var preparedMeasure = prepareMeasureForLine(cm, lineObj); - - function getX(ch) { - var sp = cursorCoords(cm, Pos(lineNo, ch), "line", lineObj, preparedMeasure); - wrongLine = true; - if (innerOff > sp.bottom) return sp.left - adjust; - else if (innerOff < sp.top) return sp.left + adjust; - else wrongLine = false; - return sp.left; - } - - var bidi = getOrder(lineObj), dist = lineObj.text.length; - var from = lineLeft(lineObj), to = lineRight(lineObj); - var fromX = getX(from), fromOutside = wrongLine, toX = getX(to), toOutside = wrongLine; - - if (x > toX) return PosWithInfo(lineNo, to, toOutside, 1); - // Do a binary search between these bounds. - for (;;) { - if (bidi ? to == from || to == moveVisually(lineObj, from, 1) : to - from <= 1) { - var ch = x < fromX || x - fromX <= toX - x ? from : to; - var xDiff = x - (ch == from ? fromX : toX); - while (isExtendingChar(lineObj.text.charAt(ch))) ++ch; - var pos = PosWithInfo(lineNo, ch, ch == from ? fromOutside : toOutside, - xDiff < -1 ? -1 : xDiff > 1 ? 1 : 0); - return pos; - } - var step = Math.ceil(dist / 2), middle = from + step; - if (bidi) { - middle = from; - for (var i = 0; i < step; ++i) middle = moveVisually(lineObj, middle, 1); - } - var middleX = getX(middle); - if (middleX > x) {to = middle; toX = middleX; if (toOutside = wrongLine) toX += 1000; dist = step;} - else {from = middle; fromX = middleX; fromOutside = wrongLine; dist -= step;} - } - } - - var measureText; - // Compute the default text height. - function textHeight(display) { - if (display.cachedTextHeight != null) return display.cachedTextHeight; - if (measureText == null) { - measureText = elt("pre"); - // Measure a bunch of lines, for browsers that compute - // fractional heights. - for (var i = 0; i < 49; ++i) { - measureText.appendChild(document.createTextNode("x")); - measureText.appendChild(elt("br")); - } - measureText.appendChild(document.createTextNode("x")); - } - removeChildrenAndAdd(display.measure, measureText); - var height = measureText.offsetHeight / 50; - if (height > 3) display.cachedTextHeight = height; - removeChildren(display.measure); - return height || 1; - } - - // Compute the default character width. - function charWidth(display) { - if (display.cachedCharWidth != null) return display.cachedCharWidth; - var anchor = elt("span", "xxxxxxxxxx"); - var pre = elt("pre", [anchor]); - removeChildrenAndAdd(display.measure, pre); - var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10; - if (width > 2) display.cachedCharWidth = width; - return width || 10; - } - - // OPERATIONS - - // Operations are used to wrap a series of changes to the editor - // state in such a way that each change won't have to update the - // cursor and display (which would be awkward, slow, and - // error-prone). Instead, display updates are batched and then all - // combined and executed at once. - - var operationGroup = null; - - var nextOpId = 0; - // Start a new operation. - function startOperation(cm) { - cm.curOp = { - cm: cm, - viewChanged: false, // Flag that indicates that lines might need to be redrawn - startHeight: cm.doc.height, // Used to detect need to update scrollbar - forceUpdate: false, // Used to force a redraw - updateInput: null, // Whether to reset the input textarea - typing: false, // Whether this reset should be careful to leave existing text (for compositing) - changeObjs: null, // Accumulated changes, for firing change events - cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on - cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already - selectionChanged: false, // Whether the selection needs to be redrawn - updateMaxLine: false, // Set when the widest line needs to be determined anew - scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet - scrollToPos: null, // Used to scroll to a specific position - id: ++nextOpId // Unique ID - }; - if (operationGroup) { - operationGroup.ops.push(cm.curOp); - } else { - cm.curOp.ownsGroup = operationGroup = { - ops: [cm.curOp], - delayedCallbacks: [] - }; - } - } - - function fireCallbacksForOps(group) { - // Calls delayed callbacks and cursorActivity handlers until no - // new ones appear - var callbacks = group.delayedCallbacks, i = 0; - do { - for (; i < callbacks.length; i++) - callbacks[i](); - for (var j = 0; j < group.ops.length; j++) { - var op = group.ops[j]; - if (op.cursorActivityHandlers) - while (op.cursorActivityCalled < op.cursorActivityHandlers.length) - op.cursorActivityHandlers[op.cursorActivityCalled++](op.cm); - } - } while (i < callbacks.length); - } - - // Finish an operation, updating the display and signalling delayed events - function endOperation(cm) { - var op = cm.curOp, group = op.ownsGroup; - if (!group) return; - - try { fireCallbacksForOps(group); } - finally { - operationGroup = null; - for (var i = 0; i < group.ops.length; i++) - group.ops[i].cm.curOp = null; - endOperations(group); - } - } - - // The DOM updates done when an operation finishes are batched so - // that the minimum number of relayouts are required. - function endOperations(group) { - var ops = group.ops; - for (var i = 0; i < ops.length; i++) // Read DOM - endOperation_R1(ops[i]); - for (var i = 0; i < ops.length; i++) // Write DOM (maybe) - endOperation_W1(ops[i]); - for (var i = 0; i < ops.length; i++) // Read DOM - endOperation_R2(ops[i]); - for (var i = 0; i < ops.length; i++) // Write DOM (maybe) - endOperation_W2(ops[i]); - for (var i = 0; i < ops.length; i++) // Read DOM - endOperation_finish(ops[i]); - } - - function endOperation_R1(op) { - var cm = op.cm, display = cm.display; - maybeClipScrollbars(cm); - if (op.updateMaxLine) findMaxLine(cm); - - op.mustUpdate = op.viewChanged || op.forceUpdate || op.scrollTop != null || - op.scrollToPos && (op.scrollToPos.from.line < display.viewFrom || - op.scrollToPos.to.line >= display.viewTo) || - display.maxLineChanged && cm.options.lineWrapping; - op.update = op.mustUpdate && - new DisplayUpdate(cm, op.mustUpdate && {top: op.scrollTop, ensure: op.scrollToPos}, op.forceUpdate); - } - - function endOperation_W1(op) { - op.updatedDisplay = op.mustUpdate && updateDisplayIfNeeded(op.cm, op.update); - } - - function endOperation_R2(op) { - var cm = op.cm, display = cm.display; - if (op.updatedDisplay) updateHeightsInViewport(cm); - - op.barMeasure = measureForScrollbars(cm); - - // If the max line changed since it was last measured, measure it, - // and ensure the document's width matches it. - // updateDisplay_W2 will use these properties to do the actual resizing - if (display.maxLineChanged && !cm.options.lineWrapping) { - op.adjustWidthTo = measureChar(cm, display.maxLine, display.maxLine.text.length).left + 3; - cm.display.sizerWidth = op.adjustWidthTo; - op.barMeasure.scrollWidth = - Math.max(display.scroller.clientWidth, display.sizer.offsetLeft + op.adjustWidthTo + scrollGap(cm) + cm.display.barWidth); - op.maxScrollLeft = Math.max(0, display.sizer.offsetLeft + op.adjustWidthTo - displayWidth(cm)); - } - - if (op.updatedDisplay || op.selectionChanged) - op.newSelectionNodes = drawSelection(cm); - } - - function endOperation_W2(op) { - var cm = op.cm; - - if (op.adjustWidthTo != null) { - cm.display.sizer.style.minWidth = op.adjustWidthTo + "px"; - if (op.maxScrollLeft < cm.doc.scrollLeft) - setScrollLeft(cm, Math.min(cm.display.scroller.scrollLeft, op.maxScrollLeft), true); - cm.display.maxLineChanged = false; - } - - if (op.newSelectionNodes) - showSelection(cm, op.newSelectionNodes); - if (op.updatedDisplay) - setDocumentHeight(cm, op.barMeasure); - if (op.updatedDisplay || op.startHeight != cm.doc.height) - updateScrollbars(cm, op.barMeasure); - - if (op.selectionChanged) restartBlink(cm); - - if (cm.state.focused && op.updateInput) - resetInput(cm, op.typing); - } - - function endOperation_finish(op) { - var cm = op.cm, display = cm.display, doc = cm.doc; - - if (op.updatedDisplay) postUpdateDisplay(cm, op.update); - - // Abort mouse wheel delta measurement, when scrolling explicitly - if (display.wheelStartX != null && (op.scrollTop != null || op.scrollLeft != null || op.scrollToPos)) - display.wheelStartX = display.wheelStartY = null; - - // Propagate the scroll position to the actual DOM scroller - if (op.scrollTop != null && (display.scroller.scrollTop != op.scrollTop || op.forceScroll)) { - doc.scrollTop = Math.max(0, Math.min(display.scroller.scrollHeight - display.scroller.clientHeight, op.scrollTop)); - display.scrollbars.setScrollTop(doc.scrollTop); - display.scroller.scrollTop = doc.scrollTop; - } - if (op.scrollLeft != null && (display.scroller.scrollLeft != op.scrollLeft || op.forceScroll)) { - doc.scrollLeft = Math.max(0, Math.min(display.scroller.scrollWidth - displayWidth(cm), op.scrollLeft)); - display.scrollbars.setScrollLeft(doc.scrollLeft); - display.scroller.scrollLeft = doc.scrollLeft; - alignHorizontally(cm); - } - // If we need to scroll a specific position into view, do so. - if (op.scrollToPos) { - var coords = scrollPosIntoView(cm, clipPos(doc, op.scrollToPos.from), - clipPos(doc, op.scrollToPos.to), op.scrollToPos.margin); - if (op.scrollToPos.isCursor && cm.state.focused) maybeScrollWindow(cm, coords); - } - - // Fire events for markers that are hidden/unidden by editing or - // undoing - var hidden = op.maybeHiddenMarkers, unhidden = op.maybeUnhiddenMarkers; - if (hidden) for (var i = 0; i < hidden.length; ++i) - if (!hidden[i].lines.length) signal(hidden[i], "hide"); - if (unhidden) for (var i = 0; i < unhidden.length; ++i) - if (unhidden[i].lines.length) signal(unhidden[i], "unhide"); - - if (display.wrapper.offsetHeight) - doc.scrollTop = cm.display.scroller.scrollTop; - - // Fire change events, and delayed event handlers - if (op.changeObjs) - signal(cm, "changes", cm, op.changeObjs); - } - - // Run the given function in an operation - function runInOp(cm, f) { - if (cm.curOp) return f(); - startOperation(cm); - try { return f(); } - finally { endOperation(cm); } - } - // Wraps a function in an operation. Returns the wrapped function. - function operation(cm, f) { - return function() { - if (cm.curOp) return f.apply(cm, arguments); - startOperation(cm); - try { return f.apply(cm, arguments); } - finally { endOperation(cm); } - }; - } - // Used to add methods to editor and doc instances, wrapping them in - // operations. - function methodOp(f) { - return function() { - if (this.curOp) return f.apply(this, arguments); - startOperation(this); - try { return f.apply(this, arguments); } - finally { endOperation(this); } - }; - } - function docMethodOp(f) { - return function() { - var cm = this.cm; - if (!cm || cm.curOp) return f.apply(this, arguments); - startOperation(cm); - try { return f.apply(this, arguments); } - finally { endOperation(cm); } - }; - } - - // VIEW TRACKING - - // These objects are used to represent the visible (currently drawn) - // part of the document. A LineView may correspond to multiple - // logical lines, if those are connected by collapsed ranges. - function LineView(doc, line, lineN) { - // The starting line - this.line = line; - // Continuing lines, if any - this.rest = visualLineContinued(line); - // Number of logical lines in this visual line - this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1; - this.node = this.text = null; - this.hidden = lineIsHidden(doc, line); - } - - // Create a range of LineView objects for the given lines. - function buildViewArray(cm, from, to) { - var array = [], nextPos; - for (var pos = from; pos < to; pos = nextPos) { - var view = new LineView(cm.doc, getLine(cm.doc, pos), pos); - nextPos = pos + view.size; - array.push(view); - } - return array; - } - - // Updates the display.view data structure for a given change to the - // document. From and to are in pre-change coordinates. Lendiff is - // the amount of lines added or subtracted by the change. This is - // used for changes that span multiple lines, or change the way - // lines are divided into visual lines. regLineChange (below) - // registers single-line changes. - function regChange(cm, from, to, lendiff) { - if (from == null) from = cm.doc.first; - if (to == null) to = cm.doc.first + cm.doc.size; - if (!lendiff) lendiff = 0; - - var display = cm.display; - if (lendiff && to < display.viewTo && - (display.updateLineNumbers == null || display.updateLineNumbers > from)) - display.updateLineNumbers = from; - - cm.curOp.viewChanged = true; - - if (from >= display.viewTo) { // Change after - if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo) - resetView(cm); - } else if (to <= display.viewFrom) { // Change before - if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) { - resetView(cm); - } else { - display.viewFrom += lendiff; - display.viewTo += lendiff; - } - } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap - resetView(cm); - } else if (from <= display.viewFrom) { // Top overlap - var cut = viewCuttingPoint(cm, to, to + lendiff, 1); - if (cut) { - display.view = display.view.slice(cut.index); - display.viewFrom = cut.lineN; - display.viewTo += lendiff; - } else { - resetView(cm); - } - } else if (to >= display.viewTo) { // Bottom overlap - var cut = viewCuttingPoint(cm, from, from, -1); - if (cut) { - display.view = display.view.slice(0, cut.index); - display.viewTo = cut.lineN; - } else { - resetView(cm); - } - } else { // Gap in the middle - var cutTop = viewCuttingPoint(cm, from, from, -1); - var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1); - if (cutTop && cutBot) { - display.view = display.view.slice(0, cutTop.index) - .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN)) - .concat(display.view.slice(cutBot.index)); - display.viewTo += lendiff; - } else { - resetView(cm); - } - } - - var ext = display.externalMeasured; - if (ext) { - if (to < ext.lineN) - ext.lineN += lendiff; - else if (from < ext.lineN + ext.size) - display.externalMeasured = null; - } - } - - // Register a change to a single line. Type must be one of "text", - // "gutter", "class", "widget" - function regLineChange(cm, line, type) { - cm.curOp.viewChanged = true; - var display = cm.display, ext = cm.display.externalMeasured; - if (ext && line >= ext.lineN && line < ext.lineN + ext.size) - display.externalMeasured = null; - - if (line < display.viewFrom || line >= display.viewTo) return; - var lineView = display.view[findViewIndex(cm, line)]; - if (lineView.node == null) return; - var arr = lineView.changes || (lineView.changes = []); - if (indexOf(arr, type) == -1) arr.push(type); - } - - // Clear the view. - function resetView(cm) { - cm.display.viewFrom = cm.display.viewTo = cm.doc.first; - cm.display.view = []; - cm.display.viewOffset = 0; - } - - // Find the view element corresponding to a given line. Return null - // when the line isn't visible. - function findViewIndex(cm, n) { - if (n >= cm.display.viewTo) return null; - n -= cm.display.viewFrom; - if (n < 0) return null; - var view = cm.display.view; - for (var i = 0; i < view.length; i++) { - n -= view[i].size; - if (n < 0) return i; - } - } - - function viewCuttingPoint(cm, oldN, newN, dir) { - var index = findViewIndex(cm, oldN), diff, view = cm.display.view; - if (!sawCollapsedSpans || newN == cm.doc.first + cm.doc.size) - return {index: index, lineN: newN}; - for (var i = 0, n = cm.display.viewFrom; i < index; i++) - n += view[i].size; - if (n != oldN) { - if (dir > 0) { - if (index == view.length - 1) return null; - diff = (n + view[index].size) - oldN; - index++; - } else { - diff = n - oldN; - } - oldN += diff; newN += diff; - } - while (visualLineNo(cm.doc, newN) != newN) { - if (index == (dir < 0 ? 0 : view.length - 1)) return null; - newN += dir * view[index - (dir < 0 ? 1 : 0)].size; - index += dir; - } - return {index: index, lineN: newN}; - } - - // Force the view to cover a given range, adding empty view element - // or clipping off existing ones as needed. - function adjustView(cm, from, to) { - var display = cm.display, view = display.view; - if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) { - display.view = buildViewArray(cm, from, to); - display.viewFrom = from; - } else { - if (display.viewFrom > from) - display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view); - else if (display.viewFrom < from) - display.view = display.view.slice(findViewIndex(cm, from)); - display.viewFrom = from; - if (display.viewTo < to) - display.view = display.view.concat(buildViewArray(cm, display.viewTo, to)); - else if (display.viewTo > to) - display.view = display.view.slice(0, findViewIndex(cm, to)); - } - display.viewTo = to; - } - - // Count the number of lines in the view whose DOM representation is - // out of date (or nonexistent). - function countDirtyView(cm) { - var view = cm.display.view, dirty = 0; - for (var i = 0; i < view.length; i++) { - var lineView = view[i]; - if (!lineView.hidden && (!lineView.node || lineView.changes)) ++dirty; - } - return dirty; - } - - // INPUT HANDLING - - // Poll for input changes, using the normal rate of polling. This - // runs as long as the editor is focused. - function slowPoll(cm) { - if (cm.display.pollingFast) return; - cm.display.poll.set(cm.options.pollInterval, function() { - readInput(cm); - if (cm.state.focused) slowPoll(cm); - }); - } - - // When an event has just come in that is likely to add or change - // something in the input textarea, we poll faster, to ensure that - // the change appears on the screen quickly. - function fastPoll(cm) { - var missed = false; - cm.display.pollingFast = true; - function p() { - var changed = readInput(cm); - if (!changed && !missed) {missed = true; cm.display.poll.set(60, p);} - else {cm.display.pollingFast = false; slowPoll(cm);} - } - cm.display.poll.set(20, p); - } - - // This will be set to an array of strings when copying, so that, - // when pasting, we know what kind of selections the copied text - // was made out of. - var lastCopied = null; - - // Read input from the textarea, and update the document to match. - // When something is selected, it is present in the textarea, and - // selected (unless it is huge, in which case a placeholder is - // used). When nothing is selected, the cursor sits after previously - // seen text (can be empty), which is stored in prevInput (we must - // not reset the textarea when typing, because that breaks IME). - function readInput(cm) { - var input = cm.display.input, prevInput = cm.display.prevInput, doc = cm.doc; - // Since this is called a *lot*, try to bail out as cheaply as - // possible when it is clear that nothing happened. hasSelection - // will be the case when there is a lot of text in the textarea, - // in which case reading its value would be expensive. - if (!cm.state.focused || (hasSelection(input) && !prevInput) || isReadOnly(cm) || cm.options.disableInput || cm.state.keySeq) - return false; - // See paste handler for more on the fakedLastChar kludge - if (cm.state.pasteIncoming && cm.state.fakedLastChar) { - input.value = input.value.substring(0, input.value.length - 1); - cm.state.fakedLastChar = false; - } - var text = input.value; - // If nothing changed, bail. - if (text == prevInput && !cm.somethingSelected()) return false; - // Work around nonsensical selection resetting in IE9/10, and - // inexplicable appearance of private area unicode characters on - // some key combos in Mac (#2689). - if (ie && ie_version >= 9 && cm.display.inputHasSelection === text || - mac && /[\uf700-\uf7ff]/.test(text)) { - resetInput(cm); - return false; - } - - var withOp = !cm.curOp; - if (withOp) startOperation(cm); - cm.display.shift = false; - - if (text.charCodeAt(0) == 0x200b && doc.sel == cm.display.selForContextMenu && !prevInput) - prevInput = "\u200b"; - // Find the part of the input that is actually new - var same = 0, l = Math.min(prevInput.length, text.length); - while (same < l && prevInput.charCodeAt(same) == text.charCodeAt(same)) ++same; - var inserted = text.slice(same), textLines = splitLines(inserted); - - // When pasing N lines into N selections, insert one line per selection - var multiPaste = null; - if (cm.state.pasteIncoming && doc.sel.ranges.length > 1) { - if (lastCopied && lastCopied.join("\n") == inserted) - multiPaste = doc.sel.ranges.length % lastCopied.length == 0 && map(lastCopied, splitLines); - else if (textLines.length == doc.sel.ranges.length) - multiPaste = map(textLines, function(l) { return [l]; }); - } - - // Normal behavior is to insert the new text into every selection - for (var i = doc.sel.ranges.length - 1; i >= 0; i--) { - var range = doc.sel.ranges[i]; - var from = range.from(), to = range.to(); - // Handle deletion - if (same < prevInput.length) - from = Pos(from.line, from.ch - (prevInput.length - same)); - // Handle overwrite - else if (cm.state.overwrite && range.empty() && !cm.state.pasteIncoming) - to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + lst(textLines).length)); - var updateInput = cm.curOp.updateInput; - var changeEvent = {from: from, to: to, text: multiPaste ? multiPaste[i % multiPaste.length] : textLines, - origin: cm.state.pasteIncoming ? "paste" : cm.state.cutIncoming ? "cut" : "+input"}; - makeChange(cm.doc, changeEvent); - signalLater(cm, "inputRead", cm, changeEvent); - // When an 'electric' character is inserted, immediately trigger a reindent - if (inserted && !cm.state.pasteIncoming && cm.options.electricChars && - cm.options.smartIndent && range.head.ch < 100 && - (!i || doc.sel.ranges[i - 1].head.line != range.head.line)) { - var mode = cm.getModeAt(range.head); - var end = changeEnd(changeEvent); - if (mode.electricChars) { - for (var j = 0; j < mode.electricChars.length; j++) - if (inserted.indexOf(mode.electricChars.charAt(j)) > -1) { - indentLine(cm, end.line, "smart"); - break; - } - } else if (mode.electricInput) { - if (mode.electricInput.test(getLine(doc, end.line).text.slice(0, end.ch))) - indentLine(cm, end.line, "smart"); - } - } - } - ensureCursorVisible(cm); - cm.curOp.updateInput = updateInput; - cm.curOp.typing = true; - - // Don't leave long text in the textarea, since it makes further polling slow - if (text.length > 1000 || text.indexOf("\n") > -1) input.value = cm.display.prevInput = ""; - else cm.display.prevInput = text; - if (withOp) endOperation(cm); - cm.state.pasteIncoming = cm.state.cutIncoming = false; - return true; - } - - // Reset the input to correspond to the selection (or to be empty, - // when not typing and nothing is selected) - function resetInput(cm, typing) { - if (cm.display.contextMenuPending) return; - var minimal, selected, doc = cm.doc; - if (cm.somethingSelected()) { - cm.display.prevInput = ""; - var range = doc.sel.primary(); - minimal = hasCopyEvent && - (range.to().line - range.from().line > 100 || (selected = cm.getSelection()).length > 1000); - var content = minimal ? "-" : selected || cm.getSelection(); - cm.display.input.value = content; - if (cm.state.focused) selectInput(cm.display.input); - if (ie && ie_version >= 9) cm.display.inputHasSelection = content; - } else if (!typing) { - cm.display.prevInput = cm.display.input.value = ""; - if (ie && ie_version >= 9) cm.display.inputHasSelection = null; - } - cm.display.inaccurateSelection = minimal; - } - - function focusInput(cm) { - if (cm.options.readOnly != "nocursor" && (!mobile || activeElt() != cm.display.input)) - cm.display.input.focus(); - } - - function ensureFocus(cm) { - if (!cm.state.focused) { focusInput(cm); onFocus(cm); } - } - - function isReadOnly(cm) { - return cm.options.readOnly || cm.doc.cantEdit; - } - - // EVENT HANDLERS - - // Attach the necessary event handlers when initializing the editor - function registerEventHandlers(cm) { - var d = cm.display; - on(d.scroller, "mousedown", operation(cm, onMouseDown)); - // Older IE's will not fire a second mousedown for a double click - if (ie && ie_version < 11) - on(d.scroller, "dblclick", operation(cm, function(e) { - if (signalDOMEvent(cm, e)) return; - var pos = posFromMouse(cm, e); - if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) return; - e_preventDefault(e); - var word = cm.findWordAt(pos); - extendSelection(cm.doc, word.anchor, word.head); - })); - else - on(d.scroller, "dblclick", function(e) { signalDOMEvent(cm, e) || e_preventDefault(e); }); - // Prevent normal selection in the editor (we handle our own) - on(d.lineSpace, "selectstart", function(e) { - if (!eventInWidget(d, e)) e_preventDefault(e); - }); - // Some browsers fire contextmenu *after* opening the menu, at - // which point we can't mess with it anymore. Context menu is - // handled in onMouseDown for these browsers. - if (!captureRightClick) on(d.scroller, "contextmenu", function(e) {onContextMenu(cm, e);}); - - // Sync scrolling between fake scrollbars and real scrollable - // area, ensure viewport is updated when scrolling. - on(d.scroller, "scroll", function() { - if (d.scroller.clientHeight) { - setScrollTop(cm, d.scroller.scrollTop); - setScrollLeft(cm, d.scroller.scrollLeft, true); - signal(cm, "scroll", cm); - } - }); - - // Listen to wheel events in order to try and update the viewport on time. - on(d.scroller, "mousewheel", function(e){onScrollWheel(cm, e);}); - on(d.scroller, "DOMMouseScroll", function(e){onScrollWheel(cm, e);}); - - // Prevent wrapper from ever scrolling - on(d.wrapper, "scroll", function() { d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; }); - - on(d.input, "keyup", function(e) { onKeyUp.call(cm, e); }); - on(d.input, "input", function() { - if (ie && ie_version >= 9 && cm.display.inputHasSelection) cm.display.inputHasSelection = null; - readInput(cm); - }); - on(d.input, "keydown", operation(cm, onKeyDown)); - on(d.input, "keypress", operation(cm, onKeyPress)); - on(d.input, "focus", bind(onFocus, cm)); - on(d.input, "blur", bind(onBlur, cm)); - - function drag_(e) { - if (!signalDOMEvent(cm, e)) e_stop(e); - } - if (cm.options.dragDrop) { - on(d.scroller, "dragstart", function(e){onDragStart(cm, e);}); - on(d.scroller, "dragenter", drag_); - on(d.scroller, "dragover", drag_); - on(d.scroller, "drop", operation(cm, onDrop)); - } - on(d.scroller, "paste", function(e) { - if (eventInWidget(d, e)) return; - cm.state.pasteIncoming = true; - focusInput(cm); - fastPoll(cm); - }); - on(d.input, "paste", function() { - // Workaround for webkit bug https://bugs.webkit.org/show_bug.cgi?id=90206 - // Add a char to the end of textarea before paste occur so that - // selection doesn't span to the end of textarea. - if (webkit && !cm.state.fakedLastChar && !(new Date - cm.state.lastMiddleDown < 200)) { - var start = d.input.selectionStart, end = d.input.selectionEnd; - d.input.value += "$"; - // The selection end needs to be set before the start, otherwise there - // can be an intermediate non-empty selection between the two, which - // can override the middle-click paste buffer on linux and cause the - // wrong thing to get pasted. - d.input.selectionEnd = end; - d.input.selectionStart = start; - cm.state.fakedLastChar = true; - } - cm.state.pasteIncoming = true; - fastPoll(cm); - }); - - function prepareCopyCut(e) { - if (cm.somethingSelected()) { - lastCopied = cm.getSelections(); - if (d.inaccurateSelection) { - d.prevInput = ""; - d.inaccurateSelection = false; - d.input.value = lastCopied.join("\n"); - selectInput(d.input); - } - } else { - var text = [], ranges = []; - for (var i = 0; i < cm.doc.sel.ranges.length; i++) { - var line = cm.doc.sel.ranges[i].head.line; - var lineRange = {anchor: Pos(line, 0), head: Pos(line + 1, 0)}; - ranges.push(lineRange); - text.push(cm.getRange(lineRange.anchor, lineRange.head)); - } - if (e.type == "cut") { - cm.setSelections(ranges, null, sel_dontScroll); - } else { - d.prevInput = ""; - d.input.value = text.join("\n"); - selectInput(d.input); - } - lastCopied = text; - } - if (e.type == "cut") cm.state.cutIncoming = true; - } - on(d.input, "cut", prepareCopyCut); - on(d.input, "copy", prepareCopyCut); - - // Needed to handle Tab key in KHTML - if (khtml) on(d.sizer, "mouseup", function() { - if (activeElt() == d.input) d.input.blur(); - focusInput(cm); - }); - } - - // Called when the window resizes - function onResize(cm) { - var d = cm.display; - if (d.lastWrapHeight == d.wrapper.clientHeight && d.lastWrapWidth == d.wrapper.clientWidth) - return; - // Might be a text scaling operation, clear size caches. - d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null; - d.scrollbarsClipped = false; - cm.setSize(); - } - - // MOUSE EVENTS - - // Return true when the given mouse event happened in a widget - function eventInWidget(display, e) { - for (var n = e_target(e); n != display.wrapper; n = n.parentNode) { - if (!n || (n.nodeType == 1 && n.getAttribute("cm-ignore-events") == "true") || - (n.parentNode == display.sizer && n != display.mover)) - return true; - } - } - - // Given a mouse event, find the corresponding position. If liberal - // is false, it checks whether a gutter or scrollbar was clicked, - // and returns null if it was. forRect is used by rectangular - // selections, and tries to estimate a character position even for - // coordinates beyond the right of the text. - function posFromMouse(cm, e, liberal, forRect) { - var display = cm.display; - if (!liberal && e_target(e).getAttribute("not-content") == "true") return null; - - var x, y, space = display.lineSpace.getBoundingClientRect(); - // Fails unpredictably on IE[67] when mouse is dragged around quickly. - try { x = e.clientX - space.left; y = e.clientY - space.top; } - catch (e) { return null; } - var coords = coordsChar(cm, x, y), line; - if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) { - var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length; - coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff)); - } - return coords; - } - - // A mouse down can be a single click, double click, triple click, - // start of selection drag, start of text drag, new cursor - // (ctrl-click), rectangle drag (alt-drag), or xwin - // middle-click-paste. Or it might be a click on something we should - // not interfere with, such as a scrollbar or widget. - function onMouseDown(e) { - if (signalDOMEvent(this, e)) return; - var cm = this, display = cm.display; - display.shift = e.shiftKey; - - if (eventInWidget(display, e)) { - if (!webkit) { - // Briefly turn off draggability, to allow widgets to do - // normal dragging things. - display.scroller.draggable = false; - setTimeout(function(){display.scroller.draggable = true;}, 100); - } - return; - } - if (clickInGutter(cm, e)) return; - var start = posFromMouse(cm, e); - window.focus(); - - switch (e_button(e)) { - case 1: - if (start) - leftButtonDown(cm, e, start); - else if (e_target(e) == display.scroller) - e_preventDefault(e); - break; - case 2: - if (webkit) cm.state.lastMiddleDown = +new Date; - if (start) extendSelection(cm.doc, start); - setTimeout(bind(focusInput, cm), 20); - e_preventDefault(e); - break; - case 3: - if (captureRightClick) onContextMenu(cm, e); - break; - } - } - - var lastClick, lastDoubleClick; - function leftButtonDown(cm, e, start) { - setTimeout(bind(ensureFocus, cm), 0); - - var now = +new Date, type; - if (lastDoubleClick && lastDoubleClick.time > now - 400 && cmp(lastDoubleClick.pos, start) == 0) { - type = "triple"; - } else if (lastClick && lastClick.time > now - 400 && cmp(lastClick.pos, start) == 0) { - type = "double"; - lastDoubleClick = {time: now, pos: start}; - } else { - type = "single"; - lastClick = {time: now, pos: start}; - } - - var sel = cm.doc.sel, modifier = mac ? e.metaKey : e.ctrlKey, contained; - if (cm.options.dragDrop && dragAndDrop && !isReadOnly(cm) && - type == "single" && (contained = sel.contains(start)) > -1 && - !sel.ranges[contained].empty()) - leftButtonStartDrag(cm, e, start, modifier); - else - leftButtonSelect(cm, e, start, type, modifier); - } - - // Start a text drag. When it ends, see if any dragging actually - // happen, and treat as a click if it didn't. - function leftButtonStartDrag(cm, e, start, modifier) { - var display = cm.display; - var dragEnd = operation(cm, function(e2) { - if (webkit) display.scroller.draggable = false; - cm.state.draggingText = false; - off(document, "mouseup", dragEnd); - off(display.scroller, "drop", dragEnd); - if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) { - e_preventDefault(e2); - if (!modifier) - extendSelection(cm.doc, start); - focusInput(cm); - // Work around unexplainable focus problem in IE9 (#2127) - if (ie && ie_version == 9) - setTimeout(function() {document.body.focus(); focusInput(cm);}, 20); - } - }); - // Let the drag handler handle this. - if (webkit) display.scroller.draggable = true; - cm.state.draggingText = dragEnd; - // IE's approach to draggable - if (display.scroller.dragDrop) display.scroller.dragDrop(); - on(document, "mouseup", dragEnd); - on(display.scroller, "drop", dragEnd); - } - - // Normal selection, as opposed to text dragging. - function leftButtonSelect(cm, e, start, type, addNew) { - var display = cm.display, doc = cm.doc; - e_preventDefault(e); - - var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges; - if (addNew && !e.shiftKey) { - ourIndex = doc.sel.contains(start); - if (ourIndex > -1) - ourRange = ranges[ourIndex]; - else - ourRange = new Range(start, start); - } else { - ourRange = doc.sel.primary(); - } - - if (e.altKey) { - type = "rect"; - if (!addNew) ourRange = new Range(start, start); - start = posFromMouse(cm, e, true, true); - ourIndex = -1; - } else if (type == "double") { - var word = cm.findWordAt(start); - if (cm.display.shift || doc.extend) - ourRange = extendRange(doc, ourRange, word.anchor, word.head); - else - ourRange = word; - } else if (type == "triple") { - var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0))); - if (cm.display.shift || doc.extend) - ourRange = extendRange(doc, ourRange, line.anchor, line.head); - else - ourRange = line; - } else { - ourRange = extendRange(doc, ourRange, start); - } - - if (!addNew) { - ourIndex = 0; - setSelection(doc, new Selection([ourRange], 0), sel_mouse); - startSel = doc.sel; - } else if (ourIndex == -1) { - ourIndex = ranges.length; - setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex), - {scroll: false, origin: "*mouse"}); - } else if (ranges.length > 1 && ranges[ourIndex].empty() && type == "single") { - setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0)); - startSel = doc.sel; - } else { - replaceOneSelection(doc, ourIndex, ourRange, sel_mouse); - } - - var lastPos = start; - function extendTo(pos) { - if (cmp(lastPos, pos) == 0) return; - lastPos = pos; - - if (type == "rect") { - var ranges = [], tabSize = cm.options.tabSize; - var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize); - var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize); - var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol); - for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line)); - line <= end; line++) { - var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize); - if (left == right) - ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); - else if (text.length > leftPos) - ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); - } - if (!ranges.length) ranges.push(new Range(start, start)); - setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex), - {origin: "*mouse", scroll: false}); - cm.scrollIntoView(pos); - } else { - var oldRange = ourRange; - var anchor = oldRange.anchor, head = pos; - if (type != "single") { - if (type == "double") - var range = cm.findWordAt(pos); - else - var range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0))); - if (cmp(range.anchor, anchor) > 0) { - head = range.head; - anchor = minPos(oldRange.from(), range.anchor); - } else { - head = range.anchor; - anchor = maxPos(oldRange.to(), range.head); - } - } - var ranges = startSel.ranges.slice(0); - ranges[ourIndex] = new Range(clipPos(doc, anchor), head); - setSelection(doc, normalizeSelection(ranges, ourIndex), sel_mouse); - } - } - - var editorSize = display.wrapper.getBoundingClientRect(); - // Used to ensure timeout re-tries don't fire when another extend - // happened in the meantime (clearTimeout isn't reliable -- at - // least on Chrome, the timeouts still happen even when cleared, - // if the clear happens after their scheduled firing time). - var counter = 0; - - function extend(e) { - var curCount = ++counter; - var cur = posFromMouse(cm, e, true, type == "rect"); - if (!cur) return; - if (cmp(cur, lastPos) != 0) { - ensureFocus(cm); - extendTo(cur); - var visible = visibleLines(display, doc); - if (cur.line >= visible.to || cur.line < visible.from) - setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150); - } else { - var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0; - if (outside) setTimeout(operation(cm, function() { - if (counter != curCount) return; - display.scroller.scrollTop += outside; - extend(e); - }), 50); - } - } - - function done(e) { - counter = Infinity; - e_preventDefault(e); - focusInput(cm); - off(document, "mousemove", move); - off(document, "mouseup", up); - doc.history.lastSelOrigin = null; - } - - var move = operation(cm, function(e) { - if (!e_button(e)) done(e); - else extend(e); - }); - var up = operation(cm, done); - on(document, "mousemove", move); - on(document, "mouseup", up); - } - - // Determines whether an event happened in the gutter, and fires the - // handlers for the corresponding event. - function gutterEvent(cm, e, type, prevent, signalfn) { - try { var mX = e.clientX, mY = e.clientY; } - catch(e) { return false; } - if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) return false; - if (prevent) e_preventDefault(e); - - var display = cm.display; - var lineBox = display.lineDiv.getBoundingClientRect(); - - if (mY > lineBox.bottom || !hasHandler(cm, type)) return e_defaultPrevented(e); - mY -= lineBox.top - display.viewOffset; - - for (var i = 0; i < cm.options.gutters.length; ++i) { - var g = display.gutters.childNodes[i]; - if (g && g.getBoundingClientRect().right >= mX) { - var line = lineAtHeight(cm.doc, mY); - var gutter = cm.options.gutters[i]; - signalfn(cm, type, cm, line, gutter, e); - return e_defaultPrevented(e); - } - } - } - - function clickInGutter(cm, e) { - return gutterEvent(cm, e, "gutterClick", true, signalLater); - } - - // Kludge to work around strange IE behavior where it'll sometimes - // re-fire a series of drag-related events right after the drop (#1551) - var lastDrop = 0; - - function onDrop(e) { - var cm = this; - if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) - return; - e_preventDefault(e); - if (ie) lastDrop = +new Date; - var pos = posFromMouse(cm, e, true), files = e.dataTransfer.files; - if (!pos || isReadOnly(cm)) return; - // Might be a file drop, in which case we simply extract the text - // and insert it. - if (files && files.length && window.FileReader && window.File) { - var n = files.length, text = Array(n), read = 0; - var loadFile = function(file, i) { - var reader = new FileReader; - reader.onload = operation(cm, function() { - text[i] = reader.result; - if (++read == n) { - pos = clipPos(cm.doc, pos); - var change = {from: pos, to: pos, text: splitLines(text.join("\n")), origin: "paste"}; - makeChange(cm.doc, change); - setSelectionReplaceHistory(cm.doc, simpleSelection(pos, changeEnd(change))); - } - }); - reader.readAsText(file); - }; - for (var i = 0; i < n; ++i) loadFile(files[i], i); - } else { // Normal drop - // Don't do a replace if the drop happened inside of the selected text. - if (cm.state.draggingText && cm.doc.sel.contains(pos) > -1) { - cm.state.draggingText(e); - // Ensure the editor is re-focused - setTimeout(bind(focusInput, cm), 20); - return; - } - try { - var text = e.dataTransfer.getData("Text"); - if (text) { - if (cm.state.draggingText && !(mac ? e.metaKey : e.ctrlKey)) - var selected = cm.listSelections(); - setSelectionNoUndo(cm.doc, simpleSelection(pos, pos)); - if (selected) for (var i = 0; i < selected.length; ++i) - replaceRange(cm.doc, "", selected[i].anchor, selected[i].head, "drag"); - cm.replaceSelection(text, "around", "paste"); - focusInput(cm); - } - } - catch(e){} - } - } - - function onDragStart(cm, e) { - if (ie && (!cm.state.draggingText || +new Date - lastDrop < 100)) { e_stop(e); return; } - if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) return; - - e.dataTransfer.setData("Text", cm.getSelection()); - - // Use dummy image instead of default browsers image. - // Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there. - if (e.dataTransfer.setDragImage && !safari) { - var img = elt("img", null, null, "position: fixed; left: 0; top: 0;"); - img.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="; - if (presto) { - img.width = img.height = 1; - cm.display.wrapper.appendChild(img); - // Force a relayout, or Opera won't use our image for some obscure reason - img._top = img.offsetTop; - } - e.dataTransfer.setDragImage(img, 0, 0); - if (presto) img.parentNode.removeChild(img); - } - } - - // SCROLL EVENTS - - // Sync the scrollable area and scrollbars, ensure the viewport - // covers the visible area. - function setScrollTop(cm, val) { - if (Math.abs(cm.doc.scrollTop - val) < 2) return; - cm.doc.scrollTop = val; - if (!gecko) updateDisplaySimple(cm, {top: val}); - if (cm.display.scroller.scrollTop != val) cm.display.scroller.scrollTop = val; - cm.display.scrollbars.setScrollTop(val); - if (gecko) updateDisplaySimple(cm); - startWorker(cm, 100); - } - // Sync scroller and scrollbar, ensure the gutter elements are - // aligned. - function setScrollLeft(cm, val, isScroller) { - if (isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) return; - val = Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth); - cm.doc.scrollLeft = val; - alignHorizontally(cm); - if (cm.display.scroller.scrollLeft != val) cm.display.scroller.scrollLeft = val; - cm.display.scrollbars.setScrollLeft(val); - } - - // Since the delta values reported on mouse wheel events are - // unstandardized between browsers and even browser versions, and - // generally horribly unpredictable, this code starts by measuring - // the scroll effect that the first few mouse wheel events have, - // and, from that, detects the way it can convert deltas to pixel - // offsets afterwards. - // - // The reason we want to know the amount a wheel event will scroll - // is that it gives us a chance to update the display before the - // actual scrolling happens, reducing flickering. - - var wheelSamples = 0, wheelPixelsPerUnit = null; - // Fill in a browser-detected starting value on browsers where we - // know one. These don't have to be accurate -- the result of them - // being wrong would just be a slight flicker on the first wheel - // scroll (if it is large enough). - if (ie) wheelPixelsPerUnit = -.53; - else if (gecko) wheelPixelsPerUnit = 15; - else if (chrome) wheelPixelsPerUnit = -.7; - else if (safari) wheelPixelsPerUnit = -1/3; - - var wheelEventDelta = function(e) { - var dx = e.wheelDeltaX, dy = e.wheelDeltaY; - if (dx == null && e.detail && e.axis == e.HORIZONTAL_AXIS) dx = e.detail; - if (dy == null && e.detail && e.axis == e.VERTICAL_AXIS) dy = e.detail; - else if (dy == null) dy = e.wheelDelta; - return {x: dx, y: dy}; - }; - CodeMirror.wheelEventPixels = function(e) { - var delta = wheelEventDelta(e); - delta.x *= wheelPixelsPerUnit; - delta.y *= wheelPixelsPerUnit; - return delta; - }; - - function onScrollWheel(cm, e) { - var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y; - - var display = cm.display, scroll = display.scroller; - // Quit if there's nothing to scroll here - if (!(dx && scroll.scrollWidth > scroll.clientWidth || - dy && scroll.scrollHeight > scroll.clientHeight)) return; - - // Webkit browsers on OS X abort momentum scrolls when the target - // of the scroll event is removed from the scrollable element. - // This hack (see related code in patchDisplay) makes sure the - // element is kept around. - if (dy && mac && webkit) { - outer: for (var cur = e.target, view = display.view; cur != scroll; cur = cur.parentNode) { - for (var i = 0; i < view.length; i++) { - if (view[i].node == cur) { - cm.display.currentWheelTarget = cur; - break outer; - } - } - } - } - - // On some browsers, horizontal scrolling will cause redraws to - // happen before the gutter has been realigned, causing it to - // wriggle around in a most unseemly way. When we have an - // estimated pixels/delta value, we just handle horizontal - // scrolling entirely here. It'll be slightly off from native, but - // better than glitching out. - if (dx && !gecko && !presto && wheelPixelsPerUnit != null) { - if (dy) - setScrollTop(cm, Math.max(0, Math.min(scroll.scrollTop + dy * wheelPixelsPerUnit, scroll.scrollHeight - scroll.clientHeight))); - setScrollLeft(cm, Math.max(0, Math.min(scroll.scrollLeft + dx * wheelPixelsPerUnit, scroll.scrollWidth - scroll.clientWidth))); - e_preventDefault(e); - display.wheelStartX = null; // Abort measurement, if in progress - return; - } - - // 'Project' the visible viewport to cover the area that is being - // scrolled into view (if we know enough to estimate it). - if (dy && wheelPixelsPerUnit != null) { - var pixels = dy * wheelPixelsPerUnit; - var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight; - if (pixels < 0) top = Math.max(0, top + pixels - 50); - else bot = Math.min(cm.doc.height, bot + pixels + 50); - updateDisplaySimple(cm, {top: top, bottom: bot}); - } - - if (wheelSamples < 20) { - if (display.wheelStartX == null) { - display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop; - display.wheelDX = dx; display.wheelDY = dy; - setTimeout(function() { - if (display.wheelStartX == null) return; - var movedX = scroll.scrollLeft - display.wheelStartX; - var movedY = scroll.scrollTop - display.wheelStartY; - var sample = (movedY && display.wheelDY && movedY / display.wheelDY) || - (movedX && display.wheelDX && movedX / display.wheelDX); - display.wheelStartX = display.wheelStartY = null; - if (!sample) return; - wheelPixelsPerUnit = (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1); - ++wheelSamples; - }, 200); - } else { - display.wheelDX += dx; display.wheelDY += dy; - } - } - } - - // KEY EVENTS - - // Run a handler that was bound to a key. - function doHandleBinding(cm, bound, dropShift) { - if (typeof bound == "string") { - bound = commands[bound]; - if (!bound) return false; - } - // Ensure previous input has been read, so that the handler sees a - // consistent view of the document - if (cm.display.pollingFast && readInput(cm)) cm.display.pollingFast = false; - var prevShift = cm.display.shift, done = false; - try { - if (isReadOnly(cm)) cm.state.suppressEdits = true; - if (dropShift) cm.display.shift = false; - done = bound(cm) != Pass; - } finally { - cm.display.shift = prevShift; - cm.state.suppressEdits = false; - } - return done; - } - - function lookupKeyForEditor(cm, name, handle) { - for (var i = 0; i < cm.state.keyMaps.length; i++) { - var result = lookupKey(name, cm.state.keyMaps[i], handle, cm); - if (result) return result; - } - return (cm.options.extraKeys && lookupKey(name, cm.options.extraKeys, handle, cm)) - || lookupKey(name, cm.options.keyMap, handle, cm); - } - - var stopSeq = new Delayed; - function dispatchKey(cm, name, e, handle) { - var seq = cm.state.keySeq; - if (seq) { - if (isModifierKey(name)) return "handled"; - stopSeq.set(50, function() { - if (cm.state.keySeq == seq) { - cm.state.keySeq = null; - resetInput(cm); - } - }); - name = seq + " " + name; - } - var result = lookupKeyForEditor(cm, name, handle); - - if (result == "multi") - cm.state.keySeq = name; - if (result == "handled") - signalLater(cm, "keyHandled", cm, name, e); - - if (result == "handled" || result == "multi") { - e_preventDefault(e); - restartBlink(cm); - } - - if (seq && !result && /\'$/.test(name)) { - e_preventDefault(e); - return true; - } - return !!result; - } - - // Handle a key from the keydown event. - function handleKeyBinding(cm, e) { - var name = keyName(e, true); - if (!name) return false; - - if (e.shiftKey && !cm.state.keySeq) { - // First try to resolve full name (including 'Shift-'). Failing - // that, see if there is a cursor-motion command (starting with - // 'go') bound to the keyname without 'Shift-'. - return dispatchKey(cm, "Shift-" + name, e, function(b) {return doHandleBinding(cm, b, true);}) - || dispatchKey(cm, name, e, function(b) { - if (typeof b == "string" ? /^go[A-Z]/.test(b) : b.motion) - return doHandleBinding(cm, b); - }); - } else { - return dispatchKey(cm, name, e, function(b) { return doHandleBinding(cm, b); }); - } - } - - // Handle a key from the keypress event - function handleCharBinding(cm, e, ch) { - return dispatchKey(cm, "'" + ch + "'", e, - function(b) { return doHandleBinding(cm, b, true); }); - } - - var lastStoppedKey = null; - function onKeyDown(e) { - var cm = this; - ensureFocus(cm); - if (signalDOMEvent(cm, e)) return; - // IE does strange things with escape. - if (ie && ie_version < 11 && e.keyCode == 27) e.returnValue = false; - var code = e.keyCode; - cm.display.shift = code == 16 || e.shiftKey; - var handled = handleKeyBinding(cm, e); - if (presto) { - lastStoppedKey = handled ? code : null; - // Opera has no cut event... we try to at least catch the key combo - if (!handled && code == 88 && !hasCopyEvent && (mac ? e.metaKey : e.ctrlKey)) - cm.replaceSelection("", null, "cut"); - } - - // Turn mouse into crosshair when Alt is held on Mac. - if (code == 18 && !/\bCodeMirror-crosshair\b/.test(cm.display.lineDiv.className)) - showCrossHair(cm); - } - - function showCrossHair(cm) { - var lineDiv = cm.display.lineDiv; - addClass(lineDiv, "CodeMirror-crosshair"); - - function up(e) { - if (e.keyCode == 18 || !e.altKey) { - rmClass(lineDiv, "CodeMirror-crosshair"); - off(document, "keyup", up); - off(document, "mouseover", up); - } - } - on(document, "keyup", up); - on(document, "mouseover", up); - } - - function onKeyUp(e) { - if (e.keyCode == 16) this.doc.sel.shift = false; - signalDOMEvent(this, e); - } - - function onKeyPress(e) { - var cm = this; - if (signalDOMEvent(cm, e) || e.ctrlKey && !e.altKey || mac && e.metaKey) return; - var keyCode = e.keyCode, charCode = e.charCode; - if (presto && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return;} - if (((presto && (!e.which || e.which < 10)) || khtml) && handleKeyBinding(cm, e)) return; - var ch = String.fromCharCode(charCode == null ? keyCode : charCode); - if (handleCharBinding(cm, e, ch)) return; - if (ie && ie_version >= 9) cm.display.inputHasSelection = null; - fastPoll(cm); - } - - // FOCUS/BLUR EVENTS - - function onFocus(cm) { - if (cm.options.readOnly == "nocursor") return; - if (!cm.state.focused) { - signal(cm, "focus", cm); - cm.state.focused = true; - addClass(cm.display.wrapper, "CodeMirror-focused"); - // The prevInput test prevents this from firing when a context - // menu is closed (since the resetInput would kill the - // select-all detection hack) - if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) { - resetInput(cm); - if (webkit) setTimeout(bind(resetInput, cm, true), 0); // Issue #1730 - } - } - slowPoll(cm); - restartBlink(cm); - } - function onBlur(cm) { - if (cm.state.focused) { - signal(cm, "blur", cm); - cm.state.focused = false; - rmClass(cm.display.wrapper, "CodeMirror-focused"); - } - clearInterval(cm.display.blinker); - setTimeout(function() {if (!cm.state.focused) cm.display.shift = false;}, 150); - } - - // CONTEXT MENU HANDLING - - // To make the context menu work, we need to briefly unhide the - // textarea (making it as unobtrusive as possible) to let the - // right-click take effect on it. - function onContextMenu(cm, e) { - if (signalDOMEvent(cm, e, "contextmenu")) return; - var display = cm.display; - if (eventInWidget(display, e) || contextMenuInGutter(cm, e)) return; - - var pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop; - if (!pos || presto) return; // Opera is difficult. - - // Reset the current text selection only if the click is done outside of the selection - // and 'resetSelectionOnContextMenu' option is true. - var reset = cm.options.resetSelectionOnContextMenu; - if (reset && cm.doc.sel.contains(pos) == -1) - operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll); - - var oldCSS = display.input.style.cssText; - display.inputDiv.style.position = "absolute"; - display.input.style.cssText = "position: fixed; width: 30px; height: 30px; top: " + (e.clientY - 5) + - "px; left: " + (e.clientX - 5) + "px; z-index: 1000; background: " + - (ie ? "rgba(255, 255, 255, .05)" : "transparent") + - "; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);"; - if (webkit) var oldScrollY = window.scrollY; // Work around Chrome issue (#2712) - focusInput(cm); - if (webkit) window.scrollTo(null, oldScrollY); - resetInput(cm); - // Adds "Select all" to context menu in FF - if (!cm.somethingSelected()) display.input.value = display.prevInput = " "; - display.contextMenuPending = true; - display.selForContextMenu = cm.doc.sel; - clearTimeout(display.detectingSelectAll); - - // Select-all will be greyed out if there's nothing to select, so - // this adds a zero-width space so that we can later check whether - // it got selected. - function prepareSelectAllHack() { - if (display.input.selectionStart != null) { - var selected = cm.somethingSelected(); - var extval = display.input.value = "\u200b" + (selected ? display.input.value : ""); - display.prevInput = selected ? "" : "\u200b"; - display.input.selectionStart = 1; display.input.selectionEnd = extval.length; - // Re-set this, in case some other handler touched the - // selection in the meantime. - display.selForContextMenu = cm.doc.sel; - } - } - function rehide() { - display.contextMenuPending = false; - display.inputDiv.style.position = "relative"; - display.input.style.cssText = oldCSS; - if (ie && ie_version < 9) display.scrollbars.setScrollTop(display.scroller.scrollTop = scrollPos); - slowPoll(cm); - - // Try to detect the user choosing select-all - if (display.input.selectionStart != null) { - if (!ie || (ie && ie_version < 9)) prepareSelectAllHack(); - var i = 0, poll = function() { - if (display.selForContextMenu == cm.doc.sel && display.input.selectionStart == 0) - operation(cm, commands.selectAll)(cm); - else if (i++ < 10) display.detectingSelectAll = setTimeout(poll, 500); - else resetInput(cm); - }; - display.detectingSelectAll = setTimeout(poll, 200); - } - } - - if (ie && ie_version >= 9) prepareSelectAllHack(); - if (captureRightClick) { - e_stop(e); - var mouseup = function() { - off(window, "mouseup", mouseup); - setTimeout(rehide, 20); - }; - on(window, "mouseup", mouseup); - } else { - setTimeout(rehide, 50); - } - } - - function contextMenuInGutter(cm, e) { - if (!hasHandler(cm, "gutterContextMenu")) return false; - return gutterEvent(cm, e, "gutterContextMenu", false, signal); - } - - // UPDATING - - // Compute the position of the end of a change (its 'to' property - // refers to the pre-change end). - var changeEnd = CodeMirror.changeEnd = function(change) { - if (!change.text) return change.to; - return Pos(change.from.line + change.text.length - 1, - lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0)); - }; - - // Adjust a position to refer to the post-change position of the - // same text, or the end of the change if the change covers it. - function adjustForChange(pos, change) { - if (cmp(pos, change.from) < 0) return pos; - if (cmp(pos, change.to) <= 0) return changeEnd(change); - - var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch; - if (pos.line == change.to.line) ch += changeEnd(change).ch - change.to.ch; - return Pos(line, ch); - } - - function computeSelAfterChange(doc, change) { - var out = []; - for (var i = 0; i < doc.sel.ranges.length; i++) { - var range = doc.sel.ranges[i]; - out.push(new Range(adjustForChange(range.anchor, change), - adjustForChange(range.head, change))); - } - return normalizeSelection(out, doc.sel.primIndex); - } - - function offsetPos(pos, old, nw) { - if (pos.line == old.line) - return Pos(nw.line, pos.ch - old.ch + nw.ch); - else - return Pos(nw.line + (pos.line - old.line), pos.ch); - } - - // Used by replaceSelections to allow moving the selection to the - // start or around the replaced test. Hint may be "start" or "around". - function computeReplacedSel(doc, changes, hint) { - var out = []; - var oldPrev = Pos(doc.first, 0), newPrev = oldPrev; - for (var i = 0; i < changes.length; i++) { - var change = changes[i]; - var from = offsetPos(change.from, oldPrev, newPrev); - var to = offsetPos(changeEnd(change), oldPrev, newPrev); - oldPrev = change.to; - newPrev = to; - if (hint == "around") { - var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0; - out[i] = new Range(inv ? to : from, inv ? from : to); - } else { - out[i] = new Range(from, from); - } - } - return new Selection(out, doc.sel.primIndex); - } - - // Allow "beforeChange" event handlers to influence a change - function filterChange(doc, change, update) { - var obj = { - canceled: false, - from: change.from, - to: change.to, - text: change.text, - origin: change.origin, - cancel: function() { this.canceled = true; } - }; - if (update) obj.update = function(from, to, text, origin) { - if (from) this.from = clipPos(doc, from); - if (to) this.to = clipPos(doc, to); - if (text) this.text = text; - if (origin !== undefined) this.origin = origin; - }; - signal(doc, "beforeChange", doc, obj); - if (doc.cm) signal(doc.cm, "beforeChange", doc.cm, obj); - - if (obj.canceled) return null; - return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}; - } - - // Apply a change to a document, and add it to the document's - // history, and propagating it to all linked documents. - function makeChange(doc, change, ignoreReadOnly) { - if (doc.cm) { - if (!doc.cm.curOp) return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly); - if (doc.cm.state.suppressEdits) return; - } - - if (hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")) { - change = filterChange(doc, change, true); - if (!change) return; - } - - // Possibly split or suppress the update based on the presence - // of read-only spans in its range. - var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to); - if (split) { - for (var i = split.length - 1; i >= 0; --i) - makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [""] : change.text}); - } else { - makeChangeInner(doc, change); - } - } - - function makeChangeInner(doc, change) { - if (change.text.length == 1 && change.text[0] == "" && cmp(change.from, change.to) == 0) return; - var selAfter = computeSelAfterChange(doc, change); - addChangeToHistory(doc, change, selAfter, doc.cm ? doc.cm.curOp.id : NaN); - - makeChangeSingleDoc(doc, change, selAfter, stretchSpansOverChange(doc, change)); - var rebased = []; - - linkedDocs(doc, function(doc, sharedHist) { - if (!sharedHist && indexOf(rebased, doc.history) == -1) { - rebaseHist(doc.history, change); - rebased.push(doc.history); - } - makeChangeSingleDoc(doc, change, null, stretchSpansOverChange(doc, change)); - }); - } - - // Revert a change stored in a document's history. - function makeChangeFromHistory(doc, type, allowSelectionOnly) { - if (doc.cm && doc.cm.state.suppressEdits) return; - - var hist = doc.history, event, selAfter = doc.sel; - var source = type == "undo" ? hist.done : hist.undone, dest = type == "undo" ? hist.undone : hist.done; - - // Verify that there is a useable event (so that ctrl-z won't - // needlessly clear selection events) - for (var i = 0; i < source.length; i++) { - event = source[i]; - if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges) - break; - } - if (i == source.length) return; - hist.lastOrigin = hist.lastSelOrigin = null; - - for (;;) { - event = source.pop(); - if (event.ranges) { - pushSelectionToHistory(event, dest); - if (allowSelectionOnly && !event.equals(doc.sel)) { - setSelection(doc, event, {clearRedo: false}); - return; - } - selAfter = event; - } - else break; - } - - // Build up a reverse change object to add to the opposite history - // stack (redo when undoing, and vice versa). - var antiChanges = []; - pushSelectionToHistory(selAfter, dest); - dest.push({changes: antiChanges, generation: hist.generation}); - hist.generation = event.generation || ++hist.maxGeneration; - - var filter = hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange"); - - for (var i = event.changes.length - 1; i >= 0; --i) { - var change = event.changes[i]; - change.origin = type; - if (filter && !filterChange(doc, change, false)) { - source.length = 0; - return; - } - - antiChanges.push(historyChangeFromChange(doc, change)); - - var after = i ? computeSelAfterChange(doc, change) : lst(source); - makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change)); - if (!i && doc.cm) doc.cm.scrollIntoView({from: change.from, to: changeEnd(change)}); - var rebased = []; - - // Propagate to the linked documents - linkedDocs(doc, function(doc, sharedHist) { - if (!sharedHist && indexOf(rebased, doc.history) == -1) { - rebaseHist(doc.history, change); - rebased.push(doc.history); - } - makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change)); - }); - } - } - - // Sub-views need their line numbers shifted when text is added - // above or below them in the parent document. - function shiftDoc(doc, distance) { - if (distance == 0) return; - doc.first += distance; - doc.sel = new Selection(map(doc.sel.ranges, function(range) { - return new Range(Pos(range.anchor.line + distance, range.anchor.ch), - Pos(range.head.line + distance, range.head.ch)); - }), doc.sel.primIndex); - if (doc.cm) { - regChange(doc.cm, doc.first, doc.first - distance, distance); - for (var d = doc.cm.display, l = d.viewFrom; l < d.viewTo; l++) - regLineChange(doc.cm, l, "gutter"); - } - } - - // More lower-level change function, handling only a single document - // (not linked ones). - function makeChangeSingleDoc(doc, change, selAfter, spans) { - if (doc.cm && !doc.cm.curOp) - return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans); - - if (change.to.line < doc.first) { - shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line)); - return; - } - if (change.from.line > doc.lastLine()) return; - - // Clip the change to the size of this doc - if (change.from.line < doc.first) { - var shift = change.text.length - 1 - (doc.first - change.from.line); - shiftDoc(doc, shift); - change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch), - text: [lst(change.text)], origin: change.origin}; - } - var last = doc.lastLine(); - if (change.to.line > last) { - change = {from: change.from, to: Pos(last, getLine(doc, last).text.length), - text: [change.text[0]], origin: change.origin}; - } - - change.removed = getBetween(doc, change.from, change.to); - - if (!selAfter) selAfter = computeSelAfterChange(doc, change); - if (doc.cm) makeChangeSingleDocInEditor(doc.cm, change, spans); - else updateDoc(doc, change, spans); - setSelectionNoUndo(doc, selAfter, sel_dontScroll); - } - - // Handle the interaction of a change to a document with the editor - // that this document is part of. - function makeChangeSingleDocInEditor(cm, change, spans) { - var doc = cm.doc, display = cm.display, from = change.from, to = change.to; - - var recomputeMaxLength = false, checkWidthStart = from.line; - if (!cm.options.lineWrapping) { - checkWidthStart = lineNo(visualLine(getLine(doc, from.line))); - doc.iter(checkWidthStart, to.line + 1, function(line) { - if (line == display.maxLine) { - recomputeMaxLength = true; - return true; - } - }); - } - - if (doc.sel.contains(change.from, change.to) > -1) - signalCursorActivity(cm); - - updateDoc(doc, change, spans, estimateHeight(cm)); - - if (!cm.options.lineWrapping) { - doc.iter(checkWidthStart, from.line + change.text.length, function(line) { - var len = lineLength(line); - if (len > display.maxLineLength) { - display.maxLine = line; - display.maxLineLength = len; - display.maxLineChanged = true; - recomputeMaxLength = false; - } - }); - if (recomputeMaxLength) cm.curOp.updateMaxLine = true; - } - - // Adjust frontier, schedule worker - doc.frontier = Math.min(doc.frontier, from.line); - startWorker(cm, 400); - - var lendiff = change.text.length - (to.line - from.line) - 1; - // Remember that these lines changed, for updating the display - if (change.full) - regChange(cm); - else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change)) - regLineChange(cm, from.line, "text"); - else - regChange(cm, from.line, to.line + 1, lendiff); - - var changesHandler = hasHandler(cm, "changes"), changeHandler = hasHandler(cm, "change"); - if (changeHandler || changesHandler) { - var obj = { - from: from, to: to, - text: change.text, - removed: change.removed, - origin: change.origin - }; - if (changeHandler) signalLater(cm, "change", cm, obj); - if (changesHandler) (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); - } - cm.display.selForContextMenu = null; - } - - function replaceRange(doc, code, from, to, origin) { - if (!to) to = from; - if (cmp(to, from) < 0) { var tmp = to; to = from; from = tmp; } - if (typeof code == "string") code = splitLines(code); - makeChange(doc, {from: from, to: to, text: code, origin: origin}); - } - - // SCROLLING THINGS INTO VIEW - - // If an editor sits on the top or bottom of the window, partially - // scrolled out of view, this ensures that the cursor is visible. - function maybeScrollWindow(cm, coords) { - if (signalDOMEvent(cm, "scrollCursorIntoView")) return; - - var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null; - if (coords.top + box.top < 0) doScroll = true; - else if (coords.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) doScroll = false; - if (doScroll != null && !phantom) { - var scrollNode = elt("div", "\u200b", null, "position: absolute; top: " + - (coords.top - display.viewOffset - paddingTop(cm.display)) + "px; height: " + - (coords.bottom - coords.top + scrollGap(cm) + display.barHeight) + "px; left: " + - coords.left + "px; width: 2px;"); - cm.display.lineSpace.appendChild(scrollNode); - scrollNode.scrollIntoView(doScroll); - cm.display.lineSpace.removeChild(scrollNode); - } - } - - // Scroll a given position into view (immediately), verifying that - // it actually became visible (as line heights are accurately - // measured, the position of something may 'drift' during drawing). - function scrollPosIntoView(cm, pos, end, margin) { - if (margin == null) margin = 0; - for (var limit = 0; limit < 5; limit++) { - var changed = false, coords = cursorCoords(cm, pos); - var endCoords = !end || end == pos ? coords : cursorCoords(cm, end); - var scrollPos = calculateScrollPos(cm, Math.min(coords.left, endCoords.left), - Math.min(coords.top, endCoords.top) - margin, - Math.max(coords.left, endCoords.left), - Math.max(coords.bottom, endCoords.bottom) + margin); - var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft; - if (scrollPos.scrollTop != null) { - setScrollTop(cm, scrollPos.scrollTop); - if (Math.abs(cm.doc.scrollTop - startTop) > 1) changed = true; - } - if (scrollPos.scrollLeft != null) { - setScrollLeft(cm, scrollPos.scrollLeft); - if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) changed = true; - } - if (!changed) break; - } - return coords; - } - - // Scroll a given set of coordinates into view (immediately). - function scrollIntoView(cm, x1, y1, x2, y2) { - var scrollPos = calculateScrollPos(cm, x1, y1, x2, y2); - if (scrollPos.scrollTop != null) setScrollTop(cm, scrollPos.scrollTop); - if (scrollPos.scrollLeft != null) setScrollLeft(cm, scrollPos.scrollLeft); - } - - // Calculate a new scroll position needed to scroll the given - // rectangle into view. Returns an object with scrollTop and - // scrollLeft properties. When these are undefined, the - // vertical/horizontal position does not need to be adjusted. - function calculateScrollPos(cm, x1, y1, x2, y2) { - var display = cm.display, snapMargin = textHeight(cm.display); - if (y1 < 0) y1 = 0; - var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop; - var screen = displayHeight(cm), result = {}; - if (y2 - y1 > screen) y2 = y1 + screen; - var docBottom = cm.doc.height + paddingVert(display); - var atTop = y1 < snapMargin, atBottom = y2 > docBottom - snapMargin; - if (y1 < screentop) { - result.scrollTop = atTop ? 0 : y1; - } else if (y2 > screentop + screen) { - var newTop = Math.min(y1, (atBottom ? docBottom : y2) - screen); - if (newTop != screentop) result.scrollTop = newTop; - } - - var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft; - var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0); - var tooWide = x2 - x1 > screenw; - if (tooWide) x2 = x1 + screenw; - if (x1 < 10) - result.scrollLeft = 0; - else if (x1 < screenleft) - result.scrollLeft = Math.max(0, x1 - (tooWide ? 0 : 10)); - else if (x2 > screenw + screenleft - 3) - result.scrollLeft = x2 + (tooWide ? 0 : 10) - screenw; - return result; - } - - // Store a relative adjustment to the scroll position in the current - // operation (to be applied when the operation finishes). - function addToScrollPos(cm, left, top) { - if (left != null || top != null) resolveScrollToPos(cm); - if (left != null) - cm.curOp.scrollLeft = (cm.curOp.scrollLeft == null ? cm.doc.scrollLeft : cm.curOp.scrollLeft) + left; - if (top != null) - cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top; - } - - // Make sure that at the end of the operation the current cursor is - // shown. - function ensureCursorVisible(cm) { - resolveScrollToPos(cm); - var cur = cm.getCursor(), from = cur, to = cur; - if (!cm.options.lineWrapping) { - from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur; - to = Pos(cur.line, cur.ch + 1); - } - cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin, isCursor: true}; - } - - // When an operation has its scrollToPos property set, and another - // scroll action is applied before the end of the operation, this - // 'simulates' scrolling that position into view in a cheap way, so - // that the effect of intermediate scroll commands is not ignored. - function resolveScrollToPos(cm) { - var range = cm.curOp.scrollToPos; - if (range) { - cm.curOp.scrollToPos = null; - var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to); - var sPos = calculateScrollPos(cm, Math.min(from.left, to.left), - Math.min(from.top, to.top) - range.margin, - Math.max(from.right, to.right), - Math.max(from.bottom, to.bottom) + range.margin); - cm.scrollTo(sPos.scrollLeft, sPos.scrollTop); - } - } - - // API UTILITIES - - // Indent the given line. The how parameter can be "smart", - // "add"/null, "subtract", or "prev". When aggressive is false - // (typically set to true for forced single-line indents), empty - // lines are not indented, and places where the mode returns Pass - // are left alone. - function indentLine(cm, n, how, aggressive) { - var doc = cm.doc, state; - if (how == null) how = "add"; - if (how == "smart") { - // Fall back to "prev" when the mode doesn't have an indentation - // method. - if (!doc.mode.indent) how = "prev"; - else state = getStateBefore(cm, n); - } - - var tabSize = cm.options.tabSize; - var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize); - if (line.stateAfter) line.stateAfter = null; - var curSpaceString = line.text.match(/^\s*/)[0], indentation; - if (!aggressive && !/\S/.test(line.text)) { - indentation = 0; - how = "not"; - } else if (how == "smart") { - indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text); - if (indentation == Pass || indentation > 150) { - if (!aggressive) return; - how = "prev"; - } - } - if (how == "prev") { - if (n > doc.first) indentation = countColumn(getLine(doc, n-1).text, null, tabSize); - else indentation = 0; - } else if (how == "add") { - indentation = curSpace + cm.options.indentUnit; - } else if (how == "subtract") { - indentation = curSpace - cm.options.indentUnit; - } else if (typeof how == "number") { - indentation = curSpace + how; - } - indentation = Math.max(0, indentation); - - var indentString = "", pos = 0; - if (cm.options.indentWithTabs) - for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += "\t";} - if (pos < indentation) indentString += spaceStr(indentation - pos); - - if (indentString != curSpaceString) { - replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), "+input"); - } else { - // Ensure that, if the cursor was in the whitespace at the start - // of the line, it is moved to the end of that space. - for (var i = 0; i < doc.sel.ranges.length; i++) { - var range = doc.sel.ranges[i]; - if (range.head.line == n && range.head.ch < curSpaceString.length) { - var pos = Pos(n, curSpaceString.length); - replaceOneSelection(doc, i, new Range(pos, pos)); - break; - } - } - } - line.stateAfter = null; - } - - // Utility for applying a change to a line by handle or number, - // returning the number and optionally registering the line as - // changed. - function changeLine(doc, handle, changeType, op) { - var no = handle, line = handle; - if (typeof handle == "number") line = getLine(doc, clipLine(doc, handle)); - else no = lineNo(handle); - if (no == null) return null; - if (op(line, no) && doc.cm) regLineChange(doc.cm, no, changeType); - return line; - } - - // Helper for deleting text near the selection(s), used to implement - // backspace, delete, and similar functionality. - function deleteNearSelection(cm, compute) { - var ranges = cm.doc.sel.ranges, kill = []; - // Build up a set of ranges to kill first, merging overlapping - // ranges. - for (var i = 0; i < ranges.length; i++) { - var toKill = compute(ranges[i]); - while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) { - var replaced = kill.pop(); - if (cmp(replaced.from, toKill.from) < 0) { - toKill.from = replaced.from; - break; - } - } - kill.push(toKill); - } - // Next, remove those actual ranges. - runInOp(cm, function() { - for (var i = kill.length - 1; i >= 0; i--) - replaceRange(cm.doc, "", kill[i].from, kill[i].to, "+delete"); - ensureCursorVisible(cm); - }); - } - - // Used for horizontal relative motion. Dir is -1 or 1 (left or - // right), unit can be "char", "column" (like char, but doesn't - // cross line boundaries), "word" (across next word), or "group" (to - // the start of next group of word or non-word-non-whitespace - // chars). The visually param controls whether, in right-to-left - // text, direction 1 means to move towards the next index in the - // string, or towards the character to the right of the current - // position. The resulting position will have a hitSide=true - // property if it reached the end of the document. - function findPosH(doc, pos, dir, unit, visually) { - var line = pos.line, ch = pos.ch, origDir = dir; - var lineObj = getLine(doc, line); - var possible = true; - function findNextLine() { - var l = line + dir; - if (l < doc.first || l >= doc.first + doc.size) return (possible = false); - line = l; - return lineObj = getLine(doc, l); - } - function moveOnce(boundToLine) { - var next = (visually ? moveVisually : moveLogically)(lineObj, ch, dir, true); - if (next == null) { - if (!boundToLine && findNextLine()) { - if (visually) ch = (dir < 0 ? lineRight : lineLeft)(lineObj); - else ch = dir < 0 ? lineObj.text.length : 0; - } else return (possible = false); - } else ch = next; - return true; - } - - if (unit == "char") moveOnce(); - else if (unit == "column") moveOnce(true); - else if (unit == "word" || unit == "group") { - var sawType = null, group = unit == "group"; - var helper = doc.cm && doc.cm.getHelper(pos, "wordChars"); - for (var first = true;; first = false) { - if (dir < 0 && !moveOnce(!first)) break; - var cur = lineObj.text.charAt(ch) || "\n"; - var type = isWordChar(cur, helper) ? "w" - : group && cur == "\n" ? "n" - : !group || /\s/.test(cur) ? null - : "p"; - if (group && !first && !type) type = "s"; - if (sawType && sawType != type) { - if (dir < 0) {dir = 1; moveOnce();} - break; - } - - if (type) sawType = type; - if (dir > 0 && !moveOnce(!first)) break; - } - } - var result = skipAtomic(doc, Pos(line, ch), origDir, true); - if (!possible) result.hitSide = true; - return result; - } - - // For relative vertical movement. Dir may be -1 or 1. Unit can be - // "page" or "line". The resulting position will have a hitSide=true - // property if it reached the end of the document. - function findPosV(cm, pos, dir, unit) { - var doc = cm.doc, x = pos.left, y; - if (unit == "page") { - var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight); - y = pos.top + dir * (pageSize - (dir < 0 ? 1.5 : .5) * textHeight(cm.display)); - } else if (unit == "line") { - y = dir > 0 ? pos.bottom + 3 : pos.top - 3; - } - for (;;) { - var target = coordsChar(cm, x, y); - if (!target.outside) break; - if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break; } - y += dir * 5; - } - return target; - } - - // EDITOR METHODS - - // The publicly visible API. Note that methodOp(f) means - // 'wrap f in an operation, performed on its `this` parameter'. - - // This is not the complete set of editor methods. Most of the - // methods defined on the Doc type are also injected into - // CodeMirror.prototype, for backwards compatibility and - // convenience. - - CodeMirror.prototype = { - constructor: CodeMirror, - focus: function(){window.focus(); focusInput(this); fastPoll(this);}, - - setOption: function(option, value) { - var options = this.options, old = options[option]; - if (options[option] == value && option != "mode") return; - options[option] = value; - if (optionHandlers.hasOwnProperty(option)) - operation(this, optionHandlers[option])(this, value, old); - }, - - getOption: function(option) {return this.options[option];}, - getDoc: function() {return this.doc;}, - - addKeyMap: function(map, bottom) { - this.state.keyMaps[bottom ? "push" : "unshift"](getKeyMap(map)); - }, - removeKeyMap: function(map) { - var maps = this.state.keyMaps; - for (var i = 0; i < maps.length; ++i) - if (maps[i] == map || maps[i].name == map) { - maps.splice(i, 1); - return true; - } - }, - - addOverlay: methodOp(function(spec, options) { - var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec); - if (mode.startState) throw new Error("Overlays may not be stateful."); - this.state.overlays.push({mode: mode, modeSpec: spec, opaque: options && options.opaque}); - this.state.modeGen++; - regChange(this); - }), - removeOverlay: methodOp(function(spec) { - var overlays = this.state.overlays; - for (var i = 0; i < overlays.length; ++i) { - var cur = overlays[i].modeSpec; - if (cur == spec || typeof spec == "string" && cur.name == spec) { - overlays.splice(i, 1); - this.state.modeGen++; - regChange(this); - return; - } - } - }), - - indentLine: methodOp(function(n, dir, aggressive) { - if (typeof dir != "string" && typeof dir != "number") { - if (dir == null) dir = this.options.smartIndent ? "smart" : "prev"; - else dir = dir ? "add" : "subtract"; - } - if (isLine(this.doc, n)) indentLine(this, n, dir, aggressive); - }), - indentSelection: methodOp(function(how) { - var ranges = this.doc.sel.ranges, end = -1; - for (var i = 0; i < ranges.length; i++) { - var range = ranges[i]; - if (!range.empty()) { - var from = range.from(), to = range.to(); - var start = Math.max(end, from.line); - end = Math.min(this.lastLine(), to.line - (to.ch ? 0 : 1)) + 1; - for (var j = start; j < end; ++j) - indentLine(this, j, how); - var newRanges = this.doc.sel.ranges; - if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0) - replaceOneSelection(this.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); - } else if (range.head.line > end) { - indentLine(this, range.head.line, how, true); - end = range.head.line; - if (i == this.doc.sel.primIndex) ensureCursorVisible(this); - } - } - }), - - // Fetch the parser token for a given character. Useful for hacks - // that want to inspect the mode state (say, for completion). - getTokenAt: function(pos, precise) { - return takeToken(this, pos, precise); - }, - - getLineTokens: function(line, precise) { - return takeToken(this, Pos(line), precise, true); - }, - - getTokenTypeAt: function(pos) { - pos = clipPos(this.doc, pos); - var styles = getLineStyles(this, getLine(this.doc, pos.line)); - var before = 0, after = (styles.length - 1) / 2, ch = pos.ch; - var type; - if (ch == 0) type = styles[2]; - else for (;;) { - var mid = (before + after) >> 1; - if ((mid ? styles[mid * 2 - 1] : 0) >= ch) after = mid; - else if (styles[mid * 2 + 1] < ch) before = mid + 1; - else { type = styles[mid * 2 + 2]; break; } - } - var cut = type ? type.indexOf("cm-overlay ") : -1; - return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1); - }, - - getModeAt: function(pos) { - var mode = this.doc.mode; - if (!mode.innerMode) return mode; - return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode; - }, - - getHelper: function(pos, type) { - return this.getHelpers(pos, type)[0]; - }, - - getHelpers: function(pos, type) { - var found = []; - if (!helpers.hasOwnProperty(type)) return helpers; - var help = helpers[type], mode = this.getModeAt(pos); - if (typeof mode[type] == "string") { - if (help[mode[type]]) found.push(help[mode[type]]); - } else if (mode[type]) { - for (var i = 0; i < mode[type].length; i++) { - var val = help[mode[type][i]]; - if (val) found.push(val); - } - } else if (mode.helperType && help[mode.helperType]) { - found.push(help[mode.helperType]); - } else if (help[mode.name]) { - found.push(help[mode.name]); - } - for (var i = 0; i < help._global.length; i++) { - var cur = help._global[i]; - if (cur.pred(mode, this) && indexOf(found, cur.val) == -1) - found.push(cur.val); - } - return found; - }, - - getStateAfter: function(line, precise) { - var doc = this.doc; - line = clipLine(doc, line == null ? doc.first + doc.size - 1: line); - return getStateBefore(this, line + 1, precise); - }, - - cursorCoords: function(start, mode) { - var pos, range = this.doc.sel.primary(); - if (start == null) pos = range.head; - else if (typeof start == "object") pos = clipPos(this.doc, start); - else pos = start ? range.from() : range.to(); - return cursorCoords(this, pos, mode || "page"); - }, - - charCoords: function(pos, mode) { - return charCoords(this, clipPos(this.doc, pos), mode || "page"); - }, - - coordsChar: function(coords, mode) { - coords = fromCoordSystem(this, coords, mode || "page"); - return coordsChar(this, coords.left, coords.top); - }, - - lineAtHeight: function(height, mode) { - height = fromCoordSystem(this, {top: height, left: 0}, mode || "page").top; - return lineAtHeight(this.doc, height + this.display.viewOffset); - }, - heightAtLine: function(line, mode) { - var end = false, last = this.doc.first + this.doc.size - 1; - if (line < this.doc.first) line = this.doc.first; - else if (line > last) { line = last; end = true; } - var lineObj = getLine(this.doc, line); - return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || "page").top + - (end ? this.doc.height - heightAtLine(lineObj) : 0); - }, - - defaultTextHeight: function() { return textHeight(this.display); }, - defaultCharWidth: function() { return charWidth(this.display); }, - - setGutterMarker: methodOp(function(line, gutterID, value) { - return changeLine(this.doc, line, "gutter", function(line) { - var markers = line.gutterMarkers || (line.gutterMarkers = {}); - markers[gutterID] = value; - if (!value && isEmpty(markers)) line.gutterMarkers = null; - return true; - }); - }), - - clearGutter: methodOp(function(gutterID) { - var cm = this, doc = cm.doc, i = doc.first; - doc.iter(function(line) { - if (line.gutterMarkers && line.gutterMarkers[gutterID]) { - line.gutterMarkers[gutterID] = null; - regLineChange(cm, i, "gutter"); - if (isEmpty(line.gutterMarkers)) line.gutterMarkers = null; - } - ++i; - }); - }), - - addLineWidget: methodOp(function(handle, node, options) { - return addLineWidget(this, handle, node, options); - }), - - removeLineWidget: function(widget) { widget.clear(); }, - - lineInfo: function(line) { - if (typeof line == "number") { - if (!isLine(this.doc, line)) return null; - var n = line; - line = getLine(this.doc, line); - if (!line) return null; - } else { - var n = lineNo(line); - if (n == null) return null; - } - return {line: n, handle: line, text: line.text, gutterMarkers: line.gutterMarkers, - textClass: line.textClass, bgClass: line.bgClass, wrapClass: line.wrapClass, - widgets: line.widgets}; - }, - - getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo};}, - - addWidget: function(pos, node, scroll, vert, horiz) { - var display = this.display; - pos = cursorCoords(this, clipPos(this.doc, pos)); - var top = pos.bottom, left = pos.left; - node.style.position = "absolute"; - node.setAttribute("cm-ignore-events", "true"); - display.sizer.appendChild(node); - if (vert == "over") { - top = pos.top; - } else if (vert == "above" || vert == "near") { - var vspace = Math.max(display.wrapper.clientHeight, this.doc.height), - hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth); - // Default to positioning above (if specified and possible); otherwise default to positioning below - if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight) - top = pos.top - node.offsetHeight; - else if (pos.bottom + node.offsetHeight <= vspace) - top = pos.bottom; - if (left + node.offsetWidth > hspace) - left = hspace - node.offsetWidth; - } - node.style.top = top + "px"; - node.style.left = node.style.right = ""; - if (horiz == "right") { - left = display.sizer.clientWidth - node.offsetWidth; - node.style.right = "0px"; - } else { - if (horiz == "left") left = 0; - else if (horiz == "middle") left = (display.sizer.clientWidth - node.offsetWidth) / 2; - node.style.left = left + "px"; - } - if (scroll) - scrollIntoView(this, left, top, left + node.offsetWidth, top + node.offsetHeight); - }, - - triggerOnKeyDown: methodOp(onKeyDown), - triggerOnKeyPress: methodOp(onKeyPress), - triggerOnKeyUp: onKeyUp, - - execCommand: function(cmd) { - if (commands.hasOwnProperty(cmd)) - return commands[cmd](this); - }, - - findPosH: function(from, amount, unit, visually) { - var dir = 1; - if (amount < 0) { dir = -1; amount = -amount; } - for (var i = 0, cur = clipPos(this.doc, from); i < amount; ++i) { - cur = findPosH(this.doc, cur, dir, unit, visually); - if (cur.hitSide) break; - } - return cur; - }, - - moveH: methodOp(function(dir, unit) { - var cm = this; - cm.extendSelectionsBy(function(range) { - if (cm.display.shift || cm.doc.extend || range.empty()) - return findPosH(cm.doc, range.head, dir, unit, cm.options.rtlMoveVisually); - else - return dir < 0 ? range.from() : range.to(); - }, sel_move); - }), - - deleteH: methodOp(function(dir, unit) { - var sel = this.doc.sel, doc = this.doc; - if (sel.somethingSelected()) - doc.replaceSelection("", null, "+delete"); - else - deleteNearSelection(this, function(range) { - var other = findPosH(doc, range.head, dir, unit, false); - return dir < 0 ? {from: other, to: range.head} : {from: range.head, to: other}; - }); - }), - - findPosV: function(from, amount, unit, goalColumn) { - var dir = 1, x = goalColumn; - if (amount < 0) { dir = -1; amount = -amount; } - for (var i = 0, cur = clipPos(this.doc, from); i < amount; ++i) { - var coords = cursorCoords(this, cur, "div"); - if (x == null) x = coords.left; - else coords.left = x; - cur = findPosV(this, coords, dir, unit); - if (cur.hitSide) break; - } - return cur; - }, - - moveV: methodOp(function(dir, unit) { - var cm = this, doc = this.doc, goals = []; - var collapse = !cm.display.shift && !doc.extend && doc.sel.somethingSelected(); - doc.extendSelectionsBy(function(range) { - if (collapse) - return dir < 0 ? range.from() : range.to(); - var headPos = cursorCoords(cm, range.head, "div"); - if (range.goalColumn != null) headPos.left = range.goalColumn; - goals.push(headPos.left); - var pos = findPosV(cm, headPos, dir, unit); - if (unit == "page" && range == doc.sel.primary()) - addToScrollPos(cm, null, charCoords(cm, pos, "div").top - headPos.top); - return pos; - }, sel_move); - if (goals.length) for (var i = 0; i < doc.sel.ranges.length; i++) - doc.sel.ranges[i].goalColumn = goals[i]; - }), - - // Find the word at the given position (as returned by coordsChar). - findWordAt: function(pos) { - var doc = this.doc, line = getLine(doc, pos.line).text; - var start = pos.ch, end = pos.ch; - if (line) { - var helper = this.getHelper(pos, "wordChars"); - if ((pos.xRel < 0 || end == line.length) && start) --start; else ++end; - var startChar = line.charAt(start); - var check = isWordChar(startChar, helper) - ? function(ch) { return isWordChar(ch, helper); } - : /\s/.test(startChar) ? function(ch) {return /\s/.test(ch);} - : function(ch) {return !/\s/.test(ch) && !isWordChar(ch);}; - while (start > 0 && check(line.charAt(start - 1))) --start; - while (end < line.length && check(line.charAt(end))) ++end; - } - return new Range(Pos(pos.line, start), Pos(pos.line, end)); - }, - - toggleOverwrite: function(value) { - if (value != null && value == this.state.overwrite) return; - if (this.state.overwrite = !this.state.overwrite) - addClass(this.display.cursorDiv, "CodeMirror-overwrite"); - else - rmClass(this.display.cursorDiv, "CodeMirror-overwrite"); - - signal(this, "overwriteToggle", this, this.state.overwrite); - }, - hasFocus: function() { return activeElt() == this.display.input; }, - - scrollTo: methodOp(function(x, y) { - if (x != null || y != null) resolveScrollToPos(this); - if (x != null) this.curOp.scrollLeft = x; - if (y != null) this.curOp.scrollTop = y; - }), - getScrollInfo: function() { - var scroller = this.display.scroller; - return {left: scroller.scrollLeft, top: scroller.scrollTop, - height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight, - width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth, - clientHeight: displayHeight(this), clientWidth: displayWidth(this)}; - }, - - scrollIntoView: methodOp(function(range, margin) { - if (range == null) { - range = {from: this.doc.sel.primary().head, to: null}; - if (margin == null) margin = this.options.cursorScrollMargin; - } else if (typeof range == "number") { - range = {from: Pos(range, 0), to: null}; - } else if (range.from == null) { - range = {from: range, to: null}; - } - if (!range.to) range.to = range.from; - range.margin = margin || 0; - - if (range.from.line != null) { - resolveScrollToPos(this); - this.curOp.scrollToPos = range; - } else { - var sPos = calculateScrollPos(this, Math.min(range.from.left, range.to.left), - Math.min(range.from.top, range.to.top) - range.margin, - Math.max(range.from.right, range.to.right), - Math.max(range.from.bottom, range.to.bottom) + range.margin); - this.scrollTo(sPos.scrollLeft, sPos.scrollTop); - } - }), - - setSize: methodOp(function(width, height) { - var cm = this; - function interpret(val) { - return typeof val == "number" || /^\d+$/.test(String(val)) ? val + "px" : val; - } - if (width != null) cm.display.wrapper.style.width = interpret(width); - if (height != null) cm.display.wrapper.style.height = interpret(height); - if (cm.options.lineWrapping) clearLineMeasurementCache(this); - var lineNo = cm.display.viewFrom; - cm.doc.iter(lineNo, cm.display.viewTo, function(line) { - if (line.widgets) for (var i = 0; i < line.widgets.length; i++) - if (line.widgets[i].noHScroll) { regLineChange(cm, lineNo, "widget"); break; } - ++lineNo; - }); - cm.curOp.forceUpdate = true; - signal(cm, "refresh", this); - }), - - operation: function(f){return runInOp(this, f);}, - - refresh: methodOp(function() { - var oldHeight = this.display.cachedTextHeight; - regChange(this); - this.curOp.forceUpdate = true; - clearCaches(this); - this.scrollTo(this.doc.scrollLeft, this.doc.scrollTop); - updateGutterSpace(this); - if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5) - estimateLineHeights(this); - signal(this, "refresh", this); - }), - - swapDoc: methodOp(function(doc) { - var old = this.doc; - old.cm = null; - attachDoc(this, doc); - clearCaches(this); - resetInput(this); - this.scrollTo(doc.scrollLeft, doc.scrollTop); - this.curOp.forceScroll = true; - signalLater(this, "swapDoc", this, old); - return old; - }), - - getInputField: function(){return this.display.input;}, - getWrapperElement: function(){return this.display.wrapper;}, - getScrollerElement: function(){return this.display.scroller;}, - getGutterElement: function(){return this.display.gutters;} - }; - eventMixin(CodeMirror); - - // OPTION DEFAULTS - - // The default configuration options. - var defaults = CodeMirror.defaults = {}; - // Functions to run when options are changed. - var optionHandlers = CodeMirror.optionHandlers = {}; - - function option(name, deflt, handle, notOnInit) { - CodeMirror.defaults[name] = deflt; - if (handle) optionHandlers[name] = - notOnInit ? function(cm, val, old) {if (old != Init) handle(cm, val, old);} : handle; - } - - // Passed to option handlers when there is no old value. - var Init = CodeMirror.Init = {toString: function(){return "CodeMirror.Init";}}; - - // These two are, on init, called from the constructor because they - // have to be initialized before the editor can start at all. - option("value", "", function(cm, val) { - cm.setValue(val); - }, true); - option("mode", null, function(cm, val) { - cm.doc.modeOption = val; - loadMode(cm); - }, true); - - option("indentUnit", 2, loadMode, true); - option("indentWithTabs", false); - option("smartIndent", true); - option("tabSize", 4, function(cm) { - resetModeState(cm); - clearCaches(cm); - regChange(cm); - }, true); - option("specialChars", /[\t\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g, function(cm, val) { - cm.options.specialChars = new RegExp(val.source + (val.test("\t") ? "" : "|\t"), "g"); - cm.refresh(); - }, true); - option("specialCharPlaceholder", defaultSpecialCharPlaceholder, function(cm) {cm.refresh();}, true); - option("electricChars", true); - option("rtlMoveVisually", !windows); - option("wholeLineUpdateBefore", true); - - option("theme", "default", function(cm) { - themeChanged(cm); - guttersChanged(cm); - }, true); - option("keyMap", "default", function(cm, val, old) { - var next = getKeyMap(val); - var prev = old != CodeMirror.Init && getKeyMap(old); - if (prev && prev.detach) prev.detach(cm, next); - if (next.attach) next.attach(cm, prev || null); - }); - option("extraKeys", null); - - option("lineWrapping", false, wrappingChanged, true); - option("gutters", [], function(cm) { - setGuttersForLineNumbers(cm.options); - guttersChanged(cm); - }, true); - option("fixedGutter", true, function(cm, val) { - cm.display.gutters.style.left = val ? compensateForHScroll(cm.display) + "px" : "0"; - cm.refresh(); - }, true); - option("coverGutterNextToScrollbar", false, function(cm) {updateScrollbars(cm);}, true); - option("scrollbarStyle", "native", function(cm) { - initScrollbars(cm); - updateScrollbars(cm); - cm.display.scrollbars.setScrollTop(cm.doc.scrollTop); - cm.display.scrollbars.setScrollLeft(cm.doc.scrollLeft); - }, true); - option("lineNumbers", false, function(cm) { - setGuttersForLineNumbers(cm.options); - guttersChanged(cm); - }, true); - option("firstLineNumber", 1, guttersChanged, true); - option("lineNumberFormatter", function(integer) {return integer;}, guttersChanged, true); - option("showCursorWhenSelecting", false, updateSelection, true); - - option("resetSelectionOnContextMenu", true); - - option("readOnly", false, function(cm, val) { - if (val == "nocursor") { - onBlur(cm); - cm.display.input.blur(); - cm.display.disabled = true; - } else { - cm.display.disabled = false; - if (!val) resetInput(cm); - } - }); - option("disableInput", false, function(cm, val) {if (!val) resetInput(cm);}, true); - option("dragDrop", true); - - option("cursorBlinkRate", 530); - option("cursorScrollMargin", 0); - option("cursorHeight", 1, updateSelection, true); - option("singleCursorHeightPerLine", true, updateSelection, true); - option("workTime", 100); - option("workDelay", 100); - option("flattenSpans", true, resetModeState, true); - option("addModeClass", false, resetModeState, true); - option("pollInterval", 100); - option("undoDepth", 200, function(cm, val){cm.doc.history.undoDepth = val;}); - option("historyEventDelay", 1250); - option("viewportMargin", 10, function(cm){cm.refresh();}, true); - option("maxHighlightLength", 10000, resetModeState, true); - option("moveInputWithCursor", true, function(cm, val) { - if (!val) cm.display.inputDiv.style.top = cm.display.inputDiv.style.left = 0; - }); - - option("tabindex", null, function(cm, val) { - cm.display.input.tabIndex = val || ""; - }); - option("autofocus", null); - - // MODE DEFINITION AND QUERYING - - // Known modes, by name and by MIME - var modes = CodeMirror.modes = {}, mimeModes = CodeMirror.mimeModes = {}; - - // Extra arguments are stored as the mode's dependencies, which is - // used by (legacy) mechanisms like loadmode.js to automatically - // load a mode. (Preferred mechanism is the require/define calls.) - CodeMirror.defineMode = function(name, mode) { - if (!CodeMirror.defaults.mode && name != "null") CodeMirror.defaults.mode = name; - if (arguments.length > 2) - mode.dependencies = Array.prototype.slice.call(arguments, 2); - modes[name] = mode; - }; - - CodeMirror.defineMIME = function(mime, spec) { - mimeModes[mime] = spec; - }; - - // Given a MIME type, a {name, ...options} config object, or a name - // string, return a mode config object. - CodeMirror.resolveMode = function(spec) { - if (typeof spec == "string" && mimeModes.hasOwnProperty(spec)) { - spec = mimeModes[spec]; - } else if (spec && typeof spec.name == "string" && mimeModes.hasOwnProperty(spec.name)) { - var found = mimeModes[spec.name]; - if (typeof found == "string") found = {name: found}; - spec = createObj(found, spec); - spec.name = found.name; - } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(spec)) { - return CodeMirror.resolveMode("application/xml"); - } - if (typeof spec == "string") return {name: spec}; - else return spec || {name: "null"}; - }; - - // Given a mode spec (anything that resolveMode accepts), find and - // initialize an actual mode object. - CodeMirror.getMode = function(options, spec) { - var spec = CodeMirror.resolveMode(spec); - var mfactory = modes[spec.name]; - if (!mfactory) return CodeMirror.getMode(options, "text/plain"); - var modeObj = mfactory(options, spec); - if (modeExtensions.hasOwnProperty(spec.name)) { - var exts = modeExtensions[spec.name]; - for (var prop in exts) { - if (!exts.hasOwnProperty(prop)) continue; - if (modeObj.hasOwnProperty(prop)) modeObj["_" + prop] = modeObj[prop]; - modeObj[prop] = exts[prop]; - } - } - modeObj.name = spec.name; - if (spec.helperType) modeObj.helperType = spec.helperType; - if (spec.modeProps) for (var prop in spec.modeProps) - modeObj[prop] = spec.modeProps[prop]; - - return modeObj; - }; - - // Minimal default mode. - CodeMirror.defineMode("null", function() { - return {token: function(stream) {stream.skipToEnd();}}; - }); - CodeMirror.defineMIME("text/plain", "null"); - - // This can be used to attach properties to mode objects from - // outside the actual mode definition. - var modeExtensions = CodeMirror.modeExtensions = {}; - CodeMirror.extendMode = function(mode, properties) { - var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {}); - copyObj(properties, exts); - }; - - // EXTENSIONS - - CodeMirror.defineExtension = function(name, func) { - CodeMirror.prototype[name] = func; - }; - CodeMirror.defineDocExtension = function(name, func) { - Doc.prototype[name] = func; - }; - CodeMirror.defineOption = option; - - var initHooks = []; - CodeMirror.defineInitHook = function(f) {initHooks.push(f);}; - - var helpers = CodeMirror.helpers = {}; - CodeMirror.registerHelper = function(type, name, value) { - if (!helpers.hasOwnProperty(type)) helpers[type] = CodeMirror[type] = {_global: []}; - helpers[type][name] = value; - }; - CodeMirror.registerGlobalHelper = function(type, name, predicate, value) { - CodeMirror.registerHelper(type, name, value); - helpers[type]._global.push({pred: predicate, val: value}); - }; - - // MODE STATE HANDLING - - // Utility functions for working with state. Exported because nested - // modes need to do this for their inner modes. - - var copyState = CodeMirror.copyState = function(mode, state) { - if (state === true) return state; - if (mode.copyState) return mode.copyState(state); - var nstate = {}; - for (var n in state) { - var val = state[n]; - if (val instanceof Array) val = val.concat([]); - nstate[n] = val; - } - return nstate; - }; - - var startState = CodeMirror.startState = function(mode, a1, a2) { - return mode.startState ? mode.startState(a1, a2) : true; - }; - - // Given a mode and a state (for that mode), find the inner mode and - // state at the position that the state refers to. - CodeMirror.innerMode = function(mode, state) { - while (mode.innerMode) { - var info = mode.innerMode(state); - if (!info || info.mode == mode) break; - state = info.state; - mode = info.mode; - } - return info || {mode: mode, state: state}; - }; - - // STANDARD COMMANDS - - // Commands are parameter-less actions that can be performed on an - // editor, mostly used for keybindings. - var commands = CodeMirror.commands = { - selectAll: function(cm) {cm.setSelection(Pos(cm.firstLine(), 0), Pos(cm.lastLine()), sel_dontScroll);}, - singleSelection: function(cm) { - cm.setSelection(cm.getCursor("anchor"), cm.getCursor("head"), sel_dontScroll); - }, - killLine: function(cm) { - deleteNearSelection(cm, function(range) { - if (range.empty()) { - var len = getLine(cm.doc, range.head.line).text.length; - if (range.head.ch == len && range.head.line < cm.lastLine()) - return {from: range.head, to: Pos(range.head.line + 1, 0)}; - else - return {from: range.head, to: Pos(range.head.line, len)}; - } else { - return {from: range.from(), to: range.to()}; - } - }); - }, - deleteLine: function(cm) { - deleteNearSelection(cm, function(range) { - return {from: Pos(range.from().line, 0), - to: clipPos(cm.doc, Pos(range.to().line + 1, 0))}; - }); - }, - delLineLeft: function(cm) { - deleteNearSelection(cm, function(range) { - return {from: Pos(range.from().line, 0), to: range.from()}; - }); - }, - delWrappedLineLeft: function(cm) { - deleteNearSelection(cm, function(range) { - var top = cm.charCoords(range.head, "div").top + 5; - var leftPos = cm.coordsChar({left: 0, top: top}, "div"); - return {from: leftPos, to: range.from()}; - }); - }, - delWrappedLineRight: function(cm) { - deleteNearSelection(cm, function(range) { - var top = cm.charCoords(range.head, "div").top + 5; - var rightPos = cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div"); - return {from: range.from(), to: rightPos }; - }); - }, - undo: function(cm) {cm.undo();}, - redo: function(cm) {cm.redo();}, - undoSelection: function(cm) {cm.undoSelection();}, - redoSelection: function(cm) {cm.redoSelection();}, - goDocStart: function(cm) {cm.extendSelection(Pos(cm.firstLine(), 0));}, - goDocEnd: function(cm) {cm.extendSelection(Pos(cm.lastLine()));}, - goLineStart: function(cm) { - cm.extendSelectionsBy(function(range) { return lineStart(cm, range.head.line); }, - {origin: "+move", bias: 1}); - }, - goLineStartSmart: function(cm) { - cm.extendSelectionsBy(function(range) { - return lineStartSmart(cm, range.head); - }, {origin: "+move", bias: 1}); - }, - goLineEnd: function(cm) { - cm.extendSelectionsBy(function(range) { return lineEnd(cm, range.head.line); }, - {origin: "+move", bias: -1}); - }, - goLineRight: function(cm) { - cm.extendSelectionsBy(function(range) { - var top = cm.charCoords(range.head, "div").top + 5; - return cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div"); - }, sel_move); - }, - goLineLeft: function(cm) { - cm.extendSelectionsBy(function(range) { - var top = cm.charCoords(range.head, "div").top + 5; - return cm.coordsChar({left: 0, top: top}, "div"); - }, sel_move); - }, - goLineLeftSmart: function(cm) { - cm.extendSelectionsBy(function(range) { - var top = cm.charCoords(range.head, "div").top + 5; - var pos = cm.coordsChar({left: 0, top: top}, "div"); - if (pos.ch < cm.getLine(pos.line).search(/\S/)) return lineStartSmart(cm, range.head); - return pos; - }, sel_move); - }, - goLineUp: function(cm) {cm.moveV(-1, "line");}, - goLineDown: function(cm) {cm.moveV(1, "line");}, - goPageUp: function(cm) {cm.moveV(-1, "page");}, - goPageDown: function(cm) {cm.moveV(1, "page");}, - goCharLeft: function(cm) {cm.moveH(-1, "char");}, - goCharRight: function(cm) {cm.moveH(1, "char");}, - goColumnLeft: function(cm) {cm.moveH(-1, "column");}, - goColumnRight: function(cm) {cm.moveH(1, "column");}, - goWordLeft: function(cm) {cm.moveH(-1, "word");}, - goGroupRight: function(cm) {cm.moveH(1, "group");}, - goGroupLeft: function(cm) {cm.moveH(-1, "group");}, - goWordRight: function(cm) {cm.moveH(1, "word");}, - delCharBefore: function(cm) {cm.deleteH(-1, "char");}, - delCharAfter: function(cm) {cm.deleteH(1, "char");}, - delWordBefore: function(cm) {cm.deleteH(-1, "word");}, - delWordAfter: function(cm) {cm.deleteH(1, "word");}, - delGroupBefore: function(cm) {cm.deleteH(-1, "group");}, - delGroupAfter: function(cm) {cm.deleteH(1, "group");}, - indentAuto: function(cm) {cm.indentSelection("smart");}, - indentMore: function(cm) {cm.indentSelection("add");}, - indentLess: function(cm) {cm.indentSelection("subtract");}, - insertTab: function(cm) {cm.replaceSelection("\t");}, - insertSoftTab: function(cm) { - var spaces = [], ranges = cm.listSelections(), tabSize = cm.options.tabSize; - for (var i = 0; i < ranges.length; i++) { - var pos = ranges[i].from(); - var col = countColumn(cm.getLine(pos.line), pos.ch, tabSize); - spaces.push(new Array(tabSize - col % tabSize + 1).join(" ")); - } - cm.replaceSelections(spaces); - }, - defaultTab: function(cm) { - if (cm.somethingSelected()) cm.indentSelection("add"); - else cm.execCommand("insertTab"); - }, - transposeChars: function(cm) { - runInOp(cm, function() { - var ranges = cm.listSelections(), newSel = []; - for (var i = 0; i < ranges.length; i++) { - var cur = ranges[i].head, line = getLine(cm.doc, cur.line).text; - if (line) { - if (cur.ch == line.length) cur = new Pos(cur.line, cur.ch - 1); - if (cur.ch > 0) { - cur = new Pos(cur.line, cur.ch + 1); - cm.replaceRange(line.charAt(cur.ch - 1) + line.charAt(cur.ch - 2), - Pos(cur.line, cur.ch - 2), cur, "+transpose"); - } else if (cur.line > cm.doc.first) { - var prev = getLine(cm.doc, cur.line - 1).text; - if (prev) - cm.replaceRange(line.charAt(0) + "\n" + prev.charAt(prev.length - 1), - Pos(cur.line - 1, prev.length - 1), Pos(cur.line, 1), "+transpose"); - } - } - newSel.push(new Range(cur, cur)); - } - cm.setSelections(newSel); - }); - }, - newlineAndIndent: function(cm) { - runInOp(cm, function() { - var len = cm.listSelections().length; - for (var i = 0; i < len; i++) { - var range = cm.listSelections()[i]; - cm.replaceRange("\n", range.anchor, range.head, "+input"); - cm.indentLine(range.from().line + 1, null, true); - ensureCursorVisible(cm); - } - }); - }, - toggleOverwrite: function(cm) {cm.toggleOverwrite();} - }; - - - // STANDARD KEYMAPS - - var keyMap = CodeMirror.keyMap = {}; - - keyMap.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" - }; - // Note that the save and find-related commands aren't defined by - // default. User code or addons can define them. Unknown commands - // are simply ignored. - keyMap.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" - }; - // Very basic readline/emacs-style bindings, which are standard on Mac. - keyMap.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" - }; - keyMap.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"] - }; - keyMap["default"] = mac ? keyMap.macDefault : keyMap.pcDefault; - - // KEYMAP DISPATCH - - function normalizeKeyName(name) { - var parts = name.split(/-(?!$)/), name = parts[parts.length - 1]; - var alt, ctrl, shift, cmd; - for (var i = 0; i < parts.length - 1; i++) { - var mod = parts[i]; - if (/^(cmd|meta|m)$/i.test(mod)) cmd = true; - else if (/^a(lt)?$/i.test(mod)) alt = true; - else if (/^(c|ctrl|control)$/i.test(mod)) ctrl = true; - else if (/^s(hift)$/i.test(mod)) shift = true; - else throw new Error("Unrecognized modifier name: " + mod); - } - if (alt) name = "Alt-" + name; - if (ctrl) name = "Ctrl-" + name; - if (cmd) name = "Cmd-" + name; - if (shift) name = "Shift-" + name; - return name; - } - - // This is a kludge to keep keymaps mostly working as raw objects - // (backwards compatibility) while at the same time support features - // like normalization and multi-stroke key bindings. It compiles a - // new normalized keymap, and then updates the old object to reflect - // this. - CodeMirror.normalizeKeyMap = function(keymap) { - var copy = {}; - for (var keyname in keymap) if (keymap.hasOwnProperty(keyname)) { - var value = keymap[keyname]; - if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) continue; - if (value == "...") { delete keymap[keyname]; continue; } - - var keys = map(keyname.split(" "), normalizeKeyName); - for (var i = 0; i < keys.length; i++) { - var val, name; - if (i == keys.length - 1) { - name = keyname; - val = value; - } else { - name = keys.slice(0, i + 1).join(" "); - val = "..."; - } - var prev = copy[name]; - if (!prev) copy[name] = val; - else if (prev != val) throw new Error("Inconsistent bindings for " + name); - } - delete keymap[keyname]; - } - for (var prop in copy) keymap[prop] = copy[prop]; - return keymap; - }; - - var lookupKey = CodeMirror.lookupKey = function(key, map, handle, context) { - map = getKeyMap(map); - var found = map.call ? map.call(key, context) : map[key]; - if (found === false) return "nothing"; - if (found === "...") return "multi"; - if (found != null && handle(found)) return "handled"; - - if (map.fallthrough) { - if (Object.prototype.toString.call(map.fallthrough) != "[object Array]") - return lookupKey(key, map.fallthrough, handle, context); - for (var i = 0; i < map.fallthrough.length; i++) { - var result = lookupKey(key, map.fallthrough[i], handle, context); - if (result) return result; - } - } - }; - - // Modifier key presses don't count as 'real' key presses for the - // purpose of keymap fallthrough. - var isModifierKey = CodeMirror.isModifierKey = function(value) { - var name = typeof value == "string" ? value : keyNames[value.keyCode]; - return name == "Ctrl" || name == "Alt" || name == "Shift" || name == "Mod"; - }; - - // Look up the name of a key as indicated by an event object. - var keyName = CodeMirror.keyName = function(event, noShift) { - if (presto && event.keyCode == 34 && event["char"]) return false; - var base = keyNames[event.keyCode], name = base; - if (name == null || event.altGraphKey) return false; - if (event.altKey && base != "Alt") name = "Alt-" + name; - if ((flipCtrlCmd ? event.metaKey : event.ctrlKey) && base != "Ctrl") name = "Ctrl-" + name; - if ((flipCtrlCmd ? event.ctrlKey : event.metaKey) && base != "Cmd") name = "Cmd-" + name; - if (!noShift && event.shiftKey && base != "Shift") name = "Shift-" + name; - return name; - }; - - function getKeyMap(val) { - return typeof val == "string" ? keyMap[val] : val; - } - - // FROMTEXTAREA - - CodeMirror.fromTextArea = function(textarea, options) { - if (!options) options = {}; - options.value = textarea.value; - if (!options.tabindex && textarea.tabindex) - options.tabindex = textarea.tabindex; - if (!options.placeholder && textarea.placeholder) - options.placeholder = textarea.placeholder; - // Set autofocus to true if this textarea is focused, or if it has - // autofocus and no other element is focused. - if (options.autofocus == null) { - var hasFocus = activeElt(); - options.autofocus = hasFocus == textarea || - textarea.getAttribute("autofocus") != null && hasFocus == document.body; - } - - function save() {textarea.value = cm.getValue();} - if (textarea.form) { - on(textarea.form, "submit", save); - // Deplorable hack to make the submit method do the right thing. - if (!options.leaveSubmitMethodAlone) { - var form = textarea.form, realSubmit = form.submit; - try { - var wrappedSubmit = form.submit = function() { - save(); - form.submit = realSubmit; - form.submit(); - form.submit = wrappedSubmit; - }; - } catch(e) {} - } - } - - textarea.style.display = "none"; - var cm = CodeMirror(function(node) { - textarea.parentNode.insertBefore(node, textarea.nextSibling); - }, options); - cm.save = save; - cm.getTextArea = function() { return textarea; }; - cm.toTextArea = function() { - cm.toTextArea = isNaN; // Prevent this from being ran twice - save(); - textarea.parentNode.removeChild(cm.getWrapperElement()); - textarea.style.display = ""; - if (textarea.form) { - off(textarea.form, "submit", save); - if (typeof textarea.form.submit == "function") - textarea.form.submit = realSubmit; - } - }; - return cm; - }; - - // STRING STREAM - - // Fed to the mode parsers, provides helper functions to make - // parsers more succinct. - - var StringStream = CodeMirror.StringStream = function(string, tabSize) { - this.pos = this.start = 0; - this.string = string; - this.tabSize = tabSize || 8; - this.lastColumnPos = this.lastColumnValue = 0; - this.lineStart = 0; - }; - - StringStream.prototype = { - eol: function() {return this.pos >= this.string.length;}, - sol: function() {return this.pos == this.lineStart;}, - peek: function() {return this.string.charAt(this.pos) || undefined;}, - next: function() { - if (this.pos < this.string.length) - return this.string.charAt(this.pos++); - }, - eat: function(match) { - var ch = this.string.charAt(this.pos); - if (typeof match == "string") var ok = ch == match; - else var ok = ch && (match.test ? match.test(ch) : match(ch)); - if (ok) {++this.pos; return ch;} - }, - eatWhile: function(match) { - var start = this.pos; - while (this.eat(match)){} - return this.pos > start; - }, - eatSpace: function() { - var start = this.pos; - while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) ++this.pos; - return this.pos > start; - }, - skipToEnd: function() {this.pos = this.string.length;}, - skipTo: function(ch) { - var found = this.string.indexOf(ch, this.pos); - if (found > -1) {this.pos = found; return true;} - }, - backUp: function(n) {this.pos -= n;}, - column: function() { - if (this.lastColumnPos < this.start) { - this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue); - this.lastColumnPos = this.start; - } - return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0); - }, - indentation: function() { - return countColumn(this.string, null, this.tabSize) - - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0); - }, - match: function(pattern, consume, caseInsensitive) { - if (typeof pattern == "string") { - var cased = function(str) {return caseInsensitive ? str.toLowerCase() : str;}; - var substr = this.string.substr(this.pos, pattern.length); - if (cased(substr) == cased(pattern)) { - if (consume !== false) this.pos += pattern.length; - return true; - } - } else { - var match = this.string.slice(this.pos).match(pattern); - if (match && match.index > 0) return null; - if (match && consume !== false) this.pos += match[0].length; - return match; - } - }, - current: function(){return this.string.slice(this.start, this.pos);}, - hideFirstChars: function(n, inner) { - this.lineStart += n; - try { return inner(); } - finally { this.lineStart -= n; } - } - }; - - // TEXTMARKERS - - // Created with markText and setBookmark methods. A TextMarker is a - // handle that can be used to clear or find a marked position in the - // document. Line objects hold arrays (markedSpans) containing - // {from, to, marker} object pointing to such marker objects, and - // indicating that such a marker is present on that line. Multiple - // lines may point to the same marker when it spans across lines. - // The spans will have null for their from/to properties when the - // marker continues beyond the start/end of the line. Markers have - // links back to the lines they currently touch. - - var TextMarker = CodeMirror.TextMarker = function(doc, type) { - this.lines = []; - this.type = type; - this.doc = doc; - }; - eventMixin(TextMarker); - - // Clear the marker. - TextMarker.prototype.clear = function() { - if (this.explicitlyCleared) return; - var cm = this.doc.cm, withOp = cm && !cm.curOp; - if (withOp) startOperation(cm); - if (hasHandler(this, "clear")) { - var found = this.find(); - if (found) signalLater(this, "clear", found.from, found.to); - } - var min = null, max = null; - for (var i = 0; i < this.lines.length; ++i) { - var line = this.lines[i]; - var span = getMarkedSpanFor(line.markedSpans, this); - if (cm && !this.collapsed) regLineChange(cm, lineNo(line), "text"); - else if (cm) { - if (span.to != null) max = lineNo(line); - if (span.from != null) min = lineNo(line); - } - line.markedSpans = removeMarkedSpan(line.markedSpans, span); - if (span.from == null && this.collapsed && !lineIsHidden(this.doc, line) && cm) - updateLineHeight(line, textHeight(cm.display)); - } - if (cm && this.collapsed && !cm.options.lineWrapping) for (var i = 0; i < this.lines.length; ++i) { - var visual = visualLine(this.lines[i]), len = lineLength(visual); - if (len > cm.display.maxLineLength) { - cm.display.maxLine = visual; - cm.display.maxLineLength = len; - cm.display.maxLineChanged = true; - } - } - - if (min != null && cm && this.collapsed) regChange(cm, min, max + 1); - this.lines.length = 0; - this.explicitlyCleared = true; - if (this.atomic && this.doc.cantEdit) { - this.doc.cantEdit = false; - if (cm) reCheckSelection(cm.doc); - } - if (cm) signalLater(cm, "markerCleared", cm, this); - if (withOp) endOperation(cm); - if (this.parent) this.parent.clear(); - }; - - // Find the position of the marker in the document. Returns a {from, - // to} object by default. Side can be passed to get a specific side - // -- 0 (both), -1 (left), or 1 (right). When lineObj is true, the - // Pos objects returned contain a line object, rather than a line - // number (used to prevent looking up the same line twice). - TextMarker.prototype.find = function(side, lineObj) { - if (side == null && this.type == "bookmark") side = 1; - var from, to; - for (var i = 0; i < this.lines.length; ++i) { - var line = this.lines[i]; - var span = getMarkedSpanFor(line.markedSpans, this); - if (span.from != null) { - from = Pos(lineObj ? line : lineNo(line), span.from); - if (side == -1) return from; - } - if (span.to != null) { - to = Pos(lineObj ? line : lineNo(line), span.to); - if (side == 1) return to; - } - } - return from && {from: from, to: to}; - }; - - // Signals that the marker's widget changed, and surrounding layout - // should be recomputed. - TextMarker.prototype.changed = function() { - var pos = this.find(-1, true), widget = this, cm = this.doc.cm; - if (!pos || !cm) return; - runInOp(cm, function() { - var line = pos.line, lineN = lineNo(pos.line); - var view = findViewForLine(cm, lineN); - if (view) { - clearLineMeasurementCacheFor(view); - cm.curOp.selectionChanged = cm.curOp.forceUpdate = true; - } - cm.curOp.updateMaxLine = true; - if (!lineIsHidden(widget.doc, line) && widget.height != null) { - var oldHeight = widget.height; - widget.height = null; - var dHeight = widgetHeight(widget) - oldHeight; - if (dHeight) - updateLineHeight(line, line.height + dHeight); - } - }); - }; - - TextMarker.prototype.attachLine = function(line) { - if (!this.lines.length && this.doc.cm) { - var op = this.doc.cm.curOp; - if (!op.maybeHiddenMarkers || indexOf(op.maybeHiddenMarkers, this) == -1) - (op.maybeUnhiddenMarkers || (op.maybeUnhiddenMarkers = [])).push(this); - } - this.lines.push(line); - }; - TextMarker.prototype.detachLine = function(line) { - this.lines.splice(indexOf(this.lines, line), 1); - if (!this.lines.length && this.doc.cm) { - var op = this.doc.cm.curOp; - (op.maybeHiddenMarkers || (op.maybeHiddenMarkers = [])).push(this); - } - }; - - // Collapsed markers have unique ids, in order to be able to order - // them, which is needed for uniquely determining an outer marker - // when they overlap (they may nest, but not partially overlap). - var nextMarkerId = 0; - - // Create a marker, wire it up to the right lines, and - function markText(doc, from, to, options, type) { - // Shared markers (across linked documents) are handled separately - // (markTextShared will call out to this again, once per - // document). - if (options && options.shared) return markTextShared(doc, from, to, options, type); - // Ensure we are in an operation. - if (doc.cm && !doc.cm.curOp) return operation(doc.cm, markText)(doc, from, to, options, type); - - var marker = new TextMarker(doc, type), diff = cmp(from, to); - if (options) copyObj(options, marker, false); - // Don't connect empty markers unless clearWhenEmpty is false - if (diff > 0 || diff == 0 && marker.clearWhenEmpty !== false) - return marker; - if (marker.replacedWith) { - // Showing up as a widget implies collapsed (widget replaces text) - marker.collapsed = true; - marker.widgetNode = elt("span", [marker.replacedWith], "CodeMirror-widget"); - if (!options.handleMouseEvents) marker.widgetNode.setAttribute("cm-ignore-events", "true"); - if (options.insertLeft) marker.widgetNode.insertLeft = true; - } - if (marker.collapsed) { - if (conflictingCollapsedRange(doc, from.line, from, to, marker) || - from.line != to.line && conflictingCollapsedRange(doc, to.line, from, to, marker)) - throw new Error("Inserting collapsed marker partially overlapping an existing one"); - sawCollapsedSpans = true; - } - - if (marker.addToHistory) - addChangeToHistory(doc, {from: from, to: to, origin: "markText"}, doc.sel, NaN); - - var curLine = from.line, cm = doc.cm, updateMaxLine; - doc.iter(curLine, to.line + 1, function(line) { - if (cm && marker.collapsed && !cm.options.lineWrapping && visualLine(line) == cm.display.maxLine) - updateMaxLine = true; - if (marker.collapsed && curLine != from.line) updateLineHeight(line, 0); - addMarkedSpan(line, new MarkedSpan(marker, - curLine == from.line ? from.ch : null, - curLine == to.line ? to.ch : null)); - ++curLine; - }); - // lineIsHidden depends on the presence of the spans, so needs a second pass - if (marker.collapsed) doc.iter(from.line, to.line + 1, function(line) { - if (lineIsHidden(doc, line)) updateLineHeight(line, 0); - }); - - if (marker.clearOnEnter) on(marker, "beforeCursorEnter", function() { marker.clear(); }); - - if (marker.readOnly) { - sawReadOnlySpans = true; - if (doc.history.done.length || doc.history.undone.length) - doc.clearHistory(); - } - if (marker.collapsed) { - marker.id = ++nextMarkerId; - marker.atomic = true; - } - if (cm) { - // Sync editor state - if (updateMaxLine) cm.curOp.updateMaxLine = true; - if (marker.collapsed) - regChange(cm, from.line, to.line + 1); - else if (marker.className || marker.title || marker.startStyle || marker.endStyle || marker.css) - for (var i = from.line; i <= to.line; i++) regLineChange(cm, i, "text"); - if (marker.atomic) reCheckSelection(cm.doc); - signalLater(cm, "markerAdded", cm, marker); - } - return marker; - } - - // SHARED TEXTMARKERS - - // A shared marker spans multiple linked documents. It is - // implemented as a meta-marker-object controlling multiple normal - // markers. - var SharedTextMarker = CodeMirror.SharedTextMarker = function(markers, primary) { - this.markers = markers; - this.primary = primary; - for (var i = 0; i < markers.length; ++i) - markers[i].parent = this; - }; - eventMixin(SharedTextMarker); - - SharedTextMarker.prototype.clear = function() { - if (this.explicitlyCleared) return; - this.explicitlyCleared = true; - for (var i = 0; i < this.markers.length; ++i) - this.markers[i].clear(); - signalLater(this, "clear"); - }; - SharedTextMarker.prototype.find = function(side, lineObj) { - return this.primary.find(side, lineObj); - }; - - function markTextShared(doc, from, to, options, type) { - options = copyObj(options); - options.shared = false; - var markers = [markText(doc, from, to, options, type)], primary = markers[0]; - var widget = options.widgetNode; - linkedDocs(doc, function(doc) { - if (widget) options.widgetNode = widget.cloneNode(true); - markers.push(markText(doc, clipPos(doc, from), clipPos(doc, to), options, type)); - for (var i = 0; i < doc.linked.length; ++i) - if (doc.linked[i].isParent) return; - primary = lst(markers); - }); - return new SharedTextMarker(markers, primary); - } - - function findSharedMarkers(doc) { - return doc.findMarks(Pos(doc.first, 0), doc.clipPos(Pos(doc.lastLine())), - function(m) { return m.parent; }); - } - - function copySharedMarkers(doc, markers) { - for (var i = 0; i < markers.length; i++) { - var marker = markers[i], pos = marker.find(); - var mFrom = doc.clipPos(pos.from), mTo = doc.clipPos(pos.to); - if (cmp(mFrom, mTo)) { - var subMark = markText(doc, mFrom, mTo, marker.primary, marker.primary.type); - marker.markers.push(subMark); - subMark.parent = marker; - } - } - } - - function detachSharedMarkers(markers) { - for (var i = 0; i < markers.length; i++) { - var marker = markers[i], linked = [marker.primary.doc];; - linkedDocs(marker.primary.doc, function(d) { linked.push(d); }); - for (var j = 0; j < marker.markers.length; j++) { - var subMarker = marker.markers[j]; - if (indexOf(linked, subMarker.doc) == -1) { - subMarker.parent = null; - marker.markers.splice(j--, 1); - } - } - } - } - - // TEXTMARKER SPANS - - function MarkedSpan(marker, from, to) { - this.marker = marker; - this.from = from; this.to = to; - } - - // Search an array of spans for a span matching the given marker. - function getMarkedSpanFor(spans, marker) { - if (spans) for (var i = 0; i < spans.length; ++i) { - var span = spans[i]; - if (span.marker == marker) return span; - } - } - // Remove a span from an array, returning undefined if no spans are - // left (we don't store arrays for lines without spans). - function removeMarkedSpan(spans, span) { - for (var r, i = 0; i < spans.length; ++i) - if (spans[i] != span) (r || (r = [])).push(spans[i]); - return r; - } - // Add a span to a line. - function addMarkedSpan(line, span) { - line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span]; - span.marker.attachLine(line); - } - - // Used for the algorithm that adjusts markers for a change in the - // document. These functions cut an array of spans at a given - // character position, returning an array of remaining chunks (or - // undefined if nothing remains). - function markedSpansBefore(old, startCh, isInsert) { - if (old) for (var i = 0, nw; i < old.length; ++i) { - var span = old[i], marker = span.marker; - var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh); - if (startsBefore || span.from == startCh && marker.type == "bookmark" && (!isInsert || !span.marker.insertLeft)) { - var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh); - (nw || (nw = [])).push(new MarkedSpan(marker, span.from, endsAfter ? null : span.to)); - } - } - return nw; - } - function markedSpansAfter(old, endCh, isInsert) { - if (old) for (var i = 0, nw; i < old.length; ++i) { - var span = old[i], marker = span.marker; - var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh); - if (endsAfter || span.from == endCh && marker.type == "bookmark" && (!isInsert || span.marker.insertLeft)) { - var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh); - (nw || (nw = [])).push(new MarkedSpan(marker, startsBefore ? null : span.from - endCh, - span.to == null ? null : span.to - endCh)); - } - } - return nw; - } - - // Given a change object, compute the new set of marker spans that - // cover the line in which the change took place. Removes spans - // entirely within the change, reconnects spans belonging to the - // same marker that appear on both sides of the change, and cuts off - // spans partially within the change. Returns an array of span - // arrays with one element for each line in (after) the change. - function stretchSpansOverChange(doc, change) { - if (change.full) return null; - var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans; - var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans; - if (!oldFirst && !oldLast) return null; - - var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0; - // Get the spans that 'stick out' on both sides - var first = markedSpansBefore(oldFirst, startCh, isInsert); - var last = markedSpansAfter(oldLast, endCh, isInsert); - - // Next, merge those two ends - var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0); - if (first) { - // Fix up .to properties of first - for (var i = 0; i < first.length; ++i) { - var span = first[i]; - if (span.to == null) { - var found = getMarkedSpanFor(last, span.marker); - if (!found) span.to = startCh; - else if (sameLine) span.to = found.to == null ? null : found.to + offset; - } - } - } - if (last) { - // Fix up .from in last (or move them into first in case of sameLine) - for (var i = 0; i < last.length; ++i) { - var span = last[i]; - if (span.to != null) span.to += offset; - if (span.from == null) { - var found = getMarkedSpanFor(first, span.marker); - if (!found) { - span.from = offset; - if (sameLine) (first || (first = [])).push(span); - } - } else { - span.from += offset; - if (sameLine) (first || (first = [])).push(span); - } - } - } - // Make sure we didn't create any zero-length spans - if (first) first = clearEmptySpans(first); - if (last && last != first) last = clearEmptySpans(last); - - var newMarkers = [first]; - if (!sameLine) { - // Fill gap with whole-line-spans - var gap = change.text.length - 2, gapMarkers; - if (gap > 0 && first) - for (var i = 0; i < first.length; ++i) - if (first[i].to == null) - (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i].marker, null, null)); - for (var i = 0; i < gap; ++i) - newMarkers.push(gapMarkers); - newMarkers.push(last); - } - return newMarkers; - } - - // Remove spans that are empty and don't have a clearWhenEmpty - // option of false. - function clearEmptySpans(spans) { - for (var i = 0; i < spans.length; ++i) { - var span = spans[i]; - if (span.from != null && span.from == span.to && span.marker.clearWhenEmpty !== false) - spans.splice(i--, 1); - } - if (!spans.length) return null; - return spans; - } - - // Used for un/re-doing changes from the history. Combines the - // result of computing the existing spans with the set of spans that - // existed in the history (so that deleting around a span and then - // undoing brings back the span). - function mergeOldSpans(doc, change) { - var old = getOldSpans(doc, change); - var stretched = stretchSpansOverChange(doc, change); - if (!old) return stretched; - if (!stretched) return old; - - for (var i = 0; i < old.length; ++i) { - var oldCur = old[i], stretchCur = stretched[i]; - if (oldCur && stretchCur) { - spans: for (var j = 0; j < stretchCur.length; ++j) { - var span = stretchCur[j]; - for (var k = 0; k < oldCur.length; ++k) - if (oldCur[k].marker == span.marker) continue spans; - oldCur.push(span); - } - } else if (stretchCur) { - old[i] = stretchCur; - } - } - return old; - } - - // Used to 'clip' out readOnly ranges when making a change. - function removeReadOnlyRanges(doc, from, to) { - var markers = null; - doc.iter(from.line, to.line + 1, function(line) { - if (line.markedSpans) for (var i = 0; i < line.markedSpans.length; ++i) { - var mark = line.markedSpans[i].marker; - if (mark.readOnly && (!markers || indexOf(markers, mark) == -1)) - (markers || (markers = [])).push(mark); - } - }); - if (!markers) return null; - var parts = [{from: from, to: to}]; - for (var i = 0; i < markers.length; ++i) { - var mk = markers[i], m = mk.find(0); - for (var j = 0; j < parts.length; ++j) { - var p = parts[j]; - if (cmp(p.to, m.from) < 0 || cmp(p.from, m.to) > 0) continue; - var newParts = [j, 1], dfrom = cmp(p.from, m.from), dto = cmp(p.to, m.to); - if (dfrom < 0 || !mk.inclusiveLeft && !dfrom) - newParts.push({from: p.from, to: m.from}); - if (dto > 0 || !mk.inclusiveRight && !dto) - newParts.push({from: m.to, to: p.to}); - parts.splice.apply(parts, newParts); - j += newParts.length - 1; - } - } - return parts; - } - - // Connect or disconnect spans from a line. - function detachMarkedSpans(line) { - var spans = line.markedSpans; - if (!spans) return; - for (var i = 0; i < spans.length; ++i) - spans[i].marker.detachLine(line); - line.markedSpans = null; - } - function attachMarkedSpans(line, spans) { - if (!spans) return; - for (var i = 0; i < spans.length; ++i) - spans[i].marker.attachLine(line); - line.markedSpans = spans; - } - - // Helpers used when computing which overlapping collapsed span - // counts as the larger one. - function extraLeft(marker) { return marker.inclusiveLeft ? -1 : 0; } - function extraRight(marker) { return marker.inclusiveRight ? 1 : 0; } - - // Returns a number indicating which of two overlapping collapsed - // spans is larger (and thus includes the other). Falls back to - // comparing ids when the spans cover exactly the same range. - function compareCollapsedMarkers(a, b) { - var lenDiff = a.lines.length - b.lines.length; - if (lenDiff != 0) return lenDiff; - var aPos = a.find(), bPos = b.find(); - var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b); - if (fromCmp) return -fromCmp; - var toCmp = cmp(aPos.to, bPos.to) || extraRight(a) - extraRight(b); - if (toCmp) return toCmp; - return b.id - a.id; - } - - // Find out whether a line ends or starts in a collapsed span. If - // so, return the marker for that span. - function collapsedSpanAtSide(line, start) { - var sps = sawCollapsedSpans && line.markedSpans, found; - if (sps) for (var sp, i = 0; i < sps.length; ++i) { - sp = sps[i]; - if (sp.marker.collapsed && (start ? sp.from : sp.to) == null && - (!found || compareCollapsedMarkers(found, sp.marker) < 0)) - found = sp.marker; - } - return found; - } - function collapsedSpanAtStart(line) { return collapsedSpanAtSide(line, true); } - function collapsedSpanAtEnd(line) { return collapsedSpanAtSide(line, false); } - - // Test whether there exists a collapsed span that partially - // overlaps (covers the start or end, but not both) of a new span. - // Such overlap is not allowed. - function conflictingCollapsedRange(doc, lineNo, from, to, marker) { - var line = getLine(doc, lineNo); - var sps = sawCollapsedSpans && line.markedSpans; - if (sps) for (var i = 0; i < sps.length; ++i) { - var sp = sps[i]; - if (!sp.marker.collapsed) continue; - var found = sp.marker.find(0); - var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker); - var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker); - if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) continue; - if (fromCmp <= 0 && (cmp(found.to, from) > 0 || (sp.marker.inclusiveRight && marker.inclusiveLeft)) || - fromCmp >= 0 && (cmp(found.from, to) < 0 || (sp.marker.inclusiveLeft && marker.inclusiveRight))) - return true; - } - } - - // A visual line is a line as drawn on the screen. Folding, for - // example, can cause multiple logical lines to appear on the same - // visual line. This finds the start of the visual line that the - // given line is part of (usually that is the line itself). - function visualLine(line) { - var merged; - while (merged = collapsedSpanAtStart(line)) - line = merged.find(-1, true).line; - return line; - } - - // Returns an array of logical lines that continue the visual line - // started by the argument, or undefined if there are no such lines. - function visualLineContinued(line) { - var merged, lines; - while (merged = collapsedSpanAtEnd(line)) { - line = merged.find(1, true).line; - (lines || (lines = [])).push(line); - } - return lines; - } - - // Get the line number of the start of the visual line that the - // given line number is part of. - function visualLineNo(doc, lineN) { - var line = getLine(doc, lineN), vis = visualLine(line); - if (line == vis) return lineN; - return lineNo(vis); - } - // Get the line number of the start of the next visual line after - // the given line. - function visualLineEndNo(doc, lineN) { - if (lineN > doc.lastLine()) return lineN; - var line = getLine(doc, lineN), merged; - if (!lineIsHidden(doc, line)) return lineN; - while (merged = collapsedSpanAtEnd(line)) - line = merged.find(1, true).line; - return lineNo(line) + 1; - } - - // Compute whether a line is hidden. Lines count as hidden when they - // are part of a visual line that starts with another line, or when - // they are entirely covered by collapsed, non-widget span. - function lineIsHidden(doc, line) { - var sps = sawCollapsedSpans && line.markedSpans; - if (sps) for (var sp, i = 0; i < sps.length; ++i) { - sp = sps[i]; - if (!sp.marker.collapsed) continue; - if (sp.from == null) return true; - if (sp.marker.widgetNode) continue; - if (sp.from == 0 && sp.marker.inclusiveLeft && lineIsHiddenInner(doc, line, sp)) - return true; - } - } - function lineIsHiddenInner(doc, line, span) { - if (span.to == null) { - var end = span.marker.find(1, true); - return lineIsHiddenInner(doc, end.line, getMarkedSpanFor(end.line.markedSpans, span.marker)); - } - if (span.marker.inclusiveRight && span.to == line.text.length) - return true; - for (var sp, i = 0; i < line.markedSpans.length; ++i) { - sp = line.markedSpans[i]; - if (sp.marker.collapsed && !sp.marker.widgetNode && sp.from == span.to && - (sp.to == null || sp.to != span.from) && - (sp.marker.inclusiveLeft || span.marker.inclusiveRight) && - lineIsHiddenInner(doc, line, sp)) return true; - } - } - - // LINE WIDGETS - - // Line widgets are block elements displayed above or below a line. - - var LineWidget = CodeMirror.LineWidget = function(cm, node, options) { - if (options) for (var opt in options) if (options.hasOwnProperty(opt)) - this[opt] = options[opt]; - this.cm = cm; - this.node = node; - }; - eventMixin(LineWidget); - - function adjustScrollWhenAboveVisible(cm, line, diff) { - if (heightAtLine(line) < ((cm.curOp && cm.curOp.scrollTop) || cm.doc.scrollTop)) - addToScrollPos(cm, null, diff); - } - - LineWidget.prototype.clear = function() { - var cm = this.cm, ws = this.line.widgets, line = this.line, no = lineNo(line); - if (no == null || !ws) return; - for (var i = 0; i < ws.length; ++i) if (ws[i] == this) ws.splice(i--, 1); - if (!ws.length) line.widgets = null; - var height = widgetHeight(this); - runInOp(cm, function() { - adjustScrollWhenAboveVisible(cm, line, -height); - regLineChange(cm, no, "widget"); - updateLineHeight(line, Math.max(0, line.height - height)); - }); - }; - LineWidget.prototype.changed = function() { - var oldH = this.height, cm = this.cm, line = this.line; - this.height = null; - var diff = widgetHeight(this) - oldH; - if (!diff) return; - runInOp(cm, function() { - cm.curOp.forceUpdate = true; - adjustScrollWhenAboveVisible(cm, line, diff); - updateLineHeight(line, line.height + diff); - }); - }; - - function widgetHeight(widget) { - if (widget.height != null) return widget.height; - if (!contains(document.body, widget.node)) { - var parentStyle = "position: relative;"; - if (widget.coverGutter) - parentStyle += "margin-left: -" + widget.cm.display.gutters.offsetWidth + "px;"; - if (widget.noHScroll) - parentStyle += "width: " + widget.cm.display.wrapper.clientWidth + "px;"; - removeChildrenAndAdd(widget.cm.display.measure, elt("div", [widget.node], null, parentStyle)); - } - return widget.height = widget.node.offsetHeight; - } - - function addLineWidget(cm, handle, node, options) { - var widget = new LineWidget(cm, node, options); - if (widget.noHScroll) cm.display.alignWidgets = true; - changeLine(cm.doc, handle, "widget", function(line) { - var widgets = line.widgets || (line.widgets = []); - if (widget.insertAt == null) widgets.push(widget); - else widgets.splice(Math.min(widgets.length - 1, Math.max(0, widget.insertAt)), 0, widget); - widget.line = line; - if (!lineIsHidden(cm.doc, line)) { - var aboveVisible = heightAtLine(line) < cm.doc.scrollTop; - updateLineHeight(line, line.height + widgetHeight(widget)); - if (aboveVisible) addToScrollPos(cm, null, widget.height); - cm.curOp.forceUpdate = true; - } - return true; - }); - return widget; - } - - // LINE DATA STRUCTURE - - // Line objects. These hold state related to a line, including - // highlighting info (the styles array). - var Line = CodeMirror.Line = function(text, markedSpans, estimateHeight) { - this.text = text; - attachMarkedSpans(this, markedSpans); - this.height = estimateHeight ? estimateHeight(this) : 1; - }; - eventMixin(Line); - Line.prototype.lineNo = function() { return lineNo(this); }; - - // Change the content (text, markers) of a line. Automatically - // invalidates cached information and tries to re-estimate the - // line's height. - function updateLine(line, text, markedSpans, estimateHeight) { - line.text = text; - if (line.stateAfter) line.stateAfter = null; - if (line.styles) line.styles = null; - if (line.order != null) line.order = null; - detachMarkedSpans(line); - attachMarkedSpans(line, markedSpans); - var estHeight = estimateHeight ? estimateHeight(line) : 1; - if (estHeight != line.height) updateLineHeight(line, estHeight); - } - - // Detach a line from the document tree and its markers. - function cleanUpLine(line) { - line.parent = null; - detachMarkedSpans(line); - } - - function extractLineClasses(type, output) { - if (type) for (;;) { - var lineClass = type.match(/(?:^|\s+)line-(background-)?(\S+)/); - if (!lineClass) break; - type = type.slice(0, lineClass.index) + type.slice(lineClass.index + lineClass[0].length); - var prop = lineClass[1] ? "bgClass" : "textClass"; - if (output[prop] == null) - output[prop] = lineClass[2]; - else if (!(new RegExp("(?:^|\s)" + lineClass[2] + "(?:$|\s)")).test(output[prop])) - output[prop] += " " + lineClass[2]; - } - return type; - } - - function callBlankLine(mode, state) { - if (mode.blankLine) return mode.blankLine(state); - if (!mode.innerMode) return; - var inner = CodeMirror.innerMode(mode, state); - if (inner.mode.blankLine) return inner.mode.blankLine(inner.state); - } - - function readToken(mode, stream, state, inner) { - for (var i = 0; i < 10; i++) { - if (inner) inner[0] = CodeMirror.innerMode(mode, state).mode; - var style = mode.token(stream, state); - if (stream.pos > stream.start) return style; - } - throw new Error("Mode " + mode.name + " failed to advance stream."); - } - - // Utility for getTokenAt and getLineTokens - function takeToken(cm, pos, precise, asArray) { - function getObj(copy) { - return {start: stream.start, end: stream.pos, - string: stream.current(), - type: style || null, - state: copy ? copyState(doc.mode, state) : state}; - } - - var doc = cm.doc, mode = doc.mode, style; - pos = clipPos(doc, pos); - var line = getLine(doc, pos.line), state = getStateBefore(cm, pos.line, precise); - var stream = new StringStream(line.text, cm.options.tabSize), tokens; - if (asArray) tokens = []; - while ((asArray || stream.pos < pos.ch) && !stream.eol()) { - stream.start = stream.pos; - style = readToken(mode, stream, state); - if (asArray) tokens.push(getObj(true)); - } - return asArray ? tokens : getObj(); - } - - // Run the given mode's parser over a line, calling f for each token. - function runMode(cm, text, mode, state, f, lineClasses, forceToEnd) { - var flattenSpans = mode.flattenSpans; - if (flattenSpans == null) flattenSpans = cm.options.flattenSpans; - var curStart = 0, curStyle = null; - var stream = new StringStream(text, cm.options.tabSize), style; - var inner = cm.options.addModeClass && [null]; - if (text == "") extractLineClasses(callBlankLine(mode, state), lineClasses); - while (!stream.eol()) { - if (stream.pos > cm.options.maxHighlightLength) { - flattenSpans = false; - if (forceToEnd) processLine(cm, text, state, stream.pos); - stream.pos = text.length; - style = null; - } else { - style = extractLineClasses(readToken(mode, stream, state, inner), lineClasses); - } - if (inner) { - var mName = inner[0].name; - if (mName) style = "m-" + (style ? mName + " " + style : mName); - } - if (!flattenSpans || curStyle != style) { - while (curStart < stream.start) { - curStart = Math.min(stream.start, curStart + 50000); - f(curStart, curStyle); - } - curStyle = style; - } - stream.start = stream.pos; - } - while (curStart < stream.pos) { - // Webkit seems to refuse to render text nodes longer than 57444 characters - var pos = Math.min(stream.pos, curStart + 50000); - f(pos, curStyle); - curStart = pos; - } - } - - // Compute a style array (an array starting with a mode generation - // -- for invalidation -- followed by pairs of end positions and - // style strings), which is used to highlight the tokens on the - // line. - function highlightLine(cm, line, state, forceToEnd) { - // A styles array always starts with a number identifying the - // mode/overlays that it is based on (for easy invalidation). - var st = [cm.state.modeGen], lineClasses = {}; - // Compute the base array of styles - runMode(cm, line.text, cm.doc.mode, state, function(end, style) { - st.push(end, style); - }, lineClasses, forceToEnd); - - // Run overlays, adjust style array. - for (var o = 0; o < cm.state.overlays.length; ++o) { - var overlay = cm.state.overlays[o], i = 1, at = 0; - runMode(cm, line.text, overlay.mode, true, function(end, style) { - var start = i; - // Ensure there's a token end at the current position, and that i points at it - while (at < end) { - var i_end = st[i]; - if (i_end > end) - st.splice(i, 1, end, st[i+1], i_end); - i += 2; - at = Math.min(end, i_end); - } - if (!style) return; - if (overlay.opaque) { - st.splice(start, i - start, end, "cm-overlay " + style); - i = start + 2; - } else { - for (; start < i; start += 2) { - var cur = st[start+1]; - st[start+1] = (cur ? cur + " " : "") + "cm-overlay " + style; - } - } - }, lineClasses); - } - - return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}; - } - - function getLineStyles(cm, line, updateFrontier) { - if (!line.styles || line.styles[0] != cm.state.modeGen) { - var result = highlightLine(cm, line, line.stateAfter = getStateBefore(cm, lineNo(line))); - line.styles = result.styles; - if (result.classes) line.styleClasses = result.classes; - else if (line.styleClasses) line.styleClasses = null; - if (updateFrontier === cm.doc.frontier) cm.doc.frontier++; - } - return line.styles; - } - - // Lightweight form of highlight -- proceed over this line and - // update state, but don't save a style array. Used for lines that - // aren't currently visible. - function processLine(cm, text, state, startAt) { - var mode = cm.doc.mode; - var stream = new StringStream(text, cm.options.tabSize); - stream.start = stream.pos = startAt || 0; - if (text == "") callBlankLine(mode, state); - while (!stream.eol() && stream.pos <= cm.options.maxHighlightLength) { - readToken(mode, stream, state); - stream.start = stream.pos; - } - } - - // Convert a style as returned by a mode (either null, or a string - // containing one or more styles) to a CSS style. This is cached, - // and also looks for line-wide styles. - var styleToClassCache = {}, styleToClassCacheWithMode = {}; - function interpretTokenStyle(style, options) { - if (!style || /^\s*$/.test(style)) return null; - var cache = options.addModeClass ? styleToClassCacheWithMode : styleToClassCache; - return cache[style] || - (cache[style] = style.replace(/\S+/g, "cm-$&")); - } - - // Render the DOM representation of the text of a line. Also builds - // up a 'line map', which points at the DOM nodes that represent - // specific stretches of text, and is used by the measuring code. - // The returned object contains the DOM node, this map, and - // information about line-wide styles that were set by the mode. - function buildLineContent(cm, lineView) { - // The padding-right forces the element to have a 'border', which - // is needed on Webkit to be able to get line-level bounding - // rectangles for it (in measureChar). - var content = elt("span", null, null, webkit ? "padding-right: .1px" : null); - var builder = {pre: elt("pre", [content]), content: content, col: 0, pos: 0, cm: cm}; - lineView.measure = {}; - - // Iterate over the logical lines that make up this visual line. - for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) { - var line = i ? lineView.rest[i - 1] : lineView.line, order; - builder.pos = 0; - builder.addToken = buildToken; - // Optionally wire in some hacks into the token-rendering - // algorithm, to deal with browser quirks. - if ((ie || webkit) && cm.getOption("lineWrapping")) - builder.addToken = buildTokenSplitSpaces(builder.addToken); - if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line))) - builder.addToken = buildTokenBadBidi(builder.addToken, order); - builder.map = []; - var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line); - insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate)); - if (line.styleClasses) { - if (line.styleClasses.bgClass) - builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || ""); - if (line.styleClasses.textClass) - builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || ""); - } - - // Ensure at least a single node is present, for measuring. - if (builder.map.length == 0) - builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); - - // Store the map and a cache object for the current logical line - if (i == 0) { - lineView.measure.map = builder.map; - lineView.measure.cache = {}; - } else { - (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map); - (lineView.measure.caches || (lineView.measure.caches = [])).push({}); - } - } - - // See issue #2901 - if (webkit && /\bcm-tab\b/.test(builder.content.lastChild.className)) - builder.content.className = "cm-tab-wrap-hack"; - - signal(cm, "renderLine", cm, lineView.line, builder.pre); - if (builder.pre.className) - builder.textClass = joinClasses(builder.pre.className, builder.textClass || ""); - - return builder; - } - - function defaultSpecialCharPlaceholder(ch) { - var token = elt("span", "\u2022", "cm-invalidchar"); - token.title = "\\u" + ch.charCodeAt(0).toString(16); - return token; - } - - // Build up the DOM representation for a single token, and add it to - // the line map. Takes care to render special characters separately. - function buildToken(builder, text, style, startStyle, endStyle, title, css) { - if (!text) return; - var special = builder.cm.options.specialChars, mustWrap = false; - if (!special.test(text)) { - builder.col += text.length; - var content = document.createTextNode(text); - builder.map.push(builder.pos, builder.pos + text.length, content); - if (ie && ie_version < 9) mustWrap = true; - builder.pos += text.length; - } else { - var content = document.createDocumentFragment(), pos = 0; - while (true) { - special.lastIndex = pos; - var m = special.exec(text); - var skipped = m ? m.index - pos : text.length - pos; - if (skipped) { - var txt = document.createTextNode(text.slice(pos, pos + skipped)); - if (ie && ie_version < 9) content.appendChild(elt("span", [txt])); - else content.appendChild(txt); - builder.map.push(builder.pos, builder.pos + skipped, txt); - builder.col += skipped; - builder.pos += skipped; - } - if (!m) break; - pos += skipped + 1; - if (m[0] == "\t") { - var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize; - var txt = content.appendChild(elt("span", spaceStr(tabWidth), "cm-tab")); - builder.col += tabWidth; - } else { - var txt = builder.cm.options.specialCharPlaceholder(m[0]); - if (ie && ie_version < 9) content.appendChild(elt("span", [txt])); - else content.appendChild(txt); - builder.col += 1; - } - builder.map.push(builder.pos, builder.pos + 1, txt); - builder.pos++; - } - } - if (style || startStyle || endStyle || mustWrap || css) { - var fullStyle = style || ""; - if (startStyle) fullStyle += startStyle; - if (endStyle) fullStyle += endStyle; - var token = elt("span", [content], fullStyle, css); - if (title) token.title = title; - return builder.content.appendChild(token); - } - builder.content.appendChild(content); - } - - function buildTokenSplitSpaces(inner) { - function split(old) { - var out = " "; - for (var i = 0; i < old.length - 2; ++i) out += i % 2 ? " " : "\u00a0"; - out += " "; - return out; - } - return function(builder, text, style, startStyle, endStyle, title) { - inner(builder, text.replace(/ {3,}/g, split), style, startStyle, endStyle, title); - }; - } - - // Work around nonsense dimensions being reported for stretches of - // right-to-left text. - function buildTokenBadBidi(inner, order) { - return function(builder, text, style, startStyle, endStyle, title) { - style = style ? style + " cm-force-border" : "cm-force-border"; - var start = builder.pos, end = start + text.length; - for (;;) { - // Find the part that overlaps with the start of this text - for (var i = 0; i < order.length; i++) { - var part = order[i]; - if (part.to > start && part.from <= start) break; - } - if (part.to >= end) return inner(builder, text, style, startStyle, endStyle, title); - inner(builder, text.slice(0, part.to - start), style, startStyle, null, title); - startStyle = null; - text = text.slice(part.to - start); - start = part.to; - } - }; - } - - function buildCollapsedSpan(builder, size, marker, ignoreWidget) { - var widget = !ignoreWidget && marker.widgetNode; - if (widget) { - builder.map.push(builder.pos, builder.pos + size, widget); - builder.content.appendChild(widget); - } - builder.pos += size; - } - - // Outputs a number of spans to make up a line, taking highlighting - // and marked text into account. - function insertLineContent(line, builder, styles) { - var spans = line.markedSpans, allText = line.text, at = 0; - if (!spans) { - for (var i = 1; i < styles.length; i+=2) - builder.addToken(builder, allText.slice(at, at = styles[i]), interpretTokenStyle(styles[i+1], builder.cm.options)); - return; - } - - var len = allText.length, pos = 0, i = 1, text = "", style, css; - var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed; - for (;;) { - if (nextChange == pos) { // Update current marker set - spanStyle = spanEndStyle = spanStartStyle = title = css = ""; - collapsed = null; nextChange = Infinity; - var foundBookmarks = []; - for (var j = 0; j < spans.length; ++j) { - var sp = spans[j], m = sp.marker; - if (sp.from <= pos && (sp.to == null || sp.to > pos)) { - if (sp.to != null && nextChange > sp.to) { nextChange = sp.to; spanEndStyle = ""; } - if (m.className) spanStyle += " " + m.className; - if (m.css) css = m.css; - if (m.startStyle && sp.from == pos) spanStartStyle += " " + m.startStyle; - if (m.endStyle && sp.to == nextChange) spanEndStyle += " " + m.endStyle; - if (m.title && !title) title = m.title; - if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0)) - collapsed = sp; - } else if (sp.from > pos && nextChange > sp.from) { - nextChange = sp.from; - } - if (m.type == "bookmark" && sp.from == pos && m.widgetNode) foundBookmarks.push(m); - } - if (collapsed && (collapsed.from || 0) == pos) { - buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos, - collapsed.marker, collapsed.from == null); - if (collapsed.to == null) return; - } - if (!collapsed && foundBookmarks.length) for (var j = 0; j < foundBookmarks.length; ++j) - buildCollapsedSpan(builder, 0, foundBookmarks[j]); - } - if (pos >= len) break; - - var upto = Math.min(len, nextChange); - while (true) { - if (text) { - var end = pos + text.length; - if (!collapsed) { - var tokenText = end > upto ? text.slice(0, upto - pos) : text; - builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle, - spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : "", title, css); - } - if (end >= upto) {text = text.slice(upto - pos); pos = upto; break;} - pos = end; - spanStartStyle = ""; - } - text = allText.slice(at, at = styles[i++]); - style = interpretTokenStyle(styles[i++], builder.cm.options); - } - } - } - - // DOCUMENT DATA STRUCTURE - - // By default, updates that start and end at the beginning of a line - // are treated specially, in order to make the association of line - // widgets and marker elements with the text behave more intuitive. - function isWholeLineUpdate(doc, change) { - return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == "" && - (!doc.cm || doc.cm.options.wholeLineUpdateBefore); - } - - // Perform a change on the document data structure. - function updateDoc(doc, change, markedSpans, estimateHeight) { - function spansFor(n) {return markedSpans ? markedSpans[n] : null;} - function update(line, text, spans) { - updateLine(line, text, spans, estimateHeight); - signalLater(line, "change", line, change); - } - function linesFor(start, end) { - for (var i = start, result = []; i < end; ++i) - result.push(new Line(text[i], spansFor(i), estimateHeight)); - return result; - } - - var from = change.from, to = change.to, text = change.text; - var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line); - var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line; - - // Adjust the line structure - if (change.full) { - doc.insert(0, linesFor(0, text.length)); - doc.remove(text.length, doc.size - text.length); - } else if (isWholeLineUpdate(doc, change)) { - // This is a whole-line replace. Treated specially to make - // sure line objects move the way they are supposed to. - var added = linesFor(0, text.length - 1); - update(lastLine, lastLine.text, lastSpans); - if (nlines) doc.remove(from.line, nlines); - if (added.length) doc.insert(from.line, added); - } else if (firstLine == lastLine) { - if (text.length == 1) { - update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans); - } else { - var added = linesFor(1, text.length - 1); - added.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight)); - update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0)); - doc.insert(from.line + 1, added); - } - } else if (text.length == 1) { - update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0)); - doc.remove(from.line + 1, nlines); - } else { - update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0)); - update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans); - var added = linesFor(1, text.length - 1); - if (nlines > 1) doc.remove(from.line + 1, nlines - 1); - doc.insert(from.line + 1, added); - } - - signalLater(doc, "change", doc, change); - } - - // The document is represented as a BTree consisting of leaves, with - // chunk of lines in them, and branches, with up to ten leaves or - // other branch nodes below them. The top node is always a branch - // node, and is the document object itself (meaning it has - // additional methods and properties). - // - // All nodes have parent links. The tree is used both to go from - // line numbers to line objects, and to go from objects to numbers. - // It also indexes by height, and is used to convert between height - // and line object, and to find the total height of the document. - // - // See also http://marijnhaverbeke.nl/blog/codemirror-line-tree.html - - function LeafChunk(lines) { - this.lines = lines; - this.parent = null; - for (var i = 0, height = 0; i < lines.length; ++i) { - lines[i].parent = this; - height += lines[i].height; - } - this.height = height; - } - - LeafChunk.prototype = { - chunkSize: function() { return this.lines.length; }, - // Remove the n lines at offset 'at'. - removeInner: function(at, n) { - for (var i = at, e = at + n; i < e; ++i) { - var line = this.lines[i]; - this.height -= line.height; - cleanUpLine(line); - signalLater(line, "delete"); - } - this.lines.splice(at, n); - }, - // Helper used to collapse a small branch into a single leaf. - collapse: function(lines) { - lines.push.apply(lines, this.lines); - }, - // Insert the given array of lines at offset 'at', count them as - // having the given height. - insertInner: function(at, lines, height) { - this.height += height; - this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at)); - for (var i = 0; i < lines.length; ++i) lines[i].parent = this; - }, - // Used to iterate over a part of the tree. - iterN: function(at, n, op) { - for (var e = at + n; at < e; ++at) - if (op(this.lines[at])) return true; - } - }; - - function BranchChunk(children) { - this.children = children; - var size = 0, height = 0; - for (var i = 0; i < children.length; ++i) { - var ch = children[i]; - size += ch.chunkSize(); height += ch.height; - ch.parent = this; - } - this.size = size; - this.height = height; - this.parent = null; - } - - BranchChunk.prototype = { - chunkSize: function() { return this.size; }, - removeInner: function(at, n) { - this.size -= n; - for (var i = 0; i < this.children.length; ++i) { - var child = this.children[i], sz = child.chunkSize(); - if (at < sz) { - var rm = Math.min(n, sz - at), oldHeight = child.height; - child.removeInner(at, rm); - this.height -= oldHeight - child.height; - if (sz == rm) { this.children.splice(i--, 1); child.parent = null; } - if ((n -= rm) == 0) break; - at = 0; - } else at -= sz; - } - // If the result is smaller than 25 lines, ensure that it is a - // single leaf node. - if (this.size - n < 25 && - (this.children.length > 1 || !(this.children[0] instanceof LeafChunk))) { - var lines = []; - this.collapse(lines); - this.children = [new LeafChunk(lines)]; - this.children[0].parent = this; - } - }, - collapse: function(lines) { - for (var i = 0; i < this.children.length; ++i) this.children[i].collapse(lines); - }, - insertInner: function(at, lines, height) { - this.size += lines.length; - this.height += height; - for (var i = 0; i < this.children.length; ++i) { - var child = this.children[i], sz = child.chunkSize(); - if (at <= sz) { - child.insertInner(at, lines, height); - if (child.lines && child.lines.length > 50) { - while (child.lines.length > 50) { - var spilled = child.lines.splice(child.lines.length - 25, 25); - var newleaf = new LeafChunk(spilled); - child.height -= newleaf.height; - this.children.splice(i + 1, 0, newleaf); - newleaf.parent = this; - } - this.maybeSpill(); - } - break; - } - at -= sz; - } - }, - // When a node has grown, check whether it should be split. - maybeSpill: function() { - if (this.children.length <= 10) return; - var me = this; - do { - var spilled = me.children.splice(me.children.length - 5, 5); - var sibling = new BranchChunk(spilled); - if (!me.parent) { // Become the parent node - var copy = new BranchChunk(me.children); - copy.parent = me; - me.children = [copy, sibling]; - me = copy; - } else { - me.size -= sibling.size; - me.height -= sibling.height; - var myIndex = indexOf(me.parent.children, me); - me.parent.children.splice(myIndex + 1, 0, sibling); - } - sibling.parent = me.parent; - } while (me.children.length > 10); - me.parent.maybeSpill(); - }, - iterN: function(at, n, op) { - for (var i = 0; i < this.children.length; ++i) { - var child = this.children[i], sz = child.chunkSize(); - if (at < sz) { - var used = Math.min(n, sz - at); - if (child.iterN(at, used, op)) return true; - if ((n -= used) == 0) break; - at = 0; - } else at -= sz; - } - } - }; - - var nextDocId = 0; - var Doc = CodeMirror.Doc = function(text, mode, firstLine) { - if (!(this instanceof Doc)) return new Doc(text, mode, firstLine); - if (firstLine == null) firstLine = 0; - - BranchChunk.call(this, [new LeafChunk([new Line("", null)])]); - this.first = firstLine; - this.scrollTop = this.scrollLeft = 0; - this.cantEdit = false; - this.cleanGeneration = 1; - this.frontier = firstLine; - var start = Pos(firstLine, 0); - this.sel = simpleSelection(start); - this.history = new History(null); - this.id = ++nextDocId; - this.modeOption = mode; - - if (typeof text == "string") text = splitLines(text); - updateDoc(this, {from: start, to: start, text: text}); - setSelection(this, simpleSelection(start), sel_dontScroll); - }; - - Doc.prototype = createObj(BranchChunk.prototype, { - constructor: Doc, - // Iterate over the document. Supports two forms -- with only one - // argument, it calls that for each line in the document. With - // three, it iterates over the range given by the first two (with - // the second being non-inclusive). - iter: function(from, to, op) { - if (op) this.iterN(from - this.first, to - from, op); - else this.iterN(this.first, this.first + this.size, from); - }, - - // Non-public interface for adding and removing lines. - insert: function(at, lines) { - var height = 0; - for (var i = 0; i < lines.length; ++i) height += lines[i].height; - this.insertInner(at - this.first, lines, height); - }, - remove: function(at, n) { this.removeInner(at - this.first, n); }, - - // From here, the methods are part of the public interface. Most - // are also available from CodeMirror (editor) instances. - - getValue: function(lineSep) { - var lines = getLines(this, this.first, this.first + this.size); - if (lineSep === false) return lines; - return lines.join(lineSep || "\n"); - }, - setValue: docMethodOp(function(code) { - var top = Pos(this.first, 0), last = this.first + this.size - 1; - makeChange(this, {from: top, to: Pos(last, getLine(this, last).text.length), - text: splitLines(code), origin: "setValue", full: true}, true); - setSelection(this, simpleSelection(top)); - }), - replaceRange: function(code, from, to, origin) { - from = clipPos(this, from); - to = to ? clipPos(this, to) : from; - replaceRange(this, code, from, to, origin); - }, - getRange: function(from, to, lineSep) { - var lines = getBetween(this, clipPos(this, from), clipPos(this, to)); - if (lineSep === false) return lines; - return lines.join(lineSep || "\n"); - }, - - getLine: function(line) {var l = this.getLineHandle(line); return l && l.text;}, - - getLineHandle: function(line) {if (isLine(this, line)) return getLine(this, line);}, - getLineNumber: function(line) {return lineNo(line);}, - - getLineHandleVisualStart: function(line) { - if (typeof line == "number") line = getLine(this, line); - return visualLine(line); - }, - - lineCount: function() {return this.size;}, - firstLine: function() {return this.first;}, - lastLine: function() {return this.first + this.size - 1;}, - - clipPos: function(pos) {return clipPos(this, pos);}, - - getCursor: function(start) { - var range = this.sel.primary(), pos; - if (start == null || start == "head") pos = range.head; - else if (start == "anchor") pos = range.anchor; - else if (start == "end" || start == "to" || start === false) pos = range.to(); - else pos = range.from(); - return pos; - }, - listSelections: function() { return this.sel.ranges; }, - somethingSelected: function() {return this.sel.somethingSelected();}, - - setCursor: docMethodOp(function(line, ch, options) { - setSimpleSelection(this, clipPos(this, typeof line == "number" ? Pos(line, ch || 0) : line), null, options); - }), - setSelection: docMethodOp(function(anchor, head, options) { - setSimpleSelection(this, clipPos(this, anchor), clipPos(this, head || anchor), options); - }), - extendSelection: docMethodOp(function(head, other, options) { - extendSelection(this, clipPos(this, head), other && clipPos(this, other), options); - }), - extendSelections: docMethodOp(function(heads, options) { - extendSelections(this, clipPosArray(this, heads, options)); - }), - extendSelectionsBy: docMethodOp(function(f, options) { - extendSelections(this, map(this.sel.ranges, f), options); - }), - setSelections: docMethodOp(function(ranges, primary, options) { - if (!ranges.length) return; - for (var i = 0, out = []; i < ranges.length; i++) - out[i] = new Range(clipPos(this, ranges[i].anchor), - clipPos(this, ranges[i].head)); - if (primary == null) primary = Math.min(ranges.length - 1, this.sel.primIndex); - setSelection(this, normalizeSelection(out, primary), options); - }), - addSelection: docMethodOp(function(anchor, head, options) { - var ranges = this.sel.ranges.slice(0); - ranges.push(new Range(clipPos(this, anchor), clipPos(this, head || anchor))); - setSelection(this, normalizeSelection(ranges, ranges.length - 1), options); - }), - - getSelection: function(lineSep) { - var ranges = this.sel.ranges, lines; - for (var i = 0; i < ranges.length; i++) { - var sel = getBetween(this, ranges[i].from(), ranges[i].to()); - lines = lines ? lines.concat(sel) : sel; - } - if (lineSep === false) return lines; - else return lines.join(lineSep || "\n"); - }, - getSelections: function(lineSep) { - var parts = [], ranges = this.sel.ranges; - for (var i = 0; i < ranges.length; i++) { - var sel = getBetween(this, ranges[i].from(), ranges[i].to()); - if (lineSep !== false) sel = sel.join(lineSep || "\n"); - parts[i] = sel; - } - return parts; - }, - replaceSelection: function(code, collapse, origin) { - var dup = []; - for (var i = 0; i < this.sel.ranges.length; i++) - dup[i] = code; - this.replaceSelections(dup, collapse, origin || "+input"); - }, - replaceSelections: docMethodOp(function(code, collapse, origin) { - var changes = [], sel = this.sel; - for (var i = 0; i < sel.ranges.length; i++) { - var range = sel.ranges[i]; - changes[i] = {from: range.from(), to: range.to(), text: splitLines(code[i]), origin: origin}; - } - var newSel = collapse && collapse != "end" && computeReplacedSel(this, changes, collapse); - for (var i = changes.length - 1; i >= 0; i--) - makeChange(this, changes[i]); - if (newSel) setSelectionReplaceHistory(this, newSel); - else if (this.cm) ensureCursorVisible(this.cm); - }), - undo: docMethodOp(function() {makeChangeFromHistory(this, "undo");}), - redo: docMethodOp(function() {makeChangeFromHistory(this, "redo");}), - undoSelection: docMethodOp(function() {makeChangeFromHistory(this, "undo", true);}), - redoSelection: docMethodOp(function() {makeChangeFromHistory(this, "redo", true);}), - - setExtending: function(val) {this.extend = val;}, - getExtending: function() {return this.extend;}, - - historySize: function() { - var hist = this.history, done = 0, undone = 0; - for (var i = 0; i < hist.done.length; i++) if (!hist.done[i].ranges) ++done; - for (var i = 0; i < hist.undone.length; i++) if (!hist.undone[i].ranges) ++undone; - return {undo: done, redo: undone}; - }, - clearHistory: function() {this.history = new History(this.history.maxGeneration);}, - - markClean: function() { - this.cleanGeneration = this.changeGeneration(true); - }, - changeGeneration: function(forceSplit) { - if (forceSplit) - this.history.lastOp = this.history.lastSelOp = this.history.lastOrigin = null; - return this.history.generation; - }, - isClean: function (gen) { - return this.history.generation == (gen || this.cleanGeneration); - }, - - getHistory: function() { - return {done: copyHistoryArray(this.history.done), - undone: copyHistoryArray(this.history.undone)}; - }, - setHistory: function(histData) { - var hist = this.history = new History(this.history.maxGeneration); - hist.done = copyHistoryArray(histData.done.slice(0), null, true); - hist.undone = copyHistoryArray(histData.undone.slice(0), null, true); - }, - - addLineClass: docMethodOp(function(handle, where, cls) { - return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function(line) { - var prop = where == "text" ? "textClass" - : where == "background" ? "bgClass" - : where == "gutter" ? "gutterClass" : "wrapClass"; - if (!line[prop]) line[prop] = cls; - else if (classTest(cls).test(line[prop])) return false; - else line[prop] += " " + cls; - return true; - }); - }), - removeLineClass: docMethodOp(function(handle, where, cls) { - return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function(line) { - var prop = where == "text" ? "textClass" - : where == "background" ? "bgClass" - : where == "gutter" ? "gutterClass" : "wrapClass"; - var cur = line[prop]; - if (!cur) return false; - else if (cls == null) line[prop] = null; - else { - var found = cur.match(classTest(cls)); - if (!found) return false; - var end = found.index + found[0].length; - line[prop] = cur.slice(0, found.index) + (!found.index || end == cur.length ? "" : " ") + cur.slice(end) || null; - } - return true; - }); - }), - - markText: function(from, to, options) { - return markText(this, clipPos(this, from), clipPos(this, to), options, "range"); - }, - setBookmark: function(pos, options) { - var realOpts = {replacedWith: options && (options.nodeType == null ? options.widget : options), - insertLeft: options && options.insertLeft, - clearWhenEmpty: false, shared: options && options.shared}; - pos = clipPos(this, pos); - return markText(this, pos, pos, realOpts, "bookmark"); - }, - findMarksAt: function(pos) { - pos = clipPos(this, pos); - var markers = [], spans = getLine(this, pos.line).markedSpans; - if (spans) for (var i = 0; i < spans.length; ++i) { - var span = spans[i]; - if ((span.from == null || span.from <= pos.ch) && - (span.to == null || span.to >= pos.ch)) - markers.push(span.marker.parent || span.marker); - } - return markers; - }, - findMarks: function(from, to, filter) { - from = clipPos(this, from); to = clipPos(this, to); - var found = [], lineNo = from.line; - this.iter(from.line, to.line + 1, function(line) { - var spans = line.markedSpans; - if (spans) for (var i = 0; i < spans.length; i++) { - var span = spans[i]; - if (!(lineNo == from.line && from.ch > span.to || - span.from == null && lineNo != from.line|| - lineNo == to.line && span.from > to.ch) && - (!filter || filter(span.marker))) - found.push(span.marker.parent || span.marker); - } - ++lineNo; - }); - return found; - }, - getAllMarks: function() { - var markers = []; - this.iter(function(line) { - var sps = line.markedSpans; - if (sps) for (var i = 0; i < sps.length; ++i) - if (sps[i].from != null) markers.push(sps[i].marker); - }); - return markers; - }, - - posFromIndex: function(off) { - var ch, lineNo = this.first; - this.iter(function(line) { - var sz = line.text.length + 1; - if (sz > off) { ch = off; return true; } - off -= sz; - ++lineNo; - }); - return clipPos(this, Pos(lineNo, ch)); - }, - indexFromPos: function (coords) { - coords = clipPos(this, coords); - var index = coords.ch; - if (coords.line < this.first || coords.ch < 0) return 0; - this.iter(this.first, coords.line, function (line) { - index += line.text.length + 1; - }); - return index; - }, - - copy: function(copyHistory) { - var doc = new Doc(getLines(this, this.first, this.first + this.size), this.modeOption, this.first); - doc.scrollTop = this.scrollTop; doc.scrollLeft = this.scrollLeft; - doc.sel = this.sel; - doc.extend = false; - if (copyHistory) { - doc.history.undoDepth = this.history.undoDepth; - doc.setHistory(this.getHistory()); - } - return doc; - }, - - linkedDoc: function(options) { - if (!options) options = {}; - var from = this.first, to = this.first + this.size; - if (options.from != null && options.from > from) from = options.from; - if (options.to != null && options.to < to) to = options.to; - var copy = new Doc(getLines(this, from, to), options.mode || this.modeOption, from); - if (options.sharedHist) copy.history = this.history; - (this.linked || (this.linked = [])).push({doc: copy, sharedHist: options.sharedHist}); - copy.linked = [{doc: this, isParent: true, sharedHist: options.sharedHist}]; - copySharedMarkers(copy, findSharedMarkers(this)); - return copy; - }, - unlinkDoc: function(other) { - if (other instanceof CodeMirror) other = other.doc; - if (this.linked) for (var i = 0; i < this.linked.length; ++i) { - var link = this.linked[i]; - if (link.doc != other) continue; - this.linked.splice(i, 1); - other.unlinkDoc(this); - detachSharedMarkers(findSharedMarkers(this)); - break; - } - // If the histories were shared, split them again - if (other.history == this.history) { - var splitIds = [other.id]; - linkedDocs(other, function(doc) {splitIds.push(doc.id);}, true); - other.history = new History(null); - other.history.done = copyHistoryArray(this.history.done, splitIds); - other.history.undone = copyHistoryArray(this.history.undone, splitIds); - } - }, - iterLinkedDocs: function(f) {linkedDocs(this, f);}, - - getMode: function() {return this.mode;}, - getEditor: function() {return this.cm;} - }); - - // Public alias. - Doc.prototype.eachLine = Doc.prototype.iter; - - // Set up methods on CodeMirror's prototype to redirect to the editor's document. - var dontDelegate = "iter insert remove copy getEditor".split(" "); - for (var prop in Doc.prototype) if (Doc.prototype.hasOwnProperty(prop) && indexOf(dontDelegate, prop) < 0) - CodeMirror.prototype[prop] = (function(method) { - return function() {return method.apply(this.doc, arguments);}; - })(Doc.prototype[prop]); - - eventMixin(Doc); - - // Call f for all linked documents. - function linkedDocs(doc, f, sharedHistOnly) { - function propagate(doc, skip, sharedHist) { - if (doc.linked) for (var i = 0; i < doc.linked.length; ++i) { - var rel = doc.linked[i]; - if (rel.doc == skip) continue; - var shared = sharedHist && rel.sharedHist; - if (sharedHistOnly && !shared) continue; - f(rel.doc, shared); - propagate(rel.doc, doc, shared); - } - } - propagate(doc, null, true); - } - - // Attach a document to an editor. - function attachDoc(cm, doc) { - if (doc.cm) throw new Error("This document is already in use."); - cm.doc = doc; - doc.cm = cm; - estimateLineHeights(cm); - loadMode(cm); - if (!cm.options.lineWrapping) findMaxLine(cm); - cm.options.mode = doc.modeOption; - regChange(cm); - } - - // LINE UTILITIES - - // Find the line object corresponding to the given line number. - function getLine(doc, n) { - n -= doc.first; - if (n < 0 || n >= doc.size) throw new Error("There is no line " + (n + doc.first) + " in the document."); - for (var chunk = doc; !chunk.lines;) { - for (var i = 0;; ++i) { - var child = chunk.children[i], sz = child.chunkSize(); - if (n < sz) { chunk = child; break; } - n -= sz; - } - } - return chunk.lines[n]; - } - - // Get the part of a document between two positions, as an array of - // strings. - function getBetween(doc, start, end) { - var out = [], n = start.line; - doc.iter(start.line, end.line + 1, function(line) { - var text = line.text; - if (n == end.line) text = text.slice(0, end.ch); - if (n == start.line) text = text.slice(start.ch); - out.push(text); - ++n; - }); - return out; - } - // Get the lines between from and to, as array of strings. - function getLines(doc, from, to) { - var out = []; - doc.iter(from, to, function(line) { out.push(line.text); }); - return out; - } - - // Update the height of a line, propagating the height change - // upwards to parent nodes. - function updateLineHeight(line, height) { - var diff = height - line.height; - if (diff) for (var n = line; n; n = n.parent) n.height += diff; - } - - // Given a line object, find its line number by walking up through - // its parent links. - function lineNo(line) { - if (line.parent == null) return null; - var cur = line.parent, no = indexOf(cur.lines, line); - for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) { - for (var i = 0;; ++i) { - if (chunk.children[i] == cur) break; - no += chunk.children[i].chunkSize(); - } - } - return no + cur.first; - } - - // Find the line at the given vertical position, using the height - // information in the document tree. - function lineAtHeight(chunk, h) { - var n = chunk.first; - outer: do { - for (var i = 0; i < chunk.children.length; ++i) { - var child = chunk.children[i], ch = child.height; - if (h < ch) { chunk = child; continue outer; } - h -= ch; - n += child.chunkSize(); - } - return n; - } while (!chunk.lines); - for (var i = 0; i < chunk.lines.length; ++i) { - var line = chunk.lines[i], lh = line.height; - if (h < lh) break; - h -= lh; - } - return n + i; - } - - - // Find the height above the given line. - function heightAtLine(lineObj) { - lineObj = visualLine(lineObj); - - var h = 0, chunk = lineObj.parent; - for (var i = 0; i < chunk.lines.length; ++i) { - var line = chunk.lines[i]; - if (line == lineObj) break; - else h += line.height; - } - for (var p = chunk.parent; p; chunk = p, p = chunk.parent) { - for (var i = 0; i < p.children.length; ++i) { - var cur = p.children[i]; - if (cur == chunk) break; - else h += cur.height; - } - } - return h; - } - - // Get the bidi ordering for the given line (and cache it). Returns - // false for lines that are fully left-to-right, and an array of - // BidiSpan objects otherwise. - function getOrder(line) { - var order = line.order; - if (order == null) order = line.order = bidiOrdering(line.text); - return order; - } - - // HISTORY - - function History(startGen) { - // Arrays of change events and selections. Doing something adds an - // event to done and clears undo. Undoing moves events from done - // to undone, redoing moves them in the other direction. - this.done = []; this.undone = []; - this.undoDepth = Infinity; - // Used to track when changes can be merged into a single undo - // event - this.lastModTime = this.lastSelTime = 0; - this.lastOp = this.lastSelOp = null; - this.lastOrigin = this.lastSelOrigin = null; - // Used by the isClean() method - this.generation = this.maxGeneration = startGen || 1; - } - - // Create a history change event from an updateDoc-style change - // object. - function historyChangeFromChange(doc, change) { - var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)}; - attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); - linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true); - return histChange; - } - - // Pop all selection events off the end of a history array. Stop at - // a change event. - function clearSelectionEvents(array) { - while (array.length) { - var last = lst(array); - if (last.ranges) array.pop(); - else break; - } - } - - // Find the top change event in the history. Pop off selection - // events that are in the way. - function lastChangeEvent(hist, force) { - if (force) { - clearSelectionEvents(hist.done); - return lst(hist.done); - } else if (hist.done.length && !lst(hist.done).ranges) { - return lst(hist.done); - } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) { - hist.done.pop(); - return lst(hist.done); - } - } - - // Register a change in the history. Merges changes that are within - // a single operation, ore are close together with an origin that - // allows merging (starting with "+") into a single event. - function addChangeToHistory(doc, change, selAfter, opId) { - var hist = doc.history; - hist.undone.length = 0; - var time = +new Date, cur; - - if ((hist.lastOp == opId || - hist.lastOrigin == change.origin && change.origin && - ((change.origin.charAt(0) == "+" && doc.cm && hist.lastModTime > time - doc.cm.options.historyEventDelay) || - change.origin.charAt(0) == "*")) && - (cur = lastChangeEvent(hist, hist.lastOp == opId))) { - // Merge this change into the last event - var last = lst(cur.changes); - if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) { - // Optimized case for simple insertion -- don't want to add - // new changesets for every character typed - last.to = changeEnd(change); - } else { - // Add new sub-event - cur.changes.push(historyChangeFromChange(doc, change)); - } - } else { - // Can not be merged, start a new event. - var before = lst(hist.done); - if (!before || !before.ranges) - pushSelectionToHistory(doc.sel, hist.done); - cur = {changes: [historyChangeFromChange(doc, change)], - generation: hist.generation}; - hist.done.push(cur); - while (hist.done.length > hist.undoDepth) { - hist.done.shift(); - if (!hist.done[0].ranges) hist.done.shift(); - } - } - hist.done.push(selAfter); - hist.generation = ++hist.maxGeneration; - hist.lastModTime = hist.lastSelTime = time; - hist.lastOp = hist.lastSelOp = opId; - hist.lastOrigin = hist.lastSelOrigin = change.origin; - - if (!last) signal(doc, "historyAdded"); - } - - function selectionEventCanBeMerged(doc, origin, prev, sel) { - var ch = origin.charAt(0); - return ch == "*" || - ch == "+" && - prev.ranges.length == sel.ranges.length && - prev.somethingSelected() == sel.somethingSelected() && - new Date - doc.history.lastSelTime <= (doc.cm ? doc.cm.options.historyEventDelay : 500); - } - - // Called whenever the selection changes, sets the new selection as - // the pending selection in the history, and pushes the old pending - // selection into the 'done' array when it was significantly - // different (in number of selected ranges, emptiness, or time). - function addSelectionToHistory(doc, sel, opId, options) { - var hist = doc.history, origin = options && options.origin; - - // A new event is started when the previous origin does not match - // the current, or the origins don't allow matching. Origins - // starting with * are always merged, those starting with + are - // merged when similar and close together in time. - if (opId == hist.lastSelOp || - (origin && hist.lastSelOrigin == origin && - (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin || - selectionEventCanBeMerged(doc, origin, lst(hist.done), sel)))) - hist.done[hist.done.length - 1] = sel; - else - pushSelectionToHistory(sel, hist.done); - - hist.lastSelTime = +new Date; - hist.lastSelOrigin = origin; - hist.lastSelOp = opId; - if (options && options.clearRedo !== false) - clearSelectionEvents(hist.undone); - } - - function pushSelectionToHistory(sel, dest) { - var top = lst(dest); - if (!(top && top.ranges && top.equals(sel))) - dest.push(sel); - } - - // Used to store marked span information in the history. - function attachLocalSpans(doc, change, from, to) { - var existing = change["spans_" + doc.id], n = 0; - doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) { - if (line.markedSpans) - (existing || (existing = change["spans_" + doc.id] = {}))[n] = line.markedSpans; - ++n; - }); - } - - // When un/re-doing restores text containing marked spans, those - // that have been explicitly cleared should not be restored. - function removeClearedSpans(spans) { - if (!spans) return null; - for (var i = 0, out; i < spans.length; ++i) { - if (spans[i].marker.explicitlyCleared) { if (!out) out = spans.slice(0, i); } - else if (out) out.push(spans[i]); - } - return !out ? spans : out.length ? out : null; - } - - // Retrieve and filter the old marked spans stored in a change event. - function getOldSpans(doc, change) { - var found = change["spans_" + doc.id]; - if (!found) return null; - for (var i = 0, nw = []; i < change.text.length; ++i) - nw.push(removeClearedSpans(found[i])); - return nw; - } - - // Used both to provide a JSON-safe object in .getHistory, and, when - // detaching a document, to split the history in two - function copyHistoryArray(events, newGroup, instantiateSel) { - for (var i = 0, copy = []; i < events.length; ++i) { - var event = events[i]; - if (event.ranges) { - copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event); - continue; - } - var changes = event.changes, newChanges = []; - copy.push({changes: newChanges}); - for (var j = 0; j < changes.length; ++j) { - var change = changes[j], m; - newChanges.push({from: change.from, to: change.to, text: change.text}); - if (newGroup) for (var prop in change) if (m = prop.match(/^spans_(\d+)$/)) { - if (indexOf(newGroup, Number(m[1])) > -1) { - lst(newChanges)[prop] = change[prop]; - delete change[prop]; - } - } - } - } - return copy; - } - - // Rebasing/resetting history to deal with externally-sourced changes - - function rebaseHistSelSingle(pos, from, to, diff) { - if (to < pos.line) { - pos.line += diff; - } else if (from < pos.line) { - pos.line = from; - pos.ch = 0; - } - } - - // Tries to rebase an array of history events given a change in the - // document. If the change touches the same lines as the event, the - // event, and everything 'behind' it, is discarded. If the change is - // before the event, the event's positions are updated. Uses a - // copy-on-write scheme for the positions, to avoid having to - // reallocate them all on every rebase, but also avoid problems with - // shared position objects being unsafely updated. - function rebaseHistArray(array, from, to, diff) { - for (var i = 0; i < array.length; ++i) { - var sub = array[i], ok = true; - if (sub.ranges) { - if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; } - for (var j = 0; j < sub.ranges.length; j++) { - rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff); - rebaseHistSelSingle(sub.ranges[j].head, from, to, diff); - } - continue; - } - for (var j = 0; j < sub.changes.length; ++j) { - var cur = sub.changes[j]; - if (to < cur.from.line) { - cur.from = Pos(cur.from.line + diff, cur.from.ch); - cur.to = Pos(cur.to.line + diff, cur.to.ch); - } else if (from <= cur.to.line) { - ok = false; - break; - } - } - if (!ok) { - array.splice(0, i + 1); - i = 0; - } - } - } - - function rebaseHist(hist, change) { - var from = change.from.line, to = change.to.line, diff = change.text.length - (to - from) - 1; - rebaseHistArray(hist.done, from, to, diff); - rebaseHistArray(hist.undone, from, to, diff); - } - - // EVENT UTILITIES - - // Due to the fact that we still support jurassic IE versions, some - // compatibility wrappers are needed. - - var e_preventDefault = CodeMirror.e_preventDefault = function(e) { - if (e.preventDefault) e.preventDefault(); - else e.returnValue = false; - }; - var e_stopPropagation = CodeMirror.e_stopPropagation = function(e) { - if (e.stopPropagation) e.stopPropagation(); - else e.cancelBubble = true; - }; - function e_defaultPrevented(e) { - return e.defaultPrevented != null ? e.defaultPrevented : e.returnValue == false; - } - var e_stop = CodeMirror.e_stop = function(e) {e_preventDefault(e); e_stopPropagation(e);}; - - function e_target(e) {return e.target || e.srcElement;} - function e_button(e) { - var b = e.which; - if (b == null) { - if (e.button & 1) b = 1; - else if (e.button & 2) b = 3; - else if (e.button & 4) b = 2; - } - if (mac && e.ctrlKey && b == 1) b = 3; - return b; - } - - // EVENT HANDLING - - // Lightweight event framework. on/off also work on DOM nodes, - // registering native DOM handlers. - - var on = CodeMirror.on = function(emitter, type, f) { - if (emitter.addEventListener) - emitter.addEventListener(type, f, false); - else if (emitter.attachEvent) - emitter.attachEvent("on" + type, f); - else { - var map = emitter._handlers || (emitter._handlers = {}); - var arr = map[type] || (map[type] = []); - arr.push(f); - } - }; - - var off = CodeMirror.off = function(emitter, type, f) { - if (emitter.removeEventListener) - emitter.removeEventListener(type, f, false); - else if (emitter.detachEvent) - emitter.detachEvent("on" + type, f); - else { - var arr = emitter._handlers && emitter._handlers[type]; - if (!arr) return; - for (var i = 0; i < arr.length; ++i) - if (arr[i] == f) { arr.splice(i, 1); break; } - } - }; - - var signal = CodeMirror.signal = function(emitter, type /*, values...*/) { - var arr = emitter._handlers && emitter._handlers[type]; - if (!arr) return; - var args = Array.prototype.slice.call(arguments, 2); - for (var i = 0; i < arr.length; ++i) arr[i].apply(null, args); - }; - - var orphanDelayedCallbacks = null; - - // Often, we want to signal events at a point where we are in the - // middle of some work, but don't want the handler to start calling - // other methods on the editor, which might be in an inconsistent - // state or simply not expect any other events to happen. - // signalLater looks whether there are any handlers, and schedules - // them to be executed when the last operation ends, or, if no - // operation is active, when a timeout fires. - function signalLater(emitter, type /*, values...*/) { - var arr = emitter._handlers && emitter._handlers[type]; - if (!arr) return; - var args = Array.prototype.slice.call(arguments, 2), list; - if (operationGroup) { - list = operationGroup.delayedCallbacks; - } else if (orphanDelayedCallbacks) { - list = orphanDelayedCallbacks; - } else { - list = orphanDelayedCallbacks = []; - setTimeout(fireOrphanDelayed, 0); - } - function bnd(f) {return function(){f.apply(null, args);};}; - for (var i = 0; i < arr.length; ++i) - list.push(bnd(arr[i])); - } - - function fireOrphanDelayed() { - var delayed = orphanDelayedCallbacks; - orphanDelayedCallbacks = null; - for (var i = 0; i < delayed.length; ++i) delayed[i](); - } - - // The DOM events that CodeMirror handles can be overridden by - // registering a (non-DOM) handler on the editor for the event name, - // and preventDefault-ing the event in that handler. - function signalDOMEvent(cm, e, override) { - if (typeof e == "string") - e = {type: e, preventDefault: function() { this.defaultPrevented = true; }}; - signal(cm, override || e.type, cm, e); - return e_defaultPrevented(e) || e.codemirrorIgnore; - } - - function signalCursorActivity(cm) { - var arr = cm._handlers && cm._handlers.cursorActivity; - if (!arr) return; - var set = cm.curOp.cursorActivityHandlers || (cm.curOp.cursorActivityHandlers = []); - for (var i = 0; i < arr.length; ++i) if (indexOf(set, arr[i]) == -1) - set.push(arr[i]); - } - - function hasHandler(emitter, type) { - var arr = emitter._handlers && emitter._handlers[type]; - return arr && arr.length > 0; - } - - // Add on and off methods to a constructor's prototype, to make - // registering events on such objects more convenient. - function eventMixin(ctor) { - ctor.prototype.on = function(type, f) {on(this, type, f);}; - ctor.prototype.off = function(type, f) {off(this, type, f);}; - } - - // MISC UTILITIES - - // Number of pixels added to scroller and sizer to hide scrollbar - var scrollerGap = 30; - - // Returned or thrown by various protocols to signal 'I'm not - // handling this'. - var Pass = CodeMirror.Pass = {toString: function(){return "CodeMirror.Pass";}}; - - // Reused option objects for setSelection & friends - var sel_dontScroll = {scroll: false}, sel_mouse = {origin: "*mouse"}, sel_move = {origin: "+move"}; - - function Delayed() {this.id = null;} - Delayed.prototype.set = function(ms, f) { - clearTimeout(this.id); - this.id = setTimeout(f, ms); - }; - - // Counts the column offset in a string, taking tabs into account. - // Used mostly to find indentation. - var countColumn = CodeMirror.countColumn = function(string, end, tabSize, startIndex, startValue) { - if (end == null) { - end = string.search(/[^\s\u00a0]/); - if (end == -1) end = string.length; - } - for (var i = startIndex || 0, n = startValue || 0;;) { - var nextTab = string.indexOf("\t", i); - if (nextTab < 0 || nextTab >= end) - return n + (end - i); - n += nextTab - i; - n += tabSize - (n % tabSize); - i = nextTab + 1; - } - }; - - // The inverse of countColumn -- find the offset that corresponds to - // a particular column. - function findColumn(string, goal, tabSize) { - for (var pos = 0, col = 0;;) { - var nextTab = string.indexOf("\t", pos); - if (nextTab == -1) nextTab = string.length; - var skipped = nextTab - pos; - if (nextTab == string.length || col + skipped >= goal) - return pos + Math.min(skipped, goal - col); - col += nextTab - pos; - col += tabSize - (col % tabSize); - pos = nextTab + 1; - if (col >= goal) return pos; - } - } - - var spaceStrs = [""]; - function spaceStr(n) { - while (spaceStrs.length <= n) - spaceStrs.push(lst(spaceStrs) + " "); - return spaceStrs[n]; - } - - function lst(arr) { return arr[arr.length-1]; } - - var selectInput = function(node) { node.select(); }; - if (ios) // Mobile Safari apparently has a bug where select() is broken. - selectInput = function(node) { node.selectionStart = 0; node.selectionEnd = node.value.length; }; - else if (ie) // Suppress mysterious IE10 errors - selectInput = function(node) { try { node.select(); } catch(_e) {} }; - - function indexOf(array, elt) { - for (var i = 0; i < array.length; ++i) - if (array[i] == elt) return i; - return -1; - } - function map(array, f) { - var out = []; - for (var i = 0; i < array.length; i++) out[i] = f(array[i], i); - return out; - } - - function createObj(base, props) { - var inst; - if (Object.create) { - inst = Object.create(base); - } else { - var ctor = function() {}; - ctor.prototype = base; - inst = new ctor(); - } - if (props) copyObj(props, inst); - return inst; - }; - - function copyObj(obj, target, overwrite) { - if (!target) target = {}; - for (var prop in obj) - if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop))) - target[prop] = obj[prop]; - return target; - } - - function bind(f) { - var args = Array.prototype.slice.call(arguments, 1); - return function(){return f.apply(null, args);}; - } - - var nonASCIISingleCaseWordChar = /[\u00df\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/; - var isWordCharBasic = CodeMirror.isWordChar = function(ch) { - return /\w/.test(ch) || ch > "\x80" && - (ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch)); - }; - function isWordChar(ch, helper) { - if (!helper) return isWordCharBasic(ch); - if (helper.source.indexOf("\\w") > -1 && isWordCharBasic(ch)) return true; - return helper.test(ch); - } - - function isEmpty(obj) { - for (var n in obj) if (obj.hasOwnProperty(n) && obj[n]) return false; - return true; - } - - // Extending unicode characters. A series of a non-extending char + - // any number of extending chars is treated as a single unit as far - // as editing and measuring is concerned. This is not fully correct, - // since some scripts/fonts/browsers also treat other configurations - // of code points as a group. - var extendingChars = /[\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]/; - function isExtendingChar(ch) { return ch.charCodeAt(0) >= 768 && extendingChars.test(ch); } - - // DOM UTILITIES - - function elt(tag, content, className, style) { - var e = document.createElement(tag); - if (className) e.className = className; - if (style) e.style.cssText = style; - if (typeof content == "string") e.appendChild(document.createTextNode(content)); - else if (content) for (var i = 0; i < content.length; ++i) e.appendChild(content[i]); - return e; - } - - var range; - if (document.createRange) range = function(node, start, end) { - var r = document.createRange(); - r.setEnd(node, end); - r.setStart(node, start); - return r; - }; - else range = function(node, start, end) { - var r = document.body.createTextRange(); - try { r.moveToElementText(node.parentNode); } - catch(e) { return r; } - r.collapse(true); - r.moveEnd("character", end); - r.moveStart("character", start); - return r; - }; - - function removeChildren(e) { - for (var count = e.childNodes.length; count > 0; --count) - e.removeChild(e.firstChild); - return e; - } - - function removeChildrenAndAdd(parent, e) { - return removeChildren(parent).appendChild(e); - } - - function contains(parent, child) { - if (parent.contains) - return parent.contains(child); - while (child = child.parentNode) - if (child == parent) return true; - } - - function activeElt() { return document.activeElement; } - // Older versions of IE throws unspecified error when touching - // document.activeElement in some cases (during loading, in iframe) - if (ie && ie_version < 11) activeElt = function() { - try { return document.activeElement; } - catch(e) { return document.body; } - }; - - function classTest(cls) { return new RegExp("(^|\\s)" + cls + "(?:$|\\s)\\s*"); } - var rmClass = CodeMirror.rmClass = function(node, cls) { - var current = node.className; - var match = classTest(cls).exec(current); - if (match) { - var after = current.slice(match.index + match[0].length); - node.className = current.slice(0, match.index) + (after ? match[1] + after : ""); - } - }; - var addClass = CodeMirror.addClass = function(node, cls) { - var current = node.className; - if (!classTest(cls).test(current)) node.className += (current ? " " : "") + cls; - }; - function joinClasses(a, b) { - var as = a.split(" "); - for (var i = 0; i < as.length; i++) - if (as[i] && !classTest(as[i]).test(b)) b += " " + as[i]; - return b; - } - - // WINDOW-WIDE EVENTS - - // These must be handled carefully, because naively registering a - // handler for each editor will cause the editors to never be - // garbage collected. - - function forEachCodeMirror(f) { - if (!document.body.getElementsByClassName) return; - var byClass = document.body.getElementsByClassName("CodeMirror"); - for (var i = 0; i < byClass.length; i++) { - var cm = byClass[i].CodeMirror; - if (cm) f(cm); - } - } - - var globalsRegistered = false; - function ensureGlobalHandlers() { - if (globalsRegistered) return; - registerGlobalHandlers(); - globalsRegistered = true; - } - function registerGlobalHandlers() { - // When the window resizes, we need to refresh active editors. - var resizeTimer; - on(window, "resize", function() { - if (resizeTimer == null) resizeTimer = setTimeout(function() { - resizeTimer = null; - forEachCodeMirror(onResize); - }, 100); - }); - // When the window loses focus, we want to show the editor as blurred - on(window, "blur", function() { - forEachCodeMirror(onBlur); - }); - } - - // FEATURE DETECTION - - // Detect drag-and-drop - var dragAndDrop = function() { - // There is *some* kind of drag-and-drop support in IE6-8, but I - // couldn't get it to work yet. - if (ie && ie_version < 9) return false; - var div = elt('div'); - return "draggable" in div || "dragDrop" in div; - }(); - - var zwspSupported; - function zeroWidthElement(measure) { - if (zwspSupported == null) { - var test = elt("span", "\u200b"); - removeChildrenAndAdd(measure, elt("span", [test, document.createTextNode("x")])); - if (measure.firstChild.offsetHeight != 0) - zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !(ie && ie_version < 8); - } - if (zwspSupported) return elt("span", "\u200b"); - else return elt("span", "\u00a0", null, "display: inline-block; width: 1px; margin-right: -1px"); - } - - // Feature-detect IE's crummy client rect reporting for bidi text - var badBidiRects; - function hasBadBidiRects(measure) { - if (badBidiRects != null) return badBidiRects; - var txt = removeChildrenAndAdd(measure, document.createTextNode("A\u062eA")); - var r0 = range(txt, 0, 1).getBoundingClientRect(); - if (!r0 || r0.left == r0.right) return false; // Safari returns null in some cases (#2780) - var r1 = range(txt, 1, 2).getBoundingClientRect(); - return badBidiRects = (r1.right - r0.right < 3); - } - - // See if "".split is the broken IE version, if so, provide an - // alternative way to split lines. - var splitLines = CodeMirror.splitLines = "\n\nb".split(/\n/).length != 3 ? function(string) { - var pos = 0, result = [], l = string.length; - while (pos <= l) { - var nl = string.indexOf("\n", pos); - if (nl == -1) nl = string.length; - var line = string.slice(pos, string.charAt(nl - 1) == "\r" ? nl - 1 : nl); - var rt = line.indexOf("\r"); - if (rt != -1) { - result.push(line.slice(0, rt)); - pos += rt + 1; - } else { - result.push(line); - pos = nl + 1; - } - } - return result; - } : function(string){return string.split(/\r\n?|\n/);}; - - var hasSelection = window.getSelection ? function(te) { - try { return te.selectionStart != te.selectionEnd; } - catch(e) { return false; } - } : function(te) { - try {var range = te.ownerDocument.selection.createRange();} - catch(e) {} - if (!range || range.parentElement() != te) return false; - return range.compareEndPoints("StartToEnd", range) != 0; - }; - - var hasCopyEvent = (function() { - var e = elt("div"); - if ("oncopy" in e) return true; - e.setAttribute("oncopy", "return;"); - return typeof e.oncopy == "function"; - })(); - - var badZoomedRects = null; - function hasBadZoomedRects(measure) { - if (badZoomedRects != null) return badZoomedRects; - var node = removeChildrenAndAdd(measure, elt("span", "x")); - var normal = node.getBoundingClientRect(); - var fromRange = range(node, 0, 1).getBoundingClientRect(); - return badZoomedRects = Math.abs(normal.left - fromRange.left) > 1; - } - - // KEY NAMES - - var 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", 107: "=", 109: "-", 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"}; - CodeMirror.keyNames = keyNames; - (function() { - // Number keys - for (var i = 0; i < 10; i++) keyNames[i + 48] = keyNames[i + 96] = String(i); - // Alphabetic keys - for (var i = 65; i <= 90; i++) keyNames[i] = String.fromCharCode(i); - // Function keys - for (var i = 1; i <= 12; i++) keyNames[i + 111] = keyNames[i + 63235] = "F" + i; - })(); - - // BIDI HELPERS - - function iterateBidiSections(order, from, to, f) { - if (!order) return f(from, to, "ltr"); - var found = false; - for (var i = 0; i < order.length; ++i) { - var part = order[i]; - if (part.from < to && part.to > from || from == to && part.to == from) { - f(Math.max(part.from, from), Math.min(part.to, to), part.level == 1 ? "rtl" : "ltr"); - found = true; - } - } - if (!found) f(from, to, "ltr"); - } - - function bidiLeft(part) { return part.level % 2 ? part.to : part.from; } - function bidiRight(part) { return part.level % 2 ? part.from : part.to; } - - function lineLeft(line) { var order = getOrder(line); return order ? bidiLeft(order[0]) : 0; } - function lineRight(line) { - var order = getOrder(line); - if (!order) return line.text.length; - return bidiRight(lst(order)); - } - - function lineStart(cm, lineN) { - var line = getLine(cm.doc, lineN); - var visual = visualLine(line); - if (visual != line) lineN = lineNo(visual); - var order = getOrder(visual); - var ch = !order ? 0 : order[0].level % 2 ? lineRight(visual) : lineLeft(visual); - return Pos(lineN, ch); - } - function lineEnd(cm, lineN) { - var merged, line = getLine(cm.doc, lineN); - while (merged = collapsedSpanAtEnd(line)) { - line = merged.find(1, true).line; - lineN = null; - } - var order = getOrder(line); - var ch = !order ? line.text.length : order[0].level % 2 ? lineLeft(line) : lineRight(line); - return Pos(lineN == null ? lineNo(line) : lineN, ch); - } - function lineStartSmart(cm, pos) { - var start = lineStart(cm, pos.line); - var line = getLine(cm.doc, start.line); - var order = getOrder(line); - if (!order || order[0].level == 0) { - var firstNonWS = Math.max(0, line.text.search(/\S/)); - var inWS = pos.line == start.line && pos.ch <= firstNonWS && pos.ch; - return Pos(start.line, inWS ? 0 : firstNonWS); - } - return start; - } - - function compareBidiLevel(order, a, b) { - var linedir = order[0].level; - if (a == linedir) return true; - if (b == linedir) return false; - return a < b; - } - var bidiOther; - function getBidiPartAt(order, pos) { - bidiOther = null; - for (var i = 0, found; i < order.length; ++i) { - var cur = order[i]; - if (cur.from < pos && cur.to > pos) return i; - if ((cur.from == pos || cur.to == pos)) { - if (found == null) { - found = i; - } else if (compareBidiLevel(order, cur.level, order[found].level)) { - if (cur.from != cur.to) bidiOther = found; - return i; - } else { - if (cur.from != cur.to) bidiOther = i; - return found; - } - } - } - return found; - } - - function moveInLine(line, pos, dir, byUnit) { - if (!byUnit) return pos + dir; - do pos += dir; - while (pos > 0 && isExtendingChar(line.text.charAt(pos))); - return pos; - } - - // This is needed in order to move 'visually' through bi-directional - // text -- i.e., pressing left should make the cursor go left, even - // when in RTL text. The tricky part is the 'jumps', where RTL and - // LTR text touch each other. This often requires the cursor offset - // to move more than one unit, in order to visually move one unit. - function moveVisually(line, start, dir, byUnit) { - var bidi = getOrder(line); - if (!bidi) return moveLogically(line, start, dir, byUnit); - var pos = getBidiPartAt(bidi, start), part = bidi[pos]; - var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit); - - for (;;) { - if (target > part.from && target < part.to) return target; - if (target == part.from || target == part.to) { - if (getBidiPartAt(bidi, target) == pos) return target; - part = bidi[pos += dir]; - return (dir > 0) == part.level % 2 ? part.to : part.from; - } else { - part = bidi[pos += dir]; - if (!part) return null; - if ((dir > 0) == part.level % 2) - target = moveInLine(line, part.to, -1, byUnit); - else - target = moveInLine(line, part.from, 1, byUnit); - } - } - } - - function moveLogically(line, start, dir, byUnit) { - var target = start + dir; - if (byUnit) while (target > 0 && isExtendingChar(line.text.charAt(target))) target += dir; - return target < 0 || target > line.text.length ? null : target; - } - - // Bidirectional ordering algorithm - // See http://unicode.org/reports/tr9/tr9-13.html for the algorithm - // that this (partially) implements. - - // One-char codes used for character types: - // L (L): Left-to-Right - // R (R): Right-to-Left - // r (AL): Right-to-Left Arabic - // 1 (EN): European Number - // + (ES): European Number Separator - // % (ET): European Number Terminator - // n (AN): Arabic Number - // , (CS): Common Number Separator - // m (NSM): Non-Spacing Mark - // b (BN): Boundary Neutral - // s (B): Paragraph Separator - // t (S): Segment Separator - // w (WS): Whitespace - // N (ON): Other Neutrals - - // Returns null if characters are ordered as they appear - // (left-to-right), or an array of sections ({from, to, level} - // objects) in the order in which they occur visually. - var bidiOrdering = (function() { - // Character types for codepoints 0 to 0xff - var lowTypes = "bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN"; - // Character types for codepoints 0x600 to 0x6ff - var arabicTypes = "rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm"; - function charType(code) { - if (code <= 0xf7) return lowTypes.charAt(code); - else if (0x590 <= code && code <= 0x5f4) return "R"; - else if (0x600 <= code && code <= 0x6ed) return arabicTypes.charAt(code - 0x600); - else if (0x6ee <= code && code <= 0x8ac) return "r"; - else if (0x2000 <= code && code <= 0x200b) return "w"; - else if (code == 0x200c) return "b"; - else return "L"; - } - - var bidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/; - var isNeutral = /[stwN]/, isStrong = /[LRr]/, countsAsLeft = /[Lb1n]/, countsAsNum = /[1n]/; - // Browsers seem to always treat the boundaries of block elements as being L. - var outerType = "L"; - - function BidiSpan(level, from, to) { - this.level = level; - this.from = from; this.to = to; - } - - return function(str) { - if (!bidiRE.test(str)) return false; - var len = str.length, types = []; - for (var i = 0, type; i < len; ++i) - types.push(type = charType(str.charCodeAt(i))); - - // W1. Examine each non-spacing mark (NSM) in the level run, and - // change the type of the NSM to the type of the previous - // character. If the NSM is at the start of the level run, it will - // get the type of sor. - for (var i = 0, prev = outerType; i < len; ++i) { - var type = types[i]; - if (type == "m") types[i] = prev; - else prev = type; - } - - // W2. Search backwards from each instance of a European number - // until the first strong type (R, L, AL, or sor) is found. If an - // AL is found, change the type of the European number to Arabic - // number. - // W3. Change all ALs to R. - for (var i = 0, cur = outerType; i < len; ++i) { - var type = types[i]; - if (type == "1" && cur == "r") types[i] = "n"; - else if (isStrong.test(type)) { cur = type; if (type == "r") types[i] = "R"; } - } - - // W4. A single European separator between two European numbers - // changes to a European number. A single common separator between - // two numbers of the same type changes to that type. - for (var i = 1, prev = types[0]; i < len - 1; ++i) { - var type = types[i]; - if (type == "+" && prev == "1" && types[i+1] == "1") types[i] = "1"; - else if (type == "," && prev == types[i+1] && - (prev == "1" || prev == "n")) types[i] = prev; - prev = type; - } - - // W5. A sequence of European terminators adjacent to European - // numbers changes to all European numbers. - // W6. Otherwise, separators and terminators change to Other - // Neutral. - for (var i = 0; i < len; ++i) { - var type = types[i]; - if (type == ",") types[i] = "N"; - else if (type == "%") { - for (var end = i + 1; end < len && types[end] == "%"; ++end) {} - var replace = (i && types[i-1] == "!") || (end < len && types[end] == "1") ? "1" : "N"; - for (var j = i; j < end; ++j) types[j] = replace; - i = end - 1; - } - } - - // W7. Search backwards from each instance of a European number - // until the first strong type (R, L, or sor) is found. If an L is - // found, then change the type of the European number to L. - for (var i = 0, cur = outerType; i < len; ++i) { - var type = types[i]; - if (cur == "L" && type == "1") types[i] = "L"; - else if (isStrong.test(type)) cur = type; - } - - // N1. A sequence of neutrals takes the direction of the - // surrounding strong text if the text on both sides has the same - // direction. European and Arabic numbers act as if they were R in - // terms of their influence on neutrals. Start-of-level-run (sor) - // and end-of-level-run (eor) are used at level run boundaries. - // N2. Any remaining neutrals take the embedding direction. - for (var i = 0; i < len; ++i) { - if (isNeutral.test(types[i])) { - for (var end = i + 1; end < len && isNeutral.test(types[end]); ++end) {} - var before = (i ? types[i-1] : outerType) == "L"; - var after = (end < len ? types[end] : outerType) == "L"; - var replace = before || after ? "L" : "R"; - for (var j = i; j < end; ++j) types[j] = replace; - i = end - 1; - } - } - - // Here we depart from the documented algorithm, in order to avoid - // building up an actual levels array. Since there are only three - // levels (0, 1, 2) in an implementation that doesn't take - // explicit embedding into account, we can build up the order on - // the fly, without following the level-based algorithm. - var order = [], m; - for (var i = 0; i < len;) { - if (countsAsLeft.test(types[i])) { - var start = i; - for (++i; i < len && countsAsLeft.test(types[i]); ++i) {} - order.push(new BidiSpan(0, start, i)); - } else { - var pos = i, at = order.length; - for (++i; i < len && types[i] != "L"; ++i) {} - for (var j = pos; j < i;) { - if (countsAsNum.test(types[j])) { - if (pos < j) order.splice(at, 0, new BidiSpan(1, pos, j)); - var nstart = j; - for (++j; j < i && countsAsNum.test(types[j]); ++j) {} - order.splice(at, 0, new BidiSpan(2, nstart, j)); - pos = j; - } else ++j; - } - if (pos < i) order.splice(at, 0, new BidiSpan(1, pos, i)); - } - } - if (order[0].level == 1 && (m = str.match(/^\s+/))) { - order[0].from = m[0].length; - order.unshift(new BidiSpan(0, 0, m[0].length)); - } - if (lst(order).level == 1 && (m = str.match(/\s+$/))) { - lst(order).to -= m[0].length; - order.push(new BidiSpan(0, len - m[0].length, len)); - } - if (order[0].level != lst(order).level) - order.push(new BidiSpan(order[0].level, len, len)); - - return order; - }; - })(); - - // THE END - - CodeMirror.version = "4.12.0"; - - return CodeMirror; -}); diff --git a/media/editors/codemirror/lib/codemirror.css b/media/editors/codemirror/lib/codemirror.css index 1b8b844a0b9a6..ceacd13047908 100644 --- a/media/editors/codemirror/lib/codemirror.css +++ b/media/editors/codemirror/lib/codemirror.css @@ -1 +1,325 @@ -.CodeMirror{font-family:monospace;height:300px}.CodeMirror-lines{padding:4px 0}.CodeMirror pre{padding:0 4px}.CodeMirror-scrollbar-filler,.CodeMirror-gutter-filler{background-color:white}.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;-moz-box-sizing:content-box;box-sizing:content-box}.CodeMirror-guttermarker{color:black}.CodeMirror-guttermarker-subtle{color:#999}.CodeMirror div.CodeMirror-cursor{border-left:1px solid black}.CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}.CodeMirror.cm-fat-cursor div.CodeMirror-cursor{width:auto;border:0;background:#7e7}.CodeMirror.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}@-moz-keyframes blink{0%{background:#7e7}50%{background:0}100%{background:#7e7}}@-webkit-keyframes blink{0%{background:#7e7}50%{background:0}100%{background:#7e7}}@keyframes blink{0%{background:#7e7}50%{background:0}100%{background:#7e7}}.cm-tab{display:inline-block;text-decoration:inherit}.CodeMirror-ruler{border-left:1px solid #ccc;position:absolute}.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{color:#555}.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-header{color:blue}.cm-s-default .cm-quote{color:#090}.cm-s-default .cm-hr{color:#999}.cm-s-default .cm-link{color:#00c}.cm-negative{color:#d44}.cm-positive{color:#292}.cm-header,.cm-strong{font-weight:bold}.cm-em{font-style:italic}.cm-link{text-decoration:underline}.cm-strikethrough{text-decoration:line-through}.cm-s-default .cm-error{color:#f00}.cm-invalidchar{color:#f00}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{line-height:1;position:relative;overflow:hidden;background:white;color:black}.CodeMirror-scroll{overflow:scroll!important;margin-bottom:-30px;margin-right:-30px;padding-bottom:30px;height:100%;outline:0;position:relative;-moz-box-sizing:content-box;box-sizing:content-box}.CodeMirror-sizer{position:relative;border-right:30px solid transparent;-moz-box-sizing:content-box;box-sizing:content-box}.CodeMirror-vscrollbar,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-gutter-filler{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;z-index:3}.CodeMirror-gutter{white-space:normal;height:100%;-moz-box-sizing:content-box;box-sizing:content-box;display:inline-block;margin-bottom:-30px;*zoom:1;*display:inline}.CodeMirror-gutter-wrapper{position:absolute;z-index:4;height:100%}.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:transparent;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}.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-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}.CodeMirror-measure pre{position:static}.CodeMirror div.CodeMirror-cursor{position:absolute;border-right:0;width:0}div.CodeMirror-cursors{visibility:hidden;position:relative;z-index:3}.CodeMirror-focused div.CodeMirror-cursors{visibility:visible}.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused .CodeMirror-selected{background:#d7d4f0}.CodeMirror-crosshair{cursor:crosshair}.cm-searching{background:#ffa;background:rgba(255,255,0,.4)}.CodeMirror span{*vertical-align:text-bottom}.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}.CodeMirror-fullscreen{position:fixed;top:0;left:0;right:0;bottom:0;height:auto;z-index:9}.CodeMirror-foldmarker{color:blue;text-shadow:#b9f 1px 1px 2px,#b9f -1px -1px 2px,#b9f 1px -1px 2px,#b9f -1px 1px 2px;font-family:arial;line-height:.3;cursor:pointer}.CodeMirror-foldgutter{width:.7em}.CodeMirror-foldgutter-open,.CodeMirror-foldgutter-folded{cursor:pointer}.CodeMirror-foldgutter-open:after{content:"\25BE"}.CodeMirror-foldgutter-folded:after{content:"\25B8"}.CodeMirror-simplescroll-horizontal div,.CodeMirror-simplescroll-vertical div{position:absolute;background:#ccc;-moz-box-sizing:border-box;box-sizing:border-box;border:1px solid #bbb;border-radius:2px}.CodeMirror-simplescroll-horizontal,.CodeMirror-simplescroll-vertical{position:absolute;z-index:6;background:#eee}.CodeMirror-simplescroll-horizontal{bottom:0;left:0;height:8px}.CodeMirror-simplescroll-horizontal div{bottom:0;height:100%}.CodeMirror-simplescroll-vertical{right:0;top:0;width:8px}.CodeMirror-simplescroll-vertical div{right:0;width:100%}.CodeMirror-overlayscroll .CodeMirror-scrollbar-filler,.CodeMirror-overlayscroll .CodeMirror-gutter-filler{display:none}.CodeMirror-overlayscroll-horizontal div,.CodeMirror-overlayscroll-vertical div{position:absolute;background:#bcd;border-radius:3px}.CodeMirror-overlayscroll-horizontal,.CodeMirror-overlayscroll-vertical{position:absolute;z-index:6}.CodeMirror-overlayscroll-horizontal{bottom:0;left:0;height:6px}.CodeMirror-overlayscroll-horizontal div{bottom:0;height:100%}.CodeMirror-overlayscroll-vertical{right:0;top:0;width:6px}.CodeMirror-overlayscroll-vertical div{right:0;width:100%} \ No newline at end of file +/* BASICS */ + +.CodeMirror { + /* Set height, width, borders, and global font properties here */ + font-family: monospace; + height: 300px; + color: black; +} + +/* PADDING */ + +.CodeMirror-lines { + padding: 4px 0; /* Vertical padding around content */ +} +.CodeMirror pre { + padding: 0 4px; /* Horizontal padding of content */ +} + +.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler { + background-color: white; /* The little square between H and V scrollbars */ +} + +/* GUTTER */ + +.CodeMirror-gutters { + border-right: 1px solid #ddd; + background-color: #f7f7f7; + white-space: nowrap; +} +.CodeMirror-linenumbers {} +.CodeMirror-linenumber { + padding: 0 3px 0 5px; + min-width: 20px; + text-align: right; + color: #999; + white-space: nowrap; +} + +.CodeMirror-guttermarker { color: black; } +.CodeMirror-guttermarker-subtle { color: #999; } + +/* CURSOR */ + +.CodeMirror div.CodeMirror-cursor { + border-left: 1px solid black; +} +/* Shown when moving in bi-directional text */ +.CodeMirror div.CodeMirror-secondarycursor { + border-left: 1px solid silver; +} +.CodeMirror.cm-fat-cursor div.CodeMirror-cursor { + width: auto; + border: 0; + background: #7e7; +} +.CodeMirror.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; +} +@-moz-keyframes blink { + 0% { background: #7e7; } + 50% { background: none; } + 100% { background: #7e7; } +} +@-webkit-keyframes blink { + 0% { background: #7e7; } + 50% { background: none; } + 100% { background: #7e7; } +} +@keyframes blink { + 0% { background: #7e7; } + 50% { background: none; } + 100% { background: #7e7; } +} + +/* Can style cursor different in overwrite (non-insert) mode */ +div.CodeMirror-overwrite div.CodeMirror-cursor {} + +.cm-tab { display: inline-block; text-decoration: inherit; } + +.CodeMirror-ruler { + border-left: 1px solid #ccc; + position: absolute; +} + +/* DEFAULT THEME */ + +.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, +.cm-s-default .cm-punctuation, +.cm-s-default .cm-property, +.cm-s-default .cm-operator {} +.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 {color: #555;} +.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-header {color: blue;} +.cm-s-default .cm-quote {color: #090;} +.cm-s-default .cm-hr {color: #999;} +.cm-s-default .cm-link {color: #00c;} + +.cm-negative {color: #d44;} +.cm-positive {color: #292;} +.cm-header, .cm-strong {font-weight: bold;} +.cm-em {font-style: italic;} +.cm-link {text-decoration: underline;} +.cm-strikethrough {text-decoration: line-through;} + +.cm-s-default .cm-error {color: #f00;} +.cm-invalidchar {color: #f00;} + +.CodeMirror-composing { border-bottom: 2px solid; } + +/* Default styles for common addons */ + +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;} + +/* STOP */ + +/* The rest of this file contains styles related to the mechanics of + the editor. You probably shouldn't touch them. */ + +.CodeMirror { + position: relative; + overflow: hidden; + background: white; +} + +.CodeMirror-scroll { + overflow: scroll !important; /* Things will break if this is overridden */ + /* 30px is the magic margin used to hide the element's real scrollbars */ + /* See overflow: hidden in .CodeMirror */ + margin-bottom: -30px; margin-right: -30px; + padding-bottom: 30px; + height: 100%; + outline: none; /* Prevent dragging from highlighting the element */ + position: relative; +} +.CodeMirror-sizer { + position: relative; + border-right: 30px solid transparent; +} + +/* The fake, visible scrollbars. Used to force redraw during scrolling + before actuall scrolling happens, thus preventing shaking and + flickering artifacts. */ +.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler { + 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; + z-index: 3; +} +.CodeMirror-gutter { + white-space: normal; + height: 100%; + display: inline-block; + margin-bottom: -30px; + /* Hack to make IE7 behave */ + *zoom:1; + *display:inline; +} +.CodeMirror-gutter-wrapper { + position: absolute; + z-index: 4; + height: 100%; +} +.CodeMirror-gutter-elt { + position: absolute; + cursor: default; + z-index: 4; +} +.CodeMirror-gutter-wrapper { + -webkit-user-select: none; + -moz-user-select: none; + user-select: none; +} + +.CodeMirror-lines { + cursor: text; + min-height: 1px; /* prevents collapsing before first draw */ +} +.CodeMirror pre { + /* Reset some styles that the rest of the page might have set */ + -moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0; + border-width: 0; + background: transparent; + 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; +} +.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-widget {} + +.CodeMirror-code { + outline: none; +} + +/* Force content-box sizing for the elements where we expect it */ +.CodeMirror-scroll, +.CodeMirror-sizer, +.CodeMirror-gutter, +.CodeMirror-gutters, +.CodeMirror-linenumber { + -moz-box-sizing: content-box; + box-sizing: content-box; +} + +.CodeMirror-measure { + position: absolute; + width: 100%; + height: 0; + overflow: hidden; + visibility: hidden; +} +.CodeMirror-measure pre { position: static; } + +.CodeMirror div.CodeMirror-cursor { + position: absolute; + border-right: none; + width: 0; +} + +div.CodeMirror-cursors { + visibility: hidden; + position: relative; + z-index: 3; +} +.CodeMirror-focused div.CodeMirror-cursors { + visibility: visible; +} + +.CodeMirror-selected { background: #d9d9d9; } +.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; } +.CodeMirror-crosshair { cursor: crosshair; } +.CodeMirror ::selection { background: #d7d4f0; } +.CodeMirror ::-moz-selection { background: #d7d4f0; } + +.cm-searching { + background: #ffa; + background: rgba(255, 255, 0, .4); +} + +/* IE7 hack to prevent it from returning funny offsetTops on the spans */ +.CodeMirror span { *vertical-align: text-bottom; } + +/* Used to force a border model for a node */ +.cm-force-border { padding-right: .1px; } + +@media print { + /* Hide the cursor when printing */ + .CodeMirror div.CodeMirror-cursors { + visibility: hidden; + } +} + +/* See issue #2901 */ +.cm-tab-wrap-hack:after { content: ''; } + +/* Help users use markselection to safely style text background */ +span.CodeMirror-selectedtext { background: none; } diff --git a/media/editors/codemirror/lib/codemirror.js b/media/editors/codemirror/lib/codemirror.js index d54fe16dd295d..a1dfd0fc3d381 100644 --- a/media/editors/codemirror/lib/codemirror.js +++ b/media/editors/codemirror/lib/codemirror.js @@ -1 +1,8745 @@ -(function(a){if(typeof exports=="object"&&typeof module=="object"){module.exports=a()}else{if(typeof define=="function"&&define.amd){return define([],a)}else{this.CodeMirror=a()}}})(function(){var co=/gecko\/\d/i.test(navigator.userAgent);var eG=/MSIE \d/.test(navigator.userAgent);var bI=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);var dG=eG||bI;var k=dG&&(eG?document.documentMode||6:bI[1]);var cY=/WebKit\//.test(navigator.userAgent);var dJ=cY&&/Qt\/\d+\.\d+/.test(navigator.userAgent);var da=/Chrome\//.test(navigator.userAgent);var dY=/Opera\//.test(navigator.userAgent);var aA=/Apple Computer/.test(navigator.vendor);var a8=/KHTML\//.test(navigator.userAgent);var c5=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent);var fr=/PhantomJS/.test(navigator.userAgent);var eX=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent);var ec=eX||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent);var b6=eX||/Mac/.test(navigator.platform);var aM=/win/i.test(navigator.platform);var aV=dY&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);if(aV){aV=Number(aV[1])}if(aV&&aV>=15){dY=false;cY=true}var bP=b6&&(dJ||dY&&(aV==null||aV<12.11));var f0=co||(dG&&k>=9);var f3=false,a4=false;function I(f8,f9){if(!(this instanceof I)){return new I(f8,f9)}this.options=f9=f9?aK(f9):{};aK(eZ,f9,false);cd(f9);var gd=f9.value;if(typeof gd=="string"){gd=new ar(gd,f9.mode)}this.doc=gd;var gc=this.display=new eE(f8,gd);gc.wrapper.CodeMirror=this;d8(this);cM(this);if(f9.lineWrapping){this.display.wrapper.className+=" CodeMirror-wrap"}if(f9.autofocus&&!ec){ev(this)}aB(this);this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:false,focused:false,suppressEdits:false,pasteIncoming:false,cutIncoming:false,draggingText:false,highlight:new f7(),keySeq:null};if(dG&&k<11){setTimeout(cv(fl,this,true),20)}fM(this);bg();cG(this);this.curOp.forceUpdate=true;d7(this,gd);if((f9.autofocus&&!ec)||dK()==gc.input){setTimeout(cv(cA,this),20)}else{aS(this)}for(var gb in bc){if(bc.hasOwnProperty(gb)){bc[gb](this,f9[gb],cb)}}d1(this);for(var ga=0;gaga.maxLineLength){ga.maxLineLength=gb;ga.maxLine=gc}})}function cd(f8){var f9=df(f8.gutters,"CodeMirror-linenumbers");if(f9==-1&&f8.lineNumbers){f8.gutters=f8.gutters.concat(["CodeMirror-linenumbers"])}else{if(f9>-1&&!f8.lineNumbers){f8.gutters=f8.gutters.slice(0);f8.gutters.splice(f9,1)}}}function dw(f8){var gb=f8.display,ga=gb.gutters.offsetWidth;var f9=Math.round(f8.doc.height+bH(f8.display));return{clientHeight:gb.scroller.clientHeight,viewHeight:gb.wrapper.clientHeight,scrollWidth:gb.scroller.scrollWidth,clientWidth:gb.scroller.clientWidth,viewWidth:gb.wrapper.clientWidth,barLeft:f8.options.fixedGutter?ga:0,docHeight:f9,scrollHeight:f9+cR(f8)+gb.barHeight,nativeBarWidth:gb.nativeBarWidth,gutterWidth:ga}}function dh(ga,f9,f8){this.cm=f8;var gb=this.vert=fT("div",[fT("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar");var gc=this.horiz=fT("div",[fT("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");ga(gb);ga(gc);bW(gb,"scroll",function(){if(gb.clientHeight){f9(gb.scrollTop,"vertical")}});bW(gc,"scroll",function(){if(gc.clientWidth){f9(gc.scrollLeft,"horizontal")}});this.checkedOverlay=false;if(dG&&k<8){this.horiz.style.minHeight=this.vert.style.minWidth="18px"}}dh.prototype=aK({update:function(gb){var gc=gb.scrollWidth>gb.clientWidth+1;var ga=gb.scrollHeight>gb.clientHeight+1;var gd=gb.nativeBarWidth;if(ga){this.vert.style.display="block";this.vert.style.bottom=gc?gd+"px":"0";var f9=gb.viewHeight-(gc?gd:0);this.vert.firstChild.style.height=Math.max(0,gb.scrollHeight-gb.clientHeight+f9)+"px"}else{this.vert.style.display="";this.vert.firstChild.style.height="0"}if(gc){this.horiz.style.display="block";this.horiz.style.right=ga?gd+"px":"0";this.horiz.style.left=gb.barLeft+"px";var f8=gb.viewWidth-gb.barLeft-(ga?gd:0);this.horiz.firstChild.style.width=(gb.scrollWidth-gb.clientWidth+f8)+"px"}else{this.horiz.style.display="";this.horiz.firstChild.style.width="0"}if(!this.checkedOverlay&&gb.clientHeight>0){if(gd==0){this.overlayHack()}this.checkedOverlay=true}return{right:ga?gd:0,bottom:gc?gd:0}},setScrollLeft:function(f8){if(this.horiz.scrollLeft!=f8){this.horiz.scrollLeft=f8}},setScrollTop:function(f8){if(this.vert.scrollTop!=f8){this.vert.scrollTop=f8}},overlayHack:function(){var f8=b6&&!c5?"12px":"18px";this.horiz.style.minHeight=this.vert.style.minWidth=f8;var f9=this;var ga=function(gb){if(M(gb)!=f9.vert&&M(gb)!=f9.horiz){c0(f9.cm,ep)(gb)}};bW(this.vert,"mousedown",ga);bW(this.horiz,"mousedown",ga)},clear:function(){var f8=this.horiz.parentNode;f8.removeChild(this.horiz);f8.removeChild(this.vert)}},dh.prototype);function e0(){}e0.prototype=aK({update:function(){return{bottom:0,right:0}},setScrollLeft:function(){},setScrollTop:function(){},clear:function(){}},e0.prototype);I.scrollbarModel={"native":dh,"null":e0};function aB(f8){if(f8.display.scrollbars){f8.display.scrollbars.clear();if(f8.display.scrollbars.addClass){f(f8.display.wrapper,f8.display.scrollbars.addClass)}}f8.display.scrollbars=new I.scrollbarModel[f8.options.scrollbarStyle](function(f9){f8.display.wrapper.insertBefore(f9,f8.display.scrollbarFiller);bW(f9,"mousedown",function(){if(f8.state.focused){setTimeout(cv(ev,f8),0)}});f9.setAttribute("not-content","true")},function(ga,f9){if(f9=="horizontal"){bD(f8,ga)}else{O(f8,ga)}},f8);if(f8.display.scrollbars.addClass){fx(f8.display.wrapper,f8.display.scrollbars.addClass)}}function eU(ga,gc){if(!gc){gc=dw(ga)}var f9=ga.display.barWidth,f8=ga.display.barHeight;aR(ga,gc);for(var gb=0;gb<4&&f9!=ga.display.barWidth||f8!=ga.display.barHeight;gb++){if(f9!=ga.display.barWidth&&ga.options.lineWrapping){a6(ga)}aR(ga,dw(ga));f9=ga.display.barWidth;f8=ga.display.barHeight}}function aR(f8,f9){var gb=f8.display;var ga=gb.scrollbars.update(f9);gb.sizer.style.paddingRight=(gb.barWidth=ga.right)+"px";gb.sizer.style.paddingBottom=(gb.barHeight=ga.bottom)+"px";if(ga.right&&ga.bottom){gb.scrollbarFiller.style.display="block";gb.scrollbarFiller.style.height=ga.bottom+"px";gb.scrollbarFiller.style.width=ga.right+"px"}else{gb.scrollbarFiller.style.display=""}if(ga.bottom&&f8.options.coverGutterNextToScrollbar&&f8.options.fixedGutter){gb.gutterFiller.style.display="block";gb.gutterFiller.style.height=ga.bottom+"px";gb.gutterFiller.style.width=f9.gutterWidth+"px"}else{gb.gutterFiller.style.display=""}}function b5(gb,gf,ga){var gc=ga&&ga.top!=null?Math.max(0,ga.top):gb.scroller.scrollTop;gc=Math.floor(gc-e4(gb));var f8=ga&&ga.bottom!=null?ga.bottom:gc+gb.wrapper.clientHeight;var gd=bF(gf,gc),ge=bF(gf,f8);if(ga&&ga.ensure){var f9=ga.ensure.from.line,gg=ga.ensure.to.line;if(f9=ge){gd=bF(gf,bL(fb(gf,gg))-gb.wrapper.clientHeight);ge=gg}}}return{from:gd,to:Math.max(ge,gd+1)}}function eA(gg){var ge=gg.display,gf=ge.view;if(!ge.alignWidgets&&(!ge.gutters.firstChild||!gg.options.fixedGutter)){return}var gc=dT(ge)-ge.scroller.scrollLeft+gg.doc.scrollLeft;var f8=ge.gutters.offsetWidth,f9=gc+"px";for(var gb=0;gb=gc.viewFrom&&gb.visible.to<=gc.viewTo&&(gc.updateLineNumbers==null||gc.updateLineNumbers>=gc.viewTo)&&gc.renderedView==gc.view&&c9(gh)==0){return false}if(d1(gh)){es(gh);gb.dims=e9(gh)}var ga=gg.first+gg.size;var ge=Math.max(gb.visible.from-gh.options.viewportMargin,gg.first);var gf=Math.min(ga,gb.visible.to+gh.options.viewportMargin);if(gc.viewFromgf&&gc.viewTo-gf<20){gf=Math.min(ga,gc.viewTo)}if(a4){ge=aT(gh.doc,ge);gf=dZ(gh.doc,gf)}var f9=ge!=gc.viewFrom||gf!=gc.viewTo||gc.lastWrapHeight!=gb.wrapperHeight||gc.lastWrapWidth!=gb.wrapperWidth;cP(gh,ge,gf);gc.viewOffset=bL(fb(gh.doc,gc.viewFrom));gh.display.mover.style.top=gc.viewOffset+"px";var f8=c9(gh);if(!f9&&f8==0&&!gb.force&&gc.renderedView==gc.view&&(gc.updateLineNumbers==null||gc.updateLineNumbers>=gc.viewTo)){return false}var gd=dK();if(f8>4){gc.lineDiv.style.display="none"}cm(gh,gc.updateLineNumbers,gb.dims);if(f8>4){gc.lineDiv.style.display=""}gc.renderedView=gc.view;if(gd&&dK()!=gd&&gd.offsetHeight){gd.focus()}dX(gc.cursorDiv);dX(gc.selectionDiv);gc.gutters.style.height=0;if(f9){gc.lastWrapHeight=gb.wrapperHeight;gc.lastWrapWidth=gb.wrapperWidth;eb(gh,400)}gc.updateLineNumbers=null;return true}function cj(f9,gd){var gb=gd.force,f8=gd.viewport;for(var gc=true;;gc=false){if(gc&&f9.options.lineWrapping&&gd.oldDisplayWidth!=di(f9)){gb=true}else{gb=false;if(f8&&f8.top!=null){f8={top:Math.min(f9.doc.height+bH(f9.display)-cT(f9),f8.top)}}gd.visible=b5(f9.display,f9.doc,f8);if(gd.visible.from>=f9.display.viewFrom&&gd.visible.to<=f9.display.viewTo){break}}if(!C(f9,gd)){break}a6(f9);var ga=dw(f9);bB(f9);dv(f9,ga);eU(f9,ga)}ad(f9,"update",f9);if(f9.display.viewFrom!=f9.display.reportedViewFrom||f9.display.viewTo!=f9.display.reportedViewTo){ad(f9,"viewportChange",f9,f9.display.viewFrom,f9.display.viewTo);f9.display.reportedViewFrom=f9.display.viewFrom;f9.display.reportedViewTo=f9.display.viewTo}}function dP(f9,f8){var gb=new aG(f9,f8);if(C(f9,gb)){a6(f9);cj(f9,gb);var ga=dw(f9);bB(f9);dv(f9,ga);eU(f9,ga)}}function dv(f8,f9){f8.display.sizer.style.minHeight=f9.docHeight+"px";var ga=f9.docHeight+f8.display.barHeight;f8.display.heightForcer.style.top=ga+"px";f8.display.gutters.style.height=Math.max(ga+cR(f8),f9.clientHeight)+"px"}function a6(gf){var gd=gf.display;var f9=gd.lineDiv.offsetTop;for(var ga=0;ga0.001||ge<-0.001){fW(gg.line,gh);ca(gg.line);if(gg.rest){for(var f8=0;f8-1){gh=false}aa(gj,gc,gd,gi)}if(gh){dX(gc.lineNumber);gc.lineNumber.appendChild(document.createTextNode(eo(gj.options,gd)))}gk=gc.node.nextSibling}}gd+=gc.size}while(gk){gk=ge(gk)}}function aa(f8,ga,gc,gd){for(var f9=0;f9=0&&ce(gb,f9.to())<=0){return ga}}return -1}};function dU(f8,f9){this.anchor=f8;this.head=f9}dU.prototype={from:function(){return aq(this.anchor,this.head)},to:function(){return bw(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};function cw(f8,gf){var ga=f8[gf];f8.sort(function(gi,gh){return ce(gi.from(),gh.from())});gf=df(f8,ga);for(var gc=1;gc=0){var gd=aq(f9.from(),gg.from()),ge=bw(f9.to(),gg.to());var gb=f9.empty()?gg.from()==gg.head:f9.from()==f9.head;if(gc<=gf){--gf}f8.splice(--gc,2,new dU(gb?ge:gd,gb?gd:ge))}}return new fU(f8,gf)}function eO(f8,f9){return new fU([new dU(f8,f9||f8)],0)}function c3(f8,f9){return Math.max(f8.first,Math.min(f9,f8.first+f8.size-1))}function fG(f9,ga){if(ga.linef8){return X(f8,fb(f9,f8).text.length)}return fp(ga,fb(f9,ga.line).text.length)}function fp(ga,f9){var f8=ga.ch;if(f8==null||f8>f9){return X(ga.line,f9)}else{if(f8<0){return X(ga.line,0)}else{return ga}}}function b8(f9,f8){return f8>=f9.first&&f8=ga.ch:f8.to>ga.ch))){if(ge){aC(f9,"beforeCursorEnter");if(f9.explicitlyCleared){if(!gj.markedSpans){break}else{--gc;continue}}}if(!f9.atomic){continue}var gf=f9.find(gb<0?-1:1);if(ce(gf,ga)==0){gf.ch+=gb;if(gf.ch<0){if(gf.line>gh.first){gf=fG(gh,X(gf.line-1))}else{gf=null}}else{if(gf.ch>gj.text.length){if(gf.line3){gj(gD,gB.top,null,gB.bottom);gD=gb;if(gB.bottomgq.bottom||gC.bottom==gq.bottom&&gC.right>gq.right){gq=gC}if(gD0){ga.blinker=setInterval(function(){ga.cursorDiv.style.visibility=(f9=!f9)?"":"hidden"},f8.options.cursorBlinkRate)}else{if(f8.options.cursorBlinkRate<0){ga.cursorDiv.style.visibility="hidden"}}}function eb(f8,f9){if(f8.doc.mode.startState&&f8.doc.frontier=f8.display.viewTo){return}var ga=+new Date+f8.options.workTime;var gb=b2(gc.mode,dx(f8,gc.frontier));var f9=[];gc.iter(gc.frontier,Math.min(gc.first+gc.size,f8.display.viewTo+500),function(gd){if(gc.frontier>=f8.display.viewFrom){var gg=gd.styles;var gi=fw(f8,gd,gb,true);gd.styles=gi.styles;var gf=gd.styleClasses,gh=gi.classes;if(gh){gd.styleClasses=gh}else{if(gf){gd.styleClasses=null}}var gj=!gg||gg.length!=gd.styles.length||gf!=gh&&(!gf||!gh||gf.bgClass!=gh.bgClass||gf.textClass!=gh.textClass);for(var ge=0;!gj&&gega){eb(f8,f8.options.workDelay);return true}});if(f9.length){cK(f8,function(){for(var gd=0;gdga;--gh){if(gh<=gd.first){return gd.first}var gg=fb(gd,gh-1);if(gg.stateAfter&&(!gb||gh<=gd.frontier)){return gh}var gf=bS(gg.text,null,ge.options.tabSize);if(gc==null||f9>gf){gc=gh-1;f9=gf}}return gc}function dx(f8,ge,f9){var gc=f8.doc,gb=f8.display;if(!gc.mode.startState){return true}var gd=cy(f8,ge,f9),ga=gd>gc.first&&fb(gc,gd-1).stateAfter;if(!ga){ga=bZ(gc.mode)}else{ga=b2(gc.mode,ga)}gc.iter(gd,ge,function(gf){dt(f8,gf.text,ga);var gg=gd==ge-1||gd%5==0||gd>=gb.viewFrom&&gd2){gd.push((gg.bottom+f9.top)/2-ge.top)}}}gd.push(ge.bottom-ge.top)}}function ct(ga,f8,gb){if(ga.line==f8){return{map:ga.measure.map,cache:ga.measure.cache}}for(var f9=0;f9gb){return{map:ga.measure.maps[f9],cache:ga.measure.caches[f9],before:true}}}}function cZ(f8,ga){ga=y(ga);var gc=bM(ga);var f9=f8.display.externalMeasured=new bu(f8.doc,ga,gc);f9.lineN=gc;var gb=f9.built=eN(f8,f9);f9.text=gb.pre;bQ(f8.display.lineMeasure,gb.pre);return f9}function ed(f8,f9,gb,ga){return D(f8,a1(f8,f9),gb,ga)}function e7(f8,ga){if(ga>=f8.display.viewFrom&&ga=f9.lineN&&gagh){gb=gn-gr;gc=gb-1;if(gh>=gn){f8="right"}}}}if(gc!=null){gm=gt[go+2];if(gr==gn&&gd==(gm.insertLeft?"left":"right")){f8=gd}if(gd=="left"&&gc==0){while(go&>[go-2]==gt[go-3]&>[go-1].insertLeft){gm=gt[(go-=3)+2];f8="left"}}if(gd=="right"&&gc==gn-gr){while(go0){f8=gd="right"}var ga;if(gf.options.lineWrapping&&(ga=gm.getClientRects()).length>1){f9=ga[gd=="right"?ga.length-1:0]}else{f9=gm.getBoundingClientRect()}}if(dG&&k<9&&!gc&&(!f9||!f9.left&&!f9.right)){var ge=gm.parentNode.getClientRects()[0];if(ge){f9={left:ge.left,right:ge.left+dz(gf.display),top:ge.top,bottom:ge.bottom}}else{f9=ex}}var gk=f9.top-gp.rect.top,gi=f9.bottom-gp.rect.top;var gs=(gk+gi)/2;var gq=gp.view.measure.heights;for(var go=0;gogl.from){return gc(gn-1)}return gc(gn,gm)}var gd=a(ge),f8=gg.ch;if(!gd){return gc(f8)}var f9=aE(gd,f8);var gb=gi(f8,f9);if(eY!=null){gb.other=gi(f8,eY)}return gb}function dD(f8,gc){var gb=0,gc=fG(f8.doc,gc);if(!f8.options.lineWrapping){gb=dz(f8.display)*gc.ch}var f9=fb(f8.doc,gc.line);var ga=bL(f9)+e4(f8.display);return{left:gb,right:gb,top:ga,bottom:ga+f9.height}}function fS(f8,f9,ga,gc){var gb=X(f8,f9);gb.xRel=gc;if(ga){gb.outside=true}return gb}function fL(gf,gc,gb){var ge=gf.doc;gb+=gf.display.viewOffset;if(gb<0){return fS(ge.first,0,true,-1)}var ga=bF(ge,gb),gg=ge.first+ge.size-1;if(ga>gg){return fS(ge.first+ge.size-1,fb(ge,gg).text.length,true,1)}if(gc<0){gc=0}var f9=fb(ge,ga);for(;;){var gh=cX(gf,f9,ga,gc,gb);var gd=er(f9);var f8=gd&&gd.find(0,true);if(gd&&(gh.ch>f8.from.ch||gh.ch==f8.from.ch&&gh.xRel>0)){ga=bM(f9=f8.to.line)}else{return gh}}}function cX(gi,ga,gl,gk,gj){var gh=gj-bL(ga);var ge=false,gr=2*gi.display.wrapper.clientWidth;var go=a1(gi,ga);function gv(gx){var gy=dQ(gi,X(gl,gx),"line",ga,go);ge=true;if(gh>gy.bottom){return gy.left-gr}else{if(ghf9){return fS(gl,gb,gd,1)}for(;;){if(gn?gb==gs||gb==u(ga,gs,1):gb-gs<=1){var gm=gk1?1:0);return gg}var gf=Math.ceil(gq/2),gw=gs+gf;if(gn){gw=gs;for(var gt=0;gtgk){gb=gw;f9=gc;if(gd=ge){f9+=1000}gq=gf}else{gs=gw;gp=gc;f8=ge;gq-=gf}}}var aF;function aU(ga){if(ga.cachedTextHeight!=null){return ga.cachedTextHeight}if(aF==null){aF=fT("pre");for(var f9=0;f9<49;++f9){aF.appendChild(document.createTextNode("x"));aF.appendChild(fT("br"))}aF.appendChild(document.createTextNode("x"))}bQ(ga.measure,aF);var f8=aF.offsetHeight/50;if(f8>3){ga.cachedTextHeight=f8}dX(ga.measure);return f8||1}function dz(gc){if(gc.cachedCharWidth!=null){return gc.cachedCharWidth}var f8=fT("span","xxxxxxxxxx");var gb=fT("pre",[f8]);bQ(gc.measure,gb);var ga=f8.getBoundingClientRect(),f9=(ga.right-ga.left)/10;if(f9>2){gc.cachedCharWidth=f9}return f9||10}var bo=null;var d4=0;function cG(f8){f8.curOp={cm:f8,viewChanged:false,startHeight:f8.doc.height,forceUpdate:false,updateInput:null,typing:false,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:false,updateMaxLine:false,scrollLeft:null,scrollTop:null,scrollToPos:null,id:++d4};if(bo){bo.ops.push(f8.curOp)}else{f8.curOp.ownsGroup=bo={ops:[f8.curOp],delayedCallbacks:[]}}}function cS(gb){var ga=gb.delayedCallbacks,f9=0;do{for(;f9=f9.viewTo)||f9.maxLineChanged&&f8.options.lineWrapping;ga.update=ga.mustUpdate&&new aG(f8,ga.mustUpdate&&{top:ga.scrollTop,ensure:ga.scrollToPos},ga.forceUpdate)}function ap(f8){f8.updatedDisplay=f8.mustUpdate&&C(f8.cm,f8.update)}function b1(ga){var f8=ga.cm,f9=f8.display;if(ga.updatedDisplay){a6(f8)}ga.barMeasure=dw(f8);if(f9.maxLineChanged&&!f8.options.lineWrapping){ga.adjustWidthTo=ed(f8,f9.maxLine,f9.maxLine.text.length).left+3;f8.display.sizerWidth=ga.adjustWidthTo;ga.barMeasure.scrollWidth=Math.max(f9.scroller.clientWidth,f9.sizer.offsetLeft+ga.adjustWidthTo+cR(f8)+f8.display.barWidth);ga.maxScrollLeft=Math.max(0,f9.sizer.offsetLeft+ga.adjustWidthTo-di(f8))}if(ga.updatedDisplay||ga.selectionChanged){ga.newSelectionNodes=bk(f8)}}function ao(f9){var f8=f9.cm;if(f9.adjustWidthTo!=null){f8.display.sizer.style.minWidth=f9.adjustWidthTo+"px";if(f9.maxScrollLeftgd)){ga.updateLineNumbers=gd}gf.curOp.viewChanged=true;if(gd>=ga.viewTo){if(a4&&aT(gf.doc,gd)ga.viewFrom){es(gf)}else{ga.viewFrom+=gg;ga.viewTo+=gg}}else{if(gd<=ga.viewFrom&&ge>=ga.viewTo){es(gf)}else{if(gd<=ga.viewFrom){var gc=dc(gf,ge,ge+gg,1);if(gc){ga.view=ga.view.slice(gc.index);ga.viewFrom=gc.lineN;ga.viewTo+=gg}else{es(gf)}}else{if(ge>=ga.viewTo){var gc=dc(gf,gd,gd,-1);if(gc){ga.view=ga.view.slice(0,gc.index);ga.viewTo=gc.lineN}else{es(gf)}}else{var gb=dc(gf,gd,gd,-1);var f9=dc(gf,ge,ge+gg,1);if(gb&&f9){ga.view=ga.view.slice(0,gb.index).concat(eR(gf,gb.lineN,f9.lineN)).concat(ga.view.slice(f9.index));ga.viewTo+=gg}else{es(gf)}}}}}}var f8=ga.externalMeasured;if(f8){if(ge=gc.lineN&&ga=ge.viewTo){return}var gb=ge.view[dn(f9,ga)];if(gb.node==null){return}var f8=gb.changes||(gb.changes=[]);if(df(f8,gd)==-1){f8.push(gd)}}function es(f8){f8.display.viewFrom=f8.display.viewTo=f8.doc.first;f8.display.view=[];f8.display.viewOffset=0}function dn(f8,gb){if(gb>=f8.display.viewTo){return null}gb-=f8.display.viewFrom;if(gb<0){return null}var f9=f8.display.view;for(var ga=0;ga0){if(gd==ge.length-1){return null}gf=(f8+ge[gd].size)-ga;gd++}else{gf=f8-ga}ga+=gf;gc+=gf}while(aT(gg.doc,gc)!=gc){if(gd==(f9<0?0:ge.length-1)){return null}gc+=f9*ge[gd-(f9<0?1:0)].size;gd+=f9}return{index:gd,lineN:gc}}function cP(f8,gc,gb){var ga=f8.display,f9=ga.view;if(f9.length==0||gc>=ga.viewTo||gb<=ga.viewFrom){ga.view=eR(f8,gc,gb);ga.viewFrom=gc}else{if(ga.viewFrom>gc){ga.view=eR(f8,gc,ga.viewFrom).concat(ga.view)}else{if(ga.viewFromgb){ga.view=ga.view.slice(0,dn(f8,gb))}}}ga.viewTo=gb}function c9(f8){var f9=f8.display.view,gc=0;for(var gb=0;gb=9&&gc.display.inputHasSelection===gf||b6&&/[\uf700-\uf7ff]/.test(gf)){fl(gc);return false}var gn=!gc.curOp;if(gn){cG(gc)}gc.display.shift=false;if(gf.charCodeAt(0)==8203&&gr.sel==gc.display.selForContextMenu&&!gg){gg="\u200b"}var gm=0,gj=Math.min(gg.length,gf.length);while(gm1){if(bj&&bj.join("\n")==f9){gq=gr.sel.ranges.length%bj.length==0&&bR(bj,aX)}else{if(gh.length==gr.sel.ranges.length){gq=bR(gh,function(gs){return[gs]})}}}for(var go=gr.sel.ranges.length-1;go>=0;go--){var gi=gr.sel.ranges[go];var gk=gi.from(),f8=gi.to();if(gm-1){ac(gc,ga.line,"smart");break}}}else{if(ge.electricInput){if(ge.electricInput.test(fb(gr,ga.line).text.slice(0,ga.ch))){ac(gc,ga.line,"smart")}}}}}fD(gc);gc.curOp.updateInput=gb;gc.curOp.typing=true;if(gf.length>1000||gf.indexOf("\n")>-1){gd.value=gc.display.prevInput=""}else{gc.display.prevInput=gf}if(gn){al(gc)}gc.state.pasteIncoming=gc.state.cutIncoming=false;return true}function fl(f8,gc){if(f8.display.contextMenuPending){return}var f9,gb,ge=f8.doc;if(f8.somethingSelected()){f8.display.prevInput="";var ga=ge.sel.primary();f9=c8&&(ga.to().line-ga.from().line>100||(gb=f8.getSelection()).length>1000);var gd=f9?"-":gb||f8.getSelection();f8.display.input.value=gd;if(f8.state.focused){dH(f8.display.input)}if(dG&&k>=9){f8.display.inputHasSelection=gd}}else{if(!gc){f8.display.prevInput=f8.display.input.value="";if(dG&&k>=9){f8.display.inputHasSelection=null}}}f8.display.inaccurateSelection=f9}function ev(f8){if(f8.options.readOnly!="nocursor"&&(!ec||dK()!=f8.display.input)){f8.display.input.focus()}}function r(f8){if(!f8.state.focused){ev(f8);cA(f8)}}function ai(f8){return f8.options.readOnly||f8.doc.cantEdit}function fM(f8){var ga=f8.display;bW(ga.scroller,"mousedown",c0(f8,ep));if(dG&&k<11){bW(ga.scroller,"dblclick",c0(f8,function(gd){if(aO(f8,gd)){return}var ge=cn(f8,gd);if(!ge||l(f8,gd)||a7(f8.display,gd)){return}cE(gd);var gc=f8.findWordAt(ge);fQ(f8.doc,gc.anchor,gc.head)}))}else{bW(ga.scroller,"dblclick",function(gc){aO(f8,gc)||cE(gc)})}bW(ga.lineSpace,"selectstart",function(gc){if(!a7(ga,gc)){cE(gc)}});if(!f0){bW(ga.scroller,"contextmenu",function(gc){ax(f8,gc)})}bW(ga.scroller,"scroll",function(){if(ga.scroller.clientHeight){O(f8,ga.scroller.scrollTop);bD(f8,ga.scroller.scrollLeft,true);aC(f8,"scroll",f8)}});bW(ga.scroller,"mousewheel",function(gc){b(f8,gc)});bW(ga.scroller,"DOMMouseScroll",function(gc){b(f8,gc)});bW(ga.wrapper,"scroll",function(){ga.wrapper.scrollTop=ga.wrapper.scrollLeft=0});bW(ga.input,"keyup",function(gc){bf.call(f8,gc)});bW(ga.input,"input",function(){if(dG&&k>=9&&f8.display.inputHasSelection){f8.display.inputHasSelection=null}cg(f8)});bW(ga.input,"keydown",c0(f8,p));bW(ga.input,"keypress",c0(f8,cx));bW(ga.input,"focus",cv(cA,f8));bW(ga.input,"blur",cv(aS,f8));function f9(gc){if(!aO(f8,gc)){en(gc)}}if(f8.options.dragDrop){bW(ga.scroller,"dragstart",function(gc){R(f8,gc)});bW(ga.scroller,"dragenter",f9);bW(ga.scroller,"dragover",f9);bW(ga.scroller,"drop",c0(f8,bh))}bW(ga.scroller,"paste",function(gc){if(a7(ga,gc)){return}f8.state.pasteIncoming=true;ev(f8);B(f8)});bW(ga.input,"paste",function(){if(cY&&!f8.state.fakedLastChar&&!(new Date-f8.state.lastMiddleDown<200)){var gd=ga.input.selectionStart,gc=ga.input.selectionEnd;ga.input.value+="$";ga.input.selectionEnd=gc;ga.input.selectionStart=gd;f8.state.fakedLastChar=true}f8.state.pasteIncoming=true;B(f8)});function gb(gg){if(f8.somethingSelected()){bj=f8.getSelections();if(ga.inaccurateSelection){ga.prevInput="";ga.inaccurateSelection=false;ga.input.value=bj.join("\n");dH(ga.input)}}else{var gh=[],gd=[];for(var ge=0;gega-400&&ce(db.pos,gf)==0){gc="triple"}else{if(dk&&dk.time>ga-400&&ce(dk.pos,gf)==0){gc="double";db={time:ga,pos:gf}}else{gc="single";dk={time:ga,pos:gf}}}var gd=f9.doc.sel,f8=b6?ge.metaKey:ge.ctrlKey,gb;if(f9.options.dragDrop&&eH&&!ai(f9)&&gc=="single"&&(gb=gd.contains(gf))>-1&&!gd.ranges[gb].empty()){a0(f9,ge,gf,f8)}else{m(f9,ge,gf,gc,f8)}}function a0(ga,gc,gd,f9){var gb=ga.display;var f8=c0(ga,function(ge){if(cY){gb.scroller.draggable=false}ga.state.draggingText=false;d9(document,"mouseup",f8);d9(gb.scroller,"drop",f8);if(Math.abs(gc.clientX-ge.clientX)+Math.abs(gc.clientY-ge.clientY)<10){cE(ge);if(!f9){fQ(ga.doc,gd)}ev(ga);if(dG&&k==9){setTimeout(function(){document.body.focus();ev(ga)},20)}}});if(cY){gb.scroller.draggable=true}ga.state.draggingText=f8;if(gb.scroller.dragDrop){gb.scroller.dragDrop()}bW(document,"mouseup",f8);bW(gb.scroller,"drop",f8)}function m(gc,gq,gb,f9,ge){var gn=gc.display,gs=gc.doc;cE(gq);var ga,gr,gd=gs.sel,f8=gd.ranges;if(ge&&!gq.shiftKey){gr=gs.sel.contains(gb);if(gr>-1){ga=f8[gr]}else{ga=new dU(gb,gb)}}else{ga=gs.sel.primary()}if(gq.altKey){f9="rect";if(!ge){ga=new dU(gb,gb)}gb=cn(gc,gq,true,true);gr=-1}else{if(f9=="double"){var go=gc.findWordAt(gb);if(gc.display.shift||gs.extend){ga=fs(gs,ga,go.anchor,go.head)}else{ga=go}}else{if(f9=="triple"){var gh=new dU(X(gb.line,0),fG(gs,X(gb.line+1,0)));if(gc.display.shift||gs.extend){ga=fs(gs,ga,gh.anchor,gh.head)}else{ga=gh}}else{ga=fs(gs,ga,gb)}}}if(!ge){gr=0;bT(gs,new fU([ga],0),N);gd=gs.sel}else{if(gr==-1){gr=f8.length;bT(gs,cw(f8.concat([ga]),gr),{scroll:false,origin:"*mouse"})}else{if(f8.length>1&&f8[gr].empty()&&f9=="single"){bT(gs,cw(f8.slice(0,gr).concat(f8.slice(gr+1)),0));gd=gs.sel}else{e(gs,gr,ga,N)}}}var gm=gb;function gl(gD){if(ce(gm,gD)==0){return}gm=gD;if(f9=="rect"){var gu=[],gA=gc.options.tabSize;var gt=bS(fb(gs,gb.line).text,gb.ch,gA);var gG=bS(fb(gs,gD.line).text,gD.ch,gA);var gv=Math.min(gt,gG),gE=Math.max(gt,gG);for(var gH=Math.min(gb.line,gD.line),gx=Math.min(gc.lastLine(),Math.max(gb.line,gD.line));gH<=gx;gH++){var gF=fb(gs,gH).text,gw=em(gF,gv,gA);if(gv==gE){gu.push(new dU(X(gH,gw),X(gH,gw)))}else{if(gF.length>gw){gu.push(new dU(X(gH,gw),X(gH,em(gF,gE,gA))))}}}if(!gu.length){gu.push(new dU(gb,gb))}bT(gs,cw(gd.ranges.slice(0,gr).concat(gu),gr),{origin:"*mouse",scroll:false});gc.scrollIntoView(gD)}else{var gB=ga;var gy=gB.anchor,gC=gD;if(f9!="single"){if(f9=="double"){var gz=gc.findWordAt(gD)}else{var gz=new dU(X(gD.line,0),fG(gs,X(gD.line+1,0)))}if(ce(gz.anchor,gy)>0){gC=gz.head;gy=aq(gB.from(),gz.anchor)}else{gC=gz.anchor;gy=bw(gB.to(),gz.head)}}var gu=gd.ranges.slice(0);gu[gr]=new dU(fG(gs,gy),gC);bT(gs,cw(gu,gr),N)}}var gj=gn.wrapper.getBoundingClientRect();var gf=0;function gp(gv){var gt=++gf;var gx=cn(gc,gv,true,f9=="rect");if(!gx){return}if(ce(gx,gm)!=0){r(gc);gl(gx);var gw=b5(gn,gs);if(gx.line>=gw.to||gx.linegj.bottom?20:0;if(gu){setTimeout(c0(gc,function(){if(gf!=gt){return}gn.scroller.scrollTop+=gu;gp(gv)}),50)}}}function gi(gt){gf=Infinity;cE(gt);ev(gc);d9(document,"mousemove",gk);d9(document,"mouseup",gg);gs.history.lastSelOrigin=null}var gk=c0(gc,function(gt){if(!fK(gt)){gi(gt)}else{gp(gt)}});var gg=c0(gc,gi);bW(document,"mousemove",gk);bW(document,"mouseup",gg)}function f6(gj,gf,gh,gi,gb){try{var f9=gf.clientX,f8=gf.clientY}catch(gf){return false}if(f9>=Math.floor(gj.display.gutters.getBoundingClientRect().right)){return false}if(gi){cE(gf)}var gg=gj.display;var ge=gg.lineDiv.getBoundingClientRect();if(f8>ge.bottom||!fe(gj,gh)){return bK(gf)}f8-=ge.top-gg.viewOffset;for(var gc=0;gc=f9){var gk=bF(gj.doc,f8);var ga=gj.options.gutters[gc];gb(gj,gh,gj,gk,ga,gf);return bK(gf)}}}function l(f8,f9){return f6(f8,f9,"gutterClick",true,ad)}var af=0;function bh(ge){var gg=this;if(aO(gg,ge)||a7(gg.display,ge)){return}cE(ge);if(dG){af=+new Date}var gf=cn(gg,ge,true),f8=ge.dataTransfer.files;if(!gf||ai(gg)){return}if(f8&&f8.length&&window.FileReader&&window.File){var ga=f8.length,gh=Array(ga),f9=0;var gc=function(gk,gj){var gi=new FileReader;gi.onload=c0(gg,function(){gh[gj]=gi.result;if(++f9==ga){gf=fG(gg.doc,gf);var gl={from:gf,to:gf,text:aX(gh.join("\n")),origin:"paste"};bd(gg.doc,gl);e3(gg.doc,eO(gf,cV(gl)))}});gi.readAsText(gk)};for(var gd=0;gd-1){gg.state.draggingText(ge);setTimeout(cv(ev,gg),20);return}try{var gh=ge.dataTransfer.getData("Text");if(gh){if(gg.state.draggingText&&!(b6?ge.metaKey:ge.ctrlKey)){var gb=gg.listSelections()}el(gg.doc,eO(gf,gf));if(gb){for(var gd=0;gdgf.clientWidth||gj&&gf.scrollHeight>gf.clientHeight)){return}if(gj&&b6&&cY){outer:for(var gi=ga.target,ge=gc.view;gi!=gf;gi=gi.parentNode){for(var f9=0;f9=9){f8.display.inputHasSelection=null}B(f8)}function cA(f8){if(f8.options.readOnly=="nocursor"){return}if(!f8.state.focused){aC(f8,"focus",f8);f8.state.focused=true;fx(f8.display.wrapper,"CodeMirror-focused");if(!f8.curOp&&f8.display.selForContextMenu!=f8.doc.sel){fl(f8);if(cY){setTimeout(cv(fl,f8,true),0)}}}bl(f8);o(f8)}function aS(f8){if(f8.state.focused){aC(f8,"blur",f8);f8.state.focused=false;f(f8.display.wrapper,"CodeMirror-focused")}clearInterval(f8.display.blinker);setTimeout(function(){if(!f8.state.focused){f8.display.shift=false}},150)}function ax(gh,gc){if(aO(gh,gc,"contextmenu")){return}var ge=gh.display;if(a7(ge,gc)||de(gh,gc)){return}var gg=cn(gh,gc),f8=ge.scroller.scrollTop;if(!gg||dY){return}var gb=gh.options.resetSelectionOnContextMenu;if(gb&&gh.doc.sel.contains(gg)==-1){c0(gh,bT)(gh.doc,eO(gg),Z)}var gd=ge.input.style.cssText;ge.inputDiv.style.position="absolute";ge.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(gc.clientY-5)+"px; left: "+(gc.clientX-5)+"px; z-index: 1000; background: "+(dG?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";if(cY){var gi=window.scrollY}ev(gh);if(cY){window.scrollTo(null,gi)}fl(gh);if(!gh.somethingSelected()){ge.input.value=ge.prevInput=" "}ge.contextMenuPending=true;ge.selForContextMenu=gh.doc.sel;clearTimeout(ge.detectingSelectAll);function ga(){if(ge.input.selectionStart!=null){var gj=gh.somethingSelected();var gk=ge.input.value="\u200b"+(gj?ge.input.value:"");ge.prevInput=gj?"":"\u200b";ge.input.selectionStart=1;ge.input.selectionEnd=gk.length;ge.selForContextMenu=gh.doc.sel}}function gf(){ge.contextMenuPending=false;ge.inputDiv.style.position="relative";ge.input.style.cssText=gd;if(dG&&k<9){ge.scrollbars.setScrollTop(ge.scroller.scrollTop=f8)}bl(gh);if(ge.input.selectionStart!=null){if(!dG||(dG&&k<9)){ga()}var gj=0,gk=function(){if(ge.selForContextMenu==gh.doc.sel&&ge.input.selectionStart==0){c0(gh,ez.selectAll)(gh)}else{if(gj++<10){ge.detectingSelectAll=setTimeout(gk,500)}else{fl(gh)}}};ge.detectingSelectAll=setTimeout(gk,200)}}if(dG&&k>=9){ga()}if(f0){en(gc);var f9=function(){d9(window,"mouseup",f9);setTimeout(gf,20)};bW(window,"mouseup",f9)}else{setTimeout(gf,50)}}function de(f8,f9){if(!fe(f8,"gutterContextMenu")){return false}return f6(f8,f9,"gutterContextMenu",false,aC)}var cV=I.changeEnd=function(f8){if(!f8.text){return f8.to}return X(f8.from.line+f8.text.length-1,fE(f8.text).length+(f8.text.length==1?f8.from.ch:0))};function bY(gb,ga){if(ce(gb,ga.from)<0){return gb}if(ce(gb,ga.to)<=0){return cV(ga)}var f8=gb.line+ga.text.length-(ga.to.line-ga.from.line)-1,f9=gb.ch;if(gb.line==ga.to.line){f9+=cV(ga).ch-ga.to.ch}return X(f8,f9)}function fg(gb,gc){var f9=[];for(var ga=0;ga=0;--f8){L(gb,{from:f9[f8].from,to:f9[f8].to,text:f8?[""]:gc.text})}}else{L(gb,gc)}}function L(ga,gb){if(gb.text.length==1&&gb.text[0]==""&&ce(gb.from,gb.to)==0){return}var f9=fg(ga,gb);fJ(ga,gb,f9,ga.cm?ga.cm.curOp.id:NaN);ea(ga,gb,f9,eg(ga,gb));var f8=[];d3(ga,function(gd,gc){if(!gc&&df(f8,gd.history)==-1){dA(gd.history,gb);f8.push(gd.history)}ea(gd,gb,null,eg(gd,gb))})}function b7(gj,gh,gl){if(gj.cm&&gj.cm.state.suppressEdits){return}var gg=gj.history,ga,gc=gj.sel;var f8=gh=="undo"?gg.done:gg.undone,gk=gh=="undo"?gg.undone:gg.done;for(var gd=0;gd=0;--gd){var gi=ga.changes[gd];gi.origin=gh;if(gb&&!dN(gj,gi,false)){f8.length=0;return}gf.push(dr(gj,gi));var f9=gd?fg(gj,gi):fE(f8);ea(gj,gi,f9,d5(gj,gi));if(!gd&&gj.cm){gj.cm.scrollIntoView({from:gi.from,to:cV(gi)})}var ge=[];d3(gj,function(gn,gm){if(!gm&&df(ge,gn.history)==-1){dA(gn.history,gi);ge.push(gn.history)}ea(gn,gi,null,d5(gn,gi))})}}function fj(f9,gb){if(gb==0){return}f9.first+=gb;f9.sel=new fU(bR(f9.sel.ranges,function(gc){return new dU(X(gc.anchor.line+gb,gc.anchor.ch),X(gc.head.line+gb,gc.head.ch))}),f9.sel.primIndex);if(f9.cm){ag(f9.cm,f9.first,f9.first-gb,gb);for(var ga=f9.cm.display,f8=ga.viewFrom;f8gc.lastLine()){return}if(gd.from.linega){gd={from:gd.from,to:X(ga,fb(gc,ga).text.length),text:[gd.text[0]],origin:gd.origin}}gd.removed=fV(gc,gd.from,gd.to);if(!gb){gb=fg(gc,gd)}if(gc.cm){aH(gc.cm,gd,f9)}else{fv(gc,gd,f9)}el(gc,gb,Z)}function aH(gj,gf,gd){var gi=gj.doc,ge=gj.display,gg=gf.from,gh=gf.to;var f8=false,gc=gg.line;if(!gj.options.lineWrapping){gc=bM(y(fb(gi,gg.line)));gi.iter(gc,gh.line+1,function(gl){if(gl==ge.maxLine){f8=true;return true}})}if(gi.sel.contains(gf.from,gf.to)>-1){W(gj)}fv(gi,gf,gd,bb(gj));if(!gj.options.lineWrapping){gi.iter(gc,gg.line+gf.text.length,function(gm){var gl=ej(gm);if(gl>ge.maxLineLength){ge.maxLine=gm;ge.maxLineLength=gl;ge.maxLineChanged=true;f8=false}});if(f8){gj.curOp.updateMaxLine=true}}gi.frontier=Math.min(gi.frontier,gg.line);eb(gj,400);var gk=gf.text.length-(gh.line-gg.line)-1;if(gf.full){ag(gj)}else{if(gg.line==gh.line&&gf.text.length==1&&!dO(gj.doc,gf)){S(gj,gg.line,"text")}else{ag(gj,gg.line,gh.line+1,gk)}}var ga=fe(gj,"changes"),gb=fe(gj,"change");if(gb||ga){var f9={from:gg,to:gh,text:gf.text,removed:gf.removed,origin:gf.origin};if(gb){ad(gj,"change",gj,f9)}if(ga){(gj.curOp.changeObjs||(gj.curOp.changeObjs=[])).push(f9)}}gj.display.selForContextMenu=null}function aY(gb,ga,gd,gc,f8){if(!gc){gc=gd}if(ce(gc,gd)<0){var f9=gc;gc=gd;gd=f9}if(typeof ga=="string"){ga=aX(ga)}bd(gb,{from:gd,to:gc,text:ga,origin:f8})}function d2(f9,gc){if(aO(f9,"scrollCursorIntoView")){return}var gd=f9.display,ga=gd.sizer.getBoundingClientRect(),f8=null;if(gc.top+ga.top<0){f8=true}else{if(gc.bottom+ga.top>(window.innerHeight||document.documentElement.clientHeight)){f8=false}}if(f8!=null&&!fr){var gb=fT("div","\u200b",null,"position: absolute; top: "+(gc.top-gd.viewOffset-e4(f9.display))+"px; height: "+(gc.bottom-gc.top+cR(f9)+gd.barHeight)+"px; left: "+gc.left+"px; width: 2px;");f9.display.lineSpace.appendChild(gb);gb.scrollIntoView(f8);f9.display.lineSpace.removeChild(gb)}}function E(gi,gg,gc,gb){if(gb==null){gb=0}for(var gd=0;gd<5;gd++){var ge=false,gh=dQ(gi,gg);var f8=!gc||gc==gg?gh:dQ(gi,gc);var ga=H(gi,Math.min(gh.left,f8.left),Math.min(gh.top,f8.top)-gb,Math.max(gh.left,f8.left),Math.max(gh.bottom,f8.bottom)+gb);var gf=gi.doc.scrollTop,f9=gi.doc.scrollLeft;if(ga.scrollTop!=null){O(gi,ga.scrollTop);if(Math.abs(gi.doc.scrollTop-gf)>1){ge=true}}if(ga.scrollLeft!=null){bD(gi,ga.scrollLeft);if(Math.abs(gi.doc.scrollLeft-f9)>1){ge=true}}if(!ge){break}}return gh}function F(f8,ga,gc,f9,gb){var gd=H(f8,ga,gc,f9,gb);if(gd.scrollTop!=null){O(f8,gd.scrollTop)}if(gd.scrollLeft!=null){bD(f8,gd.scrollLeft)}}function H(gk,gb,gj,f9,gi){var gg=gk.display,ge=aU(gk.display);if(gj<0){gj=0}var gc=gk.curOp&&gk.curOp.scrollTop!=null?gk.curOp.scrollTop:gg.scroller.scrollTop;var gm=cT(gk),go={};if(gi-gj>gm){gi=gj+gm}var ga=gk.doc.height+bH(gg);var f8=gjga-ge;if(gjgc+gm){var gh=Math.min(gj,(gf?ga:gi)-gm);if(gh!=gc){go.scrollTop=gh}}}var gn=gk.curOp&&gk.curOp.scrollLeft!=null?gk.curOp.scrollLeft:gg.scroller.scrollLeft;var gl=di(gk)-(gk.options.fixedGutter?gg.gutters.offsetWidth:0);var gd=f9-gb>gl;if(gd){f9=gb+gl}if(gb<10){go.scrollLeft=0}else{if(gbgl+gn-3){go.scrollLeft=f9+(gd?0:10)-gl}}}return go}function cJ(f8,ga,f9){if(ga!=null||f9!=null){fz(f8)}if(ga!=null){f8.curOp.scrollLeft=(f8.curOp.scrollLeft==null?f8.doc.scrollLeft:f8.curOp.scrollLeft)+ga}if(f9!=null){f8.curOp.scrollTop=(f8.curOp.scrollTop==null?f8.doc.scrollTop:f8.curOp.scrollTop)+f9}}function fD(f8){fz(f8);var f9=f8.getCursor(),gb=f9,ga=f9;if(!f8.options.lineWrapping){gb=f9.ch?X(f9.line,f9.ch-1):f9;ga=X(f9.line,f9.ch+1)}f8.curOp.scrollToPos={from:gb,to:ga,margin:f8.options.cursorScrollMargin,isCursor:true}}function fz(f8){var ga=f8.curOp.scrollToPos;if(ga){f8.curOp.scrollToPos=null;var gc=dD(f8,ga.from),gb=dD(f8,ga.to);var f9=H(f8,Math.min(gc.left,gb.left),Math.min(gc.top,gb.top)-ga.margin,Math.max(gc.right,gb.right),Math.max(gc.bottom,gb.bottom)+ga.margin);f8.scrollTo(f9.scrollLeft,f9.scrollTop)}}function ac(gl,gb,gk,ga){var gj=gl.doc,f9;if(gk==null){gk="add"}if(gk=="smart"){if(!gj.mode.indent){gk="prev"}else{f9=dx(gl,gb)}}var gf=gl.options.tabSize;var gm=fb(gj,gb),ge=bS(gm.text,null,gf);if(gm.stateAfter){gm.stateAfter=null}var f8=gm.text.match(/^\s*/)[0],gh;if(!ga&&!/\S/.test(gm.text)){gh=0;gk="not"}else{if(gk=="smart"){gh=gj.mode.indent(f9,gm.text.slice(f8.length),gm.text);if(gh==b9||gh>150){if(!ga){return}gk="prev"}}}if(gk=="prev"){if(gb>gj.first){gh=bS(fb(gj,gb-1).text,null,gf)}else{gh=0}}else{if(gk=="add"){gh=ge+gl.options.indentUnit}else{if(gk=="subtract"){gh=ge-gl.options.indentUnit}else{if(typeof gk=="number"){gh=ge+gk}}}}gh=Math.max(0,gh);var gi="",gg=0;if(gl.options.indentWithTabs){for(var gc=Math.floor(gh/gf);gc;--gc){gg+=gf;gi+="\t"}}if(gg=0;gf--){aY(f8.doc,"",gc[gf].from,gc[gf].to,"+delete")}fD(f8)})}function bv(gq,gc,gk,gj,ge){var gh=gc.line,gi=gc.ch,gp=gk;var f9=fb(gq,gh);var gn=true;function go(){var gr=gh+gk;if(gr=gq.first+gq.size){return(gn=false)}gh=gr;return f9=fb(gq,gr)}function gm(gs){var gr=(ge?u:ah)(f9,gi,gk,true);if(gr==null){if(!gs&&go()){if(ge){gi=(gk<0?cQ:cD)(f9)}else{gi=gk<0?f9.text.length:0}}else{return(gn=false)}}else{gi=gr}return true}if(gj=="char"){gm()}else{if(gj=="column"){gm(true)}else{if(gj=="word"||gj=="group"){var gl=null,gf=gj=="group";var f8=gq.cm&&gq.cm.getHelper(gc,"wordChars");for(var gd=true;;gd=false){if(gk<0&&!gm(!gd)){break}var ga=f9.text.charAt(gi)||"\n";var gb=cz(ga,f8)?"w":gf&&ga=="\n"?"n":!gf||/\s/.test(ga)?null:"p";if(gf&&!gd&&!gb){gb="s"}if(gl&&gl!=gb){if(gk<0){gk=1;gm()}break}if(gb){gl=gb}if(gk>0&&!gm(!gd)){break}}}}}var gg=bU(gq,X(gh,gi),gp,true);if(!gn){gg.hitSide=true}return gg}function bp(gg,gb,f8,gf){var ge=gg.doc,gd=gb.left,gc;if(gf=="page"){var ga=Math.min(gg.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);gc=gb.top+f8*(ga-(f8<0?1.5:0.5)*aU(gg.display))}else{if(gf=="line"){gc=f8>0?gb.bottom+3:gb.top-3}}for(;;){var f9=fL(gg,gd,gc);if(!f9.outside){break}if(f8<0?gc<=0:gc>=ge.height){f9.hitSide=true;break}gc+=f8*5}return f9}I.prototype={constructor:I,focus:function(){window.focus();ev(this);B(this)},setOption:function(ga,gb){var f9=this.options,f8=f9[ga];if(f9[ga]==gb&&ga!="mode"){return}f9[ga]=gb;if(bc.hasOwnProperty(ga)){c0(this,bc[ga])(this,gb,f8)}},getOption:function(f8){return this.options[f8]},getDoc:function(){return this.doc},addKeyMap:function(f9,f8){this.state.keyMaps[f8?"push":"unshift"](fR(f9))},removeKeyMap:function(f9){var ga=this.state.keyMaps;for(var f8=0;f80){e(this.doc,gd,new dU(gf,ga[gd].to()),Z)}}else{if(ge.head.line>gb){ac(this,ge.head.line,gh,true);gb=ge.head.line;if(gd==this.doc.sel.primIndex){fD(this)}}}}}),getTokenAt:function(f9,f8){return cq(this,f9,f8)},getLineTokens:function(f9,f8){return cq(this,X(f9),f8,true)},getTokenTypeAt:function(gf){gf=fG(this.doc,gf);var gb=c4(this,fb(this.doc,gf.line));var gd=0,ge=(gb.length-1)/2,ga=gf.ch;var f9;if(ga==0){f9=gb[2]}else{for(;;){var f8=(gd+ge)>>1;if((f8?gb[f8*2-1]:0)>=ga){ge=f8}else{if(gb[f8*2+1]gb){f9=gb;f8=true}}var ga=fb(this.doc,f9);return eM(this,ga,{top:0,left:0},gc||"page").top+(f8?this.doc.height-bL(ga):0)},defaultTextHeight:function(){return aU(this.display)},defaultCharWidth:function(){return dz(this.display)},setGutterMarker:c6(function(f8,f9,ga){return eu(this.doc,f8,"gutter",function(gb){var gc=gb.gutterMarkers||(gb.gutterMarkers={});gc[f9]=ga;if(!ga&&eQ(gc)){gb.gutterMarkers=null}return true})}),clearGutter:c6(function(ga){var f8=this,gb=f8.doc,f9=gb.first;gb.iter(function(gc){if(gc.gutterMarkers&&gc.gutterMarkers[ga]){gc.gutterMarkers[ga]=null;S(f8,f9,"gutter");if(eQ(gc.gutterMarkers)){gc.gutterMarkers=null}}++f9})}),addLineWidget:c6(function(ga,f9,f8){return bG(this,ga,f9,f8)}),removeLineWidget:function(f8){f8.clear()},lineInfo:function(f8){if(typeof f8=="number"){if(!b8(this.doc,f8)){return null}var f9=f8;f8=fb(this.doc,f8);if(!f8){return null}}else{var f9=bM(f8);if(f9==null){return null}}return{line:f9,handle:f8,text:f8.text,gutterMarkers:f8.gutterMarkers,textClass:f8.textClass,bgClass:f8.bgClass,wrapClass:f8.wrapClass,widgets:f8.widgets}},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(gd,ga,gf,gb,gh){var gc=this.display;gd=dQ(this,fG(this.doc,gd));var ge=gd.bottom,f9=gd.left;ga.style.position="absolute";ga.setAttribute("cm-ignore-events","true");gc.sizer.appendChild(ga);if(gb=="over"){ge=gd.top}else{if(gb=="above"||gb=="near"){var f8=Math.max(gc.wrapper.clientHeight,this.doc.height),gg=Math.max(gc.sizer.clientWidth,gc.lineSpace.clientWidth);if((gb=="above"||gd.bottom+ga.offsetHeight>f8)&&gd.top>ga.offsetHeight){ge=gd.top-ga.offsetHeight}else{if(gd.bottom+ga.offsetHeight<=f8){ge=gd.bottom}}if(f9+ga.offsetWidth>gg){f9=gg-ga.offsetWidth}}}ga.style.top=ge+"px";ga.style.left=ga.style.right="";if(gh=="right"){f9=gc.sizer.clientWidth-ga.offsetWidth;ga.style.right="0px"}else{if(gh=="left"){f9=0}else{if(gh=="middle"){f9=(gc.sizer.clientWidth-ga.offsetWidth)/2}}ga.style.left=f9+"px"}if(gf){F(this,f9,ge,f9+ga.offsetWidth,ge+ga.offsetHeight)}},triggerOnKeyDown:c6(p),triggerOnKeyPress:c6(cx),triggerOnKeyUp:bf,execCommand:function(f8){if(ez.hasOwnProperty(f8)){return ez[f8](this)}},findPosH:function(ge,gb,gc,f9){var f8=1;if(gb<0){f8=-1;gb=-gb}for(var ga=0,gd=fG(this.doc,ge);ga0&&f8(gb.charAt(ge-1))){--ge}while(ga0.5){Y(this)}aC(this,"refresh",this)}),swapDoc:c6(function(f9){var f8=this.doc;f8.cm=null;d7(this,f9);aj(this);fl(this);this.scrollTo(f9.scrollLeft,f9.scrollTop);this.curOp.forceScroll=true;ad(this,"swapDoc",this,f8);return f8}),getInputField:function(){return this.display.input},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}};bx(I);var eZ=I.defaults={};var bc=I.optionHandlers={};function s(f8,gb,ga,f9){I.defaults[f8]=gb;if(ga){bc[f8]=f9?function(gc,ge,gd){if(gd!=cb){ga(gc,ge,gd)}}:ga}}var cb=I.Init={toString:function(){return"CodeMirror.Init"}};s("value","",function(f8,f9){f8.setValue(f9)},true);s("mode",null,function(f8,f9){f8.doc.modeOption=f9;bq(f8)},true);s("indentUnit",2,bq,true);s("indentWithTabs",false);s("smartIndent",true);s("tabSize",4,function(f8){eh(f8);aj(f8);ag(f8)},true);s("specialChars",/[\t\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g,function(f8,f9){f8.options.specialChars=new RegExp(f9.source+(f9.test("\t")?"":"|\t"),"g");f8.refresh()},true);s("specialCharPlaceholder",e8,function(f8){f8.refresh()},true);s("electricChars",true);s("rtlMoveVisually",!aM);s("wholeLineUpdateBefore",true);s("theme","default",function(f8){cM(f8);ds(f8)},true);s("keyMap","default",function(f8,gc,f9){var ga=fR(gc);var gb=f9!=I.Init&&fR(f9);if(gb&&gb.detach){gb.detach(f8,ga)}if(ga.attach){ga.attach(f8,gb||null)}});s("extraKeys",null);s("lineWrapping",false,eC,true);s("gutters",[],function(f8){cd(f8.options);ds(f8)},true);s("fixedGutter",true,function(f8,f9){f8.display.gutters.style.left=f9?dT(f8.display)+"px":"0";f8.refresh()},true);s("coverGutterNextToScrollbar",false,function(f8){eU(f8)},true);s("scrollbarStyle","native",function(f8){aB(f8);eU(f8);f8.display.scrollbars.setScrollTop(f8.doc.scrollTop);f8.display.scrollbars.setScrollLeft(f8.doc.scrollLeft)},true);s("lineNumbers",false,function(f8){cd(f8.options);ds(f8)},true);s("firstLineNumber",1,ds,true);s("lineNumberFormatter",function(f8){return f8},ds,true);s("showCursorWhenSelecting",false,bB,true);s("resetSelectionOnContextMenu",true);s("readOnly",false,function(f8,f9){if(f9=="nocursor"){aS(f8);f8.display.input.blur();f8.display.disabled=true}else{f8.display.disabled=false;if(!f9){fl(f8)}}});s("disableInput",false,function(f8,f9){if(!f9){fl(f8)}},true);s("dragDrop",true);s("cursorBlinkRate",530);s("cursorScrollMargin",0);s("cursorHeight",1,bB,true);s("singleCursorHeightPerLine",true,bB,true);s("workTime",100);s("workDelay",100);s("flattenSpans",true,eh,true);s("addModeClass",false,eh,true);s("pollInterval",100);s("undoDepth",200,function(f8,f9){f8.doc.history.undoDepth=f9});s("historyEventDelay",1250);s("viewportMargin",10,function(f8){f8.refresh()},true);s("maxHighlightLength",10000,eh,true);s("moveInputWithCursor",true,function(f8,f9){if(!f9){f8.display.inputDiv.style.top=f8.display.inputDiv.style.left=0}});s("tabindex",null,function(f8,f9){f8.display.input.tabIndex=f9||""});s("autofocus",null);var dp=I.modes={},aP=I.mimeModes={};I.defineMode=function(f8,f9){if(!I.defaults.mode&&f8!="null"){I.defaults.mode=f8}if(arguments.length>2){f9.dependencies=Array.prototype.slice.call(arguments,2)}dp[f8]=f9};I.defineMIME=function(f9,f8){aP[f9]=f8};I.resolveMode=function(f8){if(typeof f8=="string"&&aP.hasOwnProperty(f8)){f8=aP[f8]}else{if(f8&&typeof f8.name=="string"&&aP.hasOwnProperty(f8.name)){var f9=aP[f8.name];if(typeof f9=="string"){f9={name:f9}}f8=ck(f9,f8);f8.name=f9.name}else{if(typeof f8=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(f8)){return I.resolveMode("application/xml")}}}if(typeof f8=="string"){return{name:f8}}else{return f8||{name:"null"}}};I.getMode=function(f9,f8){var f8=I.resolveMode(f8);var gb=dp[f8.name];if(!gb){return I.getMode(f9,"text/plain")}var gc=gb(f9,f8);if(dl.hasOwnProperty(f8.name)){var ga=dl[f8.name];for(var gd in ga){if(!ga.hasOwnProperty(gd)){continue}if(gc.hasOwnProperty(gd)){gc["_"+gd]=gc[gd]}gc[gd]=ga[gd]}}gc.name=f8.name;if(f8.helperType){gc.helperType=f8.helperType}if(f8.modeProps){for(var gd in f8.modeProps){gc[gd]=f8.modeProps[gd]}}return gc};I.defineMode("null",function(){return{token:function(f8){f8.skipToEnd()}}});I.defineMIME("text/plain","null");var dl=I.modeExtensions={};I.extendMode=function(ga,f9){var f8=dl.hasOwnProperty(ga)?dl[ga]:(dl[ga]={});aK(f9,f8)};I.defineExtension=function(f8,f9){I.prototype[f8]=f9};I.defineDocExtension=function(f8,f9){ar.prototype[f8]=f9};I.defineOption=s;var a5=[];I.defineInitHook=function(f8){a5.push(f8)};var fk=I.helpers={};I.registerHelper=function(f9,f8,ga){if(!fk.hasOwnProperty(f9)){fk[f9]=I[f9]={_global:[]}}fk[f9][f8]=ga};I.registerGlobalHelper=function(ga,f9,f8,gb){I.registerHelper(ga,f9,gb);fk[ga]._global.push({pred:f8,val:gb})};var b2=I.copyState=function(gb,f8){if(f8===true){return f8}if(gb.copyState){return gb.copyState(f8)}var ga={};for(var gc in f8){var f9=f8[gc];if(f9 instanceof Array){f9=f9.concat([])}ga[gc]=f9}return ga};var bZ=I.startState=function(ga,f9,f8){return ga.startState?ga.startState(f9,f8):true};I.innerMode=function(ga,f8){while(ga.innerMode){var f9=ga.innerMode(f8);if(!f9||f9.mode==ga){break}f8=f9.state;ga=f9.mode}return f9||{mode:ga,state:f8}};var ez=I.commands={selectAll:function(f8){f8.setSelection(X(f8.firstLine(),0),X(f8.lastLine()),Z)},singleSelection:function(f8){f8.setSelection(f8.getCursor("anchor"),f8.getCursor("head"),Z)},killLine:function(f8){eT(f8,function(ga){if(ga.empty()){var f9=fb(f8.doc,ga.head.line).text.length;if(ga.head.ch==f9&&ga.head.line0){ge=new X(ge.line,ge.ch+1);f8.replaceRange(f9.charAt(ge.ch-1)+f9.charAt(ge.ch-2),X(ge.line,ge.ch-2),ge,"+transpose")}else{if(ge.line>f8.doc.first){var gd=fb(f8.doc,ge.line-1).text;if(gd){f8.replaceRange(f9.charAt(0)+"\n"+gd.charAt(gd.length-1),X(ge.line-1,gd.length-1),X(ge.line,1),"+transpose")}}}}ga.push(new dU(ge,ge))}f8.setSelections(ga)})},newlineAndIndent:function(f8){cK(f8,function(){var f9=f8.listSelections().length;for(var gb=0;gb=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||undefined},next:function(){if(this.posf9},eatSpace:function(){var f8=this.pos;while(/[\s\u00a0]/.test(this.string.charAt(this.pos))){++this.pos}return this.pos>f8},skipToEnd:function(){this.pos=this.string.length},skipTo:function(f8){var f9=this.string.indexOf(f8,this.pos);if(f9>-1){this.pos=f9;return true}},backUp:function(f8){this.pos-=f8},column:function(){if(this.lastColumnPos0){return null}if(ga&&f9!==false){this.pos+=ga[0].length}return ga}},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(f9,f8){this.lineStart+=f9;try{return f8()}finally{this.lineStart-=f9}}};var Q=I.TextMarker=function(f9,f8){this.lines=[];this.type=f8;this.doc=f9};bx(Q);Q.prototype.clear=function(){if(this.explicitlyCleared){return}var gf=this.doc.cm,f9=gf&&!gf.curOp;if(f9){cG(gf)}if(fe(this,"clear")){var gg=this.find();if(gg){ad(this,"clear",gg.from,gg.to)}}var ga=null,gd=null;for(var gb=0;gbgf.display.maxLineLength){gf.display.maxLine=f8;gf.display.maxLineLength=gc;gf.display.maxLineChanged=true}}}if(ga!=null&&gf&&this.collapsed){ag(gf,ga,gd+1)}this.lines.length=0;this.explicitlyCleared=true;if(this.atomic&&this.doc.cantEdit){this.doc.cantEdit=false;if(gf){et(gf.doc)}}if(gf){ad(gf,"markerCleared",gf,this)}if(f9){al(gf)}if(this.parent){this.parent.clear()}};Q.prototype.find=function(gb,f9){if(gb==null&&this.type=="bookmark"){gb=1}var ge,gd;for(var ga=0;ga0||gh==0&&gb.clearWhenEmpty!==false){return gb}if(gb.replacedWith){gb.collapsed=true;gb.widgetNode=fT("span",[gb.replacedWith],"CodeMirror-widget");if(!gi.handleMouseEvents){gb.widgetNode.setAttribute("cm-ignore-events","true")}if(gi.insertLeft){gb.widgetNode.insertLeft=true}}if(gb.collapsed){if(z(gg,ge.line,ge,gf,gb)||ge.line!=gf.line&&z(gg,gf.line,ge,gf,gb)){throw new Error("Inserting collapsed marker partially overlapping an existing one")}a4=true}if(gb.addToHistory){fJ(gg,{from:ge,to:gf,origin:"markText"},gg.sel,NaN)}var f9=ge.line,gd=gg.cm,f8;gg.iter(f9,gf.line+1,function(gj){if(gd&&gb.collapsed&&!gd.options.lineWrapping&&y(gj)==gd.display.maxLine){f8=true}if(gb.collapsed&&f9!=ge.line){fW(gj,0)}cc(gj,new ee(gb,f9==ge.line?ge.ch:null,f9==gf.line?gf.ch:null));++f9});if(gb.collapsed){gg.iter(ge.line,gf.line+1,function(gj){if(ft(gg,gj)){fW(gj,0)}})}if(gb.clearOnEnter){bW(gb,"beforeCursorEnter",function(){gb.clear()})}if(gb.readOnly){f3=true;if(gg.history.done.length||gg.history.undone.length){gg.clearHistory()}}if(gb.collapsed){gb.id=++a2;gb.atomic=true}if(gd){if(f8){gd.curOp.updateMaxLine=true}if(gb.collapsed){ag(gd,ge.line,gf.line+1)}else{if(gb.className||gb.title||gb.startStyle||gb.endStyle||gb.css){for(var ga=ge.line;ga<=gf.line;ga++){S(gd,ga,"text")}}}if(gb.atomic){et(gd.doc)}ad(gd,"markerAdded",gd,gb)}return gb}var x=I.SharedTextMarker=function(ga,f9){this.markers=ga;this.primary=f9;for(var f8=0;f8=ga:gg.to>ga);(gf||(gf=[])).push(new ee(gd,gg.from,gb?null:gg.to))}}}return gf}function az(f9,gb,ge){if(f9){for(var gc=0,gf;gc=gb:gg.to>gb);if(ga||gg.from==gb&&gd.type=="bookmark"&&(!ge||gg.marker.insertLeft)){var f8=gg.from==null||(gd.inclusiveLeft?gg.from<=gb:gg.from0&&ge){for(var gb=0;gb0){continue}var gh=[gb,1],f8=ce(f9.from,ga.from),gg=ce(f9.to,ga.to);if(f8<0||!gf.inclusiveLeft&&!f8){gh.push({from:f9.from,to:ga.from})}if(gg>0||!gf.inclusiveRight&&!gg){gh.push({from:ga.to,to:f9.to})}gd.splice.apply(gd,gh);gb+=gh.length-1}}return gd}function fZ(f8){var ga=f8.markedSpans;if(!ga){return}for(var f9=0;f9=0&&gd<=0||gh<=0&&gd>=0){continue}if(gh<=0&&(ce(gi.to,ge)>0||(f9.marker.inclusiveRight&&gc.inclusiveLeft))||gh>=0&&(ce(gi.from,gf)<0||(f9.marker.inclusiveLeft&&gc.inclusiveRight))){return true}}}}function y(f9){var f8;while(f8=eK(f9)){f9=f8.find(-1,true).line}return f9}function h(ga){var f8,f9;while(f8=er(ga)){ga=f8.find(1,true).line;(f9||(f9=[])).push(ga)}return f9}function aT(gb,f9){var f8=fb(gb,f9),ga=y(f8);if(f8==ga){return f9}return bM(ga)}function dZ(gb,ga){if(ga>gb.lastLine()){return ga}var f9=fb(gb,ga),f8;if(!ft(gb,f9)){return ga}while(f8=er(f9)){f9=f8.find(1,true).line}return bM(f9)+1}function ft(gc,f9){var f8=a4&&f9.markedSpans;if(f8){for(var gb,ga=0;gagc.start){return ga}}throw new Error("Mode "+gd.name+" failed to advance stream.")}function cq(gh,gf,gc,gb){function f8(gk){return{start:gi.start,end:gi.pos,string:gi.current(),type:ga||null,state:gk?b2(gg.mode,f9):f9}}var gg=gh.doc,gd=gg.mode,ga;gf=fG(gg,gf);var gj=fb(gg,gf.line),f9=dx(gh,gf.line,gc);var gi=new eP(gj.text,gh.options.tabSize),ge;if(gb){ge=[]}while((gb||gi.posgi.options.maxHighlightLength){ga=false;if(gc){dt(gi,gk,f9,gj.pos)}gj.pos=gk.length;f8=null}else{f8=dg(ew(gd,gj,f9,gm),gb)}if(gm){var gl=gm[0].name;if(gl){f8="m-"+(f8?gl+" "+f8:gl)}}if(!ga||gf!=f8){while(gggi){gg.splice(ge,1,gi,gg[ge+1],gj)}ge+=2;ga=Math.min(gi,gj)}if(!gk){return}if(gd.opaque){gg.splice(gm,ge-gm,gi,"cm-overlay "+gk);ge=gm+2}else{for(;gmgb&&gc.from<=gb){break}}if(gc.to>=gd){return f9(gg,gi,ga,ge,gj,gh)}f9(gg,gi.slice(0,gc.to-gb),ga,ge,null,gh);ge=null;gi=gi.slice(gc.to-gb);gb=gc.to}}}function ab(f9,gb,f8,ga){var gc=!ga&&f8.widgetNode;if(gc){f9.map.push(f9.pos,f9.pos+gb,gc);f9.content.appendChild(gc)}f9.pos+=gb}function bn(gh,go,gg){var gd=gh.markedSpans,gf=gh.text,gm=0;if(!gd){for(var gr=1;grgc)){if(gq.to!=null&&gv>gq.to){gv=gq.to;gu=""}if(gn.className){f8+=" "+gn.className}if(gn.css){gi=gn.css}if(gn.startStyle&&gq.from==gc){gl+=" "+gn.startStyle}if(gn.endStyle&&gq.to==gv){gu+=" "+gn.endStyle}if(gn.title&&!gw){gw=gn.title}if(gn.collapsed&&(!ga||dM(ga.marker,gn)<0)){ga=gq}}else{if(gq.from>gc&&gv>gq.from){gv=gq.from}}if(gn.type=="bookmark"&&gq.from==gc&&gn.widgetNode){ge.push(gn)}}if(ga&&(ga.from||0)==gc){ab(go,(ga.to==null?gs+1:ga.to)-gc,ga.marker,ga.from==null);if(ga.to==null){return}}if(!ga&&ge.length){for(var gp=0;gp=gs){break}var gj=Math.min(gs,gv);while(true){if(gk){var f9=gc+gk.length;if(!ga){var gb=f9>gj?gk.slice(0,gj-gc):gk;go.addToken(go,gb,gt?gt+f8:f8,gl,gc+gb.length==gv?gu:"",gw,gi)}if(f9>=gj){gk=gk.slice(gj-gc);gc=gj;break}gc=f9;gl=""}gk=gf.slice(gm,gm=gg[gr++]);gt=eS(gg[gr++],go.cm.options)}}}function dO(f8,f9){return f9.from.ch==0&&f9.to.ch==0&&fE(f9.text)==""&&(!f8.cm||f8.cm.options.wholeLineUpdateBefore)}function fv(gl,gg,f9,gc){function gm(go){return f9?f9[go]:null}function ga(go,gq,gp){ei(go,gq,gp,gc);ad(go,"change",go,gg)}function f8(gr,gp){for(var gq=gr,go=[];gq1){gl.remove(gk.line+1,ge-1)}gl.insert(gk.line+1,gd)}}}}ad(gl,"change",gl,gg)}function eV(f9){this.lines=f9;this.parent=null;for(var ga=0,f8=0;ga1||!(this.children[0] instanceof eV))){var f9=[];this.collapse(f9);this.children=[new eV(f9)];this.children[0].parent=this}},collapse:function(f8){for(var f9=0;f950){while(gf.lines.length>50){var gc=gf.lines.splice(gf.lines.length-25,25);var gb=new eV(gc);gf.height-=gb.height;this.children.splice(gd+1,0,gb);gb.parent=this}this.maybeSpill()}break}f9-=ge}},maybeSpill:function(){if(this.children.length<=10){return}var gb=this;do{var f9=gb.children.splice(gb.children.length-5,5);var ga=new fu(f9);if(!gb.parent){var gc=new fu(gb.children);gc.parent=gb;gb.children=[gc,ga];gb=gc}else{gb.size-=ga.size;gb.height-=ga.height;var f8=df(gb.parent.children,gb);gb.parent.children.splice(f8+1,0,ga)}ga.parent=gb.parent}while(gb.children.length>10);gb.parent.maybeSpill()},iterN:function(f8,ge,gd){for(var f9=0;f9=0;gb--){bd(this,gc[gb])}if(f8){e3(this,f8)}else{if(this.cm){fD(this.cm)}}}),undo:cC(function(){b7(this,"undo")}),redo:cC(function(){b7(this,"redo")}),undoSelection:cC(function(){b7(this,"undo",true)}),redoSelection:cC(function(){b7(this,"redo",true)}),setExtending:function(f8){this.extend=f8},getExtending:function(){return this.extend},historySize:function(){var gb=this.history,f8=0,ga=0;for(var f9=0;f9=gc.ch)){gb.push(ga.marker.parent||ga.marker)}}}return gb},findMarks:function(gc,gb,f8){gc=fG(this,gc);gb=fG(this,gb);var f9=[],ga=gc.line;this.iter(gc.line,gb.line+1,function(gd){var gf=gd.markedSpans;if(gf){for(var ge=0;gegg.to||gg.from==null&&ga!=gc.line||ga==gb.line&&gg.from>gb.ch)&&(!f8||f8(gg.marker))){f9.push(gg.marker.parent||gg.marker)}}}++ga});return f9},getAllMarks:function(){var f8=[];this.iter(function(ga){var f9=ga.markedSpans;if(f9){for(var gb=0;gbf9){f8=f9;return true}f9-=gc;++ga});return fG(this,X(ga,f8))},indexFromPos:function(f9){f9=fG(this,f9);var f8=f9.ch;if(f9.linegb){gb=f8.from}if(f8.to!=null&&f8.to=gb.size){throw new Error("There is no line "+(gd+gb.first)+" in the document.")}for(var f8=gb;!f8.lines;){for(var f9=0;;++f9){var gc=f8.children[f9],ga=gc.chunkSize();if(gd1&&!f9.done[f9.done.length-2].ranges){f9.done.pop();return fE(f9.done)}}}}function fJ(ge,gc,f8,gb){var ga=ge.history;ga.undone.length=0;var f9=+new Date,gf;if((ga.lastOp==gb||ga.lastOrigin==gc.origin&&gc.origin&&((gc.origin.charAt(0)=="+"&&ge.cm&&ga.lastModTime>f9-ge.cm.options.historyEventDelay)||gc.origin.charAt(0)=="*"))&&(gf=eI(ga,ga.lastOp==gb))){var gg=fE(gf.changes);if(ce(gc.from,gc.to)==0&&ce(gc.from,gg.to)==0){gg.to=cV(gc)}else{gf.changes.push(dr(ge,gc))}}else{var gd=fE(ga.done);if(!gd||!gd.ranges){cL(ge.sel,ga.done)}gf={changes:[dr(ge,gc)],generation:ga.generation};ga.done.push(gf);while(ga.done.length>ga.undoDepth){ga.done.shift();if(!ga.done[0].ranges){ga.done.shift()}}}ga.done.push(f8);ga.generation=++ga.maxGeneration;ga.lastModTime=ga.lastSelTime=f9;ga.lastOp=ga.lastSelOp=gb;ga.lastOrigin=ga.lastSelOrigin=gc.origin;if(!gg){aC(ge,"historyAdded")}}function bz(gc,f8,ga,gb){var f9=f8.charAt(0);return f9=="*"||f9=="+"&&ga.ranges.length==gb.ranges.length&&ga.somethingSelected()==gb.somethingSelected()&&new Date-gc.history.lastSelTime<=(gc.cm?gc.cm.options.historyEventDelay:500)}function f2(gd,gb,f8,ga){var gc=gd.history,f9=ga&&ga.origin;if(f8==gc.lastSelOp||(f9&&gc.lastSelOrigin==f9&&(gc.lastModTime==gc.lastSelTime&&gc.lastOrigin==f9||bz(gd,f9,fE(gc.done),gb)))){gc.done[gc.done.length-1]=gb}else{cL(gb,gc.done)}gc.lastSelTime=+new Date;gc.lastSelOrigin=f9;gc.lastSelOp=f8;if(ga&&ga.clearRedo!==false){fy(gc.undone)}}function cL(f9,f8){var ga=fE(f8);if(!(ga&&ga.ranges&&ga.equals(f9))){f8.push(f9)}}function bX(f9,gd,gc,gb){var f8=gd["spans_"+f9.id],ga=0;f9.iter(Math.max(f9.first,gc),Math.min(f9.first+f9.size,gb),function(ge){if(ge.markedSpans){(f8||(f8=gd["spans_"+f9.id]={}))[ga]=ge.markedSpans}++ga})}function bi(ga){if(!ga){return null}for(var f9=0,f8;f9-1){fE(gh)[f8]=gf[f8];delete gf[f8]}}}}}}return f9}function J(gb,ga,f9,f8){if(f90}function bx(f8){f8.prototype.on=function(f9,ga){bW(this,f9,ga)};f8.prototype.off=function(f9,ga){d9(this,f9,ga)}}var dF=30;var b9=I.Pass={toString:function(){return"CodeMirror.Pass"}};var Z={scroll:false},N={origin:"*mouse"},cU={origin:"+move"};function f7(){this.id=null}f7.prototype.set=function(f8,f9){clearTimeout(this.id);this.id=setTimeout(f9,f8)};var bS=I.countColumn=function(gb,f9,gd,ge,ga){if(f9==null){f9=gb.search(/[^\s\u00a0]/);if(f9==-1){f9=gb.length}}for(var gc=ge||0,gf=ga||0;;){var f8=gb.indexOf("\t",gc);if(f8<0||f8>=f9){return gf+(f9-gc)}gf+=f8-gc;gf+=gd-(gf%gd);gc=f8+1}};function em(gc,gb,gd){for(var ge=0,ga=0;;){var f9=gc.indexOf("\t",ge);if(f9==-1){f9=gc.length}var f8=f9-ge;if(f9==gc.length||ga+f8>=gb){return ge+Math.min(f8,gb-ga)}ga+=f9-ge;ga+=gd-(ga%gd);ge=f9+1;if(ga>=gb){return ge}}}var aW=[""];function cp(f8){while(aW.length<=f8){aW.push(fE(aW)+" ")}return aW[f8]}function fE(f8){return f8[f8.length-1]}var dH=function(f8){f8.select()};if(eX){dH=function(f8){f8.selectionStart=0;f8.selectionEnd=f8.value.length}}else{if(dG){dH=function(f9){try{f9.select()}catch(f8){}}}}function df(ga,f8){for(var f9=0;f9"\x80"&&(f8.toUpperCase()!=f8.toLowerCase()||a9.test(f8))};function cz(f8,f9){if(!f9){return fA(f8)}if(f9.source.indexOf("\\w")>-1&&fA(f8)){return true}return f9.test(f8)}function eQ(f8){for(var f9 in f8){if(f8.hasOwnProperty(f9)&&f8[f9]){return false}}return true}var eF=/[\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]/;function fm(f8){return f8.charCodeAt(0)>=768&&eF.test(f8)}function fT(f8,gc,gb,ga){var gd=document.createElement(f8);if(gb){gd.className=gb}if(ga){gd.style.cssText=ga}if(typeof gc=="string"){gd.appendChild(document.createTextNode(gc))}else{if(gc){for(var f9=0;f90;--f8){f9.removeChild(f9.firstChild)}return f9}function bQ(f8,f9){return dX(f8).appendChild(f9)}function f1(f8,f9){if(f8.contains){return f8.contains(f9)}while(f9=f9.parentNode){if(f9==f8){return true}}}function dK(){return document.activeElement}if(dG&&k<11){dK=function(){try{return document.activeElement}catch(f8){return document.body}}}function T(f8){return new RegExp("(^|\\s)"+f8+"(?:$|\\s)\\s*")}var f=I.rmClass=function(ga,f8){var gb=ga.className;var f9=T(f8).exec(gb);if(f9){var gc=gb.slice(f9.index+f9[0].length);ga.className=gb.slice(0,f9.index)+(gc?f9[1]+gc:"")}};var fx=I.addClass=function(f9,f8){var ga=f9.className;if(!T(f8).test(ga)){f9.className+=(ga?" ":"")+f8}};function fO(ga,f8){var f9=ga.split(" ");for(var gb=0;gb2&&!(dG&&k<8)}}if(fI){return fT("span","\u200b")}else{return fT("span","\u00a0",null,"display: inline-block; width: 1px; margin-right: -1px")}}var fH;function bN(gb){if(fH!=null){return fH}var f8=bQ(gb,document.createTextNode("A\u062eA"));var ga=cl(f8,0,1).getBoundingClientRect();if(!ga||ga.left==ga.right){return false}var f9=cl(f8,1,2).getBoundingClientRect();return fH=(f9.right-ga.right<3)}var aX=I.splitLines="\n\nb".split(/\n/).length!=3?function(gd){var ge=0,f8=[],gc=gd.length;while(ge<=gc){var gb=gd.indexOf("\n",ge);if(gb==-1){gb=gd.length}var ga=gd.slice(ge,gd.charAt(gb-1)=="\r"?gb-1:gb);var f9=ga.indexOf("\r");if(f9!=-1){f8.push(ga.slice(0,f9));ge+=f9+1}else{f8.push(ga);ge=gb+1}}return f8}:function(f8){return f8.split(/\r\n?|\n/)};var br=window.getSelection?function(f9){try{return f9.selectionStart!=f9.selectionEnd}catch(f8){return false}}:function(ga){try{var f8=ga.ownerDocument.selection.createRange()}catch(f9){}if(!f8||f8.parentElement()!=ga){return false}return f8.compareEndPoints("StartToEnd",f8)!=0};var c8=(function(){var f8=fT("div");if("oncopy" in f8){return true}f8.setAttribute("oncopy","return;");return typeof f8.oncopy=="function"})();var e2=null;function aI(f9){if(e2!=null){return e2}var ga=bQ(f9,fT("span","x"));var gb=ga.getBoundingClientRect();var f8=cl(ga,0,1).getBoundingClientRect();return e2=Math.abs(gb.left-f8.left)>1}var fc={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",107:"=",109:"-",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"};I.keyNames=fc;(function(){for(var f8=0;f8<10;f8++){fc[f8+48]=fc[f8+96]=String(f8)}for(var f8=65;f8<=90;f8++){fc[f8]=String.fromCharCode(f8)}for(var f8=1;f8<=12;f8++){fc[f8+111]=fc[f8+63235]="F"+f8}})();function d0(f8,ge,gd,gc){if(!f8){return gc(ge,gd,"ltr")}var gb=false;for(var ga=0;gage||ge==gd&&f9.to==ge){gc(Math.max(f9.from,ge),Math.min(f9.to,gd),f9.level==1?"rtl":"ltr");gb=true}}if(!gb){gc(ge,gd,"ltr")}}function du(f8){return f8.level%2?f8.to:f8.from}function f4(f8){return f8.level%2?f8.from:f8.to}function cD(f9){var f8=a(f9);return f8?du(f8[0]):0}function cQ(f9){var f8=a(f9);if(!f8){return f9.text.length}return f4(fE(f8))}function bs(f9,gc){var ga=fb(f9.doc,gc);var gd=y(ga);if(gd!=ga){gc=bM(gd)}var f8=a(gd);var gb=!f8?0:f8[0].level%2?cQ(gd):cD(gd);return X(gc,gb)}function dL(ga,gd){var f9,gb=fb(ga.doc,gd);while(f9=er(gb)){gb=f9.find(1,true).line;gd=null}var f8=a(gb);var gc=!f8?gb.text.length:f8[0].level%2?cD(gb):cQ(gb);return X(gd==null?bM(gb):gd,gc)}function dE(f9,ge){var gd=bs(f9,ge.line);var ga=fb(f9.doc,gd.line);var f8=a(ga);if(!f8||f8[0].level==0){var gc=Math.max(0,ga.text.search(/\S/));var gb=ge.line==gd.line&&ge.ch<=gc&&ge.ch;return X(gd.line,gb?0:gc)}return gd}function am(f9,ga,f8){var gb=f9[0].level;if(ga==gb){return true}if(f8==gb){return false}return gagc){return f9}if((gb.from==gc||gb.to==gc)){if(ga==null){ga=f9}else{if(am(f8,gb.level,f8[ga].level)){if(gb.from!=gb.to){eY=ga}return f9}else{if(gb.from!=gb.to){eY=f9}return ga}}}}return ga}function fa(f8,gb,f9,ga){if(!ga){return gb+f9}do{gb+=f9}while(gb>0&&fm(f8.text.charAt(gb)));return gb}function u(f8,gf,ga,gb){var gc=a(f8);if(!gc){return ah(f8,gf,ga,gb)}var ge=aE(gc,gf),f9=gc[ge];var gd=fa(f8,gf,f9.level%2?-ga:ga,gb);for(;;){if(gd>f9.from&&gd0)==f9.level%2?f9.to:f9.from}else{f9=gc[ge+=ga];if(!f9){return null}if((ga>0)==f9.level%2){gd=fa(f8,f9.to,-1,gb)}else{gd=fa(f8,f9.from,1,gb)}}}}function ah(f8,gc,f9,ga){var gb=gc+f9;if(ga){while(gb>0&&fm(f8.text.charAt(gb))){gb+=f9}}return gb<0||gb>f8.text.length?null:gb}var be=(function(){var ge="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN";var gc="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm";function gb(gi){if(gi<=247){return ge.charAt(gi)}else{if(1424<=gi&&gi<=1524){return"R"}else{if(1536<=gi&&gi<=1773){return gc.charAt(gi-1536)}else{if(1774<=gi&&gi<=2220){return"r"}else{if(8192<=gi&&gi<=8203){return"w"}else{if(gi==8204){return"b"}else{return"L"}}}}}}}var f8=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;var gh=/[stwN]/,ga=/[LRr]/,f9=/[Lb1n]/,gd=/[1n]/;var gg="L";function gf(gk,gj,gi){this.level=gk;this.from=gj;this.to=gi}return function(gs){if(!f8.test(gs)){return false}var gy=gs.length,go=[];for(var gx=0,gk;gx= 15) { presto = false; webkit = true; } + // Some browsers use the wrong event properties to signal cmd/ctrl on OS X + var flipCtrlCmd = mac && (qtwebkit || presto && (presto_version == null || presto_version < 12.11)); + var captureRightClick = gecko || (ie && ie_version >= 9); + + // Optimize some code when these features are not used. + var sawReadOnlySpans = false, sawCollapsedSpans = false; + + // EDITOR CONSTRUCTOR + + // A CodeMirror instance represents an editor. This is the object + // that user code is usually dealing with. + + function CodeMirror(place, options) { + if (!(this instanceof CodeMirror)) return new CodeMirror(place, options); + + this.options = options = options ? copyObj(options) : {}; + // Determine effective options based on given values and defaults. + copyObj(defaults, options, false); + setGuttersForLineNumbers(options); + + var doc = options.value; + if (typeof doc == "string") doc = new Doc(doc, options.mode); + this.doc = doc; + + var input = new CodeMirror.inputStyles[options.inputStyle](this); + var display = this.display = new Display(place, doc, input); + display.wrapper.CodeMirror = this; + updateGutters(this); + themeChanged(this); + if (options.lineWrapping) + this.display.wrapper.className += " CodeMirror-wrap"; + if (options.autofocus && !mobile) display.input.focus(); + initScrollbars(this); + + this.state = { + keyMaps: [], // stores maps added by addKeyMap + overlays: [], // highlighting overlays, as added by addOverlay + modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info + overwrite: false, + delayingBlurEvent: false, + focused: false, + suppressEdits: false, // used to disable editing during key handlers when in readOnly mode + pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll + draggingText: false, + highlight: new Delayed(), // stores highlight worker timeout + keySeq: null, // Unfinished key sequence + specialChars: null + }; + + var cm = this; + + // Override magic textarea content restore that IE sometimes does + // on our hidden textarea on reload + if (ie && ie_version < 11) setTimeout(function() { cm.display.input.reset(true); }, 20); + + registerEventHandlers(this); + ensureGlobalHandlers(); + + startOperation(this); + this.curOp.forceUpdate = true; + attachDoc(this, doc); + + if ((options.autofocus && !mobile) || cm.hasFocus()) + setTimeout(bind(onFocus, this), 20); + else + onBlur(this); + + for (var opt in optionHandlers) if (optionHandlers.hasOwnProperty(opt)) + optionHandlers[opt](this, options[opt], Init); + maybeUpdateLineNumberWidth(this); + if (options.finishInit) options.finishInit(this); + for (var i = 0; i < initHooks.length; ++i) initHooks[i](this); + endOperation(this); + // Suppress optimizelegibility in Webkit, since it breaks text + // measuring on line wrapping boundaries. + if (webkit && options.lineWrapping && + getComputedStyle(display.lineDiv).textRendering == "optimizelegibility") + display.lineDiv.style.textRendering = "auto"; + } + + // DISPLAY CONSTRUCTOR + + // The display handles the DOM integration, both for input reading + // and content drawing. It holds references to DOM nodes and + // display-related state. + + function Display(place, doc, input) { + var d = this; + this.input = input; + + // Covers bottom-right square when both scrollbars are present. + d.scrollbarFiller = elt("div", null, "CodeMirror-scrollbar-filler"); + d.scrollbarFiller.setAttribute("cm-not-content", "true"); + // Covers bottom of gutter when coverGutterNextToScrollbar is on + // and h scrollbar is present. + d.gutterFiller = elt("div", null, "CodeMirror-gutter-filler"); + d.gutterFiller.setAttribute("cm-not-content", "true"); + // Will contain the actual code, positioned to cover the viewport. + d.lineDiv = elt("div", null, "CodeMirror-code"); + // Elements are added to these to represent selection and cursors. + d.selectionDiv = elt("div", null, null, "position: relative; z-index: 1"); + d.cursorDiv = elt("div", null, "CodeMirror-cursors"); + // A visibility: hidden element used to find the size of things. + d.measure = elt("div", null, "CodeMirror-measure"); + // When lines outside of the viewport are measured, they are drawn in this. + d.lineMeasure = elt("div", null, "CodeMirror-measure"); + // Wraps everything that needs to exist inside the vertically-padded coordinate system + d.lineSpace = elt("div", [d.measure, d.lineMeasure, d.selectionDiv, d.cursorDiv, d.lineDiv], + null, "position: relative; outline: none"); + // Moved around its parent to cover visible view. + d.mover = elt("div", [elt("div", [d.lineSpace], "CodeMirror-lines")], null, "position: relative"); + // Set to the height of the document, allowing scrolling. + d.sizer = elt("div", [d.mover], "CodeMirror-sizer"); + d.sizerWidth = null; + // Behavior of elts with overflow: auto and padding is + // inconsistent across browsers. This is used to ensure the + // scrollable area is big enough. + d.heightForcer = elt("div", null, null, "position: absolute; height: " + scrollerGap + "px; width: 1px;"); + // Will contain the gutters, if any. + d.gutters = elt("div", null, "CodeMirror-gutters"); + d.lineGutter = null; + // Actual scrollable element. + d.scroller = elt("div", [d.sizer, d.heightForcer, d.gutters], "CodeMirror-scroll"); + d.scroller.setAttribute("tabIndex", "-1"); + // The element in which the editor lives. + d.wrapper = elt("div", [d.scrollbarFiller, d.gutterFiller, d.scroller], "CodeMirror"); + + // Work around IE7 z-index bug (not perfect, hence IE7 not really being supported) + if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0; } + if (!webkit && !(gecko && mobile)) d.scroller.draggable = true; + + if (place) { + if (place.appendChild) place.appendChild(d.wrapper); + else place(d.wrapper); + } + + // Current rendered range (may be bigger than the view window). + d.viewFrom = d.viewTo = doc.first; + d.reportedViewFrom = d.reportedViewTo = doc.first; + // Information about the rendered lines. + d.view = []; + d.renderedView = null; + // Holds info about a single rendered line when it was rendered + // for measurement, while not in view. + d.externalMeasured = null; + // Empty space (in pixels) above the view + d.viewOffset = 0; + d.lastWrapHeight = d.lastWrapWidth = 0; + d.updateLineNumbers = null; + + d.nativeBarWidth = d.barHeight = d.barWidth = 0; + d.scrollbarsClipped = false; + + // Used to only resize the line number gutter when necessary (when + // the amount of lines crosses a boundary that makes its width change) + d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null; + // Set to true when a non-horizontal-scrolling line widget is + // added. As an optimization, line widget aligning is skipped when + // this is false. + d.alignWidgets = false; + + d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null; + + // Tracks the maximum line length so that the horizontal scrollbar + // can be kept static when scrolling. + d.maxLine = null; + d.maxLineLength = 0; + d.maxLineChanged = false; + + // Used for measuring wheel scrolling granularity + d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null; + + // True when shift is held down. + d.shift = false; + + // Used to track whether anything happened since the context menu + // was opened. + d.selForContextMenu = null; + + d.activeTouch = null; + + input.init(d); + } + + // STATE UPDATES + + // Used to get the editor into a consistent state again when options change. + + function loadMode(cm) { + cm.doc.mode = CodeMirror.getMode(cm.options, cm.doc.modeOption); + resetModeState(cm); + } + + function resetModeState(cm) { + cm.doc.iter(function(line) { + if (line.stateAfter) line.stateAfter = null; + if (line.styles) line.styles = null; + }); + cm.doc.frontier = cm.doc.first; + startWorker(cm, 100); + cm.state.modeGen++; + if (cm.curOp) regChange(cm); + } + + function wrappingChanged(cm) { + if (cm.options.lineWrapping) { + addClass(cm.display.wrapper, "CodeMirror-wrap"); + cm.display.sizer.style.minWidth = ""; + cm.display.sizerWidth = null; + } else { + rmClass(cm.display.wrapper, "CodeMirror-wrap"); + findMaxLine(cm); + } + estimateLineHeights(cm); + regChange(cm); + clearCaches(cm); + setTimeout(function(){updateScrollbars(cm);}, 100); + } + + // Returns a function that estimates the height of a line, to use as + // first approximation until the line becomes visible (and is thus + // properly measurable). + function estimateHeight(cm) { + var th = textHeight(cm.display), wrapping = cm.options.lineWrapping; + var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3); + return function(line) { + if (lineIsHidden(cm.doc, line)) return 0; + + var widgetsHeight = 0; + if (line.widgets) for (var i = 0; i < line.widgets.length; i++) { + if (line.widgets[i].height) widgetsHeight += line.widgets[i].height; + } + + if (wrapping) + return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th; + else + return widgetsHeight + th; + }; + } + + function estimateLineHeights(cm) { + var doc = cm.doc, est = estimateHeight(cm); + doc.iter(function(line) { + var estHeight = est(line); + if (estHeight != line.height) updateLineHeight(line, estHeight); + }); + } + + function themeChanged(cm) { + cm.display.wrapper.className = cm.display.wrapper.className.replace(/\s*cm-s-\S+/g, "") + + cm.options.theme.replace(/(^|\s)\s*/g, " cm-s-"); + clearCaches(cm); + } + + function guttersChanged(cm) { + updateGutters(cm); + regChange(cm); + setTimeout(function(){alignHorizontally(cm);}, 20); + } + + // Rebuild the gutter elements, ensure the margin to the left of the + // code matches their width. + function updateGutters(cm) { + var gutters = cm.display.gutters, specs = cm.options.gutters; + removeChildren(gutters); + for (var i = 0; i < specs.length; ++i) { + var gutterClass = specs[i]; + var gElt = gutters.appendChild(elt("div", null, "CodeMirror-gutter " + gutterClass)); + if (gutterClass == "CodeMirror-linenumbers") { + cm.display.lineGutter = gElt; + gElt.style.width = (cm.display.lineNumWidth || 1) + "px"; + } + } + gutters.style.display = i ? "" : "none"; + updateGutterSpace(cm); + } + + function updateGutterSpace(cm) { + var width = cm.display.gutters.offsetWidth; + cm.display.sizer.style.marginLeft = width + "px"; + } + + // Compute the character length of a line, taking into account + // collapsed ranges (see markText) that might hide parts, and join + // other lines onto it. + function lineLength(line) { + if (line.height == 0) return 0; + var len = line.text.length, merged, cur = line; + while (merged = collapsedSpanAtStart(cur)) { + var found = merged.find(0, true); + cur = found.from.line; + len += found.from.ch - found.to.ch; + } + cur = line; + while (merged = collapsedSpanAtEnd(cur)) { + var found = merged.find(0, true); + len -= cur.text.length - found.from.ch; + cur = found.to.line; + len += cur.text.length - found.to.ch; + } + return len; + } + + // Find the longest line in the document. + function findMaxLine(cm) { + var d = cm.display, doc = cm.doc; + d.maxLine = getLine(doc, doc.first); + d.maxLineLength = lineLength(d.maxLine); + d.maxLineChanged = true; + doc.iter(function(line) { + var len = lineLength(line); + if (len > d.maxLineLength) { + d.maxLineLength = len; + d.maxLine = line; + } + }); + } + + // Make sure the gutters options contains the element + // "CodeMirror-linenumbers" when the lineNumbers option is true. + function setGuttersForLineNumbers(options) { + var found = indexOf(options.gutters, "CodeMirror-linenumbers"); + if (found == -1 && options.lineNumbers) { + options.gutters = options.gutters.concat(["CodeMirror-linenumbers"]); + } else if (found > -1 && !options.lineNumbers) { + options.gutters = options.gutters.slice(0); + options.gutters.splice(found, 1); + } + } + + // SCROLLBARS + + // Prepare DOM reads needed to update the scrollbars. Done in one + // shot to minimize update/measure roundtrips. + function measureForScrollbars(cm) { + var d = cm.display, gutterW = d.gutters.offsetWidth; + var docH = Math.round(cm.doc.height + paddingVert(cm.display)); + return { + clientHeight: d.scroller.clientHeight, + viewHeight: d.wrapper.clientHeight, + scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth, + viewWidth: d.wrapper.clientWidth, + barLeft: cm.options.fixedGutter ? gutterW : 0, + docHeight: docH, + scrollHeight: docH + scrollGap(cm) + d.barHeight, + nativeBarWidth: d.nativeBarWidth, + gutterWidth: gutterW + }; + } + + function NativeScrollbars(place, scroll, cm) { + this.cm = cm; + var vert = this.vert = elt("div", [elt("div", null, null, "min-width: 1px")], "CodeMirror-vscrollbar"); + var horiz = this.horiz = elt("div", [elt("div", null, null, "height: 100%; min-height: 1px")], "CodeMirror-hscrollbar"); + place(vert); place(horiz); + + on(vert, "scroll", function() { + if (vert.clientHeight) scroll(vert.scrollTop, "vertical"); + }); + on(horiz, "scroll", function() { + if (horiz.clientWidth) scroll(horiz.scrollLeft, "horizontal"); + }); + + this.checkedOverlay = false; + // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8). + if (ie && ie_version < 8) this.horiz.style.minHeight = this.vert.style.minWidth = "18px"; + } + + NativeScrollbars.prototype = copyObj({ + update: function(measure) { + var needsH = measure.scrollWidth > measure.clientWidth + 1; + var needsV = measure.scrollHeight > measure.clientHeight + 1; + var sWidth = measure.nativeBarWidth; + + if (needsV) { + this.vert.style.display = "block"; + this.vert.style.bottom = needsH ? sWidth + "px" : "0"; + var totalHeight = measure.viewHeight - (needsH ? sWidth : 0); + // A bug in IE8 can cause this value to be negative, so guard it. + this.vert.firstChild.style.height = + Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + "px"; + } else { + this.vert.style.display = ""; + this.vert.firstChild.style.height = "0"; + } + + if (needsH) { + this.horiz.style.display = "block"; + this.horiz.style.right = needsV ? sWidth + "px" : "0"; + this.horiz.style.left = measure.barLeft + "px"; + var totalWidth = measure.viewWidth - measure.barLeft - (needsV ? sWidth : 0); + this.horiz.firstChild.style.width = + (measure.scrollWidth - measure.clientWidth + totalWidth) + "px"; + } else { + this.horiz.style.display = ""; + this.horiz.firstChild.style.width = "0"; + } + + if (!this.checkedOverlay && measure.clientHeight > 0) { + if (sWidth == 0) this.overlayHack(); + this.checkedOverlay = true; + } + + return {right: needsV ? sWidth : 0, bottom: needsH ? sWidth : 0}; + }, + setScrollLeft: function(pos) { + if (this.horiz.scrollLeft != pos) this.horiz.scrollLeft = pos; + }, + setScrollTop: function(pos) { + if (this.vert.scrollTop != pos) this.vert.scrollTop = pos; + }, + overlayHack: function() { + var w = mac && !mac_geMountainLion ? "12px" : "18px"; + this.horiz.style.minHeight = this.vert.style.minWidth = w; + var self = this; + var barMouseDown = function(e) { + if (e_target(e) != self.vert && e_target(e) != self.horiz) + operation(self.cm, onMouseDown)(e); + }; + on(this.vert, "mousedown", barMouseDown); + on(this.horiz, "mousedown", barMouseDown); + }, + clear: function() { + var parent = this.horiz.parentNode; + parent.removeChild(this.horiz); + parent.removeChild(this.vert); + } + }, NativeScrollbars.prototype); + + function NullScrollbars() {} + + NullScrollbars.prototype = copyObj({ + update: function() { return {bottom: 0, right: 0}; }, + setScrollLeft: function() {}, + setScrollTop: function() {}, + clear: function() {} + }, NullScrollbars.prototype); + + CodeMirror.scrollbarModel = {"native": NativeScrollbars, "null": NullScrollbars}; + + function initScrollbars(cm) { + if (cm.display.scrollbars) { + cm.display.scrollbars.clear(); + if (cm.display.scrollbars.addClass) + rmClass(cm.display.wrapper, cm.display.scrollbars.addClass); + } + + cm.display.scrollbars = new CodeMirror.scrollbarModel[cm.options.scrollbarStyle](function(node) { + cm.display.wrapper.insertBefore(node, cm.display.scrollbarFiller); + // Prevent clicks in the scrollbars from killing focus + on(node, "mousedown", function() { + if (cm.state.focused) setTimeout(function() { cm.display.input.focus(); }, 0); + }); + node.setAttribute("cm-not-content", "true"); + }, function(pos, axis) { + if (axis == "horizontal") setScrollLeft(cm, pos); + else setScrollTop(cm, pos); + }, cm); + if (cm.display.scrollbars.addClass) + addClass(cm.display.wrapper, cm.display.scrollbars.addClass); + } + + function updateScrollbars(cm, measure) { + if (!measure) measure = measureForScrollbars(cm); + var startWidth = cm.display.barWidth, startHeight = cm.display.barHeight; + updateScrollbarsInner(cm, measure); + for (var i = 0; i < 4 && startWidth != cm.display.barWidth || startHeight != cm.display.barHeight; i++) { + if (startWidth != cm.display.barWidth && cm.options.lineWrapping) + updateHeightsInViewport(cm); + updateScrollbarsInner(cm, measureForScrollbars(cm)); + startWidth = cm.display.barWidth; startHeight = cm.display.barHeight; + } + } + + // Re-synchronize the fake scrollbars with the actual size of the + // content. + function updateScrollbarsInner(cm, measure) { + var d = cm.display; + var sizes = d.scrollbars.update(measure); + + d.sizer.style.paddingRight = (d.barWidth = sizes.right) + "px"; + d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + "px"; + + if (sizes.right && sizes.bottom) { + d.scrollbarFiller.style.display = "block"; + d.scrollbarFiller.style.height = sizes.bottom + "px"; + d.scrollbarFiller.style.width = sizes.right + "px"; + } else d.scrollbarFiller.style.display = ""; + if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) { + d.gutterFiller.style.display = "block"; + d.gutterFiller.style.height = sizes.bottom + "px"; + d.gutterFiller.style.width = measure.gutterWidth + "px"; + } else d.gutterFiller.style.display = ""; + } + + // Compute the lines that are visible in a given viewport (defaults + // the the current scroll position). viewport may contain top, + // height, and ensure (see op.scrollToPos) properties. + function visibleLines(display, doc, viewport) { + var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop; + top = Math.floor(top - paddingTop(display)); + var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight; + + var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom); + // Ensure is a {from: {line, ch}, to: {line, ch}} object, and + // forces those lines into the viewport (if possible). + if (viewport && viewport.ensure) { + var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line; + if (ensureFrom < from) { + from = ensureFrom; + to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight); + } else if (Math.min(ensureTo, doc.lastLine()) >= to) { + from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight); + to = ensureTo; + } + } + return {from: from, to: Math.max(to, from + 1)}; + } + + // LINE NUMBERS + + // Re-align line numbers and gutter marks to compensate for + // horizontal scrolling. + function alignHorizontally(cm) { + var display = cm.display, view = display.view; + if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return; + var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft; + var gutterW = display.gutters.offsetWidth, left = comp + "px"; + for (var i = 0; i < view.length; i++) if (!view[i].hidden) { + if (cm.options.fixedGutter && view[i].gutter) + view[i].gutter.style.left = left; + var align = view[i].alignable; + if (align) for (var j = 0; j < align.length; j++) + align[j].style.left = left; + } + if (cm.options.fixedGutter) + display.gutters.style.left = (comp + gutterW) + "px"; + } + + // Used to ensure that the line number gutter is still the right + // size for the current document size. Returns true when an update + // is needed. + function maybeUpdateLineNumberWidth(cm) { + if (!cm.options.lineNumbers) return false; + var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display; + if (last.length != display.lineNumChars) { + var test = display.measure.appendChild(elt("div", [elt("div", last)], + "CodeMirror-linenumber CodeMirror-gutter-elt")); + var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW; + display.lineGutter.style.width = ""; + display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1; + display.lineNumWidth = display.lineNumInnerWidth + padding; + display.lineNumChars = display.lineNumInnerWidth ? last.length : -1; + display.lineGutter.style.width = display.lineNumWidth + "px"; + updateGutterSpace(cm); + return true; + } + return false; + } + + function lineNumberFor(options, i) { + return String(options.lineNumberFormatter(i + options.firstLineNumber)); + } + + // Computes display.scroller.scrollLeft + display.gutters.offsetWidth, + // but using getBoundingClientRect to get a sub-pixel-accurate + // result. + function compensateForHScroll(display) { + return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left; + } + + // DISPLAY DRAWING + + function DisplayUpdate(cm, viewport, force) { + var display = cm.display; + + this.viewport = viewport; + // Store some values that we'll need later (but don't want to force a relayout for) + this.visible = visibleLines(display, cm.doc, viewport); + this.editorIsHidden = !display.wrapper.offsetWidth; + this.wrapperHeight = display.wrapper.clientHeight; + this.wrapperWidth = display.wrapper.clientWidth; + this.oldDisplayWidth = displayWidth(cm); + this.force = force; + this.dims = getDimensions(cm); + this.events = []; + } + + DisplayUpdate.prototype.signal = function(emitter, type) { + if (hasHandler(emitter, type)) + this.events.push(arguments); + }; + DisplayUpdate.prototype.finish = function() { + for (var i = 0; i < this.events.length; i++) + signal.apply(null, this.events[i]); + }; + + function maybeClipScrollbars(cm) { + var display = cm.display; + if (!display.scrollbarsClipped && display.scroller.offsetWidth) { + display.nativeBarWidth = display.scroller.offsetWidth - display.scroller.clientWidth; + display.heightForcer.style.height = scrollGap(cm) + "px"; + display.sizer.style.marginBottom = -display.nativeBarWidth + "px"; + display.sizer.style.borderRightWidth = scrollGap(cm) + "px"; + display.scrollbarsClipped = true; + } + } + + // Does the actual updating of the line display. Bails out + // (returning false) when there is nothing to be done and forced is + // false. + function updateDisplayIfNeeded(cm, update) { + var display = cm.display, doc = cm.doc; + + if (update.editorIsHidden) { + resetView(cm); + return false; + } + + // Bail out if the visible area is already rendered and nothing changed. + if (!update.force && + update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo && + (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) && + display.renderedView == display.view && countDirtyView(cm) == 0) + return false; + + if (maybeUpdateLineNumberWidth(cm)) { + resetView(cm); + update.dims = getDimensions(cm); + } + + // Compute a suitable new viewport (from & to) + var end = doc.first + doc.size; + var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first); + var to = Math.min(end, update.visible.to + cm.options.viewportMargin); + if (display.viewFrom < from && from - display.viewFrom < 20) from = Math.max(doc.first, display.viewFrom); + if (display.viewTo > to && display.viewTo - to < 20) to = Math.min(end, display.viewTo); + if (sawCollapsedSpans) { + from = visualLineNo(cm.doc, from); + to = visualLineEndNo(cm.doc, to); + } + + var different = from != display.viewFrom || to != display.viewTo || + display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth; + adjustView(cm, from, to); + + display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom)); + // Position the mover div to align with the current scroll position + cm.display.mover.style.top = display.viewOffset + "px"; + + var toUpdate = countDirtyView(cm); + if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view && + (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo)) + return false; + + // For big changes, we hide the enclosing element during the + // update, since that speeds up the operations on most browsers. + var focused = activeElt(); + if (toUpdate > 4) display.lineDiv.style.display = "none"; + patchDisplay(cm, display.updateLineNumbers, update.dims); + if (toUpdate > 4) display.lineDiv.style.display = ""; + display.renderedView = display.view; + // There might have been a widget with a focused element that got + // hidden or updated, if so re-focus it. + if (focused && activeElt() != focused && focused.offsetHeight) focused.focus(); + + // Prevent selection and cursors from interfering with the scroll + // width and height. + removeChildren(display.cursorDiv); + removeChildren(display.selectionDiv); + display.gutters.style.height = 0; + + if (different) { + display.lastWrapHeight = update.wrapperHeight; + display.lastWrapWidth = update.wrapperWidth; + startWorker(cm, 400); + } + + display.updateLineNumbers = null; + + return true; + } + + function postUpdateDisplay(cm, update) { + var viewport = update.viewport; + for (var first = true;; first = false) { + if (!first || !cm.options.lineWrapping || update.oldDisplayWidth == displayWidth(cm)) { + // Clip forced viewport to actual scrollable area. + if (viewport && viewport.top != null) + viewport = {top: Math.min(cm.doc.height + paddingVert(cm.display) - displayHeight(cm), viewport.top)}; + // Updated line heights might result in the drawn area not + // actually covering the viewport. Keep looping until it does. + update.visible = visibleLines(cm.display, cm.doc, viewport); + if (update.visible.from >= cm.display.viewFrom && update.visible.to <= cm.display.viewTo) + break; + } + if (!updateDisplayIfNeeded(cm, update)) break; + updateHeightsInViewport(cm); + var barMeasure = measureForScrollbars(cm); + updateSelection(cm); + setDocumentHeight(cm, barMeasure); + updateScrollbars(cm, barMeasure); + } + + update.signal(cm, "update", cm); + if (cm.display.viewFrom != cm.display.reportedViewFrom || cm.display.viewTo != cm.display.reportedViewTo) { + update.signal(cm, "viewportChange", cm, cm.display.viewFrom, cm.display.viewTo); + cm.display.reportedViewFrom = cm.display.viewFrom; cm.display.reportedViewTo = cm.display.viewTo; + } + } + + function updateDisplaySimple(cm, viewport) { + var update = new DisplayUpdate(cm, viewport); + if (updateDisplayIfNeeded(cm, update)) { + updateHeightsInViewport(cm); + postUpdateDisplay(cm, update); + var barMeasure = measureForScrollbars(cm); + updateSelection(cm); + setDocumentHeight(cm, barMeasure); + updateScrollbars(cm, barMeasure); + update.finish(); + } + } + + function setDocumentHeight(cm, measure) { + cm.display.sizer.style.minHeight = measure.docHeight + "px"; + var total = measure.docHeight + cm.display.barHeight; + cm.display.heightForcer.style.top = total + "px"; + cm.display.gutters.style.height = Math.max(total + scrollGap(cm), measure.clientHeight) + "px"; + } + + // Read the actual heights of the rendered lines, and update their + // stored heights to match. + function updateHeightsInViewport(cm) { + var display = cm.display; + var prevBottom = display.lineDiv.offsetTop; + for (var i = 0; i < display.view.length; i++) { + var cur = display.view[i], height; + if (cur.hidden) continue; + if (ie && ie_version < 8) { + var bot = cur.node.offsetTop + cur.node.offsetHeight; + height = bot - prevBottom; + prevBottom = bot; + } else { + var box = cur.node.getBoundingClientRect(); + height = box.bottom - box.top; + } + var diff = cur.line.height - height; + if (height < 2) height = textHeight(display); + if (diff > .001 || diff < -.001) { + updateLineHeight(cur.line, height); + updateWidgetHeight(cur.line); + if (cur.rest) for (var j = 0; j < cur.rest.length; j++) + updateWidgetHeight(cur.rest[j]); + } + } + } + + // Read and store the height of line widgets associated with the + // given line. + function updateWidgetHeight(line) { + if (line.widgets) for (var i = 0; i < line.widgets.length; ++i) + line.widgets[i].height = line.widgets[i].node.offsetHeight; + } + + // Do a bulk-read of the DOM positions and sizes needed to draw the + // view, so that we don't interleave reading and writing to the DOM. + function getDimensions(cm) { + var d = cm.display, left = {}, width = {}; + var gutterLeft = d.gutters.clientLeft; + for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) { + left[cm.options.gutters[i]] = n.offsetLeft + n.clientLeft + gutterLeft; + width[cm.options.gutters[i]] = n.clientWidth; + } + return {fixedPos: compensateForHScroll(d), + gutterTotalWidth: d.gutters.offsetWidth, + gutterLeft: left, + gutterWidth: width, + wrapperWidth: d.wrapper.clientWidth}; + } + + // Sync the actual display DOM structure with display.view, removing + // nodes for lines that are no longer in view, and creating the ones + // that are not there yet, and updating the ones that are out of + // date. + function patchDisplay(cm, updateNumbersFrom, dims) { + var display = cm.display, lineNumbers = cm.options.lineNumbers; + var container = display.lineDiv, cur = container.firstChild; + + function rm(node) { + var next = node.nextSibling; + // Works around a throw-scroll bug in OS X Webkit + if (webkit && mac && cm.display.currentWheelTarget == node) + node.style.display = "none"; + else + node.parentNode.removeChild(node); + return next; + } + + var view = display.view, lineN = display.viewFrom; + // Loop over the elements in the view, syncing cur (the DOM nodes + // in display.lineDiv) with the view as we go. + for (var i = 0; i < view.length; i++) { + var lineView = view[i]; + if (lineView.hidden) { + } else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet + var node = buildLineElement(cm, lineView, lineN, dims); + container.insertBefore(node, cur); + } else { // Already drawn + while (cur != lineView.node) cur = rm(cur); + var updateNumber = lineNumbers && updateNumbersFrom != null && + updateNumbersFrom <= lineN && lineView.lineNumber; + if (lineView.changes) { + if (indexOf(lineView.changes, "gutter") > -1) updateNumber = false; + updateLineForChanges(cm, lineView, lineN, dims); + } + if (updateNumber) { + removeChildren(lineView.lineNumber); + lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN))); + } + cur = lineView.node.nextSibling; + } + lineN += lineView.size; + } + while (cur) cur = rm(cur); + } + + // When an aspect of a line changes, a string is added to + // lineView.changes. This updates the relevant part of the line's + // DOM structure. + function updateLineForChanges(cm, lineView, lineN, dims) { + for (var j = 0; j < lineView.changes.length; j++) { + var type = lineView.changes[j]; + if (type == "text") updateLineText(cm, lineView); + else if (type == "gutter") updateLineGutter(cm, lineView, lineN, dims); + else if (type == "class") updateLineClasses(lineView); + else if (type == "widget") updateLineWidgets(cm, lineView, dims); + } + lineView.changes = null; + } + + // Lines with gutter elements, widgets or a background class need to + // be wrapped, and have the extra elements added to the wrapper div + function ensureLineWrapped(lineView) { + if (lineView.node == lineView.text) { + lineView.node = elt("div", null, null, "position: relative"); + if (lineView.text.parentNode) + lineView.text.parentNode.replaceChild(lineView.node, lineView.text); + lineView.node.appendChild(lineView.text); + if (ie && ie_version < 8) lineView.node.style.zIndex = 2; + } + return lineView.node; + } + + function updateLineBackground(lineView) { + var cls = lineView.bgClass ? lineView.bgClass + " " + (lineView.line.bgClass || "") : lineView.line.bgClass; + if (cls) cls += " CodeMirror-linebackground"; + if (lineView.background) { + if (cls) lineView.background.className = cls; + else { lineView.background.parentNode.removeChild(lineView.background); lineView.background = null; } + } else if (cls) { + var wrap = ensureLineWrapped(lineView); + lineView.background = wrap.insertBefore(elt("div", null, cls), wrap.firstChild); + } + } + + // Wrapper around buildLineContent which will reuse the structure + // in display.externalMeasured when possible. + function getLineContent(cm, lineView) { + var ext = cm.display.externalMeasured; + if (ext && ext.line == lineView.line) { + cm.display.externalMeasured = null; + lineView.measure = ext.measure; + return ext.built; + } + return buildLineContent(cm, lineView); + } + + // Redraw the line's text. Interacts with the background and text + // classes because the mode may output tokens that influence these + // classes. + function updateLineText(cm, lineView) { + var cls = lineView.text.className; + var built = getLineContent(cm, lineView); + if (lineView.text == lineView.node) lineView.node = built.pre; + lineView.text.parentNode.replaceChild(built.pre, lineView.text); + lineView.text = built.pre; + if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) { + lineView.bgClass = built.bgClass; + lineView.textClass = built.textClass; + updateLineClasses(lineView); + } else if (cls) { + lineView.text.className = cls; + } + } + + function updateLineClasses(lineView) { + updateLineBackground(lineView); + if (lineView.line.wrapClass) + ensureLineWrapped(lineView).className = lineView.line.wrapClass; + else if (lineView.node != lineView.text) + lineView.node.className = ""; + var textClass = lineView.textClass ? lineView.textClass + " " + (lineView.line.textClass || "") : lineView.line.textClass; + lineView.text.className = textClass || ""; + } + + function updateLineGutter(cm, lineView, lineN, dims) { + if (lineView.gutter) { + lineView.node.removeChild(lineView.gutter); + lineView.gutter = null; + } + var markers = lineView.line.gutterMarkers; + if (cm.options.lineNumbers || markers) { + var wrap = ensureLineWrapped(lineView); + var gutterWrap = lineView.gutter = elt("div", null, "CodeMirror-gutter-wrapper", "left: " + + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + + "px; width: " + dims.gutterTotalWidth + "px"); + cm.display.input.setUneditable(gutterWrap); + wrap.insertBefore(gutterWrap, lineView.text); + if (lineView.line.gutterClass) + gutterWrap.className += " " + lineView.line.gutterClass; + if (cm.options.lineNumbers && (!markers || !markers["CodeMirror-linenumbers"])) + lineView.lineNumber = gutterWrap.appendChild( + elt("div", lineNumberFor(cm.options, lineN), + "CodeMirror-linenumber CodeMirror-gutter-elt", + "left: " + dims.gutterLeft["CodeMirror-linenumbers"] + "px; width: " + + cm.display.lineNumInnerWidth + "px")); + if (markers) for (var k = 0; k < cm.options.gutters.length; ++k) { + var id = cm.options.gutters[k], found = markers.hasOwnProperty(id) && markers[id]; + if (found) + gutterWrap.appendChild(elt("div", [found], "CodeMirror-gutter-elt", "left: " + + dims.gutterLeft[id] + "px; width: " + dims.gutterWidth[id] + "px")); + } + } + } + + function updateLineWidgets(cm, lineView, dims) { + if (lineView.alignable) lineView.alignable = null; + for (var node = lineView.node.firstChild, next; node; node = next) { + var next = node.nextSibling; + if (node.className == "CodeMirror-linewidget") + lineView.node.removeChild(node); + } + insertLineWidgets(cm, lineView, dims); + } + + // Build a line's DOM representation from scratch + function buildLineElement(cm, lineView, lineN, dims) { + var built = getLineContent(cm, lineView); + lineView.text = lineView.node = built.pre; + if (built.bgClass) lineView.bgClass = built.bgClass; + if (built.textClass) lineView.textClass = built.textClass; + + updateLineClasses(lineView); + updateLineGutter(cm, lineView, lineN, dims); + insertLineWidgets(cm, lineView, dims); + return lineView.node; + } + + // A lineView may contain multiple logical lines (when merged by + // collapsed spans). The widgets for all of them need to be drawn. + function insertLineWidgets(cm, lineView, dims) { + insertLineWidgetsFor(cm, lineView.line, lineView, dims, true); + if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++) + insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); + } + + function insertLineWidgetsFor(cm, line, lineView, dims, allowAbove) { + if (!line.widgets) return; + var wrap = ensureLineWrapped(lineView); + for (var i = 0, ws = line.widgets; i < ws.length; ++i) { + var widget = ws[i], node = elt("div", [widget.node], "CodeMirror-linewidget"); + if (!widget.handleMouseEvents) node.setAttribute("cm-ignore-events", "true"); + positionLineWidget(widget, node, lineView, dims); + cm.display.input.setUneditable(node); + if (allowAbove && widget.above) + wrap.insertBefore(node, lineView.gutter || lineView.text); + else + wrap.appendChild(node); + signalLater(widget, "redraw"); + } + } + + function positionLineWidget(widget, node, lineView, dims) { + if (widget.noHScroll) { + (lineView.alignable || (lineView.alignable = [])).push(node); + var width = dims.wrapperWidth; + node.style.left = dims.fixedPos + "px"; + if (!widget.coverGutter) { + width -= dims.gutterTotalWidth; + node.style.paddingLeft = dims.gutterTotalWidth + "px"; + } + node.style.width = width + "px"; + } + if (widget.coverGutter) { + node.style.zIndex = 5; + node.style.position = "relative"; + if (!widget.noHScroll) node.style.marginLeft = -dims.gutterTotalWidth + "px"; + } + } + + // POSITION OBJECT + + // A Pos instance represents a position within the text. + var Pos = CodeMirror.Pos = function(line, ch) { + if (!(this instanceof Pos)) return new Pos(line, ch); + this.line = line; this.ch = ch; + }; + + // Compare two positions, return 0 if they are the same, a negative + // number when a is less, and a positive number otherwise. + var cmp = CodeMirror.cmpPos = function(a, b) { return a.line - b.line || a.ch - b.ch; }; + + function copyPos(x) {return Pos(x.line, x.ch);} + function maxPos(a, b) { return cmp(a, b) < 0 ? b : a; } + function minPos(a, b) { return cmp(a, b) < 0 ? a : b; } + + // INPUT HANDLING + + function ensureFocus(cm) { + if (!cm.state.focused) { cm.display.input.focus(); onFocus(cm); } + } + + function isReadOnly(cm) { + return cm.options.readOnly || cm.doc.cantEdit; + } + + // This will be set to an array of strings when copying, so that, + // when pasting, we know what kind of selections the copied text + // was made out of. + var lastCopied = null; + + function applyTextInput(cm, inserted, deleted, sel, origin) { + var doc = cm.doc; + cm.display.shift = false; + if (!sel) sel = doc.sel; + + var textLines = splitLines(inserted), multiPaste = null; + // When pasing N lines into N selections, insert one line per selection + if (cm.state.pasteIncoming && sel.ranges.length > 1) { + if (lastCopied && lastCopied.join("\n") == inserted) + multiPaste = sel.ranges.length % lastCopied.length == 0 && map(lastCopied, splitLines); + else if (textLines.length == sel.ranges.length) + multiPaste = map(textLines, function(l) { return [l]; }); + } + + // Normal behavior is to insert the new text into every selection + for (var i = sel.ranges.length - 1; i >= 0; i--) { + var range = sel.ranges[i]; + var from = range.from(), to = range.to(); + if (range.empty()) { + if (deleted && deleted > 0) // Handle deletion + from = Pos(from.line, from.ch - deleted); + else if (cm.state.overwrite && !cm.state.pasteIncoming) // Handle overwrite + to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + lst(textLines).length)); + } + var updateInput = cm.curOp.updateInput; + var changeEvent = {from: from, to: to, text: multiPaste ? multiPaste[i % multiPaste.length] : textLines, + origin: origin || (cm.state.pasteIncoming ? "paste" : cm.state.cutIncoming ? "cut" : "+input")}; + makeChange(cm.doc, changeEvent); + signalLater(cm, "inputRead", cm, changeEvent); + } + if (inserted && !cm.state.pasteIncoming) + triggerElectric(cm, inserted); + + ensureCursorVisible(cm); + cm.curOp.updateInput = updateInput; + cm.curOp.typing = true; + cm.state.pasteIncoming = cm.state.cutIncoming = false; + } + + function triggerElectric(cm, inserted) { + // When an 'electric' character is inserted, immediately trigger a reindent + if (!cm.options.electricChars || !cm.options.smartIndent) return; + var sel = cm.doc.sel; + + for (var i = sel.ranges.length - 1; i >= 0; i--) { + var range = sel.ranges[i]; + if (range.head.ch > 100 || (i && sel.ranges[i - 1].head.line == range.head.line)) continue; + var mode = cm.getModeAt(range.head); + var indented = false; + if (mode.electricChars) { + for (var j = 0; j < mode.electricChars.length; j++) + if (inserted.indexOf(mode.electricChars.charAt(j)) > -1) { + indented = indentLine(cm, range.head.line, "smart"); + break; + } + } else if (mode.electricInput) { + if (mode.electricInput.test(getLine(cm.doc, range.head.line).text.slice(0, range.head.ch))) + indented = indentLine(cm, range.head.line, "smart"); + } + if (indented) signalLater(cm, "electricInput", cm, range.head.line); + } + } + + function copyableRanges(cm) { + var text = [], ranges = []; + for (var i = 0; i < cm.doc.sel.ranges.length; i++) { + var line = cm.doc.sel.ranges[i].head.line; + var lineRange = {anchor: Pos(line, 0), head: Pos(line + 1, 0)}; + ranges.push(lineRange); + text.push(cm.getRange(lineRange.anchor, lineRange.head)); + } + return {text: text, ranges: ranges}; + } + + function disableBrowserMagic(field) { + field.setAttribute("autocorrect", "off"); + field.setAttribute("autocapitalize", "off"); + field.setAttribute("spellcheck", "false"); + } + + // TEXTAREA INPUT STYLE + + function TextareaInput(cm) { + this.cm = cm; + // See input.poll and input.reset + this.prevInput = ""; + + // Flag that indicates whether we expect input to appear real soon + // now (after some event like 'keypress' or 'input') and are + // polling intensively. + this.pollingFast = false; + // Self-resetting timeout for the poller + this.polling = new Delayed(); + // Tracks when input.reset has punted to just putting a short + // string into the textarea instead of the full selection. + this.inaccurateSelection = false; + // Used to work around IE issue with selection being forgotten when focus moves away from textarea + this.hasSelection = false; + this.composing = null; + }; + + function hiddenTextarea() { + var te = elt("textarea", null, null, "position: absolute; padding: 0; width: 1px; height: 1em; outline: none"); + var div = elt("div", [te], null, "overflow: hidden; position: relative; width: 3px; height: 0px;"); + // The textarea is kept positioned near the cursor to prevent the + // fact that it'll be scrolled into view on input from scrolling + // our fake cursor out of view. On webkit, when wrap=off, paste is + // very slow. So make the area wide instead. + if (webkit) te.style.width = "1000px"; + else te.setAttribute("wrap", "off"); + // If border: 0; -- iOS fails to open keyboard (issue #1287) + if (ios) te.style.border = "1px solid black"; + disableBrowserMagic(te); + return div; + } + + TextareaInput.prototype = copyObj({ + init: function(display) { + var input = this, cm = this.cm; + + // Wraps and hides input textarea + var div = this.wrapper = hiddenTextarea(); + // The semihidden textarea that is focused when the editor is + // focused, and receives input. + var te = this.textarea = div.firstChild; + display.wrapper.insertBefore(div, display.wrapper.firstChild); + + // Needed to hide big blue blinking cursor on Mobile Safari (doesn't seem to work in iOS 8 anymore) + if (ios) te.style.width = "0px"; + + on(te, "input", function() { + if (ie && ie_version >= 9 && input.hasSelection) input.hasSelection = null; + input.poll(); + }); + + on(te, "paste", function() { + // Workaround for webkit bug https://bugs.webkit.org/show_bug.cgi?id=90206 + // Add a char to the end of textarea before paste occur so that + // selection doesn't span to the end of textarea. + if (webkit && !cm.state.fakedLastChar && !(new Date - cm.state.lastMiddleDown < 200)) { + var start = te.selectionStart, end = te.selectionEnd; + te.value += "$"; + // The selection end needs to be set before the start, otherwise there + // can be an intermediate non-empty selection between the two, which + // can override the middle-click paste buffer on linux and cause the + // wrong thing to get pasted. + te.selectionEnd = end; + te.selectionStart = start; + cm.state.fakedLastChar = true; + } + cm.state.pasteIncoming = true; + input.fastPoll(); + }); + + function prepareCopyCut(e) { + if (cm.somethingSelected()) { + lastCopied = cm.getSelections(); + if (input.inaccurateSelection) { + input.prevInput = ""; + input.inaccurateSelection = false; + te.value = lastCopied.join("\n"); + selectInput(te); + } + } else if (!cm.options.lineWiseCopyCut) { + return; + } else { + var ranges = copyableRanges(cm); + lastCopied = ranges.text; + if (e.type == "cut") { + cm.setSelections(ranges.ranges, null, sel_dontScroll); + } else { + input.prevInput = ""; + te.value = ranges.text.join("\n"); + selectInput(te); + } + } + if (e.type == "cut") cm.state.cutIncoming = true; + } + on(te, "cut", prepareCopyCut); + on(te, "copy", prepareCopyCut); + + on(display.scroller, "paste", function(e) { + if (eventInWidget(display, e)) return; + cm.state.pasteIncoming = true; + input.focus(); + }); + + // Prevent normal selection in the editor (we handle our own) + on(display.lineSpace, "selectstart", function(e) { + if (!eventInWidget(display, e)) e_preventDefault(e); + }); + + on(te, "compositionstart", function() { + var start = cm.getCursor("from"); + input.composing = { + start: start, + range: cm.markText(start, cm.getCursor("to"), {className: "CodeMirror-composing"}) + }; + }); + on(te, "compositionend", function() { + if (input.composing) { + input.poll(); + input.composing.range.clear(); + input.composing = null; + } + }); + }, + + prepareSelection: function() { + // Redraw the selection and/or cursor + var cm = this.cm, display = cm.display, doc = cm.doc; + var result = prepareSelection(cm); + + // Move the hidden textarea near the cursor to prevent scrolling artifacts + if (cm.options.moveInputWithCursor) { + var headPos = cursorCoords(cm, doc.sel.primary().head, "div"); + var wrapOff = display.wrapper.getBoundingClientRect(), lineOff = display.lineDiv.getBoundingClientRect(); + result.teTop = Math.max(0, Math.min(display.wrapper.clientHeight - 10, + headPos.top + lineOff.top - wrapOff.top)); + result.teLeft = Math.max(0, Math.min(display.wrapper.clientWidth - 10, + headPos.left + lineOff.left - wrapOff.left)); + } + + return result; + }, + + showSelection: function(drawn) { + var cm = this.cm, display = cm.display; + removeChildrenAndAdd(display.cursorDiv, drawn.cursors); + removeChildrenAndAdd(display.selectionDiv, drawn.selection); + if (drawn.teTop != null) { + this.wrapper.style.top = drawn.teTop + "px"; + this.wrapper.style.left = drawn.teLeft + "px"; + } + }, + + // Reset the input to correspond to the selection (or to be empty, + // when not typing and nothing is selected) + reset: function(typing) { + if (this.contextMenuPending) return; + var minimal, selected, cm = this.cm, doc = cm.doc; + if (cm.somethingSelected()) { + this.prevInput = ""; + var range = doc.sel.primary(); + minimal = hasCopyEvent && + (range.to().line - range.from().line > 100 || (selected = cm.getSelection()).length > 1000); + var content = minimal ? "-" : selected || cm.getSelection(); + this.textarea.value = content; + if (cm.state.focused) selectInput(this.textarea); + if (ie && ie_version >= 9) this.hasSelection = content; + } else if (!typing) { + this.prevInput = this.textarea.value = ""; + if (ie && ie_version >= 9) this.hasSelection = null; + } + this.inaccurateSelection = minimal; + }, + + getField: function() { return this.textarea; }, + + supportsTouch: function() { return false; }, + + focus: function() { + if (this.cm.options.readOnly != "nocursor" && (!mobile || activeElt() != this.textarea)) { + try { this.textarea.focus(); } + catch (e) {} // IE8 will throw if the textarea is display: none or not in DOM + } + }, + + blur: function() { this.textarea.blur(); }, + + resetPosition: function() { + this.wrapper.style.top = this.wrapper.style.left = 0; + }, + + receivedFocus: function() { this.slowPoll(); }, + + // Poll for input changes, using the normal rate of polling. This + // runs as long as the editor is focused. + slowPoll: function() { + var input = this; + if (input.pollingFast) return; + input.polling.set(this.cm.options.pollInterval, function() { + input.poll(); + if (input.cm.state.focused) input.slowPoll(); + }); + }, + + // When an event has just come in that is likely to add or change + // something in the input textarea, we poll faster, to ensure that + // the change appears on the screen quickly. + fastPoll: function() { + var missed = false, input = this; + input.pollingFast = true; + function p() { + var changed = input.poll(); + if (!changed && !missed) {missed = true; input.polling.set(60, p);} + else {input.pollingFast = false; input.slowPoll();} + } + input.polling.set(20, p); + }, + + // Read input from the textarea, and update the document to match. + // When something is selected, it is present in the textarea, and + // selected (unless it is huge, in which case a placeholder is + // used). When nothing is selected, the cursor sits after previously + // seen text (can be empty), which is stored in prevInput (we must + // not reset the textarea when typing, because that breaks IME). + poll: function() { + var cm = this.cm, input = this.textarea, prevInput = this.prevInput; + // Since this is called a *lot*, try to bail out as cheaply as + // possible when it is clear that nothing happened. hasSelection + // will be the case when there is a lot of text in the textarea, + // in which case reading its value would be expensive. + if (!cm.state.focused || (hasSelection(input) && !prevInput) || + isReadOnly(cm) || cm.options.disableInput || cm.state.keySeq) + return false; + // See paste handler for more on the fakedLastChar kludge + if (cm.state.pasteIncoming && cm.state.fakedLastChar) { + input.value = input.value.substring(0, input.value.length - 1); + cm.state.fakedLastChar = false; + } + var text = input.value; + // If nothing changed, bail. + if (text == prevInput && !cm.somethingSelected()) return false; + // Work around nonsensical selection resetting in IE9/10, and + // inexplicable appearance of private area unicode characters on + // some key combos in Mac (#2689). + if (ie && ie_version >= 9 && this.hasSelection === text || + mac && /[\uf700-\uf7ff]/.test(text)) { + cm.display.input.reset(); + return false; + } + + if (cm.doc.sel == cm.display.selForContextMenu) { + var first = text.charCodeAt(0); + if (first == 0x200b && !prevInput) prevInput = "\u200b"; + if (first == 0x21da) { this.reset(); return this.cm.execCommand("undo"); } + } + // Find the part of the input that is actually new + var same = 0, l = Math.min(prevInput.length, text.length); + while (same < l && prevInput.charCodeAt(same) == text.charCodeAt(same)) ++same; + + var self = this; + runInOp(cm, function() { + applyTextInput(cm, text.slice(same), prevInput.length - same, + null, self.composing ? "*compose" : null); + + // Don't leave long text in the textarea, since it makes further polling slow + if (text.length > 1000 || text.indexOf("\n") > -1) input.value = self.prevInput = ""; + else self.prevInput = text; + + if (self.composing) { + self.composing.range.clear(); + self.composing.range = cm.markText(self.composing.start, cm.getCursor("to"), + {className: "CodeMirror-composing"}); + } + }); + return true; + }, + + ensurePolled: function() { + if (this.pollingFast && this.poll()) this.pollingFast = false; + }, + + onKeyPress: function() { + if (ie && ie_version >= 9) this.hasSelection = null; + this.fastPoll(); + }, + + onContextMenu: function(e) { + var input = this, cm = input.cm, display = cm.display, te = input.textarea; + var pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop; + if (!pos || presto) return; // Opera is difficult. + + // Reset the current text selection only if the click is done outside of the selection + // and 'resetSelectionOnContextMenu' option is true. + var reset = cm.options.resetSelectionOnContextMenu; + if (reset && cm.doc.sel.contains(pos) == -1) + operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll); + + var oldCSS = te.style.cssText; + input.wrapper.style.position = "absolute"; + te.style.cssText = "position: fixed; width: 30px; height: 30px; top: " + (e.clientY - 5) + + "px; left: " + (e.clientX - 5) + "px; z-index: 1000; background: " + + (ie ? "rgba(255, 255, 255, .05)" : "transparent") + + "; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);"; + if (webkit) var oldScrollY = window.scrollY; // Work around Chrome issue (#2712) + display.input.focus(); + if (webkit) window.scrollTo(null, oldScrollY); + display.input.reset(); + // Adds "Select all" to context menu in FF + if (!cm.somethingSelected()) te.value = input.prevInput = " "; + input.contextMenuPending = true; + display.selForContextMenu = cm.doc.sel; + clearTimeout(display.detectingSelectAll); + + // Select-all will be greyed out if there's nothing to select, so + // this adds a zero-width space so that we can later check whether + // it got selected. + function prepareSelectAllHack() { + if (te.selectionStart != null) { + var selected = cm.somethingSelected(); + var extval = "\u200b" + (selected ? te.value : ""); + te.value = "\u21da"; // Used to catch context-menu undo + te.value = extval; + input.prevInput = selected ? "" : "\u200b"; + te.selectionStart = 1; te.selectionEnd = extval.length; + // Re-set this, in case some other handler touched the + // selection in the meantime. + display.selForContextMenu = cm.doc.sel; + } + } + function rehide() { + input.contextMenuPending = false; + input.wrapper.style.position = "relative"; + te.style.cssText = oldCSS; + if (ie && ie_version < 9) display.scrollbars.setScrollTop(display.scroller.scrollTop = scrollPos); + + // Try to detect the user choosing select-all + if (te.selectionStart != null) { + if (!ie || (ie && ie_version < 9)) prepareSelectAllHack(); + var i = 0, poll = function() { + if (display.selForContextMenu == cm.doc.sel && te.selectionStart == 0 && + te.selectionEnd > 0 && input.prevInput == "\u200b") + operation(cm, commands.selectAll)(cm); + else if (i++ < 10) display.detectingSelectAll = setTimeout(poll, 500); + else display.input.reset(); + }; + display.detectingSelectAll = setTimeout(poll, 200); + } + } + + if (ie && ie_version >= 9) prepareSelectAllHack(); + if (captureRightClick) { + e_stop(e); + var mouseup = function() { + off(window, "mouseup", mouseup); + setTimeout(rehide, 20); + }; + on(window, "mouseup", mouseup); + } else { + setTimeout(rehide, 50); + } + }, + + setUneditable: nothing, + + needsContentAttribute: false + }, TextareaInput.prototype); + + // CONTENTEDITABLE INPUT STYLE + + function ContentEditableInput(cm) { + this.cm = cm; + this.lastAnchorNode = this.lastAnchorOffset = this.lastFocusNode = this.lastFocusOffset = null; + this.polling = new Delayed(); + this.gracePeriod = false; + } + + ContentEditableInput.prototype = copyObj({ + init: function(display) { + var input = this, cm = input.cm; + var div = input.div = display.lineDiv; + div.contentEditable = "true"; + disableBrowserMagic(div); + + on(div, "paste", function(e) { + var pasted = e.clipboardData && e.clipboardData.getData("text/plain"); + if (pasted) { + e.preventDefault(); + cm.replaceSelection(pasted, null, "paste"); + } + }); + + on(div, "compositionstart", function(e) { + var data = e.data; + input.composing = {sel: cm.doc.sel, data: data, startData: data}; + if (!data) return; + var prim = cm.doc.sel.primary(); + var line = cm.getLine(prim.head.line); + var found = line.indexOf(data, Math.max(0, prim.head.ch - data.length)); + if (found > -1 && found <= prim.head.ch) + input.composing.sel = simpleSelection(Pos(prim.head.line, found), + Pos(prim.head.line, found + data.length)); + }); + on(div, "compositionupdate", function(e) { + input.composing.data = e.data; + }); + on(div, "compositionend", function(e) { + var ours = input.composing; + if (!ours) return; + if (e.data != ours.startData && !/\u200b/.test(e.data)) + ours.data = e.data; + // Need a small delay to prevent other code (input event, + // selection polling) from doing damage when fired right after + // compositionend. + setTimeout(function() { + if (!ours.handled) + input.applyComposition(ours); + if (input.composing == ours) + input.composing = null; + }, 50); + }); + + on(div, "touchstart", function() { + input.forceCompositionEnd(); + }); + + on(div, "input", function() { + if (input.composing) return; + if (!input.pollContent()) + runInOp(input.cm, function() {regChange(cm);}); + }); + + function onCopyCut(e) { + if (cm.somethingSelected()) { + lastCopied = cm.getSelections(); + if (e.type == "cut") cm.replaceSelection("", null, "cut"); + } else if (!cm.options.lineWiseCopyCut) { + return; + } else { + var ranges = copyableRanges(cm); + lastCopied = ranges.text; + if (e.type == "cut") { + cm.operation(function() { + cm.setSelections(ranges.ranges, 0, sel_dontScroll); + cm.replaceSelection("", null, "cut"); + }); + } + } + // iOS exposes the clipboard API, but seems to discard content inserted into it + if (e.clipboardData && !ios) { + e.preventDefault(); + e.clipboardData.clearData(); + e.clipboardData.setData("text/plain", lastCopied.join("\n")); + } else { + // Old-fashioned briefly-focus-a-textarea hack + var kludge = hiddenTextarea(), te = kludge.firstChild; + cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild); + te.value = lastCopied.join("\n"); + var hadFocus = document.activeElement; + selectInput(te); + setTimeout(function() { + cm.display.lineSpace.removeChild(kludge); + hadFocus.focus(); + }, 50); + } + } + on(div, "copy", onCopyCut); + on(div, "cut", onCopyCut); + }, + + prepareSelection: function() { + var result = prepareSelection(this.cm, false); + result.focus = this.cm.state.focused; + return result; + }, + + showSelection: function(info) { + if (!info || !this.cm.display.view.length) return; + if (info.focus) this.showPrimarySelection(); + this.showMultipleSelections(info); + }, + + showPrimarySelection: function() { + var sel = window.getSelection(), prim = this.cm.doc.sel.primary(); + var curAnchor = domToPos(this.cm, sel.anchorNode, sel.anchorOffset); + var curFocus = domToPos(this.cm, sel.focusNode, sel.focusOffset); + if (curAnchor && !curAnchor.bad && curFocus && !curFocus.bad && + cmp(minPos(curAnchor, curFocus), prim.from()) == 0 && + cmp(maxPos(curAnchor, curFocus), prim.to()) == 0) + return; + + var start = posToDOM(this.cm, prim.from()); + var end = posToDOM(this.cm, prim.to()); + if (!start && !end) return; + + var view = this.cm.display.view; + var old = sel.rangeCount && sel.getRangeAt(0); + if (!start) { + start = {node: view[0].measure.map[2], offset: 0}; + } else if (!end) { // FIXME dangerously hacky + var measure = view[view.length - 1].measure; + var map = measure.maps ? measure.maps[measure.maps.length - 1] : measure.map; + end = {node: map[map.length - 1], offset: map[map.length - 2] - map[map.length - 3]}; + } + + try { var rng = range(start.node, start.offset, end.offset, end.node); } + catch(e) {} // Our model of the DOM might be outdated, in which case the range we try to set can be impossible + if (rng) { + sel.removeAllRanges(); + sel.addRange(rng); + if (old && sel.anchorNode == null) sel.addRange(old); + else if (gecko) this.startGracePeriod(); + } + this.rememberSelection(); + }, + + startGracePeriod: function() { + var input = this; + clearTimeout(this.gracePeriod); + this.gracePeriod = setTimeout(function() { + input.gracePeriod = false; + if (input.selectionChanged()) + input.cm.operation(function() { input.cm.curOp.selectionChanged = true; }); + }, 20); + }, + + showMultipleSelections: function(info) { + removeChildrenAndAdd(this.cm.display.cursorDiv, info.cursors); + removeChildrenAndAdd(this.cm.display.selectionDiv, info.selection); + }, + + rememberSelection: function() { + var sel = window.getSelection(); + this.lastAnchorNode = sel.anchorNode; this.lastAnchorOffset = sel.anchorOffset; + this.lastFocusNode = sel.focusNode; this.lastFocusOffset = sel.focusOffset; + }, + + selectionInEditor: function() { + var sel = window.getSelection(); + if (!sel.rangeCount) return false; + var node = sel.getRangeAt(0).commonAncestorContainer; + return contains(this.div, node); + }, + + focus: function() { + if (this.cm.options.readOnly != "nocursor") this.div.focus(); + }, + blur: function() { this.div.blur(); }, + getField: function() { return this.div; }, + + supportsTouch: function() { return true; }, + + receivedFocus: function() { + var input = this; + if (this.selectionInEditor()) + this.pollSelection(); + else + runInOp(this.cm, function() { input.cm.curOp.selectionChanged = true; }); + + function poll() { + if (input.cm.state.focused) { + input.pollSelection(); + input.polling.set(input.cm.options.pollInterval, poll); + } + } + this.polling.set(this.cm.options.pollInterval, poll); + }, + + selectionChanged: function() { + var sel = window.getSelection(); + return sel.anchorNode != this.lastAnchorNode || sel.anchorOffset != this.lastAnchorOffset || + sel.focusNode != this.lastFocusNode || sel.focusOffset != this.lastFocusOffset; + }, + + pollSelection: function() { + if (!this.composing && !this.gracePeriod && this.selectionChanged()) { + var sel = window.getSelection(), cm = this.cm; + this.rememberSelection(); + var anchor = domToPos(cm, sel.anchorNode, sel.anchorOffset); + var head = domToPos(cm, sel.focusNode, sel.focusOffset); + if (anchor && head) runInOp(cm, function() { + setSelection(cm.doc, simpleSelection(anchor, head), sel_dontScroll); + if (anchor.bad || head.bad) cm.curOp.selectionChanged = true; + }); + } + }, + + pollContent: function() { + var cm = this.cm, display = cm.display, sel = cm.doc.sel.primary(); + var from = sel.from(), to = sel.to(); + if (from.line < display.viewFrom || to.line > display.viewTo - 1) return false; + + var fromIndex; + if (from.line == display.viewFrom || (fromIndex = findViewIndex(cm, from.line)) == 0) { + var fromLine = lineNo(display.view[0].line); + var fromNode = display.view[0].node; + } else { + var fromLine = lineNo(display.view[fromIndex].line); + var fromNode = display.view[fromIndex - 1].node.nextSibling; + } + var toIndex = findViewIndex(cm, to.line); + if (toIndex == display.view.length - 1) { + var toLine = display.viewTo - 1; + var toNode = display.view[toIndex].node; + } else { + var toLine = lineNo(display.view[toIndex + 1].line) - 1; + var toNode = display.view[toIndex + 1].node.previousSibling; + } + + var newText = splitLines(domTextBetween(cm, fromNode, toNode, fromLine, toLine)); + var oldText = getBetween(cm.doc, Pos(fromLine, 0), Pos(toLine, getLine(cm.doc, toLine).text.length)); + while (newText.length > 1 && oldText.length > 1) { + if (lst(newText) == lst(oldText)) { newText.pop(); oldText.pop(); toLine--; } + else if (newText[0] == oldText[0]) { newText.shift(); oldText.shift(); fromLine++; } + else break; + } + + var cutFront = 0, cutEnd = 0; + var newTop = newText[0], oldTop = oldText[0], maxCutFront = Math.min(newTop.length, oldTop.length); + while (cutFront < maxCutFront && newTop.charCodeAt(cutFront) == oldTop.charCodeAt(cutFront)) + ++cutFront; + var newBot = lst(newText), oldBot = lst(oldText); + var maxCutEnd = Math.min(newBot.length - (newText.length == 1 ? cutFront : 0), + oldBot.length - (oldText.length == 1 ? cutFront : 0)); + while (cutEnd < maxCutEnd && + newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1)) + ++cutEnd; + + newText[newText.length - 1] = newBot.slice(0, newBot.length - cutEnd); + newText[0] = newText[0].slice(cutFront); + + var chFrom = Pos(fromLine, cutFront); + var chTo = Pos(toLine, oldText.length ? lst(oldText).length - cutEnd : 0); + if (newText.length > 1 || newText[0] || cmp(chFrom, chTo)) { + replaceRange(cm.doc, newText, chFrom, chTo, "+input"); + return true; + } + }, + + ensurePolled: function() { + this.forceCompositionEnd(); + }, + reset: function() { + this.forceCompositionEnd(); + }, + forceCompositionEnd: function() { + if (!this.composing || this.composing.handled) return; + this.applyComposition(this.composing); + this.composing.handled = true; + this.div.blur(); + this.div.focus(); + }, + applyComposition: function(composing) { + if (composing.data && composing.data != composing.startData) + operation(this.cm, applyTextInput)(this.cm, composing.data, 0, composing.sel); + }, + + setUneditable: function(node) { + node.setAttribute("contenteditable", "false"); + }, + + onKeyPress: function(e) { + e.preventDefault(); + operation(this.cm, applyTextInput)(this.cm, String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode), 0); + }, + + onContextMenu: nothing, + resetPosition: nothing, + + needsContentAttribute: true + }, ContentEditableInput.prototype); + + function posToDOM(cm, pos) { + var view = findViewForLine(cm, pos.line); + if (!view || view.hidden) return null; + var line = getLine(cm.doc, pos.line); + var info = mapFromLineView(view, line, pos.line); + + var order = getOrder(line), side = "left"; + if (order) { + var partPos = getBidiPartAt(order, pos.ch); + side = partPos % 2 ? "right" : "left"; + } + var result = nodeAndOffsetInLineMap(info.map, pos.ch, side); + result.offset = result.collapse == "right" ? result.end : result.start; + return result; + } + + function badPos(pos, bad) { if (bad) pos.bad = true; return pos; } + + function domToPos(cm, node, offset) { + var lineNode; + if (node == cm.display.lineDiv) { + lineNode = cm.display.lineDiv.childNodes[offset]; + if (!lineNode) return badPos(cm.clipPos(Pos(cm.display.viewTo - 1)), true); + node = null; offset = 0; + } else { + for (lineNode = node;; lineNode = lineNode.parentNode) { + if (!lineNode || lineNode == cm.display.lineDiv) return null; + if (lineNode.parentNode && lineNode.parentNode == cm.display.lineDiv) break; + } + } + for (var i = 0; i < cm.display.view.length; i++) { + var lineView = cm.display.view[i]; + if (lineView.node == lineNode) + return locateNodeInLineView(lineView, node, offset); + } + } + + function locateNodeInLineView(lineView, node, offset) { + var wrapper = lineView.text.firstChild, bad = false; + if (!node || !contains(wrapper, node)) return badPos(Pos(lineNo(lineView.line), 0), true); + if (node == wrapper) { + bad = true; + node = wrapper.childNodes[offset]; + offset = 0; + if (!node) { + var line = lineView.rest ? lst(lineView.rest) : lineView.line; + return badPos(Pos(lineNo(line), line.text.length), bad); + } + } + + var textNode = node.nodeType == 3 ? node : null, topNode = node; + if (!textNode && node.childNodes.length == 1 && node.firstChild.nodeType == 3) { + textNode = node.firstChild; + if (offset) offset = textNode.nodeValue.length; + } + while (topNode.parentNode != wrapper) topNode = topNode.parentNode; + var measure = lineView.measure, maps = measure.maps; + + function find(textNode, topNode, offset) { + for (var i = -1; i < (maps ? maps.length : 0); i++) { + var map = i < 0 ? measure.map : maps[i]; + for (var j = 0; j < map.length; j += 3) { + var curNode = map[j + 2]; + if (curNode == textNode || curNode == topNode) { + var line = lineNo(i < 0 ? lineView.line : lineView.rest[i]); + var ch = map[j] + offset; + if (offset < 0 || curNode != textNode) ch = map[j + (offset ? 1 : 0)]; + return Pos(line, ch); + } + } + } + } + var found = find(textNode, topNode, offset); + if (found) return badPos(found, bad); + + // FIXME this is all really shaky. might handle the few cases it needs to handle, but likely to cause problems + for (var after = topNode.nextSibling, dist = textNode ? textNode.nodeValue.length - offset : 0; after; after = after.nextSibling) { + found = find(after, after.firstChild, 0); + if (found) + return badPos(Pos(found.line, found.ch - dist), bad); + else + dist += after.textContent.length; + } + for (var before = topNode.previousSibling, dist = offset; before; before = before.previousSibling) { + found = find(before, before.firstChild, -1); + if (found) + return badPos(Pos(found.line, found.ch + dist), bad); + else + dist += after.textContent.length; + } + } + + function domTextBetween(cm, from, to, fromLine, toLine) { + var text = "", closing = false; + function recognizeMarker(id) { return function(marker) { return marker.id == id; }; } + function walk(node) { + if (node.nodeType == 1) { + var cmText = node.getAttribute("cm-text"); + if (cmText != null) { + if (cmText == "") cmText = node.textContent.replace(/\u200b/g, ""); + text += cmText; + return; + } + var markerID = node.getAttribute("cm-marker"), range; + if (markerID) { + var found = cm.findMarks(Pos(fromLine, 0), Pos(toLine + 1, 0), recognizeMarker(+markerID)); + if (found.length && (range = found[0].find())) + text += getBetween(cm.doc, range.from, range.to).join("\n"); + return; + } + if (node.getAttribute("contenteditable") == "false") return; + for (var i = 0; i < node.childNodes.length; i++) + walk(node.childNodes[i]); + if (/^(pre|div|p)$/i.test(node.nodeName)) + closing = true; + } else if (node.nodeType == 3) { + var val = node.nodeValue; + if (!val) return; + if (closing) { + text += "\n"; + closing = false; + } + text += val; + } + } + for (;;) { + walk(from); + if (from == to) break; + from = from.nextSibling; + } + return text; + } + + CodeMirror.inputStyles = {"textarea": TextareaInput, "contenteditable": ContentEditableInput}; + + // SELECTION / CURSOR + + // Selection objects are immutable. A new one is created every time + // the selection changes. A selection is one or more non-overlapping + // (and non-touching) ranges, sorted, and an integer that indicates + // which one is the primary selection (the one that's scrolled into + // view, that getCursor returns, etc). + function Selection(ranges, primIndex) { + this.ranges = ranges; + this.primIndex = primIndex; + } + + Selection.prototype = { + primary: function() { return this.ranges[this.primIndex]; }, + equals: function(other) { + if (other == this) return true; + if (other.primIndex != this.primIndex || other.ranges.length != this.ranges.length) return false; + for (var i = 0; i < this.ranges.length; i++) { + var here = this.ranges[i], there = other.ranges[i]; + if (cmp(here.anchor, there.anchor) != 0 || cmp(here.head, there.head) != 0) return false; + } + return true; + }, + deepCopy: function() { + for (var out = [], i = 0; i < this.ranges.length; i++) + out[i] = new Range(copyPos(this.ranges[i].anchor), copyPos(this.ranges[i].head)); + return new Selection(out, this.primIndex); + }, + somethingSelected: function() { + for (var i = 0; i < this.ranges.length; i++) + if (!this.ranges[i].empty()) return true; + return false; + }, + contains: function(pos, end) { + if (!end) end = pos; + for (var i = 0; i < this.ranges.length; i++) { + var range = this.ranges[i]; + if (cmp(end, range.from()) >= 0 && cmp(pos, range.to()) <= 0) + return i; + } + return -1; + } + }; + + function Range(anchor, head) { + this.anchor = anchor; this.head = head; + } + + Range.prototype = { + from: function() { return minPos(this.anchor, this.head); }, + to: function() { return maxPos(this.anchor, this.head); }, + empty: function() { + return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch; + } + }; + + // Take an unsorted, potentially overlapping set of ranges, and + // build a selection out of it. 'Consumes' ranges array (modifying + // it). + function normalizeSelection(ranges, primIndex) { + var prim = ranges[primIndex]; + ranges.sort(function(a, b) { return cmp(a.from(), b.from()); }); + primIndex = indexOf(ranges, prim); + for (var i = 1; i < ranges.length; i++) { + var cur = ranges[i], prev = ranges[i - 1]; + if (cmp(prev.to(), cur.from()) >= 0) { + var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to()); + var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head; + if (i <= primIndex) --primIndex; + ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to)); + } + } + return new Selection(ranges, primIndex); + } + + function simpleSelection(anchor, head) { + return new Selection([new Range(anchor, head || anchor)], 0); + } + + // Most of the external API clips given positions to make sure they + // actually exist within the document. + function clipLine(doc, n) {return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1));} + function clipPos(doc, pos) { + if (pos.line < doc.first) return Pos(doc.first, 0); + var last = doc.first + doc.size - 1; + if (pos.line > last) return Pos(last, getLine(doc, last).text.length); + return clipToLen(pos, getLine(doc, pos.line).text.length); + } + function clipToLen(pos, linelen) { + var ch = pos.ch; + if (ch == null || ch > linelen) return Pos(pos.line, linelen); + else if (ch < 0) return Pos(pos.line, 0); + else return pos; + } + function isLine(doc, l) {return l >= doc.first && l < doc.first + doc.size;} + function clipPosArray(doc, array) { + for (var out = [], i = 0; i < array.length; i++) out[i] = clipPos(doc, array[i]); + return out; + } + + // SELECTION UPDATES + + // The 'scroll' parameter given to many of these indicated whether + // the new cursor position should be scrolled into view after + // modifying the selection. + + // If shift is held or the extend flag is set, extends a range to + // include a given position (and optionally a second position). + // Otherwise, simply returns the range between the given positions. + // Used for cursor motion and such. + function extendRange(doc, range, head, other) { + if (doc.cm && doc.cm.display.shift || doc.extend) { + var anchor = range.anchor; + if (other) { + var posBefore = cmp(head, anchor) < 0; + if (posBefore != (cmp(other, anchor) < 0)) { + anchor = head; + head = other; + } else if (posBefore != (cmp(head, other) < 0)) { + head = other; + } + } + return new Range(anchor, head); + } else { + return new Range(other || head, head); + } + } + + // Extend the primary selection range, discard the rest. + function extendSelection(doc, head, other, options) { + setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options); + } + + // Extend all selections (pos is an array of selections with length + // equal the number of selections) + function extendSelections(doc, heads, options) { + for (var out = [], i = 0; i < doc.sel.ranges.length; i++) + out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null); + var newSel = normalizeSelection(out, doc.sel.primIndex); + setSelection(doc, newSel, options); + } + + // Updates a single range in the selection. + function replaceOneSelection(doc, i, range, options) { + var ranges = doc.sel.ranges.slice(0); + ranges[i] = range; + setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options); + } + + // Reset the selection to a single range. + function setSimpleSelection(doc, anchor, head, options) { + setSelection(doc, simpleSelection(anchor, head), options); + } + + // Give beforeSelectionChange handlers a change to influence a + // selection update. + function filterSelectionChange(doc, sel) { + var obj = { + ranges: sel.ranges, + update: function(ranges) { + this.ranges = []; + for (var i = 0; i < ranges.length; i++) + this.ranges[i] = new Range(clipPos(doc, ranges[i].anchor), + clipPos(doc, ranges[i].head)); + } + }; + signal(doc, "beforeSelectionChange", doc, obj); + if (doc.cm) signal(doc.cm, "beforeSelectionChange", doc.cm, obj); + if (obj.ranges != sel.ranges) return normalizeSelection(obj.ranges, obj.ranges.length - 1); + else return sel; + } + + function setSelectionReplaceHistory(doc, sel, options) { + var done = doc.history.done, last = lst(done); + if (last && last.ranges) { + done[done.length - 1] = sel; + setSelectionNoUndo(doc, sel, options); + } else { + setSelection(doc, sel, options); + } + } + + // Set a new selection. + function setSelection(doc, sel, options) { + setSelectionNoUndo(doc, sel, options); + addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options); + } + + function setSelectionNoUndo(doc, sel, options) { + if (hasHandler(doc, "beforeSelectionChange") || doc.cm && hasHandler(doc.cm, "beforeSelectionChange")) + sel = filterSelectionChange(doc, sel); + + var bias = options && options.bias || + (cmp(sel.primary().head, doc.sel.primary().head) < 0 ? -1 : 1); + setSelectionInner(doc, skipAtomicInSelection(doc, sel, bias, true)); + + if (!(options && options.scroll === false) && doc.cm) + ensureCursorVisible(doc.cm); + } + + function setSelectionInner(doc, sel) { + if (sel.equals(doc.sel)) return; + + doc.sel = sel; + + if (doc.cm) { + doc.cm.curOp.updateInput = doc.cm.curOp.selectionChanged = true; + signalCursorActivity(doc.cm); + } + signalLater(doc, "cursorActivity", doc); + } + + // Verify that the selection does not partially select any atomic + // marked ranges. + function reCheckSelection(doc) { + setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false), sel_dontScroll); + } + + // Return a selection that does not partially select any atomic + // ranges. + function skipAtomicInSelection(doc, sel, bias, mayClear) { + var out; + for (var i = 0; i < sel.ranges.length; i++) { + var range = sel.ranges[i]; + var newAnchor = skipAtomic(doc, range.anchor, bias, mayClear); + var newHead = skipAtomic(doc, range.head, bias, mayClear); + if (out || newAnchor != range.anchor || newHead != range.head) { + if (!out) out = sel.ranges.slice(0, i); + out[i] = new Range(newAnchor, newHead); + } + } + return out ? normalizeSelection(out, sel.primIndex) : sel; + } + + // Ensure a given position is not inside an atomic range. + function skipAtomic(doc, pos, bias, mayClear) { + var flipped = false, curPos = pos; + var dir = bias || 1; + doc.cantEdit = false; + search: for (;;) { + var line = getLine(doc, curPos.line); + if (line.markedSpans) { + for (var i = 0; i < line.markedSpans.length; ++i) { + var sp = line.markedSpans[i], m = sp.marker; + if ((sp.from == null || (m.inclusiveLeft ? sp.from <= curPos.ch : sp.from < curPos.ch)) && + (sp.to == null || (m.inclusiveRight ? sp.to >= curPos.ch : sp.to > curPos.ch))) { + if (mayClear) { + signal(m, "beforeCursorEnter"); + if (m.explicitlyCleared) { + if (!line.markedSpans) break; + else {--i; continue;} + } + } + if (!m.atomic) continue; + var newPos = m.find(dir < 0 ? -1 : 1); + if (cmp(newPos, curPos) == 0) { + newPos.ch += dir; + if (newPos.ch < 0) { + if (newPos.line > doc.first) newPos = clipPos(doc, Pos(newPos.line - 1)); + else newPos = null; + } else if (newPos.ch > line.text.length) { + if (newPos.line < doc.first + doc.size - 1) newPos = Pos(newPos.line + 1, 0); + else newPos = null; + } + if (!newPos) { + if (flipped) { + // Driven in a corner -- no valid cursor position found at all + // -- try again *with* clearing, if we didn't already + if (!mayClear) return skipAtomic(doc, pos, bias, true); + // Otherwise, turn off editing until further notice, and return the start of the doc + doc.cantEdit = true; + return Pos(doc.first, 0); + } + flipped = true; newPos = pos; dir = -dir; + } + } + curPos = newPos; + continue search; + } + } + } + return curPos; + } + } + + // SELECTION DRAWING + + function updateSelection(cm) { + cm.display.input.showSelection(cm.display.input.prepareSelection()); + } + + function prepareSelection(cm, primary) { + var doc = cm.doc, result = {}; + var curFragment = result.cursors = document.createDocumentFragment(); + var selFragment = result.selection = document.createDocumentFragment(); + + for (var i = 0; i < doc.sel.ranges.length; i++) { + if (primary === false && i == doc.sel.primIndex) continue; + var range = doc.sel.ranges[i]; + var collapsed = range.empty(); + if (collapsed || cm.options.showCursorWhenSelecting) + drawSelectionCursor(cm, range, curFragment); + if (!collapsed) + drawSelectionRange(cm, range, selFragment); + } + return result; + } + + // Draws a cursor for the given range + function drawSelectionCursor(cm, range, output) { + var pos = cursorCoords(cm, range.head, "div", null, null, !cm.options.singleCursorHeightPerLine); + + var cursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor")); + cursor.style.left = pos.left + "px"; + cursor.style.top = pos.top + "px"; + cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px"; + + if (pos.other) { + // Secondary cursor, shown when on a 'jump' in bi-directional text + var otherCursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor")); + otherCursor.style.display = ""; + otherCursor.style.left = pos.other.left + "px"; + otherCursor.style.top = pos.other.top + "px"; + otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + "px"; + } + } + + // Draws the given range as a highlighted selection + function drawSelectionRange(cm, range, output) { + var display = cm.display, doc = cm.doc; + var fragment = document.createDocumentFragment(); + var padding = paddingH(cm.display), leftSide = padding.left; + var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right; + + function add(left, top, width, bottom) { + if (top < 0) top = 0; + top = Math.round(top); + bottom = Math.round(bottom); + fragment.appendChild(elt("div", null, "CodeMirror-selected", "position: absolute; left: " + left + + "px; top: " + top + "px; width: " + (width == null ? rightSide - left : width) + + "px; height: " + (bottom - top) + "px")); + } + + function drawForLine(line, fromArg, toArg) { + var lineObj = getLine(doc, line); + var lineLen = lineObj.text.length; + var start, end; + function coords(ch, bias) { + return charCoords(cm, Pos(line, ch), "div", lineObj, bias); + } + + iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function(from, to, dir) { + var leftPos = coords(from, "left"), rightPos, left, right; + if (from == to) { + rightPos = leftPos; + left = right = leftPos.left; + } else { + rightPos = coords(to - 1, "right"); + if (dir == "rtl") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; } + left = leftPos.left; + right = rightPos.right; + } + if (fromArg == null && from == 0) left = leftSide; + if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part + add(left, leftPos.top, null, leftPos.bottom); + left = leftSide; + if (leftPos.bottom < rightPos.top) add(left, leftPos.bottom, null, rightPos.top); + } + if (toArg == null && to == lineLen) right = rightSide; + if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left) + start = leftPos; + if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right) + end = rightPos; + if (left < leftSide + 1) left = leftSide; + add(left, rightPos.top, right - left, rightPos.bottom); + }); + return {start: start, end: end}; + } + + var sFrom = range.from(), sTo = range.to(); + if (sFrom.line == sTo.line) { + drawForLine(sFrom.line, sFrom.ch, sTo.ch); + } else { + var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line); + var singleVLine = visualLine(fromLine) == visualLine(toLine); + var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end; + var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start; + if (singleVLine) { + if (leftEnd.top < rightStart.top - 2) { + add(leftEnd.right, leftEnd.top, null, leftEnd.bottom); + add(leftSide, rightStart.top, rightStart.left, rightStart.bottom); + } else { + add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom); + } + } + if (leftEnd.bottom < rightStart.top) + add(leftSide, leftEnd.bottom, null, rightStart.top); + } + + output.appendChild(fragment); + } + + // Cursor-blinking + function restartBlink(cm) { + if (!cm.state.focused) return; + var display = cm.display; + clearInterval(display.blinker); + var on = true; + display.cursorDiv.style.visibility = ""; + if (cm.options.cursorBlinkRate > 0) + display.blinker = setInterval(function() { + display.cursorDiv.style.visibility = (on = !on) ? "" : "hidden"; + }, cm.options.cursorBlinkRate); + else if (cm.options.cursorBlinkRate < 0) + display.cursorDiv.style.visibility = "hidden"; + } + + // HIGHLIGHT WORKER + + function startWorker(cm, time) { + if (cm.doc.mode.startState && cm.doc.frontier < cm.display.viewTo) + cm.state.highlight.set(time, bind(highlightWorker, cm)); + } + + function highlightWorker(cm) { + var doc = cm.doc; + if (doc.frontier < doc.first) doc.frontier = doc.first; + if (doc.frontier >= cm.display.viewTo) return; + var end = +new Date + cm.options.workTime; + var state = copyState(doc.mode, getStateBefore(cm, doc.frontier)); + var changedLines = []; + + doc.iter(doc.frontier, Math.min(doc.first + doc.size, cm.display.viewTo + 500), function(line) { + if (doc.frontier >= cm.display.viewFrom) { // Visible + var oldStyles = line.styles; + var highlighted = highlightLine(cm, line, state, true); + line.styles = highlighted.styles; + var oldCls = line.styleClasses, newCls = highlighted.classes; + if (newCls) line.styleClasses = newCls; + else if (oldCls) line.styleClasses = null; + var ischange = !oldStyles || oldStyles.length != line.styles.length || + oldCls != newCls && (!oldCls || !newCls || oldCls.bgClass != newCls.bgClass || oldCls.textClass != newCls.textClass); + for (var i = 0; !ischange && i < oldStyles.length; ++i) ischange = oldStyles[i] != line.styles[i]; + if (ischange) changedLines.push(doc.frontier); + line.stateAfter = copyState(doc.mode, state); + } else { + processLine(cm, line.text, state); + line.stateAfter = doc.frontier % 5 == 0 ? copyState(doc.mode, state) : null; + } + ++doc.frontier; + if (+new Date > end) { + startWorker(cm, cm.options.workDelay); + return true; + } + }); + if (changedLines.length) runInOp(cm, function() { + for (var i = 0; i < changedLines.length; i++) + regLineChange(cm, changedLines[i], "text"); + }); + } + + // Finds the line to start with when starting a parse. Tries to + // find a line with a stateAfter, so that it can start with a + // valid state. If that fails, it returns the line with the + // smallest indentation, which tends to need the least context to + // parse correctly. + function findStartLine(cm, n, precise) { + var minindent, minline, doc = cm.doc; + var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100); + for (var search = n; search > lim; --search) { + if (search <= doc.first) return doc.first; + var line = getLine(doc, search - 1); + if (line.stateAfter && (!precise || search <= doc.frontier)) return search; + var indented = countColumn(line.text, null, cm.options.tabSize); + if (minline == null || minindent > indented) { + minline = search - 1; + minindent = indented; + } + } + return minline; + } + + function getStateBefore(cm, n, precise) { + var doc = cm.doc, display = cm.display; + if (!doc.mode.startState) return true; + var pos = findStartLine(cm, n, precise), state = pos > doc.first && getLine(doc, pos-1).stateAfter; + if (!state) state = startState(doc.mode); + else state = copyState(doc.mode, state); + doc.iter(pos, n, function(line) { + processLine(cm, line.text, state); + var save = pos == n - 1 || pos % 5 == 0 || pos >= display.viewFrom && pos < display.viewTo; + line.stateAfter = save ? copyState(doc.mode, state) : null; + ++pos; + }); + if (precise) doc.frontier = pos; + return state; + } + + // POSITION MEASUREMENT + + function paddingTop(display) {return display.lineSpace.offsetTop;} + function paddingVert(display) {return display.mover.offsetHeight - display.lineSpace.offsetHeight;} + function paddingH(display) { + if (display.cachedPaddingH) return display.cachedPaddingH; + var e = removeChildrenAndAdd(display.measure, elt("pre", "x")); + var style = window.getComputedStyle ? window.getComputedStyle(e) : e.currentStyle; + var data = {left: parseInt(style.paddingLeft), right: parseInt(style.paddingRight)}; + if (!isNaN(data.left) && !isNaN(data.right)) display.cachedPaddingH = data; + return data; + } + + function scrollGap(cm) { return scrollerGap - cm.display.nativeBarWidth; } + function displayWidth(cm) { + return cm.display.scroller.clientWidth - scrollGap(cm) - cm.display.barWidth; + } + function displayHeight(cm) { + return cm.display.scroller.clientHeight - scrollGap(cm) - cm.display.barHeight; + } + + // Ensure the lineView.wrapping.heights array is populated. This is + // an array of bottom offsets for the lines that make up a drawn + // line. When lineWrapping is on, there might be more than one + // height. + function ensureLineHeights(cm, lineView, rect) { + var wrapping = cm.options.lineWrapping; + var curWidth = wrapping && displayWidth(cm); + if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) { + var heights = lineView.measure.heights = []; + if (wrapping) { + lineView.measure.width = curWidth; + var rects = lineView.text.firstChild.getClientRects(); + for (var i = 0; i < rects.length - 1; i++) { + var cur = rects[i], next = rects[i + 1]; + if (Math.abs(cur.bottom - next.bottom) > 2) + heights.push((cur.bottom + next.top) / 2 - rect.top); + } + } + heights.push(rect.bottom - rect.top); + } + } + + // Find a line map (mapping character offsets to text nodes) and a + // measurement cache for the given line number. (A line view might + // contain multiple lines when collapsed ranges are present.) + function mapFromLineView(lineView, line, lineN) { + if (lineView.line == line) + return {map: lineView.measure.map, cache: lineView.measure.cache}; + for (var i = 0; i < lineView.rest.length; i++) + if (lineView.rest[i] == line) + return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]}; + for (var i = 0; i < lineView.rest.length; i++) + if (lineNo(lineView.rest[i]) > lineN) + return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i], before: true}; + } + + // Render a line into the hidden node display.externalMeasured. Used + // when measurement is needed for a line that's not in the viewport. + function updateExternalMeasurement(cm, line) { + line = visualLine(line); + var lineN = lineNo(line); + var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN); + view.lineN = lineN; + var built = view.built = buildLineContent(cm, view); + view.text = built.pre; + removeChildrenAndAdd(cm.display.lineMeasure, built.pre); + return view; + } + + // Get a {top, bottom, left, right} box (in line-local coordinates) + // for a given character. + function measureChar(cm, line, ch, bias) { + return measureCharPrepared(cm, prepareMeasureForLine(cm, line), ch, bias); + } + + // Find a line view that corresponds to the given line number. + function findViewForLine(cm, lineN) { + if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo) + return cm.display.view[findViewIndex(cm, lineN)]; + var ext = cm.display.externalMeasured; + if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size) + return ext; + } + + // Measurement can be split in two steps, the set-up work that + // applies to the whole line, and the measurement of the actual + // character. Functions like coordsChar, that need to do a lot of + // measurements in a row, can thus ensure that the set-up work is + // only done once. + function prepareMeasureForLine(cm, line) { + var lineN = lineNo(line); + var view = findViewForLine(cm, lineN); + if (view && !view.text) + view = null; + else if (view && view.changes) + updateLineForChanges(cm, view, lineN, getDimensions(cm)); + if (!view) + view = updateExternalMeasurement(cm, line); + + var info = mapFromLineView(view, line, lineN); + return { + line: line, view: view, rect: null, + map: info.map, cache: info.cache, before: info.before, + hasHeights: false + }; + } + + // Given a prepared measurement object, measures the position of an + // actual character (or fetches it from the cache). + function measureCharPrepared(cm, prepared, ch, bias, varHeight) { + if (prepared.before) ch = -1; + var key = ch + (bias || ""), found; + if (prepared.cache.hasOwnProperty(key)) { + found = prepared.cache[key]; + } else { + if (!prepared.rect) + prepared.rect = prepared.view.text.getBoundingClientRect(); + if (!prepared.hasHeights) { + ensureLineHeights(cm, prepared.view, prepared.rect); + prepared.hasHeights = true; + } + found = measureCharInner(cm, prepared, ch, bias); + if (!found.bogus) prepared.cache[key] = found; + } + return {left: found.left, right: found.right, + top: varHeight ? found.rtop : found.top, + bottom: varHeight ? found.rbottom : found.bottom}; + } + + var nullRect = {left: 0, right: 0, top: 0, bottom: 0}; + + function nodeAndOffsetInLineMap(map, ch, bias) { + var node, start, end, collapse; + // First, search the line map for the text node corresponding to, + // or closest to, the target character. + for (var i = 0; i < map.length; i += 3) { + var mStart = map[i], mEnd = map[i + 1]; + if (ch < mStart) { + start = 0; end = 1; + collapse = "left"; + } else if (ch < mEnd) { + start = ch - mStart; + end = start + 1; + } else if (i == map.length - 3 || ch == mEnd && map[i + 3] > ch) { + end = mEnd - mStart; + start = end - 1; + if (ch >= mEnd) collapse = "right"; + } + if (start != null) { + node = map[i + 2]; + if (mStart == mEnd && bias == (node.insertLeft ? "left" : "right")) + collapse = bias; + if (bias == "left" && start == 0) + while (i && map[i - 2] == map[i - 3] && map[i - 1].insertLeft) { + node = map[(i -= 3) + 2]; + collapse = "left"; + } + if (bias == "right" && start == mEnd - mStart) + while (i < map.length - 3 && map[i + 3] == map[i + 4] && !map[i + 5].insertLeft) { + node = map[(i += 3) + 2]; + collapse = "right"; + } + break; + } + } + return {node: node, start: start, end: end, collapse: collapse, coverStart: mStart, coverEnd: mEnd}; + } + + function measureCharInner(cm, prepared, ch, bias) { + var place = nodeAndOffsetInLineMap(prepared.map, ch, bias); + var node = place.node, start = place.start, end = place.end, collapse = place.collapse; + + var rect; + if (node.nodeType == 3) { // If it is a text node, use a range to retrieve the coordinates. + for (var i = 0; i < 4; i++) { // Retry a maximum of 4 times when nonsense rectangles are returned + while (start && isExtendingChar(prepared.line.text.charAt(place.coverStart + start))) --start; + while (place.coverStart + end < place.coverEnd && isExtendingChar(prepared.line.text.charAt(place.coverStart + end))) ++end; + if (ie && ie_version < 9 && start == 0 && end == place.coverEnd - place.coverStart) { + rect = node.parentNode.getBoundingClientRect(); + } else if (ie && cm.options.lineWrapping) { + var rects = range(node, start, end).getClientRects(); + if (rects.length) + rect = rects[bias == "right" ? rects.length - 1 : 0]; + else + rect = nullRect; + } else { + rect = range(node, start, end).getBoundingClientRect() || nullRect; + } + if (rect.left || rect.right || start == 0) break; + end = start; + start = start - 1; + collapse = "right"; + } + if (ie && ie_version < 11) rect = maybeUpdateRectForZooming(cm.display.measure, rect); + } else { // If it is a widget, simply get the box for the whole widget. + if (start > 0) collapse = bias = "right"; + var rects; + if (cm.options.lineWrapping && (rects = node.getClientRects()).length > 1) + rect = rects[bias == "right" ? rects.length - 1 : 0]; + else + rect = node.getBoundingClientRect(); + } + if (ie && ie_version < 9 && !start && (!rect || !rect.left && !rect.right)) { + var rSpan = node.parentNode.getClientRects()[0]; + if (rSpan) + rect = {left: rSpan.left, right: rSpan.left + charWidth(cm.display), top: rSpan.top, bottom: rSpan.bottom}; + else + rect = nullRect; + } + + var rtop = rect.top - prepared.rect.top, rbot = rect.bottom - prepared.rect.top; + var mid = (rtop + rbot) / 2; + var heights = prepared.view.measure.heights; + for (var i = 0; i < heights.length - 1; i++) + if (mid < heights[i]) break; + var top = i ? heights[i - 1] : 0, bot = heights[i]; + var result = {left: (collapse == "right" ? rect.right : rect.left) - prepared.rect.left, + right: (collapse == "left" ? rect.left : rect.right) - prepared.rect.left, + top: top, bottom: bot}; + if (!rect.left && !rect.right) result.bogus = true; + if (!cm.options.singleCursorHeightPerLine) { result.rtop = rtop; result.rbottom = rbot; } + + return result; + } + + // Work around problem with bounding client rects on ranges being + // returned incorrectly when zoomed on IE10 and below. + function maybeUpdateRectForZooming(measure, rect) { + if (!window.screen || screen.logicalXDPI == null || + screen.logicalXDPI == screen.deviceXDPI || !hasBadZoomedRects(measure)) + return rect; + var scaleX = screen.logicalXDPI / screen.deviceXDPI; + var scaleY = screen.logicalYDPI / screen.deviceYDPI; + return {left: rect.left * scaleX, right: rect.right * scaleX, + top: rect.top * scaleY, bottom: rect.bottom * scaleY}; + } + + function clearLineMeasurementCacheFor(lineView) { + if (lineView.measure) { + lineView.measure.cache = {}; + lineView.measure.heights = null; + if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++) + lineView.measure.caches[i] = {}; + } + } + + function clearLineMeasurementCache(cm) { + cm.display.externalMeasure = null; + removeChildren(cm.display.lineMeasure); + for (var i = 0; i < cm.display.view.length; i++) + clearLineMeasurementCacheFor(cm.display.view[i]); + } + + function clearCaches(cm) { + clearLineMeasurementCache(cm); + cm.display.cachedCharWidth = cm.display.cachedTextHeight = cm.display.cachedPaddingH = null; + if (!cm.options.lineWrapping) cm.display.maxLineChanged = true; + cm.display.lineNumChars = null; + } + + function pageScrollX() { return window.pageXOffset || (document.documentElement || document.body).scrollLeft; } + function pageScrollY() { return window.pageYOffset || (document.documentElement || document.body).scrollTop; } + + // Converts a {top, bottom, left, right} box from line-local + // coordinates into another coordinate system. Context may be one of + // "line", "div" (display.lineDiv), "local"/null (editor), "window", + // or "page". + function intoCoordSystem(cm, lineObj, rect, context) { + if (lineObj.widgets) for (var i = 0; i < lineObj.widgets.length; ++i) if (lineObj.widgets[i].above) { + var size = widgetHeight(lineObj.widgets[i]); + rect.top += size; rect.bottom += size; + } + if (context == "line") return rect; + if (!context) context = "local"; + var yOff = heightAtLine(lineObj); + if (context == "local") yOff += paddingTop(cm.display); + else yOff -= cm.display.viewOffset; + if (context == "page" || context == "window") { + var lOff = cm.display.lineSpace.getBoundingClientRect(); + yOff += lOff.top + (context == "window" ? 0 : pageScrollY()); + var xOff = lOff.left + (context == "window" ? 0 : pageScrollX()); + rect.left += xOff; rect.right += xOff; + } + rect.top += yOff; rect.bottom += yOff; + return rect; + } + + // Coverts a box from "div" coords to another coordinate system. + // Context may be "window", "page", "div", or "local"/null. + function fromCoordSystem(cm, coords, context) { + if (context == "div") return coords; + var left = coords.left, top = coords.top; + // First move into "page" coordinate system + if (context == "page") { + left -= pageScrollX(); + top -= pageScrollY(); + } else if (context == "local" || !context) { + var localBox = cm.display.sizer.getBoundingClientRect(); + left += localBox.left; + top += localBox.top; + } + + var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect(); + return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}; + } + + function charCoords(cm, pos, context, lineObj, bias) { + if (!lineObj) lineObj = getLine(cm.doc, pos.line); + return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch, bias), context); + } + + // Returns a box for a given cursor position, which may have an + // 'other' property containing the position of the secondary cursor + // on a bidi boundary. + function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) { + lineObj = lineObj || getLine(cm.doc, pos.line); + if (!preparedMeasure) preparedMeasure = prepareMeasureForLine(cm, lineObj); + function get(ch, right) { + var m = measureCharPrepared(cm, preparedMeasure, ch, right ? "right" : "left", varHeight); + if (right) m.left = m.right; else m.right = m.left; + return intoCoordSystem(cm, lineObj, m, context); + } + function getBidi(ch, partPos) { + var part = order[partPos], right = part.level % 2; + if (ch == bidiLeft(part) && partPos && part.level < order[partPos - 1].level) { + part = order[--partPos]; + ch = bidiRight(part) - (part.level % 2 ? 0 : 1); + right = true; + } else if (ch == bidiRight(part) && partPos < order.length - 1 && part.level < order[partPos + 1].level) { + part = order[++partPos]; + ch = bidiLeft(part) - part.level % 2; + right = false; + } + if (right && ch == part.to && ch > part.from) return get(ch - 1); + return get(ch, right); + } + var order = getOrder(lineObj), ch = pos.ch; + if (!order) return get(ch); + var partPos = getBidiPartAt(order, ch); + var val = getBidi(ch, partPos); + if (bidiOther != null) val.other = getBidi(ch, bidiOther); + return val; + } + + // Used to cheaply estimate the coordinates for a position. Used for + // intermediate scroll updates. + function estimateCoords(cm, pos) { + var left = 0, pos = clipPos(cm.doc, pos); + if (!cm.options.lineWrapping) left = charWidth(cm.display) * pos.ch; + var lineObj = getLine(cm.doc, pos.line); + var top = heightAtLine(lineObj) + paddingTop(cm.display); + return {left: left, right: left, top: top, bottom: top + lineObj.height}; + } + + // Positions returned by coordsChar contain some extra information. + // xRel is the relative x position of the input coordinates compared + // to the found position (so xRel > 0 means the coordinates are to + // the right of the character position, for example). When outside + // is true, that means the coordinates lie outside the line's + // vertical range. + function PosWithInfo(line, ch, outside, xRel) { + var pos = Pos(line, ch); + pos.xRel = xRel; + if (outside) pos.outside = true; + return pos; + } + + // Compute the character position closest to the given coordinates. + // Input must be lineSpace-local ("div" coordinate system). + function coordsChar(cm, x, y) { + var doc = cm.doc; + y += cm.display.viewOffset; + if (y < 0) return PosWithInfo(doc.first, 0, true, -1); + var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1; + if (lineN > last) + return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1); + if (x < 0) x = 0; + + var lineObj = getLine(doc, lineN); + for (;;) { + var found = coordsCharInner(cm, lineObj, lineN, x, y); + var merged = collapsedSpanAtEnd(lineObj); + var mergedPos = merged && merged.find(0, true); + if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0)) + lineN = lineNo(lineObj = mergedPos.to.line); + else + return found; + } + } + + function coordsCharInner(cm, lineObj, lineNo, x, y) { + var innerOff = y - heightAtLine(lineObj); + var wrongLine = false, adjust = 2 * cm.display.wrapper.clientWidth; + var preparedMeasure = prepareMeasureForLine(cm, lineObj); + + function getX(ch) { + var sp = cursorCoords(cm, Pos(lineNo, ch), "line", lineObj, preparedMeasure); + wrongLine = true; + if (innerOff > sp.bottom) return sp.left - adjust; + else if (innerOff < sp.top) return sp.left + adjust; + else wrongLine = false; + return sp.left; + } + + var bidi = getOrder(lineObj), dist = lineObj.text.length; + var from = lineLeft(lineObj), to = lineRight(lineObj); + var fromX = getX(from), fromOutside = wrongLine, toX = getX(to), toOutside = wrongLine; + + if (x > toX) return PosWithInfo(lineNo, to, toOutside, 1); + // Do a binary search between these bounds. + for (;;) { + if (bidi ? to == from || to == moveVisually(lineObj, from, 1) : to - from <= 1) { + var ch = x < fromX || x - fromX <= toX - x ? from : to; + var xDiff = x - (ch == from ? fromX : toX); + while (isExtendingChar(lineObj.text.charAt(ch))) ++ch; + var pos = PosWithInfo(lineNo, ch, ch == from ? fromOutside : toOutside, + xDiff < -1 ? -1 : xDiff > 1 ? 1 : 0); + return pos; + } + var step = Math.ceil(dist / 2), middle = from + step; + if (bidi) { + middle = from; + for (var i = 0; i < step; ++i) middle = moveVisually(lineObj, middle, 1); + } + var middleX = getX(middle); + if (middleX > x) {to = middle; toX = middleX; if (toOutside = wrongLine) toX += 1000; dist = step;} + else {from = middle; fromX = middleX; fromOutside = wrongLine; dist -= step;} + } + } + + var measureText; + // Compute the default text height. + function textHeight(display) { + if (display.cachedTextHeight != null) return display.cachedTextHeight; + if (measureText == null) { + measureText = elt("pre"); + // Measure a bunch of lines, for browsers that compute + // fractional heights. + for (var i = 0; i < 49; ++i) { + measureText.appendChild(document.createTextNode("x")); + measureText.appendChild(elt("br")); + } + measureText.appendChild(document.createTextNode("x")); + } + removeChildrenAndAdd(display.measure, measureText); + var height = measureText.offsetHeight / 50; + if (height > 3) display.cachedTextHeight = height; + removeChildren(display.measure); + return height || 1; + } + + // Compute the default character width. + function charWidth(display) { + if (display.cachedCharWidth != null) return display.cachedCharWidth; + var anchor = elt("span", "xxxxxxxxxx"); + var pre = elt("pre", [anchor]); + removeChildrenAndAdd(display.measure, pre); + var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10; + if (width > 2) display.cachedCharWidth = width; + return width || 10; + } + + // OPERATIONS + + // Operations are used to wrap a series of changes to the editor + // state in such a way that each change won't have to update the + // cursor and display (which would be awkward, slow, and + // error-prone). Instead, display updates are batched and then all + // combined and executed at once. + + var operationGroup = null; + + var nextOpId = 0; + // Start a new operation. + function startOperation(cm) { + cm.curOp = { + cm: cm, + viewChanged: false, // Flag that indicates that lines might need to be redrawn + startHeight: cm.doc.height, // Used to detect need to update scrollbar + forceUpdate: false, // Used to force a redraw + updateInput: null, // Whether to reset the input textarea + typing: false, // Whether this reset should be careful to leave existing text (for compositing) + changeObjs: null, // Accumulated changes, for firing change events + cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on + cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already + selectionChanged: false, // Whether the selection needs to be redrawn + updateMaxLine: false, // Set when the widest line needs to be determined anew + scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet + scrollToPos: null, // Used to scroll to a specific position + focus: false, + id: ++nextOpId // Unique ID + }; + if (operationGroup) { + operationGroup.ops.push(cm.curOp); + } else { + cm.curOp.ownsGroup = operationGroup = { + ops: [cm.curOp], + delayedCallbacks: [] + }; + } + } + + function fireCallbacksForOps(group) { + // Calls delayed callbacks and cursorActivity handlers until no + // new ones appear + var callbacks = group.delayedCallbacks, i = 0; + do { + for (; i < callbacks.length; i++) + callbacks[i](); + for (var j = 0; j < group.ops.length; j++) { + var op = group.ops[j]; + if (op.cursorActivityHandlers) + while (op.cursorActivityCalled < op.cursorActivityHandlers.length) + op.cursorActivityHandlers[op.cursorActivityCalled++](op.cm); + } + } while (i < callbacks.length); + } + + // Finish an operation, updating the display and signalling delayed events + function endOperation(cm) { + var op = cm.curOp, group = op.ownsGroup; + if (!group) return; + + try { fireCallbacksForOps(group); } + finally { + operationGroup = null; + for (var i = 0; i < group.ops.length; i++) + group.ops[i].cm.curOp = null; + endOperations(group); + } + } + + // The DOM updates done when an operation finishes are batched so + // that the minimum number of relayouts are required. + function endOperations(group) { + var ops = group.ops; + for (var i = 0; i < ops.length; i++) // Read DOM + endOperation_R1(ops[i]); + for (var i = 0; i < ops.length; i++) // Write DOM (maybe) + endOperation_W1(ops[i]); + for (var i = 0; i < ops.length; i++) // Read DOM + endOperation_R2(ops[i]); + for (var i = 0; i < ops.length; i++) // Write DOM (maybe) + endOperation_W2(ops[i]); + for (var i = 0; i < ops.length; i++) // Read DOM + endOperation_finish(ops[i]); + } + + function endOperation_R1(op) { + var cm = op.cm, display = cm.display; + maybeClipScrollbars(cm); + if (op.updateMaxLine) findMaxLine(cm); + + op.mustUpdate = op.viewChanged || op.forceUpdate || op.scrollTop != null || + op.scrollToPos && (op.scrollToPos.from.line < display.viewFrom || + op.scrollToPos.to.line >= display.viewTo) || + display.maxLineChanged && cm.options.lineWrapping; + op.update = op.mustUpdate && + new DisplayUpdate(cm, op.mustUpdate && {top: op.scrollTop, ensure: op.scrollToPos}, op.forceUpdate); + } + + function endOperation_W1(op) { + op.updatedDisplay = op.mustUpdate && updateDisplayIfNeeded(op.cm, op.update); + } + + function endOperation_R2(op) { + var cm = op.cm, display = cm.display; + if (op.updatedDisplay) updateHeightsInViewport(cm); + + op.barMeasure = measureForScrollbars(cm); + + // If the max line changed since it was last measured, measure it, + // and ensure the document's width matches it. + // updateDisplay_W2 will use these properties to do the actual resizing + if (display.maxLineChanged && !cm.options.lineWrapping) { + op.adjustWidthTo = measureChar(cm, display.maxLine, display.maxLine.text.length).left + 3; + cm.display.sizerWidth = op.adjustWidthTo; + op.barMeasure.scrollWidth = + Math.max(display.scroller.clientWidth, display.sizer.offsetLeft + op.adjustWidthTo + scrollGap(cm) + cm.display.barWidth); + op.maxScrollLeft = Math.max(0, display.sizer.offsetLeft + op.adjustWidthTo - displayWidth(cm)); + } + + if (op.updatedDisplay || op.selectionChanged) + op.preparedSelection = display.input.prepareSelection(); + } + + function endOperation_W2(op) { + var cm = op.cm; + + if (op.adjustWidthTo != null) { + cm.display.sizer.style.minWidth = op.adjustWidthTo + "px"; + if (op.maxScrollLeft < cm.doc.scrollLeft) + setScrollLeft(cm, Math.min(cm.display.scroller.scrollLeft, op.maxScrollLeft), true); + cm.display.maxLineChanged = false; + } + + if (op.preparedSelection) + cm.display.input.showSelection(op.preparedSelection); + if (op.updatedDisplay) + setDocumentHeight(cm, op.barMeasure); + if (op.updatedDisplay || op.startHeight != cm.doc.height) + updateScrollbars(cm, op.barMeasure); + + if (op.selectionChanged) restartBlink(cm); + + if (cm.state.focused && op.updateInput) + cm.display.input.reset(op.typing); + if (op.focus && op.focus == activeElt()) ensureFocus(op.cm); + } + + function endOperation_finish(op) { + var cm = op.cm, display = cm.display, doc = cm.doc; + + if (op.updatedDisplay) postUpdateDisplay(cm, op.update); + + // Abort mouse wheel delta measurement, when scrolling explicitly + if (display.wheelStartX != null && (op.scrollTop != null || op.scrollLeft != null || op.scrollToPos)) + display.wheelStartX = display.wheelStartY = null; + + // Propagate the scroll position to the actual DOM scroller + if (op.scrollTop != null && (display.scroller.scrollTop != op.scrollTop || op.forceScroll)) { + doc.scrollTop = Math.max(0, Math.min(display.scroller.scrollHeight - display.scroller.clientHeight, op.scrollTop)); + display.scrollbars.setScrollTop(doc.scrollTop); + display.scroller.scrollTop = doc.scrollTop; + } + if (op.scrollLeft != null && (display.scroller.scrollLeft != op.scrollLeft || op.forceScroll)) { + doc.scrollLeft = Math.max(0, Math.min(display.scroller.scrollWidth - displayWidth(cm), op.scrollLeft)); + display.scrollbars.setScrollLeft(doc.scrollLeft); + display.scroller.scrollLeft = doc.scrollLeft; + alignHorizontally(cm); + } + // If we need to scroll a specific position into view, do so. + if (op.scrollToPos) { + var coords = scrollPosIntoView(cm, clipPos(doc, op.scrollToPos.from), + clipPos(doc, op.scrollToPos.to), op.scrollToPos.margin); + if (op.scrollToPos.isCursor && cm.state.focused) maybeScrollWindow(cm, coords); + } + + // Fire events for markers that are hidden/unidden by editing or + // undoing + var hidden = op.maybeHiddenMarkers, unhidden = op.maybeUnhiddenMarkers; + if (hidden) for (var i = 0; i < hidden.length; ++i) + if (!hidden[i].lines.length) signal(hidden[i], "hide"); + if (unhidden) for (var i = 0; i < unhidden.length; ++i) + if (unhidden[i].lines.length) signal(unhidden[i], "unhide"); + + if (display.wrapper.offsetHeight) + doc.scrollTop = cm.display.scroller.scrollTop; + + // Fire change events, and delayed event handlers + if (op.changeObjs) + signal(cm, "changes", cm, op.changeObjs); + if (op.update) + op.update.finish(); + } + + // Run the given function in an operation + function runInOp(cm, f) { + if (cm.curOp) return f(); + startOperation(cm); + try { return f(); } + finally { endOperation(cm); } + } + // Wraps a function in an operation. Returns the wrapped function. + function operation(cm, f) { + return function() { + if (cm.curOp) return f.apply(cm, arguments); + startOperation(cm); + try { return f.apply(cm, arguments); } + finally { endOperation(cm); } + }; + } + // Used to add methods to editor and doc instances, wrapping them in + // operations. + function methodOp(f) { + return function() { + if (this.curOp) return f.apply(this, arguments); + startOperation(this); + try { return f.apply(this, arguments); } + finally { endOperation(this); } + }; + } + function docMethodOp(f) { + return function() { + var cm = this.cm; + if (!cm || cm.curOp) return f.apply(this, arguments); + startOperation(cm); + try { return f.apply(this, arguments); } + finally { endOperation(cm); } + }; + } + + // VIEW TRACKING + + // These objects are used to represent the visible (currently drawn) + // part of the document. A LineView may correspond to multiple + // logical lines, if those are connected by collapsed ranges. + function LineView(doc, line, lineN) { + // The starting line + this.line = line; + // Continuing lines, if any + this.rest = visualLineContinued(line); + // Number of logical lines in this visual line + this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1; + this.node = this.text = null; + this.hidden = lineIsHidden(doc, line); + } + + // Create a range of LineView objects for the given lines. + function buildViewArray(cm, from, to) { + var array = [], nextPos; + for (var pos = from; pos < to; pos = nextPos) { + var view = new LineView(cm.doc, getLine(cm.doc, pos), pos); + nextPos = pos + view.size; + array.push(view); + } + return array; + } + + // Updates the display.view data structure for a given change to the + // document. From and to are in pre-change coordinates. Lendiff is + // the amount of lines added or subtracted by the change. This is + // used for changes that span multiple lines, or change the way + // lines are divided into visual lines. regLineChange (below) + // registers single-line changes. + function regChange(cm, from, to, lendiff) { + if (from == null) from = cm.doc.first; + if (to == null) to = cm.doc.first + cm.doc.size; + if (!lendiff) lendiff = 0; + + var display = cm.display; + if (lendiff && to < display.viewTo && + (display.updateLineNumbers == null || display.updateLineNumbers > from)) + display.updateLineNumbers = from; + + cm.curOp.viewChanged = true; + + if (from >= display.viewTo) { // Change after + if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo) + resetView(cm); + } else if (to <= display.viewFrom) { // Change before + if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) { + resetView(cm); + } else { + display.viewFrom += lendiff; + display.viewTo += lendiff; + } + } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap + resetView(cm); + } else if (from <= display.viewFrom) { // Top overlap + var cut = viewCuttingPoint(cm, to, to + lendiff, 1); + if (cut) { + display.view = display.view.slice(cut.index); + display.viewFrom = cut.lineN; + display.viewTo += lendiff; + } else { + resetView(cm); + } + } else if (to >= display.viewTo) { // Bottom overlap + var cut = viewCuttingPoint(cm, from, from, -1); + if (cut) { + display.view = display.view.slice(0, cut.index); + display.viewTo = cut.lineN; + } else { + resetView(cm); + } + } else { // Gap in the middle + var cutTop = viewCuttingPoint(cm, from, from, -1); + var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1); + if (cutTop && cutBot) { + display.view = display.view.slice(0, cutTop.index) + .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN)) + .concat(display.view.slice(cutBot.index)); + display.viewTo += lendiff; + } else { + resetView(cm); + } + } + + var ext = display.externalMeasured; + if (ext) { + if (to < ext.lineN) + ext.lineN += lendiff; + else if (from < ext.lineN + ext.size) + display.externalMeasured = null; + } + } + + // Register a change to a single line. Type must be one of "text", + // "gutter", "class", "widget" + function regLineChange(cm, line, type) { + cm.curOp.viewChanged = true; + var display = cm.display, ext = cm.display.externalMeasured; + if (ext && line >= ext.lineN && line < ext.lineN + ext.size) + display.externalMeasured = null; + + if (line < display.viewFrom || line >= display.viewTo) return; + var lineView = display.view[findViewIndex(cm, line)]; + if (lineView.node == null) return; + var arr = lineView.changes || (lineView.changes = []); + if (indexOf(arr, type) == -1) arr.push(type); + } + + // Clear the view. + function resetView(cm) { + cm.display.viewFrom = cm.display.viewTo = cm.doc.first; + cm.display.view = []; + cm.display.viewOffset = 0; + } + + // Find the view element corresponding to a given line. Return null + // when the line isn't visible. + function findViewIndex(cm, n) { + if (n >= cm.display.viewTo) return null; + n -= cm.display.viewFrom; + if (n < 0) return null; + var view = cm.display.view; + for (var i = 0; i < view.length; i++) { + n -= view[i].size; + if (n < 0) return i; + } + } + + function viewCuttingPoint(cm, oldN, newN, dir) { + var index = findViewIndex(cm, oldN), diff, view = cm.display.view; + if (!sawCollapsedSpans || newN == cm.doc.first + cm.doc.size) + return {index: index, lineN: newN}; + for (var i = 0, n = cm.display.viewFrom; i < index; i++) + n += view[i].size; + if (n != oldN) { + if (dir > 0) { + if (index == view.length - 1) return null; + diff = (n + view[index].size) - oldN; + index++; + } else { + diff = n - oldN; + } + oldN += diff; newN += diff; + } + while (visualLineNo(cm.doc, newN) != newN) { + if (index == (dir < 0 ? 0 : view.length - 1)) return null; + newN += dir * view[index - (dir < 0 ? 1 : 0)].size; + index += dir; + } + return {index: index, lineN: newN}; + } + + // Force the view to cover a given range, adding empty view element + // or clipping off existing ones as needed. + function adjustView(cm, from, to) { + var display = cm.display, view = display.view; + if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) { + display.view = buildViewArray(cm, from, to); + display.viewFrom = from; + } else { + if (display.viewFrom > from) + display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view); + else if (display.viewFrom < from) + display.view = display.view.slice(findViewIndex(cm, from)); + display.viewFrom = from; + if (display.viewTo < to) + display.view = display.view.concat(buildViewArray(cm, display.viewTo, to)); + else if (display.viewTo > to) + display.view = display.view.slice(0, findViewIndex(cm, to)); + } + display.viewTo = to; + } + + // Count the number of lines in the view whose DOM representation is + // out of date (or nonexistent). + function countDirtyView(cm) { + var view = cm.display.view, dirty = 0; + for (var i = 0; i < view.length; i++) { + var lineView = view[i]; + if (!lineView.hidden && (!lineView.node || lineView.changes)) ++dirty; + } + return dirty; + } + + // EVENT HANDLERS + + // Attach the necessary event handlers when initializing the editor + function registerEventHandlers(cm) { + var d = cm.display; + on(d.scroller, "mousedown", operation(cm, onMouseDown)); + // Older IE's will not fire a second mousedown for a double click + if (ie && ie_version < 11) + on(d.scroller, "dblclick", operation(cm, function(e) { + if (signalDOMEvent(cm, e)) return; + var pos = posFromMouse(cm, e); + if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) return; + e_preventDefault(e); + var word = cm.findWordAt(pos); + extendSelection(cm.doc, word.anchor, word.head); + })); + else + on(d.scroller, "dblclick", function(e) { signalDOMEvent(cm, e) || e_preventDefault(e); }); + // Some browsers fire contextmenu *after* opening the menu, at + // which point we can't mess with it anymore. Context menu is + // handled in onMouseDown for these browsers. + if (!captureRightClick) on(d.scroller, "contextmenu", function(e) {onContextMenu(cm, e);}); + + // Used to suppress mouse event handling when a touch happens + var touchFinished, prevTouch = {end: 0}; + function finishTouch() { + if (d.activeTouch) { + touchFinished = setTimeout(function() {d.activeTouch = null;}, 1000); + prevTouch = d.activeTouch; + prevTouch.end = +new Date; + } + }; + function isMouseLikeTouchEvent(e) { + if (e.touches.length != 1) return false; + var touch = e.touches[0]; + return touch.radiusX <= 1 && touch.radiusY <= 1; + } + function farAway(touch, other) { + if (other.left == null) return true; + var dx = other.left - touch.left, dy = other.top - touch.top; + return dx * dx + dy * dy > 20 * 20; + } + on(d.scroller, "touchstart", function(e) { + if (!isMouseLikeTouchEvent(e)) { + clearTimeout(touchFinished); + var now = +new Date; + d.activeTouch = {start: now, moved: false, + prev: now - prevTouch.end <= 300 ? prevTouch : null}; + if (e.touches.length == 1) { + d.activeTouch.left = e.touches[0].pageX; + d.activeTouch.top = e.touches[0].pageY; + } + } + }); + on(d.scroller, "touchmove", function() { + if (d.activeTouch) d.activeTouch.moved = true; + }); + on(d.scroller, "touchend", function(e) { + var touch = d.activeTouch; + if (touch && !eventInWidget(d, e) && touch.left != null && + !touch.moved && new Date - touch.start < 300) { + var pos = cm.coordsChar(d.activeTouch, "page"), range; + if (!touch.prev || farAway(touch, touch.prev)) // Single tap + range = new Range(pos, pos); + else if (!touch.prev.prev || farAway(touch, touch.prev.prev)) // Double tap + range = cm.findWordAt(pos); + else // Triple tap + range = new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0))); + cm.setSelection(range.anchor, range.head); + cm.focus(); + e_preventDefault(e); + } + finishTouch(); + }); + on(d.scroller, "touchcancel", finishTouch); + + // Sync scrolling between fake scrollbars and real scrollable + // area, ensure viewport is updated when scrolling. + on(d.scroller, "scroll", function() { + if (d.scroller.clientHeight) { + setScrollTop(cm, d.scroller.scrollTop); + setScrollLeft(cm, d.scroller.scrollLeft, true); + signal(cm, "scroll", cm); + } + }); + + // Listen to wheel events in order to try and update the viewport on time. + on(d.scroller, "mousewheel", function(e){onScrollWheel(cm, e);}); + on(d.scroller, "DOMMouseScroll", function(e){onScrollWheel(cm, e);}); + + // Prevent wrapper from ever scrolling + on(d.wrapper, "scroll", function() { d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; }); + + d.dragFunctions = { + simple: function(e) {if (!signalDOMEvent(cm, e)) e_stop(e);}, + start: function(e){onDragStart(cm, e);}, + drop: operation(cm, onDrop) + }; + + var inp = d.input.getField(); + on(inp, "keyup", function(e) { onKeyUp.call(cm, e); }); + on(inp, "keydown", operation(cm, onKeyDown)); + on(inp, "keypress", operation(cm, onKeyPress)); + on(inp, "focus", bind(onFocus, cm)); + on(inp, "blur", bind(onBlur, cm)); + } + + function dragDropChanged(cm, value, old) { + var wasOn = old && old != CodeMirror.Init; + if (!value != !wasOn) { + var funcs = cm.display.dragFunctions; + var toggle = value ? on : off; + toggle(cm.display.scroller, "dragstart", funcs.start); + toggle(cm.display.scroller, "dragenter", funcs.simple); + toggle(cm.display.scroller, "dragover", funcs.simple); + toggle(cm.display.scroller, "drop", funcs.drop); + } + } + + // Called when the window resizes + function onResize(cm) { + var d = cm.display; + if (d.lastWrapHeight == d.wrapper.clientHeight && d.lastWrapWidth == d.wrapper.clientWidth) + return; + // Might be a text scaling operation, clear size caches. + d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null; + d.scrollbarsClipped = false; + cm.setSize(); + } + + // MOUSE EVENTS + + // Return true when the given mouse event happened in a widget + function eventInWidget(display, e) { + for (var n = e_target(e); n != display.wrapper; n = n.parentNode) { + if (!n || (n.nodeType == 1 && n.getAttribute("cm-ignore-events") == "true") || + (n.parentNode == display.sizer && n != display.mover)) + return true; + } + } + + // Given a mouse event, find the corresponding position. If liberal + // is false, it checks whether a gutter or scrollbar was clicked, + // and returns null if it was. forRect is used by rectangular + // selections, and tries to estimate a character position even for + // coordinates beyond the right of the text. + function posFromMouse(cm, e, liberal, forRect) { + var display = cm.display; + if (!liberal && e_target(e).getAttribute("cm-not-content") == "true") return null; + + var x, y, space = display.lineSpace.getBoundingClientRect(); + // Fails unpredictably on IE[67] when mouse is dragged around quickly. + try { x = e.clientX - space.left; y = e.clientY - space.top; } + catch (e) { return null; } + var coords = coordsChar(cm, x, y), line; + if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) { + var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length; + coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff)); + } + return coords; + } + + // A mouse down can be a single click, double click, triple click, + // start of selection drag, start of text drag, new cursor + // (ctrl-click), rectangle drag (alt-drag), or xwin + // middle-click-paste. Or it might be a click on something we should + // not interfere with, such as a scrollbar or widget. + function onMouseDown(e) { + var cm = this, display = cm.display; + if (display.activeTouch && display.input.supportsTouch() || signalDOMEvent(cm, e)) return; + display.shift = e.shiftKey; + + if (eventInWidget(display, e)) { + if (!webkit) { + // Briefly turn off draggability, to allow widgets to do + // normal dragging things. + display.scroller.draggable = false; + setTimeout(function(){display.scroller.draggable = true;}, 100); + } + return; + } + if (clickInGutter(cm, e)) return; + var start = posFromMouse(cm, e); + window.focus(); + + switch (e_button(e)) { + case 1: + if (start) + leftButtonDown(cm, e, start); + else if (e_target(e) == display.scroller) + e_preventDefault(e); + break; + case 2: + if (webkit) cm.state.lastMiddleDown = +new Date; + if (start) extendSelection(cm.doc, start); + setTimeout(function() {display.input.focus();}, 20); + e_preventDefault(e); + break; + case 3: + if (captureRightClick) onContextMenu(cm, e); + else delayBlurEvent(cm); + break; + } + } + + var lastClick, lastDoubleClick; + function leftButtonDown(cm, e, start) { + if (ie) setTimeout(bind(ensureFocus, cm), 0); + else cm.curOp.focus = activeElt(); + + var now = +new Date, type; + if (lastDoubleClick && lastDoubleClick.time > now - 400 && cmp(lastDoubleClick.pos, start) == 0) { + type = "triple"; + } else if (lastClick && lastClick.time > now - 400 && cmp(lastClick.pos, start) == 0) { + type = "double"; + lastDoubleClick = {time: now, pos: start}; + } else { + type = "single"; + lastClick = {time: now, pos: start}; + } + + var sel = cm.doc.sel, modifier = mac ? e.metaKey : e.ctrlKey, contained; + if (cm.options.dragDrop && dragAndDrop && !isReadOnly(cm) && + type == "single" && (contained = sel.contains(start)) > -1 && + !sel.ranges[contained].empty()) + leftButtonStartDrag(cm, e, start, modifier); + else + leftButtonSelect(cm, e, start, type, modifier); + } + + // Start a text drag. When it ends, see if any dragging actually + // happen, and treat as a click if it didn't. + function leftButtonStartDrag(cm, e, start, modifier) { + var display = cm.display, startTime = +new Date; + var dragEnd = operation(cm, function(e2) { + if (webkit) display.scroller.draggable = false; + cm.state.draggingText = false; + off(document, "mouseup", dragEnd); + off(display.scroller, "drop", dragEnd); + if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) { + e_preventDefault(e2); + if (!modifier && +new Date - 200 < startTime) + extendSelection(cm.doc, start); + // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081) + if (webkit || ie && ie_version == 9) + setTimeout(function() {document.body.focus(); display.input.focus();}, 20); + else + display.input.focus(); + } + }); + // Let the drag handler handle this. + if (webkit) display.scroller.draggable = true; + cm.state.draggingText = dragEnd; + // IE's approach to draggable + if (display.scroller.dragDrop) display.scroller.dragDrop(); + on(document, "mouseup", dragEnd); + on(display.scroller, "drop", dragEnd); + } + + // Normal selection, as opposed to text dragging. + function leftButtonSelect(cm, e, start, type, addNew) { + var display = cm.display, doc = cm.doc; + e_preventDefault(e); + + var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges; + if (addNew && !e.shiftKey) { + ourIndex = doc.sel.contains(start); + if (ourIndex > -1) + ourRange = ranges[ourIndex]; + else + ourRange = new Range(start, start); + } else { + ourRange = doc.sel.primary(); + ourIndex = doc.sel.primIndex; + } + + if (e.altKey) { + type = "rect"; + if (!addNew) ourRange = new Range(start, start); + start = posFromMouse(cm, e, true, true); + ourIndex = -1; + } else if (type == "double") { + var word = cm.findWordAt(start); + if (cm.display.shift || doc.extend) + ourRange = extendRange(doc, ourRange, word.anchor, word.head); + else + ourRange = word; + } else if (type == "triple") { + var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0))); + if (cm.display.shift || doc.extend) + ourRange = extendRange(doc, ourRange, line.anchor, line.head); + else + ourRange = line; + } else { + ourRange = extendRange(doc, ourRange, start); + } + + if (!addNew) { + ourIndex = 0; + setSelection(doc, new Selection([ourRange], 0), sel_mouse); + startSel = doc.sel; + } else if (ourIndex == -1) { + ourIndex = ranges.length; + setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex), + {scroll: false, origin: "*mouse"}); + } else if (ranges.length > 1 && ranges[ourIndex].empty() && type == "single" && !e.shiftKey) { + setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0)); + startSel = doc.sel; + } else { + replaceOneSelection(doc, ourIndex, ourRange, sel_mouse); + } + + var lastPos = start; + function extendTo(pos) { + if (cmp(lastPos, pos) == 0) return; + lastPos = pos; + + if (type == "rect") { + var ranges = [], tabSize = cm.options.tabSize; + var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize); + var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize); + var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol); + for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line)); + line <= end; line++) { + var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize); + if (left == right) + ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); + else if (text.length > leftPos) + ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); + } + if (!ranges.length) ranges.push(new Range(start, start)); + setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex), + {origin: "*mouse", scroll: false}); + cm.scrollIntoView(pos); + } else { + var oldRange = ourRange; + var anchor = oldRange.anchor, head = pos; + if (type != "single") { + if (type == "double") + var range = cm.findWordAt(pos); + else + var range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0))); + if (cmp(range.anchor, anchor) > 0) { + head = range.head; + anchor = minPos(oldRange.from(), range.anchor); + } else { + head = range.anchor; + anchor = maxPos(oldRange.to(), range.head); + } + } + var ranges = startSel.ranges.slice(0); + ranges[ourIndex] = new Range(clipPos(doc, anchor), head); + setSelection(doc, normalizeSelection(ranges, ourIndex), sel_mouse); + } + } + + var editorSize = display.wrapper.getBoundingClientRect(); + // Used to ensure timeout re-tries don't fire when another extend + // happened in the meantime (clearTimeout isn't reliable -- at + // least on Chrome, the timeouts still happen even when cleared, + // if the clear happens after their scheduled firing time). + var counter = 0; + + function extend(e) { + var curCount = ++counter; + var cur = posFromMouse(cm, e, true, type == "rect"); + if (!cur) return; + if (cmp(cur, lastPos) != 0) { + cm.curOp.focus = activeElt(); + extendTo(cur); + var visible = visibleLines(display, doc); + if (cur.line >= visible.to || cur.line < visible.from) + setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150); + } else { + var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0; + if (outside) setTimeout(operation(cm, function() { + if (counter != curCount) return; + display.scroller.scrollTop += outside; + extend(e); + }), 50); + } + } + + function done(e) { + counter = Infinity; + e_preventDefault(e); + display.input.focus(); + off(document, "mousemove", move); + off(document, "mouseup", up); + doc.history.lastSelOrigin = null; + } + + var move = operation(cm, function(e) { + if (!e_button(e)) done(e); + else extend(e); + }); + var up = operation(cm, done); + on(document, "mousemove", move); + on(document, "mouseup", up); + } + + // Determines whether an event happened in the gutter, and fires the + // handlers for the corresponding event. + function gutterEvent(cm, e, type, prevent, signalfn) { + try { var mX = e.clientX, mY = e.clientY; } + catch(e) { return false; } + if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) return false; + if (prevent) e_preventDefault(e); + + var display = cm.display; + var lineBox = display.lineDiv.getBoundingClientRect(); + + if (mY > lineBox.bottom || !hasHandler(cm, type)) return e_defaultPrevented(e); + mY -= lineBox.top - display.viewOffset; + + for (var i = 0; i < cm.options.gutters.length; ++i) { + var g = display.gutters.childNodes[i]; + if (g && g.getBoundingClientRect().right >= mX) { + var line = lineAtHeight(cm.doc, mY); + var gutter = cm.options.gutters[i]; + signalfn(cm, type, cm, line, gutter, e); + return e_defaultPrevented(e); + } + } + } + + function clickInGutter(cm, e) { + return gutterEvent(cm, e, "gutterClick", true, signalLater); + } + + // Kludge to work around strange IE behavior where it'll sometimes + // re-fire a series of drag-related events right after the drop (#1551) + var lastDrop = 0; + + function onDrop(e) { + var cm = this; + if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) + return; + e_preventDefault(e); + if (ie) lastDrop = +new Date; + var pos = posFromMouse(cm, e, true), files = e.dataTransfer.files; + if (!pos || isReadOnly(cm)) return; + // Might be a file drop, in which case we simply extract the text + // and insert it. + if (files && files.length && window.FileReader && window.File) { + var n = files.length, text = Array(n), read = 0; + var loadFile = function(file, i) { + var reader = new FileReader; + reader.onload = operation(cm, function() { + text[i] = reader.result; + if (++read == n) { + pos = clipPos(cm.doc, pos); + var change = {from: pos, to: pos, text: splitLines(text.join("\n")), origin: "paste"}; + makeChange(cm.doc, change); + setSelectionReplaceHistory(cm.doc, simpleSelection(pos, changeEnd(change))); + } + }); + reader.readAsText(file); + }; + for (var i = 0; i < n; ++i) loadFile(files[i], i); + } else { // Normal drop + // Don't do a replace if the drop happened inside of the selected text. + if (cm.state.draggingText && cm.doc.sel.contains(pos) > -1) { + cm.state.draggingText(e); + // Ensure the editor is re-focused + setTimeout(function() {cm.display.input.focus();}, 20); + return; + } + try { + var text = e.dataTransfer.getData("Text"); + if (text) { + if (cm.state.draggingText && !(mac ? e.altKey : e.ctrlKey)) + var selected = cm.listSelections(); + setSelectionNoUndo(cm.doc, simpleSelection(pos, pos)); + if (selected) for (var i = 0; i < selected.length; ++i) + replaceRange(cm.doc, "", selected[i].anchor, selected[i].head, "drag"); + cm.replaceSelection(text, "around", "paste"); + cm.display.input.focus(); + } + } + catch(e){} + } + } + + function onDragStart(cm, e) { + if (ie && (!cm.state.draggingText || +new Date - lastDrop < 100)) { e_stop(e); return; } + if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) return; + + e.dataTransfer.setData("Text", cm.getSelection()); + + // Use dummy image instead of default browsers image. + // Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there. + if (e.dataTransfer.setDragImage && !safari) { + var img = elt("img", null, null, "position: fixed; left: 0; top: 0;"); + img.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="; + if (presto) { + img.width = img.height = 1; + cm.display.wrapper.appendChild(img); + // Force a relayout, or Opera won't use our image for some obscure reason + img._top = img.offsetTop; + } + e.dataTransfer.setDragImage(img, 0, 0); + if (presto) img.parentNode.removeChild(img); + } + } + + // SCROLL EVENTS + + // Sync the scrollable area and scrollbars, ensure the viewport + // covers the visible area. + function setScrollTop(cm, val) { + if (Math.abs(cm.doc.scrollTop - val) < 2) return; + cm.doc.scrollTop = val; + if (!gecko) updateDisplaySimple(cm, {top: val}); + if (cm.display.scroller.scrollTop != val) cm.display.scroller.scrollTop = val; + cm.display.scrollbars.setScrollTop(val); + if (gecko) updateDisplaySimple(cm); + startWorker(cm, 100); + } + // Sync scroller and scrollbar, ensure the gutter elements are + // aligned. + function setScrollLeft(cm, val, isScroller) { + if (isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) return; + val = Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth); + cm.doc.scrollLeft = val; + alignHorizontally(cm); + if (cm.display.scroller.scrollLeft != val) cm.display.scroller.scrollLeft = val; + cm.display.scrollbars.setScrollLeft(val); + } + + // Since the delta values reported on mouse wheel events are + // unstandardized between browsers and even browser versions, and + // generally horribly unpredictable, this code starts by measuring + // the scroll effect that the first few mouse wheel events have, + // and, from that, detects the way it can convert deltas to pixel + // offsets afterwards. + // + // The reason we want to know the amount a wheel event will scroll + // is that it gives us a chance to update the display before the + // actual scrolling happens, reducing flickering. + + var wheelSamples = 0, wheelPixelsPerUnit = null; + // Fill in a browser-detected starting value on browsers where we + // know one. These don't have to be accurate -- the result of them + // being wrong would just be a slight flicker on the first wheel + // scroll (if it is large enough). + if (ie) wheelPixelsPerUnit = -.53; + else if (gecko) wheelPixelsPerUnit = 15; + else if (chrome) wheelPixelsPerUnit = -.7; + else if (safari) wheelPixelsPerUnit = -1/3; + + var wheelEventDelta = function(e) { + var dx = e.wheelDeltaX, dy = e.wheelDeltaY; + if (dx == null && e.detail && e.axis == e.HORIZONTAL_AXIS) dx = e.detail; + if (dy == null && e.detail && e.axis == e.VERTICAL_AXIS) dy = e.detail; + else if (dy == null) dy = e.wheelDelta; + return {x: dx, y: dy}; + }; + CodeMirror.wheelEventPixels = function(e) { + var delta = wheelEventDelta(e); + delta.x *= wheelPixelsPerUnit; + delta.y *= wheelPixelsPerUnit; + return delta; + }; + + function onScrollWheel(cm, e) { + var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y; + + var display = cm.display, scroll = display.scroller; + // Quit if there's nothing to scroll here + if (!(dx && scroll.scrollWidth > scroll.clientWidth || + dy && scroll.scrollHeight > scroll.clientHeight)) return; + + // Webkit browsers on OS X abort momentum scrolls when the target + // of the scroll event is removed from the scrollable element. + // This hack (see related code in patchDisplay) makes sure the + // element is kept around. + if (dy && mac && webkit) { + outer: for (var cur = e.target, view = display.view; cur != scroll; cur = cur.parentNode) { + for (var i = 0; i < view.length; i++) { + if (view[i].node == cur) { + cm.display.currentWheelTarget = cur; + break outer; + } + } + } + } + + // On some browsers, horizontal scrolling will cause redraws to + // happen before the gutter has been realigned, causing it to + // wriggle around in a most unseemly way. When we have an + // estimated pixels/delta value, we just handle horizontal + // scrolling entirely here. It'll be slightly off from native, but + // better than glitching out. + if (dx && !gecko && !presto && wheelPixelsPerUnit != null) { + if (dy) + setScrollTop(cm, Math.max(0, Math.min(scroll.scrollTop + dy * wheelPixelsPerUnit, scroll.scrollHeight - scroll.clientHeight))); + setScrollLeft(cm, Math.max(0, Math.min(scroll.scrollLeft + dx * wheelPixelsPerUnit, scroll.scrollWidth - scroll.clientWidth))); + e_preventDefault(e); + display.wheelStartX = null; // Abort measurement, if in progress + return; + } + + // 'Project' the visible viewport to cover the area that is being + // scrolled into view (if we know enough to estimate it). + if (dy && wheelPixelsPerUnit != null) { + var pixels = dy * wheelPixelsPerUnit; + var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight; + if (pixels < 0) top = Math.max(0, top + pixels - 50); + else bot = Math.min(cm.doc.height, bot + pixels + 50); + updateDisplaySimple(cm, {top: top, bottom: bot}); + } + + if (wheelSamples < 20) { + if (display.wheelStartX == null) { + display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop; + display.wheelDX = dx; display.wheelDY = dy; + setTimeout(function() { + if (display.wheelStartX == null) return; + var movedX = scroll.scrollLeft - display.wheelStartX; + var movedY = scroll.scrollTop - display.wheelStartY; + var sample = (movedY && display.wheelDY && movedY / display.wheelDY) || + (movedX && display.wheelDX && movedX / display.wheelDX); + display.wheelStartX = display.wheelStartY = null; + if (!sample) return; + wheelPixelsPerUnit = (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1); + ++wheelSamples; + }, 200); + } else { + display.wheelDX += dx; display.wheelDY += dy; + } + } + } + + // KEY EVENTS + + // Run a handler that was bound to a key. + function doHandleBinding(cm, bound, dropShift) { + if (typeof bound == "string") { + bound = commands[bound]; + if (!bound) return false; + } + // Ensure previous input has been read, so that the handler sees a + // consistent view of the document + cm.display.input.ensurePolled(); + var prevShift = cm.display.shift, done = false; + try { + if (isReadOnly(cm)) cm.state.suppressEdits = true; + if (dropShift) cm.display.shift = false; + done = bound(cm) != Pass; + } finally { + cm.display.shift = prevShift; + cm.state.suppressEdits = false; + } + return done; + } + + function lookupKeyForEditor(cm, name, handle) { + for (var i = 0; i < cm.state.keyMaps.length; i++) { + var result = lookupKey(name, cm.state.keyMaps[i], handle, cm); + if (result) return result; + } + return (cm.options.extraKeys && lookupKey(name, cm.options.extraKeys, handle, cm)) + || lookupKey(name, cm.options.keyMap, handle, cm); + } + + var stopSeq = new Delayed; + function dispatchKey(cm, name, e, handle) { + var seq = cm.state.keySeq; + if (seq) { + if (isModifierKey(name)) return "handled"; + stopSeq.set(50, function() { + if (cm.state.keySeq == seq) { + cm.state.keySeq = null; + cm.display.input.reset(); + } + }); + name = seq + " " + name; + } + var result = lookupKeyForEditor(cm, name, handle); + + if (result == "multi") + cm.state.keySeq = name; + if (result == "handled") + signalLater(cm, "keyHandled", cm, name, e); + + if (result == "handled" || result == "multi") { + e_preventDefault(e); + restartBlink(cm); + } + + if (seq && !result && /\'$/.test(name)) { + e_preventDefault(e); + return true; + } + return !!result; + } + + // Handle a key from the keydown event. + function handleKeyBinding(cm, e) { + var name = keyName(e, true); + if (!name) return false; + + if (e.shiftKey && !cm.state.keySeq) { + // First try to resolve full name (including 'Shift-'). Failing + // that, see if there is a cursor-motion command (starting with + // 'go') bound to the keyname without 'Shift-'. + return dispatchKey(cm, "Shift-" + name, e, function(b) {return doHandleBinding(cm, b, true);}) + || dispatchKey(cm, name, e, function(b) { + if (typeof b == "string" ? /^go[A-Z]/.test(b) : b.motion) + return doHandleBinding(cm, b); + }); + } else { + return dispatchKey(cm, name, e, function(b) { return doHandleBinding(cm, b); }); + } + } + + // Handle a key from the keypress event + function handleCharBinding(cm, e, ch) { + return dispatchKey(cm, "'" + ch + "'", e, + function(b) { return doHandleBinding(cm, b, true); }); + } + + var lastStoppedKey = null; + function onKeyDown(e) { + var cm = this; + cm.curOp.focus = activeElt(); + if (signalDOMEvent(cm, e)) return; + // IE does strange things with escape. + if (ie && ie_version < 11 && e.keyCode == 27) e.returnValue = false; + var code = e.keyCode; + cm.display.shift = code == 16 || e.shiftKey; + var handled = handleKeyBinding(cm, e); + if (presto) { + lastStoppedKey = handled ? code : null; + // Opera has no cut event... we try to at least catch the key combo + if (!handled && code == 88 && !hasCopyEvent && (mac ? e.metaKey : e.ctrlKey)) + cm.replaceSelection("", null, "cut"); + } + + // Turn mouse into crosshair when Alt is held on Mac. + if (code == 18 && !/\bCodeMirror-crosshair\b/.test(cm.display.lineDiv.className)) + showCrossHair(cm); + } + + function showCrossHair(cm) { + var lineDiv = cm.display.lineDiv; + addClass(lineDiv, "CodeMirror-crosshair"); + + function up(e) { + if (e.keyCode == 18 || !e.altKey) { + rmClass(lineDiv, "CodeMirror-crosshair"); + off(document, "keyup", up); + off(document, "mouseover", up); + } + } + on(document, "keyup", up); + on(document, "mouseover", up); + } + + function onKeyUp(e) { + if (e.keyCode == 16) this.doc.sel.shift = false; + signalDOMEvent(this, e); + } + + function onKeyPress(e) { + var cm = this; + if (eventInWidget(cm.display, e) || signalDOMEvent(cm, e) || e.ctrlKey && !e.altKey || mac && e.metaKey) return; + var keyCode = e.keyCode, charCode = e.charCode; + if (presto && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return;} + if ((presto && (!e.which || e.which < 10)) && handleKeyBinding(cm, e)) return; + var ch = String.fromCharCode(charCode == null ? keyCode : charCode); + if (handleCharBinding(cm, e, ch)) return; + cm.display.input.onKeyPress(e); + } + + // FOCUS/BLUR EVENTS + + function delayBlurEvent(cm) { + cm.state.delayingBlurEvent = true; + setTimeout(function() { + if (cm.state.delayingBlurEvent) { + cm.state.delayingBlurEvent = false; + onBlur(cm); + } + }, 100); + } + + function onFocus(cm) { + if (cm.state.delayingBlurEvent) cm.state.delayingBlurEvent = false; + + if (cm.options.readOnly == "nocursor") return; + if (!cm.state.focused) { + signal(cm, "focus", cm); + cm.state.focused = true; + addClass(cm.display.wrapper, "CodeMirror-focused"); + // This test prevents this from firing when a context + // menu is closed (since the input reset would kill the + // select-all detection hack) + if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) { + cm.display.input.reset(); + if (webkit) setTimeout(function() { cm.display.input.reset(true); }, 20); // Issue #1730 + } + cm.display.input.receivedFocus(); + } + restartBlink(cm); + } + function onBlur(cm) { + if (cm.state.delayingBlurEvent) return; + + if (cm.state.focused) { + signal(cm, "blur", cm); + cm.state.focused = false; + rmClass(cm.display.wrapper, "CodeMirror-focused"); + } + clearInterval(cm.display.blinker); + setTimeout(function() {if (!cm.state.focused) cm.display.shift = false;}, 150); + } + + // CONTEXT MENU HANDLING + + // To make the context menu work, we need to briefly unhide the + // textarea (making it as unobtrusive as possible) to let the + // right-click take effect on it. + function onContextMenu(cm, e) { + if (eventInWidget(cm.display, e) || contextMenuInGutter(cm, e)) return; + cm.display.input.onContextMenu(e); + } + + function contextMenuInGutter(cm, e) { + if (!hasHandler(cm, "gutterContextMenu")) return false; + return gutterEvent(cm, e, "gutterContextMenu", false, signal); + } + + // UPDATING + + // Compute the position of the end of a change (its 'to' property + // refers to the pre-change end). + var changeEnd = CodeMirror.changeEnd = function(change) { + if (!change.text) return change.to; + return Pos(change.from.line + change.text.length - 1, + lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0)); + }; + + // Adjust a position to refer to the post-change position of the + // same text, or the end of the change if the change covers it. + function adjustForChange(pos, change) { + if (cmp(pos, change.from) < 0) return pos; + if (cmp(pos, change.to) <= 0) return changeEnd(change); + + var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch; + if (pos.line == change.to.line) ch += changeEnd(change).ch - change.to.ch; + return Pos(line, ch); + } + + function computeSelAfterChange(doc, change) { + var out = []; + for (var i = 0; i < doc.sel.ranges.length; i++) { + var range = doc.sel.ranges[i]; + out.push(new Range(adjustForChange(range.anchor, change), + adjustForChange(range.head, change))); + } + return normalizeSelection(out, doc.sel.primIndex); + } + + function offsetPos(pos, old, nw) { + if (pos.line == old.line) + return Pos(nw.line, pos.ch - old.ch + nw.ch); + else + return Pos(nw.line + (pos.line - old.line), pos.ch); + } + + // Used by replaceSelections to allow moving the selection to the + // start or around the replaced test. Hint may be "start" or "around". + function computeReplacedSel(doc, changes, hint) { + var out = []; + var oldPrev = Pos(doc.first, 0), newPrev = oldPrev; + for (var i = 0; i < changes.length; i++) { + var change = changes[i]; + var from = offsetPos(change.from, oldPrev, newPrev); + var to = offsetPos(changeEnd(change), oldPrev, newPrev); + oldPrev = change.to; + newPrev = to; + if (hint == "around") { + var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0; + out[i] = new Range(inv ? to : from, inv ? from : to); + } else { + out[i] = new Range(from, from); + } + } + return new Selection(out, doc.sel.primIndex); + } + + // Allow "beforeChange" event handlers to influence a change + function filterChange(doc, change, update) { + var obj = { + canceled: false, + from: change.from, + to: change.to, + text: change.text, + origin: change.origin, + cancel: function() { this.canceled = true; } + }; + if (update) obj.update = function(from, to, text, origin) { + if (from) this.from = clipPos(doc, from); + if (to) this.to = clipPos(doc, to); + if (text) this.text = text; + if (origin !== undefined) this.origin = origin; + }; + signal(doc, "beforeChange", doc, obj); + if (doc.cm) signal(doc.cm, "beforeChange", doc.cm, obj); + + if (obj.canceled) return null; + return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}; + } + + // Apply a change to a document, and add it to the document's + // history, and propagating it to all linked documents. + function makeChange(doc, change, ignoreReadOnly) { + if (doc.cm) { + if (!doc.cm.curOp) return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly); + if (doc.cm.state.suppressEdits) return; + } + + if (hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")) { + change = filterChange(doc, change, true); + if (!change) return; + } + + // Possibly split or suppress the update based on the presence + // of read-only spans in its range. + var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to); + if (split) { + for (var i = split.length - 1; i >= 0; --i) + makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [""] : change.text}); + } else { + makeChangeInner(doc, change); + } + } + + function makeChangeInner(doc, change) { + if (change.text.length == 1 && change.text[0] == "" && cmp(change.from, change.to) == 0) return; + var selAfter = computeSelAfterChange(doc, change); + addChangeToHistory(doc, change, selAfter, doc.cm ? doc.cm.curOp.id : NaN); + + makeChangeSingleDoc(doc, change, selAfter, stretchSpansOverChange(doc, change)); + var rebased = []; + + linkedDocs(doc, function(doc, sharedHist) { + if (!sharedHist && indexOf(rebased, doc.history) == -1) { + rebaseHist(doc.history, change); + rebased.push(doc.history); + } + makeChangeSingleDoc(doc, change, null, stretchSpansOverChange(doc, change)); + }); + } + + // Revert a change stored in a document's history. + function makeChangeFromHistory(doc, type, allowSelectionOnly) { + if (doc.cm && doc.cm.state.suppressEdits) return; + + var hist = doc.history, event, selAfter = doc.sel; + var source = type == "undo" ? hist.done : hist.undone, dest = type == "undo" ? hist.undone : hist.done; + + // Verify that there is a useable event (so that ctrl-z won't + // needlessly clear selection events) + for (var i = 0; i < source.length; i++) { + event = source[i]; + if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges) + break; + } + if (i == source.length) return; + hist.lastOrigin = hist.lastSelOrigin = null; + + for (;;) { + event = source.pop(); + if (event.ranges) { + pushSelectionToHistory(event, dest); + if (allowSelectionOnly && !event.equals(doc.sel)) { + setSelection(doc, event, {clearRedo: false}); + return; + } + selAfter = event; + } + else break; + } + + // Build up a reverse change object to add to the opposite history + // stack (redo when undoing, and vice versa). + var antiChanges = []; + pushSelectionToHistory(selAfter, dest); + dest.push({changes: antiChanges, generation: hist.generation}); + hist.generation = event.generation || ++hist.maxGeneration; + + var filter = hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange"); + + for (var i = event.changes.length - 1; i >= 0; --i) { + var change = event.changes[i]; + change.origin = type; + if (filter && !filterChange(doc, change, false)) { + source.length = 0; + return; + } + + antiChanges.push(historyChangeFromChange(doc, change)); + + var after = i ? computeSelAfterChange(doc, change) : lst(source); + makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change)); + if (!i && doc.cm) doc.cm.scrollIntoView({from: change.from, to: changeEnd(change)}); + var rebased = []; + + // Propagate to the linked documents + linkedDocs(doc, function(doc, sharedHist) { + if (!sharedHist && indexOf(rebased, doc.history) == -1) { + rebaseHist(doc.history, change); + rebased.push(doc.history); + } + makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change)); + }); + } + } + + // Sub-views need their line numbers shifted when text is added + // above or below them in the parent document. + function shiftDoc(doc, distance) { + if (distance == 0) return; + doc.first += distance; + doc.sel = new Selection(map(doc.sel.ranges, function(range) { + return new Range(Pos(range.anchor.line + distance, range.anchor.ch), + Pos(range.head.line + distance, range.head.ch)); + }), doc.sel.primIndex); + if (doc.cm) { + regChange(doc.cm, doc.first, doc.first - distance, distance); + for (var d = doc.cm.display, l = d.viewFrom; l < d.viewTo; l++) + regLineChange(doc.cm, l, "gutter"); + } + } + + // More lower-level change function, handling only a single document + // (not linked ones). + function makeChangeSingleDoc(doc, change, selAfter, spans) { + if (doc.cm && !doc.cm.curOp) + return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans); + + if (change.to.line < doc.first) { + shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line)); + return; + } + if (change.from.line > doc.lastLine()) return; + + // Clip the change to the size of this doc + if (change.from.line < doc.first) { + var shift = change.text.length - 1 - (doc.first - change.from.line); + shiftDoc(doc, shift); + change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch), + text: [lst(change.text)], origin: change.origin}; + } + var last = doc.lastLine(); + if (change.to.line > last) { + change = {from: change.from, to: Pos(last, getLine(doc, last).text.length), + text: [change.text[0]], origin: change.origin}; + } + + change.removed = getBetween(doc, change.from, change.to); + + if (!selAfter) selAfter = computeSelAfterChange(doc, change); + if (doc.cm) makeChangeSingleDocInEditor(doc.cm, change, spans); + else updateDoc(doc, change, spans); + setSelectionNoUndo(doc, selAfter, sel_dontScroll); + } + + // Handle the interaction of a change to a document with the editor + // that this document is part of. + function makeChangeSingleDocInEditor(cm, change, spans) { + var doc = cm.doc, display = cm.display, from = change.from, to = change.to; + + var recomputeMaxLength = false, checkWidthStart = from.line; + if (!cm.options.lineWrapping) { + checkWidthStart = lineNo(visualLine(getLine(doc, from.line))); + doc.iter(checkWidthStart, to.line + 1, function(line) { + if (line == display.maxLine) { + recomputeMaxLength = true; + return true; + } + }); + } + + if (doc.sel.contains(change.from, change.to) > -1) + signalCursorActivity(cm); + + updateDoc(doc, change, spans, estimateHeight(cm)); + + if (!cm.options.lineWrapping) { + doc.iter(checkWidthStart, from.line + change.text.length, function(line) { + var len = lineLength(line); + if (len > display.maxLineLength) { + display.maxLine = line; + display.maxLineLength = len; + display.maxLineChanged = true; + recomputeMaxLength = false; + } + }); + if (recomputeMaxLength) cm.curOp.updateMaxLine = true; + } + + // Adjust frontier, schedule worker + doc.frontier = Math.min(doc.frontier, from.line); + startWorker(cm, 400); + + var lendiff = change.text.length - (to.line - from.line) - 1; + // Remember that these lines changed, for updating the display + if (change.full) + regChange(cm); + else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change)) + regLineChange(cm, from.line, "text"); + else + regChange(cm, from.line, to.line + 1, lendiff); + + var changesHandler = hasHandler(cm, "changes"), changeHandler = hasHandler(cm, "change"); + if (changeHandler || changesHandler) { + var obj = { + from: from, to: to, + text: change.text, + removed: change.removed, + origin: change.origin + }; + if (changeHandler) signalLater(cm, "change", cm, obj); + if (changesHandler) (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); + } + cm.display.selForContextMenu = null; + } + + function replaceRange(doc, code, from, to, origin) { + if (!to) to = from; + if (cmp(to, from) < 0) { var tmp = to; to = from; from = tmp; } + if (typeof code == "string") code = splitLines(code); + makeChange(doc, {from: from, to: to, text: code, origin: origin}); + } + + // SCROLLING THINGS INTO VIEW + + // If an editor sits on the top or bottom of the window, partially + // scrolled out of view, this ensures that the cursor is visible. + function maybeScrollWindow(cm, coords) { + if (signalDOMEvent(cm, "scrollCursorIntoView")) return; + + var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null; + if (coords.top + box.top < 0) doScroll = true; + else if (coords.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) doScroll = false; + if (doScroll != null && !phantom) { + var scrollNode = elt("div", "\u200b", null, "position: absolute; top: " + + (coords.top - display.viewOffset - paddingTop(cm.display)) + "px; height: " + + (coords.bottom - coords.top + scrollGap(cm) + display.barHeight) + "px; left: " + + coords.left + "px; width: 2px;"); + cm.display.lineSpace.appendChild(scrollNode); + scrollNode.scrollIntoView(doScroll); + cm.display.lineSpace.removeChild(scrollNode); + } + } + + // Scroll a given position into view (immediately), verifying that + // it actually became visible (as line heights are accurately + // measured, the position of something may 'drift' during drawing). + function scrollPosIntoView(cm, pos, end, margin) { + if (margin == null) margin = 0; + for (var limit = 0; limit < 5; limit++) { + var changed = false, coords = cursorCoords(cm, pos); + var endCoords = !end || end == pos ? coords : cursorCoords(cm, end); + var scrollPos = calculateScrollPos(cm, Math.min(coords.left, endCoords.left), + Math.min(coords.top, endCoords.top) - margin, + Math.max(coords.left, endCoords.left), + Math.max(coords.bottom, endCoords.bottom) + margin); + var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft; + if (scrollPos.scrollTop != null) { + setScrollTop(cm, scrollPos.scrollTop); + if (Math.abs(cm.doc.scrollTop - startTop) > 1) changed = true; + } + if (scrollPos.scrollLeft != null) { + setScrollLeft(cm, scrollPos.scrollLeft); + if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) changed = true; + } + if (!changed) break; + } + return coords; + } + + // Scroll a given set of coordinates into view (immediately). + function scrollIntoView(cm, x1, y1, x2, y2) { + var scrollPos = calculateScrollPos(cm, x1, y1, x2, y2); + if (scrollPos.scrollTop != null) setScrollTop(cm, scrollPos.scrollTop); + if (scrollPos.scrollLeft != null) setScrollLeft(cm, scrollPos.scrollLeft); + } + + // Calculate a new scroll position needed to scroll the given + // rectangle into view. Returns an object with scrollTop and + // scrollLeft properties. When these are undefined, the + // vertical/horizontal position does not need to be adjusted. + function calculateScrollPos(cm, x1, y1, x2, y2) { + var display = cm.display, snapMargin = textHeight(cm.display); + if (y1 < 0) y1 = 0; + var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop; + var screen = displayHeight(cm), result = {}; + if (y2 - y1 > screen) y2 = y1 + screen; + var docBottom = cm.doc.height + paddingVert(display); + var atTop = y1 < snapMargin, atBottom = y2 > docBottom - snapMargin; + if (y1 < screentop) { + result.scrollTop = atTop ? 0 : y1; + } else if (y2 > screentop + screen) { + var newTop = Math.min(y1, (atBottom ? docBottom : y2) - screen); + if (newTop != screentop) result.scrollTop = newTop; + } + + var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft; + var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0); + var tooWide = x2 - x1 > screenw; + if (tooWide) x2 = x1 + screenw; + if (x1 < 10) + result.scrollLeft = 0; + else if (x1 < screenleft) + result.scrollLeft = Math.max(0, x1 - (tooWide ? 0 : 10)); + else if (x2 > screenw + screenleft - 3) + result.scrollLeft = x2 + (tooWide ? 0 : 10) - screenw; + return result; + } + + // Store a relative adjustment to the scroll position in the current + // operation (to be applied when the operation finishes). + function addToScrollPos(cm, left, top) { + if (left != null || top != null) resolveScrollToPos(cm); + if (left != null) + cm.curOp.scrollLeft = (cm.curOp.scrollLeft == null ? cm.doc.scrollLeft : cm.curOp.scrollLeft) + left; + if (top != null) + cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top; + } + + // Make sure that at the end of the operation the current cursor is + // shown. + function ensureCursorVisible(cm) { + resolveScrollToPos(cm); + var cur = cm.getCursor(), from = cur, to = cur; + if (!cm.options.lineWrapping) { + from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur; + to = Pos(cur.line, cur.ch + 1); + } + cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin, isCursor: true}; + } + + // When an operation has its scrollToPos property set, and another + // scroll action is applied before the end of the operation, this + // 'simulates' scrolling that position into view in a cheap way, so + // that the effect of intermediate scroll commands is not ignored. + function resolveScrollToPos(cm) { + var range = cm.curOp.scrollToPos; + if (range) { + cm.curOp.scrollToPos = null; + var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to); + var sPos = calculateScrollPos(cm, Math.min(from.left, to.left), + Math.min(from.top, to.top) - range.margin, + Math.max(from.right, to.right), + Math.max(from.bottom, to.bottom) + range.margin); + cm.scrollTo(sPos.scrollLeft, sPos.scrollTop); + } + } + + // API UTILITIES + + // Indent the given line. The how parameter can be "smart", + // "add"/null, "subtract", or "prev". When aggressive is false + // (typically set to true for forced single-line indents), empty + // lines are not indented, and places where the mode returns Pass + // are left alone. + function indentLine(cm, n, how, aggressive) { + var doc = cm.doc, state; + if (how == null) how = "add"; + if (how == "smart") { + // Fall back to "prev" when the mode doesn't have an indentation + // method. + if (!doc.mode.indent) how = "prev"; + else state = getStateBefore(cm, n); + } + + var tabSize = cm.options.tabSize; + var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize); + if (line.stateAfter) line.stateAfter = null; + var curSpaceString = line.text.match(/^\s*/)[0], indentation; + if (!aggressive && !/\S/.test(line.text)) { + indentation = 0; + how = "not"; + } else if (how == "smart") { + indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text); + if (indentation == Pass || indentation > 150) { + if (!aggressive) return; + how = "prev"; + } + } + if (how == "prev") { + if (n > doc.first) indentation = countColumn(getLine(doc, n-1).text, null, tabSize); + else indentation = 0; + } else if (how == "add") { + indentation = curSpace + cm.options.indentUnit; + } else if (how == "subtract") { + indentation = curSpace - cm.options.indentUnit; + } else if (typeof how == "number") { + indentation = curSpace + how; + } + indentation = Math.max(0, indentation); + + var indentString = "", pos = 0; + if (cm.options.indentWithTabs) + for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += "\t";} + if (pos < indentation) indentString += spaceStr(indentation - pos); + + if (indentString != curSpaceString) { + replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), "+input"); + line.stateAfter = null; + return true; + } else { + // Ensure that, if the cursor was in the whitespace at the start + // of the line, it is moved to the end of that space. + for (var i = 0; i < doc.sel.ranges.length; i++) { + var range = doc.sel.ranges[i]; + if (range.head.line == n && range.head.ch < curSpaceString.length) { + var pos = Pos(n, curSpaceString.length); + replaceOneSelection(doc, i, new Range(pos, pos)); + break; + } + } + } + } + + // Utility for applying a change to a line by handle or number, + // returning the number and optionally registering the line as + // changed. + function changeLine(doc, handle, changeType, op) { + var no = handle, line = handle; + if (typeof handle == "number") line = getLine(doc, clipLine(doc, handle)); + else no = lineNo(handle); + if (no == null) return null; + if (op(line, no) && doc.cm) regLineChange(doc.cm, no, changeType); + return line; + } + + // Helper for deleting text near the selection(s), used to implement + // backspace, delete, and similar functionality. + function deleteNearSelection(cm, compute) { + var ranges = cm.doc.sel.ranges, kill = []; + // Build up a set of ranges to kill first, merging overlapping + // ranges. + for (var i = 0; i < ranges.length; i++) { + var toKill = compute(ranges[i]); + while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) { + var replaced = kill.pop(); + if (cmp(replaced.from, toKill.from) < 0) { + toKill.from = replaced.from; + break; + } + } + kill.push(toKill); + } + // Next, remove those actual ranges. + runInOp(cm, function() { + for (var i = kill.length - 1; i >= 0; i--) + replaceRange(cm.doc, "", kill[i].from, kill[i].to, "+delete"); + ensureCursorVisible(cm); + }); + } + + // Used for horizontal relative motion. Dir is -1 or 1 (left or + // right), unit can be "char", "column" (like char, but doesn't + // cross line boundaries), "word" (across next word), or "group" (to + // the start of next group of word or non-word-non-whitespace + // chars). The visually param controls whether, in right-to-left + // text, direction 1 means to move towards the next index in the + // string, or towards the character to the right of the current + // position. The resulting position will have a hitSide=true + // property if it reached the end of the document. + function findPosH(doc, pos, dir, unit, visually) { + var line = pos.line, ch = pos.ch, origDir = dir; + var lineObj = getLine(doc, line); + var possible = true; + function findNextLine() { + var l = line + dir; + if (l < doc.first || l >= doc.first + doc.size) return (possible = false); + line = l; + return lineObj = getLine(doc, l); + } + function moveOnce(boundToLine) { + var next = (visually ? moveVisually : moveLogically)(lineObj, ch, dir, true); + if (next == null) { + if (!boundToLine && findNextLine()) { + if (visually) ch = (dir < 0 ? lineRight : lineLeft)(lineObj); + else ch = dir < 0 ? lineObj.text.length : 0; + } else return (possible = false); + } else ch = next; + return true; + } + + if (unit == "char") moveOnce(); + else if (unit == "column") moveOnce(true); + else if (unit == "word" || unit == "group") { + var sawType = null, group = unit == "group"; + var helper = doc.cm && doc.cm.getHelper(pos, "wordChars"); + for (var first = true;; first = false) { + if (dir < 0 && !moveOnce(!first)) break; + var cur = lineObj.text.charAt(ch) || "\n"; + var type = isWordChar(cur, helper) ? "w" + : group && cur == "\n" ? "n" + : !group || /\s/.test(cur) ? null + : "p"; + if (group && !first && !type) type = "s"; + if (sawType && sawType != type) { + if (dir < 0) {dir = 1; moveOnce();} + break; + } + + if (type) sawType = type; + if (dir > 0 && !moveOnce(!first)) break; + } + } + var result = skipAtomic(doc, Pos(line, ch), origDir, true); + if (!possible) result.hitSide = true; + return result; + } + + // For relative vertical movement. Dir may be -1 or 1. Unit can be + // "page" or "line". The resulting position will have a hitSide=true + // property if it reached the end of the document. + function findPosV(cm, pos, dir, unit) { + var doc = cm.doc, x = pos.left, y; + if (unit == "page") { + var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight); + y = pos.top + dir * (pageSize - (dir < 0 ? 1.5 : .5) * textHeight(cm.display)); + } else if (unit == "line") { + y = dir > 0 ? pos.bottom + 3 : pos.top - 3; + } + for (;;) { + var target = coordsChar(cm, x, y); + if (!target.outside) break; + if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break; } + y += dir * 5; + } + return target; + } + + // EDITOR METHODS + + // The publicly visible API. Note that methodOp(f) means + // 'wrap f in an operation, performed on its `this` parameter'. + + // This is not the complete set of editor methods. Most of the + // methods defined on the Doc type are also injected into + // CodeMirror.prototype, for backwards compatibility and + // convenience. + + CodeMirror.prototype = { + constructor: CodeMirror, + focus: function(){window.focus(); this.display.input.focus();}, + + setOption: function(option, value) { + var options = this.options, old = options[option]; + if (options[option] == value && option != "mode") return; + options[option] = value; + if (optionHandlers.hasOwnProperty(option)) + operation(this, optionHandlers[option])(this, value, old); + }, + + getOption: function(option) {return this.options[option];}, + getDoc: function() {return this.doc;}, + + addKeyMap: function(map, bottom) { + this.state.keyMaps[bottom ? "push" : "unshift"](getKeyMap(map)); + }, + removeKeyMap: function(map) { + var maps = this.state.keyMaps; + for (var i = 0; i < maps.length; ++i) + if (maps[i] == map || maps[i].name == map) { + maps.splice(i, 1); + return true; + } + }, + + addOverlay: methodOp(function(spec, options) { + var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec); + if (mode.startState) throw new Error("Overlays may not be stateful."); + this.state.overlays.push({mode: mode, modeSpec: spec, opaque: options && options.opaque}); + this.state.modeGen++; + regChange(this); + }), + removeOverlay: methodOp(function(spec) { + var overlays = this.state.overlays; + for (var i = 0; i < overlays.length; ++i) { + var cur = overlays[i].modeSpec; + if (cur == spec || typeof spec == "string" && cur.name == spec) { + overlays.splice(i, 1); + this.state.modeGen++; + regChange(this); + return; + } + } + }), + + indentLine: methodOp(function(n, dir, aggressive) { + if (typeof dir != "string" && typeof dir != "number") { + if (dir == null) dir = this.options.smartIndent ? "smart" : "prev"; + else dir = dir ? "add" : "subtract"; + } + if (isLine(this.doc, n)) indentLine(this, n, dir, aggressive); + }), + indentSelection: methodOp(function(how) { + var ranges = this.doc.sel.ranges, end = -1; + for (var i = 0; i < ranges.length; i++) { + var range = ranges[i]; + if (!range.empty()) { + var from = range.from(), to = range.to(); + var start = Math.max(end, from.line); + end = Math.min(this.lastLine(), to.line - (to.ch ? 0 : 1)) + 1; + for (var j = start; j < end; ++j) + indentLine(this, j, how); + var newRanges = this.doc.sel.ranges; + if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0) + replaceOneSelection(this.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); + } else if (range.head.line > end) { + indentLine(this, range.head.line, how, true); + end = range.head.line; + if (i == this.doc.sel.primIndex) ensureCursorVisible(this); + } + } + }), + + // Fetch the parser token for a given character. Useful for hacks + // that want to inspect the mode state (say, for completion). + getTokenAt: function(pos, precise) { + return takeToken(this, pos, precise); + }, + + getLineTokens: function(line, precise) { + return takeToken(this, Pos(line), precise, true); + }, + + getTokenTypeAt: function(pos) { + pos = clipPos(this.doc, pos); + var styles = getLineStyles(this, getLine(this.doc, pos.line)); + var before = 0, after = (styles.length - 1) / 2, ch = pos.ch; + var type; + if (ch == 0) type = styles[2]; + else for (;;) { + var mid = (before + after) >> 1; + if ((mid ? styles[mid * 2 - 1] : 0) >= ch) after = mid; + else if (styles[mid * 2 + 1] < ch) before = mid + 1; + else { type = styles[mid * 2 + 2]; break; } + } + var cut = type ? type.indexOf("cm-overlay ") : -1; + return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1); + }, + + getModeAt: function(pos) { + var mode = this.doc.mode; + if (!mode.innerMode) return mode; + return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode; + }, + + getHelper: function(pos, type) { + return this.getHelpers(pos, type)[0]; + }, + + getHelpers: function(pos, type) { + var found = []; + if (!helpers.hasOwnProperty(type)) return found; + var help = helpers[type], mode = this.getModeAt(pos); + if (typeof mode[type] == "string") { + if (help[mode[type]]) found.push(help[mode[type]]); + } else if (mode[type]) { + for (var i = 0; i < mode[type].length; i++) { + var val = help[mode[type][i]]; + if (val) found.push(val); + } + } else if (mode.helperType && help[mode.helperType]) { + found.push(help[mode.helperType]); + } else if (help[mode.name]) { + found.push(help[mode.name]); + } + for (var i = 0; i < help._global.length; i++) { + var cur = help._global[i]; + if (cur.pred(mode, this) && indexOf(found, cur.val) == -1) + found.push(cur.val); + } + return found; + }, + + getStateAfter: function(line, precise) { + var doc = this.doc; + line = clipLine(doc, line == null ? doc.first + doc.size - 1: line); + return getStateBefore(this, line + 1, precise); + }, + + cursorCoords: function(start, mode) { + var pos, range = this.doc.sel.primary(); + if (start == null) pos = range.head; + else if (typeof start == "object") pos = clipPos(this.doc, start); + else pos = start ? range.from() : range.to(); + return cursorCoords(this, pos, mode || "page"); + }, + + charCoords: function(pos, mode) { + return charCoords(this, clipPos(this.doc, pos), mode || "page"); + }, + + coordsChar: function(coords, mode) { + coords = fromCoordSystem(this, coords, mode || "page"); + return coordsChar(this, coords.left, coords.top); + }, + + lineAtHeight: function(height, mode) { + height = fromCoordSystem(this, {top: height, left: 0}, mode || "page").top; + return lineAtHeight(this.doc, height + this.display.viewOffset); + }, + heightAtLine: function(line, mode) { + var end = false, lineObj; + if (typeof line == "number") { + var last = this.doc.first + this.doc.size - 1; + if (line < this.doc.first) line = this.doc.first; + else if (line > last) { line = last; end = true; } + lineObj = getLine(this.doc, line); + } else { + lineObj = line; + } + return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || "page").top + + (end ? this.doc.height - heightAtLine(lineObj) : 0); + }, + + defaultTextHeight: function() { return textHeight(this.display); }, + defaultCharWidth: function() { return charWidth(this.display); }, + + setGutterMarker: methodOp(function(line, gutterID, value) { + return changeLine(this.doc, line, "gutter", function(line) { + var markers = line.gutterMarkers || (line.gutterMarkers = {}); + markers[gutterID] = value; + if (!value && isEmpty(markers)) line.gutterMarkers = null; + return true; + }); + }), + + clearGutter: methodOp(function(gutterID) { + var cm = this, doc = cm.doc, i = doc.first; + doc.iter(function(line) { + if (line.gutterMarkers && line.gutterMarkers[gutterID]) { + line.gutterMarkers[gutterID] = null; + regLineChange(cm, i, "gutter"); + if (isEmpty(line.gutterMarkers)) line.gutterMarkers = null; + } + ++i; + }); + }), + + lineInfo: function(line) { + if (typeof line == "number") { + if (!isLine(this.doc, line)) return null; + var n = line; + line = getLine(this.doc, line); + if (!line) return null; + } else { + var n = lineNo(line); + if (n == null) return null; + } + return {line: n, handle: line, text: line.text, gutterMarkers: line.gutterMarkers, + textClass: line.textClass, bgClass: line.bgClass, wrapClass: line.wrapClass, + widgets: line.widgets}; + }, + + getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo};}, + + addWidget: function(pos, node, scroll, vert, horiz) { + var display = this.display; + pos = cursorCoords(this, clipPos(this.doc, pos)); + var top = pos.bottom, left = pos.left; + node.style.position = "absolute"; + node.setAttribute("cm-ignore-events", "true"); + this.display.input.setUneditable(node); + display.sizer.appendChild(node); + if (vert == "over") { + top = pos.top; + } else if (vert == "above" || vert == "near") { + var vspace = Math.max(display.wrapper.clientHeight, this.doc.height), + hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth); + // Default to positioning above (if specified and possible); otherwise default to positioning below + if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight) + top = pos.top - node.offsetHeight; + else if (pos.bottom + node.offsetHeight <= vspace) + top = pos.bottom; + if (left + node.offsetWidth > hspace) + left = hspace - node.offsetWidth; + } + node.style.top = top + "px"; + node.style.left = node.style.right = ""; + if (horiz == "right") { + left = display.sizer.clientWidth - node.offsetWidth; + node.style.right = "0px"; + } else { + if (horiz == "left") left = 0; + else if (horiz == "middle") left = (display.sizer.clientWidth - node.offsetWidth) / 2; + node.style.left = left + "px"; + } + if (scroll) + scrollIntoView(this, left, top, left + node.offsetWidth, top + node.offsetHeight); + }, + + triggerOnKeyDown: methodOp(onKeyDown), + triggerOnKeyPress: methodOp(onKeyPress), + triggerOnKeyUp: onKeyUp, + + execCommand: function(cmd) { + if (commands.hasOwnProperty(cmd)) + return commands[cmd](this); + }, + + triggerElectric: methodOp(function(text) { triggerElectric(this, text); }), + + findPosH: function(from, amount, unit, visually) { + var dir = 1; + if (amount < 0) { dir = -1; amount = -amount; } + for (var i = 0, cur = clipPos(this.doc, from); i < amount; ++i) { + cur = findPosH(this.doc, cur, dir, unit, visually); + if (cur.hitSide) break; + } + return cur; + }, + + moveH: methodOp(function(dir, unit) { + var cm = this; + cm.extendSelectionsBy(function(range) { + if (cm.display.shift || cm.doc.extend || range.empty()) + return findPosH(cm.doc, range.head, dir, unit, cm.options.rtlMoveVisually); + else + return dir < 0 ? range.from() : range.to(); + }, sel_move); + }), + + deleteH: methodOp(function(dir, unit) { + var sel = this.doc.sel, doc = this.doc; + if (sel.somethingSelected()) + doc.replaceSelection("", null, "+delete"); + else + deleteNearSelection(this, function(range) { + var other = findPosH(doc, range.head, dir, unit, false); + return dir < 0 ? {from: other, to: range.head} : {from: range.head, to: other}; + }); + }), + + findPosV: function(from, amount, unit, goalColumn) { + var dir = 1, x = goalColumn; + if (amount < 0) { dir = -1; amount = -amount; } + for (var i = 0, cur = clipPos(this.doc, from); i < amount; ++i) { + var coords = cursorCoords(this, cur, "div"); + if (x == null) x = coords.left; + else coords.left = x; + cur = findPosV(this, coords, dir, unit); + if (cur.hitSide) break; + } + return cur; + }, + + moveV: methodOp(function(dir, unit) { + var cm = this, doc = this.doc, goals = []; + var collapse = !cm.display.shift && !doc.extend && doc.sel.somethingSelected(); + doc.extendSelectionsBy(function(range) { + if (collapse) + return dir < 0 ? range.from() : range.to(); + var headPos = cursorCoords(cm, range.head, "div"); + if (range.goalColumn != null) headPos.left = range.goalColumn; + goals.push(headPos.left); + var pos = findPosV(cm, headPos, dir, unit); + if (unit == "page" && range == doc.sel.primary()) + addToScrollPos(cm, null, charCoords(cm, pos, "div").top - headPos.top); + return pos; + }, sel_move); + if (goals.length) for (var i = 0; i < doc.sel.ranges.length; i++) + doc.sel.ranges[i].goalColumn = goals[i]; + }), + + // Find the word at the given position (as returned by coordsChar). + findWordAt: function(pos) { + var doc = this.doc, line = getLine(doc, pos.line).text; + var start = pos.ch, end = pos.ch; + if (line) { + var helper = this.getHelper(pos, "wordChars"); + if ((pos.xRel < 0 || end == line.length) && start) --start; else ++end; + var startChar = line.charAt(start); + var check = isWordChar(startChar, helper) + ? function(ch) { return isWordChar(ch, helper); } + : /\s/.test(startChar) ? function(ch) {return /\s/.test(ch);} + : function(ch) {return !/\s/.test(ch) && !isWordChar(ch);}; + while (start > 0 && check(line.charAt(start - 1))) --start; + while (end < line.length && check(line.charAt(end))) ++end; + } + return new Range(Pos(pos.line, start), Pos(pos.line, end)); + }, + + toggleOverwrite: function(value) { + if (value != null && value == this.state.overwrite) return; + if (this.state.overwrite = !this.state.overwrite) + addClass(this.display.cursorDiv, "CodeMirror-overwrite"); + else + rmClass(this.display.cursorDiv, "CodeMirror-overwrite"); + + signal(this, "overwriteToggle", this, this.state.overwrite); + }, + hasFocus: function() { return this.display.input.getField() == activeElt(); }, + + scrollTo: methodOp(function(x, y) { + if (x != null || y != null) resolveScrollToPos(this); + if (x != null) this.curOp.scrollLeft = x; + if (y != null) this.curOp.scrollTop = y; + }), + getScrollInfo: function() { + var scroller = this.display.scroller; + return {left: scroller.scrollLeft, top: scroller.scrollTop, + height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight, + width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth, + clientHeight: displayHeight(this), clientWidth: displayWidth(this)}; + }, + + scrollIntoView: methodOp(function(range, margin) { + if (range == null) { + range = {from: this.doc.sel.primary().head, to: null}; + if (margin == null) margin = this.options.cursorScrollMargin; + } else if (typeof range == "number") { + range = {from: Pos(range, 0), to: null}; + } else if (range.from == null) { + range = {from: range, to: null}; + } + if (!range.to) range.to = range.from; + range.margin = margin || 0; + + if (range.from.line != null) { + resolveScrollToPos(this); + this.curOp.scrollToPos = range; + } else { + var sPos = calculateScrollPos(this, Math.min(range.from.left, range.to.left), + Math.min(range.from.top, range.to.top) - range.margin, + Math.max(range.from.right, range.to.right), + Math.max(range.from.bottom, range.to.bottom) + range.margin); + this.scrollTo(sPos.scrollLeft, sPos.scrollTop); + } + }), + + setSize: methodOp(function(width, height) { + var cm = this; + function interpret(val) { + return typeof val == "number" || /^\d+$/.test(String(val)) ? val + "px" : val; + } + if (width != null) cm.display.wrapper.style.width = interpret(width); + if (height != null) cm.display.wrapper.style.height = interpret(height); + if (cm.options.lineWrapping) clearLineMeasurementCache(this); + var lineNo = cm.display.viewFrom; + cm.doc.iter(lineNo, cm.display.viewTo, function(line) { + if (line.widgets) for (var i = 0; i < line.widgets.length; i++) + if (line.widgets[i].noHScroll) { regLineChange(cm, lineNo, "widget"); break; } + ++lineNo; + }); + cm.curOp.forceUpdate = true; + signal(cm, "refresh", this); + }), + + operation: function(f){return runInOp(this, f);}, + + refresh: methodOp(function() { + var oldHeight = this.display.cachedTextHeight; + regChange(this); + this.curOp.forceUpdate = true; + clearCaches(this); + this.scrollTo(this.doc.scrollLeft, this.doc.scrollTop); + updateGutterSpace(this); + if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5) + estimateLineHeights(this); + signal(this, "refresh", this); + }), + + swapDoc: methodOp(function(doc) { + var old = this.doc; + old.cm = null; + attachDoc(this, doc); + clearCaches(this); + this.display.input.reset(); + this.scrollTo(doc.scrollLeft, doc.scrollTop); + this.curOp.forceScroll = true; + signalLater(this, "swapDoc", this, old); + return old; + }), + + 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;} + }; + eventMixin(CodeMirror); + + // OPTION DEFAULTS + + // The default configuration options. + var defaults = CodeMirror.defaults = {}; + // Functions to run when options are changed. + var optionHandlers = CodeMirror.optionHandlers = {}; + + function option(name, deflt, handle, notOnInit) { + CodeMirror.defaults[name] = deflt; + if (handle) optionHandlers[name] = + notOnInit ? function(cm, val, old) {if (old != Init) handle(cm, val, old);} : handle; + } + + // Passed to option handlers when there is no old value. + var Init = CodeMirror.Init = {toString: function(){return "CodeMirror.Init";}}; + + // These two are, on init, called from the constructor because they + // have to be initialized before the editor can start at all. + option("value", "", function(cm, val) { + cm.setValue(val); + }, true); + option("mode", null, function(cm, val) { + cm.doc.modeOption = val; + loadMode(cm); + }, true); + + option("indentUnit", 2, loadMode, true); + option("indentWithTabs", false); + option("smartIndent", true); + option("tabSize", 4, function(cm) { + resetModeState(cm); + clearCaches(cm); + regChange(cm); + }, true); + option("specialChars", /[\t\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g, function(cm, val, old) { + cm.state.specialChars = new RegExp(val.source + (val.test("\t") ? "" : "|\t"), "g"); + if (old != CodeMirror.Init) cm.refresh(); + }); + option("specialCharPlaceholder", defaultSpecialCharPlaceholder, function(cm) {cm.refresh();}, true); + option("electricChars", true); + option("inputStyle", mobile ? "contenteditable" : "textarea", function() { + throw new Error("inputStyle can not (yet) be changed in a running editor"); // FIXME + }, true); + option("rtlMoveVisually", !windows); + option("wholeLineUpdateBefore", true); + + option("theme", "default", function(cm) { + themeChanged(cm); + guttersChanged(cm); + }, true); + option("keyMap", "default", function(cm, val, old) { + var next = getKeyMap(val); + var prev = old != CodeMirror.Init && getKeyMap(old); + if (prev && prev.detach) prev.detach(cm, next); + if (next.attach) next.attach(cm, prev || null); + }); + option("extraKeys", null); + + option("lineWrapping", false, wrappingChanged, true); + option("gutters", [], function(cm) { + setGuttersForLineNumbers(cm.options); + guttersChanged(cm); + }, true); + option("fixedGutter", true, function(cm, val) { + cm.display.gutters.style.left = val ? compensateForHScroll(cm.display) + "px" : "0"; + cm.refresh(); + }, true); + option("coverGutterNextToScrollbar", false, function(cm) {updateScrollbars(cm);}, true); + option("scrollbarStyle", "native", function(cm) { + initScrollbars(cm); + updateScrollbars(cm); + cm.display.scrollbars.setScrollTop(cm.doc.scrollTop); + cm.display.scrollbars.setScrollLeft(cm.doc.scrollLeft); + }, true); + option("lineNumbers", false, function(cm) { + setGuttersForLineNumbers(cm.options); + guttersChanged(cm); + }, true); + option("firstLineNumber", 1, guttersChanged, true); + option("lineNumberFormatter", function(integer) {return integer;}, guttersChanged, true); + option("showCursorWhenSelecting", false, updateSelection, true); + + option("resetSelectionOnContextMenu", true); + option("lineWiseCopyCut", true); + + option("readOnly", false, function(cm, val) { + if (val == "nocursor") { + onBlur(cm); + cm.display.input.blur(); + cm.display.disabled = true; + } else { + cm.display.disabled = false; + if (!val) cm.display.input.reset(); + } + }); + option("disableInput", false, function(cm, val) {if (!val) cm.display.input.reset();}, true); + option("dragDrop", true, dragDropChanged); + + option("cursorBlinkRate", 530); + option("cursorScrollMargin", 0); + option("cursorHeight", 1, updateSelection, true); + option("singleCursorHeightPerLine", true, updateSelection, true); + option("workTime", 100); + option("workDelay", 100); + option("flattenSpans", true, resetModeState, true); + option("addModeClass", false, resetModeState, true); + option("pollInterval", 100); + option("undoDepth", 200, function(cm, val){cm.doc.history.undoDepth = val;}); + option("historyEventDelay", 1250); + option("viewportMargin", 10, function(cm){cm.refresh();}, true); + option("maxHighlightLength", 10000, resetModeState, true); + option("moveInputWithCursor", true, function(cm, val) { + if (!val) cm.display.input.resetPosition(); + }); + + option("tabindex", null, function(cm, val) { + cm.display.input.getField().tabIndex = val || ""; + }); + option("autofocus", null); + + // MODE DEFINITION AND QUERYING + + // Known modes, by name and by MIME + var modes = CodeMirror.modes = {}, mimeModes = CodeMirror.mimeModes = {}; + + // Extra arguments are stored as the mode's dependencies, which is + // used by (legacy) mechanisms like loadmode.js to automatically + // load a mode. (Preferred mechanism is the require/define calls.) + CodeMirror.defineMode = function(name, mode) { + if (!CodeMirror.defaults.mode && name != "null") CodeMirror.defaults.mode = name; + if (arguments.length > 2) + mode.dependencies = Array.prototype.slice.call(arguments, 2); + modes[name] = mode; + }; + + CodeMirror.defineMIME = function(mime, spec) { + mimeModes[mime] = spec; + }; + + // Given a MIME type, a {name, ...options} config object, or a name + // string, return a mode config object. + CodeMirror.resolveMode = function(spec) { + if (typeof spec == "string" && mimeModes.hasOwnProperty(spec)) { + spec = mimeModes[spec]; + } else if (spec && typeof spec.name == "string" && mimeModes.hasOwnProperty(spec.name)) { + var found = mimeModes[spec.name]; + if (typeof found == "string") found = {name: found}; + spec = createObj(found, spec); + spec.name = found.name; + } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(spec)) { + return CodeMirror.resolveMode("application/xml"); + } + if (typeof spec == "string") return {name: spec}; + else return spec || {name: "null"}; + }; + + // Given a mode spec (anything that resolveMode accepts), find and + // initialize an actual mode object. + CodeMirror.getMode = function(options, spec) { + var spec = CodeMirror.resolveMode(spec); + var mfactory = modes[spec.name]; + if (!mfactory) return CodeMirror.getMode(options, "text/plain"); + var modeObj = mfactory(options, spec); + if (modeExtensions.hasOwnProperty(spec.name)) { + var exts = modeExtensions[spec.name]; + for (var prop in exts) { + if (!exts.hasOwnProperty(prop)) continue; + if (modeObj.hasOwnProperty(prop)) modeObj["_" + prop] = modeObj[prop]; + modeObj[prop] = exts[prop]; + } + } + modeObj.name = spec.name; + if (spec.helperType) modeObj.helperType = spec.helperType; + if (spec.modeProps) for (var prop in spec.modeProps) + modeObj[prop] = spec.modeProps[prop]; + + return modeObj; + }; + + // Minimal default mode. + CodeMirror.defineMode("null", function() { + return {token: function(stream) {stream.skipToEnd();}}; + }); + CodeMirror.defineMIME("text/plain", "null"); + + // This can be used to attach properties to mode objects from + // outside the actual mode definition. + var modeExtensions = CodeMirror.modeExtensions = {}; + CodeMirror.extendMode = function(mode, properties) { + var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {}); + copyObj(properties, exts); + }; + + // EXTENSIONS + + CodeMirror.defineExtension = function(name, func) { + CodeMirror.prototype[name] = func; + }; + CodeMirror.defineDocExtension = function(name, func) { + Doc.prototype[name] = func; + }; + CodeMirror.defineOption = option; + + var initHooks = []; + CodeMirror.defineInitHook = function(f) {initHooks.push(f);}; + + var helpers = CodeMirror.helpers = {}; + CodeMirror.registerHelper = function(type, name, value) { + if (!helpers.hasOwnProperty(type)) helpers[type] = CodeMirror[type] = {_global: []}; + helpers[type][name] = value; + }; + CodeMirror.registerGlobalHelper = function(type, name, predicate, value) { + CodeMirror.registerHelper(type, name, value); + helpers[type]._global.push({pred: predicate, val: value}); + }; + + // MODE STATE HANDLING + + // Utility functions for working with state. Exported because nested + // modes need to do this for their inner modes. + + var copyState = CodeMirror.copyState = function(mode, state) { + if (state === true) return state; + if (mode.copyState) return mode.copyState(state); + var nstate = {}; + for (var n in state) { + var val = state[n]; + if (val instanceof Array) val = val.concat([]); + nstate[n] = val; + } + return nstate; + }; + + var startState = CodeMirror.startState = function(mode, a1, a2) { + return mode.startState ? mode.startState(a1, a2) : true; + }; + + // Given a mode and a state (for that mode), find the inner mode and + // state at the position that the state refers to. + CodeMirror.innerMode = function(mode, state) { + while (mode.innerMode) { + var info = mode.innerMode(state); + if (!info || info.mode == mode) break; + state = info.state; + mode = info.mode; + } + return info || {mode: mode, state: state}; + }; + + // STANDARD COMMANDS + + // Commands are parameter-less actions that can be performed on an + // editor, mostly used for keybindings. + var commands = CodeMirror.commands = { + selectAll: function(cm) {cm.setSelection(Pos(cm.firstLine(), 0), Pos(cm.lastLine()), sel_dontScroll);}, + singleSelection: function(cm) { + cm.setSelection(cm.getCursor("anchor"), cm.getCursor("head"), sel_dontScroll); + }, + killLine: function(cm) { + deleteNearSelection(cm, function(range) { + if (range.empty()) { + var len = getLine(cm.doc, range.head.line).text.length; + if (range.head.ch == len && range.head.line < cm.lastLine()) + return {from: range.head, to: Pos(range.head.line + 1, 0)}; + else + return {from: range.head, to: Pos(range.head.line, len)}; + } else { + return {from: range.from(), to: range.to()}; + } + }); + }, + deleteLine: function(cm) { + deleteNearSelection(cm, function(range) { + return {from: Pos(range.from().line, 0), + to: clipPos(cm.doc, Pos(range.to().line + 1, 0))}; + }); + }, + delLineLeft: function(cm) { + deleteNearSelection(cm, function(range) { + return {from: Pos(range.from().line, 0), to: range.from()}; + }); + }, + delWrappedLineLeft: function(cm) { + deleteNearSelection(cm, function(range) { + var top = cm.charCoords(range.head, "div").top + 5; + var leftPos = cm.coordsChar({left: 0, top: top}, "div"); + return {from: leftPos, to: range.from()}; + }); + }, + delWrappedLineRight: function(cm) { + deleteNearSelection(cm, function(range) { + var top = cm.charCoords(range.head, "div").top + 5; + var rightPos = cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div"); + return {from: range.from(), to: rightPos }; + }); + }, + undo: function(cm) {cm.undo();}, + redo: function(cm) {cm.redo();}, + undoSelection: function(cm) {cm.undoSelection();}, + redoSelection: function(cm) {cm.redoSelection();}, + goDocStart: function(cm) {cm.extendSelection(Pos(cm.firstLine(), 0));}, + goDocEnd: function(cm) {cm.extendSelection(Pos(cm.lastLine()));}, + goLineStart: function(cm) { + cm.extendSelectionsBy(function(range) { return lineStart(cm, range.head.line); }, + {origin: "+move", bias: 1}); + }, + goLineStartSmart: function(cm) { + cm.extendSelectionsBy(function(range) { + return lineStartSmart(cm, range.head); + }, {origin: "+move", bias: 1}); + }, + goLineEnd: function(cm) { + cm.extendSelectionsBy(function(range) { return lineEnd(cm, range.head.line); }, + {origin: "+move", bias: -1}); + }, + goLineRight: function(cm) { + cm.extendSelectionsBy(function(range) { + var top = cm.charCoords(range.head, "div").top + 5; + return cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div"); + }, sel_move); + }, + goLineLeft: function(cm) { + cm.extendSelectionsBy(function(range) { + var top = cm.charCoords(range.head, "div").top + 5; + return cm.coordsChar({left: 0, top: top}, "div"); + }, sel_move); + }, + goLineLeftSmart: function(cm) { + cm.extendSelectionsBy(function(range) { + var top = cm.charCoords(range.head, "div").top + 5; + var pos = cm.coordsChar({left: 0, top: top}, "div"); + if (pos.ch < cm.getLine(pos.line).search(/\S/)) return lineStartSmart(cm, range.head); + return pos; + }, sel_move); + }, + goLineUp: function(cm) {cm.moveV(-1, "line");}, + goLineDown: function(cm) {cm.moveV(1, "line");}, + goPageUp: function(cm) {cm.moveV(-1, "page");}, + goPageDown: function(cm) {cm.moveV(1, "page");}, + goCharLeft: function(cm) {cm.moveH(-1, "char");}, + goCharRight: function(cm) {cm.moveH(1, "char");}, + goColumnLeft: function(cm) {cm.moveH(-1, "column");}, + goColumnRight: function(cm) {cm.moveH(1, "column");}, + goWordLeft: function(cm) {cm.moveH(-1, "word");}, + goGroupRight: function(cm) {cm.moveH(1, "group");}, + goGroupLeft: function(cm) {cm.moveH(-1, "group");}, + goWordRight: function(cm) {cm.moveH(1, "word");}, + delCharBefore: function(cm) {cm.deleteH(-1, "char");}, + delCharAfter: function(cm) {cm.deleteH(1, "char");}, + delWordBefore: function(cm) {cm.deleteH(-1, "word");}, + delWordAfter: function(cm) {cm.deleteH(1, "word");}, + delGroupBefore: function(cm) {cm.deleteH(-1, "group");}, + delGroupAfter: function(cm) {cm.deleteH(1, "group");}, + indentAuto: function(cm) {cm.indentSelection("smart");}, + indentMore: function(cm) {cm.indentSelection("add");}, + indentLess: function(cm) {cm.indentSelection("subtract");}, + insertTab: function(cm) {cm.replaceSelection("\t");}, + insertSoftTab: function(cm) { + var spaces = [], ranges = cm.listSelections(), tabSize = cm.options.tabSize; + for (var i = 0; i < ranges.length; i++) { + var pos = ranges[i].from(); + var col = countColumn(cm.getLine(pos.line), pos.ch, tabSize); + spaces.push(new Array(tabSize - col % tabSize + 1).join(" ")); + } + cm.replaceSelections(spaces); + }, + defaultTab: function(cm) { + if (cm.somethingSelected()) cm.indentSelection("add"); + else cm.execCommand("insertTab"); + }, + transposeChars: function(cm) { + runInOp(cm, function() { + var ranges = cm.listSelections(), newSel = []; + for (var i = 0; i < ranges.length; i++) { + var cur = ranges[i].head, line = getLine(cm.doc, cur.line).text; + if (line) { + if (cur.ch == line.length) cur = new Pos(cur.line, cur.ch - 1); + if (cur.ch > 0) { + cur = new Pos(cur.line, cur.ch + 1); + cm.replaceRange(line.charAt(cur.ch - 1) + line.charAt(cur.ch - 2), + Pos(cur.line, cur.ch - 2), cur, "+transpose"); + } else if (cur.line > cm.doc.first) { + var prev = getLine(cm.doc, cur.line - 1).text; + if (prev) + cm.replaceRange(line.charAt(0) + "\n" + prev.charAt(prev.length - 1), + Pos(cur.line - 1, prev.length - 1), Pos(cur.line, 1), "+transpose"); + } + } + newSel.push(new Range(cur, cur)); + } + cm.setSelections(newSel); + }); + }, + newlineAndIndent: function(cm) { + runInOp(cm, function() { + var len = cm.listSelections().length; + for (var i = 0; i < len; i++) { + var range = cm.listSelections()[i]; + cm.replaceRange("\n", range.anchor, range.head, "+input"); + cm.indentLine(range.from().line + 1, null, true); + ensureCursorVisible(cm); + } + }); + }, + toggleOverwrite: function(cm) {cm.toggleOverwrite();} + }; + + + // STANDARD KEYMAPS + + var keyMap = CodeMirror.keyMap = {}; + + keyMap.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" + }; + // Note that the save and find-related commands aren't defined by + // default. User code or addons can define them. Unknown commands + // are simply ignored. + keyMap.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" + }; + // Very basic readline/emacs-style bindings, which are standard on Mac. + keyMap.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" + }; + keyMap.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"] + }; + keyMap["default"] = mac ? keyMap.macDefault : keyMap.pcDefault; + + // KEYMAP DISPATCH + + function normalizeKeyName(name) { + var parts = name.split(/-(?!$)/), name = parts[parts.length - 1]; + var alt, ctrl, shift, cmd; + for (var i = 0; i < parts.length - 1; i++) { + var mod = parts[i]; + if (/^(cmd|meta|m)$/i.test(mod)) cmd = true; + else if (/^a(lt)?$/i.test(mod)) alt = true; + else if (/^(c|ctrl|control)$/i.test(mod)) ctrl = true; + else if (/^s(hift)$/i.test(mod)) shift = true; + else throw new Error("Unrecognized modifier name: " + mod); + } + if (alt) name = "Alt-" + name; + if (ctrl) name = "Ctrl-" + name; + if (cmd) name = "Cmd-" + name; + if (shift) name = "Shift-" + name; + return name; + } + + // This is a kludge to keep keymaps mostly working as raw objects + // (backwards compatibility) while at the same time support features + // like normalization and multi-stroke key bindings. It compiles a + // new normalized keymap, and then updates the old object to reflect + // this. + CodeMirror.normalizeKeyMap = function(keymap) { + var copy = {}; + for (var keyname in keymap) if (keymap.hasOwnProperty(keyname)) { + var value = keymap[keyname]; + if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) continue; + if (value == "...") { delete keymap[keyname]; continue; } + + var keys = map(keyname.split(" "), normalizeKeyName); + for (var i = 0; i < keys.length; i++) { + var val, name; + if (i == keys.length - 1) { + name = keys.join(" "); + val = value; + } else { + name = keys.slice(0, i + 1).join(" "); + val = "..."; + } + var prev = copy[name]; + if (!prev) copy[name] = val; + else if (prev != val) throw new Error("Inconsistent bindings for " + name); + } + delete keymap[keyname]; + } + for (var prop in copy) keymap[prop] = copy[prop]; + return keymap; + }; + + var lookupKey = CodeMirror.lookupKey = function(key, map, handle, context) { + map = getKeyMap(map); + var found = map.call ? map.call(key, context) : map[key]; + if (found === false) return "nothing"; + if (found === "...") return "multi"; + if (found != null && handle(found)) return "handled"; + + if (map.fallthrough) { + if (Object.prototype.toString.call(map.fallthrough) != "[object Array]") + return lookupKey(key, map.fallthrough, handle, context); + for (var i = 0; i < map.fallthrough.length; i++) { + var result = lookupKey(key, map.fallthrough[i], handle, context); + if (result) return result; + } + } + }; + + // Modifier key presses don't count as 'real' key presses for the + // purpose of keymap fallthrough. + var isModifierKey = CodeMirror.isModifierKey = function(value) { + var name = typeof value == "string" ? value : keyNames[value.keyCode]; + return name == "Ctrl" || name == "Alt" || name == "Shift" || name == "Mod"; + }; + + // Look up the name of a key as indicated by an event object. + var keyName = CodeMirror.keyName = function(event, noShift) { + if (presto && event.keyCode == 34 && event["char"]) return false; + var base = keyNames[event.keyCode], name = base; + if (name == null || event.altGraphKey) return false; + if (event.altKey && base != "Alt") name = "Alt-" + name; + if ((flipCtrlCmd ? event.metaKey : event.ctrlKey) && base != "Ctrl") name = "Ctrl-" + name; + if ((flipCtrlCmd ? event.ctrlKey : event.metaKey) && base != "Cmd") name = "Cmd-" + name; + if (!noShift && event.shiftKey && base != "Shift") name = "Shift-" + name; + return name; + }; + + function getKeyMap(val) { + return typeof val == "string" ? keyMap[val] : val; + } + + // FROMTEXTAREA + + CodeMirror.fromTextArea = function(textarea, options) { + options = options ? copyObj(options) : {}; + options.value = textarea.value; + if (!options.tabindex && textarea.tabIndex) + options.tabindex = textarea.tabIndex; + if (!options.placeholder && textarea.placeholder) + options.placeholder = textarea.placeholder; + // Set autofocus to true if this textarea is focused, or if it has + // autofocus and no other element is focused. + if (options.autofocus == null) { + var hasFocus = activeElt(); + options.autofocus = hasFocus == textarea || + textarea.getAttribute("autofocus") != null && hasFocus == document.body; + } + + function save() {textarea.value = cm.getValue();} + if (textarea.form) { + on(textarea.form, "submit", save); + // Deplorable hack to make the submit method do the right thing. + if (!options.leaveSubmitMethodAlone) { + var form = textarea.form, realSubmit = form.submit; + try { + var wrappedSubmit = form.submit = function() { + save(); + form.submit = realSubmit; + form.submit(); + form.submit = wrappedSubmit; + }; + } catch(e) {} + } + } + + options.finishInit = function(cm) { + cm.save = save; + cm.getTextArea = function() { return textarea; }; + cm.toTextArea = function() { + cm.toTextArea = isNaN; // Prevent this from being ran twice + save(); + textarea.parentNode.removeChild(cm.getWrapperElement()); + textarea.style.display = ""; + if (textarea.form) { + off(textarea.form, "submit", save); + if (typeof textarea.form.submit == "function") + textarea.form.submit = realSubmit; + } + }; + }; + + textarea.style.display = "none"; + var cm = CodeMirror(function(node) { + textarea.parentNode.insertBefore(node, textarea.nextSibling); + }, options); + return cm; + }; + + // STRING STREAM + + // Fed to the mode parsers, provides helper functions to make + // parsers more succinct. + + var StringStream = CodeMirror.StringStream = function(string, tabSize) { + this.pos = this.start = 0; + this.string = string; + this.tabSize = tabSize || 8; + this.lastColumnPos = this.lastColumnValue = 0; + this.lineStart = 0; + }; + + StringStream.prototype = { + eol: function() {return this.pos >= this.string.length;}, + sol: function() {return this.pos == this.lineStart;}, + peek: function() {return this.string.charAt(this.pos) || undefined;}, + next: function() { + if (this.pos < this.string.length) + return this.string.charAt(this.pos++); + }, + eat: function(match) { + var ch = this.string.charAt(this.pos); + if (typeof match == "string") var ok = ch == match; + else var ok = ch && (match.test ? match.test(ch) : match(ch)); + if (ok) {++this.pos; return ch;} + }, + eatWhile: function(match) { + var start = this.pos; + while (this.eat(match)){} + return this.pos > start; + }, + eatSpace: function() { + var start = this.pos; + while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) ++this.pos; + return this.pos > start; + }, + skipToEnd: function() {this.pos = this.string.length;}, + skipTo: function(ch) { + var found = this.string.indexOf(ch, this.pos); + if (found > -1) {this.pos = found; return true;} + }, + backUp: function(n) {this.pos -= n;}, + column: function() { + if (this.lastColumnPos < this.start) { + this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue); + this.lastColumnPos = this.start; + } + return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0); + }, + indentation: function() { + return countColumn(this.string, null, this.tabSize) - + (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0); + }, + match: function(pattern, consume, caseInsensitive) { + if (typeof pattern == "string") { + var cased = function(str) {return caseInsensitive ? str.toLowerCase() : str;}; + var substr = this.string.substr(this.pos, pattern.length); + if (cased(substr) == cased(pattern)) { + if (consume !== false) this.pos += pattern.length; + return true; + } + } else { + var match = this.string.slice(this.pos).match(pattern); + if (match && match.index > 0) return null; + if (match && consume !== false) this.pos += match[0].length; + return match; + } + }, + current: function(){return this.string.slice(this.start, this.pos);}, + hideFirstChars: function(n, inner) { + this.lineStart += n; + try { return inner(); } + finally { this.lineStart -= n; } + } + }; + + // TEXTMARKERS + + // Created with markText and setBookmark methods. A TextMarker is a + // handle that can be used to clear or find a marked position in the + // document. Line objects hold arrays (markedSpans) containing + // {from, to, marker} object pointing to such marker objects, and + // indicating that such a marker is present on that line. Multiple + // lines may point to the same marker when it spans across lines. + // The spans will have null for their from/to properties when the + // marker continues beyond the start/end of the line. Markers have + // links back to the lines they currently touch. + + var nextMarkerId = 0; + + var TextMarker = CodeMirror.TextMarker = function(doc, type) { + this.lines = []; + this.type = type; + this.doc = doc; + this.id = ++nextMarkerId; + }; + eventMixin(TextMarker); + + // Clear the marker. + TextMarker.prototype.clear = function() { + if (this.explicitlyCleared) return; + var cm = this.doc.cm, withOp = cm && !cm.curOp; + if (withOp) startOperation(cm); + if (hasHandler(this, "clear")) { + var found = this.find(); + if (found) signalLater(this, "clear", found.from, found.to); + } + var min = null, max = null; + for (var i = 0; i < this.lines.length; ++i) { + var line = this.lines[i]; + var span = getMarkedSpanFor(line.markedSpans, this); + if (cm && !this.collapsed) regLineChange(cm, lineNo(line), "text"); + else if (cm) { + if (span.to != null) max = lineNo(line); + if (span.from != null) min = lineNo(line); + } + line.markedSpans = removeMarkedSpan(line.markedSpans, span); + if (span.from == null && this.collapsed && !lineIsHidden(this.doc, line) && cm) + updateLineHeight(line, textHeight(cm.display)); + } + if (cm && this.collapsed && !cm.options.lineWrapping) for (var i = 0; i < this.lines.length; ++i) { + var visual = visualLine(this.lines[i]), len = lineLength(visual); + if (len > cm.display.maxLineLength) { + cm.display.maxLine = visual; + cm.display.maxLineLength = len; + cm.display.maxLineChanged = true; + } + } + + if (min != null && cm && this.collapsed) regChange(cm, min, max + 1); + this.lines.length = 0; + this.explicitlyCleared = true; + if (this.atomic && this.doc.cantEdit) { + this.doc.cantEdit = false; + if (cm) reCheckSelection(cm.doc); + } + if (cm) signalLater(cm, "markerCleared", cm, this); + if (withOp) endOperation(cm); + if (this.parent) this.parent.clear(); + }; + + // Find the position of the marker in the document. Returns a {from, + // to} object by default. Side can be passed to get a specific side + // -- 0 (both), -1 (left), or 1 (right). When lineObj is true, the + // Pos objects returned contain a line object, rather than a line + // number (used to prevent looking up the same line twice). + TextMarker.prototype.find = function(side, lineObj) { + if (side == null && this.type == "bookmark") side = 1; + var from, to; + for (var i = 0; i < this.lines.length; ++i) { + var line = this.lines[i]; + var span = getMarkedSpanFor(line.markedSpans, this); + if (span.from != null) { + from = Pos(lineObj ? line : lineNo(line), span.from); + if (side == -1) return from; + } + if (span.to != null) { + to = Pos(lineObj ? line : lineNo(line), span.to); + if (side == 1) return to; + } + } + return from && {from: from, to: to}; + }; + + // Signals that the marker's widget changed, and surrounding layout + // should be recomputed. + TextMarker.prototype.changed = function() { + var pos = this.find(-1, true), widget = this, cm = this.doc.cm; + if (!pos || !cm) return; + runInOp(cm, function() { + var line = pos.line, lineN = lineNo(pos.line); + var view = findViewForLine(cm, lineN); + if (view) { + clearLineMeasurementCacheFor(view); + cm.curOp.selectionChanged = cm.curOp.forceUpdate = true; + } + cm.curOp.updateMaxLine = true; + if (!lineIsHidden(widget.doc, line) && widget.height != null) { + var oldHeight = widget.height; + widget.height = null; + var dHeight = widgetHeight(widget) - oldHeight; + if (dHeight) + updateLineHeight(line, line.height + dHeight); + } + }); + }; + + TextMarker.prototype.attachLine = function(line) { + if (!this.lines.length && this.doc.cm) { + var op = this.doc.cm.curOp; + if (!op.maybeHiddenMarkers || indexOf(op.maybeHiddenMarkers, this) == -1) + (op.maybeUnhiddenMarkers || (op.maybeUnhiddenMarkers = [])).push(this); + } + this.lines.push(line); + }; + TextMarker.prototype.detachLine = function(line) { + this.lines.splice(indexOf(this.lines, line), 1); + if (!this.lines.length && this.doc.cm) { + var op = this.doc.cm.curOp; + (op.maybeHiddenMarkers || (op.maybeHiddenMarkers = [])).push(this); + } + }; + + // Collapsed markers have unique ids, in order to be able to order + // them, which is needed for uniquely determining an outer marker + // when they overlap (they may nest, but not partially overlap). + var nextMarkerId = 0; + + // Create a marker, wire it up to the right lines, and + function markText(doc, from, to, options, type) { + // Shared markers (across linked documents) are handled separately + // (markTextShared will call out to this again, once per + // document). + if (options && options.shared) return markTextShared(doc, from, to, options, type); + // Ensure we are in an operation. + if (doc.cm && !doc.cm.curOp) return operation(doc.cm, markText)(doc, from, to, options, type); + + var marker = new TextMarker(doc, type), diff = cmp(from, to); + if (options) copyObj(options, marker, false); + // Don't connect empty markers unless clearWhenEmpty is false + if (diff > 0 || diff == 0 && marker.clearWhenEmpty !== false) + return marker; + if (marker.replacedWith) { + // Showing up as a widget implies collapsed (widget replaces text) + marker.collapsed = true; + marker.widgetNode = elt("span", [marker.replacedWith], "CodeMirror-widget"); + if (!options.handleMouseEvents) marker.widgetNode.setAttribute("cm-ignore-events", "true"); + if (options.insertLeft) marker.widgetNode.insertLeft = true; + } + if (marker.collapsed) { + if (conflictingCollapsedRange(doc, from.line, from, to, marker) || + from.line != to.line && conflictingCollapsedRange(doc, to.line, from, to, marker)) + throw new Error("Inserting collapsed marker partially overlapping an existing one"); + sawCollapsedSpans = true; + } + + if (marker.addToHistory) + addChangeToHistory(doc, {from: from, to: to, origin: "markText"}, doc.sel, NaN); + + var curLine = from.line, cm = doc.cm, updateMaxLine; + doc.iter(curLine, to.line + 1, function(line) { + if (cm && marker.collapsed && !cm.options.lineWrapping && visualLine(line) == cm.display.maxLine) + updateMaxLine = true; + if (marker.collapsed && curLine != from.line) updateLineHeight(line, 0); + addMarkedSpan(line, new MarkedSpan(marker, + curLine == from.line ? from.ch : null, + curLine == to.line ? to.ch : null)); + ++curLine; + }); + // lineIsHidden depends on the presence of the spans, so needs a second pass + if (marker.collapsed) doc.iter(from.line, to.line + 1, function(line) { + if (lineIsHidden(doc, line)) updateLineHeight(line, 0); + }); + + if (marker.clearOnEnter) on(marker, "beforeCursorEnter", function() { marker.clear(); }); + + if (marker.readOnly) { + sawReadOnlySpans = true; + if (doc.history.done.length || doc.history.undone.length) + doc.clearHistory(); + } + if (marker.collapsed) { + marker.id = ++nextMarkerId; + marker.atomic = true; + } + if (cm) { + // Sync editor state + if (updateMaxLine) cm.curOp.updateMaxLine = true; + if (marker.collapsed) + regChange(cm, from.line, to.line + 1); + else if (marker.className || marker.title || marker.startStyle || marker.endStyle || marker.css) + for (var i = from.line; i <= to.line; i++) regLineChange(cm, i, "text"); + if (marker.atomic) reCheckSelection(cm.doc); + signalLater(cm, "markerAdded", cm, marker); + } + return marker; + } + + // SHARED TEXTMARKERS + + // A shared marker spans multiple linked documents. It is + // implemented as a meta-marker-object controlling multiple normal + // markers. + var SharedTextMarker = CodeMirror.SharedTextMarker = function(markers, primary) { + this.markers = markers; + this.primary = primary; + for (var i = 0; i < markers.length; ++i) + markers[i].parent = this; + }; + eventMixin(SharedTextMarker); + + SharedTextMarker.prototype.clear = function() { + if (this.explicitlyCleared) return; + this.explicitlyCleared = true; + for (var i = 0; i < this.markers.length; ++i) + this.markers[i].clear(); + signalLater(this, "clear"); + }; + SharedTextMarker.prototype.find = function(side, lineObj) { + return this.primary.find(side, lineObj); + }; + + function markTextShared(doc, from, to, options, type) { + options = copyObj(options); + options.shared = false; + var markers = [markText(doc, from, to, options, type)], primary = markers[0]; + var widget = options.widgetNode; + linkedDocs(doc, function(doc) { + if (widget) options.widgetNode = widget.cloneNode(true); + markers.push(markText(doc, clipPos(doc, from), clipPos(doc, to), options, type)); + for (var i = 0; i < doc.linked.length; ++i) + if (doc.linked[i].isParent) return; + primary = lst(markers); + }); + return new SharedTextMarker(markers, primary); + } + + function findSharedMarkers(doc) { + return doc.findMarks(Pos(doc.first, 0), doc.clipPos(Pos(doc.lastLine())), + function(m) { return m.parent; }); + } + + function copySharedMarkers(doc, markers) { + for (var i = 0; i < markers.length; i++) { + var marker = markers[i], pos = marker.find(); + var mFrom = doc.clipPos(pos.from), mTo = doc.clipPos(pos.to); + if (cmp(mFrom, mTo)) { + var subMark = markText(doc, mFrom, mTo, marker.primary, marker.primary.type); + marker.markers.push(subMark); + subMark.parent = marker; + } + } + } + + function detachSharedMarkers(markers) { + for (var i = 0; i < markers.length; i++) { + var marker = markers[i], linked = [marker.primary.doc];; + linkedDocs(marker.primary.doc, function(d) { linked.push(d); }); + for (var j = 0; j < marker.markers.length; j++) { + var subMarker = marker.markers[j]; + if (indexOf(linked, subMarker.doc) == -1) { + subMarker.parent = null; + marker.markers.splice(j--, 1); + } + } + } + } + + // TEXTMARKER SPANS + + function MarkedSpan(marker, from, to) { + this.marker = marker; + this.from = from; this.to = to; + } + + // Search an array of spans for a span matching the given marker. + function getMarkedSpanFor(spans, marker) { + if (spans) for (var i = 0; i < spans.length; ++i) { + var span = spans[i]; + if (span.marker == marker) return span; + } + } + // Remove a span from an array, returning undefined if no spans are + // left (we don't store arrays for lines without spans). + function removeMarkedSpan(spans, span) { + for (var r, i = 0; i < spans.length; ++i) + if (spans[i] != span) (r || (r = [])).push(spans[i]); + return r; + } + // Add a span to a line. + function addMarkedSpan(line, span) { + line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span]; + span.marker.attachLine(line); + } + + // Used for the algorithm that adjusts markers for a change in the + // document. These functions cut an array of spans at a given + // character position, returning an array of remaining chunks (or + // undefined if nothing remains). + function markedSpansBefore(old, startCh, isInsert) { + if (old) for (var i = 0, nw; i < old.length; ++i) { + var span = old[i], marker = span.marker; + var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh); + if (startsBefore || span.from == startCh && marker.type == "bookmark" && (!isInsert || !span.marker.insertLeft)) { + var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh); + (nw || (nw = [])).push(new MarkedSpan(marker, span.from, endsAfter ? null : span.to)); + } + } + return nw; + } + function markedSpansAfter(old, endCh, isInsert) { + if (old) for (var i = 0, nw; i < old.length; ++i) { + var span = old[i], marker = span.marker; + var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh); + if (endsAfter || span.from == endCh && marker.type == "bookmark" && (!isInsert || span.marker.insertLeft)) { + var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh); + (nw || (nw = [])).push(new MarkedSpan(marker, startsBefore ? null : span.from - endCh, + span.to == null ? null : span.to - endCh)); + } + } + return nw; + } + + // Given a change object, compute the new set of marker spans that + // cover the line in which the change took place. Removes spans + // entirely within the change, reconnects spans belonging to the + // same marker that appear on both sides of the change, and cuts off + // spans partially within the change. Returns an array of span + // arrays with one element for each line in (after) the change. + function stretchSpansOverChange(doc, change) { + if (change.full) return null; + var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans; + var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans; + if (!oldFirst && !oldLast) return null; + + var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0; + // Get the spans that 'stick out' on both sides + var first = markedSpansBefore(oldFirst, startCh, isInsert); + var last = markedSpansAfter(oldLast, endCh, isInsert); + + // Next, merge those two ends + var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0); + if (first) { + // Fix up .to properties of first + for (var i = 0; i < first.length; ++i) { + var span = first[i]; + if (span.to == null) { + var found = getMarkedSpanFor(last, span.marker); + if (!found) span.to = startCh; + else if (sameLine) span.to = found.to == null ? null : found.to + offset; + } + } + } + if (last) { + // Fix up .from in last (or move them into first in case of sameLine) + for (var i = 0; i < last.length; ++i) { + var span = last[i]; + if (span.to != null) span.to += offset; + if (span.from == null) { + var found = getMarkedSpanFor(first, span.marker); + if (!found) { + span.from = offset; + if (sameLine) (first || (first = [])).push(span); + } + } else { + span.from += offset; + if (sameLine) (first || (first = [])).push(span); + } + } + } + // Make sure we didn't create any zero-length spans + if (first) first = clearEmptySpans(first); + if (last && last != first) last = clearEmptySpans(last); + + var newMarkers = [first]; + if (!sameLine) { + // Fill gap with whole-line-spans + var gap = change.text.length - 2, gapMarkers; + if (gap > 0 && first) + for (var i = 0; i < first.length; ++i) + if (first[i].to == null) + (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i].marker, null, null)); + for (var i = 0; i < gap; ++i) + newMarkers.push(gapMarkers); + newMarkers.push(last); + } + return newMarkers; + } + + // Remove spans that are empty and don't have a clearWhenEmpty + // option of false. + function clearEmptySpans(spans) { + for (var i = 0; i < spans.length; ++i) { + var span = spans[i]; + if (span.from != null && span.from == span.to && span.marker.clearWhenEmpty !== false) + spans.splice(i--, 1); + } + if (!spans.length) return null; + return spans; + } + + // Used for un/re-doing changes from the history. Combines the + // result of computing the existing spans with the set of spans that + // existed in the history (so that deleting around a span and then + // undoing brings back the span). + function mergeOldSpans(doc, change) { + var old = getOldSpans(doc, change); + var stretched = stretchSpansOverChange(doc, change); + if (!old) return stretched; + if (!stretched) return old; + + for (var i = 0; i < old.length; ++i) { + var oldCur = old[i], stretchCur = stretched[i]; + if (oldCur && stretchCur) { + spans: for (var j = 0; j < stretchCur.length; ++j) { + var span = stretchCur[j]; + for (var k = 0; k < oldCur.length; ++k) + if (oldCur[k].marker == span.marker) continue spans; + oldCur.push(span); + } + } else if (stretchCur) { + old[i] = stretchCur; + } + } + return old; + } + + // Used to 'clip' out readOnly ranges when making a change. + function removeReadOnlyRanges(doc, from, to) { + var markers = null; + doc.iter(from.line, to.line + 1, function(line) { + if (line.markedSpans) for (var i = 0; i < line.markedSpans.length; ++i) { + var mark = line.markedSpans[i].marker; + if (mark.readOnly && (!markers || indexOf(markers, mark) == -1)) + (markers || (markers = [])).push(mark); + } + }); + if (!markers) return null; + var parts = [{from: from, to: to}]; + for (var i = 0; i < markers.length; ++i) { + var mk = markers[i], m = mk.find(0); + for (var j = 0; j < parts.length; ++j) { + var p = parts[j]; + if (cmp(p.to, m.from) < 0 || cmp(p.from, m.to) > 0) continue; + var newParts = [j, 1], dfrom = cmp(p.from, m.from), dto = cmp(p.to, m.to); + if (dfrom < 0 || !mk.inclusiveLeft && !dfrom) + newParts.push({from: p.from, to: m.from}); + if (dto > 0 || !mk.inclusiveRight && !dto) + newParts.push({from: m.to, to: p.to}); + parts.splice.apply(parts, newParts); + j += newParts.length - 1; + } + } + return parts; + } + + // Connect or disconnect spans from a line. + function detachMarkedSpans(line) { + var spans = line.markedSpans; + if (!spans) return; + for (var i = 0; i < spans.length; ++i) + spans[i].marker.detachLine(line); + line.markedSpans = null; + } + function attachMarkedSpans(line, spans) { + if (!spans) return; + for (var i = 0; i < spans.length; ++i) + spans[i].marker.attachLine(line); + line.markedSpans = spans; + } + + // Helpers used when computing which overlapping collapsed span + // counts as the larger one. + function extraLeft(marker) { return marker.inclusiveLeft ? -1 : 0; } + function extraRight(marker) { return marker.inclusiveRight ? 1 : 0; } + + // Returns a number indicating which of two overlapping collapsed + // spans is larger (and thus includes the other). Falls back to + // comparing ids when the spans cover exactly the same range. + function compareCollapsedMarkers(a, b) { + var lenDiff = a.lines.length - b.lines.length; + if (lenDiff != 0) return lenDiff; + var aPos = a.find(), bPos = b.find(); + var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b); + if (fromCmp) return -fromCmp; + var toCmp = cmp(aPos.to, bPos.to) || extraRight(a) - extraRight(b); + if (toCmp) return toCmp; + return b.id - a.id; + } + + // Find out whether a line ends or starts in a collapsed span. If + // so, return the marker for that span. + function collapsedSpanAtSide(line, start) { + var sps = sawCollapsedSpans && line.markedSpans, found; + if (sps) for (var sp, i = 0; i < sps.length; ++i) { + sp = sps[i]; + if (sp.marker.collapsed && (start ? sp.from : sp.to) == null && + (!found || compareCollapsedMarkers(found, sp.marker) < 0)) + found = sp.marker; + } + return found; + } + function collapsedSpanAtStart(line) { return collapsedSpanAtSide(line, true); } + function collapsedSpanAtEnd(line) { return collapsedSpanAtSide(line, false); } + + // Test whether there exists a collapsed span that partially + // overlaps (covers the start or end, but not both) of a new span. + // Such overlap is not allowed. + function conflictingCollapsedRange(doc, lineNo, from, to, marker) { + var line = getLine(doc, lineNo); + var sps = sawCollapsedSpans && line.markedSpans; + if (sps) for (var i = 0; i < sps.length; ++i) { + var sp = sps[i]; + if (!sp.marker.collapsed) continue; + var found = sp.marker.find(0); + var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker); + var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker); + if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) continue; + if (fromCmp <= 0 && (cmp(found.to, from) > 0 || (sp.marker.inclusiveRight && marker.inclusiveLeft)) || + fromCmp >= 0 && (cmp(found.from, to) < 0 || (sp.marker.inclusiveLeft && marker.inclusiveRight))) + return true; + } + } + + // A visual line is a line as drawn on the screen. Folding, for + // example, can cause multiple logical lines to appear on the same + // visual line. This finds the start of the visual line that the + // given line is part of (usually that is the line itself). + function visualLine(line) { + var merged; + while (merged = collapsedSpanAtStart(line)) + line = merged.find(-1, true).line; + return line; + } + + // Returns an array of logical lines that continue the visual line + // started by the argument, or undefined if there are no such lines. + function visualLineContinued(line) { + var merged, lines; + while (merged = collapsedSpanAtEnd(line)) { + line = merged.find(1, true).line; + (lines || (lines = [])).push(line); + } + return lines; + } + + // Get the line number of the start of the visual line that the + // given line number is part of. + function visualLineNo(doc, lineN) { + var line = getLine(doc, lineN), vis = visualLine(line); + if (line == vis) return lineN; + return lineNo(vis); + } + // Get the line number of the start of the next visual line after + // the given line. + function visualLineEndNo(doc, lineN) { + if (lineN > doc.lastLine()) return lineN; + var line = getLine(doc, lineN), merged; + if (!lineIsHidden(doc, line)) return lineN; + while (merged = collapsedSpanAtEnd(line)) + line = merged.find(1, true).line; + return lineNo(line) + 1; + } + + // Compute whether a line is hidden. Lines count as hidden when they + // are part of a visual line that starts with another line, or when + // they are entirely covered by collapsed, non-widget span. + function lineIsHidden(doc, line) { + var sps = sawCollapsedSpans && line.markedSpans; + if (sps) for (var sp, i = 0; i < sps.length; ++i) { + sp = sps[i]; + if (!sp.marker.collapsed) continue; + if (sp.from == null) return true; + if (sp.marker.widgetNode) continue; + if (sp.from == 0 && sp.marker.inclusiveLeft && lineIsHiddenInner(doc, line, sp)) + return true; + } + } + function lineIsHiddenInner(doc, line, span) { + if (span.to == null) { + var end = span.marker.find(1, true); + return lineIsHiddenInner(doc, end.line, getMarkedSpanFor(end.line.markedSpans, span.marker)); + } + if (span.marker.inclusiveRight && span.to == line.text.length) + return true; + for (var sp, i = 0; i < line.markedSpans.length; ++i) { + sp = line.markedSpans[i]; + if (sp.marker.collapsed && !sp.marker.widgetNode && sp.from == span.to && + (sp.to == null || sp.to != span.from) && + (sp.marker.inclusiveLeft || span.marker.inclusiveRight) && + lineIsHiddenInner(doc, line, sp)) return true; + } + } + + // LINE WIDGETS + + // Line widgets are block elements displayed above or below a line. + + var LineWidget = CodeMirror.LineWidget = function(doc, node, options) { + if (options) for (var opt in options) if (options.hasOwnProperty(opt)) + this[opt] = options[opt]; + this.doc = doc; + this.node = node; + }; + eventMixin(LineWidget); + + function adjustScrollWhenAboveVisible(cm, line, diff) { + if (heightAtLine(line) < ((cm.curOp && cm.curOp.scrollTop) || cm.doc.scrollTop)) + addToScrollPos(cm, null, diff); + } + + LineWidget.prototype.clear = function() { + var cm = this.doc.cm, ws = this.line.widgets, line = this.line, no = lineNo(line); + if (no == null || !ws) return; + for (var i = 0; i < ws.length; ++i) if (ws[i] == this) ws.splice(i--, 1); + if (!ws.length) line.widgets = null; + var height = widgetHeight(this); + updateLineHeight(line, Math.max(0, line.height - height)); + if (cm) runInOp(cm, function() { + adjustScrollWhenAboveVisible(cm, line, -height); + regLineChange(cm, no, "widget"); + }); + }; + LineWidget.prototype.changed = function() { + var oldH = this.height, cm = this.doc.cm, line = this.line; + this.height = null; + var diff = widgetHeight(this) - oldH; + if (!diff) return; + updateLineHeight(line, line.height + diff); + if (cm) runInOp(cm, function() { + cm.curOp.forceUpdate = true; + adjustScrollWhenAboveVisible(cm, line, diff); + }); + }; + + function widgetHeight(widget) { + if (widget.height != null) return widget.height; + var cm = widget.doc.cm; + if (!cm) return 0; + if (!contains(document.body, widget.node)) { + var parentStyle = "position: relative;"; + if (widget.coverGutter) + parentStyle += "margin-left: -" + cm.display.gutters.offsetWidth + "px;"; + if (widget.noHScroll) + parentStyle += "width: " + cm.display.wrapper.clientWidth + "px;"; + removeChildrenAndAdd(cm.display.measure, elt("div", [widget.node], null, parentStyle)); + } + return widget.height = widget.node.offsetHeight; + } + + function addLineWidget(doc, handle, node, options) { + var widget = new LineWidget(doc, node, options); + var cm = doc.cm; + if (cm && widget.noHScroll) cm.display.alignWidgets = true; + changeLine(doc, handle, "widget", function(line) { + var widgets = line.widgets || (line.widgets = []); + if (widget.insertAt == null) widgets.push(widget); + else widgets.splice(Math.min(widgets.length - 1, Math.max(0, widget.insertAt)), 0, widget); + widget.line = line; + if (cm && !lineIsHidden(doc, line)) { + var aboveVisible = heightAtLine(line) < doc.scrollTop; + updateLineHeight(line, line.height + widgetHeight(widget)); + if (aboveVisible) addToScrollPos(cm, null, widget.height); + cm.curOp.forceUpdate = true; + } + return true; + }); + return widget; + } + + // LINE DATA STRUCTURE + + // Line objects. These hold state related to a line, including + // highlighting info (the styles array). + var Line = CodeMirror.Line = function(text, markedSpans, estimateHeight) { + this.text = text; + attachMarkedSpans(this, markedSpans); + this.height = estimateHeight ? estimateHeight(this) : 1; + }; + eventMixin(Line); + Line.prototype.lineNo = function() { return lineNo(this); }; + + // Change the content (text, markers) of a line. Automatically + // invalidates cached information and tries to re-estimate the + // line's height. + function updateLine(line, text, markedSpans, estimateHeight) { + line.text = text; + if (line.stateAfter) line.stateAfter = null; + if (line.styles) line.styles = null; + if (line.order != null) line.order = null; + detachMarkedSpans(line); + attachMarkedSpans(line, markedSpans); + var estHeight = estimateHeight ? estimateHeight(line) : 1; + if (estHeight != line.height) updateLineHeight(line, estHeight); + } + + // Detach a line from the document tree and its markers. + function cleanUpLine(line) { + line.parent = null; + detachMarkedSpans(line); + } + + function extractLineClasses(type, output) { + if (type) for (;;) { + var lineClass = type.match(/(?:^|\s+)line-(background-)?(\S+)/); + if (!lineClass) break; + type = type.slice(0, lineClass.index) + type.slice(lineClass.index + lineClass[0].length); + var prop = lineClass[1] ? "bgClass" : "textClass"; + if (output[prop] == null) + output[prop] = lineClass[2]; + else if (!(new RegExp("(?:^|\s)" + lineClass[2] + "(?:$|\s)")).test(output[prop])) + output[prop] += " " + lineClass[2]; + } + return type; + } + + function callBlankLine(mode, state) { + if (mode.blankLine) return mode.blankLine(state); + if (!mode.innerMode) return; + var inner = CodeMirror.innerMode(mode, state); + if (inner.mode.blankLine) return inner.mode.blankLine(inner.state); + } + + function readToken(mode, stream, state, inner) { + for (var i = 0; i < 10; i++) { + if (inner) inner[0] = CodeMirror.innerMode(mode, state).mode; + var style = mode.token(stream, state); + if (stream.pos > stream.start) return style; + } + throw new Error("Mode " + mode.name + " failed to advance stream."); + } + + // Utility for getTokenAt and getLineTokens + function takeToken(cm, pos, precise, asArray) { + function getObj(copy) { + return {start: stream.start, end: stream.pos, + string: stream.current(), + type: style || null, + state: copy ? copyState(doc.mode, state) : state}; + } + + var doc = cm.doc, mode = doc.mode, style; + pos = clipPos(doc, pos); + var line = getLine(doc, pos.line), state = getStateBefore(cm, pos.line, precise); + var stream = new StringStream(line.text, cm.options.tabSize), tokens; + if (asArray) tokens = []; + while ((asArray || stream.pos < pos.ch) && !stream.eol()) { + stream.start = stream.pos; + style = readToken(mode, stream, state); + if (asArray) tokens.push(getObj(true)); + } + return asArray ? tokens : getObj(); + } + + // Run the given mode's parser over a line, calling f for each token. + function runMode(cm, text, mode, state, f, lineClasses, forceToEnd) { + var flattenSpans = mode.flattenSpans; + if (flattenSpans == null) flattenSpans = cm.options.flattenSpans; + var curStart = 0, curStyle = null; + var stream = new StringStream(text, cm.options.tabSize), style; + var inner = cm.options.addModeClass && [null]; + if (text == "") extractLineClasses(callBlankLine(mode, state), lineClasses); + while (!stream.eol()) { + if (stream.pos > cm.options.maxHighlightLength) { + flattenSpans = false; + if (forceToEnd) processLine(cm, text, state, stream.pos); + stream.pos = text.length; + style = null; + } else { + style = extractLineClasses(readToken(mode, stream, state, inner), lineClasses); + } + if (inner) { + var mName = inner[0].name; + if (mName) style = "m-" + (style ? mName + " " + style : mName); + } + if (!flattenSpans || curStyle != style) { + while (curStart < stream.start) { + curStart = Math.min(stream.start, curStart + 50000); + f(curStart, curStyle); + } + curStyle = style; + } + stream.start = stream.pos; + } + while (curStart < stream.pos) { + // Webkit seems to refuse to render text nodes longer than 57444 characters + var pos = Math.min(stream.pos, curStart + 50000); + f(pos, curStyle); + curStart = pos; + } + } + + // Compute a style array (an array starting with a mode generation + // -- for invalidation -- followed by pairs of end positions and + // style strings), which is used to highlight the tokens on the + // line. + function highlightLine(cm, line, state, forceToEnd) { + // A styles array always starts with a number identifying the + // mode/overlays that it is based on (for easy invalidation). + var st = [cm.state.modeGen], lineClasses = {}; + // Compute the base array of styles + runMode(cm, line.text, cm.doc.mode, state, function(end, style) { + st.push(end, style); + }, lineClasses, forceToEnd); + + // Run overlays, adjust style array. + for (var o = 0; o < cm.state.overlays.length; ++o) { + var overlay = cm.state.overlays[o], i = 1, at = 0; + runMode(cm, line.text, overlay.mode, true, function(end, style) { + var start = i; + // Ensure there's a token end at the current position, and that i points at it + while (at < end) { + var i_end = st[i]; + if (i_end > end) + st.splice(i, 1, end, st[i+1], i_end); + i += 2; + at = Math.min(end, i_end); + } + if (!style) return; + if (overlay.opaque) { + st.splice(start, i - start, end, "cm-overlay " + style); + i = start + 2; + } else { + for (; start < i; start += 2) { + var cur = st[start+1]; + st[start+1] = (cur ? cur + " " : "") + "cm-overlay " + style; + } + } + }, lineClasses); + } + + return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}; + } + + function getLineStyles(cm, line, updateFrontier) { + if (!line.styles || line.styles[0] != cm.state.modeGen) { + var result = highlightLine(cm, line, line.stateAfter = getStateBefore(cm, lineNo(line))); + line.styles = result.styles; + if (result.classes) line.styleClasses = result.classes; + else if (line.styleClasses) line.styleClasses = null; + if (updateFrontier === cm.doc.frontier) cm.doc.frontier++; + } + return line.styles; + } + + // Lightweight form of highlight -- proceed over this line and + // update state, but don't save a style array. Used for lines that + // aren't currently visible. + function processLine(cm, text, state, startAt) { + var mode = cm.doc.mode; + var stream = new StringStream(text, cm.options.tabSize); + stream.start = stream.pos = startAt || 0; + if (text == "") callBlankLine(mode, state); + while (!stream.eol() && stream.pos <= cm.options.maxHighlightLength) { + readToken(mode, stream, state); + stream.start = stream.pos; + } + } + + // Convert a style as returned by a mode (either null, or a string + // containing one or more styles) to a CSS style. This is cached, + // and also looks for line-wide styles. + var styleToClassCache = {}, styleToClassCacheWithMode = {}; + function interpretTokenStyle(style, options) { + if (!style || /^\s*$/.test(style)) return null; + var cache = options.addModeClass ? styleToClassCacheWithMode : styleToClassCache; + return cache[style] || + (cache[style] = style.replace(/\S+/g, "cm-$&")); + } + + // Render the DOM representation of the text of a line. Also builds + // up a 'line map', which points at the DOM nodes that represent + // specific stretches of text, and is used by the measuring code. + // The returned object contains the DOM node, this map, and + // information about line-wide styles that were set by the mode. + function buildLineContent(cm, lineView) { + // The padding-right forces the element to have a 'border', which + // is needed on Webkit to be able to get line-level bounding + // rectangles for it (in measureChar). + var content = elt("span", null, null, webkit ? "padding-right: .1px" : null); + var builder = {pre: elt("pre", [content]), content: content, + col: 0, pos: 0, cm: cm, + splitSpaces: (ie || webkit) && cm.getOption("lineWrapping")}; + lineView.measure = {}; + + // Iterate over the logical lines that make up this visual line. + for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) { + var line = i ? lineView.rest[i - 1] : lineView.line, order; + builder.pos = 0; + builder.addToken = buildToken; + // Optionally wire in some hacks into the token-rendering + // algorithm, to deal with browser quirks. + if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line))) + builder.addToken = buildTokenBadBidi(builder.addToken, order); + builder.map = []; + var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line); + insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate)); + if (line.styleClasses) { + if (line.styleClasses.bgClass) + builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || ""); + if (line.styleClasses.textClass) + builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || ""); + } + + // Ensure at least a single node is present, for measuring. + if (builder.map.length == 0) + builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); + + // Store the map and a cache object for the current logical line + if (i == 0) { + lineView.measure.map = builder.map; + lineView.measure.cache = {}; + } else { + (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map); + (lineView.measure.caches || (lineView.measure.caches = [])).push({}); + } + } + + // See issue #2901 + if (webkit && /\bcm-tab\b/.test(builder.content.lastChild.className)) + builder.content.className = "cm-tab-wrap-hack"; + + signal(cm, "renderLine", cm, lineView.line, builder.pre); + if (builder.pre.className) + builder.textClass = joinClasses(builder.pre.className, builder.textClass || ""); + + return builder; + } + + function defaultSpecialCharPlaceholder(ch) { + var token = elt("span", "\u2022", "cm-invalidchar"); + token.title = "\\u" + ch.charCodeAt(0).toString(16); + token.setAttribute("aria-label", token.title); + return token; + } + + // Build up the DOM representation for a single token, and add it to + // the line map. Takes care to render special characters separately. + function buildToken(builder, text, style, startStyle, endStyle, title, css) { + if (!text) return; + var displayText = builder.splitSpaces ? text.replace(/ {3,}/g, splitSpaces) : text; + var special = builder.cm.state.specialChars, mustWrap = false; + if (!special.test(text)) { + builder.col += text.length; + var content = document.createTextNode(displayText); + builder.map.push(builder.pos, builder.pos + text.length, content); + if (ie && ie_version < 9) mustWrap = true; + builder.pos += text.length; + } else { + var content = document.createDocumentFragment(), pos = 0; + while (true) { + special.lastIndex = pos; + var m = special.exec(text); + var skipped = m ? m.index - pos : text.length - pos; + if (skipped) { + var txt = document.createTextNode(displayText.slice(pos, pos + skipped)); + if (ie && ie_version < 9) content.appendChild(elt("span", [txt])); + else content.appendChild(txt); + builder.map.push(builder.pos, builder.pos + skipped, txt); + builder.col += skipped; + builder.pos += skipped; + } + if (!m) break; + pos += skipped + 1; + if (m[0] == "\t") { + var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize; + var txt = content.appendChild(elt("span", spaceStr(tabWidth), "cm-tab")); + txt.setAttribute("role", "presentation"); + txt.setAttribute("cm-text", "\t"); + builder.col += tabWidth; + } else { + var txt = builder.cm.options.specialCharPlaceholder(m[0]); + txt.setAttribute("cm-text", m[0]); + if (ie && ie_version < 9) content.appendChild(elt("span", [txt])); + else content.appendChild(txt); + builder.col += 1; + } + builder.map.push(builder.pos, builder.pos + 1, txt); + builder.pos++; + } + } + if (style || startStyle || endStyle || mustWrap || css) { + var fullStyle = style || ""; + if (startStyle) fullStyle += startStyle; + if (endStyle) fullStyle += endStyle; + var token = elt("span", [content], fullStyle, css); + if (title) token.title = title; + return builder.content.appendChild(token); + } + builder.content.appendChild(content); + } + + function splitSpaces(old) { + var out = " "; + for (var i = 0; i < old.length - 2; ++i) out += i % 2 ? " " : "\u00a0"; + out += " "; + return out; + } + + // Work around nonsense dimensions being reported for stretches of + // right-to-left text. + function buildTokenBadBidi(inner, order) { + return function(builder, text, style, startStyle, endStyle, title, css) { + style = style ? style + " cm-force-border" : "cm-force-border"; + var start = builder.pos, end = start + text.length; + for (;;) { + // Find the part that overlaps with the start of this text + for (var i = 0; i < order.length; i++) { + var part = order[i]; + if (part.to > start && part.from <= start) break; + } + if (part.to >= end) return inner(builder, text, style, startStyle, endStyle, title, css); + inner(builder, text.slice(0, part.to - start), style, startStyle, null, title, css); + startStyle = null; + text = text.slice(part.to - start); + start = part.to; + } + }; + } + + function buildCollapsedSpan(builder, size, marker, ignoreWidget) { + var widget = !ignoreWidget && marker.widgetNode; + if (widget) builder.map.push(builder.pos, builder.pos + size, widget); + if (!ignoreWidget && builder.cm.display.input.needsContentAttribute) { + if (!widget) + widget = builder.content.appendChild(document.createElement("span")); + widget.setAttribute("cm-marker", marker.id); + } + if (widget) { + builder.cm.display.input.setUneditable(widget); + builder.content.appendChild(widget); + } + builder.pos += size; + } + + // Outputs a number of spans to make up a line, taking highlighting + // and marked text into account. + function insertLineContent(line, builder, styles) { + var spans = line.markedSpans, allText = line.text, at = 0; + if (!spans) { + for (var i = 1; i < styles.length; i+=2) + builder.addToken(builder, allText.slice(at, at = styles[i]), interpretTokenStyle(styles[i+1], builder.cm.options)); + return; + } + + var len = allText.length, pos = 0, i = 1, text = "", style, css; + var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed; + for (;;) { + if (nextChange == pos) { // Update current marker set + spanStyle = spanEndStyle = spanStartStyle = title = css = ""; + collapsed = null; nextChange = Infinity; + var foundBookmarks = []; + for (var j = 0; j < spans.length; ++j) { + var sp = spans[j], m = sp.marker; + if (m.type == "bookmark" && sp.from == pos && m.widgetNode) { + foundBookmarks.push(m); + } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) { + if (sp.to != null && sp.to != pos && nextChange > sp.to) { + nextChange = sp.to; + spanEndStyle = ""; + } + if (m.className) spanStyle += " " + m.className; + if (m.css) css = m.css; + if (m.startStyle && sp.from == pos) spanStartStyle += " " + m.startStyle; + if (m.endStyle && sp.to == nextChange) spanEndStyle += " " + m.endStyle; + if (m.title && !title) title = m.title; + if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0)) + collapsed = sp; + } else if (sp.from > pos && nextChange > sp.from) { + nextChange = sp.from; + } + } + if (collapsed && (collapsed.from || 0) == pos) { + buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos, + collapsed.marker, collapsed.from == null); + if (collapsed.to == null) return; + if (collapsed.to == pos) collapsed = false; + } + if (!collapsed && foundBookmarks.length) for (var j = 0; j < foundBookmarks.length; ++j) + buildCollapsedSpan(builder, 0, foundBookmarks[j]); + } + if (pos >= len) break; + + var upto = Math.min(len, nextChange); + while (true) { + if (text) { + var end = pos + text.length; + if (!collapsed) { + var tokenText = end > upto ? text.slice(0, upto - pos) : text; + builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle, + spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : "", title, css); + } + if (end >= upto) {text = text.slice(upto - pos); pos = upto; break;} + pos = end; + spanStartStyle = ""; + } + text = allText.slice(at, at = styles[i++]); + style = interpretTokenStyle(styles[i++], builder.cm.options); + } + } + } + + // DOCUMENT DATA STRUCTURE + + // By default, updates that start and end at the beginning of a line + // are treated specially, in order to make the association of line + // widgets and marker elements with the text behave more intuitive. + function isWholeLineUpdate(doc, change) { + return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == "" && + (!doc.cm || doc.cm.options.wholeLineUpdateBefore); + } + + // Perform a change on the document data structure. + function updateDoc(doc, change, markedSpans, estimateHeight) { + function spansFor(n) {return markedSpans ? markedSpans[n] : null;} + function update(line, text, spans) { + updateLine(line, text, spans, estimateHeight); + signalLater(line, "change", line, change); + } + function linesFor(start, end) { + for (var i = start, result = []; i < end; ++i) + result.push(new Line(text[i], spansFor(i), estimateHeight)); + return result; + } + + var from = change.from, to = change.to, text = change.text; + var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line); + var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line; + + // Adjust the line structure + if (change.full) { + doc.insert(0, linesFor(0, text.length)); + doc.remove(text.length, doc.size - text.length); + } else if (isWholeLineUpdate(doc, change)) { + // This is a whole-line replace. Treated specially to make + // sure line objects move the way they are supposed to. + var added = linesFor(0, text.length - 1); + update(lastLine, lastLine.text, lastSpans); + if (nlines) doc.remove(from.line, nlines); + if (added.length) doc.insert(from.line, added); + } else if (firstLine == lastLine) { + if (text.length == 1) { + update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans); + } else { + var added = linesFor(1, text.length - 1); + added.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight)); + update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0)); + doc.insert(from.line + 1, added); + } + } else if (text.length == 1) { + update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0)); + doc.remove(from.line + 1, nlines); + } else { + update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0)); + update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans); + var added = linesFor(1, text.length - 1); + if (nlines > 1) doc.remove(from.line + 1, nlines - 1); + doc.insert(from.line + 1, added); + } + + signalLater(doc, "change", doc, change); + } + + // The document is represented as a BTree consisting of leaves, with + // chunk of lines in them, and branches, with up to ten leaves or + // other branch nodes below them. The top node is always a branch + // node, and is the document object itself (meaning it has + // additional methods and properties). + // + // All nodes have parent links. The tree is used both to go from + // line numbers to line objects, and to go from objects to numbers. + // It also indexes by height, and is used to convert between height + // and line object, and to find the total height of the document. + // + // See also http://marijnhaverbeke.nl/blog/codemirror-line-tree.html + + function LeafChunk(lines) { + this.lines = lines; + this.parent = null; + for (var i = 0, height = 0; i < lines.length; ++i) { + lines[i].parent = this; + height += lines[i].height; + } + this.height = height; + } + + LeafChunk.prototype = { + chunkSize: function() { return this.lines.length; }, + // Remove the n lines at offset 'at'. + removeInner: function(at, n) { + for (var i = at, e = at + n; i < e; ++i) { + var line = this.lines[i]; + this.height -= line.height; + cleanUpLine(line); + signalLater(line, "delete"); + } + this.lines.splice(at, n); + }, + // Helper used to collapse a small branch into a single leaf. + collapse: function(lines) { + lines.push.apply(lines, this.lines); + }, + // Insert the given array of lines at offset 'at', count them as + // having the given height. + insertInner: function(at, lines, height) { + this.height += height; + this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at)); + for (var i = 0; i < lines.length; ++i) lines[i].parent = this; + }, + // Used to iterate over a part of the tree. + iterN: function(at, n, op) { + for (var e = at + n; at < e; ++at) + if (op(this.lines[at])) return true; + } + }; + + function BranchChunk(children) { + this.children = children; + var size = 0, height = 0; + for (var i = 0; i < children.length; ++i) { + var ch = children[i]; + size += ch.chunkSize(); height += ch.height; + ch.parent = this; + } + this.size = size; + this.height = height; + this.parent = null; + } + + BranchChunk.prototype = { + chunkSize: function() { return this.size; }, + removeInner: function(at, n) { + this.size -= n; + for (var i = 0; i < this.children.length; ++i) { + var child = this.children[i], sz = child.chunkSize(); + if (at < sz) { + var rm = Math.min(n, sz - at), oldHeight = child.height; + child.removeInner(at, rm); + this.height -= oldHeight - child.height; + if (sz == rm) { this.children.splice(i--, 1); child.parent = null; } + if ((n -= rm) == 0) break; + at = 0; + } else at -= sz; + } + // If the result is smaller than 25 lines, ensure that it is a + // single leaf node. + if (this.size - n < 25 && + (this.children.length > 1 || !(this.children[0] instanceof LeafChunk))) { + var lines = []; + this.collapse(lines); + this.children = [new LeafChunk(lines)]; + this.children[0].parent = this; + } + }, + collapse: function(lines) { + for (var i = 0; i < this.children.length; ++i) this.children[i].collapse(lines); + }, + insertInner: function(at, lines, height) { + this.size += lines.length; + this.height += height; + for (var i = 0; i < this.children.length; ++i) { + var child = this.children[i], sz = child.chunkSize(); + if (at <= sz) { + child.insertInner(at, lines, height); + if (child.lines && child.lines.length > 50) { + while (child.lines.length > 50) { + var spilled = child.lines.splice(child.lines.length - 25, 25); + var newleaf = new LeafChunk(spilled); + child.height -= newleaf.height; + this.children.splice(i + 1, 0, newleaf); + newleaf.parent = this; + } + this.maybeSpill(); + } + break; + } + at -= sz; + } + }, + // When a node has grown, check whether it should be split. + maybeSpill: function() { + if (this.children.length <= 10) return; + var me = this; + do { + var spilled = me.children.splice(me.children.length - 5, 5); + var sibling = new BranchChunk(spilled); + if (!me.parent) { // Become the parent node + var copy = new BranchChunk(me.children); + copy.parent = me; + me.children = [copy, sibling]; + me = copy; + } else { + me.size -= sibling.size; + me.height -= sibling.height; + var myIndex = indexOf(me.parent.children, me); + me.parent.children.splice(myIndex + 1, 0, sibling); + } + sibling.parent = me.parent; + } while (me.children.length > 10); + me.parent.maybeSpill(); + }, + iterN: function(at, n, op) { + for (var i = 0; i < this.children.length; ++i) { + var child = this.children[i], sz = child.chunkSize(); + if (at < sz) { + var used = Math.min(n, sz - at); + if (child.iterN(at, used, op)) return true; + if ((n -= used) == 0) break; + at = 0; + } else at -= sz; + } + } + }; + + var nextDocId = 0; + var Doc = CodeMirror.Doc = function(text, mode, firstLine) { + if (!(this instanceof Doc)) return new Doc(text, mode, firstLine); + if (firstLine == null) firstLine = 0; + + BranchChunk.call(this, [new LeafChunk([new Line("", null)])]); + this.first = firstLine; + this.scrollTop = this.scrollLeft = 0; + this.cantEdit = false; + this.cleanGeneration = 1; + this.frontier = firstLine; + var start = Pos(firstLine, 0); + this.sel = simpleSelection(start); + this.history = new History(null); + this.id = ++nextDocId; + this.modeOption = mode; + + if (typeof text == "string") text = splitLines(text); + updateDoc(this, {from: start, to: start, text: text}); + setSelection(this, simpleSelection(start), sel_dontScroll); + }; + + Doc.prototype = createObj(BranchChunk.prototype, { + constructor: Doc, + // Iterate over the document. Supports two forms -- with only one + // argument, it calls that for each line in the document. With + // three, it iterates over the range given by the first two (with + // the second being non-inclusive). + iter: function(from, to, op) { + if (op) this.iterN(from - this.first, to - from, op); + else this.iterN(this.first, this.first + this.size, from); + }, + + // Non-public interface for adding and removing lines. + insert: function(at, lines) { + var height = 0; + for (var i = 0; i < lines.length; ++i) height += lines[i].height; + this.insertInner(at - this.first, lines, height); + }, + remove: function(at, n) { this.removeInner(at - this.first, n); }, + + // From here, the methods are part of the public interface. Most + // are also available from CodeMirror (editor) instances. + + getValue: function(lineSep) { + var lines = getLines(this, this.first, this.first + this.size); + if (lineSep === false) return lines; + return lines.join(lineSep || "\n"); + }, + setValue: docMethodOp(function(code) { + var top = Pos(this.first, 0), last = this.first + this.size - 1; + makeChange(this, {from: top, to: Pos(last, getLine(this, last).text.length), + text: splitLines(code), origin: "setValue", full: true}, true); + setSelection(this, simpleSelection(top)); + }), + replaceRange: function(code, from, to, origin) { + from = clipPos(this, from); + to = to ? clipPos(this, to) : from; + replaceRange(this, code, from, to, origin); + }, + getRange: function(from, to, lineSep) { + var lines = getBetween(this, clipPos(this, from), clipPos(this, to)); + if (lineSep === false) return lines; + return lines.join(lineSep || "\n"); + }, + + getLine: function(line) {var l = this.getLineHandle(line); return l && l.text;}, + + getLineHandle: function(line) {if (isLine(this, line)) return getLine(this, line);}, + getLineNumber: function(line) {return lineNo(line);}, + + getLineHandleVisualStart: function(line) { + if (typeof line == "number") line = getLine(this, line); + return visualLine(line); + }, + + lineCount: function() {return this.size;}, + firstLine: function() {return this.first;}, + lastLine: function() {return this.first + this.size - 1;}, + + clipPos: function(pos) {return clipPos(this, pos);}, + + getCursor: function(start) { + var range = this.sel.primary(), pos; + if (start == null || start == "head") pos = range.head; + else if (start == "anchor") pos = range.anchor; + else if (start == "end" || start == "to" || start === false) pos = range.to(); + else pos = range.from(); + return pos; + }, + listSelections: function() { return this.sel.ranges; }, + somethingSelected: function() {return this.sel.somethingSelected();}, + + setCursor: docMethodOp(function(line, ch, options) { + setSimpleSelection(this, clipPos(this, typeof line == "number" ? Pos(line, ch || 0) : line), null, options); + }), + setSelection: docMethodOp(function(anchor, head, options) { + setSimpleSelection(this, clipPos(this, anchor), clipPos(this, head || anchor), options); + }), + extendSelection: docMethodOp(function(head, other, options) { + extendSelection(this, clipPos(this, head), other && clipPos(this, other), options); + }), + extendSelections: docMethodOp(function(heads, options) { + extendSelections(this, clipPosArray(this, heads, options)); + }), + extendSelectionsBy: docMethodOp(function(f, options) { + extendSelections(this, map(this.sel.ranges, f), options); + }), + setSelections: docMethodOp(function(ranges, primary, options) { + if (!ranges.length) return; + for (var i = 0, out = []; i < ranges.length; i++) + out[i] = new Range(clipPos(this, ranges[i].anchor), + clipPos(this, ranges[i].head)); + if (primary == null) primary = Math.min(ranges.length - 1, this.sel.primIndex); + setSelection(this, normalizeSelection(out, primary), options); + }), + addSelection: docMethodOp(function(anchor, head, options) { + var ranges = this.sel.ranges.slice(0); + ranges.push(new Range(clipPos(this, anchor), clipPos(this, head || anchor))); + setSelection(this, normalizeSelection(ranges, ranges.length - 1), options); + }), + + getSelection: function(lineSep) { + var ranges = this.sel.ranges, lines; + for (var i = 0; i < ranges.length; i++) { + var sel = getBetween(this, ranges[i].from(), ranges[i].to()); + lines = lines ? lines.concat(sel) : sel; + } + if (lineSep === false) return lines; + else return lines.join(lineSep || "\n"); + }, + getSelections: function(lineSep) { + var parts = [], ranges = this.sel.ranges; + for (var i = 0; i < ranges.length; i++) { + var sel = getBetween(this, ranges[i].from(), ranges[i].to()); + if (lineSep !== false) sel = sel.join(lineSep || "\n"); + parts[i] = sel; + } + return parts; + }, + replaceSelection: function(code, collapse, origin) { + var dup = []; + for (var i = 0; i < this.sel.ranges.length; i++) + dup[i] = code; + this.replaceSelections(dup, collapse, origin || "+input"); + }, + replaceSelections: docMethodOp(function(code, collapse, origin) { + var changes = [], sel = this.sel; + for (var i = 0; i < sel.ranges.length; i++) { + var range = sel.ranges[i]; + changes[i] = {from: range.from(), to: range.to(), text: splitLines(code[i]), origin: origin}; + } + var newSel = collapse && collapse != "end" && computeReplacedSel(this, changes, collapse); + for (var i = changes.length - 1; i >= 0; i--) + makeChange(this, changes[i]); + if (newSel) setSelectionReplaceHistory(this, newSel); + else if (this.cm) ensureCursorVisible(this.cm); + }), + undo: docMethodOp(function() {makeChangeFromHistory(this, "undo");}), + redo: docMethodOp(function() {makeChangeFromHistory(this, "redo");}), + undoSelection: docMethodOp(function() {makeChangeFromHistory(this, "undo", true);}), + redoSelection: docMethodOp(function() {makeChangeFromHistory(this, "redo", true);}), + + setExtending: function(val) {this.extend = val;}, + getExtending: function() {return this.extend;}, + + historySize: function() { + var hist = this.history, done = 0, undone = 0; + for (var i = 0; i < hist.done.length; i++) if (!hist.done[i].ranges) ++done; + for (var i = 0; i < hist.undone.length; i++) if (!hist.undone[i].ranges) ++undone; + return {undo: done, redo: undone}; + }, + clearHistory: function() {this.history = new History(this.history.maxGeneration);}, + + markClean: function() { + this.cleanGeneration = this.changeGeneration(true); + }, + changeGeneration: function(forceSplit) { + if (forceSplit) + this.history.lastOp = this.history.lastSelOp = this.history.lastOrigin = null; + return this.history.generation; + }, + isClean: function (gen) { + return this.history.generation == (gen || this.cleanGeneration); + }, + + getHistory: function() { + return {done: copyHistoryArray(this.history.done), + undone: copyHistoryArray(this.history.undone)}; + }, + setHistory: function(histData) { + var hist = this.history = new History(this.history.maxGeneration); + hist.done = copyHistoryArray(histData.done.slice(0), null, true); + hist.undone = copyHistoryArray(histData.undone.slice(0), null, true); + }, + + addLineClass: docMethodOp(function(handle, where, cls) { + return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function(line) { + var prop = where == "text" ? "textClass" + : where == "background" ? "bgClass" + : where == "gutter" ? "gutterClass" : "wrapClass"; + if (!line[prop]) line[prop] = cls; + else if (classTest(cls).test(line[prop])) return false; + else line[prop] += " " + cls; + return true; + }); + }), + removeLineClass: docMethodOp(function(handle, where, cls) { + return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function(line) { + var prop = where == "text" ? "textClass" + : where == "background" ? "bgClass" + : where == "gutter" ? "gutterClass" : "wrapClass"; + var cur = line[prop]; + if (!cur) return false; + else if (cls == null) line[prop] = null; + else { + var found = cur.match(classTest(cls)); + if (!found) return false; + var end = found.index + found[0].length; + line[prop] = cur.slice(0, found.index) + (!found.index || end == cur.length ? "" : " ") + cur.slice(end) || null; + } + return true; + }); + }), + + addLineWidget: docMethodOp(function(handle, node, options) { + return addLineWidget(this, handle, node, options); + }), + removeLineWidget: function(widget) { widget.clear(); }, + + markText: function(from, to, options) { + return markText(this, clipPos(this, from), clipPos(this, to), options, "range"); + }, + setBookmark: function(pos, options) { + var realOpts = {replacedWith: options && (options.nodeType == null ? options.widget : options), + insertLeft: options && options.insertLeft, + clearWhenEmpty: false, shared: options && options.shared, + handleMouseEvents: options && options.handleMouseEvents}; + pos = clipPos(this, pos); + return markText(this, pos, pos, realOpts, "bookmark"); + }, + findMarksAt: function(pos) { + pos = clipPos(this, pos); + var markers = [], spans = getLine(this, pos.line).markedSpans; + if (spans) for (var i = 0; i < spans.length; ++i) { + var span = spans[i]; + if ((span.from == null || span.from <= pos.ch) && + (span.to == null || span.to >= pos.ch)) + markers.push(span.marker.parent || span.marker); + } + return markers; + }, + findMarks: function(from, to, filter) { + from = clipPos(this, from); to = clipPos(this, to); + var found = [], lineNo = from.line; + this.iter(from.line, to.line + 1, function(line) { + var spans = line.markedSpans; + if (spans) for (var i = 0; i < spans.length; i++) { + var span = spans[i]; + if (!(lineNo == from.line && from.ch > span.to || + span.from == null && lineNo != from.line|| + lineNo == to.line && span.from > to.ch) && + (!filter || filter(span.marker))) + found.push(span.marker.parent || span.marker); + } + ++lineNo; + }); + return found; + }, + getAllMarks: function() { + var markers = []; + this.iter(function(line) { + var sps = line.markedSpans; + if (sps) for (var i = 0; i < sps.length; ++i) + if (sps[i].from != null) markers.push(sps[i].marker); + }); + return markers; + }, + + posFromIndex: function(off) { + var ch, lineNo = this.first; + this.iter(function(line) { + var sz = line.text.length + 1; + if (sz > off) { ch = off; return true; } + off -= sz; + ++lineNo; + }); + return clipPos(this, Pos(lineNo, ch)); + }, + indexFromPos: function (coords) { + coords = clipPos(this, coords); + var index = coords.ch; + if (coords.line < this.first || coords.ch < 0) return 0; + this.iter(this.first, coords.line, function (line) { + index += line.text.length + 1; + }); + return index; + }, + + copy: function(copyHistory) { + var doc = new Doc(getLines(this, this.first, this.first + this.size), this.modeOption, this.first); + doc.scrollTop = this.scrollTop; doc.scrollLeft = this.scrollLeft; + doc.sel = this.sel; + doc.extend = false; + if (copyHistory) { + doc.history.undoDepth = this.history.undoDepth; + doc.setHistory(this.getHistory()); + } + return doc; + }, + + linkedDoc: function(options) { + if (!options) options = {}; + var from = this.first, to = this.first + this.size; + if (options.from != null && options.from > from) from = options.from; + if (options.to != null && options.to < to) to = options.to; + var copy = new Doc(getLines(this, from, to), options.mode || this.modeOption, from); + if (options.sharedHist) copy.history = this.history; + (this.linked || (this.linked = [])).push({doc: copy, sharedHist: options.sharedHist}); + copy.linked = [{doc: this, isParent: true, sharedHist: options.sharedHist}]; + copySharedMarkers(copy, findSharedMarkers(this)); + return copy; + }, + unlinkDoc: function(other) { + if (other instanceof CodeMirror) other = other.doc; + if (this.linked) for (var i = 0; i < this.linked.length; ++i) { + var link = this.linked[i]; + if (link.doc != other) continue; + this.linked.splice(i, 1); + other.unlinkDoc(this); + detachSharedMarkers(findSharedMarkers(this)); + break; + } + // If the histories were shared, split them again + if (other.history == this.history) { + var splitIds = [other.id]; + linkedDocs(other, function(doc) {splitIds.push(doc.id);}, true); + other.history = new History(null); + other.history.done = copyHistoryArray(this.history.done, splitIds); + other.history.undone = copyHistoryArray(this.history.undone, splitIds); + } + }, + iterLinkedDocs: function(f) {linkedDocs(this, f);}, + + getMode: function() {return this.mode;}, + getEditor: function() {return this.cm;} + }); + + // Public alias. + Doc.prototype.eachLine = Doc.prototype.iter; + + // Set up methods on CodeMirror's prototype to redirect to the editor's document. + var dontDelegate = "iter insert remove copy getEditor".split(" "); + for (var prop in Doc.prototype) if (Doc.prototype.hasOwnProperty(prop) && indexOf(dontDelegate, prop) < 0) + CodeMirror.prototype[prop] = (function(method) { + return function() {return method.apply(this.doc, arguments);}; + })(Doc.prototype[prop]); + + eventMixin(Doc); + + // Call f for all linked documents. + function linkedDocs(doc, f, sharedHistOnly) { + function propagate(doc, skip, sharedHist) { + if (doc.linked) for (var i = 0; i < doc.linked.length; ++i) { + var rel = doc.linked[i]; + if (rel.doc == skip) continue; + var shared = sharedHist && rel.sharedHist; + if (sharedHistOnly && !shared) continue; + f(rel.doc, shared); + propagate(rel.doc, doc, shared); + } + } + propagate(doc, null, true); + } + + // Attach a document to an editor. + function attachDoc(cm, doc) { + if (doc.cm) throw new Error("This document is already in use."); + cm.doc = doc; + doc.cm = cm; + estimateLineHeights(cm); + loadMode(cm); + if (!cm.options.lineWrapping) findMaxLine(cm); + cm.options.mode = doc.modeOption; + regChange(cm); + } + + // LINE UTILITIES + + // Find the line object corresponding to the given line number. + function getLine(doc, n) { + n -= doc.first; + if (n < 0 || n >= doc.size) throw new Error("There is no line " + (n + doc.first) + " in the document."); + for (var chunk = doc; !chunk.lines;) { + for (var i = 0;; ++i) { + var child = chunk.children[i], sz = child.chunkSize(); + if (n < sz) { chunk = child; break; } + n -= sz; + } + } + return chunk.lines[n]; + } + + // Get the part of a document between two positions, as an array of + // strings. + function getBetween(doc, start, end) { + var out = [], n = start.line; + doc.iter(start.line, end.line + 1, function(line) { + var text = line.text; + if (n == end.line) text = text.slice(0, end.ch); + if (n == start.line) text = text.slice(start.ch); + out.push(text); + ++n; + }); + return out; + } + // Get the lines between from and to, as array of strings. + function getLines(doc, from, to) { + var out = []; + doc.iter(from, to, function(line) { out.push(line.text); }); + return out; + } + + // Update the height of a line, propagating the height change + // upwards to parent nodes. + function updateLineHeight(line, height) { + var diff = height - line.height; + if (diff) for (var n = line; n; n = n.parent) n.height += diff; + } + + // Given a line object, find its line number by walking up through + // its parent links. + function lineNo(line) { + if (line.parent == null) return null; + var cur = line.parent, no = indexOf(cur.lines, line); + for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) { + for (var i = 0;; ++i) { + if (chunk.children[i] == cur) break; + no += chunk.children[i].chunkSize(); + } + } + return no + cur.first; + } + + // Find the line at the given vertical position, using the height + // information in the document tree. + function lineAtHeight(chunk, h) { + var n = chunk.first; + outer: do { + for (var i = 0; i < chunk.children.length; ++i) { + var child = chunk.children[i], ch = child.height; + if (h < ch) { chunk = child; continue outer; } + h -= ch; + n += child.chunkSize(); + } + return n; + } while (!chunk.lines); + for (var i = 0; i < chunk.lines.length; ++i) { + var line = chunk.lines[i], lh = line.height; + if (h < lh) break; + h -= lh; + } + return n + i; + } + + + // Find the height above the given line. + function heightAtLine(lineObj) { + lineObj = visualLine(lineObj); + + var h = 0, chunk = lineObj.parent; + for (var i = 0; i < chunk.lines.length; ++i) { + var line = chunk.lines[i]; + if (line == lineObj) break; + else h += line.height; + } + for (var p = chunk.parent; p; chunk = p, p = chunk.parent) { + for (var i = 0; i < p.children.length; ++i) { + var cur = p.children[i]; + if (cur == chunk) break; + else h += cur.height; + } + } + return h; + } + + // Get the bidi ordering for the given line (and cache it). Returns + // false for lines that are fully left-to-right, and an array of + // BidiSpan objects otherwise. + function getOrder(line) { + var order = line.order; + if (order == null) order = line.order = bidiOrdering(line.text); + return order; + } + + // HISTORY + + function History(startGen) { + // Arrays of change events and selections. Doing something adds an + // event to done and clears undo. Undoing moves events from done + // to undone, redoing moves them in the other direction. + this.done = []; this.undone = []; + this.undoDepth = Infinity; + // Used to track when changes can be merged into a single undo + // event + this.lastModTime = this.lastSelTime = 0; + this.lastOp = this.lastSelOp = null; + this.lastOrigin = this.lastSelOrigin = null; + // Used by the isClean() method + this.generation = this.maxGeneration = startGen || 1; + } + + // Create a history change event from an updateDoc-style change + // object. + function historyChangeFromChange(doc, change) { + var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)}; + attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); + linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true); + return histChange; + } + + // Pop all selection events off the end of a history array. Stop at + // a change event. + function clearSelectionEvents(array) { + while (array.length) { + var last = lst(array); + if (last.ranges) array.pop(); + else break; + } + } + + // Find the top change event in the history. Pop off selection + // events that are in the way. + function lastChangeEvent(hist, force) { + if (force) { + clearSelectionEvents(hist.done); + return lst(hist.done); + } else if (hist.done.length && !lst(hist.done).ranges) { + return lst(hist.done); + } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) { + hist.done.pop(); + return lst(hist.done); + } + } + + // Register a change in the history. Merges changes that are within + // a single operation, ore are close together with an origin that + // allows merging (starting with "+") into a single event. + function addChangeToHistory(doc, change, selAfter, opId) { + var hist = doc.history; + hist.undone.length = 0; + var time = +new Date, cur; + + if ((hist.lastOp == opId || + hist.lastOrigin == change.origin && change.origin && + ((change.origin.charAt(0) == "+" && doc.cm && hist.lastModTime > time - doc.cm.options.historyEventDelay) || + change.origin.charAt(0) == "*")) && + (cur = lastChangeEvent(hist, hist.lastOp == opId))) { + // Merge this change into the last event + var last = lst(cur.changes); + if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) { + // Optimized case for simple insertion -- don't want to add + // new changesets for every character typed + last.to = changeEnd(change); + } else { + // Add new sub-event + cur.changes.push(historyChangeFromChange(doc, change)); + } + } else { + // Can not be merged, start a new event. + var before = lst(hist.done); + if (!before || !before.ranges) + pushSelectionToHistory(doc.sel, hist.done); + cur = {changes: [historyChangeFromChange(doc, change)], + generation: hist.generation}; + hist.done.push(cur); + while (hist.done.length > hist.undoDepth) { + hist.done.shift(); + if (!hist.done[0].ranges) hist.done.shift(); + } + } + hist.done.push(selAfter); + hist.generation = ++hist.maxGeneration; + hist.lastModTime = hist.lastSelTime = time; + hist.lastOp = hist.lastSelOp = opId; + hist.lastOrigin = hist.lastSelOrigin = change.origin; + + if (!last) signal(doc, "historyAdded"); + } + + function selectionEventCanBeMerged(doc, origin, prev, sel) { + var ch = origin.charAt(0); + return ch == "*" || + ch == "+" && + prev.ranges.length == sel.ranges.length && + prev.somethingSelected() == sel.somethingSelected() && + new Date - doc.history.lastSelTime <= (doc.cm ? doc.cm.options.historyEventDelay : 500); + } + + // Called whenever the selection changes, sets the new selection as + // the pending selection in the history, and pushes the old pending + // selection into the 'done' array when it was significantly + // different (in number of selected ranges, emptiness, or time). + function addSelectionToHistory(doc, sel, opId, options) { + var hist = doc.history, origin = options && options.origin; + + // A new event is started when the previous origin does not match + // the current, or the origins don't allow matching. Origins + // starting with * are always merged, those starting with + are + // merged when similar and close together in time. + if (opId == hist.lastSelOp || + (origin && hist.lastSelOrigin == origin && + (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin || + selectionEventCanBeMerged(doc, origin, lst(hist.done), sel)))) + hist.done[hist.done.length - 1] = sel; + else + pushSelectionToHistory(sel, hist.done); + + hist.lastSelTime = +new Date; + hist.lastSelOrigin = origin; + hist.lastSelOp = opId; + if (options && options.clearRedo !== false) + clearSelectionEvents(hist.undone); + } + + function pushSelectionToHistory(sel, dest) { + var top = lst(dest); + if (!(top && top.ranges && top.equals(sel))) + dest.push(sel); + } + + // Used to store marked span information in the history. + function attachLocalSpans(doc, change, from, to) { + var existing = change["spans_" + doc.id], n = 0; + doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) { + if (line.markedSpans) + (existing || (existing = change["spans_" + doc.id] = {}))[n] = line.markedSpans; + ++n; + }); + } + + // When un/re-doing restores text containing marked spans, those + // that have been explicitly cleared should not be restored. + function removeClearedSpans(spans) { + if (!spans) return null; + for (var i = 0, out; i < spans.length; ++i) { + if (spans[i].marker.explicitlyCleared) { if (!out) out = spans.slice(0, i); } + else if (out) out.push(spans[i]); + } + return !out ? spans : out.length ? out : null; + } + + // Retrieve and filter the old marked spans stored in a change event. + function getOldSpans(doc, change) { + var found = change["spans_" + doc.id]; + if (!found) return null; + for (var i = 0, nw = []; i < change.text.length; ++i) + nw.push(removeClearedSpans(found[i])); + return nw; + } + + // Used both to provide a JSON-safe object in .getHistory, and, when + // detaching a document, to split the history in two + function copyHistoryArray(events, newGroup, instantiateSel) { + for (var i = 0, copy = []; i < events.length; ++i) { + var event = events[i]; + if (event.ranges) { + copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event); + continue; + } + var changes = event.changes, newChanges = []; + copy.push({changes: newChanges}); + for (var j = 0; j < changes.length; ++j) { + var change = changes[j], m; + newChanges.push({from: change.from, to: change.to, text: change.text}); + if (newGroup) for (var prop in change) if (m = prop.match(/^spans_(\d+)$/)) { + if (indexOf(newGroup, Number(m[1])) > -1) { + lst(newChanges)[prop] = change[prop]; + delete change[prop]; + } + } + } + } + return copy; + } + + // Rebasing/resetting history to deal with externally-sourced changes + + function rebaseHistSelSingle(pos, from, to, diff) { + if (to < pos.line) { + pos.line += diff; + } else if (from < pos.line) { + pos.line = from; + pos.ch = 0; + } + } + + // Tries to rebase an array of history events given a change in the + // document. If the change touches the same lines as the event, the + // event, and everything 'behind' it, is discarded. If the change is + // before the event, the event's positions are updated. Uses a + // copy-on-write scheme for the positions, to avoid having to + // reallocate them all on every rebase, but also avoid problems with + // shared position objects being unsafely updated. + function rebaseHistArray(array, from, to, diff) { + for (var i = 0; i < array.length; ++i) { + var sub = array[i], ok = true; + if (sub.ranges) { + if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; } + for (var j = 0; j < sub.ranges.length; j++) { + rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff); + rebaseHistSelSingle(sub.ranges[j].head, from, to, diff); + } + continue; + } + for (var j = 0; j < sub.changes.length; ++j) { + var cur = sub.changes[j]; + if (to < cur.from.line) { + cur.from = Pos(cur.from.line + diff, cur.from.ch); + cur.to = Pos(cur.to.line + diff, cur.to.ch); + } else if (from <= cur.to.line) { + ok = false; + break; + } + } + if (!ok) { + array.splice(0, i + 1); + i = 0; + } + } + } + + function rebaseHist(hist, change) { + var from = change.from.line, to = change.to.line, diff = change.text.length - (to - from) - 1; + rebaseHistArray(hist.done, from, to, diff); + rebaseHistArray(hist.undone, from, to, diff); + } + + // EVENT UTILITIES + + // Due to the fact that we still support jurassic IE versions, some + // compatibility wrappers are needed. + + var e_preventDefault = CodeMirror.e_preventDefault = function(e) { + if (e.preventDefault) e.preventDefault(); + else e.returnValue = false; + }; + var e_stopPropagation = CodeMirror.e_stopPropagation = function(e) { + if (e.stopPropagation) e.stopPropagation(); + else e.cancelBubble = true; + }; + function e_defaultPrevented(e) { + return e.defaultPrevented != null ? e.defaultPrevented : e.returnValue == false; + } + var e_stop = CodeMirror.e_stop = function(e) {e_preventDefault(e); e_stopPropagation(e);}; + + function e_target(e) {return e.target || e.srcElement;} + function e_button(e) { + var b = e.which; + if (b == null) { + if (e.button & 1) b = 1; + else if (e.button & 2) b = 3; + else if (e.button & 4) b = 2; + } + if (mac && e.ctrlKey && b == 1) b = 3; + return b; + } + + // EVENT HANDLING + + // Lightweight event framework. on/off also work on DOM nodes, + // registering native DOM handlers. + + var on = CodeMirror.on = function(emitter, type, f) { + if (emitter.addEventListener) + emitter.addEventListener(type, f, false); + else if (emitter.attachEvent) + emitter.attachEvent("on" + type, f); + else { + var map = emitter._handlers || (emitter._handlers = {}); + var arr = map[type] || (map[type] = []); + arr.push(f); + } + }; + + var off = CodeMirror.off = function(emitter, type, f) { + if (emitter.removeEventListener) + emitter.removeEventListener(type, f, false); + else if (emitter.detachEvent) + emitter.detachEvent("on" + type, f); + else { + var arr = emitter._handlers && emitter._handlers[type]; + if (!arr) return; + for (var i = 0; i < arr.length; ++i) + if (arr[i] == f) { arr.splice(i, 1); break; } + } + }; + + var signal = CodeMirror.signal = function(emitter, type /*, values...*/) { + var arr = emitter._handlers && emitter._handlers[type]; + if (!arr) return; + var args = Array.prototype.slice.call(arguments, 2); + for (var i = 0; i < arr.length; ++i) arr[i].apply(null, args); + }; + + var orphanDelayedCallbacks = null; + + // Often, we want to signal events at a point where we are in the + // middle of some work, but don't want the handler to start calling + // other methods on the editor, which might be in an inconsistent + // state or simply not expect any other events to happen. + // signalLater looks whether there are any handlers, and schedules + // them to be executed when the last operation ends, or, if no + // operation is active, when a timeout fires. + function signalLater(emitter, type /*, values...*/) { + var arr = emitter._handlers && emitter._handlers[type]; + if (!arr) return; + var args = Array.prototype.slice.call(arguments, 2), list; + if (operationGroup) { + list = operationGroup.delayedCallbacks; + } else if (orphanDelayedCallbacks) { + list = orphanDelayedCallbacks; + } else { + list = orphanDelayedCallbacks = []; + setTimeout(fireOrphanDelayed, 0); + } + function bnd(f) {return function(){f.apply(null, args);};}; + for (var i = 0; i < arr.length; ++i) + list.push(bnd(arr[i])); + } + + function fireOrphanDelayed() { + var delayed = orphanDelayedCallbacks; + orphanDelayedCallbacks = null; + for (var i = 0; i < delayed.length; ++i) delayed[i](); + } + + // The DOM events that CodeMirror handles can be overridden by + // registering a (non-DOM) handler on the editor for the event name, + // and preventDefault-ing the event in that handler. + function signalDOMEvent(cm, e, override) { + if (typeof e == "string") + e = {type: e, preventDefault: function() { this.defaultPrevented = true; }}; + signal(cm, override || e.type, cm, e); + return e_defaultPrevented(e) || e.codemirrorIgnore; + } + + function signalCursorActivity(cm) { + var arr = cm._handlers && cm._handlers.cursorActivity; + if (!arr) return; + var set = cm.curOp.cursorActivityHandlers || (cm.curOp.cursorActivityHandlers = []); + for (var i = 0; i < arr.length; ++i) if (indexOf(set, arr[i]) == -1) + set.push(arr[i]); + } + + function hasHandler(emitter, type) { + var arr = emitter._handlers && emitter._handlers[type]; + return arr && arr.length > 0; + } + + // Add on and off methods to a constructor's prototype, to make + // registering events on such objects more convenient. + function eventMixin(ctor) { + ctor.prototype.on = function(type, f) {on(this, type, f);}; + ctor.prototype.off = function(type, f) {off(this, type, f);}; + } + + // MISC UTILITIES + + // Number of pixels added to scroller and sizer to hide scrollbar + var scrollerGap = 30; + + // Returned or thrown by various protocols to signal 'I'm not + // handling this'. + var Pass = CodeMirror.Pass = {toString: function(){return "CodeMirror.Pass";}}; + + // Reused option objects for setSelection & friends + var sel_dontScroll = {scroll: false}, sel_mouse = {origin: "*mouse"}, sel_move = {origin: "+move"}; + + function Delayed() {this.id = null;} + Delayed.prototype.set = function(ms, f) { + clearTimeout(this.id); + this.id = setTimeout(f, ms); + }; + + // Counts the column offset in a string, taking tabs into account. + // Used mostly to find indentation. + var countColumn = CodeMirror.countColumn = function(string, end, tabSize, startIndex, startValue) { + if (end == null) { + end = string.search(/[^\s\u00a0]/); + if (end == -1) end = string.length; + } + for (var i = startIndex || 0, n = startValue || 0;;) { + var nextTab = string.indexOf("\t", i); + if (nextTab < 0 || nextTab >= end) + return n + (end - i); + n += nextTab - i; + n += tabSize - (n % tabSize); + i = nextTab + 1; + } + }; + + // The inverse of countColumn -- find the offset that corresponds to + // a particular column. + function findColumn(string, goal, tabSize) { + for (var pos = 0, col = 0;;) { + var nextTab = string.indexOf("\t", pos); + if (nextTab == -1) nextTab = string.length; + var skipped = nextTab - pos; + if (nextTab == string.length || col + skipped >= goal) + return pos + Math.min(skipped, goal - col); + col += nextTab - pos; + col += tabSize - (col % tabSize); + pos = nextTab + 1; + if (col >= goal) return pos; + } + } + + var spaceStrs = [""]; + function spaceStr(n) { + while (spaceStrs.length <= n) + spaceStrs.push(lst(spaceStrs) + " "); + return spaceStrs[n]; + } + + function lst(arr) { return arr[arr.length-1]; } + + var selectInput = function(node) { node.select(); }; + if (ios) // Mobile Safari apparently has a bug where select() is broken. + selectInput = function(node) { node.selectionStart = 0; node.selectionEnd = node.value.length; }; + else if (ie) // Suppress mysterious IE10 errors + selectInput = function(node) { try { node.select(); } catch(_e) {} }; + + function indexOf(array, elt) { + for (var i = 0; i < array.length; ++i) + if (array[i] == elt) return i; + return -1; + } + function map(array, f) { + var out = []; + for (var i = 0; i < array.length; i++) out[i] = f(array[i], i); + return out; + } + + function nothing() {} + + function createObj(base, props) { + var inst; + if (Object.create) { + inst = Object.create(base); + } else { + nothing.prototype = base; + inst = new nothing(); + } + if (props) copyObj(props, inst); + return inst; + }; + + function copyObj(obj, target, overwrite) { + if (!target) target = {}; + for (var prop in obj) + if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop))) + target[prop] = obj[prop]; + return target; + } + + function bind(f) { + var args = Array.prototype.slice.call(arguments, 1); + return function(){return f.apply(null, args);}; + } + + var nonASCIISingleCaseWordChar = /[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/; + var isWordCharBasic = CodeMirror.isWordChar = function(ch) { + return /\w/.test(ch) || ch > "\x80" && + (ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch)); + }; + function isWordChar(ch, helper) { + if (!helper) return isWordCharBasic(ch); + if (helper.source.indexOf("\\w") > -1 && isWordCharBasic(ch)) return true; + return helper.test(ch); + } + + function isEmpty(obj) { + for (var n in obj) if (obj.hasOwnProperty(n) && obj[n]) return false; + return true; + } + + // Extending unicode characters. A series of a non-extending char + + // any number of extending chars is treated as a single unit as far + // as editing and measuring is concerned. This is not fully correct, + // since some scripts/fonts/browsers also treat other configurations + // of code points as a group. + var extendingChars = /[\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]/; + function isExtendingChar(ch) { return ch.charCodeAt(0) >= 768 && extendingChars.test(ch); } + + // DOM UTILITIES + + function elt(tag, content, className, style) { + var e = document.createElement(tag); + if (className) e.className = className; + if (style) e.style.cssText = style; + if (typeof content == "string") e.appendChild(document.createTextNode(content)); + else if (content) for (var i = 0; i < content.length; ++i) e.appendChild(content[i]); + return e; + } + + var range; + if (document.createRange) range = function(node, start, end, endNode) { + var r = document.createRange(); + r.setEnd(endNode || node, end); + r.setStart(node, start); + return r; + }; + else range = function(node, start, end) { + var r = document.body.createTextRange(); + try { r.moveToElementText(node.parentNode); } + catch(e) { return r; } + r.collapse(true); + r.moveEnd("character", end); + r.moveStart("character", start); + return r; + }; + + function removeChildren(e) { + for (var count = e.childNodes.length; count > 0; --count) + e.removeChild(e.firstChild); + return e; + } + + function removeChildrenAndAdd(parent, e) { + return removeChildren(parent).appendChild(e); + } + + var contains = CodeMirror.contains = function(parent, child) { + if (child.nodeType == 3) // Android browser always returns false when child is a textnode + child = child.parentNode; + if (parent.contains) + return parent.contains(child); + do { + if (child.nodeType == 11) child = child.host; + if (child == parent) return true; + } while (child = child.parentNode); + }; + + function activeElt() { return document.activeElement; } + // Older versions of IE throws unspecified error when touching + // document.activeElement in some cases (during loading, in iframe) + if (ie && ie_version < 11) activeElt = function() { + try { return document.activeElement; } + catch(e) { return document.body; } + }; + + function classTest(cls) { return new RegExp("(^|\\s)" + cls + "(?:$|\\s)\\s*"); } + var rmClass = CodeMirror.rmClass = function(node, cls) { + var current = node.className; + var match = classTest(cls).exec(current); + if (match) { + var after = current.slice(match.index + match[0].length); + node.className = current.slice(0, match.index) + (after ? match[1] + after : ""); + } + }; + var addClass = CodeMirror.addClass = function(node, cls) { + var current = node.className; + if (!classTest(cls).test(current)) node.className += (current ? " " : "") + cls; + }; + function joinClasses(a, b) { + var as = a.split(" "); + for (var i = 0; i < as.length; i++) + if (as[i] && !classTest(as[i]).test(b)) b += " " + as[i]; + return b; + } + + // WINDOW-WIDE EVENTS + + // These must be handled carefully, because naively registering a + // handler for each editor will cause the editors to never be + // garbage collected. + + function forEachCodeMirror(f) { + if (!document.body.getElementsByClassName) return; + var byClass = document.body.getElementsByClassName("CodeMirror"); + for (var i = 0; i < byClass.length; i++) { + var cm = byClass[i].CodeMirror; + if (cm) f(cm); + } + } + + var globalsRegistered = false; + function ensureGlobalHandlers() { + if (globalsRegistered) return; + registerGlobalHandlers(); + globalsRegistered = true; + } + function registerGlobalHandlers() { + // When the window resizes, we need to refresh active editors. + var resizeTimer; + on(window, "resize", function() { + if (resizeTimer == null) resizeTimer = setTimeout(function() { + resizeTimer = null; + forEachCodeMirror(onResize); + }, 100); + }); + // When the window loses focus, we want to show the editor as blurred + on(window, "blur", function() { + forEachCodeMirror(onBlur); + }); + } + + // FEATURE DETECTION + + // Detect drag-and-drop + var dragAndDrop = function() { + // There is *some* kind of drag-and-drop support in IE6-8, but I + // couldn't get it to work yet. + if (ie && ie_version < 9) return false; + var div = elt('div'); + return "draggable" in div || "dragDrop" in div; + }(); + + var zwspSupported; + function zeroWidthElement(measure) { + if (zwspSupported == null) { + var test = elt("span", "\u200b"); + removeChildrenAndAdd(measure, elt("span", [test, document.createTextNode("x")])); + if (measure.firstChild.offsetHeight != 0) + zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !(ie && ie_version < 8); + } + var node = zwspSupported ? elt("span", "\u200b") : + elt("span", "\u00a0", null, "display: inline-block; width: 1px; margin-right: -1px"); + node.setAttribute("cm-text", ""); + return node; + } + + // Feature-detect IE's crummy client rect reporting for bidi text + var badBidiRects; + function hasBadBidiRects(measure) { + if (badBidiRects != null) return badBidiRects; + var txt = removeChildrenAndAdd(measure, document.createTextNode("A\u062eA")); + var r0 = range(txt, 0, 1).getBoundingClientRect(); + if (!r0 || r0.left == r0.right) return false; // Safari returns null in some cases (#2780) + var r1 = range(txt, 1, 2).getBoundingClientRect(); + return badBidiRects = (r1.right - r0.right < 3); + } + + // See if "".split is the broken IE version, if so, provide an + // alternative way to split lines. + var splitLines = CodeMirror.splitLines = "\n\nb".split(/\n/).length != 3 ? function(string) { + var pos = 0, result = [], l = string.length; + while (pos <= l) { + var nl = string.indexOf("\n", pos); + if (nl == -1) nl = string.length; + var line = string.slice(pos, string.charAt(nl - 1) == "\r" ? nl - 1 : nl); + var rt = line.indexOf("\r"); + if (rt != -1) { + result.push(line.slice(0, rt)); + pos += rt + 1; + } else { + result.push(line); + pos = nl + 1; + } + } + return result; + } : function(string){return string.split(/\r\n?|\n/);}; + + var hasSelection = window.getSelection ? function(te) { + try { return te.selectionStart != te.selectionEnd; } + catch(e) { return false; } + } : function(te) { + try {var range = te.ownerDocument.selection.createRange();} + catch(e) {} + if (!range || range.parentElement() != te) return false; + return range.compareEndPoints("StartToEnd", range) != 0; + }; + + var hasCopyEvent = (function() { + var e = elt("div"); + if ("oncopy" in e) return true; + e.setAttribute("oncopy", "return;"); + return typeof e.oncopy == "function"; + })(); + + var badZoomedRects = null; + function hasBadZoomedRects(measure) { + if (badZoomedRects != null) return badZoomedRects; + var node = removeChildrenAndAdd(measure, elt("span", "x")); + var normal = node.getBoundingClientRect(); + var fromRange = range(node, 0, 1).getBoundingClientRect(); + return badZoomedRects = Math.abs(normal.left - fromRange.left) > 1; + } + + // KEY NAMES + + var 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", 107: "=", 109: "-", 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"}; + CodeMirror.keyNames = keyNames; + (function() { + // Number keys + for (var i = 0; i < 10; i++) keyNames[i + 48] = keyNames[i + 96] = String(i); + // Alphabetic keys + for (var i = 65; i <= 90; i++) keyNames[i] = String.fromCharCode(i); + // Function keys + for (var i = 1; i <= 12; i++) keyNames[i + 111] = keyNames[i + 63235] = "F" + i; + })(); + + // BIDI HELPERS + + function iterateBidiSections(order, from, to, f) { + if (!order) return f(from, to, "ltr"); + var found = false; + for (var i = 0; i < order.length; ++i) { + var part = order[i]; + if (part.from < to && part.to > from || from == to && part.to == from) { + f(Math.max(part.from, from), Math.min(part.to, to), part.level == 1 ? "rtl" : "ltr"); + found = true; + } + } + if (!found) f(from, to, "ltr"); + } + + function bidiLeft(part) { return part.level % 2 ? part.to : part.from; } + function bidiRight(part) { return part.level % 2 ? part.from : part.to; } + + function lineLeft(line) { var order = getOrder(line); return order ? bidiLeft(order[0]) : 0; } + function lineRight(line) { + var order = getOrder(line); + if (!order) return line.text.length; + return bidiRight(lst(order)); + } + + function lineStart(cm, lineN) { + var line = getLine(cm.doc, lineN); + var visual = visualLine(line); + if (visual != line) lineN = lineNo(visual); + var order = getOrder(visual); + var ch = !order ? 0 : order[0].level % 2 ? lineRight(visual) : lineLeft(visual); + return Pos(lineN, ch); + } + function lineEnd(cm, lineN) { + var merged, line = getLine(cm.doc, lineN); + while (merged = collapsedSpanAtEnd(line)) { + line = merged.find(1, true).line; + lineN = null; + } + var order = getOrder(line); + var ch = !order ? line.text.length : order[0].level % 2 ? lineLeft(line) : lineRight(line); + return Pos(lineN == null ? lineNo(line) : lineN, ch); + } + function lineStartSmart(cm, pos) { + var start = lineStart(cm, pos.line); + var line = getLine(cm.doc, start.line); + var order = getOrder(line); + if (!order || order[0].level == 0) { + var firstNonWS = Math.max(0, line.text.search(/\S/)); + var inWS = pos.line == start.line && pos.ch <= firstNonWS && pos.ch; + return Pos(start.line, inWS ? 0 : firstNonWS); + } + return start; + } + + function compareBidiLevel(order, a, b) { + var linedir = order[0].level; + if (a == linedir) return true; + if (b == linedir) return false; + return a < b; + } + var bidiOther; + function getBidiPartAt(order, pos) { + bidiOther = null; + for (var i = 0, found; i < order.length; ++i) { + var cur = order[i]; + if (cur.from < pos && cur.to > pos) return i; + if ((cur.from == pos || cur.to == pos)) { + if (found == null) { + found = i; + } else if (compareBidiLevel(order, cur.level, order[found].level)) { + if (cur.from != cur.to) bidiOther = found; + return i; + } else { + if (cur.from != cur.to) bidiOther = i; + return found; + } + } + } + return found; + } + + function moveInLine(line, pos, dir, byUnit) { + if (!byUnit) return pos + dir; + do pos += dir; + while (pos > 0 && isExtendingChar(line.text.charAt(pos))); + return pos; + } + + // This is needed in order to move 'visually' through bi-directional + // text -- i.e., pressing left should make the cursor go left, even + // when in RTL text. The tricky part is the 'jumps', where RTL and + // LTR text touch each other. This often requires the cursor offset + // to move more than one unit, in order to visually move one unit. + function moveVisually(line, start, dir, byUnit) { + var bidi = getOrder(line); + if (!bidi) return moveLogically(line, start, dir, byUnit); + var pos = getBidiPartAt(bidi, start), part = bidi[pos]; + var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit); + + for (;;) { + if (target > part.from && target < part.to) return target; + if (target == part.from || target == part.to) { + if (getBidiPartAt(bidi, target) == pos) return target; + part = bidi[pos += dir]; + return (dir > 0) == part.level % 2 ? part.to : part.from; + } else { + part = bidi[pos += dir]; + if (!part) return null; + if ((dir > 0) == part.level % 2) + target = moveInLine(line, part.to, -1, byUnit); + else + target = moveInLine(line, part.from, 1, byUnit); + } + } + } + + function moveLogically(line, start, dir, byUnit) { + var target = start + dir; + if (byUnit) while (target > 0 && isExtendingChar(line.text.charAt(target))) target += dir; + return target < 0 || target > line.text.length ? null : target; + } + + // Bidirectional ordering algorithm + // See http://unicode.org/reports/tr9/tr9-13.html for the algorithm + // that this (partially) implements. + + // One-char codes used for character types: + // L (L): Left-to-Right + // R (R): Right-to-Left + // r (AL): Right-to-Left Arabic + // 1 (EN): European Number + // + (ES): European Number Separator + // % (ET): European Number Terminator + // n (AN): Arabic Number + // , (CS): Common Number Separator + // m (NSM): Non-Spacing Mark + // b (BN): Boundary Neutral + // s (B): Paragraph Separator + // t (S): Segment Separator + // w (WS): Whitespace + // N (ON): Other Neutrals + + // Returns null if characters are ordered as they appear + // (left-to-right), or an array of sections ({from, to, level} + // objects) in the order in which they occur visually. + var bidiOrdering = (function() { + // Character types for codepoints 0 to 0xff + var lowTypes = "bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN"; + // Character types for codepoints 0x600 to 0x6ff + var arabicTypes = "rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm"; + function charType(code) { + if (code <= 0xf7) return lowTypes.charAt(code); + else if (0x590 <= code && code <= 0x5f4) return "R"; + else if (0x600 <= code && code <= 0x6ed) return arabicTypes.charAt(code - 0x600); + else if (0x6ee <= code && code <= 0x8ac) return "r"; + else if (0x2000 <= code && code <= 0x200b) return "w"; + else if (code == 0x200c) return "b"; + else return "L"; + } + + var bidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/; + var isNeutral = /[stwN]/, isStrong = /[LRr]/, countsAsLeft = /[Lb1n]/, countsAsNum = /[1n]/; + // Browsers seem to always treat the boundaries of block elements as being L. + var outerType = "L"; + + function BidiSpan(level, from, to) { + this.level = level; + this.from = from; this.to = to; + } + + return function(str) { + if (!bidiRE.test(str)) return false; + var len = str.length, types = []; + for (var i = 0, type; i < len; ++i) + types.push(type = charType(str.charCodeAt(i))); + + // W1. Examine each non-spacing mark (NSM) in the level run, and + // change the type of the NSM to the type of the previous + // character. If the NSM is at the start of the level run, it will + // get the type of sor. + for (var i = 0, prev = outerType; i < len; ++i) { + var type = types[i]; + if (type == "m") types[i] = prev; + else prev = type; + } + + // W2. Search backwards from each instance of a European number + // until the first strong type (R, L, AL, or sor) is found. If an + // AL is found, change the type of the European number to Arabic + // number. + // W3. Change all ALs to R. + for (var i = 0, cur = outerType; i < len; ++i) { + var type = types[i]; + if (type == "1" && cur == "r") types[i] = "n"; + else if (isStrong.test(type)) { cur = type; if (type == "r") types[i] = "R"; } + } + + // W4. A single European separator between two European numbers + // changes to a European number. A single common separator between + // two numbers of the same type changes to that type. + for (var i = 1, prev = types[0]; i < len - 1; ++i) { + var type = types[i]; + if (type == "+" && prev == "1" && types[i+1] == "1") types[i] = "1"; + else if (type == "," && prev == types[i+1] && + (prev == "1" || prev == "n")) types[i] = prev; + prev = type; + } + + // W5. A sequence of European terminators adjacent to European + // numbers changes to all European numbers. + // W6. Otherwise, separators and terminators change to Other + // Neutral. + for (var i = 0; i < len; ++i) { + var type = types[i]; + if (type == ",") types[i] = "N"; + else if (type == "%") { + for (var end = i + 1; end < len && types[end] == "%"; ++end) {} + var replace = (i && types[i-1] == "!") || (end < len && types[end] == "1") ? "1" : "N"; + for (var j = i; j < end; ++j) types[j] = replace; + i = end - 1; + } + } + + // W7. Search backwards from each instance of a European number + // until the first strong type (R, L, or sor) is found. If an L is + // found, then change the type of the European number to L. + for (var i = 0, cur = outerType; i < len; ++i) { + var type = types[i]; + if (cur == "L" && type == "1") types[i] = "L"; + else if (isStrong.test(type)) cur = type; + } + + // N1. A sequence of neutrals takes the direction of the + // surrounding strong text if the text on both sides has the same + // direction. European and Arabic numbers act as if they were R in + // terms of their influence on neutrals. Start-of-level-run (sor) + // and end-of-level-run (eor) are used at level run boundaries. + // N2. Any remaining neutrals take the embedding direction. + for (var i = 0; i < len; ++i) { + if (isNeutral.test(types[i])) { + for (var end = i + 1; end < len && isNeutral.test(types[end]); ++end) {} + var before = (i ? types[i-1] : outerType) == "L"; + var after = (end < len ? types[end] : outerType) == "L"; + var replace = before || after ? "L" : "R"; + for (var j = i; j < end; ++j) types[j] = replace; + i = end - 1; + } + } + + // Here we depart from the documented algorithm, in order to avoid + // building up an actual levels array. Since there are only three + // levels (0, 1, 2) in an implementation that doesn't take + // explicit embedding into account, we can build up the order on + // the fly, without following the level-based algorithm. + var order = [], m; + for (var i = 0; i < len;) { + if (countsAsLeft.test(types[i])) { + var start = i; + for (++i; i < len && countsAsLeft.test(types[i]); ++i) {} + order.push(new BidiSpan(0, start, i)); + } else { + var pos = i, at = order.length; + for (++i; i < len && types[i] != "L"; ++i) {} + for (var j = pos; j < i;) { + if (countsAsNum.test(types[j])) { + if (pos < j) order.splice(at, 0, new BidiSpan(1, pos, j)); + var nstart = j; + for (++j; j < i && countsAsNum.test(types[j]); ++j) {} + order.splice(at, 0, new BidiSpan(2, nstart, j)); + pos = j; + } else ++j; + } + if (pos < i) order.splice(at, 0, new BidiSpan(1, pos, i)); + } + } + if (order[0].level == 1 && (m = str.match(/^\s+/))) { + order[0].from = m[0].length; + order.unshift(new BidiSpan(0, 0, m[0].length)); + } + if (lst(order).level == 1 && (m = str.match(/\s+$/))) { + lst(order).to -= m[0].length; + order.push(new BidiSpan(0, len - m[0].length, len)); + } + if (order[0].level == 2) + order.unshift(new BidiSpan(1, order[0].to, order[0].to)); + if (order[0].level != lst(order).level) + order.push(new BidiSpan(order[0].level, len, len)); + + return order; + }; + })(); + + // THE END + + CodeMirror.version = "5.3.0"; + + return CodeMirror; +}); diff --git a/media/editors/codemirror/lib/codemirror.min.css b/media/editors/codemirror/lib/codemirror.min.css new file mode 100644 index 0000000000000..5cd3f6957cd30 --- /dev/null +++ b/media/editors/codemirror/lib/codemirror.min.css @@ -0,0 +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 div.CodeMirror-cursor{border-left:1px solid #000}.CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}.CodeMirror.cm-fat-cursor div.CodeMirror-cursor{width:auto;border:0;background:#7e7}.CodeMirror.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}@-moz-keyframes blink{0%,100%{background:#7e7}50%{background:0 0}}@-webkit-keyframes blink{0%,100%{background:#7e7}50%{background:0 0}}@keyframes blink{0%,100%{background:#7e7}50%{background:0 0}}.cm-tab{display:inline-block;text-decoration:inherit}.CodeMirror-ruler{border-left:1px solid #ccc;position:absolute}.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-header{color:#00f}.cm-s-default .cm-quote{color:#090}.cm-s-default .cm-hr{color:#999}.cm-s-default .cm-link{color:#00c}.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-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;z-index:3}.CodeMirror-gutter{white-space:normal;height:100%;display:inline-block;margin-bottom:-30px}.CodeMirror-gutter-wrapper{position:absolute;z-index:4;height:100%;-webkit-user-select:none;-moz-user-select:none;user-select:none}.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}.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-measure pre{position:static}.CodeMirror div.CodeMirror-cursor{position:absolute;border-right:none;width:0}div.CodeMirror-cursors{visibility:hidden;position:relative;z-index:3}.CodeMirror-focused div.CodeMirror-cursors{visibility:visible}.CodeMirror-selected{background:#d9d9d9}.CodeMirror ::selection,.CodeMirror-focused .CodeMirror-selected{background:#d7d4f0}.CodeMirror-crosshair{cursor:crosshair}.CodeMirror ::-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 new file mode 100644 index 0000000000000..4e56fe1f790e0 --- /dev/null +++ b/media/editors/codemirror/lib/codemirror.min.js @@ -0,0 +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.CodeMirror=a()}}(function(){"use strict";function a(c,d){if(!(this instanceof a))return new a(c,d);this.options=d=d?Ge(d):{},Ge(Uf,d,!1),n(d);var e=d.value;"string"==typeof e&&(e=new qg(e,d.mode)),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&&!wf&&g.input.focus(),r(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,draggingText:!1,highlight:new ye,keySeq:null,specialChars:null};var i=this;mf&&11>nf&&setTimeout(function(){i.display.input.reset(!0)},20),Ob(this),Se(),sb(this),this.curOp.forceUpdate=!0,Td(this,e),d.autofocus&&!wf||i.hasFocus()?setTimeout(He(mc,this),20):nc(this);for(var k in Vf)Vf.hasOwnProperty(k)&&Vf[k](this,d[k],Wf);w(this),d.finishInit&&d.finishInit(this);for(var l=0;l<$f.length;++l)$f[l](this);ub(this),of&&d.lineWrapping&&"optimizelegibility"==getComputedStyle(g.lineDiv).textRendering&&(g.lineDiv.style.textRendering="auto")}function b(a,b,c){var d=this;this.input=c,d.scrollbarFiller=Le("div",null,"CodeMirror-scrollbar-filler"),d.scrollbarFiller.setAttribute("cm-not-content","true"),d.gutterFiller=Le("div",null,"CodeMirror-gutter-filler"),d.gutterFiller.setAttribute("cm-not-content","true"),d.lineDiv=Le("div",null,"CodeMirror-code"),d.selectionDiv=Le("div",null,null,"position: relative; z-index: 1"),d.cursorDiv=Le("div",null,"CodeMirror-cursors"),d.measure=Le("div",null,"CodeMirror-measure"),d.lineMeasure=Le("div",null,"CodeMirror-measure"),d.lineSpace=Le("div",[d.measure,d.lineMeasure,d.selectionDiv,d.cursorDiv,d.lineDiv],null,"position: relative; outline: none"),d.mover=Le("div",[Le("div",[d.lineSpace],"CodeMirror-lines")],null,"position: relative"),d.sizer=Le("div",[d.mover],"CodeMirror-sizer"),d.sizerWidth=null,d.heightForcer=Le("div",null,null,"position: absolute; height: "+Ag+"px; width: 1px;"),d.gutters=Le("div",null,"CodeMirror-gutters"),d.lineGutter=null,d.scroller=Le("div",[d.sizer,d.heightForcer,d.gutters],"CodeMirror-scroll"),d.scroller.setAttribute("tabIndex","-1"),d.wrapper=Le("div",[d.scrollbarFiller,d.gutterFiller,d.scroller],"CodeMirror"),mf&&8>nf&&(d.gutters.style.zIndex=-1,d.scroller.style.paddingRight=0),of||jf&&wf||(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,La(a,100),a.state.modeGen++,a.curOp&&Hb(a)}function e(a){a.options.lineWrapping?(Qg(a.display.wrapper,"CodeMirror-wrap"),a.display.sizer.style.minWidth="",a.display.sizerWidth=null):(Pg(a.display.wrapper,"CodeMirror-wrap"),m(a)),g(a),Hb(a),fb(a),setTimeout(function(){s(a)},100)}function f(a){var b=qb(a.display),c=a.options.lineWrapping,d=c&&Math.max(5,a.display.scroller.clientWidth/rb(a.display)-3);return function(e){if(rd(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=Ce(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+Qa(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+Sa(a)+b.barHeight,nativeBarWidth:b.nativeBarWidth,gutterWidth:c}}function p(a,b,c){this.cm=c;var d=this.vert=Le("div",[Le("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),e=this.horiz=Le("div",[Le("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");a(d),a(e),wg(d,"scroll",function(){d.clientHeight&&b(d.scrollTop,"vertical")}),wg(e,"scroll",function(){e.clientWidth&&b(e.scrollLeft,"horizontal")}),this.checkedOverlay=!1,mf&&8>nf&&(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&&Pg(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),wg(a,"mousedown",function(){b.state.focused&&setTimeout(function(){b.display.input.focus()},0)}),a.setAttribute("cm-not-content","true")},function(a,c){"horizontal"==c?ac(b,a):_b(b,a)},b),b.display.scrollbars.addClass&&Qg(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",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-Pa(a));var e=c&&null!=c.bottom?c.bottom:d+a.wrapper.clientHeight,f=Zd(b,d),g=Zd(b,e);if(c&&c.ensure){var h=c.ensure.from.line,i=c.ensure.to.line;f>h?(f=h,g=Zd(b,$d(Ud(b,h))+a.wrapper.clientHeight)):Math.min(i,b.lastLine())>=g&&(f=Zd(b,$d(Ud(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==Nb(a))return!1;w(a)&&(Jb(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)),Df&&(f=pd(a.doc,f),g=qd(a.doc,g));var h=f!=c.viewFrom||g!=c.viewTo||c.lastWrapHeight!=b.wrapperHeight||c.lastWrapWidth!=b.wrapperWidth;Mb(a,f,g),c.viewOffset=$d(Ud(a.doc,c.viewFrom)),a.display.mover.style.top=c.viewOffset+"px";var i=Nb(a);if(!h&&0==i&&!b.force&&c.renderedView==c.view&&(null==c.updateLineNumbers||c.updateLineNumbers>=c.viewTo))return!1;var j=Oe();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&&Oe()!=j&&j.offsetHeight&&j.focus(),Me(c.cursorDiv),Me(c.selectionDiv),c.gutters.style.height=0,h&&(c.lastWrapHeight=b.wrapperHeight,c.lastWrapWidth=b.wrapperWidth,La(a,400)),c.updateLineNumbers=null,!0}function C(a,b){for(var c=b.viewport,d=!0;(d&&a.options.lineWrapping&&b.oldDisplayWidth!=Ta(a)||(c&&null!=c.top&&(c={top:Math.min(a.doc.height+Qa(a.display)-Ua(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);Ga(a),E(a,e),s(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);Ga(a),E(a,d),s(a,d),c.finish()}}function E(a,b){a.display.sizer.style.minHeight=b.docHeight+"px";var c=b.docHeight+a.display.barHeight;a.display.heightForcer.style.top=c+"px",a.display.gutters.style.height=Math.max(c+Sa(a),b.clientHeight)+"px"}function F(a){for(var b=a.display,c=b.lineDiv.offsetTop,d=0;dnf){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=qb(b)),(i>.001||-.001>i)&&(Xd(f.line,e),G(f.line),f.rest))for(var j=0;j=b&&l.lineNumber;l.changes&&(Ce(l.changes,"gutter")>-1&&(m=!1),J(a,l,j,c)),m&&(Me(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;enf&&(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(Le("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):Hd(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){b.gutter&&(b.node.removeChild(b.gutter),b.gutter=null);var e=b.line.gutterMarkers;if(a.options.lineNumbers||e){var f=K(b),g=b.gutter=Le("div",null,"CodeMirror-gutter-wrapper","left: "+(a.options.fixedGutter?d.fixedPos:-d.gutterTotalWidth)+"px; width: "+d.gutterTotalWidth+"px");if(a.display.input.setUneditable(g),f.insertBefore(g,b.text),b.line.gutterClass&&(g.className+=" "+b.line.gutterClass),!a.options.lineNumbers||e&&e["CodeMirror-linenumbers"]||(b.lineNumber=g.appendChild(Le("div",x(a.options,c),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+d.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+a.display.lineNumInnerWidth+"px"))),e)for(var h=0;h1&&(Gf&&Gf.join("\n")==b?h=d.ranges.length%Gf.length==0&&De(Gf,Tg):g.length==d.ranges.length&&(h=De(g,function(a){return[a]})));for(var i=d.ranges.length-1;i>=0;i--){var j=d.ranges[i],k=j.from(),l=j.to();j.empty()&&(c&&c>0?k=Ef(k.line,k.ch-c):a.state.overwrite&&!a.state.pasteIncoming&&(l=Ef(l.line,Math.min(Ud(f,l.line).text.length,l.ch+Be(g).length))));var m=a.curOp.updateInput,n={from:k,to:l,text:h?h[i%h.length]:g,origin:e||(a.state.pasteIncoming?"paste":a.state.cutIncoming?"cut":"+input")};vc(a.doc,n),se(a,"inputRead",a,n)}b&&!a.state.pasteIncoming&&_(a,b),Hc(a),a.curOp.updateInput=m,a.curOp.typing=!0,a.state.pasteIncoming=a.state.cutIncoming=!1}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=Jc(a,e.head.line,"smart");break}}else f.electricInput&&f.electricInput.test(Ud(a.doc,e.head.line).text.slice(0,e.head.ch))&&(g=Jc(a,e.head.line,"smart"));g&&se(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)]),Ef(i,l)}}}var e=a.text.firstChild,f=!1;if(!b||!Mg(e,b))return ga(Ef(Yd(a.line),0),!0);if(b==e&&(f=!0,b=e.childNodes[c],c=0,!b)){var g=a.rest?Be(a.rest):a.line;return ga(Ef(Yd(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(Ef(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(Ef(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 j,k=b.getAttribute("cm-marker");if(k){var l=a.findMarks(Ef(d,0),Ef(e+1,0),f(+k));return void(l.length&&(j=l[0].find())&&(h+=Vd(a.doc,j.from,j.to).join("\n")))}if("false"==b.getAttribute("contenteditable"))return;for(var m=0;m=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?Ef(c,Ud(a,c).text.length):qa(b,Ud(a,b.line).text.length)}function qa(a,b){var c=a.ch;return null==c||c>b?Ef(a.line,b):0>c?Ef(a.line,0):a}function ra(a,b){return b>=a.first&&b=f.ch:j.to>f.ch))){if(d&&(yg(k,"beforeCursorEnter"),k.explicitlyCleared)){if(h.markedSpans){--i;continue}break}if(!k.atomic)continue;var l=k.find(0>g?-1:1);if(0==Ff(l,f)&&(l.ch+=g,l.ch<0?l=l.line>a.first?pa(a,Ef(l.line-1)):null:l.ch>h.text.length&&(l=l.lineb&&(b=0),b=Math.round(b),d=Math.round(d),h.appendChild(Le("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 kb(a,Ef(b,c),"div",l,d)}var h,i,l=Ud(g,b),m=l.text.length;return Xe(_d(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=Ra(a.display),j=i.left,k=Math.max(f.sizerWidth,Ta(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=Ud(g,l.line),o=Ud(g,m.line),p=nd(n)==nd(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 La(a,b){a.doc.mode.startState&&a.doc.frontier=a.display.viewTo)){var c=+new Date+a.options.workTime,d=ag(b.mode,Oa(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=Dd(a,f,d,!0);f.styles=h.styles;var i=f.styleClasses,j=h.classes;j?f.styleClasses=j:i&&(f.styleClasses=null);for(var k=!g||g.length!=f.styles.length||i!=j&&(!i||!j||i.bgClass!=j.bgClass||i.textClass!=j.textClass),l=0;!k&&lc?(La(a,a.options.workDelay),!0):void 0}),e.length&&Bb(a,function(){for(var b=0;bg;--h){if(h<=f.first)return f.first;var i=Ud(f,h-1);if(i.stateAfter&&(!c||h<=f.frontier))return h;var j=Fg(i.text,null,a.options.tabSize);(null==e||d>j)&&(e=h-1,d=j)}return e}function Oa(a,b,c){var d=a.doc,e=a.display;if(!d.mode.startState)return!0;var f=Na(a,b,c),g=f>d.first&&Ud(d,f-1).stateAfter;return g=g?ag(d.mode,g):bg(d.mode),d.iter(f,b,function(c){Fd(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 Wa(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 Xa(a,b){b=nd(b);var c=Yd(b),d=a.display.externalMeasured=new Fb(a.doc,b,c);d.lineN=c;var e=d.built=Hd(a,d);return d.text=e.pre,Ne(a.display.lineMeasure,e.pre),d}function Ya(a,b,c,d){return _a(a,$a(a,b),c,d)}function Za(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&&Ke(b.line.text.charAt(f.coverStart+h));)--h;for(;f.coverStart+inf&&0==h&&i==f.coverEnd-f.coverStart)e=g.parentNode.getBoundingClientRect();else if(mf&&a.options.lineWrapping){var l=Ig(g,h,i).getClientRects();e=l.length?l["right"==d?l.length-1:0]:Kf}else e=Ig(g,h,i).getBoundingClientRect()||Kf;if(e.left||e.right||0==h)break;i=h,h-=1,j="right"}mf&&11>nf&&(e=cb(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(mf&&9>nf&&!h&&(!e||!e.left&&!e.right)){var m=g.parentNode.getClientRects()[0];e=m?{left:m.left,right:m.left+rb(a.display),top:m.top,bottom:m.bottom}:Kf}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||Ud(a.doc,b.line),e||(e=$a(a,d));var i=_d(d),j=b.ch;if(!i)return g(j);var k=ef(i,j),l=h(j,k);return null!=Yg&&(l.other=h(j,Yg)),l}function mb(a,b){var c=0,b=pa(a.doc,b);a.options.lineWrapping||(c=rb(a.display)*b.ch);var d=Ud(a.doc,b.line),e=$d(d)+Pa(a.display);return{left:c,right:c,top:e,bottom:e+d.height}}function nb(a,b,c,d){var e=Ef(a,b);return e.xRel=d,c&&(e.outside=!0),e}function ob(a,b,c){var d=a.doc;if(c+=a.display.viewOffset,0>c)return nb(d.first,0,!0,-1);var e=Zd(d,c),f=d.first+d.size-1;if(e>f)return nb(d.first+d.size-1,Ud(d,f).text.length,!0,1);0>b&&(b=0);for(var g=Ud(d,e);;){var h=pb(a,g,e,b,c),i=ld(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=Yd(g=j.to.line)}}function pb(a,b,c,d,e){function f(d){var e=lb(a,Ef(c,d),"line",b,j);return h=!0,g>e.bottom?e.left-i:gq)return nb(c,n,r,1);for(;;){if(k?n==m||n==gf(b,m,1):1>=n-m){for(var s=o>d||q-d>=d-o?m:n,t=d-(s==m?o:q);Ke(b.text.charAt(s));)++s;var u=nb(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=gf(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 qb(a){if(null!=a.cachedTextHeight)return a.cachedTextHeight;if(null==Hf){Hf=Le("pre");for(var b=0;49>b;++b)Hf.appendChild(document.createTextNode("x")),Hf.appendChild(Le("br"));Hf.appendChild(document.createTextNode("x"))}Ne(a.measure,Hf);var c=Hf.offsetHeight/50;return c>3&&(a.cachedTextHeight=c),Me(a.measure),c||1}function rb(a){if(null!=a.cachedCharWidth)return a.cachedCharWidth;var b=Le("span","xxxxxxxxxx"),c=Le("pre",[b]);Ne(a.measure,c);var d=b.getBoundingClientRect(),e=(d.right-d.left)/10;return e>2&&(a.cachedCharWidth=e),e||10}function sb(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:++Mf},Lf?Lf.ops.push(a.curOp):a.curOp.ownsGroup=Lf={ops:[a.curOp],delayedCallbacks:[]}}function tb(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 xb(a){a.updatedDisplay=a.mustUpdate&&B(a.cm,a.update)}function yb(a){var b=a.cm,c=b.display;a.updatedDisplay&&F(b),a.barMeasure=o(b),c.maxLineChanged&&!b.options.lineWrapping&&(a.adjustWidthTo=Ya(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+Sa(b)+b.display.barWidth),a.maxScrollLeft=Math.max(0,c.sizer.offsetLeft+a.adjustWidthTo-Ta(b))),(a.updatedDisplay||a.selectionChanged)&&(a.preparedSelection=c.input.prepareSelection())}function zb(a){var b=a.cm;null!=a.adjustWidthTo&&(b.display.sizer.style.minWidth=a.adjustWidthTo+"px",a.maxScrollLeftf;f=d){var g=new Fb(a.doc,Ud(a.doc,f),f);d=f+g.size,e.push(g)}return e}function Hb(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)Df&&pd(a.doc,b)e.viewFrom?Jb(a):(e.viewFrom+=d,e.viewTo+=d);else if(b<=e.viewFrom&&c>=e.viewTo)Jb(a);else if(b<=e.viewFrom){var f=Lb(a,c,c+d,1);f?(e.view=e.view.slice(f.index),e.viewFrom=f.lineN,e.viewTo+=d):Jb(a)}else if(c>=e.viewTo){var f=Lb(a,b,b,-1);f?(e.view=e.view.slice(0,f.index),e.viewTo=f.lineN):Jb(a)}else{var g=Lb(a,b,b,-1),h=Lb(a,c,c+d,1);g&&h?(e.view=e.view.slice(0,g.index).concat(Gb(a,g.lineN,h.lineN)).concat(e.view.slice(h.index)),e.viewTo+=d):Jb(a)}var i=e.externalMeasured;i&&(c=e.lineN&&b=d.viewTo)){var f=d.view[Kb(a,b)];if(null!=f.node){var g=f.changes||(f.changes=[]);-1==Ce(g,c)&&g.push(c)}}}function Jb(a){a.display.viewFrom=a.display.viewTo=a.doc.first,a.display.view=[],a.display.viewOffset=0}function Kb(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 Lb(a,b,c,d){var e,f=Kb(a,b),g=a.display.view;if(!Df||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(;pd(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 Mb(a,b,c){var d=a.display,e=d.view;0==e.length||b>=d.viewTo||c<=d.viewFrom?(d.view=Gb(a,b,c),d.viewFrom=b):(d.viewFrom>b?d.view=Gb(a,b,d.viewFrom).concat(d.view):d.viewFromc&&(d.view=d.view.slice(0,Kb(a,c)))),d.viewTo=c}function Nb(a){for(var b=a.display.view,c=0,d=0;d400}var e=a.display;wg(e.scroller,"mousedown",Cb(a,Tb)),mf&&11>nf?wg(e.scroller,"dblclick",Cb(a,function(b){if(!ue(a,b)){var c=Sb(a,b);if(c&&!Yb(a,b)&&!Rb(a.display,b)){tg(b);var d=a.findWordAt(c);ua(a.doc,d.anchor,d.head)}}})):wg(e.scroller,"dblclick",function(b){ue(a,b)||tg(b)}),Bf||wg(e.scroller,"contextmenu",function(b){oc(a,b)});var f,g={end:0};wg(e.scroller,"touchstart",function(a){if(!c(a)){clearTimeout(f);var b=+new Date;e.activeTouch={start:b,moved:!1,prev:b-g.end<=300?g:null},1==a.touches.length&&(e.activeTouch.left=a.touches[0].pageX,e.activeTouch.top=a.touches[0].pageY)}}),wg(e.scroller,"touchmove",function(){e.activeTouch&&(e.activeTouch.moved=!0)}),wg(e.scroller,"touchend",function(c){var f=e.activeTouch;if(f&&!Rb(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(Ef(h.line,0),pa(a.doc,Ef(h.line+1,0))),a.setSelection(g.anchor,g.head),a.focus(),tg(c)}b()}),wg(e.scroller,"touchcancel",b),wg(e.scroller,"scroll",function(){e.scroller.clientHeight&&(_b(a,e.scroller.scrollTop),ac(a,e.scroller.scrollLeft,!0),yg(a,"scroll",a))}),wg(e.scroller,"mousewheel",function(b){bc(a,b)}),wg(e.scroller,"DOMMouseScroll",function(b){bc(a,b)}),wg(e.wrapper,"scroll",function(){e.wrapper.scrollTop=e.wrapper.scrollLeft=0}),e.dragFunctions={simple:function(b){ue(a,b)||vg(b)},start:function(b){$b(a,b)},drop:Cb(a,Zb)};var h=e.input.getField();wg(h,"keyup",function(b){jc.call(a,b)}),wg(h,"keydown",Cb(a,hc)),wg(h,"keypress",Cb(a,kc)),wg(h,"focus",He(mc,a)),wg(h,"blur",He(nc,a))}function Pb(b,c,d){var e=d&&d!=a.Init;if(!c!=!e){var f=b.display.dragFunctions,g=c?wg:xg;g(b.display.scroller,"dragstart",f.start),g(b.display.scroller,"dragenter",f.simple),g(b.display.scroller,"dragover",f.simple),g(b.display.scroller,"drop",f.drop)}}function Qb(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 Rb(a,b){for(var c=qe(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 Sb(a,b,c,d){var e=a.display;if(!c&&"true"==qe(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=ob(a,f,g);if(d&&1==j.xRel&&(i=Ud(a.doc,j.line).text).length==j.ch){var k=Fg(i,i.length,a.options.tabSize)-i.length;j=Ef(j.line,Math.max(0,Math.round((f-Ra(a.display).left)/rb(a.display))-k))}return j}function Tb(a){var b=this,c=b.display;if(!(c.activeTouch&&c.input.supportsTouch()||ue(b,a))){if(c.shift=a.shiftKey,Rb(c,a))return void(of||(c.scroller.draggable=!1,setTimeout(function(){c.scroller.draggable=!0},100)));if(!Yb(b,a)){var d=Sb(b,a);switch(window.focus(),re(a)){case 1:d?Ub(b,a,d):qe(a)==c.scroller&&tg(a);break;case 2:of&&(b.state.lastMiddleDown=+new Date),d&&ua(b.doc,d),setTimeout(function(){c.input.focus()},20),tg(a);break;case 3:Bf?oc(b,a):lc(b)}}}}function Ub(a,b,c){mf?setTimeout(He(Y,a),0):a.curOp.focus=Oe();var d,e=+new Date;Jf&&Jf.time>e-400&&0==Ff(Jf.pos,c)?d="triple":If&&If.time>e-400&&0==Ff(If.pos,c)?(d="double",Jf={time:e,pos:c}):(d="single",If={time:e,pos:c});var f,g=a.doc.sel,h=xf?b.metaKey:b.ctrlKey;a.options.dragDrop&&Sg&&!Z(a)&&"single"==d&&(f=g.contains(c))>-1&&!g.ranges[f].empty()?Vb(a,b,c,h):Wb(a,b,c,d,h)}function Vb(a,b,c,d){var e=a.display,f=+new Date,g=Cb(a,function(h){of&&(e.scroller.draggable=!1),a.state.draggingText=!1,xg(document,"mouseup",g),xg(e.scroller,"drop",g),Math.abs(b.clientX-h.clientX)+Math.abs(b.clientY-h.clientY)<10&&(tg(h),!d&&+new Date-200=o;o++){var r=Ud(j,o).text,s=ze(r,i,f);i==n?e.push(new la(Ef(o,s),Ef(o,s))):r.length>s&&e.push(new la(Ef(o,s),Ef(o,ze(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(Ef(b.line,0),pa(j,Ef(b.line+1,0)));Ff(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),Dg)}}function g(b){var c=++s,e=Sb(a,b,!0,"rect"==d);if(e)if(0!=Ff(e,q)){a.curOp.focus=Oe(),f(e);var h=u(i,j);(e.line>=h.to||e.liner.bottom?20:0;k&&setTimeout(Cb(a,function(){s==c&&(i.scroller.scrollTop+=k,g(b))}),50)}}function h(a){s=1/0,tg(a),i.input.focus(),xg(document,"mousemove",t),xg(document,"mouseup",v),j.history.lastSelOrigin=null}var i=a.display,j=a.doc;tg(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),b.altKey)d="rect",e||(k=new la(c,c)),c=Sb(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(Ef(c.line,0),pa(j,Ef(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)),m=j.sel):wa(j,l,k,Dg):(l=0,Aa(j,new ka([k],0),Dg),m=j.sel);var q=c,r=i.wrapper.getBoundingClientRect(),s=0,t=Cb(a,function(a){re(a)?g(a):h(a)}),v=Cb(a,h);wg(document,"mousemove",t),wg(document,"mouseup",v)}function Xb(a,b,c,d,e){try{var f=b.clientX,g=b.clientY}catch(b){return!1}if(f>=Math.floor(a.display.gutters.getBoundingClientRect().right))return!1;d&&tg(b);var h=a.display,i=h.lineDiv.getBoundingClientRect();if(g>i.bottom||!we(a,c))return pe(b);g-=i.top-h.viewOffset;for(var j=0;j=f){var l=Zd(a.doc,g),m=a.options.gutters[j];return e(a,c,a,l,m,b),pe(b)}}}function Yb(a,b){return Xb(a,b,"gutterClick",!0,se)}function Zb(a){var b=this;if(!ue(b,a)&&!Rb(b.display,a)){tg(a),mf&&(Nf=+new Date);var c=Sb(b,a,!0),d=a.dataTransfer.files;if(c&&!Z(b))if(d&&d.length&&window.FileReader&&window.File)for(var e=d.length,f=Array(e),g=0,h=function(a,d){var h=new FileReader;h.onload=Cb(b,function(){if(f[d]=h.result,++g==e){c=pa(b.doc,c);var a={from:c,to:c,text:Tg(f.join("\n")),origin:"paste"};vc(b.doc,a),za(b.doc,na(c,Tf(a)))}}),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&&!(xf?a.altKey:a.ctrlKey))var j=b.listSelections();if(Ba(b.doc,na(c,c)),j)for(var i=0;ig.clientWidth||e&&g.scrollHeight>g.clientHeight){if(e&&xf&&of)a:for(var h=b.target,i=f.view;h!=g;h=h.parentNode)for(var j=0;jk?l=Math.max(0,l+k-50):m=Math.min(a.doc.height,m+k+50),D(a,{top:l,bottom:m})}20>Of&&(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&&(Pf=(Pf*Of+c)/(Of+1),++Of)}},200)):(f.wheelDX+=d,f.wheelDY+=e))}}function cc(a,b,c){if("string"==typeof b&&(b=cg[b],!b))return!1;a.display.input.ensurePolled();var d=a.display.shift,e=!1;try{Z(a)&&(a.state.suppressEdits=!0),c&&(a.display.shift=!1),e=b(a)!=Bg}finally{a.display.shift=d,a.state.suppressEdits=!1}return e}function dc(a,b,c){for(var d=0;dnf&&27==a.keyCode&&(a.returnValue=!1);var c=a.keyCode;b.display.shift=16==c||a.shiftKey;var d=fc(b,a);rf&&(Sf=d?c:null,!d&&88==c&&!Vg&&(xf?a.metaKey:a.ctrlKey)&&b.replaceSelection("",null,"cut")),18!=c||/\bCodeMirror-crosshair\b/.test(b.display.lineDiv.className)||ic(b)}}function ic(a){function b(a){18!=a.keyCode&&a.altKey||(Pg(c,"CodeMirror-crosshair"),xg(document,"keyup",b),xg(document,"mouseover",b))}var c=a.display.lineDiv;Qg(c,"CodeMirror-crosshair"),wg(document,"keyup",b),wg(document,"mouseover",b)}function jc(a){16==a.keyCode&&(this.doc.sel.shift=!1),ue(this,a)}function kc(a){var b=this;if(!(Rb(b.display,a)||ue(b,a)||a.ctrlKey&&!a.altKey||xf&&a.metaKey)){var c=a.keyCode,d=a.charCode;if(rf&&c==Sf)return Sf=null,void tg(a);if(!rf||a.which&&!(a.which<10)||!fc(b,a)){var e=String.fromCharCode(null==d?c:d);gc(b,a,e)||b.display.input.onKeyPress(a)}}}function lc(a){a.state.delayingBlurEvent=!0,setTimeout(function(){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1,nc(a))},100)}function mc(a){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1),"nocursor"!=a.options.readOnly&&(a.state.focused||(yg(a,"focus",a),a.state.focused=!0,Qg(a.display.wrapper,"CodeMirror-focused"),a.curOp||a.display.selForContextMenu==a.doc.sel||(a.display.input.reset(),of&&setTimeout(function(){a.display.input.reset(!0)},20)),a.display.input.receivedFocus()),Ka(a))}function nc(a){a.state.delayingBlurEvent||(a.state.focused&&(yg(a,"blur",a),a.state.focused=!1,Pg(a.display.wrapper,"CodeMirror-focused")),clearInterval(a.display.blinker),setTimeout(function(){a.state.focused||(a.display.shift=!1)},150))}function oc(a,b){Rb(a.display,b)||pc(a,b)||a.display.input.onContextMenu(b)}function pc(a,b){return we(a,"gutterContextMenu")?Xb(a,b,"gutterContextMenu",!1,yg):!1}function qc(a,b){if(Ff(a,b.from)<0)return a;if(Ff(a,b.to)<=0)return Tf(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+=Tf(b).ch-b.to.ch),Ef(c,d)}function rc(a,b){for(var c=[],d=0;d=0;--e)wc(a,{from:d[e].from,to:d[e].to,text:e?[""]:b.text});else wc(a,b)}}function wc(a,b){if(1!=b.text.length||""!=b.text[0]||0!=Ff(b.from,b.to)){var c=rc(a,b);ee(a,b,c,a.cm?a.cm.curOp.id:NaN),zc(a,b,c,ad(a,b));var d=[];Sd(a,function(a,c){c||-1!=Ce(d,a.history)||(oe(a.history,b),d.push(a.history)),zc(a,b,null,ad(a,b))})}}function xc(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&&!uc(a,l,!1))return void(g.length=0);j.push(be(a,l));var m=i?rc(a,l):Be(g);zc(a,l,m,cd(a,l)),!i&&a.cm&&a.cm.scrollIntoView({from:l.from,to:Tf(l)});var n=[];Sd(a,function(a,b){b||-1!=Ce(n,a.history)||(oe(a.history,l),n.push(a.history)),zc(a,l,null,cd(a,l))})}}}}function yc(a,b){if(0!=b&&(a.first+=b,a.sel=new ka(De(a.sel.ranges,function(a){return new la(Ef(a.anchor.line+b,a.anchor.ch),Ef(a.head.line+b,a.head.ch))}),a.sel.primIndex),a.cm)){Hb(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:Ef(f,Ud(a,f).text.length),text:[b.text[0]],origin:b.origin}),b.removed=Vd(a,b.from,b.to),c||(c=rc(a,b)),a.cm?Ac(a.cm,b,d):Pd(a,b,d),Ba(a,c,Cg)}}function Ac(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=Yd(nd(Ud(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&&ve(a),Pd(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),La(a,400);var k=b.text.length-(h.line-g.line)-1;b.full?Hb(a):g.line!=h.line||1!=b.text.length||Od(a.doc,b)?Hb(a,g.line,h.line+1,k):Ib(a,g.line,"text");var m=we(a,"changes"),n=we(a,"change");if(n||m){var o={from:g,to:h,text:b.text,removed:b.removed,origin:b.origin};n&&se(a,"change",a,o),m&&(a.curOp.changeObjs||(a.curOp.changeObjs=[])).push(o)}a.display.selForContextMenu=null}function Bc(a,b,c,d,e){if(d||(d=c),Ff(d,c)<0){var f=d;d=c,c=f}"string"==typeof b&&(b=Tg(b)),vc(a,{from:c,to:d,text:b,origin:e})}function Cc(a,b){if(!ue(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&&!uf){var f=Le("div","​",null,"position: absolute; top: "+(b.top-c.viewOffset-Pa(a.display))+"px; height: "+(b.bottom-b.top+Sa(a)+c.barHeight)+"px; left: "+b.left+"px; width: 2px;");a.display.lineSpace.appendChild(f),f.scrollIntoView(e),a.display.lineSpace.removeChild(f)}}}function Dc(a,b,c,d){null==d&&(d=0);for(var e=0;5>e;e++){var f=!1,g=lb(a,b),h=c&&c!=b?lb(a,c):g,i=Fc(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&&(_b(a,i.scrollTop),Math.abs(a.doc.scrollTop-j)>1&&(f=!0)),null!=i.scrollLeft&&(ac(a,i.scrollLeft),Math.abs(a.doc.scrollLeft-k)>1&&(f=!0)),!f)break}return g}function Ec(a,b,c,d,e){var f=Fc(a,b,c,d,e);null!=f.scrollTop&&_b(a,f.scrollTop),null!=f.scrollLeft&&ac(a,f.scrollLeft)}function Fc(a,b,c,d,e){var f=a.display,g=qb(a.display);0>c&&(c=0);var h=a.curOp&&null!=a.curOp.scrollTop?a.curOp.scrollTop:f.scroller.scrollTop,i=Ua(a),j={};e-c>i&&(e=c+i);var k=a.doc.height+Qa(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=Ta(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 Gc(a,b,c){(null!=b||null!=c)&&Ic(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 Hc(a){Ic(a);var b=a.getCursor(),c=b,d=b;a.options.lineWrapping||(c=b.ch?Ef(b.line,b.ch-1):b,d=Ef(b.line,b.ch+1)),a.curOp.scrollToPos={from:c,to:d,margin:a.options.cursorScrollMargin,isCursor:!0}}function Ic(a){var b=a.curOp.scrollToPos;if(b){a.curOp.scrollToPos=null;var c=mb(a,b.from),d=mb(a,b.to),e=Fc(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 Jc(a,b,c,d){var e,f=a.doc;null==c&&(c="add"),"smart"==c&&(f.mode.indent?e=Oa(a,b):c="prev");var g=a.options.tabSize,h=Ud(f,b),i=Fg(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==Bg||j>150)){if(!d)return;c="prev"}}else j=0,c="not";"prev"==c?j=b>f.first?Fg(Ud(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+=Ae(j-m)),l!=k)return Bc(f,l,Ef(b,0),Ef(b,k.length),"+input"),h.stateAfter=null,!0;for(var n=0;n=0;b--)Bc(a.doc,"",d[b].from,d[b].to,"+delete");Hc(a)})}function Mc(a,b,c,d,e){function f(){var b=h+c;return b=a.first+a.size?l=!1:(h=b,k=Ud(a,b))}function g(a){var b=(e?gf:hf)(k,i,c,!0);if(null==b){if(a||!f())return l=!1;i=e?(0>c?_e:$e)(k):0>c?k.text.length:0}else i=b;return!0}var h=b.line,i=b.ch,j=c,k=Ud(a,h),l=!0;if("char"==d)g();else if("column"==d)g(!0);else if("word"==d||"group"==d)for(var m=null,n="group"==d,o=a.cm&&a.cm.getHelper(b,"wordChars"),p=!0;!(0>c)||g(!p);p=!1){var q=k.text.charAt(i)||"\n",r=Ie(q,o)?"w":n&&"\n"==q?"n":!n||/\s/.test(q)?null:"p";if(!n||p||r||(r="s"),m&&m!=r){0>c&&(c=1,g());break}if(r&&(m=r),c>0&&!g(!p))break}var s=Fa(a,Ef(h,i),j,!0);return l||(s.hitSide=!0),s}function Nc(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)*qb(a.display))}else"line"==d&&(e=c>0?b.bottom+3:b.top-3);for(;;){var i=ob(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 Oc(b,c,d,e){a.defaults[b]=c,d&&(Vf[b]=e?function(a,b,c){c!=Wf&&d(a,b,c)}:d)}function Pc(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=Le("span",[f.replacedWith],"CodeMirror-widget"),d.handleMouseEvents||f.widgetNode.setAttribute("cm-ignore-events","true"),d.insertLeft&&(f.widgetNode.insertLeft=!0)),f.collapsed){if(md(a,b.line,b,c,f)||b.line!=c.line&&md(a,c.line,b,c,f))throw new Error("Inserting collapsed marker partially overlapping an existing one");Df=!0}f.addToHistory&&ee(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&&nd(a)==j.display.maxLine&&(h=!0),f.collapsed&&i!=b.line&&Xd(a,0),Zc(a,new Wc(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){rd(a,b)&&Xd(b,0)}),f.clearOnEnter&&wg(f,"beforeCursorEnter",function(){f.clear()}),f.readOnly&&(Cf=!0,(a.history.done.length||a.history.undone.length)&&a.clearHistory()),f.collapsed&&(f.id=++ig,f.atomic=!0),j){if(h&&(j.curOp.updateMaxLine=!0),f.collapsed)Hb(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++)Ib(j,k,"text");f.atomic&&Da(j.doc),se(j,"markerAdded",j,f)}return f}function Sc(a,b,c,d,e){d=Ge(d),d.shared=!1;var f=[Rc(a,b,c,d,e)],g=f[0],h=d.widgetNode;return Sd(a,function(a){h&&(d.widgetNode=h.cloneNode(!0)),f.push(Rc(a,pa(a,b),pa(a,c),d,e));for(var i=0;i=b:f.to>b);(d||(d=[])).push(new Wc(g,f.from,i?null:f.to))}}return d}function _c(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 bd(a){for(var b=0;b0)){var k=[i,1],l=Ff(j.from,h.from),m=Ff(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 ed(a){var b=a.markedSpans;if(b){for(var c=0;c=0&&0>=l||0>=k&&l>=0)&&(0>=k&&(Ff(j.to,c)>0||i.marker.inclusiveRight&&e.inclusiveLeft)||k>=0&&(Ff(j.from,d)<0||i.marker.inclusiveLeft&&e.inclusiveRight)))return!0}}}function nd(a){for(var b;b=kd(a);)a=b.find(-1,!0).line;return a}function od(a){for(var b,c;b=ld(a);)a=b.find(1,!0).line,(c||(c=[])).push(a);return c}function pd(a,b){var c=Ud(a,b),d=nd(c);return c==d?b:Yd(d)}function qd(a,b){if(b>a.lastLine())return b;var c,d=Ud(a,b);if(!rd(a,d))return b;for(;c=ld(d);)d=c.find(1,!0).line;return Yd(d)+1}function rd(a,b){var c=Df&&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 Bd(a,b,c,d){function e(a){return{start:l.start,end:l.pos,string:l.current(),type:f||null,state:a?ag(g.mode,k):k}}var f,g=a.doc,h=g.mode;b=pa(g,b);var i,j=Ud(g,b.line),k=Oa(a,b.line,c),l=new hg(j.text,a.options.tabSize);for(d&&(i=[]);(d||l.posa.options.maxHighlightLength?(h=!1,g&&Fd(a,b,d,l.pos),l.pos=b.length,i=null):i=yd(Ad(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 Ed(a,b,c){if(!b.styles||b.styles[0]!=a.state.modeGen){var d=Dd(a,b,b.stateAfter=Oa(a,Yd(b)));b.styles=d.styles,d.classes?b.styleClasses=d.classes:b.styleClasses&&(b.styleClasses=null),c===a.doc.frontier&&a.doc.frontier++}return b.styles}function Fd(a,b,c,d){var e=a.doc.mode,f=new hg(b,a.options.tabSize);for(f.start=f.pos=d||0,""==b&&zd(e,c);!f.eol()&&f.pos<=a.options.maxHighlightLength;)Ad(e,f,c),f.start=f.pos}function Gd(a,b){if(!a||/^\s*$/.test(a))return null;var c=b.addModeClass?og:ng;return c[a]||(c[a]=a.replace(/\S+/g,"cm-$&"))}function Hd(a,b){var c=Le("span",null,null,of?"padding-right: .1px":null),d={pre:Le("pre",[c]),content:c,col:0,pos:0,cm:a,splitSpaces:(mf||of)&&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=Jd,Ve(a.display.measure)&&(f=_d(g))&&(d.addToken=Ld(d.addToken,f)),d.map=[];var h=b!=a.display.externalMeasured&&Yd(g);Nd(g,d,Ed(a,g,h)),g.styleClasses&&(g.styleClasses.bgClass&&(d.bgClass=Qe(g.styleClasses.bgClass,d.bgClass||"")),g.styleClasses.textClass&&(d.textClass=Qe(g.styleClasses.textClass,d.textClass||""))),0==d.map.length&&d.map.push(0,0,d.content.appendChild(Ue(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({}))}return of&&/\bcm-tab\b/.test(d.content.lastChild.className)&&(d.content.className="cm-tab-wrap-hack"),yg(a,"renderLine",a,b.line,d.pre),d.pre.className&&(d.textClass=Qe(d.pre.className,d.textClass||"")),d}function Id(a){var b=Le("span","•","cm-invalidchar");return b.title="\\u"+a.charCodeAt(0).toString(16),b.setAttribute("aria-label",b.title),b}function Jd(a,b,c,d,e,f,g){if(b){var h=a.splitSpaces?b.replace(/ {3,}/g,Kd):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));mf&&9>nf?k.appendChild(Le("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(Le("span",Ae(q),"cm-tab"));o.setAttribute("role","presentation"),o.setAttribute("cm-text"," "),a.col+=q}else{var o=a.cm.options.specialCharPlaceholder(m[0]);o.setAttribute("cm-text",m[0]),mf&&9>nf?k.appendChild(Le("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),mf&&9>nf&&(j=!0),a.pos+=b.length}if(c||d||e||j||g){var r=c||"";d&&(r+=d),e&&(r+=e);var s=Le("span",[k],r,g);return f&&(s.title=f),a.content.appendChild(s)}a.content.appendChild(k)}}function Kd(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 Md(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 Nd(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=0;to||v.collapsed&&u.to==o&&u.from==o)?(null!=u.to&&u.to!=o&&r>u.to&&(r=u.to,j=""),v.className&&(i+=" "+v.className),v.css&&(h=v.css),v.startStyle&&u.from==o&&(k+=" "+v.startStyle),v.endStyle&&u.to==r&&(j+=" "+v.endStyle),v.title&&!l&&(l=v.title),v.collapsed&&(!m||id(m.marker,v)<0)&&(m=u)):u.from>o&&r>u.from&&(r=u.from)}if(m&&(m.from||0)==o){if(Md(b,(null==m.to?n+1:m.to)-o,m.marker,null==m.from),null==m.to)return;m.to==o&&(m=!1)}if(!m&&s.length)for(var t=0;t=n)break;for(var w=Math.min(n,r);;){if(q){var x=o+q.length;if(!m){var y=x>w?q.slice(0,w-o):q;b.addToken(b,y,g?g+i:i,k,o+y.length==r?j:"",l,h)}if(x>=w){q=q.slice(w-o),o=w;break}o=x,k=""}q=e.slice(f,f=c[p++]),g=Gd(c[p++],b.cm.options)}}else for(var p=1;pc;++c)f.push(new mg(j[c],e(c),d));return f}var h=b.from,i=b.to,j=b.text,k=Ud(a,h.line),l=Ud(a,i.line),m=Be(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(Od(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 mg(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)}se(a,"change",a,b)}function Qd(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 Vd(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 Wd(a,b,c){var d=[];return a.iter(b,c,function(a){d.push(a.text)}),d}function Xd(a,b){var c=b-a.height;if(c)for(var d=a;d;d=d.parent)d.height+=c}function Yd(a){if(null==a.parent)return null;for(var b=a.parent,c=Ce(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 Zd(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 $d(a){a=nd(a);for(var b=0,c=a.parent,d=0;d1&&!a.done[a.done.length-2].ranges?(a.done.pop(),Be(a.done)):void 0}function ee(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=de(e,e.lastOp==d))){var h=Be(f.changes);0==Ff(b.from,b.to)&&0==Ff(b.from,h.to)?h.to=Tf(b):f.changes.push(be(a,b))}else{var i=Be(e.done);for(i&&i.ranges||he(a.sel,e.done),f={changes:[be(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||yg(a,"historyAdded")}function fe(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 ge(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||fe(a,f,Be(e.done),b))?e.done[e.done.length-1]=b:he(b,e.done),e.lastSelTime=+new Date,e.lastSelOrigin=f,e.lastSelOp=c,d&&d.clearRedo!==!1&&ce(e.undone)}function he(a,b){var c=Be(b);c&&c.ranges&&c.equals(a)||b.push(a)}function ie(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 je(a){if(!a)return null;for(var b,c=0;c-1&&(Be(h)[l]=k[l],delete k[l])}}}return e}function me(a,b,c,d){c0}function xe(a){a.prototype.on=function(a,b){wg(this,a,b)},a.prototype.off=function(a,b){xg(this,a,b)}}function ye(){this.id=null}function ze(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}}function Ae(a){for(;Gg.length<=a;)Gg.push(Be(Gg)+" ");return Gg[a]}function Be(a){return a[a.length-1]}function Ce(a,b){for(var c=0;c-1&&Kg(a)?!0:b.test(a):Kg(a)}function Je(a){for(var b in a)if(a.hasOwnProperty(b)&&a[b])return!1;return!0}function Ke(a){return a.charCodeAt(0)>=768&&Lg.test(a)}function Le(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 Ne(a,b){return Me(a).appendChild(b)}function Oe(){return document.activeElement}function Pe(a){return new RegExp("(^|\\s)"+a+"(?:$|\\s)\\s*")}function Qe(a,b){for(var c=a.split(" "),d=0;d2&&!(mf&&8>nf))}var c=Ng?Le("span","​"):Le("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return c.setAttribute("cm-text",""),c}function Ve(a){if(null!=Og)return Og;var b=Ne(a,document.createTextNode("AخA")),c=Ig(b,0,1).getBoundingClientRect();if(!c||c.left==c.right)return!1;var d=Ig(b,1,2).getBoundingClientRect();return Og=d.right-c.right<3}function We(a){if(null!=Wg)return Wg;var b=Ne(a,Le("span","x")),c=b.getBoundingClientRect(),d=Ig(b,0,1).getBoundingClientRect();return Wg=Math.abs(c.left-d.left)>1}function Xe(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 Ye(a){return a.level%2?a.to:a.from}function Ze(a){return a.level%2?a.from:a.to}function $e(a){var b=_d(a);return b?Ye(b[0]):0}function _e(a){var b=_d(a);return b?Ze(Be(b)):a.text.length}function af(a,b){var c=Ud(a.doc,b),d=nd(c);d!=c&&(b=Yd(d));var e=_d(d),f=e?e[0].level%2?_e(d):$e(d):0;return Ef(b,f)}function bf(a,b){for(var c,d=Ud(a.doc,b);c=ld(d);)d=c.find(1,!0).line,b=null;var e=_d(d),f=e?e[0].level%2?$e(d):_e(d):d.text.length;return Ef(null==b?Yd(d):b,f)}function cf(a,b){var c=af(a,b.line),d=Ud(a.doc,c.line),e=_d(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 Ef(c.line,g?0:f)}return c}function df(a,b,c){var d=a[0].level;return b==d?!0:c==d?!1:c>b}function ef(a,b){Yg=null;for(var c,d=0;db)return d;if(e.from==b||e.to==b){if(null!=c)return df(a,e.level,a[c].level)?(e.from!=e.to&&(Yg=c),d):(e.from!=e.to&&(Yg=d),c);c=d}}return c}function ff(a,b,c,d){if(!d)return b+c;do b+=c;while(b>0&&Ke(a.text.charAt(b)));return b}function gf(a,b,c,d){var e=_d(a);if(!e)return hf(a,b,c,d);for(var f=ef(e,b),g=e[f],h=ff(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?ff(a,g.to,-1,d):ff(a,g.from,1,d)}}function hf(a,b,c,d){var e=b+c;if(d)for(;e>0&&Ke(a.text.charAt(e));)e+=c;return 0>e||e>a.text.length?null:e}var jf=/gecko\/\d/i.test(navigator.userAgent),kf=/MSIE \d/.test(navigator.userAgent),lf=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),mf=kf||lf,nf=mf&&(kf?document.documentMode||6:lf[1]),of=/WebKit\//.test(navigator.userAgent),pf=of&&/Qt\/\d+\.\d+/.test(navigator.userAgent),qf=/Chrome\//.test(navigator.userAgent),rf=/Opera\//.test(navigator.userAgent),sf=/Apple Computer/.test(navigator.vendor),tf=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),uf=/PhantomJS/.test(navigator.userAgent),vf=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),wf=vf||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),xf=vf||/Mac/.test(navigator.platform),yf=/win/i.test(navigator.platform),zf=rf&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);zf&&(zf=Number(zf[1])),zf&&zf>=15&&(rf=!1,of=!0);var Af=xf&&(pf||rf&&(null==zf||12.11>zf)),Bf=jf||mf&&nf>=9,Cf=!1,Df=!1;p.prototype=Ge({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.checkedOverlay&&a.clientHeight>0&&(0==d&&this.overlayHack(),this.checkedOverlay=!0),{right:c?d:0,bottom:b?d:0}},setScrollLeft:function(a){this.horiz.scrollLeft!=a&&(this.horiz.scrollLeft=a)},setScrollTop:function(a){this.vert.scrollTop!=a&&(this.vert.scrollTop=a)},overlayHack:function(){var a=xf&&!tf?"12px":"18px";this.horiz.style.minHeight=this.vert.style.minWidth=a;var b=this,c=function(a){qe(a)!=b.vert&&qe(a)!=b.horiz&&Cb(b.cm,Tb)(a)};wg(this.vert,"mousedown",c),wg(this.horiz,"mousedown",c)},clear:function(){var a=this.horiz.parentNode;a.removeChild(this.horiz),a.removeChild(this.vert)}},p.prototype),q.prototype=Ge({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){we(a,b)&&this.events.push(arguments)},z.prototype.finish=function(){for(var a=0;a=9&&c.hasSelection&&(c.hasSelection=null),c.poll()}),wg(f,"paste",function(){if(of&&!d.state.fakedLastChar&&!(new Date-d.state.lastMiddleDown<200)){var a=f.selectionStart,b=f.selectionEnd;f.value+="$",f.selectionEnd=b,f.selectionStart=a,d.state.fakedLastChar=!0}d.state.pasteIncoming=!0,c.fastPoll()}),wg(f,"cut",b),wg(f,"copy",b),wg(a.scroller,"paste",function(b){Rb(a,b)||(d.state.pasteIncoming=!0,c.focus())}),wg(a.lineSpace,"selectstart",function(b){Rb(a,b)||tg(b)}),wg(f,"compositionstart",function(){var a=d.getCursor("from");c.composing={start:a,range:d.markText(a,d.getCursor("to"),{className:"CodeMirror-composing"})}}),wg(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=Ha(a);if(a.options.moveInputWithCursor){var e=lb(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;Ne(c.cursorDiv,a.cursors),Ne(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=Vg&&(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&&Hg(this.textarea),mf&&nf>=9&&(this.hasSelection=g)}else a||(this.prevInput=this.textarea.value="",mf&&nf>=9&&(this.hasSelection=null));this.inaccurateSelection=b}},getField:function(){return this.textarea},supportsTouch:function(){return!1},focus:function(){if("nocursor"!=this.cm.options.readOnly&&(!wf||Oe()!=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(!a.state.focused||Ug(b)&&!c||Z(a)||a.options.disableInput||a.state.keySeq)return!1;a.state.pasteIncoming&&a.state.fakedLastChar&&(b.value=b.value.substring(0,b.value.length-1),a.state.fakedLastChar=!1);var d=b.value;if(d==c&&!a.somethingSelected())return!1;if(mf&&nf>=9&&this.hasSelection===d||xf&&/[\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 Bb(a,function(){$(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(){mf&&nf>=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.position="relative",g.style.cssText=k,mf&&9>nf&&f.scrollbars.setScrollTop(f.scroller.scrollTop=i),null!=g.selectionStart){(!mf||mf&&9>nf)&&b();var a=0,c=function(){f.selForContextMenu==e.doc.sel&&0==g.selectionStart&&g.selectionEnd>0&&"​"==d.prevInput?Cb(e,cg.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=Sb(e,a),i=f.scroller.scrollTop;if(h&&!rf){var j=e.options.resetSelectionOnContextMenu;j&&-1==e.doc.sel.contains(h)&&Cb(e,Aa)(e.doc,na(h),Cg);var k=g.style.cssText;if(d.wrapper.style.position="absolute",g.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(a.clientY-5)+"px; left: "+(a.clientX-5)+"px; z-index: 1000; background: "+(mf?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",of)var l=window.scrollY;if(f.input.focus(),of&&window.scrollTo(null,l),f.input.reset(),e.somethingSelected()||(g.value=d.prevInput=" "),d.contextMenuPending=!0,f.selForContextMenu=e.doc.sel,clearTimeout(f.detectingSelectAll),mf&&nf>=9&&b(),Bf){vg(a);var m=function(){xg(window,"mouseup",m),setTimeout(c,20)};wg(window,"mouseup",m)}else setTimeout(c,50)}},setUneditable:Ee,needsContentAttribute:!1},ca.prototype),ea.prototype=Ge({init:function(a){function b(a){if(d.somethingSelected())Gf=d.getSelections(),"cut"==a.type&&d.replaceSelection("",null,"cut");else{if(!d.options.lineWiseCopyCut)return;var b=aa(d);Gf=b.text,"cut"==a.type&&d.operation(function(){d.setSelections(b.ranges,0,Cg),d.replaceSelection("",null,"cut")})}if(a.clipboardData&&!vf)a.preventDefault(),a.clipboardData.clearData(),a.clipboardData.setData("text/plain",Gf.join("\n"));else{var c=da(),e=c.firstChild;d.display.lineSpace.insertBefore(c,d.display.lineSpace.firstChild),e.value=Gf.join("\n");var f=document.activeElement;Hg(e),setTimeout(function(){d.display.lineSpace.removeChild(c),f.focus()},50)}}var c=this,d=c.cm,e=c.div=a.lineDiv;e.contentEditable="true",ba(e),wg(e,"paste",function(a){var b=a.clipboardData&&a.clipboardData.getData("text/plain");b&&(a.preventDefault(),d.replaceSelection(b,null,"paste"))}),wg(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(Ef(e.head.line,g),Ef(e.head.line,g+b.length)))}}),wg(e,"compositionupdate",function(a){c.composing.data=a.data}),wg(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))}),wg(e,"touchstart",function(){c.forceCompositionEnd()}),wg(e,"input",function(){c.composing||c.pollContent()||Bb(c.cm,function(){Hb(d)})}),wg(e,"copy",b),wg(e,"cut",b)},prepareSelection:function(){var a=Ha(this.cm,!1);return a.focus=this.cm.state.focused,a},showSelection:function(a){a&&this.cm.display.view.length&&(a.focus&&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!=Ff(X(c,d),b.from())||0!=Ff(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=Ig(e.node,e.offset,f.offset,f.node)}catch(l){}k&&(a.removeAllRanges(),a.addRange(k),h&&null==a.anchorNode?a.addRange(h):jf&&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){Ne(this.cm.display.cursorDiv,a.cursors),Ne(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 Mg(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():Bb(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&&Bb(b,function(){Aa(b.doc,na(c,d),Cg),(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=Kb(a,d.line)))var g=Yd(b.view[0].line),h=b.view[0].node;else var g=Yd(b.view[f].line),h=b.view[f-1].node.nextSibling;var i=Kb(a,e.line);if(i==b.view.length-1)var j=b.viewTo-1,k=b.view[i].node;else var j=Yd(b.view[i+1].line)-1,k=b.view[i+1].node.previousSibling;for(var l=Tg(ja(a,h,k,g,j)),m=Vd(a.doc,Ef(g,0),Ef(j,Ud(a.doc,j).text.length));l.length>1&&m.length>1;)if(Be(l)==Be(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=Be(l),t=Be(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=Ef(g,n),w=Ef(j,m.length?Be(m).length-o:0);return l.length>1||l[0]||Ff(v,w)?(Bc(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){a.data&&a.data!=a.startData&&Cb(this.cm,$)(this.cm,a.data,0,a.sel)},setUneditable:function(a){a.setAttribute("contenteditable","false")},onKeyPress:function(a){a.preventDefault(),Cb(this.cm,$)(this.cm,String.fromCharCode(null==a.charCode?a.keyCode:a.charCode),0)},onContextMenu:Ee,resetPosition:Ee,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&&Ff(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 Hf,If,Jf,Kf={left:0,right:0,top:0,bottom:0},Lf=null,Mf=0,Nf=0,Of=0,Pf=null;mf?Pf=-.53:jf?Pf=15:qf?Pf=-.7:sf&&(Pf=-1/3);var Qf=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=Qf(a);return b.x*=Pf,b.y*=Pf,b};var Rf=new ye,Sf=null,Tf=a.changeEnd=function(a){return a.text?Ef(a.from.line+a.text.length-1,Be(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,Vf.hasOwnProperty(a)&&Cb(this,Vf[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"](Qc(a))},removeKeyMap:function(a){for(var b=this.state.keyMaps,c=0;cc&&(Jc(this,e.head.line,a,!0),c=e.head.line,d==this.doc.sel.primIndex&&Hc(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)Jc(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()),Cg)}}}),getTokenAt:function(a,b){return Bd(this,a,b)},getLineTokens:function(a,b){return Bd(this,Ef(a),b,!0)},getTokenTypeAt:function(a){a=pa(this.doc,a);var b,c=Ed(this,Ud(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(!_f.hasOwnProperty(b))return c;var d=_f[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=Ud(this.doc,a)}else c=a;return ib(this,c,{top:0,left:0},b||"page").top+(d?this.doc.height-$d(c):0)},defaultTextHeight:function(){return qb(this.display)},defaultCharWidth:function(){return rb(this.display)},setGutterMarker:Db(function(a,b,c){return Kc(this.doc,a,"gutter",function(a){var d=a.gutterMarkers||(a.gutterMarkers={});return d[b]=c,!c&&Je(d)&&(a.gutterMarkers=null),!0})}),clearGutter:Db(function(a){var b=this,c=b.doc,d=c.first;c.iter(function(c){c.gutterMarkers&&c.gutterMarkers[a]&&(c.gutterMarkers[a]=null,Ib(b,d,"gutter"),Je(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=Ud(this.doc,a),!a)return null}else{var b=Yd(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=lb(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&&Ec(this,h,g,h+b.offsetWidth,g+b.offsetHeight)},triggerOnKeyDown:Db(hc),triggerOnKeyPress:Db(kc),triggerOnKeyUp:jc,execCommand:function(a){return cg.hasOwnProperty(a)?cg[a](this):void 0},triggerElectric:Db(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=Mc(this.doc,g,e,c,d),!g.hitSide);++f);return g},moveH:Db(function(a,b){var c=this;c.extendSelectionsBy(function(d){return c.display.shift||c.doc.extend||d.empty()?Mc(c.doc,d.head,a,b,c.options.rtlMoveVisually):0>a?d.from():d.to()},Eg)}),deleteH:Db(function(a,b){var c=this.doc.sel,d=this.doc;c.somethingSelected()?d.replaceSelection("",null,"+delete"):Lc(this,function(c){var e=Mc(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=lb(this,h,"div");if(null==f?f=i.left:i.left=f,h=Nc(this,i,e,c),h.hitSide)break}return h},moveV:Db(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=lb(c,g.head,"div");null!=g.goalColumn&&(h.left=g.goalColumn),e.push(h.left);var i=Nc(c,h,a,b);return"page"==b&&g==d.sel.primary()&&Gc(c,null,kb(c,i,"div").top-h.top),i},Eg),e.length)for(var g=0;g0&&h(c.charAt(d-1));)--d;for(;e.5)&&g(this),yg(this,"refresh",this)}),swapDoc:Db(function(a){var b=this.doc;return b.cm=null,Td(this,a),fb(this),this.display.input.reset(),this.scrollTo(a.scrollLeft,a.scrollTop),this.curOp.forceScroll=!0,se(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}},xe(a);var Uf=a.defaults={},Vf=a.optionHandlers={},Wf=a.Init={toString:function(){return"CodeMirror.Init"}};Oc("value","",function(a,b){a.setValue(b)},!0),Oc("mode",null,function(a,b){a.doc.modeOption=b,c(a)},!0),Oc("indentUnit",2,c,!0),Oc("indentWithTabs",!1),Oc("smartIndent",!0),Oc("tabSize",4,function(a){d(a),fb(a),Hb(a)},!0),Oc("specialChars",/[\t\u0000-\u0019\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()}),Oc("specialCharPlaceholder",Id,function(a){a.refresh()},!0),Oc("electricChars",!0),Oc("inputStyle",wf?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),Oc("rtlMoveVisually",!yf),Oc("wholeLineUpdateBefore",!0),Oc("theme","default",function(a){h(a),i(a)},!0),Oc("keyMap","default",function(b,c,d){var e=Qc(c),f=d!=a.Init&&Qc(d);f&&f.detach&&f.detach(b,e),e.attach&&e.attach(b,f||null)}),Oc("extraKeys",null),Oc("lineWrapping",!1,e,!0),Oc("gutters",[],function(a){n(a.options),i(a)},!0),Oc("fixedGutter",!0,function(a,b){a.display.gutters.style.left=b?y(a.display)+"px":"0",a.refresh()},!0),Oc("coverGutterNextToScrollbar",!1,function(a){s(a)},!0),Oc("scrollbarStyle","native",function(a){r(a),s(a),a.display.scrollbars.setScrollTop(a.doc.scrollTop),a.display.scrollbars.setScrollLeft(a.doc.scrollLeft)},!0),Oc("lineNumbers",!1,function(a){n(a.options),i(a)},!0),Oc("firstLineNumber",1,i,!0),Oc("lineNumberFormatter",function(a){return a},i,!0),Oc("showCursorWhenSelecting",!1,Ga,!0),Oc("resetSelectionOnContextMenu",!0),Oc("lineWiseCopyCut",!0),Oc("readOnly",!1,function(a,b){"nocursor"==b?(nc(a),a.display.input.blur(),a.display.disabled=!0):(a.display.disabled=!1,b||a.display.input.reset())}),Oc("disableInput",!1,function(a,b){b||a.display.input.reset()},!0),Oc("dragDrop",!0,Pb),Oc("cursorBlinkRate",530),Oc("cursorScrollMargin",0),Oc("cursorHeight",1,Ga,!0),Oc("singleCursorHeightPerLine",!0,Ga,!0),Oc("workTime",100),Oc("workDelay",100),Oc("flattenSpans",!0,d,!0),Oc("addModeClass",!1,d,!0),Oc("pollInterval",100),Oc("undoDepth",200,function(a,b){a.doc.history.undoDepth=b}),Oc("historyEventDelay",1250),Oc("viewportMargin",10,function(a){a.refresh()},!0),Oc("maxHighlightLength",1e4,d,!0),Oc("moveInputWithCursor",!0,function(a,b){b||a.display.input.resetPosition()}),Oc("tabindex",null,function(a,b){a.display.input.getField().tabIndex=b||""}),Oc("autofocus",null);var Xf=a.modes={},Yf=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)),Xf[b]=c},a.defineMIME=function(a,b){Yf[a]=b},a.resolveMode=function(b){if("string"==typeof b&&Yf.hasOwnProperty(b))b=Yf[b];else if(b&&"string"==typeof b.name&&Yf.hasOwnProperty(b.name)){var c=Yf[b.name];"string"==typeof c&&(c={name:c}),b=Fe(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=Xf[c.name];if(!d)return a.getMode(b,"text/plain");var e=d(b,c);if(Zf.hasOwnProperty(c.name)){var f=Zf[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 Zf=a.modeExtensions={};a.extendMode=function(a,b){var c=Zf.hasOwnProperty(a)?Zf[a]:Zf[a]={};Ge(b,c)},a.defineExtension=function(b,c){a.prototype[b]=c},a.defineDocExtension=function(a,b){qg.prototype[a]=b},a.defineOption=Oc;var $f=[];a.defineInitHook=function(a){$f.push(a)};var _f=a.helpers={};a.registerHelper=function(b,c,d){_f.hasOwnProperty(b)||(_f[b]=a[b]={_global:[]}),_f[b][c]=d},a.registerGlobalHelper=function(b,c,d,e){a.registerHelper(b,c,e),_f[b]._global.push({pred:d,val:e})};var ag=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},bg=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 cg=a.commands={selectAll:function(a){a.setSelection(Ef(a.firstLine(),0),Ef(a.lastLine()),Cg)},singleSelection:function(a){a.setSelection(a.getCursor("anchor"),a.getCursor("head"),Cg)},killLine:function(a){Lc(a,function(b){if(b.empty()){var c=Ud(a.doc,b.head.line).text.length;return b.head.ch==c&&b.head.line0)e=new Ef(e.line,e.ch+1),a.replaceRange(f.charAt(e.ch-1)+f.charAt(e.ch-2),Ef(e.line,e.ch-2),e,"+transpose");else if(e.line>a.doc.first){var g=Ud(a.doc,e.line-1).text;g&&a.replaceRange(f.charAt(0)+"\n"+g.charAt(g.length-1),Ef(e.line-1,g.length-1),Ef(e.line,1),"+transpose")}c.push(new la(e,e))}a.setSelections(c)})},newlineAndIndent:function(a){Bb(a,function(){for(var b=a.listSelections().length,c=0;b>c;c++){var d=a.listSelections()[c];a.replaceRange("\n",d.anchor,d.head,"+input"),a.indentLine(d.from().line+1,null,!0),Hc(a)}})},toggleOverwrite:function(a){a.toggleOverwrite()}},dg=a.keyMap={};dg.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"},dg.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"},dg.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"},dg.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"]},dg["default"]=xf?dg.macDefault:dg.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=De(c.split(" "),Pc),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 ig=0,jg=a.TextMarker=function(a,b){this.lines=[],this.type=b,this.doc=a,this.id=++ig};xe(jg),jg.prototype.clear=function(){if(!this.explicitlyCleared){var a=this.doc.cm,b=a&&!a.curOp;if(b&&sb(a),we(this,"clear")){var c=this.find();c&&se(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&&Hb(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&&se(a,"markerCleared",a,this),b&&ub(a),this.parent&&this.parent.clear()}},jg.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,xd(e),se(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}},Rd.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 Qd))){var h=[];this.collapse(h),this.children=[new Qd(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(;e.lines.length>50;){var g=e.lines.splice(e.lines.length-25,25),h=new Qd(g);e.height-=h.height,this.children.splice(d+1,0,h),h.parent=this}this.maybeSpill()}break}a-=f}},maybeSpill:function(){if(!(this.children.length<=10)){var a=this;do{var b=a.children.splice(a.children.length-5,5),c=new Rd(b);if(a.parent){a.size-=c.size,a.height-=c.height;var d=Ce(a.parent.children,a);a.parent.children.splice(d+1,0,c)}else{var e=new Rd(a.children);e.parent=a,a.children=[e,c],a=e}c.parent=a.parent}while(a.children.length>10);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 pg=0,qg=a.Doc=function(a,b,c){if(!(this instanceof qg))return new qg(a,b,c);null==c&&(c=0),Rd.call(this,[new Qd([new mg("",null)])]),this.first=c,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.frontier=c;var d=Ef(c,0);this.sel=na(d),this.history=new ae(null),this.id=++pg,this.modeOption=b,"string"==typeof a&&(a=Tg(a)),Pd(this,{from:d,to:d,text:a}),Aa(this,na(d),Cg)};qg.prototype=Fe(Rd.prototype,{constructor:qg,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--)vc(this,d[f]);h?za(this,h):this.cm&&Hc(this.cm)}),undo:Eb(function(){xc(this,"undo")}),redo:Eb(function(){xc(this,"redo")}),undoSelection:Eb(function(){xc(this,"undo",!0)}),redoSelection:Eb(function(){xc(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;hi.to||null==i.from&&e!=a.line||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-=e,void++c)}),pa(this,Ef(c,b))},indexFromPos:function(a){a=pa(this,a);var b=a.ch;return 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}},Gg=[""],Hg=function(a){a.select()};vf?Hg=function(a){a.selectionStart=0,a.selectionEnd=a.value.length}:mf&&(Hg=function(a){try{a.select()}catch(b){}});var Ig,Jg=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Kg=a.isWordChar=function(a){return/\w/.test(a)||a>"€"&&(a.toUpperCase()!=a.toLowerCase()||Jg.test(a))},Lg=/[\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]/;Ig=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 Mg=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)};mf&&11>nf&&(Oe=function(){try{return document.activeElement}catch(a){return document.body}});var Ng,Og,Pg=a.rmClass=function(a,b){var c=a.className,d=Pe(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:"")}},Qg=a.addClass=function(a,b){var c=a.className;Pe(b).test(c)||(a.className+=(c?" ":"")+b)},Rg=!1,Sg=function(){if(mf&&9>nf)return!1;var a=Le("div");return"draggable"in a||"dragDrop"in a}(),Tg=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/)},Ug=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},Vg=function(){var a=Le("div");return"oncopy"in a?!0:(a.setAttribute("oncopy","return;"),"function"==typeof a.oncopy)}(),Wg=null,Xg={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",107:"=",109:"-",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"};a.keyNames=Xg,function(){for(var a=0;10>a;a++)Xg[a+48]=Xg[a+96]=String(a);for(var a=65;90>=a;a++)Xg[a]=String.fromCharCode(a);for(var a=1;12>=a;a++)Xg[a+111]=Xg[a+63235]="F"+a}();var Yg,Zg=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==Be(v).level&&(u=c.match(/\s+$/))&&(Be(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!=Be(v).level&&v.push(new b(v[0].level,k,k)),v}}();return a.version="5.3.0",a}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/apl/apl.js b/media/editors/codemirror/mode/apl/apl.js index 4357bed475fb1..caafe4e913526 100644 --- a/media/editors/codemirror/mode/apl/apl.js +++ b/media/editors/codemirror/mode/apl/apl.js @@ -102,7 +102,7 @@ CodeMirror.defineMode("apl", function() { }; }, token: function(stream, state) { - var ch, funcName, word; + var ch, funcName; if (stream.eatSpace()) { return null; } @@ -163,7 +163,6 @@ CodeMirror.defineMode("apl", function() { return "function jot-dot"; } stream.eatWhile(/[\w\$_]/); - word = stream.current(); state.prev = true; return "keyword"; } diff --git a/media/editors/codemirror/mode/apl/apl.min.js b/media/editors/codemirror/mode/apl/apl.min.js new file mode 100644 index 0000000000000..66fbd5ac5140d --- /dev/null +++ b/media/editors/codemirror/mode/apl/apl.min.js @@ -0,0 +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("apl",function(){var a={".":"innerProduct","\\":"scan","/":"reduce","⌿":"reduce1Axis","⍀":"scan1Axis","¨":"each","⍣":"power"},b={"+":["conjugate","add"],"−":["negate","subtract"],"×":["signOf","multiply"],"÷":["reciprocal","divide"],"⌈":["ceiling","greaterOf"],"⌊":["floor","lesserOf"],"∣":["absolute","residue"],"⍳":["indexGenerate","indexOf"],"?":["roll","deal"],"⋆":["exponentiate","toThePowerOf"],"⍟":["naturalLog","logToTheBase"],"○":["piTimes","circularFuncs"],"!":["factorial","binomial"],"⌹":["matrixInverse","matrixDivide"],"<":[null,"lessThan"],"≤":[null,"lessThanOrEqual"],"=":[null,"equals"],">":[null,"greaterThan"],"≥":[null,"greaterThanOrEqual"],"≠":[null,"notEqual"],"≡":["depth","match"],"≢":[null,"notMatch"],"∈":["enlist","membership"],"⍷":[null,"find"],"∪":["unique","union"],"∩":[null,"intersection"],"∼":["not","without"],"∨":[null,"or"],"∧":[null,"and"],"⍱":[null,"nor"],"⍲":[null,"nand"],"⍴":["shapeOf","reshape"],",":["ravel","catenate"],"⍪":[null,"firstAxisCatenate"],"⌽":["reverse","rotate"],"⊖":["axis1Reverse","axis1Rotate"],"⍉":["transpose",null],"↑":["first","take"],"↓":[null,"drop"],"⊂":["enclose","partitionWithAxis"],"⊃":["diclose","pick"],"⌷":[null,"index"],"⍋":["gradeUp",null],"⍒":["gradeDown",null],"⊤":["encode",null],"⊥":["decode",null],"⍕":["format","formatByExample"],"⍎":["execute",null],"⊣":["stop","left"],"⊢":["pass","right"]},c=/[\.\/⌿⍀¨⍣]/,d=/⍬/,e=/[\+−×÷⌈⌊∣⍳\?⋆⍟○!⌹<≤=>≥≠≡≢∈⍷∪∩∼∨∧⍱⍲⍴,⍪⌽⊖⍉↑↓⊂⊃⌷⍋⍒⊤⊥⍕⍎⊣⊢]/,f=/←/,g=/[⍝#].*$/,h=function(a){var b;return b=!1,function(c){return b=c,c===a?"\\"===b:!0}};return{startState:function(){return{prev:!1,func:!1,op:!1,string:!1,escape:!1}},token:function(i,j){var k,l;return i.eatSpace()?null:(k=i.next(),'"'===k||"'"===k?(i.eatWhile(h(k)),i.next(),j.prev=!0,"string"):/[\[{\(]/.test(k)?(j.prev=!1,null):/[\]}\)]/.test(k)?(j.prev=!0,null):d.test(k)?(j.prev=!1,"niladic"):/[¯\d]/.test(k)?(j.func?(j.func=!1,j.prev=!1):j.prev=!0,i.eatWhile(/[\w\.]/),"number"):c.test(k)?"operator apl-"+a[k]:f.test(k)?"apl-arrow":e.test(k)?(l="apl-",null!=b[k]&&(l+=j.prev?b[k][1]:b[k][0]),j.func=!0,j.prev=!1,"function "+l):g.test(k)?(i.skipToEnd(),"comment"):"∘"===k&&"."===i.peek()?(i.next(),"function jot-dot"):(i.eatWhile(/[\w\$_]/),j.prev=!0,"keyword"))}}}),a.defineMIME("text/apl","apl")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/asciiarmor/asciiarmor.js b/media/editors/codemirror/mode/asciiarmor/asciiarmor.js new file mode 100644 index 0000000000000..d830903767c91 --- /dev/null +++ b/media/editors/codemirror/mode/asciiarmor/asciiarmor.js @@ -0,0 +1,73 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + function errorIfNotEmpty(stream) { + var nonWS = stream.match(/^\s*\S/); + stream.skipToEnd(); + return nonWS ? "error" : null; + } + + CodeMirror.defineMode("asciiarmor", function() { + return { + token: function(stream, state) { + var m; + if (state.state == "top") { + if (stream.sol() && (m = stream.match(/^-----BEGIN (.*)?-----\s*$/))) { + state.state = "headers"; + state.type = m[1]; + return "tag"; + } + return errorIfNotEmpty(stream); + } else if (state.state == "headers") { + if (stream.sol() && stream.match(/^\w+:/)) { + state.state = "header"; + return "atom"; + } else { + var result = errorIfNotEmpty(stream); + if (result) state.state = "body"; + return result; + } + } else if (state.state == "header") { + stream.skipToEnd(); + state.state = "headers"; + return "string"; + } else if (state.state == "body") { + if (stream.sol() && (m = stream.match(/^-----END (.*)?-----\s*$/))) { + if (m[1] != state.type) return "error"; + state.state = "end"; + return "tag"; + } else { + if (stream.eatWhile(/[A-Za-z0-9+\/=]/)) { + return null; + } else { + stream.next(); + return "error"; + } + } + } else if (state.state == "end") { + return errorIfNotEmpty(stream); + } + }, + blankLine: function(state) { + if (state.state == "headers") state.state = "body"; + }, + startState: function() { + return {state: "top", type: null}; + } + }; + }); + + CodeMirror.defineMIME("application/pgp", "asciiarmor"); + CodeMirror.defineMIME("application/pgp-keys", "asciiarmor"); + CodeMirror.defineMIME("application/pgp-signature", "asciiarmor"); +}); diff --git a/media/editors/codemirror/mode/asciiarmor/asciiarmor.min.js b/media/editors/codemirror/mode/asciiarmor/asciiarmor.min.js new file mode 100644 index 0000000000000..bbddf5df0ebeb --- /dev/null +++ b/media/editors/codemirror/mode/asciiarmor/asciiarmor.min.js @@ -0,0 +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){var b=a.match(/^\s*\S/);return a.skipToEnd(),b?"error":null}a.defineMode("asciiarmor",function(){return{token:function(a,c){var d;if("top"==c.state)return a.sol()&&(d=a.match(/^-----BEGIN (.*)?-----\s*$/))?(c.state="headers",c.type=d[1],"tag"):b(a);if("headers"==c.state){if(a.sol()&&a.match(/^\w+:/))return c.state="header","atom";var e=b(a);return e&&(c.state="body"),e}return"header"==c.state?(a.skipToEnd(),c.state="headers","string"):"body"==c.state?a.sol()&&(d=a.match(/^-----END (.*)?-----\s*$/))?d[1]!=c.type?"error":(c.state="end","tag"):a.eatWhile(/[A-Za-z0-9+\/=]/)?null:(a.next(),"error"):"end"==c.state?b(a):void 0},blankLine:function(a){"headers"==a.state&&(a.state="body")},startState:function(){return{state:"top",type:null}}}}),a.defineMIME("application/pgp","asciiarmor"),a.defineMIME("application/pgp-keys","asciiarmor"),a.defineMIME("application/pgp-signature","asciiarmor")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/asn.1/asn.1.js b/media/editors/codemirror/mode/asn.1/asn.1.js new file mode 100644 index 0000000000000..9600247ea60d9 --- /dev/null +++ b/media/editors/codemirror/mode/asn.1/asn.1.js @@ -0,0 +1,204 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + CodeMirror.defineMode("asn.1", function(config, parserConfig) { + var indentUnit = config.indentUnit, + keywords = parserConfig.keywords || {}, + cmipVerbs = parserConfig.cmipVerbs || {}, + compareTypes = parserConfig.compareTypes || {}, + status = parserConfig.status || {}, + tags = parserConfig.tags || {}, + storage = parserConfig.storage || {}, + modifier = parserConfig.modifier || {}, + accessTypes = parserConfig.accessTypes|| {}, + multiLineStrings = parserConfig.multiLineStrings, + indentStatements = parserConfig.indentStatements !== false; + var isOperatorChar = /[\|\^]/; + var curPunc; + + function tokenBase(stream, state) { + var ch = stream.next(); + if (ch == '"' || ch == "'") { + state.tokenize = tokenString(ch); + return state.tokenize(stream, state); + } + if (/[\[\]\(\){}:=,;]/.test(ch)) { + curPunc = ch; + return "punctuation"; + } + if (ch == "-"){ + if (stream.eat("-")) { + stream.skipToEnd(); + return "comment"; + } + } + if (/\d/.test(ch)) { + stream.eatWhile(/[\w\.]/); + return "number"; + } + if (isOperatorChar.test(ch)) { + stream.eatWhile(isOperatorChar); + return "operator"; + } + + stream.eatWhile(/[\w\-]/); + var cur = stream.current(); + if (keywords.propertyIsEnumerable(cur)) return "keyword"; + if (cmipVerbs.propertyIsEnumerable(cur)) return "variable cmipVerbs"; + if (compareTypes.propertyIsEnumerable(cur)) return "atom compareTypes"; + if (status.propertyIsEnumerable(cur)) return "comment status"; + if (tags.propertyIsEnumerable(cur)) return "variable-3 tags"; + if (storage.propertyIsEnumerable(cur)) return "builtin storage"; + if (modifier.propertyIsEnumerable(cur)) return "string-2 modifier"; + if (accessTypes.propertyIsEnumerable(cur)) return "atom accessTypes"; + + return "variable"; + } + + function tokenString(quote) { + return function(stream, state) { + var escaped = false, next, end = false; + while ((next = stream.next()) != null) { + if (next == quote && !escaped){ + var afterNext = stream.peek(); + //look if the character if the quote is like the B in '10100010'B + if (afterNext){ + afterNext = afterNext.toLowerCase(); + if(afterNext == "b" || afterNext == "h" || afterNext == "o") + stream.next(); + } + end = true; break; + } + escaped = !escaped && next == "\\"; + } + if (end || !(escaped || multiLineStrings)) + state.tokenize = null; + return "string"; + }; + } + + function Context(indented, column, type, align, prev) { + this.indented = indented; + this.column = column; + this.type = type; + this.align = align; + this.prev = prev; + } + function pushContext(state, col, type) { + var indent = state.indented; + if (state.context && state.context.type == "statement") + indent = state.context.indented; + return state.context = new Context(indent, col, type, null, state.context); + } + function popContext(state) { + var t = state.context.type; + if (t == ")" || t == "]" || t == "}") + state.indented = state.context.indented; + return state.context = state.context.prev; + } + + //Interface + return { + startState: function(basecolumn) { + return { + tokenize: null, + context: new Context((basecolumn || 0) - indentUnit, 0, "top", false), + indented: 0, + startOfLine: true + }; + }, + + token: function(stream, state) { + var ctx = state.context; + if (stream.sol()) { + if (ctx.align == null) ctx.align = false; + state.indented = stream.indentation(); + state.startOfLine = true; + } + if (stream.eatSpace()) return null; + curPunc = null; + var style = (state.tokenize || tokenBase)(stream, state); + if (style == "comment") return style; + if (ctx.align == null) ctx.align = true; + + if ((curPunc == ";" || curPunc == ":" || curPunc == ",") + && ctx.type == "statement"){ + popContext(state); + } + else if (curPunc == "{") pushContext(state, stream.column(), "}"); + else if (curPunc == "[") pushContext(state, stream.column(), "]"); + else if (curPunc == "(") pushContext(state, stream.column(), ")"); + else if (curPunc == "}") { + while (ctx.type == "statement") ctx = popContext(state); + if (ctx.type == "}") ctx = popContext(state); + while (ctx.type == "statement") ctx = popContext(state); + } + else if (curPunc == ctx.type) popContext(state); + else if (indentStatements && (((ctx.type == "}" || ctx.type == "top") + && curPunc != ';') || (ctx.type == "statement" + && curPunc == "newstatement"))) + pushContext(state, stream.column(), "statement"); + + state.startOfLine = false; + return style; + }, + + electricChars: "{}", + lineComment: "--", + fold: "brace" + }; + }); + + function words(str) { + var obj = {}, words = str.split(" "); + for (var i = 0; i < words.length; ++i) obj[words[i]] = true; + return obj; + } + + CodeMirror.defineMIME("text/x-ttcn-asn", { + name: "asn.1", + keywords: words("DEFINITIONS OBJECTS IF DERIVED INFORMATION ACTION" + + " REPLY ANY NAMED CHARACTERIZED BEHAVIOUR REGISTERED" + + " WITH AS IDENTIFIED CONSTRAINED BY PRESENT BEGIN" + + " IMPORTS FROM UNITS SYNTAX MIN-ACCESS MAX-ACCESS" + + " MINACCESS MAXACCESS REVISION STATUS DESCRIPTION" + + " SEQUENCE SET COMPONENTS OF CHOICE DistinguishedName" + + " ENUMERATED SIZE MODULE END INDEX AUGMENTS EXTENSIBILITY" + + " IMPLIED EXPORTS"), + cmipVerbs: words("ACTIONS ADD GET NOTIFICATIONS REPLACE REMOVE"), + compareTypes: words("OPTIONAL DEFAULT MANAGED MODULE-TYPE MODULE_IDENTITY" + + " MODULE-COMPLIANCE OBJECT-TYPE OBJECT-IDENTITY" + + " OBJECT-COMPLIANCE MODE CONFIRMED CONDITIONAL" + + " SUBORDINATE SUPERIOR CLASS TRUE FALSE NULL" + + " TEXTUAL-CONVENTION"), + status: words("current deprecated mandatory obsolete"), + tags: words("APPLICATION AUTOMATIC EXPLICIT IMPLICIT PRIVATE TAGS" + + " UNIVERSAL"), + storage: words("BOOLEAN INTEGER OBJECT IDENTIFIER BIT OCTET STRING" + + " UTCTime InterfaceIndex IANAifType CMIP-Attribute" + + " REAL PACKAGE PACKAGES IpAddress PhysAddress" + + " NetworkAddress BITS BMPString TimeStamp TimeTicks" + + " TruthValue RowStatus DisplayString GeneralString" + + " GraphicString IA5String NumericString" + + " PrintableString SnmpAdminAtring TeletexString" + + " UTF8String VideotexString VisibleString StringStore" + + " ISO646String T61String UniversalString Unsigned32" + + " Integer32 Gauge Gauge32 Counter Counter32 Counter64"), + modifier: words("ATTRIBUTE ATTRIBUTES MANDATORY-GROUP MANDATORY-GROUPS" + + " GROUP GROUPS ELEMENTS EQUALITY ORDERING SUBSTRINGS" + + " DEFINED"), + accessTypes: words("not-accessible accessible-for-notify read-only" + + " read-create read-write"), + multiLineStrings: true + }); +}); diff --git a/media/editors/codemirror/mode/asn.1/asn.min.js b/media/editors/codemirror/mode/asn.1/asn.min.js new file mode 100644 index 0000000000000..7d682f74b3a57 --- /dev/null +++ b/media/editors/codemirror/mode/asn.1/asn.min.js @@ -0,0 +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){for(var b={},c=a.split(" "),d=0;d?$/.test(e)?(c.extenExten=!0,c.extenStart=!1,"strong"):(c.extenStart=!1,b.skipToEnd(),"error")):c.extenExten?(c.extenExten=!1,c.extenPriority=!0,b.eatWhile(/[^,]/),c.extenInclude&&(b.skipToEnd(),c.extenPriority=!1,c.extenInclude=!1),c.extenSame&&(c.extenPriority=!1,c.extenSame=!1,c.extenApplication=!0),"tag"):c.extenPriority?(c.extenPriority=!1,c.extenApplication=!0,b.next(),c.extenSame?null:(b.eatWhile(/[^,]/),"number")):c.extenApplication?(b.eatWhile(/,/),e=b.current(),","===e?null:(b.eatWhile(/\w/),e=b.current().toLowerCase(),c.extenApplication=!1,-1!==d.indexOf(e)?"def strong":null)):a(b,c)}}}),a.defineMIME("text/x-asterisk","asterisk")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/clike/clike.js b/media/editors/codemirror/mode/clike/clike.js index b04b22b167f9a..c5469eb27d176 100644 --- a/media/editors/codemirror/mode/clike/clike.js +++ b/media/editors/codemirror/mode/clike/clike.js @@ -16,15 +16,18 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { statementIndentUnit = parserConfig.statementIndentUnit || indentUnit, dontAlignCalls = parserConfig.dontAlignCalls, keywords = parserConfig.keywords || {}, + types = parserConfig.types || {}, builtin = parserConfig.builtin || {}, blockKeywords = parserConfig.blockKeywords || {}, + defKeywords = parserConfig.defKeywords || {}, atoms = parserConfig.atoms || {}, hooks = parserConfig.hooks || {}, multiLineStrings = parserConfig.multiLineStrings, - indentStatements = parserConfig.indentStatements !== false; + indentStatements = parserConfig.indentStatements !== false, + indentSwitch = parserConfig.indentSwitch !== false; var isOperatorChar = /[+\-*&%=<>!?|\/]/; - var curPunc; + var curPunc, isDefKeyword; function tokenBase(stream, state) { var ch = stream.next(); @@ -62,8 +65,10 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { var cur = stream.current(); if (keywords.propertyIsEnumerable(cur)) { if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement"; + if (defKeywords.propertyIsEnumerable(cur)) isDefKeyword = true; return "keyword"; } + if (types.propertyIsEnumerable(cur)) return "variable-3"; if (builtin.propertyIsEnumerable(cur)) { if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement"; return "builtin"; @@ -104,9 +109,12 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { this.align = align; this.prev = prev; } + function isStatement(context) { + return context.type == "statement" || context.type == "switchstatement"; + } function pushContext(state, col, type) { var indent = state.indented; - if (state.context && state.context.type == "statement") + if (state.context && isStatement(state.context)) indent = state.context.indented; return state.context = new Context(indent, col, type, null, state.context); } @@ -117,6 +125,11 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { return state.context = state.context.prev; } + function typeBefore(stream, state) { + if (state.prevToken == "variable" || state.prevToken == "variable-3") return true; + if (/\S[>*\]]\s*$|\*$/.test(stream.string.slice(0, stream.start))) return true; + } + // Interface return { @@ -125,7 +138,8 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { tokenize: null, context: new Context((basecolumn || 0) - indentUnit, 0, "top", false), indented: 0, - startOfLine: true + startOfLine: true, + prevToken: null }; }, @@ -137,41 +151,59 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { state.startOfLine = true; } if (stream.eatSpace()) return null; - curPunc = null; + curPunc = isDefKeyword = null; var style = (state.tokenize || tokenBase)(stream, state); if (style == "comment" || style == "meta") return style; if (ctx.align == null) ctx.align = true; - if ((curPunc == ";" || curPunc == ":" || curPunc == ",") && ctx.type == "statement") popContext(state); + if ((curPunc == ";" || curPunc == ":" || curPunc == ",") && isStatement(ctx)) popContext(state); else if (curPunc == "{") pushContext(state, stream.column(), "}"); else if (curPunc == "[") pushContext(state, stream.column(), "]"); else if (curPunc == "(") pushContext(state, stream.column(), ")"); else if (curPunc == "}") { - while (ctx.type == "statement") ctx = popContext(state); + while (isStatement(ctx)) ctx = popContext(state); if (ctx.type == "}") ctx = popContext(state); - while (ctx.type == "statement") ctx = popContext(state); + while (isStatement(ctx)) ctx = popContext(state); } else if (curPunc == ctx.type) popContext(state); else if (indentStatements && (((ctx.type == "}" || ctx.type == "top") && curPunc != ';') || - (ctx.type == "statement" && curPunc == "newstatement"))) - pushContext(state, stream.column(), "statement"); + (isStatement(ctx) && curPunc == "newstatement"))) { + var type = "statement" + if (curPunc == "newstatement" && indentSwitch && stream.current() == "switch") + type = "switchstatement" + pushContext(state, stream.column(), type); + } + + if (style == "variable" && + ((state.prevToken == "def" || + (parserConfig.typeFirstDefinitions && typeBefore(stream, state) && + stream.match(/^\s*\(/, false))))) + style = "def"; + state.startOfLine = false; + state.prevToken = isDefKeyword ? "def" : style; return style; }, indent: function(state, textAfter) { if (state.tokenize != tokenBase && state.tokenize != null) return CodeMirror.Pass; var ctx = state.context, firstChar = textAfter && textAfter.charAt(0); - if (ctx.type == "statement" && firstChar == "}") ctx = ctx.prev; + if (isStatement(ctx) && firstChar == "}") ctx = ctx.prev; var closing = firstChar == ctx.type; - if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : statementIndentUnit); - else if (ctx.align && (!dontAlignCalls || ctx.type != ")")) return ctx.column + (closing ? 0 : 1); - else if (ctx.type == ")" && !closing) return ctx.indented + statementIndentUnit; - else return ctx.indented + (closing ? 0 : indentUnit); + var switchBlock = ctx.prev && ctx.prev.type == "switchstatement"; + if (isStatement(ctx)) + return ctx.indented + (firstChar == "{" ? 0 : statementIndentUnit); + if (ctx.align && (!dontAlignCalls || ctx.type != ")")) + return ctx.column + (closing ? 0 : 1); + if (ctx.type == ")" && !closing) + return ctx.indented + statementIndentUnit; + + return ctx.indented + (closing ? 0 : indentUnit) + + (!closing && switchBlock && !/^(?:case|default)\b/.test(textAfter) ? indentUnit : 0); }, - electricChars: "{}", + electricInput: indentSwitch ? /^\s*(?:case .*?:|default:|\{|\})$/ : /^\s*[{}]$/, blockCommentStart: "/*", blockCommentEnd: "*/", lineComment: "//", @@ -184,9 +216,10 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { for (var i = 0; i < words.length; ++i) obj[words[i]] = true; return obj; } - var cKeywords = "auto if break int case long char register continue return default short do sizeof " + - "double static else struct entry switch extern typedef float union for unsigned " + - "goto while enum void const signed volatile"; + var cKeywords = "auto if break case register continue return default do sizeof " + + "static else struct switch extern typedef float union for " + + "goto while enum const volatile true false"; + var cTypes = "int long char short double float unsigned signed void size_t ptrdiff_t"; function cppHook(stream, state) { if (!state.startOfLine) return false; @@ -206,6 +239,11 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { return "meta"; } + function pointerHook(_stream, state) { + if (state.prevToken == "variable-3") return "variable-3"; + return false; + } + function cpp11StringHook(stream, state) { stream.backUp(1); // Raw strings. @@ -263,6 +301,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { words.push(prop); } add(mode.keywords); + add(mode.types); add(mode.builtin); add(mode.atoms); if (words.length) { @@ -277,9 +316,14 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { def(["text/x-csrc", "text/x-c", "text/x-chdr"], { name: "clike", keywords: words(cKeywords), + types: words(cTypes + " bool _Complex _Bool float_t double_t intptr_t intmax_t " + + "int8_t int16_t int32_t int64_t uintptr_t uintmax_t uint8_t uint16_t " + + "uint32_t uint64_t"), blockKeywords: words("case do else for if switch while struct"), + defKeywords: words("struct"), + typeFirstDefinitions: true, atoms: words("null"), - hooks: {"#": cppHook}, + hooks: {"#": cppHook, "*": pointerHook}, modeProps: {fold: ["brace", "include"]} }); @@ -290,10 +334,14 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { "this using const_cast inline public throw virtual delete mutable protected " + "wchar_t alignas alignof constexpr decltype nullptr noexcept thread_local final " + "static_assert override"), + types: words(cTypes + "bool wchar_t"), blockKeywords: words("catch class do else finally for if struct switch try while"), + defKeywords: words("class namespace struct enum union"), + typeFirstDefinitions: true, atoms: words("true false null"), hooks: { "#": cppHook, + "*": pointerHook, "u": cpp11StringHook, "U": cpp11StringHook, "L": cpp11StringHook, @@ -304,12 +352,16 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { def("text/x-java", { name: "clike", - keywords: words("abstract assert boolean break byte case catch char class const continue default " + - "do double else enum extends final finally float for goto if implements import " + - "instanceof int interface long native new package private protected public " + - "return short static strictfp super switch synchronized this throw throws transient " + - "try void volatile while"), + keywords: words("abstract assert break case catch class const continue default " + + "do else enum extends final finally float for goto if implements import " + + "instanceof interface native new package private protected public " + + "return static strictfp super switch synchronized this throw throws transient " + + "try volatile while"), + types: words("byte short int long float double boolean char void Boolean Byte Character Double Float " + + "Integer Long Number Object Short String StringBuffer StringBuilder Void"), blockKeywords: words("catch class do else finally for if switch try while"), + defKeywords: words("class interface package enum"), + typeFirstDefinitions: true, atoms: words("true false null"), hooks: { "@": function(stream) { @@ -322,18 +374,20 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { def("text/x-csharp", { name: "clike", - keywords: words("abstract as base break case catch checked class const continue" + + keywords: words("abstract as async await base break case catch checked class const continue" + " default delegate do else enum event explicit extern finally fixed for" + " foreach goto if implicit in interface internal is lock namespace new" + " operator out override params private protected public readonly ref return sealed" + " sizeof stackalloc static struct switch this throw try typeof unchecked" + " unsafe using virtual void volatile while add alias ascending descending dynamic from get" + " global group into join let orderby partial remove select set value var yield"), + types: words("Action Boolean Byte Char DateTime DateTimeOffset Decimal Double Func" + + " Guid Int16 Int32 Int64 Object SByte Single String Task TimeSpan UInt16 UInt32" + + " UInt64 bool byte char decimal double short int long object" + + " sbyte float string ushort uint ulong"), blockKeywords: words("catch class do else finally for foreach if struct switch try while"), - builtin: words("Boolean Byte Char DateTime DateTimeOffset Decimal Double" + - " Guid Int16 Int32 Int64 Object SByte Single String TimeSpan UInt16 UInt32" + - " UInt64 bool byte char decimal double short int long object" + - " sbyte float string ushort uint ulong"), + defKeywords: words("class interface namespace struct var"), + typeFirstDefinitions: true, atoms: words("true false null"), hooks: { "@": function(stream, state) { @@ -354,7 +408,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { state.tokenize = null; break; } - escaped = stream.next() != "\\" && !escaped; + escaped = stream.next() == "\\" && !escaped; } return "string"; } @@ -366,18 +420,21 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { /* scala */ "abstract case catch class def do else extends false final finally for forSome if " + "implicit import lazy match new null object override package private protected return " + - "sealed super this throw trait try trye type val var while with yield _ : = => <- <: " + + "sealed super this throw trait try type val var while with yield _ : = => <- <: " + "<% >: # @ " + /* package scala */ "assert assume require print println printf readLine readBoolean readByte readShort " + "readChar readInt readLong readFloat readDouble " + + ":: #:: " + ), + types: words( "AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either " + "Enumeration Equiv Error Exception Fractional Function IndexedSeq Integral Iterable " + "Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering " + "Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder " + - "StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector :: #:: " + + "StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector " + /* package java.lang */ "Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable " + @@ -387,8 +444,10 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { ), multiLineStrings: true, blockKeywords: words("catch class do else finally for forSome if match switch try while"), + defKeywords: words("class def object package trait type val var"), atoms: words("true false null"), indentStatements: false, + indentSwitch: false, hooks: { "@": function(stream) { stream.eatWhile(/[\w\$_]/); @@ -398,21 +457,26 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { if (!stream.match('""')) return false; state.tokenize = tokenTripleString; return state.tokenize(stream, state); + }, + "'": function(stream) { + stream.eatWhile(/[\w\$_\xa1-\uffff]/); + return "atom"; } - } + }, + modeProps: {closeBrackets: {triples: '"'}} }); def(["x-shader/x-vertex", "x-shader/x-fragment"], { name: "clike", - keywords: words("float int bool void " + - "vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 " + - "mat2 mat3 mat4 " + - "sampler1D sampler2D sampler3D samplerCube " + + keywords: words("sampler1D sampler2D sampler3D samplerCube " + "sampler1DShadow sampler2DShadow " + "const attribute uniform varying " + "break continue discard return " + "for while do if else struct " + "in out inout"), + types: words("float int bool void " + + "vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 " + + "mat2 mat3 mat4"), blockKeywords: words("for while do if else struct"), builtin: words("radians degrees sin cos tan asin acos atan " + "pow exp log exp2 sqrt inversesqrt " + @@ -456,6 +520,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { "gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits " + "gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits " + "gl_MaxDrawBuffers"), + indentSwitch: false, hooks: {"#": cppHook}, modeProps: {fold: ["brace", "include"]} }); @@ -465,6 +530,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { keywords: words(cKeywords + "as atomic async call command component components configuration event generic " + "implementation includes interface module new norace nx_struct nx_union post provides " + "signal task uses abstract extends"), + types: words(cTypes), blockKeywords: words("case do else for if switch while struct"), atoms: words("null"), hooks: {"#": cppHook}, @@ -475,6 +541,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { name: "clike", keywords: words(cKeywords + "inline restrict _Bool _Complex _Imaginery BOOL Class bycopy byref id IMP in " + "inout nil oneway out Protocol SEL self super atomic nonatomic retain copy readwrite readonly"), + types: words(cTypes), atoms: words("YES NO NULL NILL ON OFF"), hooks: { "@": function(stream) { diff --git a/media/editors/codemirror/mode/clike/clike.min.js b/media/editors/codemirror/mode/clike/clike.min.js new file mode 100644 index 0000000000000..548e89ef22829 --- /dev/null +++ b/media/editors/codemirror/mode/clike/clike.min.js @@ -0,0 +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){for(var b={},c=a.split(" "),d=0;d*\]]\s*$|\*$/.test(a.string.slice(0,a.start))?!0:void 0}var l,m,n=b.indentUnit,o=c.statementIndentUnit||n,p=c.dontAlignCalls,q=c.keywords||{},r=c.types||{},s=c.builtin||{},t=c.blockKeywords||{},u=c.defKeywords||{},v=c.atoms||{},w=c.hooks||{},x=c.multiLineStrings,y=c.indentStatements!==!1,z=c.indentSwitch!==!1,A=/[+\-*&%=<>!?|\/]/;return{startState:function(a){return{tokenize:null,context:new g((a||0)-n,0,"top",!1),indented:0,startOfLine:!0,prevToken:null}},token:function(a,b){var e=b.context;if(a.sol()&&(null==e.align&&(e.align=!1),b.indented=a.indentation(),b.startOfLine=!0),a.eatSpace())return null;l=m=null;var f=(b.tokenize||d)(a,b);if("comment"==f||"meta"==f)return f;if(null==e.align&&(e.align=!0),";"!=l&&":"!=l&&","!=l||!h(e)){if("{"==l)i(b,a.column(),"}");else if("["==l)i(b,a.column(),"]");else if("("==l)i(b,a.column(),")");else if("}"==l){for(;h(e);)e=j(b);for("}"==e.type&&(e=j(b));h(e);)e=j(b)}else if(l==e.type)j(b);else if(y&&(("}"==e.type||"top"==e.type)&&";"!=l||h(e)&&"newstatement"==l)){var g="statement";"newstatement"==l&&z&&"switch"==a.current()&&(g="switchstatement"),i(b,a.column(),g)}}else j(b);return"variable"==f&&("def"==b.prevToken||c.typeFirstDefinitions&&k(a,b)&&a.match(/^\s*\(/,!1))&&(f="def"),b.startOfLine=!1,b.prevToken=m?"def":f,f},indent:function(b,c){if(b.tokenize!=d&&null!=b.tokenize)return a.Pass;var e=b.context,f=c&&c.charAt(0);h(e)&&"}"==f&&(e=e.prev);var g=f==e.type,i=e.prev&&"switchstatement"==e.prev.type;return h(e)?e.indented+("{"==f?0:o):!e.align||p&&")"==e.type?")"!=e.type||g?e.indented+(g?0:n)+(g||!i||/^(?:case|default)\b/.test(c)?0:n):e.indented+o:e.column+(g?0:1)},electricInput:z?/^\s*(?:case .*?:|default:|\{|\})$/:/^\s*[{}]$/,blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",fold:"brace"}});var j="auto if break case register continue return default do sizeof static else struct switch extern typedef float union for goto while enum const volatile true false",k="int long char short double float unsigned signed void size_t ptrdiff_t";h(["text/x-csrc","text/x-c","text/x-chdr"],{name:"clike",keywords:b(j),types:b(k+" bool _Complex _Bool float_t double_t intptr_t intmax_t int8_t int16_t int32_t int64_t uintptr_t uintmax_t uint8_t uint16_t uint32_t uint64_t"),blockKeywords:b("case do else for if switch while struct"),defKeywords:b("struct"),typeFirstDefinitions:!0,atoms:b("null"),hooks:{"#":c,"*":d},modeProps:{fold:["brace","include"]}}),h(["text/x-c++src","text/x-c++hdr"],{name:"clike",keywords:b(j+" asm dynamic_cast namespace reinterpret_cast try bool explicit new static_cast typeid catch operator template typename class friend private this using const_cast inline public throw virtual delete mutable protected wchar_t alignas alignof constexpr decltype nullptr noexcept thread_local final static_assert override"),types:b(k+"bool wchar_t"),blockKeywords:b("catch class do else finally for if struct switch try while"),defKeywords:b("class namespace struct enum union"),typeFirstDefinitions:!0,atoms:b("true false null"),hooks:{"#":c,"*":d,u:e,U:e,L:e,R:e},modeProps:{fold:["brace","include"]}}),h("text/x-java",{name:"clike",keywords:b("abstract assert break case catch class const continue default do else enum extends final finally float for goto if implements import instanceof interface native new package private protected public return static strictfp super switch synchronized this throw throws transient try volatile while"),types:b("byte short int long float double boolean char void Boolean Byte Character Double Float Integer Long Number Object Short String StringBuffer StringBuilder Void"),blockKeywords:b("catch class do else finally for if switch try while"),defKeywords:b("class interface package enum"),typeFirstDefinitions:!0,atoms:b("true false null"),hooks:{"@":function(a){return a.eatWhile(/[\w\$_]/),"meta"}},modeProps:{fold:["brace","import"]}}),h("text/x-csharp",{name:"clike",keywords:b("abstract as async await base break case catch checked class const continue default delegate do else enum event explicit extern finally fixed for foreach goto if implicit in interface internal is lock namespace new operator out override params private protected public readonly ref return sealed sizeof stackalloc static struct switch this throw try typeof unchecked unsafe using virtual void volatile while add alias ascending descending dynamic from get global group into join let orderby partial remove select set value var yield"),types:b("Action Boolean Byte Char DateTime DateTimeOffset Decimal Double Func Guid Int16 Int32 Int64 Object SByte Single String Task TimeSpan UInt16 UInt32 UInt64 bool byte char decimal double short int long object sbyte float string ushort uint ulong"),blockKeywords:b("catch class do else finally for foreach if struct switch try while"),defKeywords:b("class interface namespace struct var"),typeFirstDefinitions:!0,atoms:b("true false null"),hooks:{"@":function(a,b){return a.eat('"')?(b.tokenize=f,f(a,b)):(a.eatWhile(/[\w\$_]/),"meta")}}}),h("text/x-scala",{name:"clike",keywords:b("abstract case catch class def do else extends false final finally for forSome if implicit import lazy match new null object override package private protected return sealed super this throw trait try type val var while with yield _ : = => <- <: <% >: # @ assert assume require print println printf readLine readBoolean readByte readShort readChar readInt readLong readFloat readDouble :: #:: "),types:b("AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either Enumeration Equiv Error Exception Fractional Function IndexedSeq Integral Iterable Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"),multiLineStrings:!0,blockKeywords:b("catch class do else finally for forSome if match switch try while"),defKeywords:b("class def object package trait type val var"),atoms:b("true false null"),indentStatements:!1,indentSwitch:!1,hooks:{"@":function(a){return a.eatWhile(/[\w\$_]/),"meta"},'"':function(a,b){return a.match('""')?(b.tokenize=i,b.tokenize(a,b)):!1},"'":function(a){return a.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"}},modeProps:{closeBrackets:{triples:'"'}}}),h(["x-shader/x-vertex","x-shader/x-fragment"],{name:"clike",keywords:b("sampler1D sampler2D sampler3D samplerCube sampler1DShadow sampler2DShadow const attribute uniform varying break continue discard return for while do if else struct in out inout"),types:b("float int bool void vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 mat2 mat3 mat4"),blockKeywords:b("for while do if else struct"),builtin:b("radians degrees sin cos tan asin acos atan pow exp log exp2 sqrt inversesqrt abs sign floor ceil fract mod min max clamp mix step smoothstep length distance dot cross normalize ftransform faceforward reflect refract matrixCompMult lessThan lessThanEqual greaterThan greaterThanEqual equal notEqual any all not texture1D texture1DProj texture1DLod texture1DProjLod texture2D texture2DProj texture2DLod texture2DProjLod texture3D texture3DProj texture3DLod texture3DProjLod textureCube textureCubeLod shadow1D shadow2D shadow1DProj shadow2DProj shadow1DLod shadow2DLod shadow1DProjLod shadow2DProjLod dFdx dFdy fwidth noise1 noise2 noise3 noise4"),atoms:b("true false gl_FragColor gl_SecondaryColor gl_Normal gl_Vertex gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_FogCoord gl_PointCoord gl_Position gl_PointSize gl_ClipVertex gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor gl_TexCoord gl_FogFragCoord gl_FragCoord gl_FrontFacing gl_FragData gl_FragDepth gl_ModelViewMatrix gl_ProjectionMatrix gl_ModelViewProjectionMatrix gl_TextureMatrix gl_NormalMatrix gl_ModelViewMatrixInverse gl_ProjectionMatrixInverse gl_ModelViewProjectionMatrixInverse gl_TexureMatrixTranspose gl_ModelViewMatrixInverseTranspose gl_ProjectionMatrixInverseTranspose gl_ModelViewProjectionMatrixInverseTranspose gl_TextureMatrixInverseTranspose gl_NormalScale gl_DepthRange gl_ClipPlane gl_Point gl_FrontMaterial gl_BackMaterial gl_LightSource gl_LightModel gl_FrontLightModelProduct gl_BackLightModelProduct gl_TextureColor gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR gl_EyePlaneQ gl_FogParameters gl_MaxLights gl_MaxClipPlanes gl_MaxTextureUnits gl_MaxTextureCoords gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingFloats gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits gl_MaxDrawBuffers"),indentSwitch:!1,hooks:{"#":c},modeProps:{fold:["brace","include"]}}),h("text/x-nesc",{name:"clike",keywords:b(j+"as atomic async call command component components configuration event generic implementation includes interface module new norace nx_struct nx_union post provides signal task uses abstract extends"),types:b(k),blockKeywords:b("case do else for if switch while struct"),atoms:b("null"),hooks:{"#":c},modeProps:{fold:["brace","include"]}}),h("text/x-objectivec",{name:"clike",keywords:b(j+"inline restrict _Bool _Complex _Imaginery BOOL Class bycopy byref id IMP in inout nil oneway out Protocol SEL self super atomic nonatomic retain copy readwrite readonly"),types:b(k),atoms:b("YES NO NULL NILL ON OFF"),hooks:{"@":function(a){return a.eatWhile(/[\w\$]/),"keyword"},"#":c},modeProps:{fold:"brace"}})}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/clike/scala.html b/media/editors/codemirror/mode/clike/scala.html deleted file mode 100644 index aa04cf0f04af5..0000000000000 --- a/media/editors/codemirror/mode/clike/scala.html +++ /dev/null @@ -1,767 +0,0 @@ - - -CodeMirror: Scala mode - - - - - - - - - - -
    -

    Scala mode

    - - - - - -
    diff --git a/media/editors/codemirror/mode/clojure/clojure.js b/media/editors/codemirror/mode/clojure/clojure.js index c334de730077a..d531022a2ebfe 100644 --- a/media/editors/codemirror/mode/clojure/clojure.js +++ b/media/editors/codemirror/mode/clojure/clojure.js @@ -234,6 +234,7 @@ CodeMirror.defineMode("clojure", function (options) { return state.indentStack.indent; }, + closeBrackets: {pairs: "()[]{}\"\""}, lineComment: ";;" }; }); diff --git a/media/editors/codemirror/mode/clojure/clojure.min.js b/media/editors/codemirror/mode/clojure/clojure.min.js new file mode 100644 index 0000000000000..5342660960552 --- /dev/null +++ b/media/editors/codemirror/mode/clojure/clojure.min.js @@ -0,0 +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("clojure",function(a){function b(a){for(var b={},c=a.split(" "),d=0;d ->> doto and or dosync doseq dotimes dorun doall load import unimport ns in-ns refer try catch finally throw with-open with-local-vars binding gen-class gen-and-load-class gen-and-save-class handler-case handle"),u=b("* *' *1 *2 *3 *agent* *allow-unresolved-vars* *assert* *clojure-version* *command-line-args* *compile-files* *compile-path* *compiler-options* *data-readers* *e *err* *file* *flush-on-newline* *fn-loader* *in* *math-context* *ns* *out* *print-dup* *print-length* *print-level* *print-meta* *print-readably* *read-eval* *source-path* *unchecked-math* *use-context-classloader* *verbose-defrecords* *warn-on-reflection* + +' - -' -> ->> ->ArrayChunk ->Vec ->VecNode ->VecSeq -cache-protocol-fn -reset-methods .. / < <= = == > >= EMPTY-NODE accessor aclone add-classpath add-watch agent agent-error agent-errors aget alength alias all-ns alter alter-meta! alter-var-root amap ancestors and apply areduce array-map aset aset-boolean aset-byte aset-char aset-double aset-float aset-int aset-long aset-short assert assoc assoc! assoc-in associative? atom await await-for await1 bases bean bigdec bigint biginteger binding bit-and bit-and-not bit-clear bit-flip bit-not bit-or bit-set bit-shift-left bit-shift-right bit-test bit-xor boolean boolean-array booleans bound-fn bound-fn* bound? butlast byte byte-array bytes case cast char char-array char-escape-string char-name-string char? chars chunk chunk-append chunk-buffer chunk-cons chunk-first chunk-next chunk-rest chunked-seq? class class? clear-agent-errors clojure-version coll? comment commute comp comparator compare compare-and-set! compile complement concat cond condp conj conj! cons constantly construct-proxy contains? count counted? create-ns create-struct cycle dec dec' decimal? declare default-data-readers definline definterface defmacro defmethod defmulti defn defn- defonce defprotocol defrecord defstruct deftype delay delay? deliver denominator deref derive descendants destructure disj disj! dissoc dissoc! distinct distinct? doall dorun doseq dosync dotimes doto double double-array doubles drop drop-last drop-while empty empty? ensure enumeration-seq error-handler error-mode eval even? every-pred every? ex-data ex-info extend extend-protocol extend-type extenders extends? false? ffirst file-seq filter filterv find find-keyword find-ns find-protocol-impl find-protocol-method find-var first flatten float float-array float? floats flush fn fn? fnext fnil for force format frequencies future future-call future-cancel future-cancelled? future-done? future? gen-class gen-interface gensym get get-in get-method get-proxy-class get-thread-bindings get-validator group-by hash hash-combine hash-map hash-set identical? identity if-let if-not ifn? import in-ns inc inc' init-proxy instance? int int-array integer? interleave intern interpose into into-array ints io! isa? iterate iterator-seq juxt keep keep-indexed key keys keyword keyword? last lazy-cat lazy-seq let letfn line-seq list list* list? load load-file load-reader load-string loaded-libs locking long long-array longs loop macroexpand macroexpand-1 make-array make-hierarchy map map-indexed map? mapcat mapv max max-key memfn memoize merge merge-with meta method-sig methods min min-key mod munge name namespace namespace-munge neg? newline next nfirst nil? nnext not not-any? not-empty not-every? not= ns ns-aliases ns-imports ns-interns ns-map ns-name ns-publics ns-refers ns-resolve ns-unalias ns-unmap nth nthnext nthrest num number? numerator object-array odd? or parents partial partition partition-all partition-by pcalls peek persistent! pmap pop pop! pop-thread-bindings pos? pr pr-str prefer-method prefers primitives-classnames print print-ctor print-dup print-method print-simple print-str printf println println-str prn prn-str promise proxy proxy-call-with-super proxy-mappings proxy-name proxy-super push-thread-bindings pvalues quot rand rand-int rand-nth range ratio? rational? rationalize re-find re-groups re-matcher re-matches re-pattern re-seq read read-line read-string realized? reduce reduce-kv reductions ref ref-history-count ref-max-history ref-min-history ref-set refer refer-clojure reify release-pending-sends rem remove remove-all-methods remove-method remove-ns remove-watch repeat repeatedly replace replicate require reset! reset-meta! resolve rest restart-agent resultset-seq reverse reversible? rseq rsubseq satisfies? second select-keys send send-off seq seq? seque sequence sequential? set set-error-handler! set-error-mode! set-validator! set? short short-array shorts shuffle shutdown-agents slurp some some-fn sort sort-by sorted-map sorted-map-by sorted-set sorted-set-by sorted? special-symbol? spit split-at split-with str string? struct struct-map subs subseq subvec supers swap! symbol symbol? sync take take-last take-nth take-while test the-ns thread-bound? time to-array to-array-2d trampoline transient tree-seq true? type unchecked-add unchecked-add-int unchecked-byte unchecked-char unchecked-dec unchecked-dec-int unchecked-divide-int unchecked-double unchecked-float unchecked-inc unchecked-inc-int unchecked-int unchecked-long unchecked-multiply unchecked-multiply-int unchecked-negate unchecked-negate-int unchecked-remainder-int unchecked-short unchecked-subtract unchecked-subtract-int underive unquote unquote-splicing update-in update-proxy use val vals var-get var-set var? vary-meta vec vector vector-of vector? when when-first when-let when-not while with-bindings with-bindings* with-in-str with-loading-context with-local-vars with-meta with-open with-out-str with-precision with-redefs with-redefs-fn xml-seq zero? zipmap *default-data-reader-fn* as-> cond-> cond->> reduced reduced? send-via set-agent-send-executor! set-agent-send-off-executor! some-> some->>"),v=b("ns fn def defn defmethod bound-fn if if-not case condp when while when-not when-first do future comment doto locking proxy with-open with-precision reify deftype defrecord defprotocol extend extend-protocol extend-type try catch let letfn binding loop for doseq dotimes when-let if-let defstruct struct-map assoc testing deftest handler-case handle dotrace deftrace"),w={digit:/\d/,digit_or_colon:/[\d:]/,hex:/[0-9a-f]/i,sign:/[+-]/,exponent:/e/i,keyword_char:/[^\s\(\[\;\)\]]/,symbol:/[\w*+!\-\._?:<>\/\xa1-\uffff]/};return{startState:function(){return{indentStack:null,indentation:0,mode:!1}},token:function(a,b){if(null==b.indentStack&&a.sol()&&(b.indentation=a.indentation()),a.eatSpace())return null;var c=null;switch(b.mode){case"string":for(var x,y=!1;null!=(x=a.next());){if('"'==x&&!y){b.mode=!1;break}y=!y&&"\\"==x}c=j;break;default:var z=a.next();if('"'==z)b.mode="string",c=j;else if("\\"==z)g(a),c=k;else if("'"!=z||w.digit_or_colon.test(a.peek()))if(";"==z)a.skipToEnd(),c=i;else if(f(z,a))c=m;else if("("==z||"["==z||"{"==z){var A,B="",C=a.column();if("("==z)for(;null!=(A=a.eat(w.keyword_char));)B+=A;B.length>0&&(v.propertyIsEnumerable(B)||/^(?:def|with)/.test(B))?d(b,C+q,z):(a.eatSpace(),a.eol()||";"==a.peek()?d(b,C+r,z):d(b,C+a.current().length,z)),a.backUp(a.current().length-1),c=n}else if(")"==z||"]"==z||"}"==z)c=n,null!=b.indentStack&&b.indentStack.type==(")"==z?"(":"]"==z?"[":"{")&&e(b);else{if(":"==z)return a.eatWhile(w.symbol),l;a.eatWhile(w.symbol),c=t&&t.propertyIsEnumerable(a.current())?o:u&&u.propertyIsEnumerable(a.current())?h:s&&s.propertyIsEnumerable(a.current())?l:p}else c=l}return c},indent:function(a){return null==a.indentStack?a.indentation:a.indentStack.indent},closeBrackets:{pairs:'()[]{}""'},lineComment:";;"}}),a.defineMIME("text/x-clojure","clojure")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/cmake/cmake.js b/media/editors/codemirror/mode/cmake/cmake.js new file mode 100644 index 0000000000000..9f9eda5417d37 --- /dev/null +++ b/media/editors/codemirror/mode/cmake/cmake.js @@ -0,0 +1,97 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) + define(["../../lib/codemirror"], mod); + else + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.defineMode("cmake", function () { + var variable_regex = /({)?[a-zA-Z0-9_]+(})?/; + + function tokenString(stream, state) { + var current, prev, found_var = false; + while (!stream.eol() && (current = stream.next()) != state.pending) { + if (current === '$' && prev != '\\' && state.pending == '"') { + found_var = true; + break; + } + prev = current; + } + if (found_var) { + stream.backUp(1); + } + if (current == state.pending) { + state.continueString = false; + } else { + state.continueString = true; + } + return "string"; + } + + function tokenize(stream, state) { + var ch = stream.next(); + + // Have we found a variable? + if (ch === '$') { + if (stream.match(variable_regex)) { + return 'variable-2'; + } + return 'variable'; + } + // Should we still be looking for the end of a string? + if (state.continueString) { + // If so, go through the loop again + stream.backUp(1); + return tokenString(stream, state); + } + // Do we just have a function on our hands? + // In 'cmake_minimum_required (VERSION 2.8.8)', 'cmake_minimum_required' is matched + if (stream.match(/(\s+)?\w+\(/) || stream.match(/(\s+)?\w+\ \(/)) { + stream.backUp(1); + return 'def'; + } + if (ch == "#") { + stream.skipToEnd(); + return "comment"; + } + // Have we found a string? + if (ch == "'" || ch == '"') { + // Store the type (single or double) + state.pending = ch; + // Perform the looping function to find the end + return tokenString(stream, state); + } + if (ch == '(' || ch == ')') { + return 'bracket'; + } + if (ch.match(/[0-9]/)) { + return 'number'; + } + stream.eatWhile(/[\w-]/); + return null; + } + return { + startState: function () { + var state = {}; + state.inDefinition = false; + state.inInclude = false; + state.continueString = false; + state.pending = false; + return state; + }, + token: function (stream, state) { + if (stream.eatSpace()) return null; + return tokenize(stream, state); + } + }; +}); + +CodeMirror.defineMIME("text/x-cmake", "cmake"); + +}); diff --git a/media/editors/codemirror/mode/cmake/cmake.min.js b/media/editors/codemirror/mode/cmake/cmake.min.js new file mode 100644 index 0000000000000..6d08346201436 --- /dev/null +++ b/media/editors/codemirror/mode/cmake/cmake.min.js @@ -0,0 +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("cmake",function(){function a(a,b){for(var c,d,e=!1;!a.eol()&&(c=a.next())!=b.pending;){if("$"===c&&"\\"!=d&&'"'==b.pending){e=!0;break}d=c}return e&&a.backUp(1),c==b.pending?b.continueString=!1:b.continueString=!0,"string"}function b(b,d){var e=b.next();return"$"===e?b.match(c)?"variable-2":"variable":d.continueString?(b.backUp(1),a(b,d)):b.match(/(\s+)?\w+\(/)||b.match(/(\s+)?\w+\ \(/)?(b.backUp(1),"def"):"#"==e?(b.skipToEnd(),"comment"):"'"==e||'"'==e?(d.pending=e,a(b,d)):"("==e||")"==e?"bracket":e.match(/[0-9]/)?"number":(b.eatWhile(/[\w-]/),null)}var c=/({)?[a-zA-Z0-9_]+(})?/;return{startState:function(){var a={};return a.inDefinition=!1,a.inInclude=!1,a.continueString=!1,a.pending=!1,a},token:function(a,c){return a.eatSpace()?null:b(a,c)}}}),a.defineMIME("text/x-cmake","cmake")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/cobol/cobol.min.js b/media/editors/codemirror/mode/cobol/cobol.min.js new file mode 100644 index 0000000000000..0e2014f16968e --- /dev/null +++ b/media/editors/codemirror/mode/cobol/cobol.min.js @@ -0,0 +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("cobol",function(){function a(a){for(var b={},c=a.split(" "),d=0;d >= "),o={digit:/\d/,digit_or_colon:/[\d:]/,hex:/[0-9a-f]/i,sign:/[+-]/,exponent:/e/i,keyword_char:/[^\s\(\[\;\)\]]/,symbol:/[\w*+\-]/};return{startState:function(){return{indentStack:null,indentation:0,mode:!1}},token:function(a,p){if(null==p.indentStack&&a.sol()&&(p.indentation=6),a.eatSpace())return null;var q=null;switch(p.mode){case"string":for(var r=!1;null!=(r=a.next());)if('"'==r||"'"==r){p.mode=!1;break}q=e;break;default:var s=a.next(),t=a.column();if(t>=0&&5>=t)q=j;else if(t>=72&&79>=t)a.skipToEnd(),q=i;else if("*"==s&&6==t)a.skipToEnd(),q=d;else if('"'==s||"'"==s)p.mode="string",q=e;else if("'"!=s||o.digit_or_colon.test(a.peek()))if("."==s)q=k;else if(b(s,a))q=g;else{if(a.current().match(o.symbol))for(;71>t&&void 0!==a.eat(o.symbol);)t++;q=m&&m.propertyIsEnumerable(a.current().toUpperCase())?h:n&&n.propertyIsEnumerable(a.current().toUpperCase())?c:l&&l.propertyIsEnumerable(a.current().toUpperCase())?f:null}else q=f}return q},indent:function(a){return null==a.indentStack?a.indentation:a.indentStack.indent}}}),a.defineMIME("text/x-cobol","cobol")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/coffeescript/coffeescript.min.js b/media/editors/codemirror/mode/coffeescript/coffeescript.min.js new file mode 100644 index 0000000000000..b463469ce5236 --- /dev/null +++ b/media/editors/codemirror/mode/coffeescript/coffeescript.min.js @@ -0,0 +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("coffeescript",function(a,b){function c(a){return new RegExp("^(("+a.join(")|(")+"))\\b")}function d(a,b){if(a.sol()){null===b.scope.align&&(b.scope.align=!1);var c=b.scope.offset;if(a.eatSpace()){var d=a.indentation();return d>c&&"coffee"==b.scope.type?"indent":c>d?"dedent":null}c>0&&h(a,b)}if(a.eatSpace())return null;var g=a.peek();if(a.match("####"))return a.skipToEnd(),"comment";if(a.match("###"))return b.tokenize=f,b.tokenize(a,b);if("#"===g)return a.skipToEnd(),"comment";if(a.match(/^-?[0-9\.]/,!1)){var i=!1;if(a.match(/^-?\d*\.\d+(e[\+\-]?\d+)?/i)&&(i=!0),a.match(/^-?\d+\.\d*/)&&(i=!0),a.match(/^-?\.\d+/)&&(i=!0),i)return"."==a.peek()&&a.backUp(1),"number";var p=!1;if(a.match(/^-?0x[0-9a-f]+/i)&&(p=!0),a.match(/^-?[1-9]\d*(e[\+\-]?\d+)?/)&&(p=!0),a.match(/^-?0(?![\dx])/i)&&(p=!0),p)return"number"}if(a.match(s))return b.tokenize=e(a.current(),!1,"string"),b.tokenize(a,b);if(a.match(t)){if("/"!=a.current()||a.match(/^.*\//,!1))return b.tokenize=e(a.current(),!0,"string-2"),b.tokenize(a,b);a.backUp(1)}return a.match(k)||a.match(o)?"operator":a.match(l)?"punctuation":a.match(v)?"atom":a.match(r)?"keyword":a.match(m)?"variable":a.match(n)?"property":(a.next(),j)}function e(a,c,e){return function(f,g){for(;!f.eol();)if(f.eatWhile(/[^'"\/\\]/),f.eat("\\")){if(f.next(),c&&f.eol())return e}else{if(f.match(a))return g.tokenize=d,e;f.eat(/['"\/]/)}return c&&(b.singleLineStringErrors?e=j:g.tokenize=d),e}}function f(a,b){for(;!a.eol();){if(a.eatWhile(/[^#]/),a.match("###")){b.tokenize=d;break}a.eatWhile("#")}return"comment"}function g(b,c,d){d=d||"coffee";for(var e=0,f=!1,g=null,h=c.scope;h;h=h.prev)if("coffee"===h.type||"}"==h.type){e=h.offset+a.indentUnit;break}"coffee"!==d?(f=null,g=b.column()+b.current().length):c.scope.align&&(c.scope.align=!1),c.scope={offset:e,type:d,prev:c.scope,align:f,alignOffset:g}}function h(a,b){if(b.scope.prev){if("coffee"===b.scope.type){for(var c=a.indentation(),d=!1,e=b.scope;e;e=e.prev)if(c===e.offset){d=!0;break}if(!d)return!0;for(;b.scope.prev&&b.scope.offset!==c;)b.scope=b.scope.prev;return!1}return b.scope=b.scope.prev,!1}}function i(a,b){var c=b.tokenize(a,b),d=a.current();if("."===d)return c=b.tokenize(a,b),d=a.current(),/^\.[\w$]+$/.test(d)?"variable":j;"return"===d&&(b.dedent=!0),("->"!==d&&"=>"!==d||b.lambda||a.peek())&&"indent"!==c||g(a,b);var e="[({".indexOf(d);if(-1!==e&&g(a,b,"])}".slice(e,e+1)),p.exec(d)&&g(a,b),"then"==d&&h(a,b),"dedent"===c&&h(a,b))return j;if(e="])}".indexOf(d),-1!==e){for(;"coffee"==b.scope.type&&b.scope.prev;)b.scope=b.scope.prev;b.scope.type==d&&(b.scope=b.scope.prev)}return b.dedent&&a.eol()&&("coffee"==b.scope.type&&b.scope.prev&&(b.scope=b.scope.prev),b.dedent=!1),c}var j="error",k=/^(?:->|=>|\+[+=]?|-[\-=]?|\*[\*=]?|\/[\/=]?|[=!]=|<[><]?=?|>>?=?|%=?|&=?|\|=?|\^=?|\~|!|\?|(or|and|\|\||&&|\?)=)/,l=/^(?:[()\[\]{},:`=;]|\.\.?\.?)/,m=/^[_A-Za-z$][_A-Za-z$0-9]*/,n=/^(@|this\.)[_A-Za-z$][_A-Za-z$0-9]*/,o=c(["and","or","not","is","isnt","in","instanceof","typeof"]),p=["for","while","loop","if","unless","else","switch","try","catch","finally","class"],q=["break","by","continue","debugger","delete","do","in","of","new","return","then","this","@","throw","when","until","extends"],r=c(p.concat(q));p=c(p);var s=/^('{3}|\"{3}|['\"])/,t=/^(\/{3}|\/)/,u=["Infinity","NaN","undefined","null","true","false","on","off","yes","no"],v=c(u),w={startState:function(a){return{tokenize:d,scope:{offset:a||0,type:"coffee",prev:null,align:!1},lastToken:null,lambda:!1,dedent:0}},token:function(a,b){var c=null===b.scope.align&&b.scope;c&&a.sol()&&(c.align=!1);var d=i(a,b);return c&&d&&"comment"!=d&&(c.align=!0),b.lastToken={style:d,content:a.current()},a.eol()&&a.lambda&&(b.lambda=!1),d},indent:function(a,b){if(a.tokenize!=d)return 0;var c=a.scope,e=b&&"])}".indexOf(b.charAt(0))>-1;if(e)for(;"coffee"==c.type&&c.prev;)c=c.prev;var f=e&&c.type===b.charAt(0);return c.align?c.alignOffset-(f?1:0):(f?c.prev:c).offset},lineComment:"#",fold:"indent"};return w}),a.defineMIME("text/x-coffeescript","coffeescript")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/commonlisp/commonlisp.js b/media/editors/codemirror/mode/commonlisp/commonlisp.js index 5f50b352de73c..fb1f99c631020 100644 --- a/media/editors/codemirror/mode/commonlisp/commonlisp.js +++ b/media/editors/codemirror/mode/commonlisp/commonlisp.js @@ -111,6 +111,7 @@ CodeMirror.defineMode("commonlisp", function (config) { return typeof i == "number" ? i : state.ctx.start + 1; }, + closeBrackets: {pairs: "()[]{}\"\""}, lineComment: ";;", blockCommentStart: "#|", blockCommentEnd: "|#" diff --git a/media/editors/codemirror/mode/commonlisp/commonlisp.min.js b/media/editors/codemirror/mode/commonlisp/commonlisp.min.js new file mode 100644 index 0000000000000..3e2e47dd89dec --- /dev/null +++ b/media/editors/codemirror/mode/commonlisp/commonlisp.min.js @@ -0,0 +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("commonlisp",function(a){function b(a){for(var b;b=a.next();)if("\\"==b)a.next();else if(!j.test(b)){a.backUp(1);break}return a.current()}function c(a,c){if(a.eatSpace())return f="ws",null;if(a.match(i))return"number";var j=a.next();if("\\"==j&&(j=a.next()),'"'==j)return(c.tokenize=d)(a,c);if("("==j)return f="open","bracket";if(")"==j||"]"==j)return f="close","bracket";if(";"==j)return a.skipToEnd(),f="ws","comment";if(/['`,@]/.test(j))return null;if("|"==j)return a.skipTo("|")?(a.next(),"symbol"):(a.skipToEnd(),"error");if("#"==j){var j=a.next();return"["==j?(f="open","bracket"):/[+\-=\.']/.test(j)?null:/\d/.test(j)&&a.match(/^\d*#/)?null:"|"==j?(c.tokenize=e)(a,c):":"==j?(b(a),"meta"):"error"}var k=b(a);return"."==k?null:(f="symbol","nil"==k||"t"==k||":"==k.charAt(0)?"atom":"open"==c.lastType&&(g.test(k)||h.test(k))?"keyword":"&"==k.charAt(0)?"variable-2":"variable")}function d(a,b){for(var d,e=!1;d=a.next();){if('"'==d&&!e){b.tokenize=c;break}e=!e&&"\\"==d}return"string"}function e(a,b){for(var d,e;d=a.next();){if("#"==d&&"|"==e){b.tokenize=c;break}e=d}return f="ws","comment"}var f,g=/^(block|let*|return-from|catch|load-time-value|setq|eval-when|locally|symbol-macrolet|flet|macrolet|tagbody|function|multiple-value-call|the|go|multiple-value-prog1|throw|if|progn|unwind-protect|labels|progv|let|quote)$/,h=/^with|^def|^do|^prog|case$|^cond$|bind$|when$|unless$/,i=/^(?:[+\-]?(?:\d+|\d*\.\d+)(?:[efd][+\-]?\d+)?|[+\-]?\d+(?:\/[+\-]?\d+)?|#b[+\-]?[01]+|#o[+\-]?[0-7]+|#x[+\-]?[\da-f]+)/,j=/[^\s'`,@()\[\]";]/;return{startState:function(){return{ctx:{prev:null,start:0,indentTo:0},lastType:null,tokenize:c}},token:function(b,c){b.sol()&&"number"!=typeof c.ctx.indentTo&&(c.ctx.indentTo=c.ctx.start+1),f=null;var d=c.tokenize(b,c);return"ws"!=f&&(null==c.ctx.indentTo?"symbol"==f&&h.test(b.current())?c.ctx.indentTo=c.ctx.start+a.indentUnit:c.ctx.indentTo="next":"next"==c.ctx.indentTo&&(c.ctx.indentTo=b.column()),c.lastType=f),"open"==f?c.ctx={prev:c.ctx,start:b.column(),indentTo:null}:"close"==f&&(c.ctx=c.ctx.prev||c.ctx),d},indent:function(a,b){var c=a.ctx.indentTo;return"number"==typeof c?c:a.ctx.start+1},closeBrackets:{pairs:'()[]{}""'},lineComment:";;",blockCommentStart:"#|",blockCommentEnd:"|#"}}),a.defineMIME("text/x-common-lisp","commonlisp")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/css/css.js b/media/editors/codemirror/mode/css/css.js index 3f02907ed5752..1e6d2ddbc7588 100644 --- a/media/editors/codemirror/mode/css/css.js +++ b/media/editors/codemirror/mode/css/css.js @@ -16,13 +16,15 @@ CodeMirror.defineMode("css", function(config, parserConfig) { var indentUnit = config.indentUnit, tokenHooks = parserConfig.tokenHooks, + documentTypes = parserConfig.documentTypes || {}, mediaTypes = parserConfig.mediaTypes || {}, mediaFeatures = parserConfig.mediaFeatures || {}, propertyKeywords = parserConfig.propertyKeywords || {}, nonStandardPropertyKeywords = parserConfig.nonStandardPropertyKeywords || {}, + fontProperties = parserConfig.fontProperties || {}, + counterDescriptors = parserConfig.counterDescriptors || {}, colorKeywords = parserConfig.colorKeywords || {}, valueKeywords = parserConfig.valueKeywords || {}, - fontProperties = parserConfig.fontProperties || {}, allowNested = parserConfig.allowNested; var type, override; @@ -57,6 +59,11 @@ CodeMirror.defineMode("css", function(config, parserConfig) { if (/[\d.]/.test(stream.peek())) { stream.eatWhile(/[\w.%]/); return ret("number", "unit"); + } else if (stream.match(/^-[\w\\\-]+/)) { + stream.eatWhile(/[\w\\\-]/); + if (stream.match(/^\s*:/, false)) + return ret("variable-2", "variable-definition"); + return ret("variable-2", "variable"); } else if (stream.match(/^\w+-/)) { return ret("meta", "meta"); } @@ -66,7 +73,9 @@ CodeMirror.defineMode("css", function(config, parserConfig) { return ret("qualifier", "qualifier"); } else if (/[:;{}\[\]\(\)]/.test(ch)) { return ret(null, ch); - } else if (ch == "u" && stream.match("rl(")) { + } else if ((ch == "u" && stream.match(/rl(-prefix)?\(/)) || + (ch == "d" && stream.match("omain(")) || + (ch == "r" && stream.match("egexp("))) { stream.backUp(1); state.tokenize = tokenParenthesized; return ret("property", "word"); @@ -148,10 +157,11 @@ CodeMirror.defineMode("css", function(config, parserConfig) { return pushContext(state, stream, "block"); } else if (type == "}" && state.context.prev) { return popContext(state); - } else if (type == "@media") { - return pushContext(state, stream, "media"); - } else if (type == "@font-face") { - return "font_face_before"; + } else if (/@(media|supports|(-moz-)?document)/.test(type)) { + return pushContext(state, stream, "atBlock"); + } else if (/@(font-face|counter-style)/.test(type)) { + state.stateArg = type; + return "restricted_atBlock_before"; } else if (/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(type)) { return "keyframes"; } else if (type && type.charAt(0) == "@") { @@ -229,6 +239,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) { if (type == "{" || type == "}") return popAndPass(type, stream, state); if (type == ")") return popContext(state); if (type == "(") return pushContext(state, stream, "parens"); + if (type == "interpolation") return pushContext(state, stream, "interpolation"); if (type == "word") wordAsValue(stream); return "parens"; }; @@ -241,47 +252,63 @@ CodeMirror.defineMode("css", function(config, parserConfig) { return pass(type, stream, state); }; - states.media = function(type, stream, state) { - if (type == "(") return pushContext(state, stream, "media_parens"); + states.atBlock = function(type, stream, state) { + if (type == "(") return pushContext(state, stream, "atBlock_parens"); if (type == "}") return popAndPass(type, stream, state); if (type == "{") return popContext(state) && pushContext(state, stream, allowNested ? "block" : "top"); if (type == "word") { var word = stream.current().toLowerCase(); - if (word == "only" || word == "not" || word == "and") + if (word == "only" || word == "not" || word == "and" || word == "or") override = "keyword"; + else if (documentTypes.hasOwnProperty(word)) + override = "tag"; else if (mediaTypes.hasOwnProperty(word)) override = "attribute"; else if (mediaFeatures.hasOwnProperty(word)) override = "property"; + else if (propertyKeywords.hasOwnProperty(word)) + override = "property"; + else if (nonStandardPropertyKeywords.hasOwnProperty(word)) + override = "string-2"; + else if (valueKeywords.hasOwnProperty(word)) + override = "atom"; else override = "error"; } return state.context.type; }; - states.media_parens = function(type, stream, state) { + states.atBlock_parens = function(type, stream, state) { if (type == ")") return popContext(state); if (type == "{" || type == "}") return popAndPass(type, stream, state, 2); - return states.media(type, stream, state); + return states.atBlock(type, stream, state); }; - states.font_face_before = function(type, stream, state) { + states.restricted_atBlock_before = function(type, stream, state) { if (type == "{") - return pushContext(state, stream, "font_face"); + return pushContext(state, stream, "restricted_atBlock"); + if (type == "word" && state.stateArg == "@counter-style") { + override = "variable"; + return "restricted_atBlock_before"; + } return pass(type, stream, state); }; - states.font_face = function(type, stream, state) { - if (type == "}") return popContext(state); + states.restricted_atBlock = function(type, stream, state) { + if (type == "}") { + state.stateArg = null; + return popContext(state); + } if (type == "word") { - if (!fontProperties.hasOwnProperty(stream.current().toLowerCase())) + if ((state.stateArg == "@font-face" && !fontProperties.hasOwnProperty(stream.current().toLowerCase())) || + (state.stateArg == "@counter-style" && !counterDescriptors.hasOwnProperty(stream.current().toLowerCase()))) override = "error"; else override = "property"; return "maybeprop"; } - return "font_face"; + return "restricted_atBlock"; }; states.keyframes = function(type, stream, state) { @@ -301,7 +328,8 @@ CodeMirror.defineMode("css", function(config, parserConfig) { states.interpolation = function(type, stream, state) { if (type == "}") return popContext(state); if (type == "{" || type == ";") return popAndPass(type, stream, state); - if (type != "variable") override = "error"; + if (type == "word") override = "variable"; + else if (type != "variable" && type != "(" && type != ")") override = "error"; return "interpolation"; }; @@ -309,6 +337,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) { startState: function(base) { return {tokenize: null, state: "top", + stateArg: null, context: new Context("top", base || 0, null)}; }, @@ -329,9 +358,9 @@ CodeMirror.defineMode("css", function(config, parserConfig) { var indent = cx.indent; if (cx.type == "prop" && (ch == "}" || ch == ")")) cx = cx.prev; if (cx.prev && - (ch == "}" && (cx.type == "block" || cx.type == "top" || cx.type == "interpolation" || cx.type == "font_face") || - ch == ")" && (cx.type == "parens" || cx.type == "media_parens") || - ch == "{" && (cx.type == "at" || cx.type == "media"))) { + (ch == "}" && (cx.type == "block" || cx.type == "top" || cx.type == "interpolation" || cx.type == "restricted_atBlock") || + ch == ")" && (cx.type == "parens" || cx.type == "atBlock_parens") || + ch == "{" && (cx.type == "at" || cx.type == "atBlock"))) { indent = cx.indent - indentUnit; cx = cx.prev; } @@ -353,6 +382,10 @@ CodeMirror.defineMode("css", function(config, parserConfig) { return keys; } + var documentTypes_ = [ + "domain", "regexp", "url", "url-prefix" + ], documentTypes = keySet(documentTypes_); + var mediaTypes_ = [ "all", "aural", "braille", "handheld", "print", "projection", "screen", "tty", "tv", "embossed" @@ -469,6 +502,16 @@ CodeMirror.defineMode("css", function(config, parserConfig) { "searchfield-results-decoration", "zoom" ], nonStandardPropertyKeywords = keySet(nonStandardPropertyKeywords_); + var fontProperties_ = [ + "font-family", "src", "unicode-range", "font-variant", "font-feature-settings", + "font-stretch", "font-weight", "font-style" + ], fontProperties = keySet(fontProperties_); + + var counterDescriptors_ = [ + "additive-symbols", "fallback", "negative", "pad", "prefix", "range", + "speak-as", "suffix", "symbols", "system" + ], counterDescriptors = keySet(counterDescriptors_); + var colorKeywords_ = [ "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", @@ -499,32 +542,33 @@ CodeMirror.defineMode("css", function(config, parserConfig) { ], colorKeywords = keySet(colorKeywords_); var valueKeywords_ = [ - "above", "absolute", "activeborder", "activecaption", "afar", - "after-white-space", "ahead", "alias", "all", "all-scroll", "alternate", + "above", "absolute", "activeborder", "additive", "activecaption", "afar", + "after-white-space", "ahead", "alias", "all", "all-scroll", "alphabetic", "alternate", "always", "amharic", "amharic-abegede", "antialiased", "appworkspace", - "arabic-indic", "armenian", "asterisks", "auto", "avoid", "avoid-column", "avoid-page", + "arabic-indic", "armenian", "asterisks", "attr", "auto", "avoid", "avoid-column", "avoid-page", "avoid-region", "background", "backwards", "baseline", "below", "bidi-override", "binary", "bengali", "blink", "block", "block-axis", "bold", "bolder", "border", "border-box", - "both", "bottom", "break", "break-all", "break-word", "button", "button-bevel", - "buttonface", "buttonhighlight", "buttonshadow", "buttontext", "cambodian", + "both", "bottom", "break", "break-all", "break-word", "bullets", "button", "button-bevel", + "buttonface", "buttonhighlight", "buttonshadow", "buttontext", "calc", "cambodian", "capitalize", "caps-lock-indicator", "caption", "captiontext", "caret", - "cell", "center", "checkbox", "circle", "cjk-earthly-branch", + "cell", "center", "checkbox", "circle", "cjk-decimal", "cjk-earthly-branch", "cjk-heavenly-stem", "cjk-ideographic", "clear", "clip", "close-quote", "col-resize", "collapse", "column", "compact", "condensed", "contain", "content", - "content-box", "context-menu", "continuous", "copy", "cover", "crop", - "cross", "crosshair", "currentcolor", "cursive", "dashed", "decimal", + "content-box", "context-menu", "continuous", "copy", "counter", "counters", "cover", "crop", + "cross", "crosshair", "currentcolor", "cursive", "cyclic", "dashed", "decimal", "decimal-leading-zero", "default", "default-button", "destination-atop", "destination-in", "destination-out", "destination-over", "devanagari", - "disc", "discard", "document", "dot-dash", "dot-dot-dash", "dotted", - "double", "down", "e-resize", "ease", "ease-in", "ease-in-out", "ease-out", + "disc", "discard", "disclosure-closed", "disclosure-open", "document", + "dot-dash", "dot-dot-dash", + "dotted", "double", "down", "e-resize", "ease", "ease-in", "ease-in-out", "ease-out", "element", "ellipse", "ellipsis", "embed", "end", "ethiopic", "ethiopic-abegede", "ethiopic-abegede-am-et", "ethiopic-abegede-gez", "ethiopic-abegede-ti-er", "ethiopic-abegede-ti-et", "ethiopic-halehame-aa-er", "ethiopic-halehame-aa-et", "ethiopic-halehame-am-et", "ethiopic-halehame-gez", "ethiopic-halehame-om-et", "ethiopic-halehame-sid-et", "ethiopic-halehame-so-et", - "ethiopic-halehame-ti-er", "ethiopic-halehame-ti-et", - "ethiopic-halehame-tig", "ew-resize", "expanded", "extra-condensed", + "ethiopic-halehame-ti-er", "ethiopic-halehame-ti-et", "ethiopic-halehame-tig", + "ethiopic-numeric", "ew-resize", "expanded", "extends", "extra-condensed", "extra-expanded", "fantasy", "fast", "fill", "fixed", "flat", "flex", "footnotes", "forwards", "from", "geometricPrecision", "georgian", "graytext", "groove", "gujarati", "gurmukhi", "hand", "hangul", "hangul-consonant", "hebrew", @@ -533,12 +577,14 @@ CodeMirror.defineMode("css", function(config, parserConfig) { "inactiveborder", "inactivecaption", "inactivecaptiontext", "infinite", "infobackground", "infotext", "inherit", "initial", "inline", "inline-axis", "inline-block", "inline-flex", "inline-table", "inset", "inside", "intrinsic", "invert", - "italic", "justify", "kannada", "katakana", "katakana-iroha", "keep-all", "khmer", + "italic", "japanese-formal", "japanese-informal", "justify", "kannada", + "katakana", "katakana-iroha", "keep-all", "khmer", + "korean-hangul-formal", "korean-hanja-formal", "korean-hanja-informal", "landscape", "lao", "large", "larger", "left", "level", "lighter", - "line-through", "linear", "lines", "list-item", "listbox", "listitem", + "line-through", "linear", "linear-gradient", "lines", "list-item", "listbox", "listitem", "local", "logical", "loud", "lower", "lower-alpha", "lower-armenian", "lower-greek", "lower-hexadecimal", "lower-latin", "lower-norwegian", - "lower-roman", "lowercase", "ltr", "malayalam", "match", + "lower-roman", "lowercase", "ltr", "malayalam", "match", "matrix", "matrix3d", "media-controls-background", "media-current-time-display", "media-fullscreen-button", "media-mute-button", "media-play-button", "media-return-to-realtime-button", "media-rewind-button", @@ -550,45 +596,48 @@ CodeMirror.defineMode("css", function(config, parserConfig) { "mix", "mongolian", "monospace", "move", "multiple", "myanmar", "n-resize", "narrower", "ne-resize", "nesw-resize", "no-close-quote", "no-drop", "no-open-quote", "no-repeat", "none", "normal", "not-allowed", "nowrap", - "ns-resize", "nw-resize", "nwse-resize", "oblique", "octal", "open-quote", + "ns-resize", "numbers", "numeric", "nw-resize", "nwse-resize", "oblique", "octal", "open-quote", "optimizeLegibility", "optimizeSpeed", "oriya", "oromo", "outset", "outside", "outside-shape", "overlay", "overline", "padding", "padding-box", - "painted", "page", "paused", "persian", "plus-darker", "plus-lighter", "pointer", - "polygon", "portrait", "pre", "pre-line", "pre-wrap", "preserve-3d", "progress", "push-button", - "radio", "read-only", "read-write", "read-write-plaintext-only", "rectangle", "region", - "relative", "repeat", "repeat-x", "repeat-y", "reset", "reverse", "rgb", "rgba", - "ridge", "right", "round", "row-resize", "rtl", "run-in", "running", - "s-resize", "sans-serif", "scroll", "scrollbar", "se-resize", "searchfield", + "painted", "page", "paused", "persian", "perspective", "plus-darker", "plus-lighter", + "pointer", "polygon", "portrait", "pre", "pre-line", "pre-wrap", "preserve-3d", + "progress", "push-button", "radial-gradient", "radio", "read-only", + "read-write", "read-write-plaintext-only", "rectangle", "region", + "relative", "repeat", "repeating-linear-gradient", + "repeating-radial-gradient", "repeat-x", "repeat-y", "reset", "reverse", + "rgb", "rgba", "ridge", "right", "rotate", "rotate3d", "rotateX", "rotateY", + "rotateZ", "round", "row-resize", "rtl", "run-in", "running", + "s-resize", "sans-serif", "scale", "scale3d", "scaleX", "scaleY", "scaleZ", + "scroll", "scrollbar", "se-resize", "searchfield", "searchfield-cancel-button", "searchfield-decoration", "searchfield-results-button", "searchfield-results-decoration", "semi-condensed", "semi-expanded", "separate", "serif", "show", "sidama", - "single", "skip-white-space", "slide", "slider-horizontal", + "simp-chinese-formal", "simp-chinese-informal", "single", + "skew", "skewX", "skewY", "skip-white-space", "slide", "slider-horizontal", "slider-vertical", "sliderthumb-horizontal", "sliderthumb-vertical", "slow", "small", "small-caps", "small-caption", "smaller", "solid", "somali", - "source-atop", "source-in", "source-out", "source-over", "space", "square", - "square-button", "start", "static", "status-bar", "stretch", "stroke", - "sub", "subpixel-antialiased", "super", "sw-resize", "table", + "source-atop", "source-in", "source-out", "source-over", "space", "spell-out", "square", + "square-button", "start", "static", "status-bar", "stretch", "stroke", "sub", + "subpixel-antialiased", "super", "sw-resize", "symbolic", "symbols", "table", "table-caption", "table-cell", "table-column", "table-column-group", "table-footer-group", "table-header-group", "table-row", "table-row-group", + "tamil", "telugu", "text", "text-bottom", "text-top", "textarea", "textfield", "thai", "thick", "thin", "threeddarkshadow", "threedface", "threedhighlight", "threedlightshadow", "threedshadow", "tibetan", "tigre", "tigrinya-er", "tigrinya-er-abegede", "tigrinya-et", "tigrinya-et-abegede", "to", "top", + "trad-chinese-formal", "trad-chinese-informal", + "translate", "translate3d", "translateX", "translateY", "translateZ", "transparent", "ultra-condensed", "ultra-expanded", "underline", "up", "upper-alpha", "upper-armenian", "upper-greek", "upper-hexadecimal", "upper-latin", "upper-norwegian", "upper-roman", "uppercase", "urdu", "url", - "vertical", "vertical-text", "visible", "visibleFill", "visiblePainted", + "var", "vertical", "vertical-text", "visible", "visibleFill", "visiblePainted", "visibleStroke", "visual", "w-resize", "wait", "wave", "wider", - "window", "windowframe", "windowtext", "x-large", "x-small", "xor", + "window", "windowframe", "windowtext", "words", "x-large", "x-small", "xor", "xx-large", "xx-small" ], valueKeywords = keySet(valueKeywords_); - var fontProperties_ = [ - "font-family", "src", "unicode-range", "font-variant", "font-feature-settings", - "font-stretch", "font-weight", "font-style" - ], fontProperties = keySet(fontProperties_); - - var allWords = mediaTypes_.concat(mediaFeatures_).concat(propertyKeywords_) + var allWords = documentTypes_.concat(mediaTypes_).concat(mediaFeatures_).concat(propertyKeywords_) .concat(nonStandardPropertyKeywords_).concat(colorKeywords_).concat(valueKeywords_); CodeMirror.registerHelper("hintWords", "css", allWords); @@ -604,30 +653,17 @@ CodeMirror.defineMode("css", function(config, parserConfig) { return ["comment", "comment"]; } - function tokenSGMLComment(stream, state) { - if (stream.skipTo("-->")) { - stream.match("-->"); - state.tokenize = null; - } else { - stream.skipToEnd(); - } - return ["comment", "comment"]; - } - CodeMirror.defineMIME("text/css", { + documentTypes: documentTypes, mediaTypes: mediaTypes, mediaFeatures: mediaFeatures, propertyKeywords: propertyKeywords, nonStandardPropertyKeywords: nonStandardPropertyKeywords, + fontProperties: fontProperties, + counterDescriptors: counterDescriptors, colorKeywords: colorKeywords, valueKeywords: valueKeywords, - fontProperties: fontProperties, tokenHooks: { - "<": function(stream, state) { - if (!stream.match("!--")) return false; - state.tokenize = tokenSGMLComment; - return tokenSGMLComment(stream, state); - }, "/": function(stream, state) { if (!stream.eat("*")) return false; state.tokenize = tokenCComment; @@ -700,6 +736,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) { } }, "@": function(stream) { + if (stream.eat("{")) return [null, "interpolation"]; if (stream.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/, false)) return false; stream.eatWhile(/[\w\\\-]/); if (stream.match(/^\s*:/, false)) diff --git a/media/editors/codemirror/mode/css/css.min.js b/media/editors/codemirror/mode/css/css.min.js new file mode 100644 index 0000000000000..7257db3f4068d --- /dev/null +++ b/media/editors/codemirror/mode/css/css.min.js @@ -0,0 +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){for(var b={},c=0;c*\/]/.test(c)?d(null,"select-op"):"."==c&&a.match(/^-?[_a-z][_a-z0-9-]*/i)?d("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(c)?d(null,c):"u"==c&&a.match(/rl(-prefix)?\(/)||"d"==c&&a.match("omain(")||"r"==c&&a.match("egexp(")?(a.backUp(1),b.tokenize=g,d("property","word")):/[\w\\\-]/.test(c)?(a.eatWhile(/[\w\\\-]/),d("property","word")):d(null,null):/[\d.]/.test(a.peek())?(a.eatWhile(/[\w.%]/),d("number","unit")):a.match(/^-[\w\\\-]+/)?(a.eatWhile(/[\w\\\-]/),a.match(/^\s*:/,!1)?d("variable-2","variable-definition"):d("variable-2","variable")):a.match(/^\w+-/)?d("meta","meta"):void 0}function f(a){return function(b,c){for(var e,f=!1;null!=(e=b.next());){if(e==a&&!f){")"==a&&b.backUp(1);break}f=!f&&"\\"==e}return(e==a||!f&&")"!=a)&&(c.tokenize=null),d("string","string")}}function g(a,b){return a.next(),a.match(/\s*[\"\')]/,!1)?b.tokenize=null:b.tokenize=f(")"),d(null,"(")}function h(a,b,c){this.type=a,this.indent=b,this.prev=c}function i(a,b,c){return a.context=new h(c,b.indentation()+p,a.context),c}function j(a){return a.context=a.context.prev,a.context.type}function k(a,b,c){return B[c.context.type](a,b,c)}function l(a,b,c,d){for(var e=d||1;e>0;e--)c.context=c.context.prev;return k(a,b,c)}function m(a){var b=a.current().toLowerCase();o=z.hasOwnProperty(b)?"atom":y.hasOwnProperty(b)?"keyword":"variable"}c.propertyKeywords||(c=a.resolveMode("text/css"));var n,o,p=b.indentUnit,q=c.tokenHooks,r=c.documentTypes||{},s=c.mediaTypes||{},t=c.mediaFeatures||{},u=c.propertyKeywords||{},v=c.nonStandardPropertyKeywords||{},w=c.fontProperties||{},x=c.counterDescriptors||{},y=c.colorKeywords||{},z=c.valueKeywords||{},A=c.allowNested,B={};return B.top=function(a,b,c){if("{"==a)return i(c,b,"block");if("}"==a&&c.context.prev)return j(c);if(/@(media|supports|(-moz-)?document)/.test(a))return i(c,b,"atBlock");if(/@(font-face|counter-style)/.test(a))return c.stateArg=a,"restricted_atBlock_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(a))return"keyframes";if(a&&"@"==a.charAt(0))return i(c,b,"at");if("hash"==a)o="builtin";else if("word"==a)o="tag";else{if("variable-definition"==a)return"maybeprop";if("interpolation"==a)return i(c,b,"interpolation");if(":"==a)return"pseudo";if(A&&"("==a)return i(c,b,"parens")}return c.context.type},B.block=function(a,b,c){if("word"==a){var d=b.current().toLowerCase();return u.hasOwnProperty(d)?(o="property","maybeprop"):v.hasOwnProperty(d)?(o="string-2","maybeprop"):A?(o=b.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block"):(o+=" error","maybeprop")}return"meta"==a?"block":A||"hash"!=a&&"qualifier"!=a?B.top(a,b,c):(o="error","block")},B.maybeprop=function(a,b,c){return":"==a?i(c,b,"prop"):k(a,b,c)},B.prop=function(a,b,c){if(";"==a)return j(c);if("{"==a&&A)return i(c,b,"propBlock");if("}"==a||"{"==a)return l(a,b,c);if("("==a)return i(c,b,"parens");if("hash"!=a||/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(b.current())){if("word"==a)m(b);else if("interpolation"==a)return i(c,b,"interpolation")}else o+=" error";return"prop"},B.propBlock=function(a,b,c){return"}"==a?j(c):"word"==a?(o="property","maybeprop"):c.context.type},B.parens=function(a,b,c){return"{"==a||"}"==a?l(a,b,c):")"==a?j(c):"("==a?i(c,b,"parens"):"interpolation"==a?i(c,b,"interpolation"):("word"==a&&m(b),"parens")},B.pseudo=function(a,b,c){return"word"==a?(o="variable-3",c.context.type):k(a,b,c)},B.atBlock=function(a,b,c){if("("==a)return i(c,b,"atBlock_parens");if("}"==a)return l(a,b,c);if("{"==a)return j(c)&&i(c,b,A?"block":"top");if("word"==a){var d=b.current().toLowerCase();o="only"==d||"not"==d||"and"==d||"or"==d?"keyword":r.hasOwnProperty(d)?"tag":s.hasOwnProperty(d)?"attribute":t.hasOwnProperty(d)?"property":u.hasOwnProperty(d)?"property":v.hasOwnProperty(d)?"string-2":z.hasOwnProperty(d)?"atom":"error"}return c.context.type},B.atBlock_parens=function(a,b,c){return")"==a?j(c):"{"==a||"}"==a?l(a,b,c,2):B.atBlock(a,b,c)},B.restricted_atBlock_before=function(a,b,c){return"{"==a?i(c,b,"restricted_atBlock"):"word"==a&&"@counter-style"==c.stateArg?(o="variable","restricted_atBlock_before"):k(a,b,c)},B.restricted_atBlock=function(a,b,c){return"}"==a?(c.stateArg=null,j(c)):"word"==a?(o="@font-face"==c.stateArg&&!w.hasOwnProperty(b.current().toLowerCase())||"@counter-style"==c.stateArg&&!x.hasOwnProperty(b.current().toLowerCase())?"error":"property","maybeprop"):"restricted_atBlock"},B.keyframes=function(a,b,c){return"word"==a?(o="variable","keyframes"):"{"==a?i(c,b,"top"):k(a,b,c)},B.at=function(a,b,c){return";"==a?j(c):"{"==a||"}"==a?l(a,b,c):("word"==a?o="tag":"hash"==a&&(o="builtin"),"at")},B.interpolation=function(a,b,c){return"}"==a?j(c):"{"==a||";"==a?l(a,b,c):("word"==a?o="variable":"variable"!=a&&"("!=a&&")"!=a&&(o="error"),"interpolation")},{startState:function(a){return{tokenize:null,state:"top",stateArg:null,context:new h("top",a||0,null)}},token:function(a,b){if(!b.tokenize&&a.eatSpace())return null;var c=(b.tokenize||e)(a,b);return c&&"object"==typeof c&&(n=c[1],c=c[0]),o=c,b.state=B[b.state](n,a,b),o},indent:function(a,b){var c=a.context,d=b&&b.charAt(0),e=c.indent;return"prop"!=c.type||"}"!=d&&")"!=d||(c=c.prev),!c.prev||("}"!=d||"block"!=c.type&&"top"!=c.type&&"interpolation"!=c.type&&"restricted_atBlock"!=c.type)&&(")"!=d||"parens"!=c.type&&"atBlock_parens"!=c.type)&&("{"!=d||"at"!=c.type&&"atBlock"!=c.type)||(e=c.indent-p,c=c.prev),e},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",fold:"brace"}});var d=["domain","regexp","url","url-prefix"],e=b(d),f=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],g=b(f),h=["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid"],i=b(h),j=["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-position","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marker-offset","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-image-threshold","shape-inside","shape-margin","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","word-break","word-spacing","word-wrap","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode"],k=b(j),l=["scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-3d-light-color","scrollbar-track-color","shape-inside","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","zoom"],m=b(l),n=["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"],o=b(n),p=["additive-symbols","fallback","negative","pad","prefix","range","speak-as","suffix","symbols","system"],q=b(p),r=["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],s=b(r),t=["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","attr","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","column","compact","condensed","contain","content","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","flex","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-table","inset","inside","intrinsic","invert","italic","japanese-formal","japanese-informal","justify","kannada","katakana","katakana-iroha","keep-all","khmer","korean-hangul-formal","korean-hanja-formal","korean-hanja-informal","landscape","lao","large","larger","left","level","lighter","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","malayalam","match","matrix","matrix3d","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","perspective","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row-resize","rtl","run-in","running","s-resize","sans-serif","scale","scale3d","scaleX","scaleY","scaleZ","scroll","scrollbar","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","simp-chinese-formal","simp-chinese-informal","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","solid","somali","source-atop","source-in","source-out","source-over","space","spell-out","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","symbolic","symbols","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","tamil","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","trad-chinese-formal","trad-chinese-informal","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","x-large","x-small","xor","xx-large","xx-small"],u=b(t),v=d.concat(f).concat(h).concat(j).concat(l).concat(r).concat(t);a.registerHelper("hintWords","css",v),a.defineMIME("text/css",{documentTypes:e,mediaTypes:g,mediaFeatures:i,propertyKeywords:k,nonStandardPropertyKeywords:m,fontProperties:o,counterDescriptors:q,colorKeywords:s,valueKeywords:u,tokenHooks:{"/":function(a,b){return a.eat("*")?(b.tokenize=c,c(a,b)):!1}},name:"css"}),a.defineMIME("text/x-scss",{mediaTypes:g,mediaFeatures:i,propertyKeywords:k,nonStandardPropertyKeywords:m,colorKeywords:s,valueKeywords:u,fontProperties:o,allowNested:!0,tokenHooks:{"/":function(a,b){return a.eat("/")?(a.skipToEnd(),["comment","comment"]):a.eat("*")?(b.tokenize=c,c(a,b)):["operator","operator"]},":":function(a){return a.match(/\s*\{/)?[null,"{"]:!1},$:function(a){return a.match(/^[\w-]+/),a.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"]},"#":function(a){return a.eat("{")?[null,"interpolation"]:!1}},name:"css",helperType:"scss"}),a.defineMIME("text/x-less",{mediaTypes:g,mediaFeatures:i,propertyKeywords:k,nonStandardPropertyKeywords:m,colorKeywords:s,valueKeywords:u,fontProperties:o,allowNested:!0,tokenHooks:{"/":function(a,b){return a.eat("/")?(a.skipToEnd(),["comment","comment"]):a.eat("*")?(b.tokenize=c,c(a,b)):["operator","operator"]},"@":function(a){return a.eat("{")?[null,"interpolation"]:a.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/,!1)?!1:(a.eatWhile(/[\w\\\-]/),a.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"])},"&":function(){return["atom","atom"]}},name:"css",helperType:"less"})}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/css/less.html b/media/editors/codemirror/mode/css/less.html deleted file mode 100644 index 6ccb721e63a4d..0000000000000 --- a/media/editors/codemirror/mode/css/less.html +++ /dev/null @@ -1,152 +0,0 @@ - - -CodeMirror: LESS mode - - - - - - - - - - -
    -

    LESS mode

    -
    - - -

    The LESS mode is a sub-mode of the CSS mode (defined in css.js.

    - -

    Parsing/Highlighting Tests: normal, verbose.

    -
    diff --git a/media/editors/codemirror/mode/css/less_test.js b/media/editors/codemirror/mode/css/less_test.js deleted file mode 100644 index 2ba69984f3189..0000000000000 --- a/media/editors/codemirror/mode/css/less_test.js +++ /dev/null @@ -1,51 +0,0 @@ -// CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: http://codemirror.net/LICENSE - -(function() { - "use strict"; - - var mode = CodeMirror.getMode({indentUnit: 2}, "text/x-less"); - function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1), "less"); } - - MT("variable", - "[variable-2 @base]: [atom #f04615];", - "[qualifier .class] {", - " [property width]: [variable percentage]([number 0.5]); [comment // returns `50%`]", - " [property color]: [variable saturate]([variable-2 @base], [number 5%]);", - "}"); - - MT("amp", - "[qualifier .child], [qualifier .sibling] {", - " [qualifier .parent] [atom &] {", - " [property color]: [keyword black];", - " }", - " [atom &] + [atom &] {", - " [property color]: [keyword red];", - " }", - "}"); - - MT("mixin", - "[qualifier .mixin] ([variable dark]; [variable-2 @color]) {", - " [property color]: [variable darken]([variable-2 @color], [number 10%]);", - "}", - "[qualifier .mixin] ([variable light]; [variable-2 @color]) {", - " [property color]: [variable lighten]([variable-2 @color], [number 10%]);", - "}", - "[qualifier .mixin] ([variable-2 @_]; [variable-2 @color]) {", - " [property display]: [atom block];", - "}", - "[variable-2 @switch]: [variable light];", - "[qualifier .class] {", - " [qualifier .mixin]([variable-2 @switch]; [atom #888]);", - "}"); - - MT("nest", - "[qualifier .one] {", - " [def @media] ([property width]: [number 400px]) {", - " [property font-size]: [number 1.2em];", - " [def @media] [attribute print] [keyword and] [property color] {", - " [property color]: [keyword blue];", - " }", - " }", - "}"); -})(); diff --git a/media/editors/codemirror/mode/css/scss.html b/media/editors/codemirror/mode/css/scss.html deleted file mode 100644 index 21f20e0d16e74..0000000000000 --- a/media/editors/codemirror/mode/css/scss.html +++ /dev/null @@ -1,157 +0,0 @@ - - -CodeMirror: SCSS mode - - - - - - - - - -
    -

    SCSS mode

    -
    - - -

    The SCSS mode is a sub-mode of the CSS mode (defined in css.js.

    - -

    Parsing/Highlighting Tests: normal, verbose.

    - -
    diff --git a/media/editors/codemirror/mode/css/scss_test.js b/media/editors/codemirror/mode/css/scss_test.js deleted file mode 100644 index 8dcea9e86e408..0000000000000 --- a/media/editors/codemirror/mode/css/scss_test.js +++ /dev/null @@ -1,110 +0,0 @@ -// CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: http://codemirror.net/LICENSE - -(function() { - var mode = CodeMirror.getMode({indentUnit: 2}, "text/x-scss"); - function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1), "scss"); } - - MT('url_with_quotation', - "[tag foo] { [property background]:[atom url]([string test.jpg]) }"); - - MT('url_with_double_quotes', - "[tag foo] { [property background]:[atom url]([string \"test.jpg\"]) }"); - - MT('url_with_single_quotes', - "[tag foo] { [property background]:[atom url]([string \'test.jpg\']) }"); - - MT('string', - "[def @import] [string \"compass/css3\"]"); - - MT('important_keyword', - "[tag foo] { [property background]:[atom url]([string \'test.jpg\']) [keyword !important] }"); - - MT('variable', - "[variable-2 $blue]:[atom #333]"); - - MT('variable_as_attribute', - "[tag foo] { [property color]:[variable-2 $blue] }"); - - MT('numbers', - "[tag foo] { [property padding]:[number 10px] [number 10] [number 10em] [number 8in] }"); - - MT('number_percentage', - "[tag foo] { [property width]:[number 80%] }"); - - MT('selector', - "[builtin #hello][qualifier .world]{}"); - - MT('singleline_comment', - "[comment // this is a comment]"); - - MT('multiline_comment', - "[comment /*foobar*/]"); - - MT('attribute_with_hyphen', - "[tag foo] { [property font-size]:[number 10px] }"); - - MT('string_after_attribute', - "[tag foo] { [property content]:[string \"::\"] }"); - - MT('directives', - "[def @include] [qualifier .mixin]"); - - MT('basic_structure', - "[tag p] { [property background]:[keyword red]; }"); - - MT('nested_structure', - "[tag p] { [tag a] { [property color]:[keyword red]; } }"); - - MT('mixin', - "[def @mixin] [tag table-base] {}"); - - MT('number_without_semicolon', - "[tag p] {[property width]:[number 12]}", - "[tag a] {[property color]:[keyword red];}"); - - MT('atom_in_nested_block', - "[tag p] { [tag a] { [property color]:[atom #000]; } }"); - - MT('interpolation_in_property', - "[tag foo] { #{[variable-2 $hello]}:[number 2]; }"); - - MT('interpolation_in_selector', - "[tag foo]#{[variable-2 $hello]} { [property color]:[atom #000]; }"); - - MT('interpolation_error', - "[tag foo]#{[error foo]} { [property color]:[atom #000]; }"); - - MT("divide_operator", - "[tag foo] { [property width]:[number 4] [operator /] [number 2] }"); - - MT('nested_structure_with_id_selector', - "[tag p] { [builtin #hello] { [property color]:[keyword red]; } }"); - - MT('indent_mixin', - "[def @mixin] [tag container] (", - " [variable-2 $a]: [number 10],", - " [variable-2 $b]: [number 10])", - "{}"); - - MT('indent_nested', - "[tag foo] {", - " [tag bar] {", - " }", - "}"); - - MT('indent_parentheses', - "[tag foo] {", - " [property color]: [variable darken]([variable-2 $blue],", - " [number 9%]);", - "}"); - - MT('indent_vardef', - "[variable-2 $name]:", - " [string 'val'];", - "[tag tag] {", - " [tag inner] {", - " [property margin]: [number 3px];", - " }", - "}"); -})(); diff --git a/media/editors/codemirror/mode/css/test.js b/media/editors/codemirror/mode/css/test.js deleted file mode 100644 index d236e2a7384af..0000000000000 --- a/media/editors/codemirror/mode/css/test.js +++ /dev/null @@ -1,135 +0,0 @@ -// CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: http://codemirror.net/LICENSE - -(function() { - var mode = CodeMirror.getMode({indentUnit: 2}, "css"); - function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); } - - // Error, because "foobarhello" is neither a known type or property, but - // property was expected (after "and"), and it should be in parenthese. - MT("atMediaUnknownType", - "[def @media] [attribute screen] [keyword and] [error foobarhello] { }"); - - // Soft error, because "foobarhello" is not a known property or type. - MT("atMediaUnknownProperty", - "[def @media] [attribute screen] [keyword and] ([error foobarhello]) { }"); - - // Make sure nesting works with media queries - MT("atMediaMaxWidthNested", - "[def @media] [attribute screen] [keyword and] ([property max-width]: [number 25px]) { [tag foo] { } }"); - - MT("tagSelector", - "[tag foo] { }"); - - MT("classSelector", - "[qualifier .foo-bar_hello] { }"); - - MT("idSelector", - "[builtin #foo] { [error #foo] }"); - - MT("tagSelectorUnclosed", - "[tag foo] { [property margin]: [number 0] } [tag bar] { }"); - - MT("tagStringNoQuotes", - "[tag foo] { [property font-family]: [variable hello] [variable world]; }"); - - MT("tagStringDouble", - "[tag foo] { [property font-family]: [string \"hello world\"]; }"); - - MT("tagStringSingle", - "[tag foo] { [property font-family]: [string 'hello world']; }"); - - MT("tagColorKeyword", - "[tag foo] {", - " [property color]: [keyword black];", - " [property color]: [keyword navy];", - " [property color]: [keyword yellow];", - "}"); - - MT("tagColorHex3", - "[tag foo] { [property background]: [atom #fff]; }"); - - MT("tagColorHex6", - "[tag foo] { [property background]: [atom #ffffff]; }"); - - MT("tagColorHex4", - "[tag foo] { [property background]: [atom&error #ffff]; }"); - - MT("tagColorHexInvalid", - "[tag foo] { [property background]: [atom&error #ffg]; }"); - - MT("tagNegativeNumber", - "[tag foo] { [property margin]: [number -5px]; }"); - - MT("tagPositiveNumber", - "[tag foo] { [property padding]: [number 5px]; }"); - - MT("tagVendor", - "[tag foo] { [meta -foo-][property box-sizing]: [meta -foo-][atom border-box]; }"); - - MT("tagBogusProperty", - "[tag foo] { [property&error barhelloworld]: [number 0]; }"); - - MT("tagTwoProperties", - "[tag foo] { [property margin]: [number 0]; [property padding]: [number 0]; }"); - - MT("tagTwoPropertiesURL", - "[tag foo] { [property background]: [atom url]([string //example.com/foo.png]); [property padding]: [number 0]; }"); - - MT("commentSGML", - "[comment ]"); - - MT("commentSGML2", - "[comment ] [tag div] {}"); - - MT("indent_tagSelector", - "[tag strong], [tag em] {", - " [property background]: [atom rgba](", - " [number 255], [number 255], [number 0], [number .2]", - " );", - "}"); - - MT("indent_atMedia", - "[def @media] {", - " [tag foo] {", - " [property color]:", - " [keyword yellow];", - " }", - "}"); - - MT("indent_comma", - "[tag foo] {", - " [property font-family]: [variable verdana],", - " [atom sans-serif];", - "}"); - - MT("indent_parentheses", - "[tag foo]:[variable-3 before] {", - " [property background]: [atom url](", - "[string blahblah]", - "[string etc]", - "[string ]) [keyword !important];", - "}"); - - MT("font_face", - "[def @font-face] {", - " [property font-family]: [string 'myfont'];", - " [error nonsense]: [string 'abc'];", - " [property src]: [atom url]([string http://blah]),", - " [atom url]([string http://foo]);", - "}"); - - MT("empty_url", - "[def @import] [tag url]() [tag screen];"); - - MT("parens", - "[qualifier .foo] {", - " [property background-image]: [variable fade]([atom #000], [number 20%]);", - " [property border-image]: [variable linear-gradient](", - " [atom to] [atom bottom],", - " [variable fade]([atom #000], [number 20%]) [number 0%],", - " [variable fade]([atom #000], [number 20%]) [number 100%]", - " );", - "}"); -})(); diff --git a/media/editors/codemirror/mode/cypher/cypher.js b/media/editors/codemirror/mode/cypher/cypher.js index 315778706ef87..e218d47308f8c 100644 --- a/media/editors/codemirror/mode/cypher/cypher.js +++ b/media/editors/codemirror/mode/cypher/cypher.js @@ -19,7 +19,7 @@ CodeMirror.defineMode("cypher", function(config) { var tokenBase = function(stream/*, state*/) { - var ch = stream.next(), curPunc = null; + var ch = stream.next(); if (ch === "\"" || ch === "'") { stream.match(/.+?["']/); return "string"; @@ -60,7 +60,7 @@ }; var indentUnit = config.indentUnit; var curPunc; - var funcs = wordRegexp(["abs", "acos", "allShortestPaths", "asin", "atan", "atan2", "avg", "ceil", "coalesce", "collect", "cos", "cot", "count", "degrees", "e", "endnode", "exp", "extract", "filter", "floor", "haversin", "head", "id", "labels", "last", "left", "length", "log", "log10", "lower", "ltrim", "max", "min", "node", "nodes", "percentileCont", "percentileDisc", "pi", "radians", "rand", "range", "reduce", "rel", "relationship", "relationships", "replace", "right", "round", "rtrim", "shortestPath", "sign", "sin", "split", "sqrt", "startnode", "stdev", "stdevp", "str", "substring", "sum", "tail", "tan", "timestamp", "toFloat", "toInt", "trim", "type", "upper"]); + var funcs = wordRegexp(["abs", "acos", "allShortestPaths", "asin", "atan", "atan2", "avg", "ceil", "coalesce", "collect", "cos", "cot", "count", "degrees", "e", "endnode", "exp", "extract", "filter", "floor", "haversin", "head", "id", "keys", "labels", "last", "left", "length", "log", "log10", "lower", "ltrim", "max", "min", "node", "nodes", "percentileCont", "percentileDisc", "pi", "radians", "rand", "range", "reduce", "rel", "relationship", "relationships", "replace", "right", "round", "rtrim", "shortestPath", "sign", "sin", "split", "sqrt", "startnode", "stdev", "stdevp", "str", "substring", "sum", "tail", "tan", "timestamp", "toFloat", "toInt", "trim", "type", "upper"]); var preds = wordRegexp(["all", "and", "any", "has", "in", "none", "not", "or", "single", "xor"]); var keywords = wordRegexp(["as", "asc", "ascending", "assert", "by", "case", "commit", "constraint", "create", "csv", "cypher", "delete", "desc", "descending", "distinct", "drop", "else", "end", "explain", "false", "fieldterminator", "foreach", "from", "headers", "in", "index", "is", "limit", "load", "match", "merge", "null", "on", "optional", "order", "periodic", "profile", "remove", "return", "scan", "set", "skip", "start", "then", "true", "union", "unique", "unwind", "using", "when", "where", "with"]); var operatorChars = /[*+\-<>=&|~%^]/; diff --git a/media/editors/codemirror/mode/cypher/cypher.min.js b/media/editors/codemirror/mode/cypher/cypher.min.js new file mode 100644 index 0000000000000..ec9c8eaf4e9c6 --- /dev/null +++ b/media/editors/codemirror/mode/cypher/cypher.min.js @@ -0,0 +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";var b=function(a){return new RegExp("^(?:"+a.join("|")+")$","i")};a.defineMode("cypher",function(c){var d,e=function(a){var b=a.next();if('"'===b||"'"===b)return a.match(/.+?["']/),"string";if(/[{}\(\),\.;\[\]]/.test(b))return d=b,"node";if("/"===b&&a.eat("/"))return a.skipToEnd(),"comment";if(l.test(b))return a.eatWhile(l),null;if(a.eatWhile(/[_\w\d]/),a.eat(":"))return a.eatWhile(/[\w\d_\-]/),"atom";var c=a.current();return i.test(c)?"builtin":j.test(c)?"def":k.test(c)?"keyword":"variable"},f=function(a,b,c){return a.context={prev:a.context,indent:a.indent,col:c,type:b}},g=function(a){return a.indent=a.context.indent,a.context=a.context.prev},h=c.indentUnit,i=b(["abs","acos","allShortestPaths","asin","atan","atan2","avg","ceil","coalesce","collect","cos","cot","count","degrees","e","endnode","exp","extract","filter","floor","haversin","head","id","keys","labels","last","left","length","log","log10","lower","ltrim","max","min","node","nodes","percentileCont","percentileDisc","pi","radians","rand","range","reduce","rel","relationship","relationships","replace","right","round","rtrim","shortestPath","sign","sin","split","sqrt","startnode","stdev","stdevp","str","substring","sum","tail","tan","timestamp","toFloat","toInt","trim","type","upper"]),j=b(["all","and","any","has","in","none","not","or","single","xor"]),k=b(["as","asc","ascending","assert","by","case","commit","constraint","create","csv","cypher","delete","desc","descending","distinct","drop","else","end","explain","false","fieldterminator","foreach","from","headers","in","index","is","limit","load","match","merge","null","on","optional","order","periodic","profile","remove","return","scan","set","skip","start","then","true","union","unique","unwind","using","when","where","with"]),l=/[*+\-<>=&|~%^]/;return{startState:function(){return{tokenize:e,context:null,indent:0,col:0}},token:function(a,b){if(a.sol()&&(b.context&&null==b.context.align&&(b.context.align=!1),b.indent=a.indentation()),a.eatSpace())return null;var c=b.tokenize(a,b);if("comment"!==c&&b.context&&null==b.context.align&&"pattern"!==b.context.type&&(b.context.align=!0),"("===d)f(b,")",a.column());else if("["===d)f(b,"]",a.column());else if("{"===d)f(b,"}",a.column());else if(/[\]\}\)]/.test(d)){for(;b.context&&"pattern"===b.context.type;)g(b);b.context&&d===b.context.type&&g(b)}else"."===d&&b.context&&"pattern"===b.context.type?g(b):/atom|string|variable/.test(c)&&b.context&&(/[\}\]]/.test(b.context.type)?f(b,"pattern",a.column()):"pattern"!==b.context.type||b.context.align||(b.context.align=!0,b.context.col=a.column()));return c},indent:function(b,c){var d=c&&c.charAt(0),e=b.context;if(/[\]\}]/.test(d))for(;e&&"pattern"===e.type;)e=e.prev;var f=e&&d===e.type;return e?"keywords"===e.type?a.commands.newlineAndIndent:e.align?e.col+(f?0:1):e.indent+(f?0:h):0}}}),a.modeExtensions.cypher={autoFormatLineBreaks:function(a){for(var b,c,d,c=a.split("\n"),d=/\s+\b(return|where|order by|match|with|skip|limit|create|delete|set)\b\s/g,b=0;b!?|\/]/;return{startState:function(a){return{tokenize:null,context:new h((a||0)-l,0,"top",!1),indented:0,startOfLine:!0}},token:function(a,b){var c=b.context;if(a.sol()&&(null==c.align&&(c.align=!1),b.indented=a.indentation(),b.startOfLine=!0),a.eatSpace())return null;k=null;var e=(b.tokenize||d)(a,b);if("comment"==e||"meta"==e)return e;if(null==c.align&&(c.align=!0),";"!=k&&":"!=k&&","!=k||"statement"!=c.type)if("{"==k)i(b,a.column(),"}");else if("["==k)i(b,a.column(),"]");else if("("==k)i(b,a.column(),")");else if("}"==k){for(;"statement"==c.type;)c=j(b);for("}"==c.type&&(c=j(b));"statement"==c.type;)c=j(b)}else k==c.type?j(b):(("}"==c.type||"top"==c.type)&&";"!=k||"statement"==c.type&&"newstatement"==k)&&i(b,a.column(),"statement");else j(b);return b.startOfLine=!1,e},indent:function(b,c){if(b.tokenize!=d&&null!=b.tokenize)return a.Pass;var e=b.context,f=c&&c.charAt(0);"statement"==e.type&&"}"==f&&(e=e.prev);var g=f==e.type;return"statement"==e.type?e.indented+("{"==f?0:m):e.align?e.column+(g?0:1):e.indented+(g?0:l)},electricChars:"{}"}});var c="body catch class do else enum for foreach foreach_reverse if in interface mixin out scope struct switch try union unittest version while with";a.defineMIME("text/x-d",{name:"d",keywords:b("abstract alias align asm assert auto break case cast cdouble cent cfloat const continue debug default delegate delete deprecated export extern final finally function goto immutable import inout invariant is lazy macro module new nothrow override package pragma private protected public pure ref return shared short static super synchronized template this throw typedef typeid typeof volatile __FILE__ __LINE__ __gshared __traits __vector __parameters "+c),blockKeywords:b(c),builtin:b("bool byte char creal dchar double float idouble ifloat int ireal long real short ubyte ucent uint ulong ushort wchar wstring void size_t sizediff_t"),atoms:b("exit failure success true false null"),hooks:{"@":function(a,b){return a.eatWhile(/[\w\$_]/),"meta"}}})}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/dart/dart.min.js b/media/editors/codemirror/mode/dart/dart.min.js new file mode 100644 index 0000000000000..5e5f1edfdd7b2 --- /dev/null +++ b/media/editors/codemirror/mode/dart/dart.min.js @@ -0,0 +1 @@ +!function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("../clike/clike")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../clike/clike"],a):a(CodeMirror)}(function(a){"use strict";function b(a){for(var b={},c=0;c", "<=", ">=", "in", "not", "or", "and"]; + keywords = new RegExp("^\\b(" + keywords.join("|") + ")\\b"); + filters = new RegExp("^\\b(" + filters.join("|") + ")\\b"); + operators = new RegExp("^\\b(" + operators.join("|") + ")\\b"); + + // We have to return "null" instead of null, in order to avoid string + // styling as the default, when using Django templates inside HTML + // element attributes function tokenBase (stream, state) { - stream.eatWhile(/[^\{]/); - var ch = stream.next(); - if (ch == "{") { - if (ch = stream.eat(/\{|%|#/)) { - state.tokenize = inTag(ch); - return "tag"; + // Attempt to identify a variable, template or comment tag respectively + if (stream.match("{{")) { + state.tokenize = inVariable; + return "tag"; + } else if (stream.match("{%")) { + state.tokenize = inTag; + return "tag"; + } else if (stream.match("{#")) { + state.tokenize = inComment; + return "comment"; + } + + // Ignore completely any stream series that do not match the + // Django template opening tags. + while (stream.next() != null && !stream.match("{{", false) && !stream.match("{%", false)) {} + return null; + } + + // A string can be included in either single or double quotes (this is + // the delimeter). Mark everything as a string until the start delimeter + // occurs again. + function inString (delimeter, previousTokenizer) { + return function (stream, state) { + if (!state.escapeNext && stream.eat(delimeter)) { + state.tokenize = previousTokenizer; + } else { + if (state.escapeNext) { + state.escapeNext = false; + } + + var ch = stream.next(); + + // Take into account the backslash for escaping characters, such as + // the string delimeter. + if (ch == "\\") { + state.escapeNext = true; + } + } + + return "string"; + }; + } + + // Apply Django template variable syntax highlighting + function inVariable (stream, state) { + // Attempt to match a dot that precedes a property + if (state.waitDot) { + state.waitDot = false; + + if (stream.peek() != ".") { + return "null"; + } + + // Dot folowed by a non-word character should be considered an error. + if (stream.match(/\.\W+/)) { + return "error"; + } else if (stream.eat(".")) { + state.waitProperty = true; + return "null"; + } else { + throw Error ("Unexpected error while waiting for property."); + } + } + + // Attempt to match a pipe that precedes a filter + if (state.waitPipe) { + state.waitPipe = false; + + if (stream.peek() != "|") { + return "null"; + } + + // Pipe folowed by a non-word character should be considered an error. + if (stream.match(/\.\W+/)) { + return "error"; + } else if (stream.eat("|")) { + state.waitFilter = true; + return "null"; + } else { + throw Error ("Unexpected error while waiting for filter."); + } + } + + // Highlight properties + if (state.waitProperty) { + state.waitProperty = false; + if (stream.match(/\b(\w+)\b/)) { + state.waitDot = true; // A property can be followed by another property + state.waitPipe = true; // A property can be followed by a filter + return "property"; } } + + // Highlight filters + if (state.waitFilter) { + state.waitFilter = false; + if (stream.match(filters)) { + return "variable-2"; + } + } + + // Ignore all white spaces + if (stream.eatSpace()) { + state.waitProperty = false; + return "null"; + } + + // Identify numbers + if (stream.match(/\b\d+(\.\d+)?\b/)) { + return "number"; + } + + // Identify strings + if (stream.match("'")) { + state.tokenize = inString("'", state.tokenize); + return "string"; + } else if (stream.match('"')) { + state.tokenize = inString('"', state.tokenize); + return "string"; + } + + // Attempt to find the variable + if (stream.match(/\b(\w+)\b/) && !state.foundVariable) { + state.waitDot = true; + state.waitPipe = true; // A property can be followed by a filter + return "variable"; + } + + // If found closing tag reset + if (stream.match("}}")) { + state.waitProperty = null; + state.waitFilter = null; + state.waitDot = null; + state.waitPipe = null; + state.tokenize = tokenBase; + return "tag"; + } + + // If nothing was found, advance to the next character + stream.next(); + return "null"; } - function inTag (close) { - if (close == "{") { - close = "}"; + + function inTag (stream, state) { + // Attempt to match a dot that precedes a property + if (state.waitDot) { + state.waitDot = false; + + if (stream.peek() != ".") { + return "null"; + } + + // Dot folowed by a non-word character should be considered an error. + if (stream.match(/\.\W+/)) { + return "error"; + } else if (stream.eat(".")) { + state.waitProperty = true; + return "null"; + } else { + throw Error ("Unexpected error while waiting for property."); + } } - return function (stream, state) { - var ch = stream.next(); - if ((ch == close) && stream.eat("}")) { - state.tokenize = tokenBase; - return "tag"; + + // Attempt to match a pipe that precedes a filter + if (state.waitPipe) { + state.waitPipe = false; + + if (stream.peek() != "|") { + return "null"; } - if (stream.match(keywords)) { - return "keyword"; + + // Pipe folowed by a non-word character should be considered an error. + if (stream.match(/\.\W+/)) { + return "error"; + } else if (stream.eat("|")) { + state.waitFilter = true; + return "null"; + } else { + throw Error ("Unexpected error while waiting for filter."); } - return close == "#" ? "comment" : "string"; - }; + } + + // Highlight properties + if (state.waitProperty) { + state.waitProperty = false; + if (stream.match(/\b(\w+)\b/)) { + state.waitDot = true; // A property can be followed by another property + state.waitPipe = true; // A property can be followed by a filter + return "property"; + } + } + + // Highlight filters + if (state.waitFilter) { + state.waitFilter = false; + if (stream.match(filters)) { + return "variable-2"; + } + } + + // Ignore all white spaces + if (stream.eatSpace()) { + state.waitProperty = false; + return "null"; + } + + // Identify numbers + if (stream.match(/\b\d+(\.\d+)?\b/)) { + return "number"; + } + + // Identify strings + if (stream.match("'")) { + state.tokenize = inString("'", state.tokenize); + return "string"; + } else if (stream.match('"')) { + state.tokenize = inString('"', state.tokenize); + return "string"; + } + + // Attempt to match an operator + if (stream.match(operators)) { + return "operator"; + } + + // Attempt to match a keyword + var keywordMatch = stream.match(keywords); + if (keywordMatch) { + if (keywordMatch[0] == "comment") { + state.blockCommentTag = true; + } + return "keyword"; + } + + // Attempt to match a variable + if (stream.match(/\b(\w+)\b/)) { + state.waitDot = true; + state.waitPipe = true; // A property can be followed by a filter + return "variable"; + } + + // If found closing tag reset + if (stream.match("%}")) { + state.waitProperty = null; + state.waitFilter = null; + state.waitDot = null; + state.waitPipe = null; + // If the tag that closes is a block comment tag, we want to mark the + // following code as comment, until the tag closes. + if (state.blockCommentTag) { + state.blockCommentTag = false; // Release the "lock" + state.tokenize = inBlockComment; + } else { + state.tokenize = tokenBase; + } + return "tag"; + } + + // If nothing was found, advance to the next character + stream.next(); + return "null"; + } + + // Mark everything as comment inside the tag and the tag itself. + function inComment (stream, state) { + if (stream.match("#}")) { + state.tokenize = tokenBase; + } + return "comment"; + } + + // Mark everything as a comment until the `blockcomment` tag closes. + function inBlockComment (stream, state) { + if (stream.match(/\{%\s*endcomment\s*%\}/, false)) { + state.tokenize = inTag; + stream.match("{%"); + return "tag"; + } else { + stream.next(); + return "comment"; + } } + return { startState: function () { return {tokenize: tokenBase}; }, token: function (stream, state) { return state.tokenize(stream, state); - } + }, + blockCommentStart: "{% comment %}", + blockCommentEnd: "{% endcomment %}" }; }); diff --git a/media/editors/codemirror/mode/django/django.min.js b/media/editors/codemirror/mode/django/django.min.js new file mode 100644 index 0000000000000..9f0ba66a83763 --- /dev/null +++ b/media/editors/codemirror/mode/django/django.min.js @@ -0,0 +1 @@ +!function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("../htmlmixed/htmlmixed"),require("../../addon/mode/overlay")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../htmlmixed/htmlmixed","../../addon/mode/overlay"],a):a(CodeMirror)}(function(a){"use strict";a.defineMode("django:inner",function(){function a(a,b){if(a.match("{{"))return b.tokenize=c,"tag";if(a.match("{%"))return b.tokenize=d,"tag";if(a.match("{#"))return b.tokenize=e,"comment";for(;null!=a.next()&&!a.match("{{",!1)&&!a.match("{%",!1););return null}function b(a,b){return function(c,d){if(!d.escapeNext&&c.eat(a))d.tokenize=b;else{d.escapeNext&&(d.escapeNext=!1);var e=c.next();"\\"==e&&(d.escapeNext=!0)}return"string"}}function c(c,d){if(d.waitDot){if(d.waitDot=!1,"."!=c.peek())return"null";if(c.match(/\.\W+/))return"error";if(c.eat("."))return d.waitProperty=!0,"null";throw Error("Unexpected error while waiting for property.")}if(d.waitPipe){if(d.waitPipe=!1,"|"!=c.peek())return"null";if(c.match(/\.\W+/))return"error";if(c.eat("|"))return d.waitFilter=!0,"null";throw Error("Unexpected error while waiting for filter.")}return d.waitProperty&&(d.waitProperty=!1,c.match(/\b(\w+)\b/))?(d.waitDot=!0,d.waitPipe=!0,"property"):d.waitFilter&&(d.waitFilter=!1,c.match(h))?"variable-2":c.eatSpace()?(d.waitProperty=!1,"null"):c.match(/\b\d+(\.\d+)?\b/)?"number":c.match("'")?(d.tokenize=b("'",d.tokenize),"string"):c.match('"')?(d.tokenize=b('"',d.tokenize),"string"):c.match(/\b(\w+)\b/)&&!d.foundVariable?(d.waitDot=!0,d.waitPipe=!0,"variable"):c.match("}}")?(d.waitProperty=null,d.waitFilter=null,d.waitDot=null,d.waitPipe=null,d.tokenize=a,"tag"):(c.next(),"null")}function d(c,d){if(d.waitDot){if(d.waitDot=!1,"."!=c.peek())return"null";if(c.match(/\.\W+/))return"error";if(c.eat("."))return d.waitProperty=!0,"null";throw Error("Unexpected error while waiting for property.")}if(d.waitPipe){if(d.waitPipe=!1,"|"!=c.peek())return"null";if(c.match(/\.\W+/))return"error";if(c.eat("|"))return d.waitFilter=!0,"null";throw Error("Unexpected error while waiting for filter.")}if(d.waitProperty&&(d.waitProperty=!1,c.match(/\b(\w+)\b/)))return d.waitDot=!0,d.waitPipe=!0,"property";if(d.waitFilter&&(d.waitFilter=!1,c.match(h)))return"variable-2";if(c.eatSpace())return d.waitProperty=!1,"null";if(c.match(/\b\d+(\.\d+)?\b/))return"number";if(c.match("'"))return d.tokenize=b("'",d.tokenize),"string";if(c.match('"'))return d.tokenize=b('"',d.tokenize),"string";if(c.match(i))return"operator";var e=c.match(g);return e?("comment"==e[0]&&(d.blockCommentTag=!0),"keyword"):c.match(/\b(\w+)\b/)?(d.waitDot=!0,d.waitPipe=!0,"variable"):c.match("%}")?(d.waitProperty=null,d.waitFilter=null,d.waitDot=null,d.waitPipe=null,d.blockCommentTag?(d.blockCommentTag=!1,d.tokenize=f):d.tokenize=a,"tag"):(c.next(),"null")}function e(b,c){return b.match("#}")&&(c.tokenize=a),"comment"}function f(a,b){return a.match(/\{%\s*endcomment\s*%\}/,!1)?(b.tokenize=d,a.match("{%"),"tag"):(a.next(),"comment")}var g=["block","endblock","for","endfor","true","false","loop","none","self","super","if","endif","as","else","import","with","endwith","without","context","ifequal","endifequal","ifnotequal","endifnotequal","extends","include","load","comment","endcomment","empty","url","static","trans","blocktrans","now","regroup","lorem","ifchanged","endifchanged","firstof","debug","cycle","csrf_token","autoescape","endautoescape","spaceless","ssi","templatetag","verbatim","endverbatim","widthratio"],h=["add","addslashes","capfirst","center","cut","date","default","default_if_none","dictsort","dictsortreversed","divisibleby","escape","escapejs","filesizeformat","first","floatformat","force_escape","get_digit","iriencode","join","last","length","length_is","linebreaks","linebreaksbr","linenumbers","ljust","lower","make_list","phone2numeric","pluralize","pprint","random","removetags","rjust","safe","safeseq","slice","slugify","stringformat","striptags","time","timesince","timeuntil","title","truncatechars","truncatechars_html","truncatewords","truncatewords_html","unordered_list","upper","urlencode","urlize","urlizetrunc","wordcount","wordwrap","yesno"],i=["==","!=","<",">","<=",">=","in","not","or","and"];return g=new RegExp("^\\b("+g.join("|")+")\\b"),h=new RegExp("^\\b("+h.join("|")+")\\b"),i=new RegExp("^\\b("+i.join("|")+")\\b"),{startState:function(){return{tokenize:a}},token:function(a,b){return b.tokenize(a,b)},blockCommentStart:"{% comment %}",blockCommentEnd:"{% endcomment %}"}}),a.defineMode("django",function(b){var c=a.getMode(b,"text/html"),d=a.getMode(b,"django:inner");return a.overlayMode(c,d)}),a.defineMIME("text/x-django","django")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/dockerfile/dockerfile.min.js b/media/editors/codemirror/mode/dockerfile/dockerfile.min.js new file mode 100644 index 0000000000000..13ef61e66ff88 --- /dev/null +++ b/media/editors/codemirror/mode/dockerfile/dockerfile.min.js @@ -0,0 +1 @@ +!function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("../../addon/mode/simple")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../../addon/mode/simple"],a):a(CodeMirror)}(function(a){"use strict";var b=["from","maintainer","run","cmd","expose","env","add","copy","entrypoint","volume","user","workdir","onbuild"],c="("+b.join("|")+")",d=new RegExp(c+"\\s*$","i"),e=new RegExp(c+"(\\s+)","i");a.defineSimpleMode("dockerfile",{start:[{regex:/#.*$/,token:"comment"},{regex:d,token:"variable-2"},{regex:e,token:["variable-2",null],next:"arguments"},{regex:/./,token:null}],arguments:[{regex:/#.*$/,token:"error",next:"start"},{regex:/[^#]+\\$/,token:null},{regex:/[^#]+/,token:null,next:"start"},{regex:/$/,token:null,next:"start"},{token:null,next:"start"}]}),a.defineMIME("text/x-dockerfile","dockerfile")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/dtd/dtd.min.js b/media/editors/codemirror/mode/dtd/dtd.min.js new file mode 100644 index 0000000000000..4197455f972cc --- /dev/null +++ b/media/editors/codemirror/mode/dtd/dtd.min.js @@ -0,0 +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("dtd",function(a){function b(a,b){return g=b,a}function c(a,c){var g=a.next();if("<"!=g||!a.eat("!")){if("<"==g&&a.eat("?"))return c.tokenize=f("meta","?>"),b("meta",g);if("#"==g&&a.eatWhile(/[\w]/))return b("atom","tag");if("|"==g)return b("keyword","seperator");if(g.match(/[\(\)\[\]\-\.,\+\?>]/))return b(null,g);if(g.match(/[\[\]]/))return b("rule",g);if('"'==g||"'"==g)return c.tokenize=e(g),c.tokenize(a,c);if(a.eatWhile(/[a-zA-Z\?\+\d]/)){var h=a.current();return null!==h.substr(h.length-1,h.length).match(/\?|\+/)&&a.backUp(1),b("tag","tag")}return"%"==g||"*"==g?b("number","number"):(a.eatWhile(/[\w\\\-_%.{,]/),b(null,null))}return a.eatWhile(/[\-]/)?(c.tokenize=d,d(a,c)):a.eatWhile(/[\w]/)?b("keyword","doindent"):void 0}function d(a,d){for(var e,f=0;null!=(e=a.next());){if(f>=2&&">"==e){d.tokenize=c;break}f="-"==e?f+1:0}return b("comment","comment")}function e(a){return function(d,e){for(var f,g=!1;null!=(f=d.next());){if(f==a&&!g){e.tokenize=c;break}g=!g&&"\\"==f}return b("string","tag")}}function f(a,b){return function(d,e){for(;!d.eol();){if(d.match(b)){e.tokenize=c;break}d.next()}return a}}var g,h=a.indentUnit;return{startState:function(a){return{tokenize:c,baseIndent:a||0,stack:[]}},token:function(a,b){if(a.eatSpace())return null;var c=b.tokenize(a,b),d=b.stack[b.stack.length-1];return"["==a.current()||"doindent"===g||"["==g?b.stack.push("rule"):"endtag"===g?b.stack[b.stack.length-1]="endtag":"]"==a.current()||"]"==g||">"==g&&"rule"==d?b.stack.pop():"["==g&&b.stack.push("["),c},indent:function(a,b){var c=a.stack.length;return b.match(/\]\s+|\]/)?c-=1:">"===b.substr(b.length-1,b.length)&&("<"===b.substr(0,1)||"doindent"==g&&b.length>1||("doindent"==g?c--:">"==g&&b.length>1||"tag"==g&&">"!==b||("tag"==g&&"rule"==a.stack[a.stack.length-1]?c--:"tag"==g?c++:">"===b&&"rule"==a.stack[a.stack.length-1]&&">"===g?c--:">"===b&&"rule"==a.stack[a.stack.length-1]||("<"!==b.substr(0,1)&&">"===b.substr(0,1)?c-=1:">"===b||(c-=1)))),(null==g||"]"==g)&&c--),a.baseIndent+c*h},electricChars:"]>"}}),a.defineMIME("application/xml-dtd","dtd")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/dylan/dylan.js b/media/editors/codemirror/mode/dylan/dylan.js index be2986adb542e..85f0166c10a1f 100644 --- a/media/editors/codemirror/mode/dylan/dylan.js +++ b/media/editors/codemirror/mode/dylan/dylan.js @@ -154,20 +154,12 @@ CodeMirror.defineMode("dylan", function(_config) { return f(stream, state); } - var type, content; - - function ret(_type, style, _content) { - type = _type; - content = _content; - return style; - } - function tokenBase(stream, state) { // String var ch = stream.peek(); if (ch == "'" || ch == '"') { stream.next(); - return chain(stream, state, tokenString(ch, "string", "string")); + return chain(stream, state, tokenString(ch, "string")); } // Comment else if (ch == "/") { @@ -176,16 +168,16 @@ CodeMirror.defineMode("dylan", function(_config) { return chain(stream, state, tokenComment); } else if (stream.eat("/")) { stream.skipToEnd(); - return ret("comment", "comment"); + return "comment"; } else { stream.skipTo(" "); - return ret("operator", "operator"); + return "operator"; } } // Decimal else if (/\d/.test(ch)) { stream.match(/^\d*(?:\.\d*)?(?:e[+\-]?\d+)?/); - return ret("number", "number"); + return "number"; } // Hash else if (ch == "#") { @@ -194,33 +186,33 @@ CodeMirror.defineMode("dylan", function(_config) { ch = stream.peek(); if (ch == '"') { stream.next(); - return chain(stream, state, tokenString('"', "symbol", "string-2")); + return chain(stream, state, tokenString('"', "string-2")); } // Binary number else if (ch == "b") { stream.next(); stream.eatWhile(/[01]/); - return ret("number", "number"); + return "number"; } // Hex number else if (ch == "x") { stream.next(); stream.eatWhile(/[\da-f]/i); - return ret("number", "number"); + return "number"; } // Octal number else if (ch == "o") { stream.next(); stream.eatWhile(/[0-7]/); - return ret("number", "number"); + return "number"; } // Hash symbol else { stream.eatWhile(/[-a-zA-Z]/); - return ret("hash", "keyword"); + return "keyword"; } } else if (stream.match("end")) { - return ret("end", "keyword"); + return "keyword"; } for (var name in patterns) { if (patterns.hasOwnProperty(name)) { @@ -228,21 +220,21 @@ CodeMirror.defineMode("dylan", function(_config) { if ((pattern instanceof Array && pattern.some(function(p) { return stream.match(p); })) || stream.match(pattern)) - return ret(name, patternStyles[name], stream.current()); + return patternStyles[name]; } } if (stream.match("define")) { - return ret("definition", "def"); + return "def"; } else { stream.eatWhile(/[\w\-]/); // Keyword if (wordLookup[stream.current()]) { - return ret(wordLookup[stream.current()], styleLookup[stream.current()], stream.current()); + return styleLookup[stream.current()]; } else if (stream.current().match(symbol)) { - return ret("variable", "variable"); + return "variable"; } else { stream.next(); - return ret("other", "variable-2"); + return "variable-2"; } } } @@ -257,10 +249,10 @@ CodeMirror.defineMode("dylan", function(_config) { } maybeEnd = (ch == "*"); } - return ret("comment", "comment"); + return "comment"; } - function tokenString(quote, type, style) { + function tokenString(quote, style) { return function(stream, state) { var next, end = false; while ((next = stream.next()) != null) { @@ -271,7 +263,7 @@ CodeMirror.defineMode("dylan", function(_config) { } if (end) state.tokenize = tokenBase; - return ret(type, style); + return style; }; } diff --git a/media/editors/codemirror/mode/dylan/dylan.min.js b/media/editors/codemirror/mode/dylan/dylan.min.js new file mode 100644 index 0000000000000..550880b2267d5 --- /dev/null +++ b/media/editors/codemirror/mode/dylan/dylan.min.js @@ -0,0 +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("dylan",function(a){function b(a,b,c){return b.tokenize=c,c(a,b)}function c(a,c){var f=a.peek();if("'"==f||'"'==f)return a.next(),b(a,c,e(f,"string"));if("/"==f)return a.next(),a.eat("*")?b(a,c,d):a.eat("/")?(a.skipToEnd(),"comment"):(a.skipTo(" "),"operator");if(/\d/.test(f))return a.match(/^\d*(?:\.\d*)?(?:e[+\-]?\d+)?/),"number";if("#"==f)return a.next(),f=a.peek(),'"'==f?(a.next(),b(a,c,e('"',"string-2"))):"b"==f?(a.next(),a.eatWhile(/[01]/),"number"):"x"==f?(a.next(),a.eatWhile(/[\da-f]/i),"number"):"o"==f?(a.next(),a.eatWhile(/[0-7]/),"number"):(a.eatWhile(/[-a-zA-Z]/),"keyword");if(a.match("end"))return"keyword";for(var g in i)if(i.hasOwnProperty(g)){var k=i[g];if(k instanceof Array&&k.some(function(b){return a.match(b)})||a.match(k))return j[g]}return a.match("define")?"def":(a.eatWhile(/[\w\-]/),m[a.current()]?n[a.current()]:a.current().match(h)?"variable":(a.next(),"variable-2"))}function d(a,b){for(var d,e=!1;d=a.next();){if("/"==d&&e){b.tokenize=c;break}e="*"==d}return"comment"}function e(a,b){return function(d,e){for(var f,g=!1;null!=(f=d.next());)if(f==a){g=!0;break}return g&&(e.tokenize=c),b}}var f={unnamedDefinition:["interface"],namedDefinition:["module","library","macro","C-struct","C-union","C-function","C-callable-wrapper"],typeParameterizedDefinition:["class","C-subtype","C-mapped-subtype"],otherParameterizedDefinition:["method","function","C-variable","C-address"],constantSimpleDefinition:["constant"],variableSimpleDefinition:["variable"],otherSimpleDefinition:["generic","domain","C-pointer-type","table"],statement:["if","block","begin","method","case","for","select","when","unless","until","while","iterate","profiling","dynamic-bind"],separator:["finally","exception","cleanup","else","elseif","afterwards"],other:["above","below","by","from","handler","in","instance","let","local","otherwise","slot","subclass","then","to","keyed-by","virtual"],signalingCalls:["signal","error","cerror","break","check-type","abort"]};f.otherDefinition=f.unnamedDefinition.concat(f.namedDefinition).concat(f.otherParameterizedDefinition),f.definition=f.typeParameterizedDefinition.concat(f.otherDefinition),f.parameterizedDefinition=f.typeParameterizedDefinition.concat(f.otherParameterizedDefinition),f.simpleDefinition=f.constantSimpleDefinition.concat(f.variableSimpleDefinition).concat(f.otherSimpleDefinition),f.keyword=f.statement.concat(f.separator).concat(f.other);var g="[-_a-zA-Z?!*@<>$%]+",h=new RegExp("^"+g),i={symbolKeyword:g+":",symbolClass:"<"+g+">",symbolGlobal:"\\*"+g+"\\*",symbolConstant:"\\$"+g},j={symbolKeyword:"atom",symbolClass:"tag",symbolGlobal:"variable-2",symbolConstant:"variable-3"};for(var k in i)i.hasOwnProperty(k)&&(i[k]=new RegExp("^"+i[k]));i.keyword=[/^with(?:out)?-[-_a-zA-Z?!*@<>$%]+/];var l={};l.keyword="keyword",l.definition="def",l.simpleDefinition="def",l.signalingCalls="builtin";var m={},n={};return["keyword","definition","simpleDefinition","signalingCalls"].forEach(function(a){f[a].forEach(function(b){m[b]=a,n[b]=l[a]})}),{startState:function(){return{tokenize:c,currentIndent:0}},token:function(a,b){if(a.eatSpace())return null;var c=b.tokenize(a,b);return c},blockCommentStart:"/*",blockCommentEnd:"*/"}}),a.defineMIME("text/x-dylan","dylan")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/ebnf/ebnf.min.js b/media/editors/codemirror/mode/ebnf/ebnf.min.js new file mode 100644 index 0000000000000..8c0cfbbab405c --- /dev/null +++ b/media/editors/codemirror/mode/ebnf/ebnf.min.js @@ -0,0 +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("ebnf",function(b){var c={slash:0,parenthesis:1},d={comment:0,_string:1,characterClass:2},e=null;return b.bracesMode&&(e=a.getMode(b,b.bracesMode)),{startState:function(){return{stringType:null,commentType:null,braced:0,lhs:!0,localState:null,stack:[],inDefinition:!1}},token:function(a,b){if(a){switch(0===b.stack.length&&('"'==a.peek()||"'"==a.peek()?(b.stringType=a.peek(),a.next(),b.stack.unshift(d._string)):a.match(/^\/\*/)?(b.stack.unshift(d.comment),b.commentType=c.slash):a.match(/^\(\*/)&&(b.stack.unshift(d.comment),b.commentType=c.parenthesis)),b.stack[0]){case d._string:for(;b.stack[0]===d._string&&!a.eol();)a.peek()===b.stringType?(a.next(),b.stack.shift()):"\\"===a.peek()?(a.next(),a.next()):a.match(/^.[^\\\"\']*/);return b.lhs?"property string":"string";case d.comment:for(;b.stack[0]===d.comment&&!a.eol();)b.commentType===c.slash&&a.match(/\*\//)?(b.stack.shift(),b.commentType=null):b.commentType===c.parenthesis&&a.match(/\*\)/)?(b.stack.shift(),b.commentType=null):a.match(/^.[^\*]*/);return"comment";case d.characterClass:for(;b.stack[0]===d.characterClass&&!a.eol();)a.match(/^[^\]\\]+/)||a.match(/^\\./)||b.stack.shift();return"operator"}var f=a.peek();if(null!==e&&(b.braced||"{"===f)){null===b.localState&&(b.localState=e.startState());var g=e.token(a,b.localState),h=a.current();if(!g)for(var i=0;i>/))return"builtin"}return a.match(/^\/\//)?(a.skipToEnd(),"comment"):a.match(/return/)?"operator":a.match(/^[a-zA-Z_][a-zA-Z0-9_]*/)?a.match(/(?=[\(.])/)?"variable":a.match(/(?=[\s\n]*[:=])/)?"def":"variable-2":-1!=["[","]","(",")"].indexOf(a.peek())?(a.next(),"bracket"):(a.eatSpace()||a.next(),null)}}}}),a.defineMIME("text/x-ebnf","ebnf")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/ecl/ecl.js b/media/editors/codemirror/mode/ecl/ecl.js index 18778f1691298..8df7ebe4aba81 100644 --- a/media/editors/codemirror/mode/ecl/ecl.js +++ b/media/editors/codemirror/mode/ecl/ecl.js @@ -34,7 +34,6 @@ CodeMirror.defineMode("ecl", function(config) { var blockKeywords = words("catch class do else finally for if switch try while"); var atoms = words("true false null"); var hooks = {"#": metaHook}; - var multiLineStrings; var isOperatorChar = /[+\-*&%=<>!?|\/]/; var curPunc; @@ -112,7 +111,7 @@ CodeMirror.defineMode("ecl", function(config) { if (next == quote && !escaped) {end = true; break;} escaped = !escaped && next == "\\"; } - if (end || !(escaped || multiLineStrings)) + if (end || !escaped) state.tokenize = tokenBase; return "string"; }; diff --git a/media/editors/codemirror/mode/ecl/ecl.min.js b/media/editors/codemirror/mode/ecl/ecl.min.js new file mode 100644 index 0000000000000..18584615aafb8 --- /dev/null +++ b/media/editors/codemirror/mode/ecl/ecl.min.js @@ -0,0 +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("ecl",function(a){function b(a){for(var b={},c=a.split(" "),d=0;d=0&&(!isNaN(g[h])||"_"==g[h]);)--h;if(h>0){var i=g.substr(0,h+1);if(o.propertyIsEnumerable(i))return q.propertyIsEnumerable(i)&&(j="newstatement"),"variable-3"}return r.propertyIsEnumerable(g)?"atom":null}function e(a){return function(b,c){for(var e,f=!1,g=!1;null!=(e=b.next());){if(e==a&&!f){g=!0;break}f=!f&&"\\"==e}return(g||!f)&&(c.tokenize=d),"string"}}function f(a,b){for(var c,e=!1;c=a.next();){if("/"==c&&e){b.tokenize=d;break}e="*"==c}return"comment"}function g(a,b,c,d,e){this.indented=a,this.column=b,this.type=c,this.align=d,this.prev=e}function h(a,b,c){return a.context=new g(a.indented,b,c,null,a.context)}function i(a){var b=a.context.type;return(")"==b||"]"==b||"}"==b)&&(a.indented=a.context.indented),a.context=a.context.prev}var j,k=a.indentUnit,l=b("abs acos allnodes ascii asin asstring atan atan2 ave case choose choosen choosesets clustersize combine correlation cos cosh count covariance cron dataset dedup define denormalize distribute distributed distribution ebcdic enth error evaluate event eventextra eventname exists exp failcode failmessage fetch fromunicode getisvalid global graph group hash hash32 hash64 hashcrc hashmd5 having if index intformat isvalid iterate join keyunicode length library limit ln local log loop map matched matchlength matchposition matchtext matchunicode max merge mergejoin min nolocal nonempty normalize parse pipe power preload process project pull random range rank ranked realformat recordof regexfind regexreplace regroup rejected rollup round roundup row rowdiff sample set sin sinh sizeof soapcall sort sorted sqrt stepped stored sum table tan tanh thisnode topn tounicode transfer trim truncate typeof ungroup unicodeorder variance which workunit xmldecode xmlencode xmltext xmlunicode"),m=b("apply assert build buildindex evaluate fail keydiff keypatch loadxml nothor notify output parallel sequential soapcall wait"),n=b("__compressed__ all and any as atmost before beginc++ best between case const counter csv descend encrypt end endc++ endmacro except exclusive expire export extend false few first flat from full function group header heading hole ifblock import in interface joined keep keyed last left limit load local locale lookup macro many maxcount maxlength min skew module named nocase noroot noscan nosort not of only opt or outer overwrite packed partition penalty physicallength pipe quote record relationship repeat return right scan self separator service shared skew skip sql store terminator thor threshold token transform trim true type unicodeorder unsorted validate virtual whole wild within xml xpath"),o=b("ascii big_endian boolean data decimal ebcdic integer pattern qstring real record rule set of string token udecimal unicode unsigned varstring varunicode"),p=b("checkpoint deprecated failcode failmessage failure global independent onwarning persist priority recovery stored success wait when"),q=b("catch class do else finally for if switch try while"),r=b("true false null"),s={"#":c},t=/[+\-*&%=<>!?|\/]/;return{startState:function(a){return{tokenize:null,context:new g((a||0)-k,0,"top",!1),indented:0,startOfLine:!0}},token:function(a,b){var c=b.context;if(a.sol()&&(null==c.align&&(c.align=!1),b.indented=a.indentation(),b.startOfLine=!0),a.eatSpace())return null;j=null;var e=(b.tokenize||d)(a,b);if("comment"==e||"meta"==e)return e;if(null==c.align&&(c.align=!0),";"!=j&&":"!=j||"statement"!=c.type)if("{"==j)h(b,a.column(),"}");else if("["==j)h(b,a.column(),"]");else if("("==j)h(b,a.column(),")");else if("}"==j){for(;"statement"==c.type;)c=i(b);for("}"==c.type&&(c=i(b));"statement"==c.type;)c=i(b)}else j==c.type?i(b):("}"==c.type||"top"==c.type||"statement"==c.type&&"newstatement"==j)&&h(b,a.column(),"statement");else i(b);return b.startOfLine=!1,e},indent:function(a,b){if(a.tokenize!=d&&null!=a.tokenize)return 0;var c=a.context,e=b&&b.charAt(0);"statement"==c.type&&"}"==e&&(c=c.prev);var f=e==c.type;return"statement"==c.type?c.indented+("{"==e?0:k):c.align?c.column+(f?0:1):c.indented+(f?0:k)},electricChars:"{}"}}),a.defineMIME("text/x-ecl","ecl")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/eiffel/eiffel.js b/media/editors/codemirror/mode/eiffel/eiffel.js index fcdf295cbc912..b8b70e36e503e 100644 --- a/media/editors/codemirror/mode/eiffel/eiffel.js +++ b/media/editors/codemirror/mode/eiffel/eiffel.js @@ -84,7 +84,6 @@ CodeMirror.defineMode("eiffel", function() { 'or' ]); var operators = wordObj([":=", "and then","and", "or","<<",">>"]); - var curPunc; function chain(newtok, stream, state) { state.tokenize.push(newtok); @@ -92,7 +91,6 @@ CodeMirror.defineMode("eiffel", function() { } function tokenBase(stream, state) { - curPunc = null; if (stream.eatSpace()) return null; var ch = stream.next(); if (ch == '"'||ch == "'") { diff --git a/media/editors/codemirror/mode/eiffel/eiffel.min.js b/media/editors/codemirror/mode/eiffel/eiffel.min.js new file mode 100644 index 0000000000000..59d7d0aad5045 --- /dev/null +++ b/media/editors/codemirror/mode/eiffel/eiffel.min.js @@ -0,0 +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("eiffel",function(){function a(a){for(var b={},c=0,d=a.length;d>c;++c)b[a[c]]=!0;return b}function b(a,b,c){return c.tokenize.push(a),a(b,c)}function c(a,c){if(a.eatSpace())return null;var e=a.next();return'"'==e||"'"==e?b(d(e,"string"),a,c):"-"==e&&a.eat("-")?(a.skipToEnd(),"comment"):":"==e&&a.eat("=")?"operator":/[0-9]/.test(e)?(a.eatWhile(/[xXbBCc0-9\.]/),a.eat(/[\?\!]/),"ident"):/[a-zA-Z_0-9]/.test(e)?(a.eatWhile(/[a-zA-Z_0-9]/),a.eat(/[\?\!]/),"ident"):/[=+\-\/*^%<>~]/.test(e)?(a.eatWhile(/[=+\-\/*^%<>~]/),"operator"):null}function d(a,b,c){return function(d,e){for(var f,g=!1;null!=(f=d.next());){if(f==a&&(c||!g)){e.tokenize.pop();break}g=!g&&"%"==f}return b}}var e=a(["note","across","when","variant","until","unique","undefine","then","strip","select","retry","rescue","require","rename","reference","redefine","prefix","once","old","obsolete","loop","local","like","is","inspect","infix","include","if","frozen","from","external","export","ensure","end","elseif","else","do","creation","create","check","alias","agent","separate","invariant","inherit","indexing","feature","expanded","deferred","class","Void","True","Result","Precursor","False","Current","create","attached","detachable","as","and","implies","not","or"]),f=a([":=","and then","and","or","<<",">>"]);return{startState:function(){return{tokenize:[c]}},token:function(a,b){var c=b.tokenize[b.tokenize.length-1](a,b);if("ident"==c){var d=a.current();c=e.propertyIsEnumerable(a.current())?"keyword":f.propertyIsEnumerable(a.current())?"operator":/^[A-Z][A-Z_0-9]*$/g.test(d)?"tag":/^0[bB][0-1]+$/g.test(d)?"number":/^0[cC][0-7]+$/g.test(d)?"number":/^0[xX][a-fA-F0-9]+$/g.test(d)?"number":/^([0-9]+\.[0-9]*)|([0-9]*\.[0-9]+)$/g.test(d)?"number":/^[0-9]+$/g.test(d)?"number":"variable"}return c},lineComment:"--"}}),a.defineMIME("text/x-eiffel","eiffel")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/erlang/erlang.min.js b/media/editors/codemirror/mode/erlang/erlang.min.js new file mode 100644 index 0000000000000..963bd258c00a7 --- /dev/null +++ b/media/editors/codemirror/mode/erlang/erlang.min.js @@ -0,0 +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.defineMIME("text/x-erlang","erlang"),a.defineMode("erlang",function(b){function c(a,b){if(b.in_string)return b.in_string=!f(a),k(b,a,"string");if(b.in_atom)return b.in_atom=!g(a),k(b,a,"atom");if(a.eatSpace())return k(b,a,"whitespace");if(!o(b)&&a.match(/-\s*[a-zß-öø-ÿ][\wØ-ÞÀ-Öß-öø-ÿ]*/))return j(a.current(),A)?k(b,a,"type"):k(b,a,"attribute");var c=a.next();if("%"==c)return a.skipToEnd(),k(b,a,"comment");if(":"==c)return k(b,a,"colon");if("?"==c)return a.eatSpace(),a.eatWhile(N),k(b,a,"macro");if("#"==c)return a.eatSpace(),a.eatWhile(N),k(b,a,"record");if("$"==c)return"\\"!=a.next()||a.match(O)?k(b,a,"number"):k(b,a,"error");if("."==c)return k(b,a,"dot");if("'"==c){if(!(b.in_atom=!g(a))){if(a.match(/\s*\/\s*[0-9]/,!1))return a.match(/\s*\/\s*[0-9]/,!0),k(b,a,"fun");if(a.match(/\s*\(/,!1)||a.match(/\s*:/,!1))return k(b,a,"function")}return k(b,a,"atom")}if('"'==c)return b.in_string=!f(a),k(b,a,"string");if(/[A-Z_Ø-ÞÀ-Ö]/.test(c))return a.eatWhile(N),k(b,a,"variable");if(/[a-z_ß-öø-ÿ]/.test(c)){if(a.eatWhile(N),a.match(/\s*\/\s*[0-9]/,!1))return a.match(/\s*\/\s*[0-9]/,!0),k(b,a,"fun");var h=a.current();return j(h,B)?k(b,a,"keyword"):j(h,E)?k(b,a,"operator"):a.match(/\s*\(/,!1)?!j(h,M)||":"==o(b).token&&"erlang"!=o(b,2).token?j(h,L)?k(b,a,"guard"):k(b,a,"function"):k(b,a,"builtin"):j(h,E)?k(b,a,"operator"):":"==i(a)?"erlang"==h?k(b,a,"builtin"):k(b,a,"function"):j(h,["true","false"])?k(b,a,"boolean"):j(h,["true","false"])?k(b,a,"boolean"):k(b,a,"atom")}var l=/[0-9]/,m=/[0-9a-zA-Z]/;return l.test(c)?(a.eatWhile(l),a.eat("#")?a.eatWhile(m)||a.backUp(1):a.eat(".")&&(a.eatWhile(l)?a.eat(/[eE]/)&&(a.eat(/[-+]/)?a.eatWhile(l)||a.backUp(2):a.eatWhile(l)||a.backUp(1)):a.backUp(1)),k(b,a,"number")):d(a,H,I)?k(b,a,"open_paren"):d(a,J,K)?k(b,a,"close_paren"):e(a,C,D)?k(b,a,"separator"):e(a,F,G)?k(b,a,"operator"):k(b,a,null)}function d(a,b,c){if(1==a.current().length&&b.test(a.current())){for(a.backUp(1);b.test(a.peek());)if(a.next(),j(a.current(),c))return!0;a.backUp(a.current().length-1)}return!1}function e(a,b,c){if(1==a.current().length&&b.test(a.current())){for(;b.test(a.peek());)a.next();for(;0c?!1:a.tokenStack[c-d]}function p(a,b){"comment"!=b.type&&"whitespace"!=b.type&&(a.tokenStack=q(a.tokenStack,b),a.tokenStack=r(a.tokenStack))}function q(a,b){var c=a.length-1;return c>0&&"record"===a[c].type&&"dot"===b.type?a.pop():c>0&&"group"===a[c].type?(a.pop(),a.push(b)):a.push(b),a}function r(a){var b=a.length-1;if("dot"===a[b].type)return[];if("fun"===a[b].type&&"fun"===a[b-1].token)return a.slice(0,b-1);switch(a[a.length-1].token){case"}":return s(a,{g:["{"]});case"]":return s(a,{i:["["]});case")":return s(a,{i:["("]});case">>":return s(a,{i:["<<"]});case"end":return s(a,{i:["begin","case","fun","if","receive","try"]});case",":return s(a,{e:["begin","try","when","->",",","(","[","{","<<"]});case"->":return s(a,{r:["when"],m:["try","if","case","receive"]});case";":return s(a,{E:["case","fun","if","receive","try","when"]});case"catch":return s(a,{e:["try"]});case"of":return s(a,{e:["case"]});case"after":return s(a,{e:["receive","try"]});default:return a}}function s(a,b){for(var c in b)for(var d=a.length-1,e=b[c],f=d-1;f>-1;f--)if(j(a[f].token,e)){var g=a.slice(0,f);switch(c){case"m":return g.concat(a[f]).concat(a[d]);case"r":return g.concat(a[d]);case"i":return g;case"g":return g.concat(n("group"));case"E":return g.concat(a[f]);case"e":return g.concat(a[f])}}return"E"==c?[]:a}function t(c,d){var e,f=b.indentUnit,g=u(d),h=o(c,1),i=o(c,2);return c.in_string||c.in_atom?a.Pass:i?"when"==h.token?h.column+f:"when"===g&&"function"===i.type?i.indent+f:"("===g&&"fun"===h.token?h.column+3:"catch"===g&&(e=x(c,["try"]))?e.column:j(g,["end","after","of"])?(e=x(c,["begin","case","fun","if","receive","try"]),e?e.column:a.Pass):j(g,K)?(e=x(c,I),e?e.column:a.Pass):j(h.token,[",","|","||"])||j(g,[",","|","||"])?(e=v(c),e?e.column+e.token.length:f):"->"==h.token?j(i.token,["receive","case","if","try"])?i.column+f+f:i.column+f:j(h.token,I)?h.column+h.token.length:(e=w(c),z(e)?e.column+f:0):0}function u(a){var b=a.match(/,|[a-z]+|\}|\]|\)|>>|\|+|\(/);return z(b)&&0===b.index?b[0]:""}function v(a){var b=a.tokenStack.slice(0,-1),c=y(b,"type",["open_paren"]);return z(b[c])?b[c]:!1}function w(a){var b=a.tokenStack,c=y(b,"type",["open_paren","separator","keyword"]),d=y(b,"type",["operator"]);return z(c)&&z(d)&&d>c?b[c+1]:z(c)?b[c]:!1}function x(a,b){var c=a.tokenStack,d=y(c,"token",b);return z(c[d])?c[d]:!1}function y(a,b,c){for(var d=a.length-1;d>-1;d--)if(j(a[d][b],c))return d;return!1}function z(a){return a!==!1&&null!=a}var A=["-type","-spec","-export_type","-opaque"],B=["after","begin","catch","case","cond","end","fun","if","let","of","query","receive","try","when"],C=/[\->,;]/,D=["->",";",","],E=["and","andalso","band","bnot","bor","bsl","bsr","bxor","div","not","or","orelse","rem","xor"],F=/[\+\-\*\/<>=\|:!]/,G=["=","+","-","*","/",">",">=","<","=<","=:=","==","=/=","/=","||","<-","!"],H=/[<\(\[\{]/,I=["<<","(","[","{"],J=/[>\)\]\}]/,K=["}","]",")",">>"],L=["is_atom","is_binary","is_bitstring","is_boolean","is_float","is_function","is_integer","is_list","is_number","is_pid","is_port","is_record","is_reference","is_tuple","atom","binary","bitstring","boolean","function","integer","list","number","pid","port","record","reference","tuple"],M=["abs","adler32","adler32_combine","alive","apply","atom_to_binary","atom_to_list","binary_to_atom","binary_to_existing_atom","binary_to_list","binary_to_term","bit_size","bitstring_to_list","byte_size","check_process_code","contact_binary","crc32","crc32_combine","date","decode_packet","delete_module","disconnect_node","element","erase","exit","float","float_to_list","garbage_collect","get","get_keys","group_leader","halt","hd","integer_to_list","internal_bif","iolist_size","iolist_to_binary","is_alive","is_atom","is_binary","is_bitstring","is_boolean","is_float","is_function","is_integer","is_list","is_number","is_pid","is_port","is_process_alive","is_record","is_reference","is_tuple","length","link","list_to_atom","list_to_binary","list_to_bitstring","list_to_existing_atom","list_to_float","list_to_integer","list_to_pid","list_to_tuple","load_module","make_ref","module_loaded","monitor_node","node","node_link","node_unlink","nodes","notalive","now","open_port","pid_to_list","port_close","port_command","port_connect","port_control","pre_loaded","process_flag","process_info","processes","purge_module","put","register","registered","round","self","setelement","size","spawn","spawn_link","spawn_monitor","spawn_opt","split_binary","statistics","term_to_binary","time","throw","tl","trunc","tuple_size","tuple_to_list","unlink","unregister","whereis"],N=/[\w@Ø-ÞÀ-Öß-öø-ÿ]/,O=/[0-7]{1,3}|[bdefnrstv\\"']|\^[a-zA-Z]|x[0-9a-zA-Z]{2}|x{[0-9a-zA-Z]+}/;return{startState:function(){return{tokenStack:[],in_string:!1,in_atom:!1}},token:function(a,b){return c(a,b)},indent:function(a,b){return t(a,b)},lineComment:"%"}})}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/forth/forth.js b/media/editors/codemirror/mode/forth/forth.js new file mode 100644 index 0000000000000..1f519d886212b --- /dev/null +++ b/media/editors/codemirror/mode/forth/forth.js @@ -0,0 +1,180 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +// Author: Aliaksei Chapyzhenka + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + function toWordList(words) { + var ret = []; + words.split(' ').forEach(function(e){ + ret.push({name: e}); + }); + return ret; + } + + var coreWordList = toWordList( +'INVERT AND OR XOR\ + 2* 2/ LSHIFT RSHIFT\ + 0= = 0< < > U< MIN MAX\ + 2DROP 2DUP 2OVER 2SWAP ?DUP DEPTH DROP DUP OVER ROT SWAP\ + >R R> R@\ + + - 1+ 1- ABS NEGATE\ + S>D * M* UM*\ + FM/MOD SM/REM UM/MOD */ */MOD / /MOD MOD\ + HERE , @ ! CELL+ CELLS C, C@ C! CHARS 2@ 2!\ + ALIGN ALIGNED +! ALLOT\ + CHAR [CHAR] [ ] BL\ + FIND EXECUTE IMMEDIATE COUNT LITERAL STATE\ + ; DOES> >BODY\ + EVALUATE\ + SOURCE >IN\ + <# # #S #> HOLD SIGN BASE >NUMBER HEX DECIMAL\ + FILL MOVE\ + . CR EMIT SPACE SPACES TYPE U. .R U.R\ + ACCEPT\ + TRUE FALSE\ + <> U> 0<> 0>\ + NIP TUCK ROLL PICK\ + 2>R 2R@ 2R>\ + WITHIN UNUSED MARKER\ + I J\ + TO\ + COMPILE, [COMPILE]\ + SAVE-INPUT RESTORE-INPUT\ + PAD ERASE\ + 2LITERAL DNEGATE\ + D- D+ D0< D0= D2* D2/ D< D= DMAX DMIN D>S DABS\ + M+ M*/ D. D.R 2ROT DU<\ + CATCH THROW\ + FREE RESIZE ALLOCATE\ + CS-PICK CS-ROLL\ + GET-CURRENT SET-CURRENT FORTH-WORDLIST GET-ORDER SET-ORDER\ + PREVIOUS SEARCH-WORDLIST WORDLIST FIND ALSO ONLY FORTH DEFINITIONS ORDER\ + -TRAILING /STRING SEARCH COMPARE CMOVE CMOVE> BLANK SLITERAL'); + + var immediateWordList = toWordList('IF ELSE THEN BEGIN WHILE REPEAT UNTIL RECURSE [IF] [ELSE] [THEN] ?DO DO LOOP +LOOP UNLOOP LEAVE EXIT AGAIN CASE OF ENDOF ENDCASE'); + + CodeMirror.defineMode('forth', function() { + function searchWordList (wordList, word) { + var i; + for (i = wordList.length - 1; i >= 0; i--) { + if (wordList[i].name === word.toUpperCase()) { + return wordList[i]; + } + } + return undefined; + } + return { + startState: function() { + return { + state: '', + base: 10, + coreWordList: coreWordList, + immediateWordList: immediateWordList, + wordList: [] + }; + }, + token: function (stream, stt) { + var mat; + if (stream.eatSpace()) { + return null; + } + if (stt.state === '') { // interpretation + if (stream.match(/^(\]|:NONAME)(\s|$)/i)) { + stt.state = ' compilation'; + return 'builtin compilation'; + } + mat = stream.match(/^(\:)\s+(\S+)(\s|$)+/); + if (mat) { + stt.wordList.push({name: mat[2].toUpperCase()}); + stt.state = ' compilation'; + return 'def' + stt.state; + } + mat = stream.match(/^(VARIABLE|2VARIABLE|CONSTANT|2CONSTANT|CREATE|POSTPONE|VALUE|WORD)\s+(\S+)(\s|$)+/i); + if (mat) { + stt.wordList.push({name: mat[2].toUpperCase()}); + return 'def' + stt.state; + } + mat = stream.match(/^(\'|\[\'\])\s+(\S+)(\s|$)+/); + if (mat) { + return 'builtin' + stt.state; + } + } else { // compilation + // ; [ + if (stream.match(/^(\;|\[)(\s)/)) { + stt.state = ''; + stream.backUp(1); + return 'builtin compilation'; + } + if (stream.match(/^(\;|\[)($)/)) { + stt.state = ''; + return 'builtin compilation'; + } + if (stream.match(/^(POSTPONE)\s+\S+(\s|$)+/)) { + return 'builtin'; + } + } + + // dynamic wordlist + mat = stream.match(/^(\S+)(\s+|$)/); + if (mat) { + if (searchWordList(stt.wordList, mat[1]) !== undefined) { + return 'variable' + stt.state; + } + + // comments + if (mat[1] === '\\') { + stream.skipToEnd(); + return 'comment' + stt.state; + } + + // core words + if (searchWordList(stt.coreWordList, mat[1]) !== undefined) { + return 'builtin' + stt.state; + } + if (searchWordList(stt.immediateWordList, mat[1]) !== undefined) { + return 'keyword' + stt.state; + } + + if (mat[1] === '(') { + stream.eatWhile(function (s) { return s !== ')'; }); + stream.eat(')'); + return 'comment' + stt.state; + } + + // // strings + if (mat[1] === '.(') { + stream.eatWhile(function (s) { return s !== ')'; }); + stream.eat(')'); + return 'string' + stt.state; + } + if (mat[1] === 'S"' || mat[1] === '."' || mat[1] === 'C"') { + stream.eatWhile(function (s) { return s !== '"'; }); + stream.eat('"'); + return 'string' + stt.state; + } + + // numbers + if (mat[1] - 0xfffffffff) { + return 'number' + stt.state; + } + // if (mat[1].match(/^[-+]?[0-9]+\.[0-9]*/)) { + // return 'number' + stt.state; + // } + + return 'atom' + stt.state; + } + } + }; + }); + CodeMirror.defineMIME("text/x-forth", "forth"); +}); diff --git a/media/editors/codemirror/mode/forth/forth.min.js b/media/editors/codemirror/mode/forth/forth.min.js new file mode 100644 index 0000000000000..3afd7ae044591 --- /dev/null +++ b/media/editors/codemirror/mode/forth/forth.min.js @@ -0,0 +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){var b=[];return a.split(" ").forEach(function(a){b.push({name:a})}),b}var c=b("INVERT AND OR XOR 2* 2/ LSHIFT RSHIFT 0= = 0< < > U< MIN MAX 2DROP 2DUP 2OVER 2SWAP ?DUP DEPTH DROP DUP OVER ROT SWAP >R R> R@ + - 1+ 1- ABS NEGATE S>D * M* UM* FM/MOD SM/REM UM/MOD */ */MOD / /MOD MOD HERE , @ ! CELL+ CELLS C, C@ C! CHARS 2@ 2! ALIGN ALIGNED +! ALLOT CHAR [CHAR] [ ] BL FIND EXECUTE IMMEDIATE COUNT LITERAL STATE ; DOES> >BODY EVALUATE SOURCE >IN <# # #S #> HOLD SIGN BASE >NUMBER HEX DECIMAL FILL MOVE . CR EMIT SPACE SPACES TYPE U. .R U.R ACCEPT TRUE FALSE <> U> 0<> 0> NIP TUCK ROLL PICK 2>R 2R@ 2R> WITHIN UNUSED MARKER I J TO COMPILE, [COMPILE] SAVE-INPUT RESTORE-INPUT PAD ERASE 2LITERAL DNEGATE D- D+ D0< D0= D2* D2/ D< D= DMAX DMIN D>S DABS M+ M*/ D. D.R 2ROT DU< CATCH THROW FREE RESIZE ALLOCATE CS-PICK CS-ROLL GET-CURRENT SET-CURRENT FORTH-WORDLIST GET-ORDER SET-ORDER PREVIOUS SEARCH-WORDLIST WORDLIST FIND ALSO ONLY FORTH DEFINITIONS ORDER -TRAILING /STRING SEARCH COMPARE CMOVE CMOVE> BLANK SLITERAL"),d=b("IF ELSE THEN BEGIN WHILE REPEAT UNTIL RECURSE [IF] [ELSE] [THEN] ?DO DO LOOP +LOOP UNLOOP LEAVE EXIT AGAIN CASE OF ENDOF ENDCASE");a.defineMode("forth",function(){function a(a,b){var c;for(c=a.length-1;c>=0;c--)if(a[c].name===b.toUpperCase())return a[c];return void 0}return{startState:function(){return{state:"",base:10,coreWordList:c,immediateWordList:d,wordList:[]}},token:function(b,c){var d;if(b.eatSpace())return null;if(""===c.state){if(b.match(/^(\]|:NONAME)(\s|$)/i))return c.state=" compilation","builtin compilation";if(d=b.match(/^(\:)\s+(\S+)(\s|$)+/))return c.wordList.push({name:d[2].toUpperCase()}),c.state=" compilation","def"+c.state;if(d=b.match(/^(VARIABLE|2VARIABLE|CONSTANT|2CONSTANT|CREATE|POSTPONE|VALUE|WORD)\s+(\S+)(\s|$)+/i))return c.wordList.push({name:d[2].toUpperCase()}),"def"+c.state;if(d=b.match(/^(\'|\[\'\])\s+(\S+)(\s|$)+/))return"builtin"+c.state}else{if(b.match(/^(\;|\[)(\s)/))return c.state="",b.backUp(1),"builtin compilation";if(b.match(/^(\;|\[)($)/))return c.state="","builtin compilation";if(b.match(/^(POSTPONE)\s+\S+(\s|$)+/))return"builtin"}return d=b.match(/^(\S+)(\s+|$)/),d?void 0!==a(c.wordList,d[1])?"variable"+c.state:"\\"===d[1]?(b.skipToEnd(),"comment"+c.state):void 0!==a(c.coreWordList,d[1])?"builtin"+c.state:void 0!==a(c.immediateWordList,d[1])?"keyword"+c.state:"("===d[1]?(b.eatWhile(function(a){return")"!==a}),b.eat(")"),"comment"+c.state):".("===d[1]?(b.eatWhile(function(a){return")"!==a}),b.eat(")"),"string"+c.state):'S"'===d[1]||'."'===d[1]||'C"'===d[1]?(b.eatWhile(function(a){return'"'!==a}),b.eat('"'),"string"+c.state):d[1]-68719476735?"number"+c.state:"atom"+c.state:void 0}}}),a.defineMIME("text/x-forth","forth")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/fortran/fortran.min.js b/media/editors/codemirror/mode/fortran/fortran.min.js new file mode 100644 index 0000000000000..dfc209828eb69 --- /dev/null +++ b/media/editors/codemirror/mode/fortran/fortran.min.js @@ -0,0 +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("fortran",function(){function a(a){for(var b={},c=0;c\/\:]/,h=new RegExp("(.and.|.or.|.eq.|.lt.|.le.|.gt.|.ge.|.ne.|.not.|.eqv.|.neqv.)","i");return{startState:function(){return{tokenize:null}},token:function(a,c){if(a.eatSpace())return null;var d=(c.tokenize||b)(a,c);return"comment"==d||"meta"==d?d:d}}}),a.defineMIME("text/x-fortran","fortran")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/gas/gas.min.js b/media/editors/codemirror/mode/gas/gas.min.js new file mode 100644 index 0000000000000..e4890ca8f6049 --- /dev/null +++ b/media/editors/codemirror/mode/gas/gas.min.js @@ -0,0 +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("gas",function(a,b){function c(a){h="#",j.ax="variable",j.eax="variable-2",j.rax="variable-3",j.bx="variable",j.ebx="variable-2",j.rbx="variable-3",j.cx="variable",j.ecx="variable-2",j.rcx="variable-3",j.dx="variable",j.edx="variable-2",j.rdx="variable-3",j.si="variable",j.esi="variable-2",j.rsi="variable-3",j.di="variable",j.edi="variable-2",j.rdi="variable-3",j.sp="variable",j.esp="variable-2",j.rsp="variable-3",j.bp="variable",j.ebp="variable-2",j.rbp="variable-3",j.ip="variable",j.eip="variable-2",j.rip="variable-3",j.cs="keyword",j.ds="keyword",j.ss="keyword",j.es="keyword",j.fs="keyword",j.gs="keyword"}function d(a){h="@",i.syntax="builtin",j.r0="variable",j.r1="variable",j.r2="variable",j.r3="variable",j.r4="variable",j.r5="variable",j.r6="variable",j.r7="variable",j.r8="variable",j.r9="variable",j.r10="variable",j.r11="variable",j.r12="variable",j.sp="variable-2",j.lr="variable-2",j.pc="variable-2",j.r13=j.sp,j.r14=j.lr,j.r15=j.pc,g.push(function(a,b){return"#"===a?(b.eatWhile(/\w/),"number"):void 0})}function e(a,b){for(var c,d=!1;null!=(c=a.next());){if(c===b&&!d)return!1;d=!d&&"\\"===c}return d}function f(a,b){for(var c,d=!1;null!=(c=a.next());){if("/"===c&&d){b.tokenize=null;break}d="*"===c}return"comment"}var g=[],h="",i={".abort":"builtin",".align":"builtin",".altmacro":"builtin",".ascii":"builtin",".asciz":"builtin",".balign":"builtin",".balignw":"builtin",".balignl":"builtin",".bundle_align_mode":"builtin",".bundle_lock":"builtin",".bundle_unlock":"builtin",".byte":"builtin",".cfi_startproc":"builtin",".comm":"builtin",".data":"builtin",".def":"builtin",".desc":"builtin",".dim":"builtin",".double":"builtin",".eject":"builtin",".else":"builtin",".elseif":"builtin",".end":"builtin",".endef":"builtin",".endfunc":"builtin",".endif":"builtin",".equ":"builtin",".equiv":"builtin",".eqv":"builtin",".err":"builtin",".error":"builtin",".exitm":"builtin",".extern":"builtin",".fail":"builtin",".file":"builtin",".fill":"builtin",".float":"builtin",".func":"builtin",".global":"builtin",".gnu_attribute":"builtin",".hidden":"builtin",".hword":"builtin",".ident":"builtin",".if":"builtin",".incbin":"builtin",".include":"builtin",".int":"builtin",".internal":"builtin",".irp":"builtin",".irpc":"builtin",".lcomm":"builtin",".lflags":"builtin",".line":"builtin",".linkonce":"builtin",".list":"builtin",".ln":"builtin",".loc":"builtin",".loc_mark_labels":"builtin",".local":"builtin",".long":"builtin",".macro":"builtin",".mri":"builtin",".noaltmacro":"builtin",".nolist":"builtin",".octa":"builtin",".offset":"builtin",".org":"builtin",".p2align":"builtin",".popsection":"builtin",".previous":"builtin",".print":"builtin",".protected":"builtin",".psize":"builtin",".purgem":"builtin",".pushsection":"builtin",".quad":"builtin",".reloc":"builtin",".rept":"builtin",".sbttl":"builtin",".scl":"builtin",".section":"builtin",".set":"builtin",".short":"builtin",".single":"builtin",".size":"builtin",".skip":"builtin",".sleb128":"builtin",".space":"builtin",".stab":"builtin",".string":"builtin",".struct":"builtin",".subsection":"builtin",".symver":"builtin",".tag":"builtin",".text":"builtin",".title":"builtin",".type":"builtin",".uleb128":"builtin",".val":"builtin",".version":"builtin",".vtable_entry":"builtin",".vtable_inherit":"builtin",".warning":"builtin",".weak":"builtin",".weakref":"builtin",".word":"builtin"},j={},k=(b.architecture||"x86").toLowerCase();return"x86"===k?c(b):("arm"===k||"armv6"===k)&&d(b),{startState:function(){return{tokenize:null}},token:function(a,b){if(b.tokenize)return b.tokenize(a,b);if(a.eatSpace())return null;var c,d,k=a.next();if("/"===k&&a.eat("*"))return b.tokenize=f,f(a,b);if(k===h)return a.skipToEnd(),"comment";if('"'===k)return e(a,'"'),"string";if("."===k)return a.eatWhile(/\w/),d=a.current().toLowerCase(),c=i[d],c||null;if("="===k)return a.eatWhile(/\w/),"tag";if("{"===k)return"braket";if("}"===k)return"braket";if(/\d/.test(k))return"0"===k&&a.eat("x")?(a.eatWhile(/[0-9a-fA-F]/),"number"):(a.eatWhile(/\d/),"number");if(/\w/.test(k))return a.eatWhile(/\w/),a.eat(":")?"tag":(d=a.current().toLowerCase(),c=j[d],c||null);for(var l=0;l]|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`*!()\[\]{};:'".,<>?«»“”‘’]))/i)&&"]("!=a.string.slice(a.start-2,a.start)?(b.combineTokens=!0,"link"):(a.next(),null)},blankLine:d},g={underscoresBreakWords:!1,taskLists:!0,fencedCodeBlocks:!0,strikethrough:!0};for(var h in c)g[h]=c[h];return g.name="markdown",a.defineMIME("gfmBase",g),a.overlayMode(a.getMode(b,"gfmBase"),f)},"markdown")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/gfm/test.js b/media/editors/codemirror/mode/gfm/test.js deleted file mode 100644 index c2bc38fd57715..0000000000000 --- a/media/editors/codemirror/mode/gfm/test.js +++ /dev/null @@ -1,213 +0,0 @@ -// CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: http://codemirror.net/LICENSE - -(function() { - var mode = CodeMirror.getMode({tabSize: 4}, "gfm"); - function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); } - var modeHighlightFormatting = CodeMirror.getMode({tabSize: 4}, {name: "gfm", highlightFormatting: true}); - function FT(name) { test.mode(name, modeHighlightFormatting, Array.prototype.slice.call(arguments, 1)); } - - FT("codeBackticks", - "[comment&formatting&formatting-code `][comment foo][comment&formatting&formatting-code `]"); - - FT("doubleBackticks", - "[comment&formatting&formatting-code ``][comment foo ` bar][comment&formatting&formatting-code ``]"); - - FT("codeBlock", - "[comment&formatting&formatting-code-block ```css]", - "[tag foo]", - "[comment&formatting&formatting-code-block ```]"); - - FT("taskList", - "[variable-2&formatting&formatting-list&formatting-list-ul - ][meta&formatting&formatting-task [ ]]][variable-2 foo]", - "[variable-2&formatting&formatting-list&formatting-list-ul - ][property&formatting&formatting-task [x]]][variable-2 foo]"); - - FT("formatting_strikethrough", - "[strikethrough&formatting&formatting-strikethrough ~~][strikethrough foo][strikethrough&formatting&formatting-strikethrough ~~]"); - - FT("formatting_strikethrough", - "foo [strikethrough&formatting&formatting-strikethrough ~~][strikethrough bar][strikethrough&formatting&formatting-strikethrough ~~]"); - - MT("emInWordAsterisk", - "foo[em *bar*]hello"); - - MT("emInWordUnderscore", - "foo_bar_hello"); - - MT("emStrongUnderscore", - "[strong __][em&strong _foo__][em _] bar"); - - MT("fencedCodeBlocks", - "[comment ```]", - "[comment foo]", - "", - "[comment ```]", - "bar"); - - MT("fencedCodeBlockModeSwitching", - "[comment ```javascript]", - "[variable foo]", - "", - "[comment ```]", - "bar"); - - MT("taskListAsterisk", - "[variable-2 * []] foo]", // Invalid; must have space or x between [] - "[variable-2 * [ ]]bar]", // Invalid; must have space after ] - "[variable-2 * [x]]hello]", // Invalid; must have space after ] - "[variable-2 * ][meta [ ]]][variable-2 [world]]]", // Valid; tests reference style links - " [variable-3 * ][property [x]]][variable-3 foo]"); // Valid; can be nested - - MT("taskListPlus", - "[variable-2 + []] foo]", // Invalid; must have space or x between [] - "[variable-2 + [ ]]bar]", // Invalid; must have space after ] - "[variable-2 + [x]]hello]", // Invalid; must have space after ] - "[variable-2 + ][meta [ ]]][variable-2 [world]]]", // Valid; tests reference style links - " [variable-3 + ][property [x]]][variable-3 foo]"); // Valid; can be nested - - MT("taskListDash", - "[variable-2 - []] foo]", // Invalid; must have space or x between [] - "[variable-2 - [ ]]bar]", // Invalid; must have space after ] - "[variable-2 - [x]]hello]", // Invalid; must have space after ] - "[variable-2 - ][meta [ ]]][variable-2 [world]]]", // Valid; tests reference style links - " [variable-3 - ][property [x]]][variable-3 foo]"); // Valid; can be nested - - MT("taskListNumber", - "[variable-2 1. []] foo]", // Invalid; must have space or x between [] - "[variable-2 2. [ ]]bar]", // Invalid; must have space after ] - "[variable-2 3. [x]]hello]", // Invalid; must have space after ] - "[variable-2 4. ][meta [ ]]][variable-2 [world]]]", // Valid; tests reference style links - " [variable-3 1. ][property [x]]][variable-3 foo]"); // Valid; can be nested - - MT("SHA", - "foo [link be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2] bar"); - - MT("SHAEmphasis", - "[em *foo ][em&link be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2][em *]"); - - MT("shortSHA", - "foo [link be6a8cc] bar"); - - MT("tooShortSHA", - "foo be6a8c bar"); - - MT("longSHA", - "foo be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd22 bar"); - - MT("badSHA", - "foo be6a8cc1c1ecfe9489fb51e4869af15a13fc2cg2 bar"); - - MT("userSHA", - "foo [link bar@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2] hello"); - - MT("userSHAEmphasis", - "[em *foo ][em&link bar@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2][em *]"); - - MT("userProjectSHA", - "foo [link bar/hello@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2] world"); - - MT("userProjectSHAEmphasis", - "[em *foo ][em&link bar/hello@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2][em *]"); - - MT("num", - "foo [link #1] bar"); - - MT("numEmphasis", - "[em *foo ][em&link #1][em *]"); - - MT("badNum", - "foo #1bar hello"); - - MT("userNum", - "foo [link bar#1] hello"); - - MT("userNumEmphasis", - "[em *foo ][em&link bar#1][em *]"); - - MT("userProjectNum", - "foo [link bar/hello#1] world"); - - MT("userProjectNumEmphasis", - "[em *foo ][em&link bar/hello#1][em *]"); - - MT("vanillaLink", - "foo [link http://www.example.com/] bar"); - - MT("vanillaLinkPunctuation", - "foo [link http://www.example.com/]. bar"); - - MT("vanillaLinkExtension", - "foo [link http://www.example.com/index.html] bar"); - - MT("vanillaLinkEmphasis", - "foo [em *][em&link http://www.example.com/index.html][em *] bar"); - - MT("notALink", - "[comment ```css]", - "[tag foo] {[property color]:[keyword black];}", - "[comment ```][link http://www.example.com/]"); - - MT("notALink", - "[comment ``foo `bar` http://www.example.com/``] hello"); - - MT("notALink", - "[comment `foo]", - "[link http://www.example.com/]", - "[comment `foo]", - "", - "[link http://www.example.com/]"); - - MT("headerCodeBlockGithub", - "[header&header-1 # heading]", - "", - "[comment ```]", - "[comment code]", - "[comment ```]", - "", - "Commit: [link be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2]", - "Issue: [link #1]", - "Link: [link http://www.example.com/]"); - - MT("strikethrough", - "[strikethrough ~~foo~~]"); - - MT("strikethroughWithStartingSpace", - "~~ foo~~"); - - MT("strikethroughUnclosedStrayTildes", - "[strikethrough ~~foo~~~]"); - - MT("strikethroughUnclosedStrayTildes", - "[strikethrough ~~foo ~~]"); - - MT("strikethroughUnclosedStrayTildes", - "[strikethrough ~~foo ~~ bar]"); - - MT("strikethroughUnclosedStrayTildes", - "[strikethrough ~~foo ~~ bar~~]hello"); - - MT("strikethroughOneLetter", - "[strikethrough ~~a~~]"); - - MT("strikethroughWrapped", - "[strikethrough ~~foo]", - "[strikethrough foo~~]"); - - MT("strikethroughParagraph", - "[strikethrough ~~foo]", - "", - "foo[strikethrough ~~bar]"); - - MT("strikethroughEm", - "[strikethrough ~~foo][em&strikethrough *bar*][strikethrough ~~]"); - - MT("strikethroughEm", - "[em *][em&strikethrough ~~foo~~][em *]"); - - MT("strikethroughStrong", - "[strikethrough ~~][strong&strikethrough **foo**][strikethrough ~~]"); - - MT("strikethroughStrong", - "[strong **][strong&strikethrough ~~foo~~][strong **]"); - -})(); diff --git a/media/editors/codemirror/mode/gherkin/gherkin.min.js b/media/editors/codemirror/mode/gherkin/gherkin.min.js new file mode 100644 index 0000000000000..4033dda7b6ade --- /dev/null +++ b/media/editors/codemirror/mode/gherkin/gherkin.min.js @@ -0,0 +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("gherkin",function(){return{startState:function(){return{lineNumber:0,tableHeaderLine:!1,allowFeature:!0,allowBackground:!1,allowScenario:!1,allowSteps:!1,allowPlaceholders:!1,allowMultilineArgument:!1,inMultilineString:!1,inMultilineTable:!1,inKeywordLine:!1}},token:function(a,b){if(a.sol()&&(b.lineNumber++,b.inKeywordLine=!1,b.inMultilineTable&&(b.tableHeaderLine=!1,a.match(/\s*\|/,!1)||(b.allowMultilineArgument=!1,b.inMultilineTable=!1))),a.eatSpace(),b.allowMultilineArgument){if(b.inMultilineString)return a.match('"""')?(b.inMultilineString=!1,b.allowMultilineArgument=!1):a.match(/.*/),"string";if(b.inMultilineTable)return a.match(/\|\s*/)?"bracket":(a.match(/[^\|]*/),b.tableHeaderLine?"header":"string");if(a.match('"""'))return b.inMultilineString=!0,"string";if(a.match("|"))return b.inMultilineTable=!0,b.tableHeaderLine=!0,"bracket"}return a.match(/#.*/)?"comment":!b.inKeywordLine&&a.match(/@\S+/)?"tag":!b.inKeywordLine&&b.allowFeature&&a.match(/(機能|功能|フィーチャ|기능|โครงหลัก|ความสามารถ|ความต้องการทางธุรกิจ|ಹೆಚ್ಚಳ|గుణము|ਮੁਹਾਂਦਰਾ|ਨਕਸ਼ ਨੁਹਾਰ|ਖਾਸੀਅਤ|रूप लेख|وِیژگی|خاصية|תכונה|Функціонал|Функция|Функционалност|Функционал|Үзенчәлеклелек|Свойство|Особина|Мөмкинлек|Могућност|Λειτουργία|Δυνατότητα|Właściwość|Vlastnosť|Trajto|Tính năng|Savybė|Pretty much|Požiadavka|Požadavek|Potrzeba biznesowa|Özellik|Osobina|Ominaisuus|Omadus|OH HAI|Mogućnost|Mogucnost|Jellemző|Hwæt|Hwaet|Funzionalità|Funktionalitéit|Funktionalität|Funkcja|Funkcionalnost|Funkcionalitāte|Funkcia|Fungsi|Functionaliteit|Funcționalitate|Funcţionalitate|Functionalitate|Funcionalitat|Funcionalidade|Fonctionnalité|Fitur|Fīča|Feature|Eiginleiki|Egenskap|Egenskab|Característica|Caracteristica|Business Need|Aspekt|Arwedd|Ahoy matey!|Ability):/)?(b.allowScenario=!0,b.allowBackground=!0,b.allowPlaceholders=!1,b.allowSteps=!1,b.allowMultilineArgument=!1,b.inKeywordLine=!0,"keyword"):!b.inKeywordLine&&b.allowBackground&&a.match(/(背景|배경|แนวคิด|ಹಿನ್ನೆಲೆ|నేపథ్యం|ਪਿਛੋਕੜ|पृष्ठभूमि|زمینه|الخلفية|רקע|Тарих|Предыстория|Предистория|Позадина|Передумова|Основа|Контекст|Кереш|Υπόβαθρο|Założenia|Yo\-ho\-ho|Tausta|Taust|Situācija|Rerefons|Pozadina|Pozadie|Pozadí|Osnova|Latar Belakang|Kontext|Konteksts|Kontekstas|Kontekst|Háttér|Hannergrond|Grundlage|Geçmiş|Fundo|Fono|First off|Dis is what went down|Dasar|Contexto|Contexte|Context|Contesto|Cenário de Fundo|Cenario de Fundo|Cefndir|Bối cảnh|Bakgrunnur|Bakgrunn|Bakgrund|Baggrund|Background|B4|Antecedents|Antecedentes|Ær|Aer|Achtergrond):/)?(b.allowPlaceholders=!1,b.allowSteps=!0,b.allowBackground=!1,b.allowMultilineArgument=!1,b.inKeywordLine=!0,"keyword"):!b.inKeywordLine&&b.allowScenario&&a.match(/(場景大綱|场景大纲|劇本大綱|剧本大纲|テンプレ|シナリオテンプレート|シナリオテンプレ|シナリオアウトライン|시나리오 개요|สรุปเหตุการณ์|โครงสร้างของเหตุการณ์|ವಿವರಣೆ|కథనం|ਪਟਕਥਾ ਰੂਪ ਰੇਖਾ|ਪਟਕਥਾ ਢਾਂਚਾ|परिदृश्य रूपरेखा|سيناريو مخطط|الگوی سناریو|תבנית תרחיש|Сценарийның төзелеше|Сценарий структураси|Структура сценарію|Структура сценария|Структура сценарија|Скица|Рамка на сценарий|Концепт|Περιγραφή Σεναρίου|Wharrimean is|Template Situai|Template Senario|Template Keadaan|Tapausaihio|Szenariogrundriss|Szablon scenariusza|Swa hwær swa|Swa hwaer swa|Struktura scenarija|Structură scenariu|Structura scenariu|Skica|Skenario konsep|Shiver me timbers|Senaryo taslağı|Schema dello scenario|Scenariomall|Scenariomal|Scenario Template|Scenario Outline|Scenario Amlinellol|Scenārijs pēc parauga|Scenarijaus šablonas|Reckon it's like|Raamstsenaarium|Plang vum Szenario|Plan du Scénario|Plan du scénario|Osnova scénáře|Osnova Scenára|Náčrt Scenáru|Náčrt Scénáře|Náčrt Scenára|MISHUN SRSLY|Menggariskan Senario|Lýsing Dæma|Lýsing Atburðarásar|Konturo de la scenaro|Koncept|Khung tình huống|Khung kịch bản|Forgatókönyv vázlat|Esquema do Cenário|Esquema do Cenario|Esquema del escenario|Esquema de l'escenari|Esbozo do escenario|Delineação do Cenário|Delineacao do Cenario|All y'all|Abstrakt Scenario|Abstract Scenario):/)?(b.allowPlaceholders=!0,b.allowSteps=!0,b.allowMultilineArgument=!1,b.inKeywordLine=!0,"keyword"):b.allowScenario&&a.match(/(例子|例|サンプル|예|ชุดของเหตุการณ์|ชุดของตัวอย่าง|ಉದಾಹರಣೆಗಳು|ఉదాహరణలు|ਉਦਾਹਰਨਾਂ|उदाहरण|نمونه ها|امثلة|דוגמאות|Үрнәкләр|Сценарији|Примеры|Примери|Приклади|Мисоллар|Мисаллар|Σενάρια|Παραδείγματα|You'll wanna|Voorbeelden|Variantai|Tapaukset|Se þe|Se the|Se ðe|Scenarios|Scenariji|Scenarijai|Przykłady|Primjeri|Primeri|Příklady|Príklady|Piemēri|Példák|Pavyzdžiai|Paraugs|Örnekler|Juhtumid|Exemplos|Exemples|Exemple|Exempel|EXAMPLZ|Examples|Esempi|Enghreifftiau|Ekzemploj|Eksempler|Ejemplos|Dữ liệu|Dead men tell no tales|Dæmi|Contoh|Cenários|Cenarios|Beispiller|Beispiele|Atburðarásir):/)?(b.allowPlaceholders=!1,b.allowSteps=!0,b.allowBackground=!1,b.allowMultilineArgument=!0,"keyword"):!b.inKeywordLine&&b.allowScenario&&a.match(/(場景|场景|劇本|剧本|シナリオ|시나리오|เหตุการณ์|ಕಥಾಸಾರಾಂಶ|సన్నివేశం|ਪਟਕਥਾ|परिदृश्य|سيناريو|سناریو|תרחיש|Сценарій|Сценарио|Сценарий|Пример|Σενάριο|Tình huống|The thing of it is|Tapaus|Szenario|Swa|Stsenaarium|Skenario|Situai|Senaryo|Senario|Scenaro|Scenariusz|Scenariu|Scénario|Scenario|Scenarijus|Scenārijs|Scenarij|Scenarie|Scénář|Scenár|Primer|MISHUN|Kịch bản|Keadaan|Heave to|Forgatókönyv|Escenario|Escenari|Cenário|Cenario|Awww, look mate|Atburðarás):/)?(b.allowPlaceholders=!1,b.allowSteps=!0,b.allowBackground=!1,b.allowMultilineArgument=!1,b.inKeywordLine=!0,"keyword"):!b.inKeywordLine&&b.allowSteps&&a.match(/(那麼|那么|而且|當|当|并且|同時|同时|前提|假设|假設|假定|假如|但是|但し|並且|もし|ならば|ただし|しかし|かつ|하지만|조건|먼저|만일|만약|단|그리고|그러면|และ |เมื่อ |แต่ |ดังนั้น |กำหนดให้ |ಸ್ಥಿತಿಯನ್ನು |ಮತ್ತು |ನೀಡಿದ |ನಂತರ |ಆದರೆ |మరియు |చెప్పబడినది |కాని |ఈ పరిస్థితిలో |అప్పుడు |ਪਰ |ਤਦ |ਜੇਕਰ |ਜਿਵੇਂ ਕਿ |ਜਦੋਂ |ਅਤੇ |यदि |परन्तु |पर |तब |तदा |तथा |जब |चूंकि |किन्तु |कदा |और |अगर |و |هنگامی |متى |لكن |عندما |ثم |بفرض |با فرض |اما |اذاً |آنگاه |כאשר |וגם |בהינתן |אזי |אז |אבל |Якщо |Һәм |Унда |Тоді |Тогда |То |Также |Та |Пусть |Припустимо, що |Припустимо |Онда |Но |Нехай |Нәтиҗәдә |Лекин |Ләкин |Коли |Когда |Когато |Када |Кад |К тому же |І |И |Задато |Задати |Задате |Если |Допустим |Дано |Дадено |Вә |Ва |Бирок |Әмма |Әйтик |Әгәр |Аммо |Али |Але |Агар |А також |А |Τότε |Όταν |Και |Δεδομένου |Αλλά |Þurh |Þegar |Þa þe |Þá |Þa |Zatati |Zakładając |Zadato |Zadate |Zadano |Zadani |Zadan |Za předpokladu |Za predpokladu |Youse know when youse got |Youse know like when |Yna |Yeah nah |Y'know |Y |Wun |Wtedy |When y'all |When |Wenn |WEN |wann |Ve |Và |Und |Un |ugeholl |Too right |Thurh |Thì |Then y'all |Then |Tha the |Tha |Tetapi |Tapi |Tak |Tada |Tad |Stel |Soit |Siis |Și |Şi |Si |Sed |Se |Så |Quando |Quand |Quan |Pryd |Potom |Pokud |Pokiaľ |Però |Pero |Pak |Oraz |Onda |Ond |Oletetaan |Og |Och |O zaman |Niin |Nhưng |När |Når |Mutta |Men |Mas |Maka |Majd |Mając |Mais |Maar |mä |Ma |Lorsque |Lorsqu'|Logo |Let go and haul |Kun |Kuid |Kui |Kiedy |Khi |Ketika |Kemudian |Keď |Když |Kaj |Kai |Kada |Kad |Jeżeli |Jeśli |Ja |It's just unbelievable |Ir |I CAN HAZ |I |Ha |Givun |Givet |Given y'all |Given |Gitt |Gegeven |Gegeben seien |Gegeben sei |Gdy |Gangway! |Fakat |Étant donnés |Etant donnés |Étant données |Etant données |Étant donnée |Etant donnée |Étant donné |Etant donné |Et |És |Entonces |Entón |Então |Entao |En |Eğer ki |Ef |Eeldades |E |Ðurh |Duota |Dun |Donitaĵo |Donat |Donada |Do |Diyelim ki |Diberi |Dengan |Den youse gotta |DEN |De |Dato |Dați fiind |Daţi fiind |Dati fiind |Dati |Date fiind |Date |Data |Dat fiind |Dar |Dann |dann |Dan |Dados |Dado |Dadas |Dada |Ða ðe |Ða |Cuando |Cho |Cando |Când |Cand |Cal |But y'all |But at the end of the day I reckon |BUT |But |Buh |Blimey! |Biết |Bet |Bagi |Aye |awer |Avast! |Atunci |Atesa |Atès |Apabila |Anrhegedig a |Angenommen |And y'all |And |AN |An |an |Amikor |Amennyiben |Ama |Als |Alors |Allora |Ali |Aleshores |Ale |Akkor |Ak |Adott |Ac |Aber |A zároveň |A tiež |A taktiež |A také |A |a |7 |\* )/)?(b.inStep=!0,b.allowPlaceholders=!0,b.allowMultilineArgument=!0,b.inKeywordLine=!0,"keyword"):a.match(/"[^"]*"?/)?"string":b.allowPlaceholders&&a.match(/<[^>]*>?/)?"variable":(a.next(),a.eatWhile(/[^@"<#]/),null)}}}),a.defineMIME("text/x-feature","gherkin")}); \ 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 173e034d0c836..b121f4e6eb7b3 100644 --- a/media/editors/codemirror/mode/go/go.js +++ b/media/editors/codemirror/mode/go/go.js @@ -117,6 +117,7 @@ CodeMirror.defineMode("go", function(config) { return state.context = new Context(state.indented, col, type, null, state.context); } function popContext(state) { + if (!state.context.prev) return; var t = state.context.type; if (t == ")" || t == "]" || t == "}") state.indented = state.context.indented; diff --git a/media/editors/codemirror/mode/go/go.min.js b/media/editors/codemirror/mode/go/go.min.js new file mode 100644 index 0000000000000..88a7335a903c4 --- /dev/null +++ b/media/editors/codemirror/mode/go/go.min.js @@ -0,0 +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&&"\\"==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 diff --git a/media/editors/codemirror/mode/groovy/groovy.js b/media/editors/codemirror/mode/groovy/groovy.js index 89b8224cf5dff..e3a1db869b496 100644 --- a/media/editors/codemirror/mode/groovy/groovy.js +++ b/media/editors/codemirror/mode/groovy/groovy.js @@ -217,6 +217,7 @@ CodeMirror.defineMode("groovy", function(config) { }, electricChars: "{}", + closeBrackets: {triples: "'\""}, fold: "brace" }; }); diff --git a/media/editors/codemirror/mode/groovy/groovy.min.js b/media/editors/codemirror/mode/groovy/groovy.min.js new file mode 100644 index 0000000000000..8d9e7cd2ae3b5 --- /dev/null +++ b/media/editors/codemirror/mode/groovy/groovy.min.js @@ -0,0 +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("groovy",function(a){function b(a){for(var b={},c=a.split(" "),d=0;d"))return k="->",null;if(/[+\-*&%=<>!?|\/~]/.test(c))return a.eatWhile(/[+\-*&%=<>|~]/),"operator";if(a.eatWhile(/[\w\$_]/),"@"==c)return a.eatWhile(/[\w\$_\.]/),"meta";if("."==b.lastToken)return"property";if(a.eat(":"))return k="proplabel","property";var e=a.current();return n.propertyIsEnumerable(e)?"atom":l.propertyIsEnumerable(e)?(m.propertyIsEnumerable(e)&&(k="newstatement"),"keyword"):"variable"}function d(a,b,c){function d(b,c){for(var d,g=!1,h=!f;null!=(d=b.next());){if(d==a&&!g){if(!f)break;if(b.match(a+a)){h=!0;break}}if('"'==a&&"$"==d&&!g&&b.eat("{"))return c.tokenize.push(e()),"string";g=!g&&"\\"==d}return h&&c.tokenize.pop(),"string"}var f=!1;if("/"!=a&&b.eat(a)){if(!b.eat(a))return"string";f=!0}return c.tokenize.push(d),d(b,c)}function e(){function a(a,d){if("}"==a.peek()){if(b--,0==b)return d.tokenize.pop(),d.tokenize[d.tokenize.length-1](a,d)}else"{"==a.peek()&&b++;return c(a,d)}var b=1;return a.isBase=!0,a}function f(a,b){for(var c,d=!1;c=a.next();){if("/"==c&&d){b.tokenize.pop();break}d="*"==c}return"comment"}function g(a){return!a||"operator"==a||"->"==a||/[\.\[\{\(,;:]/.test(a)||"newstatement"==a||"keyword"==a||"proplabel"==a}function h(a,b,c,d,e){this.indented=a,this.column=b,this.type=c,this.align=d,this.prev=e}function i(a,b,c){return a.context=new h(a.indented,b,c,null,a.context)}function j(a){var b=a.context.type;return(")"==b||"]"==b||"}"==b)&&(a.indented=a.context.indented),a.context=a.context.prev}var k,l=b("abstract as assert boolean break byte case catch char class const continue def default do double else enum extends final finally float for goto if implements import in instanceof int interface long native new package private protected public return short static strictfp super switch synchronized threadsafe throw throws transient try void volatile while"),m=b("catch class do else finally for if switch try while enum interface def"),n=b("null true false this");return c.isBase=!0,{startState:function(b){return{tokenize:[c],context:new h((b||0)-a.indentUnit,0,"top",!1),indented:0,startOfLine:!0,lastToken:null}},token:function(a,b){var c=b.context;if(a.sol()&&(null==c.align&&(c.align=!1),b.indented=a.indentation(),b.startOfLine=!0,"statement"!=c.type||g(b.lastToken)||(j(b),c=b.context)),a.eatSpace())return null;k=null;var d=b.tokenize[b.tokenize.length-1](a,b);if("comment"==d)return d;if(null==c.align&&(c.align=!0),";"!=k&&":"!=k||"statement"!=c.type)if("->"==k&&"statement"==c.type&&"}"==c.prev.type)j(b),b.context.align=!1;else if("{"==k)i(b,a.column(),"}");else if("["==k)i(b,a.column(),"]");else if("("==k)i(b,a.column(),")");else if("}"==k){for(;"statement"==c.type;)c=j(b);for("}"==c.type&&(c=j(b));"statement"==c.type;)c=j(b)}else k==c.type?j(b):("}"==c.type||"top"==c.type||"statement"==c.type&&"newstatement"==k)&&i(b,a.column(),"statement");else j(b);return b.startOfLine=!1,b.lastToken=k||d,d},indent:function(b,c){if(!b.tokenize[b.tokenize.length-1].isBase)return 0;var d=c&&c.charAt(0),e=b.context;"statement"!=e.type||g(b.lastToken)||(e=e.prev);var f=d==e.type;return"statement"==e.type?e.indented+("{"==d?0:a.indentUnit):e.align?e.column+(f?0:1):e.indented+(f?0:a.indentUnit)},electricChars:"{}",closeBrackets:{triples:"'\""},fold:"brace"}}),a.defineMIME("text/x-groovy","groovy")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/haml/haml.min.js b/media/editors/codemirror/mode/haml/haml.min.js new file mode 100644 index 0000000000000..7ae40291ad715 --- /dev/null +++ b/media/editors/codemirror/mode/haml/haml.min.js @@ -0,0 +1 @@ +!function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("../htmlmixed/htmlmixed"),require("../ruby/ruby")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../htmlmixed/htmlmixed","../ruby/ruby"],a):a(CodeMirror)}(function(a){"use strict";a.defineMode("haml",function(b){function c(a){return function(b,c){var f=b.peek();return f==a&&1==c.rubyState.tokenize.length?(b.next(),c.tokenize=e,"closeAttributeTag"):d(b,c)}}function d(a,b){return a.match("-#")?(a.skipToEnd(),"comment"):g.token(a,b.rubyState)}function e(a,b){var e=a.peek();if("comment"==b.previousToken.style&&b.indented>b.previousToken.indented)return a.skipToEnd(),"commentLine";if(b.startOfLine){if("!"==e&&a.match("!!"))return a.skipToEnd(),"tag";if(a.match(/^%[\w:#\.]+=/))return b.tokenize=d,"hamlTag";if(a.match(/^%[\w:]+/))return"hamlTag";if("/"==e)return a.skipToEnd(),"comment"}if((b.startOfLine||"hamlTag"==b.previousToken.style)&&("#"==e||"."==e))return a.match(/[\w-#\.]*/),"hamlAttribute";if(b.startOfLine&&!a.match("-->",!1)&&("="==e||"-"==e))return b.tokenize=d,b.tokenize(a,b);if("hamlTag"==b.previousToken.style||"closeAttributeTag"==b.previousToken.style||"hamlAttribute"==b.previousToken.style){if("("==e)return b.tokenize=c(")"),b.tokenize(a,b);if("{"==e)return b.tokenize=c("}"),b.tokenize(a,b)}return f.token(a,b.htmlState)}var f=a.getMode(b,{name:"htmlmixed"}),g=a.getMode(b,"ruby");return{startState:function(){var a=f.startState(),b=g.startState();return{htmlState:a,rubyState:b,indented:0,previousToken:{style:null,indented:0},tokenize:e}},copyState:function(b){return{htmlState:a.copyState(f,b.htmlState),rubyState:a.copyState(g,b.rubyState),indented:b.indented,previousToken:b.previousToken,tokenize:b.tokenize}},token:function(a,b){if(a.sol()&&(b.indented=a.indentation(),b.startOfLine=!0),a.eatSpace())return null;var c=b.tokenize(a,b);if(b.startOfLine=!1,c&&"commentLine"!=c&&(b.previousToken={style:c,indented:b.indented}),a.eol()&&b.tokenize==d){a.backUp(1);var f=a.peek();a.next(),f&&","!=f&&(b.tokenize=e)}return"hamlTag"==c?c="tag":"commentLine"==c?c="comment":"hamlAttribute"==c?c="attribute":"closeAttributeTag"==c&&(c=null),c}}},"htmlmixed","ruby"),a.defineMIME("text/x-haml","haml")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/haml/test.js b/media/editors/codemirror/mode/haml/test.js deleted file mode 100644 index 508458a437f43..0000000000000 --- a/media/editors/codemirror/mode/haml/test.js +++ /dev/null @@ -1,97 +0,0 @@ -// CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: http://codemirror.net/LICENSE - -(function() { - var mode = CodeMirror.getMode({tabSize: 4, indentUnit: 2}, "haml"); - function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); } - - // Requires at least one media query - MT("elementName", - "[tag %h1] Hey There"); - - MT("oneElementPerLine", - "[tag %h1] Hey There %h2"); - - MT("idSelector", - "[tag %h1][attribute #test] Hey There"); - - MT("classSelector", - "[tag %h1][attribute .hello] Hey There"); - - MT("docType", - "[tag !!! XML]"); - - MT("comment", - "[comment / Hello WORLD]"); - - MT("notComment", - "[tag %h1] This is not a / comment "); - - MT("attributes", - "[tag %a]([variable title][operator =][string \"test\"]){[atom :title] [operator =>] [string \"test\"]}"); - - MT("htmlCode", - "[tag&bracket <][tag h1][tag&bracket >]Title[tag&bracket ]"); - - MT("rubyBlock", - "[operator =][variable-2 @item]"); - - MT("selectorRubyBlock", - "[tag %a.selector=] [variable-2 @item]"); - - MT("nestedRubyBlock", - "[tag %a]", - " [operator =][variable puts] [string \"test\"]"); - - MT("multilinePlaintext", - "[tag %p]", - " Hello,", - " World"); - - MT("multilineRuby", - "[tag %p]", - " [comment -# this is a comment]", - " [comment and this is a comment too]", - " Date/Time", - " [operator -] [variable now] [operator =] [tag DateTime][operator .][property now]", - " [tag %strong=] [variable now]", - " [operator -] [keyword if] [variable now] [operator >] [tag DateTime][operator .][property parse]([string \"December 31, 2006\"])", - " [operator =][string \"Happy\"]", - " [operator =][string \"Belated\"]", - " [operator =][string \"Birthday\"]"); - - MT("multilineComment", - "[comment /]", - " [comment Multiline]", - " [comment Comment]"); - - MT("hamlComment", - "[comment -# this is a comment]"); - - MT("multilineHamlComment", - "[comment -# this is a comment]", - " [comment and this is a comment too]"); - - MT("multilineHTMLComment", - "[comment ]"); - - MT("hamlAfterRubyTag", - "[attribute .block]", - " [tag %strong=] [variable now]", - " [attribute .test]", - " [operator =][variable now]", - " [attribute .right]"); - - MT("stretchedRuby", - "[operator =] [variable puts] [string \"Hello\"],", - " [string \"World\"]"); - - MT("interpolationInHashAttribute", - //"[tag %div]{[atom :id] [operator =>] [string \"#{][variable test][string }_#{][variable ting][string }\"]} test"); - "[tag %div]{[atom :id] [operator =>] [string \"#{][variable test][string }_#{][variable ting][string }\"]} test"); - - MT("interpolationInHTMLAttribute", - "[tag %div]([variable title][operator =][string \"#{][variable test][string }_#{][variable ting]()[string }\"]) Test"); -})(); diff --git a/media/editors/codemirror/mode/handlebars/handlebars.js b/media/editors/codemirror/mode/handlebars/handlebars.js new file mode 100644 index 0000000000000..40dfea42afa40 --- /dev/null +++ b/media/editors/codemirror/mode/handlebars/handlebars.js @@ -0,0 +1,53 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror"), require("../../addon/mode/simple")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror", "../../addon/mode/simple"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + CodeMirror.defineSimpleMode("handlebars", { + start: [ + { regex: /\{\{!--/, push: "dash_comment", token: "comment" }, + { regex: /\{\{!/, push: "comment", token: "comment" }, + { regex: /\{\{/, push: "handlebars", token: "tag" } + ], + handlebars: [ + { regex: /\}\}/, pop: true, token: "tag" }, + + // Double and single quotes + { regex: /"(?:[^\\]|\\.)*?"/, token: "string" }, + { regex: /'(?:[^\\]|\\.)*?'/, token: "string" }, + + // Handlebars keywords + { regex: />|[#\/]([A-Za-z_]\w*)/, token: "keyword" }, + { regex: /(?:else|this)\b/, token: "keyword" }, + + // Numeral + { regex: /\d+/i, token: "number" }, + + // Atoms like = and . + { regex: /=|~|@|true|false/, token: "atom" }, + + // Paths + { regex: /(?:\.\.\/)*(?:[A-Za-z_][\w\.]*)+/, token: "variable-2" } + ], + dash_comment: [ + { regex: /--\}\}/, pop: true, token: "comment" }, + + // Commented code + { regex: /./, token: "comment"} + ], + comment: [ + { regex: /\}\}/, pop: true, token: "comment" }, + { regex: /./, token: "comment" } + ] + }); + + CodeMirror.defineMIME("text/x-handlebars-template", "handlebars"); +}); diff --git a/media/editors/codemirror/mode/handlebars/handlebars.min.js b/media/editors/codemirror/mode/handlebars/handlebars.min.js new file mode 100644 index 0000000000000..11ce1cb24e717 --- /dev/null +++ b/media/editors/codemirror/mode/handlebars/handlebars.min.js @@ -0,0 +1 @@ +!function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("../../addon/mode/simple")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../../addon/mode/simple"],a):a(CodeMirror)}(function(a){"use strict";a.defineSimpleMode("handlebars",{start:[{regex:/\{\{!--/,push:"dash_comment",token:"comment"},{regex:/\{\{!/,push:"comment",token:"comment"},{regex:/\{\{/,push:"handlebars",token:"tag"}],handlebars:[{regex:/\}\}/,pop:!0,token:"tag"},{regex:/"(?:[^\\]|\\.)*?"/,token:"string"},{regex:/'(?:[^\\]|\\.)*?'/,token:"string"},{regex:/>|[#\/]([A-Za-z_]\w*)/,token:"keyword"},{regex:/(?:else|this)\b/,token:"keyword"},{regex:/\d+/i,token:"number"},{regex:/=|~|@|true|false/,token:"atom"},{regex:/(?:\.\.\/)*(?:[A-Za-z_][\w\.]*)+/,token:"variable-2"}],dash_comment:[{regex:/--\}\}/,pop:!0,token:"comment"},{regex:/./,token:"comment"}],comment:[{regex:/\}\}/,pop:!0,token:"comment"},{regex:/./,token:"comment"}]}),a.defineMIME("text/x-handlebars-template","handlebars")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/haskell/haskell.min.js b/media/editors/codemirror/mode/haskell/haskell.min.js new file mode 100644 index 0000000000000..c44c3d6c00091 --- /dev/null +++ b/media/editors/codemirror/mode/haskell/haskell.min.js @@ -0,0 +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("haskell",function(a,b){function c(a,b,c){return b(c),c(a,b)}function d(a,b){if(a.eatWhile(p))return null;var d=a.next();if(o.test(d)){if("{"==d&&a.eat("-")){var g="comment";return a.eat("#")&&(g="meta"),c(a,b,e(g,1))}return null}if("'"==d)return a.eat("\\")?a.next():a.next(),a.eat("'")?"string":"error";if('"'==d)return c(a,b,f);if(i.test(d))return a.eatWhile(m),a.eat(".")?"qualifier":"variable-2";if(h.test(d))return a.eatWhile(m),"variable";if(j.test(d)){if("0"==d){if(a.eat(/[xX]/))return a.eatWhile(k),"integer";if(a.eat(/[oO]/))return a.eatWhile(l),"number"}a.eatWhile(j);var g="number";return a.match(/^\.\d+/)&&(g="number"),a.eat(/[eE]/)&&(g="number",a.eat(/[-+]/),a.eatWhile(j)),g}if("."==d&&a.eat("."))return"keyword";if(n.test(d)){if("-"==d&&a.eat(/-/)&&(a.eatWhile(/-/),!a.eat(n)))return a.skipToEnd(),"comment";var g="variable";return":"==d&&(g="variable-2"),a.eatWhile(n),g}return"error"}function e(a,b){return 0==b?d:function(c,f){for(var g=b;!c.eol();){var h=c.next();if("{"==h&&c.eat("-"))++g;else if("-"==h&&c.eat("}")&&(--g,0==g))return f(d),a}return f(e(a,g)),a}}function f(a,b){for(;!a.eol();){var c=a.next();if('"'==c)return b(d),"string";if("\\"==c){if(a.eol()||a.eat(p))return b(g),"string";a.eat("&")||a.next()}}return b(d),"error"}function g(a,b){return a.eat("\\")?c(a,b,f):(a.next(),b(d),"error")}var h=/[a-z_]/,i=/[A-Z]/,j=/\d/,k=/[0-9A-Fa-f]/,l=/[0-7]/,m=/[a-z_A-Z0-9'\xa1-\uffff]/,n=/[-!#$%&*+.\/<=>?@\\^|~:]/,o=/[(),;[\]`{}]/,p=/[ \t\v\f]/,q=function(){function a(a){return function(){for(var b=0;b","@","~","=>"),a("builtin")("!!","$!","$","&&","+","++","-",".","/","/=","<","<=","=<<","==",">",">=",">>",">>=","^","^^","||","*","**"),a("builtin")("Bool","Bounded","Char","Double","EQ","Either","Enum","Eq","False","FilePath","Float","Floating","Fractional","Functor","GT","IO","IOError","Int","Integer","Integral","Just","LT","Left","Maybe","Monad","Nothing","Num","Ord","Ordering","Rational","Read","ReadS","Real","RealFloat","RealFrac","Right","Show","ShowS","String","True"),a("builtin")("abs","acos","acosh","all","and","any","appendFile","asTypeOf","asin","asinh","atan","atan2","atanh","break","catch","ceiling","compare","concat","concatMap","const","cos","cosh","curry","cycle","decodeFloat","div","divMod","drop","dropWhile","either","elem","encodeFloat","enumFrom","enumFromThen","enumFromThenTo","enumFromTo","error","even","exp","exponent","fail","filter","flip","floatDigits","floatRadix","floatRange","floor","fmap","foldl","foldl1","foldr","foldr1","fromEnum","fromInteger","fromIntegral","fromRational","fst","gcd","getChar","getContents","getLine","head","id","init","interact","ioError","isDenormalized","isIEEE","isInfinite","isNaN","isNegativeZero","iterate","last","lcm","length","lex","lines","log","logBase","lookup","map","mapM","mapM_","max","maxBound","maximum","maybe","min","minBound","minimum","mod","negate","not","notElem","null","odd","or","otherwise","pi","pred","print","product","properFraction","putChar","putStr","putStrLn","quot","quotRem","read","readFile","readIO","readList","readLn","readParen","reads","readsPrec","realToFrac","recip","rem","repeat","replicate","return","reverse","round","scaleFloat","scanl","scanl1","scanr","scanr1","seq","sequence","sequence_","show","showChar","showList","showParen","showString","shows","showsPrec","significand","signum","sin","sinh","snd","span","splitAt","sqrt","subtract","succ","sum","tail","take","takeWhile","tan","tanh","toEnum","toInteger","toRational","truncate","uncurry","undefined","unlines","until","unwords","unzip","unzip3","userError","words","writeFile","zip","zip3","zipWith","zipWith3");var d=b.overrideKeywords;if(d)for(var e in d)d.hasOwnProperty(e)&&(c[e]=d[e]);return c}();return{startState:function(){return{f:d}},copyState:function(a){return{f:a.f}},token:function(a,b){var c=b.f(a,function(a){b.f=a}),d=a.current();return q.hasOwnProperty(d)?q[d]:c},blockCommentStart:"{-",blockCommentEnd:"-}",lineComment:"--"}}),a.defineMIME("text/x-haskell","haskell")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/haxe/haxe.min.js b/media/editors/codemirror/mode/haxe/haxe.min.js new file mode 100644 index 0000000000000..7bdf741ac3e38 --- /dev/null +++ b/media/editors/codemirror/mode/haxe/haxe.min.js @@ -0,0 +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("haxe",function(a,b){function c(a,b,c){return b.tokenize=c,c(a,b)}function d(a,b){for(var c,d=!1;null!=(c=a.next());){if(c==b&&!d)return!1;d=!d&&"\\"==c}return d}function e(a,b,c){return S=a,T=c,b}function f(a,b){var f=a.next();if('"'==f||"'"==f)return c(a,b,g(f));if(/[\[\]{}\(\),;\:\.]/.test(f))return e(f);if("0"==f&&a.eat(/x/i))return a.eatWhile(/[\da-f]/i),e("number","number");if(/\d/.test(f)||"-"==f&&a.eat(/\d/))return a.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),e("number","number");if(b.reAllowed&&"~"==f&&a.eat(/\//))return d(a,"/"),a.eatWhile(/[gimsu]/),e("regexp","string-2");if("/"==f)return a.eat("*")?c(a,b,h):a.eat("/")?(a.skipToEnd(),e("comment","comment")):(a.eatWhile(W),e("operator",null,a.current()));if("#"==f)return a.skipToEnd(),e("conditional","meta");if("@"==f)return a.eat(/:/),a.eatWhile(/[\w_]/),e("metadata","meta");if(W.test(f))return a.eatWhile(W),e("operator",null,a.current());var i;if(/[A-Z]/.test(f))return a.eatWhile(/[\w_<>]/),i=a.current(),e("type","variable-3",i);a.eatWhile(/[\w_]/);var i=a.current(),j=V.propertyIsEnumerable(i)&&V[i];return j&&b.kwAllowed?e(j.type,j.style,i):e("variable","variable",i)}function g(a){return function(b,c){return d(b,a)||(c.tokenize=f),e("string","string")}}function h(a,b){for(var c,d=!1;c=a.next();){if("/"==c&&d){b.tokenize=f;break}d="*"==c}return e("comment","comment")}function i(a,b,c,d,e,f){this.indented=a,this.column=b,this.type=c,this.prev=e,this.info=f,null!=d&&(this.align=d)}function j(a,b){for(var c=a.localVars;c;c=c.next)if(c.name==b)return!0}function k(a,b,c,d,e){var f=a.cc;for(Y.state=a,Y.stream=e,Y.marked=null,Y.cc=f,a.lexical.hasOwnProperty("align")||(a.lexical.align=!0);;){var g=f.length?f.pop():v;if(g(c,d)){for(;f.length&&f[f.length-1].lex;)f.pop()();return Y.marked?Y.marked:"variable"==c&&j(a,d)?"variable-2":"variable"==c&&l(a,d)?"variable-3":b}}}function l(a,b){if(/[a-z]/.test(b.charAt(0)))return!1;for(var c=a.importedtypes.length,d=0;c>d;d++)if(a.importedtypes[d]==b)return!0}function m(a){for(var b=Y.state,c=b.importedtypes;c;c=c.next)if(c.name==a)return;b.importedtypes={name:a,next:b.importedtypes}}function n(){for(var a=arguments.length-1;a>=0;a--)Y.cc.push(arguments[a])}function o(){return n.apply(null,arguments),!0}function p(a){var b=Y.state;if(b.context){Y.marked="def";for(var c=b.localVars;c;c=c.next)if(c.name==a)return;b.localVars={name:a,next:b.localVars}}}function q(){Y.state.context||(Y.state.localVars=Z),Y.state.context={prev:Y.state.context,vars:Y.state.localVars}}function r(){Y.state.localVars=Y.state.context.vars,Y.state.context=Y.state.context.prev}function s(a,b){var c=function(){var c=Y.state;c.lexical=new i(c.indented,Y.stream.column(),a,null,c.lexical,b)};return c.lex=!0,c}function t(){var a=Y.state;a.lexical.prev&&(")"==a.lexical.type&&(a.indented=a.lexical.indented),a.lexical=a.lexical.prev)}function u(a){function b(c){return c==a?o():";"==a?n():o(b)}return b}function v(a){return"@"==a?o(A):"var"==a?o(s("vardef"),J,u(";"),t):"keyword a"==a?o(s("form"),w,v,t):"keyword b"==a?o(s("form"),v,t):"{"==a?o(s("}"),q,I,t,r):";"==a?o():"attribute"==a?o(z):"function"==a?o(N):"for"==a?o(s("form"),u("("),s(")"),L,u(")"),t,v,t):"variable"==a?o(s("stat"),E):"switch"==a?o(s("form"),w,s("}","switch"),u("{"),I,t,t):"case"==a?o(w,u(":")):"default"==a?o(u(":")):"catch"==a?o(s("form"),q,u("("),R,u(")"),v,t,r):"import"==a?o(C,u(";")):"typedef"==a?o(D):n(s("stat"),w,u(";"),t)}function w(a){return X.hasOwnProperty(a)?o(y):"function"==a?o(N):"keyword c"==a?o(x):"("==a?o(s(")"),x,u(")"),t,y):"operator"==a?o(w):"["==a?o(s("]"),H(w,"]"),t,y):"{"==a?o(s("}"),H(G,"}"),t,y):o()}function x(a){return a.match(/[;\}\)\],]/)?n():n(w)}function y(a,b){if("operator"==a&&/\+\+|--/.test(b))return o(y);if("operator"==a||":"==a)return o(w);if(";"!=a)return"("==a?o(s(")"),H(w,")"),t,y):"."==a?o(F,y):"["==a?o(s("]"),w,u("]"),t,y):void 0}function z(a){return"attribute"==a?o(z):"function"==a?o(N):"var"==a?o(J):void 0}function A(a){return":"==a?o(A):"variable"==a?o(A):"("==a?o(s(")"),H(B,")"),t,v):void 0}function B(a){return"variable"==a?o():void 0}function C(a,b){return"variable"==a&&/[A-Z]/.test(b.charAt(0))?(m(b),o()):"variable"==a||"property"==a||"."==a||"*"==b?o(C):void 0}function D(a,b){return"variable"==a&&/[A-Z]/.test(b.charAt(0))?(m(b),o()):"type"==a&&/[A-Z]/.test(b.charAt(0))?o():void 0}function E(a){return":"==a?o(t,v):n(y,u(";"),t)}function F(a){return"variable"==a?(Y.marked="property",o()):void 0}function G(a){return"variable"==a&&(Y.marked="property"),X.hasOwnProperty(a)?o(u(":"),w):void 0}function H(a,b){function c(d){return","==d?o(a,c):d==b?o():o(u(b))}return function(d){return d==b?o():n(a,c)}}function I(a){return"}"==a?o():n(v,I)}function J(a,b){return"variable"==a?(p(b),o(O,K)):o()}function K(a,b){return"="==b?o(w,K):","==a?o(J):void 0}function L(a,b){return"variable"==a&&p(b),o(s(")"),q,M,w,t,v,r)}function M(a,b){return"in"==b?o():void 0}function N(a,b){return"variable"==a?(p(b),o(N)):"new"==b?o(N):"("==a?o(s(")"),q,H(R,")"),t,O,v,r):void 0}function O(a){return":"==a?o(P):void 0}function P(a){return"type"==a?o():"variable"==a?o():"{"==a?o(s("}"),H(Q,"}"),t):void 0}function Q(a){return"variable"==a?o(O):void 0}function R(a,b){return"variable"==a?(p(b),o(O)):void 0}var S,T,U=a.indentUnit,V=function(){function a(a){return{type:a,style:"keyword"}}var b=a("keyword a"),c=a("keyword b"),d=a("keyword c"),e=a("operator"),f={type:"atom",style:"atom"},g={type:"attribute",style:"attribute"},h=a("typedef");return{"if":b,"while":b,"else":c,"do":c,"try":c,"return":d,"break":d,"continue":d,"new":d,"throw":d,"var":a("var"),inline:g,"static":g,using:a("import"),"public":g,"private":g,cast:a("cast"),"import":a("import"),macro:a("macro"),"function":a("function"),"catch":a("catch"),untyped:a("untyped"),callback:a("cb"),"for":a("for"),"switch":a("switch"),"case":a("case"),"default":a("default"),"in":e,never:a("property_access"),trace:a("trace"),"class":h,"abstract":h,"enum":h,"interface":h,typedef:h,"extends":h,"implements":h,dynamic:h,"true":f,"false":f,"null":f}}(),W=/[+\-*&%=<>!?|]/,X={atom:!0,number:!0,variable:!0,string:!0,regexp:!0},Y={state:null,column:null,marked:null,cc:null},Z={name:"this",next:null};return t.lex=!0,{startState:function(a){var c=["Int","Float","String","Void","Std","Bool","Dynamic","Array"];return{tokenize:f,reAllowed:!0,kwAllowed:!0,cc:[],lexical:new i((a||0)-U,0,"block",!1),localVars:b.localVars,importedtypes:c,context:b.localVars&&{vars:b.localVars},indented:0}},token:function(a,b){if(a.sol()&&(b.lexical.hasOwnProperty("align")||(b.lexical.align=!1),b.indented=a.indentation()),a.eatSpace())return null;var c=b.tokenize(a,b);return"comment"==S?c:(b.reAllowed=!("operator"!=S&&"keyword c"!=S&&!S.match(/^[\[{}\(,;:]$/)),b.kwAllowed="."!=S,k(b,c,S,T,a))},indent:function(a,b){if(a.tokenize!=f)return 0;var c=b&&b.charAt(0),d=a.lexical;"stat"==d.type&&"}"==c&&(d=d.prev);var e=d.type,g=c==e;return"vardef"==e?d.indented+4:"form"==e&&"{"==c?d.indented:"stat"==e||"form"==e?d.indented+U:"switch"!=d.info||g?d.align?d.column+(g?0:1):d.indented+(g?0:U):d.indented+(/^(?:case|default)\b/.test(b)?U:2*U)},electricChars:"{}",blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//"}}),a.defineMIME("text/x-haxe","haxe"),a.defineMode("hxml",function(){return{startState:function(){return{define:!1,inString:!1}},token:function(a,b){var c=a.peek(),d=a.sol();if("#"==c)return a.skipToEnd(),"comment";if(d&&"-"==c){var e="variable-2";return a.eat(/-/),"-"==a.peek()&&(a.eat(/-/),e="keyword a"),"D"==a.peek()&&(a.eat(/[D]/),e="keyword c",b.define=!0),a.eatWhile(/[A-Z]/i),e}var c=a.peek();return 0==b.inString&&"'"==c&&(b.inString=!0,c=a.next()),1==b.inString?(a.skipTo("'")||a.skipToEnd(),"'"==a.peek()&&(a.next(),b.inString=!1),"string"):(a.next(),null)},lineComment:"#"}}),a.defineMIME("text/x-hxml","hxml")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/htmlembedded/htmlembedded.js b/media/editors/codemirror/mode/htmlembedded/htmlembedded.js index e8f7ba803f64f..464dc57f83870 100644 --- a/media/editors/codemirror/mode/htmlembedded/htmlembedded.js +++ b/media/editors/codemirror/mode/htmlembedded/htmlembedded.js @@ -3,84 +3,26 @@ (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed")); + mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed"), + require("../../addon/mode/multiplex")); else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror", "../htmlmixed/htmlmixed"], mod); + define(["../../lib/codemirror", "../htmlmixed/htmlmixed", + "../../addon/mode/multiplex"], mod); else // Plain browser env mod(CodeMirror); })(function(CodeMirror) { -"use strict"; - -CodeMirror.defineMode("htmlembedded", function(config, parserConfig) { - - //config settings - var scriptStartRegex = parserConfig.scriptStartRegex || /^<%/i, - scriptEndRegex = parserConfig.scriptEndRegex || /^%>/i; - - //inner modes - var scriptingMode, htmlMixedMode; - - //tokenizer when in html mode - function htmlDispatch(stream, state) { - if (stream.match(scriptStartRegex, false)) { - state.token=scriptingDispatch; - return scriptingMode.token(stream, state.scriptState); - } - else - return htmlMixedMode.token(stream, state.htmlState); - } - - //tokenizer when in scripting mode - function scriptingDispatch(stream, state) { - if (stream.match(scriptEndRegex, false)) { - state.token=htmlDispatch; - return htmlMixedMode.token(stream, state.htmlState); - } - else - return scriptingMode.token(stream, state.scriptState); - } - - - return { - startState: function() { - scriptingMode = scriptingMode || CodeMirror.getMode(config, parserConfig.scriptingModeSpec); - htmlMixedMode = htmlMixedMode || CodeMirror.getMode(config, "htmlmixed"); - return { - token : parserConfig.startOpen ? scriptingDispatch : htmlDispatch, - htmlState : CodeMirror.startState(htmlMixedMode), - scriptState : CodeMirror.startState(scriptingMode) - }; - }, - - token: function(stream, state) { - return state.token(stream, state); - }, - - indent: function(state, textAfter) { - if (state.token == htmlDispatch) - return htmlMixedMode.indent(state.htmlState, textAfter); - else if (scriptingMode.indent) - return scriptingMode.indent(state.scriptState, textAfter); - }, - - copyState: function(state) { - return { - token : state.token, - htmlState : CodeMirror.copyState(htmlMixedMode, state.htmlState), - scriptState : CodeMirror.copyState(scriptingMode, state.scriptState) - }; - }, - - innerMode: function(state) { - if (state.token == scriptingDispatch) return {state: state.scriptState, mode: scriptingMode}; - else return {state: state.htmlState, mode: htmlMixedMode}; - } - }; -}, "htmlmixed"); - -CodeMirror.defineMIME("application/x-ejs", { name: "htmlembedded", scriptingModeSpec:"javascript"}); -CodeMirror.defineMIME("application/x-aspx", { name: "htmlembedded", scriptingModeSpec:"text/x-csharp"}); -CodeMirror.defineMIME("application/x-jsp", { name: "htmlembedded", scriptingModeSpec:"text/x-java"}); -CodeMirror.defineMIME("application/x-erb", { name: "htmlembedded", scriptingModeSpec:"ruby"}); - + "use strict"; + + CodeMirror.defineMode("htmlembedded", function(config, parserConfig) { + return CodeMirror.multiplexingMode(CodeMirror.getMode(config, "htmlmixed"), { + open: parserConfig.open || parserConfig.scriptStartRegex || "<%", + close: parserConfig.close || parserConfig.scriptEndRegex || "%>", + mode: CodeMirror.getMode(config, parserConfig.scriptingModeSpec) + }); + }, "htmlmixed"); + + CodeMirror.defineMIME("application/x-ejs", {name: "htmlembedded", scriptingModeSpec:"javascript"}); + CodeMirror.defineMIME("application/x-aspx", {name: "htmlembedded", scriptingModeSpec:"text/x-csharp"}); + CodeMirror.defineMIME("application/x-jsp", {name: "htmlembedded", scriptingModeSpec:"text/x-java"}); + CodeMirror.defineMIME("application/x-erb", {name: "htmlembedded", scriptingModeSpec:"ruby"}); }); diff --git a/media/editors/codemirror/mode/htmlembedded/htmlembedded.min.js b/media/editors/codemirror/mode/htmlembedded/htmlembedded.min.js new file mode 100644 index 0000000000000..5483b7de9c56f --- /dev/null +++ b/media/editors/codemirror/mode/htmlembedded/htmlembedded.min.js @@ -0,0 +1 @@ +!function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("../htmlmixed/htmlmixed"),require("../../addon/mode/multiplex")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../htmlmixed/htmlmixed","../../addon/mode/multiplex"],a):a(CodeMirror)}(function(a){"use strict";a.defineMode("htmlembedded",function(b,c){return a.multiplexingMode(a.getMode(b,"htmlmixed"),{open:c.open||c.scriptStartRegex||"<%",close:c.close||c.scriptEndRegex||"%>",mode:a.getMode(b,c.scriptingModeSpec)})},"htmlmixed"),a.defineMIME("application/x-ejs",{name:"htmlembedded",scriptingModeSpec:"javascript"}),a.defineMIME("application/x-aspx",{name:"htmlembedded",scriptingModeSpec:"text/x-csharp"}),a.defineMIME("application/x-jsp",{name:"htmlembedded",scriptingModeSpec:"text/x-java"}),a.defineMIME("application/x-erb",{name:"htmlembedded",scriptingModeSpec:"ruby"})}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/htmlmixed/htmlmixed.js b/media/editors/codemirror/mode/htmlmixed/htmlmixed.js index 1cc438f013b11..24552e2d80616 100644 --- a/media/editors/codemirror/mode/htmlmixed/htmlmixed.js +++ b/media/editors/codemirror/mode/htmlmixed/htmlmixed.js @@ -57,9 +57,9 @@ CodeMirror.defineMode("htmlmixed", function(config, parserConfig) { } function maybeBackup(stream, pat, style) { var cur = stream.current(); - var close = cur.search(pat), m; + var close = cur.search(pat); if (close > -1) stream.backUp(cur.length - close); - else if (m = cur.match(/<\/?$/)) { + else if (cur.match(/<\/?$/)) { stream.backUp(cur.length); if (!stream.match(pat, false)) stream.match(cur); } diff --git a/media/editors/codemirror/mode/htmlmixed/htmlmixed.min.js b/media/editors/codemirror/mode/htmlmixed/htmlmixed.min.js new file mode 100644 index 0000000000000..47aa4aa6897fc --- /dev/null +++ b/media/editors/codemirror/mode/htmlmixed/htmlmixed.min.js @@ -0,0 +1 @@ +!function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("../xml/xml"),require("../javascript/javascript"),require("../css/css")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml","../javascript/javascript","../css/css"],a):a(CodeMirror)}(function(a){"use strict";a.defineMode("htmlmixed",function(b,c){function d(a,b){var c=b.htmlState.tagName;c&&(c=c.toLowerCase());var d=h.token(a,b.htmlState);if("script"==c&&/\btag\b/.test(d)&&">"==a.current()){var e=a.string.slice(Math.max(0,a.pos-100),a.pos).match(/\btype\s*=\s*("[^"]+"|'[^']+'|\S+)[^<]*$/i);e=e?e[1]:"",e&&/[\"\']/.test(e.charAt(0))&&(e=e.slice(1,e.length-1));for(var k=0;k"==a.current()&&(b.token=g,b.localMode=i,b.localState=i.startState(h.indent(b.htmlState,"")));return d}function e(a,b,c){var d=a.current(),e=d.search(b);return e>-1?a.backUp(d.length-e):d.match(/<\/?$/)&&(a.backUp(d.length),a.match(b,!1)||a.match(d)),c}function f(a,b){return a.match(/^<\/\s*script\s*>/i,!1)?(b.token=d,b.localState=b.localMode=null,null):e(a,/<\/\s*script\s*>/,b.localMode.token(a,b.localState))}function g(a,b){return a.match(/^<\/\s*style\s*>/i,!1)?(b.token=d,b.localState=b.localMode=null,null):e(a,/<\/\s*style\s*>/,i.token(a,b.localState))}var h=a.getMode(b,{name:"xml",htmlMode:!0,multilineTagIndentFactor:c.multilineTagIndentFactor,multilineTagIndentPastTag:c.multilineTagIndentPastTag}),i=a.getMode(b,"css"),j=[],k=c&&c.scriptTypes;if(j.push({matches:/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i,mode:a.getMode(b,"javascript")}),k)for(var l=0;l=100&&200>f?"positive informational":f>=200&&300>f?"positive success":f>=300&&400>f?"positive redirect":f>=400&&500>f?"negative client-error":f>=500&&600>f?"negative server-error":"error"}function d(a,b){return a.skipToEnd(),b.cur=g,null}function e(a,b){return a.eatWhile(/\S/),b.cur=f,"string-2"}function f(b,c){return b.match(/^HTTP\/\d\.\d$/)?(c.cur=g,"keyword"):a(b,c)}function g(a){return a.sol()&&!a.eat(/[ \t]/)?a.match(/^.*?:/)?"atom":(a.skipToEnd(),"error"):(a.skipToEnd(),"string")}function h(a){return a.skipToEnd(),null}return{token:function(a,b){var c=b.cur;return c!=g&&c!=h&&a.eatSpace()?null:c(a,b)},blankLine:function(a){a.cur=h},startState:function(){return{cur:b}}}}),a.defineMIME("message/http","http")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/idl/idl.js b/media/editors/codemirror/mode/idl/idl.js index 15c852e36cff1..07308d71dcc86 100644 --- a/media/editors/codemirror/mode/idl/idl.js +++ b/media/editors/codemirror/mode/idl/idl.js @@ -275,7 +275,7 @@ // Handle non-detected items stream.next(); - return 'error'; + return null; }; CodeMirror.defineMode('idl', function() { diff --git a/media/editors/codemirror/mode/idl/idl.min.js b/media/editors/codemirror/mode/idl/idl.min.js new file mode 100644 index 0000000000000..b332bdfc4bf33 --- /dev/null +++ b/media/editors/codemirror/mode/idl/idl.min.js @@ -0,0 +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){return new RegExp("^(("+a.join(")|(")+"))\\b","i")}function c(a){if(a.eatSpace())return null;if(a.match(";"))return a.skipToEnd(),"comment";if(a.match(/^[0-9\.+-]/,!1)){if(a.match(/^[+-]?0x[0-9a-fA-F]+/))return"number";if(a.match(/^[+-]?\d*\.\d+([EeDd][+-]?\d+)?/))return"number";if(a.match(/^[+-]?\d+([EeDd][+-]?\d+)?/))return"number"}return a.match(/^"([^"]|(""))*"/)?"string":a.match(/^'([^']|(''))*'/)?"string":a.match(g)?"keyword":a.match(e)?"builtin":a.match(h)?"variable":a.match(i)||a.match(j)?"operator":(a.next(),null)}var d=["a_correlate","abs","acos","adapt_hist_equal","alog","alog2","alog10","amoeba","annotate","app_user_dir","app_user_dir_query","arg_present","array_equal","array_indices","arrow","ascii_template","asin","assoc","atan","axis","axis","bandpass_filter","bandreject_filter","barplot","bar_plot","beseli","beselj","beselk","besely","beta","biginteger","bilinear","bin_date","binary_template","bindgen","binomial","bit_ffs","bit_population","blas_axpy","blk_con","boolarr","boolean","boxplot","box_cursor","breakpoint","broyden","bubbleplot","butterworth","bytarr","byte","byteorder","bytscl","c_correlate","calendar","caldat","call_external","call_function","call_method","call_procedure","canny","catch","cd","cdf","ceil","chebyshev","check_math","chisqr_cvf","chisqr_pdf","choldc","cholsol","cindgen","cir_3pnt","clipboard","close","clust_wts","cluster","cluster_tree","cmyk_convert","code_coverage","color_convert","color_exchange","color_quan","color_range_map","colorbar","colorize_sample","colormap_applicable","colormap_gradient","colormap_rotation","colortable","comfit","command_line_args","common","compile_opt","complex","complexarr","complexround","compute_mesh_normals","cond","congrid","conj","constrained_min","contour","contour","convert_coord","convol","convol_fft","coord2to3","copy_lun","correlate","cos","cosh","cpu","cramer","createboxplotdata","create_cursor","create_struct","create_view","crossp","crvlength","ct_luminance","cti_test","cursor","curvefit","cv_coord","cvttobm","cw_animate","cw_animate_getp","cw_animate_load","cw_animate_run","cw_arcball","cw_bgroup","cw_clr_index","cw_colorsel","cw_defroi","cw_field","cw_filesel","cw_form","cw_fslider","cw_light_editor","cw_light_editor_get","cw_light_editor_set","cw_orient","cw_palette_editor","cw_palette_editor_get","cw_palette_editor_set","cw_pdmenu","cw_rgbslider","cw_tmpl","cw_zoom","db_exists","dblarr","dcindgen","dcomplex","dcomplexarr","define_key","define_msgblk","define_msgblk_from_file","defroi","defsysv","delvar","dendro_plot","dendrogram","deriv","derivsig","determ","device","dfpmin","diag_matrix","dialog_dbconnect","dialog_message","dialog_pickfile","dialog_printersetup","dialog_printjob","dialog_read_image","dialog_write_image","dictionary","digital_filter","dilate","dindgen","dissolve","dist","distance_measure","dlm_load","dlm_register","doc_library","double","draw_roi","edge_dog","efont","eigenql","eigenvec","ellipse","elmhes","emboss","empty","enable_sysrtn","eof","eos","erase","erf","erfc","erfcx","erode","errorplot","errplot","estimator_filter","execute","exit","exp","expand","expand_path","expint","extrac","extract_slice","f_cvf","f_pdf","factorial","fft","file_basename","file_chmod","file_copy","file_delete","file_dirname","file_expand_path","file_gunzip","file_gzip","file_info","file_lines","file_link","file_mkdir","file_move","file_poll_input","file_readlink","file_same","file_search","file_tar","file_test","file_untar","file_unzip","file_which","file_zip","filepath","findgen","finite","fix","flick","float","floor","flow3","fltarr","flush","format_axis_values","forward_function","free_lun","fstat","fulstr","funct","function","fv_test","fx_root","fz_roots","gamma","gamma_ct","gauss_cvf","gauss_pdf","gauss_smooth","gauss2dfit","gaussfit","gaussian_function","gaussint","get_drive_list","get_dxf_objects","get_kbrd","get_login_info","get_lun","get_screen_size","getenv","getwindows","greg2jul","grib","grid_input","grid_tps","grid3","griddata","gs_iter","h_eq_ct","h_eq_int","hanning","hash","hdf","hdf5","heap_free","heap_gc","heap_nosave","heap_refcount","heap_save","help","hilbert","hist_2d","hist_equal","histogram","hls","hough","hqr","hsv","i18n_multibytetoutf8","i18n_multibytetowidechar","i18n_utf8tomultibyte","i18n_widechartomultibyte","ibeta","icontour","iconvertcoord","idelete","identity","idl_base64","idl_container","idl_validname","idlexbr_assistant","idlitsys_createtool","idlunit","iellipse","igamma","igetcurrent","igetdata","igetid","igetproperty","iimage","image","image_cont","image_statistics","image_threshold","imaginary","imap","indgen","int_2d","int_3d","int_tabulated","intarr","interpol","interpolate","interval_volume","invert","ioctl","iopen","ir_filter","iplot","ipolygon","ipolyline","iputdata","iregister","ireset","iresolve","irotate","isa","isave","iscale","isetcurrent","isetproperty","ishft","isocontour","isosurface","isurface","itext","itranslate","ivector","ivolume","izoom","journal","json_parse","json_serialize","jul2greg","julday","keyword_set","krig2d","kurtosis","kw_test","l64indgen","la_choldc","la_cholmprove","la_cholsol","la_determ","la_eigenproblem","la_eigenql","la_eigenvec","la_elmhes","la_gm_linear_model","la_hqr","la_invert","la_least_square_equality","la_least_squares","la_linear_equation","la_ludc","la_lumprove","la_lusol","la_svd","la_tridc","la_trimprove","la_triql","la_trired","la_trisol","label_date","label_region","ladfit","laguerre","lambda","lambdap","lambertw","laplacian","least_squares_filter","leefilt","legend","legendre","linbcg","lindgen","linfit","linkimage","list","ll_arc_distance","lmfit","lmgr","lngamma","lnp_test","loadct","locale_get","logical_and","logical_or","logical_true","lon64arr","lonarr","long","long64","lsode","lu_complex","ludc","lumprove","lusol","m_correlate","machar","make_array","make_dll","make_rt","map","mapcontinents","mapgrid","map_2points","map_continents","map_grid","map_image","map_patch","map_proj_forward","map_proj_image","map_proj_info","map_proj_init","map_proj_inverse","map_set","matrix_multiply","matrix_power","max","md_test","mean","meanabsdev","mean_filter","median","memory","mesh_clip","mesh_decimate","mesh_issolid","mesh_merge","mesh_numtriangles","mesh_obj","mesh_smooth","mesh_surfacearea","mesh_validate","mesh_volume","message","min","min_curve_surf","mk_html_help","modifyct","moment","morph_close","morph_distance","morph_gradient","morph_hitormiss","morph_open","morph_thin","morph_tophat","multi","n_elements","n_params","n_tags","ncdf","newton","noise_hurl","noise_pick","noise_scatter","noise_slur","norm","obj_class","obj_destroy","obj_hasmethod","obj_isa","obj_new","obj_valid","objarr","on_error","on_ioerror","online_help","openr","openu","openw","oplot","oploterr","orderedhash","p_correlate","parse_url","particle_trace","path_cache","path_sep","pcomp","plot","plot3d","plot","plot_3dbox","plot_field","ploterr","plots","polar_contour","polar_surface","polyfill","polyshade","pnt_line","point_lun","polarplot","poly","poly_2d","poly_area","poly_fit","polyfillv","polygon","polyline","polywarp","popd","powell","pref_commit","pref_get","pref_set","prewitt","primes","print","printf","printd","pro","product","profile","profiler","profiles","project_vol","ps_show_fonts","psafm","pseudo","ptr_free","ptr_new","ptr_valid","ptrarr","pushd","qgrid3","qhull","qromb","qromo","qsimp","query_*","query_ascii","query_bmp","query_csv","query_dicom","query_gif","query_image","query_jpeg","query_jpeg2000","query_mrsid","query_pict","query_png","query_ppm","query_srf","query_tiff","query_video","query_wav","r_correlate","r_test","radon","randomn","randomu","ranks","rdpix","read","readf","read_ascii","read_binary","read_bmp","read_csv","read_dicom","read_gif","read_image","read_interfile","read_jpeg","read_jpeg2000","read_mrsid","read_pict","read_png","read_ppm","read_spr","read_srf","read_sylk","read_tiff","read_video","read_wav","read_wave","read_x11_bitmap","read_xwd","reads","readu","real_part","rebin","recall_commands","recon3","reduce_colors","reform","region_grow","register_cursor","regress","replicate","replicate_inplace","resolve_all","resolve_routine","restore","retall","return","reverse","rk4","roberts","rot","rotate","round","routine_filepath","routine_info","rs_test","s_test","save","savgol","scale3","scale3d","scatterplot","scatterplot3d","scope_level","scope_traceback","scope_varfetch","scope_varname","search2d","search3d","sem_create","sem_delete","sem_lock","sem_release","set_plot","set_shading","setenv","sfit","shade_surf","shade_surf_irr","shade_volume","shift","shift_diff","shmdebug","shmmap","shmunmap","shmvar","show3","showfont","signum","simplex","sin","sindgen","sinh","size","skewness","skip_lun","slicer3","slide_image","smooth","sobel","socket","sort","spawn","sph_4pnt","sph_scat","spher_harm","spl_init","spl_interp","spline","spline_p","sprsab","sprsax","sprsin","sprstp","sqrt","standardize","stddev","stop","strarr","strcmp","strcompress","streamline","streamline","stregex","stretch","string","strjoin","strlen","strlowcase","strmatch","strmessage","strmid","strpos","strput","strsplit","strtrim","struct_assign","struct_hide","strupcase","surface","surface","surfr","svdc","svdfit","svsol","swap_endian","swap_endian_inplace","symbol","systime","t_cvf","t_pdf","t3d","tag_names","tan","tanh","tek_color","temporary","terminal_size","tetra_clip","tetra_surface","tetra_volume","text","thin","thread","threed","tic","time_test2","timegen","timer","timestamp","timestamptovalues","tm_test","toc","total","trace","transpose","tri_surf","triangulate","trigrid","triql","trired","trisol","truncate_lun","ts_coef","ts_diff","ts_fcast","ts_smooth","tv","tvcrs","tvlct","tvrd","tvscl","typename","uindgen","uint","uintarr","ul64indgen","ulindgen","ulon64arr","ulonarr","ulong","ulong64","uniq","unsharp_mask","usersym","value_locate","variance","vector","vector_field","vel","velovect","vert_t3d","voigt","volume","voronoi","voxel_proj","wait","warp_tri","watershed","wdelete","wf_draw","where","widget_base","widget_button","widget_combobox","widget_control","widget_displaycontextmenu","widget_draw","widget_droplist","widget_event","widget_info","widget_label","widget_list","widget_propertysheet","widget_slider","widget_tab","widget_table","widget_text","widget_tree","widget_tree_move","widget_window","wiener_filter","window","window","write_bmp","write_csv","write_gif","write_image","write_jpeg","write_jpeg2000","write_nrif","write_pict","write_png","write_ppm","write_spr","write_srf","write_sylk","write_tiff","write_video","write_wav","write_wave","writeu","wset","wshow","wtn","wv_applet","wv_cwt","wv_cw_wavelet","wv_denoise","wv_dwt","wv_fn_coiflet","wv_fn_daubechies","wv_fn_gaussian","wv_fn_haar","wv_fn_morlet","wv_fn_paul","wv_fn_symlet","wv_import_data","wv_import_wavelet","wv_plot3d_wps","wv_plot_multires","wv_pwt","wv_tool_denoise","xbm_edit","xdisplayfile","xdxf","xfont","xinteranimate","xloadct","xmanager","xmng_tmpl","xmtool","xobjview","xobjview_rotate","xobjview_write_image","xpalette","xpcolor","xplot3d","xregistered","xroi","xsq_test","xsurface","xvaredit","xvolume","xvolume_rotate","xvolume_write_image","xyouts","zlib_compress","zlib_uncompress","zoom","zoom_24"],e=b(d),f=["begin","end","endcase","endfor","endwhile","endif","endrep","endforeach","break","case","continue","for","foreach","goto","if","then","else","repeat","until","switch","while","do","pro","function"],g=b(f);a.registerHelper("hintWords","idl",d.concat(f));var h=new RegExp("^[_a-z¡-￿][_a-z0-9¡-￿]*","i"),i=/[+\-*&=<>\/@#~$]/,j=new RegExp("(and|or|eq|lt|le|gt|ge|ne|not)","i");a.defineMode("idl",function(){return{token:function(a){return c(a)}}}),a.defineMIME("text/x-idl","idl")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/jade/jade.min.js b/media/editors/codemirror/mode/jade/jade.min.js new file mode 100644 index 0000000000000..5c11a7b6cdc43 --- /dev/null +++ b/media/editors/codemirror/mode/jade/jade.min.js @@ -0,0 +1 @@ +!function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("../javascript/javascript"),require("../css/css"),require("../htmlmixed/htmlmixed")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../javascript/javascript","../css/css","../htmlmixed/htmlmixed"],a):a(CodeMirror)}(function(a){"use strict";a.defineMode("jade",function(b){function c(){this.javaScriptLine=!1,this.javaScriptLineExcludesColon=!1,this.javaScriptArguments=!1,this.javaScriptArgumentsDepth=0,this.isInterpolating=!1,this.interpolationNesting=0,this.jsState=Z.startState(),this.restOfLine="",this.isIncludeFiltered=!1,this.isEach=!1,this.lastTag="",this.scriptType="",this.isAttrs=!1,this.attrsNest=[],this.inAttributeName=!0,this.attributeIsType=!1,this.attrValue="",this.indentOf=1/0,this.indentToken="",this.innerMode=null,this.innerState=null,this.innerModeForLine=!1}function d(a,b){if(a.sol()&&(b.javaScriptLine=!1,b.javaScriptLineExcludesColon=!1),b.javaScriptLine){if(b.javaScriptLineExcludesColon&&":"===a.peek())return b.javaScriptLine=!1,void(b.javaScriptLineExcludesColon=!1);var c=Z.token(a,b.jsState);return a.eol()&&(b.javaScriptLine=!1),c||!0}}function e(a,b){if(b.javaScriptArguments){if(0===b.javaScriptArgumentsDepth&&"("!==a.peek())return void(b.javaScriptArguments=!1);if("("===a.peek()?b.javaScriptArgumentsDepth++:")"===a.peek()&&b.javaScriptArgumentsDepth--,0===b.javaScriptArgumentsDepth)return void(b.javaScriptArguments=!1);var c=Z.token(a,b.jsState);return c||!0}}function f(a){return a.match(/^yield\b/)?"keyword":void 0}function g(a){return a.match(/^(?:doctype) *([^\n]+)?/)?V:void 0}function h(a,b){return a.match("#{")?(b.isInterpolating=!0,b.interpolationNesting=0,"punctuation"):void 0}function i(a,b){if(b.isInterpolating){if("}"===a.peek()){if(b.interpolationNesting--,b.interpolationNesting<0)return a.next(),b.isInterpolating=!1,"puncutation"}else"{"===a.peek()&&b.interpolationNesting++;return Z.token(a,b.jsState)||!0}}function j(a,b){return a.match(/^case\b/)?(b.javaScriptLine=!0,U):void 0}function k(a,b){return a.match(/^when\b/)?(b.javaScriptLine=!0,b.javaScriptLineExcludesColon=!0,U):void 0}function l(a){return a.match(/^default\b/)?U:void 0}function m(a,b){return a.match(/^extends?\b/)?(b.restOfLine="string",U):void 0}function n(a,b){return a.match(/^append\b/)?(b.restOfLine="variable",U):void 0}function o(a,b){return a.match(/^prepend\b/)?(b.restOfLine="variable",U):void 0}function p(a,b){return a.match(/^block\b *(?:(prepend|append)\b)?/)?(b.restOfLine="variable",U):void 0}function q(a,b){return a.match(/^include\b/)?(b.restOfLine="string",U):void 0}function r(a,b){return a.match(/^include:([a-zA-Z0-9\-]+)/,!1)&&a.match("include")?(b.isIncludeFiltered=!0,U):void 0}function s(a,b){if(b.isIncludeFiltered){var c=B(a,b);return b.isIncludeFiltered=!1,b.restOfLine="string",c}}function t(a,b){return a.match(/^mixin\b/)?(b.javaScriptLine=!0,U):void 0}function u(a,b){return a.match(/^\+([-\w]+)/)?(a.match(/^\( *[-\w]+ *=/,!1)||(b.javaScriptArguments=!0,b.javaScriptArgumentsDepth=0),"variable"):a.match(/^\+#{/,!1)?(a.next(),b.mixinCallAfter=!0,h(a,b)):void 0}function v(a,b){return b.mixinCallAfter?(b.mixinCallAfter=!1,a.match(/^\( *[-\w]+ *=/,!1)||(b.javaScriptArguments=!0,b.javaScriptArgumentsDepth=0),!0):void 0}function w(a,b){return a.match(/^(if|unless|else if|else)\b/)?(b.javaScriptLine=!0,U):void 0}function x(a,b){return a.match(/^(- *)?(each|for)\b/)?(b.isEach=!0,U):void 0}function y(a,b){if(b.isEach){if(a.match(/^ in\b/))return b.javaScriptLine=!0,b.isEach=!1,U;if(a.sol()||a.eol())b.isEach=!1;else if(a.next()){for(;!a.match(/^ in\b/,!1)&&a.next(););return"variable"}}}function z(a,b){return a.match(/^while\b/)?(b.javaScriptLine=!0,U):void 0}function A(a,b){var c;return(c=a.match(/^(\w(?:[-:\w]*\w)?)\/?/))?(b.lastTag=c[1].toLowerCase(),"script"===b.lastTag&&(b.scriptType="application/javascript"),"tag"):void 0}function B(c,d){if(c.match(/^:([\w\-]+)/)){var e;return b&&b.innerModes&&(e=b.innerModes(c.current().substring(1))),e||(e=c.current().substring(1)),"string"==typeof e&&(e=a.getMode(b,e)),O(c,d,e),"atom"}}function C(a,b){return a.match(/^(!?=|-)/)?(b.javaScriptLine=!0,"punctuation"):void 0}function D(a){return a.match(/^#([\w-]+)/)?W:void 0}function E(a){return a.match(/^\.([\w-]+)/)?X:void 0}function F(a,b){return"("==a.peek()?(a.next(),b.isAttrs=!0,b.attrsNest=[],b.inAttributeName=!0,b.attrValue="",b.attributeIsType=!1,"punctuation"):void 0}function G(a,b){if(b.isAttrs){if(Y[a.peek()]&&b.attrsNest.push(Y[a.peek()]),b.attrsNest[b.attrsNest.length-1]===a.peek())b.attrsNest.pop();else if(a.eat(")"))return b.isAttrs=!1,"punctuation";if(b.inAttributeName&&a.match(/^[^=,\)!]+/))return("="===a.peek()||"!"===a.peek())&&(b.inAttributeName=!1,b.jsState=Z.startState(),"script"===b.lastTag&&"type"===a.current().trim().toLowerCase()?b.attributeIsType=!0:b.attributeIsType=!1),"attribute";var c=Z.token(a,b.jsState);if(b.attributeIsType&&"string"===c&&(b.scriptType=a.current().toString()),0===b.attrsNest.length&&("string"===c||"variable"===c||"keyword"===c))try{return Function("","var x "+b.attrValue.replace(/,\s*$/,"").replace(/^!/,"")),b.inAttributeName=!0,b.attrValue="",a.backUp(a.current().length),G(a,b)}catch(d){}return b.attrValue+=a.current(),c||!0}}function H(a,b){return a.match(/^&attributes\b/)?(b.javaScriptArguments=!0,b.javaScriptArgumentsDepth=0,"keyword"):void 0}function I(a){return a.sol()&&a.eatSpace()?"indent":void 0}function J(a,b){return a.match(/^ *\/\/(-)?([^\n]*)/)?(b.indentOf=a.indentation(),b.indentToken="comment","comment"):void 0}function K(a){return a.match(/^: */)?"colon":void 0}function L(a,b){return a.match(/^(?:\| ?| )([^\n]+)/)?"string":a.match(/^(<[^\n]*)/,!1)?(O(a,b,"htmlmixed"),b.innerModeForLine=!0,P(a,b,!0)):void 0}function M(a,b){if(a.eat(".")){var c=null;return"script"===b.lastTag&&-1!=b.scriptType.toLowerCase().indexOf("javascript")?c=b.scriptType.toLowerCase().replace(/"|'/g,""):"style"===b.lastTag&&(c="css"),O(a,b,c),"dot"}}function N(a){return a.next(),null}function O(c,d,e){e=a.mimeModes[e]||e,e=b.innerModes?b.innerModes(e)||e:e,e=a.mimeModes[e]||e,e=a.getMode(b,e),d.indentOf=c.indentation(),e&&"null"!==e.name?d.innerMode=e:d.indentToken="string"}function P(a,b,c){return a.indentation()>b.indentOf||b.innerModeForLine&&!a.sol()||c?b.innerMode?(b.innerState||(b.innerState=b.innerMode.startState?b.innerMode.startState(a.indentation()):{}),a.hideFirstChars(b.indentOf+2,function(){return b.innerMode.token(a,b.innerState)||!0})):(a.skipToEnd(),b.indentToken):void(a.sol()&&(b.indentOf=1/0,b.indentToken=null,b.innerMode=null,b.innerState=null))}function Q(a,b){if(a.sol()&&(b.restOfLine=""),b.restOfLine){a.skipToEnd();var c=b.restOfLine;return b.restOfLine="",c}}function R(){return new c}function S(a){return a.copy()}function T(a,b){var c=P(a,b)||Q(a,b)||i(a,b)||s(a,b)||y(a,b)||G(a,b)||d(a,b)||e(a,b)||v(a,b)||f(a,b)||g(a,b)||h(a,b)||j(a,b)||k(a,b)||l(a,b)||m(a,b)||n(a,b)||o(a,b)||p(a,b)||q(a,b)||r(a,b)||t(a,b)||u(a,b)||w(a,b)||x(a,b)||z(a,b)||A(a,b)||B(a,b)||C(a,b)||D(a,b)||E(a,b)||F(a,b)||H(a,b)||I(a,b)||L(a,b)||J(a,b)||K(a,b)||M(a,b)||N(a,b);return c===!0?null:c}var U="keyword",V="meta",W="builtin",X="qualifier",Y={"{":"}","(":")","[":"]"},Z=a.getMode(b,"javascript");return c.prototype.copy=function(){var b=new c;return b.javaScriptLine=this.javaScriptLine,b.javaScriptLineExcludesColon=this.javaScriptLineExcludesColon,b.javaScriptArguments=this.javaScriptArguments,b.javaScriptArgumentsDepth=this.javaScriptArgumentsDepth,b.isInterpolating=this.isInterpolating,b.interpolationNesting=this.intpolationNesting,b.jsState=a.copyState(Z,this.jsState),b.innerMode=this.innerMode,this.innerMode&&this.innerState&&(b.innerState=a.copyState(this.innerMode,this.innerState)),b.restOfLine=this.restOfLine,b.isIncludeFiltered=this.isIncludeFiltered,b.isEach=this.isEach,b.lastTag=this.lastTag,b.scriptType=this.scriptType,b.isAttrs=this.isAttrs,b.attrsNest=this.attrsNest.slice(),b.inAttributeName=this.inAttributeName,b.attributeIsType=this.attributeIsType,b.attrValue=this.attrValue,b.indentOf=this.indentOf,b.indentToken=this.indentToken,b.innerModeForLine=this.innerModeForLine,b},{startState:R,copyState:S,token:T}}),a.defineMIME("text/x-jade","jade")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/javascript/javascript.js b/media/editors/codemirror/mode/javascript/javascript.js index 93df06d152d74..ef0184789ab3d 100644 --- a/media/editors/codemirror/mode/javascript/javascript.js +++ b/media/editors/codemirror/mode/javascript/javascript.js @@ -118,7 +118,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { } else if (state.lastType == "operator" || state.lastType == "keyword c" || state.lastType == "sof" || /^[\[{}\(,;:]$/.test(state.lastType)) { readRegexp(stream); - stream.eatWhile(/[gimy]/); // 'y' is "sticky" option in Mozilla + stream.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/); return ret("regexp", "string-2"); } else { stream.eatWhile(isOperatorChar); @@ -549,6 +549,10 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { } function classBody(type, value) { if (type == "variable" || cx.style == "keyword") { + if (value == "static") { + cx.marked = "keyword"; + return cont(classBody); + } cx.marked = "property"; if (value == "get" || value == "set") return cont(classGetterSetter, functiondef, classBody); return cont(functiondef, classBody); @@ -581,7 +585,11 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { function importSpec(type, value) { if (type == "{") return contCommasep(importSpec, "}"); if (type == "variable") register(value); - return cont(); + if (value == "*") cx.marked = "keyword"; + return cont(maybeAs); + } + function maybeAs(_type, value) { + if (value == "as") { cx.marked = "keyword"; return cont(importSpec); } } function maybeFrom(_type, value) { if (value == "from") { cx.marked = "keyword"; return cont(expression); } @@ -669,6 +677,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { blockCommentEnd: jsonMode ? null : "*/", lineComment: jsonMode ? null : "//", fold: "brace", + closeBrackets: "()[]{}''\"\"``", helperType: jsonMode ? "json" : "javascript", jsonldMode: jsonldMode, diff --git a/media/editors/codemirror/mode/javascript/javascript.min.js b/media/editors/codemirror/mode/javascript/javascript.min.js new file mode 100644 index 0000000000000..bd5d8d4c0b4d3 --- /dev/null +++ b/media/editors/codemirror/mode/javascript/javascript.min.js @@ -0,0 +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("javascript",function(b,c){function d(a){for(var b,c=!1,d=!1;null!=(b=a.next());){if(!c){if("/"==b&&!d)return;"["==b?d=!0:d&&"]"==b&&(d=!1)}c=!c&&"\\"==b}}function e(a,b,c){return qa=a,ra=c,b}function f(a,b){var c=a.next();if('"'==c||"'"==c)return b.tokenize=g(c),b.tokenize(a,b);if("."==c&&a.match(/^\d+(?:[eE][+\-]?\d+)?/))return e("number","number");if("."==c&&a.match(".."))return e("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(c))return e(c);if("="==c&&a.eat(">"))return e("=>","operator");if("0"==c&&a.eat(/x/i))return a.eatWhile(/[\da-f]/i),e("number","number");if(/\d/.test(c))return a.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),e("number","number");if("/"==c)return a.eat("*")?(b.tokenize=h,h(a,b)):a.eat("/")?(a.skipToEnd(),e("comment","comment")):"operator"==b.lastType||"keyword c"==b.lastType||"sof"==b.lastType||/^[\[{}\(,;:]$/.test(b.lastType)?(d(a),a.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/),e("regexp","string-2")):(a.eatWhile(za),e("operator","operator",a.current()));if("`"==c)return b.tokenize=i,i(a,b);if("#"==c)return a.skipToEnd(),e("error","error");if(za.test(c))return a.eatWhile(za),e("operator","operator",a.current());if(xa.test(c)){a.eatWhile(xa);var f=a.current(),j=ya.propertyIsEnumerable(f)&&ya[f];return j&&"."!=b.lastType?e(j.type,j.style,f):e("variable","variable",f)}}function g(a){return function(b,c){var d,g=!1;if(ua&&"@"==b.peek()&&b.match(Aa))return c.tokenize=f,e("jsonld-keyword","meta");for(;null!=(d=b.next())&&(d!=a||g);)g=!g&&"\\"==d;return g||(c.tokenize=f),e("string","string")}}function h(a,b){for(var c,d=!1;c=a.next();){if("/"==c&&d){b.tokenize=f;break}d="*"==c}return e("comment","comment")}function i(a,b){for(var c,d=!1;null!=(c=a.next());){if(!d&&("`"==c||"$"==c&&a.eat("{"))){b.tokenize=f;break}d=!d&&"\\"==c}return e("quasi","string-2",a.current())}function j(a,b){b.fatArrowAt&&(b.fatArrowAt=null);var c=a.string.indexOf("=>",a.start);if(!(0>c)){for(var d=0,e=!1,f=c-1;f>=0;--f){var g=a.string.charAt(f),h=Ba.indexOf(g);if(h>=0&&3>h){if(!d){++f;break}if(0==--d)break}else if(h>=3&&6>h)++d;else if(xa.test(g))e=!0;else{if(/["'\/]/.test(g))return;if(e&&!d){++f;break}}}e&&!d&&(b.fatArrowAt=f)}}function k(a,b,c,d,e,f){this.indented=a,this.column=b,this.type=c,this.prev=e,this.info=f,null!=d&&(this.align=d)}function l(a,b){for(var c=a.localVars;c;c=c.next)if(c.name==b)return!0;for(var d=a.context;d;d=d.prev)for(var c=d.vars;c;c=c.next)if(c.name==b)return!0}function m(a,b,c,d,e){var f=a.cc;for(Da.state=a,Da.stream=e,Da.marked=null,Da.cc=f,Da.style=b,a.lexical.hasOwnProperty("align")||(a.lexical.align=!0);;){var g=f.length?f.pop():va?w:v;if(g(c,d)){for(;f.length&&f[f.length-1].lex;)f.pop()();return Da.marked?Da.marked:"variable"==c&&l(a,d)?"variable-2":b}}}function n(){for(var a=arguments.length-1;a>=0;a--)Da.cc.push(arguments[a])}function o(){return n.apply(null,arguments),!0}function p(a){function b(b){for(var c=b;c;c=c.next)if(c.name==a)return!0;return!1}var d=Da.state;if(d.context){if(Da.marked="def",b(d.localVars))return;d.localVars={name:a,next:d.localVars}}else{if(b(d.globalVars))return;c.globalVars&&(d.globalVars={name:a,next:d.globalVars})}}function q(){Da.state.context={prev:Da.state.context,vars:Da.state.localVars},Da.state.localVars=Ea}function r(){Da.state.localVars=Da.state.context.vars,Da.state.context=Da.state.context.prev}function s(a,b){var c=function(){var c=Da.state,d=c.indented;if("stat"==c.lexical.type)d=c.lexical.indented;else for(var e=c.lexical;e&&")"==e.type&&e.align;e=e.prev)d=e.indented;c.lexical=new k(d,Da.stream.column(),a,null,c.lexical,b)};return c.lex=!0,c}function t(){var a=Da.state;a.lexical.prev&&(")"==a.lexical.type&&(a.indented=a.lexical.indented),a.lexical=a.lexical.prev)}function u(a){function b(c){return c==a?o():";"==a?n():o(b)}return b}function v(a,b){return"var"==a?o(s("vardef",b.length),R,u(";"),t):"keyword a"==a?o(s("form"),w,v,t):"keyword b"==a?o(s("form"),v,t):"{"==a?o(s("}"),O,t):";"==a?o():"if"==a?("else"==Da.state.lexical.info&&Da.state.cc[Da.state.cc.length-1]==t&&Da.state.cc.pop()(),o(s("form"),w,v,t,W)):"function"==a?o(aa):"for"==a?o(s("form"),X,v,t):"variable"==a?o(s("stat"),H):"switch"==a?o(s("form"),w,s("}","switch"),u("{"),O,t,t):"case"==a?o(w,u(":")):"default"==a?o(u(":")):"catch"==a?o(s("form"),q,u("("),ba,u(")"),v,t,r):"module"==a?o(s("form"),q,ga,r,t):"class"==a?o(s("form"),ca,t):"export"==a?o(s("form"),ha,t):"import"==a?o(s("form"),ia,t):n(s("stat"),w,u(";"),t)}function w(a){return y(a,!1)}function x(a){return y(a,!0)}function y(a,b){if(Da.state.fatArrowAt==Da.stream.start){var c=b?G:F;if("("==a)return o(q,s(")"),M(S,")"),t,u("=>"),c,r);if("variable"==a)return n(q,S,u("=>"),c,r)}var d=b?C:B;return Ca.hasOwnProperty(a)?o(d):"function"==a?o(aa,d):"keyword c"==a?o(b?A:z):"("==a?o(s(")"),z,oa,u(")"),t,d):"operator"==a||"spread"==a?o(b?x:w):"["==a?o(s("]"),ma,t,d):"{"==a?N(J,"}",null,d):"quasi"==a?n(D,d):o()}function z(a){return a.match(/[;\}\)\],]/)?n():n(w)}function A(a){return a.match(/[;\}\)\],]/)?n():n(x)}function B(a,b){return","==a?o(w):C(a,b,!1)}function C(a,b,c){var d=0==c?B:C,e=0==c?w:x;return"=>"==a?o(q,c?G:F,r):"operator"==a?/\+\+|--/.test(b)?o(d):"?"==b?o(w,u(":"),e):o(e):"quasi"==a?n(D,d):";"!=a?"("==a?N(x,")","call",d):"."==a?o(I,d):"["==a?o(s("]"),z,u("]"),t,d):void 0:void 0}function D(a,b){return"quasi"!=a?n():"${"!=b.slice(b.length-2)?o(D):o(w,E)}function E(a){return"}"==a?(Da.marked="string-2",Da.state.tokenize=i,o(D)):void 0}function F(a){return j(Da.stream,Da.state),n("{"==a?v:w)}function G(a){return j(Da.stream,Da.state),n("{"==a?v:x)}function H(a){return":"==a?o(t,v):n(B,u(";"),t)}function I(a){return"variable"==a?(Da.marked="property",o()):void 0}function J(a,b){return"variable"==a||"keyword"==Da.style?(Da.marked="property",o("get"==b||"set"==b?K:L)):"number"==a||"string"==a?(Da.marked=ua?"property":Da.style+" property",o(L)):"jsonld-keyword"==a?o(L):"["==a?o(w,u("]"),L):void 0}function K(a){return"variable"!=a?n(L):(Da.marked="property",o(aa))}function L(a){return":"==a?o(x):"("==a?n(aa):void 0}function M(a,b){function c(d){if(","==d){var e=Da.state.lexical;return"call"==e.info&&(e.pos=(e.pos||0)+1),o(a,c)}return d==b?o():o(u(b))}return function(d){return d==b?o():n(a,c)}}function N(a,b,c){for(var d=3;d!?|~^]/,Aa=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,Ba="([{}])",Ca={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,"this":!0,"jsonld-keyword":!0},Da={state:null,column:null,marked:null,cc:null},Ea={name:"this",next:{name:"arguments"}};return t.lex=!0,{startState:function(a){var b={tokenize:f,lastType:"sof",cc:[],lexical:new k((a||0)-sa,0,"block",!1),localVars:c.localVars,context:c.localVars&&{vars:c.localVars},indented:0};return c.globalVars&&"object"==typeof c.globalVars&&(b.globalVars=c.globalVars),b},token:function(a,b){if(a.sol()&&(b.lexical.hasOwnProperty("align")||(b.lexical.align=!1),b.indented=a.indentation(),j(a,b)),b.tokenize!=h&&a.eatSpace())return null;var c=b.tokenize(a,b);return"comment"==qa?c:(b.lastType="operator"!=qa||"++"!=ra&&"--"!=ra?qa:"incdec",m(b,c,qa,ra,a))},indent:function(b,d){if(b.tokenize==h)return a.Pass;if(b.tokenize!=f)return 0;var e=d&&d.charAt(0),g=b.lexical;if(!/^\s*else\b/.test(d))for(var i=b.cc.length-1;i>=0;--i){var j=b.cc[i];if(j==t)g=g.prev;else if(j!=W)break}"stat"==g.type&&"}"==e&&(g=g.prev),ta&&")"==g.type&&"stat"==g.prev.type&&(g=g.prev);var k=g.type,l=e==k;return"vardef"==k?g.indented+("operator"==b.lastType||","==b.lastType?g.info+1:0):"form"==k&&"{"==e?g.indented:"form"==k?g.indented+sa:"stat"==k?g.indented+(pa(b,d)?ta||sa:0):"switch"!=g.info||l||0==c.doubleIndentSwitch?g.align?g.column+(l?0:1):g.indented+(l?0:sa):g.indented+(/^(?:case|default)\b/.test(d)?sa:2*sa)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:va?null:"/*",blockCommentEnd:va?null:"*/",lineComment:va?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:va?"json":"javascript",jsonldMode:ua,jsonMode:va}}),a.registerHelper("wordChars","javascript",/[\w$]/),a.defineMIME("text/javascript","javascript"),a.defineMIME("text/ecmascript","javascript"),a.defineMIME("application/javascript","javascript"),a.defineMIME("application/x-javascript","javascript"),a.defineMIME("application/ecmascript","javascript"),a.defineMIME("application/json",{name:"javascript",json:!0}),a.defineMIME("application/x-json",{name:"javascript",json:!0}),a.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),a.defineMIME("text/typescript",{name:"javascript",typescript:!0}),a.defineMIME("application/typescript",{name:"javascript",typescript:!0})}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/javascript/json-ld.html b/media/editors/codemirror/mode/javascript/json-ld.html deleted file mode 100644 index 3a37f0bce60dd..0000000000000 --- a/media/editors/codemirror/mode/javascript/json-ld.html +++ /dev/null @@ -1,72 +0,0 @@ - - -CodeMirror: JSON-LD mode - - - - - - - - - - - - -
    -

    JSON-LD mode

    - - -
    - - - -

    This is a specialization of the JavaScript mode.

    -
    diff --git a/media/editors/codemirror/mode/javascript/test.js b/media/editors/codemirror/mode/javascript/test.js deleted file mode 100644 index 91b0e89a06a7e..0000000000000 --- a/media/editors/codemirror/mode/javascript/test.js +++ /dev/null @@ -1,200 +0,0 @@ -// CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: http://codemirror.net/LICENSE - -(function() { - var mode = CodeMirror.getMode({indentUnit: 2}, "javascript"); - function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); } - - MT("locals", - "[keyword function] [variable foo]([def a], [def b]) { [keyword var] [def c] [operator =] [number 10]; [keyword return] [variable-2 a] [operator +] [variable-2 c] [operator +] [variable d]; }"); - - MT("comma-and-binop", - "[keyword function](){ [keyword var] [def x] [operator =] [number 1] [operator +] [number 2], [def y]; }"); - - MT("destructuring", - "([keyword function]([def a], [[[def b], [def c] ]]) {", - " [keyword let] {[def d], [property foo]: [def c][operator =][number 10], [def x]} [operator =] [variable foo]([variable-2 a]);", - " [[[variable-2 c], [variable y] ]] [operator =] [variable-2 c];", - "})();"); - - MT("class_body", - "[keyword class] [variable Foo] {", - " [property constructor]() {}", - " [property sayName]() {", - " [keyword return] [string-2 `foo${][variable foo][string-2 }oo`];", - " }", - "}"); - - MT("class", - "[keyword class] [variable Point] [keyword extends] [variable SuperThing] {", - " [property get] [property prop]() { [keyword return] [number 24]; }", - " [property constructor]([def x], [def y]) {", - " [keyword super]([string 'something']);", - " [keyword this].[property x] [operator =] [variable-2 x];", - " }", - "}"); - - MT("module", - "[keyword module] [string 'foo'] {", - " [keyword export] [keyword let] [def x] [operator =] [number 42];", - " [keyword export] [keyword *] [keyword from] [string 'somewhere'];", - "}"); - - MT("import", - "[keyword function] [variable foo]() {", - " [keyword import] [def $] [keyword from] [string 'jquery'];", - " [keyword module] [def crypto] [keyword from] [string 'crypto'];", - " [keyword import] { [def encrypt], [def decrypt] } [keyword from] [string 'crypto'];", - "}"); - - MT("const", - "[keyword function] [variable f]() {", - " [keyword const] [[ [def a], [def b] ]] [operator =] [[ [number 1], [number 2] ]];", - "}"); - - MT("for/of", - "[keyword for]([keyword let] [variable of] [keyword of] [variable something]) {}"); - - MT("generator", - "[keyword function*] [variable repeat]([def n]) {", - " [keyword for]([keyword var] [def i] [operator =] [number 0]; [variable-2 i] [operator <] [variable-2 n]; [operator ++][variable-2 i])", - " [keyword yield] [variable-2 i];", - "}"); - - MT("quotedStringAddition", - "[keyword let] [variable f] [operator =] [variable a] [operator +] [string 'fatarrow'] [operator +] [variable c];"); - - MT("quotedFatArrow", - "[keyword let] [variable f] [operator =] [variable a] [operator +] [string '=>'] [operator +] [variable c];"); - - MT("fatArrow", - "[variable array].[property filter]([def a] [operator =>] [variable-2 a] [operator +] [number 1]);", - "[variable a];", // No longer in scope - "[keyword let] [variable f] [operator =] ([[ [def a], [def b] ]], [def c]) [operator =>] [variable-2 a] [operator +] [variable-2 c];", - "[variable c];"); - - MT("spread", - "[keyword function] [variable f]([def a], [meta ...][def b]) {", - " [variable something]([variable-2 a], [meta ...][variable-2 b]);", - "}"); - - MT("comprehension", - "[keyword function] [variable f]() {", - " [[([variable x] [operator +] [number 1]) [keyword for] ([keyword var] [def x] [keyword in] [variable y]) [keyword if] [variable pred]([variable-2 x]) ]];", - " ([variable u] [keyword for] ([keyword var] [def u] [keyword of] [variable generateValues]()) [keyword if] ([variable-2 u].[property color] [operator ===] [string 'blue']));", - "}"); - - MT("quasi", - "[variable re][string-2 `fofdlakj${][variable x] [operator +] ([variable re][string-2 `foo`]) [operator +] [number 1][string-2 }fdsa`] [operator +] [number 2]"); - - MT("quasi_no_function", - "[variable x] [operator =] [string-2 `fofdlakj${][variable x] [operator +] [string-2 `foo`] [operator +] [number 1][string-2 }fdsa`] [operator +] [number 2]"); - - MT("indent_statement", - "[keyword var] [variable x] [operator =] [number 10]", - "[variable x] [operator +=] [variable y] [operator +]", - " [atom Infinity]", - "[keyword debugger];"); - - MT("indent_if", - "[keyword if] ([number 1])", - " [keyword break];", - "[keyword else] [keyword if] ([number 2])", - " [keyword continue];", - "[keyword else]", - " [number 10];", - "[keyword if] ([number 1]) {", - " [keyword break];", - "} [keyword else] [keyword if] ([number 2]) {", - " [keyword continue];", - "} [keyword else] {", - " [number 10];", - "}"); - - MT("indent_for", - "[keyword for] ([keyword var] [variable i] [operator =] [number 0];", - " [variable i] [operator <] [number 100];", - " [variable i][operator ++])", - " [variable doSomething]([variable i]);", - "[keyword debugger];"); - - MT("indent_c_style", - "[keyword function] [variable foo]()", - "{", - " [keyword debugger];", - "}"); - - MT("indent_else", - "[keyword for] (;;)", - " [keyword if] ([variable foo])", - " [keyword if] ([variable bar])", - " [number 1];", - " [keyword else]", - " [number 2];", - " [keyword else]", - " [number 3];"); - - MT("indent_funarg", - "[variable foo]([number 10000],", - " [keyword function]([def a]) {", - " [keyword debugger];", - "};"); - - MT("indent_below_if", - "[keyword for] (;;)", - " [keyword if] ([variable foo])", - " [number 1];", - "[number 2];"); - - MT("multilinestring", - "[keyword var] [variable x] [operator =] [string 'foo\\]", - "[string bar'];"); - - MT("scary_regexp", - "[string-2 /foo[[/]]bar/];"); - - MT("indent_strange_array", - "[keyword var] [variable x] [operator =] [[", - " [number 1],,", - " [number 2],", - "]];", - "[number 10];"); - - var jsonld_mode = CodeMirror.getMode( - {indentUnit: 2}, - {name: "javascript", jsonld: true} - ); - function LD(name) { - test.mode(name, jsonld_mode, Array.prototype.slice.call(arguments, 1)); - } - - LD("json_ld_keywords", - '{', - ' [meta "@context"]: {', - ' [meta "@base"]: [string "http://example.com"],', - ' [meta "@vocab"]: [string "http://xmlns.com/foaf/0.1/"],', - ' [property "likesFlavor"]: {', - ' [meta "@container"]: [meta "@list"]', - ' [meta "@reverse"]: [string "@beFavoriteOf"]', - ' },', - ' [property "nick"]: { [meta "@container"]: [meta "@set"] },', - ' [property "nick"]: { [meta "@container"]: [meta "@index"] }', - ' },', - ' [meta "@graph"]: [[ {', - ' [meta "@id"]: [string "http://dbpedia.org/resource/John_Lennon"],', - ' [property "name"]: [string "John Lennon"],', - ' [property "modified"]: {', - ' [meta "@value"]: [string "2010-05-29T14:17:39+02:00"],', - ' [meta "@type"]: [string "http://www.w3.org/2001/XMLSchema#dateTime"]', - ' }', - ' } ]]', - '}'); - - LD("json_ld_fake", - '{', - ' [property "@fake"]: [string "@fake"],', - ' [property "@contextual"]: [string "@identifier"],', - ' [property "user@domain.com"]: [string "@graphical"],', - ' [property "@ID"]: [string "@@ID"]', - '}'); -})(); diff --git a/media/editors/codemirror/mode/javascript/typescript.html b/media/editors/codemirror/mode/javascript/typescript.html deleted file mode 100644 index 2cfc5381fe3ef..0000000000000 --- a/media/editors/codemirror/mode/javascript/typescript.html +++ /dev/null @@ -1,61 +0,0 @@ - - -CodeMirror: TypeScript mode - - - - - - - - - -
    -

    TypeScript mode

    - - -
    - - - -

    This is a specialization of the JavaScript mode.

    -
    diff --git a/media/editors/codemirror/mode/jinja2/jinja2.min.js b/media/editors/codemirror/mode/jinja2/jinja2.min.js new file mode 100644 index 0000000000000..be1cba282b0f8 --- /dev/null +++ b/media/editors/codemirror/mode/jinja2/jinja2.min.js @@ -0,0 +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("jinja2",function(){function a(a,g){var h=a.peek();if(g.incomment)return a.skipTo("#}")?(a.eatWhile(/\#|}/),g.incomment=!1):a.skipToEnd(),"comment";if(g.intag){if(g.operator){if(g.operator=!1,a.match(e))return"atom";if(a.match(f))return"number"}if(g.sign){if(g.sign=!1,a.match(e))return"atom";if(a.match(f))return"number"}if(g.instring)return h==g.instring&&(g.instring=!1),a.next(),"string";if("'"==h||'"'==h)return g.instring=h,a.next(),"string";if(a.match(g.intag+"}")||a.eat("-")&&a.match(g.intag+"}"))return g.intag=!1,"tag";if(a.match(c))return g.operator=!0,"operator";if(a.match(d))g.sign=!0;else if(a.eat(" ")||a.sol()){if(a.match(b))return"keyword";if(a.match(e))return"atom";if(a.match(f))return"number";a.sol()&&a.next()}else a.next();return"variable"}if(a.eat("{")){if(h=a.eat("#"))return g.incomment=!0,a.skipTo("#}")?(a.eatWhile(/\#|}/),g.incomment=!1):a.skipToEnd(),"comment";if(h=a.eat(/\{|%/))return g.intag=h,"{"==h&&(g.intag="}"),a.eat("-"),"tag"}a.next()}var b=["and","as","block","endblock","by","cycle","debug","else","elif","extends","filter","endfilter","firstof","for","endfor","if","endif","ifchanged","endifchanged","ifequal","endifequal","ifnotequal","endifnotequal","in","include","load","not","now","or","parsed","regroup","reversed","spaceless","endspaceless","ssi","templatetag","openblock","closeblock","openvariable","closevariable","openbrace","closebrace","opencomment","closecomment","widthratio","url","with","endwith","get_current_language","trans","endtrans","noop","blocktrans","endblocktrans","get_available_languages","get_current_language_bidi","plural"],c=/^[+\-*&%=<>!?|~^]/,d=/^[:\[\(\{]/,e=["true","false"],f=/^(\d[+\-\*\/])?\d+(\.\d+)?/;return b=new RegExp("(("+b.join(")|(")+"))\\b"),e=new RegExp("(("+e.join(")|(")+"))\\b"),{startState:function(){return{tokenize:a}},token:function(a,b){return b.tokenize(a,b)}}})}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/julia/julia.js b/media/editors/codemirror/mode/julia/julia.js index e854988aa3715..d0a74cef595ae 100644 --- a/media/editors/codemirror/mode/julia/julia.js +++ b/media/editors/codemirror/mode/julia/julia.js @@ -34,7 +34,6 @@ CodeMirror.defineMode("julia", function(_conf, parserConf) { var closers = wordRegexp(blockClosers); var macro = /^@[_A-Za-z][_A-Za-z0-9]*/; var symbol = /^:[_A-Za-z][_A-Za-z0-9]*/; - var indentInfo = null; function in_array(state) { var ch = cur_scope(state); @@ -247,7 +246,6 @@ CodeMirror.defineMode("julia", function(_conf, parserConf) { } function tokenLexer(stream, state) { - indentInfo = null; var style = state.tokenize(stream, state); var current = stream.current(); diff --git a/media/editors/codemirror/mode/julia/julia.min.js b/media/editors/codemirror/mode/julia/julia.min.js new file mode 100644 index 0000000000000..e91312d0def45 --- /dev/null +++ b/media/editors/codemirror/mode/julia/julia.min.js @@ -0,0 +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("julia",function(a,b){function c(a){return new RegExp("^(("+a.join(")|(")+"))\\b")}function d(a){var b=e(a);return"["==b||"{"==b?!0:!1}function e(a){return 0==a.scopes.length?null:a.scopes[a.scopes.length-1]}function f(a,b){var c=b.leaving_expr;if(a.sol()&&(c=!1),b.leaving_expr=!1,c&&a.match(/^'+/))return"operator";if(a.match(/^\.{2,3}/))return"operator";if(a.eatSpace())return null;var f=a.peek();if("#"===f)return a.skipToEnd(),"comment";"["===f&&b.scopes.push("["),"{"===f&&b.scopes.push("{");var h=e(b);"["===h&&"]"===f&&(b.scopes.pop(),b.leaving_expr=!0),"{"===h&&"}"===f&&(b.scopes.pop(),b.leaving_expr=!0),")"===f&&(b.leaving_expr=!0);var m;if(!d(b)&&(m=a.match(t,!1))&&b.scopes.push(m),!d(b)&&a.match(u,!1)&&b.scopes.pop(),d(b)&&a.match(/^end/))return"number";if(a.match(/^=>/))return"operator";if(a.match(/^[0-9\.]/,!1)){var n=RegExp(/^im\b/),o=!1;if(a.match(/^\d*\.(?!\.)\d+([ef][\+\-]?\d+)?/i)&&(o=!0),a.match(/^\d+\.(?!\.)\d*/)&&(o=!0),a.match(/^\.\d+/)&&(o=!0),o)return a.match(n),b.leaving_expr=!0,"number";var p=!1;if(a.match(/^0x[0-9a-f]+/i)&&(p=!0),a.match(/^0b[01]+/i)&&(p=!0),a.match(/^0o[0-7]+/i)&&(p=!0),a.match(/^[1-9]\d*(e[\+\-]?\d+)?/)&&(p=!0),a.match(/^0(?![\dx])/i)&&(p=!0),p)return a.match(n),b.leaving_expr=!0,"number"}return a.match(/^(::)|(<:)/)?"operator":!c&&a.match(w)?"string":a.match(j)?"operator":a.match(q)?(b.tokenize=g(a.current()),b.tokenize(a,b)):a.match(v)?"meta":a.match(k)?null:a.match(r)?"keyword":a.match(s)?"builtin":a.match(l)?(b.leaving_expr=!0,"variable"):(a.next(),i)}function g(a){function c(c,g){for(;!c.eol();)if(c.eatWhile(/[^'"\\]/),c.eat("\\")){if(c.next(),d&&c.eol())return e}else{if(c.match(a))return g.tokenize=f,e;c.eat(/['"]/)}if(d){if(b.singleLineStringErrors)return i;g.tokenize=f}return e}for(;"rub".indexOf(a.charAt(0).toLowerCase())>=0;)a=a.substr(1);var d=1==a.length,e="string";return c.isString=!0,c}function h(a,b){var c=b.tokenize(a,b),d=a.current();return"."===d?(c=a.match(l,!1)?null:i,null===c&&"meta"===b.lastStyle&&(c="meta"),c):c}var i="error",j=b.operators||/^\.?[|&^\\%*+\-<>!=\/]=?|\?|~|:|\$|\.[<>]|<<=?|>>>?=?|\.[<>=]=|->?|\/\/|\bin\b/,k=b.delimiters||/^[;,()[\]{}]/,l=b.identifiers||/^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*!*/,m=["begin","function","type","immutable","let","macro","for","while","quote","if","else","elseif","try","finally","catch","do"],n=["end","else","elseif","catch","finally"],o=["if","else","elseif","while","for","begin","let","end","do","try","catch","finally","return","break","continue","global","local","const","export","import","importall","using","function","macro","module","baremodule","type","immutable","quote","typealias","abstract","bitstype","ccall"],p=["true","false","enumerate","open","close","nothing","NaN","Inf","print","println","Int","Int8","Uint8","Int16","Uint16","Int32","Uint32","Int64","Uint64","Int128","Uint128","Bool","Char","Float16","Float32","Float64","Array","Vector","Matrix","String","UTF8String","ASCIIString","error","warn","info","@printf"],q=/^(`|'|"{3}|([br]?"))/,r=c(o),s=c(p),t=c(m),u=c(n),v=/^@[_A-Za-z][_A-Za-z0-9]*/,w=/^:[_A-Za-z][_A-Za-z0-9]*/,x={startState:function(){return{tokenize:f,scopes:[],leaving_expr:!1}},token:function(a,b){var c=h(a,b);return b.lastStyle=c,c},indent:function(a,b){var c=0;return("end"==b||"]"==b||"}"==b||"else"==b||"elseif"==b||"catch"==b||"finally"==b)&&(c=-1),4*(a.scopes.length+c)},lineComment:"#",fold:"indent",electricChars:"edlsifyh]}"};return x}),a.defineMIME("text/x-julia","julia")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/kotlin/kotlin.js b/media/editors/codemirror/mode/kotlin/kotlin.js index 73c84f6c4f8af..1efec85dffc8c 100644 --- a/media/editors/codemirror/mode/kotlin/kotlin.js +++ b/media/editors/codemirror/mode/kotlin/kotlin.js @@ -271,6 +271,7 @@ CodeMirror.defineMode("kotlin", function (config, parserConfig) { else return ctx.indented + (closing ? 0 : config.indentUnit); }, + closeBrackets: {triples: "'\""}, electricChars: "{}" }; }); diff --git a/media/editors/codemirror/mode/kotlin/kotlin.min.js b/media/editors/codemirror/mode/kotlin/kotlin.min.js new file mode 100644 index 0000000000000..b008678ebfeb0 --- /dev/null +++ b/media/editors/codemirror/mode/kotlin/kotlin.min.js @@ -0,0 +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("kotlin",function(a,b){function c(a){for(var b={},c=a.split(" "),d=0;d"))return m="->",null;if(/[\-+*&%=<>!?|\/~]/.test(c))return a.eatWhile(/[\-+*&%=<>|~]/),"operator";a.eatWhile(/[\w\$_]/);var d=a.current();return r.propertyIsEnumerable(d)?"atom":p.propertyIsEnumerable(d)?(q.propertyIsEnumerable(d)&&(m="newstatement"),"softKeyword"):o.propertyIsEnumerable(d)?(q.propertyIsEnumerable(d)&&(m="newstatement"),"keyword"):"word"}function e(a,b,c){function d(b,c){for(var h,i=!1,j=!e;null!=(h=b.next());){if(h==a&&!i){if(!e)break;if(b.match(a+a)){j=!0;break}}if('"'==a&&"$"==h&&!i&&b.eat("{"))return c.tokenize.push(f()),"string";if("$"==h&&!i&&!b.eat(" "))return c.tokenize.push(g()),"string";i=!i&&"\\"==h}return n&&c.tokenize.push(d),j&&c.tokenize.pop(),"string"}var e=!1;if("/"!=a&&b.eat(a)){if(!b.eat(a))return"string";e=!0}return c.tokenize.push(d),d(b,c)}function f(){function a(a,c){if("}"==a.peek()){if(b--,0==b)return c.tokenize.pop(),c.tokenize[c.tokenize.length-1](a,c)}else"{"==a.peek()&&b++;return d(a,c)}var b=1;return a.isBase=!0,a}function g(){function a(a,b){if(a.eat(/[\w]/)){var c=a.eatWhile(/[\w]/);if(c)return b.tokenize.pop(),"word"}return b.tokenize.pop(),"string"}return a.isBase=!0,a}function h(a,b){for(var c,d=!1;c=a.next();){if("/"==c&&d){b.tokenize.pop();break}d="*"==c}return"comment"}function i(a){return!a||"operator"==a||"->"==a||/[\.\[\{\(,;:]/.test(a)||"newstatement"==a||"keyword"==a||"proplabel"==a}function j(a,b,c,d,e){this.indented=a,this.column=b,this.type=c,this.align=d,this.prev=e}function k(a,b,c){return a.context=new j(a.indented,b,c,null,a.context)}function l(a){var b=a.context.type;return(")"==b||"]"==b||"}"==b)&&(a.indented=a.context.indented),a.context=a.context.prev}var m,n=b.multiLineStrings,o=c("package continue return object while break class data trait throw super when type this else This try val var fun for is in if do as true false null get set"),p=c("import where by get set abstract enum open annotation override private public internal protected catch out vararg inline finally final ref"),q=c("catch class do else finally for if where try while enum"),r=c("null true false this");return d.isBase=!0,{startState:function(b){return{tokenize:[d],context:new j((b||0)-a.indentUnit,0,"top",!1),indented:0,startOfLine:!0,lastToken:null}},token:function(a,b){var c=b.context;if(a.sol()&&(null==c.align&&(c.align=!1),b.indented=a.indentation(),b.startOfLine=!0,"statement"!=c.type||i(b.lastToken)||(l(b),c=b.context)),a.eatSpace())return null;m=null;var d=b.tokenize[b.tokenize.length-1](a,b);if("comment"==d)return d;if(null==c.align&&(c.align=!0),";"!=m&&":"!=m||"statement"!=c.type)if("->"==m&&"statement"==c.type&&"}"==c.prev.type)l(b),b.context.align=!1;else if("{"==m)k(b,a.column(),"}");else if("["==m)k(b,a.column(),"]");else if("("==m)k(b,a.column(),")");else if("}"==m){for(;"statement"==c.type;)c=l(b);for("}"==c.type&&(c=l(b));"statement"==c.type;)c=l(b)}else m==c.type?l(b):("}"==c.type||"top"==c.type||"statement"==c.type&&"newstatement"==m)&&k(b,a.column(),"statement");else l(b);return b.startOfLine=!1,b.lastToken=m||d,d},indent:function(b,c){if(!b.tokenize[b.tokenize.length-1].isBase)return 0;var d=c&&c.charAt(0),e=b.context;"statement"!=e.type||i(b.lastToken)||(e=e.prev);var f=d==e.type;return"statement"==e.type?e.indented+("{"==d?0:a.indentUnit):e.align?e.column+(f?0:1):e.indented+(f?0:a.indentUnit)},closeBrackets:{triples:"'\""},electricChars:"{}"}}),a.defineMIME("text/x-kotlin","kotlin")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/livescript/livescript.js b/media/editors/codemirror/mode/livescript/livescript.js index 55882efc3bc4f..4b26e04619cd6 100644 --- a/media/editors/codemirror/mode/livescript/livescript.js +++ b/media/editors/codemirror/mode/livescript/livescript.js @@ -24,8 +24,8 @@ var nr = Rules[next_rule]; if (nr.splice) { for (var i$ = 0; i$ < nr.length; ++i$) { - var r = nr[i$], m; - if (r.regex && (m = stream.match(r.regex))) { + var r = nr[i$]; + if (r.regex && stream.match(r.regex)) { state.next = r.next || state.next; return r.token; } diff --git a/media/editors/codemirror/mode/livescript/livescript.min.js b/media/editors/codemirror/mode/livescript/livescript.min.js new file mode 100644 index 0000000000000..eae94dc1bd162 --- /dev/null +++ b/media/editors/codemirror/mode/livescript/livescript.min.js @@ -0,0 +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("livescript",function(){var a=function(a,b){var c=b.next||"start";if(c){b.next=b.next;var d=f[c];if(d.splice){for(var e=0;e|\\b(?:e(?:lse|xport)|d(?:o|efault)|t(?:ry|hen)|finally|import(?:\\s*all)?|const|var|let|new|catch(?:\\s*"+b+")?))\\s*$"),d="(?![$\\w]|-[A-Za-z]|\\s*:(?![:=]))",e={token:"string",regex:".+"},f={start:[{token:"comment.doc",regex:"/\\*",next:"comment"},{token:"comment",regex:"#.*"},{token:"keyword",regex:"(?:t(?:h(?:is|row|en)|ry|ypeof!?)|c(?:on(?:tinue|st)|a(?:se|tch)|lass)|i(?:n(?:stanceof)?|mp(?:ort(?:\\s+all)?|lements)|[fs])|d(?:e(?:fault|lete|bugger)|o)|f(?:or(?:\\s+own)?|inally|unction)|s(?:uper|witch)|e(?:lse|x(?:tends|port)|val)|a(?:nd|rguments)|n(?:ew|ot)|un(?:less|til)|w(?:hile|ith)|o[fr]|return|break|let|var|loop)"+d},{token:"constant.language",regex:"(?:true|false|yes|no|on|off|null|void|undefined)"+d},{token:"invalid.illegal",regex:"(?:p(?:ackage|r(?:ivate|otected)|ublic)|i(?:mplements|nterface)|enum|static|yield)"+d},{token:"language.support.class",regex:"(?:R(?:e(?:gExp|ferenceError)|angeError)|S(?:tring|yntaxError)|E(?:rror|valError)|Array|Boolean|Date|Function|Number|Object|TypeError|URIError)"+d},{token:"language.support.function",regex:"(?:is(?:NaN|Finite)|parse(?:Int|Float)|Math|JSON|(?:en|de)codeURI(?:Component)?)"+d},{token:"variable.language",regex:"(?:t(?:hat|il|o)|f(?:rom|allthrough)|it|by|e)"+d},{token:"identifier",regex:b+"\\s*:(?![:=])"},{token:"variable",regex:b},{token:"keyword.operator",regex:"(?:\\.{3}|\\s+\\?)"},{token:"keyword.variable",regex:"(?:@+|::|\\.\\.)",next:"key"},{token:"keyword.operator",regex:"\\.\\s*",next:"key"},{token:"string",regex:"\\\\\\S[^\\s,;)}\\]]*"},{token:"string.doc",regex:"'''",next:"qdoc"},{token:"string.doc",regex:'"""',next:"qqdoc"},{token:"string",regex:"'",next:"qstring"},{token:"string",regex:'"',next:"qqstring"},{token:"string",regex:"`",next:"js"},{token:"string",regex:"<\\[",next:"words"},{token:"string.regex",regex:"//",next:"heregex"},{token:"string.regex",regex:"\\/(?:[^[\\/\\n\\\\]*(?:(?:\\\\.|\\[[^\\]\\n\\\\]*(?:\\\\.[^\\]\\n\\\\]*)*\\])[^[\\/\\n\\\\]*)*)\\/[gimy$]{0,4}",next:"key"},{token:"constant.numeric",regex:"(?:0x[\\da-fA-F][\\da-fA-F_]*|(?:[2-9]|[12]\\d|3[0-6])r[\\da-zA-Z][\\da-zA-Z_]*|(?:\\d[\\d_]*(?:\\.\\d[\\d_]*)?|\\.\\d[\\d_]*)(?:e[+-]?\\d[\\d_]*)?[\\w$]*)"},{token:"lparen",regex:"[({[]"},{token:"rparen",regex:"[)}\\]]",next:"key"},{token:"keyword.operator",regex:"\\S+"},{token:"text",regex:"\\s+"}],heregex:[{token:"string.regex",regex:".*?//[gimy$?]{0,4}",next:"start"},{token:"string.regex",regex:"\\s*#{"},{token:"comment.regex",regex:"\\s+(?:#.*)?"},{token:"string.regex",regex:"\\S+"}],key:[{token:"keyword.operator",regex:"[.?@!]+"},{token:"identifier",regex:b,next:"start"},{token:"text",regex:"",next:"start"}],comment:[{token:"comment.doc",regex:".*?\\*/",next:"start"},{token:"comment.doc",regex:".+"}],qdoc:[{token:"string",regex:".*?'''",next:"key"},e],qqdoc:[{token:"string",regex:'.*?"""',next:"key"},e],qstring:[{token:"string",regex:"[^\\\\']*(?:\\\\.[^\\\\']*)*'",next:"key"},e],qqstring:[{token:"string",regex:'[^\\\\"]*(?:\\\\.[^\\\\"]*)*"',next:"key"},e],js:[{token:"string",regex:"[^\\\\`]*(?:\\\\.[^\\\\`]*)*`",next:"key"},e],words:[{token:"string",regex:".*?\\]>",next:"key"},e]};for(var g in f){var h=f[g];if(h.splice)for(var i=0,j=h.length;j>i;++i){var k=h[i];"string"==typeof k.regex&&(f[g][i].regex=new RegExp("^"+k.regex))}else"string"==typeof k.regex&&(f[g].regex=new RegExp("^"+h.regex))}a.defineMIME("text/x-livescript","livescript")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/lua/lua.min.js b/media/editors/codemirror/mode/lua/lua.min.js new file mode 100644 index 0000000000000..de751af2c0d28 --- /dev/null +++ b/media/editors/codemirror/mode/lua/lua.min.js @@ -0,0 +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("lua",function(a,b){function c(a){return new RegExp("^(?:"+a.join("|")+")","i")}function d(a){return new RegExp("^(?:"+a.join("|")+")$","i")}function e(a){for(var b=0;a.eat("=");)++b;return a.eat("["),b}function f(a,b){var c=a.next();return"-"==c&&a.eat("-")?a.eat("[")&&a.eat("[")?(b.cur=g(e(a),"comment"))(a,b):(a.skipToEnd(),"comment"):'"'==c||"'"==c?(b.cur=h(c))(a,b):"["==c&&/[\[=]/.test(a.peek())?(b.cur=g(e(a),"string"))(a,b):/\d/.test(c)?(a.eatWhile(/[\w.%]/),"number"):/[\w_]/.test(c)?(a.eatWhile(/[\w\\\-_.]/),"variable"):null}function g(a,b){return function(c,d){for(var e,g=null;null!=(e=c.next());)if(null==g)"]"==e&&(g=0);else if("="==e)++g;else{if("]"==e&&g==a){d.cur=f;break}g=null}return b}}function h(a){return function(b,c){for(var d,e=!1;null!=(d=b.next())&&(d!=a||e);)e=!e&&"\\"==d;return e||(c.cur=f),"string"}}var i=a.indentUnit,j=d(b.specials||[]),k=d(["_G","_VERSION","assert","collectgarbage","dofile","error","getfenv","getmetatable","ipairs","load","loadfile","loadstring","module","next","pairs","pcall","print","rawequal","rawget","rawset","require","select","setfenv","setmetatable","tonumber","tostring","type","unpack","xpcall","coroutine.create","coroutine.resume","coroutine.running","coroutine.status","coroutine.wrap","coroutine.yield","debug.debug","debug.getfenv","debug.gethook","debug.getinfo","debug.getlocal","debug.getmetatable","debug.getregistry","debug.getupvalue","debug.setfenv","debug.sethook","debug.setlocal","debug.setmetatable","debug.setupvalue","debug.traceback","close","flush","lines","read","seek","setvbuf","write","io.close","io.flush","io.input","io.lines","io.open","io.output","io.popen","io.read","io.stderr","io.stdin","io.stdout","io.tmpfile","io.type","io.write","math.abs","math.acos","math.asin","math.atan","math.atan2","math.ceil","math.cos","math.cosh","math.deg","math.exp","math.floor","math.fmod","math.frexp","math.huge","math.ldexp","math.log","math.log10","math.max","math.min","math.modf","math.pi","math.pow","math.rad","math.random","math.randomseed","math.sin","math.sinh","math.sqrt","math.tan","math.tanh","os.clock","os.date","os.difftime","os.execute","os.exit","os.getenv","os.remove","os.rename","os.setlocale","os.time","os.tmpname","package.cpath","package.loaded","package.loaders","package.loadlib","package.path","package.preload","package.seeall","string.byte","string.char","string.dump","string.find","string.format","string.gmatch","string.gsub","string.len","string.lower","string.match","string.rep","string.reverse","string.sub","string.upper","table.concat","table.insert","table.maxn","table.remove","table.sort"]),l=d(["and","break","elseif","false","nil","not","or","return","true","function","end","if","then","else","do","while","repeat","until","for","in","local"]),m=d(["function","if","repeat","do","\\(","{"]),n=d(["end","until","\\)","}"]),o=c(["end","until","\\)","}","else","elseif"]);return{startState:function(a){return{basecol:a||0,indentDepth:0,cur:f}},token:function(a,b){if(a.eatSpace())return null;var c=b.cur(a,b),d=a.current();return"variable"==c&&(l.test(d)?c="keyword":k.test(d)?c="builtin":j.test(d)&&(c="variable-2")),"comment"!=c&&"string"!=c&&(m.test(d)?++b.indentDepth:n.test(d)&&--b.indentDepth),c},indent:function(a,b){var c=o.test(b);return a.basecol+i*(a.indentDepth-(c?1:0))},lineComment:"--",blockCommentStart:"--[[",blockCommentEnd:"]]"}}),a.defineMIME("text/x-lua","lua")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/markdown/markdown.js b/media/editors/codemirror/mode/markdown/markdown.js index 3c80311068344..bc5314fc3590d 100644 --- a/media/editors/codemirror/mode/markdown/markdown.js +++ b/media/editors/codemirror/mode/markdown/markdown.js @@ -72,7 +72,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { , ulRE = /^[*\-+]\s+/ , olRE = /^[0-9]+\.\s+/ , taskListRE = /^\[(x| )\](?=\s)/ // Must follow ulRE or olRE - , atxHeaderRE = /^#+/ + , atxHeaderRE = /^#+ ?/ , setextHeaderRE = /^(?:\={1,}|-{1,})$/ , textRE = /^[^#!\[\]*_\\<>` "'(~]+/; @@ -116,18 +116,20 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { var sol = stream.sol(); - var prevLineIsList = (state.list !== false); - if (state.list !== false && state.indentationDiff >= 0) { // Continued list - if (state.indentationDiff < 4) { // Only adjust indentation if *not* a code block - state.indentation -= state.indentationDiff; + var prevLineIsList = state.list !== false; + if (prevLineIsList) { + if (state.indentationDiff >= 0) { // Continued list + if (state.indentationDiff < 4) { // Only adjust indentation if *not* a code block + state.indentation -= state.indentationDiff; + } + state.list = null; + } else if (state.indentation > 0) { + state.list = null; + state.listDepth = Math.floor(state.indentation / 4); + } else { // No longer a list + state.list = false; + state.listDepth = 0; } - state.list = null; - } else if (state.list !== false && state.indentation > 0) { - state.list = null; - state.listDepth = Math.floor(state.indentation / 4); - } else if (state.list !== false) { // No longer a list - state.list = false; - state.listDepth = 0; } var match = null; @@ -138,7 +140,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { } else if (stream.eatSpace()) { return null; } else if (match = stream.match(atxHeaderRE)) { - state.header = match[0].length <= 6 ? match[0].length : 6; + state.header = Math.min(6, match[0].indexOf(" ") !== -1 ? match[0].length - 1 : match[0].length); if (modeCfg.highlightFormatting) state.formatting = "header"; state.f = state.inline; return getType(state); diff --git a/media/editors/codemirror/mode/markdown/markdown.min.js b/media/editors/codemirror/mode/markdown/markdown.min.js new file mode 100644 index 0000000000000..6e14ce0099105 --- /dev/null +++ b/media/editors/codemirror/mode/markdown/markdown.min.js @@ -0,0 +1 @@ +!function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("../xml/xml"),require("../meta")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml","../meta"],a):a(CodeMirror)}(function(a){"use strict";a.defineMode("markdown",function(b,c){function d(c){if(a.findModeByName){var d=a.findModeByName(c);d&&(c=d.mime||d.mimes[0])}var e=a.getMode(b,c);return"null"==e.name?null:e}function e(a,b,c){return b.f=b.inline=c,c(a,b)}function f(a,b,c){return b.f=b.block=c,c(a,b)}function g(a){return a.linkTitle=!1,a.em=!1,a.strong=!1,a.strikethrough=!1,a.quote=0,v||a.f!=i||(a.f=n,a.block=h),a.trailingSpace=0,a.trailingSpaceNewLine=!1,a.thisLineHasContent=!1,null}function h(a,b){var f=a.sol(),g=b.list!==!1;g&&(b.indentationDiff>=0?(b.indentationDiff<4&&(b.indentation-=b.indentationDiff),b.list=null):b.indentation>0?(b.list=null,b.listDepth=Math.floor(b.indentation/4)):(b.list=!1,b.listDepth=0));var h=null;if(b.indentationDiff>=4)return b.indentation-=4,a.skipToEnd(),z;if(a.eatSpace())return null;if(h=a.match(S))return b.header=Math.min(6,-1!==h[0].indexOf(" ")?h[0].length-1:h[0].length),c.highlightFormatting&&(b.formatting="header"),b.f=b.inline,l(b);if(b.prevLineHasContent&&(h=a.match(T)))return b.header="="==h[0].charAt(0)?1:2,c.highlightFormatting&&(b.formatting="header"),b.f=b.inline,l(b);if(a.eat(">"))return b.indentation++,b.quote=f?1:b.quote+1,c.highlightFormatting&&(b.formatting="quote"),a.eatSpace(),l(b);if("["===a.peek())return e(a,b,r);if(a.match(O,!0))return E;if((!b.prevLineHasContent||g)&&(a.match(P,!1)||a.match(Q,!1))){var i=null;return a.match(P,!0)?i="ul":(a.match(Q,!0),i="ol"),b.indentation+=4,b.list=!0,b.listDepth++,c.taskLists&&a.match(R,!1)&&(b.taskList=!0),b.f=b.inline,c.highlightFormatting&&(b.formatting=["list","list-"+i]),l(b)}return c.fencedCodeBlocks&&a.match(/^```[ \t]*([\w+#]*)/,!0)?(b.localMode=d(RegExp.$1),b.localMode&&(b.localState=b.localMode.startState()),b.f=b.block=j,c.highlightFormatting&&(b.formatting="code-block"),b.code=!0,l(b)):e(a,b,b.inline)}function i(a,b){var c=w.token(a,b.htmlState);return(v&&null===b.htmlState.tagStart&&!b.htmlState.context||b.md_inside&&a.current().indexOf(">")>-1)&&(b.f=n,b.block=h,b.htmlState=null),c}function j(a,b){return a.sol()&&a.match("```",!1)?(b.localMode=b.localState=null,b.f=b.block=k,null):b.localMode?b.localMode.token(a,b.localState):(a.skipToEnd(),z)}function k(a,b){a.match("```"),b.block=h,b.f=n,c.highlightFormatting&&(b.formatting="code-block"),b.code=!0;var d=l(b);return b.code=!1,d}function l(a){var b=[];if(a.formatting){b.push(G),"string"==typeof a.formatting&&(a.formatting=[a.formatting]);for(var d=0;d=a.quote?b.push(G+"-"+a.formatting[d]+"-"+a.quote):b.push("error"))}if(a.taskOpen)return b.push("meta"),b.length?b.join(" "):null;if(a.taskClosed)return b.push("property"),b.length?b.join(" "):null;if(a.linkHref)return b.push(K),b.length?b.join(" "):null;if(a.strong&&b.push(M),a.em&&b.push(L),a.strikethrough&&b.push(N),a.linkText&&b.push(J),a.code&&b.push(z),a.header&&(b.push(y),b.push(y+"-"+a.header)),a.quote&&(b.push(A),!c.maxBlockquoteDepth||c.maxBlockquoteDepth>=a.quote?b.push(A+"-"+a.quote):b.push(A+"-"+c.maxBlockquoteDepth)),a.list!==!1){var e=(a.listDepth-1)%3;e?1===e?b.push(C):b.push(D):b.push(B)}return a.trailingSpaceNewLine?b.push("trailing-space-new-line"):a.trailingSpace&&b.push("trailing-space-"+(a.trailingSpace%2?"a":"b")),b.length?b.join(" "):null}function m(a,b){return a.match(U,!0)?l(b):void 0}function n(b,d){var e=d.text(b,d);if("undefined"!=typeof e)return e;if(d.list)return d.list=null,l(d);if(d.taskList){var g="x"!==b.match(R,!0)[1];return g?d.taskOpen=!0:d.taskClosed=!0,c.highlightFormatting&&(d.formatting="task"),d.taskList=!1,l(d)}if(d.taskOpen=!1,d.taskClosed=!1,d.header&&b.match(/^#+$/,!0))return c.highlightFormatting&&(d.formatting="header"),l(d);var h=b.sol(),j=b.next();if("\\"===j&&(b.next(),c.highlightFormatting)){var k=l(d);return k?k+" formatting-escape":"formatting-escape"}if(d.linkTitle){d.linkTitle=!1;var m=j;"("===j&&(m=")"),m=(m+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1");var n="^\\s*(?:[^"+m+"\\\\]+|\\\\\\\\|\\\\.)"+m;if(b.match(new RegExp(n),!0))return K}if("`"===j){var q=d.formatting;c.highlightFormatting&&(d.formatting="code");var r=l(d),s=b.pos;b.eatWhile("`");var t=1+b.pos-s;return d.code?t===x?(d.code=!1,r):(d.formatting=q,l(d)):(x=t,d.code=!0,l(d))}if(d.code)return l(d);if("!"===j&&b.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return b.match(/\[[^\]]*\]/),d.inline=d.f=p,F;if("["===j&&b.match(/.*\](\(.*\)| ?\[.*\])/,!1))return d.linkText=!0,c.highlightFormatting&&(d.formatting="link"),l(d);if("]"===j&&d.linkText&&b.match(/\(.*\)| ?\[.*\]/,!1)){c.highlightFormatting&&(d.formatting="link");var k=l(d);return d.linkText=!1,d.inline=d.f=p,k}if("<"===j&&b.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){d.f=d.inline=o,c.highlightFormatting&&(d.formatting="link");var k=l(d);return k?k+=" ":k="",k+H}if("<"===j&&b.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){d.f=d.inline=o,c.highlightFormatting&&(d.formatting="link");var k=l(d);return k?k+=" ":k="",k+I}if("<"===j&&b.match(/^\w/,!1)){if(-1!=b.string.indexOf(">")){var u=b.string.substring(1,b.string.indexOf(">"));/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(u)&&(d.md_inside=!0)}return b.backUp(1),d.htmlState=a.startState(w),f(b,d,i)}if("<"===j&&b.match(/^\/\w*?>/))return d.md_inside=!1,"tag";var v=!1;if(!c.underscoresBreakWords&&"_"===j&&"_"!==b.peek()&&b.match(/(\w)/,!1)){var y=b.pos-2;if(y>=0){var z=b.string.charAt(y);"_"!==z&&z.match(/(\w)/,!1)&&(v=!0)}}if("*"===j||"_"===j&&!v)if(h&&" "===b.peek());else{if(d.strong===j&&b.eat(j)){c.highlightFormatting&&(d.formatting="strong");var r=l(d);return d.strong=!1,r}if(!d.strong&&b.eat(j))return d.strong=j,c.highlightFormatting&&(d.formatting="strong"),l(d);if(d.em===j){c.highlightFormatting&&(d.formatting="em");var r=l(d);return d.em=!1,r}if(!d.em)return d.em=j,c.highlightFormatting&&(d.formatting="em"),l(d)}else if(" "===j&&(b.eat("*")||b.eat("_"))){if(" "===b.peek())return l(d);b.backUp(1)}if(c.strikethrough)if("~"===j&&b.eatWhile(j)){if(d.strikethrough){c.highlightFormatting&&(d.formatting="strikethrough");var r=l(d);return d.strikethrough=!1,r}if(b.match(/^[^\s]/,!1))return d.strikethrough=!0,c.highlightFormatting&&(d.formatting="strikethrough"),l(d)}else if(" "===j&&b.match(/^~~/,!0)){if(" "===b.peek())return l(d);b.backUp(2)}return" "===j&&(b.match(/ +$/,!1)?d.trailingSpace++:d.trailingSpace&&(d.trailingSpaceNewLine=!0)),l(d)}function o(a,b){var d=a.next();if(">"===d){b.f=b.inline=n,c.highlightFormatting&&(b.formatting="link");var e=l(b);return e?e+=" ":e="",e+H}return a.match(/^[^>]+/,!0),H}function p(a,b){if(a.eatSpace())return null;var d=a.next();return"("===d||"["===d?(b.f=b.inline=q("("===d?")":"]"),c.highlightFormatting&&(b.formatting="link-string"),b.linkHref=!0,l(b)):"error"}function q(a){return function(b,d){var e=b.next();if(e===a){d.f=d.inline=n,c.highlightFormatting&&(d.formatting="link-string");var f=l(d);return d.linkHref=!1,f}return b.match(u(a),!0)&&b.backUp(1),d.linkHref=!0,l(d)}}function r(a,b){return a.match(/^[^\]]*\]:/,!1)?(b.f=s,a.next(),c.highlightFormatting&&(b.formatting="link"),b.linkText=!0,l(b)):e(a,b,n)}function s(a,b){if(a.match(/^\]:/,!0)){b.f=b.inline=t,c.highlightFormatting&&(b.formatting="link");var d=l(b);return b.linkText=!1,d}return a.match(/^[^\]]+/,!0),J}function t(a,b){return a.eatSpace()?null:(a.match(/^[^\s]+/,!0),void 0===a.peek()?b.linkTitle=!0:a.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),b.f=b.inline=n,K)}function u(a){return V[a]||(a=(a+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1"),V[a]=new RegExp("^(?:[^\\\\]|\\\\.)*?("+a+")")),V[a]}var v=a.modes.hasOwnProperty("xml"),w=a.getMode(b,v?{name:"xml",htmlMode:!0}:"text/plain");void 0===c.highlightFormatting&&(c.highlightFormatting=!1),void 0===c.maxBlockquoteDepth&&(c.maxBlockquoteDepth=0),void 0===c.underscoresBreakWords&&(c.underscoresBreakWords=!0),void 0===c.fencedCodeBlocks&&(c.fencedCodeBlocks=!1),void 0===c.taskLists&&(c.taskLists=!1),void 0===c.strikethrough&&(c.strikethrough=!1);var x=0,y="header",z="comment",A="quote",B="variable-2",C="variable-3",D="keyword",E="hr",F="tag",G="formatting",H="link",I="link",J="link",K="string",L="em",M="strong",N="strikethrough",O=/^([*\-=_])(?:\s*\1){2,}\s*$/,P=/^[*\-+]\s+/,Q=/^[0-9]+\.\s+/,R=/^\[(x| )\](?=\s)/,S=/^#+ ?/,T=/^(?:\={1,}|-{1,})$/,U=/^[^#!\[\]*_\\<>` "'(~]+/,V=[],W={startState:function(){return{f:h,prevLineHasContent:!1,thisLineHasContent:!1,block:h,htmlState:null,indentation:0,inline:n,text:m,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,em:!1,strong:!1,header:0,taskList:!1,list:!1,listDepth:0,quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1}},copyState:function(b){return{f:b.f,prevLineHasContent:b.prevLineHasContent,thisLineHasContent:b.thisLineHasContent,block:b.block,htmlState:b.htmlState&&a.copyState(w,b.htmlState),indentation:b.indentation,localMode:b.localMode,localState:b.localMode?a.copyState(b.localMode,b.localState):null,inline:b.inline,text:b.text,formatting:!1,linkTitle:b.linkTitle,em:b.em,strong:b.strong,strikethrough:b.strikethrough,header:b.header,taskList:b.taskList,list:b.list,listDepth:b.listDepth,quote:b.quote,trailingSpace:b.trailingSpace,trailingSpaceNewLine:b.trailingSpaceNewLine,md_inside:b.md_inside}},token:function(a,b){if(b.formatting=!1,a.sol()){var c=!!b.header;if(b.header=0,a.match(/^\s*$/,!0)||c)return b.prevLineHasContent=!1,g(b),c?this.token(a,b):null;b.prevLineHasContent=b.thisLineHasContent,b.thisLineHasContent=!0,b.taskList=!1,b.code=!1,b.trailingSpace=0,b.trailingSpaceNewLine=!1,b.f=b.block;var d=a.match(/^\s*/,!0)[0].replace(/\t/g," ").length,e=4*Math.floor((d-b.indentation)/4);e>4&&(e=4);var f=b.indentation+e;if(b.indentationDiff=f-b.indentation,b.indentation=f,d>0)return null}return b.f(a,b)},innerMode:function(a){return a.block==i?{state:a.htmlState,mode:w}:a.localState?{state:a.localState,mode:a.localMode}:{state:a,mode:W}},blankLine:g,getType:l,fold:"markdown"};return W},"xml"),a.defineMIME("text/x-markdown","markdown")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/markdown/test.js b/media/editors/codemirror/mode/markdown/test.js deleted file mode 100644 index 96ca1aefc7b86..0000000000000 --- a/media/editors/codemirror/mode/markdown/test.js +++ /dev/null @@ -1,754 +0,0 @@ -// CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: http://codemirror.net/LICENSE - -(function() { - var mode = CodeMirror.getMode({tabSize: 4}, "markdown"); - function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); } - var modeHighlightFormatting = CodeMirror.getMode({tabSize: 4}, {name: "markdown", highlightFormatting: true}); - function FT(name) { test.mode(name, modeHighlightFormatting, Array.prototype.slice.call(arguments, 1)); } - - FT("formatting_emAsterisk", - "[em&formatting&formatting-em *][em foo][em&formatting&formatting-em *]"); - - FT("formatting_emUnderscore", - "[em&formatting&formatting-em _][em foo][em&formatting&formatting-em _]"); - - FT("formatting_strongAsterisk", - "[strong&formatting&formatting-strong **][strong foo][strong&formatting&formatting-strong **]"); - - FT("formatting_strongUnderscore", - "[strong&formatting&formatting-strong __][strong foo][strong&formatting&formatting-strong __]"); - - FT("formatting_codeBackticks", - "[comment&formatting&formatting-code `][comment foo][comment&formatting&formatting-code `]"); - - FT("formatting_doubleBackticks", - "[comment&formatting&formatting-code ``][comment foo ` bar][comment&formatting&formatting-code ``]"); - - FT("formatting_atxHeader", - "[header&header-1&formatting&formatting-header&formatting-header-1 #][header&header-1 foo # bar ][header&header-1&formatting&formatting-header&formatting-header-1 #]"); - - FT("formatting_setextHeader", - "foo", - "[header&header-1&formatting&formatting-header&formatting-header-1 =]"); - - FT("formatting_blockquote", - "[quote"e-1&formatting&formatting-quote&formatting-quote-1 > ][quote"e-1 foo]"); - - FT("formatting_list", - "[variable-2&formatting&formatting-list&formatting-list-ul - ][variable-2 foo]"); - FT("formatting_list", - "[variable-2&formatting&formatting-list&formatting-list-ol 1. ][variable-2 foo]"); - - FT("formatting_link", - "[link&formatting&formatting-link [][link foo][link&formatting&formatting-link ]]][string&formatting&formatting-link-string (][string http://example.com/][string&formatting&formatting-link-string )]"); - - FT("formatting_linkReference", - "[link&formatting&formatting-link [][link foo][link&formatting&formatting-link ]]][string&formatting&formatting-link-string [][string bar][string&formatting&formatting-link-string ]]]", - "[link&formatting&formatting-link [][link bar][link&formatting&formatting-link ]]:] [string http://example.com/]"); - - FT("formatting_linkWeb", - "[link&formatting&formatting-link <][link http://example.com/][link&formatting&formatting-link >]"); - - FT("formatting_linkEmail", - "[link&formatting&formatting-link <][link user@example.com][link&formatting&formatting-link >]"); - - FT("formatting_escape", - "[formatting-escape \\*]"); - - MT("plainText", - "foo"); - - // Don't style single trailing space - MT("trailingSpace1", - "foo "); - - // Two or more trailing spaces should be styled with line break character - MT("trailingSpace2", - "foo[trailing-space-a ][trailing-space-new-line ]"); - - MT("trailingSpace3", - "foo[trailing-space-a ][trailing-space-b ][trailing-space-new-line ]"); - - MT("trailingSpace4", - "foo[trailing-space-a ][trailing-space-b ][trailing-space-a ][trailing-space-new-line ]"); - - // Code blocks using 4 spaces (regardless of CodeMirror.tabSize value) - MT("codeBlocksUsing4Spaces", - " [comment foo]"); - - // Code blocks using 4 spaces with internal indentation - MT("codeBlocksUsing4SpacesIndentation", - " [comment bar]", - " [comment hello]", - " [comment world]", - " [comment foo]", - "bar"); - - // Code blocks using 4 spaces with internal indentation - MT("codeBlocksUsing4SpacesIndentation", - " foo", - " [comment bar]", - " [comment hello]", - " [comment world]"); - - // Code blocks should end even after extra indented lines - MT("codeBlocksWithTrailingIndentedLine", - " [comment foo]", - " [comment bar]", - " [comment baz]", - " ", - "hello"); - - // Code blocks using 1 tab (regardless of CodeMirror.indentWithTabs value) - MT("codeBlocksUsing1Tab", - "\t[comment foo]"); - - // Inline code using backticks - MT("inlineCodeUsingBackticks", - "foo [comment `bar`]"); - - // Block code using single backtick (shouldn't work) - MT("blockCodeSingleBacktick", - "[comment `]", - "foo", - "[comment `]"); - - // Unclosed backticks - // Instead of simply marking as CODE, it would be nice to have an - // incomplete flag for CODE, that is styled slightly different. - MT("unclosedBackticks", - "foo [comment `bar]"); - - // Per documentation: "To include a literal backtick character within a - // code span, you can use multiple backticks as the opening and closing - // delimiters" - MT("doubleBackticks", - "[comment ``foo ` bar``]"); - - // Tests based on Dingus - // http://daringfireball.net/projects/markdown/dingus - // - // Multiple backticks within an inline code block - MT("consecutiveBackticks", - "[comment `foo```bar`]"); - - // Multiple backticks within an inline code block with a second code block - MT("consecutiveBackticks", - "[comment `foo```bar`] hello [comment `world`]"); - - // Unclosed with several different groups of backticks - MT("unclosedBackticks", - "[comment ``foo ``` bar` hello]"); - - // Closed with several different groups of backticks - MT("closedBackticks", - "[comment ``foo ``` bar` hello``] world"); - - // atx headers - // http://daringfireball.net/projects/markdown/syntax#header - - MT("atxH1", - "[header&header-1 # foo]"); - - MT("atxH2", - "[header&header-2 ## foo]"); - - MT("atxH3", - "[header&header-3 ### foo]"); - - MT("atxH4", - "[header&header-4 #### foo]"); - - MT("atxH5", - "[header&header-5 ##### foo]"); - - MT("atxH6", - "[header&header-6 ###### foo]"); - - // H6 - 7x '#' should still be H6, per Dingus - // http://daringfireball.net/projects/markdown/dingus - MT("atxH6NotH7", - "[header&header-6 ####### foo]"); - - // Inline styles should be parsed inside headers - MT("atxH1inline", - "[header&header-1 # foo ][header&header-1&em *bar*]"); - - // Setext headers - H1, H2 - // Per documentation, "Any number of underlining =’s or -’s will work." - // http://daringfireball.net/projects/markdown/syntax#header - // Ideally, the text would be marked as `header` as well, but this is - // not really feasible at the moment. So, instead, we're testing against - // what works today, to avoid any regressions. - // - // Check if single underlining = works - MT("setextH1", - "foo", - "[header&header-1 =]"); - - // Check if 3+ ='s work - MT("setextH1", - "foo", - "[header&header-1 ===]"); - - // Check if single underlining - works - MT("setextH2", - "foo", - "[header&header-2 -]"); - - // Check if 3+ -'s work - MT("setextH2", - "foo", - "[header&header-2 ---]"); - - // Single-line blockquote with trailing space - MT("blockquoteSpace", - "[quote"e-1 > foo]"); - - // Single-line blockquote - MT("blockquoteNoSpace", - "[quote"e-1 >foo]"); - - // No blank line before blockquote - MT("blockquoteNoBlankLine", - "foo", - "[quote"e-1 > bar]"); - - // Nested blockquote - MT("blockquoteSpace", - "[quote"e-1 > foo]", - "[quote"e-1 >][quote"e-2 > foo]", - "[quote"e-1 >][quote"e-2 >][quote"e-3 > foo]"); - - // Single-line blockquote followed by normal paragraph - MT("blockquoteThenParagraph", - "[quote"e-1 >foo]", - "", - "bar"); - - // Multi-line blockquote (lazy mode) - MT("multiBlockquoteLazy", - "[quote"e-1 >foo]", - "[quote"e-1 bar]"); - - // Multi-line blockquote followed by normal paragraph (lazy mode) - MT("multiBlockquoteLazyThenParagraph", - "[quote"e-1 >foo]", - "[quote"e-1 bar]", - "", - "hello"); - - // Multi-line blockquote (non-lazy mode) - MT("multiBlockquote", - "[quote"e-1 >foo]", - "[quote"e-1 >bar]"); - - // Multi-line blockquote followed by normal paragraph (non-lazy mode) - MT("multiBlockquoteThenParagraph", - "[quote"e-1 >foo]", - "[quote"e-1 >bar]", - "", - "hello"); - - // Check list types - - MT("listAsterisk", - "foo", - "bar", - "", - "[variable-2 * foo]", - "[variable-2 * bar]"); - - MT("listPlus", - "foo", - "bar", - "", - "[variable-2 + foo]", - "[variable-2 + bar]"); - - MT("listDash", - "foo", - "bar", - "", - "[variable-2 - foo]", - "[variable-2 - bar]"); - - MT("listNumber", - "foo", - "bar", - "", - "[variable-2 1. foo]", - "[variable-2 2. bar]"); - - // Lists require a preceding blank line (per Dingus) - MT("listBogus", - "foo", - "1. bar", - "2. hello"); - - // List after header - MT("listAfterHeader", - "[header&header-1 # foo]", - "[variable-2 - bar]"); - - // Formatting in lists (*) - MT("listAsteriskFormatting", - "[variable-2 * ][variable-2&em *foo*][variable-2 bar]", - "[variable-2 * ][variable-2&strong **foo**][variable-2 bar]", - "[variable-2 * ][variable-2&strong **][variable-2&em&strong *foo**][variable-2&em *][variable-2 bar]", - "[variable-2 * ][variable-2&comment `foo`][variable-2 bar]"); - - // Formatting in lists (+) - MT("listPlusFormatting", - "[variable-2 + ][variable-2&em *foo*][variable-2 bar]", - "[variable-2 + ][variable-2&strong **foo**][variable-2 bar]", - "[variable-2 + ][variable-2&strong **][variable-2&em&strong *foo**][variable-2&em *][variable-2 bar]", - "[variable-2 + ][variable-2&comment `foo`][variable-2 bar]"); - - // Formatting in lists (-) - MT("listDashFormatting", - "[variable-2 - ][variable-2&em *foo*][variable-2 bar]", - "[variable-2 - ][variable-2&strong **foo**][variable-2 bar]", - "[variable-2 - ][variable-2&strong **][variable-2&em&strong *foo**][variable-2&em *][variable-2 bar]", - "[variable-2 - ][variable-2&comment `foo`][variable-2 bar]"); - - // Formatting in lists (1.) - MT("listNumberFormatting", - "[variable-2 1. ][variable-2&em *foo*][variable-2 bar]", - "[variable-2 2. ][variable-2&strong **foo**][variable-2 bar]", - "[variable-2 3. ][variable-2&strong **][variable-2&em&strong *foo**][variable-2&em *][variable-2 bar]", - "[variable-2 4. ][variable-2&comment `foo`][variable-2 bar]"); - - // Paragraph lists - MT("listParagraph", - "[variable-2 * foo]", - "", - "[variable-2 * bar]"); - - // Multi-paragraph lists - // - // 4 spaces - MT("listMultiParagraph", - "[variable-2 * foo]", - "", - "[variable-2 * bar]", - "", - " [variable-2 hello]"); - - // 4 spaces, extra blank lines (should still be list, per Dingus) - MT("listMultiParagraphExtra", - "[variable-2 * foo]", - "", - "[variable-2 * bar]", - "", - "", - " [variable-2 hello]"); - - // 4 spaces, plus 1 space (should still be list, per Dingus) - MT("listMultiParagraphExtraSpace", - "[variable-2 * foo]", - "", - "[variable-2 * bar]", - "", - " [variable-2 hello]", - "", - " [variable-2 world]"); - - // 1 tab - MT("listTab", - "[variable-2 * foo]", - "", - "[variable-2 * bar]", - "", - "\t[variable-2 hello]"); - - // No indent - MT("listNoIndent", - "[variable-2 * foo]", - "", - "[variable-2 * bar]", - "", - "hello"); - - // Blockquote - MT("blockquote", - "[variable-2 * foo]", - "", - "[variable-2 * bar]", - "", - " [variable-2"e"e-1 > hello]"); - - // Code block - MT("blockquoteCode", - "[variable-2 * foo]", - "", - "[variable-2 * bar]", - "", - " [comment > hello]", - "", - " [variable-2 world]"); - - // Code block followed by text - MT("blockquoteCodeText", - "[variable-2 * foo]", - "", - " [variable-2 bar]", - "", - " [comment hello]", - "", - " [variable-2 world]"); - - // Nested list - - MT("listAsteriskNested", - "[variable-2 * foo]", - "", - " [variable-3 * bar]"); - - MT("listPlusNested", - "[variable-2 + foo]", - "", - " [variable-3 + bar]"); - - MT("listDashNested", - "[variable-2 - foo]", - "", - " [variable-3 - bar]"); - - MT("listNumberNested", - "[variable-2 1. foo]", - "", - " [variable-3 2. bar]"); - - MT("listMixed", - "[variable-2 * foo]", - "", - " [variable-3 + bar]", - "", - " [keyword - hello]", - "", - " [variable-2 1. world]"); - - MT("listBlockquote", - "[variable-2 * foo]", - "", - " [variable-3 + bar]", - "", - " [quote"e-1&variable-3 > hello]"); - - MT("listCode", - "[variable-2 * foo]", - "", - " [variable-3 + bar]", - "", - " [comment hello]"); - - // Code with internal indentation - MT("listCodeIndentation", - "[variable-2 * foo]", - "", - " [comment bar]", - " [comment hello]", - " [comment world]", - " [comment foo]", - " [variable-2 bar]"); - - // List nesting edge cases - MT("listNested", - "[variable-2 * foo]", - "", - " [variable-3 * bar]", - "", - " [variable-2 hello]" - ); - MT("listNested", - "[variable-2 * foo]", - "", - " [variable-3 * bar]", - "", - " [variable-3 * foo]" - ); - - // Code followed by text - MT("listCodeText", - "[variable-2 * foo]", - "", - " [comment bar]", - "", - "hello"); - - // Following tests directly from official Markdown documentation - // http://daringfireball.net/projects/markdown/syntax#hr - - MT("hrSpace", - "[hr * * *]"); - - MT("hr", - "[hr ***]"); - - MT("hrLong", - "[hr *****]"); - - MT("hrSpaceDash", - "[hr - - -]"); - - MT("hrDashLong", - "[hr ---------------------------------------]"); - - // Inline link with title - MT("linkTitle", - "[link [[foo]]][string (http://example.com/ \"bar\")] hello"); - - // Inline link without title - MT("linkNoTitle", - "[link [[foo]]][string (http://example.com/)] bar"); - - // Inline link with image - MT("linkImage", - "[link [[][tag ![[foo]]][string (http://example.com/)][link ]]][string (http://example.com/)] bar"); - - // Inline link with Em - MT("linkEm", - "[link [[][link&em *foo*][link ]]][string (http://example.com/)] bar"); - - // Inline link with Strong - MT("linkStrong", - "[link [[][link&strong **foo**][link ]]][string (http://example.com/)] bar"); - - // Inline link with EmStrong - MT("linkEmStrong", - "[link [[][link&strong **][link&em&strong *foo**][link&em *][link ]]][string (http://example.com/)] bar"); - - // Image with title - MT("imageTitle", - "[tag ![[foo]]][string (http://example.com/ \"bar\")] hello"); - - // Image without title - MT("imageNoTitle", - "[tag ![[foo]]][string (http://example.com/)] bar"); - - // Image with asterisks - MT("imageAsterisks", - "[tag ![[*foo*]]][string (http://example.com/)] bar"); - - // Not a link. Should be normal text due to square brackets being used - // regularly in text, especially in quoted material, and no space is allowed - // between square brackets and parentheses (per Dingus). - MT("notALink", - "[[foo]] (bar)"); - - // Reference-style links - MT("linkReference", - "[link [[foo]]][string [[bar]]] hello"); - - // Reference-style links with Em - MT("linkReferenceEm", - "[link [[][link&em *foo*][link ]]][string [[bar]]] hello"); - - // Reference-style links with Strong - MT("linkReferenceStrong", - "[link [[][link&strong **foo**][link ]]][string [[bar]]] hello"); - - // Reference-style links with EmStrong - MT("linkReferenceEmStrong", - "[link [[][link&strong **][link&em&strong *foo**][link&em *][link ]]][string [[bar]]] hello"); - - // Reference-style links with optional space separator (per docuentation) - // "You can optionally use a space to separate the sets of brackets" - MT("linkReferenceSpace", - "[link [[foo]]] [string [[bar]]] hello"); - - // Should only allow a single space ("...use *a* space...") - MT("linkReferenceDoubleSpace", - "[[foo]] [[bar]] hello"); - - // Reference-style links with implicit link name - MT("linkImplicit", - "[link [[foo]]][string [[]]] hello"); - - // @todo It would be nice if, at some point, the document was actually - // checked to see if the referenced link exists - - // Link label, for reference-style links (taken from documentation) - - MT("labelNoTitle", - "[link [[foo]]:] [string http://example.com/]"); - - MT("labelIndented", - " [link [[foo]]:] [string http://example.com/]"); - - MT("labelSpaceTitle", - "[link [[foo bar]]:] [string http://example.com/ \"hello\"]"); - - MT("labelDoubleTitle", - "[link [[foo bar]]:] [string http://example.com/ \"hello\"] \"world\""); - - MT("labelTitleDoubleQuotes", - "[link [[foo]]:] [string http://example.com/ \"bar\"]"); - - MT("labelTitleSingleQuotes", - "[link [[foo]]:] [string http://example.com/ 'bar']"); - - MT("labelTitleParenthese", - "[link [[foo]]:] [string http://example.com/ (bar)]"); - - MT("labelTitleInvalid", - "[link [[foo]]:] [string http://example.com/] bar"); - - MT("labelLinkAngleBrackets", - "[link [[foo]]:] [string \"bar\"]"); - - MT("labelTitleNextDoubleQuotes", - "[link [[foo]]:] [string http://example.com/]", - "[string \"bar\"] hello"); - - MT("labelTitleNextSingleQuotes", - "[link [[foo]]:] [string http://example.com/]", - "[string 'bar'] hello"); - - MT("labelTitleNextParenthese", - "[link [[foo]]:] [string http://example.com/]", - "[string (bar)] hello"); - - MT("labelTitleNextMixed", - "[link [[foo]]:] [string http://example.com/]", - "(bar\" hello"); - - MT("linkWeb", - "[link ] foo"); - - MT("linkWebDouble", - "[link ] foo [link ]"); - - MT("linkEmail", - "[link ] foo"); - - MT("linkEmailDouble", - "[link ] foo [link ]"); - - MT("emAsterisk", - "[em *foo*] bar"); - - MT("emUnderscore", - "[em _foo_] bar"); - - MT("emInWordAsterisk", - "foo[em *bar*]hello"); - - MT("emInWordUnderscore", - "foo[em _bar_]hello"); - - // Per documentation: "...surround an * or _ with spaces, it’ll be - // treated as a literal asterisk or underscore." - - MT("emEscapedBySpaceIn", - "foo [em _bar _ hello_] world"); - - MT("emEscapedBySpaceOut", - "foo _ bar[em _hello_]world"); - - MT("emEscapedByNewline", - "foo", - "_ bar[em _hello_]world"); - - // Unclosed emphasis characters - // Instead of simply marking as EM / STRONG, it would be nice to have an - // incomplete flag for EM and STRONG, that is styled slightly different. - MT("emIncompleteAsterisk", - "foo [em *bar]"); - - MT("emIncompleteUnderscore", - "foo [em _bar]"); - - MT("strongAsterisk", - "[strong **foo**] bar"); - - MT("strongUnderscore", - "[strong __foo__] bar"); - - MT("emStrongAsterisk", - "[em *foo][em&strong **bar*][strong hello**] world"); - - MT("emStrongUnderscore", - "[em _foo][em&strong __bar_][strong hello__] world"); - - // "...same character must be used to open and close an emphasis span."" - MT("emStrongMixed", - "[em _foo][em&strong **bar*hello__ world]"); - - MT("emStrongMixed", - "[em *foo][em&strong __bar_hello** world]"); - - // These characters should be escaped: - // \ backslash - // ` backtick - // * asterisk - // _ underscore - // {} curly braces - // [] square brackets - // () parentheses - // # hash mark - // + plus sign - // - minus sign (hyphen) - // . dot - // ! exclamation mark - - MT("escapeBacktick", - "foo \\`bar\\`"); - - MT("doubleEscapeBacktick", - "foo \\\\[comment `bar\\\\`]"); - - MT("escapeAsterisk", - "foo \\*bar\\*"); - - MT("doubleEscapeAsterisk", - "foo \\\\[em *bar\\\\*]"); - - MT("escapeUnderscore", - "foo \\_bar\\_"); - - MT("doubleEscapeUnderscore", - "foo \\\\[em _bar\\\\_]"); - - MT("escapeHash", - "\\# foo"); - - MT("doubleEscapeHash", - "\\\\# foo"); - - MT("escapeNewline", - "\\", - "[em *foo*]"); - - - // Tests to make sure GFM-specific things aren't getting through - - MT("taskList", - "[variable-2 * [ ]] bar]"); - - MT("fencedCodeBlocks", - "[comment ```]", - "foo", - "[comment ```]"); - - // Tests that require XML mode - - MT("xmlMode", - "[tag&bracket <][tag div][tag&bracket >]", - "*foo*", - "[tag&bracket <][tag http://github.com][tag&bracket />]", - "[tag&bracket ]", - "[link ]"); - - MT("xmlModeWithMarkdownInside", - "[tag&bracket <][tag div] [attribute markdown]=[string 1][tag&bracket >]", - "[em *foo*]", - "[link ]", - "[tag
    ]", - "[link ]", - "[tag&bracket <][tag div][tag&bracket >]", - "[tag&bracket ]"); - -})(); diff --git a/media/editors/codemirror/mode/mathematica/mathematica.js b/media/editors/codemirror/mode/mathematica/mathematica.js new file mode 100644 index 0000000000000..5ae6f55cb563d --- /dev/null +++ b/media/editors/codemirror/mode/mathematica/mathematica.js @@ -0,0 +1,175 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +// Mathematica mode copyright (c) 2015 by Calin Barbat +// Based on code by Patrick Scheibe (halirutan) +// See: https://github.com/halirutan/Mathematica-Source-Highlighting/tree/master/src/lang-mma.js + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.defineMode('mathematica', function(_config, _parserConfig) { + + // used pattern building blocks + var Identifier = '[a-zA-Z\\$][a-zA-Z0-9\\$]*'; + var pBase = "(?:\\d+)"; + var pFloat = "(?:\\.\\d+|\\d+\\.\\d*|\\d+)"; + var pFloatBase = "(?:\\.\\w+|\\w+\\.\\w*|\\w+)"; + var pPrecision = "(?:`(?:`?"+pFloat+")?)"; + + // regular expressions + var reBaseForm = new RegExp('(?:'+pBase+'(?:\\^\\^'+pFloatBase+pPrecision+'?(?:\\*\\^[+-]?\\d+)?))'); + var reFloatForm = new RegExp('(?:' + pFloat + pPrecision + '?(?:\\*\\^[+-]?\\d+)?)'); + var reIdInContext = new RegExp('(?:`?)(?:' + Identifier + ')(?:`(?:' + Identifier + '))*(?:`?)'); + + function tokenBase(stream, state) { + var ch; + + // get next character + ch = stream.next(); + + // string + if (ch === '"') { + state.tokenize = tokenString; + return state.tokenize(stream, state); + } + + // comment + if (ch === '(') { + if (stream.eat('*')) { + state.commentLevel++; + state.tokenize = tokenComment; + return state.tokenize(stream, state); + } + } + + // go back one character + stream.backUp(1); + + // look for numbers + // Numbers in a baseform + if (stream.match(reBaseForm, true, false)) { + return 'number'; + } + + // Mathematica numbers. Floats (1.2, .2, 1.) can have optionally a precision (`float) or an accuracy definition + // (``float). Note: while 1.2` is possible 1.2`` is not. At the end an exponent (float*^+12) can follow. + if (stream.match(reFloatForm, true, false)) { + return 'number'; + } + + /* In[23] and Out[34] */ + if (stream.match(/(?:In|Out)\[[0-9]*\]/, true, false)) { + return 'atom'; + } + + // usage + if (stream.match(/([a-zA-Z\$]+(?:`?[a-zA-Z0-9\$])*::usage)/, true, false)) { + return 'meta'; + } + + // message + if (stream.match(/([a-zA-Z\$]+(?:`?[a-zA-Z0-9\$])*::[a-zA-Z\$][a-zA-Z0-9\$]*):?/, true, false)) { + return 'string-2'; + } + + // this makes a look-ahead match for something like variable:{_Integer} + // the match is then forwarded to the mma-patterns tokenizer. + if (stream.match(/([a-zA-Z\$][a-zA-Z0-9\$]*\s*:)(?:(?:[a-zA-Z\$][a-zA-Z0-9\$]*)|(?:[^:=>~@\^\&\*\)\[\]'\?,\|])).*/, true, false)) { + return 'variable-2'; + } + + // catch variables which are used together with Blank (_), BlankSequence (__) or BlankNullSequence (___) + // Cannot start with a number, but can have numbers at any other position. Examples + // blub__Integer, a1_, b34_Integer32 + if (stream.match(/[a-zA-Z\$][a-zA-Z0-9\$]*_+[a-zA-Z\$][a-zA-Z0-9\$]*/, true, false)) { + return 'variable-2'; + } + if (stream.match(/[a-zA-Z\$][a-zA-Z0-9\$]*_+/, true, false)) { + return 'variable-2'; + } + if (stream.match(/_+[a-zA-Z\$][a-zA-Z0-9\$]*/, true, false)) { + return 'variable-2'; + } + + // Named characters in Mathematica, like \[Gamma]. + if (stream.match(/\\\[[a-zA-Z\$][a-zA-Z0-9\$]*\]/, true, false)) { + return 'variable-3'; + } + + // Match all braces separately + if (stream.match(/(?:\[|\]|{|}|\(|\))/, true, false)) { + return 'bracket'; + } + + // Catch Slots (#, ##, #3, ##9 and the V10 named slots #name). I have never seen someone using more than one digit after #, so we match + // only one. + if (stream.match(/(?:#[a-zA-Z\$][a-zA-Z0-9\$]*|#+[0-9]?)/, true, false)) { + return 'variable-2'; + } + + // Literals like variables, keywords, functions + if (stream.match(reIdInContext, true, false)) { + return 'keyword'; + } + + // operators. Note that operators like @@ or /; are matched separately for each symbol. + if (stream.match(/(?:\\|\+|\-|\*|\/|,|;|\.|:|@|~|=|>|<|&|\||_|`|'|\^|\?|!|%)/, true, false)) { + return 'operator'; + } + + // everything else is an error + return 'error'; + } + + function tokenString(stream, state) { + var next, end = false, escaped = false; + while ((next = stream.next()) != null) { + if (next === '"' && !escaped) { + end = true; + break; + } + escaped = !escaped && next === '\\'; + } + if (end && !escaped) { + state.tokenize = tokenBase; + } + return 'string'; + }; + + function tokenComment(stream, state) { + var prev, next; + while(state.commentLevel > 0 && (next = stream.next()) != null) { + if (prev === '(' && next === '*') state.commentLevel++; + if (prev === '*' && next === ')') state.commentLevel--; + prev = next; + } + if (state.commentLevel <= 0) { + state.tokenize = tokenBase; + } + return 'comment'; + } + + return { + startState: function() {return {tokenize: tokenBase, commentLevel: 0};}, + token: function(stream, state) { + if (stream.eatSpace()) return null; + return state.tokenize(stream, state); + }, + blockCommentStart: "(*", + blockCommentEnd: "*)" + }; +}); + +CodeMirror.defineMIME('text/x-mathematica', { + name: 'mathematica' +}); + +}); diff --git a/media/editors/codemirror/mode/mathematica/mathematica.min.js b/media/editors/codemirror/mode/mathematica/mathematica.min.js new file mode 100644 index 0000000000000..a5872ae032f6e --- /dev/null +++ b/media/editors/codemirror/mode/mathematica/mathematica.min.js @@ -0,0 +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("mathematica",function(a,b){function c(a,b){var c;return c=a.next(),'"'===c?(b.tokenize=d,b.tokenize(a,b)):"("===c&&a.eat("*")?(b.commentLevel++,b.tokenize=e,b.tokenize(a,b)):(a.backUp(1),a.match(k,!0,!1)?"number":a.match(l,!0,!1)?"number":a.match(/(?:In|Out)\[[0-9]*\]/,!0,!1)?"atom":a.match(/([a-zA-Z\$]+(?:`?[a-zA-Z0-9\$])*::usage)/,!0,!1)?"meta":a.match(/([a-zA-Z\$]+(?:`?[a-zA-Z0-9\$])*::[a-zA-Z\$][a-zA-Z0-9\$]*):?/,!0,!1)?"string-2":a.match(/([a-zA-Z\$][a-zA-Z0-9\$]*\s*:)(?:(?:[a-zA-Z\$][a-zA-Z0-9\$]*)|(?:[^:=>~@\^\&\*\)\[\]'\?,\|])).*/,!0,!1)?"variable-2":a.match(/[a-zA-Z\$][a-zA-Z0-9\$]*_+[a-zA-Z\$][a-zA-Z0-9\$]*/,!0,!1)?"variable-2":a.match(/[a-zA-Z\$][a-zA-Z0-9\$]*_+/,!0,!1)?"variable-2":a.match(/_+[a-zA-Z\$][a-zA-Z0-9\$]*/,!0,!1)?"variable-2":a.match(/\\\[[a-zA-Z\$][a-zA-Z0-9\$]*\]/,!0,!1)?"variable-3":a.match(/(?:\[|\]|{|}|\(|\))/,!0,!1)?"bracket":a.match(/(?:#[a-zA-Z\$][a-zA-Z0-9\$]*|#+[0-9]?)/,!0,!1)?"variable-2":a.match(m,!0,!1)?"keyword":a.match(/(?:\\|\+|\-|\*|\/|,|;|\.|:|@|~|=|>|<|&|\||_|`|'|\^|\?|!|%)/,!0,!1)?"operator":"error")}function d(a,b){for(var d,e=!1,f=!1;null!=(d=a.next());){if('"'===d&&!f){e=!0;break}f=!f&&"\\"===d}return e&&!f&&(b.tokenize=c),"string"}function e(a,b){for(var d,e;b.commentLevel>0&&null!=(e=a.next());)"("===d&&"*"===e&&b.commentLevel++,"*"===d&&")"===e&&b.commentLevel--,d=e;return b.commentLevel<=0&&(b.tokenize=c),"comment"}var f="[a-zA-Z\\$][a-zA-Z0-9\\$]*",g="(?:\\d+)",h="(?:\\.\\d+|\\d+\\.\\d*|\\d+)",i="(?:\\.\\w+|\\w+\\.\\w*|\\w+)",j="(?:`(?:`?"+h+")?)",k=new RegExp("(?:"+g+"(?:\\^\\^"+i+j+"?(?:\\*\\^[+-]?\\d+)?))"),l=new RegExp("(?:"+h+j+"?(?:\\*\\^[+-]?\\d+)?)"),m=new RegExp("(?:`?)(?:"+f+")(?:`(?:"+f+"))*(?:`?)");return{startState:function(){return{tokenize:c,commentLevel:0}},token:function(a,b){return a.eatSpace()?null:b.tokenize(a,b)},blockCommentStart:"(*",blockCommentEnd:"*)"}}),a.defineMIME("text/x-mathematica",{name:"mathematica"})}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/meta.js b/media/editors/codemirror/mode/meta.js index 8d91df7d77c47..44e0dbfc991a4 100644 --- a/media/editors/codemirror/mode/meta.js +++ b/media/editors/codemirror/mode/meta.js @@ -13,12 +13,14 @@ CodeMirror.modeInfo = [ {name: "APL", mime: "text/apl", mode: "apl", ext: ["dyalog", "apl"]}, + {name: "PGP", mimes: ["application/pgp", "application/pgp-keys", "application/pgp-signature"], mode: "asciiarmor", ext: ["pgp"]}, {name: "Asterisk", mime: "text/x-asterisk", mode: "asterisk", file: /^extensions\.conf$/i}, {name: "C", mime: "text/x-csrc", mode: "clike", ext: ["c", "h"]}, {name: "C++", mime: "text/x-c++src", mode: "clike", ext: ["cpp", "c++", "cc", "cxx", "hpp", "h++", "hh", "hxx"], alias: ["cpp"]}, {name: "Cobol", mime: "text/x-cobol", mode: "cobol", ext: ["cob", "cpy"]}, {name: "C#", mime: "text/x-csharp", mode: "clike", ext: ["cs"], alias: ["csharp"]}, {name: "Clojure", mime: "text/x-clojure", mode: "clojure", ext: ["clj"]}, + {name: "CMake", mime: "text/x-cmake", mode: "cmake", ext: ["cmake", "cmake.in"], file: /^CMakeLists.txt$/}, {name: "CoffeeScript", mime: "text/x-coffeescript", mode: "coffeescript", ext: ["coffee"], alias: ["coffee", "coffee-script"]}, {name: "Common Lisp", mime: "text/x-common-lisp", mode: "commonlisp", ext: ["cl", "lisp", "el"], alias: ["lisp"]}, {name: "Cypher", mime: "application/x-cypher-query", mode: "cypher", ext: ["cyp", "cypher"]}, @@ -38,6 +40,7 @@ {name: "Embedded Javascript", mime: "application/x-ejs", mode: "htmlembedded", ext: ["ejs"]}, {name: "Embedded Ruby", mime: "application/x-erb", mode: "htmlembedded", ext: ["erb"]}, {name: "Erlang", mime: "text/x-erlang", mode: "erlang", ext: ["erl"]}, + {name: "Forth", mime: "text/x-forth", mode: "forth", ext: ["forth", "fth", "4th"]}, {name: "Fortran", mime: "text/x-fortran", mode: "fortran", ext: ["f", "for", "f77", "f90"]}, {name: "F#", mime: "text/x-fsharp", mode: "mllike", ext: ["fs"], alias: ["fsharp"]}, {name: "Gas", mime: "text/x-gas", mode: "gas", ext: ["s"]}, @@ -69,7 +72,9 @@ {name: "Markdown", mime: "text/x-markdown", mode: "markdown", ext: ["markdown", "md", "mkd"]}, {name: "mIRC", mime: "text/mirc", mode: "mirc"}, {name: "MariaDB SQL", mime: "text/x-mariadb", mode: "sql"}, + {name: "Mathematica", mime: "text/x-mathematica", mode: "mathematica", ext: ["m", "nb"]}, {name: "Modelica", mime: "text/x-modelica", mode: "modelica", ext: ["mo"]}, + {name: "MUMPS", mime: "text/x-mumps", mode: "mumps"}, {name: "MS SQL", mime: "text/x-mssql", mode: "sql"}, {name: "MySQL", mime: "text/x-mysql", mode: "sql"}, {name: "Nginx", mime: "text/x-nginx-conf", mode: "nginx", file: /nginx.*\.conf$/i}, @@ -103,7 +108,6 @@ {name: "Slim", mimes: ["text/x-slim", "application/x-slim"], mode: "slim", ext: ["slim"]}, {name: "Smalltalk", mime: "text/x-stsrc", mode: "smalltalk", ext: ["st"]}, {name: "Smarty", mime: "text/x-smarty", mode: "smarty", ext: ["tpl"]}, - {name: "SmartyMixed", mime: "text/x-smarty", mode: "smartymixed"}, {name: "Solr", mime: "text/x-solr", mode: "solr"}, {name: "Soy", mime: "text/x-soy", mode: "soy", ext: ["soy"], alias: ["closure template"]}, {name: "SPARQL", mime: "application/sparql-query", mode: "sparql", ext: ["rq", "sparql"], alias: ["sparul"]}, @@ -119,6 +123,7 @@ {name: "Tiki wiki", mime: "text/tiki", mode: "tiki"}, {name: "TOML", mime: "text/x-toml", mode: "toml", ext: ["toml"]}, {name: "Tornado", mime: "text/x-tornado", mode: "tornado"}, + {name: "troff", mime: "troff", mode: "troff", ext: ["1", "2", "3", "4", "5", "6", "7", "8", "9"]}, {name: "Turtle", mime: "text/turtle", mode: "turtle", ext: ["ttl"]}, {name: "TypeScript", mime: "application/typescript", mode: "javascript", ext: ["ts"], alias: ["ts"]}, {name: "VB.NET", mime: "text/x-vb", mode: "vb", ext: ["vb"]}, @@ -127,7 +132,7 @@ {name: "Verilog", mime: "text/x-verilog", mode: "verilog", ext: ["v"]}, {name: "XML", mimes: ["application/xml", "text/xml"], mode: "xml", ext: ["xml", "xsl", "xsd"], alias: ["rss", "wsdl", "xsd"]}, {name: "XQuery", mime: "application/xquery", mode: "xquery", ext: ["xy", "xquery"]}, - {name: "YAML", mime: "text/x-yaml", mode: "yaml", ext: ["yaml"], alias: ["yml"]}, + {name: "YAML", mime: "text/x-yaml", mode: "yaml", ext: ["yaml", "yml"], alias: ["yml"]}, {name: "Z80", mime: "text/x-z80", mode: "z80", ext: ["z80"]} ]; // Ensure all modes have a mime property for backwards compatibility diff --git a/media/editors/codemirror/mode/meta.min.js b/media/editors/codemirror/mode/meta.min.js new file mode 100644 index 0000000000000..cb85f2fb704ba --- /dev/null +++ b/media/editors/codemirror/mode/meta.min.js @@ -0,0 +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.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["pgp"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists.txt$/},{name:"CoffeeScript",mime:"text/x-coffeescript",mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history).md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy"]},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Jade",mime:"text/x-jade",mode:"jade",ext:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"Jinja2",mime:"null",mode:"jinja2"},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"kotlin",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps"},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NTriples",mime:"text/n-triples",mode:"ntriples",ext:["nt"]},{name:"Objective C",mime:"text/x-objectivec",mode:"clike",ext:["m","mm"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mime:"application/x-httpd-php",mode:"php",ext:["php","php3","php4","php5","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["py","pyw"]},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mime:"text/x-sh",mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"]},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"MariaDB",mime:"text/x-mariadb",mode:"sql"},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki ",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"YAML",mime:"text/x-yaml",mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]}];for(var b=0;b-1&&b.substring(e+1,b.length);return f?a.findModeByExtension(f):void 0},a.findModeByName=function(b){b=b.toLowerCase();for(var c=0;c!?^\/\|]/;return{startState:function(){return{tokenize:c,beforeParams:!1,inParams:!1}},token:function(a,b){return a.eatSpace()?null:b.tokenize(a,b)}}})}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/mllike/mllike.js b/media/editors/codemirror/mode/mllike/mllike.js index 04ab1c98ecd70..bf0b8a674f531 100644 --- a/media/editors/codemirror/mode/mllike/mllike.js +++ b/media/editors/codemirror/mode/mllike/mllike.js @@ -85,7 +85,7 @@ CodeMirror.defineMode('mllike', function(_config, parserConfig) { } stream.eatWhile(/\w/); var cur = stream.current(); - return words[cur] || 'variable'; + return words.hasOwnProperty(cur) ? words[cur] : 'variable'; } function tokenString(stream, state) { diff --git a/media/editors/codemirror/mode/mllike/mllike.min.js b/media/editors/codemirror/mode/mllike/mllike.min.js new file mode 100644 index 0000000000000..dbb44090e51ab --- /dev/null +++ b/media/editors/codemirror/mode/mllike/mllike.min.js @@ -0,0 +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("mllike",function(a,b){function c(a,c){var g=a.next();if('"'===g)return c.tokenize=d,c.tokenize(a,c);if("("===g&&a.eat("*"))return c.commentLevel++,c.tokenize=e,c.tokenize(a,c);if("~"===g)return a.eatWhile(/\w/),"variable-2";if("`"===g)return a.eatWhile(/\w/),"quote";if("/"===g&&b.slashComments&&a.eat("/"))return a.skipToEnd(),"comment";if(/\d/.test(g))return a.eatWhile(/[\d]/),a.eat(".")&&a.eatWhile(/[\d]/),"number";if(/[+\-*&%=<>!?|]/.test(g))return"operator";a.eatWhile(/\w/);var h=a.current();return f.hasOwnProperty(h)?f[h]:"variable"}function d(a,b){for(var d,e=!1,f=!1;null!=(d=a.next());){if('"'===d&&!f){e=!0;break}f=!f&&"\\"===d}return e&&!f&&(b.tokenize=c),"string"}function e(a,b){for(var d,e;b.commentLevel>0&&null!=(e=a.next());)"("===d&&"*"===e&&b.commentLevel++,"*"===d&&")"===e&&b.commentLevel--,d=e;return b.commentLevel<=0&&(b.tokenize=c),"comment"}var f={let:"keyword",rec:"keyword","in":"keyword",of:"keyword",and:"keyword","if":"keyword",then:"keyword","else":"keyword","for":"keyword",to:"keyword","while":"keyword","do":"keyword",done:"keyword",fun:"keyword","function":"keyword",val:"keyword",type:"keyword",mutable:"keyword",match:"keyword","with":"keyword","try":"keyword",open:"builtin",ignore:"builtin",begin:"keyword",end:"keyword"},g=b.extraWords||{};for(var h in g)g.hasOwnProperty(h)&&(f[h]=b.extraWords[h]);return{startState:function(){return{tokenize:c,commentLevel:0}},token:function(a,b){return a.eatSpace()?null:b.tokenize(a,b)},blockCommentStart:"(*",blockCommentEnd:"*)",lineComment:b.slashComments?"//":null}}),a.defineMIME("text/x-ocaml",{name:"mllike",extraWords:{succ:"keyword",trace:"builtin",exit:"builtin",print_string:"builtin",print_endline:"builtin","true":"atom","false":"atom",raise:"keyword"}}),a.defineMIME("text/x-fsharp",{name:"mllike",extraWords:{"abstract":"keyword",as:"keyword",assert:"keyword",base:"keyword","class":"keyword","default":"keyword",delegate:"keyword",downcast:"keyword",downto:"keyword",elif:"keyword",exception:"keyword",extern:"keyword","finally":"keyword",global:"keyword",inherit:"keyword",inline:"keyword","interface":"keyword",internal:"keyword",lazy:"keyword","let!":"keyword",member:"keyword",module:"keyword",namespace:"keyword","new":"keyword","null":"keyword",override:"keyword","private":"keyword","public":"keyword","return":"keyword","return!":"keyword",select:"keyword","static":"keyword",struct:"keyword",upcast:"keyword",use:"keyword","use!":"keyword",val:"keyword",when:"keyword","yield":"keyword","yield!":"keyword",List:"builtin",Seq:"builtin",Map:"builtin",Set:"builtin","int":"builtin",string:"builtin",raise:"builtin",failwith:"builtin",not:"builtin","true":"builtin","false":"builtin"},slashComments:!0})}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/modelica/modelica.min.js b/media/editors/codemirror/mode/modelica/modelica.min.js new file mode 100644 index 0000000000000..348ae9f7f2221 --- /dev/null +++ b/media/editors/codemirror/mode/modelica/modelica.min.js @@ -0,0 +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){for(var b={},c=a.split(" "),d=0;d0&&b.level--:b.level++,b.tokenize=null,b.sol=!1,k.propertyIsEnumerable(c)?"keyword":l.propertyIsEnumerable(c)?"builtin":m.propertyIsEnumerable(c)?"atom":"variable"}function h(a,b){for(;a.eat(/[^']/););return b.tokenize=null,b.sol=!1,a.eat("'")?"variable":"error"}function i(a,b){return a.eatWhile(p),a.eat(".")&&a.eatWhile(p),(a.eat("e")||a.eat("E"))&&(a.eat("-")||a.eat("+"),a.eatWhile(p)),b.tokenize=null,b.sol=!1,"number"}var j=b.indentUnit,k=c.keywords||{},l=c.builtin||{},m=c.atoms||{},n=/[;=\(:\),{}.*<>+\-\/^\[\]]/,o=/(:=|<=|>=|==|<>|\.\+|\.\-|\.\*|\.\/|\.\^)/,p=/[0-9]/,q=/[_a-zA-Z]/;return{startState:function(){return{tokenize:null,level:0,sol:!0}},token:function(a,b){if(null!=b.tokenize)return b.tokenize(a,b);if(a.sol()&&(b.sol=!0),a.eatSpace())return b.tokenize=null,null;var c=a.next();if("/"==c&&a.eat("/"))b.tokenize=d;else if("/"==c&&a.eat("*"))b.tokenize=e;else{if(o.test(c+a.peek()))return a.next(),b.tokenize=null,"operator";if(n.test(c))return b.tokenize=null,"operator";if(q.test(c))b.tokenize=g;else if("'"==c&&a.peek()&&"'"!=a.peek())b.tokenize=h;else if('"'==c)b.tokenize=f;else{if(!p.test(c))return b.tokenize=null,"error";b.tokenize=i}}return b.tokenize(a,b)},indent:function(b,c){if(null!=b.tokenize)return a.Pass;var d=b.level;return/(algorithm)/.test(c)&&d--,/(equation)/.test(c)&&d--,/(initial algorithm)/.test(c)&&d--,/(initial equation)/.test(c)&&d--,/(end)/.test(c)&&d--,d>0?j*d:0},blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//"}});var d="algorithm and annotation assert block break class connect connector constant constrainedby der discrete each else elseif elsewhen encapsulated end enumeration equation expandable extends external false final flow for function if import impure in initial inner input loop model not operator or outer output package parameter partial protected public pure record redeclare replaceable return stream then true type when while within",e="abs acos actualStream asin atan atan2 cardinality ceil cos cosh delay div edge exp floor getInstanceName homotopy inStream integer log log10 mod pre reinit rem semiLinear sign sin sinh spatialDistribution sqrt tan tanh",f="Real Boolean Integer String";c(["text/x-modelica"],{name:"modelica",keywords:b(d),builtin:b(e),atoms:b(f)})}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/mumps/mumps.js b/media/editors/codemirror/mode/mumps/mumps.js new file mode 100644 index 0000000000000..469f8c3d1c3a7 --- /dev/null +++ b/media/editors/codemirror/mode/mumps/mumps.js @@ -0,0 +1,148 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +/* + This MUMPS Language script was constructed using vbscript.js as a template. +*/ + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + CodeMirror.defineMode("mumps", function() { + function wordRegexp(words) { + return new RegExp("^((" + words.join(")|(") + "))\\b", "i"); + } + + var singleOperators = new RegExp("^[\\+\\-\\*/&#!_?\\\\<>=\\'\\[\\]]"); + var doubleOperators = new RegExp("^(('=)|(<=)|(>=)|('>)|('<)|([[)|(]])|(^$))"); + var singleDelimiters = new RegExp("^[\\.,:]"); + var brackets = new RegExp("[()]"); + var identifiers = new RegExp("^[%A-Za-z][A-Za-z0-9]*"); + var commandKeywords = ["break","close","do","else","for","goto", "halt", "hang", "if", "job","kill","lock","merge","new","open", "quit", "read", "set", "tcommit", "trollback", "tstart", "use", "view", "write", "xecute", "b","c","d","e","f","g", "h", "i", "j","k","l","m","n","o", "q", "r", "s", "tc", "tro", "ts", "u", "v", "w", "x"]; + // The following list includes instrinsic functions _and_ special variables + var intrinsicFuncsWords = ["\\$ascii", "\\$char", "\\$data", "\\$ecode", "\\$estack", "\\$etrap", "\\$extract", "\\$find", "\\$fnumber", "\\$get", "\\$horolog", "\\$io", "\\$increment", "\\$job", "\\$justify", "\\$length", "\\$name", "\\$next", "\\$order", "\\$piece", "\\$qlength", "\\$qsubscript", "\\$query", "\\$quit", "\\$random", "\\$reverse", "\\$select", "\\$stack", "\\$test", "\\$text", "\\$translate", "\\$view", "\\$x", "\\$y", "\\$a", "\\$c", "\\$d", "\\$e", "\\$ec", "\\$es", "\\$et", "\\$f", "\\$fn", "\\$g", "\\$h", "\\$i", "\\$j", "\\$l", "\\$n", "\\$na", "\\$o", "\\$p", "\\$q", "\\$ql", "\\$qs", "\\$r", "\\$re", "\\$s", "\\$st", "\\$t", "\\$tr", "\\$v", "\\$z"]; + var intrinsicFuncs = wordRegexp(intrinsicFuncsWords); + var command = wordRegexp(commandKeywords); + + function tokenBase(stream, state) { + if (stream.sol()) { + state.label = true; + state.commandMode = 0; + } + + // The character has meaning in MUMPS. Ignoring consecutive + // spaces would interfere with interpreting whether the next non-space + // character belongs to the command or argument context. + + // Examine each character and update a mode variable whose interpretation is: + // >0 => command 0 => argument <0 => command post-conditional + var ch = stream.peek(); + + if (ch == " " || ch == "\t") { // Pre-process + state.label = false; + if (state.commandMode == 0) + state.commandMode = 1; + else if ((state.commandMode < 0) || (state.commandMode == 2)) + state.commandMode = 0; + } else if ((ch != ".") && (state.commandMode > 0)) { + if (ch == ":") + state.commandMode = -1; // SIS - Command post-conditional + else + state.commandMode = 2; + } + + // Do not color parameter list as line tag + if ((ch === "(") || (ch === "\u0009")) + state.label = false; + + // MUMPS comment starts with ";" + if (ch === ";") { + stream.skipToEnd(); + return "comment"; + } + + // Number Literals // SIS/RLM - MUMPS permits canonic number followed by concatenate operator + if (stream.match(/^[-+]?\d+(\.\d+)?([eE][-+]?\d+)?/)) + return "number"; + + // Handle Strings + if (ch == '"') { + if (stream.skipTo('"')) { + stream.next(); + return "string"; + } else { + stream.skipToEnd(); + return "error"; + } + } + + // Handle operators and Delimiters + if (stream.match(doubleOperators) || stream.match(singleOperators)) + return "operator"; + + // Prevents leading "." in DO block from falling through to error + if (stream.match(singleDelimiters)) + return null; + + if (brackets.test(ch)) { + stream.next(); + return "bracket"; + } + + if (state.commandMode > 0 && stream.match(command)) + return "variable-2"; + + if (stream.match(intrinsicFuncs)) + return "builtin"; + + if (stream.match(identifiers)) + return "variable"; + + // Detect dollar-sign when not a documented intrinsic function + // "^" may introduce a GVN or SSVN - Color same as function + if (ch === "$" || ch === "^") { + stream.next(); + return "builtin"; + } + + // MUMPS Indirection + if (ch === "@") { + stream.next(); + return "string-2"; + } + + if (/[\w%]/.test(ch)) { + stream.eatWhile(/[\w%]/); + return "variable"; + } + + // Handle non-detected items + stream.next(); + return "error"; + } + + return { + startState: function() { + return { + label: false, + commandMode: 0 + }; + }, + + token: function(stream, state) { + var style = tokenBase(stream, state); + if (state.label) return "tag"; + return style; + } + }; + }); + + CodeMirror.defineMIME("text/x-mumps", "mumps"); +}); diff --git a/media/editors/codemirror/mode/mumps/mumps.min.js b/media/editors/codemirror/mode/mumps/mumps.min.js new file mode 100644 index 0000000000000..fd075fbb753f0 --- /dev/null +++ b/media/editors/codemirror/mode/mumps/mumps.min.js @@ -0,0 +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("mumps",function(){function a(a){return new RegExp("^(("+a.join(")|(")+"))\\b","i")}function b(a,b){a.sol()&&(b.label=!0,b.commandMode=0);var h=a.peek();return" "==h||" "==h?(b.label=!1,0==b.commandMode?b.commandMode=1:(b.commandMode<0||2==b.commandMode)&&(b.commandMode=0)):"."!=h&&b.commandMode>0&&(":"==h?b.commandMode=-1:b.commandMode=2),("("===h||" "===h)&&(b.label=!1),";"===h?(a.skipToEnd(),"comment"):a.match(/^[-+]?\d+(\.\d+)?([eE][-+]?\d+)?/)?"number":'"'==h?a.skipTo('"')?(a.next(),"string"):(a.skipToEnd(),"error"):a.match(d)||a.match(c)?"operator":a.match(e)?null:f.test(h)?(a.next(),"bracket"):b.commandMode>0&&a.match(k)?"variable-2":a.match(j)?"builtin":a.match(g)?"variable":"$"===h||"^"===h?(a.next(),"builtin"):"@"===h?(a.next(),"string-2"):/[\w%]/.test(h)?(a.eatWhile(/[\w%]/),"variable"):(a.next(),"error")}var c=new RegExp("^[\\+\\-\\*/&#!_?\\\\<>=\\'\\[\\]]"),d=new RegExp("^(('=)|(<=)|(>=)|('>)|('<)|([[)|(]])|(^$))"),e=new RegExp("^[\\.,:]"),f=new RegExp("[()]"),g=new RegExp("^[%A-Za-z][A-Za-z0-9]*"),h=["break","close","do","else","for","goto","halt","hang","if","job","kill","lock","merge","new","open","quit","read","set","tcommit","trollback","tstart","use","view","write","xecute","b","c","d","e","f","g","h","i","j","k","l","m","n","o","q","r","s","tc","tro","ts","u","v","w","x"],i=["\\$ascii","\\$char","\\$data","\\$ecode","\\$estack","\\$etrap","\\$extract","\\$find","\\$fnumber","\\$get","\\$horolog","\\$io","\\$increment","\\$job","\\$justify","\\$length","\\$name","\\$next","\\$order","\\$piece","\\$qlength","\\$qsubscript","\\$query","\\$quit","\\$random","\\$reverse","\\$select","\\$stack","\\$test","\\$text","\\$translate","\\$view","\\$x","\\$y","\\$a","\\$c","\\$d","\\$e","\\$ec","\\$es","\\$et","\\$f","\\$fn","\\$g","\\$h","\\$i","\\$j","\\$l","\\$n","\\$na","\\$o","\\$p","\\$q","\\$ql","\\$qs","\\$r","\\$re","\\$s","\\$st","\\$t","\\$tr","\\$v","\\$z"],j=a(i),k=a(h);return{startState:function(){return{label:!1,commandMode:0}},token:function(a,c){var d=b(a,c);return c.label?"tag":d}}}),a.defineMIME("text/x-mumps","mumps")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/nginx/nginx.min.js b/media/editors/codemirror/mode/nginx/nginx.min.js new file mode 100644 index 0000000000000..54f2824255446 --- /dev/null +++ b/media/editors/codemirror/mode/nginx/nginx.min.js @@ -0,0 +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("nginx",function(a){function b(a){for(var b={},c=a.split(" "),d=0;d*\/]/.test(h)?c(null,"select-op"):/[;{}:\[\]]/.test(h)?c(null,h):(a.eatWhile(/[\w\\\-]/),c("variable","variable")):c(null,"compare"):void c(null,"compare")}function e(a,b){for(var e,f=!1;null!=(e=a.next());){if(f&&"/"==e){b.tokenize=d;break}f="*"==e}return c("comment","comment")}function f(a,b){for(var e,f=0;null!=(e=a.next());){if(f>=2&&">"==e){b.tokenize=d;break}f="-"==e?f+1:0}return c("comment","comment")}function g(a){return function(b,e){for(var f,g=!1;null!=(f=b.next())&&(f!=a||g);)g=!g&&"\\"==f;return g||(e.tokenize=d),c("string","string")}}var h,i=b("break return rewrite set accept_mutex accept_mutex_delay access_log add_after_body add_before_body add_header addition_types aio alias allow ancient_browser ancient_browser_value auth_basic auth_basic_user_file auth_http auth_http_header auth_http_timeout autoindex autoindex_exact_size autoindex_localtime charset charset_types client_body_buffer_size client_body_in_file_only client_body_in_single_buffer client_body_temp_path client_body_timeout client_header_buffer_size client_header_timeout client_max_body_size connection_pool_size create_full_put_path daemon dav_access dav_methods debug_connection debug_points default_type degradation degrade deny devpoll_changes devpoll_events directio directio_alignment empty_gif env epoll_events error_log eventport_events expires fastcgi_bind fastcgi_buffer_size fastcgi_buffers fastcgi_busy_buffers_size fastcgi_cache fastcgi_cache_key fastcgi_cache_methods fastcgi_cache_min_uses fastcgi_cache_path fastcgi_cache_use_stale fastcgi_cache_valid fastcgi_catch_stderr fastcgi_connect_timeout fastcgi_hide_header fastcgi_ignore_client_abort fastcgi_ignore_headers fastcgi_index fastcgi_intercept_errors fastcgi_max_temp_file_size fastcgi_next_upstream fastcgi_param fastcgi_pass_header fastcgi_pass_request_body fastcgi_pass_request_headers fastcgi_read_timeout fastcgi_send_lowat fastcgi_send_timeout fastcgi_split_path_info fastcgi_store fastcgi_store_access fastcgi_temp_file_write_size fastcgi_temp_path fastcgi_upstream_fail_timeout fastcgi_upstream_max_fails flv geoip_city geoip_country google_perftools_profiles gzip gzip_buffers gzip_comp_level gzip_disable gzip_hash gzip_http_version gzip_min_length gzip_no_buffer gzip_proxied gzip_static gzip_types gzip_vary gzip_window if_modified_since ignore_invalid_headers image_filter image_filter_buffer image_filter_jpeg_quality image_filter_transparency imap_auth imap_capabilities imap_client_buffer index ip_hash keepalive_requests keepalive_timeout kqueue_changes kqueue_events large_client_header_buffers limit_conn limit_conn_log_level limit_rate limit_rate_after limit_req limit_req_log_level limit_req_zone limit_zone lingering_time lingering_timeout lock_file log_format log_not_found log_subrequest map_hash_bucket_size map_hash_max_size master_process memcached_bind memcached_buffer_size memcached_connect_timeout memcached_next_upstream memcached_read_timeout memcached_send_timeout memcached_upstream_fail_timeout memcached_upstream_max_fails merge_slashes min_delete_depth modern_browser modern_browser_value msie_padding msie_refresh multi_accept open_file_cache open_file_cache_errors open_file_cache_events open_file_cache_min_uses open_file_cache_valid open_log_file_cache output_buffers override_charset perl perl_modules perl_require perl_set pid pop3_auth pop3_capabilities port_in_redirect postpone_gzipping postpone_output protocol proxy proxy_bind proxy_buffer proxy_buffer_size proxy_buffering proxy_buffers proxy_busy_buffers_size proxy_cache proxy_cache_key proxy_cache_methods proxy_cache_min_uses proxy_cache_path proxy_cache_use_stale proxy_cache_valid proxy_connect_timeout proxy_headers_hash_bucket_size proxy_headers_hash_max_size proxy_hide_header proxy_ignore_client_abort proxy_ignore_headers proxy_intercept_errors proxy_max_temp_file_size proxy_method proxy_next_upstream proxy_pass_error_message proxy_pass_header proxy_pass_request_body proxy_pass_request_headers proxy_read_timeout proxy_redirect proxy_send_lowat proxy_send_timeout proxy_set_body proxy_set_header proxy_ssl_session_reuse proxy_store proxy_store_access proxy_temp_file_write_size proxy_temp_path proxy_timeout proxy_upstream_fail_timeout proxy_upstream_max_fails random_index read_ahead real_ip_header recursive_error_pages request_pool_size reset_timedout_connection resolver resolver_timeout rewrite_log rtsig_overflow_events rtsig_overflow_test rtsig_overflow_threshold rtsig_signo satisfy secure_link_secret send_lowat send_timeout sendfile sendfile_max_chunk server_name_in_redirect server_names_hash_bucket_size server_names_hash_max_size server_tokens set_real_ip_from smtp_auth smtp_capabilities smtp_client_buffer smtp_greeting_delay so_keepalive source_charset ssi ssi_ignore_recycled_buffers ssi_min_file_chunk ssi_silent_errors ssi_types ssi_value_length ssl ssl_certificate ssl_certificate_key ssl_ciphers ssl_client_certificate ssl_crl ssl_dhparam ssl_engine ssl_prefer_server_ciphers ssl_protocols ssl_session_cache ssl_session_timeout ssl_verify_client ssl_verify_depth starttls stub_status sub_filter sub_filter_once sub_filter_types tcp_nodelay tcp_nopush thread_stack_size timeout timer_resolution types_hash_bucket_size types_hash_max_size underscores_in_headers uninitialized_variable_warn use user userid userid_domain userid_expires userid_mark userid_name userid_p3p userid_path userid_service valid_referers variables_hash_bucket_size variables_hash_max_size worker_connections worker_cpu_affinity worker_priority worker_processes worker_rlimit_core worker_rlimit_nofile worker_rlimit_sigpending worker_threads working_directory xclient xml_entities xslt_stylesheet xslt_typesdrew@li229-23"),j=b("http mail events server types location upstream charset_map limit_except if geo map"),k=b("include root server server_name listen internal proxy_pass memcached_pass fastcgi_pass try_files"),l=a.indentUnit;return{startState:function(a){return{tokenize:d,baseIndent:a||0,stack:[]}},token:function(a,b){if(a.eatSpace())return null;h=null;var c=b.tokenize(a,b),d=b.stack[b.stack.length-1];return"hash"==h&&"rule"==d?c="atom":"variable"==c&&("rule"==d?c="number":d&&"@media{"!=d||(c="tag")),"rule"==d&&/^[\{\};]$/.test(h)&&b.stack.pop(),"{"==h?"@media"==d?b.stack[b.stack.length-1]="@media{":b.stack.push("{"):"}"==h?b.stack.pop():"@media"==h?b.stack.push("@media"):"{"==d&&"comment"!=h&&b.stack.push("rule"),c},indent:function(a,b){var c=a.stack.length;return/^\}/.test(b)&&(c-="rule"==a.stack[a.stack.length-1]?2:1),a.baseIndent+c*l},electricChars:"}"}}),a.defineMIME("text/nginx","text/x-nginx-conf")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/ntriples/ntriples.min.js b/media/editors/codemirror/mode/ntriples/ntriples.min.js new file mode 100644 index 0000000000000..80b8f118ab3e6 --- /dev/null +++ b/media/editors/codemirror/mode/ntriples/ntriples.min.js @@ -0,0 +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("ntriples",function(){function a(a,c){var d,e=a.location;d=e==b.PRE_SUBJECT&&"<"==c?b.WRITING_SUB_URI:e==b.PRE_SUBJECT&&"_"==c?b.WRITING_BNODE_URI:e==b.PRE_PRED&&"<"==c?b.WRITING_PRED_URI:e==b.PRE_OBJ&&"<"==c?b.WRITING_OBJ_URI:e==b.PRE_OBJ&&"_"==c?b.WRITING_OBJ_BNODE:e==b.PRE_OBJ&&'"'==c?b.WRITING_OBJ_LITERAL:e==b.WRITING_SUB_URI&&">"==c?b.PRE_PRED:e==b.WRITING_BNODE_URI&&" "==c?b.PRE_PRED:e==b.WRITING_PRED_URI&&">"==c?b.PRE_OBJ:e==b.WRITING_OBJ_URI&&">"==c?b.POST_OBJ:e==b.WRITING_OBJ_BNODE&&" "==c?b.POST_OBJ:e==b.WRITING_OBJ_LITERAL&&'"'==c?b.POST_OBJ:e==b.WRITING_LIT_LANG&&" "==c?b.POST_OBJ:e==b.WRITING_LIT_TYPE&&">"==c?b.POST_OBJ:e==b.WRITING_OBJ_LITERAL&&"@"==c?b.WRITING_LIT_LANG:e==b.WRITING_OBJ_LITERAL&&"^"==c?b.WRITING_LIT_TYPE:" "!=c||e!=b.PRE_SUBJECT&&e!=b.PRE_PRED&&e!=b.PRE_OBJ&&e!=b.POST_OBJ?e==b.POST_OBJ&&"."==c?b.PRE_SUBJECT:b.ERROR:e,a.location=d}var b={PRE_SUBJECT:0,WRITING_SUB_URI:1,WRITING_BNODE_URI:2,PRE_PRED:3,WRITING_PRED_URI:4,PRE_OBJ:5,WRITING_OBJ_URI:6,WRITING_OBJ_BNODE:7,WRITING_OBJ_LITERAL:8,WRITING_LIT_LANG:9,WRITING_LIT_TYPE:10,POST_OBJ:11,ERROR:12};return{startState:function(){return{location:b.PRE_SUBJECT,uris:[],anchors:[],bnodes:[],langs:[],types:[]}},token:function(b,c){var d=b.next();if("<"==d){a(c,d);var e="";return b.eatWhile(function(a){return"#"!=a&&">"!=a?(e+=a,!0):!1}),c.uris.push(e),b.match("#",!1)?"variable":(b.next(),a(c,">"),"variable")}if("#"==d){var f="";return b.eatWhile(function(a){return">"!=a&&" "!=a?(f+=a,!0):!1}),c.anchors.push(f),"variable-2"}if(">"==d)return a(c,">"),"variable";if("_"==d){a(c,d);var g="";return b.eatWhile(function(a){return" "!=a?(g+=a,!0):!1}),c.bnodes.push(g),b.next(),a(c," "),"builtin"}if('"'==d)return a(c,d),b.eatWhile(function(a){return'"'!=a}),b.next(),"@"!=b.peek()&&"^"!=b.peek()&&a(c,'"'),"string";if("@"==d){a(c,"@");var h="";return b.eatWhile(function(a){return" "!=a?(h+=a,!0):!1}),c.langs.push(h),b.next(),a(c," "),"string-2"}if("^"==d){b.next(),a(c,"^");var i="";return b.eatWhile(function(a){return">"!=a?(i+=a,!0):!1}),c.types.push(i),b.next(),a(c,">"),"variable"}" "==d&&a(c,d),"."==d&&a(c,d)}}}),a.defineMIME("text/n-triples","ntriples")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/octave/octave.min.js b/media/editors/codemirror/mode/octave/octave.min.js new file mode 100644 index 0000000000000..4525e3d2ed323 --- /dev/null +++ b/media/editors/codemirror/mode/octave/octave.min.js @@ -0,0 +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("octave",function(){function a(a){return new RegExp("^(("+a.join(")|(")+"))\\b")}function b(a,b){return a.sol()||"'"!==a.peek()?(b.tokenize=d,d(a,b)):(a.next(),b.tokenize=d,"operator")}function c(a,b){return a.match(/^.*%}/)?(b.tokenize=d,"comment"):(a.skipToEnd(),"comment")}function d(n,o){if(n.eatSpace())return null;if(n.match("%{"))return o.tokenize=c,n.skipToEnd(),"comment";if(n.match(/^[%#]/))return n.skipToEnd(),"comment";if(n.match(/^[0-9\.+-]/,!1)){if(n.match(/^[+-]?0x[0-9a-fA-F]+[ij]?/))return n.tokenize=d,"number";if(n.match(/^[+-]?\d*\.\d+([EeDd][+-]?\d+)?[ij]?/))return"number";if(n.match(/^[+-]?\d+([EeDd][+-]?\d+)?[ij]?/))return"number"}return n.match(a(["nan","NaN","inf","Inf"]))?"number":n.match(/^"([^"]|(""))*"/)?"string":n.match(/^'([^']|(''))*'/)?"string":n.match(m)?"keyword":n.match(l)?"builtin":n.match(k)?"variable":n.match(e)||n.match(g)?"operator":n.match(f)||n.match(h)||n.match(i)?null:n.match(j)?(o.tokenize=b,null):(n.next(),"error")}var e=new RegExp("^[\\+\\-\\*/&|\\^~<>!@'\\\\]"),f=new RegExp("^[\\(\\[\\{\\},:=;]"),g=new RegExp("^((==)|(~=)|(<=)|(>=)|(<<)|(>>)|(\\.[\\+\\-\\*/\\^\\\\]))"),h=new RegExp("^((!=)|(\\+=)|(\\-=)|(\\*=)|(/=)|(&=)|(\\|=)|(\\^=))"),i=new RegExp("^((>>=)|(<<=))"),j=new RegExp("^[\\]\\)]"),k=new RegExp("^[_A-Za-z¡-￿][_A-Za-z0-9¡-￿]*"),l=a(["error","eval","function","abs","acos","atan","asin","cos","cosh","exp","log","prod","sum","log10","max","min","sign","sin","sinh","sqrt","tan","reshape","break","zeros","default","margin","round","ones","rand","syn","ceil","floor","size","clear","zeros","eye","mean","std","cov","det","eig","inv","norm","rank","trace","expm","logm","sqrtm","linspace","plot","title","xlabel","ylabel","legend","text","grid","meshgrid","mesh","num2str","fft","ifft","arrayfun","cellfun","input","fliplr","flipud","ismember"]),m=a(["return","case","switch","else","elseif","end","endif","endfunction","if","otherwise","do","for","while","try","catch","classdef","properties","events","methods","global","persistent","endfor","endwhile","printf","sprintf","disp","until","continue","pkg"]);return{startState:function(){return{tokenize:d}},token:function(a,c){var d=c.tokenize(a,c);return("number"===d||"variable"===d)&&(c.tokenize=b),d}}}),a.defineMIME("text/x-octave","octave")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/pascal/pascal.min.js b/media/editors/codemirror/mode/pascal/pascal.min.js new file mode 100644 index 0000000000000..329117079b8df --- /dev/null +++ b/media/editors/codemirror/mode/pascal/pascal.min.js @@ -0,0 +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("pascal",function(){function a(a){for(var b={},c=a.split(" "),d=0;d!?|\/]/;return{startState:function(){return{tokenize:null}},token:function(a,c){if(a.eatSpace())return null;var d=(c.tokenize||b)(a,c);return"comment"==d||"meta"==d?d:d},electricChars:"{}"}}),a.defineMIME("text/x-pascal","pascal")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/pegjs/pegjs.min.js b/media/editors/codemirror/mode/pegjs/pegjs.min.js new file mode 100644 index 0000000000000..4e2ab05cc0daa --- /dev/null +++ b/media/editors/codemirror/mode/pegjs/pegjs.min.js @@ -0,0 +1 @@ +!function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("../javascript/javascript")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../javascript/javascript"],a):a(CodeMirror)}(function(a){"use strict";a.defineMode("pegjs",function(b){function c(a){return a.match(/^[a-zA-Z_][a-zA-Z0-9_]*/)}var d=a.getMode(b,"javascript");return{startState:function(){return{inString:!1,stringType:null,inComment:!1,inChracterClass:!1,braced:0,lhs:!0,localState:null}},token:function(a,b){if(a&&(b.inString||b.inComment||'"'!=a.peek()&&"'"!=a.peek()||(b.stringType=a.peek(),a.next(),b.inString=!0)),b.inString||b.inComment||!a.match(/^\/\*/)||(b.inComment=!0),b.inString){for(;b.inString&&!a.eol();)a.peek()===b.stringType?(a.next(),b.inString=!1):"\\"===a.peek()?(a.next(),a.next()):a.match(/^.[^\\\"\']*/);return b.lhs?"property string":"string"}if(b.inComment){for(;b.inComment&&!a.eol();)a.match(/\*\//)?b.inComment=!1:a.match(/^.[^\*]*/);return"comment"}if(b.inChracterClass)for(;b.inChracterClass&&!a.eol();)a.match(/^[^\]\\]+/)||a.match(/^\\./)||(b.inChracterClass=!1);else{if("["===a.peek())return a.next(),b.inChracterClass=!0,"bracket";if(a.match(/^\/\//))return a.skipToEnd(),"comment";if(b.braced||"{"===a.peek()){null===b.localState&&(b.localState=d.startState());var e=d.token(a,b.localState),f=a.current();if(!e)for(var g=0;g=0?c:0,b)}return a.string.substr(0,a.pos-1)}function d(a,b){var c=a.string.length,d=c-a.pos+1;return a.string.substr(a.pos,b&&c>b?b:d)}function e(a,b){var c,d=a.pos+b;0>=d?a.pos=0:d>=(c=a.string.length-1)?a.pos=c:a.pos=d}a.defineMode("perl",function(){function a(a,b,c,d,e){return b.chain=null,b.style=null,b.tail=null,b.tokenize=function(a,b){for(var f,h=!1,i=0;f=a.next();){if(f===c[i]&&!h)return void 0!==c[++i]?(b.chain=c[i],b.style=d,b.tail=e):e&&a.eatWhile(e),b.tokenize=g,d;h=!h&&"\\"==f}return d},b.tokenize(a,b)}function f(a,b,c){return b.tokenize=function(a,b){return a.string==c&&(b.tokenize=g),a.skipToEnd(),"string"},b.tokenize(a,b)}function g(g,k){if(g.eatSpace())return null;if(k.chain)return a(g,k,k.chain,k.style,k.tail);if(g.match(/^\-?[\d\.]/,!1)&&g.match(/^(\-?(\d*\.\d+(e[+-]?\d+)?|\d+\.\d*)|0x[\da-fA-F]+|0b[01]+|\d+(e[+-]?\d+)?)/))return"number";if(g.match(/^<<(?=\w)/))return g.eatWhile(/\w/),f(g,k,g.current().substr(2));if(g.sol()&&g.match(/^\=item(?!\w)/))return f(g,k,"=cut");var l=g.next();if('"'==l||"'"==l){if(c(g,3)=="<<"+l){var m=g.pos;g.eatWhile(/\w/);var n=g.current().substr(1);if(n&&g.eat(l))return f(g,k,n);g.pos=m}return a(g,k,[l],"string")}if("q"==l){var o=b(g,-2);if(!o||!/\w/.test(o))if(o=b(g,0),"x"==o){if(o=b(g,1),"("==o)return e(g,2),a(g,k,[")"],i,j);if("["==o)return e(g,2),a(g,k,["]"],i,j);if("{"==o)return e(g,2),a(g,k,["}"],i,j);if("<"==o)return e(g,2),a(g,k,[">"],i,j);if(/[\^'"!~\/]/.test(o))return e(g,1),a(g,k,[g.eat(o)],i,j)}else if("q"==o){if(o=b(g,1),"("==o)return e(g,2),a(g,k,[")"],"string");if("["==o)return e(g,2),a(g,k,["]"],"string");if("{"==o)return e(g,2),a(g,k,["}"],"string");if("<"==o)return e(g,2),a(g,k,[">"],"string");if(/[\^'"!~\/]/.test(o))return e(g,1),a(g,k,[g.eat(o)],"string")}else if("w"==o){if(o=b(g,1),"("==o)return e(g,2),a(g,k,[")"],"bracket");if("["==o)return e(g,2),a(g,k,["]"],"bracket");if("{"==o)return e(g,2),a(g,k,["}"],"bracket");if("<"==o)return e(g,2),a(g,k,[">"],"bracket");if(/[\^'"!~\/]/.test(o))return e(g,1),a(g,k,[g.eat(o)],"bracket")}else if("r"==o){if(o=b(g,1),"("==o)return e(g,2),a(g,k,[")"],i,j);if("["==o)return e(g,2),a(g,k,["]"],i,j);if("{"==o)return e(g,2),a(g,k,["}"],i,j);if("<"==o)return e(g,2),a(g,k,[">"],i,j);if(/[\^'"!~\/]/.test(o))return e(g,1),a(g,k,[g.eat(o)],i,j)}else if(/[\^'"!~\/(\[{<]/.test(o)){if("("==o)return e(g,1),a(g,k,[")"],"string");if("["==o)return e(g,1),a(g,k,["]"],"string");if("{"==o)return e(g,1),a(g,k,["}"],"string");if("<"==o)return e(g,1),a(g,k,[">"],"string");if(/[\^'"!~\/]/.test(o))return a(g,k,[g.eat(o)],"string")}}if("m"==l){var o=b(g,-2);if((!o||!/\w/.test(o))&&(o=g.eat(/[(\[{<\^'"!~\/]/))){if(/[\^'"!~\/]/.test(o))return a(g,k,[o],i,j);if("("==o)return a(g,k,[")"],i,j);if("["==o)return a(g,k,["]"],i,j);if("{"==o)return a(g,k,["}"],i,j);if("<"==o)return a(g,k,[">"],i,j)}}if("s"==l){var o=/[\/>\]})\w]/.test(b(g,-2));if(!o&&(o=g.eat(/[(\[{<\^'"!~\/]/)))return"["==o?a(g,k,["]","]"],i,j):"{"==o?a(g,k,["}","}"],i,j):"<"==o?a(g,k,[">",">"],i,j):"("==o?a(g,k,[")",")"],i,j):a(g,k,[o,o],i,j)}if("y"==l){var o=/[\/>\]})\w]/.test(b(g,-2));if(!o&&(o=g.eat(/[(\[{<\^'"!~\/]/)))return"["==o?a(g,k,["]","]"],i,j):"{"==o?a(g,k,["}","}"],i,j):"<"==o?a(g,k,[">",">"],i,j):"("==o?a(g,k,[")",")"],i,j):a(g,k,[o,o],i,j)}if("t"==l){var o=/[\/>\]})\w]/.test(b(g,-2));if(!o&&(o=g.eat("r"),o&&(o=g.eat(/[(\[{<\^'"!~\/]/))))return"["==o?a(g,k,["]","]"],i,j):"{"==o?a(g,k,["}","}"],i,j):"<"==o?a(g,k,[">",">"],i,j):"("==o?a(g,k,[")",")"],i,j):a(g,k,[o,o],i,j)}if("`"==l)return a(g,k,[l],"variable-2");if("/"==l)return/~\s*$/.test(c(g))?a(g,k,[l],i,j):"operator";if("$"==l){var m=g.pos;if(g.eatWhile(/\d/)||g.eat("{")&&g.eatWhile(/\d/)&&g.eat("}"))return"variable-2";g.pos=m}if(/[$@%]/.test(l)){var m=g.pos;if(g.eat("^")&&g.eat(/[A-Z]/)||!/[@$%&]/.test(b(g,-2))&&g.eat(/[=|\\\-#?@;:&`~\^!\[\]*'"$+.,\/<>()]/)){var o=g.current();if(h[o])return"variable-2"}g.pos=m}if(/[$@%&]/.test(l)&&(g.eatWhile(/[\w$\[\]]/)||g.eat("{")&&g.eatWhile(/[\w$\[\]]/)&&g.eat("}"))){var o=g.current();return h[o]?"variable-2":"variable"}if("#"==l&&"$"!=b(g,-2))return g.skipToEnd(),"comment";if(/[:+\-\^*$&%@=<>!?|\/~\.]/.test(l)){var m=g.pos;if(g.eatWhile(/[:+\-\^*$&%@=<>!?|\/~\.]/),h[g.current()])return"operator";g.pos=m}if("_"==l&&1==g.pos){if("_END__"==d(g,6))return a(g,k,["\x00"],"comment");if("_DATA__"==d(g,7))return a(g,k,["\x00"],"variable-2");if("_C__"==d(g,7))return a(g,k,["\x00"],"string")}if(/\w/.test(l)){var m=g.pos;if("{"==b(g,-2)&&("}"==b(g,0)||g.eatWhile(/\w/)&&"}"==b(g,0)))return"string";g.pos=m}if(/[A-Z]/.test(l)){var p=b(g,-2),m=g.pos;if(g.eatWhile(/[A-Z_]/),!/[\da-z]/.test(b(g,0))){var o=h[g.current()];return o?(o[1]&&(o=o[0]),":"!=p?1==o?"keyword":2==o?"def":3==o?"atom":4==o?"operator":5==o?"variable-2":"meta":"meta"):"meta"}g.pos=m}if(/[a-zA-Z_]/.test(l)){var p=b(g,-2);g.eatWhile(/\w/);var o=h[g.current()];return o?(o[1]&&(o=o[0]),":"!=p?1==o?"keyword":2==o?"def":3==o?"atom":4==o?"operator":5==o?"variable-2":"meta":"meta"):"meta"}return null}var h={"->":4,"++":4,"--":4,"**":4,"=~":4,"!~":4,"*":4,"/":4,"%":4,x:4,"+":4,"-":4,".":4,"<<":4,">>":4,"<":4,">":4,"<=":4,">=":4,lt:4,gt:4,le:4,ge:4,"==":4,"!=":4,"<=>":4,eq:4,ne:4,cmp:4,"~~":4,"&":4,"|":4,"^":4,"&&":4,"||":4,"//":4,"..":4,"...":4,"?":4,":":4,"=":4,"+=":4,"-=":4,"*=":4,",":4,"=>":4,"::":4,not:4,and:4,or:4,xor:4,BEGIN:[5,1],END:[5,1],PRINT:[5,1],PRINTF:[5,1],GETC:[5,1],READ:[5,1],READLINE:[5,1],DESTROY:[5,1],TIE:[5,1],TIEHANDLE:[5,1],UNTIE:[5,1],STDIN:5,STDIN_TOP:5,STDOUT:5,STDOUT_TOP:5,STDERR:5,STDERR_TOP:5,$ARG:5,$_:5,"@ARG":5,"@_":5,$LIST_SEPARATOR:5,'$"':5,$PROCESS_ID:5,$PID:5,$$:5,$REAL_GROUP_ID:5,$GID:5,"$(":5,$EFFECTIVE_GROUP_ID:5,$EGID:5,"$)":5,$PROGRAM_NAME:5,$0:5,$SUBSCRIPT_SEPARATOR:5,$SUBSEP:5,"$;":5,$REAL_USER_ID:5,$UID:5,"$<":5,$EFFECTIVE_USER_ID:5,$EUID:5,"$>":5,$a:5,$b:5,$COMPILING:5,"$^C":5,$DEBUGGING:5,"$^D":5,"${^ENCODING}":5,$ENV:5,"%ENV":5,$SYSTEM_FD_MAX:5,"$^F":5,"@F":5,"${^GLOBAL_PHASE}":5,"$^H":5,"%^H":5,"@INC":5,"%INC":5,$INPLACE_EDIT:5,"$^I":5,"$^M":5,$OSNAME:5,"$^O":5,"${^OPEN}":5,$PERLDB:5,"$^P":5,$SIG:5,"%SIG":5,$BASETIME:5,"$^T":5,"${^TAINT}":5,"${^UNICODE}":5,"${^UTF8CACHE}":5,"${^UTF8LOCALE}":5,$PERL_VERSION:5,"$^V":5,"${^WIN32_SLOPPY_STAT}":5,$EXECUTABLE_NAME:5,"$^X":5,$1:5,$MATCH:5,"$&":5,"${^MATCH}":5,$PREMATCH:5,"$`":5,"${^PREMATCH}":5,$POSTMATCH:5,"$'":5,"${^POSTMATCH}":5,$LAST_PAREN_MATCH:5,"$+":5,$LAST_SUBMATCH_RESULT:5,"$^N":5,"@LAST_MATCH_END":5,"@+":5,"%LAST_PAREN_MATCH":5,"%+":5,"@LAST_MATCH_START":5,"@-":5,"%LAST_MATCH_START":5,"%-":5,$LAST_REGEXP_CODE_RESULT:5,"$^R":5,"${^RE_DEBUG_FLAGS}":5,"${^RE_TRIE_MAXBUF}":5,$ARGV:5,"@ARGV":5,ARGV:5,ARGVOUT:5,$OUTPUT_FIELD_SEPARATOR:5,$OFS:5,"$,":5,$INPUT_LINE_NUMBER:5,$NR:5,"$.":5,$INPUT_RECORD_SEPARATOR:5,$RS:5,"$/":5,$OUTPUT_RECORD_SEPARATOR:5,$ORS:5,"$\\":5,$OUTPUT_AUTOFLUSH:5,"$|":5,$ACCUMULATOR:5,"$^A":5,$FORMAT_FORMFEED:5,"$^L":5,$FORMAT_PAGE_NUMBER:5,"$%":5,$FORMAT_LINES_LEFT:5,"$-":5,$FORMAT_LINE_BREAK_CHARACTERS:5,"$:":5,$FORMAT_LINES_PER_PAGE:5,"$=":5,$FORMAT_TOP_NAME:5,"$^":5,$FORMAT_NAME:5,"$~":5,"${^CHILD_ERROR_NATIVE}":5,$EXTENDED_OS_ERROR:5,"$^E":5,$EXCEPTIONS_BEING_CAUGHT:5,"$^S":5,$WARNING:5,"$^W":5,"${^WARNING_BITS}":5,$OS_ERROR:5,$ERRNO:5,"$!":5,"%OS_ERROR":5,"%ERRNO":5,"%!":5,$CHILD_ERROR:5,"$?":5,$EVAL_ERROR:5,"$@":5,$OFMT:5,"$#":5,"$*":5,$ARRAY_BASE:5,"$[":5,$OLD_PERL_VERSION:5,"$]":5,"if":[1,1],elsif:[1,1],"else":[1,1],"while":[1,1],unless:[1,1],"for":[1,1],foreach:[1,1],abs:1,accept:1,alarm:1,atan2:1,bind:1,binmode:1,bless:1,bootstrap:1,"break":1,caller:1,chdir:1,chmod:1,chomp:1,chop:1,chown:1,chr:1,chroot:1,close:1,closedir:1,connect:1,"continue":[1,1],cos:1,crypt:1,dbmclose:1,dbmopen:1,"default":1,defined:1,"delete":1,die:1,"do":1,dump:1,each:1,endgrent:1,endhostent:1,endnetent:1,endprotoent:1,endpwent:1,endservent:1,eof:1,eval:1,exec:1,exists:1,exit:1,exp:1,fcntl:1,fileno:1,flock:1,fork:1,format:1,formline:1,getc:1,getgrent:1,getgrgid:1,getgrnam:1,gethostbyaddr:1,gethostbyname:1,gethostent:1,getlogin:1,getnetbyaddr:1,getnetbyname:1,getnetent:1,getpeername:1,getpgrp:1,getppid:1,getpriority:1,getprotobyname:1,getprotobynumber:1,getprotoent:1,getpwent:1,getpwnam:1,getpwuid:1,getservbyname:1,getservbyport:1,getservent:1,getsockname:1,getsockopt:1,given:1,glob:1,gmtime:1,"goto":1,grep:1,hex:1,"import":1,index:1,"int":1,ioctl:1,join:1,keys:1,kill:1,last:1,lc:1,lcfirst:1,length:1,link:1,listen:1,local:2,localtime:1,lock:1,log:1,lstat:1,m:null,map:1,mkdir:1,msgctl:1,msgget:1,msgrcv:1,msgsnd:1,my:2,"new":1,next:1,no:1,oct:1,open:1,opendir:1,ord:1,our:2,pack:1,"package":1,pipe:1,pop:1,pos:1,print:1,printf:1,prototype:1,push:1,q:null,qq:null,qr:null,quotemeta:null,qw:null,qx:null,rand:1,read:1,readdir:1,readline:1,readlink:1,readpipe:1,recv:1,redo:1,ref:1,rename:1,require:1,reset:1,"return":1,reverse:1,rewinddir:1,rindex:1,rmdir:1,s:null,say:1,scalar:1,seek:1,seekdir:1,select:1,semctl:1,semget:1,semop:1,send:1,setgrent:1,sethostent:1,setnetent:1,setpgrp:1,setpriority:1,setprotoent:1,setpwent:1,setservent:1,setsockopt:1,shift:1,shmctl:1,shmget:1,shmread:1,shmwrite:1,shutdown:1,sin:1,sleep:1,socket:1,socketpair:1,sort:1,splice:1,split:1,sprintf:1,sqrt:1,srand:1,stat:1,state:1,study:1,sub:1,substr:1,symlink:1,syscall:1,sysopen:1,sysread:1,sysseek:1,system:1,syswrite:1,tell:1,telldir:1,tie:1,tied:1,time:1,times:1,tr:null,truncate:1,uc:1,ucfirst:1,umask:1,undef:1,unlink:1,unpack:1,unshift:1,untie:1,use:1,utime:1,values:1,vec:1,wait:1,waitpid:1,wantarray:1,warn:1,when:1,write:1,y:null},i="string-2",j=/[goseximacplud]/;return{startState:function(){return{tokenize:g,chain:null,style:null,tail:null}},token:function(a,b){return(b.tokenize||g)(a,b)},lineComment:"#"}}),a.registerHelper("wordChars","perl",/[\w$]/),a.defineMIME("text/x-perl","perl")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/php/php.js b/media/editors/codemirror/mode/php/php.js index e112d91121c3e..1c62eb485a6c9 100644 --- a/media/editors/codemirror/mode/php/php.js +++ b/media/editors/codemirror/mode/php/php.js @@ -94,6 +94,7 @@ helperType: "php", keywords: keywords(phpKeywords), blockKeywords: keywords("catch do else elseif for foreach if switch try while finally"), + defKeywords: keywords("class function interface namespace trait"), atoms: keywords(phpAtoms), builtin: keywords(phpBuiltin), multiLineStrings: true, diff --git a/media/editors/codemirror/mode/php/php.min.js b/media/editors/codemirror/mode/php/php.min.js new file mode 100644 index 0000000000000..bedd3d68e11d2 --- /dev/null +++ b/media/editors/codemirror/mode/php/php.min.js @@ -0,0 +1 @@ +!function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("../htmlmixed/htmlmixed"),require("../clike/clike")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../htmlmixed/htmlmixed","../clike/clike"],a):a(CodeMirror)}(function(a){"use strict";function b(a){for(var b={},c=a.split(" "),d=0;d\w/,!1)&&(b.tokenize=c([[["->",null]],[[/[\w]+/,"variable"]]],d)),"variable-2";for(var e=!1;!a.eol()&&(e||!a.match("{$",!1)&&!a.match(/^(\$[a-zA-Z_][a-zA-Z0-9_]*|\$\{)/,!1));){if(!e&&a.match(d)){b.tokenize=null,b.tokStack.pop(),b.tokStack.pop();break}e="\\"==a.next()&&!e}return"string"}var f="abstract and array as break case catch class clone const continue declare default do else elseif enddeclare endfor endforeach endif endswitch endwhile extends final for foreach function global goto if implements interface instanceof namespace new or private protected public static switch throw trait try use var while xor die echo empty exit eval include include_once isset list require require_once return print unset __halt_compiler self static parent yield insteadof finally",g="true false null TRUE FALSE NULL __CLASS__ __DIR__ __FILE__ __LINE__ __METHOD__ __FUNCTION__ __NAMESPACE__ __TRAIT__",h="func_num_args func_get_arg func_get_args strlen strcmp strncmp strcasecmp strncasecmp each error_reporting define defined trigger_error user_error set_error_handler restore_error_handler get_declared_classes get_loaded_extensions extension_loaded get_extension_funcs debug_backtrace constant bin2hex hex2bin sleep usleep time mktime gmmktime strftime gmstrftime strtotime date gmdate getdate localtime checkdate flush wordwrap htmlspecialchars htmlentities html_entity_decode md5 md5_file crc32 getimagesize image_type_to_mime_type phpinfo phpversion phpcredits strnatcmp strnatcasecmp substr_count strspn strcspn strtok strtoupper strtolower strpos strrpos strrev hebrev hebrevc nl2br basename dirname pathinfo stripslashes stripcslashes strstr stristr strrchr str_shuffle str_word_count strcoll substr substr_replace quotemeta ucfirst ucwords strtr addslashes addcslashes rtrim str_replace str_repeat count_chars chunk_split trim ltrim strip_tags similar_text explode implode setlocale localeconv parse_str str_pad chop strchr sprintf printf vprintf vsprintf sscanf fscanf parse_url urlencode urldecode rawurlencode rawurldecode readlink linkinfo link unlink exec system escapeshellcmd escapeshellarg passthru shell_exec proc_open proc_close rand srand getrandmax mt_rand mt_srand mt_getrandmax base64_decode base64_encode abs ceil floor round is_finite is_nan is_infinite bindec hexdec octdec decbin decoct dechex base_convert number_format fmod ip2long long2ip getenv putenv getopt microtime gettimeofday getrusage uniqid quoted_printable_decode set_time_limit get_cfg_var magic_quotes_runtime set_magic_quotes_runtime get_magic_quotes_gpc get_magic_quotes_runtime import_request_variables error_log serialize unserialize memory_get_usage var_dump var_export debug_zval_dump print_r highlight_file show_source highlight_string ini_get ini_get_all ini_set ini_alter ini_restore get_include_path set_include_path restore_include_path setcookie header headers_sent connection_aborted connection_status ignore_user_abort parse_ini_file is_uploaded_file move_uploaded_file intval floatval doubleval strval gettype settype is_null is_resource is_bool is_long is_float is_int is_integer is_double is_real is_numeric is_string is_array is_object is_scalar ereg ereg_replace eregi eregi_replace split spliti join sql_regcase dl pclose popen readfile rewind rmdir umask fclose feof fgetc fgets fgetss fread fopen fpassthru ftruncate fstat fseek ftell fflush fwrite fputs mkdir rename copy tempnam tmpfile file file_get_contents stream_select stream_context_create stream_context_set_params stream_context_set_option stream_context_get_options stream_filter_prepend stream_filter_append fgetcsv flock get_meta_tags stream_set_write_buffer set_file_buffer set_socket_blocking stream_set_blocking socket_set_blocking stream_get_meta_data stream_register_wrapper stream_wrapper_register stream_set_timeout socket_set_timeout socket_get_status realpath fnmatch fsockopen pfsockopen pack unpack get_browser crypt opendir closedir chdir getcwd rewinddir readdir dir glob fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype file_exists is_writable is_writeable is_readable is_executable is_file is_dir is_link stat lstat chown touch clearstatcache mail ob_start ob_flush ob_clean ob_end_flush ob_end_clean ob_get_flush ob_get_clean ob_get_length ob_get_level ob_get_status ob_get_contents ob_implicit_flush ob_list_handlers ksort krsort natsort natcasesort asort arsort sort rsort usort uasort uksort shuffle array_walk count end prev next reset current key min max in_array array_search extract compact array_fill range array_multisort array_push array_pop array_shift array_unshift array_splice array_slice array_merge array_merge_recursive array_keys array_values array_count_values array_reverse array_reduce array_pad array_flip array_change_key_case array_rand array_unique array_intersect array_intersect_assoc array_diff array_diff_assoc array_sum array_filter array_map array_chunk array_key_exists pos sizeof key_exists assert assert_options version_compare ftok str_rot13 aggregate session_name session_module_name session_save_path session_id session_regenerate_id session_decode session_register session_unregister session_is_registered session_encode session_start session_destroy session_unset session_set_save_handler session_cache_limiter session_cache_expire session_set_cookie_params session_get_cookie_params session_write_close preg_match preg_match_all preg_replace preg_replace_callback preg_split preg_quote preg_grep overload ctype_alnum ctype_alpha ctype_cntrl ctype_digit ctype_lower ctype_graph ctype_print ctype_punct ctype_space ctype_upper ctype_xdigit virtual apache_request_headers apache_note apache_lookup_uri apache_child_terminate apache_setenv apache_response_headers apache_get_version getallheaders mysql_connect mysql_pconnect mysql_close mysql_select_db mysql_create_db mysql_drop_db mysql_query mysql_unbuffered_query mysql_db_query mysql_list_dbs mysql_list_tables mysql_list_fields mysql_list_processes mysql_error mysql_errno mysql_affected_rows mysql_insert_id mysql_result mysql_num_rows mysql_num_fields mysql_fetch_row mysql_fetch_array mysql_fetch_assoc mysql_fetch_object mysql_data_seek mysql_fetch_lengths mysql_fetch_field mysql_field_seek mysql_free_result mysql_field_name mysql_field_table mysql_field_len mysql_field_type mysql_field_flags mysql_escape_string mysql_real_escape_string mysql_stat mysql_thread_id mysql_client_encoding mysql_get_client_info mysql_get_host_info mysql_get_proto_info mysql_get_server_info mysql_info mysql mysql_fieldname mysql_fieldtable mysql_fieldlen mysql_fieldtype mysql_fieldflags mysql_selectdb mysql_createdb mysql_dropdb mysql_freeresult mysql_numfields mysql_numrows mysql_listdbs mysql_listtables mysql_listfields mysql_db_name mysql_dbname mysql_tablename mysql_table_name pg_connect pg_pconnect pg_close pg_connection_status pg_connection_busy pg_connection_reset pg_host pg_dbname pg_port pg_tty pg_options pg_ping pg_query pg_send_query pg_cancel_query pg_fetch_result pg_fetch_row pg_fetch_assoc pg_fetch_array pg_fetch_object pg_fetch_all pg_affected_rows pg_get_result pg_result_seek pg_result_status pg_free_result pg_last_oid pg_num_rows pg_num_fields pg_field_name pg_field_num pg_field_size pg_field_type pg_field_prtlen pg_field_is_null pg_get_notify pg_get_pid pg_result_error pg_last_error pg_last_notice pg_put_line pg_end_copy pg_copy_to pg_copy_from pg_trace pg_untrace pg_lo_create pg_lo_unlink pg_lo_open pg_lo_close pg_lo_read pg_lo_write pg_lo_read_all pg_lo_import pg_lo_export pg_lo_seek pg_lo_tell pg_escape_string pg_escape_bytea pg_unescape_bytea pg_client_encoding pg_set_client_encoding pg_meta_data pg_convert pg_insert pg_update pg_delete pg_select pg_exec pg_getlastoid pg_cmdtuples pg_errormessage pg_numrows pg_numfields pg_fieldname pg_fieldsize pg_fieldtype pg_fieldnum pg_fieldprtlen pg_fieldisnull pg_freeresult pg_result pg_loreadall pg_locreate pg_lounlink pg_loopen pg_loclose pg_loread pg_lowrite pg_loimport pg_loexport http_response_code get_declared_traits getimagesizefromstring socket_import_stream stream_set_chunk_size trait_exists header_register_callback class_uses session_status session_register_shutdown echo print global static exit array empty eval isset unset die include require include_once require_once json_decode json_encode json_last_error json_last_error_msg curl_close curl_copy_handle curl_errno curl_error curl_escape curl_exec curl_file_create curl_getinfo curl_init curl_multi_add_handle curl_multi_close curl_multi_exec curl_multi_getcontent curl_multi_info_read curl_multi_init curl_multi_remove_handle curl_multi_select curl_multi_setopt curl_multi_strerror curl_pause curl_reset curl_setopt_array curl_setopt curl_share_close curl_share_init curl_share_setopt curl_strerror curl_unescape curl_version mysqli_affected_rows mysqli_autocommit mysqli_change_user mysqli_character_set_name mysqli_close mysqli_commit mysqli_connect_errno mysqli_connect_error mysqli_connect mysqli_data_seek mysqli_debug mysqli_dump_debug_info mysqli_errno mysqli_error_list mysqli_error mysqli_fetch_all mysqli_fetch_array mysqli_fetch_assoc mysqli_fetch_field_direct mysqli_fetch_field mysqli_fetch_fields mysqli_fetch_lengths mysqli_fetch_object mysqli_fetch_row mysqli_field_count mysqli_field_seek mysqli_field_tell mysqli_free_result mysqli_get_charset mysqli_get_client_info mysqli_get_client_stats mysqli_get_client_version mysqli_get_connection_stats mysqli_get_host_info mysqli_get_proto_info mysqli_get_server_info mysqli_get_server_version mysqli_info mysqli_init mysqli_insert_id mysqli_kill mysqli_more_results mysqli_multi_query mysqli_next_result mysqli_num_fields mysqli_num_rows mysqli_options mysqli_ping mysqli_prepare mysqli_query mysqli_real_connect mysqli_real_escape_string mysqli_real_query mysqli_reap_async_query mysqli_refresh mysqli_rollback mysqli_select_db mysqli_set_charset mysqli_set_local_infile_default mysqli_set_local_infile_handler mysqli_sqlstate mysqli_ssl_set mysqli_stat mysqli_stmt_init mysqli_store_result mysqli_thread_id mysqli_thread_safe mysqli_use_result mysqli_warning_count";a.registerHelper("hintWords","php",[f,g,h].join(" ").split(" ")),a.registerHelper("wordChars","php",/[\w$]/);var i={name:"clike",helperType:"php",keywords:b(f),blockKeywords:b("catch do else elseif for foreach if switch try while finally"),defKeywords:b("class function interface namespace trait"),atoms:b(g),builtin:b(h),multiLineStrings:!0,hooks:{$:function(a){return a.eatWhile(/[\w\$_]/),"variable-2"},"<":function(a,b){if(a.match(/<",!1);)a.next();return"comment"},"/":function(a){if(a.eat("/")){for(;!a.eol()&&!a.match("?>",!1);)a.next();return"comment"}return!1},'"':function(a,b){return(b.tokStack||(b.tokStack=[])).push('"',0),b.tokenize=d('"'),"string"},"{":function(a,b){return b.tokStack&&b.tokStack.length&&b.tokStack[b.tokStack.length-1]++,!1},"}":function(a,b){return b.tokStack&&b.tokStack.length>0&&!--b.tokStack[b.tokStack.length-1]&&(b.tokenize=d(b.tokStack[b.tokStack.length-2])),!1}}};a.defineMode("php",function(b,c){function d(a,b){var c=b.curMode==f;if(a.sol()&&b.pending&&'"'!=b.pending&&"'"!=b.pending&&(b.pending=null),c)return c&&null==b.php.tokenize&&a.match("?>")?(b.curMode=e,b.curState=b.html,"meta"):f.token(a,b.curState);if(a.match(/^<\?\w*/))return b.curMode=f,b.curState=b.php,"meta";if('"'==b.pending||"'"==b.pending){for(;!a.eol()&&a.next()!=b.pending;);var d="string"}else if(b.pending&&a.pos/.test(h)?b.pending=g[0]:b.pending={end:a.pos,style:d},a.backUp(h.length-i)),d}var e=a.getMode(b,"text/html"),f=a.getMode(b,i);return{startState:function(){var b=a.startState(e),d=a.startState(f);return{html:b,php:d,curMode:c.startOpen?f:e,curState:c.startOpen?d:b,pending:null}},copyState:function(b){var c,d=b.html,g=a.copyState(e,d),h=b.php,i=a.copyState(f,h);return c=b.curMode==e?g:i,{html:g,php:i,curMode:b.curMode,curState:c,pending:b.pending}},token:d,indent:function(a,b){return a.curMode!=f&&/^\s*<\//.test(b)||a.curMode==f&&/^\?>/.test(b)?e.indent(a.html,b):a.curMode.indent(a.curState,b)},blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",innerMode:function(a){return{state:a.curState,mode:a.curMode}}}},"htmlmixed","clike"),a.defineMIME("application/x-httpd-php","php"),a.defineMIME("application/x-httpd-php-open",{name:"php",startOpen:!0}),a.defineMIME("text/x-php",i)}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/php/test.js b/media/editors/codemirror/mode/php/test.js deleted file mode 100644 index e2ecefc187501..0000000000000 --- a/media/editors/codemirror/mode/php/test.js +++ /dev/null @@ -1,154 +0,0 @@ -// CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: http://codemirror.net/LICENSE - -(function() { - var mode = CodeMirror.getMode({indentUnit: 2}, "php"); - function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); } - - MT('simple_test', - '[meta ]'); - - MT('variable_interpolation_non_alphanumeric', - '[meta $/$\\$}$\\\"$:$;$?$|$[[$]]$+$=aaa"]', - '[meta ?>]'); - - MT('variable_interpolation_digits', - '[meta ]'); - - MT('variable_interpolation_simple_syntax_1', - '[meta ]'); - - MT('variable_interpolation_simple_syntax_2', - '[meta ]'); - - MT('variable_interpolation_simple_syntax_3', - '[meta [variable aaaaa][string .aaaaaa"];', - '[keyword echo] [string "aaa][variable-2 $aaaa][string ->][variable-2 $aaaaa][string .aaaaaa"];', - '[keyword echo] [string "aaa][variable-2 $aaaa]->[variable aaaaa][string [[2]].aaaaaa"];', - '[keyword echo] [string "aaa][variable-2 $aaaa]->[variable aaaaa][string ->aaaa2.aaaaaa"];', - '[meta ?>]'); - - MT('variable_interpolation_escaping', - '[meta aaa.aaa"];', - '[keyword echo] [string "aaa\\$aaaa[[2]]aaa.aaa"];', - '[keyword echo] [string "aaa\\$aaaa[[asd]]aaa.aaa"];', - '[keyword echo] [string "aaa{\\$aaaa->aaa.aaa"];', - '[keyword echo] [string "aaa{\\$aaaa[[2]]aaa.aaa"];', - '[keyword echo] [string "aaa{\\aaaaa[[asd]]aaa.aaa"];', - '[keyword echo] [string "aaa\\${aaaa->aaa.aaa"];', - '[keyword echo] [string "aaa\\${aaaa[[2]]aaa.aaa"];', - '[keyword echo] [string "aaa\\${aaaa[[asd]]aaa.aaa"];', - '[meta ?>]'); - - MT('variable_interpolation_complex_syntax_1', - '[meta aaa.aaa"];', - '[keyword echo] [string "aaa][variable-2 $]{[variable-2 $aaaa]}[string ->aaa.aaa"];', - '[keyword echo] [string "aaa][variable-2 $]{[variable-2 $aaaa][[',' [number 42]',']]}[string ->aaa.aaa"];', - '[keyword echo] [string "aaa][variable-2 $]{[variable aaaa][meta ?>]aaaaaa'); - - MT('variable_interpolation_complex_syntax_2', - '[meta } $aaaaaa.aaa"];', - '[keyword echo] [string "][variable-2 $]{[variable aaa][comment /*}?>*/][[',' [string "aaa][variable-2 $aaa][string {}][variable-2 $]{[variable aaa]}[string "]',']]}[string ->aaa.aaa"];', - '[keyword echo] [string "][variable-2 $]{[variable aaa][comment /*} } $aaa } */]}[string ->aaa.aaa"];'); - - - function build_recursive_monsters(nt, t, n){ - var monsters = [t]; - for (var i = 1; i <= n; ++i) - monsters[i] = nt.join(monsters[i - 1]); - return monsters; - } - - var m1 = build_recursive_monsters( - ['[string "][variable-2 $]{[variable aaa] [operator +] ', '}[string "]'], - '[comment /* }?>} */] [string "aaa][variable-2 $aaa][string .aaa"]', - 10 - ); - - MT('variable_interpolation_complex_syntax_3_1', - '[meta ]'); - - var m2 = build_recursive_monsters( - ['[string "a][variable-2 $]{[variable aaa] [operator +] ', ' [operator +] ', '}[string .a"]'], - '[comment /* }?>{{ */] [string "a?>}{{aa][variable-2 $aaa][string .a}a?>a"]', - 5 - ); - - MT('variable_interpolation_complex_syntax_3_2', - '[meta ]'); - - function build_recursive_monsters_2(mf1, mf2, nt, t, n){ - var monsters = [t]; - for (var i = 1; i <= n; ++i) - monsters[i] = nt[0] + mf1[i - 1] + nt[1] + mf2[i - 1] + nt[2] + monsters[i - 1] + nt[3]; - return monsters; - } - - var m3 = build_recursive_monsters_2( - m1, - m2, - ['[string "a][variable-2 $]{[variable aaa] [operator +] ', ' [operator +] ', ' [operator +] ', '}[string .a"]'], - '[comment /* }?>{{ */] [string "a?>}{{aa][variable-2 $aaa][string .a}a?>a"]', - 4 - ); - - MT('variable_interpolation_complex_syntax_3_3', - '[meta ]'); - - MT("variable_interpolation_heredoc", - "[meta =&?:\/!|]/;return{startState:function(){return{tokenize:f,startOfLine:!0}},token:function(a,b){if(a.eatSpace())return null;var c=b.tokenize(a,b);return c}}}),function(){function b(a){for(var b={},c=a.split(" "),d=0;d.*/,!1),h=a.match(/(\s+)?[\w:_]+(\s+)?{/,!1),i=a.match(/(\s+)?[@]{1,2}[\w:_]+(\s+)?{/,!1),j=a.next();if("$"===j)return a.match(e)?c.continueString?"variable-2":"variable":"error";if(c.continueString)return a.backUp(1),b(a,c);if(c.inDefinition){if(a.match(/(\s+)?[\w:_]+(\s+)?/))return"def";a.match(/\s+{/),c.inDefinition=!1}return c.inInclude?(a.match(/(\s+)?\S+(\s+)?/),c.inInclude=!1,"def"):a.match(/(\s+)?\w+\(/)?(a.backUp(1),"def"):g?(a.match(/(\s+)?\w+/),"tag"):f&&d.hasOwnProperty(f)?(a.backUp(1),a.match(/[\w]+/),a.match(/\s+\S+\s+{/,!1)&&(c.inDefinition=!0),"include"==f&&(c.inInclude=!0),d[f]):/(^|\s+)[A-Z][\w:_]+/.test(f)?(a.backUp(1),a.match(/(^|\s+)[A-Z][\w:_]+/),"def"):h?(a.match(/(\s+)?[\w:_]+/),"def"):i?(a.match(/(\s+)?[@]{1,2}/),"special"):"#"==j?(a.skipToEnd(),"comment"):"'"==j||'"'==j?(c.pending=j,b(a,c)):"{"==j||"}"==j?"bracket":"/"==j?(a.match(/.*?\//),"variable-3"):j.match(/[0-9]/)?(a.eatWhile(/[0-9]+/),"number"):"="==j?(">"==a.peek()&&a.next(),"operator"):(a.eatWhile(/[\w-]/),null)}var d={},e=/({)?([a-z][a-z0-9_]*)?((::[a-z][a-z0-9_]*)*::)?[a-zA-Z0-9_]+(})?/;return a("keyword","class define site node include import inherits"),a("keyword","case if else in and elsif default or"),a("atom","false true running present absent file directory undef"),a("builtin","action augeas burst chain computer cron destination dport exec file filebucket group host icmp iniface interface jump k5login limit log_level log_prefix macauthorization mailalias maillist mcx mount nagios_command nagios_contact nagios_contactgroup nagios_host nagios_hostdependency nagios_hostescalation nagios_hostextinfo nagios_hostgroup nagios_service nagios_servicedependency nagios_serviceescalation nagios_serviceextinfo nagios_servicegroup nagios_timeperiod name notify outiface package proto reject resources router schedule scheduled_task selboolean selmodule service source sport ssh_authorized_key sshkey stage state table tidy todest toports tosource user vlan yumrepo zfs zone zpool"),{startState:function(){var a={};return a.inDefinition=!1,a.inInclude=!1,a.continueString=!1,a.pending=!1,a},token:function(a,b){return a.eatSpace()?null:c(a,b)}}}),a.defineMIME("text/x-puppet","puppet")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/python/python.js b/media/editors/codemirror/mode/python/python.js index 98c0409ae2e01..cdb58bbbb17be 100644 --- a/media/editors/codemirror/mode/python/python.js +++ b/media/editors/codemirror/mode/python/python.js @@ -162,15 +162,13 @@ if (stream.match(tripleDelimiters) || stream.match(doubleDelimiters)) return null; - if (stream.match(doubleOperators) - || stream.match(singleOperators) - || stream.match(wordOperators)) + if (stream.match(doubleOperators) || stream.match(singleOperators)) return "operator"; if (stream.match(singleDelimiters)) return null; - if (stream.match(keywords)) + if (stream.match(keywords) || stream.match(wordOperators)) return "keyword"; if (stream.match(builtins)) @@ -339,6 +337,7 @@ return scope.offset; }, + closeBrackets: {triples: "'\""}, lineComment: "#", fold: "indent" }; diff --git a/media/editors/codemirror/mode/python/python.min.js b/media/editors/codemirror/mode/python/python.min.js new file mode 100644 index 0000000000000..c8bed71236f89 --- /dev/null +++ b/media/editors/codemirror/mode/python/python.min.js @@ -0,0 +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){return new RegExp("^(("+a.join(")|(")+"))\\b")}function c(a){return a.scopes[a.scopes.length-1]}var d=b(["and","or","not","is"]),e=["as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","lambda","pass","raise","return","try","while","with","yield","in"],f=["abs","all","any","bin","bool","bytearray","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip","__import__","NotImplemented","Ellipsis","__debug__"],g={builtins:["apply","basestring","buffer","cmp","coerce","execfile","file","intern","long","raw_input","reduce","reload","unichr","unicode","xrange","False","True","None"],keywords:["exec","print"]},h={builtins:["ascii","bytes","exec","print"],keywords:["nonlocal","False","True","None"]};a.registerHelper("hintWords","python",e.concat(f)),a.defineMode("python",function(i,j){function k(a,b){if(a.sol()&&"py"==c(b).type){var d=c(b).offset;if(a.eatSpace()){var e=a.indentation();return e>d?n(a,b,"py"):d>e&&o(a,b)&&(b.errorToken=!0),null}var f=l(a,b);return d>0&&o(a,b)&&(f+=" "+q),f}return l(a,b)}function l(a,b){if(a.eatSpace())return null;var c=a.peek();if("#"==c)return a.skipToEnd(),"comment";if(a.match(/^[0-9\.]/,!1)){var e=!1;if(a.match(/^\d*\.\d+(e[\+\-]?\d+)?/i)&&(e=!0),a.match(/^\d+\.\d*/)&&(e=!0),a.match(/^\.\d+/)&&(e=!0),e)return a.eat(/J/i),"number";var f=!1;if(a.match(/^0x[0-9a-f]+/i)&&(f=!0),a.match(/^0b[01]+/i)&&(f=!0),a.match(/^0o[0-7]+/i)&&(f=!0),a.match(/^[1-9]\d*(e[\+\-]?\d+)?/)&&(a.eat(/J/i),f=!0),a.match(/^0(?![\dx])/i)&&(f=!0),f)return a.eat(/L/i),"number"}return a.match(A)?(b.tokenize=m(a.current()),b.tokenize(a,b)):a.match(u)||a.match(t)?null:a.match(s)||a.match(v)?"operator":a.match(r)?null:a.match(B)||a.match(d)?"keyword":a.match(C)?"builtin":a.match(/^(self|cls)\b/)?"variable-2":a.match(w)?"def"==b.lastToken||"class"==b.lastToken?"def":"variable":(a.next(),q)}function m(a){function b(b,e){for(;!b.eol();)if(b.eatWhile(/[^'"\\]/),b.eat("\\")){if(b.next(),c&&b.eol())return d}else{if(b.match(a))return e.tokenize=k,d;b.eat(/['"]/)}if(c){if(j.singleLineStringErrors)return q;e.tokenize=k}return d}for(;"rub".indexOf(a.charAt(0).toLowerCase())>=0;)a=a.substr(1);var c=1==a.length,d="string";return b.isString=!0,b}function n(a,b,d){var e=0,f=null;if("py"==d)for(;"py"!=c(b).type;)b.scopes.pop();e=c(b).offset+("py"==d?i.indentUnit:x),"py"==d||a.match(/^(\s|#.*)*$/,!1)||(f=a.column()+1),b.scopes.push({offset:e,type:d,align:f})}function o(a,b){for(var d=a.indentation();c(b).offset>d;){if("py"!=c(b).type)return!0;b.scopes.pop()}return c(b).offset!=d}function p(a,b){var d=b.tokenize(a,b),e=a.current();if("."==e)return d=a.match(w,!1)?null:q,null==d&&"meta"==b.lastStyle&&(d="meta"),d;if("@"==e)return j.version&&3==parseInt(j.version,10)?a.match(w,!1)?"meta":"operator":a.match(w,!1)?"meta":q;"variable"!=d&&"builtin"!=d||"meta"!=b.lastStyle||(d="meta"),("pass"==e||"return"==e)&&(b.dedent+=1),"lambda"==e&&(b.lambda=!0),":"!=e||b.lambda||"py"!=c(b).type||n(a,b,"py");var f=1==e.length?"[({".indexOf(e):-1;if(-1!=f&&n(a,b,"])}".slice(f,f+1)),f="])}".indexOf(e),-1!=f){if(c(b).type!=e)return q;b.scopes.pop()}return b.dedent>0&&a.eol()&&"py"==c(b).type&&(b.scopes.length>1&&b.scopes.pop(),b.dedent-=1),d}var q="error",r=j.singleDelimiters||new RegExp("^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]"),s=j.doubleOperators||new RegExp("^((==)|(!=)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*))"),t=j.doubleDelimiters||new RegExp("^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))"),u=j.tripleDelimiters||new RegExp("^((//=)|(>>=)|(<<=)|(\\*\\*=))");if(j.version&&3==parseInt(j.version,10))var v=j.singleOperators||new RegExp("^[\\+\\-\\*/%&|\\^~<>!@]"),w=j.identifiers||new RegExp("^[_A-Za-z¡-￿][_A-Za-z0-9¡-￿]*");else var v=j.singleOperators||new RegExp("^[\\+\\-\\*/%&|\\^~<>!]"),w=j.identifiers||new RegExp("^[_A-Za-z][_A-Za-z0-9]*");var x=j.hangingIndent||i.indentUnit,y=e,z=f;if(void 0!=j.extra_keywords&&(y=y.concat(j.extra_keywords)),void 0!=j.extra_builtins&&(z=z.concat(j.extra_builtins)),j.version&&3==parseInt(j.version,10)){y=y.concat(h.keywords),z=z.concat(h.builtins);var A=new RegExp("^(([rb]|(br))?('{3}|\"{3}|['\"]))","i")}else{y=y.concat(g.keywords),z=z.concat(g.builtins);var A=new RegExp("^(([rub]|(ur)|(br))?('{3}|\"{3}|['\"]))","i")}var B=b(y),C=b(z),D={startState:function(a){return{tokenize:k,scopes:[{offset:a||0,type:"py",align:null}],lastStyle:null,lastToken:null,lambda:!1,dedent:0}},token:function(a,b){var c=b.errorToken;c&&(b.errorToken=!1);var d=p(a,b);b.lastStyle=d;var e=a.current();return e&&d&&(b.lastToken=e),a.eol()&&b.lambda&&(b.lambda=!1),c?d+" "+q:d},indent:function(b,d){if(b.tokenize!=k)return b.tokenize.isString?a.Pass:0;var e=c(b),f=d&&d.charAt(0)==e.type;return null!=e.align?e.align-(f?1:0):f&&b.scopes.length>1?b.scopes[b.scopes.length-2].offset:e.offset},closeBrackets:{triples:"'\""},lineComment:"#",fold:"indent"};return D}),a.defineMIME("text/x-python","python");var i=function(a){return a.split(" ")};a.defineMIME("text/x-cython",{name:"python",extra_keywords:i("by cdef cimport cpdef ctypedef enum exceptextern gil include nogil property publicreadonly struct union DEF IF ELIF ELSE")})}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/q/q.min.js b/media/editors/codemirror/mode/q/q.min.js new file mode 100644 index 0000000000000..2395a934f5170 --- /dev/null +++ b/media/editors/codemirror/mode/q/q.min.js @@ -0,0 +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("q",function(a){function b(a){return new RegExp("^("+a.join("|")+")$")}function c(a,b){var e=a.sol(),h=a.next();if(j=null,e){if("/"==h)return(b.tokenize=d)(a,b);if("\\"==h)return a.eol()||/\s/.test(a.peek())?(a.skipToEnd(),/^\\\s*$/.test(a.current())?(b.tokenize=f)(a,b):b.tokenize=c,"comment"):(b.tokenize=c,"builtin")}if(/\s/.test(h))return"/"==a.peek()?(a.skipToEnd(),"comment"):"whitespace";if('"'==h)return(b.tokenize=g)(a,b);if("`"==h)return a.eatWhile(/[A-Z|a-z|\d|_|:|\/|\.]/),"symbol";if("."==h&&/\d/.test(a.peek())||/\d/.test(h)){var i=null;return a.backUp(1),a.match(/^\d{4}\.\d{2}(m|\.\d{2}([D|T](\d{2}(:\d{2}(:\d{2}(\.\d{1,9})?)?)?)?)?)/)||a.match(/^\d+D(\d{2}(:\d{2}(:\d{2}(\.\d{1,9})?)?)?)/)||a.match(/^\d{2}:\d{2}(:\d{2}(\.\d{1,9})?)?/)||a.match(/^\d+[ptuv]{1}/)?i="temporal":(a.match(/^0[NwW]{1}/)||a.match(/^0x[\d|a-f|A-F]*/)||a.match(/^[0|1]+[b]{1}/)||a.match(/^\d+[chijn]{1}/)||a.match(/-?\d*(\.\d*)?(e[+\-]?\d+)?(e|f)?/))&&(i="number"),!i||(h=a.peek())&&!m.test(h)?(a.next(),"error"):i}return/[A-Z|a-z]|\./.test(h)?(a.eatWhile(/[A-Z|a-z|\.|_|\d]/),l.test(a.current())?"keyword":"variable"):/[|/&^!+:\\\-*%$=~#;@><\.,?_\']/.test(h)?null:/[{}\(\[\]\)]/.test(h)?null:"error"}function d(a,b){return a.skipToEnd(),/\/\s*$/.test(a.current())?(b.tokenize=e)(a,b):b.tokenize=c,"comment"}function e(a,b){var d=a.sol()&&"\\"==a.peek();return a.skipToEnd(),d&&/^\\\s*$/.test(a.current())&&(b.tokenize=c),"comment"}function f(a){return a.skipToEnd(),"comment"}function g(a,b){for(var d,e=!1,f=!1;d=a.next();){if('"'==d&&!e){f=!0;break}e=!e&&"\\"==d}return f&&(b.tokenize=c),"string"}function h(a,b,c){a.context={prev:a.context,indent:a.indent,col:c,type:b}}function i(a){a.indent=a.context.indent,a.context=a.context.prev}var j,k=a.indentUnit,l=b(["abs","acos","aj","aj0","all","and","any","asc","asin","asof","atan","attr","avg","avgs","bin","by","ceiling","cols","cor","cos","count","cov","cross","csv","cut","delete","deltas","desc","dev","differ","distinct","div","do","each","ej","enlist","eval","except","exec","exit","exp","fby","fills","first","fkeys","flip","floor","from","get","getenv","group","gtime","hclose","hcount","hdel","hopen","hsym","iasc","idesc","if","ij","in","insert","inter","inv","key","keys","last","like","list","lj","load","log","lower","lsq","ltime","ltrim","mavg","max","maxs","mcount","md5","mdev","med","meta","min","mins","mmax","mmin","mmu","mod","msum","neg","next","not","null","or","over","parse","peach","pj","plist","prd","prds","prev","prior","rand","rank","ratios","raze","read0","read1","reciprocal","reverse","rload","rotate","rsave","rtrim","save","scan","select","set","setenv","show","signum","sin","sqrt","ss","ssr","string","sublist","sum","sums","sv","system","tables","tan","til","trim","txf","type","uj","ungroup","union","update","upper","upsert","value","var","view","views","vs","wavg","where","where","while","within","wj","wj1","wsum","xasc","xbar","xcol","xcols","xdesc","xexp","xgroup","xkey","xlog","xprev","xrank"]),m=/[|/&^!+:\\\-*%$=~#;@><,?_\'\"\[\(\]\)\s{}]/;return{startState:function(){return{tokenize:c,context:null,indent:0,col:0}},token:function(a,b){a.sol()&&(b.context&&null==b.context.align&&(b.context.align=!1),b.indent=a.indentation());var c=b.tokenize(a,b);if("comment"!=c&&b.context&&null==b.context.align&&"pattern"!=b.context.type&&(b.context.align=!0),"("==j)h(b,")",a.column());else if("["==j)h(b,"]",a.column());else if("{"==j)h(b,"}",a.column());else if(/[\]\}\)]/.test(j)){for(;b.context&&"pattern"==b.context.type;)i(b);b.context&&j==b.context.type&&i(b)}else"."==j&&b.context&&"pattern"==b.context.type?i(b):/atom|string|variable/.test(c)&&b.context&&(/[\}\]]/.test(b.context.type)?h(b,"pattern",a.column()):"pattern"!=b.context.type||b.context.align||(b.context.align=!0,b.context.col=a.column()));return c},indent:function(a,b){var c=b&&b.charAt(0),d=a.context;if(/[\]\}]/.test(c))for(;d&&"pattern"==d.type;)d=d.prev;var e=d&&c==d.type;return d?"pattern"==d.type?d.col:d.align?d.col+(e?0:1):d.indent+(e?0:k):0}}}),a.defineMIME("text/x-q","q")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/r/r.min.js b/media/editors/codemirror/mode/r/r.min.js new file mode 100644 index 0000000000000..f4fe531f5b5a2 --- /dev/null +++ b/media/editors/codemirror/mode/r/r.min.js @@ -0,0 +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("r",function(a){function b(a){for(var b=a.split(" "),c={},d=0;d=!&|~$:]/;return{startState:function(){return{tokenize:c,ctx:{type:"top",indent:-a.indentUnit,align:!1},indent:0,afterIdent:!1}},token:function(a,b){if(a.sol()&&(null==b.ctx.align&&(b.ctx.align=!1),b.indent=a.indentation()),a.eatSpace())return null;var c=b.tokenize(a,b);"comment"!=c&&null==b.ctx.align&&(b.ctx.align=!0);var d=b.ctx.type;return";"!=g&&"{"!=g&&"}"!=g||"block"!=d||f(b),"{"==g?e(b,"}",a):"("==g?(e(b,")",a),b.afterIdent&&(b.ctx.argList=!0)):"["==g?e(b,"]",a):"block"==g?e(b,"block",a):g==d&&f(b),b.afterIdent="variable"==c||"keyword"==c,c},indent:function(b,d){if(b.tokenize!=c)return 0;var e=d&&d.charAt(0),f=b.ctx,g=e==f.type;return"block"==f.type?f.indent+("{"==e?0:a.indentUnit):f.align?f.column+(g?0:1):f.indent+(g?0:a.indentUnit)},lineComment:"#"}}),a.defineMIME("text/x-rsrc","r")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/rpm/rpm.min.js b/media/editors/codemirror/mode/rpm/rpm.min.js new file mode 100644 index 0000000000000..2c770609e80f8 --- /dev/null +++ b/media/editors/codemirror/mode/rpm/rpm.min.js @@ -0,0 +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("rpm-changes",function(){var a=/^-+$/,b=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ?\d{1,2} \d{2}:\d{2}(:\d{2})? [A-Z]{3,4} \d{4} - /,c=/^[\w+.-]+@[\w.-]+/;return{token:function(d){if(d.sol()){if(d.match(a))return"tag";if(d.match(b))return"tag"}return d.match(c)?"string":(d.next(),null)}}}),a.defineMIME("text/x-rpm-changes","rpm-changes"),a.defineMode("rpm-spec",function(){var a=/^(i386|i586|i686|x86_64|ppc64|ppc|ia64|s390x|s390|sparc64|sparcv9|sparc|noarch|alphaev6|alpha|hppa|mipsel)/,b=/^(Name|Version|Release|License|Summary|Url|Group|Source|BuildArch|BuildRequires|BuildRoot|AutoReqProv|Provides|Requires(\(\w+\))?|Obsoletes|Conflicts|Recommends|Source\d*|Patch\d*|ExclusiveArch|NoSource|Supplements):/,c=/^%(debug_package|package|description|prep|build|install|files|clean|changelog|preinstall|preun|postinstall|postun|pre|post|triggerin|triggerun|pretrans|posttrans|verifyscript|check|triggerpostun|triggerprein|trigger)/,d=/^%(ifnarch|ifarch|if)/,e=/^%(else|endif)/,f=/^(\!|\?|\<\=|\<|\>\=|\>|\=\=|\&\&|\|\|)/;return{startState:function(){return{controlFlow:!1,macroParameters:!1,section:!1}},token:function(g,h){var i=g.peek();if("#"==i)return g.skipToEnd(),"comment";if(g.sol()){if(g.match(b))return"preamble";if(g.match(c))return"section"}if(g.match(/^\$\w+/))return"def";if(g.match(/^\$\{\w+\}/))return"def";if(g.match(e))return"keyword";if(g.match(d))return h.controlFlow=!0,"keyword";if(h.controlFlow){if(g.match(f))return"operator";if(g.match(/^(\d+)/))return"number";g.eol()&&(h.controlFlow=!1)}if(g.match(a))return"number";if(g.match(/^%[\w]+/))return g.match(/^\(/)&&(h.macroParameters=!0),"macro";if(h.macroParameters){if(g.match(/^\d+/))return"number";if(g.match(/^\)/))return h.macroParameters=!1,"macro"}return g.match(/^%\{\??[\w \-]+\}/)?"macro":(g.next(),null)}}}),a.defineMIME("text/x-rpm-spec","rpm-spec")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/rst/rst.min.js b/media/editors/codemirror/mode/rst/rst.min.js new file mode 100644 index 0000000000000..4dd8fb84299e8 --- /dev/null +++ b/media/editors/codemirror/mode/rst/rst.min.js @@ -0,0 +1 @@ +!function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("../python/python"),require("../stex/stex"),require("../../addon/mode/overlay")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../python/python","../stex/stex","../../addon/mode/overlay"],a):a(CodeMirror)}(function(a){"use strict";a.defineMode("rst",function(b,c){var d=/^\*\*[^\*\s](?:[^\*]*[^\*\s])?\*\*/,e=/^\*[^\*\s](?:[^\*]*[^\*\s])?\*/,f=/^``[^`\s](?:[^`]*[^`\s])``/,g=/^(?:[\d]+(?:[\.,]\d+)*)/,h=/^(?:\s\+[\d]+(?:[\.,]\d+)*)/,i=/^(?:\s\-[\d]+(?:[\.,]\d+)*)/,j="[Hh][Tt][Tt][Pp][Ss]?://",k="(?:[\\d\\w.-]+)\\.(?:\\w{2,6})",l="(?:/[\\d\\w\\#\\%\\&\\-\\.\\,\\/\\:\\=\\?\\~]+)*",m=new RegExp("^"+j+k+l),n={token:function(a){if(a.match(d)&&a.match(/\W+|$/,!1))return"strong";if(a.match(e)&&a.match(/\W+|$/,!1))return"em";if(a.match(f)&&a.match(/\W+|$/,!1))return"string-2";if(a.match(g))return"number";if(a.match(h))return"positive";if(a.match(i))return"negative";if(a.match(m))return"link";for(;!(null==a.next()||a.match(d,!1)||a.match(e,!1)||a.match(f,!1)||a.match(g,!1)||a.match(h,!1)||a.match(i,!1)||a.match(m,!1)););return null}},o=a.getMode(b,c.backdrop||"rst-base");return a.overlayMode(o,n,!0)},"python","stex"),a.defineMode("rst-base",function(b){function c(a){var b=Array.prototype.slice.call(arguments,1);return a.replace(/{(\d+)}/g,function(a,c){return"undefined"!=typeof b[c]?b[c]:a})}function d(b,c){var f=null;if(b.sol()&&b.match(Y,!1))k(c,i,{mode:n,local:a.startState(n)});else if(b.sol()&&b.match(A))k(c,e),f="meta";else if(b.sol()&&b.match(z))k(c,d),f="header";else if(m(c)==L||b.match(L,!1))switch(l(c)){case 0:k(c,d,j(L,1)),b.match(/^:/),f="meta";break;case 1:k(c,d,j(L,2)),b.match(t),f="keyword",b.current().match(/^(?:math|latex)/)&&(c.tmp_stex=!0);break;case 2:k(c,d,j(L,3)),b.match(/^:`/),f="meta";break;case 3:if(c.tmp_stex&&(c.tmp_stex=void 0,c.tmp={mode:o,local:a.startState(o)}),c.tmp){if("`"==b.peek()){k(c,d,j(L,4)),c.tmp=void 0;break}f=c.tmp.mode.token(b,c.tmp.local);break}k(c,d,j(L,4)),b.match(y),f="string";break;case 4:k(c,d,j(L,5)),b.match(/^`/),f="meta";break;case 5:k(c,d,j(L,6)),b.match(r);break;default:k(c,d)}else if(m(c)==M||b.match(M,!1))switch(l(c)){case 0:k(c,d,j(M,1)),b.match(/^`/),f="meta";break;case 1:k(c,d,j(M,2)),b.match(y),f="string";break;case 2:k(c,d,j(M,3)),b.match(/^`:/),f="meta";break;case 3:k(c,d,j(M,4)),b.match(t),f="keyword";break;case 4:k(c,d,j(M,5)),b.match(/^:/),f="meta";break;case 5:k(c,d,j(M,6)),b.match(r);break;default:k(c,d)}else if(m(c)==N||b.match(N,!1))switch(l(c)){case 0:k(c,d,j(N,1)),b.match(/^:/),f="meta";break;case 1:k(c,d,j(N,2)),b.match(t),f="keyword";break;case 2:k(c,d,j(N,3)),b.match(/^:/),f="meta";break;case 3:k(c,d,j(N,4)),b.match(r);break;default:k(c,d)}else if(m(c)==G||b.match(G,!1))switch(l(c)){case 0:k(c,d,j(G,1)),b.match(Q),f="variable-2";break;case 1:k(c,d,j(G,2)),b.match(/^_?_?/)&&(f="link");break;default:k(c,d)}else if(b.match(H))k(c,d),f="quote";else if(b.match(I))k(c,d),f="quote";else if(b.match(J))k(c,d),(!b.peek()||b.peek().match(/^\W$/))&&(f="link");else if(m(c)==K||b.match(K,!1))switch(l(c)){case 0:!b.peek()||b.peek().match(/^\W$/)?k(c,d,j(K,1)):b.match(K);break;case 1:k(c,d,j(K,2)),b.match(/^`/),f="link";break;case 2:k(c,d,j(K,3)),b.match(y);break;case 3:k(c,d,j(K,4)),b.match(/^`_/),f="link";break;default:k(c,d)}else b.match(X)?k(c,g):b.next()&&k(c,d);return f}function e(b,c){var g=null;if(m(c)==D||b.match(D,!1))switch(l(c)){case 0:k(c,e,j(D,1)),b.match(Q),g="variable-2";break;case 1:k(c,e,j(D,2)),b.match(R);break;case 2:k(c,e,j(D,3)),b.match(S),g="keyword";break;case 3:k(c,e,j(D,4)),b.match(T),g="meta";break;default:k(c,d)}else if(m(c)==C||b.match(C,!1))switch(l(c)){case 0:k(c,e,j(C,1)),b.match(O),g="keyword",b.current().match(/^(?:math|latex)/)?c.tmp_stex=!0:b.current().match(/^python/)&&(c.tmp_py=!0);break;case 1:k(c,e,j(C,2)),b.match(P),g="meta",(b.match(/^latex\s*$/)||c.tmp_stex)&&(c.tmp_stex=void 0,k(c,i,{mode:o,local:a.startState(o)}));break;case 2:k(c,e,j(C,3)),(b.match(/^python\s*$/)||c.tmp_py)&&(c.tmp_py=void 0,k(c,i,{mode:n,local:a.startState(n)}));break;default:k(c,d)}else if(m(c)==B||b.match(B,!1))switch(l(c)){case 0:k(c,e,j(B,1)),b.match(U),b.match(V),g="link";break;case 1:k(c,e,j(B,2)),b.match(W),g="meta";break;default:k(c,d)}else b.match(E)?(k(c,d),g="quote"):b.match(F)?(k(c,d),g="quote"):(b.eatSpace(),b.eol()?k(c,d):(b.skipToEnd(),k(c,f),g="comment"));return g}function f(a,b){return h(a,b,"comment")}function g(a,b){return h(a,b,"meta")}function h(a,b,c){return a.eol()||a.eatSpace()?(a.skipToEnd(),c):(k(b,d),null)}function i(a,b){return b.ctx.mode&&b.ctx.local?a.sol()?(a.eatSpace()||k(b,d),null):b.ctx.mode.token(a,b.ctx.local):(k(b,d),null)}function j(a,b,c,d){return{phase:a,stage:b,mode:c,local:d}}function k(a,b,c){a.tok=b,a.ctx=c||{}}function l(a){return a.ctx.stage||0}function m(a){return a.ctx.phase}var n=a.getMode(b,"python"),o=a.getMode(b,"stex"),p="\\s+",q="(?:\\s*|\\W|$)",r=new RegExp(c("^{0}",q)),s="(?:[^\\W\\d_](?:[\\w!\"#$%&'()\\*\\+,\\-\\./:;<=>\\?]*[^\\W_])?)",t=new RegExp(c("^{0}",s)),u="(?:[^\\W\\d_](?:[\\w\\s!\"#$%&'()\\*\\+,\\-\\./:;<=>\\?]*[^\\W_])?)",v=c("(?:{0}|`{1}`)",s,u),w="(?:[^\\s\\|](?:[^\\|]*[^\\s\\|])?)",x="(?:[^\\`]+)",y=new RegExp(c("^{0}",x)),z=new RegExp("^([!'#$%&\"()*+,-./:;<=>?@\\[\\\\\\]^_`{|}~])\\1{3,}\\s*$"),A=new RegExp(c("^\\.\\.{0}",p)),B=new RegExp(c("^_{0}:{1}|^__:{1}",v,q)),C=new RegExp(c("^{0}::{1}",v,q)),D=new RegExp(c("^\\|{0}\\|{1}{2}::{3}",w,p,v,q)),E=new RegExp(c("^\\[(?:\\d+|#{0}?|\\*)]{1}",v,q)),F=new RegExp(c("^\\[{0}\\]{1}",v,q)),G=new RegExp(c("^\\|{0}\\|",w)),H=new RegExp(c("^\\[(?:\\d+|#{0}?|\\*)]_",v)),I=new RegExp(c("^\\[{0}\\]_",v)),J=new RegExp(c("^{0}__?",v)),K=new RegExp(c("^`{0}`_",x)),L=new RegExp(c("^:{0}:`{1}`{2}",s,x,q)),M=new RegExp(c("^`{1}`:{0}:{2}",s,x,q)),N=new RegExp(c("^:{0}:{1}",s,q)),O=new RegExp(c("^{0}",v)),P=new RegExp(c("^::{0}",q)),Q=new RegExp(c("^\\|{0}\\|",w)),R=new RegExp(c("^{0}",p)),S=new RegExp(c("^{0}",v)),T=new RegExp(c("^::{0}",q)),U=new RegExp("^_"),V=new RegExp(c("^{0}|_",v)),W=new RegExp(c("^:{0}",q)),X=new RegExp("^::\\s*$"),Y=new RegExp("^\\s+(?:>>>|In \\[\\d+\\]:)\\s");return{startState:function(){return{tok:d,ctx:j(void 0,0)}},copyState:function(b){var c=b.ctx,d=b.tmp;return c.local&&(c={mode:c.mode,local:a.copyState(c.mode,c.local)}),d&&(d={mode:d.mode,local:a.copyState(d.mode,d.local)}),{tok:b.tok,ctx:c,tmp:d}},innerMode:function(a){return a.tmp?{state:a.tmp.local,mode:a.tmp.mode}:a.ctx.mode?{state:a.ctx.local,mode:a.ctx.mode}:null},token:function(a,b){return b.tok(a,b)}}},"python","stex"),a.defineMIME("text/x-rst","rst")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/ruby/ruby.min.js b/media/editors/codemirror/mode/ruby/ruby.min.js new file mode 100644 index 0000000000000..ee29fca85475b --- /dev/null +++ b/media/editors/codemirror/mode/ruby/ruby.min.js @@ -0,0 +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("ruby",function(a){function b(a){for(var b={},c=0,d=a.length;d>c;++c)b[a[c]]=!0;return b}function c(a,b,c){return c.tokenize.push(a),a(b,c)}function d(a,b){if(j=null,a.sol()&&a.match("=begin")&&a.eol())return b.tokenize.push(i),"comment";if(a.eatSpace())return null;var d,e=a.next();if("`"==e||"'"==e||'"'==e)return c(g(e,"string",'"'==e||"`"==e),a,b);if("/"==e){var f=a.current().length;if(a.skipTo("/")){var k=a.current().length;a.backUp(a.current().length-f);for(var l=0;a.current().lengthl)break}if(a.backUp(a.current().length-f),0==l)return c(g(e,"string-2",!0),a,b)}return"operator"}if("%"==e){var o="string",p=!0;a.eat("s")?o="atom":a.eat(/[WQ]/)?o="string":a.eat(/[r]/)?o="string-2":a.eat(/[wxq]/)&&(o="string",p=!1);var q=a.eat(/[^\w\s=]/);return q?(n.propertyIsEnumerable(q)&&(q=n[q]),c(g(q,o,p,!0),a,b)):"operator"}if("#"==e)return a.skipToEnd(),"comment";if("<"==e&&(d=a.match(/^<-?[\`\"\']?([a-zA-Z_?]\w*)[\`\"\']?(?:;|$)/)))return c(h(d[1]),a,b);if("0"==e)return a.eat("x")?a.eatWhile(/[\da-fA-F]/):a.eat("b")?a.eatWhile(/[01]/):a.eatWhile(/[0-7]/),"number";if(/\d/.test(e))return a.match(/^[\d_]*(?:\.[\d_]+)?(?:[eE][+\-]?[\d_]+)?/),"number";if("?"==e){for(;a.match(/^\\[CM]-/););return a.eat("\\")?a.eatWhile(/\w/):a.next(),"string"}if(":"==e)return a.eat("'")?c(g("'","atom",!1),a,b):a.eat('"')?c(g('"',"atom",!0),a,b):a.eat(/[\<\>]/)?(a.eat(/[\<\>]/),"atom"):a.eat(/[\+\-\*\/\&\|\:\!]/)?"atom":a.eat(/[a-zA-Z$@_\xa1-\uffff]/)?(a.eatWhile(/[\w$\xa1-\uffff]/),a.eat(/[\?\!\=]/),"atom"):"operator";if("@"==e&&a.match(/^@?[a-zA-Z_\xa1-\uffff]/))return a.eat("@"),a.eatWhile(/[\w\xa1-\uffff]/),"variable-2";if("$"==e)return a.eat(/[a-zA-Z_]/)?a.eatWhile(/[\w]/):a.eat(/\d/)?a.eat(/\d/):a.next(),"variable-3";if(/[a-zA-Z_\xa1-\uffff]/.test(e))return a.eatWhile(/[\w\xa1-\uffff]/),a.eat(/[\?\!]/),a.eat(":")?"atom":"ident";if("|"!=e||!b.varList&&"{"!=b.lastTok&&"do"!=b.lastTok){if(/[\(\)\[\]{}\\;]/.test(e))return j=e,null;if("-"==e&&a.eat(">"))return"arrow";if(/[=+\-\/*:\.^%<>~|]/.test(e)){var r=a.eatWhile(/[=+\-\/*:\.^%<>~|]/);return"."!=e||r||(j="."),"operator"}return null}return j="|",null}function e(a){return a||(a=1),function(b,c){if("}"==b.peek()){if(1==a)return c.tokenize.pop(),c.tokenize[c.tokenize.length-1](b,c);c.tokenize[c.tokenize.length-1]=e(a-1)}else"{"==b.peek()&&(c.tokenize[c.tokenize.length-1]=e(a+1));return d(b,c)}}function f(){var a=!1;return function(b,c){return a?(c.tokenize.pop(),c.tokenize[c.tokenize.length-1](b,c)):(a=!0,d(b,c))}}function g(a,b,c,d){return function(g,h){var i,j=!1;for("read-quoted-paused"===h.context.type&&(h.context=h.context.prev,g.eat("}"));null!=(i=g.next());){if(i==a&&(d||!j)){h.tokenize.pop();break}if(c&&"#"==i&&!j){if(g.eat("{")){"}"==a&&(h.context={prev:h.context,type:"read-quoted-paused"}),h.tokenize.push(e());break}if(/[@\$]/.test(g.peek())){h.tokenize.push(f());break}}j=!j&&"\\"==i}return b}}function h(a){return function(b,c){return b.match(a)?c.tokenize.pop():b.skipToEnd(),"string"}}function i(a,b){return a.sol()&&a.match("=end")&&a.eol()&&b.tokenize.pop(),a.skipToEnd(),"comment"}var j,k=b(["alias","and","BEGIN","begin","break","case","class","def","defined?","do","else","elsif","END","end","ensure","false","for","if","in","module","next","not","or","redo","rescue","retry","return","self","super","then","true","undef","unless","until","when","while","yield","nil","raise","throw","catch","fail","loop","callcc","caller","lambda","proc","public","protected","private","require","load","require_relative","extend","autoload","__END__","__FILE__","__LINE__","__dir__"]),l=b(["def","class","case","for","while","module","then","catch","loop","proc","begin"]),m=b(["end","until"]),n={"[":"]","{":"}","(":")"};return{startState:function(){return{tokenize:[d],indented:0,context:{type:"top",indented:-a.indentUnit},continuedLine:!1,lastTok:null,varList:!1}},token:function(a,b){a.sol()&&(b.indented=a.indentation());var c,d=b.tokenize[b.tokenize.length-1](a,b),e=j;if("ident"==d){var f=a.current();d="."==b.lastTok?"property":k.propertyIsEnumerable(a.current())?"keyword":/^[A-Z]/.test(f)?"tag":"def"==b.lastTok||"class"==b.lastTok||b.varList?"def":"variable","keyword"==d&&(e=f,l.propertyIsEnumerable(f)?c="indent":m.propertyIsEnumerable(f)?c="dedent":"if"!=f&&"unless"!=f||a.column()!=a.indentation()?"do"==f&&b.context.indented")?a("->",null):f.match(Y)?(b.eatWhile(Y),a("op",null)):(b.eatWhile(/\w/),T=b.current(),b.match(/^::\w/)?(b.backUp(1),a("prefix","variable-2")):e.keywords.propertyIsEnumerable(T)?a(e.keywords[T],T.match(/true|false/)?"atom":"keyword"):a("name","variable"))}function c(c,d){for(var e,f=!1;e=c.next();){if('"'==e&&!f)return d.tokenize=b,a("atom","string");f=!f&&"\\"==e}return a("op","string")}function d(a){return function(c,e){for(var f,g=null;f=c.next();){if("/"==f&&"*"==g){if(1==a){e.tokenize=b;break}return e.tokenize=d(a-1),e.tokenize(c,e)}if("*"==f&&"/"==g)return e.tokenize=d(a+1),e.tokenize(c,e);g=f}return"comment"}}function e(){for(var a=arguments.length-1;a>=0;a--)Z.cc.push(arguments[a])}function f(){return e.apply(null,arguments),!0}function g(a,b){var c=function(){var c=Z.state;c.lexical={indented:c.indented,column:Z.stream.column(),type:a,prev:c.lexical,info:b}};return c.lex=!0,c}function h(){var a=Z.state;a.lexical.prev&&(")"==a.lexical.type&&(a.indented=a.lexical.indented),a.lexical=a.lexical.prev)}function i(){Z.state.keywords=X}function j(){Z.state.keywords=W}function k(a,b){function c(d){return","==d?f(a,c):d==b?f():f(c)}return function(d){return d==b?f():e(a,c)}}function l(a,b){return f(g("stat",b),a,h,m)}function m(a){return"}"==a?f():"let"==a?l(u,"let"):"fn"==a?l(y):"type"==a?f(g("stat"),z,n,h,m):"enum"==a?l(A):"mod"==a?l(C):"iface"==a?l(D):"impl"==a?l(E):"open-attr"==a?f(g("]"),k(o,"]"),h):"ignore"==a||a.match(/[\]\);,]/)?f(m):e(g("stat"),o,h,n,m)}function n(a){return";"==a?f():e()}function o(a){return"atom"==a||"name"==a?f(p):"{"==a?f(g("}"),r,h):a.match(/[\[\(]/)?Q(a,o):a.match(/[\]\)\};,]/)?e():"if-style"==a?f(o,o):"else-style"==a||"op"==a?f(o):"for"==a?f(K,w,x,o,o):"alt"==a?f(o,M):"fn"==a?f(y):"macro"==a?f(P):f()}function p(a){return"."==T?f(q):"::<"==T?f(F,p):"op"==a||":"==T?f(o):"("==a||"["==a?Q(a,o):e()}function q(){return T.match(/^\w+$/)?(Z.marked="variable",f(p)):e(o)}function r(a){if("op"==a){if("|"==T)return f(t,h,g("}","block"),m);if("||"==T)return f(h,g("}","block"),m)}return e("mutable"==T||T.match(/^\w+$/)&&":"==Z.stream.peek()&&!Z.stream.match("::",!1)?s(o):m)}function s(a){function b(c){return"mutable"==T||"with"==T?(Z.marked="keyword",f(b)):T.match(/^\w*$/)?(Z.marked="variable",f(b)):":"==c?f(a,b):"}"==c?f():f(b)}return b}function t(a){return"name"==a?(Z.marked="def",f(t)):"op"==a&&"|"==T?f():f(t)}function u(a){return a.match(/[\]\)\};]/)?f():"="==T?f(o,v):","==a?f(u):e(K,w,u)}function v(a){return a.match(/[\]\)\};,]/)?e(u):e(o,v)}function w(a){return":"==a?f(i,H,j):e()}function x(a){return"name"==a&&"in"==T?(Z.marked="keyword",f()):e()}function y(a){return"@"==T||"~"==T?(Z.marked="keyword",f(y)):"name"==a?(Z.marked="def",f(y)):"<"==T?f(F,y):"{"==a?e(o):"("==a?f(g(")"),k(G,")"),h,y):"->"==a?f(i,H,j,y):";"==a?f():f(y)}function z(a){return"name"==a?(Z.marked="def",f(z)):"<"==T?f(F,z):"="==T?f(i,H,j):f(z)}function A(a){return"name"==a?(Z.marked="def",f(A)):"<"==T?f(F,A):"="==T?f(i,H,j,n):"{"==a?f(g("}"),i,B,j,h):f(A)}function B(a){return"}"==a?f():"("==a?f(g(")"),k(H,")"),h,B):(T.match(/^\w+$/)&&(Z.marked="def"),f(B))}function C(a){return"name"==a?(Z.marked="def",f(C)):"{"==a?f(g("}"),m,h):e()}function D(a){return"name"==a?(Z.marked="def",f(D)):"<"==T?f(F,D):"{"==a?f(g("}"),m,h):e()}function E(a){return"<"==T?f(F,E):"of"==T||"for"==T?(Z.marked="keyword",f(H,E)):"name"==a?(Z.marked="def",f(E)):"{"==a?f(g("}"),m,h):e()}function F(){return">"==T?f():","==T?f(F):":"==T?f(H,F):e(H,F)}function G(a){return"name"==a?(Z.marked="def",f(G)):":"==a?f(i,H,j):e()}function H(a){return"name"==a?(Z.marked="variable-3",f(I)):"mutable"==T?(Z.marked="keyword",f(H)):"atom"==a?f(I):"op"==a||"obj"==a?f(H):"fn"==a?f(J):"{"==a?f(g("{"),s(H),h):Q(a,H)}function I(){return"<"==T?f(F):e()}function J(a){return"("==a?f(g("("),k(H,")"),h,J):"->"==a?f(H):e()}function K(a){return"name"==a?(Z.marked="def",f(L)):"atom"==a?f(L):"op"==a?f(K):a.match(/[\]\)\};,]/)?e():Q(a,K)}function L(a){return"op"==a&&"."==T?f():"to"==T?(Z.marked="keyword",f(K)):e()}function M(a){return"{"==a?f(g("}","alt"),N,h):e()}function N(a){return"}"==a?f():"|"==a?f(N):"when"==T?(Z.marked="keyword",f(o,O)):a.match(/[\]\);,]/)?f(N):e(K,O)}function O(a){return"{"==a?f(g("}","alt"),m,h,N):e(N)}function P(a){return a.match(/[\[\(\{]/)?Q(a,o):e()}function Q(a,b){return"["==a?f(g("]"),k(b,"]"),h):"("==a?f(g(")"),k(b,")"),h):"{"==a?f(g("}"),k(b,"}"),h):f()}function R(a,b,c){var d=a.cc;for(Z.state=a,Z.stream=b,Z.marked=null,Z.cc=d;;){var e=d.length?d.pop():m;if(e(S)){for(;d.length&&d[d.length-1].lex;)d.pop()();return Z.marked||c}}}var S,T,U=4,V=2,W={"if":"if-style","while":"if-style",loop:"else-style","else":"else-style","do":"else-style",ret:"else-style",fail:"else-style","break":"atom",cont:"atom","const":"let",resource:"fn",let:"let",fn:"fn","for":"for",alt:"alt",iface:"iface",impl:"impl",type:"type","enum":"enum",mod:"mod",as:"op","true":"atom","false":"atom",assert:"op",check:"op",claim:"op","native":"ignore",unsafe:"ignore","import":"else-style","export":"else-style",copy:"op",log:"op",log_err:"op",use:"op",bind:"op",self:"atom",struct:"enum"},X=function(){for(var a={fn:"fn",block:"fn",obj:"obj"},b="bool uint int i8 i16 i32 i64 u8 u16 u32 u64 float f32 f64 str char".split(" "),c=0,d=b.length;d>c;++c)a[b[c]]="atom";return a}(),Y=/[+\-*&%=<>!?|\.@]/,Z={state:null,stream:null,marked:null,cc:null};return h.lex=i.lex=j.lex=!0,{startState:function(){return{tokenize:b,cc:[],lexical:{indented:-U,column:0,type:"top",align:!1},keywords:W,indented:0}},token:function(a,b){if(a.sol()&&(b.lexical.hasOwnProperty("align")||(b.lexical.align=!1),b.indented=a.indentation()),a.eatSpace())return null;S=T=null;var c=b.tokenize(a,b);return"comment"==c?c:(b.lexical.hasOwnProperty("align")||(b.lexical.align=!0),"prefix"==S?c:(T||(T=a.current()),R(b,a,c)))},indent:function(a,c){if(a.tokenize!=b)return 0;var d=c&&c.charAt(0),e=a.lexical,f=e.type,g=d==f;return"stat"==f?e.indented+U:e.align?e.column+(g?0:1):e.indented+(g?0:"alt"==e.info?V:U)},electricChars:"{}",blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",fold:"brace"}}),a.defineMIME("text/x-rustsrc","rust")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/sass/sass.js b/media/editors/codemirror/mode/sass/sass.js index 52a6682915910..6973ece292b09 100644 --- a/media/editors/codemirror/mode/sass/sass.js +++ b/media/editors/codemirror/mode/sass/sass.js @@ -232,7 +232,7 @@ CodeMirror.defineMode("sass", function(config) { if (stream.eatWhile(/[\w-]/)){ if(stream.match(/ *: *[\w-\+\$#!\("']/,false)){ - return "propery"; + return "property"; } else if(stream.match(/ *:/,false)){ indent(state); diff --git a/media/editors/codemirror/mode/sass/sass.min.js b/media/editors/codemirror/mode/sass/sass.min.js new file mode 100644 index 0000000000000..5d7d218961a6a --- /dev/null +++ b/media/editors/codemirror/mode/sass/sass.min.js @@ -0,0 +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("sass",function(a){function b(a){return new RegExp("^"+a.join("|"))}function c(a,b){var c=a.peek();return")"===c?(a.next(),b.tokenizer=i,"operator"):"("===c?(a.next(),a.eatSpace(),"operator"):"'"===c||'"'===c?(b.tokenizer=e(a.next()),"string"):(b.tokenizer=e(")",!1),"string")}function d(a,b){return function(c,d){return c.sol()&&c.indentation()<=a?(d.tokenizer=i,i(c,d)):(b&&c.skipTo("*/")?(c.next(),c.next(),d.tokenizer=i):c.skipToEnd(),"comment")}}function e(a,b){function c(d,e){var g=d.next(),h=d.peek(),j=d.string.charAt(d.pos-2),k="\\"!==g&&h===a||g===a&&"\\"!==j;return k?(g!==a&&b&&d.next(),e.tokenizer=i,"string"):"#"===g&&"{"===h?(e.tokenizer=f(c),d.next(),"operator"):"string"}return null==b&&(b=!0),c}function f(a){return function(b,c){return"}"===b.peek()?(b.next(),c.tokenizer=a,"operator"):i(b,c)}}function g(b){if(0==b.indentCount){b.indentCount++;var c=b.scopes[0].offset,d=c+a.indentUnit;b.scopes.unshift({offset:d})}}function h(a){1!=a.scopes.length&&a.scopes.shift()}function i(a,b){var j=a.peek();if(a.match("/*"))return b.tokenizer=d(a.indentation(),!0),b.tokenizer(a,b);if(a.match("//"))return b.tokenizer=d(a.indentation(),!1),b.tokenizer(a,b);if(a.match("#{"))return b.tokenizer=f(i),"operator";if('"'===j||"'"===j)return a.next(),b.tokenizer=e(j),"string";if(b.cursorHalf){if("#"===j&&(a.next(),a.match(/[0-9a-fA-F]{6}|[0-9a-fA-F]{3}/)))return a.peek()||(b.cursorHalf=0),"number";if(a.match(/^-?[0-9\.]+/))return a.peek()||(b.cursorHalf=0),"number";if(a.match(/^(px|em|in)\b/))return a.peek()||(b.cursorHalf=0),"unit";if(a.match(l))return a.peek()||(b.cursorHalf=0),"keyword";if(a.match(/^url/)&&"("===a.peek())return b.tokenizer=c,a.peek()||(b.cursorHalf=0),"atom";if("$"===j)return a.next(),a.eatWhile(/[\w-]/),a.peek()||(b.cursorHalf=0),"variable-3";if("!"===j)return a.next(),a.peek()||(b.cursorHalf=0),a.match(/^[\w]+/)?"keyword":"operator";if(a.match(n))return a.peek()||(b.cursorHalf=0),"operator";if(a.eatWhile(/[\w-]/))return a.peek()||(b.cursorHalf=0),"attribute";if(!a.peek())return b.cursorHalf=0,null}else{if("."===j){if(a.next(),a.match(/^[\w-]+/))return g(b),"atom";if("#"===a.peek())return g(b),"atom"}if("#"===j){if(a.next(),a.match(/^[\w-]+/))return g(b),"atom";if("#"===a.peek())return g(b),"atom"}if("$"===j)return a.next(),a.eatWhile(/[\w-]/),"variable-2";if(a.match(/^-?[0-9\.]+/))return"number";if(a.match(/^(px|em|in)\b/))return"unit";if(a.match(l))return"keyword";if(a.match(/^url/)&&"("===a.peek())return b.tokenizer=c,"atom";if("="===j&&a.match(/^=[\w-]+/))return g(b),"meta";if("+"===j&&a.match(/^\+[\w-]+/))return"variable-3";if("@"===j&&a.match(/@extend/)&&(a.match(/\s*[\w]/)||h(b)),a.match(/^@(else if|if|media|else|for|each|while|mixin|function)/))return g(b),"meta";if("@"===j)return a.next(),a.eatWhile(/[\w-]/),"meta";if(a.eatWhile(/[\w-]/))return a.match(/ *: *[\w-\+\$#!\("']/,!1)?"property":a.match(/ *:/,!1)?(g(b),b.cursorHalf=1,"atom"):a.match(/ *,/,!1)?"atom":(g(b),"atom");if(":"===j)return a.match(o)?"keyword":(a.next(),b.cursorHalf=1,"operator")}return a.match(n)?"operator":(a.next(),null)}function j(b,c){b.sol()&&(c.indentCount=0);var d=c.tokenizer(b,c),e=b.current();if(("@return"===e||"}"===e)&&h(c),null!==d){for(var f=b.pos-e.length,g=f+a.indentUnit*c.indentCount,i=[],j=0;j","<","==",">=","<=","\\+","-","\\!=","/","\\*","%","and","or","not",";","\\{","\\}",":"],n=b(m),o=/^::?[a-zA-Z_][\w\-]*/;return{startState:function(){return{tokenizer:i,scopes:[{offset:0,type:"sass"}],indentCount:0,cursorHalf:0,definedVars:[],definedMixins:[]}},token:function(a,b){var c=j(a,b);return b.lastToken={style:c,content:a.current()},c},indent:function(a){return a.scopes[0].offset}}}),a.defineMIME("text/x-sass","sass")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/scheme/scheme.js b/media/editors/codemirror/mode/scheme/scheme.js index 979edc0963c43..22346459115d0 100644 --- a/media/editors/codemirror/mode/scheme/scheme.js +++ b/media/editors/codemirror/mode/scheme/scheme.js @@ -239,6 +239,7 @@ CodeMirror.defineMode("scheme", function () { return state.indentStack.indent; }, + closeBrackets: {pairs: "()[]{}\"\""}, lineComment: ";;" }; }); diff --git a/media/editors/codemirror/mode/scheme/scheme.min.js b/media/editors/codemirror/mode/scheme/scheme.min.js new file mode 100644 index 0000000000000..f65d002cbc21c --- /dev/null +++ b/media/editors/codemirror/mode/scheme/scheme.min.js @@ -0,0 +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("scheme",function(){function a(a){for(var b={},c=a.split(" "),d=0;dinteger char-alphabetic? char-ci<=? char-ci=? char-ci>? char-downcase char-lower-case? char-numeric? char-ready? char-upcase char-upper-case? char-whitespace? char<=? char=? char>? char? close-input-port close-output-port complex? cons cos current-input-port current-output-port denominator display eof-object? eq? equal? eqv? eval even? exact->inexact exact? exp expt #f floor force gcd imag-part inexact->exact inexact? input-port? integer->char integer? interaction-environment lcm length list list->string list->vector list-ref list-tail list? load log magnitude make-polar make-rectangular make-string make-vector max member memq memv min modulo negative? newline not null-environment null? number->string number? numerator odd? open-input-file open-output-file output-port? pair? peek-char port? positive? procedure? quasiquote quote quotient rational? rationalize read read-char real-part real? remainder reverse round scheme-report-environment set! set-car! set-cdr! sin sqrt string string->list string->number string->symbol string-append string-ci<=? string-ci=? string-ci>? string-copy string-fill! string-length string-ref string-set! string<=? string=? string>? string? substring symbol->string symbol? #t tan transcript-off transcript-on truncate values vector vector->list vector-fill! vector-length vector-ref vector-set! with-input-from-file with-output-to-file write write-char zero?"),q=a("define let letrec let* lambda"),r=new RegExp(/^(?:[-+]i|[-+][01]+#*(?:\/[01]+#*)?i|[-+]?[01]+#*(?:\/[01]+#*)?@[-+]?[01]+#*(?:\/[01]+#*)?|[-+]?[01]+#*(?:\/[01]+#*)?[-+](?:[01]+#*(?:\/[01]+#*)?)?i|[-+]?[01]+#*(?:\/[01]+#*)?)(?=[()\s;"]|$)/i),s=new RegExp(/^(?:[-+]i|[-+][0-7]+#*(?:\/[0-7]+#*)?i|[-+]?[0-7]+#*(?:\/[0-7]+#*)?@[-+]?[0-7]+#*(?:\/[0-7]+#*)?|[-+]?[0-7]+#*(?:\/[0-7]+#*)?[-+](?:[0-7]+#*(?:\/[0-7]+#*)?)?i|[-+]?[0-7]+#*(?:\/[0-7]+#*)?)(?=[()\s;"]|$)/i),t=new RegExp(/^(?:[-+]i|[-+][\da-f]+#*(?:\/[\da-f]+#*)?i|[-+]?[\da-f]+#*(?:\/[\da-f]+#*)?@[-+]?[\da-f]+#*(?:\/[\da-f]+#*)?|[-+]?[\da-f]+#*(?:\/[\da-f]+#*)?[-+](?:[\da-f]+#*(?:\/[\da-f]+#*)?)?i|[-+]?[\da-f]+#*(?:\/[\da-f]+#*)?)(?=[()\s;"]|$)/i),u=new RegExp(/^(?:[-+]i|[-+](?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)i|[-+]?(?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)@[-+]?(?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)|[-+]?(?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)[-+](?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)?i|(?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*))(?=[()\s;"]|$)/i);return{startState:function(){return{indentStack:null,indentation:0,mode:!1,sExprComment:!1}},token:function(a,b){if(null==b.indentStack&&a.sol()&&(b.indentation=a.indentation()),a.eatSpace())return null;var r=null;switch(b.mode){case"string":for(var s,t=!1;null!=(s=a.next());){if('"'==s&&!t){b.mode=!1;break}t=!t&&"\\"==s}r=k;break;case"comment":for(var s,u=!1;null!=(s=a.next());){if("#"==s&&u){b.mode=!1;break}u="|"==s}r=j;break;case"s-expr-comment":if(b.mode=!1,"("!=a.peek()&&"["!=a.peek()){a.eatWhile(/[^/s]/),r=j;break}b.sExprComment=0;default:var v=a.next();if('"'==v)b.mode="string",r=k;else if("'"==v)r=l;else if("#"==v)if(a.eat("|"))b.mode="comment",r=j;else if(a.eat(/[tf]/i))r=l;else if(a.eat(";"))b.mode="s-expr-comment",r=j;else{var w=null,x=!1,y=!0;a.eat(/[ei]/i)?x=!0:a.backUp(1),a.match(/^#b/i)?w=e:a.match(/^#o/i)?w=f:a.match(/^#x/i)?w=h:a.match(/^#d/i)?w=g:a.match(/^[-+0-9.]/,!1)?(y=!1,w=g):x||a.eat("#"),null!=w&&(y&&!x&&a.match(/^#[ei]/i),w(a)&&(r=m))}else if(/^[-+0-9.]/.test(v)&&g(a,!0))r=m;else if(";"==v)a.skipToEnd(),r=j;else if("("==v||"["==v){for(var z,A="",B=a.column();null!=(z=a.eat(/[^\s\(\[\;\)\]]/));)A+=z;A.length>0&&q.propertyIsEnumerable(A)?c(b,B+o,v):(a.eatSpace(),a.eol()||";"==a.peek()?c(b,B+1,v):c(b,B+a.current().length,v)),a.backUp(a.current().length-1),"number"==typeof b.sExprComment&&b.sExprComment++,r=n}else")"==v||"]"==v?(r=n,null!=b.indentStack&&b.indentStack.type==(")"==v?"(":"[")&&(d(b),"number"==typeof b.sExprComment&&0==--b.sExprComment&&(r=j,b.sExprComment=!1))):(a.eatWhile(/[\w\$_\-!$%&*+\.\/:<=>?@\^~]/),r=p&&p.propertyIsEnumerable(a.current())?i:"variable")}return"number"==typeof b.sExprComment?j:r},indent:function(a){return null==a.indentStack?a.indentation:a.indentStack.indent},closeBrackets:{pairs:'()[]{}""'},lineComment:";;"}}),a.defineMIME("text/x-scheme","scheme")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/shell/shell.min.js b/media/editors/codemirror/mode/shell/shell.min.js new file mode 100644 index 0000000000000..b9904fa632783 --- /dev/null +++ b/media/editors/codemirror/mode/shell/shell.min.js @@ -0,0 +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("shell",function(){function a(a,b){for(var c=b.split(" "),d=0;d1&&a.eat("$");var e=a.next(),f=/\w/;return"{"===e&&(f=/[^}]/),"("===e?(b.tokens[0]=c(")"),d(a,b)):(/\d/.test(e)||(a.eatWhile(f),a.eat("}")),b.tokens.shift(),"def")};return{startState:function(){return{tokens:[]}},token:function(a,b){return d(a,b)},lineComment:"#",fold:"brace"}}),a.defineMIME("text/x-sh","shell")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/shell/test.js b/media/editors/codemirror/mode/shell/test.js deleted file mode 100644 index a413b5a406b98..0000000000000 --- a/media/editors/codemirror/mode/shell/test.js +++ /dev/null @@ -1,58 +0,0 @@ -// CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: http://codemirror.net/LICENSE - -(function() { - var mode = CodeMirror.getMode({}, "shell"); - function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); } - - MT("var", - "text [def $var] text"); - MT("varBraces", - "text[def ${var}]text"); - MT("varVar", - "text [def $a$b] text"); - MT("varBracesVarBraces", - "text[def ${a}${b}]text"); - - MT("singleQuotedVar", - "[string 'text $var text']"); - MT("singleQuotedVarBraces", - "[string 'text ${var} text']"); - - MT("doubleQuotedVar", - '[string "text ][def $var][string text"]'); - MT("doubleQuotedVarBraces", - '[string "text][def ${var}][string text"]'); - MT("doubleQuotedVarPunct", - '[string "text ][def $@][string text"]'); - MT("doubleQuotedVarVar", - '[string "][def $a$b][string "]'); - MT("doubleQuotedVarBracesVarBraces", - '[string "][def ${a}${b}][string "]'); - - MT("notAString", - "text\\'text"); - MT("escapes", - "outside\\'\\\"\\`\\\\[string \"inside\\`\\'\\\"\\\\`\\$notAVar\"]outside\\$\\(notASubShell\\)"); - - MT("subshell", - "[builtin echo] [quote $(whoami)] s log, stardate [quote `date`]."); - MT("doubleQuotedSubshell", - "[builtin echo] [string \"][quote $(whoami)][string 's log, stardate `date`.\"]"); - - MT("hashbang", - "[meta #!/bin/bash]"); - MT("comment", - "text [comment # Blurb]"); - - MT("numbers", - "[number 0] [number 1] [number 2]"); - MT("keywords", - "[keyword while] [atom true]; [keyword do]", - " [builtin sleep] [number 3]", - "[keyword done]"); - MT("options", - "[builtin ls] [attribute -l] [attribute --human-readable]"); - MT("operator", - "[def var][operator =]value"); -})(); diff --git a/media/editors/codemirror/mode/sieve/sieve.min.js b/media/editors/codemirror/mode/sieve/sieve.min.js new file mode 100644 index 0000000000000..94db61c141465 --- /dev/null +++ b/media/editors/codemirror/mode/sieve/sieve.min.js @@ -0,0 +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("sieve",function(a){function b(a){for(var b={},c=a.split(" "),d=0;dc&&(c=0),c*i},electricChars:"}"}}),a.defineMIME("application/sieve","sieve")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/slim/slim.min.js b/media/editors/codemirror/mode/slim/slim.min.js new file mode 100644 index 0000000000000..e1f94afe30053 --- /dev/null +++ b/media/editors/codemirror/mode/slim/slim.min.js @@ -0,0 +1 @@ +!function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("../htmlmixed/htmlmixed"),require("../ruby/ruby")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../htmlmixed/htmlmixed","../ruby/ruby"],a):a(CodeMirror)}(function(a){"use strict";a.defineMode("slim",function(b){function c(a,b,c){var d=function(d,e){return e.tokenize=b,d.pos-1&&(b.tokenize=c(a.pos,b.tokenize,f),a.backUp(g.length-h-e)),f}function e(a,b){a.stack={parent:a.stack,style:"continuation",indented:b,tokenize:a.line},a.line=a.tokenize}function f(a){a.line==a.tokenize&&(a.line=a.stack.tokenize,a.stack=a.stack.parent)}function g(a,b){return function(c,d){if(f(d),c.match(/^\\$/))return e(d,a),"lineContinuation";var g=b(c,d);return c.eol()&&c.current().match(/(?:^|[^\\])(?:\\\\)*\\$/)&&c.backUp(1),g}}function h(a,b){return function(c,d){f(d);var g=b(c,d);return c.eol()&&c.current().match(/,$/)&&e(d,a),g}}function i(a,b){return function(c,d){var e=c.peek();return e==a&&1==d.rubyState.tokenize.length?(c.next(),d.tokenize=b,"closeAttributeTag"):k(c,d)}}function j(a){var b,c=function(c,d){if(1==d.rubyState.tokenize.length&&!d.rubyState.context.prev){if(c.backUp(1),c.eatSpace())return d.rubyState=b,d.tokenize=a,a(c,d);c.next()}return k(c,d)};return function(a,d){return b=d.rubyState,d.rubyState=N.startState(),d.tokenize=c,k(a,d)}}function k(a,b){return N.token(a,b.rubyState)}function l(a,b){return a.match(/^\\$/)?"lineContinuation":m(a,b)}function m(a,b){return a.match(/^#\{/)?(b.tokenize=i("}",b.tokenize),null):d(a,b,/[^\\]#\{/,1,M.token(a,b.htmlState))}function n(a){return function(b,c){var d=l(b,c);return b.eol()&&(c.tokenize=a),d}}function o(a,b,c){return b.stack={parent:b.stack,style:"html",indented:a.column()+c,tokenize:b.line},b.line=b.tokenize=m,null}function p(a,b){return a.skipToEnd(),b.stack.style}function q(a,b){return b.stack={parent:b.stack,style:"comment",indented:b.indented+1,tokenize:b.line},b.line=p,p(a,b)}function r(a,b){return a.eat(b.stack.endQuote)?(b.line=b.stack.line,b.tokenize=b.stack.tokenize,b.stack=b.stack.parent,null):a.match(X)?(b.tokenize=s,"slimAttribute"):(a.next(),null)}function s(a,b){return a.match(/^==?/)?(b.tokenize=t,null):r(a,b)}function t(a,b){var c=a.peek();return'"'==c||"'"==c?(b.tokenize=K(c,"string",!0,!1,r),a.next(),b.tokenize(a,b)):"["==c?j(r)(a,b):a.match(/^(true|false|nil)\b/)?(b.tokenize=r,"keyword"):j(r)(a,b)}function u(a,b,c){return a.stack={parent:a.stack,style:"wrapper",indented:a.indented+1,tokenize:c,line:a.line,endQuote:b},a.line=a.tokenize=r,null}function v(b,c){if(b.match(/^#\{/))return c.tokenize=i("}",c.tokenize),null;var d=new a.StringStream(b.string.slice(c.stack.indented),b.tabSize);d.pos=b.pos-c.stack.indented,d.start=b.start-c.stack.indented,d.lastColumnPos=b.lastColumnPos-c.stack.indented,d.lastColumnValue=b.lastColumnValue-c.stack.indented;var e=c.subMode.token(d,c.subState);return b.pos=d.pos+c.stack.indented,e}function w(a,b){return b.stack.indented=a.column(),b.line=b.tokenize=v,b.tokenize(a,b)}function x(c){var d=P[c],e=a.mimeModes[d];if(e)return a.getMode(b,e);var f=a.modes[d];return f?f(b,{name:d}):a.getMode(b,"null")}function y(a){return O.hasOwnProperty(a)?O[a]:O[a]=x(a)}function z(a,b){var c=y(a),d=c.startState&&c.startState();return b.subMode=c,b.subState=d,b.stack={parent:b.stack,style:"sub",indented:b.indented+1,tokenize:b.line},b.line=b.tokenize=w,"slimSubmode"}function A(a,b){return a.skipToEnd(),"slimDoctype"}function B(a,b){var c=a.peek();if("<"==c)return(b.tokenize=n(b.tokenize))(a,b);if(a.match(/^[|']/))return o(a,b,1);if(a.match(/^\/(!|\[\w+])?/))return q(a,b);if(a.match(/^(-|==?[<>]?)/))return b.tokenize=g(a.column(),h(a.column(),k)),"slimSwitch";if(a.match(/^doctype\b/))return b.tokenize=A,"keyword";var d=a.match(Q);return d?z(d[1],b):D(a,b)}function C(a,b){return b.startOfLine?B(a,b):D(a,b)}function D(a,b){return a.eat("*")?(b.tokenize=j(E),null):a.match(V)?(b.tokenize=E,"slimTag"):F(a,b)}function E(a,b){return a.match(/^(<>?|>b.indented&&"slimSubmode"!=b.last;)b.line=b.tokenize=b.stack.tokenize,b.stack=b.stack.parent,b.subMode=null,b.subState=null;if(a.eatSpace())return null;var c=b.tokenize(a,b);return b.startOfLine=!1,c&&(b.last=c),R.hasOwnProperty(c)?R[c]:c},blankLine:function(a){return a.subMode&&a.subMode.blankLine?a.subMode.blankLine(a.subState):void 0},innerMode:function(a){return a.subMode?{state:a.subState,mode:a.subMode}:{state:a,mode:$}}};return $},"htmlmixed","ruby"),a.defineMIME("text/x-slim","slim"),a.defineMIME("application/x-slim","slim")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/slim/test.js b/media/editors/codemirror/mode/slim/test.js deleted file mode 100644 index be4ddacb62029..0000000000000 --- a/media/editors/codemirror/mode/slim/test.js +++ /dev/null @@ -1,96 +0,0 @@ -// CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: http://codemirror.net/LICENSE - -// Slim Highlighting for CodeMirror copyright (c) HicknHack Software Gmbh - -(function() { - var mode = CodeMirror.getMode({tabSize: 4, indentUnit: 2}, "slim"); - function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); } - - // Requires at least one media query - MT("elementName", - "[tag h1] Hey There"); - - MT("oneElementPerLine", - "[tag h1] Hey There .h2"); - - MT("idShortcut", - "[attribute&def #test] Hey There"); - - MT("tagWithIdShortcuts", - "[tag h1][attribute&def #test] Hey There"); - - MT("classShortcut", - "[attribute&qualifier .hello] Hey There"); - - MT("tagWithIdAndClassShortcuts", - "[tag h1][attribute&def #test][attribute&qualifier .hello] Hey There"); - - MT("docType", - "[keyword doctype] xml"); - - MT("comment", - "[comment / Hello WORLD]"); - - MT("notComment", - "[tag h1] This is not a / comment "); - - MT("attributes", - "[tag a]([attribute title]=[string \"test\"]) [attribute href]=[string \"link\"]}"); - - MT("multiLineAttributes", - "[tag a]([attribute title]=[string \"test\"]", - " ) [attribute href]=[string \"link\"]}"); - - MT("htmlCode", - "[tag&bracket <][tag h1][tag&bracket >]Title[tag&bracket ]"); - - MT("rubyBlock", - "[operator&special =][variable-2 @item]"); - - MT("selectorRubyBlock", - "[tag a][attribute&qualifier .test][operator&special =] [variable-2 @item]"); - - MT("nestedRubyBlock", - "[tag a]", - " [operator&special =][variable puts] [string \"test\"]"); - - MT("multilinePlaintext", - "[tag p]", - " | Hello,", - " World"); - - MT("multilineRuby", - "[tag p]", - " [comment /# this is a comment]", - " [comment and this is a comment too]", - " | Date/Time", - " [operator&special -] [variable now] [operator =] [tag DateTime][operator .][property now]", - " [tag strong][operator&special =] [variable now]", - " [operator&special -] [keyword if] [variable now] [operator >] [tag DateTime][operator .][property parse]([string \"December 31, 2006\"])", - " [operator&special =][string \"Happy\"]", - " [operator&special =][string \"Belated\"]", - " [operator&special =][string \"Birthday\"]"); - - MT("multilineComment", - "[comment /]", - " [comment Multiline]", - " [comment Comment]"); - - MT("hamlAfterRubyTag", - "[attribute&qualifier .block]", - " [tag strong][operator&special =] [variable now]", - " [attribute&qualifier .test]", - " [operator&special =][variable now]", - " [attribute&qualifier .right]"); - - MT("stretchedRuby", - "[operator&special =] [variable puts] [string \"Hello\"],", - " [string \"World\"]"); - - MT("interpolationInHashAttribute", - "[tag div]{[attribute id] = [string \"]#{[variable test]}[string _]#{[variable ting]}[string \"]} test"); - - MT("interpolationInHTMLAttribute", - "[tag div]([attribute title]=[string \"]#{[variable test]}[string _]#{[variable ting]()}[string \"]) Test"); -})(); diff --git a/media/editors/codemirror/mode/smalltalk/smalltalk.min.js b/media/editors/codemirror/mode/smalltalk/smalltalk.min.js new file mode 100644 index 0000000000000..e11cbcd9a4566 --- /dev/null +++ b/media/editors/codemirror/mode/smalltalk/smalltalk.min.js @@ -0,0 +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("smalltalk",function(a){var b=/[+\-\/\\*~<>=@%|&?!.,:;^]/,c=/true|false|nil|self|super|thisContext/,d=function(a,b){this.next=a,this.parent=b},e=function(a,b,c){this.name=a,this.context=b,this.eos=c},f=function(){this.context=new d(g,null),this.expectVariable=!0,this.indentation=0,this.userIndentationDelta=0};f.prototype.userIndent=function(b){this.userIndentationDelta=b>0?b/a.indentUnit-this.indentation:0};var g=function(a,f,g){var l=new e(null,f,!1),m=a.next();return'"'===m?l=h(a,new d(h,f)):"'"===m?l=i(a,new d(i,f)):"#"===m?"'"===a.peek()?(a.next(),l=j(a,new d(j,f))):a.eatWhile(/[^\s.{}\[\]()]/)?l.name="string-2":l.name="meta":"$"===m?("<"===a.next()&&(a.eatWhile(/[^\s>]/),a.next()),l.name="string-2"):"|"===m&&g.expectVariable?l.context=new d(k,f):/[\[\]{}()]/.test(m)?(l.name="bracket",l.eos=/[\[{(]/.test(m),"["===m?g.indentation++:"]"===m&&(g.indentation=Math.max(0,g.indentation-1))):b.test(m)?(a.eatWhile(b),l.name="operator",l.eos=";"!==m):/\d/.test(m)?(a.eatWhile(/[\w\d]/),l.name="number"):/[\w_]/.test(m)?(a.eatWhile(/[\w\d_]/),l.name=g.expectVariable?c.test(a.current())?"keyword":"variable":null):l.eos=g.expectVariable,l},h=function(a,b){return a.eatWhile(/[^"]/),new e("comment",a.eat('"')?b.parent:b,!0)},i=function(a,b){return a.eatWhile(/[^']/),new e("string",a.eat("'")?b.parent:b,!1)},j=function(a,b){return a.eatWhile(/[^']/),new e("string-2",a.eat("'")?b.parent:b,!1)},k=function(a,b){var c=new e(null,b,!1),d=a.next();return"|"===d?(c.context=b.parent,c.eos=!0):(a.eatWhile(/[^|]/),c.name="variable"),c};return{startState:function(){return new f},token:function(a,b){if(b.userIndent(a.indentation()),a.eatSpace())return null;var c=b.context.next(a,b.context,b);return b.context=c.context,b.expectVariable=c.eos,c.name},blankLine:function(a){a.userIndent(0)},indent:function(b,c){var d=b.context.next===g&&c&&"]"===c.charAt(0)?-1:b.userIndentationDelta;return(b.indentation+d)*a.indentUnit},electricChars:"]"}}),a.defineMIME("text/x-stsrc",{name:"smalltalk"})}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/smarty/smarty.js b/media/editors/codemirror/mode/smarty/smarty.js index bb053245d3581..6e0fbed422ef9 100644 --- a/media/editors/codemirror/mode/smarty/smarty.js +++ b/media/editors/codemirror/mode/smarty/smarty.js @@ -13,134 +13,123 @@ else // Plain browser env mod(CodeMirror); })(function(CodeMirror) { -"use strict"; - -CodeMirror.defineMode("smarty", function(config) { "use strict"; - // our default settings; check to see if they're overridden - var settings = { - rightDelimiter: '}', - leftDelimiter: '{', - smartyVersion: 2 // for backward compatibility - }; - if (config.hasOwnProperty("leftDelimiter")) { - settings.leftDelimiter = config.leftDelimiter; - } - if (config.hasOwnProperty("rightDelimiter")) { - settings.rightDelimiter = config.rightDelimiter; - } - if (config.hasOwnProperty("smartyVersion") && config.smartyVersion === 3) { - settings.smartyVersion = 3; - } - - var keyFunctions = ["debug", "extends", "function", "include", "literal"]; - var last; - var regs = { - operatorChars: /[+\-*&%=<>!?]/, - validIdentifier: /[a-zA-Z0-9_]/, - stringChar: /['"]/ - }; - - var helpers = { - cont: function(style, lastType) { + CodeMirror.defineMode("smarty", function(config, parserConf) { + var rightDelimiter = parserConf.rightDelimiter || "}"; + var leftDelimiter = parserConf.leftDelimiter || "{"; + var version = parserConf.version || 2; + var baseMode = CodeMirror.getMode(config, parserConf.baseMode || "null"); + + var keyFunctions = ["debug", "extends", "function", "include", "literal"]; + var regs = { + operatorChars: /[+\-*&%=<>!?]/, + validIdentifier: /[a-zA-Z0-9_]/, + stringChar: /['"]/ + }; + + var last; + function cont(style, lastType) { last = lastType; return style; - }, - chain: function(stream, state, parser) { + } + + function chain(stream, state, parser) { state.tokenize = parser; return parser(stream, state); } - }; + // Smarty 3 allows { and } surrounded by whitespace to NOT slip into Smarty mode + function doesNotCount(stream, pos) { + if (pos == null) pos = stream.pos; + return version === 3 && leftDelimiter == "{" && + (pos == stream.string.length || /\s/.test(stream.string.charAt(pos))); + } - // our various parsers - var parsers = { - - // the main tokenizer - tokenizer: function(stream, state) { - if (stream.match(settings.leftDelimiter, true)) { + function tokenTop(stream, state) { + var string = stream.string; + for (var scan = stream.pos;;) { + var nextMatch = string.indexOf(leftDelimiter, scan); + scan = nextMatch + leftDelimiter.length; + if (nextMatch == -1 || !doesNotCount(stream, nextMatch + leftDelimiter.length)) break; + } + if (nextMatch == stream.pos) { + stream.match(leftDelimiter); if (stream.eat("*")) { - return helpers.chain(stream, state, parsers.inBlock("comment", "*" + settings.rightDelimiter)); + return chain(stream, state, tokenBlock("comment", "*" + rightDelimiter)); } else { - // Smarty 3 allows { and } surrounded by whitespace to NOT slip into Smarty mode state.depth++; - var isEol = stream.eol(); - var isFollowedByWhitespace = /\s/.test(stream.peek()); - if (settings.smartyVersion === 3 && settings.leftDelimiter === "{" && (isEol || isFollowedByWhitespace)) { - state.depth--; - return null; - } else { - state.tokenize = parsers.smarty; - last = "startTag"; - return "tag"; - } + state.tokenize = tokenSmarty; + last = "startTag"; + return "tag"; } - } else { - stream.next(); - return null; } - }, + + if (nextMatch > -1) stream.string = string.slice(0, nextMatch); + var token = baseMode.token(stream, state.base); + if (nextMatch > -1) stream.string = string; + return token; + } // parsing Smarty content - smarty: function(stream, state) { - if (stream.match(settings.rightDelimiter, true)) { - if (settings.smartyVersion === 3) { + function tokenSmarty(stream, state) { + if (stream.match(rightDelimiter, true)) { + if (version === 3) { state.depth--; if (state.depth <= 0) { - state.tokenize = parsers.tokenizer; + state.tokenize = tokenTop; } } else { - state.tokenize = parsers.tokenizer; + state.tokenize = tokenTop; } - return helpers.cont("tag", null); + return cont("tag", null); } - if (stream.match(settings.leftDelimiter, true)) { + if (stream.match(leftDelimiter, true)) { state.depth++; - return helpers.cont("tag", "startTag"); + return cont("tag", "startTag"); } var ch = stream.next(); if (ch == "$") { stream.eatWhile(regs.validIdentifier); - return helpers.cont("variable-2", "variable"); + return cont("variable-2", "variable"); } else if (ch == "|") { - return helpers.cont("operator", "pipe"); + return cont("operator", "pipe"); } else if (ch == ".") { - return helpers.cont("operator", "property"); + return cont("operator", "property"); } else if (regs.stringChar.test(ch)) { - state.tokenize = parsers.inAttribute(ch); - return helpers.cont("string", "string"); + state.tokenize = tokenAttribute(ch); + return cont("string", "string"); } else if (regs.operatorChars.test(ch)) { stream.eatWhile(regs.operatorChars); - return helpers.cont("operator", "operator"); + return cont("operator", "operator"); } else if (ch == "[" || ch == "]") { - return helpers.cont("bracket", "bracket"); + return cont("bracket", "bracket"); } else if (ch == "(" || ch == ")") { - return helpers.cont("bracket", "operator"); + return cont("bracket", "operator"); } else if (/\d/.test(ch)) { stream.eatWhile(/\d/); - return helpers.cont("number", "number"); + return cont("number", "number"); } else { if (state.last == "variable") { if (ch == "@") { stream.eatWhile(regs.validIdentifier); - return helpers.cont("property", "property"); + return cont("property", "property"); } else if (ch == "|") { stream.eatWhile(regs.validIdentifier); - return helpers.cont("qualifier", "modifier"); + return cont("qualifier", "modifier"); } } else if (state.last == "pipe") { stream.eatWhile(regs.validIdentifier); - return helpers.cont("qualifier", "modifier"); + return cont("qualifier", "modifier"); } else if (state.last == "whitespace") { stream.eatWhile(regs.validIdentifier); - return helpers.cont("attribute", "modifier"); + return cont("attribute", "modifier"); } if (state.last == "property") { stream.eatWhile(regs.validIdentifier); - return helpers.cont("property", null); + return cont("property", null); } else if (/\s/.test(ch)) { last = "whitespace"; return null; @@ -156,37 +145,37 @@ CodeMirror.defineMode("smarty", function(config) { } for (var i=0, j=keyFunctions.length; i-1&&(a.string=c.slice(0,g));var i=o.token(a,b.base);return g>-1&&(a.string=c),i}function h(a,b){if(a.match(l,!0))return 3===n?(b.depth--,b.depth<=0&&(b.tokenize=g)):b.tokenize=g,d("tag",null);if(a.match(m,!0))return b.depth++,d("tag","startTag");var c=a.next();if("$"==c)return a.eatWhile(q.validIdentifier),d("variable-2","variable");if("|"==c)return d("operator","pipe");if("."==c)return d("operator","property");if(q.stringChar.test(c))return b.tokenize=i(c),d("string","string");if(q.operatorChars.test(c))return a.eatWhile(q.operatorChars),d("operator","operator");if("["==c||"]"==c)return d("bracket","bracket");if("("==c||")"==c)return d("bracket","operator");if(/\d/.test(c))return a.eatWhile(/\d/),d("number","number");if("variable"==b.last){if("@"==c)return a.eatWhile(q.validIdentifier),d("property","property");if("|"==c)return a.eatWhile(q.validIdentifier),d("qualifier","modifier")}else{if("pipe"==b.last)return a.eatWhile(q.validIdentifier),d("qualifier","modifier");if("whitespace"==b.last)return a.eatWhile(q.validIdentifier),d("attribute","modifier")}if("property"==b.last)return a.eatWhile(q.validIdentifier),d("property",null);if(/\s/.test(c))return k="whitespace",null;var e="";"/"!=c&&(e+=c);for(var f=null;f=a.eat(q.validIdentifier);)e+=f;for(var h=0,j=p.length;j>h;h++)if(p[h]==e)return d("keyword","keyword");return/\s/.test(c)?null:d("tag","tag")}function i(a){return function(b,c){for(var d=null,e=null;!b.eol();){if(e=b.peek(),b.next()==a&&"\\"!==d){c.tokenize=h;break}d=e}return"string"}}function j(a,b){return function(c,d){for(;!c.eol();){if(c.match(b)){d.tokenize=g;break}c.next()}return a}}var k,l=c.rightDelimiter||"}",m=c.leftDelimiter||"{",n=c.version||2,o=a.getMode(b,c.baseMode||"null"),p=["debug","extends","function","include","literal"],q={operatorChars:/[+\-*&%=<>!?]/,validIdentifier:/[a-zA-Z0-9_]/,stringChar:/['"]/};return{startState:function(){return{base:a.startState(o),tokenize:g,last:null,depth:0}},copyState:function(b){return{base:a.copyState(o,b.base),tokenize:b.tokenize,last:b.last,depth:b.depth}},innerMode:function(a){return a.tokenize==g?{mode:o,state:a.base}:void 0},token:function(a,b){var c=b.tokenize(a,b);return b.last=k,c},indent:function(b,c){return b.tokenize==g&&o.indent?o.indent(b.base,c):a.Pass},blockCommentStart:m+"*",blockCommentEnd:"*"+l}}),a.defineMIME("text/x-smarty","smarty")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/smartymixed/smartymixed.js b/media/editors/codemirror/mode/smartymixed/smartymixed.js deleted file mode 100644 index 4fc7ca4b606ec..0000000000000 --- a/media/editors/codemirror/mode/smartymixed/smartymixed.js +++ /dev/null @@ -1,197 +0,0 @@ -// CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: http://codemirror.net/LICENSE - -/** -* @file smartymixed.js -* @brief Smarty Mixed Codemirror mode (Smarty + Mixed HTML) -* @author Ruslan Osmanov -* @version 3.0 -* @date 05.07.2013 -*/ - -// Warning: Don't base other modes on this one. This here is a -// terrible way to write a mixed mode. - -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed"), require("../smarty/smarty")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror", "../htmlmixed/htmlmixed", "../smarty/smarty"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; - -CodeMirror.defineMode("smartymixed", function(config) { - var htmlMixedMode = CodeMirror.getMode(config, "htmlmixed"); - var smartyMode = CodeMirror.getMode(config, "smarty"); - - var settings = { - rightDelimiter: '}', - leftDelimiter: '{' - }; - - if (config.hasOwnProperty("leftDelimiter")) { - settings.leftDelimiter = config.leftDelimiter; - } - if (config.hasOwnProperty("rightDelimiter")) { - settings.rightDelimiter = config.rightDelimiter; - } - - function reEsc(str) { return str.replace(/[^\s\w]/g, "\\$&"); } - - var reLeft = reEsc(settings.leftDelimiter), reRight = reEsc(settings.rightDelimiter); - var regs = { - smartyComment: new RegExp("^" + reRight + "\\*"), - literalOpen: new RegExp(reLeft + "literal" + reRight), - literalClose: new RegExp(reLeft + "\/literal" + reRight), - hasLeftDelimeter: new RegExp(".*" + reLeft), - htmlHasLeftDelimeter: new RegExp("[^<>]*" + reLeft) - }; - - var helpers = { - chain: function(stream, state, parser) { - state.tokenize = parser; - return parser(stream, state); - }, - - cleanChain: function(stream, state, parser) { - state.tokenize = null; - state.localState = null; - state.localMode = null; - return (typeof parser == "string") ? (parser ? parser : null) : parser(stream, state); - }, - - maybeBackup: function(stream, pat, style) { - var cur = stream.current(); - var close = cur.search(pat), - m; - if (close > - 1) stream.backUp(cur.length - close); - else if (m = cur.match(/<\/?$/)) { - stream.backUp(cur.length); - if (!stream.match(pat, false)) stream.match(cur[0]); - } - return style; - } - }; - - var parsers = { - html: function(stream, state) { - var htmlTagName = state.htmlMixedState.htmlState.context && state.htmlMixedState.htmlState.context.tagName - ? state.htmlMixedState.htmlState.context.tagName - : null; - - if (!state.inLiteral && stream.match(regs.htmlHasLeftDelimeter, false) && htmlTagName === null) { - state.tokenize = parsers.smarty; - state.localMode = smartyMode; - state.localState = smartyMode.startState(htmlMixedMode.indent(state.htmlMixedState, "")); - return helpers.maybeBackup(stream, settings.leftDelimiter, smartyMode.token(stream, state.localState)); - } else if (!state.inLiteral && stream.match(settings.leftDelimiter, false)) { - state.tokenize = parsers.smarty; - state.localMode = smartyMode; - state.localState = smartyMode.startState(htmlMixedMode.indent(state.htmlMixedState, "")); - return helpers.maybeBackup(stream, settings.leftDelimiter, smartyMode.token(stream, state.localState)); - } - return htmlMixedMode.token(stream, state.htmlMixedState); - }, - - smarty: function(stream, state) { - if (stream.match(settings.leftDelimiter, false)) { - if (stream.match(regs.smartyComment, false)) { - return helpers.chain(stream, state, parsers.inBlock("comment", "*" + settings.rightDelimiter)); - } - } else if (stream.match(settings.rightDelimiter, false)) { - stream.eat(settings.rightDelimiter); - state.tokenize = parsers.html; - state.localMode = htmlMixedMode; - state.localState = state.htmlMixedState; - return "tag"; - } - - return helpers.maybeBackup(stream, settings.rightDelimiter, smartyMode.token(stream, state.localState)); - }, - - inBlock: function(style, terminator) { - return function(stream, state) { - while (!stream.eol()) { - if (stream.match(terminator)) { - helpers.cleanChain(stream, state, ""); - break; - } - stream.next(); - } - return style; - }; - } - }; - - return { - startState: function() { - var state = htmlMixedMode.startState(); - return { - token: parsers.html, - localMode: null, - localState: null, - htmlMixedState: state, - tokenize: null, - inLiteral: false - }; - }, - - copyState: function(state) { - var local = null, tok = (state.tokenize || state.token); - if (state.localState) { - local = CodeMirror.copyState((tok != parsers.html ? smartyMode : htmlMixedMode), state.localState); - } - return { - token: state.token, - tokenize: state.tokenize, - localMode: state.localMode, - localState: local, - htmlMixedState: CodeMirror.copyState(htmlMixedMode, state.htmlMixedState), - inLiteral: state.inLiteral - }; - }, - - token: function(stream, state) { - if (stream.match(settings.leftDelimiter, false)) { - if (!state.inLiteral && stream.match(regs.literalOpen, true)) { - state.inLiteral = true; - return "keyword"; - } else if (state.inLiteral && stream.match(regs.literalClose, true)) { - state.inLiteral = false; - return "keyword"; - } - } - if (state.inLiteral && state.localState != state.htmlMixedState) { - state.tokenize = parsers.html; - state.localMode = htmlMixedMode; - state.localState = state.htmlMixedState; - } - - var style = (state.tokenize || state.token)(stream, state); - return style; - }, - - indent: function(state, textAfter) { - if (state.localMode == smartyMode - || (state.inLiteral && !state.localMode) - || regs.hasLeftDelimeter.test(textAfter)) { - return CodeMirror.Pass; - } - return htmlMixedMode.indent(state.htmlMixedState, textAfter); - }, - - innerMode: function(state) { - return { - state: state.localState || state.htmlMixedState, - mode: state.localMode || htmlMixedMode - }; - } - }; -}, "htmlmixed", "smarty"); - -CodeMirror.defineMIME("text/x-smarty", "smartymixed"); -// vim: et ts=2 sts=2 sw=2 - -}); diff --git a/media/editors/codemirror/mode/solr/solr.min.js b/media/editors/codemirror/mode/solr/solr.min.js new file mode 100644 index 0000000000000..89277823a5146 --- /dev/null +++ b/media/editors/codemirror/mode/solr/solr.min.js @@ -0,0 +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("solr",function(){function a(a){return parseFloat(a,10).toString()===a}function b(a){return function(b,c){for(var d,f=!1;null!=(d=b.next())&&(d!=a||f);)f=!f&&"\\"==d;return f||(c.tokenize=e),"string"}}function c(a){return function(b,c){var d="operator";return"+"==a?d+=" positive":"-"==a?d+=" negative":"|"==a?b.eat(/\|/):"&"==a?b.eat(/\&/):"^"==a&&(d+=" boost"),c.tokenize=e,d}}function d(b){return function(c,d){for(var g=b;(b=c.peek())&&null!=b.match(f);)g+=c.next();return d.tokenize=e,h.test(g)?"operator":a(g)?"number":":"==c.peek()?"field":"string"}}function e(a,h){var i=a.next();return'"'==i?h.tokenize=b(i):g.test(i)?h.tokenize=c(i):f.test(i)&&(h.tokenize=d(i)),h.tokenize!=e?h.tokenize(a,h):null}var f=/[^\s\|\!\+\-\*\?\~\^\&\:\(\)\[\]\{\}\^\"\\]/,g=/[\|\!\+\-\*\?\~\^\&]/,h=/^(OR|AND|NOT|TO)$/i;return{startState:function(){return{tokenize:e}},token:function(a,b){return a.eatSpace()?null:b.tokenize(a,b)}}}),a.defineMIME("text/x-solr","solr")}); \ 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 7e81e8dd56b7b..79bfc24dfd6cd 100644 --- a/media/editors/codemirror/mode/soy/soy.js +++ b/media/editors/codemirror/mode/soy/soy.js @@ -96,7 +96,7 @@ else state.indent -= (stream.current() == "/}" || indentingTags.indexOf(state.tag) == -1 ? 2 : 1) * config.indentUnit; state.soyState.pop(); return "keyword"; - } else if (stream.match(/^(\w+)(?==)/)) { + } else if (stream.match(/^([\w?]+)(?==)/)) { if (stream.current() == "kind" && (match = stream.match(/^="([^"]+)/, false))) { var kind = match[1]; state.kind.push(kind); @@ -134,7 +134,7 @@ return "comment"; } else if (stream.match(stream.sol() ? /^\s*\/\/.*/ : /^\s+\/\/.*/)) { return "comment"; - } else if (stream.match(/^\{\$\w*/)) { + } else if (stream.match(/^\{\$[\w?]*/)) { state.indent += 2 * config.indentUnit; state.soyState.push("variable"); return "variable-2"; @@ -142,7 +142,7 @@ state.indent += config.indentUnit; state.soyState.push("literal"); return "keyword"; - } else if (match = stream.match(/^\{([\/@\\]?\w*)/)) { + } else if (match = stream.match(/^\{([\/@\\]?[\w?]*)/)) { if (match[1] != "/switch") state.indent += (/^(\/|(else|elseif|case|default)$)/.test(match[1]) && state.tag != "switch" ? 1 : 2) * config.indentUnit; state.tag = match[1]; diff --git a/media/editors/codemirror/mode/soy/soy.min.js b/media/editors/codemirror/mode/soy/soy.min.js new file mode 100644 index 0000000000000..f176f2968b79a --- /dev/null +++ b/media/editors/codemirror/mode/soy/soy.min.js @@ -0,0 +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 diff --git a/media/editors/codemirror/mode/sparql/sparql.min.js b/media/editors/codemirror/mode/sparql/sparql.min.js new file mode 100644 index 0000000000000..bad2eef425838 --- /dev/null +++ b/media/editors/codemirror/mode/sparql/sparql.min.js @@ -0,0 +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("sparql",function(a){function b(a){return new RegExp("^(?:"+a.join("|")+")$","i")}function c(a,b){var c=a.next();if(g=null,"$"==c||"?"==c)return"?"==c&&a.match(/\s/,!1)?"operator":(a.match(/^[\w\d]*/),"variable-2");if("<"!=c||a.match(/^[\s\u00a0=]/,!1)){if('"'==c||"'"==c)return b.tokenize=d(c),b.tokenize(a,b);if(/[{}\(\),\.;\[\]]/.test(c))return g=c,"bracket";if("#"==c)return a.skipToEnd(),"comment";if(k.test(c))return a.eatWhile(k),"operator";if(":"==c)return a.eatWhile(/[\w\d\._\-]/),"atom";if("@"==c)return a.eatWhile(/[a-z\d\-]/i),"meta";if(a.eatWhile(/[_\w\d]/),a.eat(":"))return a.eatWhile(/[\w\d_\-]/),"atom";var e=a.current();return i.test(e)?"builtin":j.test(e)?"keyword":"variable"}return a.match(/^[^\s\u00a0>]*>?/),"atom"}function d(a){return function(b,d){for(var e,f=!1;null!=(e=b.next());){if(e==a&&!f){d.tokenize=c;break}f=!f&&"\\"==e}return"string"}}function e(a,b,c){a.context={prev:a.context,indent:a.indent,col:c,type:b}}function f(a){a.indent=a.context.indent,a.context=a.context.prev}var g,h=a.indentUnit,i=b(["str","lang","langmatches","datatype","bound","sameterm","isiri","isuri","iri","uri","bnode","count","sum","min","max","avg","sample","group_concat","rand","abs","ceil","floor","round","concat","substr","strlen","replace","ucase","lcase","encode_for_uri","contains","strstarts","strends","strbefore","strafter","year","month","day","hours","minutes","seconds","timezone","tz","now","uuid","struuid","md5","sha1","sha256","sha384","sha512","coalesce","if","strlang","strdt","isnumeric","regex","exists","isblank","isliteral","a"]),j=b(["base","prefix","select","distinct","reduced","construct","describe","ask","from","named","where","order","limit","offset","filter","optional","graph","by","asc","desc","as","having","undef","values","group","minus","in","not","service","silent","using","insert","delete","union","true","false","with","data","copy","to","move","add","create","drop","clear","load"]),k=/[*+\-<>=&|\^\/!\?]/;return{startState:function(){return{tokenize:c,context:null,indent:0,col:0}},token:function(a,b){if(a.sol()&&(b.context&&null==b.context.align&&(b.context.align=!1),b.indent=a.indentation()),a.eatSpace())return null;var c=b.tokenize(a,b);if("comment"!=c&&b.context&&null==b.context.align&&"pattern"!=b.context.type&&(b.context.align=!0),"("==g)e(b,")",a.column());else if("["==g)e(b,"]",a.column());else if("{"==g)e(b,"}",a.column());else if(/[\]\}\)]/.test(g)){for(;b.context&&"pattern"==b.context.type;)f(b);b.context&&g==b.context.type&&f(b)}else"."==g&&b.context&&"pattern"==b.context.type?f(b):/atom|string|variable/.test(c)&&b.context&&(/[\}\]]/.test(b.context.type)?e(b,"pattern",a.column()):"pattern"!=b.context.type||b.context.align||(b.context.align=!0,b.context.col=a.column()));return c},indent:function(a,b){var c=b&&b.charAt(0),d=a.context;if(/[\]\}]/.test(c))for(;d&&"pattern"==d.type;)d=d.prev;var e=d&&c==d.type;return d?"pattern"==d.type?d.col:d.align?d.col+(e?0:1):d.indent+(e?0:h):0}}}),a.defineMIME("application/sparql-query","sparql")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/spreadsheet/spreadsheet.min.js b/media/editors/codemirror/mode/spreadsheet/spreadsheet.min.js new file mode 100644 index 0000000000000..7ed51e372708f --- /dev/null +++ b/media/editors/codemirror/mode/spreadsheet/spreadsheet.min.js @@ -0,0 +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("spreadsheet",function(){return{startState:function(){return{stringType:null,stack:[]}},token:function(a,b){if(a){switch(0===b.stack.length&&('"'==a.peek()||"'"==a.peek())&&(b.stringType=a.peek(),a.next(),b.stack.unshift("string")),b.stack[0]){case"string":for(;"string"===b.stack[0]&&!a.eol();)a.peek()===b.stringType?(a.next(),b.stack.shift()):"\\"===a.peek()?(a.next(),a.next()):a.match(/^.[^\\\"\']*/);return"string";case"characterClass":for(;"characterClass"===b.stack[0]&&!a.eol();)a.match(/^[^\]\\]+/)||a.match(/^\\./)||b.stack.shift();return"operator"}var c=a.peek();switch(c){case"[":return a.next(),b.stack.unshift("characterClass"),"bracket";case":":return a.next(),"operator";case"\\":return a.match(/\\[a-z]+/)?"string-2":null;case".":case",":case";":case"*":case"-":case"+":case"^":case"<":case"/":case"=":return a.next(),"atom";case"$":return a.next(),"builtin"}return a.match(/\d+/)?a.match(/^\w+/)?"error":"number":a.match(/^[a-zA-Z_]\w*/)?a.match(/(?=[\(.])/,!1)?"keyword":"variable-2":-1!=["[","]","(",")","{","}"].indexOf(c)?(a.next(),"bracket"):(a.eatSpace()||a.next(),null)}}}}),a.defineMIME("text/x-spreadsheet","spreadsheet")}); \ 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 f2c2384a7289c..a908277151fe9 100644 --- a/media/editors/codemirror/mode/sql/sql.js +++ b/media/editors/codemirror/mode/sql/sql.js @@ -190,7 +190,7 @@ CodeMirror.defineMode("sql", function(config, parserConfig) { indent: function(state, textAfter) { var cx = state.context; - if (!cx) return 0; + if (!cx) return CodeMirror.Pass; var closing = textAfter.charAt(0) == cx.type; if (cx.align) return cx.col + (closing ? 0 : 1); else return cx.indent + (closing ? 0 : config.indentUnit); @@ -257,7 +257,7 @@ CodeMirror.defineMode("sql", function(config, parserConfig) { } // these keywords are used by all SQL dialects (however, a mode can still overwrite it) - var sqlKeywords = "alter and as asc between by count create delete desc distinct drop from having in insert into is join like not on or order select set table union update values where "; + var sqlKeywords = "alter and as asc between by count create delete desc distinct drop from group having in insert into is join like not on or order select set table union update values where "; // turn a space-separated list into an array function set(str) { @@ -280,7 +280,7 @@ CodeMirror.defineMode("sql", function(config, parserConfig) { CodeMirror.defineMIME("text/x-mssql", { name: "sql", client: set("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"), - keywords: set(sqlKeywords + "begin trigger proc view index for add constraint key primary foreign collate clustered nonclustered"), + keywords: set(sqlKeywords + "begin trigger proc view index for add constraint key primary foreign collate clustered nonclustered declare"), builtin: set("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: set("false true null unknown"), operatorChars: /^[*+\-%<>!=]/, @@ -293,7 +293,7 @@ CodeMirror.defineMode("sql", function(config, parserConfig) { CodeMirror.defineMIME("text/x-mysql", { name: "sql", client: set("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"), - keywords: set(sqlKeywords + "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 groupby_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"), + keywords: set(sqlKeywords + "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: set("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: set("false true null unknown"), operatorChars: /^[*+\-%<>!=&|^]/, @@ -327,9 +327,9 @@ CodeMirror.defineMode("sql", function(config, parserConfig) { CodeMirror.defineMIME("text/x-cassandra", { name: "sql", client: { }, - keywords: set("use select from using consistency where limit first reversed first and in insert into values using consistency ttl update set delete truncate begin batch apply create keyspace with columnfamily primary key index on drop alter type add any one quorum all local_quorum each_quorum"), - builtin: set("ascii bigint blob boolean counter decimal double float int text timestamp uuid varchar varint"), - atoms: set("false true"), + keywords: set("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: set("ascii bigint blob boolean counter decimal double float frozen inet int list map static text timestamp timeuuid tuple uuid varchar varint"), + atoms: set("false true infinity NaN"), operatorChars: /^[<>=]/, dateSQL: { }, support: set("commentSlashSlash decimallessFloat"), diff --git a/media/editors/codemirror/mode/sql/sql.min.js b/media/editors/codemirror/mode/sql/sql.min.js new file mode 100644 index 0000000000000..de95e208f736d --- /dev/null +++ b/media/editors/codemirror/mode/sql/sql.min.js @@ -0,0 +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 lenght lenghtb 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")})}()}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/stex/stex.min.js b/media/editors/codemirror/mode/stex/stex.min.js new file mode 100644 index 0000000000000..c58e9cd4072b9 --- /dev/null +++ b/media/editors/codemirror/mode/stex/stex.min.js @@ -0,0 +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("stex",function(){function a(a,b){a.cmdState.push(b)}function b(a){return a.cmdState.length>0?a.cmdState[a.cmdState.length-1]:null}function c(a){var b=a.cmdState.pop();b&&b.closeBracket()}function d(a){for(var b=a.cmdState,c=b.length-1;c>=0;c--){var d=b[c];if("DEFAULT"!=d.name)return d}return{styleIdentifier:function(){return null}}}function e(a,b,c){return function(){this.name=a,this.bracketNo=0,this.style=b,this.styles=c,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}function f(a,b){a.f=b}function g(c,e){var g;if(c.match(/^\\[a-zA-Z@]+/)){var k=c.current().slice(1);return g=j[k]||j.DEFAULT,g=new g,a(e,g),f(e,i),g.style}if(c.match(/^\\[$&%#{}_]/))return"tag";if(c.match(/^\\[,;!\/\\]/))return"tag";if(c.match("\\["))return f(e,function(a,b){return h(a,b,"\\]")}),"keyword";if(c.match("$$"))return f(e,function(a,b){return h(a,b,"$$")}),"keyword";if(c.match("$"))return f(e,function(a,b){return h(a,b,"$")}),"keyword";var l=c.next();return"%"==l?(c.skipToEnd(),"comment"):"}"==l||"]"==l?(g=b(e))?(g.closeBracket(l),f(e,i),"bracket"):"error":"{"==l||"["==l?(g=j.DEFAULT,g=new g,a(e,g),"bracket"):/\d/.test(l)?(c.eatWhile(/[\w.%]/),"atom"):(c.eatWhile(/[\w\-_]/),g=d(e),"begin"==g.name&&(g.argument=c.current()),g.styleIdentifier())}function h(a,b,c){if(a.eatSpace())return null;if(a.match(c))return f(b,g),"keyword";if(a.match(/^\\[a-zA-Z@]+/))return"tag";if(a.match(/^[a-zA-Z]+/))return"variable-2";if(a.match(/^\\[$&%#{}_]/))return"tag";if(a.match(/^\\[,;!\/]/))return"tag";if(a.match(/^[\^_&]/))return"tag";if(a.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(a.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var d=a.next();return"{"==d||"}"==d||"["==d||"]"==d||"("==d||")"==d?"bracket":"%"==d?(a.skipToEnd(),"comment"):"error"}function i(a,d){var e,h=a.peek();return"{"==h||"["==h?(e=b(d),e.openBracket(h),a.eat(h),f(d,g),"bracket"):/[ \t\r]/.test(h)?(a.eat(h),null):(f(d,g),c(d),g(a,d))}var j={};return j.importmodule=e("importmodule","tag",["string","builtin"]),j.documentclass=e("documentclass","tag",["","atom"]),j.usepackage=e("usepackage","tag",["atom"]),j.begin=e("begin","tag",["atom"]),j.end=e("end","tag",["atom"]),j.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}},{startState:function(){return{cmdState:[],f:g}},copyState:function(a){return{cmdState:a.cmdState.slice(),f:a.f}},token:function(a,b){return b.f(a,b)},blankLine:function(a){a.f=g,a.cmdState.length=0},lineComment:"%"}}),a.defineMIME("text/x-stex","stex"),a.defineMIME("text/x-latex","stex")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/stex/test.js b/media/editors/codemirror/mode/stex/test.js deleted file mode 100644 index 22f027ec7b6b7..0000000000000 --- a/media/editors/codemirror/mode/stex/test.js +++ /dev/null @@ -1,123 +0,0 @@ -// CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: http://codemirror.net/LICENSE - -(function() { - var mode = CodeMirror.getMode({tabSize: 4}, "stex"); - function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); } - - MT("word", - "foo"); - - MT("twoWords", - "foo bar"); - - MT("beginEndDocument", - "[tag \\begin][bracket {][atom document][bracket }]", - "[tag \\end][bracket {][atom document][bracket }]"); - - MT("beginEndEquation", - "[tag \\begin][bracket {][atom equation][bracket }]", - " E=mc^2", - "[tag \\end][bracket {][atom equation][bracket }]"); - - MT("beginModule", - "[tag \\begin][bracket {][atom module][bracket }[[]]]"); - - MT("beginModuleId", - "[tag \\begin][bracket {][atom module][bracket }[[]id=bbt-size[bracket ]]]"); - - MT("importModule", - "[tag \\importmodule][bracket [[][string b-b-t][bracket ]]{][builtin b-b-t][bracket }]"); - - MT("importModulePath", - "[tag \\importmodule][bracket [[][tag \\KWARCslides][bracket {][string dmath/en/cardinality][bracket }]]{][builtin card][bracket }]"); - - MT("psForPDF", - "[tag \\PSforPDF][bracket [[][atom 1][bracket ]]{]#1[bracket }]"); - - MT("comment", - "[comment % foo]"); - - MT("tagComment", - "[tag \\item][comment % bar]"); - - MT("commentTag", - " [comment % \\item]"); - - MT("commentLineBreak", - "[comment %]", - "foo"); - - MT("tagErrorCurly", - "[tag \\begin][error }][bracket {]"); - - MT("tagErrorSquare", - "[tag \\item][error ]]][bracket {]"); - - MT("commentCurly", - "[comment % }]"); - - MT("tagHash", - "the [tag \\#] key"); - - MT("tagNumber", - "a [tag \\$][atom 5] stetson"); - - MT("tagPercent", - "[atom 100][tag \\%] beef"); - - MT("tagAmpersand", - "L [tag \\&] N"); - - MT("tagUnderscore", - "foo[tag \\_]bar"); - - MT("tagBracketOpen", - "[tag \\emph][bracket {][tag \\{][bracket }]"); - - MT("tagBracketClose", - "[tag \\emph][bracket {][tag \\}][bracket }]"); - - MT("tagLetterNumber", - "section [tag \\S][atom 1]"); - - MT("textTagNumber", - "para [tag \\P][atom 2]"); - - MT("thinspace", - "x[tag \\,]y"); - - MT("thickspace", - "x[tag \\;]y"); - - MT("negativeThinspace", - "x[tag \\!]y"); - - MT("periodNotSentence", - "J.\\ L.\\ is"); - - MT("periodSentence", - "X[tag \\@]. The"); - - MT("italicCorrection", - "[bracket {][tag \\em] If[tag \\/][bracket }] I"); - - MT("tagBracket", - "[tag \\newcommand][bracket {][tag \\pop][bracket }]"); - - MT("inlineMathTagFollowedByNumber", - "[keyword $][tag \\pi][number 2][keyword $]"); - - MT("inlineMath", - "[keyword $][number 3][variable-2 x][tag ^][number 2.45]-[tag \\sqrt][bracket {][tag \\$\\alpha][bracket }] = [number 2][keyword $] other text"); - - MT("displayMath", - "More [keyword $$]\t[variable-2 S][tag ^][variable-2 n][tag \\sum] [variable-2 i][keyword $$] other text"); - - MT("mathWithComment", - "[keyword $][variable-2 x] [comment % $]", - "[variable-2 y][keyword $] other text"); - - MT("lineBreakArgument", - "[tag \\\\][bracket [[][atom 1cm][bracket ]]]"); -})(); diff --git a/media/editors/codemirror/mode/stylus/stylus.js b/media/editors/codemirror/mode/stylus/stylus.js new file mode 100644 index 0000000000000..fc46a0163d45d --- /dev/null +++ b/media/editors/codemirror/mode/stylus/stylus.js @@ -0,0 +1,768 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +// Stylus mode created by Dmitry Kiselyov http://git.io/AaRB + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + CodeMirror.defineMode("stylus", function(config) { + var indentUnit = config.indentUnit, + tagKeywords = keySet(tagKeywords_), + tagVariablesRegexp = /^(a|b|i|s|col|em)$/i, + propertyKeywords = keySet(propertyKeywords_), + nonStandardPropertyKeywords = keySet(nonStandardPropertyKeywords_), + valueKeywords = keySet(valueKeywords_), + colorKeywords = keySet(colorKeywords_), + documentTypes = keySet(documentTypes_), + documentTypesRegexp = wordRegexp(documentTypes_), + mediaFeatures = keySet(mediaFeatures_), + mediaTypes = keySet(mediaTypes_), + fontProperties = keySet(fontProperties_), + operatorsRegexp = /^\s*([.]{2,3}|&&|\|\||\*\*|[?!=:]?=|[-+*\/%<>]=?|\?:|\~)/, + wordOperatorKeywordsRegexp = wordRegexp(wordOperatorKeywords_), + blockKeywords = keySet(blockKeywords_), + vendorPrefixesRegexp = new RegExp(/^\-(moz|ms|o|webkit)-/i), + commonAtoms = keySet(commonAtoms_), + firstWordMatch = "", + states = {}, + ch, + style, + type, + override; + + /** + * Tokenizers + */ + function tokenBase(stream, state) { + firstWordMatch = stream.string.match(/(^[\w-]+\s*=\s*$)|(^\s*[\w-]+\s*=\s*[\w-])|(^\s*(\.|#|@|\$|\&|\[|\d|\+|::?|\{|\>|~|\/)?\s*[\w-]*([a-z0-9-]|\*|\/\*)(\(|,)?)/); + state.context.line.firstWord = firstWordMatch ? firstWordMatch[0].replace(/^\s*/, "") : ""; + state.context.line.indent = stream.indentation(); + ch = stream.peek(); + + // Line comment + if (stream.match("//")) { + stream.skipToEnd(); + return ["comment", "comment"]; + } + // Block comment + if (stream.match("/*")) { + state.tokenize = tokenCComment; + return tokenCComment(stream, state); + } + // String + if (ch == "\"" || ch == "'") { + stream.next(); + state.tokenize = tokenString(ch); + return state.tokenize(stream, state); + } + // Def + if (ch == "@") { + stream.next(); + stream.eatWhile(/[\w\\-]/); + return ["def", stream.current()]; + } + // ID selector or Hex color + if (ch == "#") { + stream.next(); + // Hex color + if (stream.match(/^[0-9a-f]{6}|[0-9a-f]{3}/i)) { + return ["atom", "atom"]; + } + // ID selector + if (stream.match(/^[a-z][\w-]*/i)) { + return ["builtin", "hash"]; + } + } + // Vendor prefixes + if (stream.match(vendorPrefixesRegexp)) { + return ["meta", "vendor-prefixes"]; + } + // Numbers + if (stream.match(/^-?[0-9]?\.?[0-9]/)) { + stream.eatWhile(/[a-z%]/i); + return ["number", "unit"]; + } + // !important|optional + if (ch == "!") { + stream.next(); + return [stream.match(/^(important|optional)/i) ? "keyword": "operator", "important"]; + } + // Class + if (ch == "." && stream.match(/^\.[a-z][\w-]*/i)) { + return ["qualifier", "qualifier"]; + } + // url url-prefix domain regexp + if (stream.match(documentTypesRegexp)) { + if (stream.peek() == "(") state.tokenize = tokenParenthesized; + return ["property", "word"]; + } + // Mixins / Functions + if (stream.match(/^[a-z][\w-]*\(/i)) { + stream.backUp(1); + return ["keyword", "mixin"]; + } + // Block mixins + if (stream.match(/^(\+|-)[a-z][\w-]*\(/i)) { + stream.backUp(1); + return ["keyword", "block-mixin"]; + } + // Parent Reference BEM naming + if (stream.string.match(/^\s*&/) && stream.match(/^[-_]+[a-z][\w-]*/)) { + return ["qualifier", "qualifier"]; + } + // / Root Reference & Parent Reference + if (stream.match(/^(\/|&)(-|_|:|\.|#|[a-z])/)) { + stream.backUp(1); + return ["variable-3", "reference"]; + } + if (stream.match(/^&{1}\s*$/)) { + return ["variable-3", "reference"]; + } + // Variable + if (ch == "$" && stream.match(/^\$[\w-]+/i)) { + return ["variable-2", "variable-name"]; + } + // Word operator + if (stream.match(wordOperatorKeywordsRegexp)) { + return ["operator", "operator"]; + } + // Word + if (stream.match(/^[-_]*[a-z0-9]+[\w-]*/i)) { + if (stream.match(/^(\.|\[)[\w-\'\"\]]+/i, false)) { + if (!wordIsTag(stream.current())) { + stream.match(/[\w-]+/); + return ["variable-2", "variable-name"]; + } + } + return ["variable-2", "word"]; + } + // Operators + if (stream.match(operatorsRegexp)) { + return ["operator", stream.current()]; + } + // Delimiters + if (/[:;,{}\[\]\(\)]/.test(ch)) { + stream.next(); + return [null, ch]; + } + // Non-detected items + stream.next(); + return [null, null]; + } + + /** + * Token comment + */ + function tokenCComment(stream, state) { + var maybeEnd = false, ch; + while ((ch = stream.next()) != null) { + if (maybeEnd && ch == "/") { + state.tokenize = null; + break; + } + maybeEnd = (ch == "*"); + } + return ["comment", "comment"]; + } + + /** + * Token string + */ + function tokenString(quote) { + return function(stream, state) { + var escaped = false, ch; + while ((ch = stream.next()) != null) { + if (ch == quote && !escaped) { + if (quote == ")") stream.backUp(1); + break; + } + escaped = !escaped && ch == "\\"; + } + if (ch == quote || !escaped && quote != ")") state.tokenize = null; + return ["string", "string"]; + }; + } + + /** + * Token parenthesized + */ + function tokenParenthesized(stream, state) { + stream.next(); // Must be "(" + if (!stream.match(/\s*[\"\')]/, false)) + state.tokenize = tokenString(")"); + else + state.tokenize = null; + return [null, "("]; + } + + /** + * Context management + */ + function Context(type, indent, prev, line) { + this.type = type; + this.indent = indent; + this.prev = prev; + this.line = line || {firstWord: "", indent: 0}; + } + + function pushContext(state, stream, type, indent) { + indent = indent >= 0 ? indent : indentUnit; + state.context = new Context(type, stream.indentation() + indent, state.context); + return type; + } + + function popContext(state, currentIndent) { + var contextIndent = state.context.indent - indentUnit; + currentIndent = currentIndent || false; + state.context = state.context.prev; + if (currentIndent) state.context.indent = contextIndent; + return state.context.type; + } + + function pass(type, stream, state) { + return states[state.context.type](type, stream, state); + } + + function popAndPass(type, stream, state, n) { + for (var i = n || 1; i > 0; i--) + state.context = state.context.prev; + return pass(type, stream, state); + } + + + /** + * Parser + */ + function wordIsTag(word) { + return word.toLowerCase() in tagKeywords; + } + + function wordIsProperty(word) { + word = word.toLowerCase(); + return word in propertyKeywords || word in fontProperties; + } + + function wordIsBlock(word) { + return word.toLowerCase() in blockKeywords; + } + + function wordIsVendorPrefix(word) { + return word.toLowerCase().match(vendorPrefixesRegexp); + } + + function wordAsValue(word) { + var wordLC = word.toLowerCase(); + var override = "variable-2"; + if (wordIsTag(word)) override = "tag"; + else if (wordIsBlock(word)) override = "block-keyword"; + else if (wordIsProperty(word)) override = "property"; + else if (wordLC in valueKeywords || wordLC in commonAtoms) override = "atom"; + else if (wordLC == "return" || wordLC in colorKeywords) override = "keyword"; + + // Font family + else if (word.match(/^[A-Z]/)) override = "string"; + return override; + } + + function typeIsBlock(type, stream) { + return ((endOfLine(stream) && (type == "{" || type == "]" || type == "hash" || type == "qualifier")) || type == "block-mixin"); + } + + function typeIsInterpolation(type, stream) { + return type == "{" && stream.match(/^\s*\$?[\w-]+/i, false); + } + + function typeIsPseudo(type, stream) { + return type == ":" && stream.match(/^[a-z-]+/, false); + } + + function startOfLine(stream) { + return stream.sol() || stream.string.match(new RegExp("^\\s*" + escapeRegExp(stream.current()))); + } + + function endOfLine(stream) { + return stream.eol() || stream.match(/^\s*$/, false); + } + + function firstWordOfLine(line) { + var re = /^\s*[-_]*[a-z0-9]+[\w-]*/i; + var result = typeof line == "string" ? line.match(re) : line.string.match(re); + return result ? result[0].replace(/^\s*/, "") : ""; + } + + + /** + * Block + */ + states.block = function(type, stream, state) { + if ((type == "comment" && startOfLine(stream)) || + (type == "," && endOfLine(stream)) || + type == "mixin") { + return pushContext(state, stream, "block", 0); + } + if (typeIsInterpolation(type, stream)) { + return pushContext(state, stream, "interpolation"); + } + if (endOfLine(stream) && type == "]") { + if (!/^\s*(\.|#|:|\[|\*|&)/.test(stream.string) && !wordIsTag(firstWordOfLine(stream))) { + return pushContext(state, stream, "block", 0); + } + } + if (typeIsBlock(type, stream, state)) { + return pushContext(state, stream, "block"); + } + if (type == "}" && endOfLine(stream)) { + return pushContext(state, stream, "block", 0); + } + if (type == "variable-name") { + if ((stream.indentation() == 0 && startOfLine(stream)) || wordIsBlock(firstWordOfLine(stream))) { + return pushContext(state, stream, "variableName"); + } + else { + return pushContext(state, stream, "variableName", 0); + } + } + if (type == "=") { + if (!endOfLine(stream) && !wordIsBlock(firstWordOfLine(stream))) { + return pushContext(state, stream, "block", 0); + } + return pushContext(state, stream, "block"); + } + if (type == "*") { + if (endOfLine(stream) || stream.match(/\s*(,|\.|#|\[|:|{)/,false)) { + override = "tag"; + return pushContext(state, stream, "block"); + } + } + if (typeIsPseudo(type, stream)) { + return pushContext(state, stream, "pseudo"); + } + if (/@(font-face|media|supports|(-moz-)?document)/.test(type)) { + return pushContext(state, stream, endOfLine(stream) ? "block" : "atBlock"); + } + if (/@(-(moz|ms|o|webkit)-)?keyframes$/.test(type)) { + return pushContext(state, stream, "keyframes"); + } + if (/@extends?/.test(type)) { + return pushContext(state, stream, "extend", 0); + } + if (type && type.charAt(0) == "@") { + + // Property Lookup + if (stream.indentation() > 0 && wordIsProperty(stream.current().slice(1))) { + override = "variable-2"; + return "block"; + } + if (/(@import|@require|@charset)/.test(type)) { + return pushContext(state, stream, "block", 0); + } + return pushContext(state, stream, "block"); + } + if (type == "reference" && endOfLine(stream)) { + return pushContext(state, stream, "block"); + } + if (type == "(") { + return pushContext(state, stream, "parens"); + } + + if (type == "vendor-prefixes") { + return pushContext(state, stream, "vendorPrefixes"); + } + if (type == "word") { + var word = stream.current(); + override = wordAsValue(word); + + if (override == "property") { + if (startOfLine(stream)) { + return pushContext(state, stream, "block", 0); + } else { + override = "atom"; + return "block"; + } + } + + if (override == "tag") { + + // tag is a css value + if (/embed|menu|pre|progress|sub|table/.test(word)) { + if (wordIsProperty(firstWordOfLine(stream))) { + override = "atom"; + return "block"; + } + } + + // tag is an attribute + if (stream.string.match(new RegExp("\\[\\s*" + word + "|" + word +"\\s*\\]"))) { + override = "atom"; + return "block"; + } + + // tag is a variable + if (tagVariablesRegexp.test(word)) { + if ((startOfLine(stream) && stream.string.match(/=/)) || + (!startOfLine(stream) && + !stream.string.match(/^(\s*\.|#|\&|\[|\/|>|\*)/) && + !wordIsTag(firstWordOfLine(stream)))) { + override = "variable-2"; + if (wordIsBlock(firstWordOfLine(stream))) return "block"; + return pushContext(state, stream, "block", 0); + } + } + + if (endOfLine(stream)) return pushContext(state, stream, "block"); + } + if (override == "block-keyword") { + override = "keyword"; + + // Postfix conditionals + if (stream.current(/(if|unless)/) && !startOfLine(stream)) { + return "block"; + } + return pushContext(state, stream, "block"); + } + if (word == "return") return pushContext(state, stream, "block", 0); + } + return state.context.type; + }; + + + /** + * Parens + */ + states.parens = function(type, stream, state) { + if (type == "(") return pushContext(state, stream, "parens"); + if (type == ")") { + if (state.context.prev.type == "parens") { + return popContext(state); + } + if ((stream.string.match(/^[a-z][\w-]*\(/i) && endOfLine(stream)) || + wordIsBlock(firstWordOfLine(stream)) || + /(\.|#|:|\[|\*|&|>|~|\+|\/)/.test(firstWordOfLine(stream)) || + (!stream.string.match(/^-?[a-z][\w-\.\[\]\'\"]*\s*=/) && + wordIsTag(firstWordOfLine(stream)))) { + return pushContext(state, stream, "block"); + } + if (stream.string.match(/^[\$-]?[a-z][\w-\.\[\]\'\"]*\s*=/) || + stream.string.match(/^\s*(\(|\)|[0-9])/) || + stream.string.match(/^\s+[a-z][\w-]*\(/i) || + stream.string.match(/^\s+[\$-]?[a-z]/i)) { + return pushContext(state, stream, "block", 0); + } + if (endOfLine(stream)) return pushContext(state, stream, "block"); + else return pushContext(state, stream, "block", 0); + } + if (type && type.charAt(0) == "@" && wordIsProperty(stream.current().slice(1))) { + override = "variable-2"; + } + if (type == "word") { + var word = stream.current(); + override = wordAsValue(word); + if (override == "tag" && tagVariablesRegexp.test(word)) { + override = "variable-2"; + } + if (override == "property" || word == "to") override = "atom"; + } + if (type == "variable-name") { + return pushContext(state, stream, "variableName"); + } + if (typeIsPseudo(type, stream)) { + return pushContext(state, stream, "pseudo"); + } + return state.context.type; + }; + + + /** + * Vendor prefixes + */ + states.vendorPrefixes = function(type, stream, state) { + if (type == "word") { + override = "property"; + return pushContext(state, stream, "block", 0); + } + return popContext(state); + }; + + + /** + * Pseudo + */ + states.pseudo = function(type, stream, state) { + if (!wordIsProperty(firstWordOfLine(stream.string))) { + stream.match(/^[a-z-]+/); + override = "variable-3"; + if (endOfLine(stream)) return pushContext(state, stream, "block"); + return popContext(state); + } + return popAndPass(type, stream, state); + }; + + + /** + * atBlock + */ + states.atBlock = function(type, stream, state) { + if (type == "(") return pushContext(state, stream, "atBlock_parens"); + if (typeIsBlock(type, stream, state)) { + return pushContext(state, stream, "block"); + } + if (typeIsInterpolation(type, stream)) { + return pushContext(state, stream, "interpolation"); + } + if (type == "word") { + var word = stream.current().toLowerCase(); + if (/^(only|not|and|or)$/.test(word)) + override = "keyword"; + else if (documentTypes.hasOwnProperty(word)) + override = "tag"; + else if (mediaTypes.hasOwnProperty(word)) + override = "attribute"; + else if (mediaFeatures.hasOwnProperty(word)) + override = "property"; + else if (nonStandardPropertyKeywords.hasOwnProperty(word)) + override = "string-2"; + else override = wordAsValue(stream.current()); + if (override == "tag" && endOfLine(stream)) { + return pushContext(state, stream, "block"); + } + } + if (type == "operator" && /^(not|and|or)$/.test(stream.current())) { + override = "keyword"; + } + return state.context.type; + }; + + states.atBlock_parens = function(type, stream, state) { + if (type == "{" || type == "}") return state.context.type; + if (type == ")") { + if (endOfLine(stream)) return pushContext(state, stream, "block"); + else return pushContext(state, stream, "atBlock"); + } + if (type == "word") { + var word = stream.current().toLowerCase(); + override = wordAsValue(word); + if (/^(max|min)/.test(word)) override = "property"; + if (override == "tag") { + tagVariablesRegexp.test(word) ? override = "variable-2" : override = "atom"; + } + return state.context.type; + } + return states.atBlock(type, stream, state); + }; + + + /** + * Keyframes + */ + states.keyframes = function(type, stream, state) { + if (stream.indentation() == "0" && ((type == "}" && startOfLine(stream)) || type == "]" || type == "hash" + || type == "qualifier" || wordIsTag(stream.current()))) { + return popAndPass(type, stream, state); + } + if (type == "{") return pushContext(state, stream, "keyframes"); + if (type == "}") { + if (startOfLine(stream)) return popContext(state, true); + else return pushContext(state, stream, "keyframes"); + } + if (type == "unit" && /^[0-9]+\%$/.test(stream.current())) { + return pushContext(state, stream, "keyframes"); + } + if (type == "word") { + override = wordAsValue(stream.current()); + if (override == "block-keyword") { + override = "keyword"; + return pushContext(state, stream, "keyframes"); + } + } + if (/@(font-face|media|supports|(-moz-)?document)/.test(type)) { + return pushContext(state, stream, endOfLine(stream) ? "block" : "atBlock"); + } + if (type == "mixin") { + return pushContext(state, stream, "block", 0); + } + return state.context.type; + }; + + + /** + * Interpolation + */ + states.interpolation = function(type, stream, state) { + if (type == "{") popContext(state) && pushContext(state, stream, "block"); + if (type == "}") { + if (stream.string.match(/^\s*(\.|#|:|\[|\*|&|>|~|\+|\/)/i) || + (stream.string.match(/^\s*[a-z]/i) && wordIsTag(firstWordOfLine(stream)))) { + return pushContext(state, stream, "block"); + } + if (!stream.string.match(/^(\{|\s*\&)/) || + stream.match(/\s*[\w-]/,false)) { + return pushContext(state, stream, "block", 0); + } + return pushContext(state, stream, "block"); + } + if (type == "variable-name") { + return pushContext(state, stream, "variableName", 0); + } + if (type == "word") { + override = wordAsValue(stream.current()); + if (override == "tag") override = "atom"; + } + return state.context.type; + }; + + + /** + * Extend/s + */ + states.extend = function(type, stream, state) { + if (type == "[" || type == "=") return "extend"; + if (type == "]") return popContext(state); + if (type == "word") { + override = wordAsValue(stream.current()); + return "extend"; + } + return popContext(state); + }; + + + /** + * Variable name + */ + states.variableName = function(type, stream, state) { + if (type == "string" || type == "[" || type == "]" || stream.current().match(/^(\.|\$)/)) { + if (stream.current().match(/^\.[\w-]+/i)) override = "variable-2"; + if (endOfLine(stream)) return popContext(state); + return "variableName"; + } + return popAndPass(type, stream, state); + }; + + + return { + startState: function(base) { + return { + tokenize: null, + state: "block", + context: new Context("block", base || 0, null) + }; + }, + token: function(stream, state) { + if (!state.tokenize && stream.eatSpace()) return null; + style = (state.tokenize || tokenBase)(stream, state); + if (style && typeof style == "object") { + type = style[1]; + style = style[0]; + } + override = style; + state.state = states[state.state](type, stream, state); + return override; + }, + indent: function(state, textAfter, line) { + + var cx = state.context, + ch = textAfter && textAfter.charAt(0), + indent = cx.indent, + lineFirstWord = firstWordOfLine(textAfter), + lineIndent = line.length - line.replace(/^\s*/, "").length, + prevLineFirstWord = state.context.prev ? state.context.prev.line.firstWord : "", + prevLineIndent = state.context.prev ? state.context.prev.line.indent : lineIndent; + + if (cx.prev && + (ch == "}" && (cx.type == "block" || cx.type == "atBlock" || cx.type == "keyframes") || + ch == ")" && (cx.type == "parens" || cx.type == "atBlock_parens") || + ch == "{" && (cx.type == "at"))) { + indent = cx.indent - indentUnit; + cx = cx.prev; + } else if (!(/(\})/.test(ch))) { + if (/@|\$|\d/.test(ch) || + /^\{/.test(textAfter) || +/^\s*\/(\/|\*)/.test(textAfter) || + /^\s*\/\*/.test(prevLineFirstWord) || + /^\s*[\w-\.\[\]\'\"]+\s*(\?|:|\+)?=/i.test(textAfter) || +/^(\+|-)?[a-z][\w-]*\(/i.test(textAfter) || +/^return/.test(textAfter) || + wordIsBlock(lineFirstWord)) { + indent = lineIndent; + } else if (/(\.|#|:|\[|\*|&|>|~|\+|\/)/.test(ch) || wordIsTag(lineFirstWord)) { + if (/\,\s*$/.test(prevLineFirstWord)) { + indent = prevLineIndent; + } else if (/^\s+/.test(line) && (/(\.|#|:|\[|\*|&|>|~|\+|\/)/.test(prevLineFirstWord) || wordIsTag(prevLineFirstWord))) { + indent = lineIndent <= prevLineIndent ? prevLineIndent : prevLineIndent + indentUnit; + } else { + indent = lineIndent; + } + } else if (!/,\s*$/.test(line) && (wordIsVendorPrefix(lineFirstWord) || wordIsProperty(lineFirstWord))) { + if (wordIsBlock(prevLineFirstWord)) { + indent = lineIndent <= prevLineIndent ? prevLineIndent : prevLineIndent + indentUnit; + } else if (/^\{/.test(prevLineFirstWord)) { + indent = lineIndent <= prevLineIndent ? lineIndent : prevLineIndent + indentUnit; + } else if (wordIsVendorPrefix(prevLineFirstWord) || wordIsProperty(prevLineFirstWord)) { + indent = lineIndent >= prevLineIndent ? prevLineIndent : lineIndent; + } else if (/^(\.|#|:|\[|\*|&|@|\+|\-|>|~|\/)/.test(prevLineFirstWord) || + /=\s*$/.test(prevLineFirstWord) || + wordIsTag(prevLineFirstWord) || + /^\$[\w-\.\[\]\'\"]/.test(prevLineFirstWord)) { + indent = prevLineIndent + indentUnit; + } else { + indent = lineIndent; + } + } + } + return indent; + }, + electricChars: "}", + lineComment: "//", + fold: "indent" + }; + }); + + // developer.mozilla.org/en-US/docs/Web/HTML/Element + var tagKeywords_ = ["a","abbr","address","area","article","aside","audio", "b", "base","bdi", "bdo","bgsound","blockquote","body","br","button","canvas","caption","cite", "code","col","colgroup","data","datalist","dd","del","details","dfn","div", "dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1", "h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe", "img","input","ins","kbd","keygen","label","legend","li","link","main","map", "mark","marquee","menu","menuitem","meta","meter","nav","nobr","noframes", "noscript","object","ol","optgroup","option","output","p","param","pre", "progress","q","rp","rt","ruby","s","samp","script","section","select", "small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track", "u","ul","var","video"]; + + // github.com/codemirror/CodeMirror/blob/master/mode/css/css.js + var documentTypes_ = ["domain", "regexp", "url", "url-prefix"]; + var mediaTypes_ = ["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"]; + var mediaFeatures_ = ["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid"]; + var propertyKeywords_ = ["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-position","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marker-offset","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-image-threshold","shape-inside","shape-margin","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","word-break","word-spacing","word-wrap","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode","font-smoothing","osx-font-smoothing"]; + var nonStandardPropertyKeywords_ = ["scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-3d-light-color","scrollbar-track-color","shape-inside","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","zoom"]; + var fontProperties_ = ["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"]; + var colorKeywords_ = ["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]; + var valueKeywords_ = ["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","attr","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","column","compact","condensed","contain","content","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","flex","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-table","inset","inside","intrinsic","invert","italic","japanese-formal","japanese-informal","justify","kannada","katakana","katakana-iroha","keep-all","khmer","korean-hangul-formal","korean-hanja-formal","korean-hanja-informal","landscape","lao","large","larger","left","level","lighter","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","malayalam","match","matrix","matrix3d","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","perspective","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row-resize","rtl","run-in","running","s-resize","sans-serif","scale","scale3d","scaleX","scaleY","scaleZ","scroll","scrollbar","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","simp-chinese-formal","simp-chinese-informal","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","solid","somali","source-atop","source-in","source-out","source-over","space","spell-out","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","symbolic","symbols","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","tamil","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","trad-chinese-formal","trad-chinese-informal","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","x-large","x-small","xor","xx-large","xx-small","bicubic","optimizespeed","grayscale"]; + + var wordOperatorKeywords_ = ["in","and","or","not","is not","is a","is","isnt","defined","if unless"], + blockKeywords_ = ["for","if","else","unless", "from", "to"], + commonAtoms_ = ["null","true","false","href","title","type","not-allowed","readonly","disabled"], + commonDef_ = ["@font-face", "@keyframes", "@media", "@viewport", "@page", "@host", "@supports", "@block", "@css"]; + + var hintWords = tagKeywords_.concat(documentTypes_,mediaTypes_,mediaFeatures_, + propertyKeywords_,nonStandardPropertyKeywords_, + colorKeywords_,valueKeywords_,fontProperties_, + wordOperatorKeywords_,blockKeywords_, + commonAtoms_,commonDef_); + + function wordRegexp(words) { + words = words.sort(function(a,b){return b > a;}); + return new RegExp("^((" + words.join(")|(") + "))\\b"); + } + + function keySet(array) { + var keys = {}; + for (var i = 0; i < array.length; ++i) keys[array[i]] = true; + return keys; + } + + function escapeRegExp(text) { + return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); + } + + CodeMirror.registerHelper("hintWords", "stylus", hintWords); + CodeMirror.defineMIME("text/x-styl", "stylus"); +}); diff --git a/media/editors/codemirror/mode/stylus/stylus.min.js b/media/editors/codemirror/mode/stylus/stylus.min.js new file mode 100644 index 0000000000000..b7c1f34d3411c --- /dev/null +++ b/media/editors/codemirror/mode/stylus/stylus.min.js @@ -0,0 +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){return a=a.sort(function(a,b){return b>a}),new RegExp("^(("+a.join(")|(")+"))\\b")}function c(a){for(var b={},c=0;c|~|\/)?\s*[\w-]*([a-z0-9-]|\*|\/\*)(\(|,)?)/),b.context.line.firstWord=da?da[0].replace(/^\s*/,""):"",b.context.line.indent=a.indentation(),K=a.peek(),a.match("//"))return a.skipToEnd(),["comment","comment"];if(a.match("/*"))return b.tokenize=r,r(a,b);if('"'==K||"'"==K)return a.next(),b.tokenize=s(K),b.tokenize(a,b);if("@"==K)return a.next(),a.eatWhile(/[\w\\-]/),["def",a.current()];if("#"==K){if(a.next(),a.match(/^[0-9a-f]{6}|[0-9a-f]{3}/i))return["atom","atom"];if(a.match(/^[a-z][\w-]*/i))return["builtin","hash"]}return a.match(ba)?["meta","vendor-prefixes"]:a.match(/^-?[0-9]?\.?[0-9]/)?(a.eatWhile(/[a-z%]/i),["number","unit"]):"!"==K?(a.next(),[a.match(/^(important|optional)/i)?"keyword":"operator","important"]):"."==K&&a.match(/^\.[a-z][\w-]*/i)?["qualifier","qualifier"]:a.match(W)?("("==a.peek()&&(b.tokenize=t),["property","word"]):a.match(/^[a-z][\w-]*\(/i)?(a.backUp(1),["keyword","mixin"]):a.match(/^(\+|-)[a-z][\w-]*\(/i)?(a.backUp(1),["keyword","block-mixin"]):a.string.match(/^\s*&/)&&a.match(/^[-_]+[a-z][\w-]*/)?["qualifier","qualifier"]:a.match(/^(\/|&)(-|_|:|\.|#|[a-z])/)?(a.backUp(1),["variable-3","reference"]):a.match(/^&{1}\s*$/)?["variable-3","reference"]:"$"==K&&a.match(/^\$[\w-]+/i)?["variable-2","variable-name"]:a.match(_)?["operator","operator"]:a.match(/^[-_]*[a-z0-9]+[\w-]*/i)?a.match(/^(\.|\[)[\w-\'\"\]]+/i,!1)&&!z(a.current())?(a.match(/[\w-]+/),["variable-2","variable-name"]):["variable-2","word"]:a.match($)?["operator",a.current()]:/[:;,{}\[\]\(\)]/.test(K)?(a.next(),[null,K]):(a.next(),[null,null])}function r(a,b){for(var c,d=!1;null!=(c=a.next());){if(d&&"/"==c){b.tokenize=null;break}d="*"==c}return["comment","comment"]}function s(a){return function(b,c){for(var d,e=!1;null!=(d=b.next());){if(d==a&&!e){")"==a&&b.backUp(1);break}e=!e&&"\\"==d}return(d==a||!e&&")"!=a)&&(c.tokenize=null),["string","string"]}}function t(a,b){return a.next(),a.match(/\s*[\"\')]/,!1)?b.tokenize=null:b.tokenize=s(")"),[null,"("]}function u(a,b,c,d){this.type=a,this.indent=b,this.prev=c,this.line=d||{firstWord:"",indent:0}}function v(a,b,c,d){return d=d>=0?d:O,a.context=new u(c,b.indentation()+d,a.context),c}function w(a,b){var c=a.context.indent-O;return b=b||!1,a.context=a.context.prev,b&&(a.context.indent=c),a.context.type}function x(a,b,c){return ea[c.context.type](a,b,c)}function y(a,b,c,d){for(var e=d||1;e>0;e--)c.context=c.context.prev;return x(a,b,c)}function z(a){return a.toLowerCase()in P}function A(a){return a=a.toLowerCase(),a in R||a in Z}function B(a){return a.toLowerCase()in aa}function C(a){return a.toLowerCase().match(ba)}function D(a){var b=a.toLowerCase(),c="variable-2";return z(a)?c="tag":B(a)?c="block-keyword":A(a)?c="property":b in T||b in ca?c="atom":"return"==b||b in U?c="keyword":a.match(/^[A-Z]/)&&(c="string"),c}function E(a,b){return I(b)&&("{"==a||"]"==a||"hash"==a||"qualifier"==a)||"block-mixin"==a}function F(a,b){return"{"==a&&b.match(/^\s*\$?[\w-]+/i,!1)}function G(a,b){return":"==a&&b.match(/^[a-z-]+/,!1)}function H(a){return a.sol()||a.string.match(new RegExp("^\\s*"+d(a.current())))}function I(a){return a.eol()||a.match(/^\s*$/,!1)}function J(a){var b=/^\s*[-_]*[a-z0-9]+[\w-]*/i,c="string"==typeof a?a.match(b):a.string.match(b);return c?c[0].replace(/^\s*/,""):""}var K,L,M,N,O=a.indentUnit,P=c(e),Q=/^(a|b|i|s|col|em)$/i,R=c(i),S=c(j),T=c(m),U=c(l),V=c(f),W=b(f),X=c(h),Y=c(g),Z=c(k),$=/^\s*([.]{2,3}|&&|\|\||\*\*|[?!=:]?=|[-+*\/%<>]=?|\?:|\~)/,_=b(n),aa=c(o),ba=new RegExp(/^\-(moz|ms|o|webkit)-/i),ca=c(p),da="",ea={};return ea.block=function(a,b,c){if("comment"==a&&H(b)||","==a&&I(b)||"mixin"==a)return v(c,b,"block",0);if(F(a,b))return v(c,b,"interpolation");if(I(b)&&"]"==a&&!/^\s*(\.|#|:|\[|\*|&)/.test(b.string)&&!z(J(b)))return v(c,b,"block",0);if(E(a,b,c))return v(c,b,"block");if("}"==a&&I(b))return v(c,b,"block",0);if("variable-name"==a)return 0==b.indentation()&&H(b)||B(J(b))?v(c,b,"variableName"):v(c,b,"variableName",0);if("="==a)return I(b)||B(J(b))?v(c,b,"block"):v(c,b,"block",0);if("*"==a&&(I(b)||b.match(/\s*(,|\.|#|\[|:|{)/,!1)))return N="tag",v(c,b,"block");if(G(a,b))return v(c,b,"pseudo");if(/@(font-face|media|supports|(-moz-)?document)/.test(a))return v(c,b,I(b)?"block":"atBlock");if(/@(-(moz|ms|o|webkit)-)?keyframes$/.test(a))return v(c,b,"keyframes");if(/@extends?/.test(a))return v(c,b,"extend",0);if(a&&"@"==a.charAt(0))return b.indentation()>0&&A(b.current().slice(1))?(N="variable-2","block"):/(@import|@require|@charset)/.test(a)?v(c,b,"block",0):v(c,b,"block");if("reference"==a&&I(b))return v(c,b,"block");if("("==a)return v(c,b,"parens");if("vendor-prefixes"==a)return v(c,b,"vendorPrefixes");if("word"==a){var d=b.current();if(N=D(d),"property"==N)return H(b)?v(c,b,"block",0):(N="atom","block");if("tag"==N){if(/embed|menu|pre|progress|sub|table/.test(d)&&A(J(b)))return N="atom","block";if(b.string.match(new RegExp("\\[\\s*"+d+"|"+d+"\\s*\\]")))return N="atom","block";if(Q.test(d)&&(H(b)&&b.string.match(/=/)||!H(b)&&!b.string.match(/^(\s*\.|#|\&|\[|\/|>|\*)/)&&!z(J(b))))return N="variable-2",B(J(b))?"block":v(c,b,"block",0);if(I(b))return v(c,b,"block")}if("block-keyword"==N)return N="keyword",b.current(/(if|unless)/)&&!H(b)?"block":v(c,b,"block");if("return"==d)return v(c,b,"block",0)}return c.context.type},ea.parens=function(a,b,c){if("("==a)return v(c,b,"parens");if(")"==a)return"parens"==c.context.prev.type?w(c):b.string.match(/^[a-z][\w-]*\(/i)&&I(b)||B(J(b))||/(\.|#|:|\[|\*|&|>|~|\+|\/)/.test(J(b))||!b.string.match(/^-?[a-z][\w-\.\[\]\'\"]*\s*=/)&&z(J(b))?v(c,b,"block"):b.string.match(/^[\$-]?[a-z][\w-\.\[\]\'\"]*\s*=/)||b.string.match(/^\s*(\(|\)|[0-9])/)||b.string.match(/^\s+[a-z][\w-]*\(/i)||b.string.match(/^\s+[\$-]?[a-z]/i)?v(c,b,"block",0):I(b)?v(c,b,"block"):v(c,b,"block",0);if(a&&"@"==a.charAt(0)&&A(b.current().slice(1))&&(N="variable-2"),"word"==a){var d=b.current();N=D(d),"tag"==N&&Q.test(d)&&(N="variable-2"),("property"==N||"to"==d)&&(N="atom")}return"variable-name"==a?v(c,b,"variableName"):G(a,b)?v(c,b,"pseudo"):c.context.type},ea.vendorPrefixes=function(a,b,c){return"word"==a?(N="property",v(c,b,"block",0)):w(c)},ea.pseudo=function(a,b,c){return A(J(b.string))?y(a,b,c):(b.match(/^[a-z-]+/),N="variable-3",I(b)?v(c,b,"block"):w(c))},ea.atBlock=function(a,b,c){if("("==a)return v(c,b,"atBlock_parens");if(E(a,b,c))return v(c,b,"block");if(F(a,b))return v(c,b,"interpolation");if("word"==a){var d=b.current().toLowerCase();if(N=/^(only|not|and|or)$/.test(d)?"keyword":V.hasOwnProperty(d)?"tag":Y.hasOwnProperty(d)?"attribute":X.hasOwnProperty(d)?"property":S.hasOwnProperty(d)?"string-2":D(b.current()),"tag"==N&&I(b))return v(c,b,"block")}return"operator"==a&&/^(not|and|or)$/.test(b.current())&&(N="keyword"),c.context.type},ea.atBlock_parens=function(a,b,c){if("{"==a||"}"==a)return c.context.type;if(")"==a)return I(b)?v(c,b,"block"):v(c,b,"atBlock");if("word"==a){var d=b.current().toLowerCase();return N=D(d),/^(max|min)/.test(d)&&(N="property"),"tag"==N&&(N=Q.test(d)?"variable-2":"atom"),c.context.type}return ea.atBlock(a,b,c)},ea.keyframes=function(a,b,c){return"0"==b.indentation()&&("}"==a&&H(b)||"]"==a||"hash"==a||"qualifier"==a||z(b.current()))?y(a,b,c):"{"==a?v(c,b,"keyframes"):"}"==a?H(b)?w(c,!0):v(c,b,"keyframes"):"unit"==a&&/^[0-9]+\%$/.test(b.current())?v(c,b,"keyframes"):"word"==a&&(N=D(b.current()),"block-keyword"==N)?(N="keyword",v(c,b,"keyframes")):/@(font-face|media|supports|(-moz-)?document)/.test(a)?v(c,b,I(b)?"block":"atBlock"):"mixin"==a?v(c,b,"block",0):c.context.type},ea.interpolation=function(a,b,c){return"{"==a&&w(c)&&v(c,b,"block"),"}"==a?b.string.match(/^\s*(\.|#|:|\[|\*|&|>|~|\+|\/)/i)||b.string.match(/^\s*[a-z]/i)&&z(J(b))?v(c,b,"block"):!b.string.match(/^(\{|\s*\&)/)||b.match(/\s*[\w-]/,!1)?v(c,b,"block",0):v(c,b,"block"):"variable-name"==a?v(c,b,"variableName",0):("word"==a&&(N=D(b.current()),"tag"==N&&(N="atom")),c.context.type)},ea.extend=function(a,b,c){return"["==a||"="==a?"extend":"]"==a?w(c):"word"==a?(N=D(b.current()),"extend"):w(c)},ea.variableName=function(a,b,c){return"string"==a||"["==a||"]"==a||b.current().match(/^(\.|\$)/)?(b.current().match(/^\.[\w-]+/i)&&(N="variable-2"),I(b)?w(c):"variableName"):y(a,b,c)},{startState:function(a){return{tokenize:null,state:"block",context:new u("block",a||0,null)}},token:function(a,b){return!b.tokenize&&a.eatSpace()?null:(L=(b.tokenize||q)(a,b),L&&"object"==typeof L&&(M=L[1],L=L[0]),N=L,b.state=ea[b.state](M,a,b),N)},indent:function(a,b,c){var d=a.context,e=b&&b.charAt(0),f=d.indent,g=J(b),h=c.length-c.replace(/^\s*/,"").length,i=a.context.prev?a.context.prev.line.firstWord:"",j=a.context.prev?a.context.prev.line.indent:h;return d.prev&&("}"==e&&("block"==d.type||"atBlock"==d.type||"keyframes"==d.type)||")"==e&&("parens"==d.type||"atBlock_parens"==d.type)||"{"==e&&"at"==d.type)?(f=d.indent-O,d=d.prev):/(\})/.test(e)||(/@|\$|\d/.test(e)||/^\{/.test(b)||/^\s*\/(\/|\*)/.test(b)||/^\s*\/\*/.test(i)||/^\s*[\w-\.\[\]\'\"]+\s*(\?|:|\+)?=/i.test(b)||/^(\+|-)?[a-z][\w-]*\(/i.test(b)||/^return/.test(b)||B(g)?f=h:/(\.|#|:|\[|\*|&|>|~|\+|\/)/.test(e)||z(g)?f=/\,\s*$/.test(i)?j:/^\s+/.test(c)&&(/(\.|#|:|\[|\*|&|>|~|\+|\/)/.test(i)||z(i))?j>=h?j:j+O:h:/,\s*$/.test(c)||!C(g)&&!A(g)||(f=B(i)?j>=h?j:j+O:/^\{/.test(i)?j>=h?h:j+O:C(i)||A(i)?h>=j?j:h:/^(\.|#|:|\[|\*|&|@|\+|\-|>|~|\/)/.test(i)||/=\s*$/.test(i)||z(i)||/^\$[\w-\.\[\]\'\"]/.test(i)?j+O:h)),f},electricChars:"}",lineComment:"//",fold:"indent"}});var e=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","bgsound","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","nobr","noframes","noscript","object","ol","optgroup","option","output","p","param","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track","u","ul","var","video"],f=["domain","regexp","url","url-prefix"],g=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],h=["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid"],i=["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-position","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marker-offset","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-image-threshold","shape-inside","shape-margin","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","word-break","word-spacing","word-wrap","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode","font-smoothing","osx-font-smoothing"],j=["scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-3d-light-color","scrollbar-track-color","shape-inside","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","zoom"],k=["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"],l=["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],m=["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","attr","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","column","compact","condensed","contain","content","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","flex","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-table","inset","inside","intrinsic","invert","italic","japanese-formal","japanese-informal","justify","kannada","katakana","katakana-iroha","keep-all","khmer","korean-hangul-formal","korean-hanja-formal","korean-hanja-informal","landscape","lao","large","larger","left","level","lighter","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","malayalam","match","matrix","matrix3d","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","perspective","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row-resize","rtl","run-in","running","s-resize","sans-serif","scale","scale3d","scaleX","scaleY","scaleZ","scroll","scrollbar","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","simp-chinese-formal","simp-chinese-informal","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","solid","somali","source-atop","source-in","source-out","source-over","space","spell-out","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","symbolic","symbols","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","tamil","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","trad-chinese-formal","trad-chinese-informal","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","x-large","x-small","xor","xx-large","xx-small","bicubic","optimizespeed","grayscale"],n=["in","and","or","not","is not","is a","is","isnt","defined","if unless"],o=["for","if","else","unless","from","to"],p=["null","true","false","href","title","type","not-allowed","readonly","disabled"],q=["@font-face","@keyframes","@media","@viewport","@page","@host","@supports","@block","@css"],r=e.concat(f,g,h,i,j,l,m,k,n,o,p,q);a.registerHelper("hintWords","stylus",r),a.defineMIME("text/x-styl","stylus")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/tcl/tcl.min.js b/media/editors/codemirror/mode/tcl/tcl.min.js new file mode 100644 index 0000000000000..49b08311483d7 --- /dev/null +++ b/media/editors/codemirror/mode/tcl/tcl.min.js @@ -0,0 +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("tcl",function(){function a(a){for(var b={},c=a.split(" "),d=0;d!?^\/\|]/;return{startState:function(){return{tokenize:c,beforeParams:!1,inParams:!1}},token:function(a,b){return a.eatSpace()?null:b.tokenize(a,b)}}}),a.defineMIME("text/x-tcl","tcl")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/textile/test.js b/media/editors/codemirror/mode/textile/test.js deleted file mode 100644 index 49cdaf9c91e1b..0000000000000 --- a/media/editors/codemirror/mode/textile/test.js +++ /dev/null @@ -1,417 +0,0 @@ -// CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: http://codemirror.net/LICENSE - -(function() { - var mode = CodeMirror.getMode({tabSize: 4}, 'textile'); - function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); } - - MT('simpleParagraphs', - 'Some text.', - '', - 'Some more text.'); - - /* - * Phrase Modifiers - */ - - MT('em', - 'foo [em _bar_]'); - - MT('emBoogus', - 'code_mirror'); - - MT('strong', - 'foo [strong *bar*]'); - - MT('strongBogus', - '3 * 3 = 9'); - - MT('italic', - 'foo [em __bar__]'); - - MT('italicBogus', - 'code__mirror'); - - MT('bold', - 'foo [strong **bar**]'); - - MT('boldBogus', - '3 ** 3 = 27'); - - MT('simpleLink', - '[link "CodeMirror":http://codemirror.net]'); - - MT('referenceLink', - '[link "CodeMirror":code_mirror]', - 'Normal Text.', - '[link [[code_mirror]]http://codemirror.net]'); - - MT('footCite', - 'foo bar[qualifier [[1]]]'); - - MT('footCiteBogus', - 'foo bar[[1a2]]'); - - MT('special-characters', - 'Registered [tag (r)], ' + - 'Trademark [tag (tm)], and ' + - 'Copyright [tag (c)] 2008'); - - MT('cite', - "A book is [keyword ??The Count of Monte Cristo??] by Dumas."); - - MT('additionAndDeletion', - 'The news networks declared [negative -Al Gore-] ' + - '[positive +George W. Bush+] the winner in Florida.'); - - MT('subAndSup', - 'f(x, n) = log [builtin ~4~] x [builtin ^n^]'); - - MT('spanAndCode', - 'A [quote %span element%] and [atom @code element@]'); - - MT('spanBogus', - 'Percentage 25% is not a span.'); - - MT('citeBogus', - 'Question? is not a citation.'); - - MT('codeBogus', - 'user@example.com'); - - MT('subBogus', - '~username'); - - MT('supBogus', - 'foo ^ bar'); - - MT('deletionBogus', - '3 - 3 = 0'); - - MT('additionBogus', - '3 + 3 = 6'); - - MT('image', - 'An image: [string !http://www.example.com/image.png!]'); - - MT('imageWithAltText', - 'An image: [string !http://www.example.com/image.png (Alt Text)!]'); - - MT('imageWithUrl', - 'An image: [string !http://www.example.com/image.png!:http://www.example.com/]'); - - /* - * Headers - */ - - MT('h1', - '[header&header-1 h1. foo]'); - - MT('h2', - '[header&header-2 h2. foo]'); - - MT('h3', - '[header&header-3 h3. foo]'); - - MT('h4', - '[header&header-4 h4. foo]'); - - MT('h5', - '[header&header-5 h5. foo]'); - - MT('h6', - '[header&header-6 h6. foo]'); - - MT('h7Bogus', - 'h7. foo'); - - MT('multipleHeaders', - '[header&header-1 h1. Heading 1]', - '', - 'Some text.', - '', - '[header&header-2 h2. Heading 2]', - '', - 'More text.'); - - MT('h1inline', - '[header&header-1 h1. foo ][header&header-1&em _bar_][header&header-1 baz]'); - - /* - * Lists - */ - - MT('ul', - 'foo', - 'bar', - '', - '[variable-2 * foo]', - '[variable-2 * bar]'); - - MT('ulNoBlank', - 'foo', - 'bar', - '[variable-2 * foo]', - '[variable-2 * bar]'); - - MT('ol', - 'foo', - 'bar', - '', - '[variable-2 # foo]', - '[variable-2 # bar]'); - - MT('olNoBlank', - 'foo', - 'bar', - '[variable-2 # foo]', - '[variable-2 # bar]'); - - MT('ulFormatting', - '[variable-2 * ][variable-2&em _foo_][variable-2 bar]', - '[variable-2 * ][variable-2&strong *][variable-2&em&strong _foo_]' + - '[variable-2&strong *][variable-2 bar]', - '[variable-2 * ][variable-2&strong *foo*][variable-2 bar]'); - - MT('olFormatting', - '[variable-2 # ][variable-2&em _foo_][variable-2 bar]', - '[variable-2 # ][variable-2&strong *][variable-2&em&strong _foo_]' + - '[variable-2&strong *][variable-2 bar]', - '[variable-2 # ][variable-2&strong *foo*][variable-2 bar]'); - - MT('ulNested', - '[variable-2 * foo]', - '[variable-3 ** bar]', - '[keyword *** bar]', - '[variable-2 **** bar]', - '[variable-3 ** bar]'); - - MT('olNested', - '[variable-2 # foo]', - '[variable-3 ## bar]', - '[keyword ### bar]', - '[variable-2 #### bar]', - '[variable-3 ## bar]'); - - MT('ulNestedWithOl', - '[variable-2 * foo]', - '[variable-3 ## bar]', - '[keyword *** bar]', - '[variable-2 #### bar]', - '[variable-3 ** bar]'); - - MT('olNestedWithUl', - '[variable-2 # foo]', - '[variable-3 ** bar]', - '[keyword ### bar]', - '[variable-2 **** bar]', - '[variable-3 ## bar]'); - - MT('definitionList', - '[number - coffee := Hot ][number&em _and_][number black]', - '', - 'Normal text.'); - - MT('definitionListSpan', - '[number - coffee :=]', - '', - '[number Hot ][number&em _and_][number black =:]', - '', - 'Normal text.'); - - MT('boo', - '[number - dog := woof woof]', - '[number - cat := meow meow]', - '[number - whale :=]', - '[number Whale noises.]', - '', - '[number Also, ][number&em _splashing_][number . =:]'); - - /* - * Attributes - */ - - MT('divWithAttribute', - '[punctuation div][punctuation&attribute (#my-id)][punctuation . foo bar]'); - - MT('divWithAttributeAnd2emRightPadding', - '[punctuation div][punctuation&attribute (#my-id)((][punctuation . foo bar]'); - - MT('divWithClassAndId', - '[punctuation div][punctuation&attribute (my-class#my-id)][punctuation . foo bar]'); - - MT('paragraphWithCss', - 'p[attribute {color:red;}]. foo bar'); - - MT('paragraphNestedStyles', - 'p. [strong *foo ][strong&em _bar_][strong *]'); - - MT('paragraphWithLanguage', - 'p[attribute [[fr]]]. Parlez-vous français?'); - - MT('paragraphLeftAlign', - 'p[attribute <]. Left'); - - MT('paragraphRightAlign', - 'p[attribute >]. Right'); - - MT('paragraphRightAlign', - 'p[attribute =]. Center'); - - MT('paragraphJustified', - 'p[attribute <>]. Justified'); - - MT('paragraphWithLeftIndent1em', - 'p[attribute (]. Left'); - - MT('paragraphWithRightIndent1em', - 'p[attribute )]. Right'); - - MT('paragraphWithLeftIndent2em', - 'p[attribute ((]. Left'); - - MT('paragraphWithRightIndent2em', - 'p[attribute ))]. Right'); - - MT('paragraphWithLeftIndent3emRightIndent2em', - 'p[attribute ((())]. Right'); - - MT('divFormatting', - '[punctuation div. ][punctuation&strong *foo ]' + - '[punctuation&strong&em _bar_][punctuation&strong *]'); - - MT('phraseModifierAttributes', - 'p[attribute (my-class)]. This is a paragraph that has a class and' + - ' this [em _][em&attribute (#special-phrase)][em emphasized phrase_]' + - ' has an id.'); - - MT('linkWithClass', - '[link "(my-class). This is a link with class":http://redcloth.org]'); - - /* - * Layouts - */ - - MT('paragraphLayouts', - 'p. This is one paragraph.', - '', - 'p. This is another.'); - - MT('div', - '[punctuation div. foo bar]'); - - MT('pre', - '[operator pre. Text]'); - - MT('bq.', - '[bracket bq. foo bar]', - '', - 'Normal text.'); - - MT('footnote', - '[variable fn123. foo ][variable&strong *bar*]'); - - /* - * Spanning Layouts - */ - - MT('bq..ThenParagraph', - '[bracket bq.. foo bar]', - '', - '[bracket More quote.]', - 'p. Normal Text'); - - MT('bq..ThenH1', - '[bracket bq.. foo bar]', - '', - '[bracket More quote.]', - '[header&header-1 h1. Header Text]'); - - MT('bc..ThenParagraph', - '[atom bc.. # Some ruby code]', - '[atom obj = {foo: :bar}]', - '[atom puts obj]', - '', - '[atom obj[[:love]] = "*love*"]', - '[atom puts obj.love.upcase]', - '', - 'p. Normal text.'); - - MT('fn1..ThenParagraph', - '[variable fn1.. foo bar]', - '', - '[variable More.]', - 'p. Normal Text'); - - MT('pre..ThenParagraph', - '[operator pre.. foo bar]', - '', - '[operator More.]', - 'p. Normal Text'); - - /* - * Tables - */ - - MT('table', - '[variable-3&operator |_. name |_. age|]', - '[variable-3 |][variable-3&strong *Walter*][variable-3 | 5 |]', - '[variable-3 |Florence| 6 |]', - '', - 'p. Normal text.'); - - MT('tableWithAttributes', - '[variable-3&operator |_. name |_. age|]', - '[variable-3 |][variable-3&attribute /2.][variable-3 Jim |]', - '[variable-3 |][variable-3&attribute \\2{color: red}.][variable-3 Sam |]'); - - /* - * HTML - */ - - MT('html', - '[comment
    ]', - '[comment
    ]', - '', - '[header&header-1 h1. Welcome]', - '', - '[variable-2 * Item one]', - '[variable-2 * Item two]', - '', - '[comment Example]', - '', - '[comment
    ]', - '[comment
    ]'); - - MT('inlineHtml', - 'I can use HTML directly in my [comment Textile].'); - - /* - * No-Textile - */ - - MT('notextile', - '[string-2 notextile. *No* formatting]'); - - MT('notextileInline', - 'Use [string-2 ==*asterisks*==] for [strong *strong*] text.'); - - MT('notextileWithPre', - '[operator pre. *No* formatting]'); - - MT('notextileWithSpanningPre', - '[operator pre.. *No* formatting]', - '', - '[operator *No* formatting]'); - - /* Only toggling phrases between non-word chars. */ - - MT('phrase-in-word', - 'foo_bar_baz'); - - MT('phrase-non-word', - '[negative -x-] aaa-bbb ccc-ddd [negative -eee-] fff [negative -ggg-]'); - - MT('phrase-lone-dash', - 'foo - bar - baz'); -})(); diff --git a/media/editors/codemirror/mode/textile/textile.min.js b/media/editors/codemirror/mode/textile/textile.min.js new file mode 100644 index 0000000000000..77bd0badfa021 --- /dev/null +++ b/media/editors/codemirror/mode/textile/textile.min.js @@ -0,0 +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){b.mode=m.newLayout,b.tableHeading=!1,"definitionList"===b.layoutType&&b.spanningLayout&&a.match(j("definitionListEnd"),!1)&&(b.spanningLayout=!1)}function c(a,b,c){if("_"===c)return a.eat("_")?d(a,b,"italic",/__/,2):d(a,b,"em",/_/,1);if("*"===c)return a.eat("*")?d(a,b,"bold",/\*\*/,2):d(a,b,"strong",/\*/,1);if("["===c)return a.match(/\d+\]/)&&(b.footCite=!0),e(b);if("("===c){var f=a.match(/^(r|tm|c)\)/);if(f)return g(b,k.specialChar)}if("<"===c&&a.match(/(\w+)[^>]+>[^<]+<\/\1>/))return g(b,k.html);if("?"===c&&a.eat("?"))return d(a,b,"cite",/\?\?/,2);if("="===c&&a.eat("="))return d(a,b,"notextile",/==/,2);if("-"===c&&!a.eat("-"))return d(a,b,"deletion",/-/,1);if("+"===c)return d(a,b,"addition",/\+/,1);if("~"===c)return d(a,b,"sub",/~/,1);if("^"===c)return d(a,b,"sup",/\^/,1);if("%"===c)return d(a,b,"span",/%/,1);if("@"===c)return d(a,b,"code",/@/,1);if("!"===c){var h=d(a,b,"image",/(?:\([^\)]+\))?!/,1);return a.match(/^:\S+/),h}return e(b)}function d(a,b,c,d,f){var g=a.pos>f?a.string.charAt(a.pos-f-1):null,h=a.peek();if(b[c]){if((!h||/\W/.test(h))&&g&&/\S/.test(g)){var i=e(b);return b[c]=!1,i}}else(!g||/\W/.test(g))&&h&&/\S/.test(h)&&a.match(new RegExp("^.*\\S"+d.source+"(?:\\W|$)"),!1)&&(b[c]=!0,b.mode=m.attributes);return e(b)}function e(a){var b=f(a);if(b)return b;var c=[];return a.layoutType&&c.push(k[a.layoutType]),c=c.concat(h(a,"addition","bold","cite","code","deletion","em","footCite","image","italic","link","span","strong","sub","sup","table","tableHeading")),"header"===a.layoutType&&c.push(k.header+"-"+a.header),c.length?c.join(" "):null}function f(a){var b=a.layoutType;switch(b){case"notextile":case"code":case"pre":return k[b];default:return a.notextile?k.notextile+(b?" "+k[b]:""):null}}function g(a,b){var c=f(a);if(c)return c;var d=e(a);return b?d?d+" "+b:b:d}function h(a){for(var b=[],c=1;c]+)?>(?:[^<]+<\/\1>)?/,link:/[^"]+":\S/,linkDefinition:/\[[^\s\]]+\]\S+/,list:/(?:#+|\*+)/,notextile:"notextile",para:"p",pre:"pre",table:"table",tableCellAttributes:/[\/\\]\d+/,tableHeading:/\|_\./,tableText:/[^"_\*\[\(\?\+~\^%@|-]+/,text:/[^!"_=\*\[\(<\?\+~\^%@-]+/},attributes:{align:/(?:<>|<|>|=)/,selector:/\([^\(][^\)]+\)/,lang:/\[[^\[\]]+\]/,pad:/(?:\(+|\)+){1,2}/,css:/\{[^\}]+\}/},createRe:function(a){switch(a){case"drawTable":return l.makeRe("^",l.single.drawTable,"$");case"html":return l.makeRe("^",l.single.html,"(?:",l.single.html,")*","$");case"linkDefinition":return l.makeRe("^",l.single.linkDefinition,"$");case"listLayout":return l.makeRe("^",l.single.list,j("allAttributes"),"*\\s+");case"tableCellAttributes":return l.makeRe("^",l.choiceRe(l.single.tableCellAttributes,j("allAttributes")),"+\\.");case"type":return l.makeRe("^",j("allTypes"));case"typeLayout":return l.makeRe("^",j("allTypes"),j("allAttributes"),"*\\.\\.?","(\\s+|$)");case"attributes":return l.makeRe("^",j("allAttributes"),"+");case"allTypes":return l.choiceRe(l.single.div,l.single.foot,l.single.header,l.single.bc,l.single.bq,l.single.notextile,l.single.pre,l.single.table,l.single.para);case"allAttributes":return l.choiceRe(l.attributes.selector,l.attributes.css,l.attributes.lang,l.attributes.align,l.attributes.pad);default:return l.makeRe("^",l.single[a])}},makeRe:function(){for(var a="",b=0;b|]/.test(ch)) { if (ch == "!") { // tw header stream.skipToEnd(); - return ret("header", "header"); + return "header"; } if (ch == "*") { // tw list stream.eatWhile('*'); - return ret("list", "comment"); + return "comment"; } if (ch == "#") { // tw numbered list stream.eatWhile('#'); - return ret("list", "comment"); + return "comment"; } if (ch == ";") { // definition list, term stream.eatWhile(';'); - return ret("list", "comment"); + return "comment"; } if (ch == ":") { // definition list, description stream.eatWhile(':'); - return ret("list", "comment"); + return "comment"; } if (ch == ">") { // single line quote stream.eatWhile(">"); - return ret("quote", "quote"); + return "quote"; } if (ch == '|') { - return ret('table', 'header'); + return 'header'; } } @@ -146,29 +136,29 @@ CodeMirror.defineMode("tiddlywiki", function () { // rudimentary html:// file:// link matching. TW knows much more ... if (/[hf]/i.test(ch)) { if (/[ti]/i.test(stream.peek()) && stream.match(/\b(ttps?|tp|ile):\/\/[\-A-Z0-9+&@#\/%?=~_|$!:,.;]*[A-Z0-9+&@#\/%=~_|$]/i)) { - return ret("link", "link"); + return "link"; } } // just a little string indicator, don't want to have the whole string covered if (ch == '"') { - return ret('string', 'string'); + return 'string'; } if (ch == '~') { // _no_ CamelCase indicator should be bold - return ret('text', 'brace'); + return 'brace'; } if (/[\[\]]/.test(ch)) { // check for [[..]] if (stream.peek() == ch) { stream.next(); - return ret('brace', 'brace'); + return 'brace'; } } if (ch == "@") { // check for space link. TODO fix @@...@@ highlighting stream.eatWhile(isSpaceName); - return ret("link", "link"); + return "link"; } if (/\d/.test(ch)) { // numbers stream.eatWhile(/\d/); - return ret("number", "number"); + return "number"; } if (ch == "/") { // tw invisible comment if (stream.eat("%")) { @@ -191,7 +181,7 @@ CodeMirror.defineMode("tiddlywiki", function () { return chain(stream, state, twTokenStrike); // mdash if (stream.peek() == ' ') - return ret('text', 'brace'); + return 'brace'; } } if (ch == "'") { // tw bold @@ -205,7 +195,7 @@ CodeMirror.defineMode("tiddlywiki", function () { } } else { - return ret(ch); + return null; } // core macro handling @@ -213,8 +203,7 @@ CodeMirror.defineMode("tiddlywiki", function () { var word = stream.current(), known = textwords.propertyIsEnumerable(word) && textwords[word]; - return known ? ret(known.type, known.style, word) : ret("text", null, word); - + return known ? known.style : null; } // jsTokenBase() // tw invisible comment @@ -228,7 +217,7 @@ CodeMirror.defineMode("tiddlywiki", function () { } maybeEnd = (ch == "%"); } - return ret("comment", "comment"); + return "comment"; } // tw strong / bold @@ -242,29 +231,29 @@ CodeMirror.defineMode("tiddlywiki", function () { } maybeEnd = (ch == "'"); } - return ret("text", "strong"); + return "strong"; } // tw code function twTokenCode(stream, state) { - var ch, sb = state.block; + var sb = state.block; if (sb && stream.current()) { - return ret("code", "comment"); + return "comment"; } if (!sb && stream.match(reUntilCodeStop)) { state.tokenize = jsTokenBase; - return ret("code", "comment"); + return "comment"; } if (sb && stream.sol() && stream.match(reCodeBlockStop)) { state.tokenize = jsTokenBase; - return ret("code", "comment"); + return "comment"; } - ch = stream.next(); - return (sb) ? ret("code", "comment") : ret("code", "comment"); + stream.next(); + return "comment"; } // tw em / italic @@ -278,7 +267,7 @@ CodeMirror.defineMode("tiddlywiki", function () { } maybeEnd = (ch == "/"); } - return ret("text", "em"); + return "em"; } // tw underlined text @@ -292,7 +281,7 @@ CodeMirror.defineMode("tiddlywiki", function () { } maybeEnd = (ch == "_"); } - return ret("text", "underlined"); + return "underlined"; } // tw strike through text looks ugly @@ -307,7 +296,7 @@ CodeMirror.defineMode("tiddlywiki", function () { } maybeEnd = (ch == "-"); } - return ret("text", "strikethrough"); + return "strikethrough"; } // macro @@ -315,19 +304,19 @@ CodeMirror.defineMode("tiddlywiki", function () { var ch, word, known; if (stream.current() == '<<') { - return ret('brace', 'macro'); + return 'macro'; } ch = stream.next(); if (!ch) { state.tokenize = jsTokenBase; - return ret(ch); + return null; } if (ch == ">") { if (stream.peek() == '>') { stream.next(); state.tokenize = jsTokenBase; - return ret("brace", "macro"); + return "macro"; } } @@ -336,10 +325,10 @@ CodeMirror.defineMode("tiddlywiki", function () { known = keywords.propertyIsEnumerable(word) && keywords[word]; if (known) { - return ret(known.type, known.style, word); + return known.style, word; } else { - return ret("macro", null, word); + return null, word; } } diff --git a/media/editors/codemirror/mode/tiddlywiki/tiddlywiki.min.css b/media/editors/codemirror/mode/tiddlywiki/tiddlywiki.min.css new file mode 100644 index 0000000000000..0311c95514469 --- /dev/null +++ b/media/editors/codemirror/mode/tiddlywiki/tiddlywiki.min.css @@ -0,0 +1 @@ +span.cm-underlined{text-decoration:underline}span.cm-strikethrough{text-decoration:line-through}span.cm-brace{color:#170;font-weight:700}span.cm-table{color:#00f;font-weight:700} \ No newline at end of file diff --git a/media/editors/codemirror/mode/tiddlywiki/tiddlywiki.min.js b/media/editors/codemirror/mode/tiddlywiki/tiddlywiki.min.js new file mode 100644 index 0000000000000..320c35317d740 --- /dev/null +++ b/media/editors/codemirror/mode/tiddlywiki/tiddlywiki.min.js @@ -0,0 +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("tiddlywiki",function(){function a(a,b,c){return b.tokenize=c,c(a,b)}function b(b,k){var v,w=b.sol();if(k.block=!1,v=b.peek(),w&&/[<\/\*{}\-]/.test(v)){if(b.match(u))return k.block=!0,a(b,k,e);if(b.match(p))return"quote";if(b.match(n)||b.match(o))return"comment";if(b.match(q)||b.match(r)||b.match(s)||b.match(t))return"comment";if(b.match(m))return"hr"}if(v=b.next(),w&&/[\/\*!#;:>|]/.test(v)){if("!"==v)return b.skipToEnd(),"header";if("*"==v)return b.eatWhile("*"),"comment";if("#"==v)return b.eatWhile("#"),"comment";if(";"==v)return b.eatWhile(";"),"comment";if(":"==v)return b.eatWhile(":"),"comment";if(">"==v)return b.eatWhile(">"),"quote";if("|"==v)return"header"}if("{"==v&&b.match(/\{\{/))return a(b,k,e);if(/[hf]/i.test(v)&&/[ti]/i.test(b.peek())&&b.match(/\b(ttps?|tp|ile):\/\/[\-A-Z0-9+&@#\/%?=~_|$!:,.;]*[A-Z0-9+&@#\/%=~_|$]/i))return"link";if('"'==v)return"string";if("~"==v)return"brace";if(/[\[\]]/.test(v)&&b.peek()==v)return b.next(),"brace";if("@"==v)return b.eatWhile(l),"link";if(/\d/.test(v))return b.eatWhile(/\d/),"number";if("/"==v){if(b.eat("%"))return a(b,k,c);if(b.eat("/"))return a(b,k,f)}if("_"==v&&b.eat("_"))return a(b,k,g);if("-"==v&&b.eat("-")){if(" "!=b.peek())return a(b,k,h);if(" "==b.peek())return"brace"}if("'"==v&&b.eat("'"))return a(b,k,d);if("<"!=v)return null;if(b.eat("<"))return a(b,k,i);b.eatWhile(/[\w\$_]/);var x=b.current(),y=j.propertyIsEnumerable(x)&&j[x];return y?y.style:null}function c(a,c){for(var d,e=!1;d=a.next();){if("/"==d&&e){c.tokenize=b;break}e="%"==d}return"comment"}function d(a,c){for(var d,e=!1;d=a.next();){if("'"==d&&e){c.tokenize=b;break}e="'"==d}return"strong"}function e(a,c){var d=c.block;return d&&a.current()?"comment":!d&&a.match(w)?(c.tokenize=b,"comment"):d&&a.sol()&&a.match(v)?(c.tokenize=b,"comment"):(a.next(),"comment")}function f(a,c){for(var d,e=!1;d=a.next();){if("/"==d&&e){c.tokenize=b;break}e="/"==d}return"em"}function g(a,c){for(var d,e=!1;d=a.next();){if("_"==d&&e){c.tokenize=b;break}e="_"==d}return"underlined"}function h(a,c){for(var d,e=!1;d=a.next();){if("-"==d&&e){c.tokenize=b;break}e="-"==d}return"strikethrough"}function i(a,c){var d,e,f;return"<<"==a.current()?"macro":(d=a.next())?">"==d&&">"==a.peek()?(a.next(),c.tokenize=b,"macro"):(a.eatWhile(/[\w\$_]/),e=a.current(),f=k.propertyIsEnumerable(e)&&k[e],f?(f.style,e):e):(c.tokenize=b,null)}var j={},k=function(){function a(a){return{type:a,style:"macro"}}return{allTags:a("allTags"),closeAll:a("closeAll"),list:a("list"),newJournal:a("newJournal"),newTiddler:a("newTiddler"),permaview:a("permaview"),saveChanges:a("saveChanges"),search:a("search"),slider:a("slider"),tabs:a("tabs"),tag:a("tag"),tagging:a("tagging"),tags:a("tags"),tiddler:a("tiddler"),timeline:a("timeline"),today:a("today"),version:a("version"),option:a("option"),"with":a("with"),filter:a("filter")}}(),l=/[\w_\-]/i,m=/^\-\-\-\-+$/,n=/^\/\*\*\*$/,o=/^\*\*\*\/$/,p=/^<<<$/,q=/^\/\/\{\{\{$/,r=/^\/\/\}\}\}$/,s=/^$/,t=/^$/,u=/^\{\{\{$/,v=/^\}\}\}$/,w=/.*?\}\}\}/;return{startState:function(){return{tokenize:b,indented:0,level:0}},token:function(a,b){if(a.eatSpace())return null;var c=b.tokenize(a,b);return c},electricChars:""}}),a.defineMIME("text/x-tiddlywiki","tiddlywiki")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/tiki/tiki.js b/media/editors/codemirror/mode/tiki/tiki.js index c90aac9ec7588..5e05b1ff0149b 100644 --- a/media/editors/codemirror/mode/tiki/tiki.js +++ b/media/editors/codemirror/mode/tiki/tiki.js @@ -52,35 +52,27 @@ CodeMirror.defineMode('tiki', function(config) { case "{": //plugin stream.eat("/"); stream.eatSpace(); - var tagName = ""; - var c; - while ((c = stream.eat(/[^\s\u00a0=\"\'\/?(}]/))) tagName += c; + stream.eatWhile(/[^\s\u00a0=\"\'\/?(}]/); state.tokenize = inPlugin; return "tag"; - break; case "_": //bold - if (stream.eat("_")) { + if (stream.eat("_")) return chain(inBlock("strong", "__", inText)); - } break; case "'": //italics - if (stream.eat("'")) { - // Italic text + if (stream.eat("'")) return chain(inBlock("em", "''", inText)); - } break; case "(":// Wiki Link - if (stream.eat("(")) { + if (stream.eat("(")) return chain(inBlock("variable-2", "))", inText)); - } break; case "[":// Weblink return chain(inBlock("variable-3", "]", inText)); break; case "|": //table - if (stream.eat("|")) { + if (stream.eat("|")) return chain(inBlock("comment", "||")); - } break; case "-": if (stream.eat("=")) {//titleBar @@ -90,22 +82,19 @@ CodeMirror.defineMode('tiki', function(config) { } break; case "=": //underline - if (stream.match("==")) { + if (stream.match("==")) return chain(inBlock("tw-underline", "===", inText)); - } break; case ":": - if (stream.eat(":")) { + if (stream.eat(":")) return chain(inBlock("comment", "::")); - } break; case "^": //box return chain(inBlock("tw-box", "^")); break; case "~": //np - if (stream.match("np~")) { + if (stream.match("np~")) return chain(inBlock("meta", "~/np~")); - } break; } diff --git a/media/editors/codemirror/mode/tiki/tiki.min.css b/media/editors/codemirror/mode/tiki/tiki.min.css new file mode 100644 index 0000000000000..fdd7f4ac989f5 --- /dev/null +++ b/media/editors/codemirror/mode/tiki/tiki.min.css @@ -0,0 +1 @@ +.cm-tw-syntaxerror{color:#FFF;background-color:#900}.cm-tw-deleted{text-decoration:line-through}.cm-tw-header5{font-weight:700}.cm-tw-listitem:first-child{padding-left:10px}.cm-tw-box{border-top-width:0!important;border-style:solid;border-width:1px;border-color:inherit}.cm-tw-underline{text-decoration:underline} \ No newline at end of file diff --git a/media/editors/codemirror/mode/tiki/tiki.min.js b/media/editors/codemirror/mode/tiki/tiki.min.js new file mode 100644 index 0000000000000..4bff4d737ec85 --- /dev/null +++ b/media/editors/codemirror/mode/tiki/tiki.min.js @@ -0,0 +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("tiki",function(a){function b(a,b,c){return function(e,f){for(;!e.eol();){if(e.match(b)){f.tokenize=d;break}e.next()}return c&&(f.tokenize=c),a}}function c(a){return function(b,c){for(;!b.eol();)b.next();return c.tokenize=d,a}}function d(a,f){function g(b){return f.tokenize=b,b(a,f)}var h=a.sol(),i=a.next();switch(i){case"{":return a.eat("/"),a.eatSpace(),a.eatWhile(/[^\s\u00a0=\"\'\/?(}]/),f.tokenize=e,"tag";case"_":if(a.eat("_"))return g(b("strong","__",d));break;case"'":if(a.eat("'"))return g(b("em","''",d));break;case"(":if(a.eat("("))return g(b("variable-2","))",d));break;case"[":return g(b("variable-3","]",d));case"|":if(a.eat("|"))return g(b("comment","||"));break;case"-":if(a.eat("="))return g(b("header string","=-",d));if(a.eat("-"))return g(b("error tw-deleted","--",d));break;case"=":if(a.match("=="))return g(b("tw-underline","===",d));break;case":":if(a.eat(":"))return g(b("comment","::"));break;case"^":return g(b("tw-box","^"));case"~":if(a.match("np~"))return g(b("meta","~/np~"))}if(h)switch(i){case"!":return g(a.match("!!!!!")?c("header string"):a.match("!!!!")?c("header string"):a.match("!!!")?c("header string"):a.match("!!")?c("header string"):c("header string"));case"*":case"#":case"+":return g(c("tw-listitem bracket"))}return null}function e(a,b){var c=a.next(),e=a.peek();return"}"==c?(b.tokenize=d,"tag"):"("==c||")"==c?"bracket":"="==c?(s="equals",">"==e&&(c=a.next(),e=a.peek()),/[\'\"]/.test(e)||(b.tokenize=g()),"operator"):/[\'\"]/.test(c)?(b.tokenize=f(c),b.tokenize(a,b)):(a.eatWhile(/[^\s\u00a0=\"\'\/?]/),"keyword")}function f(a){return function(b,c){for(;!b.eol();)if(b.next()==a){c.tokenize=e;break}return"string"}}function g(){return function(a,b){for(;!a.eol();){var c=a.next(),d=a.peek();if(" "==c||","==c||/[ )}]/.test(d)){b.tokenize=e;break}}return"string"}}function h(){for(var a=arguments.length-1;a>=0;a--)t.cc.push(arguments[a])}function i(){return h.apply(null,arguments),!0}function j(a,b){var c=t.context&&t.context.noIndent;t.context={prev:t.context,pluginName:a,indent:t.indented,startOfLine:b,noIndent:c}}function k(){t.context&&(t.context=t.context.prev)}function l(a){if("openPlugin"==a)return t.pluginName=r,i(o,m(t.startOfLine));if("closePlugin"==a){var b=!1;return t.context?(b=t.context.pluginName!=r,k()):b=!0,b&&(u="error"),i(n(b))}return"string"==a?(t.context&&"!cdata"==t.context.name||j("!cdata"),t.tokenize==d&&k(),i()):i()}function m(a){return function(b){return"selfclosePlugin"==b||"endPlugin"==b?i():"endPlugin"==b?(j(t.pluginName,a),i()):i()}}function n(a){return function(b){return a&&(u="error"),"endPlugin"==b?i():h()}}function o(a){return"keyword"==a?(u="attribute",i(o)):"equals"==a?i(p,o):h()}function p(a){return"keyword"==a?(u="string",i()):"string"==a?i(q):h()}function q(a){return"string"==a?i(q):h()}var r,s,t,u,v=a.indentUnit;return{startState:function(){return{tokenize:d,cc:[],indented:0,startOfLine:!0,pluginName:null,context:null}},token:function(a,b){if(a.sol()&&(b.startOfLine=!0,b.indented=a.indentation()),a.eatSpace())return null;u=s=r=null;var c=b.tokenize(a,b);if((c||s)&&"comment"!=c)for(t=b;;){var d=b.cc.pop()||l;if(d(s||c))break}return b.startOfLine=!1,u||c},indent:function(a,b){var c=a.context;if(c&&c.noIndent)return 0;for(c&&/^{\//.test(b)&&(c=c.prev);c&&!c.startOfLine;)c=c.prev;return c?c.indent+v:0},electricChars:"/"}}),a.defineMIME("text/tiki","tiki")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/toml/toml.min.js b/media/editors/codemirror/mode/toml/toml.min.js new file mode 100644 index 0000000000000..e6e3e2bce0a5d --- /dev/null +++ b/media/editors/codemirror/mode/toml/toml.min.js @@ -0,0 +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("toml",function(){return{startState:function(){return{inString:!1,stringType:"",lhs:!0,inArray:0}},token:function(a,b){if(b.inString||'"'!=a.peek()&&"'"!=a.peek()||(b.stringType=a.peek(),a.next(),b.inString=!0),a.sol()&&0===b.inArray&&(b.lhs=!0),b.inString){for(;b.inString&&!a.eol();)a.peek()===b.stringType?(a.next(),b.inString=!1):"\\"===a.peek()?(a.next(),a.next()):a.match(/^.[^\\\"\']*/);return b.lhs?"property string":"string"}return b.inArray&&"]"===a.peek()?(a.next(),b.inArray--,"bracket"):b.lhs&&"["===a.peek()&&a.skipTo("]")?(a.next(),"]"===a.peek()&&a.next(),"atom"):"#"===a.peek()?(a.skipToEnd(),"comment"):a.eatSpace()?null:b.lhs&&a.eatWhile(function(a){return"="!=a&&" "!=a})?"property":b.lhs&&"="===a.peek()?(a.next(),b.lhs=!1,null):!b.lhs&&a.match(/^\d\d\d\d[\d\-\:\.T]*Z/)?"atom":b.lhs||!a.match("true")&&!a.match("false")?b.lhs||"["!==a.peek()?!b.lhs&&a.match(/^\-?\d+(?:\.\d+)?/)?"number":(a.eatSpace()||a.next(),null):(b.inArray++,a.next(),"bracket"):"atom"}}}),a.defineMIME("text/x-toml","toml")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/tornado/tornado.min.js b/media/editors/codemirror/mode/tornado/tornado.min.js new file mode 100644 index 0000000000000..7677ff9861a91 --- /dev/null +++ b/media/editors/codemirror/mode/tornado/tornado.min.js @@ -0,0 +1 @@ +!function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("../htmlmixed/htmlmixed"),require("../../addon/mode/overlay")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../htmlmixed/htmlmixed","../../addon/mode/overlay"],a):a(CodeMirror)}(function(a){"use strict";a.defineMode("tornado:inner",function(){function a(a,c){a.eatWhile(/[^\{]/);var d=a.next();return"{"==d&&(d=a.eat(/\{|%|#/))?(c.tokenize=b(d),"tag"):void 0}function b(b){return"{"==b&&(b="}"),function(d,e){var f=d.next();return f==b&&d.eat("}")?(e.tokenize=a,"tag"):d.match(c)?"keyword":"#"==b?"comment":"string"}}var c=["and","as","assert","autoescape","block","break","class","comment","context","continue","datetime","def","del","elif","else","end","escape","except","exec","extends","false","finally","for","from","global","if","import","in","include","is","json_encode","lambda","length","linkify","load","module","none","not","or","pass","print","put","raise","raw","return","self","set","squeeze","super","true","try","url_escape","while","with","without","xhtml_escape","yield"];return c=new RegExp("^(("+c.join(")|(")+"))\\b"),{startState:function(){return{tokenize:a}},token:function(a,b){return b.tokenize(a,b)}}}),a.defineMode("tornado",function(b){var c=a.getMode(b,"text/html"),d=a.getMode(b,"tornado:inner");return a.overlayMode(c,d)}),a.defineMIME("text/x-tornado","tornado")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/troff/troff.js b/media/editors/codemirror/mode/troff/troff.js new file mode 100644 index 0000000000000..beca778eeb3d6 --- /dev/null +++ b/media/editors/codemirror/mode/troff/troff.js @@ -0,0 +1,82 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) + define(["../../lib/codemirror"], mod); + else + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.defineMode('troff', function() { + + var words = {}; + + function tokenBase(stream) { + if (stream.eatSpace()) return null; + + var sol = stream.sol(); + var ch = stream.next(); + + if (ch === '\\') { + if (stream.match('fB') || stream.match('fR') || stream.match('fI') || + stream.match('u') || stream.match('d') || + stream.match('%') || stream.match('&')) { + return 'string'; + } + if (stream.match('m[')) { + stream.skipTo(']'); + stream.next(); + return 'string'; + } + if (stream.match('s+') || stream.match('s-')) { + stream.eatWhile(/[\d-]/); + return 'string'; + } + if (stream.match('\(') || stream.match('*\(')) { + stream.eatWhile(/[\w-]/); + return 'string'; + } + return 'string'; + } + if (sol && (ch === '.' || ch === '\'')) { + if (stream.eat('\\') && stream.eat('\"')) { + stream.skipToEnd(); + return 'comment'; + } + } + if (sol && ch === '.') { + if (stream.match('B ') || stream.match('I ') || stream.match('R ')) { + return 'attribute'; + } + if (stream.match('TH ') || stream.match('SH ') || stream.match('SS ') || stream.match('HP ')) { + stream.skipToEnd(); + return 'quote'; + } + if ((stream.match(/[A-Z]/) && stream.match(/[A-Z]/)) || (stream.match(/[a-z]/) && stream.match(/[a-z]/))) { + return 'attribute'; + } + } + stream.eatWhile(/[\w-]/); + var cur = stream.current(); + return words.hasOwnProperty(cur) ? words[cur] : null; + } + + function tokenize(stream, state) { + return (state.tokens[0] || tokenBase) (stream, state); + }; + + return { + startState: function() {return {tokens:[]};}, + token: function(stream, state) { + return tokenize(stream, state); + } + }; +}); + +CodeMirror.defineMIME('troff', 'troff'); + +}); diff --git a/media/editors/codemirror/mode/troff/troff.min.js b/media/editors/codemirror/mode/troff/troff.min.js new file mode 100644 index 0000000000000..3fd43538d61b7 --- /dev/null +++ b/media/editors/codemirror/mode/troff/troff.min.js @@ -0,0 +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("troff",function(){function a(a){if(a.eatSpace())return null;var b=a.sol(),d=a.next();if("\\"===d)return a.match("fB")||a.match("fR")||a.match("fI")||a.match("u")||a.match("d")||a.match("%")||a.match("&")?"string":a.match("m[")?(a.skipTo("]"),a.next(),"string"):a.match("s+")||a.match("s-")?(a.eatWhile(/[\d-]/),"string"):a.match("(")||a.match("*(")?(a.eatWhile(/[\w-]/),"string"):"string";if(b&&("."===d||"'"===d)&&a.eat("\\")&&a.eat('"'))return a.skipToEnd(),"comment";if(b&&"."===d){if(a.match("B ")||a.match("I ")||a.match("R "))return"attribute";if(a.match("TH ")||a.match("SH ")||a.match("SS ")||a.match("HP "))return a.skipToEnd(),"quote";if(a.match(/[A-Z]/)&&a.match(/[A-Z]/)||a.match(/[a-z]/)&&a.match(/[a-z]/))return"attribute"}a.eatWhile(/[\w-]/);var e=a.current();return c.hasOwnProperty(e)?c[e]:null}function b(b,c){return(c.tokens[0]||a)(b,c)}var c={};return{startState:function(){return{tokens:[]}},token:function(a,c){return b(a,c)}}}),a.defineMIME("troff","troff")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/ttcn-cfg/ttcn-cfg.js b/media/editors/codemirror/mode/ttcn-cfg/ttcn-cfg.js new file mode 100644 index 0000000000000..e10805119c17c --- /dev/null +++ b/media/editors/codemirror/mode/ttcn-cfg/ttcn-cfg.js @@ -0,0 +1,214 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + CodeMirror.defineMode("ttcn-cfg", function(config, parserConfig) { + var indentUnit = config.indentUnit, + keywords = parserConfig.keywords || {}, + fileNCtrlMaskOptions = parserConfig.fileNCtrlMaskOptions || {}, + externalCommands = parserConfig.externalCommands || {}, + multiLineStrings = parserConfig.multiLineStrings, + indentStatements = parserConfig.indentStatements !== false; + var isOperatorChar = /[\|]/; + var curPunc; + + function tokenBase(stream, state) { + var ch = stream.next(); + if (ch == '"' || ch == "'") { + state.tokenize = tokenString(ch); + return state.tokenize(stream, state); + } + if (/[:=]/.test(ch)) { + curPunc = ch; + return "punctuation"; + } + if (ch == "#"){ + stream.skipToEnd(); + return "comment"; + } + if (/\d/.test(ch)) { + stream.eatWhile(/[\w\.]/); + return "number"; + } + if (isOperatorChar.test(ch)) { + stream.eatWhile(isOperatorChar); + return "operator"; + } + if (ch == "["){ + stream.eatWhile(/[\w_\]]/); + return "number sectionTitle"; + } + + stream.eatWhile(/[\w\$_]/); + var cur = stream.current(); + if (keywords.propertyIsEnumerable(cur)) return "keyword"; + if (fileNCtrlMaskOptions.propertyIsEnumerable(cur)) + return "negative fileNCtrlMaskOptions"; + if (externalCommands.propertyIsEnumerable(cur)) return "negative externalCommands"; + + return "variable"; + } + + function tokenString(quote) { + return function(stream, state) { + var escaped = false, next, end = false; + while ((next = stream.next()) != null) { + if (next == quote && !escaped){ + var afterNext = stream.peek(); + //look if the character if the quote is like the B in '10100010'B + if (afterNext){ + afterNext = afterNext.toLowerCase(); + if(afterNext == "b" || afterNext == "h" || afterNext == "o") + stream.next(); + } + end = true; break; + } + escaped = !escaped && next == "\\"; + } + if (end || !(escaped || multiLineStrings)) + state.tokenize = null; + return "string"; + }; + } + + function Context(indented, column, type, align, prev) { + this.indented = indented; + this.column = column; + this.type = type; + this.align = align; + this.prev = prev; + } + function pushContext(state, col, type) { + var indent = state.indented; + if (state.context && state.context.type == "statement") + indent = state.context.indented; + return state.context = new Context(indent, col, type, null, state.context); + } + function popContext(state) { + var t = state.context.type; + if (t == ")" || t == "]" || t == "}") + state.indented = state.context.indented; + return state.context = state.context.prev; + } + + //Interface + return { + startState: function(basecolumn) { + return { + tokenize: null, + context: new Context((basecolumn || 0) - indentUnit, 0, "top", false), + indented: 0, + startOfLine: true + }; + }, + + token: function(stream, state) { + var ctx = state.context; + if (stream.sol()) { + if (ctx.align == null) ctx.align = false; + state.indented = stream.indentation(); + state.startOfLine = true; + } + if (stream.eatSpace()) return null; + curPunc = null; + var style = (state.tokenize || tokenBase)(stream, state); + if (style == "comment") return style; + if (ctx.align == null) ctx.align = true; + + if ((curPunc == ";" || curPunc == ":" || curPunc == ",") + && ctx.type == "statement"){ + popContext(state); + } + else if (curPunc == "{") pushContext(state, stream.column(), "}"); + else if (curPunc == "[") pushContext(state, stream.column(), "]"); + else if (curPunc == "(") pushContext(state, stream.column(), ")"); + else if (curPunc == "}") { + while (ctx.type == "statement") ctx = popContext(state); + if (ctx.type == "}") ctx = popContext(state); + while (ctx.type == "statement") ctx = popContext(state); + } + else if (curPunc == ctx.type) popContext(state); + else if (indentStatements && (((ctx.type == "}" || ctx.type == "top") + && curPunc != ';') || (ctx.type == "statement" + && curPunc == "newstatement"))) + pushContext(state, stream.column(), "statement"); + state.startOfLine = false; + return style; + }, + + electricChars: "{}", + lineComment: "#", + fold: "brace" + }; + }); + + function words(str) { + var obj = {}, words = str.split(" "); + for (var i = 0; i < words.length; ++i) + obj[words[i]] = true; + return obj; + } + + CodeMirror.defineMIME("text/x-ttcn-cfg", { + name: "ttcn-cfg", + keywords: words("Yes No LogFile FileMask ConsoleMask AppendFile" + + " TimeStampFormat LogEventTypes SourceInfoFormat" + + " LogEntityName LogSourceInfo DiskFullAction" + + " LogFileNumber LogFileSize MatchingHints Detailed" + + " Compact SubCategories Stack Single None Seconds" + + " DateTime Time Stop Error Retry Delete TCPPort KillTimer" + + " NumHCs UnixSocketsEnabled LocalAddress"), + fileNCtrlMaskOptions: words("TTCN_EXECUTOR TTCN_ERROR TTCN_WARNING" + + " TTCN_PORTEVENT TTCN_TIMEROP TTCN_VERDICTOP" + + " TTCN_DEFAULTOP TTCN_TESTCASE TTCN_ACTION" + + " TTCN_USER TTCN_FUNCTION TTCN_STATISTICS" + + " TTCN_PARALLEL TTCN_MATCHING TTCN_DEBUG" + + " EXECUTOR ERROR WARNING PORTEVENT TIMEROP" + + " VERDICTOP DEFAULTOP TESTCASE ACTION USER" + + " FUNCTION STATISTICS PARALLEL MATCHING DEBUG" + + " LOG_ALL LOG_NOTHING ACTION_UNQUALIFIED" + + " DEBUG_ENCDEC DEBUG_TESTPORT" + + " DEBUG_UNQUALIFIED DEFAULTOP_ACTIVATE" + + " DEFAULTOP_DEACTIVATE DEFAULTOP_EXIT" + + " DEFAULTOP_UNQUALIFIED ERROR_UNQUALIFIED" + + " EXECUTOR_COMPONENT EXECUTOR_CONFIGDATA" + + " EXECUTOR_EXTCOMMAND EXECUTOR_LOGOPTIONS" + + " EXECUTOR_RUNTIME EXECUTOR_UNQUALIFIED" + + " FUNCTION_RND FUNCTION_UNQUALIFIED" + + " MATCHING_DONE MATCHING_MCSUCCESS" + + " MATCHING_MCUNSUCC MATCHING_MMSUCCESS" + + " MATCHING_MMUNSUCC MATCHING_PCSUCCESS" + + " MATCHING_PCUNSUCC MATCHING_PMSUCCESS" + + " MATCHING_PMUNSUCC MATCHING_PROBLEM" + + " MATCHING_TIMEOUT MATCHING_UNQUALIFIED" + + " PARALLEL_PORTCONN PARALLEL_PORTMAP" + + " PARALLEL_PTC PARALLEL_UNQUALIFIED" + + " PORTEVENT_DUALRECV PORTEVENT_DUALSEND" + + " PORTEVENT_MCRECV PORTEVENT_MCSEND" + + " PORTEVENT_MMRECV PORTEVENT_MMSEND" + + " PORTEVENT_MQUEUE PORTEVENT_PCIN" + + " PORTEVENT_PCOUT PORTEVENT_PMIN" + + " PORTEVENT_PMOUT PORTEVENT_PQUEUE" + + " PORTEVENT_STATE PORTEVENT_UNQUALIFIED" + + " STATISTICS_UNQUALIFIED STATISTICS_VERDICT" + + " TESTCASE_FINISH TESTCASE_START" + + " TESTCASE_UNQUALIFIED TIMEROP_GUARD" + + " TIMEROP_READ TIMEROP_START TIMEROP_STOP" + + " TIMEROP_TIMEOUT TIMEROP_UNQUALIFIED" + + " USER_UNQUALIFIED VERDICTOP_FINAL" + + " VERDICTOP_GETVERDICT VERDICTOP_SETVERDICT" + + " VERDICTOP_UNQUALIFIED WARNING_UNQUALIFIED"), + externalCommands: words("BeginControlPart EndControlPart BeginTestCase" + + " EndTestCase"), + multiLineStrings: true + }); +}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/ttcn-cfg/ttcn-cfg.min.js b/media/editors/codemirror/mode/ttcn-cfg/ttcn-cfg.min.js new file mode 100644 index 0000000000000..9903f745e0a18 --- /dev/null +++ b/media/editors/codemirror/mode/ttcn-cfg/ttcn-cfg.min.js @@ -0,0 +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){for(var b={},c=a.split(" "),d=0;d!\/]/; + var curPunc; + + function tokenBase(stream, state) { + var ch = stream.next(); + + if (ch == '"' || ch == "'") { + state.tokenize = tokenString(ch); + return state.tokenize(stream, state); + } + if (/[\[\]{}\(\),;\\:\?\.]/.test(ch)) { + curPunc = ch; + return "punctuation"; + } + if (ch == "#"){ + stream.skipToEnd(); + return "atom preprocessor"; + } + if (ch == "%"){ + stream.eatWhile(/\b/); + return "atom ttcn3Macros"; + } + if (/\d/.test(ch)) { + stream.eatWhile(/[\w\.]/); + return "number"; + } + if (ch == "/") { + if (stream.eat("*")) { + state.tokenize = tokenComment; + return tokenComment(stream, state); + } + if (stream.eat("/")) { + stream.skipToEnd(); + return "comment"; + } + } + if (isOperatorChar.test(ch)) { + if(ch == "@"){ + if(stream.match("try") || stream.match("catch") + || stream.match("lazy")){ + return "keyword"; + } + } + stream.eatWhile(isOperatorChar); + return "operator"; + } + stream.eatWhile(/[\w\$_\xa1-\uffff]/); + var cur = stream.current(); + + if (keywords.propertyIsEnumerable(cur)) return "keyword"; + if (builtin.propertyIsEnumerable(cur)) return "builtin"; + + if (timerOps.propertyIsEnumerable(cur)) return "def timerOps"; + if (configOps.propertyIsEnumerable(cur)) return "def configOps"; + if (verdictOps.propertyIsEnumerable(cur)) return "def verdictOps"; + if (portOps.propertyIsEnumerable(cur)) return "def portOps"; + if (sutOps.propertyIsEnumerable(cur)) return "def sutOps"; + if (functionOps.propertyIsEnumerable(cur)) return "def functionOps"; + + if (verdictConsts.propertyIsEnumerable(cur)) return "string verdictConsts"; + if (booleanConsts.propertyIsEnumerable(cur)) return "string booleanConsts"; + if (otherConsts.propertyIsEnumerable(cur)) return "string otherConsts"; + + if (types.propertyIsEnumerable(cur)) return "builtin types"; + if (visibilityModifiers.propertyIsEnumerable(cur)) + return "builtin visibilityModifiers"; + if (templateMatch.propertyIsEnumerable(cur)) return "atom templateMatch"; + + return "variable"; + } + + function tokenString(quote) { + return function(stream, state) { + var escaped = false, next, end = false; + while ((next = stream.next()) != null) { + if (next == quote && !escaped){ + var afterQuote = stream.peek(); + //look if the character after the quote is like the B in '10100010'B + if (afterQuote){ + afterQuote = afterQuote.toLowerCase(); + if(afterQuote == "b" || afterQuote == "h" || afterQuote == "o") + stream.next(); + } + end = true; break; + } + escaped = !escaped && next == "\\"; + } + if (end || !(escaped || multiLineStrings)) + state.tokenize = null; + return "string"; + }; + } + + function tokenComment(stream, state) { + var maybeEnd = false, ch; + while (ch = stream.next()) { + if (ch == "/" && maybeEnd) { + state.tokenize = null; + break; + } + maybeEnd = (ch == "*"); + } + return "comment"; + } + + function Context(indented, column, type, align, prev) { + this.indented = indented; + this.column = column; + this.type = type; + this.align = align; + this.prev = prev; + } + + function pushContext(state, col, type) { + var indent = state.indented; + if (state.context && state.context.type == "statement") + indent = state.context.indented; + return state.context = new Context(indent, col, type, null, state.context); + } + + function popContext(state) { + var t = state.context.type; + if (t == ")" || t == "]" || t == "}") + state.indented = state.context.indented; + return state.context = state.context.prev; + } + + //Interface + return { + startState: function(basecolumn) { + return { + tokenize: null, + context: new Context((basecolumn || 0) - indentUnit, 0, "top", false), + indented: 0, + startOfLine: true + }; + }, + + token: function(stream, state) { + var ctx = state.context; + if (stream.sol()) { + if (ctx.align == null) ctx.align = false; + state.indented = stream.indentation(); + state.startOfLine = true; + } + if (stream.eatSpace()) return null; + curPunc = null; + var style = (state.tokenize || tokenBase)(stream, state); + if (style == "comment") return style; + if (ctx.align == null) ctx.align = true; + + if ((curPunc == ";" || curPunc == ":" || curPunc == ",") + && ctx.type == "statement"){ + popContext(state); + } + else if (curPunc == "{") pushContext(state, stream.column(), "}"); + else if (curPunc == "[") pushContext(state, stream.column(), "]"); + else if (curPunc == "(") pushContext(state, stream.column(), ")"); + else if (curPunc == "}") { + while (ctx.type == "statement") ctx = popContext(state); + if (ctx.type == "}") ctx = popContext(state); + while (ctx.type == "statement") ctx = popContext(state); + } + else if (curPunc == ctx.type) popContext(state); + else if (indentStatements && + (((ctx.type == "}" || ctx.type == "top") && curPunc != ';') || + (ctx.type == "statement" && curPunc == "newstatement"))) + pushContext(state, stream.column(), "statement"); + + state.startOfLine = false; + + return style; + }, + + electricChars: "{}", + blockCommentStart: "/*", + blockCommentEnd: "*/", + lineComment: "//", + fold: "brace" + }; + }); + + function words(str) { + var obj = {}, words = str.split(" "); + for (var i = 0; i < words.length; ++i) obj[words[i]] = true; + return obj; + } + + function def(mimes, mode) { + if (typeof mimes == "string") mimes = [mimes]; + var words = []; + function add(obj) { + if (obj) for (var prop in obj) if (obj.hasOwnProperty(prop)) + words.push(prop); + } + + add(mode.keywords); + add(mode.builtin); + add(mode.timerOps); + add(mode.portOps); + + if (words.length) { + mode.helperType = mimes[0]; + CodeMirror.registerHelper("hintWords", mimes[0], words); + } + + for (var i = 0; i < mimes.length; ++i) + CodeMirror.defineMIME(mimes[i], mode); + } + + def(["text/x-ttcn", "text/x-ttcn3", "text/x-ttcnpp"], { + name: "ttcn", + keywords: words("activate address alive all alt altstep and and4b any" + + " break case component const continue control deactivate" + + " display do else encode enumerated except exception" + + " execute extends extension external for from function" + + " goto group if import in infinity inout interleave" + + " label language length log match message mixed mod" + + " modifies module modulepar mtc noblock not not4b nowait" + + " of on optional or or4b out override param pattern port" + + " procedure record recursive rem repeat return runs select" + + " self sender set signature system template testcase to" + + " type union value valueof var variant while with xor xor4b"), + builtin: words("bit2hex bit2int bit2oct bit2str char2int char2oct encvalue" + + " decomp decvalue float2int float2str hex2bit hex2int" + + " hex2oct hex2str int2bit int2char int2float int2hex" + + " int2oct int2str int2unichar isbound ischosen ispresent" + + " isvalue lengthof log2str oct2bit oct2char oct2hex oct2int" + + " oct2str regexp replace rnd sizeof str2bit str2float" + + " str2hex str2int str2oct substr unichar2int unichar2char" + + " enum2int"), + types: words("anytype bitstring boolean char charstring default float" + + " hexstring integer objid octetstring universal verdicttype timer"), + timerOps: words("read running start stop timeout"), + portOps: words("call catch check clear getcall getreply halt raise receive" + + " reply send trigger"), + configOps: words("create connect disconnect done kill killed map unmap"), + verdictOps: words("getverdict setverdict"), + sutOps: words("action"), + functionOps: words("apply derefers refers"), + + verdictConsts: words("error fail inconc none pass"), + booleanConsts: words("true false"), + otherConsts: words("null NULL omit"), + + visibilityModifiers: words("private public friend"), + templateMatch: words("complement ifpresent subset superset permutation"), + multiLineStrings: true + }); +}); diff --git a/media/editors/codemirror/mode/ttcn/ttcn.min.js b/media/editors/codemirror/mode/ttcn/ttcn.min.js new file mode 100644 index 0000000000000..afa666da9a68e --- /dev/null +++ b/media/editors/codemirror/mode/ttcn/ttcn.min.js @@ -0,0 +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){for(var b={},c=a.split(" "),d=0;d!\/]/;return{startState:function(a){return{tokenize:null,context:new f((a||0)-j,0,"top",!1),indented:0,startOfLine:!0}},token:function(a,b){var d=b.context;if(a.sol()&&(null==d.align&&(d.align=!1),b.indented=a.indentation(),b.startOfLine=!0),a.eatSpace())return null;i=null;var e=(b.tokenize||c)(a,b);if("comment"==e)return e;if(null==d.align&&(d.align=!0),";"!=i&&":"!=i&&","!=i||"statement"!=d.type)if("{"==i)g(b,a.column(),"}");else if("["==i)g(b,a.column(),"]");else if("("==i)g(b,a.column(),")");else if("}"==i){for(;"statement"==d.type;)d=h(b);for("}"==d.type&&(d=h(b));"statement"==d.type;)d=h(b)}else i==d.type?h(b):z&&(("}"==d.type||"top"==d.type)&&";"!=i||"statement"==d.type&&"newstatement"==i)&&g(b,a.column(),"statement");else h(b);return b.startOfLine=!1,e},electricChars:"{}",blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",fold:"brace"}}),c(["text/x-ttcn","text/x-ttcn3","text/x-ttcnpp"],{name:"ttcn",keywords:b("activate address alive all alt altstep and and4b any break case component const continue control deactivate display do else encode enumerated except exception execute extends extension external for from function goto group if import in infinity inout interleave label language length log match message mixed mod modifies module modulepar mtc noblock not not4b nowait of on optional or or4b out override param pattern port procedure record recursive rem repeat return runs select self sender set signature system template testcase to type union value valueof var variant while with xor xor4b"),builtin:b("bit2hex bit2int bit2oct bit2str char2int char2oct encvalue decomp decvalue float2int float2str hex2bit hex2int hex2oct hex2str int2bit int2char int2float int2hex int2oct int2str int2unichar isbound ischosen ispresent isvalue lengthof log2str oct2bit oct2char oct2hex oct2int oct2str regexp replace rnd sizeof str2bit str2float str2hex str2int str2oct substr unichar2int unichar2char enum2int"),types:b("anytype bitstring boolean char charstring default float hexstring integer objid octetstring universal verdicttype timer"),timerOps:b("read running start stop timeout"),portOps:b("call catch check clear getcall getreply halt raise receive reply send trigger"),configOps:b("create connect disconnect done kill killed map unmap"),verdictOps:b("getverdict setverdict"),sutOps:b("action"),functionOps:b("apply derefers refers"),verdictConsts:b("error fail inconc none pass"),booleanConsts:b("true false"),otherConsts:b("null NULL omit"),visibilityModifiers:b("private public friend"),templateMatch:b("complement ifpresent subset superset permutation"),multiLineStrings:!0})}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/turtle/turtle.min.js b/media/editors/codemirror/mode/turtle/turtle.min.js new file mode 100644 index 0000000000000..e3df23e2ca9c7 --- /dev/null +++ b/media/editors/codemirror/mode/turtle/turtle.min.js @@ -0,0 +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("turtle",function(a){function b(a){return new RegExp("^(?:"+a.join("|")+")$","i")}function c(a,b){var c=a.next();if(g=null,"<"==c&&!a.match(/^[\s\u00a0=]/,!1))return a.match(/^[^\s\u00a0>]*>?/),"atom";if('"'==c||"'"==c)return b.tokenize=d(c),b.tokenize(a,b);if(/[{}\(\),\.;\[\]]/.test(c))return g=c,null;if("#"==c)return a.skipToEnd(),"comment";if(j.test(c))return a.eatWhile(j),null;if(":"==c)return"operator";if(a.eatWhile(/[_\w\d]/),":"==a.peek())return"variable-3";var e=a.current();return i.test(e)?"meta":c>="A"&&"Z">=c?"comment":"keyword";var e}function d(a){return function(b,d){for(var e,f=!1;null!=(e=b.next());){if(e==a&&!f){d.tokenize=c;break}f=!f&&"\\"==e}return"string"}}function e(a,b,c){a.context={prev:a.context,indent:a.indent,col:c,type:b}}function f(a){a.indent=a.context.indent,a.context=a.context.prev}var g,h=a.indentUnit,i=(b([]),b(["@prefix","@base","a"])),j=/[*+\-<>=&|]/;return{startState:function(){return{tokenize:c,context:null,indent:0,col:0}},token:function(a,b){if(a.sol()&&(b.context&&null==b.context.align&&(b.context.align=!1),b.indent=a.indentation()),a.eatSpace())return null;var c=b.tokenize(a,b);if("comment"!=c&&b.context&&null==b.context.align&&"pattern"!=b.context.type&&(b.context.align=!0),"("==g)e(b,")",a.column());else if("["==g)e(b,"]",a.column());else if("{"==g)e(b,"}",a.column());else if(/[\]\}\)]/.test(g)){for(;b.context&&"pattern"==b.context.type;)f(b);b.context&&g==b.context.type&&f(b)}else"."==g&&b.context&&"pattern"==b.context.type?f(b):/atom|string|variable/.test(c)&&b.context&&(/[\}\]]/.test(b.context.type)?e(b,"pattern",a.column()):"pattern"!=b.context.type||b.context.align||(b.context.align=!0,b.context.col=a.column()));return c},indent:function(a,b){var c=b&&b.charAt(0),d=a.context;if(/[\]\}]/.test(c))for(;d&&"pattern"==d.type;)d=d.prev;var e=d&&c==d.type;return d?"pattern"==d.type?d.col:d.align?d.col+(e?0:1):d.indent+(e?0:h):0},lineComment:"#"}}),a.defineMIME("text/turtle","turtle")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/vb/vb.js b/media/editors/codemirror/mode/vb/vb.js index 902203e0c03e9..665248f499bdb 100644 --- a/media/editors/codemirror/mode/vb/vb.js +++ b/media/editors/codemirror/mode/vb/vb.js @@ -29,13 +29,14 @@ CodeMirror.defineMode("vb", function(conf, parserConf) { var middleKeywords = ['else','elseif','case', 'catch']; var endKeywords = ['next','loop']; - var wordOperators = wordRegexp(['and', 'or', 'not', 'xor', 'in']); - var commonkeywords = ['as', 'dim', 'break', 'continue','optional', 'then', 'until', + var operatorKeywords = ['and', 'or', 'not', 'xor', 'in']; + var wordOperators = wordRegexp(operatorKeywords); + var commonKeywords = ['as', 'dim', 'break', 'continue','optional', 'then', 'until', 'goto', 'byval','byref','new','handles','property', 'return', 'const','private', 'protected', 'friend', 'public', 'shared', 'static', 'true','false']; var commontypes = ['integer','string','double','decimal','boolean','short','char', 'float','single']; - var keywords = wordRegexp(commonkeywords); + var keywords = wordRegexp(commonKeywords); var types = wordRegexp(commontypes); var stringPrefixes = '"'; @@ -47,8 +48,8 @@ CodeMirror.defineMode("vb", function(conf, parserConf) { var indentInfo = null; - - + CodeMirror.registerHelper("hintWords", "vb", openingKeywords.concat(middleKeywords).concat(endKeywords) + .concat(operatorKeywords).concat(commonKeywords).concat(commontypes)); function indent(_stream, state) { state.currentIndent++; diff --git a/media/editors/codemirror/mode/vb/vb.min.js b/media/editors/codemirror/mode/vb/vb.min.js new file mode 100644 index 0000000000000..174963bdecc6d --- /dev/null +++ b/media/editors/codemirror/mode/vb/vb.min.js @@ -0,0 +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("vb",function(b,c){function d(a){return new RegExp("^(("+a.join(")|(")+"))\\b","i")}function e(a,b){b.currentIndent++}function f(a,b){b.currentIndent--}function g(a,b){if(a.eatSpace())return null;var c=a.peek();if("'"===c)return a.skipToEnd(),"comment";if(a.match(/^((&H)|(&O))?[0-9\.a-f]/i,!1)){var d=!1;if(a.match(/^\d*\.\d+F?/i)?d=!0:a.match(/^\d+\.\d*F?/)?d=!0:a.match(/^\.\d+F?/)&&(d=!0),d)return a.eat(/J/i),"number";var g=!1;if(a.match(/^&H[0-9a-f]+/i)?g=!0:a.match(/^&O[0-7]+/i)?g=!0:a.match(/^[1-9]\d*F?/)?(a.eat(/J/i),g=!0):a.match(/^0(?![\dx])/i)&&(g=!0),g)return a.eat(/L/i),"number"}return a.match(z)?(b.tokenize=h(a.current()),b.tokenize(a,b)):a.match(o)||a.match(n)?null:a.match(m)||a.match(k)||a.match(u)?"operator":a.match(l)?null:a.match(E)?(e(a,b),b.doInCurrentLine=!0,"keyword"):a.match(A)?(b.doInCurrentLine?b.doInCurrentLine=!1:e(a,b),"keyword"):a.match(B)?"keyword":a.match(D)?(f(a,b),f(a,b),"keyword"):a.match(C)?(f(a,b),"keyword"):a.match(y)?"keyword":a.match(x)?"keyword":a.match(p)?"variable":(a.next(),j)}function h(a){var b=1==a.length,d="string";return function(e,f){for(;!e.eol();){if(e.eatWhile(/[^'"]/),e.match(a))return f.tokenize=g,d;e.eat(/['"]/)}if(b){if(c.singleLineStringErrors)return j;f.tokenize=g}return d}}function i(a,b){var c=b.tokenize(a,b),d=a.current();if("."===d)return c=b.tokenize(a,b),d=a.current(),"variable"===c?"variable":j;var g="[({".indexOf(d);return-1!==g&&e(a,b),"dedent"===F&&f(a,b)?j:(g="])}".indexOf(d),-1!==g&&f(a,b)?j:c)}var j="error",k=new RegExp("^[\\+\\-\\*/%&\\\\|\\^~<>!]"),l=new RegExp("^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]"),m=new RegExp("^((==)|(<>)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*))"),n=new RegExp("^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))"),o=new RegExp("^((//=)|(>>=)|(<<=)|(\\*\\*=))"),p=new RegExp("^[_A-Za-z][_A-Za-z0-9]*"),q=["class","module","sub","enum","select","while","if","function","get","set","property","try"],r=["else","elseif","case","catch"],s=["next","loop"],t=["and","or","not","xor","in"],u=d(t),v=["as","dim","break","continue","optional","then","until","goto","byval","byref","new","handles","property","return","const","private","protected","friend","public","shared","static","true","false"],w=["integer","string","double","decimal","boolean","short","char","float","single"],x=d(v),y=d(w),z='"',A=d(q),B=d(r),C=d(s),D=d(["end"]),E=d(["do"]),F=null;a.registerHelper("hintWords","vb",q.concat(r).concat(s).concat(t).concat(v).concat(w));var G={electricChars:"dDpPtTfFeE ",startState:function(){return{tokenize:g,lastToken:null,currentIndent:0,nextLineIndent:0,doInCurrentLine:!1}},token:function(a,b){a.sol()&&(b.currentIndent+=b.nextLineIndent,b.nextLineIndent=0,b.doInCurrentLine=0);var c=i(a,b);return b.lastToken={style:c,content:a.current()},c},indent:function(a,c){var d=c.replace(/^\s+|\s+$/g,"");return d.match(C)||d.match(D)||d.match(B)?b.indentUnit*(a.currentIndent-1):a.currentIndent<0?0:a.currentIndent*b.indentUnit}};return G}),a.defineMIME("text/x-vb","vb")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/vbscript/vbscript.min.js b/media/editors/codemirror/mode/vbscript/vbscript.min.js new file mode 100644 index 0000000000000..6ec685d4f21eb --- /dev/null +++ b/media/editors/codemirror/mode/vbscript/vbscript.min.js @@ -0,0 +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("vbscript",function(a,b){function c(a){return new RegExp("^(("+a.join(")|(")+"))\\b","i")}function d(a,b){b.currentIndent++}function e(a,b){b.currentIndent--}function f(a,b){if(a.eatSpace())return"space";var c=a.peek();if("'"===c)return a.skipToEnd(),"comment";if(a.match(P))return a.skipToEnd(),"comment";if(a.match(/^((&H)|(&O))?[0-9\.]/i,!1)&&!a.match(/^((&H)|(&O))?[0-9\.]+[a-z_]/i,!1)){var f=!1;if(a.match(/^\d*\.\d+/i)?f=!0:a.match(/^\d+\.\d*/)?f=!0:a.match(/^\.\d+/)&&(f=!0),f)return a.eat(/J/i),"number";var h=!1;if(a.match(/^&H[0-9a-f]+/i)?h=!0:a.match(/^&O[0-7]+/i)?h=!0:a.match(/^[1-9]\d*F?/)?(a.eat(/J/i),h=!0):a.match(/^0(?![\dx])/i)&&(h=!0),h)return a.eat(/L/i),"number"}return a.match(I)?(b.tokenize=g(a.current()),b.tokenize(a,b)):a.match(k)||a.match(j)||a.match(r)?"operator":a.match(l)?null:a.match(m)?"bracket":a.match(O)?(b.doInCurrentLine=!0,"keyword"):a.match(N)?(d(a,b),b.doInCurrentLine=!0,"keyword"):a.match(J)?(b.doInCurrentLine?b.doInCurrentLine=!1:d(a,b),"keyword"):a.match(K)?"keyword":a.match(M)?(e(a,b),e(a,b),"keyword"):a.match(L)?(b.doInCurrentLine?b.doInCurrentLine=!1:e(a,b),"keyword"):a.match(D)?"keyword":a.match(E)?"atom":a.match(H)?"variable-2":a.match(F)?"builtin":a.match(G)?"variable-2":a.match(n)?"variable":(a.next(),i)}function g(a){var c=1==a.length,d="string";return function(e,g){for(;!e.eol();){if(e.eatWhile(/[^'"]/),e.match(a))return g.tokenize=f,d;e.eat(/['"]/)}if(c){if(b.singleLineStringErrors)return i;g.tokenize=f}return d}}function h(a,b){var c=b.tokenize(a,b),d=a.current();return"."===d?(c=b.tokenize(a,b),d=a.current(),!c||"variable"!==c.substr(0,8)&&"builtin"!==c&&"keyword"!==c?i:(("builtin"===c||"keyword"===c)&&(c="variable"),C.indexOf(d.substr(1))>-1&&(c="variable-2"),c)):c}var i="error",j=new RegExp("^[\\+\\-\\*/&\\\\\\^<>=]"),k=new RegExp("^((<>)|(<=)|(>=))"),l=new RegExp("^[\\.,]"),m=new RegExp("^[\\(\\)]"),n=new RegExp("^[A-Za-z][_A-Za-z0-9]*"),o=["class","sub","select","while","if","function","property","with","for"],p=["else","elseif","case"],q=["next","loop","wend"],r=c(["and","or","not","xor","is","mod","eqv","imp"]),s=["dim","redim","then","until","randomize","byval","byref","new","property","exit","in","const","private","public","get","set","let","stop","on error resume next","on error goto 0","option explicit","call","me"],t=["true","false","nothing","empty","null"],u=["abs","array","asc","atn","cbool","cbyte","ccur","cdate","cdbl","chr","cint","clng","cos","csng","cstr","date","dateadd","datediff","datepart","dateserial","datevalue","day","escape","eval","execute","exp","filter","formatcurrency","formatdatetime","formatnumber","formatpercent","getlocale","getobject","getref","hex","hour","inputbox","instr","instrrev","int","fix","isarray","isdate","isempty","isnull","isnumeric","isobject","join","lbound","lcase","left","len","loadpicture","log","ltrim","rtrim","trim","maths","mid","minute","month","monthname","msgbox","now","oct","replace","rgb","right","rnd","round","scriptengine","scriptenginebuildversion","scriptenginemajorversion","scriptengineminorversion","second","setlocale","sgn","sin","space","split","sqr","strcomp","string","strreverse","tan","time","timer","timeserial","timevalue","typename","ubound","ucase","unescape","vartype","weekday","weekdayname","year"],v=["vbBlack","vbRed","vbGreen","vbYellow","vbBlue","vbMagenta","vbCyan","vbWhite","vbBinaryCompare","vbTextCompare","vbSunday","vbMonday","vbTuesday","vbWednesday","vbThursday","vbFriday","vbSaturday","vbUseSystemDayOfWeek","vbFirstJan1","vbFirstFourDays","vbFirstFullWeek","vbGeneralDate","vbLongDate","vbShortDate","vbLongTime","vbShortTime","vbObjectError","vbOKOnly","vbOKCancel","vbAbortRetryIgnore","vbYesNoCancel","vbYesNo","vbRetryCancel","vbCritical","vbQuestion","vbExclamation","vbInformation","vbDefaultButton1","vbDefaultButton2","vbDefaultButton3","vbDefaultButton4","vbApplicationModal","vbSystemModal","vbOK","vbCancel","vbAbort","vbRetry","vbIgnore","vbYes","vbNo","vbCr","VbCrLf","vbFormFeed","vbLf","vbNewLine","vbNullChar","vbNullString","vbTab","vbVerticalTab","vbUseDefault","vbTrue","vbFalse","vbEmpty","vbNull","vbInteger","vbLong","vbSingle","vbDouble","vbCurrency","vbDate","vbString","vbObject","vbError","vbBoolean","vbVariant","vbDataObject","vbDecimal","vbByte","vbArray"],w=["WScript","err","debug","RegExp"],x=["description","firstindex","global","helpcontext","helpfile","ignorecase","length","number","pattern","source","value","count"],y=["clear","execute","raise","replace","test","write","writeline","close","open","state","eof","update","addnew","end","createobject","quit"],z=["server","response","request","session","application"],A=["buffer","cachecontrol","charset","contenttype","expires","expiresabsolute","isclientconnected","pics","status","clientcertificate","cookies","form","querystring","servervariables","totalbytes","contents","staticobjects","codepage","lcid","sessionid","timeout","scripttimeout"],B=["addheader","appendtolog","binarywrite","end","flush","redirect","binaryread","remove","removeall","lock","unlock","abandon","getlasterror","htmlencode","mappath","transfer","urlencode"],C=y.concat(x);w=w.concat(v),a.isASP&&(w=w.concat(z),C=C.concat(B,A));var D=c(s),E=c(t),F=c(u),G=c(w),H=c(C),I='"',J=c(o),K=c(p),L=c(q),M=c(["end"]),N=c(["do"]),O=c(["on error resume next","exit"]),P=c(["rem"]),Q={electricChars:"dDpPtTfFeE ",startState:function(){return{tokenize:f,lastToken:null,currentIndent:0,nextLineIndent:0,doInCurrentLine:!1,ignoreKeyword:!1}},token:function(a,b){a.sol()&&(b.currentIndent+=b.nextLineIndent,b.nextLineIndent=0,b.doInCurrentLine=0);var c=h(a,b);return b.lastToken={style:c,content:a.current()},"space"===c&&(c=null),c},indent:function(b,c){var d=c.replace(/^\s+|\s+$/g,"");return d.match(L)||d.match(M)||d.match(K)?a.indentUnit*(b.currentIndent-1):b.currentIndent<0?0:b.currentIndent*a.indentUnit}};return Q}),a.defineMIME("text/vbscript","vbscript")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/velocity/velocity.min.js b/media/editors/codemirror/mode/velocity/velocity.min.js new file mode 100644 index 0000000000000..08735aae6cc68 --- /dev/null +++ b/media/editors/codemirror/mode/velocity/velocity.min.js @@ -0,0 +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("velocity",function(){function a(a){for(var b={},c=a.split(" "),d=0;dm.length&&"."==a.string.charAt(a.pos-m.length-1)&&c.lastTokenWasBuiltin?"builtin":(c.lastTokenWasBuiltin=!1,null)}return c.lastTokenWasBuiltin=!1,c.inString?(c.inString=!1,"string"):c.inParams?b(a,c,d(l)):void 0}function d(a){return function(b,d){for(var e,f=!1,g=!1;null!=(e=b.next());){if(e==a&&!f){g=!0;break}if('"'==a&&"$"==b.peek()&&!f){d.inString=!0,g=!0;break}f=!f&&"\\"==e}return g&&(d.tokenize=c),"string"}}function e(a,b){for(var d,e=!1;d=a.next();){if("#"==d&&e){b.tokenize=c;break}e="*"==d}return"comment"}function f(a,b){for(var d,e=0;d=a.next();){if("#"==d&&2==e){b.tokenize=c;break}"]"==d?e++:" "!=d&&(e=0)}return"meta"}var g=a("#end #else #break #stop #[[ #]] #{end} #{else} #{break} #{stop}"),h=a("#if #elseif #foreach #set #include #parse #macro #define #evaluate #{if} #{elseif} #{foreach} #{set} #{include} #{parse} #{macro} #{define} #{evaluate}"),i=a("$foreach.count $foreach.hasNext $foreach.first $foreach.last $foreach.topmost $foreach.parent.count $foreach.parent.hasNext $foreach.parent.first $foreach.parent.last $foreach.parent $velocityCount $!bodyContent $bodyContent"),j=/[+\-*&%=<>!?:\/|]/;return{startState:function(){return{tokenize:c,beforeParams:!1,inParams:!1,inString:!1,lastTokenWasBuiltin:!1}},token:function(a,b){return a.eatSpace()?null:b.tokenize(a,b)},blockCommentStart:"#*",blockCommentEnd:"*#",lineComment:"##",fold:"velocity"}}),a.defineMIME("text/velocity","velocity")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/verilog/test.js b/media/editors/codemirror/mode/verilog/test.js deleted file mode 100644 index 9c8c09494082e..0000000000000 --- a/media/editors/codemirror/mode/verilog/test.js +++ /dev/null @@ -1,273 +0,0 @@ -// CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: http://codemirror.net/LICENSE - -(function() { - var mode = CodeMirror.getMode({indentUnit: 4}, "verilog"); - function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); } - - MT("binary_literals", - "[number 1'b0]", - "[number 1'b1]", - "[number 1'bx]", - "[number 1'bz]", - "[number 1'bX]", - "[number 1'bZ]", - "[number 1'B0]", - "[number 1'B1]", - "[number 1'Bx]", - "[number 1'Bz]", - "[number 1'BX]", - "[number 1'BZ]", - "[number 1'b0]", - "[number 1'b1]", - "[number 2'b01]", - "[number 2'bxz]", - "[number 2'b11]", - "[number 2'b10]", - "[number 2'b1Z]", - "[number 12'b0101_0101_0101]", - "[number 1'b 0]", - "[number 'b0101]" - ); - - MT("octal_literals", - "[number 3'o7]", - "[number 3'O7]", - "[number 3'so7]", - "[number 3'SO7]" - ); - - MT("decimal_literals", - "[number 0]", - "[number 1]", - "[number 7]", - "[number 123_456]", - "[number 'd33]", - "[number 8'd255]", - "[number 8'D255]", - "[number 8'sd255]", - "[number 8'SD255]", - "[number 32'd123]", - "[number 32 'd123]", - "[number 32 'd 123]" - ); - - MT("hex_literals", - "[number 4'h0]", - "[number 4'ha]", - "[number 4'hF]", - "[number 4'hx]", - "[number 4'hz]", - "[number 4'hX]", - "[number 4'hZ]", - "[number 32'hdc78]", - "[number 32'hDC78]", - "[number 32 'hDC78]", - "[number 32'h DC78]", - "[number 32 'h DC78]", - "[number 32'h44x7]", - "[number 32'hFFF?]" - ); - - MT("real_number_literals", - "[number 1.2]", - "[number 0.1]", - "[number 2394.26331]", - "[number 1.2E12]", - "[number 1.2e12]", - "[number 1.30e-2]", - "[number 0.1e-0]", - "[number 23E10]", - "[number 29E-2]", - "[number 236.123_763_e-12]" - ); - - MT("operators", - "[meta ^]" - ); - - MT("keywords", - "[keyword logic]", - "[keyword logic] [variable foo]", - "[keyword reg] [variable abc]" - ); - - MT("variables", - "[variable _leading_underscore]", - "[variable _if]", - "[number 12] [variable foo]", - "[variable foo] [number 14]" - ); - - MT("tick_defines", - "[def `FOO]", - "[def `foo]", - "[def `FOO_bar]" - ); - - MT("system_calls", - "[meta $display]", - "[meta $vpi_printf]" - ); - - MT("line_comment", "[comment // Hello world]"); - - // Alignment tests - MT("align_port_map_style1", - /** - * mod mod(.a(a), - * .b(b) - * ); - */ - "[variable mod] [variable mod][bracket (].[variable a][bracket (][variable a][bracket )],", - " .[variable b][bracket (][variable b][bracket )]", - " [bracket )];", - "" - ); - - MT("align_port_map_style2", - /** - * mod mod( - * .a(a), - * .b(b) - * ); - */ - "[variable mod] [variable mod][bracket (]", - " .[variable a][bracket (][variable a][bracket )],", - " .[variable b][bracket (][variable b][bracket )]", - "[bracket )];", - "" - ); - - // Indentation tests - MT("indent_single_statement_if", - "[keyword if] [bracket (][variable foo][bracket )]", - " [keyword break];", - "" - ); - - MT("no_indent_after_single_line_if", - "[keyword if] [bracket (][variable foo][bracket )] [keyword break];", - "" - ); - - MT("indent_after_if_begin_same_line", - "[keyword if] [bracket (][variable foo][bracket )] [keyword begin]", - " [keyword break];", - " [keyword break];", - "[keyword end]", - "" - ); - - MT("indent_after_if_begin_next_line", - "[keyword if] [bracket (][variable foo][bracket )]", - " [keyword begin]", - " [keyword break];", - " [keyword break];", - " [keyword end]", - "" - ); - - MT("indent_single_statement_if_else", - "[keyword if] [bracket (][variable foo][bracket )]", - " [keyword break];", - "[keyword else]", - " [keyword break];", - "" - ); - - MT("indent_if_else_begin_same_line", - "[keyword if] [bracket (][variable foo][bracket )] [keyword begin]", - " [keyword break];", - " [keyword break];", - "[keyword end] [keyword else] [keyword begin]", - " [keyword break];", - " [keyword break];", - "[keyword end]", - "" - ); - - MT("indent_if_else_begin_next_line", - "[keyword if] [bracket (][variable foo][bracket )]", - " [keyword begin]", - " [keyword break];", - " [keyword break];", - " [keyword end]", - "[keyword else]", - " [keyword begin]", - " [keyword break];", - " [keyword break];", - " [keyword end]", - "" - ); - - MT("indent_if_nested_without_begin", - "[keyword if] [bracket (][variable foo][bracket )]", - " [keyword if] [bracket (][variable foo][bracket )]", - " [keyword if] [bracket (][variable foo][bracket )]", - " [keyword break];", - "" - ); - - MT("indent_case", - "[keyword case] [bracket (][variable state][bracket )]", - " [variable FOO]:", - " [keyword break];", - " [variable BAR]:", - " [keyword break];", - "[keyword endcase]", - "" - ); - - MT("unindent_after_end_with_preceding_text", - "[keyword begin]", - " [keyword break]; [keyword end]", - "" - ); - - MT("export_function_one_line_does_not_indent", - "[keyword export] [string \"DPI-C\"] [keyword function] [variable helloFromSV];", - "" - ); - - MT("export_task_one_line_does_not_indent", - "[keyword export] [string \"DPI-C\"] [keyword task] [variable helloFromSV];", - "" - ); - - MT("export_function_two_lines_indents_properly", - "[keyword export]", - " [string \"DPI-C\"] [keyword function] [variable helloFromSV];", - "" - ); - - MT("export_task_two_lines_indents_properly", - "[keyword export]", - " [string \"DPI-C\"] [keyword task] [variable helloFromSV];", - "" - ); - - MT("import_function_one_line_does_not_indent", - "[keyword import] [string \"DPI-C\"] [keyword function] [variable helloFromC];", - "" - ); - - MT("import_task_one_line_does_not_indent", - "[keyword import] [string \"DPI-C\"] [keyword task] [variable helloFromC];", - "" - ); - - MT("import_package_single_line_does_not_indent", - "[keyword import] [variable p]::[variable x];", - "[keyword import] [variable p]::[variable y];", - "" - ); - - MT("covergoup_with_function_indents_properly", - "[keyword covergroup] [variable cg] [keyword with] [keyword function] [variable sample][bracket (][keyword bit] [variable b][bracket )];", - " [variable c] : [keyword coverpoint] [variable c];", - "[keyword endgroup]: [variable cg]", - "" - ); - -})(); diff --git a/media/editors/codemirror/mode/verilog/verilog.js b/media/editors/codemirror/mode/verilog/verilog.js index 8fc9ea4f8cda3..9d2a4cd5829c1 100644 --- a/media/editors/codemirror/mode/verilog/verilog.js +++ b/media/editors/codemirror/mode/verilog/verilog.js @@ -17,7 +17,8 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) { statementIndentUnit = parserConfig.statementIndentUnit || indentUnit, dontAlignCalls = parserConfig.dontAlignCalls, noIndentKeywords = parserConfig.noIndentKeywords || [], - multiLineStrings = parserConfig.multiLineStrings; + multiLineStrings = parserConfig.multiLineStrings, + hooks = parserConfig.hooks || {}; function words(str) { var obj = {}, words = str.split(" "); @@ -107,7 +108,11 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) { var statementKeywords = words("always always_comb always_ff always_latch assert assign assume else export for foreach forever if import initial repeat while"); function tokenBase(stream, state) { - var ch = stream.peek(); + var ch = stream.peek(), style; + if (hooks[ch] && (style = hooks[ch](stream, state)) != false) return style; + if (hooks.tokenBase && (style = hooks.tokenBase(stream, state)) != false) + return style; + if (/[,;:\.]/.test(ch)) { curPunc = stream.next(); return null; @@ -280,12 +285,14 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) { electricInput: buildElectricInputRegEx(), startState: function(basecolumn) { - return { + var state = { tokenize: null, context: new Context((basecolumn || 0) - indentUnit, 0, "top", false), indented: 0, startOfLine: true }; + if (hooks.startState) hooks.startState(state); + return state; }, token: function(stream, state) { @@ -295,6 +302,7 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) { state.indented = stream.indentation(); state.startOfLine = true; } + if (hooks.token) hooks.token(stream, state); if (stream.eatSpace()) return null; curPunc = null; curKeyword = null; @@ -304,17 +312,19 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) { if (curPunc == ctx.type) { popContext(state); - } - else if ((curPunc == ";" && ctx.type == "statement") || + } else if ((curPunc == ";" && ctx.type == "statement") || (ctx.type && isClosing(curKeyword, ctx.type))) { ctx = popContext(state); while (ctx && ctx.type == "statement") ctx = popContext(state); - } - else if (curPunc == "{") { pushContext(state, stream.column(), "}"); } - else if (curPunc == "[") { pushContext(state, stream.column(), "]"); } - else if (curPunc == "(") { pushContext(state, stream.column(), ")"); } - else if (ctx && ctx.type == "endcase" && curPunc == ":") { pushContext(state, stream.column(), "statement"); } - else if (curPunc == "newstatement") { + } else if (curPunc == "{") { + pushContext(state, stream.column(), "}"); + } else if (curPunc == "[") { + pushContext(state, stream.column(), "]"); + } else if (curPunc == "(") { + pushContext(state, stream.column(), ")"); + } else if (ctx && ctx.type == "endcase" && curPunc == ":") { + pushContext(state, stream.column(), "statement"); + } else if (curPunc == "newstatement") { pushContext(state, stream.column(), "statement"); } else if (curPunc == "newblock") { if (curKeyword == "function" && ctx && (ctx.type == "statement" || ctx.type == "endgroup")) { @@ -335,13 +345,16 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) { indent: function(state, textAfter) { if (state.tokenize != tokenBase && state.tokenize != null) return CodeMirror.Pass; + if (hooks.indent) { + var fromHook = hooks.indent(state); + if (fromHook >= 0) return fromHook; + } var ctx = state.context, firstChar = textAfter && textAfter.charAt(0); if (ctx.type == "statement" && firstChar == "}") ctx = ctx.prev; var closing = false; var possibleClosing = textAfter.match(closingBracketOrWord); - if (possibleClosing) { + if (possibleClosing) closing = isClosing(possibleClosing[0], ctx.type); - } if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : statementIndentUnit); else if (closingBracket.test(ctx.type) && ctx.align && !dontAlignCalls) return ctx.column + (closing ? 0 : 1); else if (ctx.type == ")" && !closing) return ctx.indented + statementIndentUnit; @@ -354,11 +367,171 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) { }; }); -CodeMirror.defineMIME("text/x-verilog", { - name: "verilog" -}); -CodeMirror.defineMIME("text/x-systemverilog", { - name: "systemverilog" -}); + CodeMirror.defineMIME("text/x-verilog", { + name: "verilog" + }); + + CodeMirror.defineMIME("text/x-systemverilog", { + name: "verilog" + }); + + // TLVVerilog mode + + var tlvchScopePrefixes = { + ">": "property", "->": "property", "-": "hr", "|": "link", "?$": "qualifier", "?*": "qualifier", + "@-": "variable-3", "@": "variable-3", "?": "qualifier" + }; + function tlvGenIndent(stream, state) { + var tlvindentUnit = 2; + var rtnIndent = -1, indentUnitRq = 0, curIndent = stream.indentation(); + switch (state.tlvCurCtlFlowChar) { + case "\\": + curIndent = 0; + break; + case "|": + if (state.tlvPrevPrevCtlFlowChar == "@") { + indentUnitRq = -2; //-2 new pipe rq after cur pipe + break; + } + if (tlvchScopePrefixes[state.tlvPrevCtlFlowChar]) + indentUnitRq = 1; // +1 new scope + break; + case "M": // m4 + if (state.tlvPrevPrevCtlFlowChar == "@") { + indentUnitRq = -2; //-2 new inst rq after pipe + break; + } + if (tlvchScopePrefixes[state.tlvPrevCtlFlowChar]) + indentUnitRq = 1; // +1 new scope + break; + case "@": + if (state.tlvPrevCtlFlowChar == "S") + indentUnitRq = -1; // new pipe stage after stmts + if (state.tlvPrevCtlFlowChar == "|") + indentUnitRq = 1; // 1st pipe stage + break; + case "S": + if (state.tlvPrevCtlFlowChar == "@") + indentUnitRq = 1; // flow in pipe stage + if (tlvchScopePrefixes[state.tlvPrevCtlFlowChar]) + indentUnitRq = 1; // +1 new scope + break; + } + var statementIndentUnit = tlvindentUnit; + rtnIndent = curIndent + (indentUnitRq*statementIndentUnit); + return rtnIndent >= 0 ? rtnIndent : curIndent; + } + + CodeMirror.defineMIME("text/x-tlv", { + name: "verilog", + hooks: { + "\\": function(stream, state) { + var vxIndent = 0, style = false; + var curPunc = stream.string; + if ((stream.sol()) && ((/\\SV/.test(stream.string)) || (/\\TLV/.test(stream.string)))) { + curPunc = (/\\TLV_version/.test(stream.string)) + ? "\\TLV_version" : stream.string; + stream.skipToEnd(); + if (curPunc == "\\SV" && state.vxCodeActive) {state.vxCodeActive = false;}; + if ((/\\TLV/.test(curPunc) && !state.vxCodeActive) + || (curPunc=="\\TLV_version" && state.vxCodeActive)) {state.vxCodeActive = true;}; + style = "keyword"; + state.tlvCurCtlFlowChar = state.tlvPrevPrevCtlFlowChar + = state.tlvPrevCtlFlowChar = ""; + if (state.vxCodeActive == true) { + state.tlvCurCtlFlowChar = "\\"; + vxIndent = tlvGenIndent(stream, state); + } + state.vxIndentRq = vxIndent; + } + return style; + }, + tokenBase: function(stream, state) { + var vxIndent = 0, style = false; + var tlvisOperatorChar = /[\[\]=:]/; + var tlvkpScopePrefixs = { + "**":"variable-2", "*":"variable-2", "$$":"variable", "$":"variable", + "^^":"attribute", "^":"attribute"}; + var ch = stream.peek(); + var vxCurCtlFlowCharValueAtStart = state.tlvCurCtlFlowChar; + if (state.vxCodeActive == true) { + if (/[\[\]{}\(\);\:]/.test(ch)) { + // bypass nesting and 1 char punc + style = "meta"; + stream.next(); + } else if (ch == "/") { + stream.next(); + if (stream.eat("/")) { + stream.skipToEnd(); + style = "comment"; + state.tlvCurCtlFlowChar = "S"; + } else { + stream.backUp(1); + } + } else if (ch == "@") { + // pipeline stage + style = tlvchScopePrefixes[ch]; + state.tlvCurCtlFlowChar = "@"; + stream.next(); + stream.eatWhile(/[\w\$_]/); + } else if (stream.match(/\b[mM]4+/, true)) { // match: function(pattern, consume, caseInsensitive) + // m4 pre proc + stream.skipTo("("); + style = "def"; + state.tlvCurCtlFlowChar = "M"; + } else if (ch == "!" && stream.sol()) { + // v stmt in tlv region + // state.tlvCurCtlFlowChar = "S"; + style = "comment"; + stream.next(); + } else if (tlvisOperatorChar.test(ch)) { + // operators + stream.eatWhile(tlvisOperatorChar); + style = "operator"; + } else if (ch == "#") { + // phy hier + state.tlvCurCtlFlowChar = (state.tlvCurCtlFlowChar == "") + ? ch : state.tlvCurCtlFlowChar; + stream.next(); + stream.eatWhile(/[+-]\d/); + style = "tag"; + } else if (tlvkpScopePrefixs.propertyIsEnumerable(ch)) { + // special TLV operators + style = tlvkpScopePrefixs[ch]; + state.tlvCurCtlFlowChar = state.tlvCurCtlFlowChar == "" ? "S" : state.tlvCurCtlFlowChar; // stmt + stream.next(); + stream.match(/[a-zA-Z_0-9]+/); + } else if (style = tlvchScopePrefixes[ch] || false) { + // special TLV operators + state.tlvCurCtlFlowChar = state.tlvCurCtlFlowChar == "" ? ch : state.tlvCurCtlFlowChar; + stream.next(); + stream.match(/[a-zA-Z_0-9]+/); + } + if (state.tlvCurCtlFlowChar != vxCurCtlFlowCharValueAtStart) { // flow change + vxIndent = tlvGenIndent(stream, state); + state.vxIndentRq = vxIndent; + } + } + return style; + }, + token: function(stream, state) { + if (state.vxCodeActive == true && stream.sol() && state.tlvCurCtlFlowChar != "") { + state.tlvPrevPrevCtlFlowChar = state.tlvPrevCtlFlowChar; + state.tlvPrevCtlFlowChar = state.tlvCurCtlFlowChar; + state.tlvCurCtlFlowChar = ""; + } + }, + indent: function(state) { + return (state.vxCodeActive == true) ? state.vxIndentRq : -1; + }, + startState: function(state) { + state.tlvCurCtlFlowChar = ""; + state.tlvPrevCtlFlowChar = ""; + state.tlvPrevPrevCtlFlowChar = ""; + state.vxCodeActive = true; + state.vxIndentRq = 0; + } + } + }); }); diff --git a/media/editors/codemirror/mode/verilog/verilog.min.js b/media/editors/codemirror/mode/verilog/verilog.min.js new file mode 100644 index 0000000000000..037ddcfc5b9be --- /dev/null +++ b/media/editors/codemirror/mode/verilog/verilog.min.js @@ -0,0 +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){var d=2,e=-1,f=0,g=a.indentation();switch(b.tlvCurCtlFlowChar){case"\\":g=0;break;case"|":if("@"==b.tlvPrevPrevCtlFlowChar){f=-2;break}c[b.tlvPrevCtlFlowChar]&&(f=1);break;case"M":if("@"==b.tlvPrevPrevCtlFlowChar){f=-2;break}c[b.tlvPrevCtlFlowChar]&&(f=1);break;case"@":"S"==b.tlvPrevCtlFlowChar&&(f=-1),"|"==b.tlvPrevCtlFlowChar&&(f=1);break;case"S":"@"==b.tlvPrevCtlFlowChar&&(f=1),c[b.tlvPrevCtlFlowChar]&&(f=1)}var h=d;return e=g+f*h,e>=0?e:g}a.defineMode("verilog",function(b,c){function d(a){for(var b={},c=a.split(" "),d=0;d=0)return d}var f=b.context,g=c&&c.charAt(0);"statement"==f.type&&"}"==g&&(f=f.prev);var h=!1,i=c.match(D);return i&&(h=k(i[0],f.type)),"statement"==f.type?f.indented+("{"==g?0:p):E.test(f.type)&&f.align&&!q?f.column+(h?0:1):")"!=f.type||h?f.indented+(h?0:o):f.indented+p},blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//"}}),a.defineMIME("text/x-verilog",{name:"verilog"}),a.defineMIME("text/x-systemverilog",{name:"verilog"});var c={">":"property","->":"property","-":"hr","|":"link","?$":"qualifier","?*":"qualifier","@-":"variable-3","@":"variable-3","?":"qualifier"};a.defineMIME("text/x-tlv",{name:"verilog",hooks:{"\\":function(a,c){var d=0,e=!1,f=a.string;return a.sol()&&(/\\SV/.test(a.string)||/\\TLV/.test(a.string))&&(f=/\\TLV_version/.test(a.string)?"\\TLV_version":a.string,a.skipToEnd(),"\\SV"==f&&c.vxCodeActive&&(c.vxCodeActive=!1),(/\\TLV/.test(f)&&!c.vxCodeActive||"\\TLV_version"==f&&c.vxCodeActive)&&(c.vxCodeActive=!0),e="keyword",c.tlvCurCtlFlowChar=c.tlvPrevPrevCtlFlowChar=c.tlvPrevCtlFlowChar="",1==c.vxCodeActive&&(c.tlvCurCtlFlowChar="\\",d=b(a,c)),c.vxIndentRq=d),e},tokenBase:function(a,d){var e=0,f=!1,g=/[\[\]=:]/,h={"**":"variable-2","*":"variable-2",$$:"variable",$:"variable","^^":"attribute","^":"attribute"},i=a.peek(),j=d.tlvCurCtlFlowChar;return 1==d.vxCodeActive&&(/[\[\]{}\(\);\:]/.test(i)?(f="meta",a.next()):"/"==i?(a.next(),a.eat("/")?(a.skipToEnd(),f="comment",d.tlvCurCtlFlowChar="S"):a.backUp(1)):"@"==i?(f=c[i],d.tlvCurCtlFlowChar="@",a.next(),a.eatWhile(/[\w\$_]/)):a.match(/\b[mM]4+/,!0)?(a.skipTo("("),f="def",d.tlvCurCtlFlowChar="M"):"!"==i&&a.sol()?(f="comment",a.next()):g.test(i)?(a.eatWhile(g),f="operator"):"#"==i?(d.tlvCurCtlFlowChar=""==d.tlvCurCtlFlowChar?i:d.tlvCurCtlFlowChar,a.next(),a.eatWhile(/[+-]\d/),f="tag"):h.propertyIsEnumerable(i)?(f=h[i],d.tlvCurCtlFlowChar=""==d.tlvCurCtlFlowChar?"S":d.tlvCurCtlFlowChar,a.next(),a.match(/[a-zA-Z_0-9]+/)):(f=c[i]||!1)&&(d.tlvCurCtlFlowChar=""==d.tlvCurCtlFlowChar?i:d.tlvCurCtlFlowChar,a.next(),a.match(/[a-zA-Z_0-9]+/)),d.tlvCurCtlFlowChar!=j&&(e=b(a,d),d.vxIndentRq=e)),f},token:function(a,b){1==b.vxCodeActive&&a.sol()&&""!=b.tlvCurCtlFlowChar&&(b.tlvPrevPrevCtlFlowChar=b.tlvPrevCtlFlowChar,b.tlvPrevCtlFlowChar=b.tlvCurCtlFlowChar,b.tlvCurCtlFlowChar="")},indent:function(a){return 1==a.vxCodeActive?a.vxIndentRq:-1},startState:function(a){a.tlvCurCtlFlowChar="",a.tlvPrevCtlFlowChar="",a.tlvPrevPrevCtlFlowChar="",a.vxCodeActive=!0,a.vxIndentRq=0}}})}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/xml/test.js b/media/editors/codemirror/mode/xml/test.js deleted file mode 100644 index f48156b51749f..0000000000000 --- a/media/editors/codemirror/mode/xml/test.js +++ /dev/null @@ -1,51 +0,0 @@ -// CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: http://codemirror.net/LICENSE - -(function() { - var mode = CodeMirror.getMode({indentUnit: 2}, "xml"), mname = "xml"; - function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1), mname); } - - MT("matching", - "[tag&bracket <][tag top][tag&bracket >]", - " text", - " [tag&bracket <][tag inner][tag&bracket />]", - "[tag&bracket ]"); - - MT("nonmatching", - "[tag&bracket <][tag top][tag&bracket >]", - " [tag&bracket <][tag inner][tag&bracket />]", - " [tag&bracket ]"); - - MT("doctype", - "[meta ]", - "[tag&bracket <][tag top][tag&bracket />]"); - - MT("cdata", - "[tag&bracket <][tag top][tag&bracket >]", - " [atom ]", - "[tag&bracket ]"); - - // HTML tests - mode = CodeMirror.getMode({indentUnit: 2}, "text/html"); - - MT("selfclose", - "[tag&bracket <][tag html][tag&bracket >]", - " [tag&bracket <][tag link] [attribute rel]=[string stylesheet] [attribute href]=[string \"/foobar\"][tag&bracket >]", - "[tag&bracket ]"); - - MT("list", - "[tag&bracket <][tag ol][tag&bracket >]", - " [tag&bracket <][tag li][tag&bracket >]one", - " [tag&bracket <][tag li][tag&bracket >]two", - "[tag&bracket ]"); - - MT("valueless", - "[tag&bracket <][tag input] [attribute type]=[string checkbox] [attribute checked][tag&bracket />]"); - - MT("pThenArticle", - "[tag&bracket <][tag p][tag&bracket >]", - " foo", - "[tag&bracket <][tag article][tag&bracket >]bar"); - -})(); diff --git a/media/editors/codemirror/mode/xml/xml.min.js b/media/editors/codemirror/mode/xml/xml.min.js new file mode 100644 index 0000000000000..8d92fba7a8d0e --- /dev/null +++ b/media/editors/codemirror/mode/xml/xml.min.js @@ -0,0 +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("xml",function(b,c){function d(a,b){function c(c){return b.tokenize=c,c(a,b)}var d=a.next();if("<"==d)return a.eat("!")?a.eat("[")?a.match("CDATA[")?c(g("atom","]]>")):null:a.match("--")?c(g("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),c(h(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),b.tokenize=g("meta","?>"),"meta"):(x=a.eat("/")?"closeTag":"openTag",b.tokenize=e,"tag bracket");if("&"==d){var f;return f=a.eat("#")?a.eat("x")?a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):a.eatWhile(/[\d]/)&&a.eat(";"):a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),f?"atom":"error"}return a.eatWhile(/[^&<]/),null}function e(a,b){var c=a.next();if(">"==c||"/"==c&&a.eat(">"))return b.tokenize=d,x=">"==c?"endTag":"selfcloseTag","tag bracket";if("="==c)return x="equals",null;if("<"==c){b.tokenize=d,b.state=l,b.tagName=b.tagStart=null;var e=b.tokenize(a,b);return e?e+" tag error":"tag error"}return/[\'\"]/.test(c)?(b.tokenize=f(c),b.stringStartCol=a.column(),b.tokenize(a,b)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function f(a){var b=function(b,c){for(;!b.eol();)if(b.next()==a){c.tokenize=e;break}return"string"};return b.isInAttribute=!0,b}function g(a,b){return function(c,e){for(;!c.eol();){if(c.match(b)){e.tokenize=d;break}c.next()}return a}}function h(a){return function(b,c){for(var e;null!=(e=b.next());){if("<"==e)return c.tokenize=h(a+1),c.tokenize(b,c);if(">"==e){if(1==a){c.tokenize=d;break}return c.tokenize=h(a-1),c.tokenize(b,c)}}return"meta"}}function i(a,b,c){this.prev=a.context,this.tagName=b,this.indent=a.indented,this.startOfLine=c,(z.doNotIndent.hasOwnProperty(b)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function j(a){a.context&&(a.context=a.context.prev)}function k(a,b){for(var c;;){if(!a.context)return;if(c=a.context.tagName,!z.contextGrabbers.hasOwnProperty(c)||!z.contextGrabbers[c].hasOwnProperty(b))return;j(a)}}function l(a,b,c){return"openTag"==a?(c.tagStart=b.column(),m):"closeTag"==a?n:l}function m(a,b,c){return"word"==a?(c.tagName=b.current(),y="tag",q):(y="error",m)}function n(a,b,c){if("word"==a){var d=b.current();return c.context&&c.context.tagName!=d&&z.implicitlyClosed.hasOwnProperty(c.context.tagName)&&j(c),c.context&&c.context.tagName==d?(y="tag",o):(y="tag error",p)}return y="error",p}function o(a,b,c){return"endTag"!=a?(y="error",o):(j(c),l)}function p(a,b,c){return y="error",o(a,b,c)}function q(a,b,c){if("word"==a)return y="attribute",r;if("endTag"==a||"selfcloseTag"==a){var d=c.tagName,e=c.tagStart;return c.tagName=c.tagStart=null,"selfcloseTag"==a||z.autoSelfClosers.hasOwnProperty(d)?k(c,d):(k(c,d),c.context=new i(c,d,e==c.indented)),l}return y="error",q}function r(a,b,c){return"equals"==a?s:(z.allowMissing||(y="error"),q(a,b,c))}function s(a,b,c){return"string"==a?t:"word"==a&&z.allowUnquoted?(y="string",q):(y="error",q(a,b,c))}function t(a,b,c){return"string"==a?t:q(a,b,c)}var u=b.indentUnit,v=c.multilineTagIndentFactor||1,w=c.multilineTagIndentPastTag;null==w&&(w=!0);var x,y,z=c.htmlMode?{autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0}:{autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,caseFold:!1},A=c.alignCDATA;return{startState:function(){return{tokenize:d,state:l,indented:0,tagName:null,tagStart:null,context:null}},token:function(a,b){if(!b.tagName&&a.sol()&&(b.indented=a.indentation()),a.eatSpace())return null;x=null;var c=b.tokenize(a,b);return(c||x)&&"comment"!=c&&(y=null,b.state=b.state(x||c,a,b),y&&(c="error"==y?c+" error":y)),c},indent:function(b,c,f){var g=b.context;if(b.tokenize.isInAttribute)return b.tagStart==b.indented?b.stringStartCol+1:b.indented+u;if(g&&g.noIndent)return a.Pass;if(b.tokenize!=e&&b.tokenize!=d)return f?f.match(/^(\s*)/)[0].length:0;if(b.tagName)return w?b.tagStart+b.tagName.length+2:b.tagStart+u*v;if(A&&/$/,blockCommentStart:"",configuration:c.htmlMode?"html":"xml",helperType:c.htmlMode?"html":"xml"}}),a.defineMIME("text/xml","xml"),a.defineMIME("application/xml","xml"),a.mimeModes.hasOwnProperty("text/html")||a.defineMIME("text/html",{name:"xml",htmlMode:!0})}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/xquery/test.js b/media/editors/codemirror/mode/xquery/test.js deleted file mode 100644 index 1f148cdbbd8c0..0000000000000 --- a/media/editors/codemirror/mode/xquery/test.js +++ /dev/null @@ -1,67 +0,0 @@ -// CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: http://codemirror.net/LICENSE - -// Don't take these too seriously -- the expected results appear to be -// based on the results of actual runs without any serious manual -// verification. If a change you made causes them to fail, the test is -// as likely to wrong as the code. - -(function() { - var mode = CodeMirror.getMode({tabSize: 4}, "xquery"); - function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); } - - MT("eviltest", - "[keyword xquery] [keyword version] [variable "1][keyword .][atom 0][keyword -][variable ml"][def&variable ;] [comment (: this is : a \"comment\" :)]", - " [keyword let] [variable $let] [keyword :=] [variable <x] [variable attr][keyword =][variable "value">"test"<func>][def&variable ;function]() [variable $var] {[keyword function]()} {[variable $var]}[variable <][keyword /][variable func><][keyword /][variable x>]", - " [keyword let] [variable $joe][keyword :=][atom 1]", - " [keyword return] [keyword element] [variable element] {", - " [keyword attribute] [variable attribute] { [atom 1] },", - " [keyword element] [variable test] { [variable 'a'] }, [keyword attribute] [variable foo] { [variable "bar"] },", - " [def&variable fn:doc]()[[ [variable foo][keyword /][variable @bar] [keyword eq] [variable $let] ]],", - " [keyword //][variable x] } [comment (: a more 'evil' test :)]", - " [comment (: Modified Blakeley example (: with nested comment :) ... :)]", - " [keyword declare] [keyword private] [keyword function] [def&variable local:declare]() {()}[variable ;]", - " [keyword declare] [keyword private] [keyword function] [def&variable local:private]() {()}[variable ;]", - " [keyword declare] [keyword private] [keyword function] [def&variable local:function]() {()}[variable ;]", - " [keyword declare] [keyword private] [keyword function] [def&variable local:local]() {()}[variable ;]", - " [keyword let] [variable $let] [keyword :=] [variable <let>let] [variable $let] [keyword :=] [variable "let"<][keyword /let][variable >]", - " [keyword return] [keyword element] [variable element] {", - " [keyword attribute] [variable attribute] { [keyword try] { [def&variable xdmp:version]() } [keyword catch]([variable $e]) { [def&variable xdmp:log]([variable $e]) } },", - " [keyword attribute] [variable fn:doc] { [variable "bar"] [variable castable] [keyword as] [atom xs:string] },", - " [keyword element] [variable text] { [keyword text] { [variable "text"] } },", - " [def&variable fn:doc]()[[ [qualifier child::][variable eq][keyword /]([variable @bar] [keyword |] [qualifier attribute::][variable attribute]) [keyword eq] [variable $let] ]],", - " [keyword //][variable fn:doc]", - " }"); - - MT("testEmptySequenceKeyword", - "[string \"foo\"] [keyword instance] [keyword of] [keyword empty-sequence]()"); - - MT("testMultiAttr", - "[tag

    ][variable hello] [variable world][tag

    ]"); - - MT("test namespaced variable", - "[keyword declare] [keyword namespace] [variable e] [keyword =] [string \"http://example.com/ANamespace\"][variable ;declare] [keyword variable] [variable $e:exampleComThisVarIsNotRecognized] [keyword as] [keyword element]([keyword *]) [variable external;]"); - - MT("test EQName variable", - "[keyword declare] [keyword variable] [variable $\"http://www.example.com/ns/my\":var] [keyword :=] [atom 12][variable ;]", - "[tag ]{[variable $\"http://www.example.com/ns/my\":var]}[tag ]"); - - MT("test EQName function", - "[keyword declare] [keyword function] [def&variable \"http://www.example.com/ns/my\":fn] ([variable $a] [keyword as] [atom xs:integer]) [keyword as] [atom xs:integer] {", - " [variable $a] [keyword +] [atom 2]", - "}[variable ;]", - "[tag ]{[def&variable \"http://www.example.com/ns/my\":fn]([atom 12])}[tag ]"); - - MT("test EQName function with single quotes", - "[keyword declare] [keyword function] [def&variable 'http://www.example.com/ns/my':fn] ([variable $a] [keyword as] [atom xs:integer]) [keyword as] [atom xs:integer] {", - " [variable $a] [keyword +] [atom 2]", - "}[variable ;]", - "[tag ]{[def&variable 'http://www.example.com/ns/my':fn]([atom 12])}[tag ]"); - - MT("testProcessingInstructions", - "[def&variable data]([comment&meta ]) [keyword instance] [keyword of] [atom xs:string]"); - - MT("testQuoteEscapeDouble", - "[keyword let] [variable $rootfolder] [keyword :=] [string \"c:\\builds\\winnt\\HEAD\\qa\\scripts\\\"]", - "[keyword let] [variable $keysfolder] [keyword :=] [def&variable concat]([variable $rootfolder], [string \"keys\\\"])"); -})(); diff --git a/media/editors/codemirror/mode/xquery/xquery.js b/media/editors/codemirror/mode/xquery/xquery.js index c8f3d90a9fb8a..c642ee58fadc2 100644 --- a/media/editors/codemirror/mode/xquery/xquery.js +++ b/media/editors/codemirror/mode/xquery/xquery.js @@ -68,15 +68,6 @@ CodeMirror.defineMode("xquery", function() { return kwObj; }(); - // Used as scratch variables to communicate multiple values without - // consing up tons of objects. - var type, content; - - function ret(tp, style, cont) { - type = tp; content = cont; - return style; - } - function chain(stream, state, f) { state.tokenize = f; return f(stream, state); @@ -95,7 +86,7 @@ CodeMirror.defineMode("xquery", function() { if(stream.match("![CDATA", false)) { state.tokenize = tokenCDATA; - return ret("tag", "tag"); + return "tag"; } if(stream.match("?", false)) { @@ -112,28 +103,28 @@ CodeMirror.defineMode("xquery", function() { // start code block else if(ch == "{") { pushStateStack(state,{ type: "codeblock"}); - return ret("", null); + return null; } // end code block else if(ch == "}") { popStateStack(state); - return ret("", null); + return null; } // if we're in an XML block else if(isInXmlBlock(state)) { if(ch == ">") - return ret("tag", "tag"); + return "tag"; else if(ch == "/" && stream.eat(">")) { popStateStack(state); - return ret("tag", "tag"); + return "tag"; } else - return ret("word", "variable"); + return "variable"; } // if a number else if (/\d/.test(ch)) { stream.match(/^\d*(?:\.\d*)?(?:E[+\-]?\d+)?/); - return ret("number", "atom"); + return "atom"; } // comment start else if (ch === "(" && stream.eat(":")) { @@ -149,27 +140,27 @@ CodeMirror.defineMode("xquery", function() { } // assignment else if(ch ===":" && stream.eat("=")) { - return ret("operator", "keyword"); + return "keyword"; } // open paren else if(ch === "(") { pushStateStack(state, { type: "paren"}); - return ret("", null); + return null; } // close paren else if(ch === ")") { popStateStack(state); - return ret("", null); + return null; } // open paren else if(ch === "[") { pushStateStack(state, { type: "bracket"}); - return ret("", null); + return null; } // close paren else if(ch === "]") { popStateStack(state); - return ret("", null); + return null; } else { var known = keywords.propertyIsEnumerable(ch) && keywords[ch]; @@ -204,15 +195,14 @@ CodeMirror.defineMode("xquery", function() { // if the previous word was element, attribute, axis specifier, this word should be the name of that if(isInXmlConstructor(state)) { popStateStack(state); - return ret("word", "variable", word); + return "variable"; } // as previously checked, if the word is element,attribute, axis specifier, call it an "xmlconstructor" and // push the stack so we know to look for it on the next word if(word == "element" || word == "attribute" || known.type == "axis_specifier") pushStateStack(state, {type: "xmlconstructor"}); // if the word is known, return the details of that else just call this a generic 'word' - return known ? ret(known.type, known.style, word) : - ret("word", "variable", word); + return known ? known.style : "variable"; } } @@ -235,7 +225,7 @@ CodeMirror.defineMode("xquery", function() { maybeNested = (ch == "("); } - return ret("comment", "comment"); + return "comment"; } // tokenizer for string literals @@ -247,7 +237,7 @@ CodeMirror.defineMode("xquery", function() { if(isInString(state) && stream.current() == quote) { popStateStack(state); if(f) state.tokenize = f; - return ret("string", "string"); + return "string"; } pushStateStack(state, { type: "string", name: quote, tokenize: tokenString(quote, f) }); @@ -255,7 +245,7 @@ CodeMirror.defineMode("xquery", function() { // if we're in a string and in an XML block, allow an embedded code block if(stream.match("{", false) && isInXmlAttributeBlock(state)) { state.tokenize = tokenBase; - return ret("string", "string"); + return "string"; } @@ -269,13 +259,13 @@ CodeMirror.defineMode("xquery", function() { // if we're in a string and in an XML block, allow an embedded code block in an attribute if(stream.match("{", false) && isInXmlAttributeBlock(state)) { state.tokenize = tokenBase; - return ret("string", "string"); + return "string"; } } } - return ret("string", "string"); + return "string"; }; } @@ -293,7 +283,7 @@ CodeMirror.defineMode("xquery", function() { } stream.eatWhile(isVariableChar); state.tokenize = tokenBase; - return ret("variable", "variable"); + return "variable"; } // tokenizer for XML tags @@ -303,19 +293,19 @@ CodeMirror.defineMode("xquery", function() { if(isclose && stream.eat(">")) { popStateStack(state); state.tokenize = tokenBase; - return ret("tag", "tag"); + return "tag"; } // self closing tag without attributes? if(!stream.eat("/")) pushStateStack(state, { type: "tag", name: name, tokenize: tokenBase}); if(!stream.eat(">")) { state.tokenize = tokenAttribute; - return ret("tag", "tag"); + return "tag"; } else { state.tokenize = tokenBase; } - return ret("tag", "tag"); + return "tag"; }; } @@ -326,14 +316,14 @@ CodeMirror.defineMode("xquery", function() { if(ch == "/" && stream.eat(">")) { if(isInXmlAttributeBlock(state)) popStateStack(state); if(isInXmlBlock(state)) popStateStack(state); - return ret("tag", "tag"); + return "tag"; } if(ch == ">") { if(isInXmlAttributeBlock(state)) popStateStack(state); - return ret("tag", "tag"); + return "tag"; } if(ch == "=") - return ret("", null); + return null; // quoted string if (ch == '"' || ch == "'") return chain(stream, state, tokenString(ch, tokenAttribute)); @@ -351,7 +341,7 @@ CodeMirror.defineMode("xquery", function() { state.tokenize = tokenBase; } - return ret("attribute", "attribute"); + return "attribute"; } // handle comments, including nested @@ -360,7 +350,7 @@ CodeMirror.defineMode("xquery", function() { while (ch = stream.next()) { if (ch == "-" && stream.match("->", true)) { state.tokenize = tokenBase; - return ret("comment", "comment"); + return "comment"; } } } @@ -372,7 +362,7 @@ CodeMirror.defineMode("xquery", function() { while (ch = stream.next()) { if (ch == "]" && stream.match("]", true)) { state.tokenize = tokenBase; - return ret("comment", "comment"); + return "comment"; } } } @@ -383,7 +373,7 @@ CodeMirror.defineMode("xquery", function() { while (ch = stream.next()) { if (ch == "?" && stream.match(">", true)) { state.tokenize = tokenBase; - return ret("comment", "comment meta"); + return "comment meta"; } } } diff --git a/media/editors/codemirror/mode/xquery/xquery.min.js b/media/editors/codemirror/mode/xquery/xquery.min.js new file mode 100644 index 0000000000000..0332102426d09 --- /dev/null +++ b/media/editors/codemirror/mode/xquery/xquery.min.js @@ -0,0 +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("xquery",function(){function a(a,b,c){return b.tokenize=c,c(a,b)}function b(b,g){var l=b.next(),n=!1,p=o(b);if("<"==l){if(b.match("!--",!0))return a(b,g,h);if(b.match("![CDATA",!1))return g.tokenize=i,"tag";if(b.match("?",!1))return a(b,g,j);var t=b.eat("/");b.eatSpace();for(var u,v="";u=b.eat(/[^\s\u00a0=<>\"\'\/?]/);)v+=u;return a(b,g,f(v,t))}if("{"==l)return q(g,{type:"codeblock"}),null;if("}"==l)return r(g),null;if(k(g))return">"==l?"tag":"/"==l&&b.eat(">")?(r(g),"tag"):"variable";if(/\d/.test(l))return b.match(/^\d*(?:\.\d*)?(?:E[+\-]?\d+)?/),"atom";if("("===l&&b.eat(":"))return q(g,{type:"comment"}),a(b,g,c);if(p||'"'!==l&&"'"!==l){if("$"===l)return a(b,g,e);if(":"===l&&b.eat("="))return"keyword";if("("===l)return q(g,{type:"paren"}),null;if(")"===l)return r(g),null;if("["===l)return q(g,{type:"bracket"}),null;if("]"===l)return r(g),null;var w=s.propertyIsEnumerable(l)&&s[l];if(p&&'"'===l)for(;'"'!==b.next(););if(p&&"'"===l)for(;"'"!==b.next(););w||b.eatWhile(/[\w\$_-]/);var x=b.eat(":");!b.eat(":")&&x&&b.eatWhile(/[\w\$_-]/),b.match(/^[ \t]*\(/,!1)&&(n=!0);var y=b.current();return w=s.propertyIsEnumerable(y)&&s[y],n&&!w&&(w={type:"function_call",style:"variable def"}),m(g)?(r(g),"variable"):(("element"==y||"attribute"==y||"axis_specifier"==w.type)&&q(g,{type:"xmlconstructor"}),w?w.style:"variable")}return a(b,g,d(l))}function c(a,b){for(var c,d=!1,e=!1,f=0;c=a.next();){if(")"==c&&d){if(!(f>0)){r(b);break}f--}else":"==c&&e&&f++;d=":"==c,e="("==c}return"comment"}function d(a,c){return function(e,f){var g;if(n(f)&&e.current()==a)return r(f),c&&(f.tokenize=c),"string";if(q(f,{type:"string",name:a,tokenize:d(a,c)}),e.match("{",!1)&&l(f))return f.tokenize=b,"string";for(;g=e.next();){if(g==a){r(f),c&&(f.tokenize=c);break}if(e.match("{",!1)&&l(f))return f.tokenize=b,"string"}return"string"}}function e(a,c){var d=/[\w\$_-]/;if(a.eat('"')){for(;'"'!==a.next(););a.eat(":")}else a.eatWhile(d),a.match(":=",!1)||a.eat(":");return a.eatWhile(d),c.tokenize=b,"variable"}function f(a,c){return function(d,e){return d.eatSpace(),c&&d.eat(">")?(r(e),e.tokenize=b,"tag"):(d.eat("/")||q(e,{type:"tag",name:a,tokenize:b}),d.eat(">")?(e.tokenize=b,"tag"):(e.tokenize=g,"tag"))}}function g(c,e){var f=c.next();return"/"==f&&c.eat(">")?(l(e)&&r(e),k(e)&&r(e),"tag"):">"==f?(l(e)&&r(e),"tag"):"="==f?null:'"'==f||"'"==f?a(c,e,d(f,g)):(l(e)||q(e,{type:"attribute",tokenize:g}),c.eat(/[a-zA-Z_:]/),c.eatWhile(/[-a-zA-Z0-9_:.]/),c.eatSpace(),(c.match(">",!1)||c.match("/",!1))&&(r(e),e.tokenize=b),"attribute")}function h(a,c){for(var d;d=a.next();)if("-"==d&&a.match("->",!0))return c.tokenize=b,"comment"}function i(a,c){for(var d;d=a.next();)if("]"==d&&a.match("]",!0))return c.tokenize=b,"comment"}function j(a,c){for(var d;d=a.next();)if("?"==d&&a.match(">",!0))return c.tokenize=b,"comment meta"}function k(a){return p(a,"tag")}function l(a){return p(a,"attribute")}function m(a){return p(a,"xmlconstructor")}function n(a){return p(a,"string")}function o(a){return'"'===a.current()?a.match(/^[^\"]+\"\:/,!1):"'"===a.current()?a.match(/^[^\"]+\'\:/,!1):!1}function p(a,b){return a.stack.length&&a.stack[a.stack.length-1].type==b}function q(a,b){a.stack.push(b)}function r(a){a.stack.pop();var c=a.stack.length&&a.stack[a.stack.length-1].tokenize;a.tokenize=c||b}var s=function(){function a(a){return{type:a,style:"keyword"}}for(var b=a("keyword a"),c=a("keyword b"),d=a("keyword c"),e=a("operator"),f={type:"atom",style:"atom"},g={type:"punctuation",style:null},h={type:"axis_specifier",style:"qualifier"},i={"if":b,"switch":b,"while":b,"for":b,"else":c,then:c,"try":c,"finally":c,"catch":c,element:d,attribute:d,let:d,"implements":d,"import":d,module:d,namespace:d,"return":d,"super":d,"this":d,"throws":d,where:d,"private":d,",":g,"null":f,"fn:false()":f,"fn:true()":f},j=["after","ancestor","ancestor-or-self","and","as","ascending","assert","attribute","before","by","case","cast","child","comment","declare","default","define","descendant","descendant-or-self","descending","document","document-node","element","else","eq","every","except","external","following","following-sibling","follows","for","function","if","import","in","instance","intersect","item","let","module","namespace","node","node","of","only","or","order","parent","precedes","preceding","preceding-sibling","processing-instruction","ref","return","returns","satisfies","schema","schema-element","self","some","sortby","stable","text","then","to","treat","typeswitch","union","variable","version","where","xquery","empty-sequence"],k=0,l=j.length;l>k;k++)i[j[k]]=a(j[k]);for(var m=["xs:string","xs:float","xs:decimal","xs:double","xs:integer","xs:boolean","xs:date","xs:dateTime","xs:time","xs:duration","xs:dayTimeDuration","xs:time","xs:yearMonthDuration","numeric","xs:hexBinary","xs:base64Binary","xs:anyURI","xs:QName","xs:byte","xs:boolean","xs:anyURI","xf:yearMonthDuration"],k=0,l=m.length;l>k;k++)i[m[k]]=f;for(var n=["eq","ne","lt","le","gt","ge",":=","=",">",">=","<","<=",".","|","?","and","or","div","idiv","mod","*","/","+","-"],k=0,l=n.length;l>k;k++)i[n[k]]=e;for(var o=["self::","attribute::","child::","descendant::","descendant-or-self::","parent::","ancestor::","ancestor-or-self::","following::","preceding::","following-sibling::","preceding-sibling::"],k=0,l=o.length;l>k;k++)i[o[k]]=h;return i}();return{startState:function(){return{tokenize:b,cc:[],stack:[]}},token:function(a,b){if(a.eatSpace())return null;var c=b.tokenize(a,b);return c},blockCommentStart:"(:",blockCommentEnd:":)"}}),a.defineMIME("application/xquery","xquery")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/yaml/yaml.min.js b/media/editors/codemirror/mode/yaml/yaml.min.js new file mode 100644 index 0000000000000..1d44a82c481aa --- /dev/null +++ b/media/editors/codemirror/mode/yaml/yaml.min.js @@ -0,0 +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("yaml",function(){var a=["true","false","on","off","yes","no"],b=new RegExp("\\b(("+a.join(")|(")+"))$","i");return{token:function(a,c){var d=a.peek(),e=c.escaped;if(c.escaped=!1,"#"==d&&(0==a.pos||/\s/.test(a.string.charAt(a.pos-1))))return a.skipToEnd(),"comment";if(a.match(/^('([^']|\\.)*'?|"([^"]|\\.)*"?)/))return"string";if(c.literal&&a.indentation()>c.keyCol)return a.skipToEnd(),"string";if(c.literal&&(c.literal=!1),a.sol()){if(c.keyCol=0,c.pair=!1,c.pairStart=!1,a.match(/---/))return"def";if(a.match(/\.\.\./))return"def";if(a.match(/\s*-\s+/))return"meta"}if(a.match(/^(\{|\}|\[|\])/))return"{"==d?c.inlinePairs++:"}"==d?c.inlinePairs--:"["==d?c.inlineList++:c.inlineList--,"meta";if(c.inlineList>0&&!e&&","==d)return a.next(),"meta";if(c.inlinePairs>0&&!e&&","==d)return c.keyCol=0,c.pair=!1,c.pairStart=!1,a.next(),"meta";if(c.pairStart){if(a.match(/^\s*(\||\>)\s*/))return c.literal=!0,"meta";if(a.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i))return"variable-2";if(0==c.inlinePairs&&a.match(/^\s*-?[0-9\.\,]+\s?$/))return"number";if(c.inlinePairs>0&&a.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/))return"number";if(a.match(b))return"keyword"}return!c.pair&&a.match(/^\s*(?:[,\[\]{}&*!|>'"%@`][^\s'":]|[^,\[\]{}#&*!|>'"%@`])[^#]*?(?=\s*:($|\s))/)?(c.pair=!0,c.keyCol=a.indentation(),"atom"):c.pair&&a.match(/^:\s*/)?(c.pairStart=!0,"meta"):(c.pairStart=!1,c.escaped="\\"==d,a.next(),null)},startState:function(){return{pair:!1,pairStart:!1,keyCol:0,inlinePairs:0,inlineList:0,literal:!1,escaped:!1}}}}),a.defineMIME("text/x-yaml","yaml")}); \ No newline at end of file diff --git a/media/editors/codemirror/mode/z80/z80.js b/media/editors/codemirror/mode/z80/z80.js index ec41d050ac8f9..aae70216f8788 100644 --- a/media/editors/codemirror/mode/z80/z80.js +++ b/media/editors/codemirror/mode/z80/z80.js @@ -3,26 +3,35 @@ (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); + mod(require("../../lib/codemirror")); else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); + define(["../../lib/codemirror"], mod); else // Plain browser env - mod(CodeMirror); + mod(CodeMirror); })(function(CodeMirror) { "use strict"; -CodeMirror.defineMode('z80', function() { - var keywords1 = /^(exx?|(ld|cp|in)([di]r?)?|pop|push|ad[cd]|cpl|daa|dec|inc|neg|sbc|sub|and|bit|[cs]cf|x?or|res|set|r[lr]c?a?|r[lr]d|s[lr]a|srl|djnz|nop|rst|[de]i|halt|im|ot[di]r|out[di]?)\b/i; - var keywords2 = /^(call|j[pr]|ret[in]?)\b/i; - var keywords3 = /^b_?(call|jump)\b/i; +CodeMirror.defineMode('z80', function(_config, parserConfig) { + var ez80 = parserConfig.ez80; + var keywords1, keywords2; + if (ez80) { + keywords1 = /^(exx?|(ld|cp)([di]r?)?|[lp]ea|pop|push|ad[cd]|cpl|daa|dec|inc|neg|sbc|sub|and|bit|[cs]cf|x?or|res|set|r[lr]c?a?|r[lr]d|s[lr]a|srl|djnz|nop|[de]i|halt|im|in([di]mr?|ir?|irx|2r?)|ot(dmr?|[id]rx|imr?)|out(0?|[di]r?|[di]2r?)|tst(io)?|slp)(\.([sl]?i)?[sl])?\b/i; + keywords2 = /^(((call|j[pr]|rst|ret[in]?)(\.([sl]?i)?[sl])?)|(rs|st)mix)\b/i; + } else { + keywords1 = /^(exx?|(ld|cp|in)([di]r?)?|pop|push|ad[cd]|cpl|daa|dec|inc|neg|sbc|sub|and|bit|[cs]cf|x?or|res|set|r[lr]c?a?|r[lr]d|s[lr]a|srl|djnz|nop|rst|[de]i|halt|im|ot[di]r|out[di]?)\b/i; + keywords2 = /^(call|j[pr]|ret[in]?|b_?(call|jump))\b/i; + } + var variables1 = /^(af?|bc?|c|de?|e|hl?|l|i[xy]?|r|sp)\b/i; var variables2 = /^(n?[zc]|p[oe]?|m)\b/i; var errors = /^([hl][xy]|i[xy][hl]|slia|sll)\b/i; - var numbers = /^([\da-f]+h|[0-7]+o|[01]+b|\d+)\b/i; + var numbers = /^([\da-f]+h|[0-7]+o|[01]+b|\d+d?)\b/i; return { startState: function() { - return {context: 0}; + return { + context: 0 + }; }, token: function(stream, state) { if (!stream.column()) @@ -34,14 +43,21 @@ CodeMirror.defineMode('z80', function() { var w; if (stream.eatWhile(/\w/)) { + if (ez80 && stream.eat('.')) { + stream.eatWhile(/\w/); + } w = stream.current(); if (stream.indentation()) { - if (state.context == 1 && variables1.test(w)) - return 'variable-2'; + if ((state.context == 1 || state.context == 4) && variables1.test(w)) { + state.context = 4; + return 'var2'; + } - if (state.context == 2 && variables2.test(w)) - return 'variable-3'; + if (state.context == 2 && variables2.test(w)) { + state.context = 4; + return 'var3'; + } if (keywords1.test(w)) { state.context = 1; @@ -49,14 +65,13 @@ CodeMirror.defineMode('z80', function() { } else if (keywords2.test(w)) { state.context = 2; return 'keyword'; - } else if (keywords3.test(w)) { - state.context = 3; - return 'keyword'; + } else if (state.context == 4 && numbers.test(w)) { + return 'number'; } if (errors.test(w)) return 'error'; - } else if (numbers.test(w)) { + } else if (stream.match(numbers)) { return 'number'; } else { return null; @@ -77,7 +92,7 @@ CodeMirror.defineMode('z80', function() { if (stream.match(/\\?.'/)) return 'number'; } else if (stream.eat('.') || stream.sol() && stream.eat('#')) { - state.context = 4; + state.context = 5; if (stream.eatWhile(/\w/)) return 'def'; @@ -96,5 +111,6 @@ CodeMirror.defineMode('z80', function() { }); CodeMirror.defineMIME("text/x-z80", "z80"); +CodeMirror.defineMIME("text/x-ez80", { name: "z80", ez80: true }); }); diff --git a/media/editors/codemirror/mode/z80/z80.min.js b/media/editors/codemirror/mode/z80/z80.min.js new file mode 100644 index 0000000000000..d8eaea456d248 --- /dev/null +++ b/media/editors/codemirror/mode/z80/z80.min.js @@ -0,0 +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("z80",function(a,b){var c,d,e=b.ez80;e?(c=/^(exx?|(ld|cp)([di]r?)?|[lp]ea|pop|push|ad[cd]|cpl|daa|dec|inc|neg|sbc|sub|and|bit|[cs]cf|x?or|res|set|r[lr]c?a?|r[lr]d|s[lr]a|srl|djnz|nop|[de]i|halt|im|in([di]mr?|ir?|irx|2r?)|ot(dmr?|[id]rx|imr?)|out(0?|[di]r?|[di]2r?)|tst(io)?|slp)(\.([sl]?i)?[sl])?\b/i,d=/^(((call|j[pr]|rst|ret[in]?)(\.([sl]?i)?[sl])?)|(rs|st)mix)\b/i):(c=/^(exx?|(ld|cp|in)([di]r?)?|pop|push|ad[cd]|cpl|daa|dec|inc|neg|sbc|sub|and|bit|[cs]cf|x?or|res|set|r[lr]c?a?|r[lr]d|s[lr]a|srl|djnz|nop|rst|[de]i|halt|im|ot[di]r|out[di]?)\b/i,d=/^(call|j[pr]|ret[in]?|b_?(call|jump))\b/i);var f=/^(af?|bc?|c|de?|e|hl?|l|i[xy]?|r|sp)\b/i,g=/^(n?[zc]|p[oe]?|m)\b/i,h=/^([hl][xy]|i[xy][hl]|slia|sll)\b/i,i=/^([\da-f]+h|[0-7]+o|[01]+b|\d+d?)\b/i;return{startState:function(){return{context:0}},token:function(a,b){if(a.column()||(b.context=0),a.eatSpace())return null;var j;if(a.eatWhile(/\w/)){if(e&&a.eat(".")&&a.eatWhile(/\w/),j=a.current(),!a.indentation())return a.match(i)?"number":null;if((1==b.context||4==b.context)&&f.test(j))return b.context=4,"var2";if(2==b.context&&g.test(j))return b.context=4,"var3";if(c.test(j))return b.context=1,"keyword";if(d.test(j))return b.context=2,"keyword";if(4==b.context&&i.test(j))return"number";if(h.test(j))return"error"}else{if(a.eat(";"))return a.skipToEnd(),"comment";if(a.eat('"')){for(;(j=a.next())&&'"'!=j;)"\\"==j&&a.next();return"string"}if(a.eat("'")){if(a.match(/\\?.'/))return"number"}else if(a.eat(".")||a.sol()&&a.eat("#")){if(b.context=5,a.eatWhile(/\w/))return"def"}else if(a.eat("$")){if(a.eatWhile(/[\da-f]/i))return"number"}else if(a.eat("%")){if(a.eatWhile(/[01]/))return"number"}else a.next()}return null}}}),a.defineMIME("text/x-z80","z80"),a.defineMIME("text/x-ez80",{name:"z80",ez80:!0})}); \ No newline at end of file diff --git a/media/editors/codemirror/theme/3024-day.css b/media/editors/codemirror/theme/3024-day.css index 3c01c2bf58720..359281621bc2a 100644 --- a/media/editors/codemirror/theme/3024-day.css +++ b/media/editors/codemirror/theme/3024-day.css @@ -10,6 +10,8 @@ .cm-s-3024-day.CodeMirror {background: #f7f7f7; color: #3a3432;} .cm-s-3024-day div.CodeMirror-selected {background: #d6d5d4 !important;} +.cm-s-3024-day.CodeMirror ::selection { background: #d6d5d4; } +.cm-s-3024-day.CodeMirror ::-moz-selection { background: #d9d9d9; } .cm-s-3024-day .CodeMirror-gutters {background: #f7f7f7; border-right: 0px;} .cm-s-3024-day .CodeMirror-guttermarker { color: #db2d20; } diff --git a/media/editors/codemirror/theme/3024-night.css b/media/editors/codemirror/theme/3024-night.css index 631757fc47de9..ccab9d50bfa3e 100644 --- a/media/editors/codemirror/theme/3024-night.css +++ b/media/editors/codemirror/theme/3024-night.css @@ -10,6 +10,8 @@ .cm-s-3024-night.CodeMirror {background: #090300; color: #d6d5d4;} .cm-s-3024-night div.CodeMirror-selected {background: #3a3432 !important;} +.cm-s-3024-night.CodeMirror ::selection { background: rgba(58, 52, 50, .99); } +.cm-s-3024-night.CodeMirror ::-moz-selection { background: rgba(58, 52, 50, .99); } .cm-s-3024-night .CodeMirror-gutters {background: #090300; border-right: 0px;} .cm-s-3024-night .CodeMirror-guttermarker { color: #db2d20; } .cm-s-3024-night .CodeMirror-guttermarker-subtle { color: #5c5855; } diff --git a/media/editors/codemirror/theme/ambiance.css b/media/editors/codemirror/theme/ambiance.css index c844566eac848..afcf15a37af5b 100644 --- a/media/editors/codemirror/theme/ambiance.css +++ b/media/editors/codemirror/theme/ambiance.css @@ -30,12 +30,10 @@ .cm-s-ambiance .CodeMirror-matchingbracket { color: #0f0; } .cm-s-ambiance .CodeMirror-nonmatchingbracket { color: #f22; } -.cm-s-ambiance .CodeMirror-selected { - background: rgba(255, 255, 255, 0.15); -} -.cm-s-ambiance.CodeMirror-focused .CodeMirror-selected { - background: rgba(255, 255, 255, 0.10); -} +.cm-s-ambiance .CodeMirror-selected { background: rgba(255, 255, 255, 0.15); } +.cm-s-ambiance.CodeMirror-focused .CodeMirror-selected { background: rgba(255, 255, 255, 0.10); } +.cm-s-ambiance.CodeMirror ::selection { background: rgba(255, 255, 255, 0.10); } +.cm-s-ambiance.CodeMirror ::-moz-selection { background: rgba(255, 255, 255, 0.10); } /* Editor styling */ diff --git a/media/editors/codemirror/theme/base16-dark.css b/media/editors/codemirror/theme/base16-dark.css index a46abdbbbde4a..b009d2b9d686a 100644 --- a/media/editors/codemirror/theme/base16-dark.css +++ b/media/editors/codemirror/theme/base16-dark.css @@ -10,6 +10,8 @@ .cm-s-base16-dark.CodeMirror {background: #151515; color: #e0e0e0;} .cm-s-base16-dark div.CodeMirror-selected {background: #303030 !important;} +.cm-s-base16-dark.CodeMirror ::selection { background: rgba(48, 48, 48, .99); } +.cm-s-base16-dark.CodeMirror ::-moz-selection { background: rgba(48, 48, 48, .99); } .cm-s-base16-dark .CodeMirror-gutters {background: #151515; border-right: 0px;} .cm-s-base16-dark .CodeMirror-guttermarker { color: #ac4142; } .cm-s-base16-dark .CodeMirror-guttermarker-subtle { color: #505050; } diff --git a/media/editors/codemirror/theme/base16-light.css b/media/editors/codemirror/theme/base16-light.css index 12ff2eb06fdd5..15df6d3807ebe 100644 --- a/media/editors/codemirror/theme/base16-light.css +++ b/media/editors/codemirror/theme/base16-light.css @@ -10,6 +10,8 @@ .cm-s-base16-light.CodeMirror {background: #f5f5f5; color: #202020;} .cm-s-base16-light div.CodeMirror-selected {background: #e0e0e0 !important;} +.cm-s-base16-light.CodeMirror ::selection { background: #e0e0e0; } +.cm-s-base16-light.CodeMirror ::-moz-selection { background: #e0e0e0; } .cm-s-base16-light .CodeMirror-gutters {background: #f5f5f5; border-right: 0px;} .cm-s-base16-light .CodeMirror-guttermarker { color: #ac4142; } .cm-s-base16-light .CodeMirror-guttermarker-subtle { color: #b0b0b0; } diff --git a/media/editors/codemirror/theme/blackboard.css b/media/editors/codemirror/theme/blackboard.css index d7a2dc96953e3..02289b630b8bb 100644 --- a/media/editors/codemirror/theme/blackboard.css +++ b/media/editors/codemirror/theme/blackboard.css @@ -2,6 +2,8 @@ .cm-s-blackboard.CodeMirror { background: #0C1021; color: #F8F8F8; } .cm-s-blackboard .CodeMirror-selected { background: #253B76 !important; } +.cm-s-blackboard.CodeMirror ::selection { background: rgba(37, 59, 118, .99); } +.cm-s-blackboard.CodeMirror ::-moz-selection { background: rgba(37, 59, 118, .99); } .cm-s-blackboard .CodeMirror-gutters { background: #0C1021; border-right: 0; } .cm-s-blackboard .CodeMirror-guttermarker { color: #FBDE2D; } .cm-s-blackboard .CodeMirror-guttermarker-subtle { color: #888; } diff --git a/media/editors/codemirror/theme/cobalt.css b/media/editors/codemirror/theme/cobalt.css index 47440531a03d8..3915589494174 100644 --- a/media/editors/codemirror/theme/cobalt.css +++ b/media/editors/codemirror/theme/cobalt.css @@ -1,5 +1,7 @@ .cm-s-cobalt.CodeMirror { background: #002240; color: white; } .cm-s-cobalt div.CodeMirror-selected { background: #b36539 !important; } +.cm-s-cobalt.CodeMirror ::selection { background: rgba(179, 101, 57, .99); } +.cm-s-cobalt.CodeMirror ::-moz-selection { background: rgba(179, 101, 57, .99); } .cm-s-cobalt .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; } .cm-s-cobalt .CodeMirror-guttermarker { color: #ffee80; } .cm-s-cobalt .CodeMirror-guttermarker-subtle { color: #d0d0d0; } diff --git a/media/editors/codemirror/theme/colorforth.css b/media/editors/codemirror/theme/colorforth.css new file mode 100644 index 0000000000000..73fbf80824de0 --- /dev/null +++ b/media/editors/codemirror/theme/colorforth.css @@ -0,0 +1,33 @@ +.cm-s-colorforth.CodeMirror { background: #000000; color: #f8f8f8; } +.cm-s-colorforth .CodeMirror-gutters { background: #0a001f; border-right: 1px solid #aaa; } +.cm-s-colorforth .CodeMirror-guttermarker { color: #FFBD40; } +.cm-s-colorforth .CodeMirror-guttermarker-subtle { color: #78846f; } +.cm-s-colorforth .CodeMirror-linenumber { color: #bababa; } +.cm-s-colorforth .CodeMirror-cursor { border-left: 1px solid white !important; } + +.cm-s-colorforth span.cm-comment { color: #ededed; } +.cm-s-colorforth span.cm-def { color: #ff1c1c; font-weight:bold; } +.cm-s-colorforth span.cm-keyword { color: #ffd900; } +.cm-s-colorforth span.cm-builtin { color: #00d95a; } +.cm-s-colorforth span.cm-variable { color: #73ff00; } +.cm-s-colorforth span.cm-string { color: #007bff; } +.cm-s-colorforth span.cm-number { color: #00c4ff; } +.cm-s-colorforth span.cm-atom { color: #606060; } + +.cm-s-colorforth span.cm-variable-2 { color: #EEE; } +.cm-s-colorforth span.cm-variable-3 { color: #DDD; } +.cm-s-colorforth span.cm-property {} +.cm-s-colorforth span.cm-operator {} + +.cm-s-colorforth span.cm-meta { color: yellow; } +.cm-s-colorforth span.cm-qualifier { color: #FFF700; } +.cm-s-colorforth span.cm-bracket { color: #cc7; } +.cm-s-colorforth span.cm-tag { color: #FFBD40; } +.cm-s-colorforth span.cm-attribute { color: #FFF700; } +.cm-s-colorforth span.cm-error { color: #f00; } + +.cm-s-colorforth .CodeMirror-selected { background: #333d53 !important; } + +.cm-s-colorforth span.cm-compilation { background: rgba(255, 255, 255, 0.12); } + +.cm-s-colorforth .CodeMirror-activeline-background {background: #253540 !important;} diff --git a/media/editors/codemirror/theme/erlang-dark.css b/media/editors/codemirror/theme/erlang-dark.css index ff47d7f8de0a8..25c7e0a2aad79 100644 --- a/media/editors/codemirror/theme/erlang-dark.css +++ b/media/editors/codemirror/theme/erlang-dark.css @@ -1,5 +1,7 @@ .cm-s-erlang-dark.CodeMirror { background: #002240; color: white; } .cm-s-erlang-dark div.CodeMirror-selected { background: #b36539 !important; } +.cm-s-erlang-dark.CodeMirror ::selection { background: rgba(179, 101, 57, .99); } +.cm-s-erlang-dark.CodeMirror ::-moz-selection { background: rgba(179, 101, 57, .99); } .cm-s-erlang-dark .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; } .cm-s-erlang-dark .CodeMirror-guttermarker { color: white; } .cm-s-erlang-dark .CodeMirror-guttermarker-subtle { color: #d0d0d0; } diff --git a/media/editors/codemirror/theme/lesser-dark.css b/media/editors/codemirror/theme/lesser-dark.css index a78247473966f..5af8b7f627167 100644 --- a/media/editors/codemirror/theme/lesser-dark.css +++ b/media/editors/codemirror/theme/lesser-dark.css @@ -7,6 +7,8 @@ Ported to CodeMirror by Peter Kroon } .cm-s-lesser-dark.CodeMirror { background: #262626; color: #EBEFE7; text-shadow: 0 -1px 1px #262626; } .cm-s-lesser-dark div.CodeMirror-selected {background: #45443B !important;} /* 33322B*/ +.cm-s-lesser-dark.CodeMirror ::selection { background: rgba(69, 68, 59, .99); } +.cm-s-lesser-dark.CodeMirror ::-moz-selection { background: rgba(69, 68, 59, .99); } .cm-s-lesser-dark .CodeMirror-cursor { border-left: 1px solid white !important; } .cm-s-lesser-dark pre { padding: 0 8px; }/*editable code holder*/ diff --git a/media/editors/codemirror/theme/liquibyte.css b/media/editors/codemirror/theme/liquibyte.css new file mode 100644 index 0000000000000..a6e070c6a8877 --- /dev/null +++ b/media/editors/codemirror/theme/liquibyte.css @@ -0,0 +1,95 @@ +.cm-s-liquibyte.CodeMirror { + background-color: #000; + color: #fff; + line-height: 1.2em; + font-size: 1em; +} +.CodeMirror-focused .cm-matchhighlight { + text-decoration: underline; + text-decoration-color: #0f0; + text-decoration-style: wavy; +} +.cm-trailingspace { + text-decoration: line-through; + text-decoration-color: #f00; + text-decoration-style: dotted; +} +.cm-tab { + text-decoration: line-through; + text-decoration-color: #404040; + text-decoration-style: dotted; +} +.cm-s-liquibyte .CodeMirror-gutters { background-color: #262626; border-right: 1px solid #505050; padding-right: 0.8em; } +.cm-s-liquibyte .CodeMirror-gutter-elt div{ font-size: 1.2em; } +.cm-s-liquibyte .CodeMirror-guttermarker { } +.cm-s-liquibyte .CodeMirror-guttermarker-subtle { } +.cm-s-liquibyte .CodeMirror-linenumber { color: #606060; padding-left: 0;} +.cm-s-liquibyte .CodeMirror-cursor { border-left: 1px solid #eee !important; } + +.cm-s-liquibyte span.cm-comment { color: #008000; } +.cm-s-liquibyte span.cm-def { color: #ffaf40; font-weight: bold; } +.cm-s-liquibyte span.cm-keyword { color: #c080ff; font-weight: bold; } +.cm-s-liquibyte span.cm-builtin { color: #ffaf40; font-weight: bold; } +.cm-s-liquibyte span.cm-variable { color: #5967ff; font-weight: bold; } +.cm-s-liquibyte span.cm-string { color: #ff8000; } +.cm-s-liquibyte span.cm-number { color: #0f0; font-weight: bold; } +.cm-s-liquibyte span.cm-atom { color: #bf3030; font-weight: bold; } + +.cm-s-liquibyte span.cm-variable-2 { color: #007f7f; font-weight: bold; } +.cm-s-liquibyte span.cm-variable-3 { color: #c080ff; font-weight: bold; } +.cm-s-liquibyte span.cm-property { color: #999; font-weight: bold; } +.cm-s-liquibyte span.cm-operator { color: #fff; } + +.cm-s-liquibyte span.cm-meta { color: #0f0; } +.cm-s-liquibyte span.cm-qualifier { color: #fff700; font-weight: bold; } +.cm-s-liquibyte span.cm-bracket { color: #cc7; } +.cm-s-liquibyte span.cm-tag { color: #ff0; font-weight: bold; } +.cm-s-liquibyte span.cm-attribute { color: #c080ff; font-weight: bold; } +.cm-s-liquibyte span.cm-error { color: #f00; } + +.cm-s-liquibyte .CodeMirror-selected { background-color: rgba(255, 0, 0, 0.25) !important; } + +.cm-s-liquibyte span.cm-compilation { background-color: rgba(255, 255, 255, 0.12); } + +.cm-s-liquibyte .CodeMirror-activeline-background {background-color: rgba(0, 255, 0, 0.15) !important;} + +/* Default styles for common addons */ +div.CodeMirror span.CodeMirror-matchingbracket { color: #0f0; font-weight: bold; } +div.CodeMirror span.CodeMirror-nonmatchingbracket { color: #f00; font-weight: bold; } +.CodeMirror-matchingtag { background-color: rgba(150, 255, 0, .3); } +/* Scrollbars */ +/* Simple */ +div.CodeMirror-simplescroll-horizontal div:hover, div.CodeMirror-simplescroll-vertical div:hover { + background-color: rgba(80, 80, 80, .7); +} +div.CodeMirror-simplescroll-horizontal div, div.CodeMirror-simplescroll-vertical div { + background-color: rgba(80, 80, 80, .3); + border: 1px solid #404040; + border-radius: 5px; +} +div.CodeMirror-simplescroll-vertical div { + border-top: 1px solid #404040; + border-bottom: 1px solid #404040; +} +div.CodeMirror-simplescroll-horizontal div { + border-left: 1px solid #404040; + border-right: 1px solid #404040; +} +div.CodeMirror-simplescroll-vertical { + background-color: #262626; +} +div.CodeMirror-simplescroll-horizontal { + background-color: #262626; + border-top: 1px solid #404040; +} +/* Overlay */ +div.CodeMirror-overlayscroll-horizontal div, div.CodeMirror-overlayscroll-vertical div { + background-color: #404040; + border-radius: 5px; +} +div.CodeMirror-overlayscroll-vertical div { + border: 1px solid #404040; +} +div.CodeMirror-overlayscroll-horizontal div { + border: 1px solid #404040; +} diff --git a/media/editors/codemirror/theme/mbo.css b/media/editors/codemirror/theme/mbo.css index 0ad6360b50ecc..e39879522e37f 100644 --- a/media/editors/codemirror/theme/mbo.css +++ b/media/editors/codemirror/theme/mbo.css @@ -6,6 +6,8 @@ .cm-s-mbo.CodeMirror {background: #2c2c2c; color: #ffffec;} .cm-s-mbo div.CodeMirror-selected {background: #716C62 !important;} +.cm-s-mbo.CodeMirror ::selection { background: rgba(113, 108, 98, .99); } +.cm-s-mbo.CodeMirror ::-moz-selection { background: rgba(113, 108, 98, .99); } .cm-s-mbo .CodeMirror-gutters {background: #4e4e4e; border-right: 0px;} .cm-s-mbo .CodeMirror-guttermarker { color: white; } .cm-s-mbo .CodeMirror-guttermarker-subtle { color: grey; } diff --git a/media/editors/codemirror/theme/mdn-like.css b/media/editors/codemirror/theme/mdn-like.css index 81b21772d2411..9c73dc2f0ca12 100644 --- a/media/editors/codemirror/theme/mdn-like.css +++ b/media/editors/codemirror/theme/mdn-like.css @@ -9,9 +9,11 @@ */ .cm-s-mdn-like.CodeMirror { color: #999; background-color: #fff; } .cm-s-mdn-like .CodeMirror-selected { background: #cfc !important; } +.cm-s-mdn-like.CodeMirror ::selection { background: #cfc; } +.cm-s-mdn-like.CodeMirror ::-moz-selection { background: #cfc; } .cm-s-mdn-like .CodeMirror-gutters { background: #f8f8f8; border-left: 6px solid rgba(0,83,159,0.65); color: #333; } -.cm-s-mdn-like .CodeMirror-linenumber { color: #aaa; margin-left: 3px; } +.cm-s-mdn-like .CodeMirror-linenumber { color: #aaa; padding-left: 8px; } div.cm-s-mdn-like .CodeMirror-cursor { border-left: 2px solid #222; } .cm-s-mdn-like .cm-keyword { color: #6262FF; } diff --git a/media/editors/codemirror/theme/midnight.css b/media/editors/codemirror/theme/midnight.css index 4567d29399bc7..296af4f7d221a 100644 --- a/media/editors/codemirror/theme/midnight.css +++ b/media/editors/codemirror/theme/midnight.css @@ -15,6 +15,8 @@ .cm-s-midnight.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;} .cm-s-midnight div.CodeMirror-selected {background: #314D67 !important;} +.cm-s-midnight.CodeMirror ::selection { background: rgba(49, 77, 103, .99); } +.cm-s-midnight.CodeMirror ::-moz-selection { background: rgba(49, 77, 103, .99); } .cm-s-midnight .CodeMirror-gutters {background: #0F192A; border-right: 1px solid;} .cm-s-midnight .CodeMirror-guttermarker { color: white; } .cm-s-midnight .CodeMirror-guttermarker-subtle { color: #d0d0d0; } diff --git a/media/editors/codemirror/theme/monokai.css b/media/editors/codemirror/theme/monokai.css index 548d2dfff6033..9b9a6f3919212 100644 --- a/media/editors/codemirror/theme/monokai.css +++ b/media/editors/codemirror/theme/monokai.css @@ -2,6 +2,8 @@ .cm-s-monokai.CodeMirror {background: #272822; color: #f8f8f2;} .cm-s-monokai div.CodeMirror-selected {background: #49483E !important;} +.cm-s-monokai.CodeMirror ::selection { background: rgba(73, 72, 62, .99); } +.cm-s-monokai.CodeMirror ::-moz-selection { background: rgba(73, 72, 62, .99); } .cm-s-monokai .CodeMirror-gutters {background: #272822; border-right: 0px;} .cm-s-monokai .CodeMirror-guttermarker { color: white; } .cm-s-monokai .CodeMirror-guttermarker-subtle { color: #d0d0d0; } @@ -16,8 +18,9 @@ .cm-s-monokai span.cm-keyword {color: #f92672;} .cm-s-monokai span.cm-string {color: #e6db74;} -.cm-s-monokai span.cm-variable {color: #a6e22e;} +.cm-s-monokai span.cm-variable {color: #f8f8f2;} .cm-s-monokai span.cm-variable-2 {color: #9effff;} +.cm-s-monokai span.cm-variable-3 {color: #66d9ef;} .cm-s-monokai span.cm-def {color: #fd971f;} .cm-s-monokai span.cm-bracket {color: #f8f8f2;} .cm-s-monokai span.cm-tag {color: #f92672;} diff --git a/media/editors/codemirror/theme/night.css b/media/editors/codemirror/theme/night.css index a0bf8cfa7875c..6b2ac6c7cf02d 100644 --- a/media/editors/codemirror/theme/night.css +++ b/media/editors/codemirror/theme/night.css @@ -2,6 +2,8 @@ .cm-s-night.CodeMirror { background: #0a001f; color: #f8f8f8; } .cm-s-night div.CodeMirror-selected { background: #447 !important; } +.cm-s-night.CodeMirror ::selection { background: rgba(68, 68, 119, .99); } +.cm-s-night.CodeMirror ::-moz-selection { background: rgba(68, 68, 119, .99); } .cm-s-night .CodeMirror-gutters { background: #0a001f; border-right: 1px solid #aaa; } .cm-s-night .CodeMirror-guttermarker { color: white; } .cm-s-night .CodeMirror-guttermarker-subtle { color: #bbb; } diff --git a/media/editors/codemirror/theme/paraiso-dark.css b/media/editors/codemirror/theme/paraiso-dark.css index 53dcdf7a2ae9e..af914b60bf288 100644 --- a/media/editors/codemirror/theme/paraiso-dark.css +++ b/media/editors/codemirror/theme/paraiso-dark.css @@ -10,6 +10,8 @@ .cm-s-paraiso-dark.CodeMirror {background: #2f1e2e; color: #b9b6b0;} .cm-s-paraiso-dark div.CodeMirror-selected {background: #41323f !important;} +.cm-s-paraiso-dark.CodeMirror ::selection { background: rgba(65, 50, 63, .99); } +.cm-s-paraiso-dark.CodeMirror ::-moz-selection { background: rgba(65, 50, 63, .99); } .cm-s-paraiso-dark .CodeMirror-gutters {background: #2f1e2e; border-right: 0px;} .cm-s-paraiso-dark .CodeMirror-guttermarker { color: #ef6155; } .cm-s-paraiso-dark .CodeMirror-guttermarker-subtle { color: #776e71; } diff --git a/media/editors/codemirror/theme/paraiso-light.css b/media/editors/codemirror/theme/paraiso-light.css index 07ca325978d52..e198066faa7d2 100644 --- a/media/editors/codemirror/theme/paraiso-light.css +++ b/media/editors/codemirror/theme/paraiso-light.css @@ -10,6 +10,8 @@ .cm-s-paraiso-light.CodeMirror {background: #e7e9db; color: #41323f;} .cm-s-paraiso-light div.CodeMirror-selected {background: #b9b6b0 !important;} +.cm-s-paraiso-light.CodeMirror ::selection { background: #b9b6b0; } +.cm-s-paraiso-light.CodeMirror ::-moz-selection { background: #b9b6b0; } .cm-s-paraiso-light .CodeMirror-gutters {background: #e7e9db; border-right: 0px;} .cm-s-paraiso-light .CodeMirror-guttermarker { color: black; } .cm-s-paraiso-light .CodeMirror-guttermarker-subtle { color: #8d8687; } diff --git a/media/editors/codemirror/theme/pastel-on-dark.css b/media/editors/codemirror/theme/pastel-on-dark.css index 7992ac7d2d086..0d06f63284d30 100644 --- a/media/editors/codemirror/theme/pastel-on-dark.css +++ b/media/editors/codemirror/theme/pastel-on-dark.css @@ -14,6 +14,9 @@ font-size: 14px; } .cm-s-pastel-on-dark div.CodeMirror-selected { background: rgba(221,240,255,0.2) !important; } +.cm-s-pastel-on-dark.CodeMirror ::selection { background: rgba(221,240,255,0.2); } +.cm-s-pastel-on-dark.CodeMirror ::-moz-selection { background: rgba(221,240,255,0.2); } + .cm-s-pastel-on-dark .CodeMirror-gutters { background: #34302f; border-right: 0px; diff --git a/media/editors/codemirror/theme/rubyblue.css b/media/editors/codemirror/theme/rubyblue.css index 5349838940cb0..d2fc0ecdbcf07 100644 --- a/media/editors/codemirror/theme/rubyblue.css +++ b/media/editors/codemirror/theme/rubyblue.css @@ -1,5 +1,7 @@ .cm-s-rubyblue.CodeMirror { background: #112435; color: white; } .cm-s-rubyblue div.CodeMirror-selected { background: #38566F !important; } +.cm-s-rubyblue.CodeMirror ::selection { background: rgba(56, 86, 111, 0.99); } +.cm-s-rubyblue.CodeMirror ::-moz-selection { background: rgba(56, 86, 111, 0.99); } .cm-s-rubyblue .CodeMirror-gutters { background: #1F4661; border-right: 7px solid #3E7087; } .cm-s-rubyblue .CodeMirror-guttermarker { color: white; } .cm-s-rubyblue .CodeMirror-guttermarker-subtle { color: #3E7087; } diff --git a/media/editors/codemirror/theme/solarized.css b/media/editors/codemirror/theme/solarized.css index 07ef4068040d5..9db395157990e 100644 --- a/media/editors/codemirror/theme/solarized.css +++ b/media/editors/codemirror/theme/solarized.css @@ -53,7 +53,7 @@ http://ethanschoonover.com/solarized/img/solarized-palette.png .cm-s-solarized .cm-number { color: #d33682; } .cm-s-solarized .cm-def { color: #2aa198; } -.cm-s-solarized .cm-variable { color: #268bd2; } +.cm-s-solarized .cm-variable { color: #839496; } .cm-s-solarized .cm-variable-2 { color: #b58900; } .cm-s-solarized .cm-variable-3 { color: #6c71c4; } @@ -94,13 +94,13 @@ http://ethanschoonover.com/solarized/img/solarized-palette.png border-bottom: 1px dotted #dc322f; } -.cm-s-solarized.cm-s-dark .CodeMirror-selected { - background: #073642; -} +.cm-s-solarized.cm-s-dark .CodeMirror-selected { background: #073642; } +.cm-s-solarized.cm-s-dark.CodeMirror ::selection { background: rgba(7, 54, 66, 0.99); } +.cm-s-solarized.cm-s-dark.CodeMirror ::-moz-selection { background: rgba(7, 54, 66, 0.99); } -.cm-s-solarized.cm-s-light .CodeMirror-selected { - background: #eee8d5; -} +.cm-s-solarized.cm-s-light .CodeMirror-selected { background: #eee8d5; } +.cm-s-solarized.cm-s-light.CodeMirror ::selection { background: #eee8d5; } +.cm-s-solarized.cm-s-lightCodeMirror ::-moz-selection { background: #eee8d5; } /* Editor styling */ diff --git a/media/editors/codemirror/theme/the-matrix.css b/media/editors/codemirror/theme/the-matrix.css index 01474ca94dece..f29b22b0da4d5 100644 --- a/media/editors/codemirror/theme/the-matrix.css +++ b/media/editors/codemirror/theme/the-matrix.css @@ -1,5 +1,7 @@ .cm-s-the-matrix.CodeMirror { background: #000000; color: #00FF00; } .cm-s-the-matrix div.CodeMirror-selected { background: #2D2D2D !important; } +.cm-s-the-matrix.CodeMirror ::selection { background: rgba(45, 45, 45, 0.99); } +.cm-s-the-matrix.CodeMirror ::-moz-selection { background: rgba(45, 45, 45, 0.99); } .cm-s-the-matrix .CodeMirror-gutters { background: #060; border-right: 2px solid #00FF00; } .cm-s-the-matrix .CodeMirror-guttermarker { color: #0f0; } .cm-s-the-matrix .CodeMirror-guttermarker-subtle { color: white; } diff --git a/media/editors/codemirror/theme/tomorrow-night-eighties.css b/media/editors/codemirror/theme/tomorrow-night-eighties.css index 841413546c0de..5fca3cafbf3fa 100644 --- a/media/editors/codemirror/theme/tomorrow-night-eighties.css +++ b/media/editors/codemirror/theme/tomorrow-night-eighties.css @@ -10,6 +10,8 @@ .cm-s-tomorrow-night-eighties.CodeMirror {background: #000000; color: #CCCCCC;} .cm-s-tomorrow-night-eighties div.CodeMirror-selected {background: #2D2D2D !important;} +.cm-s-tomorrow-night-eighties.CodeMirror ::selection { background: rgba(45, 45, 45, 0.99); } +.cm-s-tomorrow-night-eighties.CodeMirror ::-moz-selection { background: rgba(45, 45, 45, 0.99); } .cm-s-tomorrow-night-eighties .CodeMirror-gutters {background: #000000; border-right: 0px;} .cm-s-tomorrow-night-eighties .CodeMirror-guttermarker { color: #f2777a; } .cm-s-tomorrow-night-eighties .CodeMirror-guttermarker-subtle { color: #777; } diff --git a/media/editors/codemirror/theme/ttcn.css b/media/editors/codemirror/theme/ttcn.css new file mode 100644 index 0000000000000..959c047968393 --- /dev/null +++ b/media/editors/codemirror/theme/ttcn.css @@ -0,0 +1,66 @@ +/* DEFAULT THEME */ +.cm-atom {color: #219;} +.cm-attribute {color: #00c;} +.cm-bracket {color: #997;} +.cm-comment {color: #333333;} +.cm-def {color: #00f;} +.cm-em {font-style: italic;} +.cm-error {color: #f00;} +.cm-header {color: #00f; font-weight: bold;} +.cm-hr {color: #999;} +.cm-invalidchar {color: #f00;} +.cm-keyword {font-weight:bold} +.cm-link {color: #00c; text-decoration: underline;} +.cm-meta {color: #555;} +.cm-negative {color: #d44;} +.cm-positive {color: #292;} +.cm-qualifier {color: #555;} +.cm-quote {color: #090;} +.cm-strikethrough {text-decoration: line-through;} +.cm-string {color: #006400;} +.cm-string-2 {color: #f50;} +.cm-strong {font-weight: bold;} +.cm-tag {color: #170;} +.cm-variable {color: #8B2252;} +.cm-variable-2 {color: #05a;} +.cm-variable-3 {color: #085;} + +.cm-negative {color: #d44;} +.cm-positive {color: #292;} +.cm-header, .cm-strong {font-weight: bold;} +.cm-em {font-style: italic;} +.cm-link {text-decoration: underline;} +.cm-strikethrough {text-decoration: line-through;} + +.cm-s-default .cm-error {color: #f00;} +.cm-invalidchar {color: #f00;} + +/* ASN */ +.cm-s-ttcn .cm-accessTypes, +.cm-s-ttcn .cm-compareTypes {color: #27408B} +.cm-s-ttcn .cm-cmipVerbs {color: #8B2252} +.cm-s-ttcn .cm-modifier {color:#D2691E} +.cm-s-ttcn .cm-status {color:#8B4545} +.cm-s-ttcn .cm-storage {color:#A020F0} +.cm-s-ttcn .cm-tags {color:#006400} + +/* CFG */ +.cm-s-ttcn .cm-externalCommands {color: #8B4545; font-weight:bold} +.cm-s-ttcn .cm-fileNCtrlMaskOptions, +.cm-s-ttcn .cm-sectionTitle {color: #2E8B57; font-weight:bold} + +/* TTCN */ +.cm-s-ttcn .cm-booleanConsts, +.cm-s-ttcn .cm-otherConsts, +.cm-s-ttcn .cm-verdictConsts {color: #006400} +.cm-s-ttcn .cm-configOps, +.cm-s-ttcn .cm-functionOps, +.cm-s-ttcn .cm-portOps, +.cm-s-ttcn .cm-sutOps, +.cm-s-ttcn .cm-timerOps, +.cm-s-ttcn .cm-verdictOps {color: #0000FF} +.cm-s-ttcn .cm-preprocessor, +.cm-s-ttcn .cm-templateMatch, +.cm-s-ttcn .cm-ttcn3Macros {color: #27408B} +.cm-s-ttcn .cm-types {color: #A52A2A; font-weight:bold} +.cm-s-ttcn .cm-visibilityModifiers {font-weight:bold} diff --git a/media/editors/codemirror/theme/twilight.css b/media/editors/codemirror/theme/twilight.css index 9ca50576d849d..889a83d7993e2 100644 --- a/media/editors/codemirror/theme/twilight.css +++ b/media/editors/codemirror/theme/twilight.css @@ -1,5 +1,7 @@ .cm-s-twilight.CodeMirror { background: #141414; color: #f7f7f7; } /**/ .cm-s-twilight .CodeMirror-selected { background: #323232 !important; } /**/ +.cm-s-twilight.CodeMirror ::selection { background: rgba(50, 50, 50, 0.99); } +.cm-s-twilight.CodeMirror ::-moz-selection { background: rgba(50, 50, 50, 0.99); } .cm-s-twilight .CodeMirror-gutters { background: #222; border-right: 1px solid #aaa; } .cm-s-twilight .CodeMirror-guttermarker { color: white; } diff --git a/media/editors/codemirror/theme/vibrant-ink.css b/media/editors/codemirror/theme/vibrant-ink.css index 5177282325c88..8ea535973c6ce 100644 --- a/media/editors/codemirror/theme/vibrant-ink.css +++ b/media/editors/codemirror/theme/vibrant-ink.css @@ -2,6 +2,8 @@ .cm-s-vibrant-ink.CodeMirror { background: black; color: white; } .cm-s-vibrant-ink .CodeMirror-selected { background: #35493c !important; } +.cm-s-vibrant-ink.CodeMirror ::selection { background: rgba(53, 73, 60, 0.99); } +.cm-s-vibrant-ink.CodeMirror ::-moz-selection { background: rgba(53, 73, 60, 0.99); } .cm-s-vibrant-ink .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; } .cm-s-vibrant-ink .CodeMirror-guttermarker { color: white; } diff --git a/media/editors/codemirror/theme/xq-dark.css b/media/editors/codemirror/theme/xq-dark.css index 116eccf21bc48..d537993e89f97 100644 --- a/media/editors/codemirror/theme/xq-dark.css +++ b/media/editors/codemirror/theme/xq-dark.css @@ -22,6 +22,8 @@ THE SOFTWARE. */ .cm-s-xq-dark.CodeMirror { background: #0a001f; color: #f8f8f8; } .cm-s-xq-dark .CodeMirror-selected { background: #27007A !important; } +.cm-s-xq-dark.CodeMirror ::selection { background: rgba(39, 0, 122, 0.99); } +.cm-s-xq-dark.CodeMirror ::-moz-selection { background: rgba(39, 0, 122, 0.99); } .cm-s-xq-dark .CodeMirror-gutters { background: #0a001f; border-right: 1px solid #aaa; } .cm-s-xq-dark .CodeMirror-guttermarker { color: #FFBD40; } .cm-s-xq-dark .CodeMirror-guttermarker-subtle { color: #f8f8f8; } diff --git a/media/jui/css/chosen.css b/media/jui/css/chosen.css index 3091181f6dc4a..50ae2d942bc5d 100644 --- a/media/jui/css/chosen.css +++ b/media/jui/css/chosen.css @@ -379,7 +379,6 @@ right: auto; left: 4px; } -.chzn-rtl.chzn-container-single-nosearch .chzn-search, .chzn-rtl .chzn-drop { left: 9999px; } @@ -410,6 +409,14 @@ .chzn-rtl.chzn-container-single.chzn-with-drop .chzn-single div b { background-position: -12px 2px; } +[dir="rtl"] .chzn-container .chzn-drop, +[dir="rtl"] .chzn-container-single.chzn-container-single-nosearch .chzn-search { + left: auto; + right: -9999px; +} +[dir="rtl"] .chzn-container.chzn-with-drop .chzn-drop { + right: 0; +} /* @end */ /* @group Retina compatibility */ diff --git a/media/jui/css/icomoon.css b/media/jui/css/icomoon.css index ea051b7713e23..f3efdb8a990d5 100644 --- a/media/jui/css/icomoon.css +++ b/media/jui/css/icomoon.css @@ -205,7 +205,6 @@ .icon-plus-2:before { content: "\5d"; } -.icon-ban-circle:before, .icon-minus-sign:before, .icon-minus-2:before { content: "\5e"; @@ -232,6 +231,7 @@ .icon-not-ok:before { content: "\4b"; } +.icon-ban-circle:before, .icon-minus-circle:before { content: "\e216"; } @@ -359,7 +359,6 @@ .icon-file-plus:before { content: "\29"; } -.icon-file-remove:before, .icon-file-minus:before { content: "\e017"; } diff --git a/media/jui/js/html5-uncompressed.js b/media/jui/js/html5-uncompressed.js new file mode 100644 index 0000000000000..77dace490002a --- /dev/null +++ b/media/jui/js/html5-uncompressed.js @@ -0,0 +1,322 @@ +/** +* @preserve HTML5 Shiv 3.7.2 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed +*/ +;(function(window, document) { +/*jshint evil:true */ + /** version */ + var version = '3.7.2'; + + /** Preset options */ + var options = window.html5 || {}; + + /** Used to skip problem elements */ + var reSkip = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i; + + /** Not all elements can be cloned in IE **/ + var saveClones = /^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i; + + /** Detect whether the browser supports default html5 styles */ + var supportsHtml5Styles; + + /** Name of the expando, to work with multiple documents or to re-shiv one document */ + var expando = '_html5shiv'; + + /** The id for the the documents expando */ + var expanID = 0; + + /** Cached data for each document */ + var expandoData = {}; + + /** Detect whether the browser supports unknown elements */ + var supportsUnknownElements; + + (function() { + try { + var a = document.createElement('a'); + a.innerHTML = ''; + //if the hidden property is implemented we can assume, that the browser supports basic HTML5 Styles + supportsHtml5Styles = ('hidden' in a); + + supportsUnknownElements = a.childNodes.length == 1 || (function() { + // assign a false positive if unable to shiv + (document.createElement)('a'); + var frag = document.createDocumentFragment(); + return ( + typeof frag.cloneNode == 'undefined' || + typeof frag.createDocumentFragment == 'undefined' || + typeof frag.createElement == 'undefined' + ); + }()); + } catch(e) { + // assign a false positive if detection fails => unable to shiv + supportsHtml5Styles = true; + supportsUnknownElements = true; + } + + }()); + + /*--------------------------------------------------------------------------*/ + + /** + * Creates a style sheet with the given CSS text and adds it to the document. + * @private + * @param {Document} ownerDocument The document. + * @param {String} cssText The CSS text. + * @returns {StyleSheet} The style element. + */ + function addStyleSheet(ownerDocument, cssText) { + var p = ownerDocument.createElement('p'), + parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement; + + p.innerHTML = 'x'; + return parent.insertBefore(p.lastChild, parent.firstChild); + } + + /** + * Returns the value of `html5.elements` as an array. + * @private + * @returns {Array} An array of shived element node names. + */ + function getElements() { + var elements = html5.elements; + return typeof elements == 'string' ? elements.split(' ') : elements; + } + + /** + * Extends the built-in list of html5 elements + * @memberOf html5 + * @param {String|Array} newElements whitespace separated list or array of new element names to shiv + * @param {Document} ownerDocument The context document. + */ + function addElements(newElements, ownerDocument) { + var elements = html5.elements; + if(typeof elements != 'string'){ + elements = elements.join(' '); + } + if(typeof newElements != 'string'){ + newElements = newElements.join(' '); + } + html5.elements = elements +' '+ newElements; + shivDocument(ownerDocument); + } + + /** + * Returns the data associated to the given document + * @private + * @param {Document} ownerDocument The document. + * @returns {Object} An object of data. + */ + function getExpandoData(ownerDocument) { + var data = expandoData[ownerDocument[expando]]; + if (!data) { + data = {}; + expanID++; + ownerDocument[expando] = expanID; + expandoData[expanID] = data; + } + return data; + } + + /** + * returns a shived element for the given nodeName and document + * @memberOf html5 + * @param {String} nodeName name of the element + * @param {Document} ownerDocument The context document. + * @returns {Object} The shived element. + */ + function createElement(nodeName, ownerDocument, data){ + if (!ownerDocument) { + ownerDocument = document; + } + if(supportsUnknownElements){ + return ownerDocument.createElement(nodeName); + } + if (!data) { + data = getExpandoData(ownerDocument); + } + var node; + + if (data.cache[nodeName]) { + node = data.cache[nodeName].cloneNode(); + } else if (saveClones.test(nodeName)) { + node = (data.cache[nodeName] = data.createElem(nodeName)).cloneNode(); + } else { + node = data.createElem(nodeName); + } + + // Avoid adding some elements to fragments in IE < 9 because + // * Attributes like `name` or `type` cannot be set/changed once an element + // is inserted into a document/fragment + // * Link elements with `src` attributes that are inaccessible, as with + // a 403 response, will cause the tab/window to crash + // * Script elements appended to fragments will execute when their `src` + // or `text` property is set + return node.canHaveChildren && !reSkip.test(nodeName) && !node.tagUrn ? data.frag.appendChild(node) : node; + } + + /** + * returns a shived DocumentFragment for the given document + * @memberOf html5 + * @param {Document} ownerDocument The context document. + * @returns {Object} The shived DocumentFragment. + */ + function createDocumentFragment(ownerDocument, data){ + if (!ownerDocument) { + ownerDocument = document; + } + if(supportsUnknownElements){ + return ownerDocument.createDocumentFragment(); + } + data = data || getExpandoData(ownerDocument); + var clone = data.frag.cloneNode(), + i = 0, + elems = getElements(), + l = elems.length; + for(;iarticle,aside,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}"; -c=d.insertBefore(c.lastChild,d.firstChild);b.hasCSS=!!c}g||t(a,b);return a}var k=l.html5||{},s=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,r=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,j,o="_html5shiv",h=0,n={},g;(function(){try{var a=f.createElement("a");a.innerHTML="";j="hidden"in a;var b;if(!(b=1==a.childNodes.length)){f.createElement("a");var c=f.createDocumentFragment();b="undefined"==typeof c.cloneNode|| -"undefined"==typeof c.createDocumentFragment||"undefined"==typeof c.createElement}g=b}catch(d){g=j=!0}})();var e={elements:k.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup main mark meter nav output progress section summary time video",version:"3.6.2",shivCSS:!1!==k.shivCSS,supportsUnknownElements:g,shivMethods:!1!==k.shivMethods,type:"default",shivDocument:q,createElement:p,createDocumentFragment:function(a,b){a||(a=f);if(g)return a.createDocumentFragment(); -for(var b=b||i(a),c=b.frag.cloneNode(),d=0,e=m(),h=e.length;d",d.insertBefore(c.lastChild,d.firstChild)}function d(){var a=t.elements;return"string"==typeof a?a.split(" "):a}function e(a,b){var c=t.elements;"string"!=typeof c&&(c=c.join(" ")),"string"!=typeof a&&(a=a.join(" ")),t.elements=c+" "+a,j(b)}function f(a){var b=s[a[q]];return b||(b={},r++,a[q]=r,s[r]=b),b}function g(a,c,d){if(c||(c=b),l)return c.createElement(a);d||(d=f(c));var e;return e=d.cache[a]?d.cache[a].cloneNode():p.test(a)?(d.cache[a]=d.createElem(a)).cloneNode():d.createElem(a),!e.canHaveChildren||o.test(a)||e.tagUrn?e:d.frag.appendChild(e)}function h(a,c){if(a||(a=b),l)return a.createDocumentFragment();c=c||f(a);for(var e=c.frag.cloneNode(),g=0,h=d(),i=h.length;i>g;g++)e.createElement(h[g]);return e}function i(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return t.shivMethods?g(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+d().join().replace(/[\w\-:]+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(t,b.frag)}function j(a){a||(a=b);var d=f(a);return!t.shivCSS||k||d.hasCSS||(d.hasCSS=!!c(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),l||i(a,d),a}var k,l,m="3.7.2",n=a.html5||{},o=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,p=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,q="_html5shiv",r=0,s={};!function(){try{var a=b.createElement("a");a.innerHTML="",k="hidden"in a,l=1==a.childNodes.length||function(){b.createElement("a");var a=b.createDocumentFragment();return"undefined"==typeof a.cloneNode||"undefined"==typeof a.createDocumentFragment||"undefined"==typeof a.createElement}()}catch(c){k=!0,l=!0}}();var t={elements:n.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video",version:m,shivCSS:n.shivCSS!==!1,supportsUnknownElements:l,shivMethods:n.shivMethods!==!1,type:"default",shivDocument:j,createElement:g,createDocumentFragment:h,addElements:e};a.html5=t,j(b)}(this,document); diff --git a/media/jui/js/icomoon-lte-ie7.js b/media/jui/js/icomoon-lte-ie7.js index 1797ca49c5855..42f7612810b6b 100644 --- a/media/jui/js/icomoon-lte-ie7.js +++ b/media/jui/js/icomoon-lte-ie7.js @@ -75,7 +75,6 @@ window.onload = function() { 'icon-brush' : ';', 'icon-save-new' : ']', 'icon-plus-2 ' : ']', - 'icon-ban-circle' : '^', 'icon-minus-sign' : '^', 'icon-minus-2' : '^', 'icon-delete' : 'I', @@ -90,6 +89,7 @@ window.onload = function() { 'icon-plus-circle' : '', 'icon-minus' : 'K', 'icon-not-ok' : 'K', + 'icon-ban-circle' : '', 'icon-minus-circle' : '', 'icon-unpublish' : 'J', 'icon-cancel' : 'J', @@ -143,7 +143,6 @@ window.onload = function() { 'icon-file-2' : '', 'icon-file-add' : ')', 'icon-file-plus' : ')', - 'icon-file-remove' : '', 'icon-file-minus' : '', 'icon-file-check' : '', 'icon-file-remove' : '', diff --git a/media/jui/js/jquery.autocomplete.js b/media/jui/js/jquery.autocomplete.js index 9476cf19a5947..3e8f527211fbc 100644 --- a/media/jui/js/jquery.autocomplete.js +++ b/media/jui/js/jquery.autocomplete.js @@ -1,966 +1,982 @@ /** - * Ajax Autocomplete for jQuery, version 1.2.14 - * (c) 2014 Tomas Kirda - * - * Ajax Autocomplete for jQuery is freely distributable under the terms of an MIT-style license. - * For details, see the web site: https://github.com/devbridge/jQuery-Autocomplete - */ +* Ajax Autocomplete for jQuery, version 1.2.18 +* (c) 2015 Tomas Kirda +* +* Ajax Autocomplete for jQuery is freely distributable under the terms of an MIT-style license. +* For details, see the web site: https://github.com/devbridge/jQuery-Autocomplete +*/ -/*jslint browser: true, white: true, plusplus: true */ -/*global define, window, document, jQuery, exports */ +/*jslint browser: true, white: true, plusplus: true, vars: true */ +/*global define, window, document, jQuery, exports, require */ // Expose plugin as an AMD module if AMD loader is present: (function (factory) { - 'use strict'; - if (typeof define === 'function' && define.amd) { - // AMD. Register as an anonymous module. - define(['jquery'], factory); - } else if (typeof exports === 'object' && typeof require === 'function') { - // Browserify - factory(require('jquery')); - } else { - // Browser globals - factory(jQuery); - } + 'use strict'; + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['jquery'], factory); + } else if (typeof exports === 'object' && typeof require === 'function') { + // Browserify + factory(require('jquery')); + } else { + // Browser globals + factory(jQuery); + } }(function ($) { - 'use strict'; - - var - utils = (function () { - return { - escapeRegExChars: function (value) { - return value.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); - }, - createNode: function (containerClass) { - var div = document.createElement('div'); - div.className = containerClass; - div.style.position = 'absolute'; - div.style.display = 'none'; - return div; - } - }; - }()), - - keys = { - ESC: 27, - TAB: 9, - RETURN: 13, - LEFT: 37, - UP: 38, - RIGHT: 39, - DOWN: 40 - }; - - function Autocomplete(el, options) { - var noop = function () { }, - that = this, - defaults = { - ajaxSettings: {}, - autoSelectFirst: false, - appendTo: document.body, - serviceUrl: null, - lookup: null, - onSelect: null, - width: 'auto', - minChars: 1, - maxHeight: 300, - deferRequestBy: 0, - params: {}, - formatResult: Autocomplete.formatResult, - delimiter: null, - zIndex: 9999, - type: 'GET', - noCache: false, - onSearchStart: noop, - onSearchComplete: noop, - onSearchError: noop, - containerClass: 'autocomplete-suggestions', - tabDisabled: false, - dataType: 'text', - currentRequest: null, - triggerSelectOnValidInput: true, - preventBadQueries: true, - lookupFilter: function (suggestion, originalQuery, queryLowerCase) { - return suggestion.value.toLowerCase().indexOf(queryLowerCase) !== -1; - }, - paramName: 'query', - transformResult: function (response) { - return typeof response === 'string' ? $.parseJSON(response) : response; - }, - showNoSuggestionNotice: false, - noSuggestionNotice: 'No results', - orientation: 'bottom', - forceFixPosition: false - }; - - // Shared variables: - that.element = el; - that.el = $(el); - that.suggestions = []; - that.badQueries = []; - that.selectedIndex = -1; - that.currentValue = that.element.value; - that.intervalId = 0; - that.cachedResponse = {}; - that.onChangeInterval = null; - that.onChange = null; - that.isLocal = false; - that.suggestionsContainer = null; - that.noSuggestionsContainer = null; - that.options = $.extend({}, defaults, options); - that.classes = { - selected: 'autocomplete-selected', - suggestion: 'autocomplete-suggestion' - }; - that.hint = null; - that.hintValue = ''; - that.selection = null; - - // Initialize and set options: - that.initialize(); - that.setOptions(options); - } - - Autocomplete.utils = utils; - - $.Autocomplete = Autocomplete; - - Autocomplete.formatResult = function (suggestion, currentValue) { - var pattern = '(' + utils.escapeRegExChars(currentValue) + ')'; - - return suggestion.value.replace(new RegExp(pattern, 'gi'), '$1<\/strong>'); - }; - - Autocomplete.prototype = { - - killerFn: null, - - initialize: function () { - var that = this, - suggestionSelector = '.' + that.classes.suggestion, - selected = that.classes.selected, - options = that.options, - container; - - // Remove autocomplete attribute to prevent native suggestions: - that.element.setAttribute('autocomplete', 'off'); - - that.killerFn = function (e) { - if ($(e.target).closest('.' + that.options.containerClass).length === 0) { - that.killSuggestions(); - that.disableKillerFn(); - } - }; - - // html() deals with many types: htmlString or Element or Array or jQuery - that.noSuggestionsContainer = $('
    ') - .html(this.options.noSuggestionNotice).get(0); - - that.suggestionsContainer = Autocomplete.utils.createNode(options.containerClass); - - container = $(that.suggestionsContainer); - - container.appendTo(options.appendTo); - - // Only set width if it was provided: - if (options.width !== 'auto') { - container.width(options.width); - } - - // Listen for mouse over event on suggestions list: - container.on('mouseover.autocomplete', suggestionSelector, function () { - that.activate($(this).data('index')); - }); - - // Deselect active element when mouse leaves suggestions container: - container.on('mouseout.autocomplete', function () { - that.selectedIndex = -1; - container.children('.' + selected).removeClass(selected); - }); - - // Listen for click event on suggestions list: - container.on('click.autocomplete', suggestionSelector, function () { - that.select($(this).data('index')); - }); - - that.fixPositionCapture = function () { - if (that.visible) { - that.fixPosition(); - } - }; - - $(window).on('resize.autocomplete', that.fixPositionCapture); - - that.el.on('keydown.autocomplete', function (e) { that.onKeyPress(e); }); - that.el.on('keyup.autocomplete', function (e) { that.onKeyUp(e); }); - that.el.on('blur.autocomplete', function () { that.onBlur(); }); - that.el.on('focus.autocomplete', function () { that.onFocus(); }); - that.el.on('change.autocomplete', function (e) { that.onKeyUp(e); }); - }, - - onFocus: function () { - var that = this; - that.fixPosition(); - if (that.options.minChars <= that.el.val().length) { - that.onValueChange(); - } - }, - - onBlur: function () { - this.enableKillerFn(); - }, - - setOptions: function (suppliedOptions) { - var that = this, - options = that.options; - - $.extend(options, suppliedOptions); - - that.isLocal = $.isArray(options.lookup); - - if (that.isLocal) { - options.lookup = that.verifySuggestionsFormat(options.lookup); - } - - options.orientation = that.validateOrientation(options.orientation, 'bottom'); - - // Adjust height, width and z-index: - $(that.suggestionsContainer).css({ - 'max-height': options.maxHeight + 'px', - 'width': options.width + 'px', - 'z-index': options.zIndex - }); - }, - - - clearCache: function () { - this.cachedResponse = {}; - this.badQueries = []; - }, - - clear: function () { - this.clearCache(); - this.currentValue = ''; - this.suggestions = []; - }, - - disable: function () { - var that = this; - that.disabled = true; - clearInterval(that.onChangeInterval); - if (that.currentRequest) { - that.currentRequest.abort(); - } - }, - - enable: function () { - this.disabled = false; - }, - - fixPosition: function () { - // Use only when container has already its content - - var that = this, - $container = $(that.suggestionsContainer), - containerParent = $container.parent().get(0); - // Fix position automatically when appended to body. - // In other cases force parameter must be given. - if (containerParent !== document.body && !that.options.forceFixPosition) - return; - - // Choose orientation - var orientation = that.options.orientation, - containerHeight = $container.outerHeight(), - height = that.el.outerHeight(), - offset = that.el.offset(), - styles = { 'top': offset.top, 'left': offset.left }; - - if (orientation == 'auto') { - var viewPortHeight = $(window).height(), - scrollTop = $(window).scrollTop(), - topOverflow = -scrollTop + offset.top - containerHeight, - bottomOverflow = scrollTop + viewPortHeight - (offset.top + height + containerHeight); - - orientation = (Math.max(topOverflow, bottomOverflow) === topOverflow) ? 'top' : 'bottom'; - } - - if (orientation === 'top') { - styles.top += -containerHeight; - } else { - styles.top += height; - } - - // If container is not positioned to body, - // correct its position using offset parent offset - if(containerParent !== document.body) { - var opacity = $container.css('opacity'), - parentOffsetDiff; - - if (!that.visible){ - $container.css('opacity', 0).show(); - } - - parentOffsetDiff = $container.offsetParent().offset(); - styles.top -= parentOffsetDiff.top; - styles.left -= parentOffsetDiff.left; - - if (!that.visible){ - $container.css('opacity', opacity).hide(); - } - } - - // -2px to account for suggestions border. - if (that.options.width === 'auto') { - styles.width = (that.el.outerWidth() - 2) + 'px'; - } - - $container.css(styles); - }, - - enableKillerFn: function () { - var that = this; - $(document).on('click.autocomplete', that.killerFn); - }, - - disableKillerFn: function () { - var that = this; - $(document).off('click.autocomplete', that.killerFn); - }, - - killSuggestions: function () { - var that = this; - that.stopKillSuggestions(); - that.intervalId = window.setInterval(function () { - that.hide(); - that.stopKillSuggestions(); - }, 50); - }, - - stopKillSuggestions: function () { - window.clearInterval(this.intervalId); - }, - - isCursorAtEnd: function () { - var that = this, - valLength = that.el.val().length, - selectionStart = that.element.selectionStart, - range; - - if (typeof selectionStart === 'number') { - return selectionStart === valLength; - } - if (document.selection) { - range = document.selection.createRange(); - range.moveStart('character', -valLength); - return valLength === range.text.length; - } - return true; - }, - - onKeyPress: function (e) { - var that = this; - - // If suggestions are hidden and user presses arrow down, display suggestions: - if (!that.disabled && !that.visible && e.which === keys.DOWN && that.currentValue) { - that.suggest(); - return; - } - - if (that.disabled || !that.visible) { - return; - } - - switch (e.which) { - case keys.ESC: - that.el.val(that.currentValue); - that.hide(); - break; - case keys.RIGHT: - if (that.hint && that.options.onHint && that.isCursorAtEnd()) { - that.selectHint(); - break; - } - return; - case keys.TAB: - if (that.hint && that.options.onHint) { - that.selectHint(); - return; - } - /* falls through */ - case keys.RETURN: - if (that.selectedIndex === -1) { - that.hide(); - return; - } - that.select(that.selectedIndex); - if (e.which === keys.TAB && that.options.tabDisabled === false) { - return; - } - break; - case keys.UP: - that.moveUp(); - break; - case keys.DOWN: - that.moveDown(); - break; - default: - return; - } - - // Cancel event if function did not return: - e.stopImmediatePropagation(); - e.preventDefault(); - }, - - onKeyUp: function (e) { - var that = this; - - if (that.disabled) { - return; - } - - switch (e.which) { - case keys.UP: - case keys.DOWN: - return; - } - - clearInterval(that.onChangeInterval); - - if (that.currentValue !== that.el.val()) { - that.findBestHint(); - if (that.options.deferRequestBy > 0) { - // Defer lookup in case when value changes very quickly: - that.onChangeInterval = setInterval(function () { - that.onValueChange(); - }, that.options.deferRequestBy); - } else { - that.onValueChange(); - } - } - }, - - onValueChange: function () { - var that = this, - options = that.options, - value = that.el.val(), - query = that.getQuery(value), - index; - - if (that.selection && that.currentValue !== query) { - that.selection = null; - (options.onInvalidateSelection || $.noop).call(that.element); - } - - clearInterval(that.onChangeInterval); - that.currentValue = value; - that.selectedIndex = -1; - - // Check existing suggestion for the match before proceeding: - if (options.triggerSelectOnValidInput) { - index = that.findSuggestionIndex(query); - if (index !== -1) { - that.select(index); - return; - } - } - - if (query.length < options.minChars) { - that.hide(); - } else { - that.getSuggestions(query); - } - }, - - findSuggestionIndex: function (query) { - var that = this, - index = -1, - queryLowerCase = query.toLowerCase(); - - $.each(that.suggestions, function (i, suggestion) { - if (suggestion.value.toLowerCase() === queryLowerCase) { - index = i; - return false; - } - }); - - return index; - }, - - getQuery: function (value) { - var delimiter = this.options.delimiter, - parts; - - if (!delimiter) { - return value; - } - parts = value.split(delimiter); - return $.trim(parts[parts.length - 1]); - }, - - getSuggestionsLocal: function (query) { - var that = this, - options = that.options, - queryLowerCase = query.toLowerCase(), - filter = options.lookupFilter, - limit = parseInt(options.lookupLimit, 10), - data; - - data = { - suggestions: $.grep(options.lookup, function (suggestion) { - return filter(suggestion, query, queryLowerCase); - }) - }; - - if (limit && data.suggestions.length > limit) { - data.suggestions = data.suggestions.slice(0, limit); - } - - return data; - }, - - getSuggestions: function (q) { - var response, - that = this, - options = that.options, - serviceUrl = options.serviceUrl, - params, - cacheKey, - ajaxSettings; - - options.params[options.paramName] = q; - params = options.ignoreParams ? null : options.params; - - if (options.onSearchStart.call(that.element, options.params) === false) { - return; - } - - if ($.isFunction(that.lookup)){ - that.lookup(q, function (data) { - that.suggestions = data.suggestions; - that.suggest(); - options.onSearchComplete.call(that.element, q, data.suggestions); - }); - return; - } - - if (that.isLocal) { - response = that.getSuggestionsLocal(q); - } else { - if ($.isFunction(serviceUrl)) { - serviceUrl = serviceUrl.call(that.element, q); - } - cacheKey = serviceUrl + '?' + $.param(params || {}); - response = that.cachedResponse[cacheKey]; - } - - if (response && $.isArray(response.suggestions)) { - that.suggestions = response.suggestions; - that.suggest(); - options.onSearchComplete.call(that.element, q, response.suggestions); - } else if (!that.isBadQuery(q)) { - if (that.currentRequest) { - that.currentRequest.abort(); - } - - ajaxSettings = { - url: serviceUrl, - data: params, - type: options.type, - dataType: options.dataType - }; - - $.extend(ajaxSettings, options.ajaxSettings); - - that.currentRequest = $.ajax(ajaxSettings).done(function (data) { - var result; - that.currentRequest = null; - result = options.transformResult(data); - that.processResponse(result, q, cacheKey); - options.onSearchComplete.call(that.element, q, result.suggestions); - }).fail(function (jqXHR, textStatus, errorThrown) { - options.onSearchError.call(that.element, q, jqXHR, textStatus, errorThrown); - }); - } else { - options.onSearchComplete.call(that.element, q, []); - } - }, - - isBadQuery: function (q) { - if (!this.options.preventBadQueries){ - return false; - } - - var badQueries = this.badQueries, - i = badQueries.length; - - while (i--) { - if (q.indexOf(badQueries[i]) === 0) { - return true; - } - } - - return false; - }, - - hide: function () { - var that = this; - that.visible = false; - that.selectedIndex = -1; - clearInterval(that.onChangeInterval); - $(that.suggestionsContainer).hide(); - that.signalHint(null); - }, - - suggest: function () { - if (this.suggestions.length === 0) { - if (this.options.showNoSuggestionNotice) { - this.noSuggestions(); - } else { - this.hide(); - } - return; - } - - var that = this, - options = that.options, - groupBy = options.groupBy, - formatResult = options.formatResult, - value = that.getQuery(that.currentValue), - className = that.classes.suggestion, - classSelected = that.classes.selected, - container = $(that.suggestionsContainer), - noSuggestionsContainer = $(that.noSuggestionsContainer), - beforeRender = options.beforeRender, - html = '', - category, - formatGroup = function (suggestion, index) { - var currentCategory = suggestion.data[groupBy]; - - if (category === currentCategory){ - return ''; - } - - category = currentCategory; - - return '
    ' + category + '
    '; - }, - index; - - if (options.triggerSelectOnValidInput) { - index = that.findSuggestionIndex(value); - if (index !== -1) { - that.select(index); - return; - } - } - - // Build suggestions inner HTML: - $.each(that.suggestions, function (i, suggestion) { - if (groupBy){ - html += formatGroup(suggestion, value, i); - } - - html += '
    ' + formatResult(suggestion, value) + '
    '; - }); - - this.adjustContainerWidth(); - - noSuggestionsContainer.detach(); - container.html(html); - - if ($.isFunction(beforeRender)) { - beforeRender.call(that.element, container); - } - - that.fixPosition(); - container.show(); - - // Select first value by default: - if (options.autoSelectFirst) { - that.selectedIndex = 0; - container.scrollTop(0); - container.children().first().addClass(classSelected); - } - - that.visible = true; - that.findBestHint(); - }, - - noSuggestions: function() { - var that = this, - container = $(that.suggestionsContainer), - noSuggestionsContainer = $(that.noSuggestionsContainer); - - this.adjustContainerWidth(); - - // Some explicit steps. Be careful here as it easy to get - // noSuggestionsContainer removed from DOM if not detached properly. - noSuggestionsContainer.detach(); - container.empty(); // clean suggestions if any - container.append(noSuggestionsContainer); - - that.fixPosition(); - - container.show(); - that.visible = true; - }, - - adjustContainerWidth: function() { - var that = this, - options = that.options, - width, - container = $(that.suggestionsContainer); - - // If width is auto, adjust width before displaying suggestions, - // because if instance was created before input had width, it will be zero. - // Also it adjusts if input width has changed. - // -2px to account for suggestions border. - if (options.width === 'auto') { - width = that.el.outerWidth() - 2; - container.width(width > 0 ? width : 300); - } - }, - - findBestHint: function () { - var that = this, - value = that.el.val().toLowerCase(), - bestMatch = null; - - if (!value) { - return; - } - - $.each(that.suggestions, function (i, suggestion) { - var foundMatch = suggestion.value.toLowerCase().indexOf(value) === 0; - if (foundMatch) { - bestMatch = suggestion; - } - return !foundMatch; - }); - - that.signalHint(bestMatch); - }, - - signalHint: function (suggestion) { - var hintValue = '', - that = this; - if (suggestion) { - hintValue = that.currentValue + suggestion.value.substr(that.currentValue.length); - } - if (that.hintValue !== hintValue) { - that.hintValue = hintValue; - that.hint = suggestion; - (this.options.onHint || $.noop)(hintValue); - } - }, - - verifySuggestionsFormat: function (suggestions) { - // If suggestions is string array, convert them to supported format: - if (suggestions.length && typeof suggestions[0] === 'string') { - return $.map(suggestions, function (value) { - return { value: value, data: null }; - }); - } - - return suggestions; - }, - - validateOrientation: function(orientation, fallback) { - orientation = $.trim(orientation || '').toLowerCase(); - - if($.inArray(orientation, ['auto', 'bottom', 'top']) === -1){ - orientation = fallback; - } - - return orientation; - }, - - processResponse: function (result, originalQuery, cacheKey) { - var that = this, - options = that.options; - - result.suggestions = that.verifySuggestionsFormat(result.suggestions); - - // Cache results if cache is not disabled: - if (!options.noCache) { - that.cachedResponse[cacheKey] = result; - if (options.preventBadQueries && result.suggestions.length === 0) { - that.badQueries.push(originalQuery); - } - } - - // Return if originalQuery is not matching current query: - if (originalQuery !== that.getQuery(that.currentValue)) { - return; - } - - that.suggestions = result.suggestions; - that.suggest(); - }, - - activate: function (index) { - var that = this, - activeItem, - selected = that.classes.selected, - container = $(that.suggestionsContainer), - children = container.find('.' + that.classes.suggestion); - - container.find('.' + selected).removeClass(selected); - - that.selectedIndex = index; - - if (that.selectedIndex !== -1 && children.length > that.selectedIndex) { - activeItem = children.get(that.selectedIndex); - $(activeItem).addClass(selected); - return activeItem; - } - - return null; - }, - - selectHint: function () { - var that = this, - i = $.inArray(that.hint, that.suggestions); - - that.select(i); - }, - - select: function (i) { - var that = this; - that.hide(); - that.onSelect(i); - }, - - moveUp: function () { - var that = this; - - if (that.selectedIndex === -1) { - return; - } - - if (that.selectedIndex === 0) { - $(that.suggestionsContainer).children().first().removeClass(that.classes.selected); - that.selectedIndex = -1; - that.el.val(that.currentValue); - that.findBestHint(); - return; - } - - that.adjustScroll(that.selectedIndex - 1); - }, - - moveDown: function () { - var that = this; - - if (that.selectedIndex === (that.suggestions.length - 1)) { - return; - } - - that.adjustScroll(that.selectedIndex + 1); - }, - - adjustScroll: function (index) { - var that = this, - activeItem = that.activate(index); - - if (!activeItem) { - return; - } - - var offsetTop, - upperBound, - lowerBound, - heightDelta = $(activeItem).outerHeight(); - - offsetTop = activeItem.offsetTop; - upperBound = $(that.suggestionsContainer).scrollTop(); - lowerBound = upperBound + that.options.maxHeight - heightDelta; - - if (offsetTop < upperBound) { - $(that.suggestionsContainer).scrollTop(offsetTop); - } else if (offsetTop > lowerBound) { - $(that.suggestionsContainer).scrollTop(offsetTop - that.options.maxHeight + heightDelta); - } - - that.el.val(that.getValue(that.suggestions[index].value)); - that.signalHint(null); - }, - - onSelect: function (index) { - var that = this, - onSelectCallback = that.options.onSelect, - suggestion = that.suggestions[index]; - - that.currentValue = that.getValue(suggestion.value); - - if (that.currentValue !== that.el.val()) { - that.el.val(that.currentValue); - } - - that.signalHint(null); - that.suggestions = []; - that.selection = suggestion; - - if ($.isFunction(onSelectCallback)) { - onSelectCallback.call(that.element, suggestion); - } - }, - - getValue: function (value) { - var that = this, - delimiter = that.options.delimiter, - currentValue, - parts; - - if (!delimiter) { - return value; - } - - currentValue = that.currentValue; - parts = currentValue.split(delimiter); - - if (parts.length === 1) { - return value; - } - - return currentValue.substr(0, currentValue.length - parts[parts.length - 1].length) + value; - }, - - dispose: function () { - var that = this; - that.el.off('.autocomplete').removeData('autocomplete'); - that.disableKillerFn(); - $(window).off('resize.autocomplete', that.fixPositionCapture); - $(that.suggestionsContainer).remove(); - } - }; - - // Create chainable jQuery plugin: - $.fn.autocomplete = $.fn.devbridgeAutocomplete = function (options, args) { - var dataKey = 'autocomplete'; - // If function invoked without argument return - // instance of the first matched element: - if (arguments.length === 0) { - return this.first().data(dataKey); - } - - return this.each(function () { - var inputElement = $(this), - instance = inputElement.data(dataKey); - - if (typeof options === 'string') { - if (instance && typeof instance[options] === 'function') { - instance[options](args); - } - } else { - // If instance already exists, destroy it: - if (instance && instance.dispose) { - instance.dispose(); - } - instance = new Autocomplete(this, options); - inputElement.data(dataKey, instance); - } - }); - }; -})); \ No newline at end of file + 'use strict'; + + var + utils = (function () { + return { + escapeRegExChars: function (value) { + return value.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); + }, + createNode: function (containerClass) { + var div = document.createElement('div'); + div.className = containerClass; + div.style.position = 'absolute'; + div.style.display = 'none'; + return div; + } + }; + }()), + + keys = { + ESC: 27, + TAB: 9, + RETURN: 13, + LEFT: 37, + UP: 38, + RIGHT: 39, + DOWN: 40 + }; + + function Autocomplete(el, options) { + var noop = function () { }, + that = this, + defaults = { + ajaxSettings: {}, + autoSelectFirst: false, + appendTo: document.body, + serviceUrl: null, + lookup: null, + onSelect: null, + width: 'auto', + minChars: 1, + maxHeight: 300, + deferRequestBy: 0, + params: {}, + formatResult: Autocomplete.formatResult, + delimiter: null, + zIndex: 9999, + type: 'GET', + noCache: false, + onSearchStart: noop, + onSearchComplete: noop, + onSearchError: noop, + preserveInput: false, + containerClass: 'autocomplete-suggestions', + tabDisabled: false, + dataType: 'text', + currentRequest: null, + triggerSelectOnValidInput: true, + preventBadQueries: true, + lookupFilter: function (suggestion, originalQuery, queryLowerCase) { + return suggestion.value.toLowerCase().indexOf(queryLowerCase) !== -1; + }, + paramName: 'query', + transformResult: function (response) { + return typeof response === 'string' ? $.parseJSON(response) : response; + }, + showNoSuggestionNotice: false, + noSuggestionNotice: 'No results', + orientation: 'bottom', + forceFixPosition: false + }; + + // Shared variables: + that.element = el; + that.el = $(el); + that.suggestions = []; + that.badQueries = []; + that.selectedIndex = -1; + that.currentValue = that.element.value; + that.intervalId = 0; + that.cachedResponse = {}; + that.onChangeInterval = null; + that.onChange = null; + that.isLocal = false; + that.suggestionsContainer = null; + that.noSuggestionsContainer = null; + that.options = $.extend({}, defaults, options); + that.classes = { + selected: 'autocomplete-selected', + suggestion: 'autocomplete-suggestion' + }; + that.hint = null; + that.hintValue = ''; + that.selection = null; + + // Initialize and set options: + that.initialize(); + that.setOptions(options); + } + + Autocomplete.utils = utils; + + $.Autocomplete = Autocomplete; + + Autocomplete.formatResult = function (suggestion, currentValue) { + var pattern = '(' + utils.escapeRegExChars(currentValue) + ')'; + + return suggestion.value.replace(new RegExp(pattern, 'gi'), '$1<\/strong>'); + }; + + Autocomplete.prototype = { + + killerFn: null, + + initialize: function () { + var that = this, + suggestionSelector = '.' + that.classes.suggestion, + selected = that.classes.selected, + options = that.options, + container; + + // Remove autocomplete attribute to prevent native suggestions: + that.element.setAttribute('autocomplete', 'off'); + + that.killerFn = function (e) { + if ($(e.target).closest('.' + that.options.containerClass).length === 0) { + that.killSuggestions(); + that.disableKillerFn(); + } + }; + + // html() deals with many types: htmlString or Element or Array or jQuery + that.noSuggestionsContainer = $('
    ') + .html(this.options.noSuggestionNotice).get(0); + + that.suggestionsContainer = Autocomplete.utils.createNode(options.containerClass); + + container = $(that.suggestionsContainer); + + container.appendTo(options.appendTo); + + // Only set width if it was provided: + if (options.width !== 'auto') { + container.width(options.width); + } + + // Listen for mouse over event on suggestions list: + container.on('mouseover.autocomplete', suggestionSelector, function () { + that.activate($(this).data('index')); + }); + + // Deselect active element when mouse leaves suggestions container: + container.on('mouseout.autocomplete', function () { + that.selectedIndex = -1; + container.children('.' + selected).removeClass(selected); + }); + + // Listen for click event on suggestions list: + container.on('click.autocomplete', suggestionSelector, function () { + that.select($(this).data('index')); + }); + + that.fixPositionCapture = function () { + if (that.visible) { + that.fixPosition(); + } + }; + + $(window).on('resize.autocomplete', that.fixPositionCapture); + + that.el.on('keydown.autocomplete', function (e) { that.onKeyPress(e); }); + that.el.on('keyup.autocomplete', function (e) { that.onKeyUp(e); }); + that.el.on('blur.autocomplete', function () { that.onBlur(); }); + that.el.on('focus.autocomplete', function () { that.onFocus(); }); + that.el.on('change.autocomplete', function (e) { that.onKeyUp(e); }); + that.el.on('input.autocomplete', function (e) { that.onKeyUp(e); }); + }, + + onFocus: function () { + var that = this; + that.fixPosition(); + if (that.options.minChars <= that.el.val().length) { + that.onValueChange(); + } + }, + + onBlur: function () { + this.enableKillerFn(); + }, + + setOptions: function (suppliedOptions) { + var that = this, + options = that.options; + + $.extend(options, suppliedOptions); + + that.isLocal = $.isArray(options.lookup); + + if (that.isLocal) { + options.lookup = that.verifySuggestionsFormat(options.lookup); + } + + options.orientation = that.validateOrientation(options.orientation, 'bottom'); + + // Adjust height, width and z-index: + $(that.suggestionsContainer).css({ + 'max-height': options.maxHeight + 'px', + 'width': options.width + 'px', + 'z-index': options.zIndex + }); + }, + + + clearCache: function () { + this.cachedResponse = {}; + this.badQueries = []; + }, + + clear: function () { + this.clearCache(); + this.currentValue = ''; + this.suggestions = []; + }, + + disable: function () { + var that = this; + that.disabled = true; + clearInterval(that.onChangeInterval); + if (that.currentRequest) { + that.currentRequest.abort(); + } + }, + + enable: function () { + this.disabled = false; + }, + + fixPosition: function () { + // Use only when container has already its content + + var that = this, + $container = $(that.suggestionsContainer), + containerParent = $container.parent().get(0); + // Fix position automatically when appended to body. + // In other cases force parameter must be given. + if (containerParent !== document.body && !that.options.forceFixPosition) { + return; + } + + // Choose orientation + var orientation = that.options.orientation, + containerHeight = $container.outerHeight(), + height = that.el.outerHeight(), + offset = that.el.offset(), + styles = { 'top': offset.top, 'left': offset.left }; + + if (orientation === 'auto') { + var viewPortHeight = $(window).height(), + scrollTop = $(window).scrollTop(), + topOverflow = -scrollTop + offset.top - containerHeight, + bottomOverflow = scrollTop + viewPortHeight - (offset.top + height + containerHeight); + + orientation = (Math.max(topOverflow, bottomOverflow) === topOverflow) ? 'top' : 'bottom'; + } + + if (orientation === 'top') { + styles.top += -containerHeight; + } else { + styles.top += height; + } + + // If container is not positioned to body, + // correct its position using offset parent offset + if(containerParent !== document.body) { + var opacity = $container.css('opacity'), + parentOffsetDiff; + + if (!that.visible){ + $container.css('opacity', 0).show(); + } + + parentOffsetDiff = $container.offsetParent().offset(); + styles.top -= parentOffsetDiff.top; + styles.left -= parentOffsetDiff.left; + + if (!that.visible){ + $container.css('opacity', opacity).hide(); + } + } + + // -2px to account for suggestions border. + if (that.options.width === 'auto') { + styles.width = (that.el.outerWidth() - 2) + 'px'; + } + + $container.css(styles); + }, + + enableKillerFn: function () { + var that = this; + $(document).on('click.autocomplete', that.killerFn); + }, + + disableKillerFn: function () { + var that = this; + $(document).off('click.autocomplete', that.killerFn); + }, + + killSuggestions: function () { + var that = this; + that.stopKillSuggestions(); + that.intervalId = window.setInterval(function () { + that.hide(); + that.stopKillSuggestions(); + }, 50); + }, + + stopKillSuggestions: function () { + window.clearInterval(this.intervalId); + }, + + isCursorAtEnd: function () { + var that = this, + valLength = that.el.val().length, + selectionStart = that.element.selectionStart, + range; + + if (typeof selectionStart === 'number') { + return selectionStart === valLength; + } + if (document.selection) { + range = document.selection.createRange(); + range.moveStart('character', -valLength); + return valLength === range.text.length; + } + return true; + }, + + onKeyPress: function (e) { + var that = this; + + // If suggestions are hidden and user presses arrow down, display suggestions: + if (!that.disabled && !that.visible && e.which === keys.DOWN && that.currentValue) { + that.suggest(); + return; + } + + if (that.disabled || !that.visible) { + return; + } + + switch (e.which) { + case keys.ESC: + that.el.val(that.currentValue); + that.hide(); + break; + case keys.RIGHT: + if (that.hint && that.options.onHint && that.isCursorAtEnd()) { + that.selectHint(); + break; + } + return; + case keys.TAB: + if (that.hint && that.options.onHint) { + that.selectHint(); + return; + } + if (that.selectedIndex === -1) { + that.hide(); + return; + } + that.select(that.selectedIndex); + if (that.options.tabDisabled === false) { + return; + } + break; + case keys.RETURN: + if (that.selectedIndex === -1) { + that.hide(); + return; + } + that.select(that.selectedIndex); + break; + case keys.UP: + that.moveUp(); + break; + case keys.DOWN: + that.moveDown(); + break; + default: + return; + } + + // Cancel event if function did not return: + e.stopImmediatePropagation(); + e.preventDefault(); + }, + + onKeyUp: function (e) { + var that = this; + + if (that.disabled) { + return; + } + + switch (e.which) { + case keys.UP: + case keys.DOWN: + return; + } + + clearInterval(that.onChangeInterval); + + if (that.currentValue !== that.el.val()) { + that.findBestHint(); + if (that.options.deferRequestBy > 0) { + // Defer lookup in case when value changes very quickly: + that.onChangeInterval = setInterval(function () { + that.onValueChange(); + }, that.options.deferRequestBy); + } else { + that.onValueChange(); + } + } + }, + + onValueChange: function () { + var that = this, + options = that.options, + value = that.el.val(), + query = that.getQuery(value), + index; + + if (that.selection && that.currentValue !== query) { + that.selection = null; + (options.onInvalidateSelection || $.noop).call(that.element); + } + + clearInterval(that.onChangeInterval); + that.currentValue = value; + that.selectedIndex = -1; + + // Check existing suggestion for the match before proceeding: + if (options.triggerSelectOnValidInput) { + index = that.findSuggestionIndex(query); + if (index !== -1) { + that.select(index); + return; + } + } + + if (query.length < options.minChars) { + that.hide(); + } else { + that.getSuggestions(query); + } + }, + + findSuggestionIndex: function (query) { + var that = this, + index = -1, + queryLowerCase = query.toLowerCase(); + + $.each(that.suggestions, function (i, suggestion) { + if (suggestion.value.toLowerCase() === queryLowerCase) { + index = i; + return false; + } + }); + + return index; + }, + + getQuery: function (value) { + var delimiter = this.options.delimiter, + parts; + + if (!delimiter) { + return value; + } + parts = value.split(delimiter); + return $.trim(parts[parts.length - 1]); + }, + + getSuggestionsLocal: function (query) { + var that = this, + options = that.options, + queryLowerCase = query.toLowerCase(), + filter = options.lookupFilter, + limit = parseInt(options.lookupLimit, 10), + data; + + data = { + suggestions: $.grep(options.lookup, function (suggestion) { + return filter(suggestion, query, queryLowerCase); + }) + }; + + if (limit && data.suggestions.length > limit) { + data.suggestions = data.suggestions.slice(0, limit); + } + + return data; + }, + + getSuggestions: function (q) { + var response, + that = this, + options = that.options, + serviceUrl = options.serviceUrl, + params, + cacheKey, + ajaxSettings; + + options.params[options.paramName] = q; + params = options.ignoreParams ? null : options.params; + + if (options.onSearchStart.call(that.element, options.params) === false) { + return; + } + + if ($.isFunction(options.lookup)){ + options.lookup(q, function (data) { + that.suggestions = data.suggestions; + that.suggest(); + options.onSearchComplete.call(that.element, q, data.suggestions); + }); + return; + } + + if (that.isLocal) { + response = that.getSuggestionsLocal(q); + } else { + if ($.isFunction(serviceUrl)) { + serviceUrl = serviceUrl.call(that.element, q); + } + cacheKey = serviceUrl + '?' + $.param(params || {}); + response = that.cachedResponse[cacheKey]; + } + + if (response && $.isArray(response.suggestions)) { + that.suggestions = response.suggestions; + that.suggest(); + options.onSearchComplete.call(that.element, q, response.suggestions); + } else if (!that.isBadQuery(q)) { + if (that.currentRequest) { + that.currentRequest.abort(); + } + + ajaxSettings = { + url: serviceUrl, + data: params, + type: options.type, + dataType: options.dataType + }; + + $.extend(ajaxSettings, options.ajaxSettings); + + that.currentRequest = $.ajax(ajaxSettings).done(function (data) { + var result; + that.currentRequest = null; + result = options.transformResult(data); + that.processResponse(result, q, cacheKey); + options.onSearchComplete.call(that.element, q, result.suggestions); + }).fail(function (jqXHR, textStatus, errorThrown) { + options.onSearchError.call(that.element, q, jqXHR, textStatus, errorThrown); + }); + } else { + options.onSearchComplete.call(that.element, q, []); + } + }, + + isBadQuery: function (q) { + if (!this.options.preventBadQueries){ + return false; + } + + var badQueries = this.badQueries, + i = badQueries.length; + + while (i--) { + if (q.indexOf(badQueries[i]) === 0) { + return true; + } + } + + return false; + }, + + hide: function () { + var that = this, + container = $(that.suggestionsContainer); + + if ($.isFunction(that.options.onHide) && that.visible) { + that.options.onHide.call(that.element, container); + } + + that.visible = false; + that.selectedIndex = -1; + clearInterval(that.onChangeInterval); + $(that.suggestionsContainer).hide(); + that.signalHint(null); + }, + + suggest: function () { + if (this.suggestions.length === 0) { + if (this.options.showNoSuggestionNotice) { + this.noSuggestions(); + } else { + this.hide(); + } + return; + } + + var that = this, + options = that.options, + groupBy = options.groupBy, + formatResult = options.formatResult, + value = that.getQuery(that.currentValue), + className = that.classes.suggestion, + classSelected = that.classes.selected, + container = $(that.suggestionsContainer), + noSuggestionsContainer = $(that.noSuggestionsContainer), + beforeRender = options.beforeRender, + html = '', + category, + formatGroup = function (suggestion, index) { + var currentCategory = suggestion.data[groupBy]; + + if (category === currentCategory){ + return ''; + } + + category = currentCategory; + + return '
    ' + category + '
    '; + }, + index; + + if (options.triggerSelectOnValidInput) { + index = that.findSuggestionIndex(value); + if (index !== -1) { + that.select(index); + return; + } + } + + // Build suggestions inner HTML: + $.each(that.suggestions, function (i, suggestion) { + if (groupBy){ + html += formatGroup(suggestion, value, i); + } + + html += '
    ' + formatResult(suggestion, value) + '
    '; + }); + + this.adjustContainerWidth(); + + noSuggestionsContainer.detach(); + container.html(html); + + if ($.isFunction(beforeRender)) { + beforeRender.call(that.element, container); + } + + that.fixPosition(); + container.show(); + + // Select first value by default: + if (options.autoSelectFirst) { + that.selectedIndex = 0; + container.scrollTop(0); + container.children('.' + className).first().addClass(classSelected); + } + + that.visible = true; + that.findBestHint(); + }, + + noSuggestions: function() { + var that = this, + container = $(that.suggestionsContainer), + noSuggestionsContainer = $(that.noSuggestionsContainer); + + this.adjustContainerWidth(); + + // Some explicit steps. Be careful here as it easy to get + // noSuggestionsContainer removed from DOM if not detached properly. + noSuggestionsContainer.detach(); + container.empty(); // clean suggestions if any + container.append(noSuggestionsContainer); + + that.fixPosition(); + + container.show(); + that.visible = true; + }, + + adjustContainerWidth: function() { + var that = this, + options = that.options, + width, + container = $(that.suggestionsContainer); + + // If width is auto, adjust width before displaying suggestions, + // because if instance was created before input had width, it will be zero. + // Also it adjusts if input width has changed. + // -2px to account for suggestions border. + if (options.width === 'auto') { + width = that.el.outerWidth() - 2; + container.width(width > 0 ? width : 300); + } + }, + + findBestHint: function () { + var that = this, + value = that.el.val().toLowerCase(), + bestMatch = null; + + if (!value) { + return; + } + + $.each(that.suggestions, function (i, suggestion) { + var foundMatch = suggestion.value.toLowerCase().indexOf(value) === 0; + if (foundMatch) { + bestMatch = suggestion; + } + return !foundMatch; + }); + + that.signalHint(bestMatch); + }, + + signalHint: function (suggestion) { + var hintValue = '', + that = this; + if (suggestion) { + hintValue = that.currentValue + suggestion.value.substr(that.currentValue.length); + } + if (that.hintValue !== hintValue) { + that.hintValue = hintValue; + that.hint = suggestion; + (this.options.onHint || $.noop)(hintValue); + } + }, + + verifySuggestionsFormat: function (suggestions) { + // If suggestions is string array, convert them to supported format: + if (suggestions.length && typeof suggestions[0] === 'string') { + return $.map(suggestions, function (value) { + return { value: value, data: null }; + }); + } + + return suggestions; + }, + + validateOrientation: function(orientation, fallback) { + orientation = $.trim(orientation || '').toLowerCase(); + + if($.inArray(orientation, ['auto', 'bottom', 'top']) === -1){ + orientation = fallback; + } + + return orientation; + }, + + processResponse: function (result, originalQuery, cacheKey) { + var that = this, + options = that.options; + + result.suggestions = that.verifySuggestionsFormat(result.suggestions); + + // Cache results if cache is not disabled: + if (!options.noCache) { + that.cachedResponse[cacheKey] = result; + if (options.preventBadQueries && result.suggestions.length === 0) { + that.badQueries.push(originalQuery); + } + } + + // Return if originalQuery is not matching current query: + if (originalQuery !== that.getQuery(that.currentValue)) { + return; + } + + that.suggestions = result.suggestions; + that.suggest(); + }, + + activate: function (index) { + var that = this, + activeItem, + selected = that.classes.selected, + container = $(that.suggestionsContainer), + children = container.find('.' + that.classes.suggestion); + + container.find('.' + selected).removeClass(selected); + + that.selectedIndex = index; + + if (that.selectedIndex !== -1 && children.length > that.selectedIndex) { + activeItem = children.get(that.selectedIndex); + $(activeItem).addClass(selected); + return activeItem; + } + + return null; + }, + + selectHint: function () { + var that = this, + i = $.inArray(that.hint, that.suggestions); + + that.select(i); + }, + + select: function (i) { + var that = this; + that.hide(); + that.onSelect(i); + }, + + moveUp: function () { + var that = this; + + if (that.selectedIndex === -1) { + return; + } + + if (that.selectedIndex === 0) { + $(that.suggestionsContainer).children().first().removeClass(that.classes.selected); + that.selectedIndex = -1; + that.el.val(that.currentValue); + that.findBestHint(); + return; + } + + that.adjustScroll(that.selectedIndex - 1); + }, + + moveDown: function () { + var that = this; + + if (that.selectedIndex === (that.suggestions.length - 1)) { + return; + } + + that.adjustScroll(that.selectedIndex + 1); + }, + + adjustScroll: function (index) { + var that = this, + activeItem = that.activate(index); + + if (!activeItem) { + return; + } + + var offsetTop, + upperBound, + lowerBound, + heightDelta = $(activeItem).outerHeight(); + + offsetTop = activeItem.offsetTop; + upperBound = $(that.suggestionsContainer).scrollTop(); + lowerBound = upperBound + that.options.maxHeight - heightDelta; + + if (offsetTop < upperBound) { + $(that.suggestionsContainer).scrollTop(offsetTop); + } else if (offsetTop > lowerBound) { + $(that.suggestionsContainer).scrollTop(offsetTop - that.options.maxHeight + heightDelta); + } + + if (!that.options.preserveInput) { + that.el.val(that.getValue(that.suggestions[index].value)); + } + that.signalHint(null); + }, + + onSelect: function (index) { + var that = this, + onSelectCallback = that.options.onSelect, + suggestion = that.suggestions[index]; + + that.currentValue = that.getValue(suggestion.value); + + if (that.currentValue !== that.el.val() && !that.options.preserveInput) { + that.el.val(that.currentValue); + } + + that.signalHint(null); + that.suggestions = []; + that.selection = suggestion; + + if ($.isFunction(onSelectCallback)) { + onSelectCallback.call(that.element, suggestion); + } + }, + + getValue: function (value) { + var that = this, + delimiter = that.options.delimiter, + currentValue, + parts; + + if (!delimiter) { + return value; + } + + currentValue = that.currentValue; + parts = currentValue.split(delimiter); + + if (parts.length === 1) { + return value; + } + + return currentValue.substr(0, currentValue.length - parts[parts.length - 1].length) + value; + }, + + dispose: function () { + var that = this; + that.el.off('.autocomplete').removeData('autocomplete'); + that.disableKillerFn(); + $(window).off('resize.autocomplete', that.fixPositionCapture); + $(that.suggestionsContainer).remove(); + } + }; + + // Create chainable jQuery plugin: + $.fn.autocomplete = $.fn.devbridgeAutocomplete = function (options, args) { + var dataKey = 'autocomplete'; + // If function invoked without argument return + // instance of the first matched element: + if (arguments.length === 0) { + return this.first().data(dataKey); + } + + return this.each(function () { + var inputElement = $(this), + instance = inputElement.data(dataKey); + + if (typeof options === 'string') { + if (instance && typeof instance[options] === 'function') { + instance[options](args); + } + } else { + // If instance already exists, destroy it: + if (instance && instance.dispose) { + instance.dispose(); + } + instance = new Autocomplete(this, options); + inputElement.data(dataKey, instance); + } + }); + }; +})); diff --git a/media/jui/js/jquery.autocomplete.min.js b/media/jui/js/jquery.autocomplete.min.js index f7dabe8d99268..01623ab8c3a25 100644 --- a/media/jui/js/jquery.autocomplete.min.js +++ b/media/jui/js/jquery.autocomplete.min.js @@ -1,8 +1,8 @@ /** - * Ajax Autocomplete for jQuery, version 1.2.14 - * (c) 2014 Tomas Kirda - * - * Ajax Autocomplete for jQuery is freely distributable under the terms of an MIT-style license. - * For details, see the web site: https://github.com/devbridge/jQuery-Autocomplete - */ -!function(a){"use strict";"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports&&"function"==typeof require?require("jquery"):jQuery)}(function(a){"use strict";function b(c,d){var e=function(){},f=this,g={ajaxSettings:{},autoSelectFirst:!1,appendTo:document.body,serviceUrl:null,lookup:null,onSelect:null,width:"auto",minChars:1,maxHeight:300,deferRequestBy:0,params:{},formatResult:b.formatResult,delimiter:null,zIndex:9999,type:"GET",noCache:!1,onSearchStart:e,onSearchComplete:e,onSearchError:e,containerClass:"autocomplete-suggestions",tabDisabled:!1,dataType:"text",currentRequest:null,triggerSelectOnValidInput:!0,preventBadQueries:!0,lookupFilter:function(a,b,c){return-1!==a.value.toLowerCase().indexOf(c)},paramName:"query",transformResult:function(b){return"string"==typeof b?a.parseJSON(b):b},showNoSuggestionNotice:!1,noSuggestionNotice:"No results",orientation:"bottom",forceFixPosition:!1};f.element=c,f.el=a(c),f.suggestions=[],f.badQueries=[],f.selectedIndex=-1,f.currentValue=f.element.value,f.intervalId=0,f.cachedResponse={},f.onChangeInterval=null,f.onChange=null,f.isLocal=!1,f.suggestionsContainer=null,f.noSuggestionsContainer=null,f.options=a.extend({},g,d),f.classes={selected:"autocomplete-selected",suggestion:"autocomplete-suggestion"},f.hint=null,f.hintValue="",f.selection=null,f.initialize(),f.setOptions(d)}var c=function(){return{escapeRegExChars:function(a){return a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},createNode:function(a){var b=document.createElement("div");return b.className=a,b.style.position="absolute",b.style.display="none",b}}}(),d={ESC:27,TAB:9,RETURN:13,LEFT:37,UP:38,RIGHT:39,DOWN:40};b.utils=c,a.Autocomplete=b,b.formatResult=function(a,b){var d="("+c.escapeRegExChars(b)+")";return a.value.replace(new RegExp(d,"gi"),"$1")},b.prototype={killerFn:null,initialize:function(){var c,d=this,e="."+d.classes.suggestion,f=d.classes.selected,g=d.options;d.element.setAttribute("autocomplete","off"),d.killerFn=function(b){0===a(b.target).closest("."+d.options.containerClass).length&&(d.killSuggestions(),d.disableKillerFn())},d.noSuggestionsContainer=a('
    ').html(this.options.noSuggestionNotice).get(0),d.suggestionsContainer=b.utils.createNode(g.containerClass),c=a(d.suggestionsContainer),c.appendTo(g.appendTo),"auto"!==g.width&&c.width(g.width),c.on("mouseover.autocomplete",e,function(){d.activate(a(this).data("index"))}),c.on("mouseout.autocomplete",function(){d.selectedIndex=-1,c.children("."+f).removeClass(f)}),c.on("click.autocomplete",e,function(){d.select(a(this).data("index"))}),d.fixPositionCapture=function(){d.visible&&d.fixPosition()},a(window).on("resize.autocomplete",d.fixPositionCapture),d.el.on("keydown.autocomplete",function(a){d.onKeyPress(a)}),d.el.on("keyup.autocomplete",function(a){d.onKeyUp(a)}),d.el.on("blur.autocomplete",function(){d.onBlur()}),d.el.on("focus.autocomplete",function(){d.onFocus()}),d.el.on("change.autocomplete",function(a){d.onKeyUp(a)})},onFocus:function(){var a=this;a.fixPosition(),a.options.minChars<=a.el.val().length&&a.onValueChange()},onBlur:function(){this.enableKillerFn()},setOptions:function(b){var c=this,d=c.options;a.extend(d,b),c.isLocal=a.isArray(d.lookup),c.isLocal&&(d.lookup=c.verifySuggestionsFormat(d.lookup)),d.orientation=c.validateOrientation(d.orientation,"bottom"),a(c.suggestionsContainer).css({"max-height":d.maxHeight+"px",width:d.width+"px","z-index":d.zIndex})},clearCache:function(){this.cachedResponse={},this.badQueries=[]},clear:function(){this.clearCache(),this.currentValue="",this.suggestions=[]},disable:function(){var a=this;a.disabled=!0,clearInterval(a.onChangeInterval),a.currentRequest&&a.currentRequest.abort()},enable:function(){this.disabled=!1},fixPosition:function(){var b=this,c=a(b.suggestionsContainer),d=c.parent().get(0);if(d===document.body||b.options.forceFixPosition){var e=b.options.orientation,f=c.outerHeight(),g=b.el.outerHeight(),h=b.el.offset(),i={top:h.top,left:h.left};if("auto"==e){var j=a(window).height(),k=a(window).scrollTop(),l=-k+h.top-f,m=k+j-(h.top+g+f);e=Math.max(l,m)===l?"top":"bottom"}if(i.top+="top"===e?-f:g,d!==document.body){var n,o=c.css("opacity");b.visible||c.css("opacity",0).show(),n=c.offsetParent().offset(),i.top-=n.top,i.left-=n.left,b.visible||c.css("opacity",o).hide()}"auto"===b.options.width&&(i.width=b.el.outerWidth()-2+"px"),c.css(i)}},enableKillerFn:function(){var b=this;a(document).on("click.autocomplete",b.killerFn)},disableKillerFn:function(){var b=this;a(document).off("click.autocomplete",b.killerFn)},killSuggestions:function(){var a=this;a.stopKillSuggestions(),a.intervalId=window.setInterval(function(){a.hide(),a.stopKillSuggestions()},50)},stopKillSuggestions:function(){window.clearInterval(this.intervalId)},isCursorAtEnd:function(){var a,b=this,c=b.el.val().length,d=b.element.selectionStart;return"number"==typeof d?d===c:document.selection?(a=document.selection.createRange(),a.moveStart("character",-c),c===a.text.length):!0},onKeyPress:function(a){var b=this;if(!b.disabled&&!b.visible&&a.which===d.DOWN&&b.currentValue)return void b.suggest();if(!b.disabled&&b.visible){switch(a.which){case d.ESC:b.el.val(b.currentValue),b.hide();break;case d.RIGHT:if(b.hint&&b.options.onHint&&b.isCursorAtEnd()){b.selectHint();break}return;case d.TAB:if(b.hint&&b.options.onHint)return void b.selectHint();case d.RETURN:if(-1===b.selectedIndex)return void b.hide();if(b.select(b.selectedIndex),a.which===d.TAB&&b.options.tabDisabled===!1)return;break;case d.UP:b.moveUp();break;case d.DOWN:b.moveDown();break;default:return}a.stopImmediatePropagation(),a.preventDefault()}},onKeyUp:function(a){var b=this;if(!b.disabled){switch(a.which){case d.UP:case d.DOWN:return}clearInterval(b.onChangeInterval),b.currentValue!==b.el.val()&&(b.findBestHint(),b.options.deferRequestBy>0?b.onChangeInterval=setInterval(function(){b.onValueChange()},b.options.deferRequestBy):b.onValueChange())}},onValueChange:function(){var b,c=this,d=c.options,e=c.el.val(),f=c.getQuery(e);return c.selection&&c.currentValue!==f&&(c.selection=null,(d.onInvalidateSelection||a.noop).call(c.element)),clearInterval(c.onChangeInterval),c.currentValue=e,c.selectedIndex=-1,d.triggerSelectOnValidInput&&(b=c.findSuggestionIndex(f),-1!==b)?void c.select(b):void(f.lengthh&&(c.suggestions=c.suggestions.slice(0,h)),c},getSuggestions:function(b){var c,d,e,f,g=this,h=g.options,i=h.serviceUrl;if(h.params[h.paramName]=b,d=h.ignoreParams?null:h.params,h.onSearchStart.call(g.element,h.params)!==!1){if(a.isFunction(g.lookup))return void g.lookup(b,function(a){g.suggestions=a.suggestions,g.suggest(),h.onSearchComplete.call(g.element,b,a.suggestions)});g.isLocal?c=g.getSuggestionsLocal(b):(a.isFunction(i)&&(i=i.call(g.element,b)),e=i+"?"+a.param(d||{}),c=g.cachedResponse[e]),c&&a.isArray(c.suggestions)?(g.suggestions=c.suggestions,g.suggest(),h.onSearchComplete.call(g.element,b,c.suggestions)):g.isBadQuery(b)?h.onSearchComplete.call(g.element,b,[]):(g.currentRequest&&g.currentRequest.abort(),f={url:i,data:d,type:h.type,dataType:h.dataType},a.extend(f,h.ajaxSettings),g.currentRequest=a.ajax(f).done(function(a){var c;g.currentRequest=null,c=h.transformResult(a),g.processResponse(c,b,e),h.onSearchComplete.call(g.element,b,c.suggestions)}).fail(function(a,c,d){h.onSearchError.call(g.element,b,a,c,d)}))}},isBadQuery:function(a){if(!this.options.preventBadQueries)return!1;for(var b=this.badQueries,c=b.length;c--;)if(0===a.indexOf(b[c]))return!0;return!1},hide:function(){var b=this;b.visible=!1,b.selectedIndex=-1,clearInterval(b.onChangeInterval),a(b.suggestionsContainer).hide(),b.signalHint(null)},suggest:function(){if(0===this.suggestions.length)return void(this.options.showNoSuggestionNotice?this.noSuggestions():this.hide());var b,c,d=this,e=d.options,f=e.groupBy,g=e.formatResult,h=d.getQuery(d.currentValue),i=d.classes.suggestion,j=d.classes.selected,k=a(d.suggestionsContainer),l=a(d.noSuggestionsContainer),m=e.beforeRender,n="",o=function(a){var c=a.data[f];return b===c?"":(b=c,'
    '+b+"
    ")};return e.triggerSelectOnValidInput&&(c=d.findSuggestionIndex(h),-1!==c)?void d.select(c):(a.each(d.suggestions,function(a,b){f&&(n+=o(b,h,a)),n+='
    '+g(b,h)+"
    "}),this.adjustContainerWidth(),l.detach(),k.html(n),a.isFunction(m)&&m.call(d.element,k),d.fixPosition(),k.show(),e.autoSelectFirst&&(d.selectedIndex=0,k.scrollTop(0),k.children().first().addClass(j)),d.visible=!0,void d.findBestHint())},noSuggestions:function(){var b=this,c=a(b.suggestionsContainer),d=a(b.noSuggestionsContainer);this.adjustContainerWidth(),d.detach(),c.empty(),c.append(d),b.fixPosition(),c.show(),b.visible=!0},adjustContainerWidth:function(){var b,c=this,d=c.options,e=a(c.suggestionsContainer);"auto"===d.width&&(b=c.el.outerWidth()-2,e.width(b>0?b:300))},findBestHint:function(){var b=this,c=b.el.val().toLowerCase(),d=null;c&&(a.each(b.suggestions,function(a,b){var e=0===b.value.toLowerCase().indexOf(c);return e&&(d=b),!e}),b.signalHint(d))},signalHint:function(b){var c="",d=this;b&&(c=d.currentValue+b.value.substr(d.currentValue.length)),d.hintValue!==c&&(d.hintValue=c,d.hint=b,(this.options.onHint||a.noop)(c))},verifySuggestionsFormat:function(b){return b.length&&"string"==typeof b[0]?a.map(b,function(a){return{value:a,data:null}}):b},validateOrientation:function(b,c){return b=a.trim(b||"").toLowerCase(),-1===a.inArray(b,["auto","bottom","top"])&&(b=c),b},processResponse:function(a,b,c){var d=this,e=d.options;a.suggestions=d.verifySuggestionsFormat(a.suggestions),e.noCache||(d.cachedResponse[c]=a,e.preventBadQueries&&0===a.suggestions.length&&d.badQueries.push(b)),b===d.getQuery(d.currentValue)&&(d.suggestions=a.suggestions,d.suggest())},activate:function(b){var c,d=this,e=d.classes.selected,f=a(d.suggestionsContainer),g=f.find("."+d.classes.suggestion);return f.find("."+e).removeClass(e),d.selectedIndex=b,-1!==d.selectedIndex&&g.length>d.selectedIndex?(c=g.get(d.selectedIndex),a(c).addClass(e),c):null},selectHint:function(){var b=this,c=a.inArray(b.hint,b.suggestions);b.select(c)},select:function(a){var b=this;b.hide(),b.onSelect(a)},moveUp:function(){var b=this;if(-1!==b.selectedIndex)return 0===b.selectedIndex?(a(b.suggestionsContainer).children().first().removeClass(b.classes.selected),b.selectedIndex=-1,b.el.val(b.currentValue),void b.findBestHint()):void b.adjustScroll(b.selectedIndex-1)},moveDown:function(){var a=this;a.selectedIndex!==a.suggestions.length-1&&a.adjustScroll(a.selectedIndex+1)},adjustScroll:function(b){var c=this,d=c.activate(b);if(d){var e,f,g,h=a(d).outerHeight();e=d.offsetTop,f=a(c.suggestionsContainer).scrollTop(),g=f+c.options.maxHeight-h,f>e?a(c.suggestionsContainer).scrollTop(e):e>g&&a(c.suggestionsContainer).scrollTop(e-c.options.maxHeight+h),c.el.val(c.getValue(c.suggestions[b].value)),c.signalHint(null)}},onSelect:function(b){var c=this,d=c.options.onSelect,e=c.suggestions[b];c.currentValue=c.getValue(e.value),c.currentValue!==c.el.val()&&c.el.val(c.currentValue),c.signalHint(null),c.suggestions=[],c.selection=e,a.isFunction(d)&&d.call(c.element,e)},getValue:function(a){var b,c,d=this,e=d.options.delimiter;return e?(b=d.currentValue,c=b.split(e),1===c.length?a:b.substr(0,b.length-c[c.length-1].length)+a):a},dispose:function(){var b=this;b.el.off(".autocomplete").removeData("autocomplete"),b.disableKillerFn(),a(window).off("resize.autocomplete",b.fixPositionCapture),a(b.suggestionsContainer).remove()}},a.fn.autocomplete=a.fn.devbridgeAutocomplete=function(c,d){var e="autocomplete";return 0===arguments.length?this.first().data(e):this.each(function(){var f=a(this),g=f.data(e);"string"==typeof c?g&&"function"==typeof g[c]&&g[c](d):(g&&g.dispose&&g.dispose(),g=new b(this,c),f.data(e,g))})}}); \ No newline at end of file +* Ajax Autocomplete for jQuery, version 1.2.18 +* (c) 2014 Tomas Kirda +* +* Ajax Autocomplete for jQuery is freely distributable under the terms of an MIT-style license. +* For details, see the web site: https://github.com/devbridge/jQuery-Autocomplete +*/ +!function(a){"use strict";"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports&&"function"==typeof require?require("jquery"):jQuery)}(function(a){"use strict";function b(c,d){var e=function(){},f=this,g={ajaxSettings:{},autoSelectFirst:!1,appendTo:document.body,serviceUrl:null,lookup:null,onSelect:null,width:"auto",minChars:1,maxHeight:300,deferRequestBy:0,params:{},formatResult:b.formatResult,delimiter:null,zIndex:9999,type:"GET",noCache:!1,onSearchStart:e,onSearchComplete:e,onSearchError:e,preserveInput:!1,containerClass:"autocomplete-suggestions",tabDisabled:!1,dataType:"text",currentRequest:null,triggerSelectOnValidInput:!0,preventBadQueries:!0,lookupFilter:function(a,b,c){return-1!==a.value.toLowerCase().indexOf(c)},paramName:"query",transformResult:function(b){return"string"==typeof b?a.parseJSON(b):b},showNoSuggestionNotice:!1,noSuggestionNotice:"No results",orientation:"bottom",forceFixPosition:!1};f.element=c,f.el=a(c),f.suggestions=[],f.badQueries=[],f.selectedIndex=-1,f.currentValue=f.element.value,f.intervalId=0,f.cachedResponse={},f.onChangeInterval=null,f.onChange=null,f.isLocal=!1,f.suggestionsContainer=null,f.noSuggestionsContainer=null,f.options=a.extend({},g,d),f.classes={selected:"autocomplete-selected",suggestion:"autocomplete-suggestion"},f.hint=null,f.hintValue="",f.selection=null,f.initialize(),f.setOptions(d)}var c=function(){return{escapeRegExChars:function(a){return a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},createNode:function(a){var b=document.createElement("div");return b.className=a,b.style.position="absolute",b.style.display="none",b}}}(),d={ESC:27,TAB:9,RETURN:13,LEFT:37,UP:38,RIGHT:39,DOWN:40};b.utils=c,a.Autocomplete=b,b.formatResult=function(a,b){var d="("+c.escapeRegExChars(b)+")";return a.value.replace(new RegExp(d,"gi"),"$1")},b.prototype={killerFn:null,initialize:function(){var c,d=this,e="."+d.classes.suggestion,f=d.classes.selected,g=d.options;d.element.setAttribute("autocomplete","off"),d.killerFn=function(b){0===a(b.target).closest("."+d.options.containerClass).length&&(d.killSuggestions(),d.disableKillerFn())},d.noSuggestionsContainer=a('
    ').html(this.options.noSuggestionNotice).get(0),d.suggestionsContainer=b.utils.createNode(g.containerClass),c=a(d.suggestionsContainer),c.appendTo(g.appendTo),"auto"!==g.width&&c.width(g.width),c.on("mouseover.autocomplete",e,function(){d.activate(a(this).data("index"))}),c.on("mouseout.autocomplete",function(){d.selectedIndex=-1,c.children("."+f).removeClass(f)}),c.on("click.autocomplete",e,function(){d.select(a(this).data("index"))}),d.fixPositionCapture=function(){d.visible&&d.fixPosition()},a(window).on("resize.autocomplete",d.fixPositionCapture),d.el.on("keydown.autocomplete",function(a){d.onKeyPress(a)}),d.el.on("keyup.autocomplete",function(a){d.onKeyUp(a)}),d.el.on("blur.autocomplete",function(){d.onBlur()}),d.el.on("focus.autocomplete",function(){d.onFocus()}),d.el.on("change.autocomplete",function(a){d.onKeyUp(a)}),d.el.on("input.autocomplete",function(a){d.onKeyUp(a)})},onFocus:function(){var a=this;a.fixPosition(),a.options.minChars<=a.el.val().length&&a.onValueChange()},onBlur:function(){this.enableKillerFn()},setOptions:function(b){var c=this,d=c.options;a.extend(d,b),c.isLocal=a.isArray(d.lookup),c.isLocal&&(d.lookup=c.verifySuggestionsFormat(d.lookup)),d.orientation=c.validateOrientation(d.orientation,"bottom"),a(c.suggestionsContainer).css({"max-height":d.maxHeight+"px",width:d.width+"px","z-index":d.zIndex})},clearCache:function(){this.cachedResponse={},this.badQueries=[]},clear:function(){this.clearCache(),this.currentValue="",this.suggestions=[]},disable:function(){var a=this;a.disabled=!0,clearInterval(a.onChangeInterval),a.currentRequest&&a.currentRequest.abort()},enable:function(){this.disabled=!1},fixPosition:function(){var b=this,c=a(b.suggestionsContainer),d=c.parent().get(0);if(d===document.body||b.options.forceFixPosition){var e=b.options.orientation,f=c.outerHeight(),g=b.el.outerHeight(),h=b.el.offset(),i={top:h.top,left:h.left};if("auto"===e){var j=a(window).height(),k=a(window).scrollTop(),l=-k+h.top-f,m=k+j-(h.top+g+f);e=Math.max(l,m)===l?"top":"bottom"}if(i.top+="top"===e?-f:g,d!==document.body){var n,o=c.css("opacity");b.visible||c.css("opacity",0).show(),n=c.offsetParent().offset(),i.top-=n.top,i.left-=n.left,b.visible||c.css("opacity",o).hide()}"auto"===b.options.width&&(i.width=b.el.outerWidth()-2+"px"),c.css(i)}},enableKillerFn:function(){var b=this;a(document).on("click.autocomplete",b.killerFn)},disableKillerFn:function(){var b=this;a(document).off("click.autocomplete",b.killerFn)},killSuggestions:function(){var a=this;a.stopKillSuggestions(),a.intervalId=window.setInterval(function(){a.hide(),a.stopKillSuggestions()},50)},stopKillSuggestions:function(){window.clearInterval(this.intervalId)},isCursorAtEnd:function(){var a,b=this,c=b.el.val().length,d=b.element.selectionStart;return"number"==typeof d?d===c:document.selection?(a=document.selection.createRange(),a.moveStart("character",-c),c===a.text.length):!0},onKeyPress:function(a){var b=this;if(!b.disabled&&!b.visible&&a.which===d.DOWN&&b.currentValue)return void b.suggest();if(!b.disabled&&b.visible){switch(a.which){case d.ESC:b.el.val(b.currentValue),b.hide();break;case d.RIGHT:if(b.hint&&b.options.onHint&&b.isCursorAtEnd()){b.selectHint();break}return;case d.TAB:if(b.hint&&b.options.onHint)return void b.selectHint();if(-1===b.selectedIndex)return void b.hide();if(b.select(b.selectedIndex),b.options.tabDisabled===!1)return;break;case d.RETURN:if(-1===b.selectedIndex)return void b.hide();b.select(b.selectedIndex);break;case d.UP:b.moveUp();break;case d.DOWN:b.moveDown();break;default:return}a.stopImmediatePropagation(),a.preventDefault()}},onKeyUp:function(a){var b=this;if(!b.disabled){switch(a.which){case d.UP:case d.DOWN:return}clearInterval(b.onChangeInterval),b.currentValue!==b.el.val()&&(b.findBestHint(),b.options.deferRequestBy>0?b.onChangeInterval=setInterval(function(){b.onValueChange()},b.options.deferRequestBy):b.onValueChange())}},onValueChange:function(){var b,c=this,d=c.options,e=c.el.val(),f=c.getQuery(e);return c.selection&&c.currentValue!==f&&(c.selection=null,(d.onInvalidateSelection||a.noop).call(c.element)),clearInterval(c.onChangeInterval),c.currentValue=e,c.selectedIndex=-1,d.triggerSelectOnValidInput&&(b=c.findSuggestionIndex(f),-1!==b)?void c.select(b):void(f.lengthh&&(c.suggestions=c.suggestions.slice(0,h)),c},getSuggestions:function(b){var c,d,e,f,g=this,h=g.options,i=h.serviceUrl;if(h.params[h.paramName]=b,d=h.ignoreParams?null:h.params,h.onSearchStart.call(g.element,h.params)!==!1){if(a.isFunction(h.lookup))return void h.lookup(b,function(a){g.suggestions=a.suggestions,g.suggest(),h.onSearchComplete.call(g.element,b,a.suggestions)});g.isLocal?c=g.getSuggestionsLocal(b):(a.isFunction(i)&&(i=i.call(g.element,b)),e=i+"?"+a.param(d||{}),c=g.cachedResponse[e]),c&&a.isArray(c.suggestions)?(g.suggestions=c.suggestions,g.suggest(),h.onSearchComplete.call(g.element,b,c.suggestions)):g.isBadQuery(b)?h.onSearchComplete.call(g.element,b,[]):(g.currentRequest&&g.currentRequest.abort(),f={url:i,data:d,type:h.type,dataType:h.dataType},a.extend(f,h.ajaxSettings),g.currentRequest=a.ajax(f).done(function(a){var c;g.currentRequest=null,c=h.transformResult(a),g.processResponse(c,b,e),h.onSearchComplete.call(g.element,b,c.suggestions)}).fail(function(a,c,d){h.onSearchError.call(g.element,b,a,c,d)}))}},isBadQuery:function(a){if(!this.options.preventBadQueries)return!1;for(var b=this.badQueries,c=b.length;c--;)if(0===a.indexOf(b[c]))return!0;return!1},hide:function(){var b=this,c=a(b.suggestionsContainer);a.isFunction(b.options.onHide)&&b.visible&&b.options.onHide.call(b.element,c),b.visible=!1,b.selectedIndex=-1,clearInterval(b.onChangeInterval),a(b.suggestionsContainer).hide(),b.signalHint(null)},suggest:function(){if(0===this.suggestions.length)return void(this.options.showNoSuggestionNotice?this.noSuggestions():this.hide());var b,c,d=this,e=d.options,f=e.groupBy,g=e.formatResult,h=d.getQuery(d.currentValue),i=d.classes.suggestion,j=d.classes.selected,k=a(d.suggestionsContainer),l=a(d.noSuggestionsContainer),m=e.beforeRender,n="",o=function(a){var c=a.data[f];return b===c?"":(b=c,'
    '+b+"
    ")};return e.triggerSelectOnValidInput&&(c=d.findSuggestionIndex(h),-1!==c)?void d.select(c):(a.each(d.suggestions,function(a,b){f&&(n+=o(b,h,a)),n+='
    '+g(b,h)+"
    "}),this.adjustContainerWidth(),l.detach(),k.html(n),a.isFunction(m)&&m.call(d.element,k),d.fixPosition(),k.show(),e.autoSelectFirst&&(d.selectedIndex=0,k.scrollTop(0),k.children("."+i).first().addClass(j)),d.visible=!0,void d.findBestHint())},noSuggestions:function(){var b=this,c=a(b.suggestionsContainer),d=a(b.noSuggestionsContainer);this.adjustContainerWidth(),d.detach(),c.empty(),c.append(d),b.fixPosition(),c.show(),b.visible=!0},adjustContainerWidth:function(){var b,c=this,d=c.options,e=a(c.suggestionsContainer);"auto"===d.width&&(b=c.el.outerWidth()-2,e.width(b>0?b:300))},findBestHint:function(){var b=this,c=b.el.val().toLowerCase(),d=null;c&&(a.each(b.suggestions,function(a,b){var e=0===b.value.toLowerCase().indexOf(c);return e&&(d=b),!e}),b.signalHint(d))},signalHint:function(b){var c="",d=this;b&&(c=d.currentValue+b.value.substr(d.currentValue.length)),d.hintValue!==c&&(d.hintValue=c,d.hint=b,(this.options.onHint||a.noop)(c))},verifySuggestionsFormat:function(b){return b.length&&"string"==typeof b[0]?a.map(b,function(a){return{value:a,data:null}}):b},validateOrientation:function(b,c){return b=a.trim(b||"").toLowerCase(),-1===a.inArray(b,["auto","bottom","top"])&&(b=c),b},processResponse:function(a,b,c){var d=this,e=d.options;a.suggestions=d.verifySuggestionsFormat(a.suggestions),e.noCache||(d.cachedResponse[c]=a,e.preventBadQueries&&0===a.suggestions.length&&d.badQueries.push(b)),b===d.getQuery(d.currentValue)&&(d.suggestions=a.suggestions,d.suggest())},activate:function(b){var c,d=this,e=d.classes.selected,f=a(d.suggestionsContainer),g=f.find("."+d.classes.suggestion);return f.find("."+e).removeClass(e),d.selectedIndex=b,-1!==d.selectedIndex&&g.length>d.selectedIndex?(c=g.get(d.selectedIndex),a(c).addClass(e),c):null},selectHint:function(){var b=this,c=a.inArray(b.hint,b.suggestions);b.select(c)},select:function(a){var b=this;b.hide(),b.onSelect(a)},moveUp:function(){var b=this;if(-1!==b.selectedIndex)return 0===b.selectedIndex?(a(b.suggestionsContainer).children().first().removeClass(b.classes.selected),b.selectedIndex=-1,b.el.val(b.currentValue),void b.findBestHint()):void b.adjustScroll(b.selectedIndex-1)},moveDown:function(){var a=this;a.selectedIndex!==a.suggestions.length-1&&a.adjustScroll(a.selectedIndex+1)},adjustScroll:function(b){var c=this,d=c.activate(b);if(d){var e,f,g,h=a(d).outerHeight();e=d.offsetTop,f=a(c.suggestionsContainer).scrollTop(),g=f+c.options.maxHeight-h,f>e?a(c.suggestionsContainer).scrollTop(e):e>g&&a(c.suggestionsContainer).scrollTop(e-c.options.maxHeight+h),c.options.preserveInput||c.el.val(c.getValue(c.suggestions[b].value)),c.signalHint(null)}},onSelect:function(b){var c=this,d=c.options.onSelect,e=c.suggestions[b];c.currentValue=c.getValue(e.value),c.currentValue===c.el.val()||c.options.preserveInput||c.el.val(c.currentValue),c.signalHint(null),c.suggestions=[],c.selection=e,a.isFunction(d)&&d.call(c.element,e)},getValue:function(a){var b,c,d=this,e=d.options.delimiter;return e?(b=d.currentValue,c=b.split(e),1===c.length?a:b.substr(0,b.length-c[c.length-1].length)+a):a},dispose:function(){var b=this;b.el.off(".autocomplete").removeData("autocomplete"),b.disableKillerFn(),a(window).off("resize.autocomplete",b.fixPositionCapture),a(b.suggestionsContainer).remove()}},a.fn.autocomplete=a.fn.devbridgeAutocomplete=function(c,d){var e="autocomplete";return 0===arguments.length?this.first().data(e):this.each(function(){var f=a(this),g=f.data(e);"string"==typeof c?g&&"function"==typeof g[c]&&g[c](d):(g&&g.dispose&&g.dispose(),g=new b(this,c),f.data(e,g))})}}); \ No newline at end of file diff --git a/media/jui/js/treeselectmenu.jquery.js b/media/jui/js/treeselectmenu.jquery.js index 1b1d23f9e8d8a..9886676ef113a 100644 --- a/media/jui/js/treeselectmenu.jquery.js +++ b/media/jui/js/treeselectmenu.jquery.js @@ -12,14 +12,14 @@ jQuery(function($) $div = $li.find('div.treeselect-item:first'); // Add icons - $li.prepend(''); + $li.prepend(''); // Append clearfix $div.after('
    '); if ($li.find('ul.treeselect-sub').length) { // Add classes to Expand/Collapse icons - $li.find('i').addClass('treeselect-toggle icon-minus'); + $li.find('span.icon-').addClass('treeselect-toggle icon-minus'); // Append drop down menu in nodes $div.find('label:first').after(treeselectmenu); @@ -31,7 +31,7 @@ jQuery(function($) }); // Takes care of the Expand/Collapse of a node - $('i.treeselect-toggle').click(function() + $('span.treeselect-toggle').click(function() { $i = $(this); diff --git a/media/jui/js/treeselectmenu.jquery.min.js b/media/jui/js/treeselectmenu.jquery.min.js index 363b79c7a6cfb..24683ab13ab9c 100644 --- a/media/jui/js/treeselectmenu.jquery.min.js +++ b/media/jui/js/treeselectmenu.jquery.min.js @@ -2,4 +2,4 @@ * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -jQuery(function(e){var t=e("div#treeselectmenu").html();e(".treeselect li").each(function(){$li=e(this);$div=$li.find("div.treeselect-item:first");$li.prepend('');$div.after('
    ');if($li.find("ul.treeselect-sub").length){$li.find("i").addClass("treeselect-toggle icon-minus");$div.find("label:first").after(t);if(!$li.find("ul.treeselect-sub ul.treeselect-sub").length){$li.find("div.treeselect-menu-expand").remove()}}});e("i.treeselect-toggle").click(function(){$i=e(this);if($i.parent().find("ul.treeselect-sub").is(":visible")){$i.removeClass("icon-minus").addClass("icon-plus");$i.parent().find("ul.treeselect-sub").hide();$i.parent().find("ul.treeselect-sub i.treeselect-toggle").removeClass("icon-minus").addClass("icon-plus")}else{$i.removeClass("icon-plus").addClass("icon-minus");$i.parent().find("ul.treeselect-sub").show();$i.parent().find("ul.treeselect-sub i.treeselect-toggle").removeClass("icon-plus").addClass("icon-minus")}});e("#treeselectfilter").keyup(function(){var t=e(this).val().toLowerCase();var n=0;e("#noresultsfound").hide();var r=e(".treeselect li");r.each(function(){if(e(this).text().toLowerCase().indexOf(t)==-1){e(this).hide();n++}else{e(this).show()}});if(n==r.length){e("#noresultsfound").show()}});e("#treeCheckAll").click(function(){e(".treeselect input").attr("checked","checked")});e("#treeUncheckAll").click(function(){e(".treeselect input").attr("checked",false)});e("#treeExpandAll").click(function(){e("ul.treeselect ul.treeselect-sub").show();e("ul.treeselect i.treeselect-toggle").removeClass("icon-plus").addClass("icon-minus")});e("#treeCollapseAll").click(function(){e("ul.treeselect ul.treeselect-sub").hide();e("ul.treeselect i.treeselect-toggle").removeClass("icon-minus").addClass("icon-plus")});e("a.checkall").click(function(){e(this).parents().eq(5).find("ul.treeselect-sub input").attr("checked","checked")});e("a.uncheckall").click(function(){e(this).parents().eq(5).find("ul.treeselect-sub input").attr("checked",false)});e("a.expandall").click(function(){var t=e(this).parents().eq(6);t.find("ul.treeselect-sub").show();t.find("ul.treeselect-sub i.treeselect-toggle").removeClass("icon-plus").addClass("icon-minus")});e("a.collapseall").click(function(){var t=e(this).parents().eq(6);t.find("li ul.treeselect-sub").hide();t.find("li i.treeselect-toggle").removeClass("icon-minus").addClass("icon-plus")})}) +jQuery(function(e){var t=e("div#treeselectmenu").html();e(".treeselect li").each(function(){$li=e(this);$div=$li.find("div.treeselect-item:first");$li.prepend('');$div.after('
    ');if($li.find("ul.treeselect-sub").length){$li.find("span.icon-").addClass("treeselect-toggle icon-minus");$div.find("label:first").after(t);if(!$li.find("ul.treeselect-sub ul.treeselect-sub").length){$li.find("div.treeselect-menu-expand").remove()}}});e("span.treeselect-toggle").click(function(){$i=e(this);if($i.parent().find("ul.treeselect-sub").is(":visible")){$i.removeClass("icon-minus").addClass("icon-plus");$i.parent().find("ul.treeselect-sub").hide();$i.parent().find("ul.treeselect-sub span.treeselect-toggle").removeClass("icon-minus").addClass("icon-plus")}else{$i.removeClass("icon-plus").addClass("icon-minus");$i.parent().find("ul.treeselect-sub").show();$i.parent().find("ul.treeselect-sub span.treeselect-toggle").removeClass("icon-plus").addClass("icon-minus")}});e("#treeselectfilter").keyup(function(){var t=e(this).val().toLowerCase();var n=0;e("#noresultsfound").hide();var r=e(".treeselect li");r.each(function(){if(e(this).text().toLowerCase().indexOf(t)==-1){e(this).hide();n++}else{e(this).show()}});if(n==r.length){e("#noresultsfound").show()}});e("#treeCheckAll").click(function(){e(".treeselect input").attr("checked","checked")});e("#treeUncheckAll").click(function(){e(".treeselect input").attr("checked",false)});e("#treeExpandAll").click(function(){e("ul.treeselect ul.treeselect-sub").show();e("ul.treeselect span.treeselect-toggle").removeClass("icon-plus").addClass("icon-minus")});e("#treeCollapseAll").click(function(){e("ul.treeselect ul.treeselect-sub").hide();e("ul.treeselect span.treeselect-toggle").removeClass("icon-minus").addClass("icon-plus")});e("a.checkall").click(function(){e(this).parents().eq(5).find("ul.treeselect-sub input").attr("checked","checked")});e("a.uncheckall").click(function(){e(this).parents().eq(5).find("ul.treeselect-sub input").attr("checked",false)});e("a.expandall").click(function(){var t=e(this).parents().eq(6);t.find("ul.treeselect-sub").show();t.find("ul.treeselect-sub span.treeselect-toggle").removeClass("icon-plus").addClass("icon-minus")});e("a.collapseall").click(function(){var t=e(this).parents().eq(6);t.find("li ul.treeselect-sub").hide();t.find("li span.treeselect-toggle").removeClass("icon-minus").addClass("icon-plus")})}) diff --git a/media/jui/less/icomoon.less b/media/jui/less/icomoon.less index 991c7197f9c20..f4298c2454171 100644 --- a/media/jui/less/icomoon.less +++ b/media/jui/less/icomoon.less @@ -222,7 +222,6 @@ dl.article-info dd.hits span[class*=" icon-"]{ .icon-plus-2:before { content: "\5d"; } -.icon-ban-circle:before, .icon-minus-sign:before, .icon-minus-2:before { content: "\5e"; @@ -249,6 +248,7 @@ dl.article-info dd.hits span[class*=" icon-"]{ .icon-not-ok:before { content: "\4b"; } +.icon-ban-circle:before, .icon-minus-circle:before { content: "\e216"; } @@ -377,7 +377,6 @@ dl.article-info dd.hits span[class*=" icon-"]{ .icon-file-plus:before { content: "\29"; } -.icon-file-remove:before, .icon-file-minus:before { content: "\e017"; } diff --git a/media/jui/less/sprites.less b/media/jui/less/sprites.less index 84607283d0836..f8ea6eb96a002 100644 --- a/media/jui/less/sprites.less +++ b/media/jui/less/sprites.less @@ -9,10 +9,10 @@ // All icons receive the styles of the tag with a base class // of .i and are then given a unique class to add width, height, // and background-position. Your resulting HTML will look like -// . +// . // For the white version of the icons, just add the .icon-white class: -// +// [class^="icon-"], [class*=" icon-"] { @@ -36,7 +36,7 @@ dl.article-info dd.hits span[class^="icon-"], dl.article-info dd.hits span[class*=" icon-"]{ margin-right: 0; } - + /* White icons with optional class, or on hover/focus/active states of certain elements */ .icon-white, .nav-pills > .active > a > [class^="icon-"], diff --git a/media/media/js/mediamanager.js b/media/media/js/mediamanager.js index a1d023a6dbaa8..40ba9e285e6a1 100644 --- a/media/media/js/mediamanager.js +++ b/media/media/js/mediamanager.js @@ -10,157 +10,182 @@ * @subpackage Media * @since 1.5 */ -(function($) { -var MediaManager = this.MediaManager = { - - initialize: function() - { - this.folderframe = $('#folderframe'); - this.folderpath = $('#folderpath'); - - this.updatepaths = $('input.update-folder'); - - this.frame = window.frames['folderframe']; - this.frameurl = this.frame.location.href; - }, - - submit: function(task) - { - form = window.frames['folderframe'].document.getElementById('mediamanager-form'); - form.task.value = task; - if ($('#username').length) { - form.username.value = $('#username').val(); - form.password.value = $('#password').val(); - } - form.submit(); - }, - - onloadframe: function() - { - // Update the frame url - this.frameurl = this.frame.location.href; - - var folder = this.getFolder(); - if (folder) { - this.updatepaths.each(function(path, el){ el.value =folder; }); - this.folderpath.value = basepath+'/'+folder; - } else { - this.updatepaths.each(function(path, el){ el.value = ''; }); - this.folderpath.value = basepath; - } - - $('#' + viewstyle).addClass('active'); - - a = this._getUriObject($('#uploadForm').attr('action')); - q = this._getQueryObject(a.query); - q['folder'] = folder; - var query = []; - - for (var k in q) { - var v = q[k]; - if (q.hasOwnProperty(k) && v !== null) { - query.push(k+'='+v); - } - } - - a.query = query.join('&'); - - if (a.port) { - $('#uploadForm').attr('action', a.scheme+'://'+a.domain+':'+a.port+a.path+'?'+a.query); - } else { - $('#uploadForm').attr('action', a.scheme+'://'+a.domain+a.path+'?'+a.query); - } - }, - - oncreatefolder: function() - { - if ($('#foldername').val().length) { - $('#dirpath').val() = this.getFolder(); - Joomla.submitbutton('createfolder'); - } - }, - - setViewType: function(type) - { - $('#' + type).addClass('active'); - $('#' + viewstyle).removeClass('active'); - viewstyle = type; - var folder = this.getFolder(); - this._setFrameUrl('index.php?option=com_media&view=mediaList&tmpl=component&folder='+folder+'&layout='+type); - }, - - refreshFrame: function() - { - this._setFrameUrl(); - }, - - getFolder: function() - { - var url = this.frame.location.search.substring(1); - var args = this.parseQuery(url); - - if (args['folder'] == "undefined") { - args['folder'] = ""; - } - - return args['folder']; - }, - - parseQuery: function(query) - { - var params = new Object(); - if (!query) { - return params; - } - var pairs = query.split(/[;&]/); - for ( var i = 0; i < pairs.length; i++ ) - { - var KeyVal = pairs[i].split('='); - if ( ! KeyVal || KeyVal.length != 2 ) { - continue; +;(function( $, scope ) { + "use strict"; + + var MediaManager = scope.MediaManager = { + + /** + * Basic setup + * + * @return void + */ + initialize: function() { + this.folderpath = $( '#folderpath' ); + + this.updatepaths = $( 'input.update-folder' ); + + this.frame = window.frames.folderframe; + this.frameurl = this.frame.location.href; + }, + + /** + * Called from outside. Only ever called with task 'folder.delete' + * + * @param string task [description] + * + * @return void + */ + submit: function( task ) { + form = this.frame.document.getElementById( 'mediamanager-form' ); + form.task.value = task; + + if ( $( '#username' ).length ) { + form.username.value = $( '#username' ).val(); + form.password.value = $( '#password' ).val(); } - var key = unescape( KeyVal[0] ); - var val = unescape( KeyVal[1] ).replace(/\+ /g, ' '); - params[key] = val; - } - return params; - }, - - _setFrameUrl: function(url) - { - if (url != null) { - this.frameurl = url; - } - this.frame.location.href = this.frameurl; - }, - - _getQueryObject: function(q) { - var vars = q.split(/[&;]/); + + form.submit(); + }, + + /** + * [onloadframe description] + * + * @return {[type]} + */ + onloadframe: function() { + // Update the frame url + this.frameurl = this.frame.location.href; + + var folder = this.getFolder() || '', + query = [], + a = getUriObject( $( '#uploadForm' ).attr( 'action' ) ), + q = getQueryObject( a.query ), + k, v; + + this.updatepaths.each( function( path, el ) { + el.value = folder; + } ); + + this.folderpath.value = basepath + (folder ? '/' + folder : ''); + + q.folder = folder; + + for ( k in q ) { + if (!q.hasOwnProperty( k )) { continue; } + + v = q[ k ]; + query.push( k + (v === null ? '' : '=' + v) ); + } + + a.query = query.join( '&' ); + a.fragment = null; + + $( '#uploadForm' ).attr( 'action', buildUri(a) ); + $( '#' + viewstyle ).addClass( 'active' ); + }, + + /** + * Switch the view type + * + * @param string type 'thumbs' || 'details' + */ + setViewType: function( type ) { + $( '#' + type ).addClass( 'active' ); + $( '#' + viewstyle ).removeClass( 'active' ); + viewstyle = type; + var folder = this.getFolder(); + + this.setFrameUrl( 'index.php?option=com_media&view=mediaList&tmpl=component&folder=' + folder + '&layout=' + type ); + }, + + refreshFrame: function() { + this.setFrameUrl(); + }, + + getFolder: function() { + var args = getQueryObject( this.frame.location.search.substring( 1 ) ); + + args.folder = args.folder === undefined ? '' : args.folder; + + return args.folder; + }, + + setFrameUrl: function( url ) { + if ( url !== null ) { + this.frameurl = url; + } + + this.frame.location.href = this.frameurl; + }, + }; + + /** + * Convert a query string to an object + * + * @param string q A query string (no leading ?) + * + * @return object + */ + function getQueryObject( q ) { var rs = {}; - if (vars.length) vars.forEach(function(val) { - var keys = val.split('='); - if (keys.length && keys.length == 2) rs[encodeURIComponent(keys[0])] = encodeURIComponent(keys[1]); - }); + + q = q || ''; + + $.each( q.split( /[&;]/ ), + function( key, val ) { + var keys = val.split( '=' ); + + rs[ decodeURIComponent(keys[ 0 ]) ] = keys.length == 2 ? decodeURIComponent(keys[ 1 ]) : null; + }); + return rs; - }, + } - _getUriObject: function(u){ - var bitsAssociate = {}, bits = u.match(/^(?:([^:\/?#.]+):)?(?:\/\/)?(([^:\/?#]*)(?::(\d*))?)((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[\?#]|$)))*\/?)?([^?#\/]*))?(?:\?([^#]*))?(?:#(.*))?/); - ['uri', 'scheme', 'authority', 'domain', 'port', 'path', 'directory', 'file', 'query', 'fragment'].forEach(function(key, index){ - bitsAssociate[key] = bits[index]; - }); + /** + * Break a url into its component parts + * + * @param string u URL + * + * @return object + */ + function getUriObject( u ) { + var bitsAssociate = {}, + bits = u.match( /^(?:([^:\/?#.]+):)?(?:\/\/)?(([^:\/?#]*)(?::(\d*))?)((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[\?#]|$)))*\/?)?([^?#\/]*))?(?:\?([^#]*))?(?:#(.*))?/ ); + + $.each([ 'uri', 'scheme', 'authority', 'domain', 'port', 'path', 'directory', 'file', 'query', 'fragment' ], + function( key, index ) { + bitsAssociate[ index ] = ( !!bits && !!bits[ key ] ) ? bits[ key ] : ''; + }); + + return bitsAssociate; + } - return (bits) - ? bitsAssociate - : null; + /** + * Build a url from component parts + * + * @param object o Such as the return value of `getUriObject()` + * + * @return string + */ + function buildUri ( o ) { + return o.scheme + '://' + o.domain + + (o.port ? ':' + o.port : '') + + (o.path ? o.path : '/') + + (o.query ? '?' + o.query : '') + + (o.fragment ? '#' + o.fragment : ''); } -}; -})(jQuery); - -jQuery(function(){ - // Added to populate data on iframe load - MediaManager.initialize(); - MediaManager.trace = 'start'; - document.updateUploader = function() { MediaManager.onloadframe(); }; - MediaManager.onloadframe(); -}); + + $(function() { + // Added to populate data on iframe load + MediaManager.initialize(); + + document.updateUploader = function() { + MediaManager.onloadframe(); + }; + + MediaManager.onloadframe(); + }); + +}( jQuery, window )); + diff --git a/media/media/js/mediamanager.min.js b/media/media/js/mediamanager.min.js new file mode 100644 index 0000000000000..3cb090c23759f --- /dev/null +++ b/media/media/js/mediamanager.min.js @@ -0,0 +1 @@ +!function(e,t){"use strict";function r(t){var r={};return t=t||"",e.each(t.split(/[&;]/),function(e,t){var a=t.split("=");r[decodeURIComponent(a[0])]=2==a.length?decodeURIComponent(a[1]):null}),r}function a(t){var r={},a=t.match(/^(?:([^:\/?#.]+):)?(?:\/\/)?(([^:\/?#]*)(?::(\d*))?)((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[\?#]|$)))*\/?)?([^?#\/]*))?(?:\?([^#]*))?(?:#(.*))?/);return e.each(["uri","scheme","authority","domain","port","path","directory","file","query","fragment"],function(e,t){r[t]=a&&a[e]?a[e]:""}),r}function o(e){return e.scheme+"://"+e.domain+(e.port?":"+e.port:"")+(e.path?e.path:"/")+(e.query?"?"+e.query:"")+(e.fragment?"#"+e.fragment:"")}var n=t.MediaManager={initialize:function(){this.folderpath=e("#folderpath"),this.updatepaths=e("input.update-folder"),this.frame=window.frames.folderframe,this.frameurl=this.frame.location.href},submit:function(t){form=this.frame.document.getElementById("mediamanager-form"),form.task.value=t,e("#username").length&&(form.username.value=e("#username").val(),form.password.value=e("#password").val()),form.submit()},onloadframe:function(){this.frameurl=this.frame.location.href;var t,n,i=this.getFolder()||"",l=[],u=a(e("#uploadForm").attr("action")),f=r(u.query);this.updatepaths.each(function(e,t){t.value=i}),this.folderpath.value=basepath+(i?"/"+i:""),f.folder=i;for(t in f)f.hasOwnProperty(t)&&(n=f[t],l.push(t+(null===n?"":"="+n)));u.query=l.join("&"),u.fragment=null,e("#uploadForm").attr("action",o(u)),e("#"+viewstyle).addClass("active")},setViewType:function(t){e("#"+t).addClass("active"),e("#"+viewstyle).removeClass("active"),viewstyle=t;var r=this.getFolder();this.setFrameUrl("index.php?option=com_media&view=mediaList&tmpl=component&folder="+r+"&layout="+t)},refreshFrame:function(){this.setFrameUrl()},getFolder:function(){var e=r(this.frame.location.search.substring(1));return e.folder=void 0===e.folder?"":e.folder,e.folder},setFrameUrl:function(e){null!==e&&(this.frameurl=e),this.frame.location.href=this.frameurl}};e(function(){n.initialize(),document.updateUploader=function(){n.onloadframe()},n.onloadframe()})}(jQuery,window); \ No newline at end of file diff --git a/media/mod_languages/images/cs.gif b/media/mod_languages/images/cs.gif new file mode 100644 index 0000000000000..5df79bba7094c Binary files /dev/null and b/media/mod_languages/images/cs.gif differ diff --git a/media/mod_languages/images/cs_cz.gif b/media/mod_languages/images/cs_cz.gif new file mode 100644 index 0000000000000..5df79bba7094c Binary files /dev/null and b/media/mod_languages/images/cs_cz.gif differ diff --git a/media/mod_languages/images/prs_af.gif b/media/mod_languages/images/prs_af.gif new file mode 100644 index 0000000000000..498e0c6fa7bd8 Binary files /dev/null and b/media/mod_languages/images/prs_af.gif differ diff --git a/media/plg_quickicon_extensionupdate/js/extensionupdatecheck.js b/media/plg_quickicon_extensionupdate/js/extensionupdatecheck.js index 3e5bf26a45b83..8856db943ba57 100644 --- a/media/plg_quickicon_extensionupdate/js/extensionupdatecheck.js +++ b/media/plg_quickicon_extensionupdate/js/extensionupdatecheck.js @@ -6,49 +6,50 @@ jQuery(document).ready(function() { var ajax_structure = { success: function(data, textStatus, jqXHR) { + var link = jQuery('#plg_quickicon_extensionupdate').find('span.j-links-link'); + try { var updateInfoList = jQuery.parseJSON(data); - } catch(e) { + } catch (e) { // An error occured - jQuery('#plg_quickicon_extensionupdate').find('span').html(plg_quickicon_extensionupdate_text.ERROR); + link.html(plg_quickicon_extensionupdate_text.ERROR); } + if (updateInfoList instanceof Array) { if (updateInfoList.length == 0) { // No updates - jQuery('#plg_quickicon_extensionupdate').find('span').html(plg_quickicon_extensionupdate_text.UPTODATE); + link.html(plg_quickicon_extensionupdate_text.UPTODATE); } else { var updateString = plg_quickicon_extensionupdate_text.UPDATEFOUND_MESSAGE.replace("%s", updateInfoList.length); - if (jQuery('.alert-joomlaupdate').length == 0) - { + if (jQuery('.alert-joomlaupdate').length == 0) { jQuery('#system-message-container').prepend( '
    ' - + updateString - + ' ' - + '
    ' + + updateString + + ' ' + + '
    ' ); } - else - { + else { jQuery('#system-message-container').prepend( '
    ' - + updateString - + ' ' - + '
    ' + + updateString + + ' ' + + '
    ' ); } var updateString = plg_quickicon_extensionupdate_text.UPDATEFOUND.replace("%s", updateInfoList.length); - jQuery('#plg_quickicon_extensionupdate').find('span').html(updateString); + link.html(updateString); } } else { // An error occured - jQuery('#plg_quickicon_extensionupdate').find('span').html(plg_quickicon_extensionupdate_text.ERROR); + link.html(plg_quickicon_extensionupdate_text.ERROR); } }, error: function(jqXHR, textStatus, errorThrown) { // An error occured - jQuery('#plg_quickicon_extensionupdate').find('span').html(plg_quickicon_extensionupdate_text.ERROR); + jQuery('#plg_quickicon_extensionupdate').find('span.j-links-link').html(plg_quickicon_extensionupdate_text.ERROR); }, url: plg_quickicon_extensionupdate_ajax_url + '&eid=0&skip=700' }; diff --git a/media/plg_quickicon_joomlaupdate/js/jupdatecheck.js b/media/plg_quickicon_joomlaupdate/js/jupdatecheck.js index c58f6285339bc..416fc6eb97a5a 100644 --- a/media/plg_quickicon_joomlaupdate/js/jupdatecheck.js +++ b/media/plg_quickicon_joomlaupdate/js/jupdatecheck.js @@ -5,60 +5,58 @@ var plg_quickicon_jupdatecheck_ajax_structure = {}; -jQuery(document).ready(function() -{ +jQuery(document).ready(function() { plg_quickicon_jupdatecheck_ajax_structure = { - success: function(data, textStatus, jqXHR) - { + success: function(data, textStatus, jqXHR) { + var link = jQuery('#plg_quickicon_joomlaupdate').find('span.j-links-link'); + try { var updateInfoList = jQuery.parseJSON(data); } catch (e) { // An error occured - jQuery('#plg_quickicon_joomlaupdate').find('span').html(plg_quickicon_joomlaupdate_text.ERROR); + link.html(plg_quickicon_joomlaupdate_text.ERROR); } + if (updateInfoList instanceof Array) { if (updateInfoList.length < 1) { // No updates - jQuery('#plg_quickicon_joomlaupdate').find('span').replaceWith(plg_quickicon_joomlaupdate_text.UPTODATE); + link.replaceWith(plg_quickicon_joomlaupdate_text.UPTODATE); } else { var updateInfo = updateInfoList.shift(); if (updateInfo.version != plg_quickicon_jupdatecheck_jversion) { var updateString = plg_quickicon_joomlaupdate_text.UPDATEFOUND.replace("%s", updateInfo.version + ""); jQuery('#plg_quickicon_joomlaupdate').find('span').html(updateString); var updateString = plg_quickicon_joomlaupdate_text.UPDATEFOUND_MESSAGE.replace("%s", updateInfo.version + ""); - if (jQuery('.alert-joomlaupdate').length == 0) - { + if (jQuery('.alert-joomlaupdate').length == 0) { jQuery('#system-message-container').prepend( '
    ' - + updateString - + ' ' - + '
    ' + + updateString + + ' ' + + '
    ' ); } - else - { + else { jQuery('#system-message-container').prepend( '
    ' - + updateString - + ' ' - + '
    ' + + updateString + + ' ' + + '
    ' ); } - } else { - jQuery('#plg_quickicon_joomlaupdate').find('span').html(plg_quickicon_joomlaupdate_text.UPTODATE); + } else { + link.html(plg_quickicon_joomlaupdate_text.UPTODATE); } } } else { // An error occured - jQuery('#plg_quickicon_joomlaupdate').find('span').html(plg_quickicon_joomlaupdate_text.ERROR); + link.html(plg_quickicon_joomlaupdate_text.ERROR); } }, - error: function(jqXHR, textStatus, errorThrown) - { + error: function(jqXHR, textStatus, errorThrown) { // An error occured - jQuery('#plg_quickicon_joomlaupdate').find('span').html(plg_quickicon_joomlaupdate_text.ERROR); + jQuery('#plg_quickicon_joomlaupdate').find('span.j-links-link').html(plg_quickicon_joomlaupdate_text.ERROR); }, url: plg_quickicon_joomlaupdate_ajax_url + '&eid=700&cache_timeout=3600' }; diff --git a/media/system/css/adminlist.css b/media/system/css/adminlist.css index a6408e2d47ed3..161d7f1cb5947 100644 --- a/media/system/css/adminlist.css +++ b/media/system/css/adminlist.css @@ -209,15 +209,10 @@ button:hover { border: 1px solid #aaa; } -.clearfix { - overflow: hidden; -} - fieldset input, fieldset textarea, fieldset select, -fieldset img, -fieldset button { +fieldset img { float: left; width: auto; margin: 5px 5px 5px 0; diff --git a/media/system/js/core-uncompressed.js b/media/system/js/core-uncompressed.js index 67b3b7bd9af83..c75dc6fde2340 100644 --- a/media/system/js/core-uncompressed.js +++ b/media/system/js/core-uncompressed.js @@ -13,23 +13,29 @@ Joomla.editors.instances = {}; /** * Generic submit form */ -Joomla.submitform = function(task, form) { - if (typeof(form) === 'undefined') { +Joomla.submitform = function(task, form, validate) { + if (!form) { form = document.getElementById('adminForm'); } - if (typeof(task) !== 'undefined' && task !== "") { + if (task) { form.task.value = task; } + // Toggle HTML5 validation + form.noValidate = !validate; + // Submit the form. - if (typeof form.onsubmit == 'function') { - form.onsubmit(); - } - if (typeof form.fireEvent == "function") { - form.fireEvent('onsubmit'); - } - form.submit(); + // Create the input type="submit" + var button = document.createElement('input'); + button.style.display = 'none'; + button.type = 'submit'; + + // Append it and click it + form.appendChild(button).click(); + + // If "submit" was prevented, make sure we don't get a build up of buttons + form.removeChild(button); }; /** @@ -37,7 +43,7 @@ Joomla.submitform = function(task, form) { */ Joomla.submitbutton = function(pressbutton) { Joomla.submitform(pressbutton); -} +}; /** * Custom behavior for JavaScript I18N in Joomla! 1.6 @@ -113,7 +119,7 @@ Joomla.checkAll = function(checkbox, stub) { return true; } return false; -} +}; /** * Render messages send via JSON @@ -148,7 +154,7 @@ Joomla.renderMessages = function(messages) { titleWrapper.className = 'alert-heading'; titleWrapper.innerHTML = Joomla.JText._(type); - messagesBox.appendChild(titleWrapper) + messagesBox.appendChild(titleWrapper); } // Add messages to the message box @@ -156,7 +162,7 @@ Joomla.renderMessages = function(messages) { var messageWrapper = document.createElement('p'); messageWrapper.innerHTML = typeMessages[i]; messagesBox.appendChild(messageWrapper); - }; + } messageContainer.appendChild(messagesBox); } @@ -179,7 +185,7 @@ Joomla.removeMessages = function() { messageContainer.style.display='none'; messageContainer.offsetHeight; messageContainer.style.display=''; -} +}; /** * USED IN: administrator/components/com_cache/views/cache/tmpl/default.php @@ -217,7 +223,7 @@ Joomla.isChecked = function(isitchecked, form) { if (form.elements['checkall-toggle']) { form.elements['checkall-toggle'].checked = c; } -} +}; /** * USED IN: libraries/joomla/html/toolbar/button/help.php @@ -228,10 +234,10 @@ Joomla.popupWindow = function(mypage, myname, w, h, scroll) { var winl = (screen.width - w) / 2, wint, winprops, win; wint = (screen.height - h) / 2; winprops = 'height=' + h + ',width=' + w + ',top=' + wint + ',left=' + winl - + ',scrollbars=' + scroll + ',resizable' - win = window.open(mypage, myname, winprops) + + ',scrollbars=' + scroll + ',resizable'; + win = window.open(mypage, myname, winprops); win.window.focus(); -} +}; /** * USED IN: libraries/joomla/html/html/grid.php @@ -244,7 +250,7 @@ Joomla.tableOrdering = function(order, dir, task, form) { form.filter_order.value = order; form.filter_order_Dir.value = dir; Joomla.submitform(task, form); -} +}; /** * USED IN: administrator/components/com_modules/views/module/tmpl/default.php @@ -409,7 +415,7 @@ function listItemTask(id, task) { * @deprecated 12.1 This function will be removed in a future version. Use Joomla.submitbutton() instead. */ function submitbutton(pressbutton) { - submitform(pressbutton); + Joomla.submitform(pressbutton); } /** @@ -418,16 +424,7 @@ function submitbutton(pressbutton) { * @deprecated 12.1 This function will be removed in a future version. Use Joomla.submitform() instead. */ function submitform(pressbutton) { - if (pressbutton) { - document.adminForm.task.value = pressbutton; - } - if (typeof document.adminForm.onsubmit == "function") { - document.adminForm.onsubmit(); - } - if (typeof document.adminForm.fireEvent == "function") { - document.adminForm.fireEvent('onsubmit'); - } - document.adminForm.submit(); + Joomla.submitform(pressbutton); } // needed for Table Column ordering diff --git a/media/system/js/core.js b/media/system/js/core.js index 322924c7b0acf..8f4f483e205ae 100644 --- a/media/system/js/core.js +++ b/media/system/js/core.js @@ -1 +1 @@ -function writeDynaList(a,b,c,d,e){var g,h,f="\n ",document.writeln(f)}function changeDynaList(a,b,c,d,e){var f=document.adminForm[a];for(i in f.options.length)f.options[i]=null;i=0;for(x in b)b[x][0]==c&&(opt=new Option,opt.value=b[x][1],opt.text=b[x][2],(d==c&&e==opt.value||0==i)&&(opt.selected=!0),f.options[i++]=opt);f.length=i}function radioGetCheckedValue(a){if(!a)return"";var c,b=a.length;if(void 0==b)return a.checked?a.value:"";for(c=0;b>c;c++)if(a[c].checked)return a[c].value;return""}function getSelectedValue(a,b){var c=document[a],d=c[b];return i=d.selectedIndex,null!=i&&i>-1?d.options[i].value:null}function listItemTask(a,b){var d,e,c=document.adminForm,f=c[a];if(f){for(d=0;!0&&(e=c["cb"+d],e);d++)e.checked=!1;f.checked=!0,c.boxchecked.value=1,submitbutton(b)}return!1}function submitbutton(a){submitform(a)}function submitform(a){a&&(document.adminForm.task.value=a),"function"==typeof document.adminForm.onsubmit&&document.adminForm.onsubmit(),"function"==typeof document.adminForm.fireEvent&&document.adminForm.fireEvent("onsubmit"),document.adminForm.submit()}function saveorder(a,b){checkAll_button(a,b)}function checkAll_button(a,b){b||(b="saveorder");var c,d;for(c=0;a>=c;c++){if(d=document.adminForm["cb"+c],!d)return alert("You cannot change the order of items, as an item in the list is `Checked Out`"),void 0;0==d.checked&&(d.checked=!0)}submitform(b)}Joomla=window.Joomla||{},Joomla.editors={},Joomla.editors.instances={},Joomla.submitform=function(a,b){"undefined"==typeof b&&(b=document.getElementById("adminForm")),"undefined"!=typeof a&&""!==a&&(b.task.value=a),"function"==typeof b.onsubmit&&b.onsubmit(),"function"==typeof b.fireEvent&&b.fireEvent("onsubmit"),b.submit()},Joomla.submitbutton=function(a){Joomla.submitform(a)},Joomla.JText={strings:{},_:function(a,b){return"undefined"!=typeof this.strings[a.toUpperCase()]?this.strings[a.toUpperCase()]:b},load:function(a){for(var b in a)this.strings[b.toUpperCase()]=a[b];return this}},Joomla.replaceTokens=function(a){var c,b=document.getElementsByTagName("input");for(c=0;cd;d++)e=a.form.elements[d],e.type==a.type&&(b&&0==e.id.indexOf(b)||!b)&&(e.checked=a.checked,c+=1==e.checked?1:0);return a.form.boxchecked&&(a.form.boxchecked.value=c),!0}return!1},Joomla.renderMessages=function(a){Joomla.removeMessages();var b=document.getElementById("system-message-container");for(var c in a)if(a.hasOwnProperty(c)){var d=a[c],e=document.createElement("div");e.className="alert alert-"+c;var f=Joomla.JText._(c);if("undefined"!=typeof f){var g=document.createElement("h4");g.className="alert-heading",g.innerHTML=Joomla.JText._(c),e.appendChild(g)}for(var h=d.length-1;h>=0;h--){var i=document.createElement("p");i.innerHTML=d[h],e.appendChild(i)}b.appendChild(e)}},Joomla.removeMessages=function(){for(var a=document.getElementById("system-message-container");a.firstChild;)a.removeChild(a.firstChild);a.style.display="none",a.offsetHeight,a.style.display=""},Joomla.isChecked=function(a,b){"undefined"==typeof b&&(b=document.getElementById("adminForm")),1==a?b.boxchecked.value++:b.boxchecked.value--;var d,e,c=!0;for(d=0,n=b.elements.length;n>d;d++)if(e=b.elements[d],"checkbox"==e.type&&"checkall-toggle"!=e.name&&0==e.checked){c=!1;break}b.elements["checkall-toggle"]&&(b.elements["checkall-toggle"].checked=c)},Joomla.popupWindow=function(a,b,c,d,e){var g,h,i,f=(screen.width-c)/2;g=(screen.height-d)/2,h="height="+d+",width="+c+",top="+g+",left="+f+",scrollbars="+e+",resizable",i=window.open(a,b,h),i.window.focus()},Joomla.tableOrdering=function(a,b,c,d){"undefined"==typeof d&&(d=document.getElementById("adminForm")),d.filter_order.value=a,d.filter_order_Dir.value=b,Joomla.submitform(c,d)}; \ No newline at end of file +function writeDynaList(e,t,n,r,i){var s="\n ",document.writeln(s)}function changeDynaList(e,t,n,r,s){var o=document.adminForm[e];for(i in o.options.length)o.options[i]=null;i=0;for(x in t)if(t[x][0]==n){opt=new Option,opt.value=t[x][1],opt.text=t[x][2];if(r==n&&s==opt.value||i==0)opt.selected=!0;o.options[i++]=opt}o.length=i}function radioGetCheckedValue(e){if(!e)return"";var t=e.length,n;if(t==undefined)return e.checked?e.value:"";for(n=0;n-1?r.options[i].value:null}function listItemTask(e,t){var n=document.adminForm,r,i,s=n[e];if(s){for(r=0;!0;r++){i=n["cb"+r];if(!i)break;i.checked=!1}s.checked=!0,n.boxchecked.value=1,submitbutton(t)}return!1}function submitbutton(e){Joomla.submitform(e)}function submitform(e){Joomla.submitform(e)}function saveorder(e,t){checkAll_button(e,t)}function checkAll_button(e,t){t||(t="saveorder");var n,r;for(n=0;n<=e;n++){r=document.adminForm["cb"+n];if(!r){alert("You cannot change the order of items, as an item in the list is `Checked Out`");return}r.checked==0&&(r.checked=!0)}submitform(t)}Joomla=window.Joomla||{},Joomla.editors={},Joomla.editors.instances={},Joomla.submitform=function(e,t,n){t||(t=document.getElementById("adminForm")),e&&(t.task.value=e),t.noValidate=!n;var r=document.createElement("input");r.style.display="none",r.type="submit",t.appendChild(r).click(),t.removeChild(r)},Joomla.submitbutton=function(e){Joomla.submitform(e)},Joomla.JText={strings:{},_:function(e,t){return typeof this.strings[e.toUpperCase()]!="undefined"?this.strings[e.toUpperCase()]:t},load:function(e){for(var t in e)this.strings[t.toUpperCase()]=e[t];return this}},Joomla.replaceTokens=function(e){var t=document.getElementsByTagName("input"),n;for(n=0;n=0;u--){var a=document.createElement("p");a.innerHTML=r[u],i.appendChild(a)}t.appendChild(i)}},Joomla.removeMessages=function(){var e=document.getElementById("system-message-container");while(e.firstChild)e.removeChild(e.firstChild);e.style.display="none",e.offsetHeight,e.style.display=""},Joomla.isChecked=function(e,t){typeof t=="undefined"&&(t=document.getElementById("adminForm")),e==1?t.boxchecked.value++:t.boxchecked.value--;var r=!0,i,s;for(i=0,n=t.elements.length;i.btn.jmodedit').clearQueue().tooltip('destroy').remove(); // Add editing button with tooltip: $(this).addClass('jmodinside') - .prepend('') + .prepend('') .children(":first").attr('href', moduleEditUrl).attr('title', moduleTip) - .tooltip({"container": false, placement: tooltipPlacer}) + .tooltip({"container": false, html: true, placement: tooltipPlacer}) .jEditMakeAbsolute(true); // This class was needed for positioning the icon before making it absolute at bottom of body: We can now remove it: $(this).removeClass('jmodinside'); @@ -191,7 +192,7 @@ } } }) - .find('a.jfedit-menu').tooltip({"container": false, placement: 'bottom'}); + .find('a.jfedit-menu').tooltip({"container": false, html: true, placement: 'bottom'}); }, mouseleave: function() { $(this).delay(1500).queue(function(next) { $(this).popover('hide'); next() }); diff --git a/media/system/js/frontediting.js b/media/system/js/frontediting.js index 323b94db5f1ed..c860d0b79c6c3 100644 --- a/media/system/js/frontediting.js +++ b/media/system/js/frontediting.js @@ -1 +1 @@ -(function(e){e.fn.extend({jEditMakeAbsolute:function(t){return this.each(function(){var n=e(this);var r;if(t){r=n.offset()}else{r=n.position()}n.css({position:"absolute",marginLeft:0,marginTop:0,top:r.top,left:r.left,width:n.width(),height:n.height()});if(t){n.detach().appendTo("body")}})}});e(document).ready(function(){var t=200;var n=100;var r=function(r,i){var s,o,u,a,f,l,c,h,p,d,v,m,g,y,b;m=function(e){return ce.left+t&&a>e.top+n};s=e(i);y=e.extend({},s.offset(),{width:i.offsetWidth,height:i.offsetHeight});c=e(document).scrollTop();f=e(document).scrollLeft();l=f+e(window).width();a=c+e(window).height();h={top:y.top-n,left:y.left+y.width/2-t/2};p={top:y.top+y.height,left:y.left+y.width/2-t/2};d={top:y.top+y.height/2-n/2,left:y.left-t};v={top:y.top+y.height/2-n/2,left:y.left+y.width};o=m(h);u=m(p);g=m(d);b=m(v);if(o){return"top"}else{if(u){return"bottom"}else{if(g){return"left"}else{if(b){return"right"}else{return"right"}}}}};e(".jmoddiv").on({mouseenter:function(){var t=e(this).data("jmodediturl");var n=e(this).data("jmodtip");e("body>.btn.jmodedit").clearQueue().tooltip("destroy").remove();e(this).addClass("jmodinside").prepend('').children(":first").attr("href",t).attr("title",n).tooltip({container:false,placement:r}).jEditMakeAbsolute(true);e(this).removeClass("jmodinside");e(".btn.jmodedit").on({mouseenter:function(){e(this).clearQueue()},mouseleave:function(){e(this).delay(500).queue(function(t){e(this).tooltip("destroy").remove();t()})}})},mouseleave:function(){e("body>.btn.jmodedit").delay(500).queue(function(t){e(this).tooltip("destroy").remove();t()})}});var i=null;e(".jmoddiv[data-jmenuedittip] .nav li,.jmoddiv[data-jmenuedittip].nav li,.jmoddiv[data-jmenuedittip] .nav .nav-child li,.jmoddiv[data-jmenuedittip].nav .nav-child li").on({mouseenter:function(){var t=/\bitem-(\d+)\b/.exec(e(this).attr("class"));if(typeof t[1]=="string"){var n=e(this).closest(".jmoddiv");var r=n.data("jmodediturl");var s=r.replace(/\/index.php\?option=com_config&controller=config.display.modules([^\d]+).+$/,"/administrator/index.php?option=com_menus&view=item&layout=edit$1"+t[1])}var o=n.data("jmenuedittip").replace("%s",t[1]);var u=e('
    ');u.children("a.jfedit-menu").prop("href",s).prop("title",o);if(i){e(i).popover("hide")}e(this).popover({html:true,content:u.html(),container:"body",trigger:"manual",animation:false,placement:"bottom"}).popover("show");i=this;e("body>div.popover").on({mouseenter:function(){if(i){e(i).clearQueue()}},mouseleave:function(){if(i){e(i).popover("hide")}}}).find("a.jfedit-menu").tooltip({container:false,placement:"bottom"})},mouseleave:function(){e(this).delay(1500).queue(function(t){e(this).popover("hide");t()})}})})})(jQuery); +(function($){$.fn.extend({jEditMakeAbsolute:function(rebase){return this.each(function(){var el=$(this);var pos;if(rebase){pos=el.offset()}else{pos=el.position()}el.css({position:"absolute",marginLeft:0,marginTop:0,top:pos.top,left:pos.left,width:el.width(),height:el.height()});if(rebase){el.detach().appendTo("body")}})}});$(document).ready(function(){var actualWidth=200;var actualHeight=100;var tooltipPlacer=function(tip,element){var $element,above,below,boundBottom,boundLeft,boundRight,boundTop,elementAbove,elementBelow,elementLeft,elementRight,isWithinBounds,left,pos,right;isWithinBounds=function(elementPosition){return boundTopelementPosition.left+actualWidth&&boundBottom>elementPosition.top+actualHeight};$element=$(element);pos=$.extend({},$element.offset(),{width:element.offsetWidth,height:element.offsetHeight});boundTop=$(document).scrollTop();boundLeft=$(document).scrollLeft();boundRight=boundLeft+$(window).width();boundBottom=boundTop+$(window).height();elementAbove={top:pos.top-actualHeight,left:pos.left+pos.width/2-actualWidth/2};elementBelow={top:pos.top+pos.height,left:pos.left+pos.width/2-actualWidth/2};elementLeft={top:pos.top+pos.height/2-actualHeight/2,left:pos.left-actualWidth};elementRight={top:pos.top+pos.height/2-actualHeight/2,left:pos.left+pos.width};above=isWithinBounds(elementAbove);below=isWithinBounds(elementBelow);left=isWithinBounds(elementLeft);right=isWithinBounds(elementRight);if(above){return"top"}else{if(below){return"bottom"}else{if(left){return"left"}else{if(right){return"right"}else{return"right"}}}}};$(".jmoddiv").on({mouseenter:function(){var moduleEditUrl=$(this).data("jmodediturl");var moduleTip=$(this).data("jmodtip");var moduleTarget = $(this).data('target');$("body>.btn.jmodedit").clearQueue().tooltip("destroy").remove();$(this).addClass("jmodinside").prepend('').children(":first").attr("href",moduleEditUrl).attr("title",moduleTip).tooltip({container:false,html:true,placement:tooltipPlacer}).jEditMakeAbsolute(true);$(this).removeClass("jmodinside");$(".btn.jmodedit").on({mouseenter:function(){$(this).clearQueue()},mouseleave:function(){$(this).delay(500).queue(function(next){$(this).tooltip("destroy").remove();next()})}})},mouseleave:function(){$("body>.btn.jmodedit").delay(500).queue(function(next){$(this).tooltip("destroy").remove();next()})}});var activePopover=null;$(".jmoddiv[data-jmenuedittip] .nav li,.jmoddiv[data-jmenuedittip].nav li,.jmoddiv[data-jmenuedittip] .nav .nav-child li,.jmoddiv[data-jmenuedittip].nav .nav-child li").on({mouseenter:function(){var itemids=/\bitem-(\d+)\b/.exec($(this).attr("class"));if(typeof itemids[1]=="string"){var enclosingModuleDiv=$(this).closest(".jmoddiv");var moduleEditUrl=enclosingModuleDiv.data("jmodediturl");var menuitemEditUrl=moduleEditUrl.replace(/\/index.php\?option=com_config&controller=config.display.modules([^\d]+).+$/,"/administrator/index.php?option=com_menus&view=item&layout=edit$1"+itemids[1])}var menuEditTip=enclosingModuleDiv.data("jmenuedittip").replace("%s",itemids[1]);var content=$('
    ');content.children("a.jfedit-menu").prop("href",menuitemEditUrl).prop("title",menuEditTip);if(activePopover){$(activePopover).popover("hide")}$(this).popover({html:true,content:content.html(),container:"body",trigger:"manual",animation:false,placement:"bottom"}).popover("show");activePopover=this;$("body>div.popover").on({mouseenter:function(){if(activePopover){$(activePopover).clearQueue()}},mouseleave:function(){if(activePopover){$(activePopover).popover("hide")}}}).find("a.jfedit-menu").tooltip({container:false,html:true,placement:"bottom"})},mouseleave:function(){$(this).delay(1500).queue(function(next){$(this).popover("hide");next()})}})})})(jQuery); \ No newline at end of file diff --git a/media/system/js/html5fallback-uncompressed.js b/media/system/js/html5fallback-uncompressed.js index 94cd85d17642d..37e6ded75d022 100644 --- a/media/system/js/html5fallback-uncompressed.js +++ b/media/system/js/html5fallback-uncompressed.js @@ -179,13 +179,11 @@ $elem.addClass(self.options.invalidClass); var $labelref = self.findLabel($elem); $labelref.addClass(self.options.invalidClass); - $labelref.attr('aria-invalid', 'true'); } else{ $elem.removeClass(self.options.invalidClass); var $labelref = self.findLabel($elem); $labelref.removeClass(self.options.invalidClass) - $labelref.attr('aria-invalid', 'false'); } return elem.validityState.valid; }, diff --git a/media/system/js/html5fallback.js b/media/system/js/html5fallback.js index b0356c388fd09..d1ef58653fef1 100644 --- a/media/system/js/html5fallback.js +++ b/media/system/js/html5fallback.js @@ -1 +1 @@ -(function(c,a,d){if(typeof Object.create!=="function"){Object.create=function(f){function e(){}e.prototype=f;return new e()}}var b={init:function(f,g){var e=this;e.elem=g;e.$elem=c(g);g.H5Form=e;e.options=c.extend({},c.fn.h5f.options,f);e.field=a.createElement("input");e.checkSupport(e);if(g.nodeName.toLowerCase()==="form"){e.bindWithForm(e.elem,e.$elem)}},bindWithForm:function(k,i){var h=this,e=!!i.attr("novalidate"),l=k.elements,g=l.length;if(h.options.formValidationEvent==="onSubmit"){i.on("submit",function(m){var f=this.H5Form.donotValidate!=d?this.H5Form.donotValidate:false;if(!f&&!e&&!h.validateForm(h)){m.preventDefault();this.donotValidate=false}else{i.find(":input").each(function(){h.placeholder(h,this,"submit")})}})}i.on("focusout focusin",function(f){h.placeholder(h,f.target,f.type)});i.on("focusout change",h.validateField);i.find("fieldset").on("change",function(){h.validateField(this)});if(!h.browser.isFormnovalidateNative){i.find(":submit[formnovalidate]").on("click",function(){h.donotValidate=true})}while(g--){var j=l[g];h.polyfill(j);h.autofocus(h,j)}},polyfill:function(f){if(f.nodeName.toLowerCase()==="form"){return true}var e=f.form.H5Form;e.placeholder(e,f);e.numberType(e,f)},checkSupport:function(e){e.browser={};e.browser.isRequiredNative=!!("required" in e.field);e.browser.isPatternNative=!!("pattern" in e.field);e.browser.isPlaceholderNative=!!("placeholder" in e.field);e.browser.isAutofocusNative=!!("autofocus" in e.field);e.browser.isFormnovalidateNative=!!("formnovalidate" in e.field);e.field.setAttribute("type","email");e.browser.isEmailNative=(e.field.type=="email");e.field.setAttribute("type","url");e.browser.isUrlNative=(e.field.type=="url");e.field.setAttribute("type","number");e.browser.isNumberNative=(e.field.type=="number");e.field.setAttribute("type","range");e.browser.isRangeNative=(e.field.type=="range")},validateForm:function(){var g=this,l=g.elem,m=l.elements,e=m.length,h=true;l.isValid=true;for(var j=0;j"),e;k=isNaN(k)?-100:k;for(var m=k;m<=n;m+=g){e=c("
    ' . $label . ' '; - $output .= ''; if ($button) : diff --git a/modules/mod_stats/helper.php b/modules/mod_stats/helper.php index 07e01f5401035..2540529b965b9 100644 --- a/modules/mod_stats/helper.php +++ b/modules/mod_stats/helper.php @@ -77,14 +77,28 @@ public static function &getList(&$params) $query->select('COUNT(id) AS count_users') ->from('#__users'); $db->setQuery($query); - $users = $db->loadResult(); + try + { + $users = $db->loadResult(); + } + catch (RuntimeException $e) + { + $users = false; + } $query->clear() ->select('COUNT(id) AS count_items') ->from('#__content') ->where('state = 1'); $db->setQuery($query); - $items = $db->loadResult(); + try + { + $items = $db->loadResult(); + } + catch (RuntimeException $e) + { + $items = false; + } if ($users) { @@ -109,7 +123,14 @@ public static function &getList(&$params) ->from('#__weblinks') ->where('state = 1'); $db->setQuery($query); - $links = $db->loadResult(); + try + { + $links = $db->loadResult(); + } + catch (RuntimeException $e) + { + $links = false; + } if ($links) { @@ -129,7 +150,14 @@ public static function &getList(&$params) ->from('#__content') ->where('state = 1'); $db->setQuery($query); - $hits = $db->loadResult(); + try + { + $hits = $db->loadResult(); + } + catch (RuntimeException $e) + { + $hits = false; + } if ($hits) { diff --git a/modules/mod_tags_popular/helper.php b/modules/mod_tags_popular/helper.php index 8804390675269..d33d6295ae39b 100644 --- a/modules/mod_tags_popular/helper.php +++ b/modules/mod_tags_popular/helper.php @@ -32,7 +32,7 @@ public static function getList(&$params) $groups = implode(',', $user->getAuthorisedViewLevels()); $timeframe = $params->get('timeframe', 'alltime'); $maximum = $params->get('maximum', 5); - $order_value = $params->get('order_value', 'count'); + $order_value = $params->get('order_value', 'title'); $nowDate = JFactory::getDate()->toSql(); $nullDate = $db->quote($db->getNullDate()); @@ -93,7 +93,15 @@ public static function getList(&$params) ->where('(' . $db->quoteName('c.core_publish_down') . ' = ' . $nullDate . ' OR ' . $db->quoteName('c.core_publish_down') . ' >= ' . $db->quote($nowDate) . ')'); $db->setQuery($query, 0, $maximum); - $results = $db->loadObjectList(); + try + { + $results = $db->loadObjectList(); + } + catch (RuntimeException $e) + { + $results = array(); + JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); + } return $results; } diff --git a/modules/mod_tags_similar/helper.php b/modules/mod_tags_similar/helper.php index 3416da9b1af79..06713c02258de 100644 --- a/modules/mod_tags_similar/helper.php +++ b/modules/mod_tags_similar/helper.php @@ -139,7 +139,15 @@ public static function getList(&$params) } $db->setQuery($query, 0, $maximum); - $results = $db->loadObjectList(); + try + { + $results = $db->loadObjectList(); + } + catch (RuntimeException $e) + { + $results = array(); + JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error'); + } foreach ($results as $result) { diff --git a/modules/mod_users_latest/helper.php b/modules/mod_users_latest/helper.php index 1523ef8873583..f837b1b4c0671 100644 --- a/modules/mod_users_latest/helper.php +++ b/modules/mod_users_latest/helper.php @@ -53,8 +53,16 @@ public static function getUsers($params) } $db->setQuery($query, 0, $params->get('shownumber')); - $result = $db->loadObjectList(); - return (array) $result; + try + { + return (array) $db->loadObjectList(); + } + catch (RuntimeException $e) + { + JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error'); + + return array(); + } } } diff --git a/modules/mod_whosonline/helper.php b/modules/mod_whosonline/helper.php index 3ffdaf7eaac7b..0138f145bc126 100644 --- a/modules/mod_whosonline/helper.php +++ b/modules/mod_whosonline/helper.php @@ -38,7 +38,15 @@ public static function getOnlineCount() ->where('client_id = 0'); $db->setQuery($query); - $sessions = (array) $db->loadObjectList(); + try + { + $sessions = (array) $db->loadObjectList(); + } + catch (RuntimeException $e) + { + // Don't worry be happy + $sessions = array(); + } if (count($sessions)) { @@ -102,6 +110,13 @@ public static function getOnlineUserNames($params) $db->setQuery($query); - return (array) $db->loadObjectList(); + try + { + return (array) $db->loadObjectList(); + } + catch (RuntimeException $e) + { + return array(); + } } } diff --git a/plugins/authentication/cookie/cookie.php b/plugins/authentication/cookie/cookie.php index 0e28c35972e1e..c3f5493401db0 100644 --- a/plugins/authentication/cookie/cookie.php +++ b/plugins/authentication/cookie/cookie.php @@ -59,7 +59,7 @@ public function onUserAuthenticate($credentials, $options, &$response) if (!$cookieValue) { - return; + return false; } $cookieArray = explode('.', $cookieValue); @@ -84,7 +84,15 @@ public function onUserAuthenticate($credentials, $options, &$response) $query = $this->db->getQuery(true) ->delete('#__user_keys') ->where($this->db->quoteName('time') . ' < ' . $this->db->quote(time())); - $this->db->setQuery($query)->execute(); + + try + { + $this->db->setQuery($query)->execute(); + } + catch (RuntimeException $e) + { + // We aren't concerned with errors from this query, carry on + } // Find the matching record if it exists. $query = $this->db->getQuery(true) @@ -93,7 +101,17 @@ public function onUserAuthenticate($credentials, $options, &$response) ->where($this->db->quoteName('series') . ' = ' . $this->db->quote($series)) ->where($this->db->quoteName('uastring') . ' = ' . $this->db->quote($cookieName)) ->order($this->db->quoteName('time') . ' DESC'); - $results = $this->db->setQuery($query)->loadObjectList(); + + try + { + $results = $this->db->setQuery($query)->loadObjectList(); + } + catch (RuntimeException $e) + { + $response->status = JAuthentication::STATUS_FAILURE; + + return false; + } if (count($results) !== 1) { @@ -101,32 +119,42 @@ public function onUserAuthenticate($credentials, $options, &$response) $this->app->input->cookie->set($cookieName, false, time() - 42000, $this->app->get('cookie_path', '/'), $this->app->get('cookie_domain')); $response->status = JAuthentication::STATUS_FAILURE; - return; + return false; } // We have a user with one cookie with a valid series and a corresponding record in the database. - else + if (!JUserHelper::verifyPassword($cookieArray[0], $results[0]->token)) { - $token = JUserHelper::hashPassword($cookieArray[0]); - - if (!JUserHelper::verifyPassword($cookieArray[0], $results[0]->token)) + /* + * This is a real attack! Either the series was guessed correctly or a cookie was stolen and used twice (once by attacker and once by victim). + * Delete all tokens for this user! + */ + $query = $this->db->getQuery(true) + ->delete('#__user_keys') + ->where($this->db->quoteName('user_id') . ' = ' . $this->db->quote($results[0]->user_id)); + + try { - // This is a real attack! Either the series was guessed correctly or a cookie was stolen and used twice (once by attacker and once by victim). - // Delete all tokens for this user! - $query = $this->db->getQuery(true) - ->delete('#__user_keys') - ->where($this->db->quoteName('user_id') . ' = ' . $this->db->quote($results[0]->user_id)); $this->db->setQuery($query)->execute(); + } + catch (RuntimeException $e) + { + // Log an alert for the site admin + JLog::add( + sprintf('Failed to delete cookie token for user %s with the following error: %s', $results[0]->user_id, $e->getMessage()), + JLog::WARNING, + 'security' + ); + } - // Destroy the cookie in the browser. - $this->app->input->cookie->set($cookieName, false, time() - 42000, $this->app->get('cookie_path', '/'), $this->app->get('cookie_domain')); + // Destroy the cookie in the browser. + $this->app->input->cookie->set($cookieName, false, time() - 42000, $this->app->get('cookie_path', '/'), $this->app->get('cookie_domain')); - // Issue warning by email to user and/or admin? - JLog::add(JText::sprintf('PLG_AUTH_COOKIE_ERROR_LOG_LOGIN_FAILED', $results[0]->user_id), JLog::WARNING, 'security'); - $response->status = JAuthentication::STATUS_FAILURE; + // Issue warning by email to user and/or admin? + JLog::add(JText::sprintf('PLG_AUTH_COOKIE_ERROR_LOG_LOGIN_FAILED', $results[0]->user_id), JLog::WARNING, 'security'); + $response->status = JAuthentication::STATUS_FAILURE; - return false; - } + return false; } // Make sure there really is a user with this name and get the data for the session. @@ -135,7 +163,17 @@ public function onUserAuthenticate($credentials, $options, &$response) ->from($this->db->quoteName('#__users')) ->where($this->db->quoteName('username') . ' = ' . $this->db->quote($results[0]->user_id)) ->where($this->db->quoteName('requireReset') . ' = 0'); - $result = $this->db->setQuery($query)->loadObject(); + + try + { + $result = $this->db->setQuery($query)->loadObject(); + } + catch (RuntimeException $e) + { + $response->status = JAuthentication::STATUS_FAILURE; + + return false; + } if ($result) { @@ -198,7 +236,8 @@ public function onUserAfterLogin($options) $cookieName = JUserHelper::getShortHashedUserAgent(); // Create an unique series which will be used over the lifespan of the cookie - $unique = false; + $unique = false; + $errorCount = 0; do { @@ -208,11 +247,24 @@ public function onUserAfterLogin($options) ->from($this->db->quoteName('#__user_keys')) ->where($this->db->quoteName('series') . ' = ' . $this->db->quote($series)); - $results = $this->db->setQuery($query)->loadResult(); + try + { + $results = $this->db->setQuery($query)->loadResult(); - if (is_null($results)) + if (is_null($results)) + { + $unique = true; + } + } + catch (RuntimeException $e) { - $unique = true; + $errorCount++; + + // We'll let this query fail up to 5 times before giving up, there's probably a bigger issue at this point + if ($errorCount == 5) + { + return false; + } } } @@ -264,7 +316,15 @@ public function onUserAfterLogin($options) $hashed_token = JUserHelper::hashPassword($token); $query->set($this->db->quoteName('token') . ' = ' . $this->db->quote($hashed_token)); - $this->db->setQuery($query)->execute(); + + try + { + $this->db->setQuery($query)->execute(); + } + catch (RuntimeException $e) + { + return false; + } return true; } @@ -302,12 +362,18 @@ public function onUserAfterLogout($options) $series = $filter->clean($cookieArray[1], 'ALNUM'); // Remove the record from the database - $query = $this->db->getQuery(true); - $query + $query = $this->db->getQuery(true) ->delete('#__user_keys') ->where($this->db->quoteName('series') . ' = ' . $this->db->quote($series)); - $this->db->setQuery($query)->execute(); + try + { + $this->db->setQuery($query)->execute(); + } + catch (RuntimeException $e) + { + // We aren't concerned with errors from this query, carry on + } // Destroy the cookie $this->app->input->cookie->set( diff --git a/plugins/authentication/joomla/joomla.php b/plugins/authentication/joomla/joomla.php index d7a407bb27497..1628fc4a81899 100644 --- a/plugins/authentication/joomla/joomla.php +++ b/plugins/authentication/joomla/joomla.php @@ -23,7 +23,7 @@ class PlgAuthenticationJoomla extends JPlugin * @param array $options Array of extra options * @param object &$response Authentication response object * - * @return boolean + * @return void * * @since 1.5 */ @@ -37,7 +37,7 @@ public function onUserAuthenticate($credentials, $options, &$response) $response->status = JAuthentication::STATUS_FAILURE; $response->error_message = JText::_('JGLOBAL_AUTH_EMPTY_PASS_NOT_ALLOWED'); - return false; + return; } // Get a database object @@ -178,7 +178,7 @@ public function onUserAuthenticate($credentials, $options, &$response) // Two factor authentication is not enabled on this account. // Any string is assumed to be a valid OTEP. - return true; + return; } else { @@ -187,7 +187,7 @@ public function onUserAuthenticate($credentials, $options, &$response) * user has used them all up. Therefore anything he enters is * an invalid OTEP. */ - return false; + return; } } diff --git a/plugins/captcha/recaptcha/recaptcha.php b/plugins/captcha/recaptcha/recaptcha.php index 0176aafcc1612..8d086590d34fe 100644 --- a/plugins/captcha/recaptcha/recaptcha.php +++ b/plugins/captcha/recaptcha/recaptcha.php @@ -71,13 +71,13 @@ public function onInit($id = 'dynamic_recaptcha_1') $file = $app->isSSLConnection() ? 'https' : 'http'; $file .= '://www.google.com/recaptcha/api.js?hl=' . JFactory::getLanguage() - ->getTag() . '&onload=onloadCallback&render=explicit'; + ->getTag() . '&render=explicit'; JHtml::_('script', $file, true, true); - $document->addScriptDeclaration('var onloadCallback = function() {' + $document->addScriptDeclaration('jQuery(document).ready(function($) {$(window).load(function() {' . 'grecaptcha.render("' . $id . '", {sitekey: "' . $pubkey . '", theme: "' . $theme . '"});' - . '}' + . '});});' ); break; } diff --git a/plugins/captcha/recaptcha/recaptchalib.php b/plugins/captcha/recaptcha/recaptchalib.php index 6bebdd52b595d..c77290a1e88bf 100644 --- a/plugins/captcha/recaptcha/recaptchalib.php +++ b/plugins/captcha/recaptcha/recaptchalib.php @@ -42,7 +42,7 @@ class JReCaptchaResponse class JReCaptcha { private static $_signupUrl = "https://www.google.com/recaptcha/admin"; - private static $_siteVerifyUrl = "https://www.google.com/recaptcha/api/siteverify?"; + private static $_siteVerifyUrl = "https://www.google.com/recaptcha/api/siteverify"; private $_secret; private static $_version = "php_1.0"; @@ -93,7 +93,8 @@ private function _encodeQS($data) private function _submitHTTPGet($path, $data) { $req = $this->_encodeQS($data); - $response = file_get_contents($path . $req); + $http = JHttpFactory::getHttp(); + $response = $http->get($path . '?' . $req)->body; return $response; } diff --git a/plugins/content/pagenavigation/tmpl/default.php b/plugins/content/pagenavigation/tmpl/default.php index a02c6cdea82e6..6b78040222037 100644 --- a/plugins/content/pagenavigation/tmpl/default.php +++ b/plugins/content/pagenavigation/tmpl/default.php @@ -16,7 +16,7 @@ $direction = $lang->isRTL() ? 'right' : 'left'; ?> @@ -24,7 +24,7 @@ $direction = $lang->isRTL() ? 'left' : 'right'; ?> diff --git a/plugins/editors-xtd/readmore/readmore.php b/plugins/editors-xtd/readmore/readmore.php index b627484633369..61160aacb538d 100644 --- a/plugins/editors-xtd/readmore/readmore.php +++ b/plugins/editors-xtd/readmore/readmore.php @@ -37,7 +37,7 @@ public function onDisplay($name) // Button is not active in specific content components - $getContent = $this->_subject->getContent($name); + $getContent = $this->_subject->getContent("'+editor+'"); $present = JText::_('PLG_READMORE_ALREADY_EXISTS', true); $js = " function insertReadmore(editor) diff --git a/plugins/editors/codemirror/codemirror.php b/plugins/editors/codemirror/codemirror.php index c5e69f6067909..45558d51cc9b6 100644 --- a/plugins/editors/codemirror/codemirror.php +++ b/plugins/editors/codemirror/codemirror.php @@ -67,9 +67,9 @@ public function onInit() $done = true; JHtml::_('behavior.framework'); - JHtml::_('script', $this->basePath . 'lib/codemirror.js'); - JHtml::_('script', $this->basePath . 'lib/addons.js'); - JHtml::_('stylesheet', $this->basePath . 'lib/codemirror.css'); + JHtml::_('script', $this->basePath . 'lib/codemirror.min.js'); + JHtml::_('script', $this->basePath . 'lib/addons.min.js'); + JHtml::_('stylesheet', $this->basePath . 'lib/codemirror.min.css'); JFactory::getDocument() ->addScriptDeclaration($this->getInitScript()) @@ -89,7 +89,8 @@ protected function getInitScript() $fskeys[] = $this->params->get('fullScreen', 'F10'); $this->fullScreenCombo = implode('-', $fskeys); - $modeURL = JURI::root(true) . '/media/editors/codemirror/mode/%N/%N.js'; + $ext = JFactory::getConfig()->get('debug') ? '.js' : '.min.js'; + $modeURL = JURI::root(true) . '/media/editors/codemirror/mode/%N/%N' . $ext; $script = array( ';(function (cm) {', @@ -118,7 +119,8 @@ protected function getInitScript() protected function getExtraStyles() { // Get our custom styles from a css file - $styles = JFile::read(__DIR__ . (JDEBUG ? '/styles.css' : '/styles.min.css')); + $filename = JFactory::getConfig()->get('debug') ? 'styles.css' : 'styles.min.css'; + $styles = JFile::read(__DIR__ . '/' . $filename); // Set the active line color. $color = $this->params->get('activeLineColor', '#a4c2eb'); diff --git a/plugins/editors/codemirror/codemirror.xml b/plugins/editors/codemirror/codemirror.xml index 115072d605511..1255d178198c3 100644 --- a/plugins/editors/codemirror/codemirror.xml +++ b/plugins/editors/codemirror/codemirror.xml @@ -1,7 +1,7 @@ plg_editors_codemirror - 4.12 + 5.3 28 March 2011 Marijn Haverbeke marijnh@gmail.com diff --git a/plugins/editors/tinymce/tinymce.php b/plugins/editors/tinymce/tinymce.php index 71984363cf52d..8d570f4f8f5af 100644 --- a/plugins/editors/tinymce/tinymce.php +++ b/plugins/editors/tinymce/tinymce.php @@ -120,7 +120,16 @@ public function onInit() ->where('client_id=0 AND home=' . $db->quote('1')); $db->setQuery($query); - $template = $db->loadResult(); + try + { + $template = $db->loadResult(); + } + catch (RuntimeException $e) + { + JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error'); + + return; + } $content_css = ''; $templates_path = JPATH_SITE . '/templates'; @@ -831,32 +840,14 @@ public function onSave($editor) */ public function onGetInsertMethod($name) { - $doc = JFactory::getDocument(); - - $js = " - function isBrowserIE() - { - return navigator.appName==\"Microsoft Internet Explorer\"; - } - + JFactory::getDocument()->addScriptDeclaration( + " function jInsertEditorText( text, editor ) { tinyMCE.execCommand('mceInsertContent', false, text); } - - var global_ie_bookmark = false; - - function IeCursorFix() - { - if (isBrowserIE()) - { - tinyMCE.execCommand('mceInsertContent', false, ''); - global_ie_bookmark = tinyMCE.activeEditor.selection.getBookmark(false); - } - return true; - }"; - - $doc->addScriptDeclaration($js); + " + ); return true; } @@ -949,6 +940,7 @@ private function _displayButtons($name, $buttons, $asset, $author) if (is_array($buttons) || (is_bool($buttons) && $buttons)) { $buttons = $this->_subject->getButtons($name, $buttons, $asset, $author); + $return .= JLayoutHelper::render('joomla.editors.buttons', $buttons); } diff --git a/plugins/finder/categories/categories.php b/plugins/finder/categories/categories.php index da85935e81390..1e9ad020e558d 100644 --- a/plugins/finder/categories/categories.php +++ b/plugins/finder/categories/categories.php @@ -4,10 +4,10 @@ * @subpackage Finder.Categories * * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE + * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('JPATH_BASE') or die; +defined('_JEXEC') or die; use Joomla\Registry\Registry; diff --git a/plugins/finder/contacts/contacts.php b/plugins/finder/contacts/contacts.php index 22355c604cfef..1e4b5c68b6149 100644 --- a/plugins/finder/contacts/contacts.php +++ b/plugins/finder/contacts/contacts.php @@ -4,10 +4,10 @@ * @subpackage Finder.Contacts * * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE + * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('JPATH_BASE') or die; +defined('_JEXEC') or die; use Joomla\Registry\Registry; diff --git a/plugins/finder/content/content.php b/plugins/finder/content/content.php index d246f335715e1..0888a8d5e9f03 100644 --- a/plugins/finder/content/content.php +++ b/plugins/finder/content/content.php @@ -4,10 +4,10 @@ * @subpackage Finder.Content * * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE + * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('JPATH_BASE') or die; +defined('_JEXEC') or die; use Joomla\Registry\Registry; diff --git a/plugins/finder/newsfeeds/newsfeeds.php b/plugins/finder/newsfeeds/newsfeeds.php index 04a38cc79ce58..852a48ef70e13 100644 --- a/plugins/finder/newsfeeds/newsfeeds.php +++ b/plugins/finder/newsfeeds/newsfeeds.php @@ -4,10 +4,10 @@ * @subpackage Finder.Newsfeeds * * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE + * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('JPATH_BASE') or die; +defined('_JEXEC') or die; use Joomla\Registry\Registry; diff --git a/plugins/finder/tags/tags.php b/plugins/finder/tags/tags.php index bfde84814bf84..9b1c30e7d96d7 100644 --- a/plugins/finder/tags/tags.php +++ b/plugins/finder/tags/tags.php @@ -4,10 +4,10 @@ * @subpackage Finder.Tags * * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE + * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('JPATH_BASE') or die; +defined('_JEXEC') or die; use Joomla\Registry\Registry; diff --git a/plugins/quickicon/extensionupdate/extensionupdate.php b/plugins/quickicon/extensionupdate/extensionupdate.php index e8fa8514a1838..295b9c63c72d7 100644 --- a/plugins/quickicon/extensionupdate/extensionupdate.php +++ b/plugins/quickicon/extensionupdate/extensionupdate.php @@ -44,9 +44,10 @@ public function onGetIcons($context) JHtml::_('jquery.framework'); - $url = JUri::base() . 'index.php?option=com_installer&view=update'; - $ajax_url = JUri::base() . 'index.php?option=com_installer&view=update&task=update.ajax'; - $script = array(); + $token = JSession::getFormToken() . '=' . 1; + $url = JUri::base() . 'index.php?option=com_installer&view=update&task=update.find&' . $token; + $ajax_url = JUri::base() . 'index.php?option=com_installer&view=update&task=update.ajax&' . $token; + $script = array(); $script[] = 'var plg_quickicon_extensionupdate_url = \'' . $url . '\';'; $script[] = 'var plg_quickicon_extensionupdate_ajax_url = \'' . $ajax_url . '\';'; $script[] = 'var plg_quickicon_extensionupdate_text = {' @@ -61,11 +62,11 @@ public function onGetIcons($context) return array( array( - 'link' => 'index.php?option=com_installer&view=update', + 'link' => 'index.php?option=com_installer&view=update&task=update.find&' . $token, 'image' => 'asterisk', - 'icon' => 'header/icon-48-extension.png', - 'text' => JText::_('PLG_QUICKICON_EXTENSIONUPDATE_CHECKING'), - 'id' => 'plg_quickicon_extensionupdate', + 'icon' => 'header/icon-48-extension.png', + 'text' => JText::_('PLG_QUICKICON_EXTENSIONUPDATE_CHECKING'), + 'id' => 'plg_quickicon_extensionupdate', 'group' => 'MOD_QUICKICON_MAINTENANCE' ) ); diff --git a/plugins/quickicon/joomlaupdate/joomlaupdate.php b/plugins/quickicon/joomlaupdate/joomlaupdate.php index 965140ce061b6..d863395e40c9d 100644 --- a/plugins/quickicon/joomlaupdate/joomlaupdate.php +++ b/plugins/quickicon/joomlaupdate/joomlaupdate.php @@ -46,8 +46,10 @@ public function onGetIcons($context) JHtml::_('jquery.framework'); $cur_template = JFactory::getApplication()->getTemplate(); + + $token = JSession::getFormToken() . '=' . 1; $url = JUri::base() . 'index.php?option=com_joomlaupdate'; - $ajax_url = JUri::base() . 'index.php?option=com_installer&view=update&task=update.ajax'; + $ajax_url = JUri::base() . 'index.php?option=com_installer&view=update&task=update.ajax&' . $token; $script = array(); $script[] = 'var plg_quickicon_joomlaupdate_url = \'' . $url . '\';'; $script[] = 'var plg_quickicon_joomlaupdate_ajax_url = \'' . $ajax_url . '\';'; diff --git a/plugins/search/categories/categories.php b/plugins/search/categories/categories.php index cdacdd4117b1e..ef2611e0d60be 100644 --- a/plugins/search/categories/categories.php +++ b/plugins/search/categories/categories.php @@ -169,7 +169,15 @@ public function onContentSearch($text, $phrase = '', $ordering = '', $areas = nu } $db->setQuery($query, 0, $limit); - $rows = $db->loadObjectList(); + try + { + $rows = $db->loadObjectList(); + } + catch (RuntimeException $e) + { + $rows = array(); + JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error'); + } $return = array(); diff --git a/plugins/search/contacts/contacts.php b/plugins/search/contacts/contacts.php index fffe0f4ccb504..cdd332263ab87 100644 --- a/plugins/search/contacts/contacts.php +++ b/plugins/search/contacts/contacts.php @@ -167,7 +167,16 @@ public function onContentSearch($text, $phrase = '', $ordering = '', $areas = nu } $db->setQuery($query, 0, $limit); - $rows = $db->loadObjectList(); + + try + { + $rows = $db->loadObjectList(); + } + catch (RuntimeException $e) + { + $rows = array(); + JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error'); + } if ($rows) { diff --git a/plugins/search/content/content.php b/plugins/search/content/content.php index bef3e75209977..a483db22ce69c 100644 --- a/plugins/search/content/content.php +++ b/plugins/search/content/content.php @@ -189,7 +189,15 @@ public function onContentSearch($text, $phrase = '', $ordering = '', $areas = nu } $db->setQuery($query, 0, $limit); - $list = $db->loadObjectList(); + try + { + $list = $db->loadObjectList(); + } + catch (RuntimeException $e) + { + $list = array(); + JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error'); + } $limit -= count($list); if (isset($list)) @@ -251,7 +259,15 @@ public function onContentSearch($text, $phrase = '', $ordering = '', $areas = nu } $db->setQuery($query, 0, $limit); - $list3 = $db->loadObjectList(); + try + { + $list3 = $db->loadObjectList(); + } + catch (RuntimeException $e) + { + $list3 = array(); + JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error'); + } // Find an itemid for archived to use if there isn't another one. $item = $app->getMenu()->getItems('link', 'index.php?option=com_content&view=archive', true); diff --git a/plugins/search/newsfeeds/newsfeeds.php b/plugins/search/newsfeeds/newsfeeds.php index 579c69cc4765b..d33097f46f2a7 100644 --- a/plugins/search/newsfeeds/newsfeeds.php +++ b/plugins/search/newsfeeds/newsfeeds.php @@ -181,7 +181,15 @@ public function onContentSearch($text, $phrase = '', $ordering = '', $areas = nu } $db->setQuery($query, 0, $limit); - $rows = $db->loadObjectList(); + try + { + $rows = $db->loadObjectList(); + } + catch (RuntimeException $e) + { + $rows = array(); + JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error'); + } if ($rows) { diff --git a/plugins/search/tags/tags.php b/plugins/search/tags/tags.php index b1fee8ff1e8da..8baf9c8fbc0fc 100644 --- a/plugins/search/tags/tags.php +++ b/plugins/search/tags/tags.php @@ -136,7 +136,15 @@ public function onContentSearch($text, $phrase = '', $ordering = '', $areas = nu $query->order($order); $db->setQuery($query, 0, $limit); - $rows = $db->loadObjectList(); + try + { + $rows = $db->loadObjectList(); + } + catch (RuntimeException $e) + { + $rows = array(); + JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error'); + } if ($rows) { diff --git a/plugins/system/debug/debug.php b/plugins/system/debug/debug.php index 9cb0ce5942564..12b2668fedce6 100644 --- a/plugins/system/debug/debug.php +++ b/plugins/system/debug/debug.php @@ -4,7 +4,7 @@ * @subpackage System.Debug * * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE + * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; @@ -640,6 +640,11 @@ protected function displayProfileInformation() 'PLG_DEBUG_QUERIES_TIME', sprintf('%.1f ms', $totalQueryTime) ) . '
    '; + + if ($this->params->get('log-executed-sql', '0')) + { + $this->writeToFile(); + } } } @@ -1367,7 +1372,7 @@ public function mysqlDisconnectHandler(&$db) $this->totalQueries = $db->getCount(); - $dbVersion5037 = (strncmp($db->name, 'mysql', 5) == 0) && version_compare($db->getVersion(), '5.0.37', '>='); + $dbVersion5037 = (strpos($db->name, 'mysql') !== false) && version_compare($db->getVersion(), '5.0.37', '>='); if ($dbVersion5037) { @@ -1410,7 +1415,7 @@ public function mysqlDisconnectHandler(&$db) foreach ($log as $k => $query) { - $dbVersion56 = (strncmp($db->name, 'mysql', 5) == 0) && version_compare($db->getVersion(), '5.6', '>='); + $dbVersion56 = (strpos($db->name, 'mysql') !== false) && version_compare($db->getVersion(), '5.6', '>='); if ((stripos($query, 'select') === 0) || ($dbVersion56 && ((stripos($query, 'delete') === 0) || (stripos($query, 'update') === 0)))) { @@ -1766,4 +1771,56 @@ protected function displayLogs() return implode('

    ', $out); } + + /** + * Write query to the log file + * + * @return void + * + * @since 3.5 + */ + protected function writeToFile() + { + $app = JFactory::getApplication(); + $conf = JFactory::getConfig(); + $domain = str_replace(' ', '_', $conf->get('sitename', 'site')); + + if ($app->isSite()) + { + $alias = $app->getMenu()->getActive()->alias; + $id = $app->getMenu()->getActive()->id; + $file = $alias . $id . '.sql'; + $file = $app->get('log_path') . '/' . $domain . '_' . $file; + } + else + { + $input = $app->input; + $file = $input->get('option') . $input->get('view') . $input->get('layout') . '.sql'; + $file = $app->get('log_path') . '/' . $domain . '_' . $file; + } + + $current = ''; + $db = JFactory::getDbo(); + $log = $db->getLog(); + $timings = $db->getTimings(); + + foreach ($log as $id => $query) + { + if (isset($timings[$id * 2 + 1])) + { + $temp = str_replace('`', '', $log[$id]); + $temp = str_replace("\t", " ", $temp); + $temp = str_replace("\n", " ", $temp); + $current .= str_replace("\r\n", " ", $temp) . ";\n"; + } + } + + if (JFile::exists($file)) + { + JFile::delete($file); + } + + // Write new file. + JFile::write($file, $current); + } } diff --git a/plugins/system/debug/debug.xml b/plugins/system/debug/debug.xml index 49dfe5b2488ad..e73c9d84c934e 100644 --- a/plugins/system/debug/debug.xml +++ b/plugins/system/debug/debug.xml @@ -185,6 +185,16 @@ + + + + + diff --git a/plugins/system/highlight/highlight.php b/plugins/system/highlight/highlight.php index cdc464c266685..1e53b5aef34f4 100644 --- a/plugins/system/highlight/highlight.php +++ b/plugins/system/highlight/highlight.php @@ -4,10 +4,10 @@ * @subpackage System.Highlight * * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE + * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('JPATH_BASE') or die; +defined('_JEXEC') or die; /** * System plugin to highlight terms. diff --git a/plugins/system/languagecode/language/en-GB/en-GB.plg_system_languagecode.ini b/plugins/system/languagecode/language/en-GB/en-GB.plg_system_languagecode.ini index 6cc419d66caec..d5aa041c1becb 100644 --- a/plugins/system/languagecode/language/en-GB/en-GB.plg_system_languagecode.ini +++ b/plugins/system/languagecode/language/en-GB/en-GB.plg_system_languagecode.ini @@ -5,6 +5,6 @@ PLG_SYSTEM_LANGUAGECODE="System - Language Code" PLG_SYSTEM_LANGUAGECODE_FIELD_DESC="Changes the language code used for the %s language." -PLG_SYSTEM_LANGUAGECODE_FIELDSET_DESC="Changes the language code for the generated HTML document. Example of use: One has installed the fr-FR language pack and wants the Search Engines to recognise the page as aimed at French-speaking Canada. Add the tag 'fr-CA' to the corresponding field for 'fr-FR' to resolve this." +PLG_SYSTEM_LANGUAGECODE_FIELDSET_DESC="Changes the language code for the generated HTML document. Example of use: You have installed the fr-FR language pack and want the Search Engines to recognise the page as aimed at French-speaking Canada. Add the tag 'fr-CA' to the corresponding field for 'fr-FR' to resolve this." PLG_SYSTEM_LANGUAGECODE_FIELDSET_LABEL="Language codes" PLG_SYSTEM_LANGUAGECODE_XML_DESCRIPTION="Provides the ability to change the language code in the generated HTML document to improve SEO.
    The fields will appear when the plugin is enabled and saved.
    More information at W3.org." \ No newline at end of file diff --git a/plugins/system/languagefilter/languagefilter.php b/plugins/system/languagefilter/languagefilter.php index 883802c6a8a3c..a223e85207e1c 100644 --- a/plugins/system/languagefilter/languagefilter.php +++ b/plugins/system/languagefilter/languagefilter.php @@ -12,6 +12,7 @@ use Joomla\Registry\Registry; JLoader::register('MenusHelper', JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php'); +JLoader::register('MultilangstatusHelper', JPATH_ADMINISTRATOR . '/components/com_languages/helpers/multilangstatus.php'); /** * Joomla! Language Filter Plugin. @@ -26,6 +27,8 @@ class PlgSystemLanguageFilter extends JPlugin protected $lang_codes; + protected $current_lang; + protected $default_lang; private $user_lang_code; @@ -55,16 +58,19 @@ public function __construct(&$subject, $config) if ($this->app->isSite()) { // Setup language data. - $this->mode_sef = $this->app->get('sef', 0); - $this->sefs = JLanguageHelper::getLanguages('sef'); - $this->lang_codes = JLanguageHelper::getLanguages('lang_code'); + $this->mode_sef = $this->app->get('sef', 0); + $this->sefs = JLanguageHelper::getLanguages('sef'); + $this->lang_codes = JLanguageHelper::getLanguages('lang_code'); + $this->default_lang = JComponentHelper::getParams('com_languages')->get('site', 'en-GB'); $levels = JFactory::getUser()->getAuthorisedViewLevels(); foreach ($this->sefs as $sef => $language) { // @todo: In Joomla 2.5.4 and earlier access wasn't set. Non modified Content Languages got 0 as access value - if ($language->access && !in_array($language->access, $levels)) + // we also check if frontend language exists and is enabled + if (($language->access && !in_array($language->access, $levels)) + || (!array_key_exists($language->lang_code, MultilangstatusHelper::getSitelangs()))) { unset($this->lang_codes[$language->lang_code]); unset($this->sefs[$language->sef]); @@ -121,9 +127,9 @@ public function onAfterInitialise() public function onAfterRoute() { // Add custom site name. - if (isset($this->lang_codes[$this->default_lang]) && $this->lang_codes[$this->default_lang]->sitename) + if (isset($this->lang_codes[$this->current_lang]) && $this->lang_codes[$this->current_lang]->sitename) { - $this->app->set('sitename', $this->lang_codes[$this->default_lang]->sitename); + $this->app->set('sitename', $this->lang_codes[$this->current_lang]->sitename); } } @@ -139,7 +145,7 @@ public function onAfterRoute() */ public function preprocessBuildRule(&$router, &$uri) { - $lang = $uri->getVar('lang', $this->default_lang); + $lang = $uri->getVar('lang', $this->current_lang); $uri->setVar('lang', $lang); if (isset($this->sefs[$lang])) @@ -169,11 +175,13 @@ public function buildRule(&$router, &$uri) } else { - $sef = $this->lang_codes[$this->default_lang]->sef; + $sef = $this->lang_codes[$this->current_lang]->sef; } if ($this->mode_sef - && (!$this->params->get('remove_default_prefix', 0) || $lang != JComponentHelper::getParams('com_languages')->get('site', 'en-GB'))) + && (!$this->params->get('remove_default_prefix', 0) + || $lang != $this->default_lang + || $lang != $this->current_lang)) { $uri->setPath($uri->getPath() . '/' . $sef . '/'); } @@ -228,6 +236,7 @@ public function parseRule(&$router, &$uri) { // Did we find the current and existing language yet? $found = false; + $lang_code = false; // Are we in SEF mode or not? if ($this->mode_sef) @@ -241,8 +250,31 @@ public function parseRule(&$router, &$uri) // that we have in our system, its the default language and we "found" the right language if ($this->params->get('remove_default_prefix', 0) && !isset($this->sefs[$sef])) { - $found = true; - $lang_code = JComponentHelper::getParams('com_languages')->get('site', 'en-GB'); + if ($parts[0]) + { + // We load a default site language page + $lang_code = $this->default_lang; + } + else + { + // We check for an existing language cookie + $lang_code = $this->getLanguageCookie(); + } + + if (!$lang_code && $this->params->get('detect_browser', 0) == 1) + { + $lang_code = JLanguageHelper::detectLanguage(); + } + + if (!$lang_code) + { + $lang_code = $this->default_lang; + } + + if ($lang_code == $this->default_lang) + { + $found = true; + } } else { @@ -254,10 +286,14 @@ public function parseRule(&$router, &$uri) $lang_code = $this->sefs[$sef]->lang_code; } - // If we found our language, but its the default language and we don't want a prefix for that, we are on a wrong URL + // If we found our language, but its the default language and we don't want a prefix for that, we are on a wrong URL. + // Or we try to change the language back to the default language. We need a redirect to the proper URL for the default language. if ($this->params->get('remove_default_prefix', 0) - && $lang_code == JComponentHelper::getParams('com_languages')->get('site', 'en-GB')) + && $lang_code == $this->default_lang) { + // Create a cookie. + $this->setLanguageCookie($lang_code); + $found = false; array_shift($parts); $path = implode('/', $parts); @@ -271,17 +307,14 @@ public function parseRule(&$router, &$uri) } } } - else - { - // We are not in SEF mode - $lang = $uri->getVar('lang'); + // We are not in SEF mode + $lang = $uri->getVar('lang', $lang_code); - if (isset($this->sefs[$lang])) - { - // We found our language - $found = true; - $lang_code = $this->sefs[$lang]->lang_code; - } + if (isset($this->sefs[$lang])) + { + // We found our language + $found = true; + $lang_code = $this->sefs[$lang]->lang_code; } // We are called via POST. We don't care about the language @@ -291,7 +324,11 @@ public function parseRule(&$router, &$uri) || count($this->app->input->files) > 0) { $found = true; - $lang_code = $this->app->input->cookie->getString(JApplicationHelper::getHash('language')); + + if (!isset($lang_code)) + { + $lang_code = $this->getLanguageCookie(); + } if ($this->params->get('detect_browser', 1) && !$lang_code) { @@ -300,7 +337,7 @@ public function parseRule(&$router, &$uri) if (!isset($this->lang_codes[$lang_code])) { - $lang_code = JComponentHelper::getParams('com_languages')->get('site', 'en-GB'); + $lang_code = $this->default_lang; } } @@ -311,6 +348,7 @@ public function parseRule(&$router, &$uri) if (!isset($lang_code) || !isset($this->lang_codes[$lang_code])) { $lang_code = false; + if ($this->params->get('detect_browser', 1)) { $lang_code = JLanguageHelper::detectLanguage(); @@ -319,20 +357,18 @@ public function parseRule(&$router, &$uri) $lang_code = false; } } + if (!$lang_code) { - $lang_code = JComponentHelper::getParams('com_languages')->get('site', 'en-GB'); + $lang_code = $this->default_lang; } - // Either we detected the language via the browser or we got it from the cookie. In worst case - // we fall back to the application setting - $lang_code = $this->app->input->cookie->getString(JApplicationHelper::getHash('language'), $lang_code); } if ($this->mode_sef) { // Use the current language sef or the default one. if (!$this->params->get('remove_default_prefix', 0) - || $lang_code != JComponentHelper::getParams('com_languages')->get('site', 'en-GB')) + || $lang_code != $this->default_lang) { $path = $this->lang_codes[$lang_code]->sef . '/' . $path; } @@ -353,7 +389,7 @@ public function parseRule(&$router, &$uri) // We have found our language and now need to set the cookie and the language value in our system $array = array('lang' => $lang_code); - $this->default_lang = $lang_code; + $this->current_lang = $lang_code; // Set the request var. $this->app->input->set('language', $lang_code); @@ -374,11 +410,9 @@ public function parseRule(&$router, &$uri) } // Create a cookie. - if ($this->app->input->cookie->getString(JApplicationHelper::getHash('language')) != $lang_code) + if ($this->getLanguageCookie() != $lang_code) { - $cookie_domain = $this->app->get('cookie_domain'); - $cookie_path = $this->app->get('cookie_path', $uri->base(true)); - $this->app->input->cookie->set(JApplicationHelper::getHash('language'), $lang_code, $this->getLangCookieTime(), $cookie_path, $cookie_domain); + $this->setLanguageCookie($lang_code); } return $array; @@ -407,7 +441,7 @@ public function onUserBeforeSave($user, $isnew, $new) if (empty($this->user_lang_code)) { - $this->user_lang_code = $this->default_lang; + $this->user_lang_code = $this->current_lang; } } } @@ -436,7 +470,7 @@ public function onUserAfterSave($user, $isnew, $success, $msg) if (empty($lang_code)) { - $lang_code = $this->default_lang; + $lang_code = $this->current_lang; } if ($lang_code == $this->user_lang_code || !isset($this->lang_codes[$lang_code])) @@ -455,9 +489,7 @@ public function onUserAfterSave($user, $isnew, $success, $msg) ); // Create a cookie. - $cookie_domain = $this->app->get('cookie_domain', ''); - $cookie_path = $this->app->get('cookie_path', '/'); - setcookie(JApplicationHelper::getHash('language'), $lang_code, $this->getLangCookieTime(), $cookie_path, $cookie_domain); + $this->setLanguageCookie($lang_code); } } } @@ -479,52 +511,66 @@ public function onUserLogin($user, $options = array()) if ($this->app->isSite() && $this->params->get('automatic_change', 1)) { - // Load associations. $assoc = JLanguageAssociations::isEnabled(); + $lang_code = $user['language']; - if ($assoc) + // If no language is specified for this user, we set it to the site default language + if (empty($lang_code)) { - $active = $menu->getActive(); + $lang_code = $this->default_lang; + } - if ($active) + jimport('joomla.filesystem.folder'); + + // The language has been deleted/disabled or the related content language does not exist/has been unpublished + // or the related home page does not exist/has been unpublished + if (!array_key_exists($lang_code, $this->lang_codes) + || !array_key_exists($lang_code, MultilangstatusHelper::getHomepages()) + || !JFolder::exists(JPATH_SITE . '/language/' . $lang_code)) + { + $lang_code = $this->current_lang; + } + + // Try to get association from the current active menu item + $active = $menu->getActive(); + $foundAssociation = false; + + if ($active) + { + if ($assoc) { $associations = MenusHelper::getAssociations($active->id); } - } - $lang_code = $user['language']; + if (isset($associations[$lang_code]) && $menu->getItem($associations[$lang_code])) + { + $associationItemid = $associations[$lang_code]; + $this->app->setUserState('users.login.form.return', 'index.php?Itemid=' . $associationItemid); + $foundAssociation = true; + } + elseif ($active->home) + { + // We are on a Home page, we redirect to the user site language home page + $item = $menu->getDefault($lang_code); - if (empty($lang_code)) - { - $lang_code = $this->default_lang; + if ($item && $item->language != $active->language && $item->language != '*') + { + $this->app->setUserState('users.login.form.return', 'index.php?Itemid=' . $item->id); + $foundAssociation = true; + } + } } - if ($lang_code != $this->default_lang) + if ($foundAssociation && $lang_code != $this->current_lang) { // Change language. - $this->default_lang = $lang_code; + $this->current_lang = $lang_code; // Create a cookie. - $cookie_domain = $this->app->get('cookie_domain', ''); - $cookie_path = $this->app->get('cookie_path', '/'); - setcookie(JApplicationHelper::getHash('language'), $lang_code, $this->getLangCookieTime(), $cookie_path, $cookie_domain); + $this->setLanguageCookie($lang_code); // Change the language code. JFactory::getLanguage()->setLanguage($lang_code); - - // Change the redirect (language has changed). - if (isset($associations[$lang_code]) && $menu->getItem($associations[$lang_code])) - { - $itemid = $associations[$lang_code]; - $this->app->setUserState('users.login.form.return', 'index.php?&Itemid=' . $itemid); - } - else - { - JLoader::register('MultilangstatusHelper', JPATH_ADMINISTRATOR . '/components/com_languages/helpers/multilangstatus.php'); - $homes = MultilangstatusHelper::getHomepages(); - $itemid = isset($homes[$lang_code]) ? $homes[$lang_code]->id : $homes['*']->id; - $this->app->setUserState('users.login.form.return', 'index.php?&Itemid=' . $itemid); - } } } } @@ -539,125 +585,145 @@ public function onUserLogin($user, $options = array()) public function onAfterDispatch() { $doc = JFactory::getDocument(); - $menu = $this->app->getMenu(); - $server = JUri::getInstance()->toString(array('scheme', 'host', 'port')); - $option = $this->app->input->get('option'); - $eName = JString::ucfirst(JString::str_ireplace('com_', '', $option)); if ($this->app->isSite() && $this->params->get('alternate_meta') && $doc->getType() == 'html') { - // Get active menu item. + $languages = $this->lang_codes; + $homes = MultilangstatusHelper::getHomepages(); + $menu = $this->app->getMenu(); $active = $menu->getActive(); + $levels = JFactory::getUser()->getAuthorisedViewLevels(); + $remove_default_prefix = $this->params->get('remove_default_prefix', 0); + $server = JUri::getInstance()->toString(array('scheme', 'host', 'port')); + $is_home = false; - $assocs = array(); - - $home = false; - - // Load menu associations. if ($active) { $active_link = JRoute::_($active->link . '&Itemid=' . $active->id, false); - - // Get current link. $current_link = JUri::getInstance()->toString(array('path', 'query')); - // Check the exact menu item's URL. + // Load menu associations if ($active_link == $current_link) { $associations = MenusHelper::getAssociations($active->id); - unset($associations[$active->language]); - $assocs = array_keys($associations); - - // If the menu item is a home menu item and the URLs are identical, we are on the homepage - $home = true; } + + // Check if we are on the homepage + $is_home = ($active->home + && ($active_link == $current_link || $active_link == $current_link . 'index.php' || $active_link . '/' == $current_link)); } // Load component associations. - $cName = JString::ucfirst($eName . 'HelperAssociation'); + $option = $this->app->input->get('option'); + $cName = JString::ucfirst(JString::str_ireplace('com_', '', $option)) . 'HelperAssociation'; JLoader::register($cName, JPath::clean(JPATH_COMPONENT_SITE . '/helpers/association.php')); if (class_exists($cName) && is_callable(array($cName, 'getAssociations'))) { $cassociations = call_user_func(array($cName, 'getAssociations')); + } - $lang_code = $this->app->input->cookie->getString(JApplicationHelper::getHash('language')); - - // No cookie - let's try to detect browser language or use site default. - if (!$lang_code) + // For each language... + foreach ($languages as $i => &$language) + { + switch (true) { - if ($this->params->get('detect_browser', 1)) - { - $lang_code = JLanguageHelper::detectLanguage(); - } - else - { - $lang_code = $this->default_lang; - } + // Language without frontend UI || Language without specific home menu || Language without authorized access level + case (!array_key_exists($i, MultilangstatusHelper::getSitelangs())): + case (!isset($homes[$i])): + case (isset($language->access) && $language->access && !in_array($language->access, $levels)): + unset($languages[$i]); + break; + + // Home page + case ($is_home): + $language->link = JRoute::_('index.php?lang=' . $language->sef . '&Itemid=' . $homes[$i]->id); + break; + + // Current language link + case ($i == $this->current_lang): + $language->link = JUri::getInstance()->toString(array('path', 'query')); + break; + + // Component association + case (isset($cassociations[$i])): + $language->link = JRoute::_($cassociations[$i] . '&lang=' . $language->sef); + break; + + // Menu items association + // Heads up! "$item = $menu" here below is an assignment, *NOT* comparison + case (isset($associations[$i]) && ($item = $menu->getItem($associations[$i]))): + $language->link = JRoute::_($item->link . '&Itemid=' . $item->id . '&lang=' . $language->sef); + break; + + // Too bad... + default: + unset($languages[$i]); } - - unset($cassociations[$lang_code]); - $assocs = array_merge(array_keys($cassociations), $assocs); } - // Handle the default associations. - if ($this->params->get('item_associations') || ($active && $active->home && $home)) + // If there are at least 2 of them, add the rel="alternate" links to the + if (count($languages) > 1) { - $languages = JLanguageHelper::getLanguages('lang_code'); - foreach ($assocs as $language) + // Remove the sef from the default language if "Remove URL Language Code" is on + if (isset($languages[$this->default_lang]) && $remove_default_prefix) { - if (!JLanguage::exists($language)) - { - continue; - } - $lang = $languages[$language]; - - if (isset($cassociations[$language])) - { - $link = JRoute::_($cassociations[$language] . '&lang=' . $lang->sef); - - // Check if language is the default site language and remove url language code is on - if ($lang->sef == $this->lang_codes[$this->default_lang]->sef && $this->params->get('remove_default_prefix') == '1') - { - $link = preg_replace('|/' . $lang->sef . '/|', '/', $link, 1); - } - - $doc->addHeadLink($server . $link, 'alternate', 'rel', array('hreflang' => $language)); - } - elseif (isset($associations[$language])) - { - $item = $menu->getItem($associations[$language]); - - if ($item) - { - $link = JRoute::_($item->link . '&Itemid=' . $item->id . '&lang=' . $lang->sef); + $languages[$this->default_lang]->link + = preg_replace('|/' . $languages[$this->default_lang]->sef . '/|', '/', $languages[$this->default_lang]->link, 1); + } - $doc->addHeadLink($server . $link, 'alternate', 'rel', array('hreflang' => $language)); - } - } + foreach ($languages as $i => &$language) + { + $doc->addHeadLink($server . $language->link, 'alternate', 'rel', array('hreflang' => $i)); } } } } /** - * Get the language cookie settings. + * Set the language cookie + * + * @param string $lang_code The language code for which we want to set the cookie * - * @return string The cookie time. + * @return void * - * @since 3.0.4 + * @since 3.4.2 */ - private function getLangCookieTime() + private function setLanguageCookie($lang_code) { + + // Get the cookie lifetime we want. + $cookie_expire = 0; if ($this->params->get('lang_cookie', 1) == 1) { - $lang_cookie = time() + 365 * 86400; + $cookie_expire = time() + 365 * 86400; } - else + + // Create a cookie. + $cookie_domain = $this->app->get('cookie_domain'); + $cookie_path = $this->app->get('cookie_path', '/'); + $cookie_secure = $this->app->isSSLConnection(); + $this->app->input->cookie->set(JApplicationHelper::getHash('language'), $lang_code, $cookie_expire, $cookie_path, $cookie_domain, $cookie_secure); + } + + /** + * Get the language cookie + * + * @return string + * + * @since 3.4.2 + */ + private function getLanguageCookie() + { + $lang_code = $this->app->input->cookie->getString(JApplicationHelper::getHash('language')); + + // Let's be sure we got a valid language code. Fallback to null. + if (!array_key_exists($lang_code, $this->lang_codes)) { - $lang_cookie = 0; + $lang_code = null; } - return $lang_cookie; + return $lang_code; } + } diff --git a/plugins/system/logout/logout.php b/plugins/system/logout/logout.php index 7de034ef85787..ea61e6b8a3c21 100644 --- a/plugins/system/logout/logout.php +++ b/plugins/system/logout/logout.php @@ -7,7 +7,7 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('JPATH_BASE') or die; +defined('_JEXEC') or die; /** * Plugin class for logout redirect handling. diff --git a/plugins/system/redirect/redirect.php b/plugins/system/redirect/redirect.php index 927aa655c0b71..1171c625a58f4 100644 --- a/plugins/system/redirect/redirect.php +++ b/plugins/system/redirect/redirect.php @@ -18,6 +18,14 @@ */ class PlgSystemRedirect extends JPlugin { + /** + * Affects constructor behavior. If true, language files will be loaded automatically. + * + * @var boolean + * @since 3.4 + */ + protected $autoloadLanguage = false; + /** * Constructor. * @@ -50,74 +58,80 @@ public static function handleError(&$error) $app = JFactory::getApplication(); // Make sure the error is a 404 and we are not in the administrator. - if (!$app->isAdmin() and ($error->getCode() == 404)) + if ($app->isAdmin() || $error->getCode() != 404) { - // Get the full current URI. - $uri = JUri::getInstance(); - $current = rawurldecode($uri->toString(array('scheme', 'host', 'port', 'path', 'query', 'fragment'))); + // Render the error page. + JError::customErrorPage($error); + } - // Attempt to ignore idiots. - if ((strpos($current, 'mosConfig_') !== false) || (strpos($current, '=http://') !== false)) - { - // Render the error page. - JError::customErrorPage($error); - } + // Get the full current URI. + $uri = JUri::getInstance(); + $current = rawurldecode($uri->toString(array('scheme', 'host', 'port', 'path', 'query', 'fragment'))); - // See if the current url exists in the database as a redirect. - $db = JFactory::getDbo(); + // Attempt to ignore idiots. + if ((strpos($current, 'mosConfig_') !== false) || (strpos($current, '=http://') !== false)) + { + // Render the error page. + JError::customErrorPage($error); + } + + // See if the current url exists in the database as a redirect. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName(array('new_url', 'header'))) + ->select($db->quoteName('published')) + ->from($db->quoteName('#__redirect_links')) + ->where($db->quoteName('old_url') . ' = ' . $db->quote($current)); + $db->setQuery($query, 0, 1); + $link = $db->loadObject(); + + // If no published redirect was found try with the server-relative URL + if (!$link or ($link->published != 1)) + { + $currRel = rawurldecode($uri->toString(array('path', 'query', 'fragment'))); $query = $db->getQuery(true) - ->select($db->quoteName(array('new_url', 'header'))) + ->select($db->quoteName('new_url')) ->select($db->quoteName('published')) ->from($db->quoteName('#__redirect_links')) - ->where($db->quoteName('old_url') . ' = ' . $db->quote($current)); + ->where($db->quoteName('old_url') . ' = ' . $db->quote($currRel)); $db->setQuery($query, 0, 1); $link = $db->loadObject(); + } - // If no published redirect was found try with the server-relative URL - if (!$link or ($link->published != 1)) + // If a redirect exists and is published, permanently redirect. + if ($link and ($link->published == 1)) + { + // If no header is set use a 301 permanent redirect + if (!$link->header || JComponentHelper::getParams('com_redirect')->get('mode', 0) == false) { - $currRel = rawurldecode($uri->toString(array('path', 'query', 'fragment'))); - $query = $db->getQuery(true) - ->select($db->quoteName('new_url')) - ->select($db->quoteName('published')) - ->from($db->quoteName('#__redirect_links')) - ->where($db->quoteName('old_url') . ' = ' . $db->quote($currRel)); - $db->setQuery($query, 0, 1); - $link = $db->loadObject(); + $link->header = 301; } - // If a redirect exists and is published, permanently redirect. - if ($link and ($link->published == 1)) + // If we have a redirect in the 300 range use JApplicationWeb::redirect(). + if ($link->header < 400 && $link->header >= 300) { - // If no header is set use a 301 permanent redirect - if (!$link->header || JComponentHelper::getParams('com_redirect')->get('mode', 0) == false) - { - $link->header = 301; - } + $new_link = JUri::isInternal($link->new_url) ? JRoute::_($link->new_url) : $link->new_url; - // If we have a redirect in the 300 range use JApplicationWeb::redirect(). - if ($link->header < 400 && $link->header >= 300) + $app->redirect($new_link, intval($link->header)); + } + else + { + // Else rethrow the exeception with the new header and return + try { - $new_link = JUri::isInternal($link->new_url) ? JRoute::_($link->new_url) : $link->new_url; - - $app->redirect($new_link, intval($link->header)); + throw new RuntimeException($error->getMessage(), $link->header, $error); } - else + catch (Exception $e) { - // Else rethrow the exeception with the new header and return - try - { - throw new RuntimeException($error->getMessage(), $link->header, $error); - } - catch (Exception $e) - { - $newError = $e; - } - - JError::customErrorPage($newError); + $newError = $e; } + + JError::customErrorPage($newError); } - else + } + else + { + try { $referer = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER']; $query = $db->getQuery(true) @@ -167,13 +181,12 @@ public static function handleError(&$error) $db->setQuery($query); $db->execute(); } - - // Render the error page. - JError::customErrorPage($error); } - } - else - { + catch (RuntimeException $exception) + { + JError::customErrorPage(new Exception(JText::_('PLG_SYSTEM_REDIRECT_ERROR_UPDATING_DATABASE'), 404)); + } + // Render the error page. JError::customErrorPage($error); } diff --git a/plugins/system/redirect/redirect.xml b/plugins/system/redirect/redirect.xml index 1ce6df49df818..a0a3419fdad7e 100644 --- a/plugins/system/redirect/redirect.xml +++ b/plugins/system/redirect/redirect.xml @@ -8,7 +8,7 @@ admin@joomla.org www.joomla.org 3.0.0 - PLG_REDIRECT_XML_DESCRIPTION + PLG_SYSTEM_REDIRECT_XML_DESCRIPTION redirect.php diff --git a/plugins/system/sef/sef.php b/plugins/system/sef/sef.php index 1a2adf347f886..dc53654fc4ae7 100644 --- a/plugins/system/sef/sef.php +++ b/plugins/system/sef/sef.php @@ -6,6 +6,7 @@ * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ + defined('_JEXEC') or die; /** diff --git a/plugins/twofactorauth/yubikey/yubikey.php b/plugins/twofactorauth/yubikey/yubikey.php index cc9ba9744631b..6513cae6d47f1 100644 --- a/plugins/twofactorauth/yubikey/yubikey.php +++ b/plugins/twofactorauth/yubikey/yubikey.php @@ -63,8 +63,7 @@ public function __construct(&$subject, $config = array()) */ public function onUserTwofactorIdentify() { - $section = (int) $this->params->get('section', 3); - + $section = (int) $this->params->get('section', 3); $current_section = 0; try @@ -186,8 +185,7 @@ public function onUserTwofactorApplyConfiguration($method) { try { - $app = JFactory::getApplication(); - $app->enqueueMessage(JText::_('PLG_TWOFACTORAUTH_YUBIKEY_ERR_VALIDATIONFAILED'), 'error'); + JFactory::getApplication()->enqueueMessage(JText::_('PLG_TWOFACTORAUTH_YUBIKEY_ERR_VALIDATIONFAILED'), 'error'); } catch (Exception $exc) { @@ -203,8 +201,7 @@ public function onUserTwofactorApplyConfiguration($method) if (!$check) { - $app = JFactory::getApplication(); - $app->enqueueMessage(JText::_('PLG_TWOFACTORAUTH_YUBIKEY_ERR_VALIDATIONFAILED'), 'error'); + JFactory::getApplication()->enqueueMessage(JText::_('PLG_TWOFACTORAUTH_YUBIKEY_ERR_VALIDATIONFAILED'), 'error'); // Check failed. Do not change two factor authentication settings. return false; @@ -215,11 +212,11 @@ public function onUserTwofactorApplyConfiguration($method) // Check succeedeed; return an OTP configuration object $otpConfig = (object) array( - 'method' => $this->methodName, - 'config' => array( - 'yubikey' => $yubikey + 'method' => $this->methodName, + 'config' => array( + 'yubikey' => $yubikey ), - 'otep' => array() + 'otep' => array() ); return $otpConfig; @@ -261,7 +258,7 @@ public function onUserTwofactorAuthenticate($credentials, $options) // Check if the Yubikey starts with the configured Yubikey user string $yubikey_valid = $otpConfig->config['yubikey']; - $yubikey = substr($credentials['secretkey'], 0, -32); + $yubikey = substr($credentials['secretkey'], 0, -32); $check = $yubikey == $yubikey_valid; @@ -285,25 +282,26 @@ public function onUserTwofactorAuthenticate($credentials, $options) public function validateYubikeyOTP($otp) { $server_queue = array( - 'api.yubico.com', 'api2.yubico.com', 'api3.yubico.com', - 'api4.yubico.com', 'api5.yubico.com' + 'api.yubico.com', + 'api2.yubico.com', + 'api3.yubico.com', + 'api4.yubico.com', + 'api5.yubico.com', ); shuffle($server_queue); $gotResponse = false; - $check = false; - - $http = JHttpFactory::getHttp(); + $check = false; + $http = JHttpFactory::getHttp(); $token = JSession::getFormToken(); $nonce = md5($token . uniqid(rand())); while (!$gotResponse && !empty($server_queue)) { $server = array_shift($server_queue); - - $uri = new JUri('https://' . $server . '/wsapi/2.0/verify'); + $uri = new JUri('https://' . $server . '/wsapi/2.0/verify'); // I don't see where this ID is used? $uri->setVar('id', 1); @@ -350,12 +348,11 @@ public function validateYubikeyOTP($otp) // Parse response $lines = explode("\n", $response->body); - $data = array(); + $data = array(); foreach ($lines as $line) { - $line = trim($line); - + $line = trim($line); $parts = explode('=', $line, 2); if (count($parts) < 2) diff --git a/plugins/user/joomla/joomla.php b/plugins/user/joomla/joomla.php index b788d1ebda7b3..5840661810743 100644 --- a/plugins/user/joomla/joomla.php +++ b/plugins/user/joomla/joomla.php @@ -58,7 +58,14 @@ public function onUserAfterDelete($user, $success, $msg) ->delete($this->db->quoteName('#__session')) ->where($this->db->quoteName('userid') . ' = ' . (int) $user['id']); - $this->db->setQuery($query)->execute(); + try + { + $this->db->setQuery($query)->execute(); + } + catch (RuntimeException $e) + { + return false; + } return true; } @@ -215,7 +222,14 @@ public function onUserLogin($user, $options = array()) ->set($this->db->quoteName('username') . ' = ' . $this->db->quote($instance->username)) ->set($this->db->quoteName('userid') . ' = ' . (int) $instance->id) ->where($this->db->quoteName('session_id') . ' = ' . $this->db->quote($session->getId())); - $this->db->setQuery($query)->execute(); + try + { + $this->db->setQuery($query)->execute(); + } + catch (RuntimeException $e) + { + return false; + } // Hit the user last visit field $instance->setLastVisit(); @@ -263,9 +277,15 @@ public function onUserLogout($user, $options = array()) ->delete($this->db->quoteName('#__session')) ->where($this->db->quoteName('userid') . ' = ' . (int) $user['id']) ->where($this->db->quoteName('client_id') . ' = ' . (int) $options['clientid']); - $this->db->setQuery($query)->execute(); + try + { + $this->db->setQuery($query)->execute(); + } + catch (RuntimeException $e) + { + return false; + } } - return true; } diff --git a/plugins/user/profile/fields/dob.php b/plugins/user/profile/fields/dob.php index b56dd4d5c23b0..73d92bb594d47 100644 --- a/plugins/user/profile/fields/dob.php +++ b/plugins/user/profile/fields/dob.php @@ -4,7 +4,7 @@ * @subpackage User.profile * * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE + * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('JPATH_PLATFORM') or die; diff --git a/plugins/user/profile/fields/tos.php b/plugins/user/profile/fields/tos.php index c635a367cff2e..09ff72f61db90 100644 --- a/plugins/user/profile/fields/tos.php +++ b/plugins/user/profile/fields/tos.php @@ -4,7 +4,7 @@ * @subpackage User.profile * * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE + * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('JPATH_PLATFORM') or die; diff --git a/plugins/user/profile/profile.php b/plugins/user/profile/profile.php index 82394e241fdc3..546f023bc8c8d 100644 --- a/plugins/user/profile/profile.php +++ b/plugins/user/profile/profile.php @@ -7,7 +7,7 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('JPATH_BASE') or die; +defined('_JEXEC') or die; /** * An example custom profile plugin. @@ -332,9 +332,6 @@ public function onUserBeforeSave($user, $isnew, $data) { try { - // Convert website url to punycode - $data['profile']['website'] = JStringPunycode::urlToPunycode($data['profile']['website']); - $date = new JDate($data['profile']['dob']); $this->date = $date->format('Y-m-d H:i:s'); } diff --git a/templates/beez3/favicon.ico b/templates/beez3/favicon.ico index 3925be4f9ceb5..1a4d7979dcf49 100644 Binary files a/templates/beez3/favicon.ico and b/templates/beez3/favicon.ico differ diff --git a/templates/beez3/html/com_content/category/blog.php b/templates/beez3/html/com_content/category/blog.php index d8230ccc8fac7..9e11f2b20e8a2 100644 --- a/templates/beez3/html/com_content/category/blog.php +++ b/templates/beez3/html/com_content/category/blog.php @@ -21,17 +21,18 @@ // It will be a separate class if the user starts it with a space ?>
    -params->get('show_page_heading') != 0 or $this->params->get('show_category_title')) : ?> +params->get('show_page_heading') != 0) : ?>

    escape($this->params->get('page_heading')); ?> - params->get('show_category_title')) - { - echo ''.JHtml::_('content.prepare', $this->category->title, '', 'com_content.category.title').''; - } - ?>

    +params->get('show_category_title')) : ?> +

    + category->title, '', 'com_content.category.title'); ?> +

    + + params->get('show_description', 1) || $this->params->def('show_description_image', 1)) : ?>
    params->get('show_description_image') && $this->category->getParams()->get('image')) : ?> diff --git a/templates/beez3/html/com_content/category/blog_item.php b/templates/beez3/html/com_content/category/blog_item.php index 6e9760ef91261..3af17f3592e05 100644 --- a/templates/beez3/html/com_content/category/blog_item.php +++ b/templates/beez3/html/com_content/category/blog_item.php @@ -139,10 +139,8 @@ $menu = JFactory::getApplication()->getMenu(); $active = $menu->getActive(); $itemId = $active->id; - $link1 = JRoute::_('index.php?option=com_users&view=login&Itemid=' . $itemId); - $returnURL = JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid, $this->item->language)); - $link = new JUri($link1); - $link->setVar('return', base64_encode($returnURL)); + $link = new JUri(JRoute::_('index.php?option=com_users&view=login&Itemid=' . $itemId, false)); + $link->setVar('return', base64_encode(JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid, $this->item->language), false))); endif; ?>

    diff --git a/templates/beez3/html/com_content/category/default_articles.php b/templates/beez3/html/com_content/category/default_articles.php index d4305769ce942..68cb33a85cb18 100644 --- a/templates/beez3/html/com_content/category/default_articles.php +++ b/templates/beez3/html/com_content/category/default_articles.php @@ -140,12 +140,10 @@ $menu = JFactory::getApplication()->getMenu(); $active = $menu->getActive(); $itemId = $active->id; - $link = JRoute::_('index.php?option=com_users&view=login&Itemid='.$itemId); - $returnURL = JRoute::_(ContentHelperRoute::getArticleRoute($article->slug, $article->catid, $article->language)); - $fullURL = new JUri($link); - $fullURL->setVar('return', base64_encode($returnURL)); + $link = new JUri(JRoute::_('index.php?option=com_users&view=login&Itemid=' . $itemId, false)); + $link->setVar('return', base64_encode(JRoute::_(ContentHelperRoute::getArticleRoute($article->slug, $article->catid, $article->language), false))); ?> - + diff --git a/templates/beez3/html/com_content/featured/default_item.php b/templates/beez3/html/com_content/featured/default_item.php index 75f7f69d1ee68..3276e1bc0f77c 100644 --- a/templates/beez3/html/com_content/featured/default_item.php +++ b/templates/beez3/html/com_content/featured/default_item.php @@ -145,10 +145,8 @@ $menu = JFactory::getApplication()->getMenu(); $active = $menu->getActive(); $itemId = $active->id; - $link1 = JRoute::_('index.php?option=com_users&view=login&Itemid=' . $itemId); - $returnURL = JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid, $this->item->language)); - $link = new JUri($link1); - $link->setVar('return', base64_encode($returnURL)); + $link = new JUri(JRoute::_('index.php?option=com_users&view=login&Itemid=' . $itemId, false)); + $link->setVar('return', base64_encode(JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid, $this->item->language), false))); endif; ?>

    diff --git a/templates/beez3/html/com_weblinks/form/edit.php b/templates/beez3/html/com_weblinks/form/edit.php index 2fe7972741a02..624f3d0b54e7e 100644 --- a/templates/beez3/html/com_weblinks/form/edit.php +++ b/templates/beez3/html/com_weblinks/form/edit.php @@ -36,12 +36,12 @@

    diff --git a/templates/beez3/language/en-GB/en-GB.tpl_beez3.ini b/templates/beez3/language/en-GB/en-GB.tpl_beez3.ini index d52bc8ab9e050..2629583ab943b 100644 --- a/templates/beez3/language/en-GB/en-GB.tpl_beez3.ini +++ b/templates/beez3/language/en-GB/en-GB.tpl_beez3.ini @@ -1,7 +1,7 @@ ; Joomla! Project ; Copyright (C) 2005 - 2015 Open Source Matters. All rights reserved. ; 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 - No BOM +; Note : All ini files need to be saved as UTF-8 TPL_BEEZ3_ADDITIONAL_INFORMATION="Additional information" TPL_BEEZ3_ALTCLOSE="is closed" @@ -15,9 +15,9 @@ TPL_BEEZ3_FIELD_BOOTSTRAP_DESC="Create a comma separated list of any components TPL_BEEZ3_FIELD_BOOTSTRAP_LABEL="Components Requiring
    Bootstrap" TPL_BEEZ3_FIELD_DESCRIPTION_DESC="Please add your site description here." TPL_BEEZ3_FIELD_DESCRIPTION_LABEL="Site Description" -TPL_BEEZ3_FIELD_HEADER_BACKGROUND_COLOR_DESC="Choose a colour for the Background if the custom colour option is selected. If left blank the Default (#eeeeee) is used." +TPL_BEEZ3_FIELD_HEADER_BACKGROUND_COLOR_DESC="Choose a colour for the Background when Custom is selected as the Template Colour. If left blank the Default (#eeeeee) is used." TPL_BEEZ3_FIELD_HEADER_BACKGROUND_COLOR_LABEL="Background Colour" -TPL_BEEZ3_FIELD_HEADER_IMAGE_DESC="Use the selected header image when the custom colour option is selected." +TPL_BEEZ3_FIELD_HEADER_IMAGE_DESC="Use the selected header image when Custom is selected as the Template Colour" TPL_BEEZ3_FIELD_HEADER_IMAGE_LABEL="Header Image" TPL_BEEZ3_FIELD_LOGO_DESC="Please choose an image. If you do not want to display a logo, click on Clear and leave the field blank." TPL_BEEZ3_FIELD_LOGO_LABEL="Logo" diff --git a/templates/beez3/language/en-GB/en-GB.tpl_beez3.sys.ini b/templates/beez3/language/en-GB/en-GB.tpl_beez3.sys.ini index abcb2e4c52ac9..656635ca05fb6 100644 --- a/templates/beez3/language/en-GB/en-GB.tpl_beez3.sys.ini +++ b/templates/beez3/language/en-GB/en-GB.tpl_beez3.sys.ini @@ -1,7 +1,7 @@ ; Joomla! Project ; Copyright (C) 2005 - 2015 Open Source Matters. All rights reserved. ; 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 - No BOM +; Note : All ini files need to be saved as UTF-8 TPL_BEEZ3_POSITION_DEBUG="Debug" TPL_BEEZ3_POSITION_POSITION-0="Search" diff --git a/templates/protostar/css/template.css b/templates/protostar/css/template.css index 0aa31a32620f3..e7b1b8bf4ec66 100644 --- a/templates/protostar/css/template.css +++ b/templates/protostar/css/template.css @@ -6428,7 +6428,6 @@ dl.article-info dd.hits span[class*=" icon-"] { .icon-plus-2:before { content: "\5d"; } -.icon-ban-circle:before, .icon-minus-sign:before, .icon-minus-2:before { content: "\5e"; @@ -6455,6 +6454,7 @@ dl.article-info dd.hits span[class*=" icon-"] { .icon-not-ok:before { content: "\4b"; } +.icon-ban-circle:before, .icon-minus-circle:before { content: "\e216"; } @@ -6583,7 +6583,6 @@ dl.article-info dd.hits span[class*=" icon-"] { .icon-file-plus:before { content: "\29"; } -.icon-file-remove:before, .icon-file-minus:before { content: "\e017"; } @@ -7475,3 +7474,7 @@ code { font-weight: bold; padding: 1px 4px; } +body.modal-open { + overflow: hidden; + -ms-overflow-style: none; +} diff --git a/templates/protostar/error.php b/templates/protostar/error.php index 43851948a5d76..2906aa9a993d9 100644 --- a/templates/protostar/error.php +++ b/templates/protostar/error.php @@ -159,7 +159,7 @@ getBuffer('module', 'search'); ?>

    -

    +


    @@ -167,6 +167,9 @@
    error->getCode(); ?> error->getMessage(), ENT_QUOTES, 'UTF-8');?>
    + debug) : ?> + renderBacktrace(); ?> + diff --git a/templates/protostar/favicon.ico b/templates/protostar/favicon.ico index b222fdd596107..1a4d7979dcf49 100644 Binary files a/templates/protostar/favicon.ico and b/templates/protostar/favicon.ico differ diff --git a/templates/protostar/html/modules.php b/templates/protostar/html/modules.php index 4d31e014720f7..d86abed7e643b 100644 --- a/templates/protostar/html/modules.php +++ b/templates/protostar/html/modules.php @@ -55,4 +55,3 @@ function modChrome_well($module, &$params, &$attribs) echo ''; } } -?> diff --git a/templates/protostar/html/pagination.php b/templates/protostar/html/pagination.php index 7678cebf76dcd..0cd60ca566703 100644 --- a/templates/protostar/html/pagination.php +++ b/templates/protostar/html/pagination.php @@ -152,25 +152,25 @@ function pagination_item_active(&$item) // Check for "Start" item if ($item->text == JText::_('JLIB_HTML_START')) { - $display = ''; + $display = ''; } // Check for "Prev" item if ($item->text == JText::_('JPREV')) { - $display = ''; + $display = ''; } // Check for "Next" item if ($item->text == JText::_('JNEXT')) { - $display = ''; + $display = ''; } // Check for "End" item if ($item->text == JText::_('JLIB_HTML_END')) { - $display = ''; + $display = ''; } // If the display object isn't set already, just render the item with its text @@ -197,25 +197,25 @@ function pagination_item_inactive(&$item) // Check for "Start" item if ($item->text == JText::_('JLIB_HTML_START')) { - return '
  • '; + return '
  • '; } // Check for "Prev" item if ($item->text == JText::_('JPREV')) { - return '
  • '; + return '
  • '; } // Check for "Next" item if ($item->text == JText::_('JNEXT')) { - return '
  • '; + return '
  • '; } // Check for "End" item if ($item->text == JText::_('JLIB_HTML_END')) { - return '
  • '; + return '
  • '; } // Check if the item is the active page diff --git a/templates/protostar/images/logo.png b/templates/protostar/images/logo.png index 8a1a369b7176e..c2e32f4c983e1 100644 Binary files a/templates/protostar/images/logo.png and b/templates/protostar/images/logo.png differ diff --git a/templates/protostar/index.php b/templates/protostar/index.php index bfb915f31b3af..cdbc58c019069 100644 --- a/templates/protostar/index.php +++ b/templates/protostar/index.php @@ -148,7 +148,16 @@ countModules('position-1')) : ?> diff --git a/templates/protostar/language/en-GB/en-GB.tpl_protostar.ini b/templates/protostar/language/en-GB/en-GB.tpl_protostar.ini index 9a290687ed6c7..842766f06493e 100644 --- a/templates/protostar/language/en-GB/en-GB.tpl_protostar.ini +++ b/templates/protostar/language/en-GB/en-GB.tpl_protostar.ini @@ -1,7 +1,7 @@ ; Joomla! Project ; Copyright (C) 2005 - 2015 Open Source Matters. All rights reserved. ; 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 - No BOM +; Note : All ini files need to be saved as UTF-8 TPL_PROTOSTAR_XML_DESCRIPTION="Continuing the space theme (Solarflare from 1.0 and Milkyway from 1.5), Protostar is the Joomla 3 site template based on Bootstrap from Twitter and the launch of the Joomla User Interface library (JUI)." @@ -18,6 +18,6 @@ TPL_PROTOSTAR_FONT_DESC="Load a Google font for the headings (H1, H2, H3, etc)." TPL_PROTOSTAR_FONT_NAME_LABEL="Google Font Name" TPL_PROTOSTAR_FONT_NAME_DESC="Example: Open+Sans or Source+Sans+Pro." TPL_PROTOSTAR_LOGO_LABEL="Logo" -TPL_PROTOSTAR_LOGO_DESC="Upload a custom logo for the site template." +TPL_PROTOSTAR_LOGO_DESC="Select or upload a custom logo for the site template." TPL_PROTOSTAR_STATIC="Static" diff --git a/templates/protostar/language/en-GB/en-GB.tpl_protostar.sys.ini b/templates/protostar/language/en-GB/en-GB.tpl_protostar.sys.ini index ffe88f8f832d8..ebcf24e898dc3 100644 --- a/templates/protostar/language/en-GB/en-GB.tpl_protostar.sys.ini +++ b/templates/protostar/language/en-GB/en-GB.tpl_protostar.sys.ini @@ -1,7 +1,7 @@ ; Joomla! Project ; Copyright (C) 2005 - 2015 Open Source Matters. All rights reserved. ; 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 - No BOM +; Note : All ini files need to be saved as UTF-8 TPL_PROTOSTAR_POSITION_BANNER="Banner" TPL_PROTOSTAR_POSITION_DEBUG="Debug" diff --git a/templates/protostar/less/template.less b/templates/protostar/less/template.less index bfb498fd02601..56fcf25c953b5 100644 --- a/templates/protostar/less/template.less +++ b/templates/protostar/less/template.less @@ -600,3 +600,9 @@ code { font-weight:bold; padding:1px 4px; } + +/* Prevent scrolling on the parent window of a modal */ +body.modal-open { + overflow: hidden; + -ms-overflow-style: none; +} \ No newline at end of file diff --git a/tests/README.md b/tests/README.md new file mode 100644 index 0000000000000..3fabcd073a4dd --- /dev/null +++ b/tests/README.md @@ -0,0 +1,10 @@ +Testing Joomla CMS +========== + +The current folder contains the Tests for Quality Assurance of the Joomla Content Management System. The Tests are divided in 3 main subfolders: + +* unit: contains the Joomla-cms unit tests based on PHPUnit +* system: contains the Webdriver-Nearsoft based Selenium tests +* codeception: contains the new System Tests based on Codeception Testing Framework + +Find more details inside each folder. diff --git a/tests/codeception/README.md b/tests/codeception/README.md new file mode 100644 index 0000000000000..aec27b62548fb --- /dev/null +++ b/tests/codeception/README.md @@ -0,0 +1,46 @@ +Testing Joomla CMS +========== + +## System testing +This folder contains a System Tests suite based on Codeception Testing Framework. For more information see: https://docs.joomla.org/Testing_Joomla_Extensions_with_Codeception + +### Getting Joomla +The first step to execute the System tests at Joomla-CMS a Joomla website. To do it automatically you can execute the following commands: + +``` +cd tests/codeception +composer install +# The following comand uses a Joomla Framework App that downloads the latests Joomla +php cli/getjoomlacli.php +``` + +note: to execute the previous commands you will need Composer in your system. See https://docs.joomla.org/Testing_Joomla_Extensions_with_Codeception#Testing_with_Codeception. + + +### Running the tests + +Rename tests/acceptance.suite.dist.yml to tests/acceptance.suite.yml + +Modify the configuration at tests/acceptance.suite.yml to fit your server details. Find the instructions in the same file: https://github.com/joomla/joomla-cms/tests/codeception/acceptance.suite.dist.yml#L3 + +Run Selenium server (is the software that drives your Firefox browser): + +``` +# Download Selenium Server +curl -O http://selenium-release.storage.googleapis.com/2.41/selenium-server-standalone-2.41.0.jar + +# Go to the folder were you have downloaded the file and start the Selenium Server +java -Xms40m -Xmx256m -jar ./selenium-server-standalone-2.41.0.jar +``` + + +Execute the tests: + +``` +php vendor/bin/codecept build +php vendor/bin/codecept run tests/acceptance/installation/ --steps +php vendor/bin/codecept run tests/acceptance/administrator/ --steps +``` + +You can also execute the tests using runsystemtests.sh file + diff --git a/tests/codeception/cli/getjoomlacli.php b/tests/codeception/cli/getjoomlacli.php new file mode 100644 index 0000000000000..06103b9e9067b --- /dev/null +++ b/tests/codeception/cli/getjoomlacli.php @@ -0,0 +1,102 @@ +input->get('h') || $this->input->get('help')) + { + $this->out(); + $this->out('GetJoomlaCLI ' . self::VERSION); + $this->out('--------------------------------------------------------'); + $this->out('GetJoomlaCLI is a Joomla Framework simple Command Line Apllication.'); + $this->out('With GetJoomlaCLI you can easily download the latest Joomla CMS into a folder.'); + $this->out('called "testingsite".'); + $this->out(); + $this->out(' -h | --help Prints this usage information.'); + $this->out(' -folder the folder name where to create the joomla site'); + $this->out(' "testingsite" will be used if no name is provided'); + $this->out('EXAMPLE USAGE:'); + $this->out(' php -f getjoomlacli.php -h'); + $this->out(' php -f getjoomlacli.php --folder=testingsite'); + $this->out(); + } + else + { + $folder = JPATH_ROOT . '/' . $this->input->get('folder', 'testingsite'); + + if (is_dir($folder)) + { + $this->out('Removing old files in the folder...'); + Folder::delete($folder); + } + + Folder::create($folder); + + $this->out('Downloading Joomla...'); + $repository = 'https://github.com/joomla/joomla-cms.git'; + $branch = 'staging'; + + $command = "git clone -b ${branch} --single-branch --depth 1 ${repository} ${folder}"; + $this->out($command); + + $output = array(); + + exec($command, $output, $returnValue); + + if ($returnValue) + { + $this->out('Sadly we were not able to download Joomla.'); + } + else + { + $this->out('Joomla Downloaded and ready for executing the tests.'); + } + } + } +} + +define('JPATH_ROOT', realpath(dirname(__DIR__))); + +$app = new GetJoomlaCli; +$app->execute(); + diff --git a/tests/codeception/codeception.yml b/tests/codeception/codeception.yml new file mode 100644 index 0000000000000..b9a584df57336 --- /dev/null +++ b/tests/codeception/codeception.yml @@ -0,0 +1,10 @@ +actor: Tester +paths: + tests: tests + log: tests/_output + data: tests/_data + helpers: tests/_support +settings: + bootstrap: _bootstrap.php + colors: true + memory_limit: 1024M diff --git a/tests/codeception/composer.json b/tests/codeception/composer.json new file mode 100644 index 0000000000000..f8557d158b334 --- /dev/null +++ b/tests/codeception/composer.json @@ -0,0 +1,14 @@ +{ + "name" : "joomla-cms", + "description": "The Joomla Content Management System", + "license" : "GPL-2.0+", + "require" : { + "php": ">=5.3.10" + }, + "require-dev": { + "codeception/codeception": "2.0.*@dev", + "joomla/application": "~1.0", + "joomla/filesystem": "~1.0", + "joomla/di" : "~1.0" + } +} diff --git a/tests/codeception/runsystemtests.sh b/tests/codeception/runsystemtests.sh new file mode 100755 index 0000000000000..676991e1dc425 --- /dev/null +++ b/tests/codeception/runsystemtests.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +printf "\nUpdating composer\n" +composer update +printf "\nDownloading Joomla\n" +php cli/getjoomlacli.php +printf "\nPreparing Codeception\n" +php vendor/bin/codecept build +printf "\nRunning Installation test\n" +php vendor/bin/codecept run tests/acceptance/installation --steps --debug +printf "\nSetting Error Reporting to Development\n" +php vendor/bin/codecept run tests/acceptance/administrator/setDevelopmentErrorReportingCept.php --steps \ No newline at end of file diff --git a/tests/codeception/tests/_bootstrap.php b/tests/codeception/tests/_bootstrap.php new file mode 100644 index 0000000000000..243f9c85bc6da --- /dev/null +++ b/tests/codeception/tests/_bootstrap.php @@ -0,0 +1,2 @@ +config[$element]; + } +} diff --git a/tests/codeception/tests/_support/FunctionalHelper.php b/tests/codeception/tests/_support/FunctionalHelper.php new file mode 100644 index 0000000000000..22cc714277faa --- /dev/null +++ b/tests/codeception/tests/_support/FunctionalHelper.php @@ -0,0 +1,10 @@ + "#mod-login-username", + 'password' => "#mod-login-password" + ); +} diff --git a/tests/codeception/tests/acceptance/administrator/_pages/system/globalconfigurationpage.php b/tests/codeception/tests/acceptance/administrator/_pages/system/globalconfigurationpage.php new file mode 100644 index 0000000000000..d04e911e124ab --- /dev/null +++ b/tests/codeception/tests/acceptance/administrator/_pages/system/globalconfigurationpage.php @@ -0,0 +1,27 @@ + "//div[@id='jform_error_reporting_chzn']/a", + 'option: Development' => "//div[@id='jform_error_reporting_chzn']/div/ul/li[contains(text(), 'Development')]", + ); +} diff --git a/tests/codeception/tests/acceptance/administrator/_steps/loginsteps.php b/tests/codeception/tests/acceptance/administrator/_steps/loginsteps.php new file mode 100644 index 0000000000000..f53a95d930e38 --- /dev/null +++ b/tests/codeception/tests/acceptance/administrator/_steps/loginsteps.php @@ -0,0 +1,30 @@ +am('Administrator'); + $I->amOnPage(\AdministratorLoginPage::$URL); + $I->fillField(\AdministratorLoginPage::$elements['username'], $user); + $I->fillField(\AdministratorLoginPage::$elements['password'], $password); + $I->click('Log in'); + $I->waitForText('Control Panel',10,'H1'); + } +} diff --git a/tests/codeception/tests/acceptance/administrator/setDevelopmentErrorReporting.txt b/tests/codeception/tests/acceptance/administrator/setDevelopmentErrorReporting.txt new file mode 100644 index 0000000000000..fa20a942f31f5 --- /dev/null +++ b/tests/codeception/tests/acceptance/administrator/setDevelopmentErrorReporting.txt @@ -0,0 +1,12 @@ +I WANT TO SET JOOMLA ERROR REPORTING TO DEVELOPMENT + +I do administrator login('admin', 'admin') +I am on page '/administrator/index.php?option=com_config' +I wait for text 'Global Configuration',10,'.page-title' +I click 'Server' +I wait for element visible "$globalConfiguration['Error Reporting Dropdown']" +I click "$globalConfiguration['Error Reporting Dropdown']" +I click "$globalConfiguration['option: Development']" +I click 'Save' +I wait for text 'Global Configuration',10,'.page-title' +I see 'Configuration successfully saved.','#system-message-container' \ No newline at end of file diff --git a/tests/codeception/tests/acceptance/administrator/setDevelopmentErrorReportingCept.php b/tests/codeception/tests/acceptance/administrator/setDevelopmentErrorReportingCept.php new file mode 100644 index 0000000000000..edbb17f01c2e9 --- /dev/null +++ b/tests/codeception/tests/acceptance/administrator/setDevelopmentErrorReportingCept.php @@ -0,0 +1,30 @@ +wantTo('set Joomla Error Reporting to Development'); + +// The following command is using a method defined in the Step Object (see _steps/loginsteps.php) +$I->doAdministratorLogin($I->getConfiguration('Username'), $I->getConfiguration('Password')); + +$I->amOnPage('/administrator/index.php?option=com_config'); + +$globalConfiguration = \GlobalconfigurationPage::$elements; +$I->waitForText('Global Configuration',10,'.page-title'); +$I->click('Server'); +$I->waitForElementVisible($globalConfiguration['Error Reporting Dropdown']); +$I->click($globalConfiguration['Error Reporting Dropdown']); +$I->click($globalConfiguration['option: Development']); +$I->click('Save'); +$I->waitForText('Global Configuration',10,'.page-title'); +$I->see('Configuration successfully saved.','#system-message-container'); \ No newline at end of file diff --git a/tests/codeception/tests/acceptance/installation/InstallJoomla.txt b/tests/codeception/tests/acceptance/installation/InstallJoomla.txt new file mode 100644 index 0000000000000..a057dfcad0d3b --- /dev/null +++ b/tests/codeception/tests/acceptance/installation/InstallJoomla.txt @@ -0,0 +1,29 @@ +I WANT TO INSTALL JOOMLA CMS + +I expect 'no configuration.php is in the Joomla CMS folder' +I don't see file found('configuration.php', $i->get configuration 'Joomla folder')" +I am on page '/installation/index.php' +I wait for text 'Main Configuration',"10",'h3' +I click "$configurationPage['Language Selector']" +I click($configuration page[$i->get configuration 'Language')]" +I fill field 'Site Name','Joomla CMS test' +I fill field 'Description','Site for testing Joomla CMS' +I fill field('admin email',admin@mydomain.com)" +I fill field('admin username','admin')" +I fill field('admin password','admin')" +I fill field('confirm admin password','admin')" +I click "$configurationPage['No Site Offline']" +I click 'Next' +I wait for text 'Database Configuration',10,'h3' +I select option('database type', 'msqli')" +I fill field('host name','localhost')" +I fill field('username','root')" +I fill field('password','root')" +I fill field('database name','testjoomla')" +I fill field('table prefix','jos_')" +I click "$databasePage['Remove Old Database button']" +I click 'Next' +I wait for text 'Finalisation',10," 'h3' +I select option($overview page['sample data'], 'none')" +I click 'Install' +I wait for text 'Congratulations! Joomla! is now installed.',30,'h3' \ No newline at end of file diff --git a/tests/codeception/tests/acceptance/installation/InstallJoomlaCept.php b/tests/codeception/tests/acceptance/installation/InstallJoomlaCept.php new file mode 100644 index 0000000000000..88b295d48ae8d --- /dev/null +++ b/tests/codeception/tests/acceptance/installation/InstallJoomlaCept.php @@ -0,0 +1,61 @@ +wantTo('Install Joomla CMS'); +$I->expect('no configuration.php is in the Joomla CMS folder'); +$I->dontSeeFileFound('configuration.php', $I->getConfiguration('Joomla folder')); + +$I->amOnPage('/installation/index.php'); + +// I Wait for the text Main Configuration, meaning that the page is loaded +$I->waitForText('Main Configuration',10,'h3'); + +// I instantiate the Installation Configuration Page Elements: +$configurationPage = \JoomlaInstallationConfigurationPage::$elements; +$I->click($configurationPage['Language Selector']); +$I->click($configurationPage[$I->getConfiguration('Language')]); +$I->fillField('Site Name','Joomla CMS test'); +$I->fillField('Description','Site for testing Joomla CMS'); +// I get the configuration from acceptance.suite.yml (see: tests/_support/acceptancehelper.php) +$I->fillField('Admin Email',$I->getConfiguration('Admin email')); +$I->fillField('Admin Username',$I->getConfiguration('Username')); +$I->fillField('Admin Password',$I->getConfiguration('Password')); +$I->fillField('Confirm Admin Password',$I->getConfiguration('Password')); +$I->click($configurationPage['No Site Offline']); +$I->click('Next'); + +$I->wantTo('Fill the form for creating the Joomla site Database'); +$I->waitForText('Database Configuration', 10, 'h3'); +// I instance the Install Joomla Database Page +$databasePage = \JoomlaInstallationDatabasePage::$elements; +$I->selectOption($databasePage['Database Type'], $I->getConfiguration('Database Type')); +$I->fillField('Host Name',$I->getConfiguration('Database Host')); +$I->fillField('Username',$I->getConfiguration('Database User')); +$I->fillField('Password',$I->getConfiguration('Database Password')); +$I->fillField('Database Name',$I->getConfiguration('Database Name')); +$I->fillField('Table Prefix',$I->getConfiguration('Database Prefix')); +$I->click($databasePage['Remove Old Database button']); +$I->click('Next'); + +$I->wantTo('Fill the form for creating the Joomla site database'); +$I->waitForText('Finalisation', 10, 'h3'); +$overviewPage = \JoomlaInstallationOverviewPage::$elements; + +if ($I->getConfiguration('Install Sample Data')) : + $I->selectOption($overviewPage['Sample Data'], $I->getConfiguration('Sample Data')); +else : + $I->selectOption($overviewPage['Sample Data'], $overviewPage['No sample Data']); +endif; + +$I->click('Install'); + +// Wait while Joomla gets installed +$I->waitForText('Congratulations! Joomla! is now installed.',30,'h3'); diff --git a/tests/codeception/tests/acceptance/installation/_pages/joomlainstallationconfigurationpage.php b/tests/codeception/tests/acceptance/installation/_pages/joomlainstallationconfigurationpage.php new file mode 100644 index 0000000000000..63d7a1b2993bd --- /dev/null +++ b/tests/codeception/tests/acceptance/installation/_pages/joomlainstallationconfigurationpage.php @@ -0,0 +1,30 @@ + "//div[@id='jform_language_chzn']/a", + 'English (United Kingdom)' => "//li[text()='English (United Kingdom)']", + 'No Site Offline' => "//fieldset[@id='jform_site_offline']/label[2]" + ); +} diff --git a/tests/codeception/tests/acceptance/installation/_pages/joomlainstallationdatabasepage.php b/tests/codeception/tests/acceptance/installation/_pages/joomlainstallationdatabasepage.php new file mode 100644 index 0000000000000..5a2ea892529ea --- /dev/null +++ b/tests/codeception/tests/acceptance/installation/_pages/joomlainstallationdatabasepage.php @@ -0,0 +1,30 @@ + "#jform_db_type", + 'Remove Old Database button' => "//label[@for='jform_db_old1']" + ); +} + diff --git a/tests/codeception/tests/acceptance/installation/_pages/joomlainstallationoverviewpage.php b/tests/codeception/tests/acceptance/installation/_pages/joomlainstallationoverviewpage.php new file mode 100644 index 0000000000000..806623932c992 --- /dev/null +++ b/tests/codeception/tests/acceptance/installation/_pages/joomlainstallationoverviewpage.php @@ -0,0 +1,30 @@ + '#jform_sample_file', + 'No sample Data' => '#jform_sample_file0', + 'Default English (GB) Sample Data' => '#jform_sample_file3' + ); +} diff --git a/tests/codeception/tests/functional.suite.yml b/tests/codeception/tests/functional.suite.yml new file mode 100644 index 0000000000000..3b17a39dc7c53 --- /dev/null +++ b/tests/codeception/tests/functional.suite.yml @@ -0,0 +1,9 @@ +# Codeception Test Suite Configuration + +# suite for functional (integration) tests. +# emulate web requests and make application process them. +# Include one of framework modules (Symfony2, Yii2, Laravel4) to use it. + +class_name: FunctionalTester +modules: + enabled: [Filesystem, FunctionalHelper] diff --git a/tests/codeception/tests/functional/_bootstrap.php b/tests/codeception/tests/functional/_bootstrap.php new file mode 100644 index 0000000000000..8a885558065a1 --- /dev/null +++ b/tests/codeception/tests/functional/_bootstrap.php @@ -0,0 +1,2 @@ += 7) +{ + restore_exception_handler(); +} + // Register the core Joomla test classes. JLoader::registerPrefix('Test', __DIR__ . '/core'); diff --git a/tests/unit/core/case/database/mysql.php b/tests/unit/core/case/database/mysql.php index 35e45d610d391..4a01149f39a26 100644 --- a/tests/unit/core/case/database/mysql.php +++ b/tests/unit/core/case/database/mysql.php @@ -43,6 +43,11 @@ abstract class TestCaseDatabaseMysql extends TestCaseDatabase */ public static function setUpBeforeClass() { + if (PHP_MAJOR_VERSION >= 7) + { + self::markTestSkipped('ext/mysql is unsupported on PHP 7.'); + } + // First let's look to see if we have a DSN defined or in the environment variables. if (defined('JTEST_DATABASE_MYSQL_DSN') || getenv('JTEST_DATABASE_MYSQL_DSN')) { diff --git a/tests/unit/stubs/database/jos_modules.csv b/tests/unit/stubs/database/jos_modules.csv index c01cc5742d653..eb2f168454ebc 100644 --- a/tests/unit/stubs/database/jos_modules.csv +++ b/tests/unit/stubs/database/jos_modules.csv @@ -1,11 +1,11 @@ 'id','title','note','content','ordering','position','checked_out','checked_out_time','publish_up','publish_down','published','module','access','showtitle','params','client_id','language' '1','Main Menu',,,'1','position-7','0','0000-00-00 00:00:00','0000-00-00 00:00:00','0000-00-00 00:00:00','1','mod_menu','1','1','{"menutype":"mainmenu","startLevel":"0","endLevel":"0","showAllChildren":"0","tag_id":"","class_sfx":"","window_open":"","layout":"","moduleclass_sfx":"_menu","cache":"1","cache_time":"900","cachemode":"itemid"}','0','*' '2','Login',,,'1','login','0','0000-00-00 00:00:00','0000-00-00 00:00:00','0000-00-00 00:00:00','1','mod_login','1','1',,'1','*' -'3','Popular Articles',,,'3','cpanel','0','0000-00-00 00:00:00','0000-00-00 00:00:00','0000-00-00 00:00:00','1','mod_popular','3','1','{"count":"5","catid":"","user_id":"0","layout":"_:default","moduleclass_sfx":"","cache":"0","automatic_title":"1"}','1','*' -'4','Recently Added Articles',,,'4','cpanel','0','0000-00-00 00:00:00','0000-00-00 00:00:00','0000-00-00 00:00:00','1','mod_latest','3','1','{"count":"5","ordering":"c_dsc","catid":"","user_id":"0","layout":"_:default","moduleclass_sfx":"","cache":"0","automatic_title":"1"}','1','*' +'3','Popular Articles',,,'3','cpanel','0','0000-00-00 00:00:00','0000-00-00 00:00:00','0000-00-00 00:00:00','1','mod_popular','3','1','{"count":"5","catid":"","user_id":"0","layout":"_:default","moduleclass_sfx":"","cache":"0"}','1','*' +'4','Recently Added Articles',,,'4','cpanel','0','0000-00-00 00:00:00','0000-00-00 00:00:00','0000-00-00 00:00:00','1','mod_latest','3','1','{"count":"5","ordering":"c_dsc","catid":"","user_id":"0","layout":"_:default","moduleclass_sfx":"","cache":"0"}','1','*' '8','Toolbar',,,'1','toolbar','0','0000-00-00 00:00:00','0000-00-00 00:00:00','0000-00-00 00:00:00','1','mod_toolbar','3','1',,'1','*' '9','Quick Icons',,,'1','icon','0','0000-00-00 00:00:00','0000-00-00 00:00:00','0000-00-00 00:00:00','1','mod_quickicon','3','1',,'1','*' -'10','Logged-in Users',,,'2','cpanel','0','0000-00-00 00:00:00','0000-00-00 00:00:00','0000-00-00 00:00:00','1','mod_logged','3','1','{"count":"5","name":"1","layout":"_:default","moduleclass_sfx":"","cache":"0","automatic_title":"1"}','1','*' +'10','Logged-in Users',,,'2','cpanel','0','0000-00-00 00:00:00','0000-00-00 00:00:00','0000-00-00 00:00:00','1','mod_logged','3','1','{"count":"5","name":"1","layout":"_:default","moduleclass_sfx":"","cache":"0"}','1','*' '12','Admin Menu',,,'1','menu','0','0000-00-00 00:00:00','0000-00-00 00:00:00','0000-00-00 00:00:00','1','mod_menu','3','1','{"layout":"","moduleclass_sfx":"","shownew":"1","showhelp":"1","cache":"0"}','1','*' '13','Admin Submenu',,,'1','submenu','0','0000-00-00 00:00:00','0000-00-00 00:00:00','0000-00-00 00:00:00','1','mod_submenu','3','1',,'1','*' '14','User Status',,,'2','status','0','0000-00-00 00:00:00','0000-00-00 00:00:00','0000-00-00 00:00:00','1','mod_status','3','1',,'1','*' diff --git a/tests/unit/suites/database/driver/pdomysql/JDatabaseExporterPdomysqlTest.php b/tests/unit/suites/database/driver/pdomysql/JDatabaseExporterPdomysqlTest.php index 3ece98752b794..931999769447b 100644 --- a/tests/unit/suites/database/driver/pdomysql/JDatabaseExporterPdomysqlTest.php +++ b/tests/unit/suites/database/driver/pdomysql/JDatabaseExporterPdomysqlTest.php @@ -496,6 +496,11 @@ public function testGetGenericTableName() */ public function testSetDboWithBadInput() { + if (PHP_MAJOR_VERSION >= 7) + { + $this->markTestSkipped('A fatal error is thrown on PHP 7 due to the typehinting of the method.'); + } + $instance = new JDatabaseExporterPdomysql; try diff --git a/tests/unit/suites/database/driver/pdomysql/JDatabaseImporterPdomysqlTest.php b/tests/unit/suites/database/driver/pdomysql/JDatabaseImporterPdomysqlTest.php index 3923e45d1ef7f..c3ec148947f4c 100644 --- a/tests/unit/suites/database/driver/pdomysql/JDatabaseImporterPdomysqlTest.php +++ b/tests/unit/suites/database/driver/pdomysql/JDatabaseImporterPdomysqlTest.php @@ -773,6 +773,11 @@ public function testGetRealTableName() */ public function testSetDboWithBadInput() { + if (PHP_MAJOR_VERSION >= 7) + { + $this->markTestSkipped('A fatal error is thrown on PHP 7 due to the typehinting of the method.'); + } + $instance = new JDatabaseImporterPdomysql; try diff --git a/tests/unit/suites/libraries/cms/component/JComponentHelperTest.php b/tests/unit/suites/libraries/cms/component/JComponentHelperTest.php index fe5878a76f880..a559beb353ed2 100644 --- a/tests/unit/suites/libraries/cms/component/JComponentHelperTest.php +++ b/tests/unit/suites/libraries/cms/component/JComponentHelperTest.php @@ -38,16 +38,49 @@ protected function getDataSet() * @return void * * @since 3.2 + * @covers JComponentHelper::getComponent */ public function testGetComponent() { $component = JComponentHelper::getComponent('com_content'); - $this->assertEquals( - $component->id, - 22, - 'com_content is extension ID 22' - ); + $this->assertEquals(22, $component->id, 'com_content is extension ID 22'); + $this->assertInstanceOf('JRegistry', $component->params, 'Parameters need to be of type JRegistry'); + $this->assertEquals('1', $component->params->get('show_title'), 'The show_title parameter of com_content should be set to 1'); + $this->assertObjectHasAttribute('enabled', $component, 'The component data needs to have an enabled field'); + $this->assertSame($component, JComponentHelper::getComponent('com_content'), 'The object returned must always be the same'); + } + + /** + * Test JComponentHelper::getComponent + * + * @return void + * + * @since 3.4 + * @covers JComponentHelper::getComponent + */ + public function testGetComponent_falseComponent() + { + $component = JComponentHelper::getComponent('com_false'); + $this->assertObjectNotHasAttribute('id', $component, 'Anonymous component does not have an ID'); + $this->assertInstanceOf('JRegistry', $component->params, 'Parameters need to be of type JRegistry'); + $this->assertEquals(0, $component->params->count(), 'Anonymous component does not have any set parameters'); + $this->assertObjectHasAttribute('enabled', $component, 'The component data needs to have an enabled field'); + $this->assertTrue($component->enabled, 'The anonymous component has to be enabled by default if not strict'); + } + + /** + * Test JComponentHelper::getComponent + * + * @return void + * + * @since 3.4 + * @covers JComponentHelper::getComponent + */ + public function testGetComponent_falseComponent_strict() + { + $component = JComponentHelper::getComponent('com_false', true); + $this->assertFalse($component->enabled, 'The anonymous component has to be disabled by default if strict'); } /** @@ -56,6 +89,7 @@ public function testGetComponent() * @return void * * @since 3.2 + * @covers JComponentHelper::isEnabled */ public function testIsEnabled() { @@ -71,6 +105,7 @@ public function testIsEnabled() * @return void * * @since 3.4 + * @covers JComponentHelper::isInstalled */ public function testIsInstalled() { @@ -89,6 +124,7 @@ public function testIsInstalled() * Test JComponentHelper::getParams * * @return void + * @covers JComponentHelper::getParams */ public function testGetParams() { diff --git a/tests/unit/suites/libraries/cms/error/JErrorPageTest.php b/tests/unit/suites/libraries/cms/error/JErrorPageTest.php new file mode 100644 index 0000000000000..55582676d2709 --- /dev/null +++ b/tests/unit/suites/libraries/cms/error/JErrorPageTest.php @@ -0,0 +1,55 @@ +saveFactoryState(); + + JFactory::$application = $this->getMockCmsApp(); + } + + /** + * Tears down the fixture, for example, closes a network connection. + * This method is called after a test is executed. + */ + protected function tearDown() + { + $this->restoreFactoryState(); + + parent::tearDown(); + } + + /** + * @covers JErrorPage::render + */ + public function testEnsureTheErrorPageIsCorrectlyRendered() + { + // Create an Exception to inject into the method + $exception = new RuntimeException('Testing JErrorPage::render()', 500); + + // The render method echoes the output, so catch it in a buffer + ob_start(); + JErrorPage::render($exception); + $output = ob_get_clean(); + + // Validate the element was set correctly + $this->assertContains('<title>500 - Testing JErrorPage::render()', $output); + } +} diff --git a/tests/unit/suites/libraries/cms/form/rule/JFormRuleNotequalsTest.php b/tests/unit/suites/libraries/cms/form/rule/JFormRuleNotequalsTest.php new file mode 100644 index 0000000000000..5338eb6aeec74 --- /dev/null +++ b/tests/unit/suites/libraries/cms/form/rule/JFormRuleNotequalsTest.php @@ -0,0 +1,76 @@ +'); + $input = new Joomla\Registry\Registry; + $input->set('notequalsfield', 'testvalue'); + + $this->assertTrue($rule->test($xml->field, 'test', null, $input)); + + $this->assertFalse($rule->test($xml->field, 'testvalue', null, $input)); + } + + /** + * Test the JFormRuleNotequals::test method with UnexpectedValueException + * + * @return void + * + * @covers JFormRuleNotequals::test + * @expectedException UnexpectedValueException + * @since 3.4 + */ + public function testNotequalsUnexpectedValueException() + { + $rule = new JFormRuleNotequals; + $xml = simplexml_load_string('
    '); + $input = new Joomla\Registry\Registry; + $input->set('notequalsfield', 'testvalue'); + + $rule->test($xml, 'test', null, $input); + } + + /** + * Test the JFormRuleNotequals::test method with InvalidArgumentException + * + * @return void + * + * @covers JFormRuleNotequals::test + * @expectedException InvalidArgumentException + * @since 3.4 + */ + public function testNotequalsInvalidArgumentException() + { + $rule = new JFormRuleNotequals; + $xml = simplexml_load_string('
    '); + $input = new Joomla\Registry\Registry; + $input->set('notequalsfield', 'testvalue'); + + $rule->test($xml->field, 'test'); + } +} diff --git a/tests/unit/suites/libraries/cms/help/JHelpTest.php b/tests/unit/suites/libraries/cms/help/JHelpTest.php index 8d066aefef129..f3913a93f2a51 100644 --- a/tests/unit/suites/libraries/cms/help/JHelpTest.php +++ b/tests/unit/suites/libraries/cms/help/JHelpTest.php @@ -73,46 +73,52 @@ protected function tearDown() * * @return void * + * @covers JHelp::createURL * @since 3.0 */ - public function testCreateURL_com_content() + public function testCreateURL() { - $this->assertThat( - JHelp::createURL('JHELP_CONTENT_ARTICLE_MANAGER', false, null, 'com_content'), - $this->equalTo('help/en-GB/Content_Article_Manager.html'), + $this->assertEquals( + 'help/en-GB/Content_Article_Manager.html', + JHelp::createURL('JHELP_CONTENT_ARTICLE_MANAGER'), 'Creates a local help URL for com_content Article Manager.' ); - } - /** - * Tests the createSiteList method with no XML file passed in the params - * - * @return void - * - * @since 3.0 - */ - public function testCreateSiteList_noXML() - { - $this->assertThat( - JHelp::createSiteList(null), - $this->isType('array'), - 'Returns the default help site list' + $this->assertEquals( + 'components/com_content/help/en-GB/Content_Article_Manager.html', + JHelp::createURL('JHELP_CONTENT_ARTICLE_MANAGER', true, null, 'com_content'), + 'Creates a local help URL for com_content Article Manager in the component.' + ); + + $this->assertEquals( + 'http://domain.tld/help', + JHelp::createURL('JHELP_CONTENT_ARTICLE_MANAGER', true, 'http://domain.tld/help', 'com_content'), + 'Creates a remote help URL via an override for com_content Article Manager.' + ); + + $this->assertEquals( + 'help/en-GB/Content_Article_Manager.html', + JHelp::createURL('JHELP_CONTENT_ARTICLE_MANAGER', false, null, 'com_content'), + 'Creates a local help URL for com_content Article Manager.' ); } /** - * Tests the createSiteList method with an XML file passed in the params + * Tests the createSiteList method * * @return void * + * @covers JHelp::createSiteList * @since 3.0 */ - public function testCreateSiteList_withXML() + public function testCreateSiteList() { - $this->assertThat( - JHelp::createSiteList(JPATH_ADMINISTRATOR . '/help/helpsites.xml'), - $this->isType('array'), - 'Returns the help site list defined in the XML file' + $helpsite = array( + 'text' => 'English (GB) help.joomla.org', + 'value' => 'http://help.joomla.org' ); + $this->assertEquals(array($helpsite), JHelp::createSiteList(null), 'Returns the default help site list'); + + $this->assertInternalType('array', JHelp::createSiteList(JPATH_ADMINISTRATOR . '/help/helpsites.xml'), 'Returns the help site list defined in the XML file'); } } diff --git a/tests/unit/suites/libraries/cms/html/TestHelpers/JHtmlSelect-helper-dataset.php b/tests/unit/suites/libraries/cms/html/TestHelpers/JHtmlSelect-helper-dataset.php index 3d51c14ce3d3e..3664c239f8a4a 100644 --- a/tests/unit/suites/libraries/cms/html/TestHelpers/JHtmlSelect-helper-dataset.php +++ b/tests/unit/suites/libraries/cms/html/TestHelpers/JHtmlSelect-helper-dataset.php @@ -16,7 +16,7 @@ */ class JHtmlSelectTest_DataSet { - static public $genericTest = array( + public static $genericTest = array( // @todo remove: array($expected, $data, $name, $attribs = null, $optKey = 'value', $optText = 'text', // $selected = null, $idtag = false, $translate = false) array( @@ -72,7 +72,7 @@ class JHtmlSelectTest_DataSet ), ); - static public $radioTest = array( + public static $radioTest = array( // @todo remove: array($expected, $data, $name, $attribs = null, $optKey = 'value', $optText = 'text', $selected = null, $idtag = false, // $translate = false) array( @@ -141,7 +141,7 @@ class JHtmlSelectTest_DataSet ), ); - static public $optionsTest = array( + public static $optionsTest = array( // @todo remove: array($expected, $arr, $optKey = 'value', $optText = 'text', $selected = null, $translate = false) array( "\n", @@ -209,7 +209,7 @@ class JHtmlSelectTest_DataSet ), ); - static public $optionTest = array( + public static $optionTest = array( // @todo remove: array($expected, $value, $text = '', $optKey = 'value', $optText = 'text', $disable = false) array( array( diff --git a/tests/unit/suites/libraries/cms/installer/JInstallerTest.php b/tests/unit/suites/libraries/cms/installer/JInstallerTest.php index f77768cb81a75..bc84a9743b5f2 100644 --- a/tests/unit/suites/libraries/cms/installer/JInstallerTest.php +++ b/tests/unit/suites/libraries/cms/installer/JInstallerTest.php @@ -31,22 +31,7 @@ protected function setUp() { parent::setUp(); - $this->saveFactoryState(); - - $this->object = JInstaller::getInstance(); - } - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - * - * @return void - */ - protected function tearDown() - { - $this->restoreFactoryState(); - - parent::tearDown(); + $this->object = new JInstaller; } /** @@ -72,10 +57,16 @@ protected function getDataSet() */ public function testGetInstance() { - $this->assertThat( - $this->object = JInstaller::getInstance(), - $this->isInstanceOf('JInstaller'), - 'JInstaller::getInstance failed' + $object1 = JInstaller::getInstance(); + + $this->assertInstanceOf( + 'JInstaller', + $object1 + ); + + $this->assertSame( + $object1, + JInstaller::getInstance() ); } @@ -91,21 +82,18 @@ public function testIsAndSetOverwrite() { $this->object->setOverwrite(false); - $this->assertThat( + $this->assertFalse( $this->object->isOverwrite(), - $this->equalTo(false), 'Get or Set overwrite failed' ); - $this->assertThat( + $this->assertFalse( $this->object->setOverwrite(true), - $this->equalTo(false), 'setOverwrite did not return the old value properly.' ); - $this->assertThat( + $this->assertTrue( $this->object->isOverwrite(), - $this->equalTo(true), 'getOverwrite did not return the expected value.' ); } @@ -122,9 +110,9 @@ public function testGetAndSetRedirectUrl() { $this->object->setRedirectUrl('http://www.example.com'); - $this->assertThat( + $this->assertEquals( $this->object->getRedirectUrl(), - $this->equalTo('http://www.example.com'), + 'http://www.example.com', 'Get or Set Redirect Url failed' ); } @@ -141,21 +129,18 @@ public function testIsAndSetUpgrade() { $this->object->setUpgrade(false); - $this->assertThat( + $this->assertFalse( $this->object->isUpgrade(), - $this->equalTo(false), 'Get or Set Upgrade failed' ); - $this->assertThat( + $this->assertFalse( $this->object->setUpgrade(true), - $this->equalTo(false), 'setUpgrade did not return the old value properly.' ); - $this->assertThat( + $this->assertTrue( $this->object->isUpgrade(), - $this->equalTo(true), 'getUpgrade did not return the expected value.' ); } @@ -169,17 +154,17 @@ public function testIsAndSetUpgrade() */ public function testGetPath() { - $this->assertThat( + $this->assertEquals( $this->object->getPath('path1_getpath', 'default_value'), - $this->equalTo('default_value'), + 'default_value', 'getPath did not return the default value for an undefined path' ); $this->object->setPath('path2_getpath', JPATH_BASE . '/required_path'); - $this->assertThat( + $this->assertEquals( $this->object->getPath('path2_getpath', 'default_value'), - $this->equalTo(JPATH_BASE . '/required_path'), + JPATH_BASE . '/required_path', 'getPath did not return the previously set value for the path' ); } @@ -195,9 +180,8 @@ public function testAbortQuery() { $this->object->pushStep(array('type' => 'query')); - $this->assertThat( - $this->object->abort(), - $this->isFalse() + $this->assertFalse( + $this->object->abort() ); } @@ -221,9 +205,8 @@ public function testAbortDefault() $this->object->pushStep(array('type' => 'testtype')); - $this->assertThat( - $this->object->abort(null, 'testadapter'), - $this->isTrue() + $this->assertTrue( + $this->object->abort(null, 'testadapter') ); } @@ -238,9 +221,38 @@ public function testAbortBadType() { $this->object->pushStep(array('type' => 'badstep')); - $this->assertThat( - $this->object->abort(null, false), - $this->isFalse() + $this->assertFalse( + $this->object->abort(null, false) + ); + } + + /** + * @testdox Ensure parseLanguages() returns 0 when there are no children in the language tag + * + * @covers JInstaller::parseLanguages + */ + public function testParseLanguagesWithNoChildren() + { + $emptyXml = new SimpleXMLElement(''); + + $this->assertEquals( + 0, + $this->object->parseLanguages($emptyXml) + ); + } + + /** + * @testdox Ensure parseFiles() returns 0 when there are no children in the files tag + * + * @covers JInstaller::parseFiles + */ + public function testParseFilesWithNoChildren() + { + $emptyXml = new SimpleXMLElement(''); + + $this->assertEquals( + 0, + $this->object->parseFiles($emptyXml) ); } @@ -256,16 +268,16 @@ public function testParseXMLInstallFile() $xml = JInstaller::parseXMLInstallFile(__DIR__ . '/data/pkg_joomla.xml'); // Verify the method returns an array of data - $this->assertThat( + $this->assertInternalType( + 'array', $xml, - $this->isType('array'), 'Ensure JInstaller::parseXMLInstallFile returns an array' ); // Verify the version string in the $xml object matches that from the XML file - $this->assertThat( + $this->assertEquals( $xml['version'], - $this->equalTo('2.5.0'), + '2.5.0', 'The version string should be 2.5.0 as specified in the parsed XML file' ); } @@ -279,9 +291,9 @@ public function testParseXMLInstallFile() */ public function testIsManifest() { - $this->assertThat( + $this->assertInstanceOf( + 'SimpleXmlElement', $this->object->isManifest(__DIR__ . '/data/pkg_joomla.xml'), - $this->isInstanceOf('SimpleXmlElement'), 'Ensure JInstaller::isManifest properly tests a valid manifest file' ); } diff --git a/tests/unit/suites/libraries/cms/module/JModuleHelperTest.php b/tests/unit/suites/libraries/cms/module/JModuleHelperTest.php index 9fd697aec709a..d24dd1d114c1b 100644 --- a/tests/unit/suites/libraries/cms/module/JModuleHelperTest.php +++ b/tests/unit/suites/libraries/cms/module/JModuleHelperTest.php @@ -83,6 +83,36 @@ public function testGetModule() '63', 'mod_search is module ID 63' ); + + $module = JModuleHelper::getModule('false'); + + $this->assertEquals( + $module, + null, + 'There should be no module named false' + ); + + $module = JModuleHelper::getModule('mod_false'); + + $this->assertInternalType('object', $module, 'No object was returned'); + + $this->assertEquals( + $module->id, + 0, + 'The anonymous module should have no id' + ); + + $this->assertEquals( + $module->title, + '', + 'The anonymous module should not have a title' + ); + + $this->assertEquals( + $module->module, + 'mod_false', + 'The anonymous module should have the given name' + ); } /** diff --git a/tests/unit/suites/libraries/cms/pagination/JPaginationTest.php b/tests/unit/suites/libraries/cms/pagination/JPaginationTest.php index 52c7074ef2f4c..9fa44a8cb3db8 100644 --- a/tests/unit/suites/libraries/cms/pagination/JPaginationTest.php +++ b/tests/unit/suites/libraries/cms/pagination/JPaginationTest.php @@ -335,46 +335,22 @@ public function testGetData($total, $limitstart, $limit, $active, $expected) $object = $pagination->getData(); // Test the view all Object - $this->assertEquals($object->all->text, $expected["0"]["text"], 'This is not the expected view all text'); - $this->assertEquals($object->all->base, $expected["0"]["base"], 'This is not the expected view all base value'); - $this->assertEquals($object->all->link, $expected["0"]["link"], 'This is not the expected view all link value'); - $this->assertEquals($object->all->prefix, $expected["0"]["prefix"], 'This is not the expected view all prefix value'); - $this->assertEquals($object->all->active, $expected["0"]["active"], 'This is not the expected view all active value'); + $this->assertEquals((array) $object->all, $expected["0"], 'This is not the expected view all'); // Test the start Object - $this->assertEquals($object->start->text, $expected["1"]["text"], 'This is not the expected start text'); - $this->assertEquals($object->start->base, $expected["1"]["base"], 'This is not the expected start base value'); - $this->assertEquals($object->start->link, $expected["1"]["link"], 'This is not the expected start link value'); - $this->assertEquals($object->start->prefix, $expected["1"]["prefix"], 'This is not the expected start prefix value'); - $this->assertEquals($object->start->active, $expected["1"]["active"], 'This is not the expected start active value'); + $this->assertEquals((array) $object->start, $expected["1"], 'This is not the expected start'); // Test the previous Object - $this->assertEquals($object->previous->text, $expected["2"]["text"], 'This is not the expected previous text'); - $this->assertEquals($object->previous->base, $expected["2"]["base"], 'This is not the expected previous base value'); - $this->assertEquals($object->previous->link, $expected["2"]["link"], 'This is not the expected previous link value'); - $this->assertEquals($object->previous->prefix, $expected["2"]["prefix"], 'This is not the expected previous prefix value'); - $this->assertEquals($object->previous->active, $expected["2"]["active"], 'This is not the expected previous active value'); + $this->assertEquals((array) $object->previous, $expected["2"], 'This is not the expected previous'); // Test the next Object - $this->assertEquals($object->next->text, $expected["3"]["text"], 'This is not the expected next text'); - $this->assertEquals($object->next->base, $expected["3"]["base"], 'This is not the expected next base value'); - $this->assertEquals($object->next->link, $expected["3"]["link"], 'This is not the expected next link value'); - $this->assertEquals($object->next->prefix, $expected["3"]["prefix"], 'This is not the expected next prefix value'); - $this->assertEquals($object->next->active, $expected["3"]["active"], 'This is not the expected next active value'); + $this->assertEquals((array) $object->next, $expected["3"], 'This is not the expected next'); // Test the end Object - $this->assertEquals($object->end->text, $expected["4"]["text"], 'This is not the expected end text'); - $this->assertEquals($object->end->base, $expected["4"]["base"], 'This is not the expected end base value'); - $this->assertEquals($object->end->link, $expected["4"]["link"], 'This is not the expected end link value'); - $this->assertEquals($object->end->prefix, $expected["4"]["prefix"], 'This is not the expected end prefix value'); - $this->assertEquals($object->end->active, $expected["4"]["active"], 'This is not the expected end active value'); + $this->assertEquals((array) $object->end, $expected["4"], 'This is not the expected end'); // Test the active object - $this->assertEquals($object->pages[$active]->text, $expected["5"]["text"], 'This is not the expected active text'); - $this->assertEquals($object->pages[$active]->base, $expected["5"]["base"], 'This is not the expected active base value'); - $this->assertEquals($object->pages[$active]->link, $expected["5"]["link"], 'This is not the expected active link value'); - $this->assertEquals($object->pages[$active]->prefix, $expected["5"]["prefix"], 'This is not the expected active prefix value'); - $this->assertEquals($object->pages[$active]->active, $expected["5"]["active"], 'This is not the expected active active value'); + $this->assertEquals((array) $object->pages[$active], $expected["5"], 'This is not the expected active'); unset($pagination); } @@ -553,8 +529,8 @@ public function testGetLimitBox($total, $limitstart, $limit, $admin, $expected) public function dataTestOrderUpIcon() { return array( - array(0, '', true, 'orderup', 'JLIB_HTML_MOVE_UP', true, 'cb'), - array(2, '', true, 'orderup', 'JLIB_HTML_MOVE_UP', true, 'cb'), + array(0, '', true, 'orderup', 'JLIB_HTML_MOVE_UP', true, 'cb'), + array(2, '', true, 'orderup', 'JLIB_HTML_MOVE_UP', true, 'cb'), array(2, ' ', false, 'orderup', 'JLIB_HTML_MOVE_UP', true, 'cb'), ); } @@ -594,8 +570,8 @@ public function testOrderUpIcon($i, $expected, $condition = true, $task = 'order public function dataTestOrderDownIcon() { return array( - array(0, 100, '', true, 'orderup', 'JLIB_HTML_MOVE_DOWN', true, 'cb'), - array(2, 100, '', true, 'orderup', 'JLIB_HTML_MOVE_DOWN', true, 'cb'), + array(0, 100, '', true, 'orderup', 'JLIB_HTML_MOVE_DOWN', true, 'cb'), + array(2, 100, '', true, 'orderup', 'JLIB_HTML_MOVE_DOWN', true, 'cb'), array(2, 100, ' ', false, 'orderup', 'JLIB_HTML_MOVE_DOWN', true, 'cb'), ); } @@ -690,11 +666,9 @@ public function testListRender($list, $total, $limitstart, $limit ,$expected) public function dataTestItemActive() { return array( - array( - 'JLIB_HTML_START', 100, 40, 20, false, 'JLIB_HTML_START', - 'JLIB_HTML_VIEW_ALL', 100, 40, 20, false, 'JLIB_HTML_VIEW_ALL', - 'JLIB_HTML_START', 100, 40, 20, false, 'JLIB_HTML_START', - ), + array('JLIB_HTML_START', 100, 40, 20, false, 'JLIB_HTML_START'), + array('JLIB_HTML_VIEW_ALL', 100, 40, 20, false, 'JLIB_HTML_VIEW_ALL'), + array('JLIB_HTML_START', 100, 40, 20, true, 'JLIB_HTML_START') ); } @@ -740,10 +714,8 @@ public function testItemActive($text, $total, $limitstart, $limit, $admin, $expe public function dataTestItemInactive() { return array( - array( - '3', 100, 40, 20, false, '3', - '3', 100, 40, 20, true, '3', - ), + array('3', 100, 40, 20, false, '3'), + array('3', 100, 40, 20, true, '3'), ); } @@ -801,46 +773,22 @@ public function testBuildDataObject($total, $limitstart, $limit, $active, $expec $object = TestReflection::invoke($pagination, '_buildDataObject'); // Test the view all Object - $this->assertEquals($object->all->text, $expected["0"]["text"], 'This is not the expected view all text'); - $this->assertEquals($object->all->base, $expected["0"]["base"], 'This is not the expected view all base value'); - $this->assertEquals($object->all->link, $expected["0"]["link"], 'This is not the expected view all link value'); - $this->assertEquals($object->all->prefix, $expected["0"]["prefix"], 'This is not the expected view all prefix value'); - $this->assertEquals($object->all->active, $expected["0"]["active"], 'This is not the expected view all active value'); + $this->assertEquals((array) $object->all, $expected["0"], 'This is not the expected view all'); // Test the start Object - $this->assertEquals($object->start->text, $expected["1"]["text"], 'This is not the expected start text'); - $this->assertEquals($object->start->base, $expected["1"]["base"], 'This is not the expected start base value'); - $this->assertEquals($object->start->link, $expected["1"]["link"], 'This is not the expected start link value'); - $this->assertEquals($object->start->prefix, $expected["1"]["prefix"], 'This is not the expected start prefix value'); - $this->assertEquals($object->start->active, $expected["1"]["active"], 'This is not the expected start active value'); + $this->assertEquals((array) $object->start, $expected["1"], 'This is not the expected start'); // Test the previous Object - $this->assertEquals($object->previous->text, $expected["2"]["text"], 'This is not the expected previous text'); - $this->assertEquals($object->previous->base, $expected["2"]["base"], 'This is not the expected previous base value'); - $this->assertEquals($object->previous->link, $expected["2"]["link"], 'This is not the expected previous link value'); - $this->assertEquals($object->previous->prefix, $expected["2"]["prefix"], 'This is not the expected previous prefix value'); - $this->assertEquals($object->previous->active, $expected["2"]["active"], 'This is not the expected previous active value'); + $this->assertEquals((array) $object->previous, $expected["2"], 'This is not the expected previous'); // Test the next Object - $this->assertEquals($object->next->text, $expected["3"]["text"], 'This is not the expected next text'); - $this->assertEquals($object->next->base, $expected["3"]["base"], 'This is not the expected next base value'); - $this->assertEquals($object->next->link, $expected["3"]["link"], 'This is not the expected next link value'); - $this->assertEquals($object->next->prefix, $expected["3"]["prefix"], 'This is not the expected next prefix value'); - $this->assertEquals($object->next->active, $expected["3"]["active"], 'This is not the expected next active value'); + $this->assertEquals((array) $object->next, $expected["3"], 'This is not the expected next'); // Test the end Object - $this->assertEquals($object->end->text, $expected["4"]["text"], 'This is not the expected end text'); - $this->assertEquals($object->end->base, $expected["4"]["base"], 'This is not the expected end base value'); - $this->assertEquals($object->end->link, $expected["4"]["link"], 'This is not the expected end link value'); - $this->assertEquals($object->end->prefix, $expected["4"]["prefix"], 'This is not the expected end prefix value'); - $this->assertEquals($object->end->active, $expected["4"]["active"], 'This is not the expected end active value'); + $this->assertEquals((array) $object->end, $expected["4"], 'This is not the expected end'); // Test the active object - $this->assertEquals($object->pages[$active]->text, $expected["5"]["text"], 'This is not the expected active text'); - $this->assertEquals($object->pages[$active]->base, $expected["5"]["base"], 'This is not the expected active base value'); - $this->assertEquals($object->pages[$active]->link, $expected["5"]["link"], 'This is not the expected active link value'); - $this->assertEquals($object->pages[$active]->prefix, $expected["5"]["prefix"], 'This is not the expected active prefix value'); - $this->assertEquals($object->pages[$active]->active, $expected["5"]["active"], 'This is not the expected active active value'); + $this->assertEquals((array) $object->pages[$active], $expected["5"], 'This is not the expected active'); unset($pagination); } diff --git a/tests/unit/suites/libraries/cms/plugin/JPluginHelperTest.php b/tests/unit/suites/libraries/cms/plugin/JPluginHelperTest.php index 909984ddb13b9..234ed2d52c2cc 100644 --- a/tests/unit/suites/libraries/cms/plugin/JPluginHelperTest.php +++ b/tests/unit/suites/libraries/cms/plugin/JPluginHelperTest.php @@ -87,11 +87,10 @@ public function testGetLayoutPath() * @return void * * @since 3.2 + * @covers JPluginHelper::getPlugin */ public function testGetPlugin() { - $this->markTestSkipped('Test fails unless run in isolation'); - $plugin = JPluginHelper::getPlugin('content', 'loadmodule'); $this->assertEquals( @@ -100,6 +99,21 @@ public function testGetPlugin() 'plg_content_loadmodule should return loadmodule as the name' ); } + + /** + * Test JPluginHelper::getPlugin with a whole plugin group + * + * @return void + * + * @since 3.2 + * @covers JPluginHelper::getPlugin + */ + public function testGetPluginGroup() + { + $plugins = JPluginHelper::getPlugin('content'); + $this->assertInternalType('array', $plugins, 'Method should return all plugins in a group'); + $this->assertEquals(7, count($plugins), 'Method should return all plugins in a group'); + } /** * Test JPluginHelper::getPlugin @@ -110,8 +124,6 @@ public function testGetPlugin() */ public function testIsEnabled() { - $this->markTestSkipped('Test fails unless run in isolation'); - $this->assertTrue( (bool) JPluginHelper::isEnabled('content', 'loadmodule'), 'plg_content_loadmodule should be enabled' diff --git a/tests/unit/suites/libraries/joomla/data/JDataSetTest.php b/tests/unit/suites/libraries/joomla/data/JDataSetTest.php index 9161d60c788f5..983796886308f 100644 --- a/tests/unit/suites/libraries/joomla/data/JDataSetTest.php +++ b/tests/unit/suites/libraries/joomla/data/JDataSetTest.php @@ -69,6 +69,11 @@ public function test__construct_array() */ public function test__construct_scalar() { + if (PHP_MAJOR_VERSION >= 7) + { + $this->markTestSkipped('A fatal error is thrown on PHP 7 due to the typehinting of the constructor.'); + } + new JDataSet('foo'); } diff --git a/tests/unit/suites/libraries/joomla/database/JDatabaseDriverTest.php b/tests/unit/suites/libraries/joomla/database/JDatabaseDriverTest.php index 28b7239b845ae..807276e51dc1a 100644 --- a/tests/unit/suites/libraries/joomla/database/JDatabaseDriverTest.php +++ b/tests/unit/suites/libraries/joomla/database/JDatabaseDriverTest.php @@ -312,11 +312,18 @@ public function testSetQuery() */ public function testReplacePrefix() { - $this->assertThat( + $this->assertEquals( + 'SELECT * FROM &dbtest', $this->db->replacePrefix('SELECT * FROM #__dbtest'), - $this->equalTo('SELECT * FROM &dbtest'), 'replacePrefix method should return the query string with the #__ prefix replaced by the actual table prefix.' ); + + // Prefix in quoted values not replaced, see https://github.com/joomla/joomla-cms/issues/7162 + $this->assertEquals( + "SHOW TABLE STATUS LIKE '#__table'", + $this->db->replacePrefix("SHOW TABLE STATUS LIKE '#__table'"), + 'replacePrefix method should not change the #__ prefix in a quoted value.' + ); } /** diff --git a/tests/unit/suites/libraries/joomla/feed/JFeedParserTest.php b/tests/unit/suites/libraries/joomla/feed/JFeedParserTest.php index f6bf2bb428c05..1ae4d2e8f3fb2 100644 --- a/tests/unit/suites/libraries/joomla/feed/JFeedParserTest.php +++ b/tests/unit/suites/libraries/joomla/feed/JFeedParserTest.php @@ -110,6 +110,11 @@ public function testRegisterNamespace() */ public function testRegisterNamespaceWithString() { + if (PHP_MAJOR_VERSION >= 7) + { + $this->markTestSkipped('A fatal error is thrown on PHP 7 due to the typehinting of the method.'); + } + $this->_instance->registerNamespace('foo', 'bar'); } @@ -124,6 +129,11 @@ public function testRegisterNamespaceWithString() */ public function testRegisterNamespaceWithObject() { + if (PHP_MAJOR_VERSION >= 7) + { + $this->markTestSkipped('A fatal error is thrown on PHP 7 due to the typehinting of the method.'); + } + $this->_instance->registerNamespace('foo', new stdClass); } diff --git a/tests/unit/suites/libraries/joomla/form/JFormDataHelper.php b/tests/unit/suites/libraries/joomla/form/JFormDataHelper.php index ee61e226ae4c6..f1d8dda67a553 100644 --- a/tests/unit/suites/libraries/joomla/form/JFormDataHelper.php +++ b/tests/unit/suites/libraries/joomla/form/JFormDataHelper.php @@ -350,6 +350,22 @@ class JFormDataHelper '; + public static $loadReplacementDocument = '
    + + + + + + + + + +
    '; + public static $loadFieldDocument = '
    = 7) + { + $this->markTestSkipped('A fatal error is thrown on PHP 7 due to the typehinting of the method.'); + } + $form = new JFormInspector('form1'); $field = new JFormFieldInspector($form); diff --git a/tests/unit/suites/libraries/joomla/form/JFormTest.php b/tests/unit/suites/libraries/joomla/form/JFormTest.php index de9f030995bf5..d281144677db6 100644 --- a/tests/unit/suites/libraries/joomla/form/JFormTest.php +++ b/tests/unit/suites/libraries/joomla/form/JFormTest.php @@ -1412,6 +1412,35 @@ public function testLoad() 'Line:' . __LINE__ . ' Replace should leave fields in the original order.' ); } + + return $form; + } + + /** + * Test the JForm::load method for descendent field elements + * + * This method can load an XML data object, or parse an XML string. + * + * @depends testLoad + * + * @return void + */ + // @var $form JForm + public function testLoad_ReplaceDescendent(JForm $form) + { + // Check the replacement data loads ok. + $this->assertThat( + $form->load(JFormDataHelper::$loadReplacementDocument), + $this->isTrue(), + 'Line:' . __LINE__ . ' XML string should load successfully.' + ); + + // Check that replaced options are present + $this->assertThat( + count($form->getXML()->xpath('/form/fields/fields[@name="params"]/field[@name="show_title"]/option')), + $this->equalTo(3), + 'Line:' . __LINE__ . ' The show_title in the params group is supposed to have 3 descendant nodes.' + ); } /** @@ -2038,9 +2067,8 @@ public function testSetFields() { $form = new JFormInspector('form1'); - $this->assertThat( + $this->assertTrue( $form->load(JFormDataHelper::$loadDocument), - $this->isTrue(), 'Line:' . __LINE__ . ' XML string should load successfully.' ); @@ -2053,22 +2081,20 @@ public function testSetFields() // Test without replace. - $this->assertThat( + $this->assertTrue( $form->setFields($xml1->field, null, false), - $this->isTrue(), - 'Line:' . __LINE__ . ' The setFields method should return true.' + 'Line:' . __LINE__ . ' The setFields method should return true for an existing field.' ); - $this->assertThat( + $this->assertEquals( $form->getFieldAttribute('title', 'required', 'default'), - $this->equalTo('default'), - 'Line:' . __LINE__ . ' The label should contain just the field name.' + 'default', + 'Line:' . __LINE__ . ' The getFieldAttribute method should return the default value if the attribute is not set.' ); - $this->assertThat( + $this->assertNotFalse( $form->getField('ordering'), - $this->logicalNot($this->isFalse()), - 'Line:' . __LINE__ . ' The label should contain just the field name.' + 'Line:' . __LINE__ . ' The getField method does not return false when the field exists.' ); } diff --git a/tests/unit/suites/libraries/joomla/form/TestHelpers/JHtmlField-helper-dataset.php b/tests/unit/suites/libraries/joomla/form/TestHelpers/JHtmlField-helper-dataset.php index fc196738b10b3..292acaddc3f13 100644 --- a/tests/unit/suites/libraries/joomla/form/TestHelpers/JHtmlField-helper-dataset.php +++ b/tests/unit/suites/libraries/joomla/form/TestHelpers/JHtmlField-helper-dataset.php @@ -16,7 +16,7 @@ */ class JHtmlFieldTest_DataSet { - static public $setupTest = array( + public static $setupTest = array( 'NameValueIdTitleLabel' => array( array( 'name' => 'myName', diff --git a/tests/unit/suites/libraries/joomla/form/fields/JFormFieldRulesTest.php b/tests/unit/suites/libraries/joomla/form/fields/JFormFieldRulesTest.php index 8c9222b7393b3..03d1eb72f53ac 100644 --- a/tests/unit/suites/libraries/joomla/form/fields/JFormFieldRulesTest.php +++ b/tests/unit/suites/libraries/joomla/form/fields/JFormFieldRulesTest.php @@ -19,7 +19,7 @@ class JFormFieldRulesTest extends TestCaseDatabase { /** - * Sets up dependancies for the test. + * Sets up dependencies for the test. * * @return void */ diff --git a/tests/unit/suites/libraries/joomla/form/fields/TestHelpers/JHtmlFieldCheckbox-helper-dataset.php b/tests/unit/suites/libraries/joomla/form/fields/TestHelpers/JHtmlFieldCheckbox-helper-dataset.php index 0c994511ebf27..5c77709d0985a 100644 --- a/tests/unit/suites/libraries/joomla/form/fields/TestHelpers/JHtmlFieldCheckbox-helper-dataset.php +++ b/tests/unit/suites/libraries/joomla/form/fields/TestHelpers/JHtmlFieldCheckbox-helper-dataset.php @@ -16,7 +16,7 @@ */ class JHtmlFieldCheckboxTest_DataSet { - static public $getInputTest = array( + public static $getInputTest = array( 'NoValueNoChecked' => array( array( 'id' => 'myTestId', diff --git a/tests/unit/suites/libraries/joomla/form/fields/TestHelpers/JHtmlFieldEmail-helper-dataset.php b/tests/unit/suites/libraries/joomla/form/fields/TestHelpers/JHtmlFieldEmail-helper-dataset.php index a472fe7284d3f..a336949a3730a 100644 --- a/tests/unit/suites/libraries/joomla/form/fields/TestHelpers/JHtmlFieldEmail-helper-dataset.php +++ b/tests/unit/suites/libraries/joomla/form/fields/TestHelpers/JHtmlFieldEmail-helper-dataset.php @@ -16,7 +16,7 @@ */ class JHtmlFieldEmailTest_DataSet { - static public $getInputTest = array( + public static $getInputTest = array( 'NoValue' => array( array( 'id' => 'myTestId', diff --git a/tests/unit/suites/libraries/joomla/form/fields/TestHelpers/JHtmlFieldNumber-helper-dataset.php b/tests/unit/suites/libraries/joomla/form/fields/TestHelpers/JHtmlFieldNumber-helper-dataset.php index e2d4612a1d56a..38e331dbc2f28 100644 --- a/tests/unit/suites/libraries/joomla/form/fields/TestHelpers/JHtmlFieldNumber-helper-dataset.php +++ b/tests/unit/suites/libraries/joomla/form/fields/TestHelpers/JHtmlFieldNumber-helper-dataset.php @@ -16,7 +16,7 @@ */ class JHtmlFieldNumberTest_DataSet { - static public $getInputTest = array( + public static $getInputTest = array( 'NoValue' => array( array( 'id' => 'myTestId', diff --git a/tests/unit/suites/libraries/joomla/form/fields/TestHelpers/JHtmlFieldPassword-helper-dataset.php b/tests/unit/suites/libraries/joomla/form/fields/TestHelpers/JHtmlFieldPassword-helper-dataset.php index 2bd1c94563819..1108723e1bb1c 100644 --- a/tests/unit/suites/libraries/joomla/form/fields/TestHelpers/JHtmlFieldPassword-helper-dataset.php +++ b/tests/unit/suites/libraries/joomla/form/fields/TestHelpers/JHtmlFieldPassword-helper-dataset.php @@ -16,7 +16,7 @@ */ class JHtmlFieldPasswordTest_DataSet { - static public $getInputTest = array( + public static $getInputTest = array( 'NoValue' => array( array( 'id' => 'myTestId', diff --git a/tests/unit/suites/libraries/joomla/form/fields/TestHelpers/JHtmlFieldRadio-helper-dataset.php b/tests/unit/suites/libraries/joomla/form/fields/TestHelpers/JHtmlFieldRadio-helper-dataset.php index 4cdf422549721..9425c23708f4d 100644 --- a/tests/unit/suites/libraries/joomla/form/fields/TestHelpers/JHtmlFieldRadio-helper-dataset.php +++ b/tests/unit/suites/libraries/joomla/form/fields/TestHelpers/JHtmlFieldRadio-helper-dataset.php @@ -16,7 +16,7 @@ */ class JHtmlFieldRadioTest_DataSet { - static public $getInputTest = array( + public static $getInputTest = array( 'NoOptions' => array( '', array( diff --git a/tests/unit/suites/libraries/joomla/form/fields/TestHelpers/JHtmlFieldRange-helper-dataset.php b/tests/unit/suites/libraries/joomla/form/fields/TestHelpers/JHtmlFieldRange-helper-dataset.php index 2d2381c3da123..8c2d9ccaa83cd 100644 --- a/tests/unit/suites/libraries/joomla/form/fields/TestHelpers/JHtmlFieldRange-helper-dataset.php +++ b/tests/unit/suites/libraries/joomla/form/fields/TestHelpers/JHtmlFieldRange-helper-dataset.php @@ -16,7 +16,7 @@ */ class JHtmlFieldRangeTest_DataSet { - static public $getInputTest = array( + public static $getInputTest = array( 'NoValue' => array( array( 'id' => 'myTestId', diff --git a/tests/unit/suites/libraries/joomla/form/fields/TestHelpers/JHtmlFieldTel-helper-dataset.php b/tests/unit/suites/libraries/joomla/form/fields/TestHelpers/JHtmlFieldTel-helper-dataset.php index da22af6337e23..f5d947a048c90 100644 --- a/tests/unit/suites/libraries/joomla/form/fields/TestHelpers/JHtmlFieldTel-helper-dataset.php +++ b/tests/unit/suites/libraries/joomla/form/fields/TestHelpers/JHtmlFieldTel-helper-dataset.php @@ -16,7 +16,7 @@ */ class JHtmlFieldTelTest_DataSet { - static public $getInputTest = array( + public static $getInputTest = array( 'NoValue' => array( array( 'id' => 'myTestId', diff --git a/tests/unit/suites/libraries/joomla/form/fields/TestHelpers/JHtmlFieldText-helper-dataset.php b/tests/unit/suites/libraries/joomla/form/fields/TestHelpers/JHtmlFieldText-helper-dataset.php index 01b4c2375e7b6..b4b43806cb918 100644 --- a/tests/unit/suites/libraries/joomla/form/fields/TestHelpers/JHtmlFieldText-helper-dataset.php +++ b/tests/unit/suites/libraries/joomla/form/fields/TestHelpers/JHtmlFieldText-helper-dataset.php @@ -16,7 +16,7 @@ */ class JHtmlFieldTextTest_DataSet { - static public $getInputTest = array( + public static $getInputTest = array( 'NoValue' => array( array( 'id' => 'myTestId', diff --git a/tests/unit/suites/libraries/joomla/form/fields/TestHelpers/JHtmlFieldTextarea-helper-dataset.php b/tests/unit/suites/libraries/joomla/form/fields/TestHelpers/JHtmlFieldTextarea-helper-dataset.php index 7a243b61e40a7..8e08225c66efd 100644 --- a/tests/unit/suites/libraries/joomla/form/fields/TestHelpers/JHtmlFieldTextarea-helper-dataset.php +++ b/tests/unit/suites/libraries/joomla/form/fields/TestHelpers/JHtmlFieldTextarea-helper-dataset.php @@ -16,7 +16,7 @@ */ class JHtmlFieldTextareaTest_DataSet { - static public $getInputTest = array( + public static $getInputTest = array( 'NoValue' => array( array( 'id' => 'myTestId', diff --git a/tests/unit/suites/libraries/joomla/form/fields/TestHelpers/JHtmlFieldUrl-helper-dataset.php b/tests/unit/suites/libraries/joomla/form/fields/TestHelpers/JHtmlFieldUrl-helper-dataset.php index 61457f7e2c918..59fc1d82c67dc 100644 --- a/tests/unit/suites/libraries/joomla/form/fields/TestHelpers/JHtmlFieldUrl-helper-dataset.php +++ b/tests/unit/suites/libraries/joomla/form/fields/TestHelpers/JHtmlFieldUrl-helper-dataset.php @@ -16,7 +16,7 @@ */ class JHtmlFieldUrlTest_DataSet { - static public $getInputTest = array( + public static $getInputTest = array( 'NoValue' => array( array( 'id' => 'myTestId', diff --git a/tests/unit/suites/libraries/joomla/string/TestHelpers/JString-helper-dataset.php b/tests/unit/suites/libraries/joomla/string/TestHelpers/JString-helper-dataset.php index 5be30495a6466..bf12f3d0e4698 100644 --- a/tests/unit/suites/libraries/joomla/string/TestHelpers/JString-helper-dataset.php +++ b/tests/unit/suites/libraries/joomla/string/TestHelpers/JString-helper-dataset.php @@ -24,7 +24,7 @@ class JStringTest_DataSet * @var array * @since 11.3 */ - static public $increment = array( + public static $increment = array( // Note: string, style, number, expected 'First default increment' => array('title', null, 0, 'title (2)'), 'Second default increment' => array('title(2)', null, 0, 'title(3)'), @@ -42,7 +42,7 @@ class JStringTest_DataSet * @var array * @since 11.2 */ - static public $strposTests = array( + public static $strposTests = array( array('missing', 'sing', 0, 3), array('missing', 'sting', 0, false), array('missing', 'ing', 0, 4), @@ -57,7 +57,7 @@ class JStringTest_DataSet * @var array * @since 11.2 */ - static public $strrposTests = array( + public static $strrposTests = array( array('missing', 'sing', 0, 3), array('missing', 'sting', 0, false), array('missing', 'ing', 0, 4), @@ -71,7 +71,7 @@ class JStringTest_DataSet * @var array * @since 11.2 */ - static public $substrTests = array( + public static $substrTests = array( array('Mississauga', 4, false, 'issauga'), array(' объектов на карте с', 10, false, 'на карте с'), array(' объектов на карте с', 10, 5, 'на ка'), @@ -83,7 +83,7 @@ class JStringTest_DataSet * @var array * @since 11.2 */ - static public $strtolowerTests = array( + public static $strtolowerTests = array( array('Joomla! Rocks', 'joomla! rocks') ); @@ -91,7 +91,7 @@ class JStringTest_DataSet * @var array * @since 11.2 */ - static public $strtoupperTests = array( + public static $strtoupperTests = array( array('Joomla! Rocks', 'JOOMLA! ROCKS') ); @@ -99,7 +99,7 @@ class JStringTest_DataSet * @var array * @since 11.2 */ - static public $strlenTests = array( + public static $strlenTests = array( array('Joomla! Rocks', 13) ); @@ -107,7 +107,7 @@ class JStringTest_DataSet * @var array * @since 11.2 */ - static public $str_ireplaceTests = array( + public static $str_ireplaceTests = array( array('Pig', 'cow', 'the pig jumped', false, 'the cow jumped'), array('Pig', 'cow', 'the pig jumped', true, 'the cow jumped'), array('Pig', 'cow', 'the pig jumped over the cow', true, 'the cow jumped over the cow'), @@ -120,7 +120,7 @@ class JStringTest_DataSet * @var array * @since 11.2 */ - static public $str_splitTests = array( + public static $str_splitTests = array( array('string', 1, array('s', 't', 'r', 'i', 'n', 'g')), array('string', 2, array('st', 'ri', 'ng')), array('волн', 3, array('вол', 'н')), @@ -131,7 +131,7 @@ class JStringTest_DataSet * @var array * @since 11.2 */ - static public $strcasecmpTests = array( + public static $strcasecmpTests = array( array('THIS IS STRING1', 'this is string1', false, 0), array('this is string1', 'this is string2', false, -1), array('this is string2', 'this is string1', false, 1), @@ -148,7 +148,7 @@ class JStringTest_DataSet * @var array * @since 11.2 */ - static public $strcmpTests = array( + public static $strcmpTests = array( array('THIS IS STRING1', 'this is string1', false, -1), array('this is string1', 'this is string2', false, -1), array('this is string2', 'this is string1', false, 1), @@ -168,7 +168,7 @@ class JStringTest_DataSet * @var array * @since 11.2 */ - static public $strcspnTests = array( + public static $strcspnTests = array( array('subject string ', '<>', false, false, 8), array('Би шил {123} идэй {456} чадна', '}{', null, false, 7), array('Би шил {123} идэй {456} чадна', '}{', 13, 10, 5) @@ -178,7 +178,7 @@ class JStringTest_DataSet * @var array * @since 11.2 */ - static public $stristrTests = array( + public static $stristrTests = array( array('haystack', 'needle', false), array('before match, after match', 'match', 'match, after match'), array('Би шил идэй чадна', 'шил', 'шил идэй чадна') @@ -188,7 +188,7 @@ class JStringTest_DataSet * @var array * @since 11.2 */ - static public $strrevTests = array( + public static $strrevTests = array( array('abc def', 'fed cba'), array('Би шил', 'лиш иБ') ); @@ -197,7 +197,7 @@ class JStringTest_DataSet * @var array * @since 11.2 */ - static public $strspnTests = array( + public static $strspnTests = array( array('A321 Main Street', '0123456789', 1, 2, 2), array('321 Main Street', '0123456789', null, 2, 2), array('A321 Main Street', '0123456789', null, 10, 0), @@ -216,7 +216,7 @@ class JStringTest_DataSet * @var array * @since 11.2 */ - static public $substr_replaceTests = array( + public static $substr_replaceTests = array( array('321 Main Street', 'Broadway Avenue', 4, null, '321 Broadway Avenue'), array('321 Main Street', 'Broadway', 4, 4, '321 Broadway Street'), array('чадна Би шил идэй чадна', '我能吞', 6, null, 'чадна 我能吞'), @@ -229,7 +229,7 @@ class JStringTest_DataSet * @var array Elements of array($string, $charlist, $expect) * @since 11.2 */ - static public $ltrimTests = array( + public static $ltrimTests = array( array(' abc def', null, 'abc def'), array(' abc def', '', ' abc def'), array(' Би шил', null, 'Би шил'), @@ -243,7 +243,7 @@ class JStringTest_DataSet * @var array * @since 11.2 */ - static public $rtrimTests = array( + public static $rtrimTests = array( array('abc def ', null, 'abc def'), array('abc def ', '', 'abc def '), array('Би шил ', null, 'Би шил'), @@ -257,7 +257,7 @@ class JStringTest_DataSet * @var array * @since 11.2 */ - static public $trimTests = array( + public static $trimTests = array( array(' abc def ', null, 'abc def'), array(' abc def ', '', ' abc def '), array(' Би шил ', null, 'Би шил'), @@ -271,7 +271,7 @@ class JStringTest_DataSet * @var array * @since 11.2 */ - static public $ucfirstTests = array( + public static $ucfirstTests = array( array('george', null, null, 'George'), array('мога', null, null, 'Мога'), array('ψυχοφθόρα', null, null, 'Ψυχοφθόρα'), @@ -284,7 +284,7 @@ class JStringTest_DataSet * @var array * @since 11.2 */ - static public $ucwordsTests = array( + public static $ucwordsTests = array( array('george washington', 'George Washington'), array("george\r\nwashington", "George\r\nWashington"), array('мога', 'Мога'), @@ -296,7 +296,7 @@ class JStringTest_DataSet * @var array * @since 11.2 */ - static public $transcodeTests = array( + public static $transcodeTests = array( array('Åbc Öde €100', 'UTF-8', 'ISO-8859-1', "\xc5bc \xd6de EUR100"), array(array('Åbc Öde €100'), 'UTF-8', 'ISO-8859-1', null), ); @@ -305,7 +305,7 @@ class JStringTest_DataSet * @var array * @since 11.2 */ - static public $validTests = array( + public static $validTests = array( array('george Мога Ž Ψυχοφθόρα ฉันกินกระจกได้ 我能吞下玻璃而不伤身体 ', true), array("\xFF ABC", false), array("0xfffd ABC", true), diff --git a/tests/unit/suites/libraries/joomla/twitter/JTwitterUsersTest.php b/tests/unit/suites/libraries/joomla/twitter/JTwitterUsersTest.php index 929f6858dea83..e31dd41c02526 100644 --- a/tests/unit/suites/libraries/joomla/twitter/JTwitterUsersTest.php +++ b/tests/unit/suites/libraries/joomla/twitter/JTwitterUsersTest.php @@ -63,16 +63,16 @@ class JTwitterUsersTest extends TestCase * @var string Sample JSON string. * @since 12.3 */ - protected $rateLimit = '{"resources": {"users": { - "/users/lookup": {"remaining":15, "reset":"Mon Jun 25 17:20:53 +0000 2012"}, - "/users/profile_banner": {"remaining":15, "reset":"Mon Jun 25 17:20:53 +0000 2012"}, - "/users/search": {"remaining":15, "reset":"Mon Jun 25 17:20:53 +0000 2012"}, - "/users/show": {"remaining":15, "reset":"Mon Jun 25 17:20:53 +0000 2012"}, - "/users/contributees": {"remaining":15, "reset":"Mon Jun 25 17:20:53 +0000 2012"}, - "/users/contributors": {"remaining":15, "reset":"Mon Jun 25 17:20:53 +0000 2012"}, - "/users/suggestions": {"remaining":15, "reset":"Mon Jun 25 17:20:53 +0000 2012"}, - "/users/suggestions/:slug": {"remaining":15, "reset":"Mon Jun 25 17:20:53 +0000 2012"}, - "/users/suggestions/:slug/members": {"remaining":15, "reset":"Mon Jun 25 17:20:53 +0000 2012"} + protected $rateLimit = '{"resources":{"users":{ + "/users/profile_banner":{"limit":180,"remaining":180,"reset":1403602426}, + "/users/suggestions/:slug/members":{"limit":15,"remaining":15,"reset":1403602426}, + "/users/show/:id":{"limit":180,"remaining":180,"reset":1403602426}, + "/users/suggestions":{"limit":15,"remaining":15,"reset":1403602426}, + "/users/lookup":{"limit":180,"remaining":180,"reset":1403602426}, + "/users/search":{"limit":180,"remaining":180,"reset":1403602426}, + "/users/contributors":{"limit":15,"remaining":15,"reset":1403602426}, + "/users/contributees":{"limit":15,"remaining":15,"reset":1403602426}, + "/users/suggestions/:slug":{"limit":15,"remaining":15,"reset":1403602426} }}}'; /** diff --git a/tests/unit/suites/libraries/legacy/categories/JCategoriesTest.php b/tests/unit/suites/libraries/legacy/categories/JCategoriesTest.php index 7121dada4f17c..3391f92448b30 100644 --- a/tests/unit/suites/libraries/legacy/categories/JCategoriesTest.php +++ b/tests/unit/suites/libraries/legacy/categories/JCategoriesTest.php @@ -32,16 +32,29 @@ class JCategoriesTest extends TestCaseDatabase * * @since 3.2 */ - protected function setUp() + public function setUp() { + parent::setUp(); + + // Add JApplication and JLanguage dependencies + $this->saveFactoryState(); + JFactory::$language = $this->getMockLanguage(); + JFactory::$application = $this->getMockCmsApp(); } /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. + * Overrides the parent tearDown method. + * + * @return void + * + * @see PHPUnit_Framework_TestCase::tearDown() + * @since 3.2 */ protected function tearDown() { + $this->restoreFactoryState(); + + parent::tearDown(); } /** diff --git a/tests/unit/suites/libraries/legacy/controller/JControllerLegacyTest.php b/tests/unit/suites/libraries/legacy/controller/JControllerLegacyTest.php index ed8a40a9ec891..6c7b7260fa7e9 100644 --- a/tests/unit/suites/libraries/legacy/controller/JControllerLegacyTest.php +++ b/tests/unit/suites/libraries/legacy/controller/JControllerLegacyTest.php @@ -65,11 +65,9 @@ protected function tearDown() } /** - * Test JController::addModelPath + * @testdox Ensure addModelPath() adds a model path to the internal array * - * @since 11.3 - * - * @return void + * @covers JControllerLegacy::addModelPath */ public function testAddModelPath() { @@ -79,19 +77,16 @@ public function testAddModelPath() // The default path is the class file folder/forms $valid = JPATH_PLATFORM . '/joomla/form/fields'; - $this->assertThat( + $this->assertTrue( in_array($path, JModelLegacy::addIncludePath()), - $this->isTrue(), 'Line:' . __LINE__ . ' The path should be added to the JModel paths.' ); } /** - * Test JController::createFileName(). - * - * @since 11.3 + * @testdox Ensure createFileName() correctly returns the file name for a controller * - * @return void + * @covers JControllerLegacy::createFileName */ public function testCreateFileName() { @@ -125,31 +120,46 @@ public function testCreateFileName() } /** - * Test JControllerLegacy::__construct - * - * @since 11.3 + * @testdox Ensure the constructor correctly initialises the class variables * - * @return void + * @covers JControllerLegacy::__construct */ - public function test__construct() + public function testConstructer() { $controller = new TestTestController; - $this->assertThat( + $this->assertEquals( $controller->getTasks(), - $this->equalTo(array('task5', 'task1', 'task2', 'display')), + array('task5', 'task1', 'task2', 'display'), 'The available tasks should be the public tasks in _all_ the derived classes after controller plus "display".' ); } /** - * Test JControllerLegacy::addPath(). + * @testdox Ensure the constructor correctly sets the name of the controller when injected via the config * - * Note that addPath call JPath::check which will exit if the path is out of bounds. - * If execution halts for some reason, a bad path could be the culprit. - * - * @since 11.3 + * @covers JControllerLegacy::__construct + */ + public function testConstructerWithInjectedName() + { + $name = 'foobar'; + $config = array( + 'name' => $name + ); + + $controller = new TestTestController($config); + + $this->assertEquals( + TestReflection::getValue($controller, 'name'), + $name + ); + } + + /** + * @testdox Ensure the addPath() correctly adds a path * - * @return void + * @covers JControllerLegacy::addPath + * @note addPath call JPath::check which will exit if the path is out of bounds. + * If execution halts for some reason, a bad path could be the culprit. */ public function testAddPath() { @@ -161,19 +171,19 @@ public function testAddPath() $this->assertTrue(is_array($paths['test']), 'The path type should be an array.'); - $this->assertThat( + $this->assertEquals( str_replace(DIRECTORY_SEPARATOR, '/', $paths['test'][0]), - $this->equalTo(str_replace(DIRECTORY_SEPARATOR, '/', JPATH_ROOT . '/foobar/')), + str_replace(DIRECTORY_SEPARATOR, '/', JPATH_ROOT . '/foobar/'), 'Line:' . __LINE__ . ' The path type should be present, clean and with a trailing slash.' ); } /** - * Test JControllerLegacy::addViewPath + * @testdox Ensure the addViewPath() correctly adds a path when initialising views * - * @since 11.3 - * - * @return void + * @covers JControllerLegacy::addViewPath + * @note addPath call JPath::check which will exit if the path is out of bounds. + * If execution halts for some reason, a bad path could be the culprit. */ public function testAddViewPath() { @@ -183,35 +193,31 @@ public function testAddViewPath() $this->assertTrue(is_array($paths['view']), 'The path type should be an array.'); - $this->assertThat( + $this->assertEquals( str_replace(DIRECTORY_SEPARATOR, '/', $paths['view'][0]), - $this->equalTo(str_replace(DIRECTORY_SEPARATOR, '/', JPATH_ROOT . '/views/')), + str_replace(DIRECTORY_SEPARATOR, '/', JPATH_ROOT . '/views/'), 'Line:' . __LINE__ . ' The path type should be present, clean and with a trailing slash.' ); } /** - * Test JControllerLegacy::getName - * - * @since 11.3 + * @testdox Ensure the getName() correctly returns the name of the controller * - * @return void + * @covers JControllerLegacy::getName */ public function testGetName() { - $this->assertThat($this->class->getName(), $this->equalTo('j')); + $this->assertEquals($this->class->getName(), 'j'); TestReflection::setValue($this->class, 'name', 'inspector'); - $this->assertThat($this->class->getName(), $this->equalTo('inspector')); + $this->assertEquals($this->class->getName(), 'inspector'); } /** - * Test JControllerLegacy::getTask(). - * - * @since 11.3 + * @testdox Ensure the getTask() correctly returns the name of the task variable * - * @return void + * @covers JControllerLegacy::getTask */ public function testGetTask() { @@ -221,26 +227,21 @@ public function testGetTask() } /** - * Test JControllerLegacy::getTasks - * - * @since 11.3 + * @testdox The available tasks should be the public tasks in the derived controller plus "display". * - * @return void + * @covers JControllerLegacy::getTasks */ public function testGetTasks() { $class = new TestController; - // The available tasks should be the public tasks in the derived controller plus "display". $this->assertEquals(array('task1', 'task2', 'display'), $class->getTasks()); } /** - * Test JControllerLegacy::setMessage + * @testdox Tests setting an error message in the controller * - * @since 11.3 - * - * @return void + * @covers JControllerLegacy::setMessage */ public function testSetMessage() { @@ -256,99 +257,166 @@ public function testSetMessage() } /** - * Test JControllerLegacy::setRedirect - * - * @since 11.3 + * @testdox Tests setting a redirect in the controller with only a URL * - * @return void + * @covers JControllerLegacy::setRedirect */ - public function testSetRedirect() + public function testSetRedirectWithUrlOnly() { - // Set the URL only $this->class->setRedirect('index.php?option=com_foobar'); - $this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class, 'Checks the redirect.'); - $this->assertAttributeEquals(null, 'message', $this->class, 'Checks the message.'); - $this->assertAttributeEquals('message', 'messageType', $this->class, 'Checks the message type.'); + $this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class); + $this->assertAttributeEquals(null, 'message', $this->class); + $this->assertAttributeEquals('message', 'messageType', $this->class); + } - // Set the URL and message + /** + * @testdox Tests setting a redirect in the controller with a URL and message + * + * @covers JControllerLegacy::setRedirect + */ + public function testSetRedirectWithUrlAndMessageWithoutType() + { $this->class->setRedirect('index.php?option=com_foobar', 'Hello World'); - $this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class, 'Checks the redirect (2).'); - $this->assertAttributeEquals('Hello World', 'message', $this->class, 'Checks the message (2).'); - $this->assertAttributeEquals('message', 'messageType', $this->class, 'Checks the message type (2).'); + $this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class); + $this->assertAttributeEquals('Hello World', 'message', $this->class); + $this->assertAttributeEquals('message', 'messageType', $this->class); + } - // URL, message and message type + /** + * @testdox Tests setting a redirect in the controller with a URL, message and message type + * + * @covers JControllerLegacy::setRedirect + */ + public function testSetRedirectWithUrlAndMessageWithType() + { $this->class->setRedirect('index.php?option=com_foobar', 'Morning Universe', 'notice'); - $this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class, 'Checks the redirect (3).'); - $this->assertAttributeEquals('Morning Universe', 'message', $this->class, 'Checks the message (3).'); - $this->assertAttributeEquals('notice', 'messageType', $this->class, 'Checks the message type (3).'); + $this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class); + $this->assertAttributeEquals('Morning Universe', 'message', $this->class); + $this->assertAttributeEquals('notice', 'messageType', $this->class); + } - // With previously set message - // URL + /** + * @testdox Tests setting a redirect in the controller with a URL and message in separate functions + * + * @covers JControllerLegacy::setRedirect + * @uses JControllerLegacy::setMessage + */ + public function testSetRedirectWithUrlAndMessageWithoutTypeWithPreviouslySetMessage() + { $this->class->setMessage('Hi all'); $this->class->setRedirect('index.php?option=com_foobar'); - $this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class, 'Checks the redirect (4).'); - $this->assertAttributeEquals('Hi all', 'message', $this->class, 'Checks the message (4).'); - $this->assertAttributeEquals('message', 'messageType', $this->class, 'Checks the message type (4).'); + $this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class); + $this->assertAttributeEquals('Hi all', 'message', $this->class); + $this->assertAttributeEquals('message', 'messageType', $this->class); + } - // URL and message + /** + * @testdox Tests setRedirect() with a message overwrites a message that was set with setMessage() + * + * @covers JControllerLegacy::setRedirect + * @uses JControllerLegacy::setMessage + */ + public function testSetRedirectWithMessageOverwritesPreviousMessage() + { $this->class->setMessage('Hi all'); $this->class->setRedirect('index.php?option=com_foobar', 'Bye all'); - $this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class, 'Checks the redirect (5).'); - $this->assertAttributeEquals('Bye all', 'message', $this->class, 'Checks the message (5).'); - $this->assertAttributeEquals('message', 'messageType', $this->class, 'Checks the message type (5).'); + $this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class); + $this->assertAttributeEquals('Bye all', 'message', $this->class); + $this->assertAttributeEquals('message', 'messageType', $this->class); + } + + /** + * @testdox Tests setRedirect() works when message and message type are set in setMessage() and the message is overriden by setRedirect() + * + * @covers JControllerLegacy::setRedirect + */ + public function testSetRedirectWithUrlMessageAndMessageTypeOverwritesPreviouslySetMessageAndMessageType() + { + $this->class->setMessage('Hello folks', 'notice'); + $this->class->setRedirect('index.php?option=com_foobar', 'Bye, Folks'); + + $this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class); + $this->assertAttributeEquals('Bye, Folks', 'message', $this->class); + $this->assertAttributeEquals('notice', 'messageType', $this->class); + } - // URL, message and message type + /** + * @testdox Tests setRedirect() with a message and message type overwrites a message that was set with setMessage() + * + * @covers JControllerLegacy::setRedirect + */ + public function testSetRedirectWithUrlMessageAndMessageTypeOverwritesPreviouslySetMessage() + { $this->class->setMessage('Hi all'); $this->class->setRedirect('index.php?option=com_foobar', 'Bye all', 'notice'); - $this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class, 'Checks the redirect (6).'); - $this->assertAttributeEquals('Bye all', 'message', $this->class, 'Checks the message (6).'); - $this->assertAttributeEquals('notice', 'messageType', $this->class, 'Checks the message type (6).'); + $this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class); + $this->assertAttributeEquals('Bye all', 'message', $this->class); + $this->assertAttributeEquals('notice', 'messageType', $this->class); + } - // URL and message type + /** + * @testdox Tests setRedirect() with a message type set but with the message set using setMessage() + * + * @covers JControllerLegacy::setRedirect + */ + public function testSetRedirectWithUrlWithoutMessgeAndWithMessageType() + { $this->class->setMessage('Hi all'); $this->class->setRedirect('index.php?option=com_foobar', null, 'notice'); - $this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class, 'Checks the redirect (7).'); - $this->assertAttributeEquals('Hi all', 'message', $this->class, 'Checks the message (7).'); - $this->assertAttributeEquals('notice', 'messageType', $this->class, 'Checks the message type (7).'); + $this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class); + $this->assertAttributeEquals('Hi all', 'message', $this->class); + $this->assertAttributeEquals('notice', 'messageType', $this->class); + } - // With previously set message and message type - // URL + /** + * @testdox Checks that setRedirect() works when a message and message type is previously set with setMessage() + * + * @covers JControllerLegacy::setRedirect + */ + public function testSetRedirectWithPreviouslySetMessageAndMessageType() + { $this->class->setMessage('Hello folks', 'notice'); $this->class->setRedirect('index.php?option=com_foobar'); - $this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class, 'Checks the redirect (8).'); - $this->assertAttributeEquals('Hello folks', 'message', $this->class, 'Checks the message (8).'); - $this->assertAttributeEquals('notice', 'messageType', $this->class, 'Checks the message type (8).'); - - // URL and message - $this->class->setMessage('Hello folks', 'notice'); - $this->class->setRedirect('index.php?option=com_foobar', 'Bye, Folks'); - - $this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class, 'Checks the redirect (9).'); - $this->assertAttributeEquals('Bye, Folks', 'message', $this->class, 'Checks the message (9).'); - $this->assertAttributeEquals('notice', 'messageType', $this->class, 'Checks the message type (9).'); + $this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class); + $this->assertAttributeEquals('Hello folks', 'message', $this->class); + $this->assertAttributeEquals('notice', 'messageType', $this->class); + } - // URL, message and message type + /** + * @testdox Tests that message and message type set in setMessage() are overwritten by setRedirect() + * + * @covers JControllerLegacy::setRedirect + */ + public function testSetRedirectWithUrlMessageAndMessageTypeOverwritesPreviouslySetMessageAndType() + { $this->class->setMessage('Hello folks', 'notice'); $this->class->setRedirect('index.php?option=com_foobar', 'Bye, folks', 'notice'); - $this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class, 'Checks the redirect (10).'); - $this->assertAttributeEquals('Bye, folks', 'message', $this->class, 'Checks the message (10).'); - $this->assertAttributeEquals('notice', 'messageType', $this->class, 'Checks the message type (10).'); + $this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class); + $this->assertAttributeEquals('Bye, folks', 'message', $this->class); + $this->assertAttributeEquals('notice', 'messageType', $this->class); + } - // URL and message type + /** + * @testdox Tests that message and message type set in setMessage() are overriden by setRedirect() + * + * @covers JControllerLegacy::setRedirect + */ + public function testSetRedirectWithUrlNoMessageAndMessageTypeWithPreviouslySetMessage() + { $this->class->setMessage('Folks?', 'notice'); $this->class->setRedirect('index.php?option=com_foobar', null, 'question'); - $this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class, 'Checks the redirect (10).'); - $this->assertAttributeEquals('Folks?', 'message', $this->class, 'Checks the message (10).'); - $this->assertAttributeEquals('question', 'messageType', $this->class, 'Checks the message type (10).'); + $this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class); + $this->assertAttributeEquals('Folks?', 'message', $this->class); + $this->assertAttributeEquals('question', 'messageType', $this->class); } }