Jump to content

User talk:Ruakh

Page contents not supported in other languages.
Add topic
From Wiktionary
Latest comment: 13 years ago by Brett in topic Collapsible JS

Hello, Ruakh, and welcome to the Simple English Wiktionary!

We hope you will be happy editing here. Some helpful pages to begin with are Wiktionary:Community Portal, Wiktionary:Useful, Help:Contents, Wiktionary:Rules, and Wiktionary:How to edit.

If you want to talk with other members or ask a question, you can visit Wiktionary:Simple talk. Administrators can also help you with more difficult problems. You can also ask me for help. The best way to do that is to leave a message on my talk page. Just remember to sign your messages on talk pages by typing "~~~~" (four tildes) at the end of your words.

Good luck and happy editing!--Brett 12:10, 7 July 2009 (UTC)Reply

ally

[change]

Thanks for coming! I've made some changes to ally, mostly additions. The only thing you might want to include is countable/uncountable for each noun sense and transitive/intransitive for each verb sense.--Brett 12:13, 7 July 2009 (UTC)Reply

Collapsible JS

[change]

Thanks, Ruakh! This looks very cool. I think some folks would use it just like this. The reason that this came up, though, was that we were discussing moving synonyms from the end of the lemma to the end of each definition line (or the line below it). So we'd like basically what you've done, but not for level 3 headings. There's have to be some other tag that would trigger it, and it would say "Show synonyms" and "Show antonyms" where each of these is available.--Brett (talk) 13:37, 2 March 2011 (UTC)Reply

Oh! Oops, sorry, I totally misunderstood.
If you'll show me how synonyms and antonyms will be formatted, I can modify the JS accordingly.
Ruakh 15:11, 2 March 2011 (UTC)Reply
Something like this:
  1. (countable) If someone is in charge of something, they are responsible for it. [synonyms ▼] [antonyms ▼]
Josh is in charge of buying drinks for the party.
and the dropdown might look like this:
  1. (countable) If someone is in charge of something, they are responsible for it. [synonyms ▲]] [antonyms ▼]
Josh is in charge of buying drinks for the party.
And I suppose these parts [synonyms ▼] should be blue. We could create a new template if that would help.--Brett (talk) 15:32, 2 March 2011 (UTC)Reply
Don't worry about how it will look when it's collapsed — I can handle that — but I need to know exactly what form the wikitext will take, so that the JavaScript can find the synonyms and antonyms, and distinguish synonyms from antonyms, and show or hide them as appropriate. Like, for example, here's one possible way you could format them:
  1. (tag) Definition.
    Example sentence.
In that case, one approach would be to look for unordered lists nested within a definition. If the list has only one element, and it starts with a bolded "Foo:", then we could hide the list and create a [foo ▼] link on the definition-line. If the list has multiple elements, then for each element that starts with a bolded "Foo:", we could hide the element and create a [foo ▼] link on the definition-line. (This also means that it's not inherently specific to synonyms and antonyms; anything you put there will work the same way.)
Ruakh 15:53, 2 March 2011 (UTC)Reply

OK, how about we say the code will look like this:

# {{countable}} If someone is in '''charge''' of something, they are responsible for it. {{synonyms|care|control|responsibility}}

Would that work?--Brett (talk) 17:20, 2 March 2011 (UTC)Reply

It would work, yes, but that's not really enough information for me. You see, templates are handled on the server-side, and JavaScript runs on the client-side; this means that the JavaScript can't directly see what templates were called, or in what way. All it can see is the resulting HTML.
But, I'm getting the impression that you don't know exactly what the uncollapsed version would look like?
So, I've created one possible version of {{synonyms}} (and ditto {{antonyms}}), and updated [[User:Ruakh/common.js]] accordingly. I've also added [[User:Ruakh/common.css]], which indents the 'onyms an extra bit, because otherwise it looks strange when there's an example sentence underneath.
Please try them out, and let me know if you want anything different.
Ruakh 22:09, 2 March 2011 (UTC)Reply
I've set up a test page, but it doesn't seem to be working. Am I doing something wrong?--Brett (talk) 01:06, 3 March 2011 (UTC)Reply
You're doing it exactly right, but it's only coded to take effect on pages in the main namespace. So, two options:
  1. Copy that into the edit-screen for a real entry, and hit "preview"; or,
  2. Take the new version of [[User:Ruakh/common.js]], which removes that restriction. On en.wikt we only want the collapsing quotations to work in entries, because it just collapses any sort of #*, which can happen any number of ways on discussion pages; but this auto-collapse is targeting very specific code that can't occur accidentally, so it might as well work on all pages.
Ruakh 02:15, 3 March 2011 (UTC)Reply
By the way — are "synonym(s)", "antonym(s)", and "visibility" considered Simple English? (I assume that "show" and "hide" are O.K.) —Ruakh 23:18, 2 March 2011 (UTC)Reply
"Visibility" probably doesn't work. "synonyms" and "antonyms" are not simple, but are considered central to using a dictionary.--Brett (talk) 01:05, 3 March 2011 (UTC)Reply
So, what to use instead of "visibility"? —Ruakh 02:15, 3 March 2011 (UTC)Reply
Not sure. Where do you mean?--Brett (talk) 12:04, 3 March 2011 (UTC)Reply
When you visit a page with hidden synonyms (or antonyms, or whatnot), you'll see a "Visibility" section in the toolbar at left. (Just visit [[charge]] and search the page for "visibility", and you'll see what I mean.) The links in that section allow you to show or hide all synonyms (or antonyms, or whatnot) at once, and are tied to cookies that remember that setting. (This way, if you always want to see synonyms, you don't have to constantly be clicking the "synonyms ▼" links on every page.) —Ruakh 14:37, 3 March 2011 (UTC)Reply

I think this is a go. Thank you very much! I've tested it on charge and it looks great. Can I ask you to add it to MediaWiki:Common.js?--Brett (talk) 12:04, 3 March 2011 (UTC)Reply

You're welcome! Re: MediaWiki:Common.js (and, for that matter, MediaWiki:Common.css): Sorry, only admins can edit pages in the MediaWiki namespace. (By the way, I've made a few new fixes to User:Ruakh/common.js that you'll probably want to pull over.) —Ruakh 14:37, 3 March 2011 (UTC)Reply
OK, so should I just copy and paste below what's there?--Brett (talk) 16:14, 3 March 2011 (UTC)Reply
Yup! And if/when you want to change "Visibility" to something else, just change the line newNode('h5', 'Visibility'),. :-)   —Ruakh 18:57, 3 March 2011 (UTC)Reply

