Edits to popup.html and icons
|
@ -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;
|
||||
}
|
||||
|
||||
|
BIN
icon-128.png
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 13 KiB |
BIN
icon-16.png
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.6 KiB |
BIN
icon-48.png
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 6.9 KiB |
BIN
icon.png
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 6.0 KiB |
|
@ -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"
|
||||
}
|
||||
]
|
||||
|
||||
}
|
||||
|
|
@ -33,7 +33,7 @@ color: #16a085;
|
|||
</head>
|
||||
<body>
|
||||
<h1>Enter the name here:</h1>
|
||||
<input type="text" id="inputTxt" placeholder="To restore, enter 'Y/N'"/><button>Change</button>
|
||||
<form><input type="text" id="inputTxt" placeholder="To restore, enter 'Y/N'"/><input type="submit" id="submit" value="Change"/></form>
|
||||
<p>
|
||||
<details><summary>About</summary>
|
||||
<a href="http://interactivefics.tumblr.com" target="_blank" title="Official tumblr">Interactive Fics</a> is a free Chrome extension developed by <a href="https://github.com/blaringsilence" target="_blank" title="her github">blaringsilence</a> to improve your online story reading experience. The extension is open source and all source code can be found <a href="https://github.com/blaringsilence/interactive-fics" title="github repo">here.</a>
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link href='http://fonts.googleapis.com/css?family=Play:400,700' rel='stylesheet' type='text/css'>
|
||||
<title>Interactive Fics</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8">
|
||||
<meta http-equiv="content-style-type" content="text/css">
|
||||
<meta http-equiv="expires" content="0">
|
||||
<style type="text/css">
|
||||
body {
|
||||
background-color: white;
|
||||
color: #16a085;
|
||||
width: 250px;
|
||||
padding:10px;
|
||||
font-family: 'Play', sans-serif;
|
||||
}
|
||||
h1 {
|
||||
font-size: 16px;
|
||||
}
|
||||
a{
|
||||
color: #e67e22;
|
||||
}
|
||||
a:hover{
|
||||
color: #16a085;
|
||||
}
|
||||
|
||||
</style>
|
||||
<script src="popup.js" type="text/javascript" >
|
||||
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<h1>Enter the name here:</h1>
|
||||
|
||||
<form><input type="text" id="inputTxt" placeholder="To restore, enter 'Y/N'"/><input type="submit" id="submit" value="Change"/></form>
|
||||
<p>
|
||||
<details><summary>About</summary>
|
||||
<a href="http://interactivefics.tumblr.com" target="_blank" title="Official tumblr">Interactive Fics</a> is a free Chrome extension developed by <a href="https://github.com/blaringsilence" target="_blank" title="her github">blaringsilence</a> to improve your online story reading experience. The extension is open source and all source code can be found <a href="https://github.com/blaringsilence/interactive-fics" title="github repo">here.</a>
|
||||
</details>
|
||||
<br>
|
||||
<a href="http://interactivefics.tumblr.com/ask" target="_blank">Feedback, suggestions and requests.</a></br>
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
3
popup.js
|
@ -1,5 +1,6 @@
|
|||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
document.querySelector('button').addEventListener('click', clickHandler);
|
||||
document.getElementById("submit").addEventListener('click', clickHandler);
|
||||
}); //instead of onclick="clickHandler()" in popup.html
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
|
||||
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());
|
||||
}
|
||||
|