Skip to content
This repository has been archived by the owner on Aug 27, 2024. It is now read-only.

Commit

Permalink
Webstorm formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Seedmanc committed Feb 22, 2016
1 parent 616376a commit 6b23be1
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 22 deletions.
6 changes: 3 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Mass uploader</title>
<meta http-equiv="Cache-Control" content="no-store" />
<meta http-equiv="Cache-Control" content="no-store"/>
<meta content="text/html" charset="utf-8" http-equiv="Content-Type"/>
<style type="text/css">
body {
Expand Down Expand Up @@ -122,8 +122,8 @@
<body>
<h1>Booru Mass-Uploader</h1>
<p class="intro">This script allows you to mass-upload images to imageboard sites running *booru software.
Select a number of files and they're sent to the website along with the metadata you include such as
the tags retrived from the filenames.</p>
Select a number of files and they're sent to the website along with the metadata you include such as
the tags retrived from the filenames.</p>

<fieldset style="padding: 2px 1em">
<legend>
Expand Down
16 changes: 8 additions & 8 deletions js/booru-params.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
var boorus = {
gelbooru: {
uploadPath: '/index.php?page=post&s=add',
fields: {
file: 'upload',
fields: {
file: 'upload',
rating: 'rating',
source: 'source',
submit: 'submit',
Expand All @@ -12,25 +12,25 @@ var boorus = {
},
moebooru: {
uploadPath: '/post/create.json',
fields: {
file: 'post[file]',
fields: {
file: 'post[file]',
parent: 'post[parent_id]',
rating: 'post[rating]',
source: 'post[source]',
submit: 'commit',
tags: 'post[tags]',
token: 'authenticity_token'
token: 'authenticity_token'
}
},
danbooru: {
uploadPath: '/uploads.json',
fields: {
file: 'upload[file]',
fields: {
file: 'upload[file]',
parent: 'upload[parent_id]',
rating: 'upload[rating]',
submit: 'commit',
tags: 'upload[tag_string]',
token: 'authenticity_token'
token: 'authenticity_token'
}
}
};
26 changes: 15 additions & 11 deletions js/uploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var upOptions = {
var current = localStorage.getItem(document.location.host) || localStorage.getItem('current') || 'gelbooru';
var engine = $("engine");

engine.onchange = function() {
engine.onchange = function () {
current = this.value;
$('current').textContent = current;
if (current != 'gelbooru') {
Expand Down Expand Up @@ -214,7 +214,7 @@ function SendFile(file, callback) {
source: upOptions.source,
submit: 'Upload',
tags: TagsFor(file),
token: localStorage.getItem('auth_token')
token: localStorage.getItem('auth_token')
};
if (upOptions.auth.use) {
reqVars.cookies = 'user_id=' + upOptions.auth.userID + '; ' + 'pass_hash=' + upOptions.auth.ticket;
Expand All @@ -223,7 +223,7 @@ function SendFile(file, callback) {
xhr.onreadystatechange = function () {
if (this.readyState == 4) {
if (current == 'gelbooru') {
if (this.status == 200 || this.status == 302 || this.status == 304 /*not modified*/ ) {
if (this.status == 200 || this.status == 302 || this.status == 304 /*not modified*/) {
if (~this.responseText.indexOf('generation failed')) {
LogFailure(file, 'thumbnail generation failed, image might be corrupted even if added');
}
Expand All @@ -239,30 +239,32 @@ function SendFile(file, callback) {

if (!!Number(existId)) {
LogFailure(file, 'image already exists <a href="index.php?page=post&s=view&id=' + existId + '" target="_blank">here</a>')
} else
} else {
LogFailure(file, 'image has been deleted');
}
}
else if (~this.responseText.indexOf('permission')) {
LogFailure(file, 'no permissions');
var msg =
'Could not upload this image - the board says that you have no permissions.\nCheck if you are logged in. Stopped.';
'Could not upload this image - the board says that you have no permissions.\nCheck if you are logged in. Stopped.';
alert(msg);
OnAllUploaded();
throw msg;
} else if (~this.responseText.indexOf('n error occured')) {
LogFailure(file, 'image too big? too small? corrupted?');
} else
} else {
LogFailure(file, 'wrong response, check your posting form URL');
}
} else {
LogFailure(file, xhr.statusCode);
}
LogFailure(file, xhr.statusCode);
}
} else {
switch (this.status) {
case 200:
LogSuccess(file);
break;
case 201:
if (current == 'danbooru'){
if (current == 'danbooru') {
var uploadResult = JSON.parse(xhr.response).status;

if (uploadResult == 'completed') {
Expand Down Expand Up @@ -419,16 +421,18 @@ function RestoreLastSettings() {
$each(settingsToSave, function (setting) {
var lastValue = GetCookie(cookieBaseName + setting);

if (lastValue && (!$get(setting)))
if (lastValue && (!$get(setting))) {
$set(setting, lastValue);
}
});
$each(checkboxesToSave, function (setting) {
var lastValue = GetCookie(cookieBaseName + setting);

if (IsNum(lastValue)) {
$(setting).checked = lastValue == '1';
if ($(setting).onchange)
if ($(setting).onchange) {
$(setting).onchange();
}
}
});
}
Expand Down

0 comments on commit 6b23be1

Please sign in to comment.