From ca32f08966f1b51fcb19460f0996bb0c4048e6fe Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sat, 3 Dec 2011 13:29:22 +0100 Subject: Update to MediaWiki 1.18.0 * also update ArchLinux skin to chagnes in MonoBook * Use only css to hide our menu bar when printing --- resources/Resources.php | 324 +- resources/jquery.tipsy/jquery.tipsy.css | 1 + resources/jquery.tipsy/jquery.tipsy.js | 18 +- resources/jquery.ui/jquery.ui.accordion.js | 609 +- resources/jquery.ui/jquery.ui.autocomplete.js | 255 +- resources/jquery.ui/jquery.ui.button.js | 56 +- resources/jquery.ui/jquery.ui.core.js | 324 +- resources/jquery.ui/jquery.ui.dialog.js | 302 +- resources/jquery.ui/jquery.ui.draggable.js | 38 +- resources/jquery.ui/jquery.ui.droppable.js | 20 +- resources/jquery.ui/jquery.ui.mouse.js | 33 +- resources/jquery.ui/jquery.ui.position.js | 89 +- resources/jquery.ui/jquery.ui.progressbar.js | 63 +- resources/jquery.ui/jquery.ui.resizable.js | 73 +- resources/jquery.ui/jquery.ui.selectable.js | 15 +- resources/jquery.ui/jquery.ui.slider.js | 24 +- resources/jquery.ui/jquery.ui.sortable.js | 52 +- resources/jquery.ui/jquery.ui.tabs.js | 731 +- resources/jquery.ui/jquery.ui.widget.js | 88 +- .../themes/default/jquery.ui.autocomplete.css | 1 + .../themes/default/jquery.ui.datepicker.css | 22 +- .../themes/vector/jquery.ui.autocomplete.css | 1 + .../jquery.ui/themes/vector/jquery.ui.button.css | 62 +- .../themes/vector/jquery.ui.datepicker.css | 26 +- .../jquery.ui/themes/vector/jquery.ui.theme.css | 4 +- resources/jquery/images/sort_both.gif | Bin 0 -> 1184 bytes resources/jquery/images/sort_down.gif | Bin 0 -> 1174 bytes resources/jquery/images/sort_none.gif | Bin 0 -> 462 bytes resources/jquery/images/sort_up.gif | Bin 0 -> 1174 bytes resources/jquery/jquery.appear.js | 138 + resources/jquery/jquery.async.js | 33 +- resources/jquery/jquery.autoEllipsis.js | 78 +- resources/jquery/jquery.byteLength.js | 19 + resources/jquery/jquery.byteLimit.js | 56 + resources/jquery/jquery.checkboxShiftClick.js | 14 +- resources/jquery/jquery.client.js | 390 +- resources/jquery/jquery.color.js | 125 +- resources/jquery/jquery.colorUtil.js | 193 + resources/jquery/jquery.cookie.js | 87 +- resources/jquery/jquery.form.js | 791 +++ resources/jquery/jquery.getAttrs.js | 24 + resources/jquery/jquery.hoverIntent.js | 111 + resources/jquery/jquery.js | 7082 ++++++++++++++------ resources/jquery/jquery.json.js | 180 + resources/jquery/jquery.localize.js | 105 +- resources/jquery/jquery.makeCollapsible.css | 14 + resources/jquery/jquery.makeCollapsible.js | 339 + resources/jquery/jquery.messageBox.css | 15 + resources/jquery/jquery.messageBox.js | 98 + resources/jquery/jquery.mwPrototypes.js | 120 + resources/jquery/jquery.placeholder.js | 32 +- resources/jquery/jquery.qunit.completenessTest.js | 267 + resources/jquery/jquery.qunit.css | 225 + resources/jquery/jquery.qunit.js | 1442 ++++ resources/jquery/jquery.suggestions.css | 2 +- resources/jquery/jquery.suggestions.js | 18 +- resources/jquery/jquery.tabIndex.js | 45 +- resources/jquery/jquery.tablesorter.css | 17 + resources/jquery/jquery.tablesorter.js | 910 +++ resources/jquery/jquery.textSelection.js | 183 +- .../mediawiki.action/mediawiki.action.edit.js | 115 +- .../mediawiki.action.history.diff.css | 61 + .../mediawiki.action/mediawiki.action.history.js | 52 +- .../mediawiki.action.view.metadata.js | 39 + .../mediawiki.action.view.rightClickEdit.js | 2 +- .../mediawiki.action.watch.ajax.js | 174 + resources/mediawiki.language/languages/nl.js | 8 + resources/mediawiki.language/languages/pt-br.js | 6 +- resources/mediawiki.language/languages/pt.js | 8 + resources/mediawiki.language/mediawiki.language.js | 20 +- .../mediawiki.libs/mediawiki.libs.jpegmeta.js | 731 ++ .../mediawiki.page/images/AJAXCategorySprite.png | Bin 0 -> 384 bytes .../mediawiki.page.ajaxCategories.css | 64 + resources/mediawiki.page/mediawiki.page.ready.js | 24 + resources/mediawiki.page/mediawiki.page.startup.js | 10 + .../mediawiki.special/mediawiki.special.block.js | 46 + .../mediawiki.special.changeslist.css | 47 + resources/mediawiki.special/mediawiki.special.css | 274 + resources/mediawiki.special/mediawiki.special.js | 1 + .../mediawiki.special.movePage.js | 5 + .../mediawiki.special.preferences.js | 172 +- .../mediawiki.special.recentchanges.js | 39 + .../mediawiki.special/mediawiki.special.search.css | 14 + .../mediawiki.special/mediawiki.special.search.js | 32 +- .../mediawiki.special.undelete.js | 10 + .../mediawiki.special/mediawiki.special.upload.js | 272 + resources/mediawiki.util/mediawiki.util.js | 401 -- resources/mediawiki.util/mediawiki.util.test.js | 172 - resources/mediawiki/mediawiki.Title.js | 334 + resources/mediawiki/mediawiki.Uri.js | 260 + resources/mediawiki/mediawiki.htmlform.js | 64 + resources/mediawiki/mediawiki.js | 834 +-- resources/mediawiki/mediawiki.log.js | 29 +- resources/mediawiki/mediawiki.user.js | 181 + resources/mediawiki/mediawiki.util.js | 598 ++ 95 files changed, 16445 insertions(+), 5038 deletions(-) create mode 100644 resources/jquery/images/sort_both.gif create mode 100644 resources/jquery/images/sort_down.gif create mode 100644 resources/jquery/images/sort_none.gif create mode 100644 resources/jquery/images/sort_up.gif create mode 100644 resources/jquery/jquery.appear.js create mode 100644 resources/jquery/jquery.byteLength.js create mode 100644 resources/jquery/jquery.byteLimit.js create mode 100644 resources/jquery/jquery.colorUtil.js create mode 100644 resources/jquery/jquery.form.js create mode 100644 resources/jquery/jquery.getAttrs.js create mode 100644 resources/jquery/jquery.hoverIntent.js create mode 100644 resources/jquery/jquery.json.js create mode 100644 resources/jquery/jquery.makeCollapsible.css create mode 100644 resources/jquery/jquery.makeCollapsible.js create mode 100644 resources/jquery/jquery.messageBox.css create mode 100644 resources/jquery/jquery.messageBox.js create mode 100644 resources/jquery/jquery.mwPrototypes.js create mode 100644 resources/jquery/jquery.qunit.completenessTest.js create mode 100644 resources/jquery/jquery.qunit.css create mode 100644 resources/jquery/jquery.qunit.js create mode 100644 resources/jquery/jquery.tablesorter.css create mode 100644 resources/jquery/jquery.tablesorter.js create mode 100644 resources/mediawiki.action/mediawiki.action.history.diff.css create mode 100644 resources/mediawiki.action/mediawiki.action.view.metadata.js create mode 100644 resources/mediawiki.action/mediawiki.action.watch.ajax.js create mode 100644 resources/mediawiki.language/languages/nl.js create mode 100644 resources/mediawiki.language/languages/pt.js create mode 100644 resources/mediawiki.libs/mediawiki.libs.jpegmeta.js create mode 100644 resources/mediawiki.page/images/AJAXCategorySprite.png create mode 100644 resources/mediawiki.page/mediawiki.page.ajaxCategories.css create mode 100644 resources/mediawiki.page/mediawiki.page.ready.js create mode 100644 resources/mediawiki.page/mediawiki.page.startup.js create mode 100644 resources/mediawiki.special/mediawiki.special.block.js create mode 100644 resources/mediawiki.special/mediawiki.special.changeslist.css create mode 100644 resources/mediawiki.special/mediawiki.special.css create mode 100644 resources/mediawiki.special/mediawiki.special.js create mode 100644 resources/mediawiki.special/mediawiki.special.movePage.js create mode 100644 resources/mediawiki.special/mediawiki.special.recentchanges.js create mode 100644 resources/mediawiki.special/mediawiki.special.search.css create mode 100644 resources/mediawiki.special/mediawiki.special.undelete.js create mode 100644 resources/mediawiki.special/mediawiki.special.upload.js delete mode 100644 resources/mediawiki.util/mediawiki.util.js delete mode 100644 resources/mediawiki.util/mediawiki.util.test.js create mode 100644 resources/mediawiki/mediawiki.Title.js create mode 100644 resources/mediawiki/mediawiki.Uri.js create mode 100644 resources/mediawiki/mediawiki.htmlform.js create mode 100644 resources/mediawiki/mediawiki.user.js create mode 100644 resources/mediawiki/mediawiki.util.js (limited to 'resources') diff --git a/resources/Resources.php b/resources/Resources.php index 5c1ade8d..7549b9c9 100644 --- a/resources/Resources.php +++ b/resources/Resources.php @@ -5,14 +5,19 @@ return array( /* Special resources who have their own classes */ 'site' => array( 'class' => 'ResourceLoaderSiteModule' ), + 'noscript' => array( 'class' => 'ResourceLoaderNoscriptModule' ), 'startup' => array( 'class' => 'ResourceLoaderStartUpModule' ), 'user' => array( 'class' => 'ResourceLoaderUserModule' ), + 'user.groups' => array( 'class' => 'ResourceLoaderUserGroupsModule' ), 'user.options' => array( 'class' => 'ResourceLoaderUserOptionsModule' ), + 'user.tokens' => array( 'class' => 'ResourceLoaderUserTokensModule' ), + 'filepage' => array( 'class' => 'ResourceLoaderFilePageModule' ), /* Skins */ 'skins.vector' => array( 'styles' => array( 'vector/screen.css' => array( 'media' => 'screen' ) ), + 'scripts' => 'vector/vector.js', 'remoteBasePath' => $GLOBALS['wgStylePath'], 'localBasePath' => $GLOBALS['wgStyleDirectory'], ), @@ -23,6 +28,16 @@ return array( 'remoteBasePath' => $GLOBALS['wgStylePath'], 'localBasePath' => $GLOBALS['wgStyleDirectory'], ), + 'skins.archlinux' => array( + 'styles' => array( + 'archlinux/main.css' => array( 'media' => 'screen' ), + 'archlinux/archnavbar.css' => array( 'media' => 'screen' ), + 'archlinux/arch.css' => array( 'media' => 'screen' ), + 'archlinux/print.css' => array( 'media' => 'print' ), + ), + 'remoteBasePath' => $GLOBALS['wgStylePath'], + 'localBasePath' => $GLOBALS['wgStyleDirectory'], + ), 'skins.simple' => array( 'styles' => array( 'simple/main.css' => array( 'media' => 'screen' ) ), 'remoteBasePath' => $GLOBALS['wgStylePath'], @@ -34,18 +49,20 @@ return array( 'localBasePath' => $GLOBALS['wgStyleDirectory'], ), 'skins.modern' => array( - 'styles' => array( 'modern/main.css' => array( 'media' => 'screen' ), - 'modern/print.css' => array( 'media' => 'print' ) ), + 'styles' => array( + 'modern/main.css' => array( 'media' => 'screen' ), + 'modern/print.css' => array( 'media' => 'print' ), + ), 'remoteBasePath' => $GLOBALS['wgStylePath'], 'localBasePath' => $GLOBALS['wgStyleDirectory'], ), 'skins.cologneblue' => array( - 'styles' => array( 'common/cologneblue.css' => array( 'media' => 'screen' ) ), + 'styles' => array( 'cologneblue/screen.css' => array( 'media' => 'screen' ) ), 'remoteBasePath' => $GLOBALS['wgStylePath'], 'localBasePath' => $GLOBALS['wgStyleDirectory'], ), 'skins.nostalgia' => array( - 'styles' => array( 'common/nostalgia.css' => array( 'media' => 'screen' ) ), + 'styles' => array( 'nostalgia/screen.css' => array( 'media' => 'screen' ) ), 'remoteBasePath' => $GLOBALS['wgStylePath'], 'localBasePath' => $GLOBALS['wgStyleDirectory'], ), @@ -65,41 +82,84 @@ return array( /* jQuery Plugins */ 'jquery.async' => array( - 'scripts' => 'resources/jquery/jquery.async.js' + 'scripts' => 'resources/jquery/jquery.async.js', + ), + 'jquery.appear' => array( + 'scripts' => 'resources/jquery/jquery.appear.js', ), 'jquery.autoEllipsis' => array( 'scripts' => 'resources/jquery/jquery.autoEllipsis.js', 'dependencies' => 'jquery.highlightText', ), + 'jquery.byteLength' => array( + 'scripts' => 'resources/jquery/jquery.byteLength.js', + ), + 'jquery.byteLimit' => array( + 'scripts' => 'resources/jquery/jquery.byteLimit.js', + 'dependencies' => 'jquery.byteLength', + ), 'jquery.checkboxShiftClick' => array( - 'scripts' => 'resources/jquery/jquery.checkboxShiftClick.js' + 'scripts' => 'resources/jquery/jquery.checkboxShiftClick.js', ), 'jquery.client' => array( 'scripts' => 'resources/jquery/jquery.client.js', ), 'jquery.collapsibleTabs' => array( - 'scripts' => 'resources/jquery/jquery.collapsibleTabs.js' + 'scripts' => 'resources/jquery/jquery.collapsibleTabs.js', + ), + 'jquery.colorUtil' => array( + 'scripts' => 'resources/jquery/jquery.colorUtil.js', ), 'jquery.color' => array( - 'scripts' => 'resources/jquery/jquery.color.js' + 'scripts' => 'resources/jquery/jquery.color.js', + 'dependencies' => 'jquery.colorUtil', ), 'jquery.cookie' => array( - 'scripts' => 'resources/jquery/jquery.cookie.js' + 'scripts' => 'resources/jquery/jquery.cookie.js', ), 'jquery.delayedBind' => array( - 'scripts' => 'resources/jquery/jquery.delayedBind.js' + 'scripts' => 'resources/jquery/jquery.delayedBind.js', ), 'jquery.expandableField' => array( - 'scripts' => 'resources/jquery/jquery.expandableField.js' + 'scripts' => 'resources/jquery/jquery.expandableField.js', + 'dependencies' => 'jquery.delayedBind', + ), + 'jquery.form' => array( + 'scripts' => 'resources/jquery/jquery.form.js', + ), + 'jquery.getAttrs' => array( + 'scripts' => 'resources/jquery/jquery.getAttrs.js', ), 'jquery.highlightText' => array( - 'scripts' => 'resources/jquery/jquery.highlightText.js' + 'scripts' => 'resources/jquery/jquery.highlightText.js', + ), + 'jquery.hoverIntent' => array( + 'scripts' => 'resources/jquery/jquery.hoverIntent.js', + ), + 'jquery.messageBox' => array( + 'scripts' => 'resources/jquery/jquery.messageBox.js', + 'styles' => 'resources/jquery/jquery.messageBox.css', ), 'jquery.placeholder' => array( - 'scripts' => 'resources/jquery/jquery.placeholder.js' + 'scripts' => 'resources/jquery/jquery.placeholder.js', + ), + 'jquery.json' => array( + 'scripts' => 'resources/jquery/jquery.json.js', ), 'jquery.localize' => array( - 'scripts' => 'resources/jquery/jquery.localize.js' + 'scripts' => 'resources/jquery/jquery.localize.js', + ), + 'jquery.makeCollapsible' => array( + 'scripts' => 'resources/jquery/jquery.makeCollapsible.js', + 'styles' => 'resources/jquery/jquery.makeCollapsible.css', + 'messages' => array( 'collapsible-expand', 'collapsible-collapse' ), + ), + 'jquery.mwPrototypes' => array( + 'scripts' => 'resources/jquery/jquery.mwPrototypes.js', + ), + 'jquery.qunit' => array( + 'scripts' => 'resources/jquery/jquery.qunit.js', + 'styles' => 'resources/jquery/jquery.qunit.css', ), 'jquery.suggestions' => array( 'scripts' => 'resources/jquery/jquery.suggestions.js', @@ -107,10 +167,15 @@ return array( 'dependencies' => 'jquery.autoEllipsis', ), 'jquery.tabIndex' => array( - 'scripts' => 'resources/jquery/jquery.tabIndex.js' + 'scripts' => 'resources/jquery/jquery.tabIndex.js', + ), + 'jquery.tablesorter' => array( + 'scripts' => 'resources/jquery/jquery.tablesorter.js', + 'styles' => 'resources/jquery/jquery.tablesorter.css', + 'messages' => array( 'sort-descending', 'sort-ascending' ), ), 'jquery.textSelection' => array( - 'scripts' => 'resources/jquery/jquery.textSelection.js' + 'scripts' => 'resources/jquery/jquery.textSelection.js', ), 'jquery.tipsy' => array( 'scripts' => 'resources/jquery.tipsy/jquery.tipsy.js', @@ -133,27 +198,33 @@ return array( ), ), 'dependencies' => 'jquery', + 'group' => 'jquery.ui', ), 'jquery.ui.widget' => array( 'scripts' => 'resources/jquery.ui/jquery.ui.widget.js', + 'group' => 'jquery.ui', ), 'jquery.ui.mouse' => array( 'scripts' => 'resources/jquery.ui/jquery.ui.mouse.js', 'dependencies' => 'jquery.ui.widget', + 'group' => 'jquery.ui', ), 'jquery.ui.position' => array( 'scripts' => 'resources/jquery.ui/jquery.ui.position.js', + 'group' => 'jquery.ui', ), // Interactions 'jquery.ui.draggable' => array( 'scripts' => 'resources/jquery.ui/jquery.ui.draggable.js', 'dependencies' => array( 'jquery.ui.core', 'jquery.ui.mouse', 'jquery.ui.widget' ), + 'group' => 'jquery.ui', ), 'jquery.ui.droppable' => array( 'scripts' => 'resources/jquery.ui/jquery.ui.droppable.js', 'dependencies' => array( - 'jquery.ui.core', 'jquery.ui.mouse', 'jquery.ui.widget', 'jquery.ui.draggable' + 'jquery.ui.core', 'jquery.ui.mouse', 'jquery.ui.widget', 'jquery.ui.draggable', ), + 'group' => 'jquery.ui', ), 'jquery.ui.resizable' => array( 'scripts' => 'resources/jquery.ui/jquery.ui.resizable.js', @@ -162,6 +233,7 @@ return array( 'vector' => 'resources/jquery.ui/themes/vector/jquery.ui.resizable.css', ), 'dependencies' => array( 'jquery.ui.core', 'jquery.ui.widget', 'jquery.ui.mouse' ), + 'group' => 'jquery.ui', ), 'jquery.ui.selectable' => array( 'scripts' => 'resources/jquery.ui/jquery.ui.selectable.js', @@ -170,10 +242,12 @@ return array( 'vector' => 'resources/jquery.ui/themes/vector/jquery.ui.selectable.css', ), 'dependencies' => array( 'jquery.ui.core', 'jquery.ui.widget', 'jquery.ui.mouse' ), + 'group' => 'jquery.ui', ), 'jquery.ui.sortable' => array( 'scripts' => 'resources/jquery.ui/jquery.ui.sortable.js', 'dependencies' => array( 'jquery.ui.core', 'jquery.ui.widget', 'jquery.ui.mouse' ), + 'group' => 'jquery.ui', ), // Widgets 'jquery.ui.accordion' => array( @@ -183,6 +257,7 @@ return array( 'default' => 'resources/jquery.ui/themes/default/jquery.ui.accordion.css', 'vector' => 'resources/jquery.ui/themes/vector/jquery.ui.accordion.css', ), + 'group' => 'jquery.ui', ), 'jquery.ui.autocomplete' => array( 'scripts' => 'resources/jquery.ui/jquery.ui.autocomplete.js', @@ -191,6 +266,7 @@ return array( 'default' => 'resources/jquery.ui/themes/default/jquery.ui.autocomplete.css', 'vector' => 'resources/jquery.ui/themes/vector/jquery.ui.autocomplete.css', ), + 'group' => 'jquery.ui', ), 'jquery.ui.button' => array( 'scripts' => 'resources/jquery.ui/jquery.ui.button.js', @@ -199,6 +275,7 @@ return array( 'default' => 'resources/jquery.ui/themes/default/jquery.ui.button.css', 'vector' => 'resources/jquery.ui/themes/vector/jquery.ui.button.css', ), + 'group' => 'jquery.ui', ), 'jquery.ui.datepicker' => array( 'scripts' => 'resources/jquery.ui/jquery.ui.datepicker.js', @@ -259,8 +336,9 @@ return array( 'vi' => 'resources/jquery.ui/i18n/jquery.ui.datepicker-vi.js', 'zh-cn' => 'resources/jquery.ui/i18n/jquery.ui.datepicker-zh-CN.js', 'zh-hk' => 'resources/jquery.ui/i18n/jquery.ui.datepicker-zh-HK.js', - 'zh-tw' => 'resources/jquery.ui/i18n/jquery.ui.datepicker-zh-TW.js' + 'zh-tw' => 'resources/jquery.ui/i18n/jquery.ui.datepicker-zh-TW.js', ), + 'group' => 'jquery.ui', ), 'jquery.ui.dialog' => array( 'scripts' => 'resources/jquery.ui/jquery.ui.dialog.js', @@ -277,6 +355,7 @@ return array( 'default' => 'resources/jquery.ui/themes/default/jquery.ui.dialog.css', 'vector' => 'resources/jquery.ui/themes/vector/jquery.ui.dialog.css', ), + 'group' => 'jquery.ui', ), 'jquery.ui.progressbar' => array( 'scripts' => 'resources/jquery.ui/jquery.ui.progressbar.js', @@ -285,6 +364,7 @@ return array( 'default' => 'resources/jquery.ui/themes/default/jquery.ui.progressbar.css', 'vector' => 'resources/jquery.ui/themes/vector/jquery.ui.progressbar.css', ), + 'group' => 'jquery.ui', ), 'jquery.ui.slider' => array( 'scripts' => 'resources/jquery.ui/jquery.ui.slider.js', @@ -293,6 +373,7 @@ return array( 'default' => 'resources/jquery.ui/themes/default/jquery.ui.slider.css', 'vector' => 'resources/jquery.ui/themes/vector/jquery.ui.slider.css', ), + 'group' => 'jquery.ui', ), 'jquery.ui.tabs' => array( 'scripts' => 'resources/jquery.ui/jquery.ui.tabs.js', @@ -301,59 +382,73 @@ return array( 'default' => 'resources/jquery.ui/themes/default/jquery.ui.tabs.css', 'vector' => 'resources/jquery.ui/themes/vector/jquery.ui.tabs.css', ), + 'group' => 'jquery.ui', ), // Effects 'jquery.effects.core' => array( 'scripts' => 'resources/jquery.effects/jquery.effects.core.js', 'dependencies' => 'jquery', + 'group' => 'jquery.ui', ), 'jquery.effects.blind' => array( 'scripts' => 'resources/jquery.effects/jquery.effects.blind.js', 'dependencies' => 'jquery.effects.core', + 'group' => 'jquery.ui', ), 'jquery.effects.bounce' => array( 'scripts' => 'resources/jquery.effects/jquery.effects.bounce.js', 'dependencies' => 'jquery.effects.core', + 'group' => 'jquery.ui', ), 'jquery.effects.clip' => array( 'scripts' => 'resources/jquery.effects/jquery.effects.clip.js', 'dependencies' => 'jquery.effects.core', + 'group' => 'jquery.ui', ), 'jquery.effects.drop' => array( 'scripts' => 'resources/jquery.effects/jquery.effects.drop.js', 'dependencies' => 'jquery.effects.core', + 'group' => 'jquery.ui', ), 'jquery.effects.explode' => array( 'scripts' => 'resources/jquery.effects/jquery.effects.explode.js', 'dependencies' => 'jquery.effects.core', + 'group' => 'jquery.ui', ), 'jquery.effects.fold' => array( 'scripts' => 'resources/jquery.effects/jquery.effects.fold.js', 'dependencies' => 'jquery.effects.core', + 'group' => 'jquery.ui', ), 'jquery.effects.highlight' => array( 'scripts' => 'resources/jquery.effects/jquery.effects.highlight.js', 'dependencies' => 'jquery.effects.core', + 'group' => 'jquery.ui', ), 'jquery.effects.pulsate' => array( 'scripts' => 'resources/jquery.effects/jquery.effects.pulsate.js', 'dependencies' => 'jquery.effects.core', + 'group' => 'jquery.ui', ), 'jquery.effects.scale' => array( 'scripts' => 'resources/jquery.effects/jquery.effects.scale.js', 'dependencies' => 'jquery.effects.core', + 'group' => 'jquery.ui', ), 'jquery.effects.shake' => array( 'scripts' => 'resources/jquery.effects/jquery.effects.shake.js', 'dependencies' => 'jquery.effects.core', + 'group' => 'jquery.ui', ), 'jquery.effects.slide' => array( 'scripts' => 'resources/jquery.effects/jquery.effects.slide.js', 'dependencies' => 'jquery.effects.core', + 'group' => 'jquery.ui', ), 'jquery.effects.transfer' => array( 'scripts' => 'resources/jquery.effects/jquery.effects.transfer.js', 'dependencies' => 'jquery.effects.core', + 'group' => 'jquery.ui', ), /* MediaWiki */ @@ -361,36 +456,135 @@ return array( 'mediawiki' => array( 'scripts' => 'resources/mediawiki/mediawiki.js', 'debugScripts' => 'resources/mediawiki/mediawiki.log.js', - 'debugRaw' => false + 'debugRaw' => false, + ), + 'mediawiki.Title' => array( + 'scripts' => 'resources/mediawiki/mediawiki.Title.js', + 'dependencies' => 'mediawiki.util', + ), + 'mediawiki.Uri' => array( + 'scripts' => 'resources/mediawiki/mediawiki.Uri.js', + ), + 'mediawiki.htmlform' => array( + 'scripts' => 'resources/mediawiki/mediawiki.htmlform.js', + ), + 'mediawiki.user' => array( + 'scripts' => 'resources/mediawiki/mediawiki.user.js', + 'dependencies' => array( + 'jquery.cookie', + ), + ), + 'mediawiki.page.startup' => array( + 'scripts' => 'resources/mediawiki.page/mediawiki.page.startup.js', + 'dependencies' => array( + 'jquery.client', + ), + 'position' => 'top', + ), + 'mediawiki.page.ready' => array( + 'scripts' => 'resources/mediawiki.page/mediawiki.page.ready.js', + 'dependencies' => array( + 'jquery.checkboxShiftClick', + 'jquery.makeCollapsible', + 'jquery.placeholder', + ), ), 'mediawiki.util' => array( - 'scripts' => 'resources/mediawiki.util/mediawiki.util.js', - 'dependencies' => array( 'jquery.checkboxShiftClick', 'jquery.client', 'jquery.placeholder' ), - 'debugScripts' => 'resources/mediawiki.util/mediawiki.util.test.js', + 'scripts' => 'resources/mediawiki/mediawiki.util.js', + 'dependencies' => array( + 'jquery.client', + 'jquery.cookie', + 'jquery.messageBox', + 'jquery.mwPrototypes', + ), + ), + 'mediawiki.libs.jpegmeta' => array( + 'scripts' => 'resources/mediawiki.libs/mediawiki.libs.jpegmeta.js', ), 'mediawiki.action.history' => array( 'scripts' => 'resources/mediawiki.action/mediawiki.action.history.js', - 'dependencies' => 'mediawiki.legacy.history', + 'dependencies' => 'jquery.ui.button', + 'group' => 'mediawiki.action.history', + ), + 'mediawiki.action.history.diff' => array( + 'styles' => 'resources/mediawiki.action/mediawiki.action.history.diff.css', 'group' => 'mediawiki.action.history', ), 'mediawiki.action.edit' => array( 'scripts' => 'resources/mediawiki.action/mediawiki.action.edit.js', + 'dependencies' => array( + 'jquery.textSelection', + 'jquery.byteLimit', + ), ), 'mediawiki.action.view.rightClickEdit' => array( 'scripts' => 'resources/mediawiki.action/mediawiki.action.view.rightClickEdit.js', ), + 'mediawiki.action.view.metadata' => array( + 'scripts' => 'resources/mediawiki.action/mediawiki.action.view.metadata.js', + 'messages' => array( 'metadata-expand', 'metadata-collapse' ), + ), + 'mediawiki.action.watch.ajax' => array( + 'scripts' => 'resources/mediawiki.action/mediawiki.action.watch.ajax.js', + 'messages' => array( + 'watch', + 'unwatch', + 'watching', + 'unwatching', + 'tooltip-ca-watch', + 'tooltip-ca-unwatch', + 'watcherrortext', + ), + ), + + /* Special pages */ + + 'mediawiki.special' => array( + 'scripts' => 'resources/mediawiki.special/mediawiki.special.js', + 'styles' => 'resources/mediawiki.special/mediawiki.special.css', + ), 'mediawiki.special.preferences' => array( 'scripts' => 'resources/mediawiki.special/mediawiki.special.preferences.js', 'styles' => 'resources/mediawiki.special/mediawiki.special.preferences.css', 'messages' => array( 'email-address-validity-valid', 'email-address-validity-invalid' ), ), + 'mediawiki.special.changeslist' => array( + 'styles' => 'resources/mediawiki.special/mediawiki.special.changeslist.css', + 'dependencies' => array( 'jquery.makeCollapsible' ), + ), 'mediawiki.special.search' => array( 'scripts' => 'resources/mediawiki.special/mediawiki.special.search.js', + 'styles' => 'resources/mediawiki.special/mediawiki.special.search.css', ), - 'mediawiki.action.history' => array( - 'scripts' => 'resources/mediawiki.action/mediawiki.action.history.js', - 'dependencies' => 'mediawiki.legacy.history', + 'mediawiki.special.block' => array( + 'scripts' => 'resources/mediawiki.special/mediawiki.special.block.js', + ), + 'mediawiki.special.undelete' => array( + 'scripts' => 'resources/mediawiki.special/mediawiki.special.undelete.js', + ), + 'mediawiki.special.movePage' => array( + 'scripts' => 'resources/mediawiki.special/mediawiki.special.movePage.js', + 'dependencies' => 'jquery.byteLimit', ), + 'mediawiki.special.recentchanges' => array( + 'scripts' => 'resources/mediawiki.special/mediawiki.special.recentchanges.js', + 'dependencies' => array( 'mediawiki.special' ), + 'position' => 'top', + ), + 'mediawiki.special.upload' => array( + // @TODO: merge in remainder of mediawiki.legacy.upload + 'scripts' => 'resources/mediawiki.special/mediawiki.special.upload.js', + 'messages' => array( + 'widthheight', + 'size-bytes', + 'size-kilobytes', + 'size-megabytes', + 'size-gigabytes', + 'largefileserver', + ), + 'dependencies' => array( 'mediawiki.libs.jpegmeta' ), + ), + 'mediawiki.language' => array( 'scripts' => 'resources/mediawiki.language/mediawiki.language.js', 'languageScripts' => array( @@ -422,8 +616,10 @@ return array( 'mk' => 'resources/mediawiki.language/languages/mk.js', 'mo' => 'resources/mediawiki.language/languages/mo.js', 'mt' => 'resources/mediawiki.language/languages/mt.js', + 'nl' => 'resources/mediawiki.language/languages/nl.js', 'nso' => 'resources/mediawiki.language/languages/nso.js', 'pl' => 'resources/mediawiki.language/languages/pl.js', + 'pt' => 'resources/mediawiki.language/languages/pt.js', 'pt-br' => 'resources/mediawiki.language/languages/pt-br.js', 'ro' => 'resources/mediawiki.language/languages/ro.js', 'ru' => 'resources/mediawiki.language/languages/ru.js', @@ -448,22 +644,6 @@ return array( 'scripts' => 'common/ajax.js', 'remoteBasePath' => $GLOBALS['wgStylePath'], 'localBasePath' => $GLOBALS['wgStyleDirectory'], - 'messages' => array( - 'watch', 'unwatch', 'watching', 'unwatching', 'tooltip-ca-watch', - 'tooltip-ca-unwatch' - ), - 'dependencies' => 'mediawiki.legacy.wikibits', - ), - 'mediawiki.legacy.ajaxwatch' => array( - 'scripts' => 'common/ajaxwatch.js', - 'remoteBasePath' => $GLOBALS['wgStylePath'], - 'localBasePath' => $GLOBALS['wgStyleDirectory'], - 'dependencies' => 'mediawiki.legacy.wikibits', - ), - 'mediawiki.legacy.block' => array( - 'scripts' => 'common/block.js', - 'remoteBasePath' => $GLOBALS['wgStylePath'], - 'localBasePath' => $GLOBALS['wgStyleDirectory'], 'dependencies' => 'mediawiki.legacy.wikibits', ), 'mediawiki.legacy.commonPrint' => array( @@ -478,65 +658,19 @@ return array( 'localBasePath' => $GLOBALS['wgStyleDirectory'], 'dependencies' => 'mediawiki.legacy.wikibits', ), - 'mediawiki.legacy.diff' => array( - 'scripts' => 'common/diff.js', - 'styles' => 'common/diff.css', - 'group' => 'mediawiki.action.history', - 'remoteBasePath' => $GLOBALS['wgStylePath'], - 'localBasePath' => $GLOBALS['wgStyleDirectory'], - 'dependencies' => 'mediawiki.legacy.wikibits', - ), - 'mediawiki.legacy.edit' => array( - 'scripts' => 'common/edit.js', - 'remoteBasePath' => $GLOBALS['wgStylePath'], - 'localBasePath' => $GLOBALS['wgStyleDirectory'], - 'dependencies' => 'mediawiki.legacy.wikibits', - ), - 'mediawiki.legacy.enhancedchanges' => array( - 'scripts' => 'common/enhancedchanges.js', - 'remoteBasePath' => $GLOBALS['wgStylePath'], - 'localBasePath' => $GLOBALS['wgStyleDirectory'], - 'dependencies' => 'mediawiki.legacy.wikibits', - ), - 'mediawiki.legacy.history' => array( - 'scripts' => 'common/history.js', - 'group' => 'mediawiki.action.history', - 'remoteBasePath' => $GLOBALS['wgStylePath'], - 'localBasePath' => $GLOBALS['wgStyleDirectory'], - 'dependencies' => 'mediawiki.legacy.wikibits', - ), - 'mediawiki.legacy.htmlform' => array( - 'scripts' => 'common/htmlform.js', - 'remoteBasePath' => $GLOBALS['wgStylePath'], - 'localBasePath' => $GLOBALS['wgStyleDirectory'], - 'dependencies' => 'mediawiki.legacy.wikibits', - ), 'mediawiki.legacy.IEFixes' => array( 'scripts' => 'common/IEFixes.js', 'remoteBasePath' => $GLOBALS['wgStylePath'], 'localBasePath' => $GLOBALS['wgStyleDirectory'], 'dependencies' => 'mediawiki.legacy.wikibits', ), - 'mediawiki.legacy.metadata' => array( - 'scripts' => 'common/metadata.js', - 'remoteBasePath' => $GLOBALS['wgStylePath'], - 'localBasePath' => $GLOBALS['wgStyleDirectory'], - 'dependencies' => 'mediawiki.legacy.wikibits', - 'messages' => array( 'metadata-expand', 'metadata-collapse' ), - ), 'mediawiki.legacy.mwsuggest' => array( 'scripts' => 'common/mwsuggest.js', 'remoteBasePath' => $GLOBALS['wgStylePath'], 'localBasePath' => $GLOBALS['wgStyleDirectory'], - 'dependencies' => 'mediawiki.legacy.wikibits', + 'dependencies' => array( 'mediawiki.legacy.wikibits', 'jquery.client' ), 'messages' => array( 'search-mwsuggest-enabled', 'search-mwsuggest-disabled' ), ), - 'mediawiki.legacy.prefs' => array( - 'scripts' => 'common/prefs.js', - 'remoteBasePath' => $GLOBALS['wgStylePath'], - 'localBasePath' => $GLOBALS['wgStyleDirectory'], - 'dependencies' => array( 'mediawiki.legacy.wikibits', 'mediawiki.legacy.htmlform' ), - ), 'mediawiki.legacy.preview' => array( 'scripts' => 'common/preview.js', 'remoteBasePath' => $GLOBALS['wgStylePath'], @@ -547,14 +681,10 @@ return array( 'scripts' => 'common/protect.js', 'remoteBasePath' => $GLOBALS['wgStylePath'], 'localBasePath' => $GLOBALS['wgStyleDirectory'], - 'dependencies' => 'mediawiki.legacy.wikibits', - ), - 'mediawiki.legacy.search' => array( - 'scripts' => 'common/search.js', - 'remoteBasePath' => $GLOBALS['wgStylePath'], - 'localBasePath' => $GLOBALS['wgStyleDirectory'], - 'styles' => 'common/search.css', - 'dependencies' => 'mediawiki.legacy.wikibits', + 'dependencies' => array( + 'mediawiki.legacy.wikibits', + 'jquery.byteLimit', + ), ), 'mediawiki.legacy.shared' => array( 'styles' => array( 'common/shared.css' => array( 'media' => 'screen' ) ), diff --git a/resources/jquery.tipsy/jquery.tipsy.css b/resources/jquery.tipsy/jquery.tipsy.css index d79554d2..2e504c32 100644 --- a/resources/jquery.tipsy/jquery.tipsy.css +++ b/resources/jquery.tipsy/jquery.tipsy.css @@ -2,6 +2,7 @@ padding: 5px; position: absolute; z-index: 100000; + cursor: default; } .tipsy-inner { padding: 5px 8px 4px 8px; diff --git a/resources/jquery.tipsy/jquery.tipsy.js b/resources/jquery.tipsy/jquery.tipsy.js index 847a527b..7c808734 100644 --- a/resources/jquery.tipsy/jquery.tipsy.js +++ b/resources/jquery.tipsy/jquery.tipsy.js @@ -56,17 +56,17 @@ if (gravity.length == 2) { if (gravity.charAt(1) == 'w') { - if ( this.options.center ) { - tp.left = pos.left + pos.width / 2 - 15; - } else { + if (this.options.center) { + tp.left = pos.left + pos.width / 2 - 15; + } else { tp.left = pos.left; - } + } } else { - if ( this.options.center ) { - tp.left = pos.left + pos.width / 2 - actualWidth + 15; - } else { - tp.left = pos.left + pos.width; - } + if (this.options.center) { + tp.left = pos.left + pos.width / 2 - actualWidth + 15; + } else { + tp.left = pos.left + pos.width; + } } } diff --git a/resources/jquery.ui/jquery.ui.accordion.js b/resources/jquery.ui/jquery.ui.accordion.js index 7d926e09..898160a1 100644 --- a/resources/jquery.ui/jquery.ui.accordion.js +++ b/resources/jquery.ui/jquery.ui.accordion.js @@ -1,9 +1,9 @@ /* - * jQuery UI Accordion 1.8.2 + * jQuery UI Accordion 1.8.11 * - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT (MIT-LICENSE.txt) - * and GPL (GPL-LICENSE.txt) licenses. + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license * * http://docs.jquery.com/UI/Accordion * @@ -11,12 +11,12 @@ * jquery.ui.core.js * jquery.ui.widget.js */ -(function($) { +(function( $, undefined ) { -$.widget("ui.accordion", { +$.widget( "ui.accordion", { options: { active: 0, - animated: 'slide', + animated: "slide", autoHeight: true, clearStyle: false, collapsible: false, @@ -29,322 +29,398 @@ $.widget("ui.accordion", { }, navigation: false, navigationFilter: function() { - return this.href.toLowerCase() == location.href.toLowerCase(); + return this.href.toLowerCase() === location.href.toLowerCase(); } }, - _create: function() { - - var o = this.options, self = this; - this.running = 0; - this.element.addClass("ui-accordion ui-widget ui-helper-reset"); - - // in lack of child-selectors in CSS we need to mark top-LIs in a UL-accordion for some IE-fix - this.element.children("li").addClass("ui-accordion-li-fix"); - - this.headers = this.element.find(o.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all") - .bind("mouseenter.accordion", function(){ $(this).addClass('ui-state-hover'); }) - .bind("mouseleave.accordion", function(){ $(this).removeClass('ui-state-hover'); }) - .bind("focus.accordion", function(){ $(this).addClass('ui-state-focus'); }) - .bind("blur.accordion", function(){ $(this).removeClass('ui-state-focus'); }); + _create: function() { + var self = this, + options = self.options; + + self.running = 0; + + self.element + .addClass( "ui-accordion ui-widget ui-helper-reset" ) + // in lack of child-selectors in CSS + // we need to mark top-LIs in a UL-accordion for some IE-fix + .children( "li" ) + .addClass( "ui-accordion-li-fix" ); + + self.headers = self.element.find( options.header ) + .addClass( "ui-accordion-header ui-helper-reset ui-state-default ui-corner-all" ) + .bind( "mouseenter.accordion", function() { + if ( options.disabled ) { + return; + } + $( this ).addClass( "ui-state-hover" ); + }) + .bind( "mouseleave.accordion", function() { + if ( options.disabled ) { + return; + } + $( this ).removeClass( "ui-state-hover" ); + }) + .bind( "focus.accordion", function() { + if ( options.disabled ) { + return; + } + $( this ).addClass( "ui-state-focus" ); + }) + .bind( "blur.accordion", function() { + if ( options.disabled ) { + return; + } + $( this ).removeClass( "ui-state-focus" ); + }); - this.headers - .next() - .addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom"); + self.headers.next() + .addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" ); - if ( o.navigation ) { - var current = this.element.find("a").filter(o.navigationFilter); + if ( options.navigation ) { + var current = self.element.find( "a" ).filter( options.navigationFilter ).eq( 0 ); if ( current.length ) { - var header = current.closest(".ui-accordion-header"); + var header = current.closest( ".ui-accordion-header" ); if ( header.length ) { // anchor within header - this.active = header; + self.active = header; } else { // anchor within content - this.active = current.closest(".ui-accordion-content").prev(); + self.active = current.closest( ".ui-accordion-content" ).prev(); } } } - this.active = this._findActive(this.active || o.active).toggleClass("ui-state-default").toggleClass("ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top"); - this.active.next().addClass('ui-accordion-content-active'); - - //Append icon elements - this._createIcons(); - - this.resize(); + self.active = self._findActive( self.active || options.active ) + .addClass( "ui-state-default ui-state-active" ) + .toggleClass( "ui-corner-all" ) + .toggleClass( "ui-corner-top" ); + self.active.next().addClass( "ui-accordion-content-active" ); - //ARIA - this.element.attr('role','tablist'); - - this.headers - .attr('role','tab') - .bind('keydown', function(event) { return self._keydown(event); }) + self._createIcons(); + self.resize(); + + // ARIA + self.element.attr( "role", "tablist" ); + + self.headers + .attr( "role", "tab" ) + .bind( "keydown.accordion", function( event ) { + return self._keydown( event ); + }) .next() - .attr('role','tabpanel'); - - this.headers - .not(this.active || "") - .attr('aria-expanded','false') - .attr("tabIndex", "-1") + .attr( "role", "tabpanel" ); + + self.headers + .not( self.active || "" ) + .attr({ + "aria-expanded": "false", + "aria-selected": "false", + tabIndex: -1 + }) .next() - .hide(); + .hide(); // make sure at least one header is in the tab order - if (!this.active.length) { - this.headers.eq(0).attr('tabIndex','0'); + if ( !self.active.length ) { + self.headers.eq( 0 ).attr( "tabIndex", 0 ); } else { - this.active - .attr('aria-expanded','true') - .attr('tabIndex', '0'); + self.active + .attr({ + "aria-expanded": "true", + "aria-selected": "true", + tabIndex: 0 + }); } - // only need links in taborder for Safari - if (!$.browser.safari) - this.headers.find('a').attr('tabIndex','-1'); + // only need links in tab order for Safari + if ( !$.browser.safari ) { + self.headers.find( "a" ).attr( "tabIndex", -1 ); + } - if (o.event) { - this.headers.bind((o.event) + ".accordion", function(event) { - self._clickHandler.call(self, event, this); + if ( options.event ) { + self.headers.bind( options.event.split(" ").join(".accordion ") + ".accordion", function(event) { + self._clickHandler.call( self, event, this ); event.preventDefault(); }); } - }, - + _createIcons: function() { - var o = this.options; - if (o.icons) { - $("").addClass("ui-icon " + o.icons.header).prependTo(this.headers); - this.active.find(".ui-icon").toggleClass(o.icons.header).toggleClass(o.icons.headerSelected); - this.element.addClass("ui-accordion-icons"); + var options = this.options; + if ( options.icons ) { + $( "" ) + .addClass( "ui-icon " + options.icons.header ) + .prependTo( this.headers ); + this.active.children( ".ui-icon" ) + .toggleClass(options.icons.header) + .toggleClass(options.icons.headerSelected); + this.element.addClass( "ui-accordion-icons" ); } }, - + _destroyIcons: function() { - this.headers.children(".ui-icon").remove(); - this.element.removeClass("ui-accordion-icons"); + this.headers.children( ".ui-icon" ).remove(); + this.element.removeClass( "ui-accordion-icons" ); }, destroy: function() { - var o = this.options; + var options = this.options; this.element - .removeClass("ui-accordion ui-widget ui-helper-reset") - .removeAttr("role") - .unbind('.accordion') - .removeData('accordion'); + .removeClass( "ui-accordion ui-widget ui-helper-reset" ) + .removeAttr( "role" ); this.headers - .unbind(".accordion") - .removeClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-corner-top") - .removeAttr("role").removeAttr("aria-expanded").removeAttr("tabIndex"); - - this.headers.find("a").removeAttr("tabIndex"); + .unbind( ".accordion" ) + .removeClass( "ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top" ) + .removeAttr( "role" ) + .removeAttr( "aria-expanded" ) + .removeAttr( "aria-selected" ) + .removeAttr( "tabIndex" ); + + this.headers.find( "a" ).removeAttr( "tabIndex" ); this._destroyIcons(); - var contents = this.headers.next().css("display", "").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active"); - if (o.autoHeight || o.fillHeight) { - contents.css("height", ""); + var contents = this.headers.next() + .css( "display", "" ) + .removeAttr( "role" ) + .removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled" ); + if ( options.autoHeight || options.fillHeight ) { + contents.css( "height", "" ); } - return this; + return $.Widget.prototype.destroy.call( this ); }, - - _setOption: function(key, value) { - $.Widget.prototype._setOption.apply(this, arguments); + + _setOption: function( key, value ) { + $.Widget.prototype._setOption.apply( this, arguments ); - if (key == "active") { - this.activate(value); + if ( key == "active" ) { + this.activate( value ); } - if (key == "icons") { + if ( key == "icons" ) { this._destroyIcons(); - if (value) { + if ( value ) { this._createIcons(); } } - + // #5332 - opacity doesn't cascade to positioned elements in IE + // so we need to add the disabled class to the headers and panels + if ( key == "disabled" ) { + this.headers.add(this.headers.next()) + [ value ? "addClass" : "removeClass" ]( + "ui-accordion-disabled ui-state-disabled" ); + } }, - _keydown: function(event) { - - var o = this.options, keyCode = $.ui.keyCode; - - if (o.disabled || event.altKey || event.ctrlKey) + _keydown: function( event ) { + if ( this.options.disabled || event.altKey || event.ctrlKey ) { return; + } - var length = this.headers.length; - var currentIndex = this.headers.index(event.target); - var toFocus = false; + var keyCode = $.ui.keyCode, + length = this.headers.length, + currentIndex = this.headers.index( event.target ), + toFocus = false; - switch(event.keyCode) { + switch ( event.keyCode ) { case keyCode.RIGHT: case keyCode.DOWN: - toFocus = this.headers[(currentIndex + 1) % length]; + toFocus = this.headers[ ( currentIndex + 1 ) % length ]; break; case keyCode.LEFT: case keyCode.UP: - toFocus = this.headers[(currentIndex - 1 + length) % length]; + toFocus = this.headers[ ( currentIndex - 1 + length ) % length ]; break; case keyCode.SPACE: case keyCode.ENTER: - this._clickHandler({ target: event.target }, event.target); + this._clickHandler( { target: event.target }, event.target ); event.preventDefault(); } - if (toFocus) { - $(event.target).attr('tabIndex','-1'); - $(toFocus).attr('tabIndex','0'); + if ( toFocus ) { + $( event.target ).attr( "tabIndex", -1 ); + $( toFocus ).attr( "tabIndex", 0 ); toFocus.focus(); return false; } return true; - }, resize: function() { + var options = this.options, + maxHeight; - var o = this.options, maxHeight; - - if (o.fillSpace) { - - if($.browser.msie) { var defOverflow = this.element.parent().css('overflow'); this.element.parent().css('overflow', 'hidden'); } + if ( options.fillSpace ) { + if ( $.browser.msie ) { + var defOverflow = this.element.parent().css( "overflow" ); + this.element.parent().css( "overflow", "hidden"); + } maxHeight = this.element.parent().height(); - if($.browser.msie) { this.element.parent().css('overflow', defOverflow); } - + if ($.browser.msie) { + this.element.parent().css( "overflow", defOverflow ); + } + this.headers.each(function() { - maxHeight -= $(this).outerHeight(true); + maxHeight -= $( this ).outerHeight( true ); }); - this.headers.next().each(function() { - $(this).height(Math.max(0, maxHeight - $(this).innerHeight() + $(this).height())); - }).css('overflow', 'auto'); - - } else if ( o.autoHeight ) { + this.headers.next() + .each(function() { + $( this ).height( Math.max( 0, maxHeight - + $( this ).innerHeight() + $( this ).height() ) ); + }) + .css( "overflow", "auto" ); + } else if ( options.autoHeight ) { maxHeight = 0; - this.headers.next().each(function() { - maxHeight = Math.max(maxHeight, $(this).height()); - }).height(maxHeight); + this.headers.next() + .each(function() { + maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() ); + }) + .height( maxHeight ); } return this; }, - activate: function(index) { + activate: function( index ) { // TODO this gets called on init, changing the option without an explicit call for that this.options.active = index; // call clickHandler with custom event - var active = this._findActive(index)[0]; - this._clickHandler({ target: active }, active); + var active = this._findActive( index )[ 0 ]; + this._clickHandler( { target: active }, active ); return this; }, - _findActive: function(selector) { + _findActive: function( selector ) { return selector - ? typeof selector == "number" - ? this.headers.filter(":eq(" + selector + ")") - : this.headers.not(this.headers.not(selector)) + ? typeof selector === "number" + ? this.headers.filter( ":eq(" + selector + ")" ) + : this.headers.not( this.headers.not( selector ) ) : selector === false - ? $([]) - : this.headers.filter(":eq(0)"); + ? $( [] ) + : this.headers.filter( ":eq(0)" ); }, - // TODO isn't event.target enough? why the seperate target argument? - _clickHandler: function(event, target) { - - var o = this.options; - if (o.disabled) + // TODO isn't event.target enough? why the separate target argument? + _clickHandler: function( event, target ) { + var options = this.options; + if ( options.disabled ) { return; + } // called only when using activate(false) to close all parts programmatically - if (!event.target) { - if (!o.collapsible) + if ( !event.target ) { + if ( !options.collapsible ) { return; - this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all") - .find(".ui-icon").removeClass(o.icons.headerSelected).addClass(o.icons.header); - this.active.next().addClass('ui-accordion-content-active'); + } + this.active + .removeClass( "ui-state-active ui-corner-top" ) + .addClass( "ui-state-default ui-corner-all" ) + .children( ".ui-icon" ) + .removeClass( options.icons.headerSelected ) + .addClass( options.icons.header ); + this.active.next().addClass( "ui-accordion-content-active" ); var toHide = this.active.next(), data = { - options: o, - newHeader: $([]), - oldHeader: o.active, - newContent: $([]), + options: options, + newHeader: $( [] ), + oldHeader: options.active, + newContent: $( [] ), oldContent: toHide }, - toShow = (this.active = $([])); - this._toggle(toShow, toHide, data); + toShow = ( this.active = $( [] ) ); + this._toggle( toShow, toHide, data ); return; } // get the click target - var clicked = $(event.currentTarget || target); - var clickedIsActive = clicked[0] == this.active[0]; - + var clicked = $( event.currentTarget || target ), + clickedIsActive = clicked[0] === this.active[0]; + // TODO the option is changed, is that correct? // TODO if it is correct, shouldn't that happen after determining that the click is valid? - o.active = o.collapsible && clickedIsActive ? false : $('.ui-accordion-header', this.element).index(clicked); + options.active = options.collapsible && clickedIsActive ? + false : + this.headers.index( clicked ); // if animations are still active, or the active header is the target, ignore click - if (this.running || (!o.collapsible && clickedIsActive)) { + if ( this.running || ( !options.collapsible && clickedIsActive ) ) { return; } - // switch classes - this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all") - .find(".ui-icon").removeClass(o.icons.headerSelected).addClass(o.icons.header); - if (!clickedIsActive) { - clicked.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top") - .find(".ui-icon").removeClass(o.icons.header).addClass(o.icons.headerSelected); - clicked.next().addClass('ui-accordion-content-active'); - } - // find elements to show and hide - var toShow = clicked.next(), + var active = this.active, + toShow = clicked.next(), toHide = this.active.next(), data = { - options: o, - newHeader: clickedIsActive && o.collapsible ? $([]) : clicked, + options: options, + newHeader: clickedIsActive && options.collapsible ? $([]) : clicked, oldHeader: this.active, - newContent: clickedIsActive && o.collapsible ? $([]) : toShow, + newContent: clickedIsActive && options.collapsible ? $([]) : toShow, oldContent: toHide }, down = this.headers.index( this.active[0] ) > this.headers.index( clicked[0] ); + // when the call to ._toggle() comes after the class changes + // it causes a very odd bug in IE 8 (see #6720) this.active = clickedIsActive ? $([]) : clicked; - this._toggle(toShow, toHide, data, clickedIsActive, down); + this._toggle( toShow, toHide, data, clickedIsActive, down ); - return; + // switch classes + active + .removeClass( "ui-state-active ui-corner-top" ) + .addClass( "ui-state-default ui-corner-all" ) + .children( ".ui-icon" ) + .removeClass( options.icons.headerSelected ) + .addClass( options.icons.header ); + if ( !clickedIsActive ) { + clicked + .removeClass( "ui-state-default ui-corner-all" ) + .addClass( "ui-state-active ui-corner-top" ) + .children( ".ui-icon" ) + .removeClass( options.icons.header ) + .addClass( options.icons.headerSelected ); + clicked + .next() + .addClass( "ui-accordion-content-active" ); + } + return; }, - _toggle: function(toShow, toHide, data, clickedIsActive, down) { + _toggle: function( toShow, toHide, data, clickedIsActive, down ) { + var self = this, + options = self.options; - var o = this.options, self = this; + self.toShow = toShow; + self.toHide = toHide; + self.data = data; - this.toShow = toShow; - this.toHide = toHide; - this.data = data; - - var complete = function() { if(!self) return; return self._completed.apply(self, arguments); }; + var complete = function() { + if ( !self ) { + return; + } + return self._completed.apply( self, arguments ); + }; // trigger changestart event - this._trigger("changestart", null, this.data); + self._trigger( "changestart", null, self.data ); // count elements to animate - this.running = toHide.size() === 0 ? toShow.size() : toHide.size(); - - if (o.animated) { + self.running = toHide.size() === 0 ? toShow.size() : toHide.size(); + if ( options.animated ) { var animOptions = {}; - if ( o.collapsible && clickedIsActive ) { + if ( options.collapsible && clickedIsActive ) { animOptions = { - toShow: $([]), + toShow: $( [] ), toHide: toHide, complete: complete, down: down, - autoHeight: o.autoHeight || o.fillSpace + autoHeight: options.autoHeight || options.fillSpace }; } else { animOptions = { @@ -352,101 +428,120 @@ $.widget("ui.accordion", { toHide: toHide, complete: complete, down: down, - autoHeight: o.autoHeight || o.fillSpace + autoHeight: options.autoHeight || options.fillSpace }; } - if (!o.proxied) { - o.proxied = o.animated; + if ( !options.proxied ) { + options.proxied = options.animated; } - if (!o.proxiedDuration) { - o.proxiedDuration = o.duration; + if ( !options.proxiedDuration ) { + options.proxiedDuration = options.duration; } - o.animated = $.isFunction(o.proxied) ? - o.proxied(animOptions) : o.proxied; + options.animated = $.isFunction( options.proxied ) ? + options.proxied( animOptions ) : + options.proxied; - o.duration = $.isFunction(o.proxiedDuration) ? - o.proxiedDuration(animOptions) : o.proxiedDuration; + options.duration = $.isFunction( options.proxiedDuration ) ? + options.proxiedDuration( animOptions ) : + options.proxiedDuration; var animations = $.ui.accordion.animations, - duration = o.duration, - easing = o.animated; + duration = options.duration, + easing = options.animated; - if (easing && !animations[easing] && !$.easing[easing]) { - easing = 'slide'; + if ( easing && !animations[ easing ] && !$.easing[ easing ] ) { + easing = "slide"; } - if (!animations[easing]) { - animations[easing] = function(options) { - this.slide(options, { + if ( !animations[ easing ] ) { + animations[ easing ] = function( options ) { + this.slide( options, { easing: easing, duration: duration || 700 }); }; } - animations[easing](animOptions); - + animations[ easing ]( animOptions ); } else { - - if (o.collapsible && clickedIsActive) { + if ( options.collapsible && clickedIsActive ) { toShow.toggle(); } else { toHide.hide(); toShow.show(); } - complete(true); - + complete( true ); } // TODO assert that the blur and focus triggers are really necessary, remove otherwise - toHide.prev().attr('aria-expanded','false').attr("tabIndex", "-1").blur(); - toShow.prev().attr('aria-expanded','true').attr("tabIndex", "0").focus(); - + toHide.prev() + .attr({ + "aria-expanded": "false", + "aria-selected": "false", + tabIndex: -1 + }) + .blur(); + toShow.prev() + .attr({ + "aria-expanded": "true", + "aria-selected": "true", + tabIndex: 0 + }) + .focus(); }, - _completed: function(cancel) { - - var o = this.options; - + _completed: function( cancel ) { this.running = cancel ? 0 : --this.running; - if (this.running) return; + if ( this.running ) { + return; + } - if (o.clearStyle) { - this.toShow.add(this.toHide).css({ + if ( this.options.clearStyle ) { + this.toShow.add( this.toHide ).css({ height: "", overflow: "" }); } - + // other classes are removed before the animation; this one needs to stay until completed - this.toHide.removeClass("ui-accordion-content-active"); + this.toHide.removeClass( "ui-accordion-content-active" ); + // Work around for rendering bug in IE (#5421) + if ( this.toHide.length ) { + this.toHide.parent()[0].className = this.toHide.parent()[0].className; + } - this._trigger('change', null, this.data); + this._trigger( "change", null, this.data ); } - }); - -$.extend($.ui.accordion, { - version: "1.8.2", +$.extend( $.ui.accordion, { + version: "1.8.11", animations: { - slide: function(options, additions) { + slide: function( options, additions ) { options = $.extend({ easing: "swing", duration: 300 - }, options, additions); + }, options, additions ); if ( !options.toHide.size() ) { - options.toShow.animate({height: "show"}, options); + options.toShow.animate({ + height: "show", + paddingTop: "show", + paddingBottom: "show" + }, options ); return; } if ( !options.toShow.size() ) { - options.toHide.animate({height: "hide"}, options); + options.toHide.animate({ + height: "hide", + paddingTop: "hide", + paddingBottom: "hide" + }, options ); return; } - var overflow = options.toShow.css('overflow'), + var overflow = options.toShow.css( "overflow" ), percentDone = 0, showProps = {}, hideProps = {}, @@ -455,45 +550,57 @@ $.extend($.ui.accordion, { // fix width before calculating height of hidden element var s = options.toShow; originalWidth = s[0].style.width; - s.width( parseInt(s.parent().width(),10) - parseInt(s.css("paddingLeft"),10) - parseInt(s.css("paddingRight"),10) - (parseInt(s.css("borderLeftWidth"),10) || 0) - (parseInt(s.css("borderRightWidth"),10) || 0) ); - - $.each(fxAttrs, function(i, prop) { - hideProps[prop] = 'hide'; - - var parts = ('' + $.css(options.toShow[0], prop)).match(/^([\d+-.]+)(.*)$/); - showProps[prop] = { - value: parts[1], - unit: parts[2] || 'px' + s.width( parseInt( s.parent().width(), 10 ) + - parseInt( s.css( "paddingLeft" ), 10 ) + - parseInt( s.css( "paddingRight" ), 10 ) + - ( parseInt( s.css( "borderLeftWidth" ), 10 ) || 0 ) + - ( parseInt( s.css( "borderRightWidth" ), 10) || 0 ) ); + + $.each( fxAttrs, function( i, prop ) { + hideProps[ prop ] = "hide"; + + var parts = ( "" + $.css( options.toShow[0], prop ) ).match( /^([\d+-.]+)(.*)$/ ); + showProps[ prop ] = { + value: parts[ 1 ], + unit: parts[ 2 ] || "px" }; }); - options.toShow.css({ height: 0, overflow: 'hidden' }).show(); - options.toHide.filter(":hidden").each(options.complete).end().filter(":visible").animate(hideProps,{ - step: function(now, settings) { + options.toShow.css({ height: 0, overflow: "hidden" }).show(); + options.toHide + .filter( ":hidden" ) + .each( options.complete ) + .end() + .filter( ":visible" ) + .animate( hideProps, { + step: function( now, settings ) { // only calculate the percent when animating height // IE gets very inconsistent results when animating elements // with small values, which is common for padding - if (settings.prop == 'height') { + if ( settings.prop == "height" ) { percentDone = ( settings.end - settings.start === 0 ) ? 0 : - (settings.now - settings.start) / (settings.end - settings.start); + ( settings.now - settings.start ) / ( settings.end - settings.start ); } - - options.toShow[0].style[settings.prop] = - (percentDone * showProps[settings.prop].value) + showProps[settings.prop].unit; + + options.toShow[ 0 ].style[ settings.prop ] = + ( percentDone * showProps[ settings.prop ].value ) + + showProps[ settings.prop ].unit; }, duration: options.duration, easing: options.easing, complete: function() { if ( !options.autoHeight ) { - options.toShow.css("height", ""); + options.toShow.css( "height", "" ); } - options.toShow.css("width", originalWidth); - options.toShow.css({overflow: overflow}); + options.toShow.css({ + width: originalWidth, + overflow: overflow + }); options.complete(); } }); }, - bounceslide: function(options) { - this.slide(options, { + bounceslide: function( options ) { + this.slide( options, { easing: options.down ? "easeOutBounce" : "swing", duration: options.down ? 1000 : 200 }); @@ -501,4 +608,4 @@ $.extend($.ui.accordion, { } }); -})(jQuery); +})( jQuery ); diff --git a/resources/jquery.ui/jquery.ui.autocomplete.js b/resources/jquery.ui/jquery.ui.autocomplete.js index 9a12a6b0..41c13930 100644 --- a/resources/jquery.ui/jquery.ui.autocomplete.js +++ b/resources/jquery.ui/jquery.ui.autocomplete.js @@ -1,9 +1,9 @@ /* - * jQuery UI Autocomplete 1.8.2 + * jQuery UI Autocomplete 1.8.14 * - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT (MIT-LICENSE.txt) - * and GPL (GPL-LICENSE.txt) licenses. + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license * * http://docs.jquery.com/UI/Autocomplete * @@ -12,16 +12,32 @@ * jquery.ui.widget.js * jquery.ui.position.js */ -(function( $ ) { +(function( $, undefined ) { + +// used to prevent race conditions with remote data sources +var requestIndex = 0; $.widget( "ui.autocomplete", { options: { + appendTo: "body", + autoFocus: false, + delay: 300, minLength: 1, - delay: 300 + position: { + my: "left top", + at: "left bottom", + collision: "none" + }, + source: null }, + + pending: 0, + _create: function() { var self = this, - doc = this.element[ 0 ].ownerDocument; + doc = this.element[ 0 ].ownerDocument, + suppressKeyPress; + this.element .addClass( "ui-autocomplete-input" ) .attr( "autocomplete", "off" ) @@ -32,6 +48,11 @@ $.widget( "ui.autocomplete", { "aria-haspopup": "true" }) .bind( "keydown.autocomplete", function( event ) { + if ( self.options.disabled || self.element.attr( "readonly" ) ) { + return; + } + + suppressKeyPress = false; var keyCode = $.ui.keyCode; switch( event.keyCode ) { case keyCode.PAGE_UP: @@ -52,8 +73,11 @@ $.widget( "ui.autocomplete", { break; case keyCode.ENTER: case keyCode.NUMPAD_ENTER: - // when menu is open or has focus + // when menu is open and has focus if ( self.menu.active ) { + // #6055 - Opera still allows the keypress to occur + // which causes forms to submit + suppressKeyPress = true; event.preventDefault(); } //passthrough - ENTER and TAB both select the current element @@ -67,33 +91,38 @@ $.widget( "ui.autocomplete", { self.element.val( self.term ); self.close( event ); break; - case keyCode.LEFT: - case keyCode.RIGHT: - case keyCode.SHIFT: - case keyCode.CONTROL: - case keyCode.ALT: - case keyCode.COMMAND: - case keyCode.COMMAND_RIGHT: - case keyCode.INSERT: - case keyCode.CAPS_LOCK: - case keyCode.END: - case keyCode.HOME: - // ignore metakeys (shift, ctrl, alt) - break; default: // keypress is triggered before the input value is changed clearTimeout( self.searching ); self.searching = setTimeout(function() { - self.search( null, event ); + // only search if the value has changed + if ( self.term != self.element.val() ) { + self.selectedItem = null; + self.search( null, event ); + } }, self.options.delay ); break; } }) + .bind( "keypress.autocomplete", function( event ) { + if ( suppressKeyPress ) { + suppressKeyPress = false; + event.preventDefault(); + } + }) .bind( "focus.autocomplete", function() { + if ( self.options.disabled ) { + return; + } + self.selectedItem = null; self.previous = self.element.val(); }) .bind( "blur.autocomplete", function( event ) { + if ( self.options.disabled ) { + return; + } + clearTimeout( self.searching ); // clicks on the menu (or a button to trigger a search) will cause a blur event self.closing = setTimeout(function() { @@ -107,9 +136,26 @@ $.widget( "ui.autocomplete", { }; this.menu = $( "" ) .addClass( "ui-autocomplete" ) - .appendTo( "body", doc ) + .appendTo( $( this.options.appendTo || "body", doc )[0] ) // prevent the close-on-blur in case of a "slow" click on the menu (long mousedown) - .mousedown(function() { + .mousedown(function( event ) { + // clicking on the scrollbar causes focus to shift to the body + // but we can't detect a mouseup or a click immediately afterward + // so we have to track the next mousedown and close the menu if + // the user clicks somewhere outside of the autocomplete + var menuElement = self.menu.element[ 0 ]; + if ( !$( event.target ).closest( ".ui-menu-item" ).length ) { + setTimeout(function() { + $( document ).one( 'mousedown', function( event ) { + if ( event.target !== self.element[ 0 ] && + event.target !== menuElement && + !$.ui.contains( menuElement, event.target ) ) { + self.close(); + } + }); + }, 1 ); + } + // use another timeout to make sure the blur-event-handler on the input was already triggered setTimeout(function() { clearTimeout( self.closing ); @@ -118,7 +164,7 @@ $.widget( "ui.autocomplete", { .menu({ focus: function( event, ui ) { var item = ui.item.data( "item.autocomplete" ); - if ( false !== self._trigger( "focus", null, { item: item } ) ) { + if ( false !== self._trigger( "focus", event, { item: item } ) ) { // use value to match what will end up in the input, if it was a key event if ( /^key/.test(event.originalEvent.type) ) { self.element.val( item.value ); @@ -126,21 +172,37 @@ $.widget( "ui.autocomplete", { } }, selected: function( event, ui ) { - var item = ui.item.data( "item.autocomplete" ); - if ( false !== self._trigger( "select", event, { item: item } ) ) { - self.element.val( item.value ); - } - self.close( event ); + var item = ui.item.data( "item.autocomplete" ), + previous = self.previous; + // only trigger when focus was lost (click on menu) - var previous = self.previous; if ( self.element[0] !== doc.activeElement ) { self.element.focus(); self.previous = previous; + // #6109 - IE triggers two focus events and the second + // is asynchronous, so we need to reset the previous + // term synchronously and asynchronously :-( + setTimeout(function() { + self.previous = previous; + self.selectedItem = item; + }, 1); } + + if ( false !== self._trigger( "select", event, { item: item } ) ) { + self.element.val( item.value ); + } + // reset the term after the select event + // this allows custom select handling to work properly + self.term = self.element.val(); + + self.close( event ); self.selectedItem = item; }, blur: function( event, ui ) { - if ( self.menu.element.is(":visible") ) { + // don't set the value of the text field if it's already correct + // this prevents moving the cursor unnecessarily + if ( self.menu.element.is(":visible") && + ( self.element.val() !== self.term ) ) { self.element.val( self.term ); } } @@ -166,15 +228,22 @@ $.widget( "ui.autocomplete", { $.Widget.prototype.destroy.call( this ); }, - _setOption: function( key ) { + _setOption: function( key, value ) { $.Widget.prototype._setOption.apply( this, arguments ); if ( key === "source" ) { this._initSource(); } + if ( key === "appendTo" ) { + this.menu.element.appendTo( $( value || "body", this.element[0].ownerDocument )[0] ) + } + if ( key === "disabled" && value && this.xhr ) { + this.xhr.abort(); + } }, _initSource: function() { - var array, + var self = this, + array, url; if ( $.isArray(this.options.source) ) { array = this.options.source; @@ -184,7 +253,25 @@ $.widget( "ui.autocomplete", { } else if ( typeof this.options.source === "string" ) { url = this.options.source; this.source = function( request, response ) { - $.getJSON( url, request, response ); + if ( self.xhr ) { + self.xhr.abort(); + } + self.xhr = $.ajax({ + url: url, + data: request, + dataType: "json", + autocompleteRequest: ++requestIndex, + success: function( data, status ) { + if ( this.autocompleteRequest === requestIndex ) { + response( data ); + } + }, + error: function() { + if ( this.autocompleteRequest === requestIndex ) { + response( [] ); + } + } + }); }; } else { this.source = this.options.source; @@ -193,12 +280,16 @@ $.widget( "ui.autocomplete", { search: function( value, event ) { value = value != null ? value : this.element.val(); + + // always save the actual value, not the one passed as an argument + this.term = this.element.val(); + if ( value.length < this.options.minLength ) { return this.close( event ); } clearTimeout( this.closing ); - if ( this._trigger("search") === false ) { + if ( this._trigger( "search", event ) === false ) { return; } @@ -206,31 +297,32 @@ $.widget( "ui.autocomplete", { }, _search: function( value ) { - this.term = this.element - .addClass( "ui-autocomplete-loading" ) - // always save the actual value, not the one passed as an argument - .val(); + this.pending++; + this.element.addClass( "ui-autocomplete-loading" ); this.source( { term: value }, this.response ); }, _response: function( content ) { - if ( content.length ) { + if ( !this.options.disabled && content && content.length ) { content = this._normalize( content ); this._suggest( content ); this._trigger( "open" ); } else { this.close(); } - this.element.removeClass( "ui-autocomplete-loading" ); + this.pending--; + if ( !this.pending ) { + this.element.removeClass( "ui-autocomplete-loading" ); + } }, close: function( event ) { clearTimeout( this.closing ); if ( this.menu.element.is(":visible") ) { - this._trigger( "close", event ); this.menu.element.hide(); this.menu.deactivate(); + this._trigger( "close", event ); } }, @@ -261,26 +353,33 @@ $.widget( "ui.autocomplete", { _suggest: function( items ) { var ul = this.menu.element - .empty() - .zIndex( this.element.zIndex() + 1 ), - menuWidth, - textWidth; + .empty() + .zIndex( this.element.zIndex() + 1 ); this._renderMenu( ul, items ); // TODO refresh should check if the active item is still in the dom, removing the need for a manual deactivate this.menu.deactivate(); this.menu.refresh(); - this.menu.element.show().position({ - my: "left top", - at: "left bottom", - of: this.element, - collision: "none" - }); - menuWidth = ul.width( "" ).width(); - textWidth = this.element.width(); - ul.width( Math.max( menuWidth, textWidth ) ); + // size and position menu + ul.show(); + this._resizeMenu(); + ul.position( $.extend({ + of: this.element + }, this.options.position )); + + if ( this.options.autoFocus ) { + this.menu.next( new $.Event("mouseover") ); + } }, - + + _resizeMenu: function() { + var ul = this.menu.element; + ul.outerWidth( Math.max( + ul.width( "" ).outerWidth(), + this.element.outerWidth() + ) ); + }, + _renderMenu: function( ul, items ) { var self = this; $.each( items, function( index, item ) { @@ -291,7 +390,7 @@ $.widget( "ui.autocomplete", { _renderItem: function( ul, item) { return $( "
  • " ) .data( "item.autocomplete", item ) - .append( "" + item.label + "" ) + .append( $( "" ).text( item.label ) ) .appendTo( ul ); }, @@ -316,7 +415,7 @@ $.widget( "ui.autocomplete", { $.extend( $.ui.autocomplete, { escapeRegex: function( value ) { - return value.replace( /([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1" ); + return value.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); }, filter: function(array, term) { var matcher = new RegExp( $.ui.autocomplete.escapeRegex(term), "i" ); @@ -335,9 +434,9 @@ $.extend( $.ui.autocomplete, { * it for the next release. You're welcome to give it a try anyway and give us feedback, * as long as you're okay with migrating your code later on. We can help with that, too. * - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT (MIT-LICENSE.txt) - * and GPL (GPL-LICENSE.txt) licenses. + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license * * http://docs.jquery.com/UI/Menu * @@ -391,12 +490,12 @@ $.widget("ui.menu", { this.deactivate(); if (this.hasScroll()) { var offset = item.offset().top - this.element.offset().top, - scroll = this.element.attr("scrollTop"), + scroll = this.element.scrollTop(), elementHeight = this.element.height(); if (offset < 0) { - this.element.attr("scrollTop", scroll + offset); - } else if (offset > elementHeight) { - this.element.attr("scrollTop", scroll + offset - elementHeight + item.height()); + this.element.scrollTop( scroll + offset); + } else if (offset >= elementHeight) { + this.element.scrollTop( scroll + offset - elementHeight + item.height()); } } this.active = item.eq(0) @@ -426,11 +525,11 @@ $.widget("ui.menu", { }, first: function() { - return this.active && !this.active.prev().length; + return this.active && !this.active.prevAll(".ui-menu-item").length; }, last: function() { - return this.active && !this.active.next().length; + return this.active && !this.active.nextAll(".ui-menu-item").length; }, move: function(direction, edge, event) { @@ -451,12 +550,12 @@ $.widget("ui.menu", { if (this.hasScroll()) { // TODO merge with no-scroll-else if (!this.active || this.last()) { - this.activate(event, this.element.children(":first")); + this.activate(event, this.element.children(".ui-menu-item:first")); return; } var base = this.active.offset().top, height = this.element.height(), - result = this.element.children("li").filter(function() { + result = this.element.children(".ui-menu-item").filter(function() { var close = $(this).offset().top - base - height + $(this).height(); // TODO improve approximation return close < 10 && close > -10; @@ -464,11 +563,12 @@ $.widget("ui.menu", { // TODO try to catch this earlier when scrollTop indicates the last page anyway if (!result.length) { - result = this.element.children(":last"); + result = this.element.children(".ui-menu-item:last"); } this.activate(event, result); } else { - this.activate(event, this.element.children(!this.active || this.last() ? ":first" : ":last")); + this.activate(event, this.element.children(".ui-menu-item") + .filter(!this.active || this.last() ? ":first" : ":last")); } }, @@ -477,13 +577,13 @@ $.widget("ui.menu", { if (this.hasScroll()) { // TODO merge with no-scroll-else if (!this.active || this.first()) { - this.activate(event, this.element.children(":last")); + this.activate(event, this.element.children(".ui-menu-item:last")); return; } var base = this.active.offset().top, height = this.element.height(); - result = this.element.children("li").filter(function() { + result = this.element.children(".ui-menu-item").filter(function() { var close = $(this).offset().top - base + height - $(this).height(); // TODO improve approximation return close < 10 && close > -10; @@ -491,16 +591,17 @@ $.widget("ui.menu", { // TODO try to catch this earlier when scrollTop indicates the last page anyway if (!result.length) { - result = this.element.children(":first"); + result = this.element.children(".ui-menu-item:first"); } this.activate(event, result); } else { - this.activate(event, this.element.children(!this.active || this.first() ? ":last" : ":first")); + this.activate(event, this.element.children(".ui-menu-item") + .filter(!this.active || this.first() ? ":last" : ":first")); } }, hasScroll: function() { - return this.element.height() < this.element.attr("scrollHeight"); + return this.element.height() < this.element[ $.fn.prop ? "prop" : "attr" ]("scrollHeight"); }, select: function( event ) { diff --git a/resources/jquery.ui/jquery.ui.button.js b/resources/jquery.ui/jquery.ui.button.js index d318e3de..9a70a01d 100644 --- a/resources/jquery.ui/jquery.ui.button.js +++ b/resources/jquery.ui/jquery.ui.button.js @@ -1,9 +1,9 @@ /* - * jQuery UI Button 1.8.2 + * jQuery UI Button 1.8.11 * - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT (MIT-LICENSE.txt) - * and GPL (GPL-LICENSE.txt) licenses. + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license * * http://docs.jquery.com/UI/Button * @@ -11,12 +11,12 @@ * jquery.ui.core.js * jquery.ui.widget.js */ -(function( $ ) { +(function( $, undefined ) { var lastActive, baseClasses = "ui-button ui-widget ui-state-default ui-corner-all", stateClasses = "ui-state-hover ui-state-active ", - typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon ui-button-text-only", + typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only", formResetHandler = function( event ) { $( ":ui-button", event.target.form ).each(function() { var inst = $( this ).data( "button" ); @@ -44,6 +44,7 @@ var lastActive, $.widget( "ui.button", { options: { + disabled: null, text: true, label: null, icons: { @@ -56,6 +57,10 @@ $.widget( "ui.button", { .unbind( "reset.button" ) .bind( "reset.button", formResetHandler ); + if ( typeof this.options.disabled !== "boolean" ) { + this.options.disabled = this.element.attr( "disabled" ); + } + this._determineButtonType(); this.hasTitle = !!this.buttonElement.attr( "title" ); @@ -195,8 +200,16 @@ $.widget( "ui.button", { if ( this.type === "checkbox" || this.type === "radio" ) { // we don't search against the document in case the element // is disconnected from the DOM - this.buttonElement = this.element.parents().last() - .find( "[for=" + this.element.attr("id") + "]" ); + var ancestor = this.element.parents().filter(":last"), + labelSelector = "label[for=" + this.element.attr("id") + "]"; + this.buttonElement = ancestor.find( labelSelector ); + if ( !this.buttonElement.length ) { + ancestor = ancestor.length ? ancestor.siblings() : this.element.siblings(); + this.buttonElement = ancestor.filter( labelSelector ); + if ( !this.buttonElement.length ) { + this.buttonElement = ancestor.find( labelSelector ); + } + } this.element.addClass( "ui-helper-hidden-accessible" ); var checked = this.element.is( ":checked" ); @@ -285,34 +298,43 @@ $.widget( "ui.button", { .appendTo( buttonElement.empty() ) .text(), icons = this.options.icons, - multipleIcons = icons.primary && icons.secondary; + multipleIcons = icons.primary && icons.secondary, + buttonClasses = []; + if ( icons.primary || icons.secondary ) { - buttonElement.addClass( "ui-button-text-icon" + - ( multipleIcons ? "s" : "" ) ); + if ( this.options.text ) { + buttonClasses.push( "ui-button-text-icon" + ( multipleIcons ? "s" : ( icons.primary ? "-primary" : "-secondary" ) ) ); + } + if ( icons.primary ) { buttonElement.prepend( "" ); } + if ( icons.secondary ) { buttonElement.append( "" ); } + if ( !this.options.text ) { - buttonElement - .addClass( multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only" ) - .removeClass( "ui-button-text-icons ui-button-text-icon" ); + buttonClasses.push( multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only" ); + if ( !this.hasTitle ) { buttonElement.attr( "title", buttonText ); } } } else { - buttonElement.addClass( "ui-button-text-only" ); + buttonClasses.push( "ui-button-text-only" ); } + buttonElement.addClass( buttonClasses.join( " " ) ); } }); $.widget( "ui.buttonset", { + options: { + items: ":button, :submit, :reset, :checkbox, :radio, a, :data(button)" + }, + _create: function() { this.element.addClass( "ui-buttonset" ); - this._init(); }, _init: function() { @@ -328,7 +350,7 @@ $.widget( "ui.buttonset", { }, refresh: function() { - this.buttons = this.element.find( ":button, :submit, :reset, :checkbox, :radio, a, :data(button)" ) + this.buttons = this.element.find( this.options.items ) .filter( ":ui-button" ) .button( "refresh" ) .end() diff --git a/resources/jquery.ui/jquery.ui.core.js b/resources/jquery.ui/jquery.ui.core.js index 80448028..4589a47e 100644 --- a/resources/jquery.ui/jquery.ui.core.js +++ b/resources/jquery.ui/jquery.ui.core.js @@ -1,82 +1,24 @@ /*! - * jQuery UI 1.8.2 + * jQuery UI 1.8.11 * - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT (MIT-LICENSE.txt) - * and GPL (GPL-LICENSE.txt) licenses. + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license * * http://docs.jquery.com/UI */ - -(function($) { +(function( $, undefined ) { // prevent duplicate loading // this is only a problem because we proxy existing functions // and we don't want to double proxy them $.ui = $.ui || {}; -if ($.ui.version) { +if ( $.ui.version ) { return; } -//Helper functions and ui object -$.extend($.ui, { - version: "1.8.2", - - // $.ui.plugin is deprecated. Use the proxy pattern instead. - plugin: { - add: function(module, option, set) { - var proto = $.ui[module].prototype; - for(var i in set) { - proto.plugins[i] = proto.plugins[i] || []; - proto.plugins[i].push([option, set[i]]); - } - }, - call: function(instance, name, args) { - var set = instance.plugins[name]; - if(!set || !instance.element[0].parentNode) { return; } - - for (var i = 0; i < set.length; i++) { - if (instance.options[set[i][0]]) { - set[i][1].apply(instance.element, args); - } - } - } - }, - - contains: function(a, b) { - return document.compareDocumentPosition - ? a.compareDocumentPosition(b) & 16 - : a !== b && a.contains(b); - }, - - hasScroll: function(el, a) { - - //If overflow is hidden, the element might have extra content, but the user wants to hide it - if ($(el).css('overflow') == 'hidden') { return false; } - - var scroll = (a && a == 'left') ? 'scrollLeft' : 'scrollTop', - has = false; - - if (el[scroll] > 0) { return true; } - - // TODO: determine which cases actually cause this to happen - // if the element doesn't have the scroll set, see if it's possible to - // set the scroll - el[scroll] = 1; - has = (el[scroll] > 0); - el[scroll] = 0; - return has; - }, - - isOverAxis: function(x, reference, size) { - //Determines when x coordinate is over "b" element axis - return (x > reference) && (x < (reference + size)); - }, - - isOver: function(y, x, top, left, height, width) { - //Determines when x, y coordinates is over "b" element - return $.ui.isOverAxis(y, top, height) && $.ui.isOverAxis(x, left, width); - }, +$.extend( $.ui, { + version: "1.8.11", keyCode: { ALT: 18, @@ -114,36 +56,26 @@ $.extend($.ui, { } }); -//jQuery plugins +// plugins $.fn.extend({ _focus: $.fn.focus, - focus: function(delay, fn) { - return typeof delay === 'number' - ? this.each(function() { + focus: function( delay, fn ) { + return typeof delay === "number" ? + this.each(function() { var elem = this; setTimeout(function() { - $(elem).focus(); - (fn && fn.call(elem)); - }, delay); - }) - : this._focus.apply(this, arguments); - }, - - enableSelection: function() { - return this - .attr('unselectable', 'off') - .css('MozUserSelect', ''); - }, - - disableSelection: function() { - return this - .attr('unselectable', 'on') - .css('MozUserSelect', 'none'); + $( elem ).focus(); + if ( fn ) { + fn.call( elem ); + } + }, delay ); + }) : + this._focus.apply( this, arguments ); }, scrollParent: function() { var scrollParent; - if(($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) { + if (($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) { scrollParent = this.parents().filter(function() { return (/(relative|absolute|fixed)/).test($.curCSS(this,'position',1)) && (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1)); }).eq(0); @@ -156,26 +88,25 @@ $.fn.extend({ return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent; }, - zIndex: function(zIndex) { - if (zIndex !== undefined) { - return this.css('zIndex', zIndex); + zIndex: function( zIndex ) { + if ( zIndex !== undefined ) { + return this.css( "zIndex", zIndex ); } - - if (this.length) { - var elem = $(this[0]), position, value; - while (elem.length && elem[0] !== document) { + + if ( this.length ) { + var elem = $( this[ 0 ] ), position, value; + while ( elem.length && elem[ 0 ] !== document ) { // Ignore z-index if position is set to a value where z-index is ignored by the browser // This makes behavior of this function consistent across browsers // WebKit always returns auto if the element is positioned - position = elem.css('position'); - if (position == 'absolute' || position == 'relative' || position == 'fixed') - { + position = elem.css( "position" ); + if ( position === "absolute" || position === "relative" || position === "fixed" ) { // IE returns 0 when zIndex is not specified // other browsers return a string // we ignore the case of nested elements with an explicit value of 0 //
    - value = parseInt(elem.css('zIndex')); - if (!isNaN(value) && value != 0) { + value = parseInt( elem.css( "zIndex" ), 10 ); + if ( !isNaN( value ) && value !== 0 ) { return value; } } @@ -184,33 +115,194 @@ $.fn.extend({ } return 0; + }, + + disableSelection: function() { + return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) + + ".ui-disableSelection", function( event ) { + event.preventDefault(); + }); + }, + + enableSelection: function() { + return this.unbind( ".ui-disableSelection" ); + } +}); + +$.each( [ "Width", "Height" ], function( i, name ) { + var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ], + type = name.toLowerCase(), + orig = { + innerWidth: $.fn.innerWidth, + innerHeight: $.fn.innerHeight, + outerWidth: $.fn.outerWidth, + outerHeight: $.fn.outerHeight + }; + + function reduce( elem, size, border, margin ) { + $.each( side, function() { + size -= parseFloat( $.curCSS( elem, "padding" + this, true) ) || 0; + if ( border ) { + size -= parseFloat( $.curCSS( elem, "border" + this + "Width", true) ) || 0; + } + if ( margin ) { + size -= parseFloat( $.curCSS( elem, "margin" + this, true) ) || 0; + } + }); + return size; } + + $.fn[ "inner" + name ] = function( size ) { + if ( size === undefined ) { + return orig[ "inner" + name ].call( this ); + } + + return this.each(function() { + $( this ).css( type, reduce( this, size ) + "px" ); + }); + }; + + $.fn[ "outer" + name] = function( size, margin ) { + if ( typeof size !== "number" ) { + return orig[ "outer" + name ].call( this, size ); + } + + return this.each(function() { + $( this).css( type, reduce( this, size, true, margin ) + "px" ); + }); + }; }); +// selectors +function visible( element ) { + return !$( element ).parents().andSelf().filter(function() { + return $.curCSS( this, "visibility" ) === "hidden" || + $.expr.filters.hidden( this ); + }).length; +} -//Additional selectors -$.extend($.expr[':'], { - data: function(elem, i, match) { - return !!$.data(elem, match[3]); +$.extend( $.expr[ ":" ], { + data: function( elem, i, match ) { + return !!$.data( elem, match[ 3 ] ); }, - focusable: function(element) { + focusable: function( element ) { var nodeName = element.nodeName.toLowerCase(), - tabIndex = $.attr(element, 'tabindex'); - return (/input|select|textarea|button|object/.test(nodeName) + tabIndex = $.attr( element, "tabindex" ); + if ( "area" === nodeName ) { + var map = element.parentNode, + mapName = map.name, + img; + if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) { + return false; + } + img = $( "img[usemap=#" + mapName + "]" )[0]; + return !!img && visible( img ); + } + return ( /input|select|textarea|button|object/.test( nodeName ) ? !element.disabled - : 'a' == nodeName || 'area' == nodeName - ? element.href || !isNaN(tabIndex) - : !isNaN(tabIndex)) + : "a" == nodeName + ? element.href || !isNaN( tabIndex ) + : !isNaN( tabIndex )) // the element and all of its ancestors must be visible - // the browser may report that the area is hidden - && !$(element)['area' == nodeName ? 'parents' : 'closest'](':hidden').length; + && visible( element ); }, - tabbable: function(element) { - var tabIndex = $.attr(element, 'tabindex'); - return (isNaN(tabIndex) || tabIndex >= 0) && $(element).is(':focusable'); + tabbable: function( element ) { + var tabIndex = $.attr( element, "tabindex" ); + return ( isNaN( tabIndex ) || tabIndex >= 0 ) && $( element ).is( ":focusable" ); + } +}); + +// support +$(function() { + var body = document.body, + div = body.appendChild( div = document.createElement( "div" ) ); + + $.extend( div.style, { + minHeight: "100px", + height: "auto", + padding: 0, + borderWidth: 0 + }); + + $.support.minHeight = div.offsetHeight === 100; + $.support.selectstart = "onselectstart" in div; + + // set display to none to avoid a layout bug in IE + // http://dev.jquery.com/ticket/4014 + body.removeChild( div ).style.display = "none"; +}); + + + + + +// deprecated +$.extend( $.ui, { + // $.ui.plugin is deprecated. Use the proxy pattern instead. + plugin: { + add: function( module, option, set ) { + var proto = $.ui[ module ].prototype; + for ( var i in set ) { + proto.plugins[ i ] = proto.plugins[ i ] || []; + proto.plugins[ i ].push( [ option, set[ i ] ] ); + } + }, + call: function( instance, name, args ) { + var set = instance.plugins[ name ]; + if ( !set || !instance.element[ 0 ].parentNode ) { + return; + } + + for ( var i = 0; i < set.length; i++ ) { + if ( instance.options[ set[ i ][ 0 ] ] ) { + set[ i ][ 1 ].apply( instance.element, args ); + } + } + } + }, + + // will be deprecated when we switch to jQuery 1.4 - use jQuery.contains() + contains: function( a, b ) { + return document.compareDocumentPosition ? + a.compareDocumentPosition( b ) & 16 : + a !== b && a.contains( b ); + }, + + // only used by resizable + hasScroll: function( el, a ) { + + //If overflow is hidden, the element might have extra content, but the user wants to hide it + if ( $( el ).css( "overflow" ) === "hidden") { + return false; + } + + var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop", + has = false; + + if ( el[ scroll ] > 0 ) { + return true; + } + + // TODO: determine which cases actually cause this to happen + // if the element doesn't have the scroll set, see if it's possible to + // set the scroll + el[ scroll ] = 1; + has = ( el[ scroll ] > 0 ); + el[ scroll ] = 0; + return has; + }, + + // these are odd functions, fix the API or move into individual plugins + isOverAxis: function( x, reference, size ) { + //Determines when x coordinate is over "b" element axis + return ( x > reference ) && ( x < ( reference + size ) ); + }, + isOver: function( y, x, top, left, height, width ) { + //Determines when x, y coordinates is over "b" element + return $.ui.isOverAxis( y, top, height ) && $.ui.isOverAxis( x, left, width ); } }); -})(jQuery); +})( jQuery ); diff --git a/resources/jquery.ui/jquery.ui.dialog.js b/resources/jquery.ui/jquery.ui.dialog.js index 5f9b1f8b..f0656a2f 100644 --- a/resources/jquery.ui/jquery.ui.dialog.js +++ b/resources/jquery.ui/jquery.ui.dialog.js @@ -1,9 +1,9 @@ /* - * jQuery UI Dialog 1.8.2 + * jQuery UI Dialog 1.8.11 * - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT (MIT-LICENSE.txt) - * and GPL (GPL-LICENSE.txt) licenses. + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license * * http://docs.jquery.com/UI/Dialog * @@ -16,13 +16,28 @@ * jquery.ui.position.js * jquery.ui.resizable.js */ -(function($) { +(function( $, undefined ) { var uiDialogClasses = - 'ui-dialog ' + - 'ui-widget ' + - 'ui-widget-content ' + - 'ui-corner-all '; + 'ui-dialog ' + + 'ui-widget ' + + 'ui-widget-content ' + + 'ui-corner-all ', + sizeRelatedOptions = { + buttons: true, + height: true, + maxHeight: true, + maxWidth: true, + minHeight: true, + minWidth: true, + width: true + }, + resizableRelatedOptions = { + maxHeight: true, + maxWidth: true, + minHeight: true, + minWidth: true + }; $.widget("ui.dialog", { options: { @@ -39,7 +54,18 @@ $.widget("ui.dialog", { minHeight: 150, minWidth: 150, modal: false, - position: 'center', + position: { + my: 'center', + at: 'center', + collision: 'fit', + // ensure that the titlebar is never outside the document + using: function(pos) { + var topOffset = $(this).css(pos).offset().top; + if (topOffset < 0) { + $(this).css('top', pos.top - topOffset); + } + } + }, resizable: true, show: null, stack: true, @@ -47,13 +73,19 @@ $.widget("ui.dialog", { width: 300, zIndex: 1000 }, + _create: function() { this.originalTitle = this.element.attr('title'); + // #5742 - .attr() might return a DOMElement + if ( typeof this.originalTitle !== "string" ) { + this.originalTitle = ""; + } + this.options.title = this.options.title || this.originalTitle; var self = this, options = self.options, - title = options.title || self.originalTitle || ' ', + title = options.title || ' ', titleId = $.ui.dialog.getTitleId(self.element), uiDialog = (self.uiDialog = $('
    ')) @@ -161,6 +193,7 @@ $.widget("ui.dialog", { uiDialog.bgiframe(); } }, + _init: function() { if ( this.options.autoOpen ) { this.open(); @@ -187,14 +220,14 @@ $.widget("ui.dialog", { return self; }, - + widget: function() { return this.uiDialog; }, close: function(event) { var self = this, - maxZ; + maxZ, thisZ; if (false === self._trigger('beforeClose', event)) { return; @@ -223,7 +256,10 @@ $.widget("ui.dialog", { maxZ = 0; $('.ui-dialog').each(function() { if (this !== self.uiDialog[0]) { - maxZ = Math.max(maxZ, $(this).css('z-index')); + thisZ = $(this).css('z-index'); + if(!isNaN(thisZ)) { + maxZ = Math.max(maxZ, thisZ); + } } }); $.ui.dialog.maxZ = maxZ; @@ -242,12 +278,12 @@ $.widget("ui.dialog", { var self = this, options = self.options, saveScroll; - + if ((options.modal && !force) || (!options.stack && !options.modal)) { return self._trigger('focus', event); } - + if (options.zIndex > $.ui.dialog.maxZ) { $.ui.dialog.maxZ = options.zIndex; } @@ -275,9 +311,6 @@ $.widget("ui.dialog", { uiDialog = self.uiDialog; self.overlay = options.modal ? new $.ui.dialog.overlay(self) : null; - if (uiDialog.next().length) { - uiDialog.appendTo('body'); - } self._size(); self._position(options.position); uiDialog.show(options.show); @@ -289,11 +322,11 @@ $.widget("ui.dialog", { if (event.keyCode !== $.ui.keyCode.TAB) { return; } - + var tabbables = $(':tabbable', this), first = tabbables.filter(':first'), last = tabbables.filter(':last'); - + if (event.target === last[0] && !event.shiftKey) { first.focus(1); return false; @@ -306,15 +339,12 @@ $.widget("ui.dialog", { // set focus to the first tabbable element in the content area or the first button // if there are no tabbable elements, set focus on the dialog itself - $([]) - .add(uiDialog.find('.ui-dialog-content :tabbable:first')) - .add(uiDialog.find('.ui-dialog-buttonpane :tabbable:first')) - .add(uiDialog) - .filter(':first') - .focus(); + $(self.element.find(':tabbable').get().concat( + uiDialog.find('.ui-dialog-buttonpane :tabbable').get().concat( + uiDialog.get()))).eq(0).focus(); - self._trigger('open'); self._isOpen = true; + self._trigger('open'); return self; }, @@ -327,7 +357,10 @@ $.widget("ui.dialog", { 'ui-dialog-buttonpane ' + 'ui-widget-content ' + 'ui-helper-clearfix' - ); + ), + uiButtonSet = $( "
    " ) + .addClass( "ui-dialog-buttonset" ) + .appendTo( uiDialogButtonPane ); // if we already have a button pane, remove it self.uiDialog.find('.ui-dialog-buttonpane').remove(); @@ -338,11 +371,17 @@ $.widget("ui.dialog", { }); } if (hasButtons) { - $.each(buttons, function(name, fn) { + $.each(buttons, function(name, props) { + props = $.isFunction( props ) ? + { click: props, text: name } : + props; var button = $('') - .text(name) - .click(function() { fn.apply(self.element[0], arguments); }) - .appendTo(uiDialogButtonPane); + .attr( props, true ) + .unbind('click') + .click(function() { + props.click.apply(self.element[0], arguments); + }) + .appendTo(uiButtonSet); if ($.fn.button) { button.button(); } @@ -450,40 +489,34 @@ $.widget("ui.dialog", { offset = [0, 0], isVisible; - position = position || $.ui.dialog.prototype.options.position; + if (position) { + // deep extending converts arrays to objects in jQuery <= 1.3.2 :-( + // if (typeof position == 'string' || $.isArray(position)) { + // myAt = $.isArray(position) ? position : position.split(' '); - // deep extending converts arrays to objects in jQuery <= 1.3.2 :-( -// if (typeof position == 'string' || $.isArray(position)) { -// myAt = $.isArray(position) ? position : position.split(' '); + if (typeof position === 'string' || (typeof position === 'object' && '0' in position)) { + myAt = position.split ? position.split(' ') : [position[0], position[1]]; + if (myAt.length === 1) { + myAt[1] = myAt[0]; + } - if (typeof position === 'string' || (typeof position === 'object' && '0' in position)) { - myAt = position.split ? position.split(' ') : [position[0], position[1]]; - if (myAt.length === 1) { - myAt[1] = myAt[0]; - } + $.each(['left', 'top'], function(i, offsetPosition) { + if (+myAt[i] === myAt[i]) { + offset[i] = myAt[i]; + myAt[i] = offsetPosition; + } + }); - $.each(['left', 'top'], function(i, offsetPosition) { - if (+myAt[i] === myAt[i]) { - offset[i] = myAt[i]; - myAt[i] = offsetPosition; - } - }); - } else if (typeof position === 'object') { - if ('left' in position) { - myAt[0] = 'left'; - offset[0] = position.left; - } else if ('right' in position) { - myAt[0] = 'right'; - offset[0] = -position.right; - } + position = { + my: myAt.join(" "), + at: myAt.join(" "), + offset: offset.join(" ") + }; + } - if ('top' in position) { - myAt[1] = 'top'; - offset[1] = position.top; - } else if ('bottom' in position) { - myAt[1] = 'bottom'; - offset[1] = -position.bottom; - } + position = $.extend({}, $.ui.dialog.prototype.options.position, position); + } else { + position = $.ui.dialog.prototype.options.position; } // need to show the dialog to get the actual offset in the position plugin @@ -494,31 +527,40 @@ $.widget("ui.dialog", { this.uiDialog // workaround for jQuery bug #5781 http://dev.jquery.com/ticket/5781 .css({ top: 0, left: 0 }) - .position({ - my: myAt.join(' '), - at: myAt.join(' '), - offset: offset.join(' '), - of: window, - collision: 'fit', - // ensure that the titlebar is never outside the document - using: function(pos) { - var topOffset = $(this).css(pos).offset().top; - if (topOffset < 0) { - $(this).css('top', pos.top - topOffset); - } - } - }); + .position($.extend({ of: window }, position)); if (!isVisible) { this.uiDialog.hide(); } }, - _setOption: function(key, value){ + _setOptions: function( options ) { var self = this, - uiDialog = self.uiDialog, - isResizable = uiDialog.is(':data(resizable)'), + resizableOptions = {}, resize = false; - + + $.each( options, function( key, value ) { + self._setOption( key, value ); + + if ( key in sizeRelatedOptions ) { + resize = true; + } + if ( key in resizableRelatedOptions ) { + resizableOptions[ key ] = value; + } + }); + + if ( resize ) { + this._size(); + } + if ( this.uiDialog.is( ":data(resizable)" ) ) { + this.uiDialog.resizable( "option", resizableOptions ); + } + }, + + _setOption: function(key, value){ + var self = this, + uiDialog = self.uiDialog; + switch (key) { //handling of deprecated beforeclose (vs beforeClose) option //Ticket #4669 http://dev.jqueryui.com/ticket/4669 @@ -530,7 +572,7 @@ $.widget("ui.dialog", { self._createButtons(value); break; case "closeText": - // convert whatever was passed in to a string, for text() to not throw up + // ensure that we always pass a string self.uiDialogTitlebarCloseText.text("" + value); break; case "dialogClass": @@ -546,44 +588,21 @@ $.widget("ui.dialog", { } break; case "draggable": - if (value) { - self._makeDraggable(); - } else { - uiDialog.draggable('destroy'); - } - break; - case "height": - resize = true; - break; - case "maxHeight": - if (isResizable) { - uiDialog.resizable('option', 'maxHeight', value); - } - resize = true; - break; - case "maxWidth": - if (isResizable) { - uiDialog.resizable('option', 'maxWidth', value); - } - resize = true; - break; - case "minHeight": - if (isResizable) { - uiDialog.resizable('option', 'minHeight', value); + var isDraggable = uiDialog.is( ":data(draggable)" ); + if ( isDraggable && !value ) { + uiDialog.draggable( "destroy" ); } - resize = true; - break; - case "minWidth": - if (isResizable) { - uiDialog.resizable('option', 'minWidth', value); + + if ( !isDraggable && value ) { + self._makeDraggable(); } - resize = true; break; case "position": self._position(value); break; case "resizable": // currently resizable, becoming non-resizable + var isResizable = uiDialog.is( ":data(resizable)" ); if (isResizable && !value) { uiDialog.resizable('destroy'); } @@ -602,15 +621,9 @@ $.widget("ui.dialog", { // convert whatever was passed in o a string, for html() to not throw up $(".ui-dialog-title", self.uiDialogTitlebar).html("" + (value || ' ')); break; - case "width": - resize = true; - break; } $.Widget.prototype._setOption.apply(self, arguments); - if (resize) { - self._size(); - } }, _size: function() { @@ -618,16 +631,21 @@ $.widget("ui.dialog", { * divs will both have width and height set, so we need to reset them */ var options = this.options, - nonContentHeight; + nonContentHeight, + minContentHeight, + isVisible = this.uiDialog.is( ":visible" ); // reset content sizing - // hide for non content measurement because height: 0 doesn't work in IE quirks mode (see #4350) - this.element.css({ + this.element.show().css({ width: 'auto', minHeight: 0, height: 0 }); + if (options.minWidth > options.width) { + options.width = options.minWidth; + } + // reset wrapper sizing // determine the height of all the non-content elements nonContentHeight = this.uiDialog.css({ @@ -635,16 +653,26 @@ $.widget("ui.dialog", { width: options.width }) .height(); - - this.element - .css(options.height === 'auto' ? { - minHeight: Math.max(options.minHeight - nonContentHeight, 0), - height: 'auto' - } : { - minHeight: 0, - height: Math.max(options.height - nonContentHeight, 0) - }) - .show(); + minContentHeight = Math.max( 0, options.minHeight - nonContentHeight ); + + if ( options.height === "auto" ) { + // only needed for IE6 support + if ( $.support.minHeight ) { + this.element.css({ + minHeight: minContentHeight, + height: "auto" + }); + } else { + this.uiDialog.show(); + var autoHeight = this.element.css( "height", "auto" ).height(); + if ( !isVisible ) { + this.uiDialog.hide(); + } + this.element.height( Math.max( autoHeight, minContentHeight ) ); + } + } else { + this.element.height( Math.max( options.height - nonContentHeight, 0 ) ); + } if (this.uiDialog.is(':data(resizable)')) { this.uiDialog.resizable('option', 'minHeight', this._minHeight()); @@ -653,7 +681,7 @@ $.widget("ui.dialog", { }); $.extend($.ui.dialog, { - version: "1.8.2", + version: "1.8.11", uuid: 0, maxZ: 0, @@ -689,7 +717,10 @@ $.extend($.ui.dialog.overlay, { if ($.ui.dialog.overlay.instances.length) { $(document).bind($.ui.dialog.overlay.events, function(event) { // stop events if the z-index of the target is < the z-index of the overlay - return ($(event.target).zIndex() >= $.ui.dialog.overlay.maxZ); + // we cannot return true when we don't want to cancel the event (#3523) + if ($(event.target).zIndex() < $.ui.dialog.overlay.maxZ) { + return false; + } }); } }, 1); @@ -724,7 +755,10 @@ $.extend($.ui.dialog.overlay, { }, destroy: function($el) { - this.oldInstances.push(this.instances.splice($.inArray($el, this.instances), 1)[0]); + var indexOf = $.inArray($el, this.instances); + if (indexOf != -1){ + this.oldInstances.push(this.instances.splice(indexOf, 1)[0]); + } if (this.instances.length === 0) { $([document, window]).unbind('.dialog-overlay'); diff --git a/resources/jquery.ui/jquery.ui.draggable.js b/resources/jquery.ui/jquery.ui.draggable.js index b4c1070d..5f367616 100644 --- a/resources/jquery.ui/jquery.ui.draggable.js +++ b/resources/jquery.ui/jquery.ui.draggable.js @@ -1,9 +1,9 @@ /* - * jQuery UI Draggable 1.8.2 + * jQuery UI Draggable 1.8.11 * - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT (MIT-LICENSE.txt) - * and GPL (GPL-LICENSE.txt) licenses. + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license * * http://docs.jquery.com/UI/Draggables * @@ -12,7 +12,7 @@ * jquery.ui.mouse.js * jquery.ui.widget.js */ -(function($) { +(function( $, undefined ) { $.widget("ui.draggable", $.ui.mouse, { widgetEventPrefix: "drag", @@ -192,8 +192,8 @@ $.widget("ui.draggable", $.ui.mouse, { this.dropped = false; } - //if the original element is removed, don't bother to continue - if(!this.element[0] || !this.element[0].parentNode) + //if the original element is removed, don't bother to continue if helper is set to "original" + if((!this.element[0] || !this.element[0].parentNode) && this.options.helper == "original") return false; if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) { @@ -317,7 +317,9 @@ $.widget("ui.draggable", $.ui.mouse, { _cacheMargins: function() { this.margins = { left: (parseInt(this.element.css("marginLeft"),10) || 0), - top: (parseInt(this.element.css("marginTop"),10) || 0) + top: (parseInt(this.element.css("marginTop"),10) || 0), + right: (parseInt(this.element.css("marginRight"),10) || 0), + bottom: (parseInt(this.element.css("marginBottom"),10) || 0) }; }, @@ -333,10 +335,10 @@ $.widget("ui.draggable", $.ui.mouse, { var o = this.options; if(o.containment == 'parent') o.containment = this.helper[0].parentNode; if(o.containment == 'document' || o.containment == 'window') this.containment = [ - 0 - this.offset.relative.left - this.offset.parent.left, - 0 - this.offset.relative.top - this.offset.parent.top, - $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left, - ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top + (o.containment == 'document' ? 0 : $(window).scrollLeft()) - this.offset.relative.left - this.offset.parent.left, + (o.containment == 'document' ? 0 : $(window).scrollTop()) - this.offset.relative.top - this.offset.parent.top, + (o.containment == 'document' ? 0 : $(window).scrollLeft()) + $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left, + (o.containment == 'document' ? 0 : $(window).scrollTop()) + ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top ]; if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor != Array) { @@ -345,10 +347,10 @@ $.widget("ui.draggable", $.ui.mouse, { var over = ($(ce).css("overflow") != 'hidden'); this.containment = [ - co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left, - co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top, - co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left, - co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top + co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0), + co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0), + co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left - this.margins.right, + co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top - this.margins.bottom ]; } else if(o.containment.constructor == Array) { this.containment = o.containment; @@ -459,7 +461,7 @@ $.widget("ui.draggable", $.ui.mouse, { }); $.extend($.ui.draggable, { - version: "1.8.2" + version: "1.8.11" }); $.ui.plugin.add("draggable", "connectToSortable", { @@ -475,7 +477,7 @@ $.ui.plugin.add("draggable", "connectToSortable", { instance: sortable, shouldRevert: sortable.options.revert }); - sortable._refreshItems(); //Do a one-time refresh at start to refresh the containerCache + sortable.refreshPositions(); // Call the sortable's refreshPositions at drag start to refresh the containerCache since the sortable container cache is used in drag and needs to be up to date (this will ensure it's initialised as well as being kept in step with any changes that might have happened on the page). sortable._trigger("activate", event, uiSortable); } }); diff --git a/resources/jquery.ui/jquery.ui.droppable.js b/resources/jquery.ui/jquery.ui.droppable.js index b6a15fdf..7d6b8975 100644 --- a/resources/jquery.ui/jquery.ui.droppable.js +++ b/resources/jquery.ui/jquery.ui.droppable.js @@ -1,9 +1,9 @@ /* - * jQuery UI Droppable 1.8.2 + * jQuery UI Droppable 1.8.11 * - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT (MIT-LICENSE.txt) - * and GPL (GPL-LICENSE.txt) licenses. + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license * * http://docs.jquery.com/UI/Droppables * @@ -13,7 +13,7 @@ * jquery.ui.mouse.js * jquery.ui.draggable.js */ -(function($) { +(function( $, undefined ) { $.widget("ui.droppable", { widgetEventPrefix: "drop", @@ -147,7 +147,7 @@ $.widget("ui.droppable", { }); $.extend($.ui.droppable, { - version: "1.8.2" + version: "1.8.11" }); $.ui.intersect = function(draggable, droppable, toleranceMode) { @@ -161,8 +161,8 @@ $.ui.intersect = function(draggable, droppable, toleranceMode) { switch (toleranceMode) { case 'fit': - return (l < x1 && x2 < r - && t < y1 && y2 < b); + return (l <= x1 && x2 <= r + && t <= y1 && y2 <= b); break; case 'intersect': return (l < x1 + (draggable.helperProportions.width / 2) // Right Half @@ -212,11 +212,11 @@ $.ui.ddmanager = { for (var j=0; j < list.length; j++) { if(list[j] == m[i].element[0]) { m[i].proportions.height = 0; continue droppablesLoop; } }; //Filter out elements in the current dragged item m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue; //If the element is not visible, continue + if(type == "mousedown") m[i]._activate.call(m[i], event); //Activate the droppable if used directly from draggables + m[i].offset = m[i].element.offset(); m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight }; - if(type == "mousedown") m[i]._activate.call(m[i], event); //Activate the droppable if used directly from draggables - } }, diff --git a/resources/jquery.ui/jquery.ui.mouse.js b/resources/jquery.ui/jquery.ui.mouse.js index 871edd83..b8db85ce 100644 --- a/resources/jquery.ui/jquery.ui.mouse.js +++ b/resources/jquery.ui/jquery.ui.mouse.js @@ -1,16 +1,16 @@ /*! - * jQuery UI Mouse 1.8.2 + * jQuery UI Mouse 1.8.11 * - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT (MIT-LICENSE.txt) - * and GPL (GPL-LICENSE.txt) licenses. + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license * * http://docs.jquery.com/UI/Mouse * * Depends: * jquery.ui.widget.js */ -(function($) { +(function( $, undefined ) { $.widget("ui.mouse", { options: { @@ -26,8 +26,8 @@ $.widget("ui.mouse", { return self._mouseDown(event); }) .bind('click.'+this.widgetName, function(event) { - if(self._preventClickEvent) { - self._preventClickEvent = false; + if (true === $.data(event.target, self.widgetName + '.preventClickEvent')) { + $.removeData(event.target, self.widgetName + '.preventClickEvent'); event.stopImmediatePropagation(); return false; } @@ -75,6 +75,11 @@ $.widget("ui.mouse", { } } + // Click event may never have fired (Gecko & Opera) + if (true === $.data(event.target, this.widgetName + '.preventClickEvent')) { + $.removeData(event.target, this.widgetName + '.preventClickEvent'); + } + // these delegates are required to keep context this._mouseMoveDelegate = function(event) { return self._mouseMove(event); @@ -86,18 +91,14 @@ $.widget("ui.mouse", { .bind('mousemove.'+this.widgetName, this._mouseMoveDelegate) .bind('mouseup.'+this.widgetName, this._mouseUpDelegate); - // preventDefault() is used to prevent the selection of text here - - // however, in Safari, this causes select boxes not to be selectable - // anymore, so this fix is needed - ($.browser.safari || event.preventDefault()); - + event.preventDefault(); event.originalEvent.mouseHandled = true; return true; }, _mouseMove: function(event) { // IE mouseup check - mouseup happened when mouse was out of window - if ($.browser.msie && !event.button) { + if ($.browser.msie && !(document.documentMode >= 9) && !event.button) { return this._mouseUp(event); } @@ -122,7 +123,11 @@ $.widget("ui.mouse", { if (this._mouseStarted) { this._mouseStarted = false; - this._preventClickEvent = (event.target == this._mouseDownEvent.target); + + if (event.target == this._mouseDownEvent.target) { + $.data(event.target, this.widgetName + '.preventClickEvent', true); + } + this._mouseStop(event); } diff --git a/resources/jquery.ui/jquery.ui.position.js b/resources/jquery.ui/jquery.ui.position.js index 50dd57f0..b66e59ef 100644 --- a/resources/jquery.ui/jquery.ui.position.js +++ b/resources/jquery.ui/jquery.ui.position.js @@ -1,20 +1,19 @@ /* - * jQuery UI Position 1.8.2 + * jQuery UI Position 1.8.11 * - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT (MIT-LICENSE.txt) - * and GPL (GPL-LICENSE.txt) licenses. + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license * * http://docs.jquery.com/UI/Position */ -(function( $ ) { +(function( $, undefined ) { $.ui = $.ui || {}; var horizontalPositions = /left|center|right/, - horizontalDefault = "center", verticalPositions = /top|center|bottom/, - verticalDefault = "center", + center = "center", _position = $.fn.position, _offset = $.fn.offset; @@ -27,21 +26,23 @@ $.fn.position = function( options ) { options = $.extend( {}, options ); var target = $( options.of ), + targetElem = target[0], collision = ( options.collision || "flip" ).split( " " ), offset = options.offset ? options.offset.split( " " ) : [ 0, 0 ], targetWidth, targetHeight, basePosition; - if ( options.of.nodeType === 9 ) { + if ( targetElem.nodeType === 9 ) { targetWidth = target.width(); targetHeight = target.height(); basePosition = { top: 0, left: 0 }; - } else if ( options.of.scrollTo && options.of.document ) { + // TODO: use $.isWindow() in 1.9 + } else if ( targetElem.setTimeout ) { targetWidth = target.width(); targetHeight = target.height(); basePosition = { top: target.scrollTop(), left: target.scrollLeft() }; - } else if ( options.of.preventDefault ) { + } else if ( targetElem.preventDefault ) { // force left top to allow flipping options.at = "left top"; targetWidth = targetHeight = 0; @@ -58,13 +59,13 @@ $.fn.position = function( options ) { var pos = ( options[this] || "" ).split( " " ); if ( pos.length === 1) { pos = horizontalPositions.test( pos[0] ) ? - pos.concat( [verticalDefault] ) : + pos.concat( [center] ) : verticalPositions.test( pos[0] ) ? - [ horizontalDefault ].concat( pos ) : - [ horizontalDefault, verticalDefault ]; + [ center ].concat( pos ) : + [ center, center ]; } - pos[ 0 ] = horizontalPositions.test( pos[0] ) ? pos[ 0 ] : horizontalDefault; - pos[ 1 ] = verticalPositions.test( pos[1] ) ? pos[ 1 ] : verticalDefault; + pos[ 0 ] = horizontalPositions.test( pos[0] ) ? pos[ 0 ] : center; + pos[ 1 ] = verticalPositions.test( pos[1] ) ? pos[ 1 ] : center; options[ this ] = pos; }); @@ -82,13 +83,13 @@ $.fn.position = function( options ) { if ( options.at[0] === "right" ) { basePosition.left += targetWidth; - } else if (options.at[0] === horizontalDefault ) { + } else if ( options.at[0] === center ) { basePosition.left += targetWidth / 2; } if ( options.at[1] === "bottom" ) { basePosition.top += targetHeight; - } else if ( options.at[1] === verticalDefault ) { + } else if ( options.at[1] === center ) { basePosition.top += targetHeight / 2; } @@ -99,23 +100,35 @@ $.fn.position = function( options ) { var elem = $( this ), elemWidth = elem.outerWidth(), elemHeight = elem.outerHeight(), - position = $.extend( {}, basePosition ); + marginLeft = parseInt( $.curCSS( this, "marginLeft", true ) ) || 0, + marginTop = parseInt( $.curCSS( this, "marginTop", true ) ) || 0, + collisionWidth = elemWidth + marginLeft + + ( parseInt( $.curCSS( this, "marginRight", true ) ) || 0 ), + collisionHeight = elemHeight + marginTop + + ( parseInt( $.curCSS( this, "marginBottom", true ) ) || 0 ), + position = $.extend( {}, basePosition ), + collisionPosition; if ( options.my[0] === "right" ) { position.left -= elemWidth; - } else if ( options.my[0] === horizontalDefault ) { + } else if ( options.my[0] === center ) { position.left -= elemWidth / 2; } if ( options.my[1] === "bottom" ) { position.top -= elemHeight; - } else if ( options.my[1] === verticalDefault ) { + } else if ( options.my[1] === center ) { position.top -= elemHeight / 2; } // prevent fractions (see #5280) - position.left = parseInt( position.left ); - position.top = parseInt( position.top ); + position.left = Math.round( position.left ); + position.top = Math.round( position.top ); + + collisionPosition = { + left: position.left - marginLeft, + top: position.top - marginTop + }; $.each( [ "left", "top" ], function( i, dir ) { if ( $.ui.position[ collision[i] ] ) { @@ -124,6 +137,9 @@ $.fn.position = function( options ) { targetHeight: targetHeight, elemWidth: elemWidth, elemHeight: elemHeight, + collisionPosition: collisionPosition, + collisionWidth: collisionWidth, + collisionHeight: collisionHeight, offset: offset, my: options.my, at: options.at @@ -142,41 +158,44 @@ $.ui.position = { fit: { left: function( position, data ) { var win = $( window ), - over = position.left + data.elemWidth - win.width() - win.scrollLeft(); - position.left = over > 0 ? position.left - over : Math.max( 0, position.left ); + over = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft(); + position.left = over > 0 ? position.left - over : Math.max( position.left - data.collisionPosition.left, position.left ); }, top: function( position, data ) { var win = $( window ), - over = position.top + data.elemHeight - win.height() - win.scrollTop(); - position.top = over > 0 ? position.top - over : Math.max( 0, position.top ); + over = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop(); + position.top = over > 0 ? position.top - over : Math.max( position.top - data.collisionPosition.top, position.top ); } }, flip: { left: function( position, data ) { - if ( data.at[0] === "center" ) { + if ( data.at[0] === center ) { return; } var win = $( window ), - over = position.left + data.elemWidth - win.width() - win.scrollLeft(), + over = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft(), myOffset = data.my[ 0 ] === "left" ? -data.elemWidth : data.my[ 0 ] === "right" ? data.elemWidth : 0, + atOffset = data.at[ 0 ] === "left" ? + data.targetWidth : + -data.targetWidth, offset = -2 * data.offset[ 0 ]; - position.left += position.left < 0 ? - myOffset + data.targetWidth + offset : + position.left += data.collisionPosition.left < 0 ? + myOffset + atOffset + offset : over > 0 ? - myOffset - data.targetWidth + offset : + myOffset + atOffset + offset : 0; }, top: function( position, data ) { - if ( data.at[1] === "center" ) { + if ( data.at[1] === center ) { return; } var win = $( window ), - over = position.top + data.elemHeight - win.height() - win.scrollTop(), + over = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop(), myOffset = data.my[ 1 ] === "top" ? -data.elemHeight : data.my[ 1 ] === "bottom" ? @@ -186,8 +205,8 @@ $.ui.position = { data.targetHeight : -data.targetHeight, offset = -2 * data.offset[ 1 ]; - position.top += position.top < 0 ? - myOffset + data.targetHeight + offset : + position.top += data.collisionPosition.top < 0 ? + myOffset + atOffset + offset : over > 0 ? myOffset + atOffset + offset : 0; diff --git a/resources/jquery.ui/jquery.ui.progressbar.js b/resources/jquery.ui/jquery.ui.progressbar.js index 4bc092d1..c432132a 100644 --- a/resources/jquery.ui/jquery.ui.progressbar.js +++ b/resources/jquery.ui/jquery.ui.progressbar.js @@ -1,9 +1,9 @@ /* - * jQuery UI Progressbar 1.8.2 + * jQuery UI Progressbar 1.8.11 * - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT (MIT-LICENSE.txt) - * and GPL (GPL-LICENSE.txt) licenses. + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license * * http://docs.jquery.com/UI/Progressbar * @@ -11,25 +11,30 @@ * jquery.ui.core.js * jquery.ui.widget.js */ -(function( $ ) { +(function( $, undefined ) { $.widget( "ui.progressbar", { options: { - value: 0 + value: 0, + max: 100 }, + + min: 0, + _create: function() { this.element .addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" ) .attr({ role: "progressbar", - "aria-valuemin": this._valueMin(), - "aria-valuemax": this._valueMax(), + "aria-valuemin": this.min, + "aria-valuemax": this.options.max, "aria-valuenow": this._value() }); this.valueDiv = $( "
    " ) .appendTo( this.element ); + this.oldValue = this._value(); this._refreshValue(); }, @@ -56,12 +61,12 @@ $.widget( "ui.progressbar", { }, _setOption: function( key, value ) { - switch ( key ) { - case "value": - this.options.value = value; - this._refreshValue(); - this._trigger( "change" ); - break; + if ( key === "value" ) { + this.options.value = value; + this._refreshValue(); + if ( this._value() === this.options.max ) { + this._trigger( "complete" ); + } } $.Widget.prototype._setOption.apply( this, arguments ); @@ -73,35 +78,31 @@ $.widget( "ui.progressbar", { if ( typeof val !== "number" ) { val = 0; } - if ( val < this._valueMin() ) { - val = this._valueMin(); - } - if ( val > this._valueMax() ) { - val = this._valueMax(); - } - - return val; + return Math.min( this.options.max, Math.max( this.min, val ) ); }, - _valueMin: function() { - return 0; - }, - - _valueMax: function() { - return 100; + _percentage: function() { + return 100 * this._value() / this.options.max; }, _refreshValue: function() { var value = this.value(); + var percentage = this._percentage(); + + if ( this.oldValue !== value ) { + this.oldValue = value; + this._trigger( "change" ); + } + this.valueDiv - [ value === this._valueMax() ? "addClass" : "removeClass"]( "ui-corner-right" ) - .width( value + "%" ); + .toggleClass( "ui-corner-right", value === this.options.max ) + .width( percentage.toFixed(0) + "%" ); this.element.attr( "aria-valuenow", value ); } }); $.extend( $.ui.progressbar, { - version: "1.8.2" + version: "1.8.11" }); })( jQuery ); diff --git a/resources/jquery.ui/jquery.ui.resizable.js b/resources/jquery.ui/jquery.ui.resizable.js index 0a782bb5..1d1c906e 100644 --- a/resources/jquery.ui/jquery.ui.resizable.js +++ b/resources/jquery.ui/jquery.ui.resizable.js @@ -1,9 +1,9 @@ /* - * jQuery UI Resizable 1.8.2 + * jQuery UI Resizable 1.8.11 * - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT (MIT-LICENSE.txt) - * and GPL (GPL-LICENSE.txt) licenses. + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license * * http://docs.jquery.com/UI/Resizables * @@ -12,7 +12,7 @@ * jquery.ui.mouse.js * jquery.ui.widget.js */ -(function($) { +(function( $, undefined ) { $.widget("ui.resizable", $.ui.mouse, { widgetEventPrefix: "resize", @@ -322,10 +322,10 @@ $.widget("ui.resizable", $.ui.mouse, { if(this._helper) { var pr = this._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName), - soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height, - soffsetw = ista ? 0 : self.sizeDiff.width; + soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height, + soffsetw = ista ? 0 : self.sizeDiff.width; - var s = { width: (self.size.width - soffsetw), height: (self.size.height - soffseth) }, + var s = { width: (self.helper.width() - soffsetw), height: (self.helper.height() - soffseth) }, left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null, top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null; @@ -519,7 +519,7 @@ $.widget("ui.resizable", $.ui.mouse, { }); $.extend($.ui.resizable, { - version: "1.8.2" + version: "1.8.11" }); /* @@ -528,28 +528,29 @@ $.extend($.ui.resizable, { $.ui.plugin.add("resizable", "alsoResize", { - start: function(event, ui) { - + start: function (event, ui) { var self = $(this).data("resizable"), o = self.options; - var _store = function(exp) { + var _store = function (exp) { $(exp).each(function() { - $(this).data("resizable-alsoresize", { - width: parseInt($(this).width(), 10), height: parseInt($(this).height(), 10), - left: parseInt($(this).css('left'), 10), top: parseInt($(this).css('top'), 10) + var el = $(this); + el.data("resizable-alsoresize", { + width: parseInt(el.width(), 10), height: parseInt(el.height(), 10), + left: parseInt(el.css('left'), 10), top: parseInt(el.css('top'), 10), + position: el.css('position') // to reset Opera on stop() }); }); }; if (typeof(o.alsoResize) == 'object' && !o.alsoResize.parentNode) { - if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); } - else { $.each(o.alsoResize, function(exp, c) { _store(exp); }); } + if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); } + else { $.each(o.alsoResize, function (exp) { _store(exp); }); } }else{ _store(o.alsoResize); } }, - resize: function(event, ui){ + resize: function (event, ui) { var self = $(this).data("resizable"), o = self.options, os = self.originalSize, op = self.originalPosition; var delta = { @@ -557,18 +558,19 @@ $.ui.plugin.add("resizable", "alsoResize", { top: (self.position.top - op.top) || 0, left: (self.position.left - op.left) || 0 }, - _alsoResize = function(exp, c) { + _alsoResize = function (exp, c) { $(exp).each(function() { - var el = $(this), start = $(this).data("resizable-alsoresize"), style = {}, css = c && c.length ? c : ['width', 'height', 'top', 'left']; + var el = $(this), start = $(this).data("resizable-alsoresize"), style = {}, + css = c && c.length ? c : el.parents(ui.originalElement[0]).length ? ['width', 'height'] : ['width', 'height', 'top', 'left']; - $.each(css || ['width', 'height', 'top', 'left'], function(i, prop) { + $.each(css, function (i, prop) { var sum = (start[prop]||0) + (delta[prop]||0); if (sum && sum >= 0) style[prop] = sum || null; }); - //Opera fixing relative position - if (/relative/.test(el.css('position')) && $.browser.opera) { + // Opera fixing relative position + if ($.browser.opera && /relative/.test(el.css('position'))) { self._revertToRelativePosition = true; el.css({ position: 'absolute', top: 'auto', left: 'auto' }); } @@ -578,22 +580,33 @@ $.ui.plugin.add("resizable", "alsoResize", { }; if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) { - $.each(o.alsoResize, function(exp, c) { _alsoResize(exp, c); }); + $.each(o.alsoResize, function (exp, c) { _alsoResize(exp, c); }); }else{ _alsoResize(o.alsoResize); } }, - stop: function(event, ui){ - var self = $(this).data("resizable"); + stop: function (event, ui) { + var self = $(this).data("resizable"), o = self.options; - //Opera fixing relative position - if (self._revertToRelativePosition && $.browser.opera) { + var _reset = function (exp) { + $(exp).each(function() { + var el = $(this); + // reset position for Opera - no need to verify it was changed + el.css({ position: el.data("resizable-alsoresize").position }); + }); + }; + + if (self._revertToRelativePosition) { self._revertToRelativePosition = false; - el.css({ position: 'relative' }); + if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) { + $.each(o.alsoResize, function (exp) { _reset(exp); }); + }else{ + _reset(o.alsoResize); + } } - $(this).removeData("resizable-alsoresize-start"); + $(this).removeData("resizable-alsoresize"); } }); diff --git a/resources/jquery.ui/jquery.ui.selectable.js b/resources/jquery.ui/jquery.ui.selectable.js index bc707d36..e3b91328 100644 --- a/resources/jquery.ui/jquery.ui.selectable.js +++ b/resources/jquery.ui/jquery.ui.selectable.js @@ -1,10 +1,9 @@ - /* - * jQuery UI Selectable 1.8.2 + * jQuery UI Selectable 1.8.11 * - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT (MIT-LICENSE.txt) - * and GPL (GPL-LICENSE.txt) licenses. + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license * * http://docs.jquery.com/UI/Selectables * @@ -13,7 +12,7 @@ * jquery.ui.mouse.js * jquery.ui.widget.js */ -(function($) { +(function( $, undefined ) { $.widget("ui.selectable", $.ui.mouse, { options: { @@ -90,8 +89,6 @@ $.widget("ui.selectable", $.ui.mouse, { $(options.appendTo).append(this.helper); // position helper (lasso) this.helper.css({ - "z-index": 100, - "position": "absolute", "left": event.clientX, "top": event.clientY, "width": 0, @@ -263,7 +260,7 @@ $.widget("ui.selectable", $.ui.mouse, { }); $.extend($.ui.selectable, { - version: "1.8.2" + version: "1.8.11" }); })(jQuery); diff --git a/resources/jquery.ui/jquery.ui.slider.js b/resources/jquery.ui/jquery.ui.slider.js index 81d854b5..f02a922f 100644 --- a/resources/jquery.ui/jquery.ui.slider.js +++ b/resources/jquery.ui/jquery.ui.slider.js @@ -1,9 +1,9 @@ /* - * jQuery UI Slider 1.8.2 + * jQuery UI Slider 1.8.11 * - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT (MIT-LICENSE.txt) - * and GPL (GPL-LICENSE.txt) licenses. + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license * * http://docs.jquery.com/UI/Slider * @@ -12,8 +12,7 @@ * jquery.ui.mouse.js * jquery.ui.widget.js */ - -(function( $ ) { +(function( $, undefined ) { // number of pages in a slider // (how many times can you page up/down to go through the whole range) @@ -310,8 +309,9 @@ $.widget( "ui.slider", $.ui.mouse, { ( parseInt( closestHandle.css("marginTop"), 10 ) || 0) }; - normValue = this._normValueFromMouse( position ); - this._slide( event, index, normValue ); + if ( !this.handles.hasClass( "ui-state-hover" ) ) { + this._slide( event, index, normValue ); + } this._animateOff = true; return true; }, @@ -585,14 +585,14 @@ $.widget( "ui.slider", $.ui.mouse, { // returns the step-aligned value that val is closest to, between (inclusive) min and max _trimAlignValue: function( val ) { - if ( val < this._valueMin() ) { + if ( val <= this._valueMin() ) { return this._valueMin(); } - if ( val > this._valueMax() ) { + if ( val >= this._valueMax() ) { return this._valueMax(); } var step = ( this.options.step > 0 ) ? this.options.step : 1, - valModStep = val % step, + valModStep = (val - this._valueMin()) % step; alignValue = val - valModStep; if ( Math.abs(valModStep) * 2 >= step ) { @@ -676,7 +676,7 @@ $.widget( "ui.slider", $.ui.mouse, { }); $.extend( $.ui.slider, { - version: "1.8.2" + version: "1.8.11" }); }(jQuery)); diff --git a/resources/jquery.ui/jquery.ui.sortable.js b/resources/jquery.ui/jquery.ui.sortable.js index fe9898e0..1a06dcae 100644 --- a/resources/jquery.ui/jquery.ui.sortable.js +++ b/resources/jquery.ui/jquery.ui.sortable.js @@ -1,9 +1,9 @@ /* - * jQuery UI Sortable 1.8.2 + * jQuery UI Sortable 1.8.11 * - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT (MIT-LICENSE.txt) - * and GPL (GPL-LICENSE.txt) licenses. + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license * * http://docs.jquery.com/UI/Sortables * @@ -12,7 +12,7 @@ * jquery.ui.mouse.js * jquery.ui.widget.js */ -(function($) { +(function( $, undefined ) { $.widget("ui.sortable", $.ui.mouse, { widgetEventPrefix: "sort", @@ -49,8 +49,8 @@ $.widget("ui.sortable", $.ui.mouse, { //Get the items this.refresh(); - //Let's determine if the items are floating - this.floating = this.items.length ? (/left|right/).test(this.items[0].item.css('float')) : false; + //Let's determine if the items are being displayed horizontally + this.floating = this.items.length ? (/left|right/).test(this.items[0].item.css('float')) || (/inline|table-cell/).test(this.items[0].item.css('display')) : false; //Let's determine the parent's offset this.offset = this.element.offset(); @@ -360,7 +360,7 @@ $.widget("ui.sortable", $.ui.mouse, { if(this.dragging) { - this._mouseUp(); + this._mouseUp({ target: null }); if(this.options.helper == "original") this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"); @@ -378,21 +378,23 @@ $.widget("ui.sortable", $.ui.mouse, { } - //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node! - if(this.placeholder[0].parentNode) this.placeholder[0].parentNode.removeChild(this.placeholder[0]); - if(this.options.helper != "original" && this.helper && this.helper[0].parentNode) this.helper.remove(); - - $.extend(this, { - helper: null, - dragging: false, - reverting: false, - _noFinalSort: null - }); + if (this.placeholder) { + //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node! + if(this.placeholder[0].parentNode) this.placeholder[0].parentNode.removeChild(this.placeholder[0]); + if(this.options.helper != "original" && this.helper && this.helper[0].parentNode) this.helper.remove(); - if(this.domPosition.prev) { - $(this.domPosition.prev).after(this.currentItem); - } else { - $(this.domPosition.parent).prepend(this.currentItem); + $.extend(this, { + helper: null, + dragging: false, + reverting: false, + _noFinalSort: null + }); + + if(this.domPosition.prev) { + $(this.domPosition.prev).after(this.currentItem); + } else { + $(this.domPosition.parent).prepend(this.currentItem); + } } return this; @@ -409,6 +411,10 @@ $.widget("ui.sortable", $.ui.mouse, { if(res) str.push((o.key || res[1]+'[]')+'='+(o.key && o.expression ? res[1] : res[2])); }); + if(!str.length && o.key) { + str.push(o.key + '='); + } + return str.join('&'); }, @@ -1061,7 +1067,7 @@ $.widget("ui.sortable", $.ui.mouse, { }); $.extend($.ui.sortable, { - version: "1.8.2" + version: "1.8.11" }); })(jQuery); diff --git a/resources/jquery.ui/jquery.ui.tabs.js b/resources/jquery.ui/jquery.ui.tabs.js index 1f94d52a..3be7ff49 100644 --- a/resources/jquery.ui/jquery.ui.tabs.js +++ b/resources/jquery.ui/jquery.ui.tabs.js @@ -1,9 +1,9 @@ /* - * jQuery UI Tabs 1.8.2 + * jQuery UI Tabs 1.8.11 * - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT (MIT-LICENSE.txt) - * and GPL (GPL-LICENSE.txt) licenses. + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license * * http://docs.jquery.com/UI/Tabs * @@ -11,7 +11,7 @@ * jquery.ui.core.js * jquery.ui.widget.js */ -(function($) { +(function( $, undefined ) { var tabId = 0, listId = 0; @@ -24,7 +24,7 @@ function getNextListId() { return ++listId; } -$.widget("ui.tabs", { +$.widget( "ui.tabs", { options: { add: null, ajaxOptions: null, @@ -34,619 +34,650 @@ $.widget("ui.tabs", { disable: null, disabled: [], enable: null, - event: 'click', + event: "click", fx: null, // e.g. { height: 'toggle', opacity: 'toggle', duration: 200 } - idPrefix: 'ui-tabs-', + idPrefix: "ui-tabs-", load: null, - panelTemplate: '
    ', + panelTemplate: "
    ", remove: null, select: null, show: null, - spinner: 'Loading…', - tabTemplate: '
  • #{label}
  • ' + spinner: "Loading…", + tabTemplate: "
  • #{label}
  • " }, + _create: function() { - this._tabify(true); + this._tabify( true ); }, - _setOption: function(key, value) { - if (key == 'selected') { - if (this.options.collapsible && value == this.options.selected) { + _setOption: function( key, value ) { + if ( key == "selected" ) { + if (this.options.collapsible && value == this.options.selected ) { return; } - this.select(value); - } - else { - this.options[key] = value; + this.select( value ); + } else { + this.options[ key ] = value; this._tabify(); } }, - _tabId: function(a) { - return a.title && a.title.replace(/\s/g, '_').replace(/[^A-Za-z0-9\-_:\.]/g, '') || + _tabId: function( a ) { + return a.title && a.title.replace( /\s/g, "_" ).replace( /[^\w\u00c0-\uFFFF-]/g, "" ) || this.options.idPrefix + getNextTabId(); }, - _sanitizeSelector: function(hash) { - return hash.replace(/:/g, '\\:'); // we need this because an id may contain a ":" + _sanitizeSelector: function( hash ) { + // we need this because an id may contain a ":" + return hash.replace( /:/g, "\\:" ); }, _cookie: function() { - var cookie = this.cookie || (this.cookie = this.options.cookie.name || 'ui-tabs-' + getNextListId()); - return $.cookie.apply(null, [cookie].concat($.makeArray(arguments))); + var cookie = this.cookie || + ( this.cookie = this.options.cookie.name || "ui-tabs-" + getNextListId() ); + return $.cookie.apply( null, [ cookie ].concat( $.makeArray( arguments ) ) ); }, - _ui: function(tab, panel) { + _ui: function( tab, panel ) { return { tab: tab, panel: panel, - index: this.anchors.index(tab) + index: this.anchors.index( tab ) }; }, _cleanup: function() { // restore all former loading tabs labels - this.lis.filter('.ui-state-processing').removeClass('ui-state-processing') - .find('span:data(label.tabs)') + this.lis.filter( ".ui-state-processing" ) + .removeClass( "ui-state-processing" ) + .find( "span:data(label.tabs)" ) .each(function() { - var el = $(this); - el.html(el.data('label.tabs')).removeData('label.tabs'); + var el = $( this ); + el.html( el.data( "label.tabs" ) ).removeData( "label.tabs" ); }); }, - _tabify: function(init) { - - this.list = this.element.find('ol,ul').eq(0); - this.lis = $('li:has(a[href])', this.list); - this.anchors = this.lis.map(function() { return $('a', this)[0]; }); - this.panels = $([]); + _tabify: function( init ) { + var self = this, + o = this.options, + fragmentId = /^#.+/; // Safari 2 reports '#' for an empty hash - var self = this, o = this.options; - - var fragmentId = /^#.+/; // Safari 2 reports '#' for an empty hash - this.anchors.each(function(i, a) { - var href = $(a).attr('href'); + this.list = this.element.find( "ol,ul" ).eq( 0 ); + this.lis = $( " > li:has(a[href])", this.list ); + this.anchors = this.lis.map(function() { + return $( "a", this )[ 0 ]; + }); + this.panels = $( [] ); + this.anchors.each(function( i, a ) { + var href = $( a ).attr( "href" ); // For dynamically created HTML that contains a hash as href IE < 8 expands // such href to the full page url with hash and then misinterprets tab as ajax. // Same consideration applies for an added tab with a fragment identifier // since a[href=#fragment-identifier] does unexpectedly not match. // Thus normalize href attribute... - var hrefBase = href.split('#')[0], baseEl; - if (hrefBase && (hrefBase === location.toString().split('#')[0] || - (baseEl = $('base')[0]) && hrefBase === baseEl.href)) { + var hrefBase = href.split( "#" )[ 0 ], + baseEl; + if ( hrefBase && ( hrefBase === location.toString().split( "#" )[ 0 ] || + ( baseEl = $( "base" )[ 0 ]) && hrefBase === baseEl.href ) ) { href = a.hash; a.href = href; } // inline tab - if (fragmentId.test(href)) { - self.panels = self.panels.add(self._sanitizeSelector(href)); - } - + if ( fragmentId.test( href ) ) { + self.panels = self.panels.add( self.element.find( self._sanitizeSelector( href ) ) ); // remote tab - else if (href != '#') { // prevent loading the page itself if href is just "#" - $.data(a, 'href.tabs', href); // required for restore on destroy + // prevent loading the page itself if href is just "#" + } else if ( href && href !== "#" ) { + // required for restore on destroy + $.data( a, "href.tabs", href ); // TODO until #3808 is fixed strip fragment identifier from url // (IE fails to load from such url) - $.data(a, 'load.tabs', href.replace(/#.*$/, '')); // mutable data - - var id = self._tabId(a); - a.href = '#' + id; - var $panel = $('#' + id); - if (!$panel.length) { - $panel = $(o.panelTemplate).attr('id', id).addClass('ui-tabs-panel ui-widget-content ui-corner-bottom') - .insertAfter(self.panels[i - 1] || self.list); - $panel.data('destroy.tabs', true); + $.data( a, "load.tabs", href.replace( /#.*$/, "" ) ); + + var id = self._tabId( a ); + a.href = "#" + id; + var $panel = self.element.find( "#" + id ); + if ( !$panel.length ) { + $panel = $( o.panelTemplate ) + .attr( "id", id ) + .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ) + .insertAfter( self.panels[ i - 1 ] || self.list ); + $panel.data( "destroy.tabs", true ); } - self.panels = self.panels.add($panel); - } - + self.panels = self.panels.add( $panel ); // invalid tab href - else { - o.disabled.push(i); + } else { + o.disabled.push( i ); } }); // initialization from scratch - if (init) { - + if ( init ) { // attach necessary classes for styling - this.element.addClass('ui-tabs ui-widget ui-widget-content ui-corner-all'); - this.list.addClass('ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all'); - this.lis.addClass('ui-state-default ui-corner-top'); - this.panels.addClass('ui-tabs-panel ui-widget-content ui-corner-bottom'); + this.element.addClass( "ui-tabs ui-widget ui-widget-content ui-corner-all" ); + this.list.addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" ); + this.lis.addClass( "ui-state-default ui-corner-top" ); + this.panels.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ); // Selected tab // use "selected" option or try to retrieve: // 1. from fragment identifier in url // 2. from cookie // 3. from selected class attribute on
  • - if (o.selected === undefined) { - if (location.hash) { - this.anchors.each(function(i, a) { - if (a.hash == location.hash) { + if ( o.selected === undefined ) { + if ( location.hash ) { + this.anchors.each(function( i, a ) { + if ( a.hash == location.hash ) { o.selected = i; - return false; // break + return false; } }); } - if (typeof o.selected != 'number' && o.cookie) { - o.selected = parseInt(self._cookie(), 10); + if ( typeof o.selected !== "number" && o.cookie ) { + o.selected = parseInt( self._cookie(), 10 ); } - if (typeof o.selected != 'number' && this.lis.filter('.ui-tabs-selected').length) { - o.selected = this.lis.index(this.lis.filter('.ui-tabs-selected')); + if ( typeof o.selected !== "number" && this.lis.filter( ".ui-tabs-selected" ).length ) { + o.selected = this.lis.index( this.lis.filter( ".ui-tabs-selected" ) ); } - o.selected = o.selected || (this.lis.length ? 0 : -1); - } - else if (o.selected === null) { // usage of null is deprecated, TODO remove in next release + o.selected = o.selected || ( this.lis.length ? 0 : -1 ); + } else if ( o.selected === null ) { // usage of null is deprecated, TODO remove in next release o.selected = -1; } // sanity check - default to first tab... - o.selected = ((o.selected >= 0 && this.anchors[o.selected]) || o.selected < 0) ? o.selected : 0; + o.selected = ( ( o.selected >= 0 && this.anchors[ o.selected ] ) || o.selected < 0 ) + ? o.selected + : 0; // Take disabling tabs via class attribute from HTML // into account and update option properly. // A selected tab cannot become disabled. - o.disabled = $.unique(o.disabled.concat( - $.map(this.lis.filter('.ui-state-disabled'), - function(n, i) { return self.lis.index(n); } ) - )).sort(); - - if ($.inArray(o.selected, o.disabled) != -1) { - o.disabled.splice($.inArray(o.selected, o.disabled), 1); + o.disabled = $.unique( o.disabled.concat( + $.map( this.lis.filter( ".ui-state-disabled" ), function( n, i ) { + return self.lis.index( n ); + }) + ) ).sort(); + + if ( $.inArray( o.selected, o.disabled ) != -1 ) { + o.disabled.splice( $.inArray( o.selected, o.disabled ), 1 ); } // highlight selected tab - this.panels.addClass('ui-tabs-hide'); - this.lis.removeClass('ui-tabs-selected ui-state-active'); - if (o.selected >= 0 && this.anchors.length) { // check for length avoids error when initializing empty list - this.panels.eq(o.selected).removeClass('ui-tabs-hide'); - this.lis.eq(o.selected).addClass('ui-tabs-selected ui-state-active'); + this.panels.addClass( "ui-tabs-hide" ); + this.lis.removeClass( "ui-tabs-selected ui-state-active" ); + // check for length avoids error when initializing empty list + if ( o.selected >= 0 && this.anchors.length ) { + self.element.find( self._sanitizeSelector( self.anchors[ o.selected ].hash ) ).removeClass( "ui-tabs-hide" ); + this.lis.eq( o.selected ).addClass( "ui-tabs-selected ui-state-active" ); // seems to be expected behavior that the show callback is fired - self.element.queue("tabs", function() { - self._trigger('show', null, self._ui(self.anchors[o.selected], self.panels[o.selected])); + self.element.queue( "tabs", function() { + self._trigger( "show", null, + self._ui( self.anchors[ o.selected ], self.element.find( self._sanitizeSelector( self.anchors[ o.selected ].hash ) )[ 0 ] ) ); }); - - this.load(o.selected); + + this.load( o.selected ); } // clean up to avoid memory leaks in certain versions of IE 6 - $(window).bind('unload', function() { - self.lis.add(self.anchors).unbind('.tabs'); + // TODO: namespace this event + $( window ).bind( "unload", function() { + self.lis.add( self.anchors ).unbind( ".tabs" ); self.lis = self.anchors = self.panels = null; }); - - } // update selected after add/remove - else { - o.selected = this.lis.index(this.lis.filter('.ui-tabs-selected')); + } else { + o.selected = this.lis.index( this.lis.filter( ".ui-tabs-selected" ) ); } // update collapsible - this.element[o.collapsible ? 'addClass' : 'removeClass']('ui-tabs-collapsible'); + // TODO: use .toggleClass() + this.element[ o.collapsible ? "addClass" : "removeClass" ]( "ui-tabs-collapsible" ); // set or update cookie after init and add/remove respectively - if (o.cookie) { - this._cookie(o.selected, o.cookie); + if ( o.cookie ) { + this._cookie( o.selected, o.cookie ); } // disable tabs - for (var i = 0, li; (li = this.lis[i]); i++) { - $(li)[$.inArray(i, o.disabled) != -1 && - !$(li).hasClass('ui-tabs-selected') ? 'addClass' : 'removeClass']('ui-state-disabled'); + for ( var i = 0, li; ( li = this.lis[ i ] ); i++ ) { + $( li )[ $.inArray( i, o.disabled ) != -1 && + // TODO: use .toggleClass() + !$( li ).hasClass( "ui-tabs-selected" ) ? "addClass" : "removeClass" ]( "ui-state-disabled" ); } // reset cache if switching from cached to not cached - if (o.cache === false) { - this.anchors.removeData('cache.tabs'); + if ( o.cache === false ) { + this.anchors.removeData( "cache.tabs" ); } // remove all handlers before, tabify may run on existing tabs after add or option change - this.lis.add(this.anchors).unbind('.tabs'); + this.lis.add( this.anchors ).unbind( ".tabs" ); - if (o.event != 'mouseover') { - var addState = function(state, el) { - if (el.is(':not(.ui-state-disabled)')) { - el.addClass('ui-state-' + state); + if ( o.event !== "mouseover" ) { + var addState = function( state, el ) { + if ( el.is( ":not(.ui-state-disabled)" ) ) { + el.addClass( "ui-state-" + state ); } }; - var removeState = function(state, el) { - el.removeClass('ui-state-' + state); + var removeState = function( state, el ) { + el.removeClass( "ui-state-" + state ); }; - this.lis.bind('mouseover.tabs', function() { - addState('hover', $(this)); + this.lis.bind( "mouseover.tabs" , function() { + addState( "hover", $( this ) ); }); - this.lis.bind('mouseout.tabs', function() { - removeState('hover', $(this)); + this.lis.bind( "mouseout.tabs", function() { + removeState( "hover", $( this ) ); }); - this.anchors.bind('focus.tabs', function() { - addState('focus', $(this).closest('li')); + this.anchors.bind( "focus.tabs", function() { + addState( "focus", $( this ).closest( "li" ) ); }); - this.anchors.bind('blur.tabs', function() { - removeState('focus', $(this).closest('li')); + this.anchors.bind( "blur.tabs", function() { + removeState( "focus", $( this ).closest( "li" ) ); }); } // set up animations var hideFx, showFx; - if (o.fx) { - if ($.isArray(o.fx)) { - hideFx = o.fx[0]; - showFx = o.fx[1]; - } - else { + if ( o.fx ) { + if ( $.isArray( o.fx ) ) { + hideFx = o.fx[ 0 ]; + showFx = o.fx[ 1 ]; + } else { hideFx = showFx = o.fx; } } // Reset certain styles left over from animation // and prevent IE's ClearType bug... - function resetStyle($el, fx) { - $el.css({ display: '' }); - if (!$.support.opacity && fx.opacity) { - $el[0].style.removeAttribute('filter'); + function resetStyle( $el, fx ) { + $el.css( "display", "" ); + if ( !$.support.opacity && fx.opacity ) { + $el[ 0 ].style.removeAttribute( "filter" ); } } // Show a tab... - var showTab = showFx ? - function(clicked, $show) { - $(clicked).closest('li').addClass('ui-tabs-selected ui-state-active'); - $show.hide().removeClass('ui-tabs-hide') // avoid flicker that way - .animate(showFx, showFx.duration || 'normal', function() { - resetStyle($show, showFx); - self._trigger('show', null, self._ui(clicked, $show[0])); + var showTab = showFx + ? function( clicked, $show ) { + $( clicked ).closest( "li" ).addClass( "ui-tabs-selected ui-state-active" ); + $show.hide().removeClass( "ui-tabs-hide" ) // avoid flicker that way + .animate( showFx, showFx.duration || "normal", function() { + resetStyle( $show, showFx ); + self._trigger( "show", null, self._ui( clicked, $show[ 0 ] ) ); }); - } : - function(clicked, $show) { - $(clicked).closest('li').addClass('ui-tabs-selected ui-state-active'); - $show.removeClass('ui-tabs-hide'); - self._trigger('show', null, self._ui(clicked, $show[0])); + } + : function( clicked, $show ) { + $( clicked ).closest( "li" ).addClass( "ui-tabs-selected ui-state-active" ); + $show.removeClass( "ui-tabs-hide" ); + self._trigger( "show", null, self._ui( clicked, $show[ 0 ] ) ); }; // Hide a tab, $show is optional... - var hideTab = hideFx ? - function(clicked, $hide) { - $hide.animate(hideFx, hideFx.duration || 'normal', function() { - self.lis.removeClass('ui-tabs-selected ui-state-active'); - $hide.addClass('ui-tabs-hide'); - resetStyle($hide, hideFx); - self.element.dequeue("tabs"); + var hideTab = hideFx + ? function( clicked, $hide ) { + $hide.animate( hideFx, hideFx.duration || "normal", function() { + self.lis.removeClass( "ui-tabs-selected ui-state-active" ); + $hide.addClass( "ui-tabs-hide" ); + resetStyle( $hide, hideFx ); + self.element.dequeue( "tabs" ); }); - } : - function(clicked, $hide, $show) { - self.lis.removeClass('ui-tabs-selected ui-state-active'); - $hide.addClass('ui-tabs-hide'); - self.element.dequeue("tabs"); + } + : function( clicked, $hide, $show ) { + self.lis.removeClass( "ui-tabs-selected ui-state-active" ); + $hide.addClass( "ui-tabs-hide" ); + self.element.dequeue( "tabs" ); }; // attach tab event handler, unbind to avoid duplicates from former tabifying... - this.anchors.bind(o.event + '.tabs', function() { - var el = this, $li = $(this).closest('li'), $hide = self.panels.filter(':not(.ui-tabs-hide)'), - $show = $(self._sanitizeSelector(this.hash)); + this.anchors.bind( o.event + ".tabs", function() { + var el = this, + $li = $(el).closest( "li" ), + $hide = self.panels.filter( ":not(.ui-tabs-hide)" ), + $show = self.element.find( self._sanitizeSelector( el.hash ) ); // If tab is already selected and not collapsible or tab disabled or // or is already loading or click callback returns false stop here. // Check if click handler returns false last so that it is not executed // for a disabled or loading tab! - if (($li.hasClass('ui-tabs-selected') && !o.collapsible) || - $li.hasClass('ui-state-disabled') || - $li.hasClass('ui-state-processing') || - self._trigger('select', null, self._ui(this, $show[0])) === false) { + if ( ( $li.hasClass( "ui-tabs-selected" ) && !o.collapsible) || + $li.hasClass( "ui-state-disabled" ) || + $li.hasClass( "ui-state-processing" ) || + self.panels.filter( ":animated" ).length || + self._trigger( "select", null, self._ui( this, $show[ 0 ] ) ) === false ) { this.blur(); return false; } - o.selected = self.anchors.index(this); + o.selected = self.anchors.index( this ); self.abort(); // if tab may be closed - if (o.collapsible) { - if ($li.hasClass('ui-tabs-selected')) { + if ( o.collapsible ) { + if ( $li.hasClass( "ui-tabs-selected" ) ) { o.selected = -1; - if (o.cookie) { - self._cookie(o.selected, o.cookie); + if ( o.cookie ) { + self._cookie( o.selected, o.cookie ); } - self.element.queue("tabs", function() { - hideTab(el, $hide); - }).dequeue("tabs"); - + self.element.queue( "tabs", function() { + hideTab( el, $hide ); + }).dequeue( "tabs" ); + this.blur(); return false; - } - else if (!$hide.length) { - if (o.cookie) { - self._cookie(o.selected, o.cookie); + } else if ( !$hide.length ) { + if ( o.cookie ) { + self._cookie( o.selected, o.cookie ); } - - self.element.queue("tabs", function() { - showTab(el, $show); + + self.element.queue( "tabs", function() { + showTab( el, $show ); }); - self.load(self.anchors.index(this)); // TODO make passing in node possible, see also http://dev.jqueryui.com/ticket/3171 - + // TODO make passing in node possible, see also http://dev.jqueryui.com/ticket/3171 + self.load( self.anchors.index( this ) ); + this.blur(); return false; } } - if (o.cookie) { - self._cookie(o.selected, o.cookie); + if ( o.cookie ) { + self._cookie( o.selected, o.cookie ); } // show new tab - if ($show.length) { - if ($hide.length) { - self.element.queue("tabs", function() { - hideTab(el, $hide); + if ( $show.length ) { + if ( $hide.length ) { + self.element.queue( "tabs", function() { + hideTab( el, $hide ); }); } - self.element.queue("tabs", function() { - showTab(el, $show); + self.element.queue( "tabs", function() { + showTab( el, $show ); }); - - self.load(self.anchors.index(this)); - } - else { - throw 'jQuery UI Tabs: Mismatching fragment identifier.'; + + self.load( self.anchors.index( this ) ); + } else { + throw "jQuery UI Tabs: Mismatching fragment identifier."; } // Prevent IE from keeping other link focussed when using the back button // and remove dotted border from clicked link. This is controlled via CSS // in modern browsers; blur() removes focus from address bar in Firefox // which can become a usability and annoying problem with tabs('rotate'). - if ($.browser.msie) { + if ( $.browser.msie ) { this.blur(); } - }); // disable click in any case - this.anchors.bind('click.tabs', function(){return false;}); + this.anchors.bind( "click.tabs", function(){ + return false; + }); + }, + + _getIndex: function( index ) { + // meta-function to give users option to provide a href string instead of a numerical index. + // also sanitizes numerical indexes to valid values. + if ( typeof index == "string" ) { + index = this.anchors.index( this.anchors.filter( "[href$=" + index + "]" ) ); + } + return index; }, destroy: function() { var o = this.options; this.abort(); - - this.element.unbind('.tabs') - .removeClass('ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible') - .removeData('tabs'); - this.list.removeClass('ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all'); + this.element + .unbind( ".tabs" ) + .removeClass( "ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible" ) + .removeData( "tabs" ); + + this.list.removeClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" ); this.anchors.each(function() { - var href = $.data(this, 'href.tabs'); - if (href) { + var href = $.data( this, "href.tabs" ); + if ( href ) { this.href = href; } - var $this = $(this).unbind('.tabs'); - $.each(['href', 'load', 'cache'], function(i, prefix) { - $this.removeData(prefix + '.tabs'); + var $this = $( this ).unbind( ".tabs" ); + $.each( [ "href", "load", "cache" ], function( i, prefix ) { + $this.removeData( prefix + ".tabs" ); }); }); - this.lis.unbind('.tabs').add(this.panels).each(function() { - if ($.data(this, 'destroy.tabs')) { - $(this).remove(); - } - else { - $(this).removeClass([ - 'ui-state-default', - 'ui-corner-top', - 'ui-tabs-selected', - 'ui-state-active', - 'ui-state-hover', - 'ui-state-focus', - 'ui-state-disabled', - 'ui-tabs-panel', - 'ui-widget-content', - 'ui-corner-bottom', - 'ui-tabs-hide' - ].join(' ')); + this.lis.unbind( ".tabs" ).add( this.panels ).each(function() { + if ( $.data( this, "destroy.tabs" ) ) { + $( this ).remove(); + } else { + $( this ).removeClass([ + "ui-state-default", + "ui-corner-top", + "ui-tabs-selected", + "ui-state-active", + "ui-state-hover", + "ui-state-focus", + "ui-state-disabled", + "ui-tabs-panel", + "ui-widget-content", + "ui-corner-bottom", + "ui-tabs-hide" + ].join( " " ) ); } }); - if (o.cookie) { - this._cookie(null, o.cookie); + if ( o.cookie ) { + this._cookie( null, o.cookie ); } return this; }, - add: function(url, label, index) { - if (index === undefined) { - index = this.anchors.length; // append by default + add: function( url, label, index ) { + if ( index === undefined ) { + index = this.anchors.length; } - var self = this, o = this.options, - $li = $(o.tabTemplate.replace(/#\{href\}/g, url).replace(/#\{label\}/g, label)), - id = !url.indexOf('#') ? url.replace('#', '') : this._tabId($('a', $li)[0]); + var self = this, + o = this.options, + $li = $( o.tabTemplate.replace( /#\{href\}/g, url ).replace( /#\{label\}/g, label ) ), + id = !url.indexOf( "#" ) ? url.replace( "#", "" ) : this._tabId( $( "a", $li )[ 0 ] ); - $li.addClass('ui-state-default ui-corner-top').data('destroy.tabs', true); + $li.addClass( "ui-state-default ui-corner-top" ).data( "destroy.tabs", true ); // try to find an existing element before creating a new one - var $panel = $('#' + id); - if (!$panel.length) { - $panel = $(o.panelTemplate).attr('id', id).data('destroy.tabs', true); - } - $panel.addClass('ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide'); - - if (index >= this.lis.length) { - $li.appendTo(this.list); - $panel.appendTo(this.list[0].parentNode); + var $panel = self.element.find( "#" + id ); + if ( !$panel.length ) { + $panel = $( o.panelTemplate ) + .attr( "id", id ) + .data( "destroy.tabs", true ); } - else { - $li.insertBefore(this.lis[index]); - $panel.insertBefore(this.panels[index]); + $panel.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide" ); + + if ( index >= this.lis.length ) { + $li.appendTo( this.list ); + $panel.appendTo( this.list[ 0 ].parentNode ); + } else { + $li.insertBefore( this.lis[ index ] ); + $panel.insertBefore( this.panels[ index ] ); } - o.disabled = $.map(o.disabled, - function(n, i) { return n >= index ? ++n : n; }); + o.disabled = $.map( o.disabled, function( n, i ) { + return n >= index ? ++n : n; + }); this._tabify(); - if (this.anchors.length == 1) { // after tabify + if ( this.anchors.length == 1 ) { o.selected = 0; - $li.addClass('ui-tabs-selected ui-state-active'); - $panel.removeClass('ui-tabs-hide'); - this.element.queue("tabs", function() { - self._trigger('show', null, self._ui(self.anchors[0], self.panels[0])); + $li.addClass( "ui-tabs-selected ui-state-active" ); + $panel.removeClass( "ui-tabs-hide" ); + this.element.queue( "tabs", function() { + self._trigger( "show", null, self._ui( self.anchors[ 0 ], self.panels[ 0 ] ) ); }); - - this.load(0); + + this.load( 0 ); } - // callback - this._trigger('add', null, this._ui(this.anchors[index], this.panels[index])); + this._trigger( "add", null, this._ui( this.anchors[ index ], this.panels[ index ] ) ); return this; }, - remove: function(index) { - var o = this.options, $li = this.lis.eq(index).remove(), - $panel = this.panels.eq(index).remove(); + remove: function( index ) { + index = this._getIndex( index ); + var o = this.options, + $li = this.lis.eq( index ).remove(), + $panel = this.panels.eq( index ).remove(); // If selected tab was removed focus tab to the right or // in case the last tab was removed the tab to the left. - if ($li.hasClass('ui-tabs-selected') && this.anchors.length > 1) { - this.select(index + (index + 1 < this.anchors.length ? 1 : -1)); + if ( $li.hasClass( "ui-tabs-selected" ) && this.anchors.length > 1) { + this.select( index + ( index + 1 < this.anchors.length ? 1 : -1 ) ); } - o.disabled = $.map($.grep(o.disabled, function(n, i) { return n != index; }), - function(n, i) { return n >= index ? --n : n; }); + o.disabled = $.map( + $.grep( o.disabled, function(n, i) { + return n != index; + }), + function( n, i ) { + return n >= index ? --n : n; + }); this._tabify(); - // callback - this._trigger('remove', null, this._ui($li.find('a')[0], $panel[0])); + this._trigger( "remove", null, this._ui( $li.find( "a" )[ 0 ], $panel[ 0 ] ) ); return this; }, - enable: function(index) { + enable: function( index ) { + index = this._getIndex( index ); var o = this.options; - if ($.inArray(index, o.disabled) == -1) { + if ( $.inArray( index, o.disabled ) == -1 ) { return; } - this.lis.eq(index).removeClass('ui-state-disabled'); - o.disabled = $.grep(o.disabled, function(n, i) { return n != index; }); + this.lis.eq( index ).removeClass( "ui-state-disabled" ); + o.disabled = $.grep( o.disabled, function( n, i ) { + return n != index; + }); - // callback - this._trigger('enable', null, this._ui(this.anchors[index], this.panels[index])); + this._trigger( "enable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) ); return this; }, - disable: function(index) { + disable: function( index ) { + index = this._getIndex( index ); var self = this, o = this.options; - if (index != o.selected) { // cannot disable already selected tab - this.lis.eq(index).addClass('ui-state-disabled'); + // cannot disable already selected tab + if ( index != o.selected ) { + this.lis.eq( index ).addClass( "ui-state-disabled" ); - o.disabled.push(index); + o.disabled.push( index ); o.disabled.sort(); - // callback - this._trigger('disable', null, this._ui(this.anchors[index], this.panels[index])); + this._trigger( "disable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) ); } return this; }, - select: function(index) { - if (typeof index == 'string') { - index = this.anchors.index(this.anchors.filter('[href$=' + index + ']')); - } - else if (index === null) { // usage of null is deprecated, TODO remove in next release - index = -1; - } - if (index == -1 && this.options.collapsible) { - index = this.options.selected; + select: function( index ) { + index = this._getIndex( index ); + if ( index == -1 ) { + if ( this.options.collapsible && this.options.selected != -1 ) { + index = this.options.selected; + } else { + return this; + } } - - this.anchors.eq(index).trigger(this.options.event + '.tabs'); + this.anchors.eq( index ).trigger( this.options.event + ".tabs" ); return this; }, - load: function(index) { - var self = this, o = this.options, a = this.anchors.eq(index)[0], url = $.data(a, 'load.tabs'); + load: function( index ) { + index = this._getIndex( index ); + var self = this, + o = this.options, + a = this.anchors.eq( index )[ 0 ], + url = $.data( a, "load.tabs" ); this.abort(); // not remote or from cache - if (!url || this.element.queue("tabs").length !== 0 && $.data(a, 'cache.tabs')) { - this.element.dequeue("tabs"); + if ( !url || this.element.queue( "tabs" ).length !== 0 && $.data( a, "cache.tabs" ) ) { + this.element.dequeue( "tabs" ); return; } // load remote from here on - this.lis.eq(index).addClass('ui-state-processing'); + this.lis.eq( index ).addClass( "ui-state-processing" ); - if (o.spinner) { - var span = $('span', a); - span.data('label.tabs', span.html()).html(o.spinner); + if ( o.spinner ) { + var span = $( "span", a ); + span.data( "label.tabs", span.html() ).html( o.spinner ); } - this.xhr = $.ajax($.extend({}, o.ajaxOptions, { + this.xhr = $.ajax( $.extend( {}, o.ajaxOptions, { url: url, - success: function(r, s) { - $(self._sanitizeSelector(a.hash)).html(r); + success: function( r, s ) { + self.element.find( self._sanitizeSelector( a.hash ) ).html( r ); // take care of tab labels self._cleanup(); - if (o.cache) { - $.data(a, 'cache.tabs', true); // if loaded once do not load them again + if ( o.cache ) { + $.data( a, "cache.tabs", true ); } - // callbacks - self._trigger('load', null, self._ui(self.anchors[index], self.panels[index])); + self._trigger( "load", null, self._ui( self.anchors[ index ], self.panels[ index ] ) ); try { - o.ajaxOptions.success(r, s); + o.ajaxOptions.success( r, s ); } - catch (e) {} + catch ( e ) {} }, - error: function(xhr, s, e) { + error: function( xhr, s, e ) { // take care of tab labels self._cleanup(); - // callbacks - self._trigger('load', null, self._ui(self.anchors[index], self.panels[index])); + self._trigger( "load", null, self._ui( self.anchors[ index ], self.panels[ index ] ) ); try { // Passing index avoid a race condition when this method is // called after the user has selected another tab. // Pass the anchor that initiated this request allows // loadError to manipulate the tab content panel via $(a.hash) - o.ajaxOptions.error(xhr, s, index, a); + o.ajaxOptions.error( xhr, s, index, a ); } - catch (e) {} + catch ( e ) {} } - })); + } ) ); // last, so that load event is fired before show... - self.element.dequeue("tabs"); + self.element.dequeue( "tabs" ); return this; }, abort: function() { // stop possibly running animations - this.element.queue([]); - this.panels.stop(false, true); + this.element.queue( [] ); + this.panels.stop( false, true ); // "tabs" queue must not contain more than two elements, // which are the callbacks for the latest clicked tab... - this.element.queue("tabs", this.element.queue("tabs").splice(-2, 2)); + this.element.queue( "tabs", this.element.queue( "tabs" ).splice( -2, 2 ) ); // terminate pending requests from other tabs - if (this.xhr) { + if ( this.xhr ) { this.xhr.abort(); delete this.xhr; } @@ -656,19 +687,18 @@ $.widget("ui.tabs", { return this; }, - url: function(index, url) { - this.anchors.eq(index).removeData('cache.tabs').data('load.tabs', url); + url: function( index, url ) { + this.anchors.eq( index ).removeData( "cache.tabs" ).data( "load.tabs", url ); return this; }, length: function() { return this.anchors.length; } - }); -$.extend($.ui.tabs, { - version: '1.8.2' +$.extend( $.ui.tabs, { + version: "1.8.11" }); /* @@ -678,46 +708,45 @@ $.extend($.ui.tabs, { /* * Rotate */ -$.extend($.ui.tabs.prototype, { +$.extend( $.ui.tabs.prototype, { rotation: null, - rotate: function(ms, continuing) { + rotate: function( ms, continuing ) { + var self = this, + o = this.options; - var self = this, o = this.options; - - var rotate = self._rotate || (self._rotate = function(e) { - clearTimeout(self.rotation); + var rotate = self._rotate || ( self._rotate = function( e ) { + clearTimeout( self.rotation ); self.rotation = setTimeout(function() { var t = o.selected; self.select( ++t < self.anchors.length ? t : 0 ); - }, ms); + }, ms ); - if (e) { + if ( e ) { e.stopPropagation(); } }); - - var stop = self._unrotate || (self._unrotate = !continuing ? - function(e) { + + var stop = self._unrotate || ( self._unrotate = !continuing + ? function(e) { if (e.clientX) { // in case of a true click self.rotate(null); } - } : - function(e) { + } + : function( e ) { t = o.selected; rotate(); }); // start rotation - if (ms) { - this.element.bind('tabsshow', rotate); - this.anchors.bind(o.event + '.tabs', stop); + if ( ms ) { + this.element.bind( "tabsshow", rotate ); + this.anchors.bind( o.event + ".tabs", stop ); rotate(); - } // stop rotation - else { - clearTimeout(self.rotation); - this.element.unbind('tabsshow', rotate); - this.anchors.unbind(o.event + '.tabs', stop); + } else { + clearTimeout( self.rotation ); + this.element.unbind( "tabsshow", rotate ); + this.anchors.unbind( o.event + ".tabs", stop ); delete this._rotate; delete this._unrotate; } @@ -726,4 +755,4 @@ $.extend($.ui.tabs.prototype, { } }); -})(jQuery); +})( jQuery ); diff --git a/resources/jquery.ui/jquery.ui.widget.js b/resources/jquery.ui/jquery.ui.widget.js index 6425d086..b6b1beea 100644 --- a/resources/jquery.ui/jquery.ui.widget.js +++ b/resources/jquery.ui/jquery.ui.widget.js @@ -1,28 +1,38 @@ /*! - * jQuery UI Widget 1.8.2 + * jQuery UI Widget 1.8.11 * - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT (MIT-LICENSE.txt) - * and GPL (GPL-LICENSE.txt) licenses. + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license * * http://docs.jquery.com/UI/Widget */ -(function( $ ) { - -var _remove = $.fn.remove; - -$.fn.remove = function( selector, keepData ) { - return this.each(function() { - if ( !keepData ) { - if ( !selector || $.filter( selector, [ this ] ).length ) { - $( "*", this ).add( this ).each(function() { - $( this ).triggerHandler( "remove" ); - }); - } +(function( $, undefined ) { + +// jQuery 1.4+ +if ( $.cleanData ) { + var _cleanData = $.cleanData; + $.cleanData = function( elems ) { + for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { + $( elem ).triggerHandler( "remove" ); } - return _remove.call( $(this), selector, keepData ); - }); -}; + _cleanData( elems ); + }; +} else { + var _remove = $.fn.remove; + $.fn.remove = function( selector, keepData ) { + return this.each(function() { + if ( !keepData ) { + if ( !selector || $.filter( selector, [ this ] ).length ) { + $( "*", this ).add( [ this ] ).each(function() { + $( this ).triggerHandler( "remove" ); + }); + } + } + return _remove.call( $(this), selector, keepData ); + }); + }; +} $.widget = function( name, base, prototype ) { var namespace = name.split( "." )[ 0 ], @@ -57,7 +67,7 @@ $.widget = function( name, base, prototype ) { // basePrototype[ key ] = $.extend( {}, val ); // } // }); - basePrototype.options = $.extend( {}, basePrototype.options ); + basePrototype.options = $.extend( true, {}, basePrototype.options ); $[ namespace ][ name ].prototype = $.extend( true, basePrototype, { namespace: namespace, widgetName: name, @@ -80,7 +90,7 @@ $.widget.bridge = function( name, object ) { options; // prevent calls to internal methods - if ( isMethodCall && options.substring( 0, 1 ) === "_" ) { + if ( isMethodCall && options.charAt( 0 ) === "_" ) { return returnValue; } @@ -90,6 +100,15 @@ $.widget.bridge = function( name, object ) { methodValue = instance && $.isFunction( instance[options] ) ? instance[ options ].apply( instance, args ) : instance; + // TODO: add this back in 1.9 and use $.error() (see #5972) +// if ( !instance ) { +// throw "cannot call methods on " + name + " prior to initialization; " + +// "attempted to call method '" + options + "'"; +// } +// if ( !$.isFunction( instance[options] ) ) { +// throw "no such method '" + options + "' for " + name + " widget instance"; +// } +// var methodValue = instance[ options ].apply( instance, args ); if ( methodValue !== instance && methodValue !== undefined ) { returnValue = methodValue; return false; @@ -99,10 +118,7 @@ $.widget.bridge = function( name, object ) { this.each(function() { var instance = $.data( this, name ); if ( instance ) { - if ( options ) { - instance.option( options ); - } - instance._init(); + instance.option( options || {} )._init(); } else { $.data( this, name, new object( options, this ) ); } @@ -129,10 +145,11 @@ $.Widget.prototype = { _createWidget: function( options, element ) { // $.widget.bridge stores the plugin instance, but we do it anyway // so that it's stored even before the _create function runs - this.element = $( element ).data( this.widgetName, this ); + $.data( element, this.widgetName, this ); + this.element = $( element ); this.options = $.extend( true, {}, this.options, - $.metadata && $.metadata.get( element )[ this.widgetName ], + this._getCreateOptions(), options ); var self = this; @@ -141,8 +158,12 @@ $.Widget.prototype = { }); this._create(); + this._trigger( "create" ); this._init(); }, + _getCreateOptions: function() { + return $.metadata && $.metadata.get( this.element[0] )[ this.widgetName ]; + }, _create: function() {}, _init: function() {}, @@ -163,12 +184,11 @@ $.Widget.prototype = { }, option: function( key, value ) { - var options = key, - self = this; + var options = key; if ( arguments.length === 0 ) { // don't return a reference to the internal hash - return $.extend( {}, self.options ); + return $.extend( {}, this.options ); } if (typeof key === "string" ) { @@ -179,11 +199,17 @@ $.Widget.prototype = { options[ key ] = value; } + this._setOptions( options ); + + return this; + }, + _setOptions: function( options ) { + var self = this; $.each( options, function( key, value ) { self._setOption( key, value ); }); - return self; + return this; }, _setOption: function( key, value ) { this.options[ key ] = value; diff --git a/resources/jquery.ui/themes/default/jquery.ui.autocomplete.css b/resources/jquery.ui/themes/default/jquery.ui.autocomplete.css index 5957f78f..f287dbe9 100644 --- a/resources/jquery.ui/themes/default/jquery.ui.autocomplete.css +++ b/resources/jquery.ui/themes/default/jquery.ui.autocomplete.css @@ -13,6 +13,7 @@ padding: 2px; margin: 0; display:block; + float: left; } .ui-menu .ui-menu { margin-top: -3px; diff --git a/resources/jquery.ui/themes/default/jquery.ui.datepicker.css b/resources/jquery.ui/themes/default/jquery.ui.datepicker.css index a1116e69..580a2929 100644 --- a/resources/jquery.ui/themes/default/jquery.ui.datepicker.css +++ b/resources/jquery.ui/themes/default/jquery.ui.datepicker.css @@ -35,17 +35,17 @@ .ui-datepicker-row-break { clear:both; width:100%; } /* RTL support */ -.ui-datepicker-rtl { direction: rtl; } -.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; } -.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; } -.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; } -.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; } -.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; } -.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; } -.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; } -.ui-datepicker-rtl .ui-datepicker-group { float:right; } -.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; } -.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; } +/* @noflip */ .ui-datepicker-rtl { direction: rtl; } +/* @noflip */ .ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; } +/* @noflip */ .ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; } +/* @noflip */ .ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; } +/* @noflip */ .ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; } +/* @noflip */ .ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; } +/* @noflip */ .ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; } +/* @noflip */ .ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; } +/* @noflip */ .ui-datepicker-rtl .ui-datepicker-group { float:right; } +/* @noflip */ .ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; } +/* @noflip */ .ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; } /* IE6 IFRAME FIX (taken from datepicker 1.5.3 */ .ui-datepicker-cover { diff --git a/resources/jquery.ui/themes/vector/jquery.ui.autocomplete.css b/resources/jquery.ui/themes/vector/jquery.ui.autocomplete.css index 6610a878..c06fd18a 100644 --- a/resources/jquery.ui/themes/vector/jquery.ui.autocomplete.css +++ b/resources/jquery.ui/themes/vector/jquery.ui.autocomplete.css @@ -13,6 +13,7 @@ padding: 2px; margin: 0; display:block; + float: left; } .ui-menu .ui-menu { margin-top: -3px; diff --git a/resources/jquery.ui/themes/vector/jquery.ui.button.css b/resources/jquery.ui/themes/vector/jquery.ui.button.css index 5507c42b..631fa756 100644 --- a/resources/jquery.ui/themes/vector/jquery.ui.button.css +++ b/resources/jquery.ui/themes/vector/jquery.ui.button.css @@ -8,19 +8,23 @@ button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a l button.ui-button-icons-only { width: 3.7em; } /*button text element */ -.ui-button .ui-button-text { display: block; line-height: 1.4; } -.ui-button-text-only .ui-button-text { padding: .125em .25em; } -.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; } -.ui-button-text-icon .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; } +.ui-button .ui-button-text { display: block; line-height: 1.4em; } +.ui-button-text-only .ui-button-text { padding: 0.3em 1em 0.25em 1em; } +.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: 0.3em; text-indent: -9999999px; } +.ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: 0.3em 1em 0.25em 2.1em; } +.ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: 0.3em 2.1em 0.25em 1em; } .ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; } +/* for older versions of jQuery UI */ +.ui-button-text-icon .ui-button-text { padding: 0.3em 1em 0.3em 2.1em; } + /* no icon support for input elements, provide padding by default */ -input.ui-button { padding: .4em 1em; } +input.ui-button { padding: 0.3em 1em; } /*button icon element(s) */ -.ui-button-icon-only .ui-icon, .ui-button-text-icon .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; } +.ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-text-icon .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -9px; } .ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; } -.ui-button-text-icon .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; } -.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; } +.ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icon .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: 0.5em; } +.ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icon .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: 0.5em; } /*button sets*/ .ui-buttonset { margin-right: 7px; } @@ -29,10 +33,10 @@ input.ui-button { padding: .4em 1em; } /* workarounds */ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */ -body button.ui-button { +body .ui-button { -moz-border-radius: 4px; -webkit-border-radius: 4px; - padding: 0.2em 0.6em 0.15em !important; + border-radius: 4px; margin: 0.5em 0 0.5em 0.4em !important; border: 1px solid #a6a6a6 !important; /* @embed */ @@ -43,18 +47,18 @@ body button.ui-button { width: auto; overflow: visible; } -body button.ui-button:hover { +body .ui-button:hover { border-color: #6e7273; /* @embed */ background: #e1e1e1 url(images/button-over.png) repeat-x scroll 50% 100% !important; } -body button.ui-button:active, -body button.ui-button:focus { +body .ui-button:active, +body .ui-button:focus { border-color: #707271; /* @embed */ background: #bfbfbf url(images/button-down.png) repeat-x scroll 50% 100% !important; } -body button.ui-button.disabled { +body .ui-button.disabled { color: #7f7f7f; border-color: #cccccc; /* @embed */ @@ -67,24 +71,24 @@ body button.ui-button::-moz-focus-inner { /* Green buttons */ -body button.ui-button.ui-button-green { +body .ui-button.ui-button-green { color: white; border-color: #97af7e !important; /* @embed */ background: #85c940 url(images/button-off-green.png) repeat-x scroll 50% 100% !important; } -body button.ui-button.ui-button-green:hover { +body .ui-button.ui-button-green:hover { border-color: #778e61; /* @embed */ background: #77ad40 url(images/button-over-green.png) repeat-x scroll 50% 100% !important; } -body button.ui-button.ui-button-green:active, -body button.ui-button.ui-button-green:focus { +body .ui-button.ui-button-green:active, +body .ui-button.ui-button-green:focus { border-color: #61b000; /* @embed */ background: #54a800 url(images/button-down-green.png) repeat-x scroll 50% 100% !important; } -body button.ui-button.ui-button-green.disabled { +body .ui-button.ui-button-green.disabled { color: #7f7f7f; border-color: #b8d29f; /* @embed */ @@ -93,24 +97,24 @@ body button.ui-button.ui-button-green.disabled { /* Blue buttons */ -body button.ui-button.ui-button-blue { +body .ui-button.ui-button-blue { color: white; border-color: #407ec9 !important; /* @embed */ background: #407ec9 url(images/button-off-blue.png) repeat-x scroll 50% 100% !important; } -body button.ui-button.ui-button-blue:hover { +body .ui-button.ui-button-blue:hover { border-color: #245289; /* @embed */ background: #4071ad url(images/button-over-blue.png) repeat-x scroll 50% 100% !important; } -body button.ui-button.ui-button-blue:active, -body button.ui-button.ui-button-blue:focus { +body .ui-button.ui-button-blue:active, +body .ui-button.ui-button-blue:focus { border-color: #003980; /* @embed */ background: #004daa url(images/button-down-blue.png) repeat-x scroll 50% 100% !important; } -body button.ui-button.ui-button-blue.disabled { +body .ui-button.ui-button-blue.disabled { border-color: #9eafc6; /* @embed */ background: #c3c8cf url(images/button-disabled-blue.png) repeat-x scroll 50% 100% !important; @@ -118,24 +122,24 @@ body button.ui-button.ui-button-blue.disabled { /* Red buttons */ -body button.ui-button.ui-button-red { +body .ui-button.ui-button-red { color: white; border-color: #af977e !important; /* @embed */ background: #c9404c url(images/button-off-red.png) repeat-x scroll 50% 100% !important; } -body button.ui-button.ui-button-red:hover { +body .ui-button.ui-button-red:hover { border-color: #8e7761; /* @embed */ background: #ad404a url(images/button-over-red.png) repeat-x scroll 50% 100% !important; } -body button.ui-button.ui-button-red:active, -body button.ui-button.ui-button-red:focus { +body .ui-button.ui-button-red:active, +body .ui-button.ui-button-red:focus { border-color: #b06100; /* @embed */ background: #aa000f url(images/button-down-red.png) repeat-x scroll 50% 100% !important; } -body button.ui-button.ui-button-red.disabled { +body .ui-button.ui-button-red.disabled { color: #7f7f7f; border-color: #c3acae; /* @embed */ diff --git a/resources/jquery.ui/themes/vector/jquery.ui.datepicker.css b/resources/jquery.ui/themes/vector/jquery.ui.datepicker.css index a1116e69..81022250 100644 --- a/resources/jquery.ui/themes/vector/jquery.ui.datepicker.css +++ b/resources/jquery.ui/themes/vector/jquery.ui.datepicker.css @@ -10,7 +10,7 @@ .ui-datepicker .ui-datepicker-next-hover { right:1px; } .ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; } .ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; } -.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; } +.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; padding:1px 0; } .ui-datepicker select.ui-datepicker-month-year {width: 100%;} .ui-datepicker select.ui-datepicker-month, .ui-datepicker select.ui-datepicker-year { width: 49%;} @@ -18,7 +18,7 @@ .ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; } .ui-datepicker td { border: 0; padding: 1px; } .ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; } -.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; } +.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .2em 0 0 0; padding: 0 .2em; border-top: 1px solid #DDDDDD; border-left: 0; border-right: 0; border-bottom: 0; } .ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; } .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; } @@ -35,17 +35,17 @@ .ui-datepicker-row-break { clear:both; width:100%; } /* RTL support */ -.ui-datepicker-rtl { direction: rtl; } -.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; } -.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; } -.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; } -.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; } -.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; } -.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; } -.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; } -.ui-datepicker-rtl .ui-datepicker-group { float:right; } -.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; } -.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; } +/* @noflip */ .ui-datepicker-rtl { direction: rtl; } +/* @noflip */ .ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; } +/* @noflip */ .ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; } +/* @noflip */ .ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; } +/* @noflip */ .ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; } +/* @noflip */ .ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; } +/* @noflip */ .ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; } +/* @noflip */ .ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; } +/* @noflip */ .ui-datepicker-rtl .ui-datepicker-group { float:right; } +/* @noflip */ .ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; } +/* @noflip */ .ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; } /* IE6 IFRAME FIX (taken from datepicker 1.5.3 */ .ui-datepicker-cover { diff --git a/resources/jquery.ui/themes/vector/jquery.ui.theme.css b/resources/jquery.ui/themes/vector/jquery.ui.theme.css index 26551213..e39371de 100644 --- a/resources/jquery.ui/themes/vector/jquery.ui.theme.css +++ b/resources/jquery.ui/themes/vector/jquery.ui.theme.css @@ -13,9 +13,9 @@ .ui-widget { font-family: sans-serif; font-size: 0.8em; } .ui-widget .ui-widget { font-size: 1em; } .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: sans-serif; font-size: 1em; } -.ui-widget-content { border: none; /* @embed */ background: #f2f5f7 url(images/ui-bg_highlight-hard_100_f2f5f7_1x100.png) 50% top repeat-x; color: #362b36; } +.ui-widget-content { border: 1px solid #cccccc; /* @embed */ background: #f2f5f7 url(images/ui-bg_highlight-hard_100_f2f5f7_1x100.png) 50% top repeat-x; color: #362b36; } .ui-widget-content a { color: #362b36; } -.ui-widget-header { border: 1px solid #aed0ea; line-height: 1em; /* @embed */ background: #ffffff url(images/ui-bg_highlight-soft_100_ffffff_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold; } +.ui-widget-header { border-bottom: 1px solid #bbbbbb; line-height: 1em; /* @embed */ background: #ffffff url(images/ui-bg_highlight-soft_100_ffffff_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold; } .ui-widget-header a { color: #222222; } /* Interaction states diff --git a/resources/jquery/images/sort_both.gif b/resources/jquery/images/sort_both.gif new file mode 100644 index 00000000..50ad15a0 Binary files /dev/null and b/resources/jquery/images/sort_both.gif differ diff --git a/resources/jquery/images/sort_down.gif b/resources/jquery/images/sort_down.gif new file mode 100644 index 00000000..ec4f41b0 Binary files /dev/null and b/resources/jquery/images/sort_down.gif differ diff --git a/resources/jquery/images/sort_none.gif b/resources/jquery/images/sort_none.gif new file mode 100644 index 00000000..edd07e58 Binary files /dev/null and b/resources/jquery/images/sort_none.gif differ diff --git a/resources/jquery/images/sort_up.gif b/resources/jquery/images/sort_up.gif new file mode 100644 index 00000000..80189185 Binary files /dev/null and b/resources/jquery/images/sort_up.gif differ diff --git a/resources/jquery/jquery.appear.js b/resources/jquery/jquery.appear.js new file mode 100644 index 00000000..4f77886c --- /dev/null +++ b/resources/jquery/jquery.appear.js @@ -0,0 +1,138 @@ +/* + * jQuery.appear + * http://code.google.com/p/jquery-appear/ + * + * Copyright (c) 2009 Michael Hixson + * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php) +*/ +(function($) { + + $.fn.appear = function(fn, options) { + + var settings = $.extend({ + + //arbitrary data to pass to fn + data: undefined, + + //call fn only on the first appear? + one: true + + }, options); + + return this.each(function() { + + var t = $(this); + + //whether the element is currently visible + t.appeared = false; + + if (!fn) { + + //trigger the custom event + t.trigger('appear', settings.data); + return; + } + + var w = $(window); + + //fires the appear event when appropriate + var check = function() { + + //is the element hidden? + if (!t.is(':visible')) { + + //it became hidden + t.appeared = false; + return; + } + + //is the element inside the visible window? + var a = w.scrollLeft(); + var b = w.scrollTop(); + var o = t.offset(); + var x = o.left; + var y = o.top; + + if (y + t.height() >= b && + y <= b + w.height() && + x + t.width() >= a && + x <= a + w.width()) { + + //trigger the custom event + if (!t.appeared) t.trigger('appear', settings.data); + + } else { + + //it scrolled out of view + t.appeared = false; + } + }; + + //create a modified fn with some additional logic + var modifiedFn = function() { + + //mark the element as visible + t.appeared = true; + + //is this supposed to happen only once? + if (settings.one) { + + //remove the check + w.unbind('scroll', check); + var i = $.inArray(check, $.fn.appear.checks); + if (i >= 0) $.fn.appear.checks.splice(i, 1); + } + + //trigger the original fn + fn.apply(this, arguments); + }; + + //bind the modified fn to the element + if (settings.one) t.one('appear', settings.data, modifiedFn); + else t.bind('appear', settings.data, modifiedFn); + + //check whenever the window scrolls + w.scroll(check); + + //check whenever the dom changes + $.fn.appear.checks.push(check); + + //check now + (check)(); + }); + }; + + //keep a queue of appearance checks + $.extend($.fn.appear, { + + checks: [], + timeout: null, + + //process the queue + checkAll: function() { + var length = $.fn.appear.checks.length; + if (length > 0) while (length--) ($.fn.appear.checks[length])(); + }, + + //check the queue asynchronously + run: function() { + if ($.fn.appear.timeout) clearTimeout($.fn.appear.timeout); + $.fn.appear.timeout = setTimeout($.fn.appear.checkAll, 20); + } + }); + + //run checks when these methods are called + $.each(['append', 'prepend', 'after', 'before', 'attr', + 'removeAttr', 'addClass', 'removeClass', 'toggleClass', + 'remove', 'css', 'show', 'hide'], function(i, n) { + var old = $.fn[n]; + if (old) { + $.fn[n] = function() { + var r = old.apply(this, arguments); + $.fn.appear.run(); + return r; + } + } + }); + +})(jQuery); \ No newline at end of file diff --git a/resources/jquery/jquery.async.js b/resources/jquery/jquery.async.js index 61493f71..2161f6b9 100644 --- a/resources/jquery/jquery.async.js +++ b/resources/jquery/jquery.async.js @@ -13,33 +13,28 @@ // opts.test : (default true) function to test in the while test part // opts.loop : (default empty) function to call in the while loop part // opts.end : (default empty) function to call at the end of the while loop -$.whileAsync = function(opts) -{ +$.whileAsync = function(opts) { var delay = Math.abs(opts.delay) || 10, bulk = isNaN(opts.bulk) ? 500 : Math.abs(opts.bulk), test = opts.test || function(){ return true; }, loop = opts.loop || function(){}, - end = opts.end || function(){}; + end = opts.end || function(){}; (function(){ var t = false, begin = new Date(); - while( t = test() ) - { + while( t = test() ) { loop(); - if( bulk === 0 || (new Date() - begin) > bulk ) - { + if( bulk === 0 || (new Date() - begin) > bulk ) { break; } } - if( t ) - { + if( t ) { setTimeout(arguments.callee, delay); } - else - { + else { end(); } @@ -50,17 +45,15 @@ $.whileAsync = function(opts) // opts.bulk : (default 500) delay during which the loop can continue synchronously without yielding the CPU // opts.loop : (default empty) function to call in the each loop part, signature: function(index, value) this = value // opts.end : (default empty) function to call at the end of the each loop -$.eachAsync = function(array, opts) -{ - var i = 0, +$.eachAsync = function(array, opts) { + var i = 0, l = array.length, loop = opts.loop || function(){}; $.whileAsync( $.extend(opts, { - test: function(){ return i < l; }, - loop: function() - { + test: function() { return i < l; }, + loop: function() { var val = array[i]; return loop.call(val, i++, val); } @@ -68,11 +61,9 @@ $.eachAsync = function(array, opts) ); }; -$.fn.eachAsync = function(opts) -{ +$.fn.eachAsync = function(opts) { $.eachAsync(this, opts); return this; } -})(jQuery); - +})(jQuery); \ No newline at end of file diff --git a/resources/jquery/jquery.autoEllipsis.js b/resources/jquery/jquery.autoEllipsis.js index 4993118d..7d726894 100644 --- a/resources/jquery/jquery.autoEllipsis.js +++ b/resources/jquery/jquery.autoEllipsis.js @@ -3,9 +3,9 @@ */ ( function( $ ) { -// Cache ellipsed substrings for every string-width combination +// Cache ellipsed substrings for every string-width-position combination var cache = { }; -// Use a seperate cache when match highlighting is enabled +// Use a separate cache when match highlighting is enabled var matchTextCache = { }; $.fn.autoEllipsis = function( options ) { @@ -17,29 +17,29 @@ $.fn.autoEllipsis = function( options ) { 'matchText': null }, options ); $(this).each( function() { - var $this = $(this); + var $el = $(this); if ( options.restoreText ) { - if ( ! $this.data( 'autoEllipsis.originalText' ) ) { - $this.data( 'autoEllipsis.originalText', $this.text() ); + if ( !$el.data( 'autoEllipsis.originalText' ) ) { + $el.data( 'autoEllipsis.originalText', $el.text() ); } else { - $this.text( $this.data( 'autoEllipsis.originalText' ) ); + $el.text( $el.data( 'autoEllipsis.originalText' ) ); } } // container element - used for measuring against - var $container = $this; + var $container = $el; // trimmable text element - only the text within this element will be trimmed var $trimmableText = null; // protected text element - the width of this element is counted, but next is never trimmed from it var $protectedText = null; if ( options.hasSpan ) { - $trimmableText = $this.children( options.selector ); + $trimmableText = $el.children( options.selector ); } else { $trimmableText = $( '' ) .css( 'whiteSpace', 'nowrap' ) - .text( $this.text() ); - $this + .text( $el.text() ); + $el .empty() .append( $trimmableText ); } @@ -49,27 +49,39 @@ $.fn.autoEllipsis = function( options ) { var w = $container.width(); var pw = $protectedText ? $protectedText.width() : 0; // Try cache - if ( !( text in cache ) ) { - cache[text] = {}; - } - if ( options.matchText && !( text in matchTextCache ) ) { - matchTextCache[text] = {}; - } - if ( options.matchText && !( options.matchText in matchTextCache[text] ) ) { - matchTextCache[text][options.matchText] = {}; - } - if ( !options.matchText && w in cache[text] ) { - $container.html( cache[text][w] ); - if ( options.tooltip ) - $container.attr( 'title', text ); - return; - } - if( options.matchText && options.matchText in matchTextCache[text] && w in matchTextCache[text][options.matchText] ) { - $container.html( matchTextCache[text][options.matchText][w] ); - if ( options.tooltip ) - $container.attr( 'title', text ); - return; + if ( options.matchText ) { + if ( !( text in matchTextCache ) ) { + matchTextCache[text] = {}; + } + if ( !( options.matchText in matchTextCache[text] ) ) { + matchTextCache[text][options.matchText] = {}; + } + if ( !( w in matchTextCache[text][options.matchText] ) ) { + matchTextCache[text][options.matchText][w] = {}; + } + if ( options.position in matchTextCache[text][options.matchText][w] ) { + $container.html( matchTextCache[text][options.matchText][w][options.position] ); + if ( options.tooltip ) { + $container.attr( 'title', text ); + } + return; + } + } else { + if ( !( text in cache ) ) { + cache[text] = {}; + } + if ( !( w in cache[text] ) ) { + cache[text][w] = {}; + } + if ( options.position in cache[text][w] ) { + $container.html( cache[text][w][options.position] ); + if ( options.tooltip ) { + $container.attr( 'title', text ); + } + return; + } } + if ( $trimmableText.width() + pw > w ) { switch ( options.position ) { case 'right': @@ -94,7 +106,7 @@ $.fn.autoEllipsis = function( options ) { while ( $trimmableText.outerWidth() + pw > w && i[0] > 0 ) { $trimmableText.text( trimmableText.substr( 0, i[0] ) + '...' + trimmableText.substr( i[1] ) ); // Alternate between trimming the end and begining - if ( side == 0 ) { + if ( side === 0 ) { // Make the begining shorter i[0]--; side = 1; @@ -120,9 +132,9 @@ $.fn.autoEllipsis = function( options ) { } if ( options.matchText ) { $container.highlightText( options.matchText ); - matchTextCache[text][options.matchText][w] = $container.html(); + matchTextCache[text][options.matchText][w][options.position] = $container.html(); } else { - cache[text][w] = $container.html(); + cache[text][w][options.position] = $container.html(); } } ); diff --git a/resources/jquery/jquery.byteLength.js b/resources/jquery/jquery.byteLength.js new file mode 100644 index 00000000..20fa5c8e --- /dev/null +++ b/resources/jquery/jquery.byteLength.js @@ -0,0 +1,19 @@ +/** + * jQuery.byteLength + * + * Calculate the byte length of a string (accounting for UTF-8). + * + * @author Jan Paul Posma + */ +jQuery.byteLength = function( str ) { + + // This basically figures out how many bytes a UTF-16 string (which is what js sees) + // will take in UTF-8 by replacing a 2 byte character with 2 *'s, etc, and counting that. + // Note, surrogate (\uD800-\uDFFF) characters are counted as 2 bytes, since there's two of them + // and the actual character takes 4 bytes in UTF-8 (2*2=4). Might not work perfectly in + // edge cases such as illegal sequences, but that should never happen. + return str + .replace( /[\u0080-\u07FF\uD800-\uDFFF]/g, '**' ) + .replace( /[\u0800-\uD7FF\uE000-\uFFFF]/g, '***' ) + .length; +} diff --git a/resources/jquery/jquery.byteLimit.js b/resources/jquery/jquery.byteLimit.js new file mode 100644 index 00000000..c1d26fc4 --- /dev/null +++ b/resources/jquery/jquery.byteLimit.js @@ -0,0 +1,56 @@ +/** + * jQuery byteLimit + * + * @author Jan Paul Posma + */ +( function( $ ) { + + /** + * Enforces a byte limit to a textbox, so that UTF-8 entries are not arbitrarily truncated. + */ + $.fn.byteLimit = function( limit ) { + + // Default to current attribute value + if ( limit == null ) { + limit = this.attr( 'maxLength' ); + + // If passed, update/set attribute value instead + } else { + this.attr( 'maxLength', limit ); + } + + // Nothing passed and/or empty attribute, return without binding an event. + if ( limit == null ) { + return this; + } + + // We've got something, go for it: + return this.keypress( function( e ) { + // First check to see if this is actually a character key + // being pressed. + // Based on key-event info from http://unixpapa.com/js/key.html + // jQuery should also normalize e.which to be consistent cross-browser, + // however the same check is still needed regardless of jQuery. + + // Note: At the moment, for some older opera versions (~< 10.5) + // some special keys won't be recognized (aka left arrow key). + // Backspace will be, so not big issue. + + if ( e.which === 0 || e.charCode === 0 || e.which === 8 || + e.ctrlKey || e.altKey || e.metaKey ) + { + return true; //a special key (backspace, etc) so don't interfere. + } + + var len = $.byteLength( this.value ); + // Note that keypress returns a character code point, not a keycode. + // However, this may not be super reliable depending on how keys come in... + var charLen = $.byteLength( String.fromCharCode( e.which ) ); + + if ( ( len + charLen ) > limit ) { + e.preventDefault(); + } + }); + }; + +} )( jQuery ); diff --git a/resources/jquery/jquery.checkboxShiftClick.js b/resources/jquery/jquery.checkboxShiftClick.js index b2fcb6ef..cfa696d4 100644 --- a/resources/jquery/jquery.checkboxShiftClick.js +++ b/resources/jquery/jquery.checkboxShiftClick.js @@ -7,22 +7,22 @@ * @license GPL v2 */ ( function( $ ) { -jQuery.fn.checkboxShiftClick = function( text ) { +$.fn.checkboxShiftClick = function( text ) { var prevCheckbox = null; var $box = this; // When our boxes are clicked.. - $box.click(function (e) { + $box.click( function( e ) { // And one has been clicked before... - if (prevCheckbox !== null && e.shiftKey) { + if ( prevCheckbox !== null && e.shiftKey ) { // Check or uncheck this one and all in-between checkboxes $box.slice( - Math.min($box.index(prevCheckbox), $box.index(e.target)), - Math.max($box.index(prevCheckbox), $box.index(e.target)) + 1 - ).attr({checked: e.target.checked ? 'checked' : ''}); + Math.min( $box.index( prevCheckbox ), $box.index( e.target ) ), + Math.max( $box.index( prevCheckbox ), $box.index( e.target ) ) + 1 + ).attr( {checked: e.target.checked ? 'checked' : ''} ); } // Either way, update the prevCheckbox variable to the one clicked now prevCheckbox = e.target; - }); + } ); return $box; }; } )( jQuery ); \ No newline at end of file diff --git a/resources/jquery/jquery.client.js b/resources/jquery/jquery.client.js index 4b9f580f..8082fa7d 100644 --- a/resources/jquery/jquery.client.js +++ b/resources/jquery/jquery.client.js @@ -1,206 +1,216 @@ -/* +/** * User-agent detection */ ( function( $ ) { -$.client = new ( function() { /* Private Members */ - var profile; - - /* Public Functions */ - /** - * Returns an object containing information about the browser - * - * The resulting client object will be in the following format: - * { - * 'name': 'firefox', - * 'layout': 'gecko', - * 'layoutVersion': '20101026', - * 'platform': 'linux' - * 'version': '3.5.1', - * 'versionBase': '3', - * 'versionNumber': 3.5, - * } + * @var profileCache {Object} Keyed by userAgent string, + * value is the parsed $.client.profile object for that user agent. */ - this.profile = function() { - // Use the cached version if possible - if ( typeof profile === 'undefined' ) { - - /* Configuration */ - - // Name of browsers or layout engines we don't recognize - var uk = 'unknown'; - // Generic version digit - var x = 'x'; - // Strings found in user agent strings that need to be conformed - var wildUserAgents = [ 'Opera', 'Navigator', 'Minefield', 'KHTML', 'Chrome', 'PLAYSTATION 3']; - // Translations for conforming user agent strings - var userAgentTranslations = [ - // Tons of browsers lie about being something they are not - [/(Firefox|MSIE|KHTML,\slike\sGecko|Konqueror)/, ''], - // Chrome lives in the shadow of Safari still - ['Chrome Safari', 'Chrome'], - // KHTML is the layout engine not the browser - LIES! - ['KHTML', 'Konqueror'], - // Firefox nightly builds - ['Minefield', 'Firefox'], - // This helps keep differnt versions consistent - ['Navigator', 'Netscape'], - // This prevents version extraction issues, otherwise translation would happen later - ['PLAYSTATION 3', 'PS3'], - ]; - // Strings which precede a version number in a user agent string - combined and used as match 1 in - // version detectection - var versionPrefixes = [ - 'camino', 'chrome', 'firefox', 'netscape', 'netscape6', 'opera', 'version', 'konqueror', 'lynx', - 'msie', 'safari', 'ps3' - ]; - // Used as matches 2, 3 and 4 in version extraction - 3 is used as actual version number - var versionSuffix = '(\\/|\\;?\\s|)([a-z0-9\\.\\+]*?)(\\;|dev|rel|\\)|\\s|$)'; - // Names of known browsers - var names = [ - 'camino', 'chrome', 'firefox', 'netscape', 'konqueror', 'lynx', 'msie', 'opera', 'safari', 'ipod', - 'iphone', 'blackberry', 'ps3' - ]; - // Tanslations for conforming browser names - var nameTranslations = []; - // Names of known layout engines - var layouts = ['gecko', 'konqueror', 'msie', 'opera', 'webkit']; - // Translations for conforming layout names - var layoutTranslations = [['konqueror', 'khtml'], ['msie', 'trident'], ['opera', 'presto']]; - // Names of supported layout engines for version number - var layoutVersions = ['applewebkit', 'gecko']; - // Names of known operating systems - var platforms = ['win', 'mac', 'linux', 'sunos', 'solaris', 'iphone']; - // Translations for conforming operating system names - var platformTranslations = [['sunos', 'solaris']]; - - /* Methods */ - - // Performs multiple replacements on a string - function translate( source, translations ) { - for ( var i = 0; i < translations.length; i++ ) { - source = source.replace( translations[i][0], translations[i][1] ); - } - return source; - }; - - /* Pre-processing */ - - var userAgent = navigator.userAgent, match, name = uk, layout = uk, layoutversion = uk, platform = uk, version = x; - if ( match = new RegExp( '(' + wildUserAgents.join( '|' ) + ')' ).exec( userAgent ) ) { - // Takes a userAgent string and translates given text into something we can more easily work with - userAgent = translate( userAgent, userAgentTranslations ); + var profileCache = {}; + + /* Public Methods */ + + $.client = { + + /** + * Get an object containing information about the client. + * + * @param nav {Object} An object with atleast a 'userAgent' and 'platform' key.= + * Defaults to the global Navigator object. + * @return {Object} The resulting client object will be in the following format: + * { + * 'name': 'firefox', + * 'layout': 'gecko', + * 'layoutVersion': 20101026, + * 'platform': 'linux' + * 'version': '3.5.1', + * 'versionBase': '3', + * 'versionNumber': 3.5, + * } + */ + profile: function( nav ) { + if ( nav === undefined ) { + nav = window.navigator; } - // Everything will be in lowercase from now on - userAgent = userAgent.toLowerCase(); - - /* Extraction */ - - if ( match = new RegExp( '(' + names.join( '|' ) + ')' ).exec( userAgent ) ) { - name = translate( match[1], nameTranslations ); - } - if ( match = new RegExp( '(' + layouts.join( '|' ) + ')' ).exec( userAgent ) ) { - layout = translate( match[1], layoutTranslations ); - } - if ( match = new RegExp( '(' + layoutVersions.join( '|' ) + ')\\\/(\\d+)').exec( navigator.userAgent.toLowerCase() ) ) { - layoutversion = parseInt(match[2]); - } - if ( match = new RegExp( '(' + platforms.join( '|' ) + ')' ).exec( navigator.platform.toLowerCase() ) ) { - platform = translate( match[1], platformTranslations ); - } - if ( match = new RegExp( '(' + versionPrefixes.join( '|' ) + ')' + versionSuffix ).exec( userAgent ) ) { - version = match[3]; - } - - /* Edge Cases -- did I mention about how user agent string lie? */ - - // Decode Safari's crazy 400+ version numbers - if ( name.match( /safari/ ) && version > 400 ) { - version = '2.0'; + // Use the cached version if possible + if ( profileCache[nav.userAgent] === undefined ) { + + /* Configuration */ + + // Name of browsers or layout engines we don't recognize + var uk = 'unknown'; + // Generic version digit + var x = 'x'; + // Strings found in user agent strings that need to be conformed + var wildUserAgents = [ 'Opera', 'Navigator', 'Minefield', 'KHTML', 'Chrome', 'PLAYSTATION 3']; + // Translations for conforming user agent strings + var userAgentTranslations = [ + // Tons of browsers lie about being something they are not + [/(Firefox|MSIE|KHTML,\slike\sGecko|Konqueror)/, ''], + // Chrome lives in the shadow of Safari still + ['Chrome Safari', 'Chrome'], + // KHTML is the layout engine not the browser - LIES! + ['KHTML', 'Konqueror'], + // Firefox nightly builds + ['Minefield', 'Firefox'], + // This helps keep differnt versions consistent + ['Navigator', 'Netscape'], + // This prevents version extraction issues, otherwise translation would happen later + ['PLAYSTATION 3', 'PS3'] + ]; + // Strings which precede a version number in a user agent string - combined and used as match 1 in + // version detectection + var versionPrefixes = [ + 'camino', 'chrome', 'firefox', 'netscape', 'netscape6', 'opera', 'version', 'konqueror', 'lynx', + 'msie', 'safari', 'ps3' + ]; + // Used as matches 2, 3 and 4 in version extraction - 3 is used as actual version number + var versionSuffix = '(\\/|\\;?\\s|)([a-z0-9\\.\\+]*?)(\\;|dev|rel|\\)|\\s|$)'; + // Names of known browsers + var names = [ + 'camino', 'chrome', 'firefox', 'netscape', 'konqueror', 'lynx', 'msie', 'opera', 'safari', 'ipod', + 'iphone', 'blackberry', 'ps3' + ]; + // Tanslations for conforming browser names + var nameTranslations = []; + // Names of known layout engines + var layouts = ['gecko', 'konqueror', 'msie', 'opera', 'webkit']; + // Translations for conforming layout names + var layoutTranslations = [['konqueror', 'khtml'], ['msie', 'trident'], ['opera', 'presto']]; + // Names of supported layout engines for version number + var layoutVersions = ['applewebkit', 'gecko']; + // Names of known operating systems + var platforms = ['win', 'mac', 'linux', 'sunos', 'solaris', 'iphone']; + // Translations for conforming operating system names + var platformTranslations = [['sunos', 'solaris']]; + + /* Methods */ + + // Performs multiple replacements on a string + var translate = function( source, translations ) { + for ( var i = 0; i < translations.length; i++ ) { + source = source.replace( translations[i][0], translations[i][1] ); + } + return source; + }; + + /* Pre-processing */ + + var ua = nav.userAgent, + match, + name = uk, + layout = uk, + layoutversion = uk, + platform = uk, + version = x; + + if ( match = new RegExp( '(' + wildUserAgents.join( '|' ) + ')' ).exec( ua ) ) { + // Takes a userAgent string and translates given text into something we can more easily work with + ua = translate( ua, userAgentTranslations ); + } + // Everything will be in lowercase from now on + ua = ua.toLowerCase(); + + /* Extraction */ + + if ( match = new RegExp( '(' + names.join( '|' ) + ')' ).exec( ua ) ) { + name = translate( match[1], nameTranslations ); + } + if ( match = new RegExp( '(' + layouts.join( '|' ) + ')' ).exec( ua ) ) { + layout = translate( match[1], layoutTranslations ); + } + if ( match = new RegExp( '(' + layoutVersions.join( '|' ) + ')\\\/(\\d+)').exec( ua ) ) { + layoutversion = parseInt( match[2], 10 ); + } + if ( match = new RegExp( '(' + platforms.join( '|' ) + ')' ).exec( nav.platform.toLowerCase() ) ) { + platform = translate( match[1], platformTranslations ); + } + if ( match = new RegExp( '(' + versionPrefixes.join( '|' ) + ')' + versionSuffix ).exec( ua ) ) { + version = match[3]; + } + + /* Edge Cases -- did I mention about how user agent string lie? */ + + // Decode Safari's crazy 400+ version numbers + if ( name.match( /safari/ ) && version > 400 ) { + version = '2.0'; + } + // Expose Opera 10's lies about being Opera 9.8 + if ( name === 'opera' && version >= 9.8) { + version = ua.match( /version\/([0-9\.]*)/i )[1] || 10; + } + var versionNumber = parseFloat( version, 10 ) || 0.0; + + /* Caching */ + + profileCache[nav.userAgent] = { + 'name': name, + 'layout': layout, + 'layoutVersion': layoutversion, + 'platform': platform, + 'version': version, + 'versionBase': ( version !== x ? Math.floor( versionNumber ).toString() : x ), + 'versionNumber': versionNumber + }; } - // Expose Opera 10's lies about being Opera 9.8 - if ( name === 'opera' && version >= 9.8) { - version = userAgent.match( /version\/([0-9\.]*)/i )[1] || 10; + return profileCache[nav.userAgent]; + }, + + /** + * Checks the current browser against a support map object to determine if the browser has been black-listed or + * not. If the browser was not configured specifically it is assumed to work. It is assumed that the body + * element is classified as either "ltr" or "rtl". If neither is set, "ltr" is assumed. + * + * A browser map is in the following format: + * { + * 'ltr': { + * // Multiple rules with configurable operators + * 'msie': [['>=', 7], ['!=', 9]], + * // Blocked entirely + * 'iphone': false + * }, + * 'rtl': { + * // Test against a string + * 'msie': [['!==', '8.1.2.3']], + * // RTL rules do not fall through to LTR rules, you must explicity set each of them + * 'iphone': false + * } + * } + * + * @param map {Object} Browser support map + * @param profile {Object} (optional) a client-profile object. + * + * @return Boolean true if browser known or assumed to be supported, false if blacklisted + */ + test: function( map, profile ) { + profile = $.isPlainObject( profile ) ? profile : $.client.profile(); + + var dir = $( 'body' ).is( '.rtl' ) ? 'rtl' : 'ltr'; + // Check over each browser condition to determine if we are running in a compatible client + if ( typeof map[dir] !== 'object' || typeof map[dir][profile.name] === 'undefined' ) { + // Unknown, so we assume it's working + return true; } - - /* Caching */ - - profile = { - 'name': name, - 'layout': layout, - 'layoutVersion': layoutversion, - 'platform': platform, - 'version': version, - 'versionBase': ( version !== x ? new String( version ).substr( 0, 1 ) : x ), - 'versionNumber': ( parseFloat( version, 10 ) || 0.0 ) - }; - } - return profile; - }; - - /** - * Checks the current browser against a support map object to determine if the browser has been black-listed or - * not. If the browser was not configured specifically it is assumed to work. It is assumed that the body - * element is classified as either "ltr" or "rtl". If neither is set, "ltr" is assumed. - * - * A browser map is in the following format: - * { - * 'ltr': { - * // Multiple rules with configurable operators - * 'msie': [['>=', 7], ['!=', 9]], - * // Blocked entirely - * 'iphone': false - * }, - * 'rtl': { - * // Test against a string - * 'msie': [['!==', '8.1.2.3']], - * // RTL rules do not fall through to LTR rules, you must explicity set each of them - * 'iphone': false - * } - * } - * - * @param map Object of browser support map - * - * @return Boolean true if browser known or assumed to be supported, false if blacklisted - */ - this.test = function( map ) { - var profile = jQuery.client.profile(); - var dir = jQuery( 'body' ).is( '.rtl' ) ? 'rtl' : 'ltr'; - // Check over each browser condition to determine if we are running in a compatible client - if ( typeof map[dir] !== 'object' || typeof map[dir][profile.name] === 'undefined' ) { - // Unknown, so we assume it's working - return true; - } - var name = map[dir][profile.name]; - for ( var condition in name ) { - var op = name[condition][0]; - var val = name[condition][1]; - if ( val === false ) { - return false; - } else if ( typeof val == 'string' ) { - if ( !( eval( 'profile.version' + op + '"' + val + '"' ) ) ) { - return false; - } - } else if ( typeof val == 'number' ) { - if ( !( eval( 'profile.versionNumber' + op + val ) ) ) { + var conditions = map[dir][profile.name]; + for ( var i = 0; i < conditions.length; i++ ) { + var op = conditions[i][0]; + var val = conditions[i][1]; + if ( val === false ) { return false; + } else if ( typeof val == 'string' ) { + if ( !( eval( 'profile.version' + op + '"' + val + '"' ) ) ) { + return false; + } + } else if ( typeof val == 'number' ) { + if ( !( eval( 'profile.versionNumber' + op + val ) ) ) { + return false; + } } } + return true; } - return true; - } -} )(); - -$( document ).ready( function() { - var profile = $.client.profile(); - $( 'html' ) - .addClass( 'client-' + profile.name ) - .addClass( 'client-' + profile.name + '-' + profile.versionBase ) - .addClass( 'client-' + profile.layout ) - .addClass( 'client-' + profile.platform ); -} ); - + }; } )( jQuery ); diff --git a/resources/jquery/jquery.color.js b/resources/jquery/jquery.color.js index e1b0d0dd..b0419428 100644 --- a/resources/jquery/jquery.color.js +++ b/resources/jquery/jquery.color.js @@ -1,123 +1,44 @@ -/* +/** * jQuery Color Animations * Copyright 2007 John Resig * Released under the MIT and GPL licenses. + * + * - 2011-01-05: Modified by Krinkle to use the jQuery.colorUtil plugin (which has to be loaded first!) */ - -(function(jQuery){ +(function( $ ) { // We override the animation for all of these color styles - jQuery.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){ - jQuery.fx.step[attr] = function(fx){ - if ( fx.state == 0 ) { - fx.start = getColor( fx.elem, attr ); - fx.end = getRGB( fx.end ); + $.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], + function( i, attr ) { + $.fx.step[attr] = function( fx ) { + if ( fx.state == 0 ) { + fx.start = getColor( fx.elem, attr ); + fx.end = $.colorUtil.getRGB( fx.end ); + } + + fx.elem.style[attr] = 'rgb(' + [ + Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0]), 255), 0), + Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1]), 255), 0), + Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2]), 255), 0) + ].join( ',' ) + ')'; } - - fx.elem.style[attr] = "rgb(" + [ - Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0]), 255), 0), - Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1]), 255), 0), - Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2]), 255), 0) - ].join(",") + ")"; } - }); - - // Color Conversion functions from highlightFade - // By Blair Mitchelmore - // http://jquery.offput.ca/highlightFade/ - - // Parse strings looking for color tuples [255,255,255] - function getRGB(color) { - var result; - - // Check if we're already dealing with an array of colors - if ( color && color.constructor == Array && color.length == 3 ) - return color; - - // Look for rgb(num,num,num) - if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color)) - return [parseInt(result[1]), parseInt(result[2]), parseInt(result[3])]; - - // Look for rgb(num%,num%,num%) - if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)%\s*,\s*([0-9]+(?:\.[0-9]+)?)%\s*,\s*([0-9]+(?:\.[0-9]+)?)%\s*\)/.exec(color)) - return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55]; - - // Look for #a0b1c2 - if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color)) - return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)]; - - // Look for #fff - if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color)) - return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)]; - - // Otherwise, we're most likely dealing with a named color - return colors[jQuery.trim(color).toLowerCase()]; - } + ); function getColor(elem, attr) { var color; do { - color = jQuery.curCSS(elem, attr); + color = $.curCSS(elem, attr); // Keep going until we find an element that has color, or we hit the body - if ( color != '' && color != 'transparent' || jQuery.nodeName(elem, "body") ) + if ( color != '' && color != 'transparent' || $.nodeName(elem, 'body') ) break; - attr = "backgroundColor"; + attr = 'backgroundColor'; } while ( elem = elem.parentNode ); - return getRGB(color); - }; - - // Some named colors to work with - // From Interface by Stefan Petre - // http://interface.eyecon.ro/ - - var colors = { - aqua:[0,255,255], - azure:[240,255,255], - beige:[245,245,220], - black:[0,0,0], - blue:[0,0,255], - brown:[165,42,42], - cyan:[0,255,255], - darkblue:[0,0,139], - darkcyan:[0,139,139], - darkgrey:[169,169,169], - darkgreen:[0,100,0], - darkkhaki:[189,183,107], - darkmagenta:[139,0,139], - darkolivegreen:[85,107,47], - darkorange:[255,140,0], - darkorchid:[153,50,204], - darkred:[139,0,0], - darksalmon:[233,150,122], - darkviolet:[148,0,211], - fuchsia:[255,0,255], - gold:[255,215,0], - green:[0,128,0], - indigo:[75,0,130], - khaki:[240,230,140], - lightblue:[173,216,230], - lightcyan:[224,255,255], - lightgreen:[144,238,144], - lightgrey:[211,211,211], - lightpink:[255,182,193], - lightyellow:[255,255,224], - lime:[0,255,0], - magenta:[255,0,255], - maroon:[128,0,0], - navy:[0,0,128], - olive:[128,128,0], - orange:[255,165,0], - pink:[255,192,203], - purple:[128,0,128], - violet:[128,0,128], - red:[255,0,0], - silver:[192,192,192], - white:[255,255,255], - yellow:[255,255,0] + return $.colorUtil.getRGB(color); }; -})(jQuery); +} )( jQuery ); diff --git a/resources/jquery/jquery.colorUtil.js b/resources/jquery/jquery.colorUtil.js new file mode 100644 index 00000000..1116aec6 --- /dev/null +++ b/resources/jquery/jquery.colorUtil.js @@ -0,0 +1,193 @@ +/** + * jQuery Color Utilities + * Written by Krinkle in 2011 + * Released under the MIT and GPL licenses. + * Mostly based on other plugins and functions (taken through JSLint and optimized a little). + * Sources cited locally. + */ +( function( $ ) { +$.colorUtil = { + + // Color Conversion function from highlightFade + // By Blair Mitchelmore + // http://jquery.offput.ca/highlightFade/ + // Parse strings looking for color tuples [255,255,255] + getRGB : function( color ) { + var result; + + // Check if we're already dealing with an array of colors + if ( color && color.constructor == Array && color.length == 3 ){ + return color; + } + + // Look for rgb(num,num,num) + if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color)) { + return [parseInt(result[1],10), parseInt(result[2],10), parseInt(result[3],10)]; + } + + // Look for rgb(num%,num%,num%) + if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color)) { + return [parseFloat(result[1],10)*2.55, parseFloat(result[2],10)*2.55, parseFloat(result[3])*2.55]; + } + + // Look for #a0b1c2 + if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color)) { + return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)]; + } + + // Look for #fff + if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color)) { + return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)]; + } + + // Look for rgba(0, 0, 0, 0) == transparent in Safari 3 + if (result = /rgba\(0, 0, 0, 0\)/.exec(color)) { + return $.colorUtil.colors.transparent; + } + + // Otherwise, we're most likely dealing with a named color + return $.colorUtil.colors[$.trim(color).toLowerCase()]; + }, + + // Some named colors to work with + // From Interface by Stefan Petre + // http://interface.eyecon.ro/ + colors: { + aqua:[0,255,255], + azure:[240,255,255], + beige:[245,245,220], + black:[0,0,0], + blue:[0,0,255], + brown:[165,42,42], + cyan:[0,255,255], + darkblue:[0,0,139], + darkcyan:[0,139,139], + darkgrey:[169,169,169], + darkgreen:[0,100,0], + darkkhaki:[189,183,107], + darkmagenta:[139,0,139], + darkolivegreen:[85,107,47], + darkorange:[255,140,0], + darkorchid:[153,50,204], + darkred:[139,0,0], + darksalmon:[233,150,122], + darkviolet:[148,0,211], + fuchsia:[255,0,255], + gold:[255,215,0], + green:[0,128,0], + indigo:[75,0,130], + khaki:[240,230,140], + lightblue:[173,216,230], + lightcyan:[224,255,255], + lightgreen:[144,238,144], + lightgrey:[211,211,211], + lightpink:[255,182,193], + lightyellow:[255,255,224], + lime:[0,255,0], + magenta:[255,0,255], + maroon:[128,0,0], + navy:[0,0,128], + olive:[128,128,0], + orange:[255,165,0], + pink:[255,192,203], + purple:[128,0,128], + violet:[128,0,128], + red:[255,0,0], + silver:[192,192,192], + white:[255,255,255], + yellow:[255,255,0], + transparent: [255,255,255] + }, + /** + * http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript + * Converts an RGB color value to HSL. Conversion formula + * adapted from http://en.wikipedia.org/wiki/HSL_color_space. + * Assumes r, g, and b are contained in the set [0, 255] and + * returns h, s, and l in the set [0, 1]. + * + * @param Number R The red color value + * @param Number G The green color value + * @param Number B The blue color value + * @return Array The HSL representation + */ + rgbToHsl: function( R, G, B ) { + var r = R / 255, + g = G / 255, + b = B / 255; + var max = Math.max(r, g, b), min = Math.min(r, g, b); + var h, s, l = (max + min) / 2; + + if(max == min){ + h = s = 0; // achromatic + }else{ + var d = max - min; + s = l > 0.5 ? d / (2 - max - min) : d / (max + min); + switch(max){ + case r: h = (g - b) / d + (g < b ? 6 : 0); break; + case g: h = (b - r) / d + 2; break; + case b: h = (r - g) / d + 4; break; + } + h /= 6; + } + + return [h, s, l]; + }, + /** + * http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript + * Converts an HSL color value to RGB. Conversion formula + * adapted from http://en.wikipedia.org/wiki/HSL_color_space. + * Assumes h, s, and l are contained in the set [0, 1] and + * returns r, g, and b in the set [0, 255]. + * + * @param Number h The hue + * @param Number s The saturation + * @param Number l The lightness + * @return Array The RGB representation + */ + hslToRgb: function( h, s, l ) { + var r, g, b; + + if(s === 0){ + r = g = b = l; // achromatic + }else{ + var hue2rgb = function(p, q, t){ + if(t < 0){ t += 1; } + if(t > 1){ t -= 1; } + if(t < 1/6){ return p + (q - p) * 6 * t; } + if(t < 1/2){ return q; } + if(t < 2/3){ return p + (q - p) * (2/3 - t) * 6; } + return p; + }; + + var q = l < 0.5 ? l * (1 + s) : l + s - l * s; + var p = 2 * l - q; + r = hue2rgb(p, q, h + 1/3); + g = hue2rgb(p, q, h); + b = hue2rgb(p, q, h - 1/3); + } + + return [r * 255, g * 255, b * 255]; + }, + /** + * Get's a brighter or darker rgb() value string. + * + * @author Krinkle + * + * @example getCSSColorMod( 'red', +0.1 ) + * @example getCSSColorMod( 'rgb(200,50,50)', -0.2 ) + * + * @param Mixed currentColor current value in css + * @param Number mod wanted brightness modification between -1 and 1 + * @return String 'rgb(r,g,b)' + */ + getColorBrightness: function( currentColor, mod ) { + var rgbArr = $.colorUtil.getRGB( currentColor ), + hslArr = $.colorUtil.rgbToHsl(rgbArr[0], rgbArr[1], rgbArr[2] ); + rgbArr = $.colorUtil.hslToRgb(hslArr[0], hslArr[1], hslArr[2]+mod); + return 'rgb(' + + [parseInt( rgbArr[0], 10), parseInt( rgbArr[1], 10 ), parseInt( rgbArr[2], 10 )].join( ',' ) + + ')'; + } + +}; +} )( jQuery ); \ No newline at end of file diff --git a/resources/jquery/jquery.cookie.js b/resources/jquery/jquery.cookie.js index eaa254e5..79317f74 100644 --- a/resources/jquery/jquery.cookie.js +++ b/resources/jquery/jquery.cookie.js @@ -1,19 +1,15 @@ -/*jslint browser: true */ /*global jQuery: true */ - /** - * jQuery Cookie plugin + * Cookie plugin * - * Copyright (c) 2010 Klaus Hartl (stilbuero.de) + * Copyright (c) 2006 Klaus Hartl (stilbuero.de) * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * */ -// TODO JsDoc - /** - * Create a cookie with the given key and value and other optional parameters. + * Create a cookie with the given name and value and other optional parameters. * * @example $.cookie('the_cookie', 'the_value'); * @desc Set the value of a cookie. @@ -25,16 +21,16 @@ * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain * used when the cookie was set. * - * @param key String The key of the cookie. - * @param value String The value of the cookie. - * @param options Object An object literal containing key/value pairs to provide optional cookie attributes. - * @option expires Number|Date Either an integer specifying the expiration date from now on in days or a Date object. + * @param String name The name of the cookie. + * @param String value The value of the cookie. + * @param Object options An object literal containing key/value pairs to provide optional cookie attributes. + * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object. * If a negative value is specified (e.g. a date in the past), the cookie will be deleted. * If set to null or omitted, the cookie will be a session cookie and will not be retained * when the the browser exits. - * @option path String The value of the path atribute of the cookie (default: path of page that created the cookie). - * @option domain String The value of the domain attribute of the cookie (default: domain of page that created the cookie). - * @option secure Boolean If true, the secure attribute of the cookie will be set and the cookie transmission will + * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie). + * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie). + * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will * require a secure protocol (like HTTPS). * @type undefined * @@ -44,12 +40,12 @@ */ /** - * Get the value of a cookie with the given key. + * Get the value of a cookie with the given name. * * @example $.cookie('the_cookie'); * @desc Get the value of a cookie. * - * @param key String The key of the cookie. + * @param String name The name of the cookie. * @return The value of the cookie. * @type String * @@ -57,33 +53,44 @@ * @cat Plugins/Cookie * @author Klaus Hartl/klaus.hartl@stilbuero.de */ -jQuery.cookie = function (key, value, options) { - - // key and value given, set cookie... - if (arguments.length > 1 && (value === null || typeof value !== "object")) { - options = jQuery.extend({}, options); - +jQuery.cookie = function(name, value, options) { + if (typeof value != 'undefined') { // name and value given, set cookie + options = options || {}; if (value === null) { + value = ''; options.expires = -1; } - - if (typeof options.expires === 'number') { - var days = options.expires, t = options.expires = new Date(); - t.setDate(t.getDate() + days); + var expires = ''; + if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) { + var date; + if (typeof options.expires == 'number') { + date = new Date(); + date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000)); + } else { + date = options.expires; + } + expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE } - - return (document.cookie = [ - encodeURIComponent(key), '=', - options.raw ? String(value) : encodeURIComponent(String(value)), - options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE - options.path ? '; path=' + options.path : '', - options.domain ? '; domain=' + options.domain : '', - options.secure ? '; secure' : '' - ].join('')); + // CAUTION: Needed to parenthesize options.path and options.domain + // in the following expressions, otherwise they evaluate to undefined + // in the packed version for some reason... + var path = options.path ? '; path=' + (options.path) : ''; + var domain = options.domain ? '; domain=' + (options.domain) : ''; + var secure = options.secure ? '; secure' : ''; + document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join(''); + } else { // only name given, get cookie + var cookieValue = null; + if (document.cookie && document.cookie != '') { + var cookies = document.cookie.split(';'); + for (var i = 0; i < cookies.length; i++) { + var cookie = jQuery.trim(cookies[i]); + // Does this cookie string begin with the name we want? + if (cookie.substring(0, name.length + 1) == (name + '=')) { + cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); + break; + } + } + } + return cookieValue; } - - // key and possibly options given, get cookie... - options = value || {}; - var result, decode = options.raw ? function (s) { return s; } : decodeURIComponent; - return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null; }; diff --git a/resources/jquery/jquery.form.js b/resources/jquery/jquery.form.js new file mode 100644 index 00000000..53c078f9 --- /dev/null +++ b/resources/jquery/jquery.form.js @@ -0,0 +1,791 @@ +/*! + * jQuery Form Plugin + * version: 2.52 (07-DEC-2010) + * @requires jQuery v1.3.2 or later + * + * Examples and documentation at: http://malsup.com/jquery/form/ + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + */ +(function($) { + +/* + Usage Note: + ----------- + Do not use both ajaxSubmit and ajaxForm on the same form. These + functions are intended to be exclusive. Use ajaxSubmit if you want + to bind your own submit handler to the form. For example, + + $(document).ready(function() { + $('#myForm').bind('submit', function(e) { + e.preventDefault(); // <-- important + $(this).ajaxSubmit({ + target: '#output' + }); + }); + }); + + Use ajaxForm when you want the plugin to manage all the event binding + for you. For example, + + $(document).ready(function() { + $('#myForm').ajaxForm({ + target: '#output' + }); + }); + + When using ajaxForm, the ajaxSubmit function will be invoked for you + at the appropriate time. +*/ + +/** + * ajaxSubmit() provides a mechanism for immediately submitting + * an HTML form using AJAX. + */ +$.fn.ajaxSubmit = function(options) { + // fast fail if nothing selected (http://dev.jquery.com/ticket/2752) + if (!this.length) { + log('ajaxSubmit: skipping submit process - no element selected'); + return this; + } + + if (typeof options == 'function') { + options = { success: options }; + } + + var action = this.attr('action'); + var url = (typeof action === 'string') ? $.trim(action) : ''; + if (url) { + // clean url (don't include hash vaue) + url = (url.match(/^([^#]+)/)||[])[1]; + } + url = url || window.location.href || ''; + + options = $.extend(true, { + url: url, + type: this.attr('method') || 'GET', + iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank' + }, options); + + // hook for manipulating the form data before it is extracted; + // convenient for use with rich editors like tinyMCE or FCKEditor + var veto = {}; + this.trigger('form-pre-serialize', [this, options, veto]); + if (veto.veto) { + log('ajaxSubmit: submit vetoed via form-pre-serialize trigger'); + return this; + } + + // provide opportunity to alter form data before it is serialized + if (options.beforeSerialize && options.beforeSerialize(this, options) === false) { + log('ajaxSubmit: submit aborted via beforeSerialize callback'); + return this; + } + + var n,v,a = this.formToArray(options.semantic); + if (options.data) { + options.extraData = options.data; + for (n in options.data) { + if(options.data[n] instanceof Array) { + for (var k in options.data[n]) { + a.push( { name: n, value: options.data[n][k] } ); + } + } + else { + v = options.data[n]; + v = $.isFunction(v) ? v() : v; // if value is fn, invoke it + a.push( { name: n, value: v } ); + } + } + } + + // give pre-submit callback an opportunity to abort the submit + if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) { + log('ajaxSubmit: submit aborted via beforeSubmit callback'); + return this; + } + + // fire vetoable 'validate' event + this.trigger('form-submit-validate', [a, this, options, veto]); + if (veto.veto) { + log('ajaxSubmit: submit vetoed via form-submit-validate trigger'); + return this; + } + + var q = $.param(a); + + if (options.type.toUpperCase() == 'GET') { + options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q; + options.data = null; // data is null for 'get' + } + else { + options.data = q; // data is the query string for 'post' + } + + var $form = this, callbacks = []; + if (options.resetForm) { + callbacks.push(function() { $form.resetForm(); }); + } + if (options.clearForm) { + callbacks.push(function() { $form.clearForm(); }); + } + + // perform a load on the target only if dataType is not provided + if (!options.dataType && options.target) { + var oldSuccess = options.success || function(){}; + callbacks.push(function(data) { + var fn = options.replaceTarget ? 'replaceWith' : 'html'; + $(options.target)[fn](data).each(oldSuccess, arguments); + }); + } + else if (options.success) { + callbacks.push(options.success); + } + + options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg + var context = options.context || options; // jQuery 1.4+ supports scope context + for (var i=0, max=callbacks.length; i < max; i++) { + callbacks[i].apply(context, [data, status, xhr || $form, $form]); + } + }; + + // are there files to upload? + var fileInputs = $('input:file', this).length > 0; + var mp = 'multipart/form-data'; + var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp); + + // options.iframe allows user to force iframe mode + // 06-NOV-09: now defaulting to iframe mode if file input is detected + if (options.iframe !== false && (fileInputs || options.iframe || multipart)) { + // hack to fix Safari hang (thanks to Tim Molendijk for this) + // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d + if (options.closeKeepAlive) { + $.get(options.closeKeepAlive, fileUpload); + } + else { + fileUpload(); + } + } + else { + $.ajax(options); + } + + // fire 'notify' event + this.trigger('form-submit-notify', [this, options]); + return this; + + + // private function for handling file uploads (hat tip to YAHOO!) + function fileUpload() { + var form = $form[0]; + + if ($(':input[name=submit],:input[id=submit]', form).length) { + // if there is an input with a name or id of 'submit' then we won't be + // able to invoke the submit fn on the form (at least not x-browser) + alert('Error: Form elements must not have name or id of "submit".'); + return; + } + + var s = $.extend(true, {}, $.ajaxSettings, options); + s.context = s.context || s; + var id = 'jqFormIO' + (new Date().getTime()), fn = '_'+id; + window[fn] = function() { + var f = $io.data('form-plugin-onload'); + if (f) { + f(); + window[fn] = undefined; + try { delete window[fn]; } catch(e){} + } + }; + var $io = $('