tweaked interface for when viewing the prototype

This commit is contained in:
Nils Norman Haukås 2015-10-24 17:26:47 +02:00
parent 8ce46e4b67
commit 6df98cb5e9
4 changed files with 25 additions and 12 deletions

View file

@ -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);

View file

@ -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');

View file

@ -16,9 +16,15 @@
<br/>
<!-- Let's pretend this is the button for activating the plugin -->
<button id="js-show-menu" class="btn btn-default">
Start tagging (just for testing)
</button>
<div class="clearfix">
<button id="js-show-menu" class="btn btn-default">
Open menu
</button>
<button id="js-reset-tags" class="btn btn-default">
Reset tags
</button>
</div>
<div>
<h1>Sample text</h1>

View file

@ -4,7 +4,7 @@
<br/>
<button ng-click="vm.removeMenu()" class="btn btn-default">
Done tagging
Close menu
</button>
<h2>Tag you're it</h2>