Danbooru

Note Assist, automatic note generation & resize.

Posted under General

I seem to have broken this when I fixed issue #1675. Notes jump around instead of being created where I drag.

It looks like it can be fixed by replacing lines 1312 to 1336 of the userscript (the override of the old Danbooru.Note.TranslationMode.create_note function) with this:

Danbooru.Note.TranslationMode.create_note = function(e,x,y,w,h) {
    var offset = $("#image").offset();

    if (w > 9 || h > 9) { /* minimum note size: 10px */
      if (w <= 9) {
        w = 10;
      } else if (h <= 9) {
        h = 10;
      }
      Danbooru.Note.create(x - offset.left, y - offset.top, w, h, e); // custom code - added event to parameters
    }

    $("#note-container").css('visibility', 'visible');
    e.stopPropagation();
    e.preventDefault();

    // Hack to ignore clicks for some milliseconds
    // The mouseup event is executed before the click event, so it's hard to do this properly
    Danbooru.Note.ignore_click_until = (new Date).getTime() + 200;
  }

That just updates the overridden function with the changes I made.

Updated

Fixed.

As one might have guessed, i no longer have the time or motivation to add new features to the script, but i'll try to keep it working.

This script shouldn't die. With some polishing, it should get incredibly useful for both translation and note gardening. I've made a little (ugly) tweak to bind ctrl+click on any existing note to resize it on the text inside - and this is STILL awesome in how much it simplifies working with notes. Itsonlyaname, are you still here? Maybe move the script to github so anyone could contribute/send pull requests? Also github probably won't go down like userscripts did.

I'm still here :p

Moved to git.
So, it's been about 2 years since the code has been touched. Perhaps it's time for some code cleanup, if i changed it a bit so it doesn't use so much hard-coding anymore, it could be quite useful for any text-detection application.
It's vacation right now, so i might be able to work on it for a bit :)
Edit, there's a lot more code than i remember (2000 lines), working on it slowly but surely.

Updated

Update!

Changelog:

New feature: Ctrl-click* a existing note to resize it (per type-kun's idea)

- Most of the logic & code re-written so people can actually read what is happening.
- Accuracy in detecting text remains about the same, I've pretty much hit a dead end trying to improve it.
- speed increase on everything!
- memory usage remains the same
- moved script objects to it's own namespace, improves cross-browser support & maintainability.
- much less likely to break when danbooru updates

*Can be bound to shift- or ctrl-shift-click

And since it's on git now, anyone is free to create issues / pull requests :)

Edit;
2015-07-10 - v1.1:
- New button: "save all non-ghost notes" to make it easier to reposition a lot of notes.
- Notes resized by the script now are properly marked as "unsaved"

Updated