Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can you implement my fork? #1

Open
ProximaNova opened this issue Jan 15, 2016 · 8 comments
Open

Can you implement my fork? #1

ProximaNova opened this issue Jan 15, 2016 · 8 comments

Comments

@ProximaNova
Copy link

At https://github.com/ProximaNova/Booru-Augmentation-Project

Also for Booru-mass-editor.user.js I've tried around 5 solid methods (from Firefox → edit userscript, not on Github) of submitting the form when enter is pressed in the textarea (like Moebooru does) and none have worked. Do you have any clue?

@Seedmanc
Copy link
Owner

I'm not quite sure what your script is supposed to do.

It doesn't look like a mass editor to me, since it's being run on single pages of images, once at a time. I have a feeling that my B.A.P already has the functionality of quick editing tags on the post pages.
After reading forum.booru.org I thought you were making stuff that would allow editing images on pages with the thumbnails, 20 at once.

As for the textarea, don't forget that after manipulations with innerHTML the event listeners are destroyed. Therefore, put your submit code after that bunch of replaces, and I'd go with something like

    var textarea = document.getElementById("tags");
    textarea.addEventListener('keydown', function(e) {
        if (e.keyCode == 13) { 
            textarea.up('table').down('input[type="submit"]').click();
        } 
    });

(this assumes prototype.js library is loaded, which I think is included in boorus anyway).

You seem to be making a lot of typos there, programming has zero tolerance for that. Especially in FF where you can't even debug userscripts.

@ProximaNova
Copy link
Author

It is meant to improve the &id= interface to quickly tag individual images. And I have noticed that editing goes a lot faster when using it.

@ProximaNova
Copy link
Author

Thanks, it only works if it's after the HTML modifications, example:

document.getElementById("tags").addEventListener("keydown", function(e) {
    if (e.keyCode == 13) { 
        document.getElementById("edit_form").style.backgroundColor = "green";
    }
});

fails before but works after. However,

document.getElementById("tags").addEventListener("keydown", function(e) {
    if (e.keyCode == 13) { 
        document.getElementById("edit_form").submit(); //OR document.forms[2].submit();
    }
});

fails for some reason.

@ProximaNova
Copy link
Author

It works here though:

<textarea id="tags">a b c</textarea>

<form id="edit_form" action="form_action.asp">
</form>

<script>
document.getElementById("tags").addEventListener("keydown", function(e) {
    if (e.keyCode == 13) { 
        document.getElementById("edit_form").submit(); //OR document.forms[0].submit();
    }
});
</script>

@Seedmanc
Copy link
Owner

I dunno why the form is not being submitted, just click the submit button programmatically as I shown.

As for onload, I dunno, if you're adding event listeners before innerHTML changes they will get rekt, and if after maybe it's too late.
Actually, I wouldn't be using the onload event at all, afaik it happens after all images have finished loading and there's really no need to wait for that unless you need image size or something. I usually put my stuff onDOMContentLoaded, or you can just add @run-at body to the header.
Or like this
document.addEventListener('DOMContentLoaded', onDOMContentLoaded, false);
function onDOMContentLoaded() {do stuff;}

@ProximaNova
Copy link
Author

It now works, I simulated a mouse click on the button and fixed the repetition problem; editing 20 at once is now very possible! Also as far as I've read I can't get an image's file size with JavaScript.

You should add the tag history script I wrote. It practically does everything needed except display the tag(s) subtracted. I don't know why the methods I used to display them failed; it is strange. Also it is in this regard (among others such as displaying the number of tags at the &id= pages) better than Gelbooru, for my script for the tag history display shows the proper color for subtraction, addition, and no change in tag quantity:

-quantity: http://gelbooru.com/index.php?page=history&type=tag_history&id=3106916 (should be red)
+quantity: http://gelbooru.com/index.php?page=history&type=tag_history&id=3106736 (should be green)
no change of quantity: http://gelbooru.com/index.php?page=history&type=tag_history&id=3098750 (should be white or grey)

(The ability to hide and display columns like Danbooru software does should be actualized along with colored tags having the right color when hovered over.)

Also implement: alias list improvement (needs tag coloring though).

The post list script doesn't do anything; I wonder why, for it seems correct. Possible future of it: tag coloring, tag wiki (Google) links, links go to section #image (at <img id="image"...> at &id= pages), image border if child or parent post which requires the &id= pages to be read (see: ProximaNova/Booru-mass-editor#11), etc.

@ProximaNova
Copy link
Author

I've been running your script along with mine which sort of works but could work better. It would be a great improvement if they both worked at once.

For &id= pages your script does:

  • Throughout:
    • Highlight tags with difference colors based on its text and quantity of on images
  • In queue:
    • change text on existing tags
    • remove existing tags
    • add tags from "my tags", tags in "my tags" can't be changed though
    • add tags, then change there text in the queue
    • all editing input type text have a drop down of the tag you might type based on the current characters like Danbooru and Google, only works on Google Chrome (and Opera which I think is what you are using)
  • Clicking the submit button:
    • spinner
  • After submission:
    • sometimes displays the false quantity tag(s) (this also happens in the queue), which corrects after refresh
  • Statistics section (minor edits):
    • Bolds the names of the name value pairs
    • link to the user who uploaded, for Anonymous it should (but does not) link to ...&tags=user:Anonymous since Anonymous doesn't have a profile
    • Adds Title: Title name value pair

My script does a bunch of other stuff at &id= but when running along with your's your's becomes visible yet inoperable, and mine has some feature that still work, others that sort of work, and others that do not work.

@Seedmanc
Copy link
Owner

Seedmanc commented Apr 3, 2016

On your first post:

I implemented the tag history script, works good enough for me.

Dunno what you mean by column hiding, probably something redundant.

Colors are the domain of your script, I don't plan on introducing them, at least the way you do. Perhaps I'll go with assigning categories to tags like I did in my tumblr addon.

Added alias script as well.

I don't understand what the post script is supposed to do and where, be verbose. Google links are already implemented on the list page. There's no place for them on the post page, the ajax editor is more important.

On your second, good job on auditing compatibility.

What do you mean by queue? I don't understand.
"My tags" can be changed in user settings. If I wanted to manually type in mytags on the post page I might as well type in the post tags themselves instead, no improvement here.

I fixed the dropdown in FF. FF is insane once again.

Added link to Anonymous in statistics area.

I'll think about improving compatibility, but it might be difficult because our script change same elements in different ways.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants