1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-24 02:27:19 +00:00

Removed TiddlyFox

It has moved to https://github.com/TiddlyWiki/TiddlyFox
This commit is contained in:
Jeremy Ruston 2012-10-02 11:48:02 +01:00
parent 9e86cb709c
commit 59b00e88c0
16 changed files with 0 additions and 590 deletions

View File

@ -1,128 +0,0 @@
#!/bin/bash
# build.sh -- builds JAR and XPI files for mozilla extensions
# by Nickolay Ponomarev <asqueella@gmail.com>
# (original version based on Nathan Yergler's build script)
# Most recent version is at <http://kb.mozillazine.org/Bash_build_script>
# This script assumes the following directory structure:
# ./
# chrome.manifest (optional - for newer extensions)
# install.rdf
# (other files listed in $ROOT_FILES)
#
# content/ |
# locale/ |} these can be named arbitrary and listed in $CHROME_PROVIDERS
# skin/ |
#
# defaults/ |
# components/ |} these must be listed in $ROOT_DIRS in order to be packaged
# ... |
#
# It uses a temporary directory ./build when building; don't use that!
# Script's output is:
# ./$APP_NAME.xpi
# ./$APP_NAME.jar (only if $KEEP_JAR=1)
# ./files -- the list of packaged files
#
# Note: It modifies chrome.manifest when packaging so that it points to
# chrome/$APP_NAME.jar!/*
#
# default configuration file is ./config_build.sh, unless another file is
# specified in command-line. Available config variables:
APP_NAME= # short-name, jar and xpi files name. Must be lowercase with no spaces
CHROME_PROVIDERS= # which chrome providers we have (space-separated list)
CLEAN_UP= # delete the jar / "files" when done? (1/0)
ROOT_FILES= # put these files in root of xpi (space separated list of leaf filenames)
ROOT_DIRS= # ...and these directories (space separated list)
BEFORE_BUILD= # run this before building (bash command)
AFTER_BUILD= # ...and this after the build (bash command)
if [ -z $1 ]; then
. ./config_build.sh
else
. $1
fi
if [ -z $APP_NAME ]; then
echo "You need to create build config file first!"
echo "Read comments at the beginning of this script for more info."
exit;
fi
ROOT_DIR=`pwd`
TMP_DIR=build
#uncomment to debug
#set -x
# remove any left-over files from previous build
rm -f $APP_NAME.jar $APP_NAME.xpi files
rm -rf $TMP_DIR
$BEFORE_BUILD
mkdir --parents --verbose $TMP_DIR/chrome
# generate the JAR file, excluding CVS, SVN, and temporary files
JAR_FILE=$TMP_DIR/chrome/$APP_NAME.jar
echo "Generating $JAR_FILE..."
for CHROME_SUBDIR in $CHROME_PROVIDERS; do
find $CHROME_SUBDIR \( -path '*CVS*' -o -path '*.svn*' \) -prune -o -type f -print | grep -v \~ >> files
done
zip -0 -r $JAR_FILE -@ < files
# The following statement should be used instead if you don't wish to use the JAR file
#cp --verbose --parents `cat files` $TMP_DIR/chrome
# prepare components and defaults
echo "Copying various files to $TMP_DIR folder..."
for DIR in $ROOT_DIRS; do
mkdir $TMP_DIR/$DIR
FILES="`find $DIR \( -path '*CVS*' -o -path '*.svn*' \) -prune -o -type f -print | grep -v \~`"
echo $FILES >> files
cp --verbose --parents $FILES $TMP_DIR
done
# Copy other files to the root of future XPI.
for ROOT_FILE in $ROOT_FILES install.rdf chrome.manifest; do
cp --verbose $ROOT_FILE $TMP_DIR
if [ -f $ROOT_FILE ]; then
echo $ROOT_FILE >> files
fi
done
cd $TMP_DIR
if [ -f "chrome.manifest" ]; then
echo "Preprocessing chrome.manifest..."
# You think this is scary?
#s/^(content\s+\S*\s+)(\S*\/)$/\1jar:chrome\/$APP_NAME\.jar!\/\2/
#s/^(skin|locale)(\s+\S*\s+\S*\s+)(.*\/)$/\1\2jar:chrome\/$APP_NAME\.jar!\/\3/
#
# Then try this! (Same, but with characters escaped for bash :)
sed -i -r s/^\(content\\s+\\S*\\s+\)\(\\S*\\/\)$/\\1jar:chrome\\/$APP_NAME\\.jar!\\/\\2/ chrome.manifest
sed -i -r s/^\(skin\|locale\)\(\\s+\\S*\\s+\\S*\\s+\)\(.*\\/\)$/\\1\\2jar:chrome\\/$APP_NAME\\.jar!\\/\\3/ chrome.manifest
# (it simply adds jar:chrome/whatever.jar!/ at appropriate positions of chrome.manifest)
fi
# generate the XPI file
echo "Generating $APP_NAME.xpi..."
zip -r ../$APP_NAME.xpi *
cd "$ROOT_DIR"
echo "Cleanup..."
if [ $CLEAN_UP = 0 ]; then
# save the jar file
mv $TMP_DIR/chrome/$APP_NAME.jar .
else
rm ./files
fi
# remove the working files
rm -rf $TMP_DIR
echo "Done!"
$AFTER_BUILD

View File

@ -1,155 +0,0 @@
#!/bin/bash
# build.sh -- builds JAR and XPI files for mozilla extensions
# by Nickolay Ponomarev <asqueella@gmail.com>
# (original version based on Nathan Yergler's build script)
# Most recent version is at <http://kb.mozillazine.org/Bash_build_script>
# This script assumes the following directory structure:
# ./
# chrome.manifest (optional - for newer extensions)
# install.rdf
# (other files listed in $ROOT_FILES)
#
# content/ |
# locale/ |} these can be named arbitrary and listed in $CHROME_PROVIDERS
# skin/ |
#
# defaults/ |
# components/ |} these must be listed in $ROOT_DIRS in order to be packaged
# ... |
#
# It uses a temporary directory ./build when building; don't use that!
# Script's output is:
# ./$APP_NAME.xpi
# ./$APP_NAME.jar (only if $KEEP_JAR=1)
# ./files -- the list of packaged files
#
# Note: It modifies chrome.manifest when packaging so that it points to
# chrome/$APP_NAME.jar!/*
#
# default configuration file is ./config_build.sh, unless another file is
# specified in command-line. Available config variables:
APP_NAME= # short-name, jar and xpi files name. Must be lowercase with no spaces
CHROME_PROVIDERS= # which chrome providers we have (space-separated list)
CLEAN_UP= # delete the jar / "files" when done? (1/0)
ROOT_FILES= # put these files in root of xpi (space separated list of leaf filenames)
ROOT_DIRS= # ...and these directories (space separated list)
BEFORE_BUILD= # run this before building (bash command)
AFTER_BUILD= # ...and this after the build (bash command)
# is "cpio" available? If not, fall back to GNU-only "cp --parents"
HAVE_CPIO=0
which cpio 2>&1 > /dev/null && HAVE_CPIO=1
echo "have cpio: $HAVE_CPIO"
function cp_parents {
if [ $HAVE_CPIO = 1 ]; then
echo $1 | cpio -pduv $TMP_DIR
else
cp --verbose --parents $1 $TMP_DIR
fi
}
function cp_parents_chr {
if [ $HAVE_CPIO = 1 ]; then
echo $1 | cpio -pduv $TMP_DIR/chrome
else
cp --verbose --parents $1 $TMP_DIR/chrome
fi
}
if [ -z $1 ]; then
. ./config_build.sh
else
. $1
fi
if [ -z $APP_NAME ]; then
echo "You need to create build config file first!"
echo "Read comments at the beginning of this script for more info."
exit;
fi
ROOT_DIR=`pwd`
TMP_DIR=build
#uncomment to debug
set -x
# remove any left-over files from previous build
rm -f $APP_NAME.jar $APP_NAME.xpi files
rm -rf $TMP_DIR
$BEFORE_BUILD
# verbose, create each non-existent directorys
mkdir -v -p $TMP_DIR/chrome
# generate the JAR file, excluding CVS, SVN, and temporary files
JAR_FILE=$TMP_DIR/chrome/$APP_NAME.jar
echo "Generating $JAR_FILE..."
for CHROME_SUBDIR in $CHROME_PROVIDERS; do
find $CHROME_SUBDIR \( -path '*CVS*' -o -path '*.svn*' \) -prune -o -type f -print | grep -v \~ >> files
done
#zip -0 -r $JAR_FILE -@ < files
# The following statement should be used instead if you don't wish to use the JAR file
FLS=`cat files`
LL=""
for F in $FLS; do
cp_parents $F
done
# prepare components and defaults
echo "Copying various files to $TMP_DIR folder..."
for DIR in $ROOT_DIRS; do
mkdir $TMP_DIR/$DIR
FILES="`find $DIR \( -path '*CVS*' -o -path '*.svn*' \) -prune -o -type f -print | grep -v \~`"
echo $FILES >> files
cp_parents $FILES
done
# Copy other files to the root of future XPI.
for ROOT_FILE in $ROOT_FILES install.rdf chrome.manifest; do
cp_parents $ROOT_FILE
if [ -f $ROOT_FILE ]; then
echo $ROOT_FILE >> files
fi
done
cd $TMP_DIR
if [ -f "chrome.manifest" ]; then
echo "Preprocessing chrome.manifest..."
# You think this is scary?
#s/^(content\s+\S*\s+)(\S*\/)$/\1jar:chrome\/$APP_NAME\.jar!\/\2/
#s/^(skin|locale)(\s+\S*\s+\S*\s+)(.*\/)$/\1\2jar:chrome\/$APP_NAME\.jar!\/\3/
#
# Then try this! (Same, but with characters escaped for bash :)
#sed -i -r s/^\(content\\s+\\S*\\s+\)\(\\S*\\/\)$/\\1jar:chrome\\/$APP_NAME\\.jar!\\/\\2/ chrome.manifest
#sed -i -r s/^\(skin\|locale\)\(\\s+\\S*\\s+\\S*\\s+\)\(.*\\/\)$/\\1\\2jar:chrome\\/$APP_NAME\\.jar!\\/\\3/ chrome.manifest
# (it simply adds jar:chrome/whatever.jar!/ at appropriate positions of chrome.manifest)
fi
# generate the XPI file
echo "Generating $APP_NAME.xpi..."
zip -r ../$APP_NAME.xpi *
cd "$ROOT_DIR"
echo "Cleanup..."
if [ $CLEAN_UP = 0 ]; then
# save the jar file
mv $TMP_DIR/chrome/$APP_NAME.jar .
else
rm ./files
fi
# remove the working files
rm -rf $TMP_DIR
echo "Done!"
$AFTER_BUILD

View File

@ -1,7 +0,0 @@
content tiddlyfox content/
overlay chrome://browser/content/browser.xul chrome://tiddlyfox/content/overlay.xul
locale tiddlyfox en-US locale/en-US/
skin tiddlyfox classic/1.0 skin/
style chrome://global/content/customizeToolbar.xul chrome://tiddlyfox/skin/overlay.css

View File

@ -1,11 +0,0 @@
#!/bin/bash
# Build config for the build script, build.sh. Look there for more info.
APP_NAME=tiddlyfox
CHROME_PROVIDERS="content locale skin"
CLEAN_UP=1
ROOT_FILES="readme.txt"
ROOT_DIRS=
BEFORE_BUILD=
AFTER_BUILD=

View File

@ -1,13 +0,0 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
<!DOCTYPE window SYSTEM "chrome://tiddlyfox/locale/hello.dtd">
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="&title.label;">
<hbox align="center">
<description flex="1">&separate.label;</description>
<button label="&close.label;" oncommand="close();"/>
</hbox>
</window>

View File

@ -1,50 +0,0 @@
/*
The JavaScript in this file is injected into each TiddlyWiki page that loads
*/
(function () {
/*
Returns true if successful, false if failed, null if not available
*/
var injectedSaveFile = function(path,content) {
// Find the message box element
var messageBox = document.getElementById("tiddlyfox-message-box");
if(messageBox) {
// Create the message element and put it in the message box
var message = document.createElement("div");
message.setAttribute("data-tiddlyfox-path",path);
message.setAttribute("data-tiddlyfox-content",content);
messageBox.appendChild(message);
// Create and dispatch the custom event to the extension
var event = document.createEvent("Events");
event.initEvent("tiddlyfox-save-file",true,false);
message.dispatchEvent(event);
}
return true;
};
/*
Returns text if successful, false if failed, null if not available
*/
var injectedLoadFile = function(path) {
try {
// Just the read the file synchronously
var xhReq = new XMLHttpRequest();
xhReq.open("GET", "file:///" + escape(path), false);
xhReq.send(null);
return xhReq.responseText;
} catch(ex) {
return false;
}
};
var injectedConvertUriToUTF8 = function(path) {
return path;
}
window.mozillaSaveFile = injectedSaveFile;
window.mozillaLoadFile = injectedLoadFile;
window.convertUriToUTF8 = injectedConvertUriToUTF8;
})();

View File

@ -1,129 +0,0 @@
/*
The JavaScript code in this file is executed via `overlay.xul` when Firefox starts up.
*/
var TiddlyFox = {
// Called when the main browser has loaded
onLoad: function(event) {
// Register a page load event
var appcontent = document.getElementById("appcontent");
if(appcontent){
appcontent.addEventListener("DOMContentLoaded",TiddlyFox.onPageLoad,true);
}
},
// Called each time a page loads
onPageLoad: function(event) {
// Get the document and window
var doc = event.originalTarget,
win = doc.defaultView;
// If it is a TiddlyWiki classic
if(TiddlyFox.isTiddlyWikiClassic(doc,win)) {
if(confirm("TiddlyFox: Enabling TiddlyWiki file saving capability for:\n" + doc.location)) {
TiddlyFox.injectScript(doc);
TiddlyFox.injectMessageBox(doc);
}
// If it is a TiddlyWiki5
} else if(TiddlyFox.isTiddlyWiki5(doc,win)) {
if(confirm("TiddlyFox: Enabling TiddlyWiki5 file saving capability for:\n" + doc.location)) {
TiddlyFox.injectMessageBox(doc);
}
}
},
injectScript: function(doc) {
// Load the script text
var xhReq = new XMLHttpRequest();
xhReq.open("GET","chrome://tiddlyfox/content/inject.js",false);
xhReq.send(null);
var injectCode = xhReq.responseText;
// Inject the script
var code = doc.createTextNode(injectCode);
var scr = doc.createElement("script");
scr.type = "text/javascript";
scr.appendChild(code);
doc.getElementsByTagName("head")[0].appendChild(scr)
},
injectMessageBox: function(doc) {
// Inject the message box
var messageBox = doc.getElementById("tiddlyfox-message-box");
if(!messageBox) {
messageBox = doc.createElement("div");
messageBox.id = "tiddlyfox-message-box";
messageBox.style.display = "none";
doc.body.appendChild(messageBox);
}
// Attach the event handler to the message box
messageBox.addEventListener("tiddlyfox-save-file",TiddlyFox.onSaveFile,false);
},
saveFile: function(filePath,content) {
// Attempt to convert the filepath to a proper UTF-8 string
try {
var converter = Components.classes["@mozilla.org/intl/utf8converterservice;1"].getService(Components.interfaces.nsIUTF8ConverterService);
filePath = converter.convertURISpecToUTF8(filePath,"UTF-8");
} catch(ex) {
}
// Save the file
try {
var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
file.initWithPath(filePath);
if(!file.exists())
file.create(0,0x01B4);// 0x01B4 = 0664
var out = Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream);
out.init(file,0x22,0x04,null);
out.write(content,content.length);
out.flush();
out.close();
return true;
} catch(ex) {
return false;
}
},
onSaveFile: function(event) {
// Get the details from the message
var message = event.target,
path = message.getAttribute("data-tiddlyfox-path"),
content = message.getAttribute("data-tiddlyfox-content");
// Save the file
TiddlyFox.saveFile(path,content);
// Remove the message element from the message box
message.parentNode.removeChild(message);
return false;
},
// Called via `overlay.xul` when the menu item is selected
onMenuItemCommand: function() {
window.open("chrome://tiddlyfox/content/hello.xul", "", "chrome");
},
isTiddlyWikiClassic: function(doc,win) {
// Test whether the document is a TiddlyWiki (we don't have access to JS objects in it)
return (doc.location.protocol === "file:") &&
doc.getElementById("storeArea") &&
(/TiddlyWiki/.test(doc.scripts[0].text));
},
isTiddlyWiki5: function(doc,win) {
// Test whether the document is a TiddlyWiki5 (we don't have access to JS objects in it)
var metaTags = doc.getElementsByTagName("meta"),
generator = false;
for(var t=0; t<metaTags.length; t++) {
if(metaTags[t].name === "application-name" && metaTags[t].content === "TiddlyWiki") {
generator = true;
}
}
return (doc.location.protocol === "file:") && generator;
}
};
window.addEventListener("load",function load(event) {
window.removeEventListener("load",load,false);
TiddlyFox.onLoad(event);
},false);