I've noticed that every time I navigate to the charge page with the new script, I get the non-javascript version. If I force a reload, then the javascript starts working, but navigate away and then back again and it's gone. I don't have this problem with other JS stuff. Is this just me or is there something else to it?--Brett (talk) 10:48, 5 March 2011 (UTC)Reply

Oh, sadness. Which browser are you using? —Ruakh 17:36, 6 March 2011 (UTC)Reply
Safari Version 5.0.3 (6533.19.4) on OS 10.6.6.--Brett (talk) 18:21, 6 March 2011 (UTC)Reply
O.K., sorry about that. I've installed Safari 5 now, and was able to reproduce the issue; and while I don't understand all the details that caused it, I think I know how you can fix it. At User:Conrad.Irwin/feedback.js, you see the line that reads, /* DOM abbreviation function */? If you take everything from that line onward, remove it from User:Conrad.Irwin/feedback.js, and put it at the top of MediaWiki:Common.js, I think it will resolve that issue.
(Technical details: the visibility code depends on Conrad's nifty newNode function. On en.wikt, that function is defined in en:MediaWiki:Common.js. On simple.wikt, it's defined in User:Conrad.Irwin/feedback.js (which is called via an importScript in MediaWiki:Common.js). In Firefox and in IE7 and IE8, this works fine; and it also works fine in Safari 3, which is the version of Safari I had installed; but in Safari 5, for whatever reason, it seems that User:Conrad.Irwin/feedback.js sometimes isn't loaded until too late.)
Ruakh 00:48, 13 March 2011 (UTC)Reply
Copy from User:Conrad.Irwin/feedback.js or remove?--Brett (talk) 17:04, 13 March 2011 (UTC)Reply
Move. (Copying would probably be fine, but I think moving is preferable: the same function shouldn't be defined twice, for various reasons.) —Ruakh 20:54, 13 March 2011 (UTC)Reply

New problem. See definitions 4.1 and 4.2 at class.--Brett (talk) 14:52, 26 June 2011 (UTC)Reply

Sorry, I didn't know y'all were using subsenses here. The code I gave you included a sanity-check to help ensure that it was only collapsing things in places where collapsing should happen. As you're probably aware, Hoo man (talk · changes) has now removed that sanity-check, thereby resolving the issue. (Also, sorry for my delayed reply; I didn't see your comment until now. In the future, please feel free to bug me via e-mail, or via en:User talk:Ruakh, for a faster response. I've now set my preferences so that I'll get an e-mail when someone edits this page.) —Ruakh 22:47, 12 July 2011 (UTC)Reply
We weren't really (using sub senses that is). Thanks for the reply though.--Brett (talk) 01:45, 13 July 2011 (UTC)Reply