From f1aaad3c2292cab9491ad3be9a28a2579aba72dd Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Tue, 17 Dec 2013 17:54:21 +0000 Subject: [PATCH] digital bumper sticker: fix so it doesn't cause JS errors when IITC is running --- plugins/iitc-ditigal-bumper-sticker.user.js | 23 ++++++++++++--------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/plugins/iitc-ditigal-bumper-sticker.user.js b/plugins/iitc-ditigal-bumper-sticker.user.js index d2ceb91d..489e39ae 100644 --- a/plugins/iitc-ditigal-bumper-sticker.user.js +++ b/plugins/iitc-ditigal-bumper-sticker.user.js @@ -2,7 +2,7 @@ // @id iitc-digital-bumper-sticker // @name IITC Digital Bumper Sticker // @category Stock -// @version 0.1.0.@@DATETIMEVERSION@@ +// @version 0.1.1.@@DATETIMEVERSION@@ // @namespace https://github.com/jonatkins/ingress-intel-total-conversion // @updateURL @@UPDATEURL@@ // @downloadURL @@DOWNLOADURL@@ @@ -14,13 +14,16 @@ // @grant none // ==/UserScript== -var logoDiv = document.createElement('div'); -logoDiv.setAttribute('style', "position: fixed; left: 20px; top: 130px; z-index: auto; pointer-events: none;"); - -var img = document.createElement('img'); -img.setAttribute('src', 'http://iitc.jonatkins.com/assets/img/prefer-iitc-200.png'); - -logoDiv.appendChild(img); - var targetContainer = document.getElementById('dashboard_container'); -targetContainer.appendChild(logoDiv); +if (targetContainer) { + + var logoDiv = document.createElement('div'); + logoDiv.setAttribute('style', "position: fixed; left: 20px; top: 130px; z-index: auto; pointer-events: none;"); + + var img = document.createElement('img'); + img.setAttribute('src', 'http://iitc.jonatkins.com/assets/img/prefer-iitc-200.png'); + + logoDiv.appendChild(img); + + targetContainer.appendChild(logoDiv); +}