diff --git a/deps/rabbitmq_management/priv/www/index.html b/deps/rabbitmq_management/priv/www/index.html index 3d22d816f8db..ca48900bdfec 100644 --- a/deps/rabbitmq_management/priv/www/index.html +++ b/deps/rabbitmq_management/priv/www/index.html @@ -13,6 +13,7 @@ + diff --git a/deps/rabbitmq_management/priv/www/js/dispatcher.js b/deps/rabbitmq_management/priv/www/js/dispatcher.js index 5789bc1b7254..4e4f09cd4fae 100644 --- a/deps/rabbitmq_management/priv/www/js/dispatcher.js +++ b/deps/rabbitmq_management/priv/www/js/dispatcher.js @@ -1,69 +1,3 @@ -(function (factory) { - if (typeof define === 'function' && define.amd) { - define(['jquery', 'sammy'], factory); - } else { - (window.Sammy = window.Sammy || {}).Title = factory(window.jQuery, window.Sammy); - } -}(function ($, Sammy) { - - // Sammy.Title is a very simple plugin to easily set the document's title. - // It supplies a helper for setting the title (`title()`) within routes, - // and an app level method for setting the global title (`setTitle()`) - Sammy.Title = function() { - - // setTitle allows setting a global title or a function that modifies the - // title for each route/page. - // - // ### Example - // - // // setting a title prefix - // $.sammy(function() { - // - // this.setTitle('My App -'); - // - // this.get('#/', function() { - // this.title('Home'); // document's title == "My App - Home" - // }); - // }); - // - // // setting a title with a function - // $.sammy(function() { - // - // this.setTitle(function(title) { - // return [title, " /// My App"].join(''); - // }); - // - // this.get('#/', function() { - // this.title('Home'); // document's title == "Home /// My App"; - // }); - // }); - // - this.setTitle = function(title) { - if (!$.isFunction(title)) { - this.title_function = function(additional_title) { - return [title, additional_title].join(' '); - } - } else { - this.title_function = title; - } - }; - - // *Helper* title() sets the document title, passing it through the function - // defined by setTitle() if set. - this.helper('title', function() { - var new_title = $.makeArray(arguments).join(' '); - if (this.app.title_function) { - new_title = this.app.title_function(new_title); - } - document.title = new_title; - }); - - }; - - return Sammy.Title; - -})); - dispatcher_add(function(sammy) { function path(p, r, t) { sammy.get(p, function() { diff --git a/deps/rabbitmq_management/priv/www/js/title.js b/deps/rabbitmq_management/priv/www/js/title.js new file mode 100644 index 000000000000..5ca31d90dff8 --- /dev/null +++ b/deps/rabbitmq_management/priv/www/js/title.js @@ -0,0 +1,64 @@ +(function (factory) { + if (typeof define === "function" && define.amd) { + define(["jquery", "sammy"], factory); + } else { + (window.Sammy = window.Sammy || {}).Title = factory( + window.jQuery, + window.Sammy, + ); + } +})(function ($, Sammy) { + // Sammy.Title is a very simple plugin to easily set the document's title. + // It supplies a helper for setting the title (`title()`) within routes, + // and an app level method for setting the global title (`setTitle()`) + Sammy.Title = function () { + // setTitle allows setting a global title or a function that modifies the + // title for each route/page. + // + // ### Example + // + // // setting a title prefix + // $.sammy(function() { + // + // this.setTitle('My App -'); + // + // this.get('#/', function() { + // this.title('Home'); // document's title == "My App - Home" + // }); + // }); + // + // // setting a title with a function + // $.sammy(function() { + // + // this.setTitle(function(title) { + // return [title, " /// My App"].join(''); + // }); + // + // this.get('#/', function() { + // this.title('Home'); // document's title == "Home /// My App"; + // }); + // }); + // + this.setTitle = function (title) { + if (!$.isFunction(title)) { + this.title_function = function (additional_title) { + return [title, additional_title].join(" "); + }; + } else { + this.title_function = title; + } + }; + + // *Helper* title() sets the document title, passing it through the function + // defined by setTitle() if set. + this.helper("title", function () { + var new_title = $.makeArray(arguments).join(" "); + if (this.app.title_function) { + new_title = this.app.title_function(new_title); + } + document.title = new_title; + }); + }; + + return Sammy.Title; +});