mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
golf
This commit is contained in:
parent
b664ebb01f
commit
00cb1f74e2
|
@ -11957,7 +11957,7 @@ function ev_load_m3u(e) {
|
||||||
function () { load_m3u(url); },
|
function () { load_m3u(url); },
|
||||||
function () {
|
function () {
|
||||||
if (has(perms, 'write') && has(perms, 'delete'))
|
if (has(perms, 'write') && has(perms, 'delete'))
|
||||||
window.location = url + '?edit';
|
location = url + '?edit';
|
||||||
else
|
else
|
||||||
showfile.show(url);
|
showfile.show(url);
|
||||||
}
|
}
|
||||||
|
@ -12556,7 +12556,7 @@ var treectl = (function () {
|
||||||
|
|
||||||
r.reqls = function (url, hpush, back, hydrate) {
|
r.reqls = function (url, hpush, back, hydrate) {
|
||||||
if (IE && !history.pushState)
|
if (IE && !history.pushState)
|
||||||
return window.location = url;
|
return location = url;
|
||||||
|
|
||||||
var xhr = new XHR(),
|
var xhr = new XHR(),
|
||||||
m = /[?&](k=[^&#]+)/.exec(url),
|
m = /[?&](k=[^&#]+)/.exec(url),
|
||||||
|
|
|
@ -255,7 +255,7 @@ function Modpoll() {
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('modpoll...');
|
console.log('modpoll...');
|
||||||
var url = (document.location + '').split('?')[0] + '?_=' + Date.now();
|
var url = (location + '').split('?')[0] + '?_=' + Date.now();
|
||||||
var xhr = new XHR();
|
var xhr = new XHR();
|
||||||
xhr.open('GET', url, true);
|
xhr.open('GET', url, true);
|
||||||
xhr.responseType = 'text';
|
xhr.responseType = 'text';
|
||||||
|
@ -346,7 +346,7 @@ function save(e) {
|
||||||
fd.append("lastmod", (force ? -1 : last_modified));
|
fd.append("lastmod", (force ? -1 : last_modified));
|
||||||
fd.append("body", txt);
|
fd.append("body", txt);
|
||||||
|
|
||||||
var url = (document.location + '').split('?')[0];
|
var url = (location + '').split('?')[0];
|
||||||
var xhr = new XHR();
|
var xhr = new XHR();
|
||||||
xhr.open('POST', url, true);
|
xhr.open('POST', url, true);
|
||||||
xhr.responseType = 'text';
|
xhr.responseType = 'text';
|
||||||
|
@ -404,7 +404,7 @@ function save_cb() {
|
||||||
|
|
||||||
function run_savechk(lastmod, txt, btn, ntry) {
|
function run_savechk(lastmod, txt, btn, ntry) {
|
||||||
// download the saved doc from the server and compare
|
// download the saved doc from the server and compare
|
||||||
var url = (document.location + '').split('?')[0] + '?_=' + Date.now();
|
var url = (location + '').split('?')[0] + '?_=' + Date.now();
|
||||||
var xhr = new XHR();
|
var xhr = new XHR();
|
||||||
xhr.open('GET', url, true);
|
xhr.open('GET', url, true);
|
||||||
xhr.responseType = 'text';
|
xhr.responseType = 'text';
|
||||||
|
|
|
@ -6,7 +6,7 @@ var dom_doc = ebi('m');
|
||||||
var dom_md = ebi('mt');
|
var dom_md = ebi('mt');
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
var n = document.location + '';
|
var n = location + '';
|
||||||
n = (n.slice(n.indexOf('//') + 2).split('?')[0] + '?v').split('/');
|
n = (n.slice(n.indexOf('//') + 2).split('?')[0] + '?v').split('/');
|
||||||
n[0] = 'top';
|
n[0] = 'top';
|
||||||
var loc = [];
|
var loc = [];
|
||||||
|
@ -113,7 +113,7 @@ function save(mde) {
|
||||||
fd.append("lastmod", (force ? -1 : last_modified));
|
fd.append("lastmod", (force ? -1 : last_modified));
|
||||||
fd.append("body", txt);
|
fd.append("body", txt);
|
||||||
|
|
||||||
var url = (document.location + '').split('?')[0];
|
var url = (location + '').split('?')[0];
|
||||||
var xhr = new XHR();
|
var xhr = new XHR();
|
||||||
xhr.open('POST', url, true);
|
xhr.open('POST', url, true);
|
||||||
xhr.responseType = 'text';
|
xhr.responseType = 'text';
|
||||||
|
@ -166,7 +166,7 @@ function save_cb() {
|
||||||
//alert('save OK -- wrote ' + r.size + ' bytes.\n\nsha512: ' + r.sha512);
|
//alert('save OK -- wrote ' + r.size + ' bytes.\n\nsha512: ' + r.sha512);
|
||||||
|
|
||||||
// download the saved doc from the server and compare
|
// download the saved doc from the server and compare
|
||||||
var url = (document.location + '').split('?')[0] + '?_=' + Date.now();
|
var url = (location + '').split('?')[0] + '?_=' + Date.now();
|
||||||
var xhr = new XHR();
|
var xhr = new XHR();
|
||||||
xhr.open('GET', url, true);
|
xhr.open('GET', url, true);
|
||||||
xhr.responseType = 'text';
|
xhr.responseType = 'text';
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
var SRS = SR.trimEnd('/') + '/';
|
|
||||||
|
|
||||||
var t = QSA('a[k]');
|
var t = QSA('a[k]');
|
||||||
for (var a = 0; a < t.length; a++)
|
for (var a = 0; a < t.length; a++)
|
||||||
t[a].onclick = rm;
|
t[a].onclick = rm;
|
||||||
|
|
||||||
function rm() {
|
function rm() {
|
||||||
var u = SRS + '?eshare=rm&skey=' + uricom_enc(this.getAttribute('k')),
|
var u = SR + '/?eshare=rm&skey=' + uricom_enc(this.getAttribute('k')),
|
||||||
xhr = new XHR();
|
xhr = new XHR();
|
||||||
|
|
||||||
xhr.open('POST', u, true);
|
xhr.open('POST', u, true);
|
||||||
|
@ -15,7 +13,7 @@ function rm() {
|
||||||
|
|
||||||
function bump() {
|
function bump() {
|
||||||
var k = this.closest('tr').getElementsByTagName('a')[2].getAttribute('k'),
|
var k = this.closest('tr').getElementsByTagName('a')[2].getAttribute('k'),
|
||||||
u = SRS + '?skey=' + uricom_enc(k) + '&eshare=' + this.value,
|
u = SR + '/?skey=' + uricom_enc(k) + '&eshare=' + this.value,
|
||||||
xhr = new XHR();
|
xhr = new XHR();
|
||||||
|
|
||||||
xhr.open('POST', u, true);
|
xhr.open('POST', u, true);
|
||||||
|
@ -27,7 +25,7 @@ function cb() {
|
||||||
if (this.status !== 200)
|
if (this.status !== 200)
|
||||||
return modal.alert('<h6>server error</h6>' + esc(unpre(this.responseText)));
|
return modal.alert('<h6>server error</h6>' + esc(unpre(this.responseText)));
|
||||||
|
|
||||||
document.location = '?shares';
|
location = '?shares';
|
||||||
}
|
}
|
||||||
|
|
||||||
function qr(e) {
|
function qr(e) {
|
||||||
|
|
|
@ -1572,7 +1572,7 @@ function up2k_init(subtle) {
|
||||||
|
|
||||||
function linklist() {
|
function linklist() {
|
||||||
var ret = [],
|
var ret = [],
|
||||||
base = document.location.origin.replace(/\/$/, '');
|
base = location.origin.replace(/\/$/, '');
|
||||||
|
|
||||||
for (var a = 0; a < st.files.length; a++) {
|
for (var a = 0; a < st.files.length; a++) {
|
||||||
var t = st.files[a],
|
var t = st.files[a],
|
||||||
|
|
|
@ -120,7 +120,7 @@ function esc(txt) {
|
||||||
function basenames(txt) {
|
function basenames(txt) {
|
||||||
return (txt + '').replace(/https?:\/\/[^ \/]+\//g, '/').replace(/js\?_=[a-zA-Z]{4}/g, 'js');
|
return (txt + '').replace(/https?:\/\/[^ \/]+\//g, '/').replace(/js\?_=[a-zA-Z]{4}/g, 'js');
|
||||||
}
|
}
|
||||||
if ((document.location + '').indexOf(',rej,') + 1)
|
if ((location + '').indexOf(',rej,') + 1)
|
||||||
window.onunhandledrejection = function (e) {
|
window.onunhandledrejection = function (e) {
|
||||||
var err = e.reason;
|
var err = e.reason;
|
||||||
try {
|
try {
|
||||||
|
@ -741,7 +741,7 @@ function assert_vp(path) {
|
||||||
if (path.indexOf('//') + 1)
|
if (path.indexOf('//') + 1)
|
||||||
throw 'nonlocal1: ' + path;
|
throw 'nonlocal1: ' + path;
|
||||||
|
|
||||||
var o = window.location.origin;
|
var o = location.origin;
|
||||||
if (have_URL && (new URL(path, o)).origin != o)
|
if (have_URL && (new URL(path, o)).origin != o)
|
||||||
throw 'nonlocal2: ' + path;
|
throw 'nonlocal2: ' + path;
|
||||||
}
|
}
|
||||||
|
@ -893,7 +893,7 @@ function uricom_adec(arr, li) {
|
||||||
|
|
||||||
|
|
||||||
function get_evpath() {
|
function get_evpath() {
|
||||||
var ret = document.location.pathname;
|
var ret = location.pathname;
|
||||||
|
|
||||||
if (ret.indexOf('/') !== 0)
|
if (ret.indexOf('/') !== 0)
|
||||||
ret = '/' + ret;
|
ret = '/' + ret;
|
||||||
|
@ -1249,10 +1249,10 @@ function hist_replace(url) {
|
||||||
|
|
||||||
function sethash(hv) {
|
function sethash(hv) {
|
||||||
if (window.history && history.replaceState) {
|
if (window.history && history.replaceState) {
|
||||||
hist_replace(document.location.pathname + document.location.search + '#' + hv);
|
hist_replace(location.pathname + location.search + '#' + hv);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
document.location.hash = hv;
|
location.hash = hv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue