-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds support for use as a pouchdb plugin; changed promise definition …
…for chrome.
- Loading branch information
1 parent
bda6758
commit 2935dfb
Showing
6 changed files
with
48 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
node_modules | ||
dist | ||
fauxton/js/pouchdb-offline.js |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
var fs = require("fs"); | ||
|
||
var html = fs.readFileSync(__dirname + "/../fauxton/index.html", {encoding: "UTF-8"}); | ||
var scr = fs.readFileSync(__dirname + "/../fauxton/js/require.js", {encoding: "UTF-8"}); | ||
scr += fs.readFileSync(__dirname + "/../fauxton/js/pouchdb-offline.js", {encoding: "UTF-8"}); | ||
var css = fs.readFileSync(__dirname + "/../fauxton/css/index.css", {encoding: "UTF-8"}); | ||
|
||
module.exports = function enableFauxton(PouchDB, allDbs) { | ||
var iframe = global.document.createElement("iframe"); | ||
document.body.appendChild(iframe); | ||
|
||
iframe.onload = function () { | ||
iframe.contentDocument.write(html); | ||
iframe.contentWindow.PouchDB = PouchDB; | ||
|
||
var style = iframe.contentDocument.createElement("style"); | ||
var script = iframe.contentDocument.createElement("script"); | ||
|
||
style.appendChild(iframe.contentDocument.createTextNode(css)); | ||
script.appendChild(iframe.contentDocument.createTextNode(scr)); | ||
|
||
iframe.contentDocument.body.appendChild(style); | ||
iframe.contentDocument.body.appendChild(script); | ||
}; | ||
iframe.style.width = "90%"; | ||
iframe.style.height = "500px"; | ||
iframe.style.position = "fixed"; | ||
iframe.style.right = "0"; | ||
iframe.style.bottom = "0"; | ||
iframe.style.border = "3px groove #CBCBCB"; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters