refactored code a little bit. Fixed gulp serve for firefox.

This commit is contained in:
Nils Norman Haukås 2015-12-06 14:31:42 +01:00
parent af34537c5b
commit 0c36aa90c0
7 changed files with 13547 additions and 27 deletions

View file

@ -5,9 +5,6 @@
<meta charset="UTF-8">
<link href="vendor/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="style.css" rel="stylesheet">
<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="load-menu-for-web-testing.js"></script>
</head>

View file

@ -28,10 +28,10 @@ module tagIt {
});
function chromeUrlTranslator(relativeUrl : string) {
if(chrome && chrome.extension) {
return chrome.extension.getURL(relativeUrl);
} else {
if(typeof chrome === 'undefined' ) {
return relativeUrl;
} else {
return chrome.extension.getURL(relativeUrl);
}
}
}

View file

@ -15,31 +15,16 @@ document.addEventListener("DOMContentLoaded", function(event) {
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 = {});
console.log('loading dependencies');
loadScript('vendor/vendor.js', loadPluginCode);
function loadPluginCode () {
console.log('loading tagit');
loadScript('bundle.js', function () {
tagIt.init(restoreOldAngularAndJquery);
tagIt.init(function () {console.log('tagIt init!')});
});
}
function restoreOldAngularAndJquery () {
// restore old angular
if (existingWindowDotAngular) {
window.angular = existingWindowDotAngular; // restore the old angular version
}
$.noConflict();
}
function loadScript (relativeScriptPath, callback) {
var s = document.createElement('script');
s.src = relativeScriptPath;

View file

@ -8,7 +8,6 @@ module tagIt {
declare var rangy: any;
declare var uuid: any;
declare var _: any;
export class WebPageService {
@ -106,15 +105,15 @@ module tagIt {
readdTagsToPage(tagsToLoad: ISenseTag[]) {
this.$log.debug('readdTagsToPage()');
//first deselect before we go to work
window.getSelection().removeAllRanges();
//deserialize ranges
_.map(tagsToLoad, deserializeRange);
this.$log.debug('finished deserializing tags');
//sort tags by ascending so that they can be properly inserted
tagsToLoad = _.sortBy(tagsToLoad, (tag: ISenseTag) => {
return tag.deserializedRange.startOffset;
@ -148,7 +147,7 @@ module tagIt {
}
}
}
private updateSavedSelection() {
if (this.savedSelection) {
rangy.removeMarkers(this.savedSelection);

View file

@ -25,6 +25,9 @@
},
"chrome/chrome.d.ts": {
"commit": "3191f6e0088eee07c4d8fd24e4d27a40a60d9eb9"
},
"lodash/lodash.d.ts": {
"commit": "e5a27ea95e47b95333784f1f0d590127b4e39a89"
}
}
}

13535
typings/lodash/lodash.d.ts vendored Normal file

File diff suppressed because it is too large Load diff

1
typings/tsd.d.ts vendored
View file

@ -6,3 +6,4 @@
/// <reference path="filesystem/filesystem.d.ts" />
/// <reference path="filewriter/filewriter.d.ts" />
/// <reference path="webrtc/MediaStream.d.ts" />
/// <reference path="lodash/lodash.d.ts" />