Daniel@0: "use strict"; Daniel@0: Daniel@0: App.addInitializer(function(options){ Daniel@0: var _this = this; Daniel@0: Daniel@0: if (!_.isUndefined(options.enableJasmine)) { Daniel@0: var $document = $(document); Daniel@0: if (!options.enableJasmine) { Daniel@0: // turn jasmine on Daniel@0: $document.bind("keydown", "j", function(event) { Daniel@0: var url = location.protocol+'//'+location.host+location.pathname; Daniel@0: if (url.indexOf('?') > -1) { Daniel@0: url += '&jasmine'; Daniel@0: } else { Daniel@0: url += '?jasmine'; Daniel@0: } Daniel@0: window.location.href = url; Daniel@0: }); Daniel@0: } else { Daniel@0: executeJasmine(); Daniel@0: // turn jasmine off Daniel@0: $document.bind("keydown", "shift+j", function(event) { Daniel@0: var url = location.protocol+'//'+location.host+location.pathname; Daniel@0: Daniel@0: _.each(["jasmine", "catch"], function(variable) { Daniel@0: url = url Daniel@0: .replace(new RegExp("\\?" + variable + "[=]?[a-zA-Z%0-9]*&", "g"), "?") Daniel@0: .replace(new RegExp("\\?" + variable + "[=]?[a-zA-Z%0-9]*$", "g"), "") Daniel@0: .replace(new RegExp("\\&" + variable + "[=]?[a-zA-Z%0-9]*&", "g"), "&") Daniel@0: .replace(new RegExp("\\&" + variable + "[=]?[a-zA-Z%0-9]*$", "g"), ""); Daniel@0: }); Daniel@0: Daniel@0: url = url Daniel@0: .replace(/\?+/, "?") Daniel@0: .replace(/\?$/, ""); Daniel@0: Daniel@0: window.location.href = url; Daniel@0: }); Daniel@0: } Daniel@0: Daniel@0: Daniel@0: Daniel@0: } Daniel@0: });