View File

@ -1,12 +0,0 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://tiddlyfox/skin/overlay.css" type="text/css"?>
<!DOCTYPE overlay SYSTEM "chrome://tiddlyfox/locale/overlay.dtd">
<overlay id="tiddlyfox-overlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script src="overlay.js"/>
<menupopup id="menu_ToolsPopup">
<menuitem id="tiddlyfox-hello" label="&tiddlyfox;"
oncommand="TiddlyFox.onMenuItemCommand(event);"/>
</menupopup>
</overlay>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

View File

@ -1,37 +0,0 @@
<?xml version="1.0"?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>tiddlyfox@tiddlywiki.org</em:id>
<em:name>TiddlyFox extension for Firefox</em:name>
<em:version>1.0alpha5</em:version>
<em:description>A Firefox extension to enable TiddlyWiki to save changes directly to the file system.</em:description>
<em:creator>Jeremy Ruston</em:creator>
<em:homepageURL>https://five.tiddlywiki.com/tiddlyfox</em:homepageURL>
<em:iconURL>chrome://tiddlyfox/content/tiddlyfox_32x32.png</em:iconURL>
<!--em:optionsURL>chrome://tiddlyfox/content/settings.xul</em:optionsURL>
<em:aboutURL>chrome://tiddlyfox/content/about.xul</em:aboutURL>
<em:updateURL>http://five.tiddlywiki.com/tiddlyfox/update.rdf</em:updateURL-->
<!-- Firefox -->
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>3.5</em:minVersion>
<em:maxVersion>4.0.*</em:maxVersion>
</Description>
</em:targetApplication>
<!-- Firefox for Android (experimental) -->
<em:targetApplication>
<Description>
<em:id>{aa3c5121-dab2-40e2-81ca-7ea25febc110}</em:id>
<em:minVersion>10.0</em:minVersion>
<em:maxVersion>15.*</em:maxVersion>
</Description>
</em:targetApplication>
</Description>
</RDF>

View File

@ -1,3 +0,0 @@
<!ENTITY title.label "TiddlyFox">
<!ENTITY separate.label "This is an entirely separate window!">
<!ENTITY close.label "Close">

View File

@ -1 +0,0 @@
<!ENTITY tiddlyfox "TiddlyFox!">

View File

@ -1,39 +0,0 @@
In order to test the extension, edit the file `tiddlyfox@tiddlywiki.org` to contain the path to the TiddlyFox extension folder, and then drop the file in your `[firefox profile folder]\extensions\` folder.
----
This package accompanies the article at MozillaZine Knowledge Base, which can be
found at <http://kb.mozillazine.org/Getting_started_with_extension_development>
You can use its contents as a starting point for developing extensions. Steps to
register these files in the EM are described in the "Registering your extension
in the Extension Manager" section of the article. In short:
1. Unzip this package to any location, e.g. c:\dev
2. Put the path to the "helloworld" folder (e.g. c:\dev\helloworld) in the
"helloworld@mozilla.doslash.org" file and move that file to
[profile folder]\extensions\
3. Restart Firefox.
You should see a new red "Hello world" item in the Tools menu and the extension
should show up in the Extension Manager window (Tools > Extensions).
********* YOU MUST RUN FIREFOX 3.6 OR FIREFOX 4 TO USE THIS PACKAGE ************
helloworld.xpi contains working prebuilt version of the extension, just in case.
You must change the following items before making your extension
available to general public:
1) the extension's ID in install.rdf (helloworld@mozilla.doslash.org).
(For details see <https://developer.mozilla.org/en/install.rdf>)
2) the extension's short name (currently "helloworld").
The new name must be in lower case.
********* OK, the example is working. What's next?
Follow the tips at <https://developer.mozilla.org/en/Setting_up_extension_development_environment>
to save yourself time.
Check the documentation available at <https://developer.mozilla.org/en/Extensions>.
If you have any problems that you can't solve yourself, feel free to ask questions:
<https://developer.mozilla.org/en/Extensions#Community>

View File

@ -1,4 +0,0 @@
/* This is just an example. You shouldn't do this. */
menuitem#tiddlyfox-hello {
color: red !important;
}

Binary file not shown.

View File

@ -1 +0,0 @@
/path/to/this/folder