Merge "Add `actor` table and code to start using it"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 23 Feb 2018 22:24:24 +0000 (22:24 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 23 Feb 2018 22:24:24 +0000 (22:24 +0000)
39 files changed:
includes/EditPage.php
includes/ProtectionForm.php
includes/api/i18n/ru.json
includes/libs/rdbms/ChronologyProtector.php
includes/libs/rdbms/database/position/DBMasterPos.php
includes/libs/rdbms/database/position/MySQLMasterPos.php
includes/media/JpegMetadataExtractor.php
includes/resourceloader/ResourceLoaderStartUpModule.php
jsduck.json
languages/i18n/ce.json
languages/i18n/diq.json
languages/i18n/fy.json
languages/i18n/it.json
languages/i18n/ku-latn.json
languages/i18n/kum.json
languages/i18n/lij.json
languages/i18n/mr.json
languages/i18n/nap.json
languages/i18n/sat.json
languages/i18n/sd.json
languages/i18n/vi.json
languages/i18n/vro.json
resources/Resources.php
resources/src/jquery/jquery.byteLimit.js [deleted file]
resources/src/jquery/jquery.lengthLimit.js [new file with mode: 0644]
resources/src/mediawiki.action/mediawiki.action.edit.js
resources/src/mediawiki.legacy/protect.js
resources/src/mediawiki.less/mediawiki.mixins.less
resources/src/mediawiki.widgets.visibleByteLimit/mediawiki.widgets.visibleByteLimit.js [deleted file]
resources/src/mediawiki.widgets.visibleLengthLimit/mediawiki.widgets.visibleLengthLimit.js [new file with mode: 0644]
resources/src/mediawiki/mediawiki.String.js
tests/phpunit/data/media/jpeg-segment-loop1.jpg [new file with mode: 0644]
tests/phpunit/data/media/jpeg-segment-loop2.jpg [new file with mode: 0644]
tests/phpunit/data/media/jpeg-xmp-loop.jpg [deleted file]
tests/phpunit/includes/libs/rdbms/database/DatabaseMysqlBaseTest.php
tests/phpunit/includes/media/JpegMetadataExtractorTest.php
tests/qunit/QUnitTestResources.php
tests/qunit/suites/resources/jquery/jquery.byteLimit.test.js [deleted file]
tests/qunit/suites/resources/jquery/jquery.lengthLimit.test.js [new file with mode: 0644]

index d6f9fdf..08c4a72 100644 (file)
@@ -3138,11 +3138,15 @@ ERROR;
         * @return array
         */
        private function getSummaryInputAttributes( array $inputAttrs = null ) {
-               // Note: the maxlength is overridden in JS to 255 and to make it use UTF-8 bytes, not characters.
+               $conf = $this->context->getConfig();
+               $oldCommentSchema = $conf->get( 'CommentTableSchemaMigrationStage' ) === MIGRATION_OLD;
+               // HTML maxlength uses "UTF-16 code units", which means that characters outside BMP
+               // (e.g. emojis) count for two each. This limit is overridden in JS to instead count
+               // Unicode codepoints (or 255 UTF-8 bytes for old schema).
                return ( is_array( $inputAttrs ) ? $inputAttrs : [] ) + [
                        'id' => 'wpSummary',
                        'name' => 'wpSummary',
-                       'maxlength' => '200',
+                       'maxlength' => $oldCommentSchema ? 200 : CommentStore::COMMENT_CHARACTER_LIMIT,
                        'tabindex' => 1,
                        'size' => 60,
                        'spellcheck' => 'true',
index 53608e8..51c2923 100644 (file)
@@ -349,7 +349,9 @@ class ProtectionForm {
                $user = $context->getUser();
                $output = $context->getOutput();
                $lang = $context->getLanguage();
-               $cascadingRestrictionLevels = $context->getConfig()->get( 'CascadingRestrictionLevels' );
+               $conf = $context->getConfig();
+               $cascadingRestrictionLevels = $conf->get( 'CascadingRestrictionLevels' );
+               $oldCommentSchema = $conf->get( 'CommentTableSchemaMigrationStage' ) === MIGRATION_OLD;
                $out = '';
                if ( !$this->disabled ) {
                        $output->addModules( 'mediawiki.legacy.protect' );
@@ -494,6 +496,13 @@ class ProtectionForm {
                                $this->mReasonSelection,
                                'mwProtect-reason', 4 );
 
+                       // HTML maxlength uses "UTF-16 code units", which means that characters outside BMP
+                       // (e.g. emojis) count for two each. This limit is overridden in JS to instead count
+                       // Unicode codepoints (or 180 UTF-8 bytes for old schema).
+                       // Subtract arbitrary 75 to leave some space for the autogenerated null edit's summary
+                       // and other texts chosen by dropdown menus on this page.
+                       $maxlength = $oldCommentSchema ? 180 : CommentStore::COMMENT_CHARACTER_LIMIT - 75;
+
                        $out .= Xml::openElement( 'table', [ 'id' => 'mw-protect-table3' ] ) .
                                Xml::openElement( 'tbody' );
                        $out .= "
@@ -511,10 +520,7 @@ class ProtectionForm {
                                        </td>
                                        <td class='mw-input'>" .
                                                Xml::input( 'mwProtect-reason', 60, $this->mReason, [ 'type' => 'text',
-                                                       'id' => 'mwProtect-reason', 'maxlength' => 180 ] ) .
-                                                       // Limited maxlength as the database trims at 255 bytes and other texts
-                                                       // chosen by dropdown menus on this page are also included in this database field.
-                                                       // The byte limit of 180 bytes is enforced in javascript
+                                                       'id' => 'mwProtect-reason', 'maxlength' => $maxlength ] ) .
                                        "</td>
                                </tr>";
                        # Disallow watching is user is not logged in
index 215e2ff..7e33e42 100644 (file)
@@ -27,7 +27,8 @@
                        "Redredsonia",
                        "Alexey zakharenkov",
                        "Facenapalm",
-                       "Jack who built the house"
+                       "Jack who built the house",
+                       "Mouse21"
                ]
        },
        "apihelp-main-extended-description": "<div class=\"hlist plainlinks api-main-links\">\n* [[mw:Special:MyLanguage/API:Main_page|Документация]]\n* [[mw:Special:MyLanguage/API:FAQ|ЧаВО]]\n* [https://lists.wikimedia.org/mailman/listinfo/mediawiki-api Почтовая рассылка]\n* [https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce Новости API]\n* [https://phabricator.wikimedia.org/maniphest/query/GebfyV4uCaLd/#R Ошибки и запросы]\n</div>\n<strong>Статус:</strong> Все отображаемые на этой странице функции должны работать, однако API находится в статусе активной разработки и может измениться в любой момент. Подпишитесь на [https://lists.wikimedia.org/pipermail/mediawiki-api-announce/ почтовую рассылку mediawiki-api-announce], чтобы быть в курсе обновлений.\n\n<strong>Ошибочные запросы:</strong> Если API получает запрос с ошибкой, вернётся заголовок HTTP с ключом «MediaWiki-API-Error», после чего значение заголовка и код ошибки будут отправлены обратно и установлены в то же значение. Более подробную информацию см. [[mw:Special:MyLanguage/API:Errors_and_warnings|API: Ошибки и предупреждения]].\n\n<p class=\"mw-apisandbox-link\"><strong>Тестирование:</strong> для удобства тестирования API-запросов, см. [[Special:ApiSandbox]].</p>",
        "apihelp-parse-param-disablepp": "Вместо этого используйте <var>$1disablelimitreport</var>.",
        "apihelp-parse-param-disableeditsection": "Опустить ссылки на редактирование разделов из результата парсинга.",
        "apihelp-parse-param-disabletidy": "Не проводить очистку HTML (например, с помощью tidy) результатов парсинга.",
+       "apihelp-parse-param-disablestylededuplication": "Не дедуплицируйте встроенные таблицы стилей в выходе парсера.",
        "apihelp-parse-param-generatexml": "Сгенерировать дерево парсинга XML (требуется модель содержимого <code>$1</code>, замещено <kbd>$2prop=parsetree</kbd>).",
        "apihelp-parse-param-preview": "Проанализировать в режиме препросмотра.",
        "apihelp-parse-param-sectionpreview": "Распарсить в режиме предпросмотра раздела (также активирует режим предпросмотра).",
index 88e276f..e115286 100644 (file)
@@ -75,7 +75,7 @@ class ChronologyProtector implements LoggerAwareInterface {
        public function __construct( BagOStuff $store, array $client, $posIndex = null ) {
                $this->store = $store;
                $this->clientId = md5( $client['ip'] . "\n" . $client['agent'] );
-               $this->key = $store->makeGlobalKey( __CLASS__, $this->clientId, 'v1' );
+               $this->key = $store->makeGlobalKey( __CLASS__, $this->clientId, 'v2' );
                $this->waitForPosIndex = $posIndex;
                $this->logger = new NullLogger();
        }
index 2f79ea9..28d2a1b 100644 (file)
@@ -2,12 +2,14 @@
 
 namespace Wikimedia\Rdbms;
 
+use Serializable;
+
 /**
  * An object representing a master or replica DB position in a replicated setup.
  *
  * The implementation details of this opaque type are up to the database subclass.
  */
-interface DBMasterPos {
+interface DBMasterPos extends Serializable {
        /**
         * @return float UNIX timestamp
         * @since 1.25
index 2ee9068..cdcb79c 100644 (file)
@@ -3,6 +3,7 @@
 namespace Wikimedia\Rdbms;
 
 use InvalidArgumentException;
+use UnexpectedValueException;
 
 /**
  * DBMasterPos class for MySQL/MariaDB
@@ -27,6 +28,14 @@ class MySQLMasterPos implements DBMasterPos {
         * @param float $asOfTime UNIX timestamp
         */
        public function __construct( $position, $asOfTime ) {
+               $this->init( $position, $asOfTime );
+       }
+
+       /**
+        * @param string $position
+        * @param float $asOfTime
+        */
+       protected function init( $position, $asOfTime ) {
                $m = [];
                if ( preg_match( '!^(.+)\.(\d+)/(\d+)$!', $position, $m ) ) {
                        $this->binlog = $m[1]; // ideally something like host name
@@ -34,7 +43,7 @@ class MySQLMasterPos implements DBMasterPos {
                } else {
                        $gtids = array_filter( array_map( 'trim', explode( ',', $position ) ) );
                        foreach ( $gtids as $gtid ) {
-                               if ( !$this->parseGTID( $gtid ) ) {
+                               if ( !self::parseGTID( $gtid ) ) {
                                        throw new InvalidArgumentException( "Invalid GTID '$gtid'." );
                                }
                                $this->gtids[] = $gtid;
@@ -192,4 +201,17 @@ class MySQLMasterPos implements DBMasterPos {
                        ? [ 'binlog' => $this->binlog, 'pos' => $this->pos ]
                        : false;
        }
+
+       public function serialize() {
+               return serialize( [ 'position' => $this->__toString(), 'asOfTime' => $this->asOfTime ] );
+       }
+
+       public function unserialize( $serialized ) {
+               $data = unserialize( $serialized );
+               if ( !is_array( $data ) ) {
+                       throw new UnexpectedValueException( __METHOD__ . ": cannot unserialize position" );
+               }
+
+               $this->init( $data['position'], $data['asOfTime'] );
+       }
 }
index 0bd01cd..3c778f3 100644 (file)
@@ -158,6 +158,8 @@ class JpegMetadataExtractor {
                                if ( $size['int'] < 2 ) {
                                        throw new MWException( "invalid marker size in jpeg" );
                                }
+                               // Note it's possible to seek beyond end of file if truncated.
+                               // fseek doesn't report a failure in this case.
                                fseek( $fh, $size['int'] - 2, SEEK_CUR );
                        }
                }
index 8b9feeb..e5fe928 100644 (file)
@@ -66,6 +66,7 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule {
                }
 
                $illegalFileChars = $conf->get( 'IllegalFileChars' );
+               $oldCommentSchema = $conf->get( 'CommentTableSchemaMigrationStage' ) === MIGRATION_OLD;
 
                // Build list of variables
                $vars = [
@@ -113,6 +114,8 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule {
                        'wgResourceLoaderStorageEnabled' => $conf->get( 'ResourceLoaderStorageEnabled' ),
                        'wgForeignUploadTargets' => $conf->get( 'ForeignUploadTargets' ),
                        'wgEnableUploads' => $conf->get( 'EnableUploads' ),
+                       'wgCommentByteLimit' => $oldCommentSchema ? 255 : null,
+                       'wgCommentCodePointLimit' => $oldCommentSchema ? null : CommentStore::COMMENT_CHARACTER_LIMIT,
                ];
 
                Hooks::run( 'ResourceLoaderGetConfigVars', [ &$vars ] );
index 6966832..6fb4544 100644 (file)
                "resources/src/mediawiki.special",
                "resources/src/mediawiki.toolbar",
                "resources/src/mediawiki.widgets",
-               "resources/src/mediawiki.widgets.visibleByteLimit",
+               "resources/src/mediawiki.widgets.visibleLengthLimit",
                "resources/src/jquery/jquery.accessKeyLabel.js",
                "resources/src/jquery/jquery.byteLength.js",
-               "resources/src/jquery/jquery.byteLimit.js",
                "resources/src/jquery/jquery.checkboxShiftClick.js",
                "resources/src/jquery/jquery.colorUtil.js",
                "resources/src/jquery/jquery.confirmable.js",
                "resources/src/jquery/jquery.footHovzer.js",
                "resources/src/jquery/jquery.getAttrs.js",
                "resources/src/jquery/jquery.hidpi.js",
+               "resources/src/jquery/jquery.lengthLimit.js",
                "resources/src/jquery/jquery.localize.js",
                "resources/src/jquery/jquery.makeCollapsible.js",
                "resources/src/jquery/jquery.spinner.js",
index 74d7b4e..0389de4 100644 (file)
        "prefs-files": "Файлаш",
        "prefs-custom-css": "Долахь йолу CSS",
        "prefs-custom-js": "Долахь йолу JS",
-       "prefs-common-config": "Юкъара CSS/JS массо кеч даран темийн:",
+       "prefs-common-config": "Юкъара CSS/JS массо кечдаран темийн:",
        "prefs-reset-intro": "ХӀара агӀо лело мега ахьа нисбина гӀирс Ӏадбитаран кепаца юха бокхуш.\nХӀара дешдерг кхочушъ динчул  тӀехьа хьан йиш хир-яц и юха меттахӀотто.",
        "prefs-emailconfirm-label": "Электронан пошт бакъ яр:",
        "youremail": "Электронан пошт:",
index 0ec4c66..131d189 100644 (file)
        "undo-summary": "Vırnayışê $1'i [[Special:Contributions/$2|$2i]] ([[User talk:$2|Werênayış]]) peyser gırewt",
        "undo-summary-username-hidden": "Rewizyona veri $1'i hewada",
        "cantcreateaccount-text": "Hesabvıraştışê na IP adrese ('''$1''') terefê [[User:$3|$3]] kılit biyo.\n\nSebebo ke terefê $3 ra diyao ''$2''",
-       "viewpagelogs": "Qeydanê na perrer bımotne",
+       "viewpagelogs": "Qeydanê na pele bımocne",
        "nohistory": "Verorê vurnayışanê na perer çıni yo.",
        "currentrev": "Çımraviyarnayışo rocane",
        "currentrev-asof": "$1 ra tepeya çım ra viyarnayışê cı'yo peyên",
index f306429..7de676d 100644 (file)
        "userjsyoucanpreview": "<strong>Tip:</strong> Brûk de knop \"{{int:showpreview}}\" om jo nije JS te testen foar it fêstlizzen.",
        "usercsspreview": "<strong>Dit is allinne mar it oerlêzen fan jo persoanlike CSS. Hy is noch net fêstlein!</strong>",
        "userjspreview": "<strong>Tink derom: jo besjogge no jo persoanlike JavaScript. De side is net fêstlein!</strong>",
-       "userinvalidconfigtitle": "!!FUZZY!!<strong>Warskôging:</strong> der is gjin skin \"$1\".\nTink derom: jo eigen .css- en .js-siden begjinne mei in lytse letter, bygelyks {{ns:user}}:Namme/vector.css ynsté fan {{ns:user}}:Namme/Vector.css.",
+       "userinvalidconfigtitle": "<strong>Warskôging:</strong> der is gjin skin \"$1\".\nTink derom: jo eigen .css- en .js-siden begjinne mei in lytse letter, bygelyks {{ns:user}}:Namme/vector.css ynsté fan {{ns:user}}:Namme/Vector.css.",
        "updated": "(Bewurke)",
        "note": "<strong>Opmerking:</strong>",
        "previewnote": "<strong>Tink der om dat dizze side noch net fêstlein is!</strong>",
index cfe34c5..bc2dba8 100644 (file)
                        "Pierpao",
                        "Sakretsu",
                        "Yiyi",
-                       "Manvydasz"
+                       "Manvydasz",
+                       "S4b1nuz E.656"
                ]
        },
        "tog-underline": "Sottolinea i collegamenti:",
        "timezoneregion-indian": "Oceano Indiano",
        "timezoneregion-pacific": "Oceano Pacifico",
        "allowemail": "Consenti ad altri utenti di inviarmi email",
+       "email-allow-new-users-label": "Consenti email da nuovi utenti",
        "email-blacklist-label": "Impedisci a questi utenti di inviarmi email:",
        "prefs-searchoptions": "Ricerca",
        "prefs-namespaces": "Namespace",
        "recentchanges-legend": "Opzioni ultime modifiche",
        "recentchanges-summary": "Questa pagina presenta le modifiche più recenti ai contenuti del sito.",
        "recentchanges-noresult": "Nessuna modifica durante il periodo inserito che soddisfa questi criteri.",
+       "recentchanges-timeout": "Questa ricerca è scaduta. Potresti voler provare diversi parametri di ricerca.",
        "recentchanges-network": "A causa di un errore tecnico, non è possibile caricare alcun risultato. Aggiorna la pagina.",
        "recentchanges-notargetpage": "Inserisci sopra il nome di una pagina per vedere le modifiche relative a quella pagina.",
        "recentchanges-feed-description": "Questo feed riporta le modifiche più recenti ai contenuti del sito.",
        "rcfilters-view-namespaces-tooltip": "Filtra risultati per namespace",
        "rcfilters-view-tags-tooltip": "Filtra risultati per etichette di modifica",
        "rcfilters-view-return-to-default-tooltip": "Torna al menu filtri principale",
+       "rcfilters-view-tags-help-icon-tooltip": "Ulteriori informazioni sulle modifiche etichettate",
        "rcfilters-liveupdates-button": "Aggiornamenti in tempo reale",
        "rcfilters-liveupdates-button-title-on": "Disabilita gli aggiornamenti in tempo reale",
        "rcfilters-liveupdates-button-title-off": "Mostra le nuove modifiche appena avvengono",
        "confirmrecreate": "L'utente [[User:$1|$1]] ([[User talk:$1|discussioni]]) ha cancellato questa pagina dopo che hai iniziato a modificarla, per il seguente motivo: ''$2''\nPer favore, conferma che vuoi veramente ricreare questa pagina.",
        "confirmrecreate-noreason": "L'utente [[User:$1|$1]] ([[User talk:$1|discussioni]]) {{GENDER:$1|ha cancellato}} questa pagina dopo che hai iniziato a modificarla. Per favore, conferma che vuoi veramente ricreare questa pagina.",
        "recreate": "Ricrea",
+       "confirm-purge-title": "Purga questa pagina",
        "confirm_purge_button": "OK",
        "confirm-purge-top": "Vuoi pulire la cache di questa pagina?",
        "confirm-purge-bottom": "Ripulire la cache di una pagina consente di mostrare la sua versione più aggiornata.",
        "pagelang-reason": "Motivo",
        "pagelang-submit": "Invia",
        "pagelang-nonexistent-page": "La pagina $1 non esiste.",
+       "pagelang-unchanged-language": "La pagina $1 è già impostata alla lingua $2.",
+       "pagelang-unchanged-language-default": "La pagina $1 è gia impostata alla lingua del contenuto predefinito del wiki.",
        "pagelang-db-failed": "Il database non è stato in grado di modificare la lingua della pagina.",
        "right-pagelang": "Modifica la lingua della pagina",
        "action-pagelang": "modificare la lingua della pagina",
index 6ef7b8e..1554705 100644 (file)
        "delete_and_move_reason": "Jêbir ji bo navguherandinê",
        "immobile-source-page": "Navê vê rûpelê nikare were guherandin.",
        "move-leave-redirect": "Beralîkirinekê bihêle",
-       "export": "Rûpelan eksport bike",
+       "export": "Rûpelan derxîne",
        "export-addcat": "Zêde bike",
        "export-addns": "Zêde bike",
        "export-download": "Weka dosyeyê qeyd bike",
index 89cdd3c..3298422 100644 (file)
        "createaccount": "Янгы бет этмек",
        "userlogin-resetpassword-link": "Чечилингни унутгъанмысан?",
        "userlogin-helplink2": "Гириш саялы кёмек",
-       "createacct-emailoptional": "ЭлекÑ\82Ñ\80он Ð¿Ð¾Ñ\87нÑ\83 ÐµÑ\80леÑ\88ими (гÑ\8cажаÑ\82 Ñ\91кÑ\8a)",
+       "createacct-emailoptional": "ЭлекÑ\82Ñ\80он Ð¿Ð¾Ñ\87нÑ\83 ÐµÑ\80леÑ\88ими (гÑ\91нгÑ\8eллÑ\8e)",
        "createacct-email-ph": "Электрон почну ерлешимин бер",
        "createacct-submit": "Бетинг яса",
        "createacct-benefit-heading": "{{SITENAME}} сени йимик адамланы ортакъ загьматы.",
        "preview": "Ингкъарав",
        "showpreview": "Ингкъарав",
        "showdiff": "Тюзлевлени гёрсетмек",
+       "anoneditwarning": "<strong>Тергев:</strong> Сен гириш этмединг. Тюзлевлер этсенг сени IP адресинг публикли гёрюнер. Эгер <strong>[$1 гириш]</strong> яда <strong>[$2 къайыт]</strong> этсенг, тюзлевлеринг сени ортакъчы аты булан гьисап этилер, оьзге пайдалардан да къайры.",
+       "blockedtext": "Сени къоллавчу атынг яда IP адресинг [[m:Special:MyLanguage/Global blocks|бары викилерден]] къамалгъан эди.''\n\nКъамав этген $1 ($2).\nСебеп берилген: ''$3'.\n\n* Къамав башлады: $4\n* Къамав бите: $5\n* Къамавну мурады: $7\n\n$1 булан яда къайсы оьзге админ булан къатнап къамавну гьакъында сёйлешмеге боласан.\nТергеп къой, сени [[Special:Preferences|энчили кюйлемлерингде]] e-mail адресинг тюз бермединг буса яда герти этмединг буса, яда къамав шартлагъа мактуп язывуну къадагъа гире буса, \"къоллавчугъа мактуп\" функцияны къоллап болмассан.\nСени IP адресинг — $3, къамавну идентификатору — $5. Тилев, бу маълюматланы бары талапларынга гийир.",
        "loginreqlink": "гирмек",
        "noarticletext": "Бу сагьифа гьали де матынсыз. Сен башгъа сагьифаларда [[Special:Search/{{PAGENAME}}|булай атын эсгеривлерини излемеге]]  боласан, <span class=\"plainlinks\">[{{fullurl:{{#Special:Log}}|page={{FULLPAGENAMEE}}}} тийишли гюнделик язывланы тапмагъа] яда '''[{{fullurl:{{FULLPAGENAME}}|action=edit}} булай аты булан сагьифа яратмагъа боласан]'''</span>.",
        "noarticletext-nopermission": "Бу сагьифа гьали де текстсиз. Сен башгъа сагьифаларда [[Special:Search/{{PAGENAME}}|булай атын эсгеривлерини излемеге]], яда <span class=\"plainlinks\">[{{fullurl:{{#Special:Log}}|page={{FULLPAGENAMEE}}}} тийишли гюнделиклени тапмагъа боласан]. </span> Тек бу сагьифаны яратмагъа ихтиярынг ёкъ.",
        "permissionserrors": "Гириш ихтиярланы хатасы",
        "permissionserrorstext-withaction": "Бугъар $2 гелеген {{PLURAL:$1|себепге|себеплеге}} гёре ихтиярынг ёкъ:",
        "recreate-moveddeleted-warn": "<strong>Тергев бер: Алдын тайдырылгъан сагьифаны ярашдырма айланасан.</strong>\n\nБашлап тергеп къара, гертиден де тарыкъмы экен ол сагьифаны ярашдырмагъа.\nТайдырыв ва атын алышдырыв гюнделиги тюпде берилген:",
+       "moveddeleted-notice": "Бу сагьифа тайдырылгъан эди.\nБу сагьифаны тайдырыв, къорув ва атянгыртыв гюнделиги маълюмат саялы тюпде гёрсетилген.",
        "content-model-wikitext": "викиматын",
        "undo-failure": "Аралыкъ алышынывланы къыйышывсызлгъы учун тюзлев гери алынмай.",
        "viewpagelogs": "Бу сагьифа учун гюнделиклени гёрсетмек",
        "search-file-match": "(сапламны ичделигине рас геле)",
        "search-suggest": "Буну ойлаймысан экен: $1",
        "searchall": "бары да",
+       "search-showingresults": "{{PLURAL:$4|<strong>$1</strong> натижа <strong>$3</strong> натижалардан|<strong>$1 – $2</strong> натижа <strong>$3</strong> натижалардан}}",
        "search-nonefound": "Бу талапгъа тийишли натижалар табулмады.",
        "mypreferences": "Кюйлемлер",
        "group-bot": "Ботлар",
        "blanknamespace": "(Аслу)",
        "contributions": "{{GENDER:$1|Къоллавчуну}} къошуму",
        "contributions-title": "Ортакъчыны ярдымы $1",
-       "mycontris": "Къошуму",
-       "anoncontribs": "Къошуму",
+       "mycontris": "Къошум",
+       "anoncontribs": "Къошум",
        "contribsub2": "Ярдым {{GENDER:$3|$1}} ($2)",
        "nocontribs": "Берилген усуллагъа къыйышывлу алышынывлар табылмагъан.",
        "uctop": "(гьалиги)",
        "show-big-image-other": "Башгъа {{PLURAL:$2|айырым|айырымлар}}: $1.",
        "show-big-image-size": "$1 × $2 пиксел",
        "metadata": "Мета маълюматлар",
+       "metadata-help": "Бу саплап къошум маълюмат сакълай, балики, санавлу камера яда сканнер табакъ яратылгъан яда санавлашгъан.\nЭгер саплам аслу гьалдан тюрленген буса, маълюматлардан бирлери алышынгъан тюрюн толу кюйде къыйышмайлы болмагъа ярай.",
        "metadata-fields": "Эгер метамаълюмат табел дагъылса, бу мактупда тизилген суратланы метамаълюмат аралыкълары сурат сагьифаны дисплейине гийирилер.\nКъалгъандал кюрчю кюйлемлеге гёре яшырыларлар.\n* make\n* model\n* datetimeoriginal\n* exposuretime\n* fnumber\n* isospeedratings\n* focallength\n* artist\n* copyright\n* imagedescription\n* gpslatitude\n* gpslongitude\n* gpsaltitude",
        "exif-orientation": "Онгарылым",
        "exif-xresolution": "Гёнделен айырым",
index 0cab88f..0b7b526 100644 (file)
        "userlogin-yourname-ph": "Inserisci o teu nómme uténte",
        "createacct-another-username-ph": "Scrivi o teu nomme utente",
        "yourpassword": "Pòula segretta:",
-       "userlogin-yourpassword": "Inserisci a teu ciâve",
+       "userlogin-yourpassword": "Ciâve",
        "userlogin-yourpassword-ph": "Scrivi a tu poula segretta.",
        "createacct-yourpassword-ph": "Scrivi 'na poula segretta.",
        "yourpasswordagain": "Riscrivi a pòula segrétta:",
index 10e041f..a816be1 100644 (file)
        "accmailtext": "[[User talk:$1|$1]] यांसाठी अनियतक्रमाने निर्मित केलेला परवलीचा शब्द $2 यांना पाठवण्यात आला आहे.\n\nया नवीन खात्यासाठीचा परवलीचा शब्द,सनोंद-प्रवेश घेतल्यावर [[Special:ChangePassword|परवलीचा शब्द बदला]] येथे बदलता येईल.",
        "newarticle": "(नवीन लेख)",
        "newarticletext": "आपण सध्या अस्तित्त्वात नसलेल्या पानाच्या दुव्याचा मागोवा घेत आला आहात.\nहे पान नव्याने तयार करण्यासाठी खालील पेटीत टंकन करणे सुरु करा(अधिक माहितीसाठी [$1 साहाय्य पान] बघा).\n\nजर आपण येथे चुकून आला असाल तर ब्राउझरच्या  <strong>परत</strong>(बॅक) कळीवर टिचकी द्या.",
-       "anontalkpagetext": "---- ''हे चर्चापान अशा अज्ञात सदस्यासाठी आहे, ज्यांनी खाते तयार केलेले नाही किंवा त्याचा वापर करत नाहीत. त्यांच्या ओळखीसाठी आम्ही आंतरजाल अंकपत्ता वापरतो आहोत. असा अंकपत्ता बऱ्याच लोकांचा एकच असू शकतो. जर आपण अज्ञात सदस्य असाल आणि आपल्याला काही अप्रासंगिक संदेश मिळाला असेल तर कृपया [[Special:UserLogin| खाते तयार करा]] किंवा [[Special:CreateAccount|सनोंद-प्रवेश करा]] ज्यामुळे, पुढे असे गैरसमज होणार नाहीत.''",
+       "anontalkpagetext": "<em>हे चर्चापान अशा अज्ञात सदस्यासाठी आहे, ज्यांनी खाते तयार केलेले नाही किंवा त्याचा वापर करत नाहीत.</em> \nत्यांच्या ओळखीसाठी आम्ही आंतरजाल अंकपत्ता वापरतो आहोत. असा अंकपत्ता बऱ्याच लोकांचा एकच असू शकतो. \nजर आपण अज्ञात सदस्य असाल आणि आपल्याला काही अप्रासंगिक संदेश मिळाला असेल तर कृपया [[Special:CreateAccount| खाते तयार करा]] किंवा [[Special:CreateAccount|सनोंद-प्रवेश करा]] ज्यामुळे, पुढे असे गैरसमज होणार नाहीत.",
        "noarticletext": "या लेखात सध्या काहीही मजकूर नाही.\nतुम्ही विकिपीडियावरील इतर लेखांमध्ये या [[Special:Search/{{PAGENAME}}| मथळ्याचा शोध घेऊ शकता]], <span class=\"plainlinks\">[{{fullurl:{{#Special:Log}}|page={{FULLPAGENAMEE}}}} इतर नोंदी शोधा],\nकिंवा हा लेख [{{fullurl:{{FULLPAGENAME}}|action=edit}}तयार करू शकता]</span>.",
        "noarticletext-nopermission": "सध्या या लेखात  काहीही मजकूर नाही.\nतुम्ही विकिपीडियावरील इतर लेखांमध्ये [[Special:Search/{{PAGENAME}}| या मथळ्याचा शोध घेऊ शकता]], <span class=\"plainlinks\">[{{fullurl:{{#Special:Log}}|page={{FULLPAGENAME}}}}आपण या लेखाच्या इतर नोंदी शोधा]</span>,परंतु, आपणास हा लेख लिहीण्याची परवानगी देण्यात येउ शकत नाही.",
        "missing-revision": "\"{{FULLPAGENAME}}\" या लेखाचे #$1 हे संस्करण अस्तित्वात नाही.वगळल्या गेलेल्या लेखपानाच्या जुन्या इतिहास-दुव्याचे अनुसरण केल्यामुळे असे होते.याबाबत विस्तृत माहिती  [{{fullurl:{{#Special:Log}}/delete|page={{FULLPAGENAMEE}}}} वगळलेल्या नोंदी]येथे बघता येईल.",
        "userpage-userdoesnotexist": "\"<nowiki>$1</nowiki>\" सदस्य खात्याची नोंद नाही. कृपया हे पान तुम्ही संपादित किंवा नव्याने तयार करू इच्छिता काय याबद्दल विचार करा.",
        "userpage-userdoesnotexist-view": "सदस्यखाते \"$1\"  हे नोंदलेले नाही.",
        "blocked-notice-logextract": "हा सदस्य सध्या प्रतिबंधित आहे.\nखाली, सर्वांत नवीनतम प्रतिबंधन नोंदप्रविष्टी संदर्भासाठी दिली आहे:",
-       "clearyourcache": "'''सूचना:''' जतन केल्यावर बदल दिसण्यासाठी तुम्हाला कदाचित न्याहाळकाची सय टाळायला लागेल. असे करण्यासाठी - \n\n*'''फायरफॉक्स / सफारी:''' साठी ''Reload'' हे टिचकतांना ''Shift'' ही कळ दाबून ठेवा, किंवा ''Ctrl-F5'' अथवा ''Ctrl-R'' कळा एकत्रितपणे दाबा (मॅकसाठी ''⌘-R'').\n\n*'''गूगल क्रोम:''' साठी ''Ctrl-Shift-R'' कळा एकत्रितपणे दाबा (मॅकसाठी ''⌘-Shift-R'')\n\n*'''इंटरनेट एक्सप्लोअरर:''' ''Refresh'' करतांना ''Ctrl'' कळ दाबून ठेवा, किंवा त्याऐवजी ''Ctrl-F5'' दाबा.\n\n*'''कॉन्क्वरर:''' '''Reload''' दाबा किंवा ''F5'' दाबा\n\n*'''ऑपेरा:''' ''Tools → Preferences'' मधून सय रिकामी करा",
+       "clearyourcache": "<strong>नोंद:</strong> साठवून ठेवल्यानंतर बदल पहाण्यासाठी कदाचित तुमच्या ब्राऊजरच्या कॅचेला बायपास करावे लागेल.\n* <strong>फ़ायरफ़ॉक्स / सफ़ारी:</strong> धरुन ठेवा <em>Shift</em> टिचकी मारताना <em>Reload</em>, किंवा हे दाबताना <em>Ctrl-F5</em> किंवा <em>Ctrl-R</em> (<em>⌘-R</em> मॅकवर)\n* <strong>गुगल क्रोम:</strong> दाबा <em>Ctrl-Shift-R</em> (<em>⌘-Shift-R</em> मॅकसाठी)\n* <strong>ओपेरा:</strong> कडे जा <em>Menu → Settings</em> (<em>ओपेरा → पसंतीक्रम </em> on a Mac) आणि मग <em>गोपनियता आणि सुरक्षा → ब्राउजिंग डाटा काढून टाका → कॅचे छायाचित्रे आणि धारिणी</em>.",
        "usercssyoucanpreview": "'''टीप:'''तुमचे नवे सीएसएस जतन करण्यापूर्वी 'झलक पहा' कळ वापरा.",
        "userjsyoucanpreview": "'''टीप:''' तुमचा नवा जावास्क्रिप्ट जतन करण्यापूर्वी 'झलक पहा' कळ वापरा.",
        "usercsspreview": "'''तुम्ही तुमच्या सी.एस.एस.ची केवळ झलक पहात आहात, ती अजून जतन केलेली नाही हे लक्षात घ्या.'''",
        "htmlform-user-not-valid": "<strong>$1</strong> हे वैध सदस्यनाम नाही.",
        "logentry-delete-delete": "$1 {{GENDER:$2|वगळलेले पान}} $3",
        "logentry-delete-delete_redir": "$1 ने $3 हे पुनर्निर्देशन उपरीलेखन (ओव्हररायटिंग) करून {{GENDER:$2|वगळले}}",
-       "logentry-delete-restore": "$1 {{GENDER:$2|पुनर्स्थापित पृष्ठ}} $3",
+       "logentry-delete-restore": "$1 {{GENDER:$2|पुनर्स्थापित पृष्ठ}} $3 ($4)",
        "logentry-delete-event": "$1 ने $3 वर{{PLURAL:$5|नोंद-प्रसंग|$5 नोंद प्रसंगांची}} दृष्यता{{GENDER:$2|बदलली}}:$4",
        "logentry-delete-revision": "$1 ने $3 पानावर{{PLURAL:$5|आवृत्ती|$5 आवृत्यांची}} दृष्यता{{GENDER:$2|बदलली}}:$4",
        "logentry-delete-event-legacy": "$1 ने $3 वर नोंद प्रसंगांची {{GENDER:$2|बदलली}}",
index c2b688a..00975fd 100644 (file)
        "htmlform-user-not-exists": "<strong>$1</strong> nun esiste.",
        "htmlform-user-not-valid": "<strong>$1</strong> nun è nu nomme buono.",
        "logentry-delete-delete": "$1 {{GENDER:$2|scancellaje}} 'a paggena $3",
-       "logentry-delete-restore": "$1 {{GENDER:$2|arrepigliaje}} 'a paggena $3",
+       "logentry-delete-restore": "$1 {{GENDER:$2|arrepigliaje}} 'a paggena $3 ($4)",
        "logentry-delete-event": "$1 {{GENDER:$2|cagnaie}} 'a vesibbiletà 'e {{PLURAL:$5|n'azione d' 'o riggistro|$5 aziune d' 'o riggistro}} ncopp' 'a 'a $3: $4",
        "logentry-delete-revision": "$1 {{GENDER:$2|cagnaie}} 'a vesibbiletà 'e {{PLURAL:$5|na verziona|$5 verziune}} ncopp' 'a 'a $3: $4",
        "logentry-delete-event-legacy": "$1 {{GENDER:$2|cagnaie}} 'a vesibbiletà 'e l'aziune dint' 'o riggistro ncopp' 'a $3: $4",
index a68cd3e..7afbb81 100644 (file)
@@ -37,7 +37,7 @@
        "tog-previewontop": "ᱥᱟᱯᱲᱟᱣ ᱵᱟᱠᱥᱳ ᱞᱟᱦᱟᱨᱮ ᱩᱱᱩᱫᱩᱜ ᱩᱫᱩᱜᱽ ᱢᱮ",
        "tog-previewonfirst": "ᱯᱟᱹᱦᱤᱞ ᱥᱟᱯᱲᱟᱣ ᱨᱮ ᱩᱱᱩᱫᱩᱜ ᱩᱫᱩᱜᱽ ᱢᱮ",
        "tog-enotifwatchlistpages": "E-mailạńme one tinre in̕aḱ n̕eloḱ tạlika do bodolok",
-       "tog-enotifusertalkpages": "E-mail ᱟᱹᱧᱢᱮ ᱛᱤᱱᱨᱮ ᱤᱧᱟᱜ ᱨᱚᱲ ᱥᱟᱦᱴᱟ ᱵᱚᱫᱚᱞᱜ-ᱟ",
+       "tog-enotifusertalkpages": "ᱤ-ᱢᱮᱞ ᱟᱹᱧᱢᱮ ᱛᱤᱱᱨᱮ ᱤᱧᱟᱜ ᱨᱚᱲ ᱥᱟᱦᱴᱟ ᱵᱚᱫᱚᱞᱜ-ᱟ",
        "tog-enotifminoredits": "E-mailạn̕me arhõ one tinre in̕aḱ sakamre huḍiń kạmi hoyoḱ",
        "tog-enotifrevealaddr": "ᱰᱷᱟᱹᱨᱣᱟᱜ ᱥᱟᱦᱴᱟᱨᱮ ᱤᱧᱟᱜ e-mail ᱴᱷᱤᱠᱱᱟ ᱥᱚᱫᱚᱨ ᱦᱩᱭᱩᱜ ᱢᱟ",
        "tog-shownumberswatching": "ᱧᱮᱞᱚᱜ ᱵᱮᱵᱟᱦᱟᱨᱤᱡ ᱠᱯᱣᱟᱜ ᱮᱞᱮᱞ ᱩᱫᱩᱜᱽ ᱢᱮ",
        "virus-unknownscanner": "Baṅ urum anṭvayras:",
        "welcomeuser": "ᱥᱟᱹᱜᱩᱱ ᱫᱟᱨᱟᱢ, $1!",
        "welcomecreation-msg": "Amaḱ ekaunṭ do̠ jhićena. Amaḱ pạsindko bodol alom hiṛińa.",
-       "yourname": "ᱵᱮᱵᱦá±\9fᱨᱤᱡ ᱧᱩᱛᱩᱢ:",
+       "yourname": "ᱵᱮᱵᱷá±\9fᱨᱤᱭá±\9fá±¹ ᱧᱩᱛᱩᱢ:",
        "userlogin-yourname": "ᱵᱮᱵᱷᱟᱨᱤᱭᱟᱹ ᱧᱩᱛᱩᱢ",
-       "userlogin-yourname-ph": "á±\9fá±¢á±\9fá±\9c á±µá±®á±µá±¦á±\9fᱨᱤᱡ ᱧᱤᱛᱩᱢ ᱵᱚᱞᱚᱭ ᱢᱮ",
-       "createacct-another-username-ph": "ᱵᱮᱵᱦᱟᱨᱤᱭᱟᱜ ᱧᱤᱛᱩᱢ ᱵᱚᱞᱚᱭ ᱢᱮ",
+       "userlogin-yourname-ph": "á±\9fá±¢á±\9fá±\9c á±µá±®á±µá±¦á±\9fᱨᱤᱭá±\9fá±¹ ᱧᱤᱛᱩᱢ ᱵᱚᱞᱚᱭ ᱢᱮ",
+       "createacct-another-username-ph": "ᱵᱮᱵᱷᱟᱨᱤᱭᱟᱜ ᱧᱤᱛᱩᱢ ᱵᱚᱞᱚᱭ ᱢᱮ",
        "yourpassword": "ᱫᱟᱱᱟᱝ ᱥᱟᱵᱟᱫᱽ",
        "userlogin-yourpassword": "ᱫᱟᱱᱟᱝ ᱥᱟᱵᱟᱫᱽ",
        "userlogin-yourpassword-ph": "ᱫᱟᱱᱟᱝ ᱥᱟᱵᱟᱫᱽ ᱟᱫᱮᱨᱢᱮ",
        "passwordtooshort": "Uku nambar do {{PLURAL:$1 1 horop reaḱ $1 horop reaḱ}} mudre hoyoḱ jạruṛa.",
        "password-name-match": "Amaḱ oku nambar do amaḱ ńutum khon eṭaḱ hoyoḱ jạruṛtama.",
        "password-login-forbidden": "Noa laṛcaṛicaḱ ńutum ar oku nambar do ạnlekate baṅkana.",
-       "mailmypassword": "á±±á±\9fá±£á±\9fá±\9bá±® á±©á± á±© á±®á±\9eá±¥á±\9aá±\9d á±®á±¢á±¢á±®",
-       "passwordremindertitle": "á±±á±\9fá±£á±\9f á±±á±¤á±\9b á±\9eá±\9fá±¹á±\9cᱤá±\9b á±©á± á±© á±®á±\9eá±¥á±\9aá±\9d {{SITENAME}} ᱞᱟᱹᱜᱤᱛ ᱛᱮ",
+       "mailmypassword": "á±±á±\9fá±£á±\9fá±\9bá±® á±«á±\9fá±±á±\9fá±\9d á±¥á±\9fá±µá±\9fᱫᱽ á±®á±¢",
+       "passwordremindertitle": "á±±á±\9fá±£á±\9f á±±á±¤á±\9b á±\9eá±\9fá±¹á±\9cᱤá±\9b á±«á±\9fá±±á±\9fá±\9d á±¥á±\9fá±µá±\9fᱫᱽ {{SITENAME}} ᱞᱟᱹᱜᱤᱛ ᱛᱮ",
        "noemail": "\"$1\" beoharić lạgit́te do jahan e-mail ṭhikana rukhiyạ doho bạnuḱa.",
        "noemailcreate": "Am do mitṭen jewet e-mail ṭhikạna em jaruṛ menaḱtama.",
        "passwordsent": "\"$1\" ṭhikạnate resṭariyen e-mail lạgit́te mitṭen oku nambar em hoyena.\nDaya kate ńam porte arhõ bhitri boloḱme.",
        "botpasswords-label-resetpassword": "ᱱᱟᱣᱟᱛᱮ ᱫᱟᱱᱟᱝᱥᱟᱵᱟᱫᱽ ᱮᱢ",
        "botpasswords-label-grants-column": "ᱦᱩᱭᱠᱟᱱ",
        "botpasswords-bad-appid": "ᱵᱚᱴ ᱧᱤᱛᱩᱢ \"$1\" ᱵᱟᱝ ᱴᱷᱤᱠᱟ᱾",
-       "botpasswords-created-title": "á±µá±\9aá±´ á±©á± á±© á±®á±\9eá±¥á±\9aá±\9d ᱛᱮᱭᱟᱨᱱᱟ",
+       "botpasswords-created-title": "á±µá±\9aá±´ á±©á± á±© á±«á±\9fá±±á±\9fá±\9d á±¥á±\9fá±µá±\9fᱫᱽ ᱛᱮᱭᱟᱨᱱᱟ",
        "botpasswords-updated-title": "ᱵᱚᱴ ᱫᱟᱱᱟᱝ ᱥᱟᱵᱟᱫᱽ ᱩᱛᱷᱱᱟᱹᱣ",
-       "botpasswords-deleted-title": "á±µá±\9aá±´ á±©á± á±© á±®á±\9eá±¥á±\9aá±\9d ᱢᱩᱪᱷᱟᱹᱣᱱᱟ",
+       "botpasswords-deleted-title": "á±µá±\9aá±´ á±«á±\9fá±±á±\9fá±\9d á±¥á±\9fá±µá±\9fᱫᱽ ᱢᱩᱪᱷᱟᱹᱣᱱᱟ",
        "resetpass_forbidden": "ᱫᱟᱱᱟᱝ ᱥᱟᱵᱟᱫᱽ ᱵᱟᱝ ᱵᱚᱫᱚᱞᱜ-ᱟ",
        "resetpass_forbidden-reason": "ᱩᱠᱩ ᱮᱞᱥᱚᱝ ᱵᱟᱝ ᱵᱚᱫᱚᱞᱚᱜ-ᱟ: $1",
        "resetpass-no-info": "Noa sakam sojhete laṛcaṛ lạgit́te am do bhitri boloḱ hoyoḱtama.",
        "resetpass-submit-loggedin": "ᱫᱟᱱᱟᱝ ᱥᱟᱵᱟᱫᱽ ᱵᱚᱫᱚᱞ",
        "resetpass-submit-cancel": "ᱵᱟᱫᱽ",
        "resetpass-temp-password": "ᱱᱮᱛᱚᱜ ᱞᱟᱹᱜᱤᱛ ᱫᱟᱱᱟᱝ ᱥᱟᱵᱟᱫᱽ:",
-       "passwordreset": "á±±á±\9fá±£á±\9fá±\9bá±® á±©á± á±© á±®á±\9eá±¥á±\9aá±\9d á±®á±¢á±¢á±®",
+       "passwordreset": "á±±á±\9fá±£á±\9fá±\9bá±® á±«á±\9fá±±á±\9fá±\9d á±¥á±\9fá±µá±\9fᱫᱽ á±®á±¢",
        "passwordreset-disabled": "Noa wikire amaḱ uku nambar nãwãte em lạgit subita do bando gea.",
        "passwordreset-username": "ᱵᱮᱵᱦᱟᱨᱤᱡ ᱧᱩᱛᱩᱢ:",
        "passwordreset-domain": "ᱧᱩᱛᱩᱢ:",
        "passwordreset-emailtitle": "{{SITENAME}} sayeṭre beoharićaḱ purạo thutiko",
        "passwordreset-emailelement": "ᱵᱮᱵᱦᱟᱨᱤᱭᱟᱜ ᱧᱩᱛᱩᱢ: \n$1\n\nᱢᱤᱫ ᱜᱷᱟᱹᱲᱤ ᱞᱟᱹᱜᱤᱛ ᱫᱟᱱᱟᱝ ᱱᱟᱵᱟᱫᱽ: \n$2",
        "passwordreset-emailsentemail": "Mitṭen disạ ruaṛ e-mail do kulena.",
-       "changeemail": "email ᱴᱷᱤᱠᱱᱟ ᱵᱚᱫᱚᱞ ᱢᱮ ᱥᱮ ᱚᱪᱚᱜᱽ ᱢᱮ",
+       "changeemail": "ᱤᱢᱮᱞ ᱴᱷᱤᱠᱱᱟ ᱵᱚᱫᱚᱞ ᱢᱮ ᱥᱮ ᱚᱪᱚᱜᱽ ᱢᱮ",
        "changeemail-header": "Ekaunṭ e-mail ṭhikạna do bodolme",
        "changeemail-no-info": "Noa sakam sojhete laṛcaṛ lạgit́te am do bhitri boloḱ hoyoḱtama.",
-       "changeemail-oldemail": "ᱱᱮᱛᱚᱜ-ᱟᱜ email ᱴᱷᱤᱠᱟᱹᱱᱟ",
+       "changeemail-oldemail": "ᱱᱮᱛᱚᱜ-ᱟᱜ ᱤᱢᱮᱞ ᱴᱷᱤᱠᱟᱹᱱᱟ",
        "changeemail-newemail": "ᱱᱟᱣᱟ ᱤᱢᱮᱞ ᱵᱩᱴᱟᱹ:",
        "changeemail-none": "(ᱪᱮᱫ ᱦᱚᱸ ᱵᱟᱹᱱᱩᱜ-ᱟ)",
-       "changeemail-password": "á±\9fá±¢á±\9fá±\9c {{SITENAME}} á±©á± á±© á±®á±\9eá±¥á±\9aá±\9d:",
+       "changeemail-password": "á±\9fá±¢á±\9fá±\9c {{SITENAME}} á±«á±\9fá±±á±\9fá±\9d á±¥á±\9fá±µá±\9fá±½:",
        "changeemail-submit": "E-mail ᱵᱚᱫᱚᱞᱢᱮ",
        "bold_sample": "ᱢᱚᱴᱟ ᱚᱞ",
        "bold_tip": "ᱢᱚᱴᱟ ᱚᱞ",
index e23d82d..6b0dc67 100644 (file)
        "mytalk": "بحث",
        "anontalk": "بحث",
        "navigation": "رھنمائي",
-       "and": "&#32؛۽",
+       "and": "&#32;۽",
        "faq": "ڪپس",
        "actions": "ڪارگذاريون",
        "namespaces": "نانءُپولارَ",
index 579f27e..bb064d8 100644 (file)
        "anonpreviewwarning": "''Bạn chưa đăng nhập. Khi lưu trang này, địa chỉ IP của bạn sẽ được ghi vào lịch sử trang.''",
        "missingsummary": "'''Nhắc nhở:''' Bạn đã không ghi lại tóm lược sửa đổi. Nếu bạn nhấn Lưu trang một lần nữa, sửa đổi của bạn sẽ được lưu mà không có tóm lược.",
        "selfredirect": "<strong>Cảnh báo:</strong> Bạn sắp đổi hướng trang này đến chính trang này.\nCó lẽ bạn đã định rõ mục tiêu sai hoặc bạn đang sửa trang sai.\nNếu bạn bấm “$1” lần nữa, trang đổi hướng sẽ được tạo ra.",
-       "missingcommenttext": "Xin hãy gõ vào lời bàn luận ở dưới.",
+       "missingcommenttext": "Xin hãy nhập bình luận vào đây.",
        "missingcommentheader": "<strong>Nhắc nhở:</strong> Bạn chưa ghi chủ đề/tiêu đề cho bàn luận này.\nNếu bạn nhấn nút “$1” lần nữa, sửa đổi của bạn sẽ được lưu mà không có đề mục.",
        "summary-preview": "Xem trước dòng tóm lược sửa đổi:",
        "subject-preview": "Xem trước đề mục:",
        "yourtext": "Nội dung bạn nhập",
        "storedversion": "Phiên bản lưu",
        "editingold": "'''Chú ý: bạn đang sửa một phiên bản cũ. Nếu bạn lưu, các sửa đổi trên các phiên bản mới hơn sẽ bị mất.'''",
+       "unicode-support-fail": "Trình duyệt của bạn không hỗ trợ Unicode. Đây là yêu cầu bắt buộc nếu bạn muốn sửa đổi trang tại đây, do đó thay đổi của bạn không được lưu.",
        "yourdiff": "Khác",
        "copyrightwarning": "Xin chú ý rằng tất cả các đóng góp của bạn tại {{SITENAME}} được xem là sẽ phát hành theo giấy phép $2 (xem $1 để biết thêm chi tiết). Nếu bạn không muốn những gì mình viết ra bị sửa đổi không thương tiếc và không sẵn lòng cho phép phát hành lại, xin đừng nhấn nút \"Lưu trang\".<br />\nBạn phải đảm bảo với chúng tôi rằng chính bạn là tác giả của những gì mình viết ra, hoặc chép nó từ một nguồn thuộc phạm vi công cộng hoặc tự do tương đương.<br />\n<strong>ĐỪNG ĐĂNG NỘI DUNG CÓ BẢN QUYỀN MÀ CHƯA XIN PHÉP!</strong>",
        "copyrightwarning2": "Xin chú ý rằng tất cả các đóng góp của bạn tại {{SITENAME}} có thể được sửa đổi, thay thế, hoặc xóa bỏ bởi các thành viên khác. Nếu bạn không muốn trang của bạn bị sửa đổi không thương tiếc, đừng đăng trang ở đây.<br />\nBạn phải đảm bảo với chúng tôi rằng chính bạn là người viết nên, hoặc chép nó từ một nguồn thuộc phạm vi công cộng hoặc tự do tương đương (xem $1 để biết thêm chi tiết).\n'''Đừng đăng nội dung có bản quyền mà không xin phép!'''",
        "postedit-confirmation-created": "Trang đã được tạo ra.",
        "postedit-confirmation-restored": "Trang đã được phục hồi.",
        "postedit-confirmation-saved": "Sửa đổi của bạn đã được lưu.",
+       "postedit-confirmation-published": "Thay đổi của bạn đã được xuất bản.",
        "edit-already-exists": "Không thể tạo trang mới.\nNó đã tồn tại.",
        "defaultmessagetext": "Nội dung mặc định",
        "content-failed-to-parse": "Thất bại phân tích nội dung $2 cho kiểu $1: $3",
        "parser-template-loop-warning": "Phát hiện bản mẫu lặp vòng: [[$1]]",
        "template-loop-category": "Trang có bản mẫu lặp vòng",
        "template-loop-category-desc": "Trang chứa một hoặc nhiều bản mẫu lặp vòng, tức là những bản mẫu tự gọi đệ quy chính nó.",
+       "template-loop-warning": "<strong>Cảnh báo:</strong> Trang này gọi [[:$1]] tạo ra vòng lặp bản mẫu (vòng gọi đệ quy vô hạn).",
        "parser-template-recursion-depth-warning": "Bản mẫu đã vượt quá giới hạn về độ sâu đệ quy ($1)",
        "language-converter-depth-warning": "Đã vượt quá giới hạn độ sâu của bộ chuyển đổi ngôn ngữ ($1)",
        "node-count-exceeded-category": "Trang có số nốt vượt quá giới hạn cho phép",
        "recentchangesdays-max": "(tối đa $1 ngày)",
        "recentchangescount": "Số sửa đổi hiển thị mặc định:",
        "prefs-help-recentchangescount": "Số này bao gồm các thay đổi gần đây, lịch sử trang, và nhật trình.",
-       "prefs-help-watchlist-token2": "Đây là chìa khóa bí mật cho nguồn cấp dữ liệu danh sách theo dõi của bạn.\nBất cứ ai biết nó sẽ có thể để đọc danh sách theo dõi của bạn, vì vậy đừng chia sẻ nó.\n[[Special:ResetTokens|Nhấn chuột vào đây nếu bạn cần phải thiết lập lại nó]].",
+       "prefs-help-watchlist-token2": "Đây là chìa khóa bí mật cho nguồn cấp dữ liệu danh sách theo dõi của bạn.\nBất cứ ai biết nó sẽ có thể để đọc danh sách theo dõi của bạn, vì vậy đừng chia sẻ nó.\nNếu cần, [[Special:ResetTokens|bạn có thể thiết lập lại nó]].",
        "savedprefs": "Đã lưu các tùy chọn cá nhân.",
        "savedrights": "Đã lưu các nhóm người dùng của {{GENDER:$1}}$1.",
        "timezonelegend": "Múi giờ:",
        "timezoneregion-europe": "Châu Âu",
        "timezoneregion-indian": "Ấn Độ Dương",
        "timezoneregion-pacific": "Thái Bình Dương",
-       "allowemail": "Nhận thư điện tử từ các thành viên khác",
+       "allowemail": "Cho phép các thành viên khác gửi thư điện tử cho tôi",
+       "email-allow-new-users-label": "Nhận thư điện tử từ các thành viên mới",
+       "email-blacklist-label": "Cấm các thành viên sau gửi thư điện tử cho tôi:",
        "prefs-searchoptions": "Tìm kiếm",
        "prefs-namespaces": "Không gian tên",
        "default": "mặc định",
        "recentchanges-legend": "Tùy chọn thay đổi gần đây",
        "recentchanges-summary": "Xem các thay đổi gần đây nhất trên wiki này tại đây.",
        "recentchanges-noresult": "Không có thay đổi trong khoảng thời gian phù hợp với các tiêu chí này.",
+       "recentchanges-timeout": "Yêu cầu tìm kiếm này đã bị quá hạn. Bạn có thể thử sử dụng các tham số tìm kiếm khác.",
+       "recentchanges-network": "Không thể tải kết quả do lỗi kĩ thuật. Xin hãy làm mới lại trang.",
+       "recentchanges-notargetpage": "Nhập tên trang vào ô trên để xem các thay đổi có liên quan tới trang đó.",
        "recentchanges-feed-description": "Theo dõi các thay đổi gần đây nhất của wiki dùng nguồn cấp dữ liệu này.",
        "recentchanges-label-newpage": "Bản sửa này tạo ra trang mới",
        "recentchanges-label-minor": "Đây là một sửa đổi nhỏ",
        "rcfilters-group-results-by-page": "Nhóm kết quả theo trang",
        "rcfilters-activefilters": "Bộ lọc hiện hành",
        "rcfilters-advancedfilters": "Bộ lọc nâng cao",
-       "rcfilters-limit-title": "Số kết quả để hiển thị",
+       "rcfilters-limit-title": "Số kết quả hiển thị",
+       "rcfilters-limit-and-date-label": "$1 thay đổi, $2",
        "rcfilters-days-title": "Những ngày gần đây",
        "rcfilters-hours-title": "Số giờ gần đây",
        "rcfilters-days-show-days": "$1 ngày",
        "rcfilters-days-show-hours": "$1 giờ",
        "rcfilters-highlighted-filters-list": "Tô màu: $1",
        "rcfilters-quickfilters": "Bộ lọc đã lưu",
-       "rcfilters-quickfilters-placeholder-title": "Chưa lưu liên kết",
+       "rcfilters-quickfilters-placeholder-title": "Chưa lưu các bộ lọc",
        "rcfilters-quickfilters-placeholder-description": "Để lưu thiết lập bộ lọc để dùng lại sau, bấm hình dấu trang trong hộp “Bộ lọc hiện hành” bên dưới.",
        "rcfilters-savedqueries-defaultlabel": "Bộ lọc đã lưu",
        "rcfilters-savedqueries-rename": "Đổi tên",
        "rcfilters-view-namespaces-tooltip": "Lọc kết quả theo không gian tên",
        "rcfilters-view-tags-tooltip": "Lọc kết quả theo thẻ đánh dấu",
        "rcfilters-view-return-to-default-tooltip": "Quay lại trình đơn bộ lọc chính",
+       "rcfilters-view-tags-help-icon-tooltip": "Tìm hiểu thêm về các sửa đổi bị đánh dấu",
        "rcfilters-liveupdates-button": "Cập nhật trực tiếp",
        "rcfilters-liveupdates-button-title-on": "Tắt cập nhật trực tiếp",
        "rcfilters-liveupdates-button-title-off": "Hiển thị các thay đổi mới lúc khi xảy ra",
        "rcfilters-watchlist-markseen-button": "Đánh dấu tất cả thay đổi là đã xem",
        "rcfilters-watchlist-edit-watchlist-button": "Sửa danh sách trang theo dõi",
        "rcfilters-watchlist-showupdated": "Thay đổi mới trên các trang kể lần cuối bạn xem trang được in <strong>đậm</strong> và có dấu tô màu.",
+       "rcfilters-preference-label": "Ẩn phiên bản cải tiến của trang Thay đổi Gần đây",
+       "rcfilters-target-page-placeholder": "Nhập tên trang (hoặc thể loại)",
        "rcnotefrom": "Dưới đây là {{PLURAL:$5|thay đổi duy nhất|các thay đổi}} từ <strong>$3 $4</strong> (hiển thị tối đa <strong>$1</strong> thay đổi).",
        "rclistfromreset": "Đặt lại lựa chọn ngày",
        "rclistfrom": "Xem các thay đổi từ $2 $3 trở về sau",
        "file-deleted-duplicate-notitle": "Một tập tin giống hệt như tập tin này đã từng bị xóa và tên bị xóa hẳn trước đây.\nBạn nên xin một người có quyền xem dữ liệu tập tin bị xóa hẳn xem lại trường hợp này trước khi tiếp tục tải nó lên lại.",
        "uploadwarning": "Cảnh báo!",
        "uploadwarning-text": "Xin hãy chỉnh sửa miêu tả tập tin ở dưới và thử lại.",
+       "uploadwarning-text-nostash": "Xin hãy tải lại tập tin lên, sửa đổi phần mô tả và thử lại.",
        "savefile": "Lưu tập tin",
        "uploaddisabled": "Chức năng tải lên đã bị khóa.",
        "copyuploaddisabled": "Chức năng tải lên từ địa chỉ URL đã bị tắt.",
        "uploadstash-refresh": "Làm mới danh sách tập tin",
        "uploadstash-thumbnail": "xem hình thu nhỏ",
        "uploadstash-exception": "Không thể lưu tập tin vào hàng đợi tải lên ($1): “$2”.",
+       "uploadstash-bad-path": "Đường dẫn không tồn tại.",
+       "uploadstash-bad-path-invalid": "Đường dẫn không hợp lệ.",
+       "uploadstash-bad-path-unknown-type": "Loại không xác định \"$1\".",
+       "uploadstash-bad-path-unrecognized-thumb-name": "Tên hình thu nhỏ không nhận dạng được.",
+       "uploadstash-file-not-found-no-thumb": "Không thể tải hình thu nhỏ.",
+       "uploadstash-file-not-found-no-object": "Không tạo được đối tượng tập tin cục bộ cho hình thu nhỏ.",
+       "uploadstash-file-not-found-no-remote-thumb": "Nạp hình thu nhỏ thất bại: $1\nURL = $2",
+       "uploadstash-not-logged-in": "Người dùng chưa đăng nhập, các tập tin phải do người dùng đã đăng nhập tải lên.",
+       "uploadstash-no-such-key": "Khoá không tồn tại ($1), không thể xoá.",
+       "uploadstash-zero-length": "Tập tin có dung lượng bằng không.",
        "invalid-chunk-offset": "Khúc lệch (chunk offset) không hợp lệ",
        "img-auth-accessdenied": "Không cho phép truy cập",
        "img-auth-nopathinfo": "Thiếu PATH_INFO.\nMáy chủ của bạn không được thiết lập để truyền thông tin này.\nCó thể do nó dựa trên CGI và không hỗ trợ img_auth.\nXem [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Image_Authorization hướng dẫn điều khiển truy cập hình ảnh].",
        "thumbnail_dest_directory": "Không thể tạo thư mục đích",
        "thumbnail_image-type": "Không hỗ trợ kiểu hình này",
        "thumbnail_gd-library": "Cấu hình thư viện GD chưa hoàn thành: thiếu hàm $1",
+       "thumbnail_image-size-zero": "Dung lượng tập tin ảnh bằng không.",
        "thumbnail_image-missing": "Hình như tập tin mất tích: $1",
        "thumbnail_image-failure-limit": "Việc tạo ra hình thu nhỏ này đã bị thất bại nhiều lần quá gần đây ($1 lần trở lên). Xin vui lòng thử lại sau.",
        "import": "Nhập các trang",
        "import-mapping-namespace": "Nhập vào một không gian tên:",
        "import-mapping-subpage": "Nhập thành các trang con của trang sau:",
        "import-upload-filename": "Tên tập tin:",
+       "import-upload-username-prefix": "Tiền tố liên wiki:",
+       "import-assign-known-users": "Gán sửa đổi cho thành viên cục bộ nếu tồn tại thành viên có tên tương tự",
        "import-comment": "Lý do:",
        "importtext": "Xin hãy xuất tập tin từ wiki nguồn dùng [[Special:Export|công cụ xuất]].\nLưu nó vào máy tính của bạn rồi tải nó lên đây.",
        "importstart": "Đang nhập các trang…",
        "imported-log-entries": "Đã nhập {{PLURAL:$1|mục nhật trình|$1 mục nhật trình}}.",
        "importfailed": "Không nhập được: $1",
        "importunknownsource": "Không hiểu nguồn trang để nhập vào",
+       "importnoprefix": "Chưa điền tiền tố liên wiki",
        "importcantopen": "Không thể mở tập tin để nhập vào",
        "importbadinterwiki": "Liên kết liên wiki sai",
        "importsuccess": "Nhập thành công!",
        "pageinfo-category-subcats": "Số thể loại con",
        "pageinfo-category-files": "Số tập tin",
        "pageinfo-user-id": "ID người dùng",
+       "pageinfo-file-hash": "Giá trị băm",
        "markaspatrolleddiff": "Đánh dấu tuần tra",
        "markaspatrolledtext": "Đánh dấu tuần tra trang này",
        "markaspatrolledtext-file": "Đánh dấu đã tuần tra phiên bản file này",
        "autosumm-blank": "Đã tẩy trống trang",
        "autosumm-replace": "Đã thay thế cả nội dung bằng “$1”",
        "autoredircomment": "Đổi hướng đến [[$1]]",
+       "autosumm-removed-redirect": "Xoá đổi hướng đến trang [[$1]]",
+       "autosumm-changed-redirect-target": "Thay đổi trang đích của đổi hướng từ [[$1]] sang [[S2]]",
        "autosumm-new": "Tạo trang mới với nội dung “$1”",
        "autosumm-newblank": "Đã tạo trang trống",
        "size-bytes": "$1 byte",
        "watchlistedit-clear-titles": "Các tiêu đề:",
        "watchlistedit-clear-submit": "Xóa sạch danh sách theo dõi (không thể lùi lại!)",
        "watchlistedit-clear-done": "Đã xóa sạch danh sách theo dõi của bạn.",
+       "watchlistedit-clear-jobqueue": "Danh sách theo dõi của bạn đang bị xoá. Quá trình này có thể tốn một khoảng thời gian!",
        "watchlistedit-clear-removed": "$1 tựa đề đã được xóa khỏi danh sách:",
        "watchlistedit-too-many": "Danh sách có quá nhiều trang để hiển thị.",
        "watchlisttools-clear": "Xóa sạch danh sách theo dõi",
        "tag-list-wrapper": "([[Special:Tags|{{PLURAL:$1}}Thẻ]]: $2)",
        "tag-mw-contentmodelchange": "thay đổi kiểu nội dung",
        "tag-mw-contentmodelchange-description": "Sửa đổi [https://www.mediawiki.org/wiki/Special:MyLanguage/Help:ChangeContentModel thay đổi kiểu nội dung] của trang",
+       "tag-mw-new-redirect": "Trang đổi hướng mới",
+       "tag-mw-new-redirect-description": "Các sửa đổi tạo ra trang đổi hướng mới hoặc biến một trang thành trang đổi hướng.",
+       "tag-mw-removed-redirect": "Xoá đổi hướng",
+       "tag-mw-removed-redirect-description": "Các thay đổi biến một trang đổi hướng thành trang không đổi hướng",
+       "tag-mw-changed-redirect-target": "Thay đổi trang đích của đổi hướng",
+       "tag-mw-changed-redirect-target-description": "Các thay đổi làm thay đổi trang đích của một trang đổi hướng",
+       "tag-mw-blank": "Tẩy trống trang",
+       "tag-mw-blank-description": "Các sửa đổi tẩy trống (xoá trắng) một trang",
+       "tag-mw-replace": "Thay thế nội dung",
+       "tag-mw-replace-description": "Các sửa đổi thay đổi trên 90% nội dung của một trang",
+       "tag-mw-rollback": "Lùi tất cả",
+       "tag-mw-rollback-description": "Các thay đổi cho phép lùi hàng loạt thay đổi của một người dùng trước đó thông qua liên kết lùi tất cả",
+       "tag-mw-undo": "Lùi sửa",
+       "tag-mw-undo-description": "Các thay đổi lùi sửa (hoàn tác) những thay đổi trước đó thông qua liên kết lùi lại",
        "tags-title": "Thẻ đánh dấu",
        "tags-intro": "Trang này liệt kê các thẻ đánh dấu mà phần mềm dùng nó để đánh dấu một sửa đổi, và ý nghĩa của nó.",
        "tags-tag": "Tên thẻ",
index aeb3b64..4e53f27 100644 (file)
        "userjsyoucanpreview": "'''Nõvvoannõq:''' Pruugiq nuppi 'Näütäq proovikaehust' uma vahtsõ CCS-i vai JavaScripti ülekaemisõs, inne ku taa ärq pästät.",
        "usercsspreview": "'''Seo um CSS-i proovikaehus. Määntsitki muutuisi olõ-i viil pästet.'''",
        "userjspreview": "'''Unõhtagu-i, et seo kujo su umast javascriptist om viil pästmäldäq!'''",
-       "userinvalidconfigtitle": "!!FUZZY!!'''Miildetulõtus:''' Olõ-i stiili nimega \"$1\". Piäq meelen, et pruukja säedüq .css- and .js-leheq piät nakkama väiku algustähega.",
+       "userinvalidconfigtitle": "'''Miildetulõtus:''' Olõ-i stiili nimega \"$1\". Piäq meelen, et pruukja säedüq .css- and .js-leheq piät nakkama väiku algustähega.",
        "updated": "(Värskis tett)",
        "note": "'''Miildetulõtus:'''",
        "previewnote": "'''Seo om õnnõ proovikaehus!''' \nSuq tettüq muutmisõq olõ-õi viil pästedüq!",
index f5f17e0..bf31024 100644 (file)
@@ -161,8 +161,8 @@ return [
                'targets' => [ 'desktop', 'mobile' ],
        ],
        'jquery.byteLimit' => [
-               'scripts' => 'resources/src/jquery/jquery.byteLimit.js',
-               'dependencies' => 'mediawiki.String',
+               'dependencies' => 'jquery.lengthLimit',
+               'deprecated' => 'Use "jquery.lengthLimit" instead.',
                'targets' => [ 'desktop', 'mobile' ],
        ],
        'jquery.checkboxShiftClick' => [
@@ -268,6 +268,11 @@ return [
                ],
                'targets' => [ 'desktop', 'mobile' ],
        ],
+       'jquery.lengthLimit' => [
+               'scripts' => 'resources/src/jquery/jquery.lengthLimit.js',
+               'dependencies' => 'mediawiki.String',
+               'targets' => [ 'desktop', 'mobile' ],
+       ],
        'jquery.localize' => [
                'scripts' => 'resources/src/jquery/jquery.localize.js',
        ],
@@ -1065,7 +1070,7 @@ return [
                ],
                'dependencies' => [
                        'mediawiki.RegExp',
-                       'jquery.byteLimit',
+                       'jquery.lengthLimit',
                ],
                'messages' => [
                        'htmlform-chosen-placeholder',
@@ -1427,7 +1432,7 @@ return [
                        'mediawiki.editfont.styles',
                        'jquery.textSelection',
                        'oojs-ui-core',
-                       'mediawiki.widgets.visibleByteLimit',
+                       'mediawiki.widgets.visibleLengthLimit',
                        'mediawiki.api',
                ],
        ],
@@ -2101,7 +2106,7 @@ return [
        'mediawiki.special.movePage' => [
                'scripts' => 'resources/src/mediawiki.special/mediawiki.special.movePage.js',
                'dependencies' => [
-                       'mediawiki.widgets.visibleByteLimit',
+                       'mediawiki.widgets.visibleLengthLimit',
                        'mediawiki.widgets',
                ],
        ],
@@ -2315,7 +2320,7 @@ return [
        ],
        'mediawiki.legacy.protect' => [
                'scripts' => 'resources/src/mediawiki.legacy/protect.js',
-               'dependencies' => 'jquery.byteLimit',
+               'dependencies' => 'jquery.lengthLimit',
                'messages' => [ 'protect-unchain-permissions' ]
        ],
        // Used in the web installer. Test it after modifying this definition!
@@ -2481,12 +2486,17 @@ return [
                'targets' => [ 'desktop', 'mobile' ],
        ],
        'mediawiki.widgets.visibleByteLimit' => [
+               'dependencies' => 'mediawiki.widgets.visibleLengthLimit',
+               'deprecated' => 'Use "mediawiki.widgets.visibleLengthLimit" instead.',
+               'targets' => [ 'desktop', 'mobile' ]
+       ],
+       'mediawiki.widgets.visibleLengthLimit' => [
                'scripts' => [
-                       'resources/src/mediawiki.widgets.visibleByteLimit/mediawiki.widgets.visibleByteLimit.js'
+                       'resources/src/mediawiki.widgets.visibleLengthLimit/mediawiki.widgets.visibleLengthLimit.js'
                ],
                'dependencies' => [
                        'oojs-ui-core',
-                       'jquery.byteLimit',
+                       'jquery.lengthLimit',
                        'mediawiki.String',
                ],
                'targets' => [ 'desktop', 'mobile' ]
diff --git a/resources/src/jquery/jquery.byteLimit.js b/resources/src/jquery/jquery.byteLimit.js
deleted file mode 100644 (file)
index eb21846..0000000
+++ /dev/null
@@ -1,171 +0,0 @@
-/**
- * @class jQuery.plugin.byteLimit
- */
-( function ( $, mw ) {
-
-       var
-               eventKeys = [
-                       'keyup.byteLimit',
-                       'keydown.byteLimit',
-                       'change.byteLimit',
-                       'mouseup.byteLimit',
-                       'cut.byteLimit',
-                       'paste.byteLimit',
-                       'focus.byteLimit',
-                       'blur.byteLimit'
-               ].join( ' ' ),
-               trimByteLength = require( 'mediawiki.String' ).trimByteLength;
-
-       /**
-        * Utility function to trim down a string, based on byteLimit
-        * and given a safe start position. It supports insertion anywhere
-        * in the string, so "foo" to "fobaro" if limit is 4 will result in
-        * "fobo", not "foba". Basically emulating the native maxlength by
-        * reconstructing where the insertion occurred.
-        *
-        * @method trimByteLength
-        * @deprecated Use `require( 'mediawiki.String' ).trimByteLength` instead.
-        * @static
-        * @param {string} safeVal Known value that was previously returned by this
-        * function, if none, pass empty string.
-        * @param {string} newVal New value that may have to be trimmed down.
-        * @param {number} byteLimit Number of bytes the value may be in size.
-        * @param {Function} [fn] See jQuery#byteLimit.
-        * @return {Object}
-        * @return {string} return.newVal
-        * @return {boolean} return.trimmed
-        */
-       mw.log.deprecate( $, 'trimByteLength', trimByteLength,
-               'Use require( \'mediawiki.String\' ).trimByteLength instead.', '$.trimByteLength' );
-
-       /**
-        * Enforces a byte limit on an input field, so that UTF-8 entries are counted as well,
-        * when, for example, a database field has a byte limit rather than a character limit.
-        * Plugin rationale: Browser has native maxlength for number of characters, this plugin
-        * exists to limit number of bytes instead.
-        *
-        * Can be called with a custom limit (to use that limit instead of the maxlength attribute
-        * value), a filter function (in case the limit should apply to something other than the
-        * exact input value), or both. Order of parameters is important!
-        *
-        * @param {number} [limit] Limit to enforce, fallsback to maxLength-attribute,
-        *  called with fetched value as argument.
-        * @param {Function} [fn] Function to call on the string before assessing the length.
-        * @return {jQuery}
-        * @chainable
-        */
-       $.fn.byteLimit = function ( limit, fn ) {
-               // If the first argument is the function,
-               // set fn to the first argument's value and ignore the second argument.
-               if ( $.isFunction( limit ) ) {
-                       fn = limit;
-                       limit = undefined;
-               // Either way, verify it is a function so we don't have to call
-               // isFunction again after this.
-               } else if ( !fn || !$.isFunction( fn ) ) {
-                       fn = undefined;
-               }
-
-               // The following is specific to each element in the collection.
-               return this.each( function ( i, el ) {
-                       var $el, elLimit, prevSafeVal;
-
-                       $el = $( el );
-
-                       // If no limit was passed to byteLimit(), use the maxlength value.
-                       // Can't re-use 'limit' variable because it's in the higher scope
-                       // that would affect the next each() iteration as well.
-                       // Note that we use attribute to read the value instead of property,
-                       // because in Chrome the maxLength property by default returns the
-                       // highest supported value (no indication that it is being enforced
-                       // by choice). We don't want to bind all of this for some ridiculously
-                       // high default number, unless it was explicitly set in the HTML.
-                       // Also cast to a (primitive) number (most commonly because the maxlength
-                       // attribute contains a string, but theoretically the limit parameter
-                       // could be something else as well).
-                       elLimit = Number( limit === undefined ? $el.attr( 'maxlength' ) : limit );
-
-                       // If there is no (valid) limit passed or found in the property,
-                       // skip this. The < 0 check is required for Firefox, which returns
-                       // -1  (instead of undefined) for maxLength if it is not set.
-                       if ( !elLimit || elLimit < 0 ) {
-                               return;
-                       }
-
-                       if ( fn ) {
-                               // Save function for reference
-                               $el.data( 'byteLimit.callback', fn );
-                       }
-
-                       // Remove old event handlers (if there are any)
-                       $el.off( '.byteLimit' );
-
-                       if ( fn ) {
-                               // Disable the native maxLength (if there is any), because it interferes
-                               // with the (differently calculated) byte limit.
-                               // Aside from being differently calculated (average chars with byteLimit
-                               // is lower), we also support a callback which can make it to allow longer
-                               // values (e.g. count "Foo" from "User:Foo").
-                               // maxLength is a strange property. Removing or setting the property to
-                               // undefined directly doesn't work. Instead, it can only be unset internally
-                               // by the browser when removing the associated attribute (Firefox/Chrome).
-                               // https://bugs.chromium.org/p/chromium/issues/detail?id=136004
-                               $el.removeAttr( 'maxlength' );
-
-                       } else {
-                               // If we don't have a callback the bytelimit can only be lower than the charlimit
-                               // (that is, there are no characters less than 1 byte in size). So lets (re-)enforce
-                               // the native limit for efficiency when possible (it will make the while-loop below
-                               // faster by there being less left to interate over).
-                               $el.attr( 'maxlength', elLimit );
-                       }
-
-                       // Safe base value, used to determine the path between the previous state
-                       // and the state that triggered the event handler below - and enforce the
-                       // limit approppiately (e.g. don't chop from the end if text was inserted
-                       // at the beginning of the string).
-                       prevSafeVal = '';
-
-                       // We need to listen to after the change has already happened because we've
-                       // learned that trying to guess the new value and canceling the event
-                       // accordingly doesn't work because the new value is not always as simple as:
-                       // oldValue + String.fromCharCode( e.which ); because of cut, paste, select-drag
-                       // replacements, and custom input methods and what not.
-                       // Even though we only trim input after it was changed (never prevent it), we do
-                       // listen on events that input text, because there are cases where the text has
-                       // changed while text is being entered and keyup/change will not be fired yet
-                       // (such as holding down a single key, fires keydown, and after each keydown,
-                       // we can trim the previous one).
-                       // See https://www.w3.org/TR/DOM-Level-3-Events/#events-keyboard-event-order for
-                       // the order and characteristics of the key events.
-                       $el.on( eventKeys, function () {
-                               var res = trimByteLength(
-                                       prevSafeVal,
-                                       this.value,
-                                       elLimit,
-                                       fn
-                               );
-
-                               // Only set value property if it was trimmed, because whenever the
-                               // value property is set, the browser needs to re-initiate the text context,
-                               // which moves the cursor at the end the input, moving it away from wherever it was.
-                               // This is a side-effect of limiting after the fact.
-                               if ( res.trimmed === true ) {
-                                       this.value = res.newVal;
-                                       // Trigger a 'change' event to let other scripts attached to this node know that the value
-                                       // was changed. This will also call ourselves again, but that's okay, it'll be a no-op.
-                                       $el.trigger( 'change' );
-                               }
-                               // Always adjust prevSafeVal to reflect the input value. Not doing this could cause
-                               // trimByteLength to compare the new value to an empty string instead of the
-                               // old value, resulting in trimming always from the end (T42850).
-                               prevSafeVal = res.newVal;
-                       } );
-               } );
-       };
-
-       /**
-        * @class jQuery
-        * @mixins jQuery.plugin.byteLimit
-        */
-}( jQuery, mediaWiki ) );
diff --git a/resources/src/jquery/jquery.lengthLimit.js b/resources/src/jquery/jquery.lengthLimit.js
new file mode 100644 (file)
index 0000000..2738d1a
--- /dev/null
@@ -0,0 +1,204 @@
+/**
+ * @class jQuery.plugin.lengthLimit
+ */
+( function ( $, mw ) {
+
+       var
+               eventKeys = [
+                       'keyup.lengthLimit',
+                       'keydown.lengthLimit',
+                       'change.lengthLimit',
+                       'mouseup.lengthLimit',
+                       'cut.lengthLimit',
+                       'paste.lengthLimit',
+                       'focus.lengthLimit',
+                       'blur.lengthLimit'
+               ].join( ' ' ),
+               trimByteLength = require( 'mediawiki.String' ).trimByteLength,
+               trimCodePointLength = require( 'mediawiki.String' ).trimCodePointLength;
+
+       /**
+        * Utility function to trim down a string, based on byteLimit
+        * and given a safe start position. It supports insertion anywhere
+        * in the string, so "foo" to "fobaro" if limit is 4 will result in
+        * "fobo", not "foba". Basically emulating the native maxlength by
+        * reconstructing where the insertion occurred.
+        *
+        * @method trimByteLength
+        * @deprecated Use `require( 'mediawiki.String' ).trimByteLength` instead.
+        * @static
+        * @param {string} safeVal Known value that was previously returned by this
+        * function, if none, pass empty string.
+        * @param {string} newVal New value that may have to be trimmed down.
+        * @param {number} byteLimit Number of bytes the value may be in size.
+        * @param {Function} [filterFn] See jQuery#byteLimit.
+        * @return {Object}
+        * @return {string} return.newVal
+        * @return {boolean} return.trimmed
+        */
+       mw.log.deprecate( $, 'trimByteLength', trimByteLength,
+               'Use require( \'mediawiki.String\' ).trimByteLength instead.', '$.trimByteLength' );
+
+       function lengthLimit( trimFn, limit, filterFn ) {
+               var allowNativeMaxlength = trimFn === trimByteLength;
+
+               // If the first argument is the function,
+               // set filterFn to the first argument's value and ignore the second argument.
+               if ( $.isFunction( limit ) ) {
+                       filterFn = limit;
+                       limit = undefined;
+               // Either way, verify it is a function so we don't have to call
+               // isFunction again after this.
+               } else if ( !filterFn || !$.isFunction( filterFn ) ) {
+                       filterFn = undefined;
+               }
+
+               // The following is specific to each element in the collection.
+               return this.each( function ( i, el ) {
+                       var $el, elLimit, prevSafeVal;
+
+                       $el = $( el );
+
+                       // If no limit was passed to lengthLimit(), use the maxlength value.
+                       // Can't re-use 'limit' variable because it's in the higher scope
+                       // that would affect the next each() iteration as well.
+                       // Note that we use attribute to read the value instead of property,
+                       // because in Chrome the maxLength property by default returns the
+                       // highest supported value (no indication that it is being enforced
+                       // by choice). We don't want to bind all of this for some ridiculously
+                       // high default number, unless it was explicitly set in the HTML.
+                       // Also cast to a (primitive) number (most commonly because the maxlength
+                       // attribute contains a string, but theoretically the limit parameter
+                       // could be something else as well).
+                       elLimit = Number( limit === undefined ? $el.attr( 'maxlength' ) : limit );
+
+                       // If there is no (valid) limit passed or found in the property,
+                       // skip this. The < 0 check is required for Firefox, which returns
+                       // -1  (instead of undefined) for maxLength if it is not set.
+                       if ( !elLimit || elLimit < 0 ) {
+                               return;
+                       }
+
+                       if ( filterFn ) {
+                               // Save function for reference
+                               $el.data( 'lengthLimit.callback', filterFn );
+                       }
+
+                       // Remove old event handlers (if there are any)
+                       $el.off( '.lengthLimit' );
+
+                       if ( filterFn || !allowNativeMaxlength ) {
+                               // Disable the native maxLength (if there is any), because it interferes
+                               // with the (differently calculated) character/byte limit.
+                               // Aside from being differently calculated,
+                               // we also support a callback which can make it to allow longer
+                               // values (e.g. count "Foo" from "User:Foo").
+                               // maxLength is a strange property. Removing or setting the property to
+                               // undefined directly doesn't work. Instead, it can only be unset internally
+                               // by the browser when removing the associated attribute (Firefox/Chrome).
+                               // https://bugs.chromium.org/p/chromium/issues/detail?id=136004
+                               $el.removeAttr( 'maxlength' );
+
+                       } else {
+                               // For $.byteLimit only, if we don't have a callback,
+                               // the byteLimit can only be lower than the native maxLength limit
+                               // (that is, there are no characters less than 1 byte in size). So lets (re-)enforce
+                               // the native limit for efficiency when possible (it will make the while-loop below
+                               // faster by there being less left to interate over). This does not work for $.codePointLimit
+                               // (code units for surrogates represent half a character each).
+                               $el.attr( 'maxlength', elLimit );
+                       }
+
+                       // Safe base value, used to determine the path between the previous state
+                       // and the state that triggered the event handler below - and enforce the
+                       // limit approppiately (e.g. don't chop from the end if text was inserted
+                       // at the beginning of the string).
+                       prevSafeVal = '';
+
+                       // We need to listen to after the change has already happened because we've
+                       // learned that trying to guess the new value and canceling the event
+                       // accordingly doesn't work because the new value is not always as simple as:
+                       // oldValue + String.fromCharCode( e.which ); because of cut, paste, select-drag
+                       // replacements, and custom input methods and what not.
+                       // Even though we only trim input after it was changed (never prevent it), we do
+                       // listen on events that input text, because there are cases where the text has
+                       // changed while text is being entered and keyup/change will not be fired yet
+                       // (such as holding down a single key, fires keydown, and after each keydown,
+                       // we can trim the previous one).
+                       // See https://www.w3.org/TR/DOM-Level-3-Events/#events-keyboard-event-order for
+                       // the order and characteristics of the key events.
+                       $el.on( eventKeys, function () {
+                               var res = trimFn(
+                                       prevSafeVal,
+                                       this.value,
+                                       elLimit,
+                                       filterFn
+                               );
+
+                               // Only set value property if it was trimmed, because whenever the
+                               // value property is set, the browser needs to re-initiate the text context,
+                               // which moves the cursor at the end the input, moving it away from wherever it was.
+                               // This is a side-effect of limiting after the fact.
+                               if ( res.trimmed === true ) {
+                                       this.value = res.newVal;
+                                       // Trigger a 'change' event to let other scripts attached to this node know that the value
+                                       // was changed. This will also call ourselves again, but that's okay, it'll be a no-op.
+                                       $el.trigger( 'change' );
+                               }
+                               // Always adjust prevSafeVal to reflect the input value. Not doing this could cause
+                               // trimFn to compare the new value to an empty string instead of the
+                               // old value, resulting in trimming always from the end (T42850).
+                               prevSafeVal = res.newVal;
+                       } );
+               } );
+       }
+
+       /**
+        * Enforces a byte limit on an input field, assuming UTF-8 encoding, for situations
+        * when, for example, a database field has a byte limit rather than a character limit.
+        * Plugin rationale: Browser has native maxlength for number of characters (technically,
+        * UTF-16 code units), this plugin exists to limit number of bytes instead.
+        *
+        * Can be called with a custom limit (to use that limit instead of the maxlength attribute
+        * value), a filter function (in case the limit should apply to something other than the
+        * exact input value), or both. Order of parameters is important!
+        *
+        * @param {number} [limit] Limit to enforce, fallsback to maxLength-attribute,
+        *  called with fetched value as argument.
+        * @param {Function} [filterFn] Function to call on the string before assessing the length.
+        * @return {jQuery}
+        * @chainable
+        */
+       $.fn.byteLimit = function ( limit, filterFn ) {
+               return lengthLimit.call( this, trimByteLength, limit, filterFn );
+       };
+
+       /**
+        * Enforces a codepoint (character) limit on an input field.
+        *
+        * For unfortunate historical reasons, browsers' native maxlength counts [the number of UTF-16
+        * code units rather than Unicode codepoints] [1], which means that codepoints outside the Basic
+        * Multilingual Plane (e.g. many emojis) count as 2 characters each. This plugin exists to
+        * correct this.
+        *
+        * [1]: https://www.w3.org/TR/html5/sec-forms.html#limiting-user-input-length-the-maxlength-attribute
+        *
+        * Can be called with a custom limit (to use that limit instead of the maxlength attribute
+        * value), a filter function (in case the limit should apply to something other than the
+        * exact input value), or both. Order of parameters is important!
+        *
+        * @param {number} [limit] Limit to enforce, fallsback to maxLength-attribute,
+        *  called with fetched value as argument.
+        * @param {Function} [filterFn] Function to call on the string before assessing the length.
+        * @return {jQuery}
+        * @chainable
+        */
+       $.fn.codePointLimit = function ( limit, filterFn ) {
+               return lengthLimit.call( this, trimCodePointLength, limit, filterFn );
+       };
+
+       /**
+        * @class jQuery
+        * @mixins jQuery.plugin.lengthLimit
+        */
+}( jQuery, mediaWiki ) );
index 087c5bc..a85e740 100644 (file)
 
        $( function () {
                var editBox, scrollTop, $editForm,
-                       // TODO T6714: Once this can be adjusted, read this from config.
-                       summaryByteLimit = 255,
+                       summaryCodePointLimit = mw.config.get( 'wgCommentCodePointLimit' ),
+                       summaryByteLimit = mw.config.get( 'wgCommentByteLimit' ),
                        wpSummary = OO.ui.infuse( $( '#wpSummaryWidget' ) );
 
                // Show a byte-counter to users with how many bytes are left for their edit summary.
                // TODO: This looks a bit weird, as there is no unit in the UI, just numbers; showing
                // 'bytes' confused users in testing, and showing 'chars' would be a lie. See T42035.
-               mw.widgets.visibleByteLimit( wpSummary, summaryByteLimit );
+               // (Showing 'chars' is still confusing with the code point limit, since it's not obvious
+               // that e.g. combining diacritics or zero-width punctuation count as characters.)
+               if ( summaryCodePointLimit ) {
+                       mw.widgets.visibleCodePointLimit( wpSummary, summaryCodePointLimit );
+               } else if ( summaryByteLimit ) {
+                       mw.widgets.visibleByteLimit( wpSummary, summaryByteLimit );
+               }
 
                // Restore the edit box scroll state following a preview operation,
                // and set up a form submission handler to remember this state.
index aa49ae1..b96bebc 100644 (file)
@@ -1,6 +1,9 @@
 ( function ( mw, $ ) {
+       var ProtectionForm,
+               reasonCodePointLimit = mw.config.get( 'wgCommentCodePointLimit' ),
+               reasonByteLimit = mw.config.get( 'wgCommentByteLimit' );
 
-       var ProtectionForm = window.ProtectionForm = {
+       ProtectionForm = window.ProtectionForm = {
                /**
                 * Set up the protection chaining interface (i.e. "unlock move permissions" checkbox)
                 * on the protection form
                                this.toggleUnchainedInputs( !this.areAllTypesMatching() );
                        }
 
-                       $( '#mwProtect-reason' ).byteLimit( 180 );
+                       // Arbitrary 75 to leave some space for the autogenerated null edit's summary
+                       if ( reasonCodePointLimit ) {
+                               $( '#mwProtect-reason' ).codePointLimit( reasonCodePointLimit - 75 );
+                       } else if ( reasonByteLimit ) {
+                               $( '#mwProtect-reason' ).byteLimit( reasonByteLimit - 75 );
+                       }
 
                        this.updateCascadeCheckbox();
                        return true;
index 986d29f..1218644 100644 (file)
                //   will abandon `word-wrap` (it has wider support), therefore no duplication.
                word-wrap: break-word;
        }
+       & when ( @value = none ) {
+               word-wrap: normal;
+       }
 
        // CSS3 hyphenation
        -webkit-hyphens: @value; // Safari 5.1+, iOS 4.3+
        -moz-hyphens: @value;    // Firefox 6-42
-       -ms-hyphens: @value;     // IE 10-11/Edge 12+
+       -ms-hyphens: @value;     // IE 10-11Edge 12+
        hyphens: @value;         // Firefox 43+, Chrome 55+, Android 62+, UC Browser 11.8+, Samsung 6.2+
 }
 
diff --git a/resources/src/mediawiki.widgets.visibleByteLimit/mediawiki.widgets.visibleByteLimit.js b/resources/src/mediawiki.widgets.visibleByteLimit/mediawiki.widgets.visibleByteLimit.js
deleted file mode 100644 (file)
index 03ffca7..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-( function ( mw ) {
-
-       var byteLength = require( 'mediawiki.String' ).byteLength;
-
-       /**
-        * @class mw.widgets
-        */
-
-       /**
-        * Add a visible byte limit label to a TextInputWidget.
-        *
-        * Uses jQuery#byteLimit to enforce the limit.
-        *
-        * @param {OO.ui.TextInputWidget} textInputWidget Text input widget
-        * @param {number} [limit] Byte limit, defaults to $input's maxlength
-        */
-       mw.widgets.visibleByteLimit = function ( textInputWidget, limit ) {
-               limit = limit || +textInputWidget.$input.attr( 'maxlength' );
-
-               function updateCount() {
-                       textInputWidget.setLabel( ( limit - byteLength( textInputWidget.getValue() ) ).toString() );
-               }
-               textInputWidget.on( 'change', updateCount );
-               // Initialise value
-               updateCount();
-
-               // Actually enforce limit
-               textInputWidget.$input.byteLimit( limit );
-       };
-
-}( mediaWiki ) );
diff --git a/resources/src/mediawiki.widgets.visibleLengthLimit/mediawiki.widgets.visibleLengthLimit.js b/resources/src/mediawiki.widgets.visibleLengthLimit/mediawiki.widgets.visibleLengthLimit.js
new file mode 100644 (file)
index 0000000..52ebe74
--- /dev/null
@@ -0,0 +1,54 @@
+( function ( mw ) {
+
+       var byteLength = require( 'mediawiki.String' ).byteLength,
+               codePointLength = require( 'mediawiki.String' ).codePointLength;
+
+       /**
+        * @class mw.widgets
+        */
+
+       /**
+        * Add a visible byte limit label to a TextInputWidget.
+        *
+        * Uses jQuery#byteLimit to enforce the limit.
+        *
+        * @param {OO.ui.TextInputWidget} textInputWidget Text input widget
+        * @param {number} [limit] Byte limit, defaults to $input's maxlength
+        */
+       mw.widgets.visibleByteLimit = function ( textInputWidget, limit ) {
+               limit = limit || +textInputWidget.$input.attr( 'maxlength' );
+
+               function updateCount() {
+                       textInputWidget.setLabel( ( limit - byteLength( textInputWidget.getValue() ) ).toString() );
+               }
+               textInputWidget.on( 'change', updateCount );
+               // Initialise value
+               updateCount();
+
+               // Actually enforce limit
+               textInputWidget.$input.byteLimit( limit );
+       };
+
+       /**
+        * Add a visible codepoint (character) limit label to a TextInputWidget.
+        *
+        * Uses jQuery#codePointLimit to enforce the limit.
+        *
+        * @param {OO.ui.TextInputWidget} textInputWidget Text input widget
+        * @param {number} [limit] Byte limit, defaults to $input's maxlength
+        */
+       mw.widgets.visibleCodePointLimit = function ( textInputWidget, limit ) {
+               limit = limit || +textInputWidget.$input.attr( 'maxlength' );
+
+               function updateCount() {
+                       textInputWidget.setLabel( ( limit - codePointLength( textInputWidget.getValue() ) ).toString() );
+               }
+               textInputWidget.on( 'change', updateCount );
+               // Initialise value
+               updateCount();
+
+               // Actually enforce limit
+               textInputWidget.$input.codePointLimit( limit );
+       };
+
+}( mediaWiki ) );
index 5e11680..5d9bef0 100644 (file)
                        .length;
        }
 
+       /**
+        * Calculate the character length of a string (accounting for UTF-16 surrogates).
+        *
+        * @param {string} str
+        * @return {number}
+        */
+       function codePointLength( str ) {
+               return str
+                       // Low surrogate + high surrogate pairs represent one character (codepoint) each
+                       .replace( /[\uD800-\uDBFF][\uDC00-\uDFFF]/g, '*' )
+                       .length;
+       }
+
        // Like String#charAt, but return the pair of UTF-16 surrogates for characters outside of BMP.
        function codePointAt( string, offset, backwards ) {
                // We don't need to check for offsets at the beginning or end of string,
                }
        }
 
-       /**
-        * Utility function to trim down a string, based on byteLimit
-        * and given a safe start position. It supports insertion anywhere
-        * in the string, so "foo" to "fobaro" if limit is 4 will result in
-        * "fobo", not "foba". Basically emulating the native maxlength by
-        * reconstructing where the insertion occurred.
-        *
-        * @param {string} safeVal Known value that was previously returned by this
-        * function, if none, pass empty string.
-        * @param {string} newVal New value that may have to be trimmed down.
-        * @param {number} byteLimit Number of bytes the value may be in size.
-        * @param {Function} [fn] Function to call on the string before assessing the length.
-        * @return {Object}
-        * @return {string} return.newVal
-        * @return {boolean} return.trimmed
-        */
-       function trimByteLength( safeVal, newVal, byteLimit, fn ) {
+       function trimLength( safeVal, newVal, length, lengthFn ) {
                var startMatches, endMatches, matchesLen, inpParts, chopOff, oldChar, newChar,
                        oldVal = safeVal;
 
                // Run the hook if one was provided, but only on the length
                // assessment. The value itself is not to be affected by the hook.
-               if ( byteLength( fn ? fn( newVal ) : newVal ) <= byteLimit ) {
+               if ( lengthFn( newVal ) <= length ) {
                        // Limit was not reached, just remember the new value
                        // and let the user continue.
                        return {
 
                // Chop off characters from the end of the "inserted content" string
                // until the limit is statisfied.
-               if ( fn ) {
-                       // stop, when there is nothing to slice - T43450
-                       while ( byteLength( fn( inpParts.join( '' ) ) ) > byteLimit && inpParts[ 1 ].length > 0 ) {
-                               // Do not chop off halves of surrogate pairs
-                               chopOff = /[\uD800-\uDBFF][\uDC00-\uDFFF]$/.test( inpParts[ 1 ] ) ? 2 : 1;
-                               inpParts[ 1 ] = inpParts[ 1 ].slice( 0, -chopOff );
-                       }
-               } else {
-                       while ( byteLength( inpParts.join( '' ) ) > byteLimit ) {
-                               // Do not chop off halves of surrogate pairs
-                               chopOff = /[\uD800-\uDBFF][\uDC00-\uDFFF]$/.test( inpParts[ 1 ] ) ? 2 : 1;
-                               inpParts[ 1 ] = inpParts[ 1 ].slice( 0, -chopOff );
-                       }
+               // Make sure to stop when there is nothing to slice (T43450).
+               while ( lengthFn( inpParts.join( '' ) ) > length && inpParts[ 1 ].length > 0 ) {
+                       // Do not chop off halves of surrogate pairs
+                       chopOff = /[\uD800-\uDBFF][\uDC00-\uDFFF]$/.test( inpParts[ 1 ] ) ? 2 : 1;
+                       inpParts[ 1 ] = inpParts[ 1 ].slice( 0, -chopOff );
                }
 
                return {
                        newVal: inpParts.join( '' ),
-                       // For pathological fn() that always returns a value longer than the limit, we might have
+                       // For pathological lengthFn() that always returns a length greater than the limit, we might have
                        // ended up not trimming - check for this case to avoid infinite loops
                        trimmed: newVal !== inpParts.join( '' )
                };
        }
 
+       /**
+        * Utility function to trim down a string, based on byteLimit
+        * and given a safe start position. It supports insertion anywhere
+        * in the string, so "foo" to "fobaro" if limit is 4 will result in
+        * "fobo", not "foba". Basically emulating the native maxlength by
+        * reconstructing where the insertion occurred.
+        *
+        * @param {string} safeVal Known value that was previously returned by this
+        * function, if none, pass empty string.
+        * @param {string} newVal New value that may have to be trimmed down.
+        * @param {number} byteLimit Number of bytes the value may be in size.
+        * @param {Function} [filterFn] Function to call on the string before assessing the length.
+        * @return {Object}
+        * @return {string} return.newVal
+        * @return {boolean} return.trimmed
+        */
+       function trimByteLength( safeVal, newVal, byteLimit, filterFn ) {
+               var lengthFn;
+               if ( filterFn ) {
+                       lengthFn = function ( val ) {
+                               return byteLength( filterFn( val ) );
+                       };
+               } else {
+                       lengthFn = byteLength;
+               }
+
+               return trimLength( safeVal, newVal, byteLimit, lengthFn );
+       }
+
+       /**
+        * Utility function to trim down a string, based on codePointLimit
+        * and given a safe start position. It supports insertion anywhere
+        * in the string, so "foo" to "fobaro" if limit is 4 will result in
+        * "fobo", not "foba". Basically emulating the native maxlength by
+        * reconstructing where the insertion occurred.
+        *
+        * @param {string} safeVal Known value that was previously returned by this
+        * function, if none, pass empty string.
+        * @param {string} newVal New value that may have to be trimmed down.
+        * @param {number} codePointLimit Number of characters the value may be in size.
+        * @param {Function} [filterFn] Function to call on the string before assessing the length.
+        * @return {Object}
+        * @return {string} return.newVal
+        * @return {boolean} return.trimmed
+        */
+       function trimCodePointLength( safeVal, newVal, codePointLimit, filterFn ) {
+               var lengthFn;
+               if ( filterFn ) {
+                       lengthFn = function ( val ) {
+                               return codePointLength( filterFn( val ) );
+                       };
+               } else {
+                       lengthFn = codePointLength;
+               }
+
+               return trimLength( safeVal, newVal, codePointLimit, lengthFn );
+       }
+
        module.exports = {
                byteLength: byteLength,
-               trimByteLength: trimByteLength
+               codePointLength: codePointLength,
+               trimByteLength: trimByteLength,
+               trimCodePointLength: trimCodePointLength
        };
 
 }() );
diff --git a/tests/phpunit/data/media/jpeg-segment-loop1.jpg b/tests/phpunit/data/media/jpeg-segment-loop1.jpg
new file mode 100644 (file)
index 0000000..962f3fe
Binary files /dev/null and b/tests/phpunit/data/media/jpeg-segment-loop1.jpg differ
diff --git a/tests/phpunit/data/media/jpeg-segment-loop2.jpg b/tests/phpunit/data/media/jpeg-segment-loop2.jpg
new file mode 100644 (file)
index 0000000..e3a7505
Binary files /dev/null and b/tests/phpunit/data/media/jpeg-segment-loop2.jpg differ
diff --git a/tests/phpunit/data/media/jpeg-xmp-loop.jpg b/tests/phpunit/data/media/jpeg-xmp-loop.jpg
deleted file mode 100644 (file)
index 962f3fe..0000000
Binary files a/tests/phpunit/data/media/jpeg-xmp-loop.jpg and /dev/null differ
index b9f57b5..5fcca1a 100644 (file)
@@ -495,4 +495,19 @@ class DatabaseMysqlBaseTest extends PHPUnit\Framework\TestCase {
 
                $db->clearFlag( Database::DBO_IGNORE );
        }
+
+       /**
+        * @covers Wikimedia\Rdbms\MySQLMasterPos
+        */
+       public function testSerialize() {
+               $pos = new MySQLMasterPos( '3E11FA47-71CA-11E1-9E33-C80AA9429562:99', 53636363 );
+               $roundtripPos = unserialize( serialize( $pos ) );
+
+               $this->assertEquals( $pos, $roundtripPos );
+
+               $pos = new MySQLMasterPos( '255-11-23', 53636363 );
+               $roundtripPos = unserialize( serialize( $pos ) );
+
+               $this->assertEquals( $pos, $roundtripPos );
+       }
 }
index 9792172..c943cef 100644 (file)
@@ -110,8 +110,19 @@ class JpegMetadataExtractorTest extends MediaWikiTestCase {
        }
 
        public function testInfiniteRead() {
+               // test file truncated right after a segment, which previously
+               // caused an infinite loop looking for the next segment byte.
                // Should get past infinite loop and throw in wfUnpack()
                $this->setExpectedException( 'MWException' );
-               $res = JpegMetadataExtractor::segmentSplitter( $this->filePath . 'jpeg-xmp-loop.jpg' );
+               $res = JpegMetadataExtractor::segmentSplitter( $this->filePath . 'jpeg-segment-loop1.jpg' );
+       }
+
+       public function testInfiniteRead2() {
+               // test file truncated after a segment's marker and size, which
+               // would cause a seek past end of file. Seek past end of file
+               // doesn't actually fail, but prevents further reading and was
+               // devolving into the previous case (testInfiniteRead).
+               $this->setExpectedException( 'MWException' );
+               $res = JpegMetadataExtractor::segmentSplitter( $this->filePath . 'jpeg-segment-loop2.jpg' );
        }
 }
index 3372bf0..785e114 100644 (file)
@@ -45,12 +45,12 @@ return [
                'scripts' => [
                        'tests/qunit/suites/resources/startup.test.js',
                        'tests/qunit/suites/resources/jquery/jquery.accessKeyLabel.test.js',
-                       'tests/qunit/suites/resources/jquery/jquery.byteLimit.test.js',
                        'tests/qunit/suites/resources/jquery/jquery.color.test.js',
                        'tests/qunit/suites/resources/jquery/jquery.colorUtil.test.js',
                        'tests/qunit/suites/resources/jquery/jquery.getAttrs.test.js',
                        'tests/qunit/suites/resources/jquery/jquery.hidpi.test.js',
                        'tests/qunit/suites/resources/jquery/jquery.highlightText.test.js',
+                       'tests/qunit/suites/resources/jquery/jquery.lengthLimit.test.js',
                        'tests/qunit/suites/resources/jquery/jquery.localize.test.js',
                        'tests/qunit/suites/resources/jquery/jquery.makeCollapsible.test.js',
                        'tests/qunit/suites/resources/jquery/jquery.tabIndex.test.js',
@@ -103,12 +103,12 @@ return [
                ],
                'dependencies' => [
                        'jquery.accessKeyLabel',
-                       'jquery.byteLimit',
                        'jquery.color',
                        'jquery.colorUtil',
                        'jquery.getAttrs',
                        'jquery.hidpi',
                        'jquery.highlightText',
+                       'jquery.lengthLimit',
                        'jquery.localize',
                        'jquery.makeCollapsible',
                        'jquery.tabIndex',
diff --git a/tests/qunit/suites/resources/jquery/jquery.byteLimit.test.js b/tests/qunit/suites/resources/jquery/jquery.byteLimit.test.js
deleted file mode 100644 (file)
index d3233da..0000000
+++ /dev/null
@@ -1,286 +0,0 @@
-( function ( $, mw ) {
-       var simpleSample, U_20AC, poop, mbSample;
-
-       QUnit.module( 'jquery.byteLimit', QUnit.newMwEnvironment() );
-
-       // Simple sample (20 chars, 20 bytes)
-       simpleSample = '12345678901234567890';
-
-       // 3 bytes (euro-symbol)
-       U_20AC = '\u20AC';
-
-       // Outside of the BMP (pile of poo emoji)
-       poop = '\uD83D\uDCA9'; // "💩"
-
-       // Multi-byte sample (22 chars, 26 bytes)
-       mbSample = '1234567890' + U_20AC + '1234567890' + U_20AC;
-
-       // Basic sendkey-implementation
-       function addChars( $input, charstr ) {
-               var c, len;
-
-               function x( $input, i ) {
-                       // Add character to the value
-                       return $input.val() + charstr.charAt( i );
-               }
-
-               for ( c = 0, len = charstr.length; c < len; c += 1 ) {
-                       $input
-                               .val( x( $input, c ) )
-                               .trigger( 'change' );
-               }
-       }
-
-       /**
-        * Test factory for $.fn.byteLimit
-        *
-        * @param {Object} options
-        * @param {string} options.description Test name
-        * @param {jQuery} options.$input jQuery object in an input element
-        * @param {string} options.sample Sequence of characters to simulate being
-        *  added one by one
-        * @param {string} options.expected Expected final value of `$input`
-        */
-       function byteLimitTest( options ) {
-               var opt = $.extend( {
-                       description: '',
-                       $input: null,
-                       sample: '',
-                       expected: ''
-               }, options );
-
-               QUnit.test( opt.description, function ( assert ) {
-                       opt.$input.appendTo( '#qunit-fixture' );
-
-                       // Simulate pressing keys for each of the sample characters
-                       addChars( opt.$input, opt.sample );
-
-                       assert.equal(
-                               opt.$input.val(),
-                               opt.expected,
-                               'New value matches the expected string'
-                       );
-               } );
-       }
-
-       byteLimitTest( {
-               description: 'Plain text input',
-               $input: $( '<input>' ).attr( 'type', 'text' ),
-               sample: simpleSample,
-               expected: simpleSample
-       } );
-
-       byteLimitTest( {
-               description: 'Plain text input. Calling byteLimit with no parameters and no maxlength attribute (T38310)',
-               $input: $( '<input>' ).attr( 'type', 'text' )
-                       .byteLimit(),
-               sample: simpleSample,
-               expected: simpleSample
-       } );
-
-       byteLimitTest( {
-               description: 'Limit using the maxlength attribute',
-               $input: $( '<input>' ).attr( 'type', 'text' )
-                       .attr( 'maxlength', '10' )
-                       .byteLimit(),
-               sample: simpleSample,
-               expected: '1234567890'
-       } );
-
-       byteLimitTest( {
-               description: 'Limit using a custom value',
-               $input: $( '<input>' ).attr( 'type', 'text' )
-                       .byteLimit( 10 ),
-               sample: simpleSample,
-               expected: '1234567890'
-       } );
-
-       byteLimitTest( {
-               description: 'Limit using a custom value, overriding maxlength attribute',
-               $input: $( '<input>' ).attr( 'type', 'text' )
-                       .attr( 'maxlength', '10' )
-                       .byteLimit( 15 ),
-               sample: simpleSample,
-               expected: '123456789012345'
-       } );
-
-       byteLimitTest( {
-               description: 'Limit using a custom value (multibyte)',
-               $input: $( '<input>' ).attr( 'type', 'text' )
-                       .byteLimit( 14 ),
-               sample: mbSample,
-               expected: '1234567890' + U_20AC + '1'
-       } );
-
-       byteLimitTest( {
-               description: 'Limit using a custom value (multibyte, outside BMP)',
-               $input: $( '<input>' ).attr( 'type', 'text' )
-                       .byteLimit( 3 ),
-               sample: poop,
-               expected: ''
-       } );
-
-       byteLimitTest( {
-               description: 'Limit using a custom value (multibyte) overlapping a byte',
-               $input: $( '<input>' ).attr( 'type', 'text' )
-                       .byteLimit( 12 ),
-               sample: mbSample,
-               expected: '123456789012'
-       } );
-
-       byteLimitTest( {
-               description: 'Pass the limit and a callback as input filter',
-               $input: $( '<input>' ).attr( 'type', 'text' )
-                       .byteLimit( 6, function ( val ) {
-                               var title = mw.Title.newFromText( String( val ) );
-                               // Return without namespace prefix
-                               return title ? title.getMain() : '';
-                       } ),
-               sample: 'User:Sample',
-               expected: 'User:Sample'
-       } );
-
-       byteLimitTest( {
-               description: 'Limit using the maxlength attribute and pass a callback as input filter',
-               $input: $( '<input>' ).attr( 'type', 'text' )
-                       .attr( 'maxlength', '6' )
-                       .byteLimit( function ( val ) {
-                               var title = mw.Title.newFromText( String( val ) );
-                               // Return without namespace prefix
-                               return title ? title.getMain() : '';
-                       } ),
-               sample: 'User:Sample',
-               expected: 'User:Sample'
-       } );
-
-       byteLimitTest( {
-               description: 'Pass the limit and a callback as input filter',
-               $input: $( '<input>' ).attr( 'type', 'text' )
-                       .byteLimit( 6, function ( val ) {
-                               var title = mw.Title.newFromText( String( val ) );
-                               // Return without namespace prefix
-                               return title ? title.getMain() : '';
-                       } ),
-               sample: 'User:Example',
-               // The callback alters the value to be used to calculeate
-               // the length. The altered value is "Exampl" which has
-               // a length of 6, the "e" would exceed the limit.
-               expected: 'User:Exampl'
-       } );
-
-       byteLimitTest( {
-               description: 'Input filter that increases the length',
-               $input: $( '<input>' ).attr( 'type', 'text' )
-                       .byteLimit( 10, function ( text ) {
-                               return 'prefix' + text;
-                       } ),
-               sample: simpleSample,
-               // Prefix adds 6 characters, limit is reached after 4
-               expected: '1234'
-       } );
-
-       // Regression tests for T43450
-       byteLimitTest( {
-               description: 'Input filter of which the base exceeds the limit',
-               $input: $( '<input>' ).attr( 'type', 'text' )
-                       .byteLimit( 3, function ( text ) {
-                               return 'prefix' + text;
-                       } ),
-               sample: simpleSample,
-               expected: ''
-       } );
-
-       QUnit.test( 'Confirm properties and attributes set', function ( assert ) {
-               var $el;
-
-               $el = $( '<input>' ).attr( 'type', 'text' )
-                       .attr( 'maxlength', '7' )
-                       .appendTo( '#qunit-fixture' )
-                       .byteLimit();
-
-               assert.strictEqual( $el.attr( 'maxlength' ), '7', 'maxlength attribute unchanged for simple limit' );
-
-               $el = $( '<input>' ).attr( 'type', 'text' )
-                       .attr( 'maxlength', '7' )
-                       .appendTo( '#qunit-fixture' )
-                       .byteLimit( 12 );
-
-               assert.strictEqual( $el.attr( 'maxlength' ), '12', 'maxlength attribute updated for custom limit' );
-
-               $el = $( '<input>' ).attr( 'type', 'text' )
-                       .attr( 'maxlength', '7' )
-                       .appendTo( '#qunit-fixture' )
-                       .byteLimit( 12, function ( val ) {
-                               return val;
-                       } );
-
-               assert.strictEqual( $el.attr( 'maxlength' ), undefined, 'maxlength attribute removed for limit with callback' );
-
-               $( '<input>' ).attr( 'type', 'text' )
-                       .addClass( 'mw-test-byteLimit-foo' )
-                       .attr( 'maxlength', '7' )
-                       .appendTo( '#qunit-fixture' );
-
-               $( '<input>' ).attr( 'type', 'text' )
-                       .addClass( 'mw-test-byteLimit-foo' )
-                       .attr( 'maxlength', '12' )
-                       .appendTo( '#qunit-fixture' );
-
-               $el = $( '.mw-test-byteLimit-foo' );
-
-               assert.strictEqual( $el.length, 2, 'Verify that there are no other elements clashing with this test suite' );
-
-               $el.byteLimit();
-       } );
-
-       QUnit.test( 'Trim from insertion when limit exceeded', function ( assert ) {
-               var $el;
-
-               // Use a new <input> because the bug only occurs on the first time
-               // the limit it reached (T42850)
-               $el = $( '<input>' ).attr( 'type', 'text' )
-                       .appendTo( '#qunit-fixture' )
-                       .byteLimit( 3 )
-                       .val( 'abc' ).trigger( 'change' )
-                       .val( 'zabc' ).trigger( 'change' );
-
-               assert.strictEqual( $el.val(), 'abc', 'Trim from the insertion point (at 0), not the end' );
-
-               $el = $( '<input>' ).attr( 'type', 'text' )
-                       .appendTo( '#qunit-fixture' )
-                       .byteLimit( 3 )
-                       .val( 'abc' ).trigger( 'change' )
-                       .val( 'azbc' ).trigger( 'change' );
-
-               assert.strictEqual( $el.val(), 'abc', 'Trim from the insertion point (at 1), not the end' );
-       } );
-
-       QUnit.test( 'Do not cut up false matching substrings in emoji insertions', function ( assert ) {
-               var $el,
-                       oldVal = '\uD83D\uDCA9\uD83D\uDCA9', // "💩💩"
-                       newVal = '\uD83D\uDCA9\uD83D\uDCB9\uD83E\uDCA9\uD83D\uDCA9', // "💩💹🢩💩"
-                       expected = '\uD83D\uDCA9\uD83D\uDCB9\uD83D\uDCA9'; // "💩💹💩"
-
-               // Possible bad results:
-               // * With no surrogate support:
-               //   '\uD83D\uDCA9\uD83D\uDCB9\uD83E\uDCA9' "💩💹🢩"
-               // * With correct trimming but bad detection of inserted text:
-               //   '\uD83D\uDCA9\uD83D\uDCB9\uDCA9' "💩💹�"
-
-               $el = $( '<input>' ).attr( 'type', 'text' )
-                       .appendTo( '#qunit-fixture' )
-                       .byteLimit( 12 )
-                       .val( oldVal ).trigger( 'change' )
-                       .val( newVal ).trigger( 'change' );
-
-               assert.strictEqual( $el.val(), expected, 'Pasted emoji correctly trimmed at the end' );
-       } );
-
-       byteLimitTest( {
-               description: 'Unpaired surrogates do not crash',
-               $input: $( '<input>' ).attr( 'type', 'text' ).byteLimit( 4 ),
-               sample: '\uD800\uD800\uDFFF',
-               expected: '\uD800'
-       } );
-
-}( jQuery, mediaWiki ) );
diff --git a/tests/qunit/suites/resources/jquery/jquery.lengthLimit.test.js b/tests/qunit/suites/resources/jquery/jquery.lengthLimit.test.js
new file mode 100644 (file)
index 0000000..7117d1f
--- /dev/null
@@ -0,0 +1,286 @@
+( function ( $, mw ) {
+       var simpleSample, U_20AC, poop, mbSample;
+
+       QUnit.module( 'jquery.lengthLimit', QUnit.newMwEnvironment() );
+
+       // Simple sample (20 chars, 20 bytes)
+       simpleSample = '12345678901234567890';
+
+       // 3 bytes (euro-symbol)
+       U_20AC = '\u20AC';
+
+       // Outside of the BMP (pile of poo emoji)
+       poop = '\uD83D\uDCA9'; // "💩"
+
+       // Multi-byte sample (22 chars, 26 bytes)
+       mbSample = '1234567890' + U_20AC + '1234567890' + U_20AC;
+
+       // Basic sendkey-implementation
+       function addChars( $input, charstr ) {
+               var c, len;
+
+               function x( $input, i ) {
+                       // Add character to the value
+                       return $input.val() + charstr.charAt( i );
+               }
+
+               for ( c = 0, len = charstr.length; c < len; c += 1 ) {
+                       $input
+                               .val( x( $input, c ) )
+                               .trigger( 'change' );
+               }
+       }
+
+       /**
+        * Test factory for $.fn.byteLimit
+        *
+        * @param {Object} options
+        * @param {string} options.description Test name
+        * @param {jQuery} options.$input jQuery object in an input element
+        * @param {string} options.sample Sequence of characters to simulate being
+        *  added one by one
+        * @param {string} options.expected Expected final value of `$input`
+        */
+       function byteLimitTest( options ) {
+               var opt = $.extend( {
+                       description: '',
+                       $input: null,
+                       sample: '',
+                       expected: ''
+               }, options );
+
+               QUnit.test( opt.description, function ( assert ) {
+                       opt.$input.appendTo( '#qunit-fixture' );
+
+                       // Simulate pressing keys for each of the sample characters
+                       addChars( opt.$input, opt.sample );
+
+                       assert.equal(
+                               opt.$input.val(),
+                               opt.expected,
+                               'New value matches the expected string'
+                       );
+               } );
+       }
+
+       byteLimitTest( {
+               description: 'Plain text input',
+               $input: $( '<input>' ).attr( 'type', 'text' ),
+               sample: simpleSample,
+               expected: simpleSample
+       } );
+
+       byteLimitTest( {
+               description: 'Plain text input. Calling byteLimit with no parameters and no maxlength attribute (T38310)',
+               $input: $( '<input>' ).attr( 'type', 'text' )
+                       .byteLimit(),
+               sample: simpleSample,
+               expected: simpleSample
+       } );
+
+       byteLimitTest( {
+               description: 'Limit using the maxlength attribute',
+               $input: $( '<input>' ).attr( 'type', 'text' )
+                       .attr( 'maxlength', '10' )
+                       .byteLimit(),
+               sample: simpleSample,
+               expected: '1234567890'
+       } );
+
+       byteLimitTest( {
+               description: 'Limit using a custom value',
+               $input: $( '<input>' ).attr( 'type', 'text' )
+                       .byteLimit( 10 ),
+               sample: simpleSample,
+               expected: '1234567890'
+       } );
+
+       byteLimitTest( {
+               description: 'Limit using a custom value, overriding maxlength attribute',
+               $input: $( '<input>' ).attr( 'type', 'text' )
+                       .attr( 'maxlength', '10' )
+                       .byteLimit( 15 ),
+               sample: simpleSample,
+               expected: '123456789012345'
+       } );
+
+       byteLimitTest( {
+               description: 'Limit using a custom value (multibyte)',
+               $input: $( '<input>' ).attr( 'type', 'text' )
+                       .byteLimit( 14 ),
+               sample: mbSample,
+               expected: '1234567890' + U_20AC + '1'
+       } );
+
+       byteLimitTest( {
+               description: 'Limit using a custom value (multibyte, outside BMP)',
+               $input: $( '<input>' ).attr( 'type', 'text' )
+                       .byteLimit( 3 ),
+               sample: poop,
+               expected: ''
+       } );
+
+       byteLimitTest( {
+               description: 'Limit using a custom value (multibyte) overlapping a byte',
+               $input: $( '<input>' ).attr( 'type', 'text' )
+                       .byteLimit( 12 ),
+               sample: mbSample,
+               expected: '123456789012'
+       } );
+
+       byteLimitTest( {
+               description: 'Pass the limit and a callback as input filter',
+               $input: $( '<input>' ).attr( 'type', 'text' )
+                       .byteLimit( 6, function ( val ) {
+                               var title = mw.Title.newFromText( String( val ) );
+                               // Return without namespace prefix
+                               return title ? title.getMain() : '';
+                       } ),
+               sample: 'User:Sample',
+               expected: 'User:Sample'
+       } );
+
+       byteLimitTest( {
+               description: 'Limit using the maxlength attribute and pass a callback as input filter',
+               $input: $( '<input>' ).attr( 'type', 'text' )
+                       .attr( 'maxlength', '6' )
+                       .byteLimit( function ( val ) {
+                               var title = mw.Title.newFromText( String( val ) );
+                               // Return without namespace prefix
+                               return title ? title.getMain() : '';
+                       } ),
+               sample: 'User:Sample',
+               expected: 'User:Sample'
+       } );
+
+       byteLimitTest( {
+               description: 'Pass the limit and a callback as input filter',
+               $input: $( '<input>' ).attr( 'type', 'text' )
+                       .byteLimit( 6, function ( val ) {
+                               var title = mw.Title.newFromText( String( val ) );
+                               // Return without namespace prefix
+                               return title ? title.getMain() : '';
+                       } ),
+               sample: 'User:Example',
+               // The callback alters the value to be used to calculeate
+               // the length. The altered value is "Exampl" which has
+               // a length of 6, the "e" would exceed the limit.
+               expected: 'User:Exampl'
+       } );
+
+       byteLimitTest( {
+               description: 'Input filter that increases the length',
+               $input: $( '<input>' ).attr( 'type', 'text' )
+                       .byteLimit( 10, function ( text ) {
+                               return 'prefix' + text;
+                       } ),
+               sample: simpleSample,
+               // Prefix adds 6 characters, limit is reached after 4
+               expected: '1234'
+       } );
+
+       // Regression tests for T43450
+       byteLimitTest( {
+               description: 'Input filter of which the base exceeds the limit',
+               $input: $( '<input>' ).attr( 'type', 'text' )
+                       .byteLimit( 3, function ( text ) {
+                               return 'prefix' + text;
+                       } ),
+               sample: simpleSample,
+               expected: ''
+       } );
+
+       QUnit.test( 'Confirm properties and attributes set', function ( assert ) {
+               var $el;
+
+               $el = $( '<input>' ).attr( 'type', 'text' )
+                       .attr( 'maxlength', '7' )
+                       .appendTo( '#qunit-fixture' )
+                       .byteLimit();
+
+               assert.strictEqual( $el.attr( 'maxlength' ), '7', 'maxlength attribute unchanged for simple limit' );
+
+               $el = $( '<input>' ).attr( 'type', 'text' )
+                       .attr( 'maxlength', '7' )
+                       .appendTo( '#qunit-fixture' )
+                       .byteLimit( 12 );
+
+               assert.strictEqual( $el.attr( 'maxlength' ), '12', 'maxlength attribute updated for custom limit' );
+
+               $el = $( '<input>' ).attr( 'type', 'text' )
+                       .attr( 'maxlength', '7' )
+                       .appendTo( '#qunit-fixture' )
+                       .byteLimit( 12, function ( val ) {
+                               return val;
+                       } );
+
+               assert.strictEqual( $el.attr( 'maxlength' ), undefined, 'maxlength attribute removed for limit with callback' );
+
+               $( '<input>' ).attr( 'type', 'text' )
+                       .addClass( 'mw-test-byteLimit-foo' )
+                       .attr( 'maxlength', '7' )
+                       .appendTo( '#qunit-fixture' );
+
+               $( '<input>' ).attr( 'type', 'text' )
+                       .addClass( 'mw-test-byteLimit-foo' )
+                       .attr( 'maxlength', '12' )
+                       .appendTo( '#qunit-fixture' );
+
+               $el = $( '.mw-test-byteLimit-foo' );
+
+               assert.strictEqual( $el.length, 2, 'Verify that there are no other elements clashing with this test suite' );
+
+               $el.byteLimit();
+       } );
+
+       QUnit.test( 'Trim from insertion when limit exceeded', function ( assert ) {
+               var $el;
+
+               // Use a new <input> because the bug only occurs on the first time
+               // the limit it reached (T42850)
+               $el = $( '<input>' ).attr( 'type', 'text' )
+                       .appendTo( '#qunit-fixture' )
+                       .byteLimit( 3 )
+                       .val( 'abc' ).trigger( 'change' )
+                       .val( 'zabc' ).trigger( 'change' );
+
+               assert.strictEqual( $el.val(), 'abc', 'Trim from the insertion point (at 0), not the end' );
+
+               $el = $( '<input>' ).attr( 'type', 'text' )
+                       .appendTo( '#qunit-fixture' )
+                       .byteLimit( 3 )
+                       .val( 'abc' ).trigger( 'change' )
+                       .val( 'azbc' ).trigger( 'change' );
+
+               assert.strictEqual( $el.val(), 'abc', 'Trim from the insertion point (at 1), not the end' );
+       } );
+
+       QUnit.test( 'Do not cut up false matching substrings in emoji insertions', function ( assert ) {
+               var $el,
+                       oldVal = '\uD83D\uDCA9\uD83D\uDCA9', // "💩💩"
+                       newVal = '\uD83D\uDCA9\uD83D\uDCB9\uD83E\uDCA9\uD83D\uDCA9', // "💩💹🢩💩"
+                       expected = '\uD83D\uDCA9\uD83D\uDCB9\uD83D\uDCA9'; // "💩💹💩"
+
+               // Possible bad results:
+               // * With no surrogate support:
+               //   '\uD83D\uDCA9\uD83D\uDCB9\uD83E\uDCA9' "💩💹🢩"
+               // * With correct trimming but bad detection of inserted text:
+               //   '\uD83D\uDCA9\uD83D\uDCB9\uDCA9' "💩💹�"
+
+               $el = $( '<input>' ).attr( 'type', 'text' )
+                       .appendTo( '#qunit-fixture' )
+                       .byteLimit( 12 )
+                       .val( oldVal ).trigger( 'change' )
+                       .val( newVal ).trigger( 'change' );
+
+               assert.strictEqual( $el.val(), expected, 'Pasted emoji correctly trimmed at the end' );
+       } );
+
+       byteLimitTest( {
+               description: 'Unpaired surrogates do not crash',
+               $input: $( '<input>' ).attr( 'type', 'text' ).byteLimit( 4 ),
+               sample: '\uD800\uD800\uDFFF',
+               expected: '\uD800'
+       } );
+
+}( jQuery, mediaWiki ) );