Gerrit Patch Uploader has uploaded a new change for review. https://gerrit.wikimedia.org/r/225014
Change subject: WikiEditor shouldn't store wrong cookies for booklets ...................................................................... WikiEditor shouldn't store wrong cookies for booklets When additional booklets are created, or existing removed, WikiEditor currently stores one wrong cookie for each new booklet. This is because twice a wrong id is passed as parameter, and because a cookie is set for the default value. This patch fixes these issues. Additionally I replaced in the function that needed to be edited a loose comparison with a strict one ($.cookie will return null, never undefined), and .size() by .length. Bug: T27184 Change-Id: Iacc1c71a1e0fc2307a3a28d9c1bb00967ac9827a --- M modules/jquery.wikiEditor.toolbar.js 1 file changed, 4 insertions(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikiEditor refs/changes/14/225014/1 diff --git a/modules/jquery.wikiEditor.toolbar.js b/modules/jquery.wikiEditor.toolbar.js index 0717b59..0a6d782 100644 --- a/modules/jquery.wikiEditor.toolbar.js +++ b/modules/jquery.wikiEditor.toolbar.js @@ -84,7 +84,7 @@ $.wikiEditor.modules.toolbar.fn.buildBookmark( context, page, data[type][page] ) ); } - $.wikiEditor.modules.toolbar.fn.updateBookletSelection( context, page, $pages, $index ); + $.wikiEditor.modules.toolbar.fn.updateBookletSelection( context, data.section, $pages, $index ); smooth = false; break; case 'rows': @@ -175,7 +175,7 @@ context.modules.toolbar.$toolbar.find( index ).remove(); $.wikiEditor.modules.toolbar.fn.updateBookletSelection( context, - null, + data.section, context.modules.toolbar.$toolbar.find( target ), context.modules.toolbar.$toolbar.find( index ) ); @@ -728,18 +728,16 @@ } }, updateBookletSelection: function ( context, id, $pages, $index ) { - /*jshint eqnull:true */ var cookie = 'wikiEditor-' + context.instance + '-booklet-' + id + '-page'; var selected = $.cookie( cookie ); // Re-save cookie - if ( selected != null ) { + if ( selected !== null ) { $.cookie( cookie, selected, { expires: 30, path: '/' } ); } var $selectedIndex = $index.find( '*[rel="' + selected + '"]' ); - if ( $selectedIndex.size() === 0 ) { + if ( $selectedIndex.length === 0 ) { $selectedIndex = $index.children().eq( 0 ); selected = $selectedIndex.attr( 'rel' ); - $.cookie( cookie, selected, { expires: 30, path: '/' } ); } $pages.children().hide(); $pages.find( '*[rel="' + selected + '"]' ).show(); -- To view, visit https://gerrit.wikimedia.org/r/225014 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iacc1c71a1e0fc2307a3a28d9c1bb00967ac9827a Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikiEditor Gerrit-Branch: master Gerrit-Owner: Gerrit Patch Uploader <gerritpatchuploa...@gmail.com> Gerrit-Reviewer: Schnark <listenle...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits