1
0
Fork 0
mirror of https://github.com/Luzifer/cloudkeys-go.git synced 2024-11-09 14:40:05 +00:00
cloudkeys-go/assets/script.js

401 lines
14 KiB
JavaScript
Raw Permalink Normal View History

// Generated by CoffeeScript 2.4.1
2015-07-29 07:01:23 +00:00
(function() {
// vim: set tabstop=2 shiftwidth=2 softtabstop=2 expandtab:
2015-07-29 07:01:23 +00:00
var CloudKeys;
CloudKeys = class CloudKeys {
constructor() {
2015-07-29 07:01:23 +00:00
this.entities = [];
this.version = "";
this.password = ''; //todo replace with user password
$('#pw').focus().keyup((evt) => {
if (evt.keyCode === 13) {
this.password = $('#pw').val();
$('#loader').removeClass('hide');
this.fetchData();
$('#newEntityLink').click(() => {
return this.showForm();
});
$('#editEncPWLink').click(() => {
return this.showEditEncPWForm();
});
$('#passwordRequest').addClass('hide');
$('#search').keyup(() => {
this.limitItems(this.getItems($('#search').val()));
});
$('#search').focus();
return $(window).keyup((evt) => {
if (evt.altKey === true && evt.keyCode === 66) {
if (typeof window.copyToClipboard === "function") {
copyToClipboard($('#items li.active .username').val());
} else {
$('#items li.active .username').focus().select();
2015-07-29 07:01:23 +00:00
}
}
if (evt.altKey === true && evt.keyCode === 79) { // workaround to copy password very fast
if (typeof window.copyToClipboard === "function") {
copyToClipboard($('#items li.active .password').data('toggle'));
} else {
$('#items li.active .passwordtoggle em').click();
$('#items li.active .password').focus().select();
2015-07-29 07:01:23 +00:00
}
}
if (evt.altKey === true && evt.keyCode === 80) {
if (typeof window.copyToClipboard === "function") {
copyToClipboard($('#items li.active .password').data('toggle'));
} else {
$('#items li.active .password').focus().select();
2015-07-29 07:01:23 +00:00
}
}
if (evt.altKey === true && evt.keyCode === 85) {
if (typeof window.copyToClipboard === "function") {
return copyToClipboard($('#items li.active .url').val());
} else {
return $('#items li.active .url').focus().select();
2015-07-29 07:01:23 +00:00
}
}
});
}
});
2015-07-29 07:01:23 +00:00
}
import(xml) {
2015-07-29 07:01:23 +00:00
var e, entity, entry, group, j, l, len, len1, parsedXML, ref, ref1, tag;
parsedXML = $.parseXML(xml);
ref = $(parsedXML).find('group');
for (j = 0, len = ref.length; j < len; j++) {
group = ref[j];
tag = $(group).find('>title').text();
ref1 = $(group).find('entry');
for (l = 0, len1 = ref1.length; l < len1; l++) {
entry = ref1[l];
e = $(entry);
entity = {};
entity['title'] = e.find('title').text();
entity['username'] = e.find('username').text();
entity['password'] = e.find('password').text();
entity['url'] = e.find('url').text();
entity['comment'] = e.find('comment').text();
entity['tags'] = tag;
this.entities.push(entity);
}
}
return this.updateData(() => {
$('#import').val('');
return $('#importLink').click();
});
}
2015-07-29 07:01:23 +00:00
updateData(callback) {
2015-07-29 07:01:23 +00:00
var encrypted, hash;
encrypted = this.encrypt(JSON.stringify(this.entities));
hash = CryptoJS.SHA1(encrypted).toString();
return $.post('ajax', {
'version': this.version,
'checksum': hash,
'data': encrypted
}, (result) => {
if (result.error === true) {
return alert("An error occured, please reload and try it again");
} else {
if (typeof callback !== "undefined") {
callback();
2015-07-29 07:01:23 +00:00
}
return this.updateInformation(result);
}
}, "json");
}
2015-07-29 07:01:23 +00:00
fetchData() {
return $.get('ajax', (data) => {
return this.updateInformation(data);
}, "json");
}
2015-07-29 07:01:23 +00:00
updateInformation(data) {
2017-01-22 13:40:54 +00:00
var e;
2015-07-29 07:01:23 +00:00
this.version = data.version;
if (data.data === "") {
this.entities = [];
} else {
try {
this.entities = $.parseJSON(this.decrypt(data.data));
Removed old clippy flash extension and replaced it with pure JS solution Squashed commit of the following: commit 682b84ab51cbaaa8343139c851a9b4278886e0da Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 21:13:13 2015 +0000 fixed godeps path commit 816132283ffa6b4520c93e199bb89b747afe306e Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 21:12:23 2015 +0000 removed branding commit d7683dd6a56427c21bd0f86c7b034bd83deb3ec7 Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 21:08:33 2015 +0000 reverted some individual stuff commit 26bc1a35e110f14b3b9f74e35cea8d66eb8129fc Merge: ecd8e53 b8ad8ee Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 20:51:18 2015 +0000 Merge branch 'master' of github.com:Luzifer/cloudkeys-go into clipboardapi Conflicts: assets/script.js bindata.go coffee/script.coffee commit ecd8e53b13d053fece855ee01b627326cf24b2f0 Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 20:45:20 2015 +0000 removed old clippy flash extension and replaced it with pure JS solution commit 225e9f13c291c17e7d5de9d6b1a7cb43a1277e2f Author: Martin Thielecke <github@mthie.com> Date: Sat Aug 1 18:14:14 2015 +0000 [main] Revert "changed variable names according to linter" This reverts commit 91ac55453ccc4a83fae417e22d0c69600501e10b. commit 91ac55453ccc4a83fae417e22d0c69600501e10b Author: Martin Thielecke <github@mthie.com> Date: Sat Aug 1 11:54:53 2015 +0000 changed variable names according to linter commit 7a0f9e22ba66493dfc7782afee0fbb54bb4a7701 Merge: 6c57d39 8386e47 Author: Martin Thielecke <github@mthie.com> Date: Sat Aug 1 11:32:28 2015 +0000 Merge branch 'master' of github.com:Luzifer/cloudkeys-go commit 6c57d394ae0d8d6412c4d4903a6384e697e906ad Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 19:30:47 2015 +0000 added title commit 17ae0383fd4f09ec394d398ea67aac033e53f900 Merge: d813879 553680c Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 19:21:18 2015 +0000 Merge branch 'development' of github.com:mthie/cloudkeys-go commit 553680c725ed2352b7b225c4f592c26ac9bbc364 Merge: ec26daa 1b66ad4 Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 19:19:41 2015 +0000 Merge branch 'master' of github.com:Luzifer/cloudkeys-go into development commit d81387910e62f7ddfe2043e22ca75a23544f19d4 Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 18:51:28 2015 +0000 changed title commit 45a64d11105038c2cc3c5060975bd0f458df1db6 Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 18:36:14 2015 +0000 changed usernames for deployment commit ec26daa6793167cee3736a66b5506925e09272c8 Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 18:34:36 2015 +0000 fixed username
2015-11-30 21:27:23 +00:00
} catch (error) {
e = error;
2015-07-29 07:01:23 +00:00
window.location.reload();
}
}
this.entities.sort(this.sortItems);
this.showItems(this.getItems(''));
return this.limitItems(this.getItems($('#search').val()));
}
2015-07-29 07:01:23 +00:00
encrypt(value) {
2015-07-29 07:01:23 +00:00
return CryptoJS.AES.encrypt(value, this.password).toString();
}
2015-07-29 07:01:23 +00:00
decrypt(value) {
2015-07-29 07:01:23 +00:00
return CryptoJS.AES.decrypt(value, this.password).toString(CryptoJS.enc.Utf8);
}
2015-07-29 07:01:23 +00:00
getClipboardCode(value) {
Removed old clippy flash extension and replaced it with pure JS solution Squashed commit of the following: commit 682b84ab51cbaaa8343139c851a9b4278886e0da Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 21:13:13 2015 +0000 fixed godeps path commit 816132283ffa6b4520c93e199bb89b747afe306e Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 21:12:23 2015 +0000 removed branding commit d7683dd6a56427c21bd0f86c7b034bd83deb3ec7 Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 21:08:33 2015 +0000 reverted some individual stuff commit 26bc1a35e110f14b3b9f74e35cea8d66eb8129fc Merge: ecd8e53 b8ad8ee Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 20:51:18 2015 +0000 Merge branch 'master' of github.com:Luzifer/cloudkeys-go into clipboardapi Conflicts: assets/script.js bindata.go coffee/script.coffee commit ecd8e53b13d053fece855ee01b627326cf24b2f0 Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 20:45:20 2015 +0000 removed old clippy flash extension and replaced it with pure JS solution commit 225e9f13c291c17e7d5de9d6b1a7cb43a1277e2f Author: Martin Thielecke <github@mthie.com> Date: Sat Aug 1 18:14:14 2015 +0000 [main] Revert "changed variable names according to linter" This reverts commit 91ac55453ccc4a83fae417e22d0c69600501e10b. commit 91ac55453ccc4a83fae417e22d0c69600501e10b Author: Martin Thielecke <github@mthie.com> Date: Sat Aug 1 11:54:53 2015 +0000 changed variable names according to linter commit 7a0f9e22ba66493dfc7782afee0fbb54bb4a7701 Merge: 6c57d39 8386e47 Author: Martin Thielecke <github@mthie.com> Date: Sat Aug 1 11:32:28 2015 +0000 Merge branch 'master' of github.com:Luzifer/cloudkeys-go commit 6c57d394ae0d8d6412c4d4903a6384e697e906ad Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 19:30:47 2015 +0000 added title commit 17ae0383fd4f09ec394d398ea67aac033e53f900 Merge: d813879 553680c Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 19:21:18 2015 +0000 Merge branch 'development' of github.com:mthie/cloudkeys-go commit 553680c725ed2352b7b225c4f592c26ac9bbc364 Merge: ec26daa 1b66ad4 Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 19:19:41 2015 +0000 Merge branch 'master' of github.com:Luzifer/cloudkeys-go into development commit d81387910e62f7ddfe2043e22ca75a23544f19d4 Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 18:51:28 2015 +0000 changed title commit 45a64d11105038c2cc3c5060975bd0f458df1db6 Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 18:36:14 2015 +0000 changed usernames for deployment commit ec26daa6793167cee3736a66b5506925e09272c8 Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 18:34:36 2015 +0000 fixed username
2015-11-30 21:27:23 +00:00
var cb;
cb = $('<div class="clipboard" data-toggle="tooltip" data-original-title="Copied to clipboard!" data-trigger="manual"/>');
Removed old clippy flash extension and replaced it with pure JS solution Squashed commit of the following: commit 682b84ab51cbaaa8343139c851a9b4278886e0da Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 21:13:13 2015 +0000 fixed godeps path commit 816132283ffa6b4520c93e199bb89b747afe306e Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 21:12:23 2015 +0000 removed branding commit d7683dd6a56427c21bd0f86c7b034bd83deb3ec7 Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 21:08:33 2015 +0000 reverted some individual stuff commit 26bc1a35e110f14b3b9f74e35cea8d66eb8129fc Merge: ecd8e53 b8ad8ee Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 20:51:18 2015 +0000 Merge branch 'master' of github.com:Luzifer/cloudkeys-go into clipboardapi Conflicts: assets/script.js bindata.go coffee/script.coffee commit ecd8e53b13d053fece855ee01b627326cf24b2f0 Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 20:45:20 2015 +0000 removed old clippy flash extension and replaced it with pure JS solution commit 225e9f13c291c17e7d5de9d6b1a7cb43a1277e2f Author: Martin Thielecke <github@mthie.com> Date: Sat Aug 1 18:14:14 2015 +0000 [main] Revert "changed variable names according to linter" This reverts commit 91ac55453ccc4a83fae417e22d0c69600501e10b. commit 91ac55453ccc4a83fae417e22d0c69600501e10b Author: Martin Thielecke <github@mthie.com> Date: Sat Aug 1 11:54:53 2015 +0000 changed variable names according to linter commit 7a0f9e22ba66493dfc7782afee0fbb54bb4a7701 Merge: 6c57d39 8386e47 Author: Martin Thielecke <github@mthie.com> Date: Sat Aug 1 11:32:28 2015 +0000 Merge branch 'master' of github.com:Luzifer/cloudkeys-go commit 6c57d394ae0d8d6412c4d4903a6384e697e906ad Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 19:30:47 2015 +0000 added title commit 17ae0383fd4f09ec394d398ea67aac033e53f900 Merge: d813879 553680c Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 19:21:18 2015 +0000 Merge branch 'development' of github.com:mthie/cloudkeys-go commit 553680c725ed2352b7b225c4f592c26ac9bbc364 Merge: ec26daa 1b66ad4 Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 19:19:41 2015 +0000 Merge branch 'master' of github.com:Luzifer/cloudkeys-go into development commit d81387910e62f7ddfe2043e22ca75a23544f19d4 Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 18:51:28 2015 +0000 changed title commit 45a64d11105038c2cc3c5060975bd0f458df1db6 Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 18:36:14 2015 +0000 changed usernames for deployment commit ec26daa6793167cee3736a66b5506925e09272c8 Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 18:34:36 2015 +0000 fixed username
2015-11-30 21:27:23 +00:00
cb.click(function(e) {
var elem, t;
elem = $(`<textarea>${value}</textarea>`).css({
Removed old clippy flash extension and replaced it with pure JS solution Squashed commit of the following: commit 682b84ab51cbaaa8343139c851a9b4278886e0da Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 21:13:13 2015 +0000 fixed godeps path commit 816132283ffa6b4520c93e199bb89b747afe306e Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 21:12:23 2015 +0000 removed branding commit d7683dd6a56427c21bd0f86c7b034bd83deb3ec7 Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 21:08:33 2015 +0000 reverted some individual stuff commit 26bc1a35e110f14b3b9f74e35cea8d66eb8129fc Merge: ecd8e53 b8ad8ee Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 20:51:18 2015 +0000 Merge branch 'master' of github.com:Luzifer/cloudkeys-go into clipboardapi Conflicts: assets/script.js bindata.go coffee/script.coffee commit ecd8e53b13d053fece855ee01b627326cf24b2f0 Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 20:45:20 2015 +0000 removed old clippy flash extension and replaced it with pure JS solution commit 225e9f13c291c17e7d5de9d6b1a7cb43a1277e2f Author: Martin Thielecke <github@mthie.com> Date: Sat Aug 1 18:14:14 2015 +0000 [main] Revert "changed variable names according to linter" This reverts commit 91ac55453ccc4a83fae417e22d0c69600501e10b. commit 91ac55453ccc4a83fae417e22d0c69600501e10b Author: Martin Thielecke <github@mthie.com> Date: Sat Aug 1 11:54:53 2015 +0000 changed variable names according to linter commit 7a0f9e22ba66493dfc7782afee0fbb54bb4a7701 Merge: 6c57d39 8386e47 Author: Martin Thielecke <github@mthie.com> Date: Sat Aug 1 11:32:28 2015 +0000 Merge branch 'master' of github.com:Luzifer/cloudkeys-go commit 6c57d394ae0d8d6412c4d4903a6384e697e906ad Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 19:30:47 2015 +0000 added title commit 17ae0383fd4f09ec394d398ea67aac033e53f900 Merge: d813879 553680c Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 19:21:18 2015 +0000 Merge branch 'development' of github.com:mthie/cloudkeys-go commit 553680c725ed2352b7b225c4f592c26ac9bbc364 Merge: ec26daa 1b66ad4 Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 19:19:41 2015 +0000 Merge branch 'master' of github.com:Luzifer/cloudkeys-go into development commit d81387910e62f7ddfe2043e22ca75a23544f19d4 Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 18:51:28 2015 +0000 changed title commit 45a64d11105038c2cc3c5060975bd0f458df1db6 Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 18:36:14 2015 +0000 changed usernames for deployment commit ec26daa6793167cee3736a66b5506925e09272c8 Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 18:34:36 2015 +0000 fixed username
2015-11-30 21:27:23 +00:00
'position': 'absolute',
'left': '-9999px',
'readonly': 'readonly',
'top': (window.pageYOffset || document.documentElement.scrollTop) + 'px'
});
$("body").append(elem);
elem.focus();
elem.select();
document.execCommand('copy');
elem.remove();
t = $(this);
t.tooltip('show');
setTimeout(function() {
return t.tooltip('hide');
}, 1000);
Removed old clippy flash extension and replaced it with pure JS solution Squashed commit of the following: commit 682b84ab51cbaaa8343139c851a9b4278886e0da Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 21:13:13 2015 +0000 fixed godeps path commit 816132283ffa6b4520c93e199bb89b747afe306e Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 21:12:23 2015 +0000 removed branding commit d7683dd6a56427c21bd0f86c7b034bd83deb3ec7 Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 21:08:33 2015 +0000 reverted some individual stuff commit 26bc1a35e110f14b3b9f74e35cea8d66eb8129fc Merge: ecd8e53 b8ad8ee Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 20:51:18 2015 +0000 Merge branch 'master' of github.com:Luzifer/cloudkeys-go into clipboardapi Conflicts: assets/script.js bindata.go coffee/script.coffee commit ecd8e53b13d053fece855ee01b627326cf24b2f0 Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 20:45:20 2015 +0000 removed old clippy flash extension and replaced it with pure JS solution commit 225e9f13c291c17e7d5de9d6b1a7cb43a1277e2f Author: Martin Thielecke <github@mthie.com> Date: Sat Aug 1 18:14:14 2015 +0000 [main] Revert "changed variable names according to linter" This reverts commit 91ac55453ccc4a83fae417e22d0c69600501e10b. commit 91ac55453ccc4a83fae417e22d0c69600501e10b Author: Martin Thielecke <github@mthie.com> Date: Sat Aug 1 11:54:53 2015 +0000 changed variable names according to linter commit 7a0f9e22ba66493dfc7782afee0fbb54bb4a7701 Merge: 6c57d39 8386e47 Author: Martin Thielecke <github@mthie.com> Date: Sat Aug 1 11:32:28 2015 +0000 Merge branch 'master' of github.com:Luzifer/cloudkeys-go commit 6c57d394ae0d8d6412c4d4903a6384e697e906ad Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 19:30:47 2015 +0000 added title commit 17ae0383fd4f09ec394d398ea67aac033e53f900 Merge: d813879 553680c Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 19:21:18 2015 +0000 Merge branch 'development' of github.com:mthie/cloudkeys-go commit 553680c725ed2352b7b225c4f592c26ac9bbc364 Merge: ec26daa 1b66ad4 Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 19:19:41 2015 +0000 Merge branch 'master' of github.com:Luzifer/cloudkeys-go into development commit d81387910e62f7ddfe2043e22ca75a23544f19d4 Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 18:51:28 2015 +0000 changed title commit 45a64d11105038c2cc3c5060975bd0f458df1db6 Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 18:36:14 2015 +0000 changed usernames for deployment commit ec26daa6793167cee3736a66b5506925e09272c8 Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 18:34:36 2015 +0000 fixed username
2015-11-30 21:27:23 +00:00
});
return cb;
}
2015-07-29 07:01:23 +00:00
limitItems(items) {
2015-07-29 07:01:23 +00:00
var current;
$('#resultdescription span').text(items.length);
current = 0;
$('#items>li').each((k, v) => {
var item;
item = $(v);
item.removeClass('odd');
if ($.inArray(item.data('num'), items) === -1) {
item.addClass('hide');
} else {
if (item.hasClass('hide')) {
item.removeClass('hide');
}
if (current % 2 === 0) {
item.addClass('odd');
2015-07-29 07:01:23 +00:00
}
current = current + 1;
}
});
}
2015-07-29 07:01:23 +00:00
showItems(items) {
Removed old clippy flash extension and replaced it with pure JS solution Squashed commit of the following: commit 682b84ab51cbaaa8343139c851a9b4278886e0da Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 21:13:13 2015 +0000 fixed godeps path commit 816132283ffa6b4520c93e199bb89b747afe306e Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 21:12:23 2015 +0000 removed branding commit d7683dd6a56427c21bd0f86c7b034bd83deb3ec7 Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 21:08:33 2015 +0000 reverted some individual stuff commit 26bc1a35e110f14b3b9f74e35cea8d66eb8129fc Merge: ecd8e53 b8ad8ee Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 20:51:18 2015 +0000 Merge branch 'master' of github.com:Luzifer/cloudkeys-go into clipboardapi Conflicts: assets/script.js bindata.go coffee/script.coffee commit ecd8e53b13d053fece855ee01b627326cf24b2f0 Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 20:45:20 2015 +0000 removed old clippy flash extension and replaced it with pure JS solution commit 225e9f13c291c17e7d5de9d6b1a7cb43a1277e2f Author: Martin Thielecke <github@mthie.com> Date: Sat Aug 1 18:14:14 2015 +0000 [main] Revert "changed variable names according to linter" This reverts commit 91ac55453ccc4a83fae417e22d0c69600501e10b. commit 91ac55453ccc4a83fae417e22d0c69600501e10b Author: Martin Thielecke <github@mthie.com> Date: Sat Aug 1 11:54:53 2015 +0000 changed variable names according to linter commit 7a0f9e22ba66493dfc7782afee0fbb54bb4a7701 Merge: 6c57d39 8386e47 Author: Martin Thielecke <github@mthie.com> Date: Sat Aug 1 11:32:28 2015 +0000 Merge branch 'master' of github.com:Luzifer/cloudkeys-go commit 6c57d394ae0d8d6412c4d4903a6384e697e906ad Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 19:30:47 2015 +0000 added title commit 17ae0383fd4f09ec394d398ea67aac033e53f900 Merge: d813879 553680c Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 19:21:18 2015 +0000 Merge branch 'development' of github.com:mthie/cloudkeys-go commit 553680c725ed2352b7b225c4f592c26ac9bbc364 Merge: ec26daa 1b66ad4 Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 19:19:41 2015 +0000 Merge branch 'master' of github.com:Luzifer/cloudkeys-go into development commit d81387910e62f7ddfe2043e22ca75a23544f19d4 Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 18:51:28 2015 +0000 changed title commit 45a64d11105038c2cc3c5060975bd0f458df1db6 Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 18:36:14 2015 +0000 changed usernames for deployment commit ec26daa6793167cee3736a66b5506925e09272c8 Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 18:34:36 2015 +0000 fixed username
2015-11-30 21:27:23 +00:00
var additionalClass, c, char, counter, field, i, item, itemContainer, j, len, lines_match, password, ref, ul;
2015-07-29 07:01:23 +00:00
$('#items li').remove();
itemContainer = $('#items');
$('#resultdescription span').text(items.length);
for (i = j = 0, len = items.length; j < len; i = ++j) {
item = items[i];
additionalClass = "";
if (i % 2 === 0) {
additionalClass = "odd";
}
item = this.entities[item];
c = $(`<li data-num="${item.num}" class="${additionalClass}">${item.title} <span>${item.username}</span></li>`);
2015-07-29 07:01:23 +00:00
ul = $("<ul></ul>");
password = "";
ref = item.password;
for (char in ref) {
i = ref[char];
password += "*";
}
field = $(`<li><label>Username:</label><input type="text" class="username" value="${item.username}"><br></li>`);
Removed old clippy flash extension and replaced it with pure JS solution Squashed commit of the following: commit 682b84ab51cbaaa8343139c851a9b4278886e0da Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 21:13:13 2015 +0000 fixed godeps path commit 816132283ffa6b4520c93e199bb89b747afe306e Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 21:12:23 2015 +0000 removed branding commit d7683dd6a56427c21bd0f86c7b034bd83deb3ec7 Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 21:08:33 2015 +0000 reverted some individual stuff commit 26bc1a35e110f14b3b9f74e35cea8d66eb8129fc Merge: ecd8e53 b8ad8ee Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 20:51:18 2015 +0000 Merge branch 'master' of github.com:Luzifer/cloudkeys-go into clipboardapi Conflicts: assets/script.js bindata.go coffee/script.coffee commit ecd8e53b13d053fece855ee01b627326cf24b2f0 Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 20:45:20 2015 +0000 removed old clippy flash extension and replaced it with pure JS solution commit 225e9f13c291c17e7d5de9d6b1a7cb43a1277e2f Author: Martin Thielecke <github@mthie.com> Date: Sat Aug 1 18:14:14 2015 +0000 [main] Revert "changed variable names according to linter" This reverts commit 91ac55453ccc4a83fae417e22d0c69600501e10b. commit 91ac55453ccc4a83fae417e22d0c69600501e10b Author: Martin Thielecke <github@mthie.com> Date: Sat Aug 1 11:54:53 2015 +0000 changed variable names according to linter commit 7a0f9e22ba66493dfc7782afee0fbb54bb4a7701 Merge: 6c57d39 8386e47 Author: Martin Thielecke <github@mthie.com> Date: Sat Aug 1 11:32:28 2015 +0000 Merge branch 'master' of github.com:Luzifer/cloudkeys-go commit 6c57d394ae0d8d6412c4d4903a6384e697e906ad Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 19:30:47 2015 +0000 added title commit 17ae0383fd4f09ec394d398ea67aac033e53f900 Merge: d813879 553680c Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 19:21:18 2015 +0000 Merge branch 'development' of github.com:mthie/cloudkeys-go commit 553680c725ed2352b7b225c4f592c26ac9bbc364 Merge: ec26daa 1b66ad4 Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 19:19:41 2015 +0000 Merge branch 'master' of github.com:Luzifer/cloudkeys-go into development commit d81387910e62f7ddfe2043e22ca75a23544f19d4 Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 18:51:28 2015 +0000 changed title commit 45a64d11105038c2cc3c5060975bd0f458df1db6 Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 18:36:14 2015 +0000 changed usernames for deployment commit ec26daa6793167cee3736a66b5506925e09272c8 Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 18:34:36 2015 +0000 fixed username
2015-11-30 21:27:23 +00:00
ul.append(field);
this.getClipboardCode(item.username).insertBefore(field.find("br"));
field = $(`<li class="passwordtoggle"><label>Password:</label><input type="text" class="password" value="${password}" data-toggle="${item.password.replace(/"/g, '&quot;')}"><em> (toggle visibility)</em></span><br></li>`);
Removed old clippy flash extension and replaced it with pure JS solution Squashed commit of the following: commit 682b84ab51cbaaa8343139c851a9b4278886e0da Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 21:13:13 2015 +0000 fixed godeps path commit 816132283ffa6b4520c93e199bb89b747afe306e Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 21:12:23 2015 +0000 removed branding commit d7683dd6a56427c21bd0f86c7b034bd83deb3ec7 Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 21:08:33 2015 +0000 reverted some individual stuff commit 26bc1a35e110f14b3b9f74e35cea8d66eb8129fc Merge: ecd8e53 b8ad8ee Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 20:51:18 2015 +0000 Merge branch 'master' of github.com:Luzifer/cloudkeys-go into clipboardapi Conflicts: assets/script.js bindata.go coffee/script.coffee commit ecd8e53b13d053fece855ee01b627326cf24b2f0 Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 20:45:20 2015 +0000 removed old clippy flash extension and replaced it with pure JS solution commit 225e9f13c291c17e7d5de9d6b1a7cb43a1277e2f Author: Martin Thielecke <github@mthie.com> Date: Sat Aug 1 18:14:14 2015 +0000 [main] Revert "changed variable names according to linter" This reverts commit 91ac55453ccc4a83fae417e22d0c69600501e10b. commit 91ac55453ccc4a83fae417e22d0c69600501e10b Author: Martin Thielecke <github@mthie.com> Date: Sat Aug 1 11:54:53 2015 +0000 changed variable names according to linter commit 7a0f9e22ba66493dfc7782afee0fbb54bb4a7701 Merge: 6c57d39 8386e47 Author: Martin Thielecke <github@mthie.com> Date: Sat Aug 1 11:32:28 2015 +0000 Merge branch 'master' of github.com:Luzifer/cloudkeys-go commit 6c57d394ae0d8d6412c4d4903a6384e697e906ad Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 19:30:47 2015 +0000 added title commit 17ae0383fd4f09ec394d398ea67aac033e53f900 Merge: d813879 553680c Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 19:21:18 2015 +0000 Merge branch 'development' of github.com:mthie/cloudkeys-go commit 553680c725ed2352b7b225c4f592c26ac9bbc364 Merge: ec26daa 1b66ad4 Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 19:19:41 2015 +0000 Merge branch 'master' of github.com:Luzifer/cloudkeys-go into development commit d81387910e62f7ddfe2043e22ca75a23544f19d4 Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 18:51:28 2015 +0000 changed title commit 45a64d11105038c2cc3c5060975bd0f458df1db6 Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 18:36:14 2015 +0000 changed usernames for deployment commit ec26daa6793167cee3736a66b5506925e09272c8 Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 18:34:36 2015 +0000 fixed username
2015-11-30 21:27:23 +00:00
ul.append(field);
this.getClipboardCode(item.password).insertBefore(field.find("br"));
field = $(`<li><label>URL:</label><input type="text" class="url" value="${item.url}"><br></li>`);
Removed old clippy flash extension and replaced it with pure JS solution Squashed commit of the following: commit 682b84ab51cbaaa8343139c851a9b4278886e0da Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 21:13:13 2015 +0000 fixed godeps path commit 816132283ffa6b4520c93e199bb89b747afe306e Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 21:12:23 2015 +0000 removed branding commit d7683dd6a56427c21bd0f86c7b034bd83deb3ec7 Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 21:08:33 2015 +0000 reverted some individual stuff commit 26bc1a35e110f14b3b9f74e35cea8d66eb8129fc Merge: ecd8e53 b8ad8ee Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 20:51:18 2015 +0000 Merge branch 'master' of github.com:Luzifer/cloudkeys-go into clipboardapi Conflicts: assets/script.js bindata.go coffee/script.coffee commit ecd8e53b13d053fece855ee01b627326cf24b2f0 Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 20:45:20 2015 +0000 removed old clippy flash extension and replaced it with pure JS solution commit 225e9f13c291c17e7d5de9d6b1a7cb43a1277e2f Author: Martin Thielecke <github@mthie.com> Date: Sat Aug 1 18:14:14 2015 +0000 [main] Revert "changed variable names according to linter" This reverts commit 91ac55453ccc4a83fae417e22d0c69600501e10b. commit 91ac55453ccc4a83fae417e22d0c69600501e10b Author: Martin Thielecke <github@mthie.com> Date: Sat Aug 1 11:54:53 2015 +0000 changed variable names according to linter commit 7a0f9e22ba66493dfc7782afee0fbb54bb4a7701 Merge: 6c57d39 8386e47 Author: Martin Thielecke <github@mthie.com> Date: Sat Aug 1 11:32:28 2015 +0000 Merge branch 'master' of github.com:Luzifer/cloudkeys-go commit 6c57d394ae0d8d6412c4d4903a6384e697e906ad Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 19:30:47 2015 +0000 added title commit 17ae0383fd4f09ec394d398ea67aac033e53f900 Merge: d813879 553680c Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 19:21:18 2015 +0000 Merge branch 'development' of github.com:mthie/cloudkeys-go commit 553680c725ed2352b7b225c4f592c26ac9bbc364 Merge: ec26daa 1b66ad4 Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 19:19:41 2015 +0000 Merge branch 'master' of github.com:Luzifer/cloudkeys-go into development commit d81387910e62f7ddfe2043e22ca75a23544f19d4 Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 18:51:28 2015 +0000 changed title commit 45a64d11105038c2cc3c5060975bd0f458df1db6 Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 18:36:14 2015 +0000 changed usernames for deployment commit ec26daa6793167cee3736a66b5506925e09272c8 Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 18:34:36 2015 +0000 fixed username
2015-11-30 21:27:23 +00:00
ul.append(field);
this.getClipboardCode(item.url).insertBefore(field.find("br"));
2015-07-29 07:01:23 +00:00
lines_match = item.comment.match(/\n/g);
if (lines_match !== null) {
counter = lines_match.length;
}
if (counter < 2) {
counter = 2;
}
field = $(`<li><label>Comment:</label><textarea class="comment" rows="${counter + 2}">${item.comment}</textarea><br></li>`);
Removed old clippy flash extension and replaced it with pure JS solution Squashed commit of the following: commit 682b84ab51cbaaa8343139c851a9b4278886e0da Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 21:13:13 2015 +0000 fixed godeps path commit 816132283ffa6b4520c93e199bb89b747afe306e Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 21:12:23 2015 +0000 removed branding commit d7683dd6a56427c21bd0f86c7b034bd83deb3ec7 Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 21:08:33 2015 +0000 reverted some individual stuff commit 26bc1a35e110f14b3b9f74e35cea8d66eb8129fc Merge: ecd8e53 b8ad8ee Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 20:51:18 2015 +0000 Merge branch 'master' of github.com:Luzifer/cloudkeys-go into clipboardapi Conflicts: assets/script.js bindata.go coffee/script.coffee commit ecd8e53b13d053fece855ee01b627326cf24b2f0 Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 20:45:20 2015 +0000 removed old clippy flash extension and replaced it with pure JS solution commit 225e9f13c291c17e7d5de9d6b1a7cb43a1277e2f Author: Martin Thielecke <github@mthie.com> Date: Sat Aug 1 18:14:14 2015 +0000 [main] Revert "changed variable names according to linter" This reverts commit 91ac55453ccc4a83fae417e22d0c69600501e10b. commit 91ac55453ccc4a83fae417e22d0c69600501e10b Author: Martin Thielecke <github@mthie.com> Date: Sat Aug 1 11:54:53 2015 +0000 changed variable names according to linter commit 7a0f9e22ba66493dfc7782afee0fbb54bb4a7701 Merge: 6c57d39 8386e47 Author: Martin Thielecke <github@mthie.com> Date: Sat Aug 1 11:32:28 2015 +0000 Merge branch 'master' of github.com:Luzifer/cloudkeys-go commit 6c57d394ae0d8d6412c4d4903a6384e697e906ad Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 19:30:47 2015 +0000 added title commit 17ae0383fd4f09ec394d398ea67aac033e53f900 Merge: d813879 553680c Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 19:21:18 2015 +0000 Merge branch 'development' of github.com:mthie/cloudkeys-go commit 553680c725ed2352b7b225c4f592c26ac9bbc364 Merge: ec26daa 1b66ad4 Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 19:19:41 2015 +0000 Merge branch 'master' of github.com:Luzifer/cloudkeys-go into development commit d81387910e62f7ddfe2043e22ca75a23544f19d4 Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 18:51:28 2015 +0000 changed title commit 45a64d11105038c2cc3c5060975bd0f458df1db6 Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 18:36:14 2015 +0000 changed usernames for deployment commit ec26daa6793167cee3736a66b5506925e09272c8 Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 18:34:36 2015 +0000 fixed username
2015-11-30 21:27:23 +00:00
ul.append(field);
this.getClipboardCode(item.comment).insertBefore(field.find("br"));
field = $(`<li><label>Tags:</label><input type="text" class="tags" value="${item.tags}"><br></li>`);
Removed old clippy flash extension and replaced it with pure JS solution Squashed commit of the following: commit 682b84ab51cbaaa8343139c851a9b4278886e0da Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 21:13:13 2015 +0000 fixed godeps path commit 816132283ffa6b4520c93e199bb89b747afe306e Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 21:12:23 2015 +0000 removed branding commit d7683dd6a56427c21bd0f86c7b034bd83deb3ec7 Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 21:08:33 2015 +0000 reverted some individual stuff commit 26bc1a35e110f14b3b9f74e35cea8d66eb8129fc Merge: ecd8e53 b8ad8ee Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 20:51:18 2015 +0000 Merge branch 'master' of github.com:Luzifer/cloudkeys-go into clipboardapi Conflicts: assets/script.js bindata.go coffee/script.coffee commit ecd8e53b13d053fece855ee01b627326cf24b2f0 Author: Martin Thielecke <github@mthie.com> Date: Mon Nov 30 20:45:20 2015 +0000 removed old clippy flash extension and replaced it with pure JS solution commit 225e9f13c291c17e7d5de9d6b1a7cb43a1277e2f Author: Martin Thielecke <github@mthie.com> Date: Sat Aug 1 18:14:14 2015 +0000 [main] Revert "changed variable names according to linter" This reverts commit 91ac55453ccc4a83fae417e22d0c69600501e10b. commit 91ac55453ccc4a83fae417e22d0c69600501e10b Author: Martin Thielecke <github@mthie.com> Date: Sat Aug 1 11:54:53 2015 +0000 changed variable names according to linter commit 7a0f9e22ba66493dfc7782afee0fbb54bb4a7701 Merge: 6c57d39 8386e47 Author: Martin Thielecke <github@mthie.com> Date: Sat Aug 1 11:32:28 2015 +0000 Merge branch 'master' of github.com:Luzifer/cloudkeys-go commit 6c57d394ae0d8d6412c4d4903a6384e697e906ad Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 19:30:47 2015 +0000 added title commit 17ae0383fd4f09ec394d398ea67aac033e53f900 Merge: d813879 553680c Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 19:21:18 2015 +0000 Merge branch 'development' of github.com:mthie/cloudkeys-go commit 553680c725ed2352b7b225c4f592c26ac9bbc364 Merge: ec26daa 1b66ad4 Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 19:19:41 2015 +0000 Merge branch 'master' of github.com:Luzifer/cloudkeys-go into development commit d81387910e62f7ddfe2043e22ca75a23544f19d4 Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 18:51:28 2015 +0000 changed title commit 45a64d11105038c2cc3c5060975bd0f458df1db6 Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 18:36:14 2015 +0000 changed usernames for deployment commit ec26daa6793167cee3736a66b5506925e09272c8 Author: Martin Thielecke <github@mthie.com> Date: Fri Jul 31 18:34:36 2015 +0000 fixed username
2015-11-30 21:27:23 +00:00
ul.append(field);
this.getClipboardCode(item.tags).insertBefore(field.find("br"));
2015-07-29 07:01:23 +00:00
ul.append("<li class=\"last\"><button class=\"btn btn-primary\">Edit</button><br></li>");
ul.find('.btn-primary').click((e) => {
var t = e.currentTarget;
var num;
num = $(t).parent().parent().parent().data('num');
if (typeof num !== "undefined" && typeof num !== null) {
return this.showForm(num);
}
});
ul.find('.passwordtoggle em').click((e) => {
var t = e.currentTarget;
var elem, original;
elem = $(t).parent().find('.password');
original = elem.data('toggle');
elem.data('toggle', elem.val());
return elem.val(original);
});
2015-07-29 07:01:23 +00:00
c.append(ul);
c.click((e) => {
var elem;
elem = $(e.currentTarget);
if (elem.hasClass('active') === false) {
$('#items li.active').removeClass('active').find('ul').slideUp();
elem.addClass('active');
return elem.find('ul').slideDown();
}
});
2015-07-29 07:01:23 +00:00
c.find('input').focus().select();
itemContainer.append(c);
}
$('.hide').removeClass('hide');
$('#loader').addClass('hide');
$('#passwordRequest').addClass('hide');
$('#search').focus();
}
2015-07-29 07:01:23 +00:00
getItems(search) {
2015-07-29 07:01:23 +00:00
var i, item, j, len, ref, result;
result = [];
search = search.toLowerCase();
ref = this.entities;
for (i = j = 0, len = ref.length; j < len; i = ++j) {
item = ref[i];
if (item.title.toLowerCase().indexOf(search) !== -1 || item.username.toLowerCase().indexOf(search) !== -1 || item.tags.toLowerCase().indexOf(search) !== -1) {
item.num = i;
result.push(i);
}
}
return result;
}
2015-07-29 07:01:23 +00:00
sortItems(a, b) {
2015-07-29 07:01:23 +00:00
var aTitle, bTitle;
aTitle = a.title.toLowerCase();
bTitle = b.title.toLowerCase();
return ((aTitle < bTitle) ? -1 : ((aTitle > bTitle) ? 1 : 0));
}
2015-07-29 07:01:23 +00:00
showForm(num) {
2015-07-29 07:01:23 +00:00
var elem, fields, j, len;
$('#editDialog input').val('');
$('#editDialog textarea').val('');
$('#editDialog .hide').removeClass('hide');
fields = ['title', 'username', 'password', 'url', 'comment', 'tags'];
if (typeof num !== "undefined" && typeof this.entities[num] !== "undefined") {
$('#editDialog input[name="num"]').val(num);
for (j = 0, len = fields.length; j < len; j++) {
elem = fields[j];
$(`#editDialog #${elem}`).val(this.entities[num][elem]);
2015-07-29 07:01:23 +00:00
}
$("#editDialog input#repeat_password").val(this.entities[num]['password']);
} else {
$('#editDialog button.btn-danger').addClass('hide');
}
$('#editDialog').modal({});
$('#editDialog .btn-danger').unbind('click').click(() => {
var confirmation;
confirmation = confirm('Are you sure?');
if (confirmation === true) {
num = $('#editDialog input[name="num"]').val();
if (typeof num !== "undefined" && typeof num !== null && num !== "") {
this.entities.splice(num, 1);
return this.updateData(() => {
2015-07-29 07:01:23 +00:00
return $('#formClose').click();
});
}
}
});
return $('#editDialog .btn-primary').unbind('click').click(() => {
var entity, field, l, len1;
if (this.validateForm()) {
num = $('#editDialog input[name="num"]').val();
entity = {};
for (l = 0, len1 = fields.length; l < len1; l++) {
field = fields[l];
entity[field] = $(`#${field}`).val();
}
if (typeof num !== "undefined" && num !== "") {
this.entities[num] = entity;
} else {
this.entities.push(entity);
}
this.updateData(() => {
return $('#formClose').click();
});
}
});
}
2015-07-29 07:01:23 +00:00
validateForm() {
2015-07-29 07:01:23 +00:00
var success;
$('#editDialog .has-error').removeClass('has-error');
success = true;
if ($('#title').val() === "") {
$('#title').parent().addClass('has-error');
success = false;
}
if ($('#password').val() !== "" && $('#repeat_password').val() !== $('#password').val()) {
$('#password, #repeat_password').parent().addClass('has-error');
success = false;
}
return success;
}
2015-07-29 07:01:23 +00:00
showEditEncPWForm() {
2017-01-22 13:40:54 +00:00
$('#editEncPWDialog input').val('');
$('#editEncPWDialog .hide').removeClass('hide');
$('#editEncPWDialog').modal({});
return $('#editEncPWDialog .btn-primary').unbind('click').click(() => {
var confirmation, new_password;
$('#editEncPWDialog .has-error').removeClass('has-error');
confirmation = confirm('Do you really want to update your encryption password?');
if (confirmation !== true) {
return;
}
if ($('#editEncPW_current_password').val() !== this.password) {
$('#editEncPW_current_password').parent().addClass('has-error');
return;
}
new_password = $('#editEncPW_password').val();
if (new_password === void 0 || new_password === '') {
$('#editEncPW_password').parent().addClass('has-error');
return;
}
if (new_password !== $('#editEncPW_repeat_password').val()) {
$('#editEncPW_password, #editEncPW_repeat_password').parent().addClass('has-error');
return;
}
this.password = new_password;
this.updateData(() => {
$('#formEncPWClose').click();
return alert('Your encryption password has been changed. Keep this in mind for later.');
});
});
}
2015-07-29 07:01:23 +00:00
};
2015-07-29 07:01:23 +00:00
window.CloudKeys = new CloudKeys();
$('#importLink').click(() => {
return $('#importContainer').toggle(500);
});
$('#importContainer button').click(() => {
return window.CloudKeys.import($('#import').val());
});
2015-07-29 07:01:23 +00:00
//$('#import').val('')
2015-07-29 07:01:23 +00:00
}).call(this);