User:BrianFreud/Uberscript

From MusicBrainz Wiki

Geordie

Downloadable at http://userscripts.org/scripts/show/22970 .

Build History:

beta 8 Feb 26: VA track titles are also now inlined. Distortion line causes by iframe ought to now be gone. Added basic button controls. Added the first bits of edit controls, plus edit 'popup' window - please let me know if it's rendering incorrectly for you. And, with many thanks to dmppanda for his js tips, rewrote the annotation parsers - they now handle lists, etc, correctly too. Also some code cleanup and optimization, it ought to be a bit faster to react now.

Screenshot: [[[Image:beta8.jpg]] 1]

beta 7 Feb 22: Named this thing; apologies to luks.  :D VA lookups no longer go into huge loops that crash the browser. Added MB artists lookup. Fixed several url filtering bugs that were causing known urls to not actually be filtered out of results, added known artist urls to the filter list. As VA releases can lead to huge numbers of info requests, added some code to slow things down a little for VA releases to avoid overloading bandwidth and the browser. Also fixed the in/out status, it ought to be much more accurate now. If you're running beta 6, please upgrade - beta 6 can be considered unstable.

beta 6 Feb 21 evening Fixed a problem with VA releases missing a cell. Fixed bug with "annotation last modified by" becoming the annotation if there once was, but no longer is, an annotation. Got rid of the "Amazon: info | buy" that was still showing up sometimes, this time without the occasional crashes on initialize... hopefully. Added VA release artists support.

Screenshots: [[[Image:exampleA.jpg]] 1] [[[Image:exampleB.jpg]] 2]

beta 5 Feb 21: Status now locked in size. Fixed bugs with various minor display elements in wierd situations. Finished up the release area highlighting. Track times and release title are now inlined as well. Fixed some issues with the time insertion code, adding a 3rd, 4th, 5th, etc column won't keep adding title lines as well. Double-click a title to enter/exit track title editing mode for that track.

beta 4 Feb 21 afternoon: Fixed bug if there was no annotation, made the annotation buttons look much more like buttons. Some other minor appearance fixes. Also added the code for inline track-editing - it's smart enough to recognize when you have or haven't made changes, as well as detecting if the new title is too long for the server.

beta 3 Feb 20 build: Massive amount of work - 18 hours straight hours of coding. Wrote a Wiki::Text <--> HTML converter. It works better than the Wiki::Text HTML converter actually, because it correctly encodes OL tags (Wiki::Text breaks them). Unfortunately, I've not yet been able to reproduce the Wiki::Text bug, so I've had to cripple that part of the code. Everything else will convert fine, but don't be surprised to see HTML list tags in here for the moment. I could add real list support in markup code, but then every OL would turn into a UL -considering that OL's are very broken in their code at the moment, is anyone actually using them? The annotation editor is otherwise fully functional - the annotation you see even when it first loads up is interpreted on-the-fly, it's not just ripped from the release page. If you make changes in the editor, you can immediately see them in the view pane! Oh yes, annotations are back - and they're inlined! No submissions yet, though, still putting the editor itself together. If anyone wants to much with that annotation code to try and duplicate the broken Wiki::Text OL behavior, go for it.  :) Other addition is on-the-fly track time column insertion and a sub-title line (with headings) to eventually ID which time is where. I'm leaving it on in this code so it can be seen, though it'll eventually be used only if/when needed.

Screenshots: [[[Image:inlineeditor.jpg]] 1] [[[Image:complex.jpg]] 2]

beta 2 Build for the afternoon of Feb 19. Tied in most of the engines, killed every error and bug I can find. Other fixes: the columns should stay sized correctly now, built in url-window added, new-user guide linked in (nothing there at the moment though), script-update check added. IMDb lookup now also gives you the actual title of the IMDb page the url links to. IMDb now only checked for releases if the release is a soundtrack. Wikipedia now also looks for labels and releases. Wikipedia and Myspace ought to give much better results now, too, for the label searches. Ozon ought to find more images now. Fixed a few minor FreeBase lookup errors; clarified what some of the FreeBase info means. Ignore the script when it says "MusicBrainz has returned information on the artist, release, and labels." - only the release info is tied in yet. Fixed the dupe-url checker, it ought to not list any url more than once, nor list it at all if we already have it in the database for that release (and when I tied them in, /artist/label either). To do: Add in the B&N code, fix the B&N code so it checks the "all tracks" view, not the short list. Add in the Discogs code. Add in the MusicMoz code. Add in edit submission. Add back in annotations. Needed: If anyone's still having rendering issues (the link disappears and nothing else happens, the coverart jumps to the lower-left corner but nothing else happens, or some new bug) please let me know! Also, if you find any more Wikipedia disambiguations, or urls that could never be valid (www.foo.com/search?blah=artist), please get in touch by IRC and let me know, so I can kill any bugs still out there in the existing code, before moving into the editing half. :) - Oh yes, don't forget you may have to fix line-breaks in the beta code from Userscripts before the script will work!

