From 51544db9a2a2ad15a06d904e846bf423f4726ab7 Mon Sep 17 00:00:00 2001 From: Caleb James DeLisle Date: Mon, 2 Feb 2015 16:01:33 +0100 Subject: [PATCH] Completed adding of customization system and bottom infobar --- customize.dist/BottomBar.html | 78 ++++++++++++++++++++++++++++++ customize.dist/DecorateToolbar.js | 18 +++++-- customize.dist/fr.png | Bin customize.dist/france.png | Bin 545 -> 0 bytes customize.dist/index.html | 21 +++++--- customize.dist/logo-xwiki2.png | Bin 0 -> 4897 bytes customize.dist/pad.js | 4 +- customize.dist/sheet.js | 6 +++ server.js | 2 +- www/common/toolbar.js | 25 +++++++++- www/pad/index.html | 17 ++++++- www/pad/inner.html | 12 +++++ www/pad/main.js | 19 +++++--- www/pad/realtime-wysiwyg.js | 7 +-- www/sheet/index.html | 8 +-- www/sheet/main.js | 3 +- 16 files changed, 189 insertions(+), 31 deletions(-) create mode 100644 customize.dist/BottomBar.html mode change 100755 => 100644 customize.dist/fr.png delete mode 100644 customize.dist/france.png create mode 100644 customize.dist/logo-xwiki2.png create mode 100644 customize.dist/sheet.js create mode 100644 www/pad/inner.html diff --git a/customize.dist/BottomBar.html b/customize.dist/BottomBar.html new file mode 100644 index 000000000..09028904c --- /dev/null +++ b/customize.dist/BottomBar.html @@ -0,0 +1,78 @@ + +
+ + +
diff --git a/customize.dist/DecorateToolbar.js b/customize.dist/DecorateToolbar.js index 6481966d7..547cc7eff 100644 --- a/customize.dist/DecorateToolbar.js +++ b/customize.dist/DecorateToolbar.js @@ -1,7 +1,17 @@ define([ '/bower_components/jquery/dist/jquery.min.js' -], function ($) { - var main = function ($toolbar) { - $toolbar.append('

Made With in Paris

') - Dt.main($('.rtwysiwyg-toolbar-rightside')); +], function () { + var $ = window.jQuery; + var main = function () { + $.ajax({ + url: '/customize/BottomBar.html', + success: function (ret) { + $('iframe').height('96%'); + $('body').append(ret); + } + }); + }; + return { + main: main + }; }); diff --git a/customize.dist/fr.png b/customize.dist/fr.png old mode 100755 new mode 100644 diff --git a/customize.dist/france.png b/customize.dist/france.png deleted file mode 100644 index 8332c4ec23c853944c29b02d7b32a88033f48a71..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 545 zcmV++0^a?JP)lgG%);U`26kn-@hOg zU%!6+4+cOs(0HIde9xZz`}Onxub&LUB0x(30+2WcIRJn#2ut|?gWYu1Cf+!-K%B8# zdf?1WA}#uZ8oj7u>$I1i0Al&`=O0k%-@icgAIJnM0xA6maSq6BK-ECw|NZ*S`0Lj% z1_pot6puj;05Ax`F!=umqj7^frO?t|3^&I1kxUq9yECc+jQpY84SWH_0#pxl$?v~F z@*hy-KN0|X07U)z`4{NpU%#2aHUI<=%a31wK(7Du52Oc(|3O^?R1IN+RRjI-n*kVB z3=9AP#PZ|EACPLGJ%9cJNh|>9B%spYzZw7h1%?tp0I_@ndg9MNE>313@6R75NcceF zkr51-#U+7;F#`Sf7i0rK0I_`g_NQ&Z + Fork me on GitHub @@ -56,10 +57,18 @@ the NSA mad enough for them to use an active attack against you, Great Success Highfive, now take the battery out of your computer before it spawns Agent Smith.

-
Try it out!
-
- CREATE PAD - CREATE SPREADSHEET + + +
diff --git a/customize.dist/logo-xwiki2.png b/customize.dist/logo-xwiki2.png new file mode 100644 index 0000000000000000000000000000000000000000..047c89ea7ab146b9a07e32813859f5d31c3f2c55 GIT binary patch literal 4897 zcmV++6W;8JP)Oz@Z0f2-7z;ux~O9+4z06=<WDR*FRcSTFz- zW=q650N5=6FiBTtNC2?60Km==3$g$R3;-}uh=nNt1bYBr$Ri_o0EC$U6h`t_Jn<{8 z5a%iY0C<_QJh>z}MS)ugEpZ1|S1ukX&Pf+56gFW3VVXcL!g-k)GJ!M?;PcD?0HBc- z5#WRK{dmp}uFlRjj{U%*%WZ25jX z{P*?XzTzZ-GF^d31o+^>%=Ap99M6&ogks$0k4OBs3;+Bb(;~!4V!2o<6ys46agIcq zjPo+3B8fthDa9qy|77CdEc*jK-!%ZRYCZvbku9iQV*~a}ClFY4z~c7+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QAzAGIGU``3Jt_M*l~o)&3NF%(!A{9eDB#IF)wiZx$hd9jAD*4Xrsg1wc)2lE zGD5${6P0l0d9?)KG1xrz`n&|@CDc1`Q^j zECE{+2&(4}Z>l_+!FMjtXC&zAW5(f9sD%II6b-k^pK#EJ1V zFI5c%&jSW0Tb{$i=jM3aNBA6KYx&x9*1$kJ)ThbsO0ufK*nx44;NVanITz;-IC_q) zfR;siFOjxhBFjJV%TnblQR}#`J!9fvpvs<#L|64?sha%pWF2vQ%qTGUe;fY;sE&qu TmX#pJ00000NkvXXu0mjfZvZ`K literal 0 HcmV?d00001 diff --git a/customize.dist/pad.js b/customize.dist/pad.js index 48d6044d5..a86e6e28f 100644 --- a/customize.dist/pad.js +++ b/customize.dist/pad.js @@ -1,6 +1,6 @@ require([ '/customize/DecorateToolbar.js', '/bower_components/jquery/dist/jquery.min.js' -], function (Dt, $) { - Dt.main($('.rtwysiwyg-toolbar-rightside')); +], function (Dt) { + Dt.main(window.$('#bottom-bar')); }); diff --git a/customize.dist/sheet.js b/customize.dist/sheet.js new file mode 100644 index 000000000..a86e6e28f --- /dev/null +++ b/customize.dist/sheet.js @@ -0,0 +1,6 @@ +require([ + '/customize/DecorateToolbar.js', + '/bower_components/jquery/dist/jquery.min.js' +], function (Dt) { + Dt.main(window.$('#bottom-bar')); +}); diff --git a/server.js b/server.js index f3fe5cab8..ac586d936 100644 --- a/server.js +++ b/server.js @@ -24,7 +24,7 @@ if (!Fs.existsSync(__dirname + "/customize")) { console.log("Cryptpad is customizable, see customize.dist/readme.md for details"); } app.use("/customize/", Express.static(__dirname + customize)); -app.get("/", function(req, res) { res.sendfile(__dirname + customize + '/index.html'); }); +app.get("/", function(req, res) { res.sendFile(__dirname + customize + '/index.html'); }); var httpsOpts; if (config.privKeyAndCertFiles) { diff --git a/www/common/toolbar.js b/www/common/toolbar.js index a471591ec..039649940 100644 --- a/www/common/toolbar.js +++ b/www/common/toolbar.js @@ -48,6 +48,9 @@ define([ ' display: inline-block;', ' width: 100%;', '}', + '.' + TOOLBAR_CLS + ' a {', + ' float: right;', + '}', '.' + TOOLBAR_CLS + ' div {', ' padding: 0 10px;', ' height: 1.5em;', @@ -55,6 +58,15 @@ define([ ' line-height: 25px;', ' height: 22px;', '}', + '.' + TOOLBAR_CLS + ' div.rtwysiwyg-back {', + ' padding: 0;', + ' font-weight: bold;', + ' cursor: pointer;', + ' color: #000;', + '}', + '.rtwysiwyg-toolbar-leftside div {', + ' float: left;', + '}', '.rtwysiwyg-toolbar-leftside {', ' float: left;', '}', @@ -79,6 +91,16 @@ define([ return toolbar; }; + var createEscape = function ($container) { + var id = uid(); + $container.append('
⇐ Back
'); + var $ret = $container.find('#'+id); + $ret.on('click', function () { + window.location.href = '/'; + }); + return $ret[0]; + }; + var createSpinner = function ($container) { var id = uid(); $container.append('
'); @@ -97,7 +119,7 @@ define([ var createUserList = function ($container) { var id = uid(); - $container.prepend('
'); + $container.append('
'); return $container.find('#'+id)[0]; }; @@ -137,6 +159,7 @@ define([ var create = function ($container, myUserName, realtime) { var toolbar = createRealtimeToolbar($container); + createEscape(toolbar.find('.rtwysiwyg-toolbar-leftside')); var userListElement = createUserList(toolbar.find('.rtwysiwyg-toolbar-leftside')); var spinner = createSpinner(toolbar.find('.rtwysiwyg-toolbar-rightside')); var lagElement = createLagElement(toolbar.find('.rtwysiwyg-toolbar-rightside')); diff --git a/www/pad/index.html b/www/pad/index.html index b5f3f1d87..685f73398 100644 --- a/www/pad/index.html +++ b/www/pad/index.html @@ -3,9 +3,24 @@ + - + diff --git a/www/pad/inner.html b/www/pad/inner.html new file mode 100644 index 000000000..bf79dcd0d --- /dev/null +++ b/www/pad/inner.html @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/www/pad/main.js b/www/pad/main.js index 7ab1f8b30..4a9a17673 100644 --- a/www/pad/main.js +++ b/www/pad/main.js @@ -4,10 +4,11 @@ define([ '/common/messages.js', '/common/crypto.js', '/bower_components/jquery/dist/jquery.min.js', - '/bower_components/ckeditor/ckeditor.js', + '/customize/pad.js' ], function (Config, RTWysiwyg, Messages, Crypto) { - var Ckeditor = window.CKEDITOR; var $ = window.jQuery; + var ifrw = $('#pad-iframe')[0].contentWindow; + var Ckeditor = ifrw.CKEDITOR; $(function () { $(window).on('hashchange', function() { @@ -20,17 +21,19 @@ define([ var key = Crypto.parseKey(window.location.hash.substring(1)); var editor = Ckeditor.replace('editor1', { removeButtons: 'Source,Maximize', - // This plugin inserts html crap into the document which is not part of the document - // itself and causes problems when it's sent across the wire and reflected back. - removePlugins: 'magicline' + // magicline plugin inserts html crap into the document which is not part of the + // document itself and causes problems when it's sent across the wire and reflected back + removePlugins: 'magicline,resize' }); editor.on('instanceReady', function () { editor.execCommand('maximize'); - var ifr = window.ifr = $('iframe')[0]; - ifr.contentDocument.body.innerHTML = Messages.initialState; + + // (contenteditable) iframe in an iframe + ifrw.$('iframe')[0].contentDocument.body.innerHTML = Messages.initialState; var rtw = - RTWysiwyg.start(Config.websocketURL, + RTWysiwyg.start(ifrw, + Config.websocketURL, Crypto.rand64(8), key.channel, key.cryptKey); diff --git a/www/pad/realtime-wysiwyg.js b/www/pad/realtime-wysiwyg.js index 4553055c1..72e11cc88 100644 --- a/www/pad/realtime-wysiwyg.js +++ b/www/pad/realtime-wysiwyg.js @@ -247,10 +247,11 @@ window.ErrorBox = ErrorBox; return out; }; - var start = module.exports.start = function (websocketUrl, userName, channel, cryptKey) + var start = module.exports.start = + function (window, websocketUrl, userName, channel, cryptKey) { var passwd = 'y'; - var wysiwygDiv = document.getElementById('cke_1_contents'); + var wysiwygDiv = window.document.getElementById('cke_1_contents'); var ifr = wysiwygDiv.getElementsByTagName('iframe')[0]; var doc = ifr.contentWindow.document; var socket = makeWebsocket(websocketUrl); @@ -303,7 +304,7 @@ console.log(new Error().stack); { transformFunction: Otaml.transform }); var toolbar = realtime.toolbar = - Toolbar.create($('#cke_1_toolbox'), userName, realtime); + Toolbar.create(window.$('#cke_1_toolbox'), userName, realtime); onEvent = function () { if (isErrorState) { return; } diff --git a/www/sheet/index.html b/www/sheet/index.html index 9cad4f2bb..e32ca87cd 100644 --- a/www/sheet/index.html +++ b/www/sheet/index.html @@ -4,26 +4,26 @@ - + diff --git a/www/sheet/main.js b/www/sheet/main.js index e13647a0e..ca71c0bfd 100644 --- a/www/sheet/main.js +++ b/www/sheet/main.js @@ -5,7 +5,8 @@ define([ '/common/toolbar.js', '/common/chainpad.js', '/bower_components/jquery/dist/jquery.min.js', - '/common/otaml.js' + '/common/otaml.js', + '/customize/sheet.js' ], function (Config, Messages, Crypto, Toolbar) { var $ = jQuery; var ChainPad = window.ChainPad;