TabSwapper: fix and enhancement #79

Closed
deerwood opened this Issue Sep 17, 2011 · 5 comments

Comments

Projects
None yet
2 participants
@deerwood

In the following diff the change around line 66/67 is a fix for a bug introduced while updating to 1.3 syntax.

The other changes are a suggested enhancement. With it one can specify an integer initPanel, which then takes precedence over a Cookie. We use that for dynamically generated pages when a certain parameter is present in the URL to force a specific tab to be open.

Best regards

--- F:/install_xp/MooTools/TabSwapper.js    Do 15. Sep 18:27:08 2011
+++ F:/install_xp/MooTools/TabSwapper_new.js    Sa 17. Sep 20:10:17 2011
@@ -20,7 +20,7 @@
        mouseoverClass: 'tabOver',
        deselectedClass: '',
        rearrangeDOM: true,
-       initPanel: 0, 
+       initPanel: null,
        smooth: false, 
        smoothSize: false,
        maxSize: null,
@@ -41,8 +41,9 @@
        this.setOptions(options);
        var prev = this.setup();
        if (prev) return prev;
-       if (this.options.cookieName && this.recall()) this.show(this.recall().toInt());
-       else this.show(this.options.initPanel);
+       if (this.options.initPanel != null) this.show(this.options.initPanel);
+       else if (this.options.cookieName && this.recall()) this.show(this.recall().toInt());
+       else this.show(0);
    },
    setup: function(){
        var opt = this.options,
@@ -63,7 +64,7 @@
            return this;
        }
        //if the index isn't specified, put the tab at the end
-       if (index != null) index = this.tabs.length;
+       if (index == null) index = this.tabs.length;
        //if this isn't the first item, and there's a tab
        //already in the interface at the index 1 less than this
        //insert this after that one 
@anutron

This comment has been minimized.

Show comment Hide comment
@anutron

anutron Sep 18, 2011

Owner

Any chance I can get this as a pull request? If not it's fine. I'll manually apply the patch.

Owner

anutron commented Sep 18, 2011

Any chance I can get this as a pull request? If not it's fine. I'll manually apply the patch.

@deerwood

This comment has been minimized.

Show comment Hide comment
@deerwood

deerwood Sep 18, 2011

Am 18.09.2011 07:13, schrieb Aaron Newton:

Any chance I can get this as a pull request? If not it's fine. I'll manually apply the patch.

Sorry, I couldn't get around to use git yet, still sticking with SVN.

Best regards, Georg

Am 18.09.2011 07:13, schrieb Aaron Newton:

Any chance I can get this as a pull request? If not it's fine. I'll manually apply the patch.

Sorry, I couldn't get around to use git yet, still sticking with SVN.

Best regards, Georg

@anutron anutron closed this Sep 19, 2011

@anutron

This comment has been minimized.

Show comment Hide comment
@anutron

anutron Sep 19, 2011

Owner

pulled

Owner

anutron commented Sep 19, 2011

pulled

@deerwood

This comment has been minimized.

Show comment Hide comment
@deerwood

deerwood Sep 19, 2011

The 2 Lines 44/45 (after if (prev) return prev; should be removed as indicated in my diff above.

The 2 Lines 44/45 (after if (prev) return prev; should be removed as indicated in my diff above.

@anutron

This comment has been minimized.

Show comment Hide comment
@anutron

anutron Sep 19, 2011

Owner

Ack. Fixed.

On Mon, Sep 19, 2011 at 3:23 PM, Georg Rehfeld <
reply@reply.github.com>wrote:

The 2 Lines 44/45 (after if (prev) return prev; should be removed as
indicated in my diff above.

Reply to this email directly or view it on GitHub:
#79 (comment)

Owner

anutron commented Sep 19, 2011

Ack. Fixed.

On Mon, Sep 19, 2011 at 3:23 PM, Georg Rehfeld <
reply@reply.github.com>wrote:

The 2 Lines 44/45 (after if (prev) return prev; should be removed as
indicated in my diff above.

Reply to this email directly or view it on GitHub:
#79 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment