mirror of
https://github.com/gorhill/uMatrix.git
synced 2024-06-03 02:44:57 +12:00
fix #807: merging was supported after all
This commit is contained in:
parent
9c634ebd45
commit
97957b7bc3
|
@ -8,7 +8,7 @@
|
||||||
<button id="cloudPush" type="button" title="cloudPush"></button>
|
<button id="cloudPush" type="button" title="cloudPush"></button>
|
||||||
<span data-i18n="cloudNoData"></span>
|
<span data-i18n="cloudNoData"></span>
|
||||||
<button id="cloudPull" type="button" title="cloudPull" disabled></button>
|
<button id="cloudPull" type="button" title="cloudPull" disabled></button>
|
||||||
<!-- <button id="cloudPullAndMerge" type="button" title="cloudPullAndMerge" disabled></button> -->
|
<button id="cloudPullAndMerge" type="button" title="cloudPullAndMerge" disabled></button>
|
||||||
<p id="cloudError"><span></span></p>
|
<p id="cloudError"><span></span></p>
|
||||||
<span id="cloudCog" class="fa"></span>
|
<span id="cloudCog" class="fa"></span>
|
||||||
<div id="cloudOptions">
|
<div id="cloudOptions">
|
||||||
|
|
|
@ -2,39 +2,45 @@
|
||||||
background: url("../img/cloud.png") hsl(216, 100%, 93%);
|
background: url("../img/cloud.png") hsl(216, 100%, 93%);
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
margin: 0.5em 0;
|
margin: 0.5em 0;
|
||||||
padding: 1em;
|
padding: 1em 1em 0 1em;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
#cloudWidget.hide {
|
#cloudWidget.hide {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
#cloudWidget > button {
|
#cloudWidget > button {
|
||||||
font-size: 160%;
|
display: inline-block;
|
||||||
padding: 0.1em 0.2em;
|
|
||||||
}
|
|
||||||
#cloudPull[disabled] {
|
|
||||||
visibility: hidden;
|
|
||||||
}
|
|
||||||
#cloudPush:after ,
|
|
||||||
#cloudPull:before {
|
|
||||||
font-family: FontAwesome;
|
font-family: FontAwesome;
|
||||||
|
font-size: 160%;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
|
padding: 0.2em 0.25em 0.1em 0.25em;
|
||||||
|
position: relative;
|
||||||
vertical-align: baseline;
|
vertical-align: baseline;
|
||||||
display: inline-block;
|
|
||||||
}
|
}
|
||||||
body[dir="ltr"] #cloudPush:after {
|
#cloudWidget > button[disabled] {
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
#cloudWidget > button.error {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
#cloudPush:after {
|
||||||
content: '\f0ee';
|
content: '\f0ee';
|
||||||
}
|
}
|
||||||
body[dir="rtl"] #cloudPush:after {
|
#cloudPull:before,
|
||||||
content: '\f0ee';
|
#cloudPullAndMerge:before {
|
||||||
}
|
|
||||||
body[dir="ltr"] #cloudPull:before {
|
|
||||||
content: '\f0ed';
|
content: '\f0ed';
|
||||||
|
}
|
||||||
|
#cloudPullAndMerge {
|
||||||
|
margin: 0 0.25em;
|
||||||
}
|
}
|
||||||
body[dir="rtl"] #cloudPull:before {
|
#cloudPullAndMerge:after {
|
||||||
content: '\f0ed';
|
content: '\f067';
|
||||||
|
font-size: 50%;
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
top: 10%;
|
||||||
}
|
}
|
||||||
#cloudWidget > span {
|
#cloudWidget > span {
|
||||||
color: gray;
|
color: gray;
|
||||||
|
@ -45,7 +51,13 @@ body[dir="rtl"] #cloudPull:before {
|
||||||
vertical-align: bottom;
|
vertical-align: bottom;
|
||||||
white-space: pre;
|
white-space: pre;
|
||||||
}
|
}
|
||||||
#cloudWidget > .nodata {
|
#cloudError {
|
||||||
|
color: red;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0.5em 0;
|
||||||
|
}
|
||||||
|
#cloudError > span {
|
||||||
|
font-size: x-small;
|
||||||
}
|
}
|
||||||
#cloudWidget > #cloudCog {
|
#cloudWidget > #cloudCog {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
|
@ -62,6 +62,7 @@ var onCloudDataReceived = function(entry) {
|
||||||
self.cloud.data = entry.data;
|
self.cloud.data = entry.data;
|
||||||
|
|
||||||
uDom.nodeFromId('cloudPull').removeAttribute('disabled');
|
uDom.nodeFromId('cloudPull').removeAttribute('disabled');
|
||||||
|
uDom.nodeFromId('cloudPullAndMerge').removeAttribute('disabled');
|
||||||
|
|
||||||
var timeOptions = {
|
var timeOptions = {
|
||||||
weekday: 'short',
|
weekday: 'short',
|
||||||
|
@ -118,6 +119,14 @@ var pullData = function(ev) {
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
|
var pullAndMergeData = function() {
|
||||||
|
if ( typeof self.cloud.onPull === 'function' ) {
|
||||||
|
self.cloud.onPull(self.cloud.data, true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
var openOptions = function() {
|
var openOptions = function() {
|
||||||
var input = uDom.nodeFromId('cloudDeviceName');
|
var input = uDom.nodeFromId('cloudDeviceName');
|
||||||
input.value = self.cloud.options.deviceName;
|
input.value = self.cloud.options.deviceName;
|
||||||
|
@ -188,6 +197,7 @@ var onInitialize = function(options) {
|
||||||
|
|
||||||
uDom('#cloudPush').on('click', pushData);
|
uDom('#cloudPush').on('click', pushData);
|
||||||
uDom('#cloudPull').on('click', pullData);
|
uDom('#cloudPull').on('click', pullData);
|
||||||
|
uDom('#cloudPullAndMerge').on('click', pullAndMergeData);
|
||||||
uDom('#cloudCog').on('click', openOptions);
|
uDom('#cloudCog').on('click', openOptions);
|
||||||
uDom('#cloudOptions').on('click', closeOptions);
|
uDom('#cloudOptions').on('click', closeOptions);
|
||||||
uDom('#cloudOptionsSubmit').on('click', submitOptions);
|
uDom('#cloudOptionsSubmit').on('click', submitOptions);
|
||||||
|
|
|
@ -307,9 +307,7 @@ self.cloud.onPush = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
self.cloud.onPull = function(data, append) {
|
self.cloud.onPull = function(data, append) {
|
||||||
if ( typeof data !== 'string' ) {
|
if ( typeof data !== 'string' ) { return; }
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ( append ) {
|
if ( append ) {
|
||||||
data = rulesFromHTML('#diff .right li') + '\n' + data;
|
data = rulesFromHTML('#diff .right li') + '\n' + data;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue