TiddlyWiki.org

Ticket #275 (closed enhancement: fixed)

Opened 2 years ago

Last modified 1 year ago

Refactor popup code so it can be re-used

Reported by: SaqImtiaz Assigned to:
Priority: undefined Milestone: 2.2.3
Component: core Version:
Severity: undefined Keywords:
Cc:

Description

Refactoring the popup code could allow for it to be used in other scenarios as well, with no cost in terms of performance or backwards compatibility.

More details: http://groups.google.com/group/TiddlyWikiDev/browse_thread/thread/3726bc3531dbb96a/5d8f6291e0b478d9?lnk=arm#5d8f6291e0b478d9

Attachments

Popup-Ticket275.patch (1.7 kB) - added by SaqImtiaz on 12/06/07 11:10:28.
patch for proposed changes.

Change History

08/02/07 15:44:10 changed by JeremyRuston

  • status changed from new to closed.
  • resolution set to fixed.
  • milestone set to 2.2.

Fixed in changeset:1474

12/06/07 10:20:23 changed by SaqImtiaz

  • status changed from closed to reopened.
  • resolution deleted.
  • milestone changed from 2.2 to 2.2.3.

I am re-opening this ticket since it was only partially implemented. I have submitted a patch for the proposed changes. I have tested it and it should be 100% backwards compatible. It does not result increase the code overhead either.

The ticket originally suggested refactoring the Popup code so it could be reused. There were two suggestions within this:

1) To refactor Popup.create, to allow elements other than 'ul' to be created in a popup. Additionally to allow custom ids and classes. This has already been implemented.

2) Refactor Popup.show so that the code used for positioning the popup can be reused. I believe this was accidentally overlooked, and the patch submitted implements this via a new function Popup.pos

Amongst other things, I have been using the refactored code and the new Popup.pos function for positioning lightboxes, tooltips and mouseover popups. If there was a reason for not implementing this, that I have overlooked, I apologize. If so, what is it?

12/06/07 11:10:28 changed by SaqImtiaz

  • attachment Popup-Ticket275.patch added.

patch for proposed changes.

12/06/07 11:13:14 changed by SaqImtiaz

Please note that the Popup.pos function accepts an optional 'offset' argument that is an object like {x: 20; y: 5}. This can be used to tweak the exact position of the popup. For instance, if you want it to appear 5 pixels below the root and 10 to the right, pass offset as {x:10, y:0}. There is minimal code overhead involved but it makes the function much more versatile. Since this argument is optional, the function remains perfectly backwards compatible.

17/06/07 00:27:26 changed by JeremyRuston

  • status changed from reopened to closed.
  • resolution set to fixed.

Fixed in changeset:2313