diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index bdb0cab..0000000 --- a/.gitattributes +++ /dev/null @@ -1,17 +0,0 @@ -# Auto detect text files and perform LF normalization -* text=auto - -# Custom for Visual Studio -*.cs diff=csharp - -# Standard to msysgit -*.doc diff=astextplain -*.DOC diff=astextplain -*.docx diff=astextplain -*.DOCX diff=astextplain -*.dot diff=astextplain -*.DOT diff=astextplain -*.pdf diff=astextplain -*.PDF diff=astextplain -*.rtf diff=astextplain -*.RTF diff=astextplain diff --git a/content_script.js b/content_script.js index 264615f..19742c8 100644 --- a/content_script.js +++ b/content_script.js @@ -7,7 +7,8 @@ function loadReplace() chrome.storage.local.get("person", function(value) { person = value.person; -walk(document.body); +if(person != null){walk(document.body);} + } ) } diff --git a/content_script.js~ b/content_script.js~ deleted file mode 100644 index dad338a..0000000 --- a/content_script.js~ +++ /dev/null @@ -1,79 +0,0 @@ - -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 474ca70..97d958a 100644 Binary files a/icon-128.png and b/icon-128.png differ diff --git a/icon-16.png b/icon-16.png index 17a17fe..faec4a5 100644 Binary files a/icon-16.png and b/icon-16.png differ diff --git a/icon-48.png b/icon-48.png index 694b09c..6b76b2c 100644 Binary files a/icon-48.png and b/icon-48.png differ diff --git a/icon.png b/icon.png index 5684b6e..df6cad5 100644 Binary files a/icon.png and b/icon.png differ diff --git a/manifest.json b/manifest.json index ff48946..bf014bc 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,6 @@ { "manifest_version": 2, - "name": "Interactive Fics", + "name": "InteractiveFics", "version": "1.0", "description": "Replaces Y/N in Reader Insert/second person fics with a name of your choice.", "browser_action": { @@ -20,7 +20,10 @@ "run_at": "document_end" } ], - "incognito": "split" + "incognito": "split", + "background": { +"page": "popup.html" +} } diff --git a/manifest.json~ b/manifest.json~ deleted file mode 100644 index 74cc29d..0000000 --- a/manifest.json~ +++ /dev/null @@ -1,25 +0,0 @@ -{ - "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 b461d97..596508f 100644 --- a/popup.html +++ b/popup.html @@ -1,12 +1,7 @@ - -Interactive Fics - - - - + - - - - -

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.
-

- - - - - - \ No newline at end of file diff --git a/popup.js b/popup.js index ed764b3..e7d4002 100644 --- a/popup.js +++ b/popup.js @@ -4,6 +4,8 @@ document.addEventListener('DOMContentLoaded', function () { }); //instead of onclick="clickHandler()" in popup.html + + function clickHandler(){ var person = document.getElementById("inputTxt").value; chrome.storage.local.set({"person": person}, chrome.tabs.reload()); diff --git a/popup.js~ b/popup.js~ deleted file mode 100644 index 2a050a7..0000000 --- a/popup.js~ +++ /dev/null @@ -1,11 +0,0 @@ - -document.addEventListener('DOMContentLoaded', function () { - document.querySelector('button').addEventListener('click', clickHandler); -}); //instead of onclick="clickHandler()" in popup.html - - -function clickHandler(){ -var person = document.getElementById("inputTxt").value; -chrome.storage.local.set({"person": person}, chrome.tabs.reload()); -} -