Skip to content

Commit

Permalink
fixed newfile error.
Browse files Browse the repository at this point in the history
  • Loading branch information
espadrine committed Apr 12, 2010
1 parent 66381d8 commit 5747dab
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 18 deletions.
11 changes: 5 additions & 6 deletions controls.html
Expand Up @@ -146,11 +146,10 @@
colorpalette.style.display = "none";
}

function newfile() {
chrome.tabs.create({url:"./new.html"}, function(tab2) {
function newFile() {
chrome.tabs.create({url:"./new.html",selected:false}, function(tab2) {
chrome.tabs.sendRequest(tab2.id, {edit:true,askName:true}, function(r) {
if(!r.ok) console.log("iDoc communication error");
localStorage['iDoc-'+r.name] = ' ';
if(!r.ok) console.log('iDoc communication error.');
});
});
}
Expand Down Expand Up @@ -185,14 +184,14 @@
table { width:100%; background-color: #ebeff9; display: none; }
table td { text-align: center; }
</style>
<button id="new" onclick="newfile();" style="width:100%">New</button>
<button id="new" onclick="newFile();" style="width:100%">New</button>
<table id="toolbar1" width="100%">
<tr>
<td>
<button id="ed" onclick="change(this);"></button>
</td>
<td>
<button id="new2" onclick="newfile();">New</button>
<button id="new2" onclick="newFile();">New</button>
</td>
<td>
<div class="imagebutton" id="cut"><img class="image" src="cut.png" alt="Cut" title="Cut"></div>
Expand Down
10 changes: 4 additions & 6 deletions idoc.js
Expand Up @@ -5,13 +5,10 @@

var name = '';
var procol = document.location.protocol;
if(procol == 'http:')
name = document.URL.substring(7);
else if(procol == 'file:')
name = document.URL.substring(8);
if (procol == 'http:') name = document.URL.substring(7);
else if(procol == 'file:') name = document.URL.substring(8);

// 1. You have to learn to listen!
if(chrome.extension)
chrome.extension.onRequest.addListener(
function( request, sender, sendResponse ) {
if(request.edit == true) {
Expand Down Expand Up @@ -100,7 +97,8 @@ chrome.extension.onRequest.addListener(
}
else
sendResponse({});
});
}
);

// 2. Wiring things up inside the DOM forest.
function insertNodeAtSelection(win, insertNode) {
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
@@ -1,6 +1,6 @@
{
"name": "iDoc",
"version": "0.995",
"version": "0.996",
"description": "The Internet In-Page Editor. Edit any web page freely and save them.",
"icons": {
"48": "pen48.png",
Expand Down
2 changes: 1 addition & 1 deletion new.html
@@ -1,6 +1,6 @@
<!DOCTYPE html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>New File</title>
<script type="text/javascript" src="idoc.js"></script>
<title>New File</title>
<h1>Title</h1>
<p>Content, etc.</p>
5 changes: 1 addition & 4 deletions options.html
Expand Up @@ -44,7 +44,7 @@
font-family: monospace;
font-weight: bold;
margin-left: 10%;
margin-bottom: 10px;
margin-top: 10px;
font-size: 2em;
}
h2 {
Expand Down Expand Up @@ -232,8 +232,6 @@
function init() {
var folders = [];
var inTable = '';
//var inTable = '<tr><td colspan=3>\n<a class="folder" '+
// 'href="javascript:void(0)" onclick="newFile()">New File</a>';
var uiFs = document.getElementById('fs');
// Show a table of current files.
if(localStorage.length >= 0) {
Expand Down Expand Up @@ -281,7 +279,6 @@ <h2>Drafts File System</h2>
</div>
<div id="preview">
<h2>Preview</h2>
<button onclick="">Send</button>
<iframe id="ifpreview"></iframe>
</div>
</html>

0 comments on commit 5747dab

Please sign in to comment.