memory display in columns, adding copy function
This commit is contained in:
parent
e531592b05
commit
2b9abb8db4
5 changed files with 53 additions and 17 deletions
|
@ -228,14 +228,14 @@ main {
|
|||
}
|
||||
|
||||
main.toggled {
|
||||
padding-left: 250px;
|
||||
padding-left: 450px;
|
||||
}
|
||||
|
||||
#sidebar-wrapper {
|
||||
position: fixed;
|
||||
width: 250px;
|
||||
width: 450px;
|
||||
height: 100%;
|
||||
left: -250px;
|
||||
left: -450px;
|
||||
padding-left: 4ch;
|
||||
overflow-y: scroll;
|
||||
overflow-x: hidden;
|
||||
|
|
|
@ -4393,7 +4393,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
|||
const url = new URL(pasteUrl),
|
||||
newPaste = {
|
||||
'https': url.protocol == 'https:',
|
||||
'service': url.hostname + url.pathname,
|
||||
'service': url.hostname + (url.pathname.length > 1 ? url.pathname : ''),
|
||||
'pasteid': url.search.replace(/^\?+/, ''),
|
||||
'key': url.hash.replace(/^#+/, ''),
|
||||
// we store the full URL as it may contain additonal information
|
||||
|
@ -4465,10 +4465,41 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
|||
}
|
||||
$tbody.textContent = '';
|
||||
pastes.forEach(function(paste) {
|
||||
const row = document.createElement('tr'),
|
||||
cell = document.createElement('td');
|
||||
cell.textContent = paste.url;
|
||||
const row = document.createElement('tr');
|
||||
|
||||
let cell = document.createElement('td');
|
||||
let input = document.createElement('input');
|
||||
input.setAttribute('type', 'checkbox');
|
||||
input.setAttribute('name', 'memoryselect-' + paste.pasteid);
|
||||
cell.appendChild(input);
|
||||
row.appendChild(cell);
|
||||
|
||||
cell = document.createElement('td');
|
||||
cell.textContent = paste.https ? '✔' : '✘';
|
||||
row.appendChild(cell);
|
||||
|
||||
cell = document.createElement('td');
|
||||
cell.textContent = paste.service;
|
||||
row.appendChild(cell);
|
||||
|
||||
cell = document.createElement('td');
|
||||
cell.textContent = paste.pasteid;
|
||||
row.appendChild(cell);
|
||||
|
||||
cell = document.createElement('td');
|
||||
cell.addEventListener('click', function () {
|
||||
navigator.clipboard.writeText(paste.url);
|
||||
});
|
||||
let button = document.createElement('button');
|
||||
button.setAttribute('class', 'btn btn-info btn-xs');
|
||||
button.setAttribute('title', I18n._('Copy paste URL'));
|
||||
let span = document.createElement('span');
|
||||
span.setAttribute('class', 'glyphicon glyphicon-duplicate');
|
||||
span.setAttribute('aria-hidden', 'true');
|
||||
button.appendChild(span);
|
||||
cell.appendChild(button);
|
||||
row.appendChild(cell);
|
||||
|
||||
$tbody.appendChild(row);
|
||||
row.addEventListener('click', function () {
|
||||
me.open(paste.url);
|
||||
|
|
|
@ -12,10 +12,11 @@ describe('Memory', function () {
|
|||
jsc.array(common.jscQueryString()),
|
||||
'string',
|
||||
function (schema, address, query, fragment) {
|
||||
const expected = schema + '://' + address.join('') + '/?' +
|
||||
encodeURI(
|
||||
query.join('').replace(/^&+|&+$/gm,'') + '#' + fragment
|
||||
const expectedQuery = encodeURI(
|
||||
query.join('').replace(/^&+|&+$/gm,'')
|
||||
),
|
||||
expected = schema + '://' + address.join('') + '/?' +
|
||||
expectedQuery + '#' + fragment,
|
||||
clean = jsdom();
|
||||
$('body').html(
|
||||
'<main><div id="sidebar-wrapper"><table><tbody>' +
|
||||
|
@ -25,9 +26,9 @@ describe('Memory', function () {
|
|||
$.PrivateBin.Memory.init();
|
||||
$.PrivateBin.Memory.add(expected);
|
||||
$.PrivateBin.Memory.refreshList();
|
||||
const result = $('#sidebar-wrapper table tbody tr td')[0].textContent;
|
||||
const result = $('#sidebar-wrapper table tbody tr td')[3].textContent;
|
||||
clean();
|
||||
return result === expected;
|
||||
return result === expectedQuery;
|
||||
}
|
||||
);
|
||||
});
|
||||
|
|
|
@ -72,7 +72,7 @@ endif;
|
|||
?>
|
||||
<script type="text/javascript" data-cfasync="false" src="js/purify-2.0.8.js" integrity="sha512-QwcEKGuEmKtMguCO9pqNtUtZqq9b/tJ8gNr5qhY8hykq3zKTlDOvpZAmf6Rs8yH35Bz1ZdctUjj2qEWxT5aXCg==" crossorigin="anonymous"></script>
|
||||
<script type="text/javascript" data-cfasync="false" src="js/legacy.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-LYos+qXHIRqFf5ZPNphvtTB0cgzHUizu2wwcOwcwz/VIpRv9lpcBgPYz4uq6jx0INwCAj6Fbnl5HoKiLufS2jg==" crossorigin="anonymous"></script>
|
||||
<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-qSwODMjBG5A1mG2x18DCdjCSBjS9JSLaqKtnMQ+wIjJdsuY6Eb603N4Sw2PhN1uJHaL0fAXBg+KOp6t9/lvvfw==" crossorigin="anonymous"></script>
|
||||
<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-99ODgpO72fZEvwq2E1NnLbXDotlDRIbzzs7b1f/5lfsp8ncghFKyvhrxjgyv4Z/RIf0oiO0MQ45crOKRAHhOWg==" crossorigin="anonymous"></script>
|
||||
<!-- icon -->
|
||||
<link rel="apple-touch-icon" href="<?php echo I18n::encode($BASEPATH); ?>img/apple-touch-icon.png" sizes="180x180" />
|
||||
<link rel="icon" type="image/png" href="img/favicon-32x32.png" sizes="32x32" />
|
||||
|
@ -453,10 +453,14 @@ endif;
|
|||
<div id="sidebar-wrapper">
|
||||
<h4><?php echo I18n::_('Memory'); ?></h4>
|
||||
<p><?php echo I18n::_('The memory lets you remember different paste links. The memory is unique to each website and device.'); ?></p>
|
||||
<table>
|
||||
<table class="table<?php echo $isDark ? '' : ' table-striped'; ?>">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>URL</th>
|
||||
<th title="<?php echo I18n::_('Select all'); ?>"><input type="checkbox" id="memoryselectall" /></th>
|
||||
<th title="<?php echo I18n::_('HTTPS'); ?>">🔒</th>
|
||||
<th><?php echo I18n::_('Service'); ?></th>
|
||||
<th><?php echo I18n::_('ID'); ?></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
|
|
@ -50,7 +50,7 @@ endif;
|
|||
?>
|
||||
<script type="text/javascript" data-cfasync="false" src="js/purify-2.0.8.js" integrity="sha512-QwcEKGuEmKtMguCO9pqNtUtZqq9b/tJ8gNr5qhY8hykq3zKTlDOvpZAmf6Rs8yH35Bz1ZdctUjj2qEWxT5aXCg==" crossorigin="anonymous"></script>
|
||||
<script type="text/javascript" data-cfasync="false" src="js/legacy.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-LYos+qXHIRqFf5ZPNphvtTB0cgzHUizu2wwcOwcwz/VIpRv9lpcBgPYz4uq6jx0INwCAj6Fbnl5HoKiLufS2jg==" crossorigin="anonymous"></script>
|
||||
<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-qSwODMjBG5A1mG2x18DCdjCSBjS9JSLaqKtnMQ+wIjJdsuY6Eb603N4Sw2PhN1uJHaL0fAXBg+KOp6t9/lvvfw==" crossorigin="anonymous"></script>
|
||||
<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-99ODgpO72fZEvwq2E1NnLbXDotlDRIbzzs7b1f/5lfsp8ncghFKyvhrxjgyv4Z/RIf0oiO0MQ45crOKRAHhOWg==" crossorigin="anonymous"></script>
|
||||
<!-- icon -->
|
||||
<link rel="apple-touch-icon" href="img/apple-touch-icon.png?<?php echo rawurlencode($VERSION); ?>" sizes="180x180" />
|
||||
<link rel="icon" type="image/png" href="img/favicon-32x32.png?<?php echo rawurlencode($VERSION); ?>" sizes="32x32" />
|
||||
|
|
Loading…
Reference in a new issue