Kevstoy has submitted this change and it was merged.
Change subject: * Removed console.log statement in BreadCrumbs.js * Set cookie
expiration for 30 days so that crumbs will persist past * session * Added check
for "Badtitle" to prevent erroneus pages from becoming * crumbs
......................................................................
* Removed console.log statement in BreadCrumbs.js
* Set cookie expiration for 30 days so that crumbs will persist past
* session
* Added check for "Badtitle" to prevent erroneus pages from becoming
* crumbs
Change-Id: Ib17f5feda52c0620b0861a8b02f9b2114289164c
---
M JSBreadCrumbs.php
M js/BreadCrumbs.js
2 files changed, 16 insertions(+), 10 deletions(-)
Approvals:
Kevstoy: Verified; Looks good to me, approved
diff --git a/JSBreadCrumbs.php b/JSBreadCrumbs.php
index 8ac99d4..e3525f6 100644
--- a/JSBreadCrumbs.php
+++ b/JSBreadCrumbs.php
@@ -36,7 +36,7 @@
'path' => __FILE__,
'name' => 'JSBreadCrumbs',
'author' => 'Ryan Lane',
- 'version' => '0.6.1',
+ 'version' => '0.6.2',
'url' =>
'https://www.mediawiki.org/wiki/Extension:JSBreadCrumbs',
'descriptionmsg' => 'jsbreadcrumbs-desc',
);
diff --git a/js/BreadCrumbs.js b/js/BreadCrumbs.js
index 5270a39..87da3f2 100644
--- a/js/BreadCrumbs.js
+++ b/js/BreadCrumbs.js
@@ -15,8 +15,8 @@
var pervasiveWikiFarm =
mw.config.get('wgJSBreadCrumbsPervasiveWikiFarm');
var cookieNameSuffix = "-" + siteName;
- console.log("PervasiveWikiFarm:" + pervasiveWikiFarm);
-
+ if(endsWith(crumbsPageName, "Badtitle")) {
+ }
if ( typeof maxCrumbs == "undefined" ) {
maxCrumbs = 5;
}
@@ -81,10 +81,11 @@
}
// Add the current page
- titleState.push( title );
- urlState.push( location.pathname + location.search );
- siteState.push( siteName );
-
+ if(!endsWith(crumbsPageName, "Badtitle")) {
+ titleState.push( title );
+ urlState.push( location.pathname + location.search );
+ siteState.push( siteName );
+ }
// Ensure we only display the maximum breadcrumbs set
if ( titleState.length > maxCrumbs ) {
titleState = titleState.slice( titleState.length - maxCrumbs );
@@ -136,9 +137,9 @@
}
}
// Save the bread crumb states to the cookies
- $.cookie( 'mwext-bc-title' + cookieNameSuffix, titleState.join( '|' ),
{ path: cookiePath } );
- $.cookie( 'mwext-bc-url' + cookieNameSuffix, urlState.join( '|' ), {
path: cookiePath } );
- $.cookie( 'mwext-bc-site' + cookieNameSuffix, siteState.join( '|' ), {
path: cookiePath } );
+ $.cookie( 'mwext-bc-title' + cookieNameSuffix, titleState.join( '|' ),
{ path: cookiePath, expires: 30 } );
+ $.cookie( 'mwext-bc-url' + cookieNameSuffix, urlState.join( '|' ), {
path: cookiePath, expires: 30 } );
+ $.cookie( 'mwext-bc-site' + cookieNameSuffix, siteState.join( '|' ), {
path: cookiePath, expires: 30 } );
});
@@ -152,3 +153,8 @@
$(id).append("<div class='portlet' id='p-rv' role='navigation'></div>");
$("#p-rv").append("<h3>Last " + maxCrumbs+ " Pages Viewed</h3><div
class='pBody'><ul id='p-rv-list'></ul></div>");
}
+
+function endsWith(str, suffix) {
+ return str.indexOf(suffix, str.length - suffix.length) !== -1;
+}
+
--
To view, visit https://gerrit.wikimedia.org/r/240850
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib17f5feda52c0620b0861a8b02f9b2114289164c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/JSBreadCrumbs
Gerrit-Branch: master
Gerrit-Owner: Kevstoy <[email protected]>
Gerrit-Reviewer: Kevstoy <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits