Skip to content

Commit 7f9e34a

Browse files
committed
getAppVersion
1 parent eae1a5a commit 7f9e34a

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

view/frontend/web/js/ajaxwishlist.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ define([
3333
this._bind();
3434
this.viewWishlist();
3535
this.closePopup();
36+
this.getAppVersion('Magepow_AjaxWishlist', 'https://magepow.com/magento-2-ajax-wishlist.html');
3637
},
3738

3839
closePopup: function() {
@@ -181,8 +182,17 @@ define([
181182
addToWishlistButton.find('span').text(addToWishlistButtonTextDefault);
182183
addToWishlistButton.attr('title', addToWishlistButtonTextDefault);
183184
}, 1000);
184-
}
185+
},
185186

187+
getAppVersion: function (appName, href) {
188+
// this expression is to get the version string
189+
let regx = new RegExp('.*\/(.*?)\/assets\/', 'i');
190+
let result = regx.exec(href);
191+
let version = result ? result[1].replace(/\D/g, '') : '1.0.0';
192+
console.log(`%c ${appName} %c v${version} %c`, "background: #555555; padding: 1px; margin-bottom: 2px; border-radius: 3px 0 0 3px; color: #fff", "background: #44cc11; padding: 1px; margin-bottom: 2px; border-radius: 0 3px 3px 0; color: #fff", "background:transparent", `🚀 ${href}`);
193+
194+
return version;
195+
}
186196

187197
});
188198

0 commit comments

Comments
 (0)