ZLib -- Zarqon's useful function library

Firefox 3.6.11

Fired it up. Got numerous prompts about a script taking too long. After 10 minutes wall clock time rendered page to the point that browser was responsive. Said there were 5800+ items which suggests a problem. I'll see if I can figure out why :-)
 
Looks like it's just about only compatible with Opera. :D

After changing line 96 to
Code:
build.append("<script type='text/javascript' charset='utf-8'>\n$(document).ready(function() {\n  var expand = $('#showall')[0];\n");
, I now see: shiny! (edit: yeah, I was getting thrown a "expand not defined" error, for whatever reason.)

But yeah, Theraze's comment about "Showing x settings" is also in FF/Chrome/Safari. So yeah, everything breaks but Opera. Probably not great -- of the major browsers, I'd say Opera is the least used.
 
Last edited:
Update. There really were 5818 entries in my vars file. Most of them were from eatdrink and of the form eatdrink_<key>_<item> where <key> was one of "avoid", "fav" or "daily". For reasons that will now be investigated there was a daily entry for (I believe) every item in the game so there is definitely some work to do with EatDrink.

When I edited it down to 81 entries, things were much better. However: 1) I could not for the life of me figure out how to get the mouseover people were complaining about; 2) I could not get the documentation text to display; 3) ftf_olfact is actually a list of strings and the display looked pretty ugly and seemed to force me to edit the whole thing as one.

1 and 2 could be operator error or a problem with using Firefox. 3 is a reasonable feature for a first release, but I can imagine a time when the interface supports a list of items.

Thanks.
 
Her's what works for me on Firefox 3.6.12:
I click on WOSSMAN, nice effect.
I have one vars setting I use called "crownthrone_choice" that I was gonna test with. (Guess what it's for.) Every time I try to change the type from string to familiar and go to click something else, it just switches back to string. If I try to change the contents from none to Cocoabo (my tester), it'll change that but won't ever let me set the type to Familiar.
Another setting I have is "allow_wardrobe" to allow a familiar equipment manager to allow switching in the tiny costume wardrobe. As you can imagine, this is a simple true/false. The setting is set at string and refuses to allow me to change it.
I also cannot get the descriptions to expand at all. When it's first starting, I see everything expended and then they collapse. Checking Expand at the top has no effect.
I get no mouseover text for items with descriptions.
If you need more information from me, I'll help how I can.
1. When it comes time to release this, should I integrate it into the ZLib thread or make a separate thread for it?
Considering WOSSMAN seems like it can be very central to zlib, it would probably be best to keep them together. Although, for the time being, until you have WOSSMAN debugged, it might be better for it to have its own thread for the time being so it doesn't overshadow zLib.
2. Right now, when populating the select boxes I'm filtering familiars down to the ones you have (idea stolen from FN Ninja). Are there any familiar-type settings where you may want to specify a familiar you don't have? This is easy to edit later if such a setting comes into being, but if there isn't presently one I'd like to filter them for ease of use.
Only reason I can think of to list familiars that you don't have yet is when someone's playing bad moon.
 
Ah nice, 3hee. It seems you put that up just as I was beginning my testrun with it. OK, the expansion works now, so scratch that off my list. Still cant change types.
I'll agree with Bale in the mouseover effect, while nifty, is rather jerky. A small time delay of just a second should help smooth it or even expand it when you click instead of mouseover.
Other than that, it looks VERY promising.
 
Ew gross, I just tried it on IE 8 and it runs like a dog. Opera wasn't kidding about their JavaScript engine being much faster.

In the interest of letting people play around and find problems, here's a very quick edit with some customization. A couple variables at the top now:

Adjust anim_ms to set your animation duration (set it to 0 for immediate transitions, which will run much faster on suboptimal machines -- in other words, machines with slow graphics or not running Opera). You can also set it to 10000 if you want to annoy yourself with 10-second animations!

Adjust openevent to your desired trigger ("mouseover" by default). Play around with "click" or "dblclick" to see if you like those better.

If people seem to settle on a variety of preferences for these, the WOSSMAN may just have its own ZLib settings.

I also added a few small fixes: 1) removed the annoying border for delete images in IE, and 2) slightly changed line-heights to possibly make all text visible. It was at least visible in both Opera and IE 8.

I did not add heeheehee's fix yet (thanks for posting that, btw) because I can't test (I only have Opera and IE 8), and also because it's kind of a hack -- it's adding an extra variable to reference something which already exists and has both a name and an id. I'm sure there is a way to reference the state of a checkbox from within Java in all browsers, I just don't know what it is yet. I seem to recall $('#showall').checked not working; that's why I added the name attribute and referenced it by name. I just tried document.expand.checked and that didn't work either.

@frono: Holy crap. Glad you got that cleaned out. I'd imagine all of your ZLib-importing scripts ran faster after that!

@Fluxxx: Are you pressing enter after changing the value? Bet you're not.
 

Attachments

Last edited:
For 3hee's fix, it's gone from line 96 to line 100. Still needed that :/

If you mean changing the value of the type, yes. Clicking, double clicking, enter, it always goes back to string. I can't get it to stay on boolean or save it as boolean. (And why does Firefox think boolean is something spelled incorrectly?!)

As for the anim_ms and openevent variables, it gets worse for mouseover. Because the mouseover responds as soon as it detects, well, a mouseover(!) it reacts instantly. So if you have a delay of anything other than 0, it'll go through each and every one that detects and take its time getting to where your mouse actually is. If it had a delay for how long you hold your mouse over before opening, that would smooth things. I apologize for I realize when I described this before, I had put it incorrectly.

The click and dblclick on the other hand... I would make references that involve sun tan lotion and my GF on the beach. Instead I'll just say it's very nice. anim_ms isn't as important, but a click and it just slides out beautifully. I will definitely use the click.
 
