User talk:Anomie/Archives/2017

{{Talkarchive}}

AnomieBOT edits

Hi Anomie,

AnomieBOT made a few edits recently to User:Becky Sayles/sandbox. I think it happened because I forgot to include {{User Sandbox}} on the page. I'm not familiar with AnomieBOT's functions, but I think it may be helpful for you to take a look at those edits. I imagine that if the page had been something other than a sandbox, the edits might not be desirable.  B E C K Y S A Y L E 01:39, 13 January 2017 (UTC)

: {{reply to|Becky Sayles}} A discussion at Wikipedia:Templates for discussion/Log/2016 July 2#Template:Multicol determined that those templates should be replaced with other templates, and thus someone instructed the bot to make that replacement. Anomie 16:47, 13 January 2017 (UTC)

Help over a specific page!

I need your help. I made a school's page named 'Contai Public School' and I am unable to add the school's logo. Shreyam Pattanayak (talk) 07:52, 14 January 2017 (UTC)

: Perhaps you should read Help:Editing#Adding images, sounds and videos. Anomie 17:15, 14 January 2017 (UTC)

Update [[:File:Pango-name.svg]]

I have just updated :File:Pango-name.svg on the Wikimedia Commons, it looks much better than previous version, do you want to copy it to Wikipedia? -- Great Brightstar (talk) 17:17, 2 December 2016 (UTC)

:Well, this file have been updated, so abandon this request. --Great Brightstar (talk) 07:21, 16 January 2017 (UTC)

I'm stumped

I've got a design flaw in a script, and I need leads on possible approaches for fixing it. I'm hoping you can point me in the right direction...

I'm working on a script to make browsing and reading lists on Wikipedia easier. It's called User:The Transhumanist/anno.js. It toggles the hiding of annotations, so you can turn them off when you just want to see the items listed for quick browsing. And you can reactivate them again when you come across a term you don't know. For example...

It makes:

  • Chess board – checkerboard with 64 squares (eight rows and eight columns) arranged in two alternating colors (light and dark). The colors are called "black" and "white", although the actual colors vary: usually they are dark green and buff for boards used in competition, and often natural shades of light and dark woods for home boards. Chess boards can be built into chess tables, or dispensed with (along with pieces) if playing mental chess, computer chess, Internet chess and sometimes correspondence chess.
  • Rank – horizontal row of squares on the chessboard.
  • File – vertical (i.e. in the direction from one player to the other) column of squares on the chessboard.
  • Chess set – all the pieces required to play a game of chess. Chess sets come in various materials and styles, and some are considered collectors' items and works of art. The most popular style for competitive play is the Staunton chess set, named after Howard Staunton. The relative values given are approximate and depend on the game situation.
  • Chess pieces – two armies of 16 chess pieces, one army white, the other black. Each player controls one of the armies for the entire game. The pieces in each army include:
  • 1 king – most important piece, and one of the weakest (until the endgame). The object of the game is checkmate, by placing the enemy king in check in a way that it cannot escape capture in the next move. On the top of the piece is a cross.
  • 1 queen – most powerful piece in the game, with a relative value of 9 points. The top of the piece is crown-like. Official tournament chess sets have 2 queens of each color, to deal with pawns being promoted
  • 2 rooks – look like castle towers and have a relative value of 5 points each.
  • 2 bishops – stylized after mitres (bishops' hats), and have a relative value of 3 points each.
  • 2 knights – usually look like horse heads and have a relative value of 3 points each.
  • 8 pawns – smallest pieces in the game, each topped by a ball. Pawns have a relative value of 1 point each.

Look like this:

Rather than show/hide DOM elements, which would require inserting divs into articles in order for those pages to work with the script, when the toggle is activated the script saves the content and then uses regex to remove the annotations. Pressing the toggle again gets the saved state back.

The problem is that the view port shifts position relative to what the user was looking at. When annotations before his location in the article are removed, the text he was looking at disappears off the top of the view port. When those annotations are restored, it pushes the text in the view port down.

What I'd like to do is have the top line of the topmost bulleted item in the view port retain its position when the toggle is pressed, with everything else being updated above and below it. If there are no bulleted items on the screen, then the topmost line of text should retain its position.

This is where I'm stuck.

Everything I've read so far about view port location adjustment requires doing so relative to an identifiable DOM element.

  • tags apparently are not specific enough.

    Is there a way to apply regex to just the content of the viewport?

    If so, I could insert a div (with ID), and then determine and save the location of the div, and work off of that.

    I'm hoping you can point me in the right direction.

    Sincerely, The Transhumanist 11:36, 12 January 2017 (UTC)

    : Personally, I'd have the script wrap each annotation in a {{tag|span|o}} with a particular class instead of cloning the whole page, inject a stylesheet rule for that class into the page, and toggle the display property.

    : As for finding the element at a particular point within the viewport, [https://developer.mozilla.org/en-US/docs/Web/API/Document/elementFromPoint document.elementFromPoint] looks promising. Anomie 17:34, 12 January 2017 (UTC)

    :: Thank you for the tips. I'm making progress (I think).

    :: I was very intrigued by your first suggestion, and have tackled that...

    :: I couldn't figure out how to inject a stylesheet rule, or even why doing so was needed.

    :: So, instead I wrapped the annotations with annotation goes here, like you said, and then I used .hide and .show on the class, like this: $( ".anno" ).hide();

    :: It's working, and there's no flicker like there was when I cloned the whole page. Is there something I'm missing here?

    :: It looks like classes have a display property by default.

    :: Now I'm going to try out your viewport suggestion... The Transhumanist 10:21, 19 January 2017 (UTC)

    ::: The difference is that $( ".anno" ).hide(); individually adjusts every 'anno' tag in the page, while if you injected a stylesheet rule and changed its display you're letting the browser handle the element-adjusting. Chances are it doesn't matter a great deal. Anomie 20:43, 19 January 2017 (UTC)

    :::: By "inject a stylesheet rule", do you mean using the