diff --git a/.jshintignore b/.jshintignore index aab1b485b..7b013e0da 100644 --- a/.jshintignore +++ b/.jshintignore @@ -11,6 +11,7 @@ www/common/hyperscript.js www/common/tippy.min.js www/pad/wysiwygarea-plugin.js -www/pad2/wysiwygarea-plugin.js +www/pad/mediatag-plugin.js +www/pad/mediatag-plugin-dialog.js www/common/media-tag-nacl.min.js diff --git a/bower.json b/bower.json index 24461eae7..af5560bf6 100644 --- a/bower.json +++ b/bower.json @@ -21,7 +21,7 @@ "jquery": "~2.1.3", "tweetnacl": "0.12.2", "components-font-awesome": "^4.6.3", - "ckeditor": "~4.7", + "ckeditor": "4.7.3", "codemirror": "^5.19.0", "requirejs": "2.3.5", "marked": "0.3.5", diff --git a/customize.dist/ckeditor-config.js b/customize.dist/ckeditor-config.js index aa551953e..3dc280116 100644 --- a/customize.dist/ckeditor-config.js +++ b/customize.dist/ckeditor-config.js @@ -10,7 +10,7 @@ CKEDITOR.editorConfig = function( config ) { // document itself and causes problems when it's sent across the wire and reflected back config.removePlugins= 'resize,elementspath'; config.resize_enabled= false; //bottom-bar - config.extraPlugins= 'autolink,colorbutton,colordialog,font,indentblock,justify'; + config.extraPlugins= 'autolink,colorbutton,colordialog,font,indentblock,justify,mediatag'; config.toolbarGroups= [ // {"name":"clipboard","groups":["clipboard","undo"]}, //{"name":"editing","groups":["find","selection"]}, diff --git a/customize.dist/messages.js b/customize.dist/messages.js index 2f31a516e..916afe135 100644 --- a/customize.dist/messages.js +++ b/customize.dist/messages.js @@ -15,6 +15,7 @@ var map = { var getStoredLanguage = function () { return localStorage.getItem(LS_LANG); }; var getBrowserLanguage = function () { return navigator.language || navigator.userLanguage; }; var getLanguage = function () { + if (window.cryptpadLanguage) { return window.cryptpadLanguage; } if (getStoredLanguage()) { return getStoredLanguage(); } var l = getBrowserLanguage() || ''; if (Object.keys(map).indexOf(l) !== -1) { diff --git a/customize.dist/pages.js b/customize.dist/pages.js index 6cebaec88..55945ccd2 100644 --- a/customize.dist/pages.js +++ b/customize.dist/pages.js @@ -570,69 +570,69 @@ define([ }; var appToolbar = function () { - return h('div#toolbar.toolbar-container'); + return h('div#toolbar.cryptpad-toolbar'); + }; + var appToolbar3 = function () { + return h('div#cp-toolbar.cp-toolbar-container'); }; Pages['/whiteboard/'] = Pages['/whiteboard/index.html'] = function () { return [ - appToolbar(), - h('div#canvas-area', h('canvas#canvas', { + appToolbar3(), + h('div#cp-app-whiteboard-canvas-area', h('canvas#cp-app-whiteboard-canvas', { width: 600, height: 600 })), - h('div#controls', { + h('div#cp-app-whiteboard-controls', { style: { display: 'block', } }, [ - h('button#clear.btn.btn-danger', Msg.canvas_clear), ' ', - h('button#toggleDraw.btn.btn-secondary', Msg.canvas_disable), - h('button#delete.btn.btn-secondary', { + h('button#cp-app-whiteboard-clear.btn.btn-danger', Msg.canvas_clear), ' ', + h('button#cp-app-whiteboard-toggledraw.btn.btn-secondary', Msg.canvas_disable), + h('button#cp-app-whiteboard-delete.btn.btn-secondary', { style: { display: 'none', } }, Msg.canvas_delete), - h('div.range-group', [ + h('div.cp-app-whiteboard-range-group', [ h('label', { - 'for': 'width' + 'for': 'cp-app-whiteboard-width' }, Msg.canvas_width), - h('input#width', { + h('input#cp-app-whiteboard-width', { type: 'range', - value: "5", min: "1", max: "100" }), - h('span#width-val', '5px') + h('span#cp-app-whiteboard-width-val', '5px') ]), - h('div.range-group', [ + h('div.cp-app-whiteboard-range-group', [ h('label', { - 'for': 'opacity', + 'for': 'cp-app-whiteboard-opacity', }, Msg.canvas_opacity), - h('input#opacity', { + h('input#cp-app-whiteboard-opacity', { type: 'range', - value: "1", min: "0.1", max: "1", step: "0.1" }), - h('span#opacity-val', '100%') + h('span#cp-app-whiteboard-opacity-val', '100%') ]), - h('span.selected', [ + h('span.cp-app-whiteboard-selected.cp-app-whiteboard-unselectable', [ h('img', { title: Msg.canvas_currentBrush }) ]) ]), - setHTML(h('div#colors'), ' '), - loadingScreen(), - h('div#cursors', { + setHTML(h('div#cp-app-whiteboard-colors'), ' '), + h('div#cp-app-whiteboard-cursors', { style: { display: 'none', background: 'white', 'text-align': 'center', } }), - h('div#pickers'), + h('div#cp-app-whiteboard-pickers'), ]; }; @@ -683,8 +683,7 @@ define([ ]) ]) ]) - ]), - loadingScreen() + ]) ]; }; diff --git a/customize.dist/src/less/mixins.less b/customize.dist/src/less/mixins.less index 68cca3cb4..a75fa4e30 100644 --- a/customize.dist/src/less/mixins.less +++ b/customize.dist/src/less/mixins.less @@ -1,4 +1,5 @@ @import "/customize/src/less/variables.less"; +@import (once) "/customize/src/less2/include/tools.less"; .fontface(@family, @src, @style: normal, @weight: 400, @fmt: 'truetype'){ @font-face { @@ -39,26 +40,6 @@ background: linear-gradient(@start, @end); /* Standard syntax */ } -.placeholderColor (@color) { - &::-webkit-input-placeholder { /* WebKit, Blink, Edge */ - color: @color;; - } - &:-moz-placeholder { /* Mozilla Firefox 4 to 18 */ - color: @color; - opacity: 1; - } - &::-moz-placeholder { /* Mozilla Firefox 19+ */ - color: @color; - opacity: 1; - } - &:-ms-input-placeholder { /* Internet Explorer 10-11 */ - color: @color; - } - &::-ms-input-placeholder { /* Microsoft Edge */ - color: @color; - } -} - .avatar (@width) { &.avatar { overflow: hidden; @@ -83,7 +64,7 @@ box-sizing: content-box; } .default { - .unselectable(); + .tools_unselectable(); background: white; color: black; font-size: @width/1.2; @@ -122,7 +103,7 @@ } .leftsideCategory { - .unselectable(); + .tools_unselectable(); padding: 5px 20px; margin: 15px 0; cursor: pointer; diff --git a/customize.dist/src/less/sidebar-layout.less b/customize.dist/src/less/sidebar-layout.less index d16d9c019..47e4e86f9 100644 --- a/customize.dist/src/less/sidebar-layout.less +++ b/customize.dist/src/less/sidebar-layout.less @@ -1,10 +1,11 @@ @import '/customize/src/less/variables.less'; @import '/customize/src/less/mixins.less'; +@import (once) "/customize/src/less2/include/colortheme.less"; -@leftside-bg: #eee; -@leftside-color: #000; -@rightside-color: #000; -@description-color: #777; +@leftside-bg: @colortheme_sidebar-left-bg; +@leftside-color: @colortheme_sidebar-left-fg; +@rightside-color: @colortheme_sidebar-right-fg; +@description-color: @colortheme_sidebar-description; @button-width: 400px; diff --git a/customize.dist/src/less2/include/avatar.less b/customize.dist/src/less2/include/avatar.less index 0ca0d0fa1..b935db786 100644 --- a/customize.dist/src/less2/include/avatar.less +++ b/customize.dist/src/less2/include/avatar.less @@ -1,3 +1,5 @@ +@import (once) "./tools.less"; + .avatar_main (@width) { &.cp-avatar { overflow: hidden; @@ -16,7 +18,7 @@ box-sizing: content-box; } .cp-avatar-default { - .unselectable(); + .tools_unselectable(); background: white; color: black; font-size: @width/1.2; diff --git a/customize.dist/src/less2/include/colortheme.less b/customize.dist/src/less2/include/colortheme.less index 53d97649a..e5e57cc74 100644 --- a/customize.dist/src/less2/include/colortheme.less +++ b/customize.dist/src/less2/include/colortheme.less @@ -75,6 +75,16 @@ @colortheme_todo-bg: #7bccd1; @colortheme_todo-color: #000; +// Sidebar layout +@colortheme_sidebar-active: #fff; +@colortheme_sidebar-left-bg: #eee; +@colortheme_sidebar-left-fg: #000; +@colortheme_sidebar-left-branch: #888; +@colortheme_sidebar-right-bg: #fff; +@colortheme_sidebar-right-fg: #000; +@colortheme_sidebar-description: #777; + + @cryptpad_color_blue: #4591C4; @cryptpad_color_grey: #999999; @cryptpad_header_col: #1E1F1F; diff --git a/customize.dist/src/less2/include/dropdown.less b/customize.dist/src/less2/include/dropdown.less index b6a7bcbeb..6593b926e 100644 --- a/customize.dist/src/less2/include/dropdown.less +++ b/customize.dist/src/less2/include/dropdown.less @@ -1,4 +1,5 @@ @import (once) "./colortheme.less"; +@import (once) "./tools.less"; /* The container
- needed to position the dropdown content */ .dropdown_main () { @@ -17,7 +18,7 @@ margin-left: 5px; } * { - .unselectable(); + .tools_unselectable(); cursor: default; } } diff --git a/customize.dist/src/less2/include/fileupload.less b/customize.dist/src/less2/include/fileupload.less index bd90ab5d3..a07d365bd 100644 --- a/customize.dist/src/less2/include/fileupload.less +++ b/customize.dist/src/less2/include/fileupload.less @@ -28,6 +28,11 @@ td { padding: @upload_pad_h @upload_pad_v; } + .cp-fileupload-table-link { + .fa { + margin-right: 5px; + } + } .cp-fileupload-table-progress { width: 200px; position: relative; diff --git a/customize.dist/src/less2/include/font.less b/customize.dist/src/less2/include/font.less index b1fdd0b19..33eb3dd3d 100644 --- a/customize.dist/src/less2/include/font.less +++ b/customize.dist/src/less2/include/font.less @@ -1,7 +1,7 @@ .font_neuropolitical () { @font-face { font-family: Neuropolitical; - src: url(./customize/fonts/neuropolitical.ttf) + src: url(/customize/fonts/neuropolitical.ttf) } } .font_open-sans () { diff --git a/customize.dist/src/less2/include/leftside-menu.less b/customize.dist/src/less2/include/leftside-menu.less new file mode 100644 index 000000000..3211fb3a9 --- /dev/null +++ b/customize.dist/src/less2/include/leftside-menu.less @@ -0,0 +1,23 @@ +@import (once) "./unselectable.less"; +@import (once) "./variables.less"; +@import (once) "./colortheme.less"; + +.leftside-menu_main() { +} +.leftside-menu-category_main() { + .unselectable_make(); + padding: 5px 20px; + margin: 15px 0; + cursor: pointer; + height: @variables_bar-height; + line-height: @variables_bar-height - 10px; + .fa { + width: 25px; + } + &:hover { + background: rgba(0,0,0,0.05); + } + &.cp-leftside-active { + background: @colortheme_sidebar-active; + } +} diff --git a/customize.dist/src/less2/include/limit-bar.less b/customize.dist/src/less2/include/limit-bar.less new file mode 100644 index 000000000..efca7811d --- /dev/null +++ b/customize.dist/src/less2/include/limit-bar.less @@ -0,0 +1,58 @@ +@import (once) "./colortheme.less"; + +.limit-bar_main () { + .cp-limit-container { + @colortheme_green: #5cb85c; + display: inline-flex; + flex-flow: column-reverse; + width: 100%; + margin-top: 20px; + .cp-limit-bar { + display: inline-block; + max-width: 100%; + margin: 3px; + box-sizing: border-box; + border: 1px solid #999; + background: white; + position: relative; + text-align: center; + vertical-align: middle; + width: ~"calc(100% - 6px)"; + height: 25px; + line-height: 25px; + overflow: hidden; + .cp-limit-usage { + height: 100%; + display: inline-block; + background: blue; + position: absolute; + left: 0; + z-index:1; // .usage + &.cp-limit-usage-normal { + background: @colortheme_green; + } + &.cp-limit-usage-warning { + background: orange; + } + &.cp-limit-usage-above { + background: red; + } + } + .cp-limit-usage-text { + position: relative; + color: black; + text-shadow: 1px 0 2px white, 0 1px 2px white, -1px 0 2px white, 0 -1px 2px white; + z-index: 2; // .usageText + font-size: @colortheme_app-font-size; + font-weight: bold; + } + } + .cp-limit-upgrade { + padding: 0; + line-height: 25px; + height: 25px; + margin: 0 3px; + border-radius: 0; + } + } +} diff --git a/customize.dist/src/less2/include/tokenfield.less b/customize.dist/src/less2/include/tokenfield.less index 2479e3330..5dcea83ec 100644 --- a/customize.dist/src/less2/include/tokenfield.less +++ b/customize.dist/src/less2/include/tokenfield.less @@ -1,23 +1,17 @@ +@import (once) "./tools.less"; + .tokenfield_main () { .tokenfield { - .unselectable () { - -webkit-touch-callout: none; - -webkit-user-select: none; - -khtml-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - } - - .unselectable(); + .tools_unselectable(); height: auto; min-height: 34px; padding-bottom: 0px; - &.focus { - border-color: #66afe9; - outline: 0; - box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, 0.6); - } + background-color: unset; + border: none; + display: flex; + flex-wrap: wrap; + align-items: center; + padding: 0 10px; .token { box-sizing: border-box; border-radius: 3px; @@ -25,8 +19,9 @@ border: 1px solid #d9d9d9; background-color: #ededed; white-space: nowrap; - margin: -1px 5px 5px 0; - vertical-align: center; + margin: 10px 5px; + height: 24px; + vertical-align: middle; cursor: default; color: #222; @@ -50,17 +45,17 @@ overflow: hidden; text-overflow: ellipsis; padding-left: 4px; - vertical-align: center; + vertical-align: middle; } .close { font-family: Arial; display: inline-block; - line-height: 100%; + line-height: 24px; font-size: 1.1em; margin-left: 5px; float: none; height: 100%; - vertical-align: center; + vertical-align: middle; padding-right: 4px; } &.active { @@ -73,11 +68,10 @@ } .token-input { background: none; - width: 0%; //60px; - min-width: 60px; + flex: 1; border: 0; padding: 0; - margin-bottom: 6px; + margin: 0 !important; // Override alertify box-shadow: none; max-width: 100%; &:focus { @@ -86,9 +80,5 @@ box-shadow: none; } } - &.disabled { - cursor: not-allowed; - background-color: #eeeeee; - } } } diff --git a/customize.dist/src/less2/include/toolbar-history.less b/customize.dist/src/less2/include/toolbar-history.less index 1a099bb76..0388f6401 100644 --- a/customize.dist/src/less2/include/toolbar-history.less +++ b/customize.dist/src/less2/include/toolbar-history.less @@ -1,7 +1,7 @@ @import (once) "./colortheme.less"; .history_main () { - body .cp-toolbar-history { + .cp-toolbar-history { display: none; text-align: center; * { diff --git a/customize.dist/src/less2/include/toolbar.less b/customize.dist/src/less2/include/toolbar.less index 366d24be4..2d49da6b2 100644 --- a/customize.dist/src/less2/include/toolbar.less +++ b/customize.dist/src/less2/include/toolbar.less @@ -5,6 +5,7 @@ @import (once) "./avatar.less"; @import (once) "./toolbar-history.less"; @import (once) "./icon-colors.less"; +@import (once) "./tools.less"; .toolbar_main () { @@ -13,15 +14,6 @@ @toolbar_top-height: 64px; @toolbar_button-font: @colortheme_app-font; - .unselectable () { - -webkit-touch-callout: none; - -webkit-user-select: none; - -khtml-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - } - .dropdown_main(); .ckeditor_fix(); .history_main(); @@ -270,7 +262,7 @@ font-family: FontAwesome; } - .unselectable(); + .tools_unselectable(); font: @toolbar_button-font; width: 100%; @@ -289,7 +281,7 @@ button { transition: all 0.15s; - .unselectable(); + .tools_unselectable(); &.cp-toolbar-hidden { display: none; } @@ -658,6 +650,14 @@ } } } + p.cp-toolbar-account { + &> span { + font-weight: bold; + span { + font-weight: normal; + } + } + } .cp-toolbar-backup { margin: 0; border-radius: 0; diff --git a/customize.dist/src/less2/include/tools.less b/customize.dist/src/less2/include/tools.less new file mode 100644 index 000000000..9fd2df5bc --- /dev/null +++ b/customize.dist/src/less2/include/tools.less @@ -0,0 +1,27 @@ +.tools_placeholder-color (@color) { + &::-webkit-input-placeholder { /* WebKit, Blink, Edge */ + color: @color;; + } + &:-moz-placeholder { /* Mozilla Firefox 4 to 18 */ + color: @color; + opacity: 1; + } + &::-moz-placeholder { /* Mozilla Firefox 19+ */ + color: @color; + opacity: 1; + } + &:-ms-input-placeholder { /* Internet Explorer 10-11 */ + color: @color; + } + &::-ms-input-placeholder { /* Microsoft Edge */ + color: @color; + } +} + +.tools_unselectable () { + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; +} diff --git a/customize.dist/src/less2/include/unselectable.less b/customize.dist/src/less2/include/unselectable.less new file mode 100644 index 000000000..30223128b --- /dev/null +++ b/customize.dist/src/less2/include/unselectable.less @@ -0,0 +1,13 @@ +.unselectable_make() { + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; +} + +.unselectable_main() { + .cp-unselectable { + .unselectable_make(); + } +} diff --git a/customize.dist/src/less2/include/variables.less b/customize.dist/src/less2/include/variables.less new file mode 100644 index 000000000..3aee02492 --- /dev/null +++ b/customize.dist/src/less2/include/variables.less @@ -0,0 +1,3 @@ +// Elements size +@variables_bar-height: 32px; + diff --git a/customize.dist/src/less2/loading.less b/customize.dist/src/less2/loading.less index 6a14fe29b..504e1e393 100644 --- a/customize.dist/src/less2/loading.less +++ b/customize.dist/src/less2/loading.less @@ -40,7 +40,7 @@ The CSS inside of loading.js is precompiled in order to save 200ish milliseconds } #cp-loading-tip { position: fixed; - z-index: 100000; // loading tip + z-index: 10000000; // loading tip top: 80%; left: 0; right: 0; diff --git a/customize.dist/src/less2/main.less b/customize.dist/src/less2/main.less index d2020c97b..8f53ecab5 100644 --- a/customize.dist/src/less2/main.less +++ b/customize.dist/src/less2/main.less @@ -22,10 +22,13 @@ html.cp-app-print { .app-print_main(); } +body.cp-app-drive { @import "../../../drive/app-drive.less"; } body.cp-app-pad { @import "../../../pad/app-pad.less"; } body.cp-app-code { @import "../../../code/app-code.less"; } body.cp-app-slide { @import "../../../slide/app-slide.less"; } body.cp-app-file { @import "../../../file/app-file.less"; } body.cp-app-filepicker { @import "../../../filepicker/app-filepicker.less"; } body.cp-app-contacts { @import "../../../contacts/app-contacts.less"; } +//body.cp-app-poll { @import "../../../poll/app-poll.less"; } +body.cp-app-whiteboard { @import "../../../whiteboard/app-whiteboard.less"; } diff --git a/customize.dist/translations/messages.fr.js b/customize.dist/translations/messages.fr.js index db0ebbf9f..118eb6f7b 100644 --- a/customize.dist/translations/messages.fr.js +++ b/customize.dist/translations/messages.fr.js @@ -157,6 +157,10 @@ define(function () { out.filePicker_filter = "Filtrez les fichiers par leur nom"; out.or = 'ou'; + out.tags_title = "Mots-clés du pad"; + out.tags_add = "Modifier les mots-clés du pad"; + out.tags_duplicate = "Mot-clé déjà présent : {0}"; + out.slideOptionsText = "Options"; out.slideOptionsTitle = "Personnaliser la présentation"; out.slideOptionsButton = "Enregistrer (Entrée)"; @@ -204,8 +208,11 @@ define(function () { out.history_restoreDone = "Document restauré"; out.history_version = "Version :"; - // Ckeditor links + // Ckeditor out.openLinkInNewTab = "Ouvrir le lien dans un nouvel onglet"; + out.pad_mediatagTitle = "Options du Media-Tag"; + out.pad_mediatagWidth = "Largeur (px)"; + out.pad_mediatagHeight = "Hauteur (px)"; // Polls @@ -363,6 +370,8 @@ define(function () { out.fm_error_cantPin = "Erreur interne du serveur. Veuillez recharger la page et essayer de nouveau."; out.fm_viewListButton = "Liste"; out.fm_viewGridButton = "Grille"; + out.fm_renamedPad = "Vous avez renommé ce pad dans votre Drive. Son titre est:
{0}"; + out.fm_prop_tagsList = "Mots-clés"; // File - Context menu out.fc_newfolder = "Nouveau dossier"; out.fc_rename = "Renommer"; diff --git a/customize.dist/translations/messages.js b/customize.dist/translations/messages.js index 6a6becf5b..fc7c204d9 100644 --- a/customize.dist/translations/messages.js +++ b/customize.dist/translations/messages.js @@ -159,6 +159,10 @@ define(function () { out.filePicker_filter = "Filter files by name"; out.or = 'or'; + out.tags_title = "Tags"; + out.tags_add = "Update this pad's tags"; + out.tags_duplicate = "Duplicate tag: {0}"; + out.slideOptionsText = "Options"; out.slideOptionsTitle = "Customize your slides"; out.slideOptionsButton = "Save (enter)"; @@ -206,8 +210,11 @@ define(function () { out.history_restoreDone = "Document restored"; out.history_version = "Version:"; - // Ckeditor links + // Ckeditor out.openLinkInNewTab = "Open Link in New Tab"; + out.pad_mediatagTitle = "Media-Tag settings"; + out.pad_mediatagWidth = "Width (px)"; + out.pad_mediatagHeight = "Height (px)"; // Polls @@ -364,6 +371,8 @@ define(function () { out.fm_error_cantPin = "Internal server error. Please reload the page and try again."; out.fm_viewListButton = "List view"; out.fm_viewGridButton = "Grid view"; + out.fm_renamedPad = "You've set a custom name for this pad. Its shared title is:
{0}"; + out.fm_prop_tagsList = "Tags"; // File - Context menu out.fc_newfolder = "New folder"; out.fc_rename = "Rename"; diff --git a/www/code/app-code.less b/www/code/app-code.less index 8772a2653..d625da0da 100644 --- a/www/code/app-code.less +++ b/www/code/app-code.less @@ -3,10 +3,12 @@ @import (once) "../../customize/src/less2/include/markdown.less"; @import (once) '../../customize/src/less2/include/fileupload.less'; @import (once) '../../customize/src/less2/include/alertify.less'; +@import (once) '../../customize/src/less2/include/tokenfield.less'; .toolbar_main(); .fileupload_main(); .alertify_main(); +.tokenfield_main(); // body &.cp-app-code { diff --git a/www/code/inner.html b/www/code/inner.html index 485e06455..5d914b6c8 100644 --- a/www/code/inner.html +++ b/www/code/inner.html @@ -2,7 +2,7 @@ - + - + diff --git a/www/olddrive/inner.html b/www/olddrive/inner.html new file mode 100644 index 000000000..0b26aa7a1 --- /dev/null +++ b/www/olddrive/inner.html @@ -0,0 +1,60 @@ + + + + + + + + +
+
+
+
+
+
+
+
+ + + + + +
+ + + diff --git a/www/olddrive/inner.js b/www/olddrive/inner.js new file mode 100644 index 000000000..e1779778b --- /dev/null +++ b/www/olddrive/inner.js @@ -0,0 +1,7 @@ +define([ + 'less!/bower_components/components-font-awesome/css/font-awesome.min.css', + 'css!/bower_components/bootstrap/dist/css/bootstrap.min.css', + 'less!/drive/file.less', + 'less!/customize/src/less/cryptpad.less', + 'less!/customize/src/less/toolbar.less', +], function () {}); diff --git a/www/olddrive/main.js b/www/olddrive/main.js new file mode 100644 index 000000000..d7766b75f --- /dev/null +++ b/www/olddrive/main.js @@ -0,0 +1,3027 @@ +define([ + 'jquery', + '/bower_components/chainpad-listmap/chainpad-listmap.js', + '/bower_components/chainpad-crypto/crypto.js', + '/bower_components/textpatcher/TextPatcher.amd.js', + 'json.sortify', + '/common/cryptpad-common.js', + '/common/userObject.js', + '/common/toolbar2.js', + '/customize/application_config.js', + '/common/cryptget.js', + '/common/mergeDrive.js', + + 'less!/bower_components/components-font-awesome/css/font-awesome.min.css', + 'less!/customize/src/less/cryptpad.less', +], function ($, Listmap, Crypto, TextPatcher, JSONSortify, Cryptpad, FO, Toolbar, AppConfig, Get, Merge) { + var module = window.MODULE = {}; + + var Messages = Cryptpad.Messages; + //var saveAs = window.saveAs; + + // Use `$(function () {});` to make sure the html is loaded before doing anything else + $(function () { + var ifrw = $('#pad-iframe')[0].contentWindow; + + Cryptpad.addLoadingScreen(); + var onConnectError = function () { + Cryptpad.errorLoadingScreen(Messages.websocketError); + }; + + var APP = window.APP = { + editable: false, + Cryptpad: Cryptpad, + loggedIn: Cryptpad.isLoggedIn(), + mobile: function () { return $('body').width() <= 600; } // Menu and content area are not inline-block anymore for mobiles + }; + + var stringify = APP.stringify = function (obj) { + return JSONSortify(obj); + }; + + var E_OVER_LIMIT = 'E_OVER_LIMIT'; + + var SEARCH = "search"; + var SEARCH_NAME = Messages.fm_searchName; + var ROOT = "root"; + var ROOT_NAME = Messages.fm_rootName; + var FILES_DATA = Cryptpad.storageKey; + var FILES_DATA_NAME = Messages.fm_filesDataName; + var TEMPLATE = "template"; + var TEMPLATE_NAME = Messages.fm_templateName; + var TRASH = "trash"; + var TRASH_NAME = Messages.fm_trashName; + var RECENT = "recent"; + var RECENT_NAME = Messages.fm_recentPadsName; + + var LOCALSTORAGE_LAST = "cryptpad-file-lastOpened"; + var LOCALSTORAGE_OPENED = "cryptpad-file-openedFolders"; + var LOCALSTORAGE_VIEWMODE = "cryptpad-file-viewMode"; + var FOLDER_CONTENT_ID = "folderContent"; + + var config = {}; + var DEBUG = config.DEBUG = true; + var debug = config.debug = DEBUG ? function () { + console.log.apply(console, arguments); + } : function () { return; }; + var logError = config.logError = function () { + console.error.apply(console, arguments); + }; + var log = config.log = Cryptpad.log; + + var getLastOpenedFolder = function () { + var path; + try { + path = localStorage[LOCALSTORAGE_LAST] ? JSON.parse(localStorage[LOCALSTORAGE_LAST]) : [ROOT]; + } catch (e) { + path = [ROOT]; + } + return path; + }; + var setLastOpenedFolder = function (path) { + if (path[0] === SEARCH) { return; } + localStorage[LOCALSTORAGE_LAST] = JSON.stringify(path); + }; + + var initLocalStorage = function () { + try { + var store = JSON.parse(localStorage[LOCALSTORAGE_OPENED]); + if (!$.isArray(store)) { + localStorage[LOCALSTORAGE_OPENED] = '[]'; + } + } catch (e) { + localStorage[LOCALSTORAGE_OPENED] = '[]'; + } + }; + + var wasFolderOpened = function (path) { + var store = JSON.parse(localStorage[LOCALSTORAGE_OPENED]); + return store.indexOf(JSON.stringify(path)) !== -1; + }; + var setFolderOpened = function (path, opened) { + var s = JSON.stringify(path); + var store = JSON.parse(localStorage[LOCALSTORAGE_OPENED]); + if (opened && store.indexOf(s) === -1) { + store.push(s); + } + if (!opened) { + var idx = store.indexOf(s); + if (idx !== -1) { + store.splice(idx, 1); + } + } + localStorage[LOCALSTORAGE_OPENED] = JSON.stringify(store); + }; + + var getViewModeClass = function () { + var mode = localStorage[LOCALSTORAGE_VIEWMODE]; + if (mode === 'list') { return 'list'; } + return 'grid'; + }; + var getViewMode = function () { + return localStorage[LOCALSTORAGE_VIEWMODE] || 'grid'; + }; + var setViewMode = function (mode) { + if (typeof(mode) !== "string") { + logError("Incorrect view mode: ", mode); + return; + } + localStorage[LOCALSTORAGE_VIEWMODE] = mode; + }; + + var setSearchCursor = function () { + var $input = APP.$iframe.find('#searchInput'); + localStorage.searchCursor = $input[0].selectionStart; + }; + var getSearchCursor = function () { + return localStorage.searchCursor || 0; + }; + +/* var now = function () { + return new Date().getTime(); + }; */ + + var setEditable = function (state) { + APP.editable = state; + if (!state) { + APP.$iframe.find('#content').addClass('readonly'); + APP.$iframe.find('[draggable="true"]').attr('draggable', false); + } + else { + APP.$iframe.find('#content').removeClass('readonly'); + APP.$iframe.find('[draggable="false"]').attr('draggable', true); + } + }; + + // Icons + var $folderIcon = $('', {"class": "fa fa-folder folder icon"}); + //var $folderIcon = $('', {src: "/customize/images/icons/folder.svg", "class": "folder icon"}); + var $folderEmptyIcon = $folderIcon.clone(); + var $folderOpenedIcon = $('', {"class": "fa fa-folder-open folder"}); + //var $folderOpenedIcon = $('', {src: "/customize/images/icons/folderOpen.svg", "class": "folder icon"}); + var $folderOpenedEmptyIcon = $folderOpenedIcon.clone(); + //var $upIcon = $('', {"class": "fa fa-arrow-circle-up"}); + var $unsortedIcon = $('', {"class": "fa fa-files-o"}); + var $templateIcon = $('', {"class": "fa fa-cubes"}); + var $recentIcon = $('', {"class": "fa fa-clock-o"}); + var $trashIcon = $('', {"class": "fa fa-trash"}); + var $trashEmptyIcon = $('', {"class": "fa fa-trash-o"}); + //var $collapseIcon = $('', {"class": "fa fa-minus-square-o expcol"}); + var $expandIcon = $('', {"class": "fa fa-plus-square-o expcol"}); + var $emptyTrashIcon = $('