diff --git a/content_script.js~ b/content_script.js~ new file mode 100644 index 0000000..dad338a --- /dev/null +++ b/content_script.js~ @@ -0,0 +1,79 @@ + +var person; + + +loadReplace(); + + +function loadReplace() +{ +chrome.storage.local.get("person", function(value) +{ +person = value.person; +walk(document.body); +} +) +} + +function walk(node) +{ + // I stole this function from here: + // http://is.gd/mwZp7E + + var child, next; + + switch ( node.nodeType ) + { + case 1: // Element + case 9: // Document + case 11: // Document fragment + child = node.firstChild; + while ( child ) + { + next = child.nextSibling; + walk(child); + child = next; + } + break; + + case 3: // Text node + handleText(node); + break; + } +} + +function handleText(textNode) +{ + var v = textNode.nodeValue; + + v = v.replace("Y/N", person); + v = v.replace("y/n", person); + v = v.replace("Y/n", person); + v = v.replace("y/N", person); + v = v.replace("(Y/N)", person); + v = v.replace("(y/n)", person); + v = v.replace("(Y/n)", person); + v = v.replace("(y/N)", person); + v = v.replace("Y/N?", person + "?"); + v = v.replace("y/n?", person + "?"); + v = v.replace("Y/n?", person + "?"); + v = v.replace("y/N?", person + "?"); + v = v.replace("Y/N!", person + "!"); + v = v.replace("y/n!", person + "!"); + v = v.replace("Y/n!", person + "!"); + v = v.replace("y/N!", person + "!"); + v = v.replace("(Y/N)?", person + "?"); + v = v.replace("(y/n)?", person + "?"); + v = v.replace("(Y/n)?", person + "?"); + v = v.replace("(y/N)?", person + "?"); + v = v.replace("(Y/N)!", person + "!"); + v = v.replace("(y/n)!", person + "!"); + v = v.replace("(Y/n)!", person + "!"); + v = v.replace("(y/N)!", person + "!"); + + + + textNode.nodeValue = v; +} + + diff --git a/icon-128.png b/icon-128.png index 5f36693..474ca70 100644 Binary files a/icon-128.png and b/icon-128.png differ diff --git a/icon-16.png b/icon-16.png index debb2f0..17a17fe 100644 Binary files a/icon-16.png and b/icon-16.png differ diff --git a/icon-48.png b/icon-48.png index 5e1df4e..694b09c 100644 Binary files a/icon-48.png and b/icon-48.png differ diff --git a/icon.png b/icon.png index aaf512f..5684b6e 100644 Binary files a/icon.png and b/icon.png differ diff --git a/manifest.json~ b/manifest.json~ new file mode 100644 index 0000000..74cc29d --- /dev/null +++ b/manifest.json~ @@ -0,0 +1,25 @@ +{ + "manifest_version": 2, + "name": "Interactive Fics", + "version": "1.0", + "description": "Replaces Y/N in Reader Insert/second person fics with a name of your choice.", + "browser_action": { + "default_icon": "icon.png", + "default_popup": "popup.html" }, + "permissions": [ + "storage", + "tabs"], + "icons": { "16": "icon-16.png", + "48": "icon-48.png", + "128": "icon-128.png" }, + "content_scripts": + [ + { + "matches": ["*://*/*"], + "js": ["content_script.js"], + "run_at": "document_end" + } + ] + +} + diff --git a/popup.html b/popup.html index 175bb7e..b461d97 100644 --- a/popup.html +++ b/popup.html @@ -33,7 +33,7 @@ color: #16a085;
+About
Interactive Fics is a free Chrome extension developed by blaringsilence to improve your online story reading experience. The extension is open source and all source code can be found here.
diff --git a/popup.html~ b/popup.html~
new file mode 100644
index 0000000..22565c4
--- /dev/null
+++ b/popup.html~
@@ -0,0 +1,50 @@
+
+
+
+
+Enter the name here:
+
+
+About
+Interactive Fics is a free Chrome extension developed by blaringsilence to improve your online story reading experience. The extension is open source and all source code can be found here.
+
+Feedback, suggestions and requests.
+