-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jean-Yves NOLEN
committed
May 27, 2020
1 parent
5781076
commit a972c59
Showing
1 changed file
with
6 additions
and
8 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,24 @@ | ||
function injectScript(file, node) { | ||
var th = document.getElementsByTagName(node)[0]; | ||
var s = document.createElement('script'); | ||
let injectScript = function(file, node) { | ||
let th = document.getElementsByTagName(node)[0]; | ||
let s = document.createElement('script'); | ||
s.setAttribute('type', 'text/javascript'); | ||
s.setAttribute('src', file); | ||
th.appendChild(s); | ||
} | ||
|
||
function checkForSplunk() | ||
let checkForSplunk = function() | ||
{ | ||
const metas = document.getElementsByTagName('meta'); | ||
for (let i = 0; i < metas.length; i++) { | ||
if (metas[i].getAttribute('name') === "author") { | ||
return metas[i].getAttribute('content') === "Splunk Inc."; | ||
} | ||
} | ||
return False | ||
return false; | ||
}; | ||
|
||
if(checkForSplunk()) | ||
{ | ||
injectScript( chrome.extension.getURL('splunk_xml.js'), 'body' ); | ||
injectScript( "//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.0.3/highlight.min.js", 'body'); | ||
} | ||
|
||
console.log("Ok module load") | ||
} |