diff --git a/customize.dist/src/less2/include/drive.less b/customize.dist/src/less2/include/drive.less index bf17b1e76..0eb400587 100644 --- a/customize.dist/src/less2/include/drive.less +++ b/customize.dist/src/less2/include/drive.less @@ -905,126 +905,6 @@ } } - /* Toolbar */ - - // XXX remove, preserve drive path? - #cp-app-drive-toolbar { - background: @colortheme_drive-bg-light; - color: @colortheme_drive-color; - //height: 30px; - //display: flex; - //flex-flow: row; - z-index: 100; - box-sizing: border-box; - height: @variables_bar-height; - padding: 0; - display: flex; - flex-flow: row; - - * { - outline-width: 0; - &:focus { - outline-width: 0; - } - } - - .cp-toolbar-icon-history { - float: right; - &.active { - background-color: rgba(0, 0, 255, 0.2); - } - .cp-toolbar-drawer-element { - display: none; - } - } - - .cp-app-drive-toolbar-rightside, .cp-app-drive-toolbar-leftside { - display: inline-block; - margin: 0; - padding: 0; - .fa, .cptools { - margin: 0; - vertical-align: top; - } - button { - height: @variables_bar-height !important; - padding: 0 10px; - border: none; - border-radius: 0; - box-sizing: border-box; - background: transparent; - font-size: @colortheme_app-font-size; - color: @colortheme_drive-color; - transition: all 0.15s; - display: inline-flex; - align-items: center; - .drawer { - display: none; - } - .fa, .cptools, span { - font-size: @colortheme_app-font-size; - } - &:hover { - background: @colortheme_drive-bg-active; - } - &.cp-app-drive-toolbar-active { - display: none; - } - } - } - .cp-app-drive-toolbar-rightside { - float: right; - flex-shrink: 0; - & > * { - float: right; - } - #cp-app-drive-toolbar-contextbuttons { - display: inline-block; - height: 100%; - } - padding-left: 10px; - } - .cp-app-drive-toolbar-leftside { - flex-shrink: 0; - & > span { - height: 100%; - margin: 0; - } - button { - padding: 0 10px; - .fa, .cptools { - margin-right: 5px; - } - .cp-dropdown-button-title { - display: inline-flex; - height: @variables_bar-height; - align-items: center; - span:not(.fa):not(.cptools) { - line-height: 23px; - } - } - } - } - - button { - font: @colortheme_app-font; - span { - font: @colortheme_app-font; - } - .fa, &.fa { - font-family: FontAwesome; - } - .cptools, &.cptools { - font-family: cptools; - } - } - - - .cp-app-drive-toolbar-filler { - flex: 1; - } - } - #cp-app-drive-edition-state { height: @variables_bar-height; display: flex; diff --git a/customize.dist/src/less2/include/toolbar.less b/customize.dist/src/less2/include/toolbar.less index 0c26c0e3b..985f6bd83 100644 --- a/customize.dist/src/less2/include/toolbar.less +++ b/customize.dist/src/less2/include/toolbar.less @@ -949,10 +949,6 @@ } } - .cp-dropdown-content { - margin-top: -1px; - } - & > span { height: @toolbar_line-height; } diff --git a/www/code/markers.js b/www/code/markers.js index fb67736a6..b070e68fc 100644 --- a/www/code/markers.js +++ b/www/code/markers.js @@ -622,30 +622,9 @@ define([ }); }; - var authorUid = function (existing) { - if (!Array.isArray(existing)) { existing = []; } - var n; - var i = 0; - while (!n || existing.indexOf(n) !== -1 && i++ < 1000) { - n = Math.floor(Math.random() * 1000000); - } - // If we can't find a valid number in 1000 iterations, use 0... - if (existing.indexOf(n) !== -1) { n = 0; } - return n; - }; var getAuthorId = function (Env) { - var existing = Object.keys(Env.authormarks.authors || {}).map(Number); - if (!Env.common.isLoggedIn()) { return authorUid(existing); } - var userData = Env.common.getMetadataMgr().getUserData(); - var uid; - existing.some(function (id) { - var author = Env.authormarks.authors[id] || {}; - if (author.curvePublic !== userData.curvePublic) { return; } - uid = Number(id); - return true; - }); - return uid || authorUid(existing); + return Env.common.getAuthorId(Env.authormarks.authors, userData.curvePublic); }; var ready = function (Env) { Env.ready = true; diff --git a/www/common/sframe-common.js b/www/common/sframe-common.js index 4fe715cf9..3d5df4f03 100644 --- a/www/common/sframe-common.js +++ b/www/common/sframe-common.js @@ -202,6 +202,33 @@ define([ }; }; + funcs.getAuthorId = function () { + }; + + var authorUid = function(existing) { + if (!Array.isArray(existing)) { existing = []; } + var n; + var i = 0; + while (!n || existing.indexOf(n) !== -1 && i++ < 1000) { + n = Math.floor(Math.random() * 1000000); + } + // If we can't find a valid number in 1000 iterations, use 0... + if (existing.indexOf(n) !== -1) { n = 0; } + return n; + }; + funcs.getAuthorId = function(authors, curve) { + var existing = Object.keys(authors || {}).map(Number); + if (!funcs.isLoggedIn()) { return authorUid(existing); } + + var uid; + existing.some(function(id) { + var author = authors[id] || {}; + if (author.curvePublic !== curve) { return; } + uid = Number(id); + return true; + }); + return uid || authorUid(existing); + }; // Chat var padChatChannel; diff --git a/www/pad/comments.js b/www/pad/comments.js index 128784671..da98ceeb2 100644 --- a/www/pad/comments.js +++ b/www/pad/comments.js @@ -42,30 +42,8 @@ define([ var canonicalize = function(t) { return t.replace(/\r\n/g, '\n'); }; - // XXX function duplicated from www/code/markers.js - var authorUid = function(existing) { - if (!Array.isArray(existing)) { existing = []; } - var n; - var i = 0; - while (!n || existing.indexOf(n) !== -1 && i++ < 1000) { - n = Math.floor(Math.random() * 1000000); - } - // If we can't find a valid number in 1000 iterations, use 0... - if (existing.indexOf(n) !== -1) { n = 0; } - return n; - }; var getAuthorId = function(Env, curve) { - var existing = Object.keys(Env.comments.authors || {}).map(Number); - if (!Env.common.isLoggedIn()) { return authorUid(existing); } - - var uid; - existing.some(function(id) { - var author = Env.comments.authors[id] || {}; - if (author.curvePublic !== curve) { return; } - uid = Number(id); - return true; - }); - return uid || authorUid(existing); + return Env.common.getAuthorId(Env.comments.authors, curve); }; // Return the author ID and add/update the data for registered users