beta 1.5 morning of Feb 19. Screenshot: [[[Image:9_46build.jpg]] 1]

beta 1 Nightly build for Feb 18. Lots of lookup improvements, shouldn't throw errors on failed lookups anymore. Wiki only for the moment, now to add back in the others.

Screenshots: [[[Image:filtering.jpg]] 1] [[[Image:z_after.jpg]] 2] [[[Image:234.jpg]] 3]

alphas first half of Feb. Basic search engines for SA only.

Screenshots: [[[Image:123-1.jpg]] 1] [[[Image:lol2.jpg]] 2] [[[Image:after.jpg]] 3] [[[Image:Uber1.jpg]] 4]

concept designs (mostly from 2007) [[[Image:ARpic.jpg]] 1] [[[Image:ARSuggestion.jpg]] 2] [[[Image:UPC-ASINmockup.jpg]] 3] [[[Image:FullyFunctional.jpg]] 4] [[[Image:SmallerReallyBigExampleScreenshot.jpg]] 5] [[[Image:ReallyBigExampleScreenshot.jpg]] 6] [[[Image:BAR-LoadObjects2-1.jpg]] 7] [[[Image:BAR-LoadObjects.jpg]] 8]

And only semi-related to the alphas: [[[Image:current1.jpg]] 1]



Annoying browser bug of the day...

What's the difference between these?

...
        newReleaseTitle = makeViewer();
        newReleaseTitle.style.fontWeight = "700";
//        newReleaseTitle.style.border = '1px thin black';
        newReleaseTitle.id = 'Title_View_ReleaseTitle';
        newReleaseTitle.addEventListener("dblclick", switchTrackMode, true);
        newReleaseTitle.innerHTML = rRelease;
        trackTable[0].appendChild(newReleaseTitle);
...

function makeViewer() {
        var newTrackView = document.createElement('div');
        newTrackView.style.border = "0 none white";
        newTrackView.style.padding = "0";
        newTrackView.style.margin = "1px";
        newTrackView.style.overflow = 'none';
        newTrackView.style.height = "100%";
        newTrackView.style.wifth = "100%";
        newTrackView.style.display = "block";
        return newTrackView;
}

and

...
        newReleaseTitle = makeViewer();
        newReleaseTitle.style.fontWeight = "700";
        newReleaseTitle.style.border = '1px thin black';
        newReleaseTitle.id = 'Title_View_ReleaseTitle';
        newReleaseTitle.addEventListener("dblclick", switchTrackMode, true);
        newReleaseTitle.innerHTML = rRelease;
        trackTable[0].appendChild(newReleaseTitle);
...

function makeViewer() {
        var newTrackView = document.createElement('div');
        newTrackView.style.border = "0 none white";
        newTrackView.style.padding = "0";
        newTrackView.style.margin = "1px";
        newTrackView.style.overflow = 'none';
        newTrackView.style.height = "100%";
        newTrackView.style.wifth = "100%";
        newTrackView.style.display = "block";
        return newTrackView;
}

Seemingly, the only difference is that bit setting the border right? Not to Firefox... When that div is the only element inside a TD, and that TD is the only element inside a TR, and that TR is the only element inside a TABLE, if you set a border on that DIV, Firefox takes that nice clean:

<div style="border: 0pt none white; margin: 1px; padding: 0pt; height: 100%; display: block;" id="Title_View_ReleaseTitle">Little Earthquakes</div>

and turns it into this:

<div style=style="border: 1px none ; margin: 1px; padding: 0pt; height: 100%; display: block;" id="Title_View_ReleaseTitle"><div>Little Earthquakes</div></div>

And it ONLY does it under those very particular circumstances - every single other place that code was used, it worked fine. And that little extra DIV shouldn't matter... except that it also screws up a comparison like:

if(editTrack.value != viewTrack.innerHTML) 

by ALWAYS making it true, even if you changed nothing! ARGH! Only took 3 hours to figure that little bug out.  :D

Brian

Just an unrelated note (unrelated to your problem): Using innerHTML as a setter is a very bad idea that will likely blow on you... -- dmppanda 01:21, 22 February 2008 (UTC)

Well, .value works for a textarea (and of course, innerHTML doesn't work there), but is there a better way to insert text into a div (other than createTextNode)? -- BrianSchweitzer 22:02, 22 February 2008 (UTC) (Oh yes, I didn't mention above, this happens even when you're setting from a straight known string, it isn't a carry-over from some otherwise unforseen innerHTML div.)