', {id: 'rightSide'}).appendTo(APP.$container);
+
+ createToolbar();
+
+ if (window.location.hash) {
+ return void andThen(window.location.hash.slice(1));
+ }
+ getOrCreateProfile();
+ };
+
+ $(function () {
+ $(window).click(function () {
+ $('.cp-dropdown-content').hide();
+ });
+
+ APP.$container = $('#container');
+ APP.$toolbar = $('#toolbar');
+
+ Cryptpad.ready(function () {
+ Cryptpad.reportAppUsage();
+ onCryptpadReady();
+ });
+ });
+
+});
diff --git a/www/oldprofile/main.less b/www/oldprofile/main.less
new file mode 100644
index 000000000..d0aa180de
--- /dev/null
+++ b/www/oldprofile/main.less
@@ -0,0 +1,143 @@
+@import '/customize/src/less/variables.less';
+@import '/customize/src/less/mixins.less';
+@import '/customize/src/less/sidebar-layout.less';
+
+.cp {
+ #header {
+ display: flex;
+ #rightside {
+ flex: 1;
+ display: flex;
+ flex-flow: column;
+ }
+ }
+ #avatar {
+ width: 300px;
+ //height: 350px;
+ margin: 10px;
+ margin-right: 20px;
+ text-align: center;
+ &> span {
+ display: inline-block;
+ text-align: center;
+ height: 300px;
+ width: 300px;
+ border: 1px solid black;
+ border-radius: 4px;
+ overflow: hidden;
+ position: relative;
+ .delete {
+ right: 0;
+ position: absolute;
+ opacity: 0.7;
+ &:hover {
+ opacity: 1;
+ }
+ }
+ }
+ img {
+ max-width: 100%;
+ max-height: 100%;
+ vertical-align: top;
+ }
+ media-tag {
+ height: 100%;
+ width: 100%;
+ display: inline-flex;
+ justify-content: center;
+ align-items: center;
+ img {
+ min-width: 100%;
+ min-height: 100%;
+ max-width: none;
+ max-height: none;
+ flex: 1;
+ }
+ }
+ button {
+ height: 40px;
+ margin: 5px;
+ }
+ }
+ #displayName, #link {
+ width: 100%;
+ height: 40px;
+ margin: 10px 0;
+ input {
+ width: 100%;
+ font-size: 20px;
+ box-sizing: border-box;
+ padding-right: 30px;
+ }
+ input:focus ~ .edit {
+ display: none;
+ }
+ .edit {
+ position: absolute;
+ margin-left: -25px;
+ margin-top: 8px;
+ }
+ .temp {
+ font-weight: 400;
+ font-family: sans-serif;
+ }
+ .displayName {
+ font-weight: bold;
+ font-size: 30px;
+ }
+ .link {
+ font-size: 25px;
+ }
+ .displayName, .link {
+ line-height: 40px;
+ }
+ }
+
+ // I tried using flexbox but messed with how the pencil icon was displayed
+ #inviteButton {
+ float: right;
+ }
+ #viewProfileButton {
+ margin-bottom: 20px;
+ float: right;
+ }
+ #description {
+ position: relative;
+ font-size: 16px;
+ border: 1px solid #DDD;
+ margin-bottom: 20px;
+ .rendered {
+ padding: 0 15px;
+ }
+ .ok, .spin {
+ position: absolute;
+ top: 2px;
+ right: 2px;
+ display: none;
+ z-index: 1000;
+ }
+ textarea {
+ width: 100%;
+ height: 300px;
+ }
+ .CodeMirror {
+ border: 1px solid #DDD;
+ font-family: monospace;
+ font-size: 16px;
+ line-height: initial;
+ pre {
+ margin: 0;
+ font-family: inherit;
+ font-size: inherit;
+ line-height: inherit;
+ }
+ }
+ }
+ #createProfile {
+ height: 100%;
+ display: flex;
+ flex-flow: column;
+ align-items: center;
+ justify-content: center;
+ }
+}
diff --git a/www/profile/app-profile.less b/www/profile/app-profile.less
new file mode 100644
index 000000000..d776f52fc
--- /dev/null
+++ b/www/profile/app-profile.less
@@ -0,0 +1,160 @@
+@import (once) "../../customize/src/less2/include/browser.less";
+@import (once) "../../customize/src/less2/include/toolbar.less";
+@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/less/mixins.less';
+//@import (once) '../../customize/src/less/variables.less";
+
+@import (once) '../../customize/src/less2/include/avatar.less';
+@import (once) '../../customize/src/less2/include/sidebar-layout.less';
+
+
+.toolbar_main();
+.fileupload_main();
+.alertify_main();
+.sidebar-layout_main();
+
+// body
+&.cp-app-profile {
+ display: flex;
+ flex-flow: column;
+ #header {
+ display: flex;
+ #rightside {
+ flex: 1;
+ display: flex;
+ flex-flow: column;
+ }
+ }
+ #avatar {
+ width: 300px;
+ //height: 350px;
+ margin: 10px;
+ margin-right: 20px;
+ text-align: center;
+ &> span {
+ display: inline-block;
+ text-align: center;
+ height: 300px;
+ width: 300px;
+ border: 1px solid black;
+ border-radius: 4px;
+ overflow: hidden;
+ position: relative;
+ .delete {
+ right: 0;
+ position: absolute;
+ opacity: 0.7;
+ &:hover {
+ opacity: 1;
+ }
+ }
+ }
+ img {
+ max-width: 100%;
+ max-height: 100%;
+ vertical-align: top;
+ }
+ media-tag {
+ height: 100%;
+ width: 100%;
+ display: inline-flex;
+ justify-content: center;
+ align-items: center;
+ img {
+ min-width: 100%;
+ min-height: 100%;
+ max-width: none;
+ max-height: none;
+ flex: 1;
+ }
+ }
+ button {
+ height: 40px;
+ margin: 5px;
+ }
+ }
+ #displayName, #link {
+ width: 100%;
+ height: 40px;
+ margin: 10px 0;
+ input {
+ width: 100%;
+ font-size: 20px;
+ box-sizing: border-box;
+ padding-right: 30px;
+ }
+ input:focus ~ .edit {
+ display: none;
+ }
+ .edit {
+ position: absolute;
+ margin-left: -25px;
+ margin-top: 8px;
+ }
+ .temp {
+ font-weight: 400;
+ font-family: sans-serif;
+ }
+ .displayName {
+ font-weight: bold;
+ font-size: 30px;
+ }
+ .link {
+ font-size: 25px;
+ }
+ .displayName, .link {
+ line-height: 40px;
+ }
+ }
+
+ // I tried using flexbox but messed with how the pencil icon was displayed
+ #inviteButton {
+ float: right;
+ }
+ #viewProfileButton {
+ margin-bottom: 20px;
+ float: right;
+ }
+ #description {
+ position: relative;
+ font-size: 16px;
+ border: 1px solid #DDD;
+ margin-bottom: 20px;
+ .rendered {
+ padding: 0 15px;
+ }
+ .ok, .spin {
+ position: absolute;
+ top: 2px;
+ right: 2px;
+ display: none;
+ z-index: 1000;
+ }
+ textarea {
+ width: 100%;
+ height: 300px;
+ }
+ .CodeMirror {
+ border: 1px solid #DDD;
+ font-family: monospace;
+ font-size: 16px;
+ line-height: initial;
+ pre {
+ margin: 0;
+ font-family: inherit;
+ font-size: inherit;
+ line-height: inherit;
+ }
+ }
+ }
+ #createProfile {
+ height: 100%;
+ display: flex;
+ flex-flow: column;
+ align-items: center;
+ justify-content: center;
+ }
+}
+
diff --git a/www/profile/inner.html b/www/profile/inner.html
new file mode 100644
index 000000000..b3ee6ea04
--- /dev/null
+++ b/www/profile/inner.html
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/www/profile/inner.js b/www/profile/inner.js
new file mode 100644
index 000000000..a09fa921c
--- /dev/null
+++ b/www/profile/inner.js
@@ -0,0 +1,476 @@
+define([
+ 'jquery',
+ '/bower_components/chainpad-crypto/crypto.js',
+ '/common/sframe-chainpad-listmap.js',
+ '/common/toolbar3.js',
+ '/common/cryptpad-common.js',
+ '/bower_components/nthen/index.js',
+ '/common/sframe-common.js',
+ '/bower_components/marked/marked.min.js',
+ 'cm/lib/codemirror',
+ 'cm/mode/markdown/markdown',
+
+ 'css!/bower_components/codemirror/lib/codemirror.css',
+ 'css!/bower_components/codemirror/addon/dialog/dialog.css',
+ 'css!/bower_components/codemirror/addon/fold/foldgutter.css',
+ 'css!/bower_components/bootstrap/dist/css/bootstrap.min.css',
+ 'less!/bower_components/components-font-awesome/css/font-awesome.min.css',
+ 'less!/customize/src/less2/main.less',
+], function (
+ $,
+ Crypto,
+ Listmap,
+ Toolbar,
+ Cryptpad,
+ nThen,
+ SFCommon,
+ Marked,
+ CodeMirror
+ )
+{
+ var Messages = Cryptpad.Messages;
+ var APP = window.APP = {
+ Cryptpad: Cryptpad,
+ _onRefresh: []
+ };
+ var onConnectError = function () {
+ Cryptpad.errorLoadingScreen(Messages.websocketError);
+ };
+
+ // Decryption event for avatar mediatag (TODO not needed anymore?)
+ $(window.document).on('decryption', function (e) {
+ var decrypted = e.originalEvent;
+ if (decrypted.callback) { decrypted.callback(); }
+ })
+ .on('decryptionError', function (e) {
+ var error = e.originalEvent;
+ Cryptpad.alert(error.message);
+ });
+
+ $(window).click(function () {
+ $('.cp-dropdown-content').hide();
+ });
+
+ // Marked
+ var renderer = new Marked.Renderer();
+ Marked.setOptions({
+ renderer: renderer,
+ sanitize: true
+ });
+ // Tasks list
+ var checkedTaskItemPtn = /^\s*\[x\]\s*/;
+ var uncheckedTaskItemPtn = /^\s*\[ \]\s*/;
+ renderer.listitem = function (text) {
+ var isCheckedTaskItem = checkedTaskItemPtn.test(text);
+ var isUncheckedTaskItem = uncheckedTaskItemPtn.test(text);
+ if (isCheckedTaskItem) {
+ text = text.replace(checkedTaskItemPtn,
+ '
') + '\n';
+ }
+ if (isUncheckedTaskItem) {
+ text = text.replace(uncheckedTaskItemPtn,
+ '
') + '\n';
+ }
+ var cls = (isCheckedTaskItem || isUncheckedTaskItem) ? ' class="todo-list-item"' : '';
+ return '
' + text + '\n';
+ };
+
+ var DISPLAYNAME_ID = "displayName";
+ var LINK_ID = "link";
+ var AVATAR_ID = "avatar";
+ var DESCRIPTION_ID = "description";
+ var PUBKEY_ID = "pubKey";
+ var CREATE_ID = "createProfile";
+ var HEADER_ID = "header";
+ var HEADER_RIGHT_ID = "rightside";
+ var CREATE_INVITE_BUTTON = 'inviteButton'; /* jshint ignore: line */
+ var VIEW_PROFILE_BUTTON = 'viewProfileButton';
+
+ var common;
+ var sFrameChan;
+
+ var createEditableInput = function ($block, name, ph, getValue, setValue, fallbackValue) {
+ fallbackValue = fallbackValue || ''; // don't ever display 'null' or 'undefined'
+ var lastVal;
+ getValue(function (value) {
+ lastVal = value;
+ var $input = $('
', {
+ 'id': name+'Input',
+ placeholder: ph
+ }).val(value);
+ var $icon = $('
', {'class': 'fa fa-pencil edit'});
+ var editing = false;
+ var todo = function () {
+ if (editing) { return; }
+ editing = true;
+
+ var newVal = $input.val().trim();
+
+ if (newVal === lastVal) {
+ editing = false;
+ return;
+ }
+
+ setValue(newVal, function (err) {
+ if (err) { return void console.error(err); }
+ lastVal = newVal;
+ Cryptpad.log(Messages._getKey('profile_fieldSaved', [newVal || fallbackValue]));
+ editing = false;
+ });
+ };
+ $input.on('keyup', function (e) {
+ if (e.which === 13) { return void todo(); }
+ if (e.which === 27) {
+ $input.val(lastVal);
+ }
+ });
+ $icon.click(function () { $input.focus(); });
+ $input.focus(function () {
+ $input.width('');
+ });
+ $input.focusout(todo);
+ $block.append($input).append($icon);
+ });
+ };
+
+/* jshint ignore:start */
+ var isFriend = function (proxy, edKey) {
+ var friends = Cryptpad.find(proxy, ['friends']);
+ return typeof(edKey) === 'string' && friends && (edKey in friends);
+ };
+
+ var addCreateInviteLinkButton = function ($container) {
+ return;
+ var obj = APP.lm.proxy;
+
+ var proxy = Cryptpad.getProxy();
+ var userViewHash = Cryptpad.find(proxy, ['profile', 'view']);
+
+ var edKey = obj.edKey;
+ var curveKey = obj.curveKey;
+
+ if (!APP.readOnly || !curveKey || !edKey || userViewHash === window.location.hash.slice(1) || isFriend(proxy, edKey)) {
+ //console.log("edit mode or missing curve key, or you're viewing your own profile");
+ return;
+ }
+
+ // sanitize user inputs
+
+ var unsafeName = obj.name || '';
+ console.log(unsafeName);
+ var name = Cryptpad.fixHTML(unsafeName) || Messages.anonymous;
+ console.log(name);
+
+ console.log("Creating invite button");
+ $("