annotate src/DML/MainVisBundle/Resources/assets/marionette/App.95-jasmine.js @ 1:f38015048f48 tip

Added GPL
author Daniel Wolff
date Sat, 13 Feb 2016 20:43:38 +0100
parents 493bcb69166c
children
rev   line source
Daniel@0 1 "use strict";
Daniel@0 2
Daniel@0 3 App.addInitializer(function(options){
Daniel@0 4 var _this = this;
Daniel@0 5
Daniel@0 6 if (!_.isUndefined(options.enableJasmine)) {
Daniel@0 7 var $document = $(document);
Daniel@0 8 if (!options.enableJasmine) {
Daniel@0 9 // turn jasmine on
Daniel@0 10 $document.bind("keydown", "j", function(event) {
Daniel@0 11 var url = location.protocol+'//'+location.host+location.pathname;
Daniel@0 12 if (url.indexOf('?') > -1) {
Daniel@0 13 url += '&jasmine';
Daniel@0 14 } else {
Daniel@0 15 url += '?jasmine';
Daniel@0 16 }
Daniel@0 17 window.location.href = url;
Daniel@0 18 });
Daniel@0 19 } else {
Daniel@0 20 executeJasmine();
Daniel@0 21 // turn jasmine off
Daniel@0 22 $document.bind("keydown", "shift+j", function(event) {
Daniel@0 23 var url = location.protocol+'//'+location.host+location.pathname;
Daniel@0 24
Daniel@0 25 _.each(["jasmine", "catch"], function(variable) {
Daniel@0 26 url = url
Daniel@0 27 .replace(new RegExp("\\?" + variable + "[=]?[a-zA-Z%0-9]*&", "g"), "?")
Daniel@0 28 .replace(new RegExp("\\?" + variable + "[=]?[a-zA-Z%0-9]*$", "g"), "")
Daniel@0 29 .replace(new RegExp("\\&" + variable + "[=]?[a-zA-Z%0-9]*&", "g"), "&")
Daniel@0 30 .replace(new RegExp("\\&" + variable + "[=]?[a-zA-Z%0-9]*$", "g"), "");
Daniel@0 31 });
Daniel@0 32
Daniel@0 33 url = url
Daniel@0 34 .replace(/\?+/, "?")
Daniel@0 35 .replace(/\?$/, "");
Daniel@0 36
Daniel@0 37 window.location.href = url;
Daniel@0 38 });
Daniel@0 39 }
Daniel@0 40
Daniel@0 41
Daniel@0 42
Daniel@0 43 }
Daniel@0 44 });