Socket
Socket
Sign inDemoInstall

oojs-router

Package Overview
Dependencies
Maintainers
25
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oojs-router - npm Package Compare versions

Comparing version 0.3.0 to 0.4.0

10

dist/oojs-router.js
/*!
* OOjs Router v0.3.0
* OOjs Router v0.4.0
* https://www.mediawiki.org/wiki/OOjs_Router
*
* Copyright 2011-2021 OOjs Team and other contributors.
* Copyright 2011-2024 OOjs Team and other contributors.
* Released under the MIT license
* http://oojs.mit-license.org
*
* Date: 2021-09-09T23:45:47Z
* Date: 2024-03-01T14:46:25Z
*/

@@ -30,7 +30,7 @@ ( function ( $ ) {

$( window ).on( 'popstate', function () {
window.addEventListener( 'popstate', function () {
router.emit( 'popstate' );
} );
$( window ).on( 'hashchange', function () {
window.addEventListener( 'hashchange', function () {
router.emit( 'hashchange' );

@@ -37,0 +37,0 @@ } );

@@ -1,3 +0,3 @@

/*! OOjs Router v0.3.0 | http://oojs.mit-license.org */
!function(i){"use strict";OO.Router=function(){var e=this;OO.Router.parent.call(this),this.enabled=!0,this.oldHash=this.getPath(),i(window).on("popstate",function(){e.emit("popstate")}),i(window).on("hashchange",function(){e.emit("hashchange")}),this.on("hashchange",function(){var t;e.enabled?(t=i.Event("route",{path:e.getPath()}),e.emit("route",t),t.isDefaultPrevented()?(e.enabled=!1,e.navigate(e.oldHash)):e.checkRoute()):e.enabled=!0,e.oldHash=e.getPath()})},OO.inheritClass(OO.Router,OO.Registry),OO.Router.static.isSupported=function(){return"onhashchange"in window},OO.Router.prototype.checkRoute=function(){var t,e,o,i=this.getPath();for(t in this.registry)if(e=this.registry[t],o=i.match(e.path))return void e.callback.apply(this,o.slice(1))},OO.Router.prototype.addRoute=function(t,e){var o={path:"string"==typeof t?new RegExp("^"+t.replace(/[\\^$*+?.()|[\]{}]/g,"\\$&")+"$"):t,callback:e};this.register(o.path.toString(),o)},OO.Router.prototype.route=OO.Router.prototype.addRoute,OO.Router.prototype.navigateTo=function(t,e){e.useReplaceState?history.replaceState(null,t,e.path):history.pushState(null,t,e.path)},OO.Router.prototype.navigate=function(t){""===t?(t=window.location.href.replace(/#.*$/,""),history.pushState(null,document.title,t),this.checkRoute()):window.location.hash=t},OO.Router.prototype.back=function(){var t,e=this,o=i.Deferred();return this.once("popstate",function(){clearTimeout(t),o.resolve()}),window.history.back(),t=setTimeout(function(){e.off("popstate"),o.resolve()},50),o.promise()},OO.Router.prototype.getPath=function(){return window.location.hash.slice(1)},OO.Router.prototype.isSupported=OO.Router.static.isSupported,"undefined"!=typeof module&&module.exports&&(module.exports=OO.Router)}(jQuery);
/*! OOjs Router v0.4.0 | http://oojs.mit-license.org */
!function(i){"use strict";OO.Router=function(){var e=this;OO.Router.parent.call(this),this.enabled=!0,this.oldHash=this.getPath(),window.addEventListener("popstate",function(){e.emit("popstate")}),window.addEventListener("hashchange",function(){e.emit("hashchange")}),this.on("hashchange",function(){var t;e.enabled?(t=i.Event("route",{path:e.getPath()}),e.emit("route",t),t.isDefaultPrevented()?(e.enabled=!1,e.navigate(e.oldHash)):e.checkRoute()):e.enabled=!0,e.oldHash=e.getPath()})},OO.inheritClass(OO.Router,OO.Registry),OO.Router.static.isSupported=function(){return"onhashchange"in window},OO.Router.prototype.checkRoute=function(){var t,e,o,i=this.getPath();for(t in this.registry)if(e=this.registry[t],o=i.match(e.path))return void e.callback.apply(this,o.slice(1))},OO.Router.prototype.addRoute=function(t,e){t={path:"string"==typeof t?new RegExp("^"+t.replace(/[\\^$*+?.()|[\]{}]/g,"\\$&")+"$"):t,callback:e};this.register(t.path.toString(),t)},OO.Router.prototype.route=OO.Router.prototype.addRoute,OO.Router.prototype.navigateTo=function(t,e){e.useReplaceState?history.replaceState(null,t,e.path):history.pushState(null,t,e.path)},OO.Router.prototype.navigate=function(t){""===t?(t=window.location.href.replace(/#.*$/,""),history.pushState(null,document.title,t),this.checkRoute()):window.location.hash=t},OO.Router.prototype.back=function(){var t,e=this,o=i.Deferred();return this.once("popstate",function(){clearTimeout(t),o.resolve()}),window.history.back(),t=setTimeout(function(){e.off("popstate"),o.resolve()},50),o.promise()},OO.Router.prototype.getPath=function(){return window.location.hash.slice(1)},OO.Router.prototype.isSupported=OO.Router.static.isSupported,"undefined"!=typeof module&&module.exports&&(module.exports=OO.Router)}(jQuery);
//# sourceMappingURL=oojs-router.min.js.map
{
"name": "oojs-router",
"version": "0.3.0",
"version": "0.4.0",
"description": "Object-oriented navigation routing library built on top of OOjs.",

@@ -27,21 +27,21 @@ "keywords": [

"dependencies": {
"oojs": "6.0.0",
"jquery": "3.6.0"
"jquery": "3.6.0",
"oojs": "6.0.0"
},
"devDependencies": {
"eslint-config-wikimedia": "0.20.0",
"grunt": "1.4.0",
"eslint-config-wikimedia": "0.24.0",
"grunt": "1.6.1",
"grunt-contrib-clean": "2.0.0",
"grunt-contrib-concat": "1.0.1",
"grunt-contrib-uglify": "4.0.1",
"grunt-eslint": "23.0.0",
"grunt-karma": "4.0.0",
"karma": "6.3.2",
"grunt-contrib-concat": "2.0.0",
"grunt-contrib-uglify": "5.0.1",
"grunt-eslint": "24.0.0",
"grunt-karma": "4.0.2",
"karma": "6.3.18",
"karma-chrome-launcher": "3.1.0",
"karma-coverage": "2.0.3",
"karma-firefox-launcher": "2.1.0",
"karma-firefox-launcher": "2.1.2",
"karma-qunit": "4.1.2",
"qunit": "2.16.0",
"sinon": "9.0.2"
"qunit": "2.19.4",
"sinon": "12.0.1"
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc