Last active
March 14, 2024 09:30
-
-
Save cosmosgenius/fca001e88c8348f0b0a5c72501d17439 to your computer and use it in GitHub Desktop.
Tampermonkey script for scope injection in irene
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Irene Globals | |
// @namespace https://appknox.com/ | |
// @version 2.0.0 | |
// @description load irene globals for console operations | |
// @author cosmosgenius | |
// @match http://irene.local:4200/* | |
// @match http://localhost:4200/* | |
// @match https://secure.appknox.com/* | |
// @icon https://secure.appknox.com/images/favicon.ico | |
// @run-at document-idle | |
// @grant none | |
// ==/UserScript== | |
function load(Ember, require, window) { | |
var app = Ember.A(Ember.Namespace.NAMESPACES).find( | |
(_) => _ instanceof Ember.Application | |
); | |
if(!app.__container__) { | |
return | |
} | |
var store = app.__container__.lookup("service:store"); | |
var env = require(`${app.modulePrefix}/config/environment`).default; | |
var organization = app.__container__.lookup("service:organization"); | |
var ajax = app.__container__.lookup("service:ajax"); | |
var me = app.__container__.lookup("service:me"); | |
var router = app.__container__.lookup("router:main"); | |
var notification = app.__container__.lookup("service:notifications"); | |
var config = app.__container__.lookup("service:configuration"); | |
var whitelabel = app.__container__.lookup("service:whitelabel"); | |
var appmonitoring = app.__container__.lookup("service:appmonitoring"); | |
window.app = app; | |
window.store = store; | |
window.env = env; | |
window.organization = organization; | |
window.ajax = ajax; | |
window.me = me; | |
window.router = router; | |
window.notification = notification; | |
window.config = config; | |
window.whitelabel = whitelabel; | |
window.appmonitoring = appmonitoring; | |
} | |
(function (requireModule, require, window) { | |
var Ember = window.Ember || requireModule('ember')['default']; | |
window.ilg = function() { | |
Ember.run.scheduleOnce("afterRender", function () { | |
load(Ember, require, window); | |
}) | |
} | |
})(requireModule, require, window); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment