delete surplus files. Fix gulp serve setup for local web testing.

This commit is contained in:
Nils Norman Haukås 2015-11-14 19:38:34 +01:00
parent 59412048d7
commit 6f05e601b7
9 changed files with 19 additions and 44 deletions

View file

@ -29,7 +29,7 @@ gulp.task('tmp', ['scripts', 'dist-node-modules'], function () {
return gulp.src([
'src/**/*.html',
'src/**/*.css',
'src/content_script_web.js'
'src/load-menu-for-web-testing.js'
], {base: 'src'})
.pipe($.flatten())
.pipe($.fileInclude({
@ -44,7 +44,7 @@ gulp.task('dist', ['tmp'], function () {
var tmp = gulp.src([
'tmp/**/*',
'!tmp/index.html',
'!tmp/content_script_web.js'
'!tmp/load-menu-for-web-testing.js'
], {base: 'tmp'});
var imageAssets = gulp.src('src/plugin-specific/*.png').pipe($.flatten());
var chromePluginResources = gulp.src([

View file

@ -1,12 +0,0 @@
// used for local web testing
@@include('content_script_include.js')
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();
});
});

View file

@ -8,7 +8,7 @@
<script src="https://code.jquery.com/jquery-1.11.3.js"></script>
<script src="vendor/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.0/angular.min.js"></script>
<script src="content_script_web.js"></script>
<script src="load-menu-for-web-testing.js"></script>
</head>
<body class="container">

View file

@ -26,7 +26,7 @@ module tagIt {
if(chrome && chrome.extension) {
return chrome.extension.getURL(relativeUrl);
} else {
relativeUrl;
return relativeUrl;
}
}
}

View file

@ -1,4 +1,13 @@
// Code used by both the local web prototype as well as the plugin.
// Script loader for local web page testing
injectScripts();
document.addEventListener("DOMContentLoaded", function(event) {
document.getElementById('js-show-menu')
.addEventListener('click', function () {
if (!document.getElementById('tagit-menu')) injectScripts();
});
});
function injectScripts () {
@ -33,16 +42,8 @@ function injectScripts () {
}
function loadScript (relativeScriptPath, callback) {
function translateToPluginPath (relativeScriptPath) {
// if "chrome" present, we deduce that we're running as a plugin
if (chrome && chrome.extension) {
return chrome.extension.getURL(relativeScriptPath);
} else {
return relativeScriptPath;
}
}
var s = document.createElement('script');
s.src = translateToPluginPath(relativeScriptPath);
s.src = relativeScriptPath;
s.onload = function() {
this.parentNode.removeChild(this);
if (callback) callback();

View file

@ -31,7 +31,7 @@ module tagIt {
onSenseSelect (sense: ISense) {
this.webPageService.addTagToPage(sense);
this.backendService.storeTaggingInformation(
this.backendService.sendTaggedDataToServer(
sense,
this.webPageService.currentSelectionRange,
this.selectedWord,

View file

@ -1,13 +0,0 @@
// used for chrome plugin, injected by popup.js
@@include('../content_script_include.js')
log('content script was added!');
injectScripts();
// todo wire up listeners
function log (msg) {
console.log(msg);
}

View file

@ -27,10 +27,9 @@ module tagIt {
return synsets.data.senses;
}
// save tagging information
// Params: email, tagging, sentence
storeTaggingInformation (sense: ISense, range: Range, selectedWord: string, userEmail: string) {
this.$log.debug('storeTaggingInformation() was called');
sendTaggedDataToServer (sense: ISense, range: Range,
selectedWord: string, userEmail: string) {
this.$log.debug('sendTaggedDataToServer() was called');
var messageToSendToServer = {
sense: sense,
range: range,