Skip to content

Commit 473940f

Browse files
author
Alexsander Akers
committed
Create Safari extension
1 parent e4d5978 commit 473940f

File tree

8 files changed

+65
-49
lines changed

8 files changed

+65
-49
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>Author</key>
6+
<string>Alexsander Akers</string>
7+
<key>Builder Version</key>
8+
<string>10600.6.3</string>
9+
<key>CFBundleDisplayName</key>
10+
<string>Millennials to Snake People</string>
11+
<key>CFBundleIdentifier</key>
12+
<string>us.pandamonia.millennials-to-snake-people</string>
13+
<key>CFBundleInfoDictionaryVersion</key>
14+
<string>6.0</string>
15+
<key>CFBundleShortVersionString</key>
16+
<string>1.0</string>
17+
<key>CFBundleVersion</key>
18+
<string>1</string>
19+
<key>Chrome</key>
20+
<dict/>
21+
<key>Content</key>
22+
<dict>
23+
<key>Scripts</key>
24+
<dict>
25+
<key>End</key>
26+
<array>
27+
<string>content_script.js</string>
28+
</array>
29+
</dict>
30+
</dict>
31+
<key>Description</key>
32+
<string>Learn the sad, sinister truth behind the mysterious Snake People. Who are they? What do they want?</string>
33+
<key>DeveloperIdentifier</key>
34+
<string>94C3W2AV74</string>
35+
<key>ExtensionInfoDictionaryVersion</key>
36+
<string>1.0</string>
37+
<key>Permissions</key>
38+
<dict>
39+
<key>Website Access</key>
40+
<dict>
41+
<key>Include Secure Pages</key>
42+
<true/>
43+
<key>Level</key>
44+
<string>All</string>
45+
</dict>
46+
</dict>
47+
<key>Update Manifest URL</key>
48+
<string>https://a2.github.io/</string>
49+
<key>Website</key>
50+
<string>https://github.com/a2/millennials-to-snake-people</string>
51+
</dict>
52+
</plist>

Source/content_script.js renamed to Millennials to Snake People.safariextension/content_script.js

+13-23
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,20 @@ walk(document.body);
22

33
document.title = replaceText(document.title);
44

5-
function walk(node)
5+
function walk(rootNode)
66
{
7-
// I stole this function from here:
8-
// http://is.gd/mwZp7E
9-
10-
var child, next;
11-
12-
switch ( node.nodeType )
13-
{
14-
case 1: // Element
15-
case 9: // Document
16-
case 11: // Document fragment
17-
child = node.firstChild;
18-
while ( child )
19-
{
20-
next = child.nextSibling;
21-
walk(child);
22-
child = next;
23-
}
24-
break;
25-
26-
case 3: // Text node
27-
handleText(node);
28-
break;
7+
// Find all the text nodes in rootNode
8+
var walker = document.createTreeWalker(
9+
rootNode,
10+
NodeFilter.SHOW_TEXT,
11+
null,
12+
false
13+
),
14+
node;
15+
16+
// Modify each text node's value
17+
while (node = walker.nextNode()) {
18+
handleText(node);
2919
}
3020
}
3121

MillennialsToSnakePeople.crx

-11.3 KB
Binary file not shown.

Source/manifest.json

-26
This file was deleted.

0 commit comments

Comments
 (0)