Zarqon -- of course $('#showall').checked wouldn't work, since the $() function returns an array of elements that fit the criteria, even if there's only one (in the case of matching for ID). I don't see how expand already exists, considering that you haven't defined it up to this point. Perhaps it's something unique to Opera's JS engine? Also, the issue with names is that I want to say that only works if they're inside a form, and ID works just as well in those cases (not for the wrapper form, just those). Or if it's an image (only name will work here, though, ). There should be some jQuery equivalent for grabbing the checked attribute, but the closest I can think of is $('#showall').attr('checked'), which is slightly more code than $('#showall')[0].checked.

Also, regarding my fix: It didn't break Opera (tested that, just for you and Bale), and it makes all the other browsers work. Which is generally good.

Edit: Just booted up Opera, and evidently anything with an id OR name is available as a variable in JS. What the heck? Looks like window.showall (which Opera abbreviates to showall) is valid in Chrome and IE8, at least, but doesn't seem to work with FF 3.6. That's actually kinda funny, that something works in IE but not in FF. Safari's console is apparently a pain to add for Windows, so I'll get back to you regarding Safari.

(further note regarding Opera: showall==expand returns true)

Double edit: Never mind about FF, showall (the id) is valid in everything (FF, Chrome, Safari, IE8, Opera). Try that instead of expand.

Triple edit: Also, an alternative to expanding the horizontal bar at the top would be modifying the CSS so that it looks like Opera regardless of browser.
 
Last edited:
Can anyone confirm whether the "showing X settings" text is visible in FF/Safari/Chrome using the last posted script?

I think the check for (this === event) can also be removed from the mouseover event -- that was to prevent a bubbling issue when I was trying out toggle() rather than explicitly using hide/show -- which will avoid the "mouseover with no response" issue someone mentioned.

I'm kind of debugging in the dark here, because everything works splendidly for me. :)

@Fluxx: not really -- whenever there's a mouseover, first it cancels all active animations (it immediately completes them) before starting the next animation. If you want to see it actually do what you're describing, remove the first command from the .unfoldable .head event function!

@3hee: aha -- so $('#showall')[0].checked ought to work, eh? That [0] was what I was missing -- I'll give it a shot. I just didn't like declaring the extra variable for an already named and id'd object. I don't like the new check_version in ZLib either, for the same reason -- it required two more string variables! Ugh. I felt kind of brutish and heavy-handed after that -- I had to enjoy a classy beverage and use large vocabulary words for a while to feel like myself again.
 
Looks a bit odd -- perhaps the bit about CSS that I added in my last comment might help? I'll poke around the internets to see if there's anything that'd be directly copy-pasteable.

Edit: No dice, although I did mess around a bit with Opera's dev tools and look at the computed styles. Those don't quite translate perfectly.

Double edit: Removing margin-bottom from #topbar's css seemed to work; will check to make sure it doesn't ruin any browsers.
(triple edit: looks fine, although Opera does have more space along the bottom than the others.)
 
Last edited:
Interesting notes about Opera! Oh Opera, how I wish other browsers would be quicker to copy you than they already are. :)

Thanks for that, I'll give both of those a shot, but probably go with window.showall since it selects a single thing rather than a group of one (subtle difference but whatever). Then I can delete the name!

The text issue would be easy to fix with a table, but I'm trying to stay CSS-only. However, that's a principle I'll discard if I get too annoyed trying to make it work for everyone. The tricky part is that the right-floated div is taken out of content for the container div, so the div cuts off the right div if the left div isn't tall enough. Can you specify margins in em? Maybe adding some margin-bottom to #title would work.
 
Note that all properties of the window element are also available as global variables, and vice versa. It's a feature! (also, see my latest edits to my latest post)
 
Okay, using IE8-64bit, the spacing is fine now for the count of scripts.
The only thing covered is the underline from your name in the credits, but that's probably fine.
If you move your mouse wildly and end up in the space between two of the values, you can still end up having it look like you've selected something else, and not had it be taken into account, but again, that's fine. That would also be resolved if we moved from mouseover as default to click... I wouldn't mind it being an option, but I think it's better served not being the default.

FReq: Is it possible to have documentation match on startsWith instead of equals? eatdrink_avoid_ and eatdrink_daily_ are likely to be different for most people/accounts, but they do standard things regardless of what the continuation of the variable is... eatdrink_avoid_<item> will always avoid consuming that item automatically. eatdrink_daily_<item> are the items that you've actually eaten, so it checks the prices on those items.
 
No. That's poor settings naming, leading (as fronobulax can attest) to unnecessary bloat. I'm definitely not going to encourage that. A comma-delimited list of items in a few settings (perhaps eatdrink_daily and eatdrink_avoid) or somesuch would be far better.

Did you try removing the "if (this === event)" bit (line 125-ish) to possibly help the rapid-mousing issue?
 
When I leave it hovered over an actual item, it realizes it. There's a ~1-2 pixel line between items though, and if the mouse ends up RIGHT on that with mouseover on, it doesn't register as having a new item selected... because it doesn't. It looks like a bug, but isn't. Only visible when you have mouseover on though, because if you're clicking, you'll click on the item you want, as opposed to trying to find that tiny little line where it doesn't.
 
The tricky part is that the right-floated div is taken out of content for the container div, so the div cuts off the right div if the left div isn't tall enough.

I am *totally* stabbing in the dark here, but that sounds like you want to use "clear: right;" on something?
 
Ok, I'm getting the following error:
Bad item value: "pumpkin carriage" (zlib.ash, line 395)

I am using the newest build (8762). I suspect the item cache is out of date, but don't know how to force an update. Thanks for any help.
 
Back
Top