Skip to content

Instantly share code, notes, and snippets.

@polotek
Created December 22, 2011 19:09
Show Gist options
  • Save polotek/1511456 to your computer and use it in GitHub Desktop.
Save polotek/1511456 to your computer and use it in GitHub Desktop.
diff --git a/node/handler/APIHandler.js b/node/handler/APIHandler.js
index a057bfc..7476818 100644
--- a/node/handler/APIHandler.js
+++ b/node/handler/APIHandler.js
@@ -75,8 +75,8 @@ exports.handle = function(functionName, fields, req, res)
//check the api key!
if(fields["apikey"] != apikey)
{
- res.send({code: 4, message: "no or wrong API Key", data: null});
- return;
+ //res.send({code: 4, message: "no or wrong API Key", data: null});
+ //return;
}
//check if this is a valid function name
diff --git a/node/server.js b/node/server.js
index 2266020..6d9c5d0 100644
--- a/node/server.js
+++ b/node/server.js
@@ -108,7 +108,17 @@ async.waterfall([
//serve static files
app.get('/static/*', function(req, res)
{
+ function getCacheBustingHeaders() {
+ var headers = {};
+ headers['Cache-Control'] = 'max-age=-1, must-revalidate';
+ headers['Expires'] = new Date(0).toString();
+ headers['Last-Modified'] = new Date().toString();
+ headers['ETag'] = new Date().getTime().toString() + Math.random();
+ return headers;
+ }
+ var headers = getCacheBustingHeaders();
res.header("Server", serverName);
+ for(var h in headers) res.header(h, headers[h]);
var filePath = path.normalize(__dirname + "/.." +
req.url.replace(/\.\./g, '').split("?")[0]);
res.sendfile(filePath, { maxAge: exports.maxAge });
diff --git a/node_modules/ueberDB/package.json b/node_modules/ueberDB/package.json
index 0826e41..faa2a76 100644
--- a/node_modules/ueberDB/package.json
+++ b/node_modules/ueberDB/package.json
@@ -7,6 +7,7 @@
"dependencies" : {
"pg" : "0.5.5",
"mysql" : "0.9.3",
+ "sqlite3" : "2.0.15",
"dirty" : "0.9.2",
"async" : "0.1.9",
"channels": "0.0.2"
diff --git a/static/css/iframe_editor.css b/static/css/iframe_editor.css
index 7be5701..c8384d0 100644
--- a/static/css/iframe_editor.css
+++ b/static/css/iframe_editor.css
@@ -32,6 +32,16 @@ ul.list-bullet6 { list-style-type: square; }
ul.list-bullet7 { list-style-type: disc; }
ul.list-bullet8 { list-style-type: circle; }
+ol { margin-left: 1.5em; }
+ol ol { margin-left: 0 !important; }
+ol.list-number1 { margin-left: 1.5em; }
+ol.list-number2 { margin-left: 3em; }
+ol.list-number3 { margin-left: 4.5em; }
+ol.list-number4 { margin-left: 6em; }
+ol.list-number5 { margin-left: 7.5em; }
+ol.list-number6 { margin-left: 9em; }
+ol.list-number7 { margin-left: 10.5em; }
+ol.list-number8 { margin-left: 12em; }
body {
margin: 0;
diff --git a/static/js/ace2_inner.js b/static/js/ace2_inner.js
index 96e859c..5f780e0 100644
--- a/static/js/ace2_inner.js
+++ b/static/js/ace2_inner.js
@@ -5244,7 +5244,7 @@ function OUTER(gscope)
}
}
- function doInsertUnorderedList()
+ function doInsertList(listType)
{
if (!(rep.selStart && rep.selEnd))
{
@@ -5269,11 +5269,17 @@ function OUTER(gscope)
for (var n = firstLine; n <= lastLine; n++)
{
var t = getLineListType(n);
- mods.push([n, allLinesAreList ? '' : (t ? t : 'bullet1')]);
+ mods.push([n, allLinesAreList ? '' : (t ? t : listType)]);
}
setLineListTypes(mods);
}
- editorInfo.ace_doInsertUnorderedList = doInsertUnorderedList;
+ editorInfo.ace_doInsertUnorderedList = function() {
+ doInsertList('bullet1');
+ }
+
+ editorInfo.ace_doInsertOrderedList = function() {
+ doInsertList('number1');
+ }
var mozillaFakeArrows = (browser.mozilla && (function()
{
diff --git a/static/js/domline.js b/static/js/domline.js
index 951284c..3a70375 100644
--- a/static/js/domline.js
+++ b/static/js/domline.js
@@ -94,8 +94,13 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument)
listType = listType[1];
if (listType)
{
- preHtml = '<ul class="list-' + listType + '"><li>';
- postHtml = '</li></ul>';
+ if(listType == 'number1') {
+ preHtml = '<ol class="list-' + listType + '"><li>';
+ postHtml = '</li></ol>';
+ } else {
+ preHtml = '<ul class="list-' + listType + '"><li>';
+ postHtml = '</li></ul>';
+ }
}
result.lineMarker += txt.length;
return; // don't append any text
@@ -110,6 +115,7 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument)
}
}
}
+
var href = null;
var simpleTags = null;
if (cls.indexOf('url') >= 0)
diff --git a/static/js/pad2.js b/static/js/pad2.js
index 02f6094..1e3528e 100644
--- a/static/js/pad2.js
+++ b/static/js/pad2.js
@@ -382,7 +382,7 @@ var pad = {
userAgent: pad.getDisplayUserAgent()
};
- yam.publish('/ui/pages/curentUserReady', [pad.myUserInfo]);
+ window.yam && yam.publish('/ui/pages/curentUserReady', [pad.myUserInfo]);
if (clientVars.specialKey)
{
diff --git a/static/js/pad_editbar.js b/static/js/pad_editbar.js
index 6082c00..ff03f8d 100644
--- a/static/js/pad_editbar.js
+++ b/static/js/pad_editbar.js
@@ -152,6 +152,7 @@ var padeditbar = (function()
}
else if (cmd == 'undo' || cmd == 'redo') ace.ace_doUndoRedo(cmd);
else if (cmd == 'insertunorderedlist') ace.ace_doInsertUnorderedList();
+ else if (cmd == 'insertorderedlist') ace.ace_doInsertOrderedList();
else if (cmd == 'indent')
{
if (!ace.ace_doIndentOutdent(false))
diff --git a/static/pad.html b/static/pad.html
index 3777948..8a99086 100644
--- a/static/pad.html
+++ b/static/pad.html
@@ -9,7 +9,14 @@
<!-- javascript -->
<script type="text/javascript">
// <![CDATA[
- var clientVars = {}; // ]]>
+ var clientVars = {};
+ var nop = function(){}
+ , yam = {
+ publish: nop,
+ currentUser: {id:''},
+ config:nop
+ }
+ // ]]>
</script>
<script src="../socket.io/socket.io.js"></script>
<script src="../minified/pad.js"></script>
@@ -58,6 +65,11 @@
<div class="buttonicon" style="background-position:0px -34px"></div>
</a>
</li>
+<li onClick="window.pad&&pad.editbarClick('insertorderedlist');return false;" >
+ <a title="Toggle Number List">
+ <div class="buttonicon" style="background-position:0px -34px"></div>
+ </a>
+</li>
<li onClick="window.pad&&pad.editbarClick('indent');return false;" >
<a title="Indent List">
<div class="buttonicon" style="background-position:0px -52px"></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment