All the files
This commit is contained in:
parent
bbed3fa0dd
commit
c5c646ba87
|
@ -0,0 +1,17 @@
|
||||||
|
# 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
|
|
@ -0,0 +1,76 @@
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 7.5 KiB |
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
Binary file not shown.
After Width: | Height: | Size: 4.7 KiB |
|
@ -0,0 +1,26 @@
|
||||||
|
{
|
||||||
|
"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"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"incognito": "split"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
<!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>
|
||||||
|
<input type="text" id="inputTxt" placeholder="To restore, enter 'Y/N'"/><button>Change</button>
|
||||||
|
<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>
|
|
@ -0,0 +1,10 @@
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue