From 6df98cb5e9ed60c8260a7b4b91150ef2c5d6450a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nils=20Norman=20Hauk=C3=A5s?= Date: Sat, 24 Oct 2015 17:26:47 +0200 Subject: [PATCH] tweaked interface for when viewing the prototype --- src/content_script_include.js | 16 ++++++++-------- src/content_script_web.js | 7 +++++++ src/index.html | 12 +++++++++--- src/menu/menu.tpl.html | 2 +- 4 files changed, 25 insertions(+), 12 deletions(-) diff --git a/src/content_script_include.js b/src/content_script_include.js index 16b985a..d3a24d5 100644 --- a/src/content_script_include.js +++ b/src/content_script_include.js @@ -1,12 +1,12 @@ -// Save a copy of existing angular js and jquery -// Source: http://www.mattburkedev.com/multiple-angular-versions-on-the-same-page/ -var existingWindowDotAngular = window['angular']; -// create a new window.angular and a closure variable for -// angular.js to load itself into -var angular = (window.angular = {}); - function injectScripts () { + // Save a copy of existing angular js and jquery + // Source: http://www.mattburkedev.com/multiple-angular-versions-on-the-same-page/ + var existingWindowDotAngular = window['angular']; + // create a new window.angular and a closure variable for + // angular.js to load itself into + var angular = (window.angular = {}); + loadScript('vendor/jquery/dist/jquery.js', loadAngular); function loadAngular () { @@ -33,7 +33,7 @@ function injectScripts () { var s = document.createElement('script'); s.src = scriptName; s.onload = function() { - // this.parentNode.removeChild(this); + this.parentNode.removeChild(this); if (callback) callback(); }; (document.head||document.documentElement).appendChild(s); diff --git a/src/content_script_web.js b/src/content_script_web.js index d009f53..b8e78f0 100644 --- a/src/content_script_web.js +++ b/src/content_script_web.js @@ -4,6 +4,13 @@ injectScripts(); //found in the included file +document.addEventListener("DOMContentLoaded", function(event) { + document.getElementById('js-show-menu') + .addEventListener('click', function () { + if (!document.getElementById('tagit-menu')) injectScripts(); + }); +}); + // will be called within a angular service function storeTagData (tagData) { console.log('storeTagDataInBrowser was called'); diff --git a/src/index.html b/src/index.html index fdbe58e..d9b4781 100644 --- a/src/index.html +++ b/src/index.html @@ -16,9 +16,15 @@
- + +
+ + +

Sample text

diff --git a/src/menu/menu.tpl.html b/src/menu/menu.tpl.html index 3271558..5986fcf 100644 --- a/src/menu/menu.tpl.html +++ b/src/menu/menu.tpl.html @@ -4,7 +4,7 @@

Tag you're it