2015-10-18 20:05:30 +02:00
|
|
|
/// <reference path="../typings/tsd.d.ts" />
|
2015-10-17 14:12:04 +02:00
|
|
|
|
2015-10-21 22:05:49 +02:00
|
|
|
/// <reference path="menu/menu.controller.ts" />
|
|
|
|
/// <reference path="services/data.service.ts" />
|
|
|
|
/// <reference path="services/selectedWord.service.ts" />
|
2015-10-17 14:12:04 +02:00
|
|
|
|
2015-10-21 22:05:49 +02:00
|
|
|
module tagIt {
|
2015-10-17 14:12:04 +02:00
|
|
|
|
2015-10-21 22:05:49 +02:00
|
|
|
angular.module('tagit', [])
|
|
|
|
.service('DataService', DataService)
|
|
|
|
.service('SelectedWordService', SelectedWordService)
|
|
|
|
.controller('MenuCtrl', MenuCtrl);
|
|
|
|
|
|
|
|
export function init (callback: () => void) {
|
|
|
|
var $ = jQuery;
|
2015-10-25 19:17:30 +01:00
|
|
|
$.get(chromeUrlTranslator('menu.tpl.html'), function (htmlData) {
|
2015-10-24 14:57:34 +02:00
|
|
|
$('body').children().wrapAll('<div id="tagit-body" class="tagit-body" />');
|
2015-10-21 22:05:49 +02:00
|
|
|
$('.tagit-body').before(htmlData);
|
2015-10-25 19:17:30 +01:00
|
|
|
window.name = '';
|
2015-10-21 22:05:49 +02:00
|
|
|
angular.bootstrap(document.getElementById("tagit-menu"), ['tagit']);
|
|
|
|
console.log('TagIt menu loaded');
|
|
|
|
if(callback) callback();
|
2015-10-19 08:47:40 +02:00
|
|
|
});
|
2015-10-24 00:39:49 +02:00
|
|
|
|
2015-10-25 19:17:30 +01:00
|
|
|
function chromeUrlTranslator(relativeUrl : string) {
|
2015-10-25 21:11:23 +01:00
|
|
|
if(chrome && chrome.extension) {
|
2015-10-25 19:17:30 +01:00
|
|
|
return chrome.extension.getURL(relativeUrl);
|
|
|
|
} else {
|
|
|
|
relativeUrl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-10-17 14:12:04 +02:00
|
|
|
}
|
|
|
|
|