diff --git a/.jshintignore b/.jshintignore index c9c5d3eb8..b7a1c570e 100644 --- a/.jshintignore +++ b/.jshintignore @@ -1,6 +1,7 @@ node_modules/ www/bower_components/ www/common/pdfjs/ +www/common/tippy/ server.js www/common/media-tag.js @@ -8,7 +9,6 @@ www/scratch www/common/toolbar.js www/common/hyperscript.js -www/common/tippy.min.js www/pad/wysiwygarea-plugin.js www/pad/mediatag-plugin.js diff --git a/customize.dist/pages.js b/customize.dist/pages.js index 4cd33f038..6fd5d418e 100644 --- a/customize.dist/pages.js +++ b/customize.dist/pages.js @@ -633,12 +633,95 @@ define([ src: '/customize/cryptpad-new-logo-colors-logoonly.png?' + urlArgs }), h('div.cp-loading-spinner-container', - h('span.fa.fa-circle-o-notch.fa-spin.fa-4x.fa-fw')), + h('span.fa.fa-circle-o-notch.fa-spin.fa-8x.fa-fw')), h('p'), ]) ); }; + Pages.createCheckbox = function (id, labelTxt, checked, opts) { + opts = opts|| {}; + // Input properties + var inputOpts = { + type: 'checkbox', + id: id + }; + if (checked) { inputOpts.checked = 'checked'; } + $.extend(inputOpts, opts.input || {}); + + // Label properties + var labelOpts = {}; + $.extend(labelOpts, opts.label || {}); + if (labelOpts.class) { labelOpts.class += ' cp-checkmark'; } + + // Mark properties + var markOpts = { tabindex: 0 }; + $.extend(markOpts, opts.mark || {}); + + var input = h('input', inputOpts); + var mark = h('span.cp-checkmark-mark', markOpts); + var label = h('span.cp-checkmark-label', labelTxt); + + $(mark).keydown(function (e) { + if (e.which === 32) { + e.stopPropagation(); + e.preventDefault(); + $(input).prop('checked', !$(input).is(':checked')); + $(input).change(); + } + }); + + $(input).change(function () { $(mark).focus(); }); + + return h('label.cp-checkmark', labelOpts, [ + input, + mark, + label + ]); + }; + + Pages.createRadio = function (name, id, labelTxt, checked, opts) { + opts = opts|| {}; + // Input properties + var inputOpts = { + type: 'radio', + id: id, + name: name + }; + if (checked) { inputOpts.checked = 'checked'; } + $.extend(inputOpts, opts.input || {}); + + // Label properties + var labelOpts = {}; + $.extend(labelOpts, opts.label || {}); + if (labelOpts.class) { labelOpts.class += ' cp-checkmark'; } + + // Mark properties + var markOpts = { tabindex: 0 }; + $.extend(markOpts, opts.mark || {}); + + var input = h('input', inputOpts); + var mark = h('span.cp-radio-mark', markOpts); + var label = h('span.cp-checkmark-label', labelTxt); + + $(mark).keydown(function (e) { + if (e.which === 32) { + e.stopPropagation(); + e.preventDefault(); + $(input).prop('checked', !$(input).is(':checked')); + $(input).change(); + } + }); + + $(input).change(function () { $(mark).focus(); }); + + return h('label.cp-radio', labelOpts, [ + input, + mark, + label + ]); + }; + var hiddenLoader = function () { var loader = loadingScreen(); loader.style.display = 'none'; @@ -688,27 +771,10 @@ define([ placeholder: Msg.login_confirm, }), h('div.checkbox-container', [ - h('input#import-recent', { - name: 'import-recent', - type: 'checkbox', - checked: true - }), - // hscript doesn't generate for on label for some - // reason... use jquery as a temporary fallback - setHTML($('')[0], Msg.register_importRecent) - /*h('label', { - 'for': 'import-recent', - }, Msg.register_importRecent),*/ + Pages.createCheckbox('import-recent', Msg.register_importRecent, true) ]), h('div.checkbox-container', [ - h('input#accept-terms', { - name: 'accept-terms', - type: 'checkbox' - }), - setHTML($('')[0], Msg.register_acceptTerms) - /*setHTML(h('label', { - 'for': 'accept-terms', - }), Msg.register_acceptTerms),*/ + $(Pages.createCheckbox('accept-terms')).find('.cp-checkmark-label').append(Msg.register_acceptTerms).parent()[0] ]), h('button#register.btn.cp-login-register', Msg.login_register) ]) @@ -750,17 +816,7 @@ define([ placeholder: Msg.login_password, }), h('div.checkbox-container', [ - h('input#import-recent', { - name: 'import-recent', - type: 'checkbox', - checked: true - }), - // hscript doesn't generate for on label for some - // reason... use jquery as a temporary fallback - setHTML($('')[0], Msg.register_importRecent) - /*h('label', { - 'for': 'import-recent', - }, Msg.register_importRecent),*/ + Pages.createCheckbox('import-recent', Msg.register_importRecent, true), ]), h('div.extra', [ h('button.login.first.btn', Msg.login_login) diff --git a/customize.dist/src/less2/include/alertify.less b/customize.dist/src/less2/include/alertify.less index b845a5d6f..24c63e570 100644 --- a/customize.dist/src/less2/include/alertify.less +++ b/customize.dist/src/less2/include/alertify.less @@ -12,14 +12,11 @@ @alertify-btn-fg: @alertify-fore; - @alertify-btn-bg: rgba(200, 200, 200, 0.1); - @alertify-btn-bg-hover: rgba(200, 200, 200, .3); - @alertify-bg: @colortheme_modal-dim; @alertify-fg: @alertify-fore; @alertify-input-bg: @colortheme_modal-input; - @alertify-input-fg: @colortheme_modal-fg; + @alertify-input-fg: @colortheme_modal-input-fg; @alertify_padding-base: @variables_padding; @alertify_box-shadow: @variables_shadow; @@ -34,7 +31,7 @@ } > * { padding: @alertify_padding-base @alertify_padding-base * 4; - color: @alertify-fore; + color: @colortheme_notification-color; font-family: @colortheme_font; font-size: large; @@ -65,6 +62,8 @@ width: 100%; height: 100%; z-index: 100000; // alertify container + font: @colortheme_app-font; + &.forefront { z-index: @max-z-index; // alertify max forefront } @@ -112,10 +111,6 @@ } .dialog, .alert { - .bright { - color: @colortheme_light-base; - } - & > div { background-color: @alertify-dialog-bg; &.half { @@ -227,7 +222,7 @@ button:not(.btn):not(.pure-button):not(.md-button):not(.mdl-button) { - background-color: @alertify-btn-bg; + background-color: @colortheme_alertify-cancel; box-sizing: border-box; position: relative; outline: 0; @@ -247,7 +242,7 @@ border-radius: 0; color: @alertify-btn-fg; - border: 1px solid transparent; + border: 1px solid @colortheme_alertify-cancel-border; &.safe, &.danger { color: @colortheme_old-base; @@ -256,32 +251,40 @@ } &.danger { background-color: @colortheme_alertify-red; + border-color: @colortheme_alertify-red-border; + color: @colortheme_alertify-red-color; &:hover, &:active { - background-color: lighten(@colortheme_alertify-red, 5%); + background-color: contrast(@colortheme_modal-bg, darken(@colortheme_alertify-red, 10%), lighten(@colortheme_alertify-red, 10%)); } } &.safe { background-color: @colortheme_alertify-green; + border-color: @colortheme_alertify-green-border; + color: @colortheme_alertify-green-color; &:hover, &:active { - background-color: lighten(@colortheme_alertify-green, 10%); + background-color: contrast(@colortheme_modal-bg, darken(@colortheme_alertify-green, 10%), lighten(@colortheme_alertify-green, 10%)); } } &.primary { background-color: @colortheme_alertify-primary; color: @colortheme_alertify-primary-text; + border-color: @colortheme_alertify-primary-border; + font-weight: bold; &:hover, &:active { - background-color: darken(@colortheme_alertify-primary, 10%); + background-color: contrast(@colortheme_modal-bg, darken(@colortheme_alertify-primary, 10%), lighten(@colortheme_alertify-primary, 10%)); } } &:hover, &:active { - background-color: @alertify-btn-bg-hover; + background-color: contrast(@colortheme_modal-bg, darken(@colortheme_alertify-cancel, 10%), lighten(@colortheme_alertify-cancel, 10%)); } &:focus { - border: 1px dotted @alertify-base; + //border: 1px dotted @alertify-base; + box-shadow: 0px 0px 5px @colortheme_alertify-primary; + outline: none; } &::-moz-focus-inner { border: 0; diff --git a/customize.dist/src/less2/include/app-noscroll.less b/customize.dist/src/less2/include/app-noscroll.less index c66019d61..f0a760b5f 100644 --- a/customize.dist/src/less2/include/app-noscroll.less +++ b/customize.dist/src/less2/include/app-noscroll.less @@ -7,6 +7,7 @@ overflow: hidden; box-sizing: border-box; position: relative; + border: 0; body { height: 100%; width: 100%; @@ -15,6 +16,7 @@ overflow: hidden; box-sizing: border-box; position: relative; + border: 0; } } diff --git a/customize.dist/src/less2/include/checkmark.less b/customize.dist/src/less2/include/checkmark.less index 30c6e7d4a..adbc70750 100644 --- a/customize.dist/src/less2/include/checkmark.less +++ b/customize.dist/src/less2/include/checkmark.less @@ -5,7 +5,7 @@ @width: round(@size / 8); @dim1: round(@size / 3); @dim2: round(2 * @size / 3); - @top: round(@size / 12); + @top: round(@size / 12) - 1; // Text .cp-checkmark { margin: 0; @@ -17,6 +17,10 @@ -ms-user-select: none; user-select: none; + & > a { + margin-left: 0.25em; + } + &.cp-checkmark-secondary { .cp-checkmark-mark { &:after { @@ -26,6 +30,7 @@ input { &:checked ~ .cp-checkmark-mark { background-color: @colortheme_checkmark-back2; + border-color: @colortheme_checkmark-back2; } } } @@ -37,12 +42,19 @@ display: none; &:checked ~ .cp-checkmark-mark { background-color: @colortheme_checkmark-back1; + border-color: @colortheme_checkmark-back1; &:after { display: block; } } } + .cp-checkmark-label { + cursor: default; + &:empty { + display: none; + } + } .cp-checkmark-mark { margin-right: 10px; position: relative; @@ -51,6 +63,8 @@ background-color: @colortheme_checkmark-back0; display: flex; justify-content: center; + border: 1px solid @colortheme_form-border; + flex-shrink: 0; &:after { content: ""; display: none; @@ -60,6 +74,90 @@ transform: rotate(45deg); border: solid @colortheme_checkmark-col1; border-width: 0 @width @width 0; + position: absolute; + } + &:focus { + //border-color: #FF007C !important; + box-shadow: 0px 0px 5px @colortheme_checkmark-back1; + outline: none; + } + } + + } + + .cp-radio { + margin: 0; + display: flex; + align-items: center; + position: relative; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + + &.cp-radio-secondary { + .cp-radio-mark { + &:after { + border-color: @colortheme_checkmark-col2; + } + } + input { + &:checked ~ .cp-radio-mark { + background-color: @colortheme_checkmark-back2; + } + } + } + &:hover .cp-radio-mark { + background-color: @colortheme_checkmark-back0-active; + } + + input { + display: none; + &:checked ~ .cp-radio-mark { + background-color: @colortheme_checkmark-back1; + border-color: @colortheme_checkmark-back1; + &:after { + display: block; + } + } + } + + .cp-checkmark-label { + cursor: default; + &:empty { + display: none; + } + } + + @radio-size: @dim1 * 3; + .cp-radio-mark { + margin-right: 10px; + position: relative; + height: @radio-size; + width: @radio-size; + background-color: @colortheme_checkmark-back0; + border-radius: 50%; + display: flex; + justify-content: center; + align-items: center; + border: 1px solid @colortheme_form-border; + flex-shrink: 0; + &:after { + display: none; + content: ""; + border-radius: 50%; + background: white; + width: @dim1; + height: @dim1; + + //transform: rotate(45deg); + //border: solid @colortheme_checkmark-col1; + //border-width: 0 @width @width 0; + } + &:focus { + //border-color: #FF007C !important; + box-shadow: 0px 0px 5px @colortheme_checkmark-back1; + outline: none; } } diff --git a/customize.dist/src/less2/include/colortheme.less b/customize.dist/src/less2/include/colortheme.less index 1bdb69291..da2404b79 100644 --- a/customize.dist/src/less2/include/colortheme.less +++ b/customize.dist/src/less2/include/colortheme.less @@ -2,6 +2,9 @@ @colortheme_app-font-size: 16px; @colortheme_app-font: @colortheme_app-font-size @colortheme_font; +@colortheme_logo-1: #326599; +@colortheme_logo-2: #4591c4; + @colortheme_link-color: #0275D8; @colortheme_link-color-visited: #005999; @colortheme_info-background: #fafafa; @@ -15,23 +18,42 @@ @colortheme_cp-red: #FA5858; // remove red @colortheme_cp-green: #46E981; -@colortheme_modal-bg: #222; -@colortheme_modal-fg: #fff; +@colortheme_form-border: #bbbbbb; +@colortheme_form-bg: @colortheme_logo-2; +@colortheme_form-color: #ffffff; +@colortheme_form-bg-alt: #ffffff; +@colortheme_form-color-alt: @colortheme_logo-1; +@colortheme_form-warning: #f49842; +@colortheme_form-warning-hov: darken(@colortheme_form-warning, 5%); + +@colortheme_modal-bg: @colortheme_form-bg-alt; // TODO Modals bg +@colortheme_modal-fg: @colortheme_form-color-alt; @colortheme_modal-link: #eee; @colortheme_modal-link-visited: lighten(@colortheme_modal-link, 10%); -@colortheme_modal-dim: rgba(0, 0, 0, 0.4); +@colortheme_modal-dim: fade(@colortheme_logo-2, 50%); // TODO transparent background behind modals +@colortheme_modal-input: @colortheme_form-bg; +@colortheme_modal-input-fg: @colortheme_form-color; -@colortheme_loading-bg: #222; +@colortheme_loading-bg: @colortheme_logo-1; +@colortheme_loading-bg-alt: @colortheme_logo-2; @colortheme_loading-color: @colortheme_old-fore; -@colortheme_modal-input: #111; +// TODO modals buttons @colortheme_alertify-red: #E55236; +@colortheme_alertify-red-color: #FFF; +@colortheme_alertify-red-border: transparent; @colortheme_alertify-green: #77C825; -@colortheme_alertify-primary: #fff; -@colortheme_alertify-primary-text: #000; - -@colortheme_notification-log: rgba(0, 0, 0, 0.8); +@colortheme_alertify-green-color: #FFF; +@colortheme_alertify-green-border: transparent; +@colortheme_alertify-primary: @colortheme_form-bg; +@colortheme_alertify-primary-text: @colortheme_form-color; +@colortheme_alertify-primary-border: transparent; +@colortheme_alertify-cancel: @colortheme_modal-bg; +@colortheme_alertify-cancel-border: #ccc; + +@colortheme_notification-log: fade(@colortheme_logo-1, 90%); +@colortheme_notification-color: #fff;; @colortheme_notification-warn: rgba(205, 37, 50, 0.8); @colortheme_dropdown-bg: #f9f9f9; @@ -110,9 +132,9 @@ @cryptpad_header_col: #1E1F1F; @cryptpad_text_col: #3F4141; -@colortheme_checkmark-back0: #ffffff; -@colortheme_checkmark-back0-active: #bbbbbb; -@colortheme_checkmark-back1: #FF0073; -@colortheme_checkmark-col1: #ffffff; -@colortheme_checkmark-back2: #FFFFFF; -@colortheme_checkmark-col2: #000000; +@colortheme_checkmark-back0: @colortheme_form-bg-alt; +@colortheme_checkmark-back0-active: @colortheme_form-border; +@colortheme_checkmark-back1: @colortheme_form-bg; +@colortheme_checkmark-col1: @colortheme_form-color; +@colortheme_checkmark-back2: @colortheme_form-bg-alt; +@colortheme_checkmark-col2: @colortheme_form-color-alt; diff --git a/customize.dist/src/less2/include/creation.less b/customize.dist/src/less2/include/creation.less index 4fd0a5a1d..b2f6fa46b 100644 --- a/customize.dist/src/less2/include/creation.less +++ b/customize.dist/src/less2/include/creation.less @@ -1,47 +1,78 @@ @import (once) "./colortheme-all.less"; @import (once) "./tools.less"; -@import (once) "./checkmark.less"; @import (once) './icon-colors.less'; -.creation_main() { - .tippy-popper { - z-index: 100000001 !important; - } +.creation_main( + @color: @colortheme_default-color, // Color of the text for the toolbar + @bg-color: @colortheme_default-bg, // color of the toolbar background + @warn-color: @colortheme_default-warn, // color of the warning text in the toolbar +) { + @colortheme_creation-modal-bg: #fff; + @colortheme_creation-modal: #666; + @colortheme_creation-modal-title: @colortheme_loading-bg; + #cp-creation-container { position: absolute; z-index: 100000000; // #loading * 10 top: 0px; - background: @colortheme_loading-bg; + //background: @colortheme_loading-bg; + background: linear-gradient(to right, @colortheme_loading-bg 0%, @colortheme_loading-bg 50%, @colortheme_loading-bg-alt 50%, @colortheme_loading-bg-alt 100%); color: @colortheme_loading-color; display: flex; flex-flow: column; /* we need column so that the child can shrink vertically */ justify-content: center; + align-items: center; width: 100%; height: 100%; overflow: auto; + .cp-creation-logo { + height: 300px; + width: 300px; + margin-top: 50px; + flex: 0 1 auto; /* allows shrink */ + min-height: 0; + text-align: center; + img { + max-width: 100%; + max-height: 100%; + } + } } #cp-creation { - flex: 0 1 auto; /* allows shrink */ - min-height: 0; overflow: auto; text-align: center; + background: @colortheme_creation-modal-bg; + color: @colortheme_creation-modal; font: @colortheme_app-font; - width: 100%; outline: none; + width: 700px; + max-width: 90vw; + height: 500px; + max-height: calc(~"100vh - 20px"); + margin: 50px; + flex-shrink: 0; + display: flex; + flex-flow: column; + & > div { - width: 60vw; + width: 100%; max-width: 100%; - margin: 40px auto; + margin: auto; text-align: left; } - .cp-creation-create, .cp-creation-settings { + .cp-creation-title { + color: @colortheme_creation-modal-title; + font-weight: bold; + margin: 15px; + } + + .cp-creation-create { margin-top: 0px; - @creation-button: #30B239; button { .tools_unselectable(); padding: 15px; - background: @creation-button; + background: linear-gradient(to right, @colortheme_logo-2, @colortheme_logo-1); color: #FFF; font-weight: bold; margin: 3px 10px; @@ -50,8 +81,9 @@ outline: none; width: 100%; &:hover { + background: linear-gradient(to right, lighten(@colortheme_logo-2, 5%), lighten(@colortheme_logo-1, 5%)); //background: darken(@creation-button, 5%); - background: lighten(@creation-button, 5%); + //background: lighten(@creation-button, 5%); } } } @@ -70,6 +102,7 @@ display: flex; flex-flow: column; align-items: center; + flex: 1 0 auto; & > div { width: 400px; max-width: 100%; @@ -78,6 +111,8 @@ flex-wrap: wrap; font-size: 16px; margin: 10px 0; + min-height: 28px; + line-height: 28px; label { flex: 1; } @@ -88,31 +123,51 @@ padding: 0 10px; } } - .cp-creation-help { - font-size: 18px; - color: white; - &:hover { - color: #AAA; - text-decoration: none; - } + } + .cp-creation-help, .cp-creation-warning { + font-size: 18px; + color: @colortheme_form-warning; + &:hover { + color: @colortheme_form-warning-hov; + text-decoration: none; } } .cp-creation-slider { display: block; overflow: hidden; max-height: 0px; - transition: max-height 0.5s ease-in-out; - width: 100%; - margin-top: 10px; + max-width: 0px; + //margin-top: 10px; &.active { - max-height: 40px; + transition: max-height 0.5s ease-in-out; + max-width: unset; + max-height: 100px; } } .cp-creation-expire { .cp-creation-expire-picker { text-align: center; + input, select { + font-size: 14px; + border: 1px solid @colortheme_form-border; + height: 26px; + background-color: @colortheme_form-bg; + color: @colortheme_form-color; + } input { - width: 100px; + width: 50px; + margin: 0 5px; + } + select { + margin-right: 5px; + } + } + &.active { + label { + flex: unset; + } + .cp-creation-slider { + flex: 1; } } } @@ -125,31 +180,51 @@ } div.cp-creation-remember { - margin-top: 30px; .cp-creation-remember-help { - font-style: italic; + width: 100%; + //font-style: italic; + font-size: 12px; + font-weight: bold; + color: @colortheme_form-bg; + line-height: 20px; + .fa { + margin-right: 10px; + } } } div.cp-creation-template { width: 100%; - background-color: darken(@colortheme_modal-bg, 3%); - padding: 20px; - margin: 30px 0; - .cp-creation-title { - padding: 0 0 10px 10px; - margin: auto; + flex: 1 0 auto; + flex-wrap: nowrap; + .cp-creation-template-more { + font-size: 30px; + cursor: pointer; + margin: 0 5px; + text-align: center; + &:first-child { + left: 5px; + } + &:last-child { + right: 5px; + } + &:hover { + color: #888; + } + &.hidden { + visibility: hidden; + } } } .cp-creation-template-container { width: 100%; + flex: 1; display: flex; flex-wrap: wrap; justify-content: center; - overflow-y: auto; + //overflow-y: auto; align-items: center; .cp-creation-template-element { - @darker: darken(@colortheme_modal-fg, 30%); - + box-shadow: 2px 2px 7px @colortheme_form-border; width: 135px; padding: 5px; margin: 5px; @@ -162,19 +237,23 @@ line-height: 1em; cursor: pointer; - background-color: #111; - color: @darker; + color: black; border: 1px solid transparent; &.cp-creation-template-selected { - border: 1px solid white; - background-color: #222; + color: @color !important; + background-color: @bg-color !important; + .fa { + color: @color; + } } transition: all 0.1s; &:hover { - color: @colortheme_modal-fg; + //color: @colortheme_modal-fg; + background-color: @colortheme_form-border; + box-shadow: none; } align-items: center; @@ -196,6 +275,7 @@ max-width: 100%; } .fa { + color: @bg-color; cursor: pointer; width: 100px; height: 100px; @@ -217,45 +297,69 @@ display: inline-block; } } + } - .checkmark_main(30px); - - @media screen and (max-width: @browser_media-narrow-screen) { - & > div { - width: 95%; - margin: 10px auto; + @media screen and (max-height: 700px) { + #cp-creation-container { + .cp-creation-logo { + //flex-shrink: 0; + display: none; + } } } - @media screen and (max-width: @browser_media-medium-screen) { - #cp-creation-form { - div.cp-creation-template { - margin: 0; - padding: 5px; - .cp-creation-template-container { - .cp-creation-template-element { - flex-flow: row; - margin: 1px; - padding: 5px; - width: 155px; - img { - display: none; + @media screen and (max-width: 500px) { + #cp-creation { + #cp-creation-form { + & > div { + width: 95%; + margin: 10px auto; + } + .cp-creation-expire { + &.active { + label { + flex: 1; } - .fa { - font-size: 18px; - width: 20px; - height: 20px; - line-height: 20px; - display: inline !important; + .cp-creation-slider { + flex: unset; + order: 10; + width: 100%; } - .cp-creation-template-element-name { - margin: 0; - margin-left: 5px; + } + } + } + } + } + @media screen and (max-width: @browser_media-medium-screen) { + #cp-creation { + height: auto; + #cp-creation-form { + div.cp-creation-template { + margin: 0; + padding: 5px; + .cp-creation-template-container { + .cp-creation-template-element { + flex-flow: row; + margin: 1px; + padding: 5px; + width: 155px; + img { + display: none; + } + .fa { + font-size: 18px; + width: 20px; + height: 20px; + line-height: 20px; + display: inline !important; + } + .cp-creation-template-element-name { + margin: 0; + margin-left: 5px; + } } } } } } } - - } } diff --git a/customize.dist/src/less2/include/framework.less b/customize.dist/src/less2/include/framework.less index 4bdb2b0b8..9dfab39f6 100644 --- a/customize.dist/src/less2/include/framework.less +++ b/customize.dist/src/less2/include/framework.less @@ -1,8 +1,11 @@ +@import (once) "./colortheme-all.less"; @import (once) "./toolbar.less"; @import (once) './fileupload.less'; @import (once) './alertify.less'; @import (once) './tokenfield.less'; @import (once) './creation.less'; +@import (once) './tippy.less'; +@import (once) "./checkmark.less"; .framework_main(@bg-color, @warn-color, @color) { .toolbar_main( @@ -13,6 +16,29 @@ .fileupload_main(); .alertify_main(); .tokenfield_main(); - .creation_main(); + .tippy_main(); + .checkmark_main(20px); + .creation_main( + @bg-color: @bg-color, + @warn-color: @warn-color, + @color: @color + ); +} + +.framework_min_main( + @color: @colortheme_default-color, // Color of the text for the toolbar + @bg-color: @colortheme_default-bg, // color of the toolbar background + @warn-color: @colortheme_default-warn, // color of the warning text in the toolbar +) { + .toolbar_main( + @bg-color: @bg-color, + @warn-color: @warn-color, + @color: @color + ); + .fileupload_main(); + .alertify_main(); + .tippy_main(); + .checkmark_main(20px); } + diff --git a/customize.dist/src/less2/include/icons.less b/customize.dist/src/less2/include/icons.less index 03a6af5ab..c2ddfef32 100644 --- a/customize.dist/src/less2/include/icons.less +++ b/customize.dist/src/less2/include/icons.less @@ -10,7 +10,6 @@ text-overflow: ellipsis; padding-top: 5px; padding-bottom: 5px; - border: 1px solid white; .cp-icons-name { width: 100%; @@ -26,7 +25,7 @@ word-wrap: break-word; } &.cp-icons-element-selected { - background-color: white; + background-color: rgba(0,0,0,0.2); color: #666; } .fa { diff --git a/customize.dist/src/less2/include/modal.less b/customize.dist/src/less2/include/modal.less index 3bd674527..e7e39ad96 100644 --- a/customize.dist/src/less2/include/modal.less +++ b/customize.dist/src/less2/include/modal.less @@ -57,7 +57,7 @@ input { background-color: @colortheme_modal-input; - color: @colortheme_modal-fg; + color: @colortheme_modal-input-fg; border: 0; padding: 8px 12px; margin: 1em; diff --git a/customize.dist/src/less2/include/sidebar-layout.less b/customize.dist/src/less2/include/sidebar-layout.less index ede03942e..5640e014b 100644 --- a/customize.dist/src/less2/include/sidebar-layout.less +++ b/customize.dist/src/less2/include/sidebar-layout.less @@ -52,6 +52,12 @@ margin-bottom: 0; } } + label.noTitle { + display: inline-flex; + .fa { + margin-left: 10px; + } + } margin-bottom: 20px; } [type="text"], button { diff --git a/customize.dist/src/less2/include/tippy.less b/customize.dist/src/less2/include/tippy.less new file mode 100644 index 000000000..afec36e96 --- /dev/null +++ b/customize.dist/src/less2/include/tippy.less @@ -0,0 +1,14 @@ +@import (once) './colortheme-all.less'; + +.tippy_main() { + .tippy-tooltip.cryptpad-theme { + /* Your styling here. Example: */ + background-color: white; + box-shadow: 2px 2px 10px #000; + font-weight: bold; + color: #333; + [x-circle] { + background-color: unset; + } + } +} diff --git a/customize.dist/src/less2/include/toolbar.less b/customize.dist/src/less2/include/toolbar.less index 50c51f611..602868fe4 100644 --- a/customize.dist/src/less2/include/toolbar.less +++ b/customize.dist/src/less2/include/toolbar.less @@ -183,8 +183,13 @@ #cp-app-toolbar-creation-dialog.cp-modal-container { .icons_main(); - li:hover { - border: 1px solid white; + li { + border: 1px solid @colortheme_modal-fg; + &:hover { + //border: 1px solid @colortheme_modal-fg; + background: @colortheme_modal-fg; + color: @colortheme_modal-bg; + } } .cp-modal { display: flex; diff --git a/customize.dist/src/less2/pages/page-login.less b/customize.dist/src/less2/pages/page-login.less index 77dead84c..dafb447ed 100644 --- a/customize.dist/src/less2/pages/page-login.less +++ b/customize.dist/src/less2/pages/page-login.less @@ -1,11 +1,13 @@ @import (once) "../include/infopages.less"; @import (once) "../include/colortheme-all.less"; @import (once) "../include/alertify.less"; +@import (once) "../include/checkmark.less"; @import (once) "../loading.less"; .infopages_main(); .infopages_topbar(); .alertify_main(); +.checkmark_main(20px); .form-group { .extra { diff --git a/customize.dist/src/less2/pages/page-register.less b/customize.dist/src/less2/pages/page-register.less index e8f49a850..28edd8613 100644 --- a/customize.dist/src/less2/pages/page-register.less +++ b/customize.dist/src/less2/pages/page-register.less @@ -1,11 +1,13 @@ @import (once) "../include/infopages.less"; @import (once) "../include/colortheme-all.less"; @import (once) "../include/alertify.less"; +@import (once) "../include/checkmark.less"; @import (once) "../loading.less"; .infopages_main(); .infopages_topbar(); .alertify_main(); +.checkmark_main(20px); .cp-container { .form-group { diff --git a/www/common/common-interface.js b/www/common/common-interface.js index 24c7098c0..eafdaca78 100644 --- a/www/common/common-interface.js +++ b/www/common/common-interface.js @@ -6,13 +6,13 @@ define([ '/common/common-notifier.js', '/customize/application_config.js', '/bower_components/alertifyjs/dist/js/alertify.js', - '/common/tippy.min.js', + '/common/tippy/tippy.min.js', '/customize/pages.js', '/common/hyperscript.js', '/common/test.js', '/bower_components/bootstrap-tokenfield/dist/bootstrap-tokenfield.js', - 'css!/common/tippy.css', + 'css!/common/tippy/tippy.css', ], function ($, Messages, Util, Hash, Notifier, AppConfig, Alertify, Tippy, Pages, h, Test) { var UI = {}; @@ -539,16 +539,16 @@ define([ var LOADING = 'cp-loading'; - var getRandomTip = function () { + /*var getRandomTip = function () { if (!Messages.tips || !Object.keys(Messages.tips).length) { return ''; } var keys = Object.keys(Messages.tips); var rdm = Math.floor(Math.random() * keys.length); return Messages.tips[keys[rdm]]; - }; + };*/ UI.addLoadingScreen = function (config) { config = config || {}; var loadingText = config.loadingText; - var hideTips = config.hideTips || AppConfig.hideLoadingScreenTips; + //var hideTips = config.hideTips || AppConfig.hideLoadingScreenTips; var hideLogo = config.hideLogo; var $loading, $container; if ($('#' + LOADING).length) { @@ -557,9 +557,9 @@ define([ $loading.removeClass('cp-loading-hidden'); $('.cp-loading-spinner-container').show(); if (loadingText) { - $('#' + LOADING).find('p').text(loadingText); + $('#' + LOADING).find('p').show().text(loadingText); } else { - $('#' + LOADING).find('p').text(''); + $('#' + LOADING).find('p').hide().text(''); } $container = $loading.find('.cp-loading-container'); } else { @@ -574,14 +574,14 @@ define([ $spinner.show(); $('body').append($loading); } - if (Messages.tips && !hideTips) { + /*if (Messages.tips && !hideTips) { var $loadingTip = $('
', {'id': 'cp-loading-tip'}); $('', {'class': 'tips'}).text(getRandomTip()).appendTo($loadingTip); $loadingTip.css({ 'bottom': $('body').height()/2 - $container.height()/2 + 20 + 'px' }); $('body').append($loadingTip); - } + }*/ }; UI.removeLoadingScreen = function (cb) { // Release the test blocker, hopefully every test has been registered. @@ -610,8 +610,8 @@ define([ } $('.cp-loading-spinner-container').hide(); $('#cp-loading-tip').remove(); - if (transparent) { $('#' + LOADING).css('opacity', 0.8); } - $('#' + LOADING).find('p').html(error || Messages.error); + if (transparent) { $('#' + LOADING).css('opacity', 0.9); } + $('#' + LOADING).find('p').show().html(error || Messages.error); if (exitable) { $(window).focus(); $(window).keydown(function (e) { @@ -660,18 +660,38 @@ define([ }); }; + var delay = typeof(AppConfig.tooltipDelay) === "number" ? AppConfig.tooltipDelay : 500; + $.extend(true, Tippy.defaults, { + placement: 'bottom', + performance: true, + delay: [delay, 0], + //sticky: true, + theme: 'cryptpad', + arrow: true, + maxWidth: '200px', + flip: true, + popperOptions: { + modifiers: { + preventOverflow: { boundariesElement: 'window' } + } + }, + //arrowType: 'round', + arrowTransform: 'scale(2)', + zIndex: 100000001 + }); UI.addTooltips = function () { var MutationObserver = window.MutationObserver; - var delay = typeof(AppConfig.tooltipDelay) === "number" ? AppConfig.tooltipDelay : 500; var addTippy = function (i, el) { if (el.nodeName === 'IFRAME') { return; } - Tippy(el, { - position: 'bottom', - distance: 0, - performance: true, - delay: [delay, 0], - sticky: true + var opts = { + distance: 15 + }; + Array.prototype.slice.apply(el.attributes).filter(function (obj) { + return /^data-tippy-/.test(obj.name); + }).forEach(function (obj) { + opts[obj.name.slice(11)] = obj.value; }); + Tippy(el, opts); }; // This is the robust solution to remove dangling tooltips // The mutation observer does not always find removed nodes. @@ -720,5 +740,9 @@ define([ }); }; + UI.createCheckbox = Pages.createCheckbox; + + UI.createRadio = Pages.createRadio; + return UI; }); diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 036d63bc8..100377fcb 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -13,8 +13,6 @@ define([ '/customize/messages.js', '/customize/application_config.js', '/bower_components/nthen/index.js', - - 'css!/common/tippy.css', ], function ($, Config, Util, Hash, Language, UI, Constants, Feedback, h, MediaTag, Clipboard, Messages, AppConfig, NThen) { var UIElements = {}; @@ -237,7 +235,11 @@ define([ var link = h('div.cp-share-modal', [ h('label', Messages.share_linkAccess), h('br'), - h('input#cp-share-editable-true.cp-share-editable-value', { + UI.createRadio('cp-share-editable', 'cp-share-editable-true', + Messages.share_linkEdit, true, { mark: {tabindex:1} }), + UI.createRadio('cp-share-editable', 'cp-share-editable-false', + Messages.share_linkView, false, { mark: {tabindex:1} }), + /*h('input#cp-share-editable-true.cp-share-editable-value', { type: 'radio', name: 'cp-share-editable', value: 1, @@ -248,25 +250,14 @@ define([ name: 'cp-share-editable', value: 0 }), - h('label', { 'for': 'cp-share-editable-false' }, Messages.share_linkView), - h('br'), + h('label', { 'for': 'cp-share-editable-false' }, Messages.share_linkView),*/ h('br'), h('label', Messages.share_linkOptions), h('br'), - h('input#cp-share-embed', { - type: 'checkbox', - name: 'cp-share-embed' - }), - h('label', { 'for': 'cp-share-embed' }, Messages.share_linkEmbed), + UI.createCheckbox('cp-share-embed', Messages.share_linkEmbed, false, { mark: {tabindex:1} }), + UI.createCheckbox('cp-share-present', Messages.share_linkPresent, false, { mark: {tabindex:1} }), h('br'), - h('input#cp-share-present', { - type: 'checkbox', - name: 'cp-share-present' - }), - h('label', { 'for': 'cp-share-present' }, Messages.share_linkPresent), - h('br'), - h('br'), - UI.dialog.selectable('', { id: 'cp-share-link-preview' }) + UI.dialog.selectable('', { id: 'cp-share-link-preview', tabindex: 1 }) ]); if (!hashes.editHash) { $(link).find('#cp-share-editable-false').attr('checked', true); @@ -1685,14 +1676,10 @@ define([ var priv = common.getMetadataMgr().getPrivateData(); var c = (priv.settings.general && priv.settings.general.creation) || {}; if (AppConfig.displayCreationScreen && common.isLoggedIn() && c.skip) { - $advanced = $('', { - type: 'checkbox', - checked: 'checked', - id: 'cp-app-toolbar-creation-advanced' - }).appendTo($advancedContainer); - $('