Skip to content

Commit 0a98ace

Browse files
committed
Got build working with content.js as content.ts, no code changes yet
1 parent d94533f commit 0a98ace

File tree

3 files changed

+3930
-44
lines changed

3 files changed

+3930
-44
lines changed

Gruntfile.js

Lines changed: 45 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,54 @@
11
module.exports = function(grunt) {
2-
"use strict";
2+
"use strict";
33

4-
var bgSrc = ["src/background/*.ts"];
5-
var popupSrc = ["src/popup/*.ts"];
6-
var optionSrc = ["src/options/*.ts"];
4+
var contentSrc = ["src/content/*.ts"];
5+
var bgSrc = ["src/background/*.ts"];
6+
var popupSrc = ["src/popup/*.ts"];
7+
var optionSrc = ["src/options/*.ts"];
78

8-
grunt.initConfig({
9-
ts: {
10-
options: {
11-
sourceMap: false,
12-
removeComments: true
13-
},
14-
background: {
15-
src: bgSrc,
16-
out: "build/background/background.js"
17-
},
18-
popup: {
19-
src: popupSrc,
20-
out: "build/popup/popup.js"
21-
},
9+
grunt.initConfig({
10+
ts: {
11+
options: {
12+
sourceMap: false,
13+
removeComments: true
14+
},
15+
background: {
16+
src: bgSrc,
17+
out: "build/background/background.js"
18+
},
19+
popup: {
20+
src: popupSrc,
21+
out: "build/popup/popup.js"
22+
},
2223
option: {
2324
src: optionSrc,
2425
out: "build/options/options.js"
26+
},
27+
content: {
28+
src: contentSrc,
29+
out: "build/content/content.js"
30+
},
31+
},
32+
copy: {
33+
all: {
34+
files: [
35+
{
36+
expand: true,
37+
src: ["manifest.json", "content/*.css", "content/*.js", "pages/*", "popup/popup.html", "options/options.html"],
38+
cwd: "src/",
39+
dest: "build/"
40+
},
41+
{
42+
expand: true,
43+
src: "images/*",
44+
dest: "build/"
45+
}
46+
]
2547
}
26-
},
27-
copy: {
28-
all: {
29-
files: [
30-
{
31-
expand: true,
32-
src: ["manifest.json", "content/*", "pages/*", "popup/popup.html", "options/options.html"],
33-
cwd: "src/",
34-
dest: "build/"
35-
},
36-
{
37-
expand: true,
38-
src: "images/*",
39-
dest: "build/"
40-
}
41-
]
42-
}
43-
}
44-
});
48+
}
49+
});
4550

46-
grunt.loadNpmTasks("grunt-ts");
47-
grunt.loadNpmTasks("grunt-contrib-copy");
48-
grunt.registerTask("default", ["ts", "copy"]);
51+
grunt.loadNpmTasks("grunt-ts");
52+
grunt.loadNpmTasks("grunt-contrib-copy");
53+
grunt.registerTask("default", ["ts", "copy"]);
4954
};

src/content/content.js renamed to src/content/content.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
1+
/// <reference path="../d.ts/DefinitelyTyped/chrome/chrome.d.ts"/>
2+
/// <reference path="../d.ts/DefinitelyTyped/jquery/jquery.d.ts"/>
3+
14
var marks = [];
25
var cur = 0;
36
var logging = false;
47

58
// Notify background script that this page has just loaded
6-
chrome.extension.sendMessage({event: "loaded"});
9+
chrome.runtime.sendMessage({event: "loaded"});
710

811
// Global variable because prototypes are hard.
912
var infoSpan = document.createElement('span');
1013
infoSpan.id = "_regexp_search_count";
1114
infoSpan.style.position = 'fixed';
12-
infoSpan.style.top = 0;
13-
infoSpan.style.left = 0;
15+
infoSpan.style.top = '0';
16+
infoSpan.style.left = '0';
1417
infoSpan.style.padding = '8px';
1518
infoSpan.style.background = 'rgba(255, 255, 0, 0.5)';
1619
infoSpan.addEventListener('mouseover', function(event) {
@@ -102,7 +105,7 @@ function recurse(element, regexp) {
102105
}
103106

104107
// Skip all invisible text nodes
105-
disp = $(element).css('display');
108+
var disp = $(element).css('display');
106109
if (element.nodeType != Node.TEXT_NODE &&
107110
(disp == 'none' || disp == 'hidden')) {
108111
return;

0 commit comments

Comments
 (0)