]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch 'master' into FeedPoller
authorMikael Nordfeldth <mmn@hethane.se>
Thu, 6 Mar 2014 00:15:19 +0000 (01:15 +0100)
committerMikael Nordfeldth <mmn@hethane.se>
Thu, 6 Mar 2014 00:15:19 +0000 (01:15 +0100)
95 files changed:
CONFIGURE
EVENTS.txt
INSTALL
actions/all.php
actions/apigroupjoin.php
actions/apitimelinementions.php
actions/blockedfromgroup.php
actions/editgroup.php
actions/groupblock.php
actions/grouplogo.php
actions/groupmembers.php
actions/groupqueue.php
actions/showgroup.php
actions/shownotice.php
actions/snapshotadminpanel.php [deleted file]
classes/Conversation.php
classes/File.php
classes/Notice.php
classes/Profile.php
classes/User.php
index.php
install.php
js/Makefile
js/extlib/jquery-ui/jquery-ui.min.js [deleted file]
js/extlib/jquery.cookie.min.js [deleted file]
js/extlib/jquery.form.min.js [deleted file]
js/extlib/jquery.infieldlabel.min.js [deleted file]
js/extlib/jquery.min.js [deleted file]
js/extlib/json2.min.js [deleted file]
js/util.js
js/util.min.js [deleted file]
lib/action.php
lib/adminpanelnav.php
lib/apiaction.php
lib/apignusocialoauthdatastore.php
lib/attachmentlist.php
lib/default.php
lib/groupaction.php
lib/installer.php
lib/mail.php
lib/microappplugin.php
lib/noticelist.php
lib/plugin.php
lib/queuemanager.php
lib/router.php
lib/snapshot.php [deleted file]
lib/threadednoticelist.php
lib/util.php
plugins/Autocomplete/actions/autocomplete.php
plugins/Comet/CometPlugin.php
plugins/Comet/bayeux.class.inc.php [deleted file]
plugins/Comet/cometupdate.js [deleted file]
plugins/Comet/extlib/Bayeux/Bayeux.class.php [new file with mode: 0644]
plugins/Comet/jquery.comet.js [deleted file]
plugins/Comet/js/cometupdate.js [new file with mode: 0644]
plugins/Comet/js/jquery.comet.js [new file with mode: 0644]
plugins/LinkPreview/LinkPreviewPlugin.php
plugins/LinkPreview/js/linkpreview.js [new file with mode: 0644]
plugins/LinkPreview/linkpreview.js [deleted file]
plugins/LinkPreview/linkpreview.min.js [deleted file]
plugins/Meteor/MeteorPlugin.php
plugins/Meteor/js/meteorupdater.js [new file with mode: 0644]
plugins/Meteor/meteorupdater.js [deleted file]
plugins/Meteor/meteorupdater.min.js [deleted file]
plugins/OStatus/OStatusPlugin.php
plugins/OStatus/actions/ostatusinit.php
plugins/OStatus/actions/ostatussub.php
plugins/OStatus/actions/pushcallback.php
plugins/OStatus/classes/FeedSub.php
plugins/OStatus/classes/Magicsig.php
plugins/Orbited/OrbitedPlugin.php
plugins/Orbited/js/orbitedextra.js [new file with mode: 0644]
plugins/Orbited/js/orbitedupdater.js [new file with mode: 0644]
plugins/Orbited/orbitedextra.js [deleted file]
plugins/Orbited/orbitedupdater.js [deleted file]
plugins/QnA/QnAPlugin.php
plugins/Realtime/RealtimePlugin.php
plugins/Realtime/css/realtimeupdate.css [new file with mode: 0644]
plugins/Realtime/js/realtimeupdate.js [new file with mode: 0644]
plugins/Realtime/realtimeupdate.css [deleted file]
plugins/Realtime/realtimeupdate.js [deleted file]
plugins/Realtime/realtimeupdate.min.js [deleted file]
plugins/SubMirror/actions/addmirror.php
plugins/SubMirror/actions/basemirror.php
plugins/SubMirror/actions/editmirror.php
plugins/SubMirror/actions/mirrorsettings.php
plugins/SubMirror/forms/addtwitter.php [deleted file]
plugins/SubMirror/images/providers/twitter.png [deleted file]
plugins/SubMirror/lib/addmirrorwizard.php
plugins/TwitterBridge/lib/twitterimport.php
plugins/TwitterBridge/lib/twitteroauthclient.php
scripts/getvaliddaemons.php
scripts/reportsnapshot.php [deleted file]
theme/neo/logo.png
theme/neo/mobilelogo.png

index d41f64b44f5ab2e895cf87274cc70bcb352ce171..8abc0513a980b8dc1abb4f70bce4f4783586aa24 100644 (file)
--- a/CONFIGURE
+++ b/CONFIGURE
@@ -182,6 +182,8 @@ sending out SMS email or XMPP messages, for off-line processing. See
 'Queues and daemons' above for how to set this up.
 
 enabled: Whether to uses queues. Defaults to false.
+daemon: Wather to use queuedaemon. Defaults to false, which means
+    you'll use OpportunisticQM plugin.
 subsystem: Which kind of queueserver to use. Values include "db" for
     our hacked-together database queuing (no other server
     required) and "stomp" for a stomp server.
@@ -532,32 +534,6 @@ welcome: nickname of a user account that sends welcome messages to new
 If either of these special user accounts are specified, the users should
 be created before the configuration is updated.
 
-snapshot
---------
-
-The software will, by default, send statistical snapshots about the
-local installation to a stats server on the status.net Web site. This
-data is used by the developers to prioritize development decisions. No
-identifying data about users or organizations is collected. The data
-is available to the public for review. Participating in this survey
-helps StatusNet developers take your needs into account when updating
-the software.
-
-run: string indicating when to run the statistics. Values can be 'web'
-    (run occasionally at Web time), 'cron' (run from a cron script),
-    or 'never' (don't ever run). If you set it to 'cron', remember to
-    schedule the script to run on a regular basis.
-frequency: if run value is 'web', how often to report statistics.
-    Measured in Web hits; depends on how active your site is.
-    Default is 10000 -- that is, one report every 10000 Web hits,
-    on average.
-reporturl: URL to post statistics to. Defaults to StatusNet developers'
-    report system, but if they go evil or disappear you may
-    need to update this to another value. Note: if you
-    don't want to report stats, it's much better to
-    set 'run' to 'never' than to set this value to something
-    nonsensical.
-
 attachments
 -----------
 
index fd75036894293bc5d2305f7364f2373d63d0bbfd..0a1951d6403fb8b8f0ac8329dd550a547901a174 100644 (file)
@@ -966,6 +966,9 @@ StartShowNoticeForm: before showing the notice form (before <form>)
 EndShowNoticeForm: after showing the notice form (after <form>)
 - $action: action being executed
 
+StartShowEntryForms: microapp entry form tab data
+- &$tabs: tab assoc array with 'tag' => (title, href to create new entry)
+
 StartGrantRole: when a role is being assigned
 - $profile: profile that will have the role
 - $role: string name of the role
diff --git a/INSTALL b/INSTALL
index bac8d3400504fca8b93466575e0e196b1ee25bb9..20817f300926e5f6d1d8000969a84fd3567805e2 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -368,12 +368,41 @@ Queues and daemons
 ------------------
 
 Some activities that StatusNet needs to do, like broadcast OStatus, SMS,
-and XMPP messages, can be 'queued' and done by off-line bots instead.
-For this to work, you must be able to run long-running offline
-processes, either on your main Web server or on another server you
-control. (Your other server will still need all the above
-prerequisites, with the exception of Apache.) Installing on a separate
-server is probably a good idea for high-volume sites.
+XMPP messages and TwitterBridge operations, can be 'queued' and done by
+off-line bots instead.
+
+Two mechanisms are available to achieve offline operations:
+
+* New embedded OpportunisticQM plugin, which is enabled by default
+* Legacy queuedaemon script, which can be enabled via config file.
+
+### OpportunisticQM plugin
+
+This plugin is enabled by default. It tries its best to do background
+job during regular HTTP requests, like API or HTML pages calls.
+
+Since queueing system is enabled by default, notices to be broadcasted
+will be stored, by default, into DB (table queue_item).
+
+Each time it can, OpportunisticQM will try to handle some of them.
+
+This is a good solution whether you:
+
+* have no access to command line (shared hosting)
+* do not want to deal with long-running PHP processes
+* run a low traffic GNU social instance
+
+In other case, you really should consider enabling the queuedaemon for
+performance reasons. Background daemons are necessary anyway if you wish
+to use the Instant Messaging features such as communicating via XMPP.
+
+### queuedaemon
+
+If you want to use legacy queuedaemon, you must be able to run
+long-running offline processes, either on your main Web server or on
+another server you control. (Your other server will still need all the
+above prerequisites, with the exception of Apache.) Installing on a
+separate server is probably a good idea for high-volume sites.
 
 1. You'll need the "CLI" (command-line interface) version of PHP
    installed on whatever server you use.
@@ -399,6 +428,7 @@ server is probably a good idea for high-volume sites.
    server!), set the following variable:
 
        $config['queue']['enabled'] = true;
+       $config['queue']['daemon'] = true;
 
    You may also want to look at the 'daemon' section of this file for
    more daemon options. Note that if you set the 'user' and/or 'group'
@@ -412,7 +442,7 @@ This will run the queue handlers:
 * queuedaemon.php - polls for queued items for inbox processing and
   pushing out to OStatus, SMS, XMPP, etc.
 * imdaemon.php - if an IM plugin is enabled (like XMPP)
-* other daemons that you may have enabled
+* other daemons, like TwitterBridge ones, that you may have enabled
 
 These daemons will automatically restart in most cases of failure
 including memory leaks (if a memory_limit is set), but may still die
index 1d9509f6db14a29333b82a1da533855024ce9907..f794064f877d14d9b2f73b1eabe7bbe3cc500edc 100644 (file)
  * @author   Sarven Capadisli <csarven@status.net>
  * @author   Siebrand Mazeland <s.mazeland@xs4all.nl>
  * @author   Zach Copley <zach@status.net>
- * @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
+ * @copyright 2009-2014 Free Software Foundation, Inc http://www.fsf.org
  * @license  GNU Affero General Public License http://www.gnu.org/licenses/
  * @link     http://status.net
  */
 
-if (!defined('STATUSNET') && !defined('LACONICA')) {
-    exit(1);
-}
-
-require_once INSTALLDIR.'/lib/personalgroupnav.php';
-require_once INSTALLDIR.'/lib/noticelist.php';
-require_once INSTALLDIR.'/lib/feedlist.php';
+if (!defined('GNUSOCIAL') && !defined('STATUSNET')) { exit(1); }
 
 class AllAction extends ProfileAction
 {
@@ -52,16 +46,16 @@ class AllAction extends ProfileAction
         return true;
     }
 
-    function prepare($args)
+    protected function prepare(array $args=array())
     {
         parent::prepare($args);
 
         $user = common_current_user();
 
         if (!empty($user) && $user->streamModeOnly()) {
-            $stream = new InboxNoticeStream($this->user, Profile::current());
+            $stream = new InboxNoticeStream($this->target, $this->scoped);
         } else {
-            $stream = new ThreadingInboxNoticeStream($this->user, Profile::current());
+            $stream = new ThreadingInboxNoticeStream($this->target, $this->scoped);
         }
 
         $this->notice = $stream->getNotices(($this->page-1)*NOTICES_PER_PAGE,
@@ -75,14 +69,13 @@ class AllAction extends ProfileAction
         return true;
     }
 
-    function handle($args)
+    protected function handle()
     {
-        parent::handle($args);
+        parent::handle();
 
-        if (!$this->user) {
+        if (!$this->target instanceof Profile) {
             // TRANS: Client error when user not found for an action.
             $this->clientError(_('No such user.'));
-            return;
         }
 
         $this->showPage();
@@ -90,15 +83,13 @@ class AllAction extends ProfileAction
 
     function title()
     {
-        $user = common_current_user();
-        if (!empty($user) && $user->id == $this->user->id) {
+        if (!empty($this->scoped) && $this->scoped->id == $this->target->id) {
             // TRANS: Title of a user's own start page.
             return _('Home timeline');
         } else {
-            $profile = $this->user->getProfile();
             // TRANS: Title of another user's start page.
             // TRANS: %s is the other user's name.
-            return sprintf(_("%s's home timeline"), $profile->getBestName());
+            return sprintf(_("%s's home timeline"), $this->target->getBestName());
         }
     }
 
@@ -109,60 +100,59 @@ class AllAction extends ProfileAction
                 common_local_url(
                     'ApiTimelineFriends', array(
                         'format' => 'as',
-                        'id' => $this->user->nickname
+                        'id' => $this->target->nickname
                     )
                 ),
                 // TRANS: %s is user nickname.
-                sprintf(_('Feed for friends of %s (Activity Streams JSON)'), $this->user->nickname)),
+                sprintf(_('Feed for friends of %s (Activity Streams JSON)'), $this->target->nickname)),
             new Feed(Feed::RSS1,
                 common_local_url(
                     'allrss', array(
                         'nickname' =>
-                        $this->user->nickname)
+                        $this->target->nickname)
                 ),
                 // TRANS: %s is user nickname.
-                sprintf(_('Feed for friends of %s (RSS 1.0)'), $this->user->nickname)),
+                sprintf(_('Feed for friends of %s (RSS 1.0)'), $this->target->nickname)),
             new Feed(Feed::RSS2,
                 common_local_url(
                     'ApiTimelineFriends', array(
                         'format' => 'rss',
-                        'id' => $this->user->nickname
+                        'id' => $this->target->nickname
                     )
                 ),
                 // TRANS: %s is user nickname.
-                sprintf(_('Feed for friends of %s (RSS 2.0)'), $this->user->nickname)),
+                sprintf(_('Feed for friends of %s (RSS 2.0)'), $this->target->nickname)),
             new Feed(Feed::ATOM,
                 common_local_url(
                     'ApiTimelineFriends', array(
                         'format' => 'atom',
-                        'id' => $this->user->nickname
+                        'id' => $this->target->nickname
                     )
                 ),
                 // TRANS: %s is user nickname.
-                sprintf(_('Feed for friends of %s (Atom)'), $this->user->nickname))
+                sprintf(_('Feed for friends of %s (Atom)'), $this->target->nickname))
         );
     }
 
     function showEmptyListMessage()
     {
         // TRANS: Empty list message. %s is a user nickname.
-        $message = sprintf(_('This is the timeline for %s and friends but no one has posted anything yet.'), $this->user->nickname) . ' ';
+        $message = sprintf(_('This is the timeline for %s and friends but no one has posted anything yet.'), $this->target->nickname) . ' ';
 
         if (common_logged_in()) {
-            $current_user = common_current_user();
-            if ($this->user->id === $current_user->id) {
+            if ($this->target->id === $this->scoped->id) {
                 // TRANS: Encouragement displayed on logged in user's empty timeline.
                 // TRANS: This message contains Markdown links. Keep "](" together.
                 $message .= _('Try subscribing to more people, [join a group](%%action.groups%%) or post something yourself.');
             } else {
                 // TRANS: %1$s is user nickname, %2$s is user nickname, %2$s is user nickname prefixed with "@".
                 // TRANS: This message contains Markdown links. Keep "](" together.
-                $message .= sprintf(_('You can try to [nudge %1$s](../%2$s) from their profile or [post something to them](%%%%action.newnotice%%%%?status_textarea=%3$s).'), $this->user->nickname, $this->user->nickname, '@' . $this->user->nickname);
+                $message .= sprintf(_('You can try to [nudge %1$s](../%2$s) from their profile or [post something to them](%%%%action.newnotice%%%%?status_textarea=%3$s).'), $this->target->nickname, $this->target->nickname, '@' . $this->target->nickname);
             }
         } else {
             // TRANS: Encouragement displayed on empty timeline user pages for anonymous users.
             // TRANS: %s is a user nickname. This message contains Markdown links. Keep "](" together.
-            $message .= sprintf(_('Why not [register an account](%%%%action.register%%%%) and then nudge %s or post a notice to them.'), $this->user->nickname);
+            $message .= sprintf(_('Why not [register an account](%%%%action.register%%%%) and then nudge %s or post a notice to them.'), $this->target->nickname);
         }
 
         $this->elementStart('div', 'guide');
@@ -196,7 +186,7 @@ class AllAction extends ProfileAction
 
             $this->pagination(
                 $this->page > 1, $cnt > NOTICES_PER_PAGE,
-                $this->page, 'all', array('nickname' => $this->user->nickname)
+                $this->page, 'all', array('nickname' => $this->target->nickname)
             );
 
             Event::handle('EndShowAllContent', array($this));
@@ -225,7 +215,7 @@ class AllAction extends ProfileAction
         if (!common_config('performance', 'high')) {
             $pop = new PopularNoticeSection($this, Profile::current());
             $pop->show();
-            $pop = new InboxTagCloudSection($this, $this->user);
+            $pop = new InboxTagCloudSection($this, $this->target);
             $pop->show();
         }
     }
index 10081ae1b599be023a53b8ead7bb679a01cce37f..3e571801f265ac3fd21493beb5491931367e6b65 100644 (file)
@@ -72,7 +72,7 @@ class ApiGroupJoinAction extends ApiAuthAction
     /**
      * Handle the request
      *
-     * Save the new message
+     * Join the authenticated user to the group
      *
      * @return void
      */
@@ -80,7 +80,7 @@ class ApiGroupJoinAction extends ApiAuthAction
     {
         parent::handle();
 
-        if (empty($this->user)) {
+        if (empty($this->scoped)) {
             // TRANS: Client error displayed when trying to have a non-existing user join a group.
             $this->clientError(_('No such user.'), 404);
         }
@@ -90,23 +90,23 @@ class ApiGroupJoinAction extends ApiAuthAction
             $this->clientError(_('Group not found.'), 404);
         }
 
-        if ($this->user->isMember($this->group)) {
+        if ($this->scoped->isMember($this->group)) {
             // TRANS: Server error displayed when trying to join a group the user is already a member of.
             $this->clientError(_('You are already a member of that group.'), 403);
         }
 
-        if (Group_block::isBlocked($this->group, $this->user->getProfile())) {
+        if (Group_block::isBlocked($this->group, $this->scoped)) {
             // TRANS: Server error displayed when trying to join a group the user is blocked from joining.
             $this->clientError(_('You have been blocked from that group by the admin.'), 403);
         }
 
         try {
-            $this->user->joinGroup($this->group);
+            $this->scoped->joinGroup($this->group);
         } catch (Exception $e) {
             // TRANS: Server error displayed when joining a group failed in the database.
             // TRANS: %1$s is the joining user's nickname, $2$s is the group nickname for which the join failed.
             $this->serverError(sprintf(_('Could not join user %1$s to group %2$s.'),
-                                       $cur->nickname, $this->group->nickname));
+                                       $this->scoped->nickname, $this->group->nickname));
         }
 
         switch($this->format) {
index ce6c73c0d18b6d62e4c5f1b2e7114d970b9d1dce..c1811ac01bb77e9fcdc23385f7136cb3581f8b2e 100644 (file)
@@ -119,8 +119,8 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction
             // TRANS: Subtitle for timeline of most recent mentions of a user.
             // TRANS: %1$s is the StatusNet sitename, %2$s is a user nickname,
             // TRANS: %3$s is a user's full name.
-            _('%1$s updates that reply to updates from %2$s / %3$s.'),
-            $sitename, $this->target->getBestName(), $this->target->nickname
+            _('%1$s updates that reply to updates from %3$s / %2$s.'),
+            $sitename, $this->target->nickname, $this->target->getBestName()
         );
 
         switch($this->format) {
index 685d6dd06822a7d7ba49b0c95135f9bddf7eff4e..a00c12ef583c755e883775485ec13d95369a2102 100644 (file)
@@ -49,7 +49,7 @@ class BlockedfromgroupAction extends GroupAction
         return true;
     }
 
-    function prepare($args)
+    protected function prepare(array $args=array())
     {
         parent::prepare($args);
         $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
@@ -109,9 +109,9 @@ class BlockedfromgroupAction extends GroupAction
         }
     }
 
-    function handle($args)
+    protected function handle()
     {
-        parent::handle($args);
+        parent::handle();
         $this->showPage();
     }
 
index 1f7788068422bd926223384412fbd4139033c60a..befbd55992941714d6da921c9ce80dacb215137e 100644 (file)
@@ -59,7 +59,7 @@ class EditgroupAction extends GroupAction
      * Prepare to run
      */
 
-    function prepare($args)
+    protected function prepare(array $args=array())
     {
         parent::prepare($args);
 
@@ -119,13 +119,11 @@ class EditgroupAction extends GroupAction
      *
      * On GET, show the form. On POST, try to save the group.
      *
-     * @param array $args unused
-     *
      * @return void
      */
-    function handle($args)
+    protected function handle()
     {
-        parent::handle($args);
+        parent::handle();
         if ($_SERVER['REQUEST_METHOD'] == 'POST') {
             $this->trySave();
         } else {
@@ -177,7 +175,7 @@ class EditgroupAction extends GroupAction
                 $nickname = Nickname::normalize($nickname, true);
             } catch (NicknameTakenException $e) {
                 // Abort only if the nickname is occupied by _another_ group
-                if ($e->profile->id != $this->group->id) {
+                if ($e->profile->id != $this->group->profile_id) {
                     $this->showForm($e->getMessage());
                     return;
                 }
index 2dbb89751451a718162de6caae220940d51fea28..1c6ccb9e59605ae00349f9a89f709fab2671b7a4 100644 (file)
@@ -58,54 +58,45 @@ class GroupblockAction extends RedirectingAction
         if (!common_logged_in()) {
             // TRANS: Error message displayed when trying to perform an action that requires a logged in user.
             $this->clientError(_('Not logged in.'));
-            return false;
         }
         $token = $this->trimmed('token');
         if (empty($token) || $token != common_session_token()) {
             // TRANS: Client error displayed when the session token does not match or is not given.
             $this->clientError(_('There was a problem with your session token. Try again, please.'));
-            return;
         }
         $id = $this->trimmed('blockto');
         if (empty($id)) {
             // TRANS: Client error displayed trying to block a user from a group while not specifying a to be blocked user profile.
             $this->clientError(_('No profile specified.'));
-            return false;
         }
         $this->profile = Profile::getKV('id', $id);
         if (empty($this->profile)) {
             // TRANS: Client error displayed trying to block a user from a group while specifying a non-existing profile.
             $this->clientError(_('No profile with that ID.'));
-            return false;
         }
         $group_id = $this->trimmed('blockgroup');
         if (empty($group_id)) {
             // TRANS: Client error displayed trying to block a user from a group while not specifying a group to block a profile from.
             $this->clientError(_('No group specified.'));
-            return false;
         }
         $this->group = User_group::getKV('id', $group_id);
         if (empty($this->group)) {
             // TRANS: Client error displayed trying to block a user from a group while specifying a non-existing group.
             $this->clientError(_('No such group.'));
-            return false;
         }
         $user = common_current_user();
         if (!$user->isAdmin($this->group)) {
             // TRANS: Client error displayed trying to block a user from a group while not being an admin user.
             $this->clientError(_('Only an admin can block group members.'), 401);
-            return false;
         }
         if (Group_block::isBlocked($this->group, $this->profile)) {
             // TRANS: Client error displayed trying to block a user from a group while user is already blocked from the given group.
             $this->clientError(_('User is already blocked from group.'));
-            return false;
         }
         // XXX: could have proactive blocks, but we don't have UI for it.
         if (!$this->profile->isMember($this->group)) {
             // TRANS: Client error displayed trying to block a user from a group while user is not a member of given group.
             $this->clientError(_('User is not a member of group.'));
-            return false;
         }
         return true;
     }
index 1e62514312a3af49150aa5b549251872002d451a..adffe63c388118999c9eda9eba874632a110d7e7 100644 (file)
@@ -60,7 +60,7 @@ class GrouplogoAction extends GroupAction
     /**
      * Prepare to run
      */
-    function prepare($args)
+    protected function prepare(array $args=array())
     {
         parent::prepare($args);
 
@@ -115,9 +115,9 @@ class GrouplogoAction extends GroupAction
         return true;
     }
 
-    function handle($args)
+    protected function handle()
     {
-        parent::handle($args);
+        parent::handle();
         if ($_SERVER['REQUEST_METHOD'] == 'POST') {
             $this->handlePost();
         } else {
index 52979101fd25e337a09e92c58285f02c1fac733c..44c4dd6f9963d27dbda9bbcf1a8be576f03e306b 100644 (file)
@@ -52,7 +52,7 @@ class GroupmembersAction extends GroupAction
         return true;
     }
 
-    function prepare($args)
+    protected function prepare(array $args=array())
     {
         parent::prepare($args);
 
@@ -77,9 +77,9 @@ class GroupmembersAction extends GroupAction
         }
     }
 
-    function handle($args)
+    protected function handle()
     {
-        parent::handle($args);
+        parent::handle();
         $this->showPage();
     }
 
index 1d5a3cd1341c470c5549c021346561f685521584..7227b1109029dc75b169c9ef454147b4b815d0cb 100644 (file)
@@ -53,7 +53,7 @@ class GroupqueueAction extends GroupAction
     }
 
     // @todo FIXME: most of this belongs in a base class, sounds common to most group actions?
-    function prepare($args)
+    protected function prepare(array $args=array())
     {
         parent::prepare($args);
         $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
@@ -119,9 +119,9 @@ class GroupqueueAction extends GroupAction
         }
     }
 
-    function handle($args)
+    protected function handle()
     {
-        parent::handle($args);
+        parent::handle();
         $this->showPage();
     }
 
index 10601e58b4e95192ebe1356dc8912e2114d6d00b..e2b5e8d547cb6ac8eea41e8f7e1f3c0592ace1df 100644 (file)
@@ -91,7 +91,7 @@ class ShowgroupAction extends GroupAction
      *
      * @return boolean success flag
      */
-    function prepare($args)
+    protected function prepare(array $args=array())
     {
         parent::prepare($args);
 
@@ -123,8 +123,9 @@ class ShowgroupAction extends GroupAction
      *
      * @return void
      */
-    function handle($args)
+    protected function handle()
     {
+        parent::handle();
         $this->showPage();
     }
 
index 6a026d2d364ea63c55f5b40712b719ac3673c921..1f92978062755b8d538fe685d29e349d58aa97f5 100644 (file)
@@ -70,7 +70,7 @@ class ShownoticeAction extends Action
      *
      * @return success flag
      */
-    function prepare($args)
+    protected function prepare(array $args=array())
     {
         parent::prepare($args);
         if ($this->boolean('ajax')) {
@@ -117,16 +117,16 @@ class ShownoticeAction extends Action
      *
      * @return Notice
      */
-    function getNotice()
+    protected function getNotice()
     {
         $id = $this->arg('notice');
 
         $notice = Notice::getKV('id', $id);
 
-        if (empty($notice)) {
+        if (!$notice instanceof Notice) {
             // Did we used to have it, and it got deleted?
             $deleted = Deleted_notice::getKV($id);
-            if (!empty($deleted)) {
+            if ($deleted instanceof Deleted_notice) {
                 // TRANS: Client error displayed trying to show a deleted notice.
                 $this->clientError(_('Notice deleted.'), 410);
             } else {
@@ -211,9 +211,9 @@ class ShownoticeAction extends Action
      *
      * @return void
      */
-    function handle($args)
+    protected function handle()
     {
-        parent::handle($args);
+        parent::handle();
 
         if ($this->boolean('ajax')) {
             $this->showAjax();
diff --git a/actions/snapshotadminpanel.php b/actions/snapshotadminpanel.php
deleted file mode 100644 (file)
index 214b3d6..0000000
+++ /dev/null
@@ -1,255 +0,0 @@
-<?php
-/**
- * StatusNet, the distributed open-source microblogging tool
- *
- * Snapshots administration panel
- *
- * PHP version 5
- *
- * LICENCE: This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- * @category  Settings
- * @package   StatusNet
- * @author    Zach Copley <zach@status.net>
- * @copyright 2010 StatusNet, Inc.
- * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link      http://status.net/
- */
-
-if (!defined('STATUSNET')) {
-    exit(1);
-}
-
-/**
- * Manage snapshots
- *
- * @category Admin
- * @package  StatusNet
- * @author   Zach Copley <zach@status.net>
- * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link     http://status.net/
- */
-class SnapshotadminpanelAction extends AdminPanelAction
-{
-    /**
-     * Returns the page title
-     *
-     * @return string page title
-     */
-    function title()
-    {
-        // TRANS: Title for admin panel to configure snapshots.
-        return _m('TITLE','Snapshots');
-    }
-
-    /**
-     * Instructions for using this form.
-     *
-     * @return string instructions
-     */
-    function getInstructions()
-    {
-        // TRANS: Instructions for admin panel to configure snapshots.
-        return _('Manage snapshot configuration');
-    }
-
-    /**
-     * Show the snapshots admin panel form
-     *
-     * @return void
-     */
-    function showForm()
-    {
-        $form = new SnapshotAdminPanelForm($this);
-        $form->show();
-        return;
-    }
-
-    /**
-     * Save settings from the form
-     *
-     * @return void
-     */
-    function saveSettings()
-    {
-        static $settings = array(
-            'snapshot' => array('run', 'reporturl', 'frequency')
-        );
-
-        $values = array();
-
-        foreach ($settings as $section => $parts) {
-            foreach ($parts as $setting) {
-                $values[$section][$setting] = $this->trimmed($setting);
-            }
-        }
-
-        // This throws an exception on validation errors
-
-        $this->validate($values);
-
-        // assert(all values are valid);
-
-        $config = new Config();
-
-        $config->query('BEGIN');
-
-        foreach ($settings as $section => $parts) {
-            foreach ($parts as $setting) {
-                Config::save($section, $setting, $values[$section][$setting]);
-            }
-        }
-
-        $config->query('COMMIT');
-
-        return;
-    }
-
-    function validate(&$values)
-    {
-        // Validate snapshot run value
-
-        if (!in_array($values['snapshot']['run'], array('web', 'cron', 'never'))) {
-            // TRANS: Client error displayed on admin panel for snapshots when providing an invalid run value.
-            $this->clientError(_('Invalid snapshot run value.'));
-        }
-
-        // Validate snapshot frequency value
-
-        if (!Validate::number($values['snapshot']['frequency'])) {
-            // TRANS: Client error displayed on admin panel for snapshots when providing an invalid value for frequency.
-            $this->clientError(_('Snapshot frequency must be a number.'));
-        }
-
-        // Validate report URL
-
-        if (!is_null($values['snapshot']['reporturl'])
-                && !common_valid_http_url($values['snapshot']['reporturl'])) {
-            // TRANS: Client error displayed on admin panel for snapshots when providing an invalid report URL.
-            $this->clientError(_('Invalid snapshot report URL.'));
-        }
-    }
-}
-
-// @todo FIXME: add documentation
-class SnapshotAdminPanelForm extends AdminForm
-{
-    /**
-     * ID of the form
-     *
-     * @return int ID of the form
-     */
-    function id()
-    {
-        return 'form_snapshot_admin_panel';
-    }
-
-    /**
-     * class of the form
-     *
-     * @return string class of the form
-     */
-    function formClass()
-    {
-        return 'form_settings';
-    }
-
-    /**
-     * Action of the form
-     *
-     * @return string URL of the action
-     */
-    function action()
-    {
-        return common_local_url('snapshotadminpanel');
-    }
-
-    /**
-     * Data elements of the form
-     *
-     * @return void
-     */
-    function formData()
-    {
-        $this->out->elementStart(
-            'fieldset',
-            array('id' => 'settings_admin_snapshots')
-        );
-        // TRANS: Fieldset legend on admin panel for snapshots.
-        $this->out->element('legend', null, _m('LEGEND','Snapshots'));
-        $this->out->elementStart('ul', 'form_data');
-        $this->li();
-        $snapshot = array(
-            // TRANS: Option in dropdown for snapshot method in admin panel for snapshots.
-            'web' => _('Randomly during web hit'),
-            // TRANS: Option in dropdown for snapshot method in admin panel for snapshots.
-            'cron'  => _('In a scheduled job'),
-            // TRANS: Option in dropdown for snapshot method in admin panel for snapshots.
-            'never' => _('Never')
-        );
-        $this->out->dropdown(
-            'run',
-            // TRANS: Dropdown label for snapshot method in admin panel for snapshots.
-            _('Data snapshots'),
-            $snapshot,
-            // TRANS: Dropdown title for snapshot method in admin panel for snapshots.
-            _('When to send statistical data to status.net servers.'),
-            false,
-            $this->value('run', 'snapshot')
-        );
-        $this->unli();
-
-        $this->li();
-        $this->input(
-            'frequency',
-            // TRANS: Input field label for snapshot frequency in admin panel for snapshots.
-            _('Frequency'),
-            // TRANS: Input field title for snapshot frequency in admin panel for snapshots.
-            _('Snapshots will be sent once every N web hits.'),
-            'snapshot'
-        );
-        $this->unli();
-
-        $this->li();
-        $this->input(
-            'reporturl',
-            // TRANS: Input field label for snapshot report URL in admin panel for snapshots.
-            _('Report URL'),
-            // TRANS: Input field title for snapshot report URL in admin panel for snapshots.
-            _('Snapshots will be sent to this URL.'),
-            'snapshot'
-        );
-        $this->unli();
-        $this->out->elementEnd('ul');
-        $this->out->elementEnd('fieldset');
-    }
-
-    /**
-     * Action elements
-     *
-     * @return void
-     */
-    function formActions()
-    {
-        $this->out->submit(
-            'submit',
-            // TRANS: Button text to save snapshot settings.
-            _m('BUTTON','Save'),
-            'submit',
-            null,
-            // TRANS: Button title to save snapshot settings.
-            _('Save snapshot settings.')
-        );
-    }
-}
index 23f8dada0b316dfe0ef7c4b2c5a7eddc32d5a614..c76b0169ffbd48408e656c56f75de7fe55542879 100755 (executable)
  * @category  Data
  * @package   StatusNet
  * @author    Zach Copley <zach@status.net>
+ * @author    Mikael Nordfeldth <mmn@hethane.se>
  * @copyright 2010 StatusNet Inc.
+ * @copyright 2009-2014 Free Software Foundation, Inc http://www.fsf.org
  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link      http://status.net/
  */
 
-require_once INSTALLDIR . '/classes/Memcached_DataObject.php';
+if (!defined('GNUSOCIAL')) { exit(1); }
 
 class Conversation extends Managed_DataObject
 {
-    ###START_AUTOCODE
-    /* the code below is auto generated do not remove the above tag */
-
-    public $__table = 'conversation';                    // table name
+    public $__table = 'conversation';        // table name
     public $id;                              // int(4)  primary_key not_null
     public $uri;                             // varchar(255)  unique_key
     public $created;                         // datetime   not_null
     public $modified;                        // timestamp   not_null default_CURRENT_TIMESTAMP
 
-    /* the code above is auto generated do not remove the tag below */
-    ###END_AUTOCODE
-
     public static function schemaDef()
     {
         return array(
             'fields' => array(
-                'id' => array('type' => 'serial', 'not null' => true, 'description' => 'unique identifier'),
+                'id' => array('type' => 'int', 'not null' => true, 'description' => 'should be set from root notice id (since 2014-03-01 commit)'),
                 'uri' => array('type' => 'varchar', 'length' => 255, 'description' => 'URI of the conversation'),
                 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
                 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
@@ -64,25 +60,20 @@ class Conversation extends Managed_DataObject
      *
      * @return Conversation the new conversation DO
      */
-    static function create()
+    static function create(Notice $notice)
     {
+        if (empty($notice->id)) {
+            throw new ServerException(_('Tried to create conversation for not yet inserted notice'));
+        }
         $conv = new Conversation();
         $conv->created = common_sql_now();
-        $id = $conv->insert();
+        $conv->id = $notice->id;
+        $conv->uri = common_local_url('conversation', array('id' => $notice->id), null, null, false);
+        $result = $conv->insert();
 
-        if (empty($id)) {
+        if ($result === false) {
             common_log_db_error($conv, 'INSERT', __FILE__);
-            return null;
-        }
-
-        $orig = clone($conv);
-        $orig->uri = common_local_url('conversation', array('id' => $id),
-                                      null, null, false);
-        $result = $orig->update($conv);
-
-        if (empty($result)) {
-            common_log_db_error($conv, 'UPDATE', __FILE__);
-            return null;
+            throw new ServerException(_('Failed to create conversation for notice'));
         }
 
         return $conv;
index a5914b506e670f414e23a33b5de65a87fdbeebeb..db80159d3ba181b80276f8eb5d072942a241f94b 100644 (file)
@@ -116,7 +116,9 @@ class File extends Managed_DataObject
             } catch (Exception $e) {
                 return false;
             }
-
+            if ($oembed_data === false) {
+                return false;
+            }
             $fo = File_oembed::getKV('file_id', $this->id);
 
             if ($fo instanceof File_oembed) {
index f40a4c2111b326ac3c11cb6798d03e4a1c5b4000..c25f702989a6efad6fd285150dd0b9ae1e240e24 100644 (file)
@@ -142,20 +142,20 @@ class Notice extends Managed_DataObject
     const FOLLOWER_SCOPE  = 8;
 
     protected $_profile = -1;
-
+    
     public function getProfile()
     {
         if ($this->_profile === -1) {
             $this->_setProfile(Profile::getKV('id', $this->profile_id));
         }
-        if (!$this->_profile instanceof Profile) {
-            throw new NoProfileException($this->profile_id);
-        }
         return $this->_profile;
     }
     
-    function _setProfile(Profile $profile)
+    public function _setProfile(Profile $profile=null)
     {
+        if (!$profile instanceof Profile) {
+            throw new NoProfileException($this->profile_id);
+        }
         $this->_profile = $profile;
     }
 
@@ -216,6 +216,16 @@ class Notice extends Managed_DataObject
         return $this->url ?: $this->uri;
     }
 
+    public static function getByUri($uri)
+    {
+        $notice = new Notice();
+        $notice->uri = $uri;
+        if (!$notice->find(true)) {
+            throw new NoResultException($notice);
+        }
+        return $notice;
+    }
+
     /**
      * Extract #hashtags from this notice's content and save them to the database.
      */
@@ -577,13 +587,13 @@ class Notice extends Managed_DataObject
             // the beginning of a new conversation.
 
             if (empty($notice->conversation)) {
-                $conv = Conversation::create();
+                $conv = Conversation::create($notice);
                 $notice->conversation = $conv->id;
                 $changed = true;
             }
 
             if ($changed) {
-                if (!$notice->update($orig)) {
+                if ($notice->update($orig) === false) {
                     common_log_db_error($notice, 'UPDATE', __FILE__);
                     // TRANS: Server exception thrown when a notice cannot be updated.
                     throw new ServerException(_('Problem saving notice.'));
@@ -2500,10 +2510,15 @@ class Notice extends Managed_DataObject
        {
                $map = self::getProfiles($notices);
                
-               foreach ($notices as $notice) {
-                       if (array_key_exists($notice->profile_id, $map)) {
-                               $notice->_setProfile($map[$notice->profile_id]);    
-                       }
+               foreach ($notices as $entry=>$notice) {
+            try {
+                       if (array_key_exists($notice->profile_id, $map)) {
+                               $notice->_setProfile($map[$notice->profile_id]);
+                       }
+            } catch (NoProfileException $e) {
+                common_log(LOG_WARNING, "Failed to fill profile in Notice with non-existing entry for profile_id: {$e->id}");
+                unset($notices[$entry]);
+            }
                }
                
                return array_values($map);
index 76b2ac28d0de52050b42f40dab0cf005938e05e6..fe2ce343d7bf92f6eec42e1ece2a2c6aafaf7e41 100644 (file)
@@ -256,7 +256,7 @@ class Profile extends Managed_DataObject
         return $stream->getNotices($offset, $limit, $since_id, $max_id);
     }
 
-    function isMember($group)
+    function isMember(User_group $group)
     {
        $groups = $this->getGroups(0, null);
         while ($groups instanceof User_group && $groups->fetch()) {
@@ -267,7 +267,7 @@ class Profile extends Managed_DataObject
        return false;
     }
 
-    function isAdmin($group)
+    function isAdmin(User_group $group)
     {
         $gm = Group_member::pkeyGet(array('profile_id' => $this->id,
                                           'group_id' => $group->id));
@@ -745,7 +745,7 @@ class Profile extends Managed_DataObject
      * @param Profile $other
      * @return boolean
      */
-    function isSubscribed($other)
+    function isSubscribed(Profile $other)
     {
         return Subscription::exists($this, $other);
     }
index 24a03b62fd0d0d82941e72a481cc3fa2f8906119..2b390bb90bbdea80a26555c0f53375ea71772bf3 100644 (file)
@@ -134,7 +134,7 @@ class User extends Managed_DataObject
         return $this->_profile;
     }
 
-    function isSubscribed($other)
+    function isSubscribed(Profile $other)
     {
         return $this->getProfile()->isSubscribed($other);
     }
@@ -616,12 +616,12 @@ class User extends Managed_DataObject
         return true;
     }
 
-    function isMember($group)
+    function isMember(User_group $group)
     {
         return $this->getProfile()->isMember($group);
     }
 
-    function isAdmin($group)
+    function isAdmin(User_group $group)
     {
         return $this->getProfile()->isAdmin($group);
     }
index 2b27845e59dcbce9ed64e69bda2ba9c028a8a2d3..82be959455933141957f2eb12bc9f5a4a2ff987b 100644 (file)
--- a/index.php
+++ b/index.php
@@ -242,8 +242,6 @@ function main()
     }
     global $user, $action;
 
-    Snapshot::check();
-
     if (!_have_config()) {
         $msg = sprintf(
             // TRANS: Error message displayed when there is no StatusNet configuration file.
index 088116d5c222034bea45fa6768fcbc70f8c55e6c..352d5a143c80ed436a532d6553faec788887e589 100644 (file)
@@ -118,7 +118,7 @@ class WebInstaller extends Installer
     function main()
     {
         if (!$this->checkPrereqs()) {
-            $this->showForm();
+            $this->warning(_('Please fix the above stated problems and refresh this page to continue installing.'));
             return;
         }
 
@@ -239,12 +239,12 @@ class WebInstaller extends Installer
                     <li>
                         <label for="admin_nickname">Administrator nickname</label>
                         <input type="text" id="admin_nickname" name="admin_nickname" value="{$post->value('admin_nickname')}" />
-                        <p class="form_guide">Nickname for the initial StatusNet user (administrator)</p>
+                        <p class="form_guide">Nickname for the initial user (administrator)</p>
                     </li>
                     <li>
                         <label for="admin_password">Administrator password</label>
                         <input type="password" id="admin_password" name="admin_password" value="{$post->value('admin_password')}" />
-                        <p class="form_guide">Password for the initial StatusNet user (administrator)</p>
+                        <p class="form_guide">Password for the initial user (administrator)</p>
                     </li>
                     <li>
                         <label for="admin_password2">Confirm password</label>
@@ -253,7 +253,7 @@ class WebInstaller extends Installer
                     <li>
                         <label for="admin_email">Administrator e-mail</label>
                         <input id="admin_email" name="admin_email" value="{$post->value('admin_email')}" />
-                        <p class="form_guide">Optional email address for the initial StatusNet user (administrator)</p>
+                        <p class="form_guide">Optional email address for the initial user (administrator)</p>
                     </li>
                     <li>
                         <label for="admin_updates">Subscribe to announcements</label>
@@ -375,14 +375,15 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
     <head>
-        <title>Install StatusNet</title>
-       <link rel="shortcut icon" href="favicon.ico"/>
+        <title>Install GNU social</title>
+        <link rel="shortcut icon" href="favicon.ico"/>
         <link rel="stylesheet" type="text/css" href="theme/base/css/display.css" media="screen, projection, tv"/>
         <link rel="stylesheet" type="text/css" href="theme/neo/css/display.css" media="screen, projection, tv"/>
+        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
         <!--[if IE]><link rel="stylesheet" type="text/css" href="theme/base/css/ie.css" /><![endif]-->
         <!--[if lte IE 6]><link rel="stylesheet" type="text/css" theme/base/css/ie6.css" /><![endif]-->
         <!--[if lte IE 7]><link rel="stylesheet" type="text/css" theme/base/css/ie7.css" /><![endif]-->
-        <script src="js/extlib/jquery.min.js"></script>
+        <script src="js/extlib/jquery.js"></script>
         <script src="js/install.js"></script>
     </head>
     <body id="install">
@@ -390,8 +391,8 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
             <div id="header">
                 <address id="site_contact" class="vcard">
                     <a class="url home bookmark" href=".">
-                        <img class="logo photo" src="theme/neo/logo.png" alt="StatusNet"/>
-                        <span class="fn org">StatusNet</span>
+                        <img class="logo photo" src="theme/neo/logo.png" alt="GNU social"/>
+                        <span class="fn org">GNU social</span>
                     </a>
                 </address>
                 <div id="site_nav_global_primary"></div>
@@ -404,7 +405,7 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 
                 <div id="content">
                      <div id="content_inner">
-                        <h1>Install StatusNet</h1>
+                        <h1>Install GNU social</h1>
 <?php
 $installer = new WebInstaller();
 $installer->main();
index 33757d11f81dbd75e050adcb77410eaf4e5a271f..57ac5ecb363825f9505bdc8efde7f2e388bbac2b 100644 (file)
@@ -1,16 +1,12 @@
 .fake: all clean
 
 TARGETS=util.min.js extlib/json2.min.js extlib/jquery.cookie.min.js
-UTIL_SOURCES=util.js xbImportNode.js geometa.js
 
 all: $(TARGETS)
 
 clean:
        rm -f $(TARGETS)
 
-util.min.js: $(UTIL_SOURCES)
-       cat $+ | yui-compressor --type js > $@
-
 extlib/json2.min.js: extlib/json2.js
        yui-compressor $+ > $@
 
diff --git a/js/extlib/jquery-ui/jquery-ui.min.js b/js/extlib/jquery-ui/jquery-ui.min.js
deleted file mode 100644 (file)
index ca9ab9e..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-/*! jQuery UI - v1.10.3 - 2013-09-11
-* http://jqueryui.com
-* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.position.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.sortable.js, jquery.ui.accordion.js, jquery.ui.autocomplete.js, jquery.ui.button.js, jquery.ui.datepicker.js, jquery.ui.dialog.js, jquery.ui.menu.js, jquery.ui.progressbar.js, jquery.ui.slider.js, jquery.ui.spinner.js, jquery.ui.tabs.js, jquery.ui.tooltip.js, jquery.ui.effect.js, jquery.ui.effect-blind.js, jquery.ui.effect-bounce.js, jquery.ui.effect-clip.js, jquery.ui.effect-drop.js, jquery.ui.effect-explode.js, jquery.ui.effect-fade.js, jquery.ui.effect-fold.js, jquery.ui.effect-highlight.js, jquery.ui.effect-pulsate.js, jquery.ui.effect-scale.js, jquery.ui.effect-shake.js, jquery.ui.effect-slide.js, jquery.ui.effect-transfer.js
-* Copyright 2013 jQuery Foundation and other contributors; Licensed MIT */
-
-(function(t,e){function n(e,n){var r,s,o,a=e.nodeName.toLowerCase();return"area"===a?(r=e.parentNode,s=r.name,e.href&&s&&"map"===r.nodeName.toLowerCase()?(o=t("img[usemap=#"+s+"]")[0],!!o&&i(o)):!1):(/input|select|textarea|button|object/.test(a)?!e.disabled:"a"===a?e.href||n:n)&&i(e)}function i(e){return t.expr.filters.visible(e)&&!t(e).parents().addBack().filter(function(){return"hidden"===t.css(this,"visibility")}).length}var r=0,s=/^ui-id-\d+$/;t.ui=t.ui||{},t.extend(t.ui,{version:"1.10.3",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),t.fn.extend({focus:function(e){return function(n,i){return"number"==typeof n?this.each(function(){var e=this;setTimeout(function(){t(e).focus(),i&&i.call(e)},n)}):e.apply(this,arguments)}}(t.fn.focus),scrollParent:function(){var e;return e=t.ui.ie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(t.css(this,"position"))&&/(auto|scroll)/.test(t.css(this,"overflow")+t.css(this,"overflow-y")+t.css(this,"overflow-x"))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(t.css(this,"overflow")+t.css(this,"overflow-y")+t.css(this,"overflow-x"))}).eq(0),/fixed/.test(this.css("position"))||!e.length?t(document):e},zIndex:function(n){if(n!==e)return this.css("zIndex",n);if(this.length)for(var i,r,s=t(this[0]);s.length&&s[0]!==document;){if(i=s.css("position"),("absolute"===i||"relative"===i||"fixed"===i)&&(r=parseInt(s.css("zIndex"),10),!isNaN(r)&&0!==r))return r;s=s.parent()}return 0},uniqueId:function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++r)})},removeUniqueId:function(){return this.each(function(){s.test(this.id)&&t(this).removeAttr("id")})}}),t.extend(t.expr[":"],{data:t.expr.createPseudo?t.expr.createPseudo(function(e){return function(n){return!!t.data(n,e)}}):function(e,n,i){return!!t.data(e,i[3])},focusable:function(e){return n(e,!isNaN(t.attr(e,"tabindex")))},tabbable:function(e){var i=t.attr(e,"tabindex"),r=isNaN(i);return(r||i>=0)&&n(e,!r)}}),t("<a>").outerWidth(1).jquery||t.each(["Width","Height"],function(n,i){function r(e,n,i,r){return t.each(s,function(){n-=parseFloat(t.css(e,"padding"+this))||0,i&&(n-=parseFloat(t.css(e,"border"+this+"Width"))||0),r&&(n-=parseFloat(t.css(e,"margin"+this))||0)}),n}var s="Width"===i?["Left","Right"]:["Top","Bottom"],o=i.toLowerCase(),a={innerWidth:t.fn.innerWidth,innerHeight:t.fn.innerHeight,outerWidth:t.fn.outerWidth,outerHeight:t.fn.outerHeight};t.fn["inner"+i]=function(n){return n===e?a["inner"+i].call(this):this.each(function(){t(this).css(o,r(this,n)+"px")})},t.fn["outer"+i]=function(e,n){return"number"!=typeof e?a["outer"+i].call(this,e):this.each(function(){t(this).css(o,r(this,e,!0,n)+"px")})}}),t.fn.addBack||(t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(t.fn.removeData=function(e){return function(n){return arguments.length?e.call(this,t.camelCase(n)):e.call(this)}}(t.fn.removeData)),t.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),t.support.selectstart="onselectstart"in document.createElement("div"),t.fn.extend({disableSelection:function(){return this.bind((t.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(t){t.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),t.extend(t.ui,{plugin:{add:function(e,n,i){var r,s=t.ui[e].prototype;for(r in i)s.plugins[r]=s.plugins[r]||[],s.plugins[r].push([n,i[r]])},call:function(t,e,n){var i,r=t.plugins[e];if(r&&t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType)for(i=0;r.length>i;i++)t.options[r[i][0]]&&r[i][1].apply(t.element,n)}},hasScroll:function(e,n){if("hidden"===t(e).css("overflow"))return!1;var i=n&&"left"===n?"scrollLeft":"scrollTop",r=!1;return e[i]>0?!0:(e[i]=1,r=e[i]>0,e[i]=0,r)}})})(jQuery);(function(e,t){var a=0,i=Array.prototype.slice,r=e.cleanData;e.cleanData=function(t){for(var a,i=0;null!=(a=t[i]);i++)try{e(a).triggerHandler("remove")}catch(s){}r(t)},e.widget=function(a,i,r){var s,n,o,d,l={},u=a.split(".")[0];a=a.split(".")[1],s=u+"-"+a,r||(r=i,i=e.Widget),e.expr[":"][s.toLowerCase()]=function(t){return!!e.data(t,s)},e[u]=e[u]||{},n=e[u][a],o=e[u][a]=function(e,a){return this._createWidget?(arguments.length&&this._createWidget(e,a),t):new o(e,a)},e.extend(o,n,{version:r.version,_proto:e.extend({},r),_childConstructors:[]}),d=new i,d.options=e.widget.extend({},d.options),e.each(r,function(a,r){return e.isFunction(r)?(l[a]=function(){var e=function(){return i.prototype[a].apply(this,arguments)},t=function(e){return i.prototype[a].apply(this,e)};return function(){var a,i=this._super,s=this._superApply;return this._super=e,this._superApply=t,a=r.apply(this,arguments),this._super=i,this._superApply=s,a}}(),t):(l[a]=r,t)}),o.prototype=e.widget.extend(d,{widgetEventPrefix:n?d.widgetEventPrefix:a},l,{constructor:o,namespace:u,widgetName:a,widgetFullName:s}),n?(e.each(n._childConstructors,function(t,a){var i=a.prototype;e.widget(i.namespace+"."+i.widgetName,o,a._proto)}),delete n._childConstructors):i._childConstructors.push(o),e.widget.bridge(a,o)},e.widget.extend=function(a){for(var r,s,n=i.call(arguments,1),o=0,d=n.length;d>o;o++)for(r in n[o])s=n[o][r],n[o].hasOwnProperty(r)&&s!==t&&(a[r]=e.isPlainObject(s)?e.isPlainObject(a[r])?e.widget.extend({},a[r],s):e.widget.extend({},s):s);return a},e.widget.bridge=function(a,r){var s=r.prototype.widgetFullName||a;e.fn[a]=function(n){var o="string"==typeof n,d=i.call(arguments,1),l=this;return n=!o&&d.length?e.widget.extend.apply(null,[n].concat(d)):n,o?this.each(function(){var i,r=e.data(this,s);return r?e.isFunction(r[n])&&"_"!==n.charAt(0)?(i=r[n].apply(r,d),i!==r&&i!==t?(l=i&&i.jquery?l.pushStack(i.get()):i,!1):t):e.error("no such method '"+n+"' for "+a+" widget instance"):e.error("cannot call methods on "+a+" prior to initialization; "+"attempted to call method '"+n+"'")}):this.each(function(){var t=e.data(this,s);t?t.option(n||{})._init():e.data(this,s,new r(n,this))}),l}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(t,i){i=e(i||this.defaultElement||this)[0],this.element=e(i),this.uuid=a++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this.bindings=e(),this.hoverable=e(),this.focusable=e(),i!==this&&(e.data(i,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===i&&this.destroy()}}),this.document=e(i.style?i.ownerDocument:i.document||i),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(a,i){var r,s,n,o=a;if(0===arguments.length)return e.widget.extend({},this.options);if("string"==typeof a)if(o={},r=a.split("."),a=r.shift(),r.length){for(s=o[a]=e.widget.extend({},this.options[a]),n=0;r.length-1>n;n++)s[r[n]]=s[r[n]]||{},s=s[r[n]];if(a=r.pop(),i===t)return s[a]===t?null:s[a];s[a]=i}else{if(i===t)return this.options[a]===t?null:this.options[a];o[a]=i}return this._setOptions(o),this},_setOptions:function(e){var t;for(t in e)this._setOption(t,e[t]);return this},_setOption:function(e,t){return this.options[e]=t,"disabled"===e&&(this.widget().toggleClass(this.widgetFullName+"-disabled ui-state-disabled",!!t).attr("aria-disabled",t),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")),this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_on:function(a,i,r){var s,n=this;"boolean"!=typeof a&&(r=i,i=a,a=!1),r?(i=s=e(i),this.bindings=this.bindings.add(i)):(r=i,i=this.element,s=this.widget()),e.each(r,function(r,o){function d(){return a||n.options.disabled!==!0&&!e(this).hasClass("ui-state-disabled")?("string"==typeof o?n[o]:o).apply(n,arguments):t}"string"!=typeof o&&(d.guid=o.guid=o.guid||d.guid||e.guid++);var l=r.match(/^(\w+)\s*(.*)$/),u=l[1]+n.eventNamespace,h=l[2];h?s.delegate(h,u,d):i.bind(u,d)})},_off:function(e,t){t=(t||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.unbind(t).undelegate(t)},_delay:function(e,t){function a(){return("string"==typeof e?i[e]:e).apply(i,arguments)}var i=this;return setTimeout(a,t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){e(t.currentTarget).addClass("ui-state-hover")},mouseleave:function(t){e(t.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){e(t.currentTarget).addClass("ui-state-focus")},focusout:function(t){e(t.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(t,a,i){var r,s,n=this.options[t];if(i=i||{},a=e.Event(a),a.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),a.target=this.element[0],s=a.originalEvent)for(r in s)r in a||(a[r]=s[r]);return this.element.trigger(a,i),!(e.isFunction(n)&&n.apply(this.element[0],[a].concat(i))===!1||a.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,a){e.Widget.prototype["_"+t]=function(i,r,s){"string"==typeof r&&(r={effect:r});var n,o=r?r===!0||"number"==typeof r?a:r.effect||a:t;r=r||{},"number"==typeof r&&(r={duration:r}),n=!e.isEmptyObject(r),r.complete=s,r.delay&&i.delay(r.delay),n&&e.effects&&e.effects.effect[o]?i[t](r):o!==t&&i[o]?i[o](r.duration,r.easing,s):i.queue(function(a){e(this)[t](),s&&s.call(i[0]),a()})}})})(jQuery);(function(e){var t=!1;e(document).mouseup(function(){t=!1}),e.widget("ui.mouse",{version:"1.10.3",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.bind("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).bind("click."+this.widgetName,function(a){return!0===e.data(a.target,t.widgetName+".preventClickEvent")?(e.removeData(a.target,t.widgetName+".preventClickEvent"),a.stopImmediatePropagation(),!1):undefined}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(a){if(!t){this._mouseStarted&&this._mouseUp(a),this._mouseDownEvent=a;var r=this,i=1===a.which,s="string"==typeof this.options.cancel&&a.target.nodeName?e(a.target).closest(this.options.cancel).length:!1;return i&&!s&&this._mouseCapture(a)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){r.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(a)&&this._mouseDelayMet(a)&&(this._mouseStarted=this._mouseStart(a)!==!1,!this._mouseStarted)?(a.preventDefault(),!0):(!0===e.data(a.target,this.widgetName+".preventClickEvent")&&e.removeData(a.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return r._mouseMove(e)},this._mouseUpDelegate=function(e){return r._mouseUp(e)},e(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),a.preventDefault(),t=!0,!0)):!0}},_mouseMove:function(t){return e.ui.ie&&(!document.documentMode||9>document.documentMode)&&!t.button?this._mouseUp(t):this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,t)!==!1,this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted)},_mouseUp:function(t){return e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&e.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),!1},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}})})(jQuery);(function(e,t){function a(e,t,a){return[parseFloat(e[0])*(m.test(e[0])?t/100:1),parseFloat(e[1])*(m.test(e[1])?a/100:1)]}function i(t,a){return parseInt(e.css(t,a),10)||0}function r(t){var a=t[0];return 9===a.nodeType?{width:t.width(),height:t.height(),offset:{top:0,left:0}}:e.isWindow(a)?{width:t.width(),height:t.height(),offset:{top:t.scrollTop(),left:t.scrollLeft()}}:a.preventDefault?{width:0,height:0,offset:{top:a.pageY,left:a.pageX}}:{width:t.outerWidth(),height:t.outerHeight(),offset:t.offset()}}e.ui=e.ui||{};var s,n=Math.max,o=Math.abs,d=Math.round,u=/left|center|right/,l=/top|center|bottom/,h=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,m=/%$/,p=e.fn.position;e.position={scrollbarWidth:function(){if(s!==t)return s;var a,i,r=e("<div style='display:block;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),n=r.children()[0];return e("body").append(r),a=n.offsetWidth,r.css("overflow","scroll"),i=n.offsetWidth,a===i&&(i=r[0].clientWidth),r.remove(),s=a-i},getScrollInfo:function(t){var a=t.isWindow?"":t.element.css("overflow-x"),i=t.isWindow?"":t.element.css("overflow-y"),r="scroll"===a||"auto"===a&&t.width<t.element[0].scrollWidth,s="scroll"===i||"auto"===i&&t.height<t.element[0].scrollHeight;return{width:s?e.position.scrollbarWidth():0,height:r?e.position.scrollbarWidth():0}},getWithinInfo:function(t){var a=e(t||window),i=e.isWindow(a[0]);return{element:a,isWindow:i,offset:a.offset()||{left:0,top:0},scrollLeft:a.scrollLeft(),scrollTop:a.scrollTop(),width:i?a.width():a.outerWidth(),height:i?a.height():a.outerHeight()}}},e.fn.position=function(t){if(!t||!t.of)return p.apply(this,arguments);t=e.extend({},t);var s,m,f,g,y,k,x=e(t.of),T=e.position.getWithinInfo(t.within),b=e.position.getScrollInfo(T),S=(t.collision||"flip").split(" "),N={};return k=r(x),x[0].preventDefault&&(t.at="left top"),m=k.width,f=k.height,g=k.offset,y=e.extend({},g),e.each(["my","at"],function(){var e,a,i=(t[this]||"").split(" ");1===i.length&&(i=u.test(i[0])?i.concat(["center"]):l.test(i[0])?["center"].concat(i):["center","center"]),i[0]=u.test(i[0])?i[0]:"center",i[1]=l.test(i[1])?i[1]:"center",e=h.exec(i[0]),a=h.exec(i[1]),N[this]=[e?e[0]:0,a?a[0]:0],t[this]=[c.exec(i[0])[0],c.exec(i[1])[0]]}),1===S.length&&(S[1]=S[0]),"right"===t.at[0]?y.left+=m:"center"===t.at[0]&&(y.left+=m/2),"bottom"===t.at[1]?y.top+=f:"center"===t.at[1]&&(y.top+=f/2),s=a(N.at,m,f),y.left+=s[0],y.top+=s[1],this.each(function(){var r,u,l=e(this),h=l.outerWidth(),c=l.outerHeight(),p=i(this,"marginLeft"),k=i(this,"marginTop"),v=h+p+i(this,"marginRight")+b.width,M=c+k+i(this,"marginBottom")+b.height,D=e.extend({},y),_=a(N.my,l.outerWidth(),l.outerHeight());"right"===t.my[0]?D.left-=h:"center"===t.my[0]&&(D.left-=h/2),"bottom"===t.my[1]?D.top-=c:"center"===t.my[1]&&(D.top-=c/2),D.left+=_[0],D.top+=_[1],e.support.offsetFractions||(D.left=d(D.left),D.top=d(D.top)),r={marginLeft:p,marginTop:k},e.each(["left","top"],function(a,i){e.ui.position[S[a]]&&e.ui.position[S[a]][i](D,{targetWidth:m,targetHeight:f,elemWidth:h,elemHeight:c,collisionPosition:r,collisionWidth:v,collisionHeight:M,offset:[s[0]+_[0],s[1]+_[1]],my:t.my,at:t.at,within:T,elem:l})}),t.using&&(u=function(e){var a=g.left-D.left,i=a+m-h,r=g.top-D.top,s=r+f-c,d={target:{element:x,left:g.left,top:g.top,width:m,height:f},element:{element:l,left:D.left,top:D.top,width:h,height:c},horizontal:0>i?"left":a>0?"right":"center",vertical:0>s?"top":r>0?"bottom":"middle"};h>m&&m>o(a+i)&&(d.horizontal="center"),c>f&&f>o(r+s)&&(d.vertical="middle"),d.important=n(o(a),o(i))>n(o(r),o(s))?"horizontal":"vertical",t.using.call(this,e,d)}),l.offset(e.extend(D,{using:u}))})},e.ui.position={fit:{left:function(e,t){var a,i=t.within,r=i.isWindow?i.scrollLeft:i.offset.left,s=i.width,o=e.left-t.collisionPosition.marginLeft,d=r-o,u=o+t.collisionWidth-s-r;t.collisionWidth>s?d>0&&0>=u?(a=e.left+d+t.collisionWidth-s-r,e.left+=d-a):e.left=u>0&&0>=d?r:d>u?r+s-t.collisionWidth:r:d>0?e.left+=d:u>0?e.left-=u:e.left=n(e.left-o,e.left)},top:function(e,t){var a,i=t.within,r=i.isWindow?i.scrollTop:i.offset.top,s=t.within.height,o=e.top-t.collisionPosition.marginTop,d=r-o,u=o+t.collisionHeight-s-r;t.collisionHeight>s?d>0&&0>=u?(a=e.top+d+t.collisionHeight-s-r,e.top+=d-a):e.top=u>0&&0>=d?r:d>u?r+s-t.collisionHeight:r:d>0?e.top+=d:u>0?e.top-=u:e.top=n(e.top-o,e.top)}},flip:{left:function(e,t){var a,i,r=t.within,s=r.offset.left+r.scrollLeft,n=r.width,d=r.isWindow?r.scrollLeft:r.offset.left,u=e.left-t.collisionPosition.marginLeft,l=u-d,h=u+t.collisionWidth-n-d,c="left"===t.my[0]?-t.elemWidth:"right"===t.my[0]?t.elemWidth:0,m="left"===t.at[0]?t.targetWidth:"right"===t.at[0]?-t.targetWidth:0,p=-2*t.offset[0];0>l?(a=e.left+c+m+p+t.collisionWidth-n-s,(0>a||o(l)>a)&&(e.left+=c+m+p)):h>0&&(i=e.left-t.collisionPosition.marginLeft+c+m+p-d,(i>0||h>o(i))&&(e.left+=c+m+p))},top:function(e,t){var a,i,r=t.within,s=r.offset.top+r.scrollTop,n=r.height,d=r.isWindow?r.scrollTop:r.offset.top,u=e.top-t.collisionPosition.marginTop,l=u-d,h=u+t.collisionHeight-n-d,c="top"===t.my[1],m=c?-t.elemHeight:"bottom"===t.my[1]?t.elemHeight:0,p="top"===t.at[1]?t.targetHeight:"bottom"===t.at[1]?-t.targetHeight:0,f=-2*t.offset[1];0>l?(i=e.top+m+p+f+t.collisionHeight-n-s,e.top+m+p+f>l&&(0>i||o(l)>i)&&(e.top+=m+p+f)):h>0&&(a=e.top-t.collisionPosition.marginTop+m+p+f-d,e.top+m+p+f>h&&(a>0||h>o(a))&&(e.top+=m+p+f))}},flipfit:{left:function(){e.ui.position.flip.left.apply(this,arguments),e.ui.position.fit.left.apply(this,arguments)},top:function(){e.ui.position.flip.top.apply(this,arguments),e.ui.position.fit.top.apply(this,arguments)}}},function(){var t,a,i,r,s,n=document.getElementsByTagName("body")[0],o=document.createElement("div");t=document.createElement(n?"div":"body"),i={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},n&&e.extend(i,{position:"absolute",left:"-1000px",top:"-1000px"});for(s in i)t.style[s]=i[s];t.appendChild(o),a=n||document.documentElement,a.insertBefore(t,a.firstChild),o.style.cssText="position: absolute; left: 10.7432222px;",r=e(o).offset().left,e.support.offsetFractions=r>10&&11>r,t.innerHTML="",a.removeChild(t)}()})(jQuery);(function(e){e.widget("ui.draggable",e.ui.mouse,{version:"1.10.3",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"!==this.options.helper||/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative"),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._mouseInit()},_destroy:function(){this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._mouseDestroy()},_mouseCapture:function(t){var a=this.options;return this.helper||a.disabled||e(t.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(t),this.handle?(e(a.iframeFix===!0?"iframe":a.iframeFix).each(function(){e("<div class='ui-draggable-iframeFix' style='background: #fff;'></div>").css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1e3}).css(e(this).offset()).appendTo("body")}),!0):!1)},_mouseStart:function(t){var a=this.options;return this.helper=this._createHelper(t),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),e.ui.ddmanager&&(e.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(),this.offsetParent=this.helper.offsetParent(),this.offsetParentCssPosition=this.offsetParent.css("position"),this.offset=this.positionAbs=this.element.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},this.offset.scroll=!1,e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.originalPosition=this.position=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,a.cursorAt&&this._adjustOffsetFromHelper(a.cursorAt),this._setContainment(),this._trigger("start",t)===!1?(this._clear(),!1):(this._cacheHelperProportions(),e.ui.ddmanager&&!a.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this._mouseDrag(t,!0),e.ui.ddmanager&&e.ui.ddmanager.dragStart(this,t),!0)},_mouseDrag:function(t,a){if("fixed"===this.offsetParentCssPosition&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),!a){var r=this._uiHash();if(this._trigger("drag",t,r)===!1)return this._mouseUp({}),!1;this.position=r.position}return this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),!1},_mouseStop:function(t){var a=this,r=!1;return e.ui.ddmanager&&!this.options.dropBehaviour&&(r=e.ui.ddmanager.drop(this,t)),this.dropped&&(r=this.dropped,this.dropped=!1),"original"!==this.options.helper||e.contains(this.element[0].ownerDocument,this.element[0])?("invalid"===this.options.revert&&!r||"valid"===this.options.revert&&r||this.options.revert===!0||e.isFunction(this.options.revert)&&this.options.revert.call(this.element,r)?e(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){a._trigger("stop",t)!==!1&&a._clear()}):this._trigger("stop",t)!==!1&&this._clear(),!1):!1},_mouseUp:function(t){return e("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)}),e.ui.ddmanager&&e.ui.ddmanager.dragStop(this,t),e.ui.mouse.prototype._mouseUp.call(this,t)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(t){return this.options.handle?!!e(t.target).closest(this.element.find(this.options.handle)).length:!0},_createHelper:function(t){var a=this.options,r=e.isFunction(a.helper)?e(a.helper.apply(this.element[0],[t])):"clone"===a.helper?this.element.clone().removeAttr("id"):this.element;return r.parents("body").length||r.appendTo("parent"===a.appendTo?this.element[0].parentNode:a.appendTo),r[0]===this.element[0]||/(fixed|absolute)/.test(r.css("position"))||r.css("position","absolute"),r},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){var t=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&e.ui.ie)&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var e=this.element.position();return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:e.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),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}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,a,r,i=this.options;return i.containment?"window"===i.containment?(this.containment=[e(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,e(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,e(window).scrollLeft()+e(window).width()-this.helperProportions.width-this.margins.left,e(window).scrollTop()+(e(window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],undefined):"document"===i.containment?(this.containment=[0,0,e(document).width()-this.helperProportions.width-this.margins.left,(e(document).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],undefined):i.containment.constructor===Array?(this.containment=i.containment,undefined):("parent"===i.containment&&(i.containment=this.helper[0].parentNode),a=e(i.containment),r=a[0],r&&(t="hidden"!==a.css("overflow"),this.containment=[(parseInt(a.css("borderLeftWidth"),10)||0)+(parseInt(a.css("paddingLeft"),10)||0),(parseInt(a.css("borderTopWidth"),10)||0)+(parseInt(a.css("paddingTop"),10)||0),(t?Math.max(r.scrollWidth,r.offsetWidth):r.offsetWidth)-(parseInt(a.css("borderRightWidth"),10)||0)-(parseInt(a.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(t?Math.max(r.scrollHeight,r.offsetHeight):r.offsetHeight)-(parseInt(a.css("borderBottomWidth"),10)||0)-(parseInt(a.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relative_container=a),undefined):(this.containment=null,undefined)},_convertPositionTo:function(t,a){a||(a=this.position);var r="absolute"===t?1:-1,i="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent;return this.offset.scroll||(this.offset.scroll={top:i.scrollTop(),left:i.scrollLeft()}),{top:a.top+this.offset.relative.top*r+this.offset.parent.top*r-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():this.offset.scroll.top)*r,left:a.left+this.offset.relative.left*r+this.offset.parent.left*r-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():this.offset.scroll.left)*r}},_generatePosition:function(t){var a,r,i,s,n=this.options,o="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,d=t.pageX,u=t.pageY;return this.offset.scroll||(this.offset.scroll={top:o.scrollTop(),left:o.scrollLeft()}),this.originalPosition&&(this.containment&&(this.relative_container?(r=this.relative_container.offset(),a=[this.containment[0]+r.left,this.containment[1]+r.top,this.containment[2]+r.left,this.containment[3]+r.top]):a=this.containment,t.pageX-this.offset.click.left<a[0]&&(d=a[0]+this.offset.click.left),t.pageY-this.offset.click.top<a[1]&&(u=a[1]+this.offset.click.top),t.pageX-this.offset.click.left>a[2]&&(d=a[2]+this.offset.click.left),t.pageY-this.offset.click.top>a[3]&&(u=a[3]+this.offset.click.top)),n.grid&&(i=n.grid[1]?this.originalPageY+Math.round((u-this.originalPageY)/n.grid[1])*n.grid[1]:this.originalPageY,u=a?i-this.offset.click.top>=a[1]||i-this.offset.click.top>a[3]?i:i-this.offset.click.top>=a[1]?i-n.grid[1]:i+n.grid[1]:i,s=n.grid[0]?this.originalPageX+Math.round((d-this.originalPageX)/n.grid[0])*n.grid[0]:this.originalPageX,d=a?s-this.offset.click.left>=a[0]||s-this.offset.click.left>a[2]?s:s-this.offset.click.left>=a[0]?s-n.grid[0]:s+n.grid[0]:s)),{top:u-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():this.offset.scroll.top),left:d-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():this.offset.scroll.left)}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1},_trigger:function(t,a,r){return r=r||this._uiHash(),e.ui.plugin.call(this,t,[a,r]),"drag"===t&&(this.positionAbs=this._convertPositionTo("absolute")),e.Widget.prototype._trigger.call(this,t,a,r)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),e.ui.plugin.add("draggable","connectToSortable",{start:function(t,a){var r=e(this).data("ui-draggable"),i=r.options,s=e.extend({},a,{item:r.element});r.sortables=[],e(i.connectToSortable).each(function(){var a=e.data(this,"ui-sortable");a&&!a.options.disabled&&(r.sortables.push({instance:a,shouldRevert:a.options.revert}),a.refreshPositions(),a._trigger("activate",t,s))})},stop:function(t,a){var r=e(this).data("ui-draggable"),i=e.extend({},a,{item:r.element});e.each(r.sortables,function(){this.instance.isOver?(this.instance.isOver=0,r.cancelHelperRemoval=!0,this.instance.cancelHelperRemoval=!1,this.shouldRevert&&(this.instance.options.revert=this.shouldRevert),this.instance._mouseStop(t),this.instance.options.helper=this.instance.options._helper,"original"===r.options.helper&&this.instance.currentItem.css({top:"auto",left:"auto"})):(this.instance.cancelHelperRemoval=!1,this.instance._trigger("deactivate",t,i))})},drag:function(t,a){var r=e(this).data("ui-draggable"),i=this;e.each(r.sortables,function(){var s=!1,n=this;this.instance.positionAbs=r.positionAbs,this.instance.helperProportions=r.helperProportions,this.instance.offset.click=r.offset.click,this.instance._intersectsWith(this.instance.containerCache)&&(s=!0,e.each(r.sortables,function(){return this.instance.positionAbs=r.positionAbs,this.instance.helperProportions=r.helperProportions,this.instance.offset.click=r.offset.click,this!==n&&this.instance._intersectsWith(this.instance.containerCache)&&e.contains(n.instance.element[0],this.instance.element[0])&&(s=!1),s})),s?(this.instance.isOver||(this.instance.isOver=1,this.instance.currentItem=e(i).clone().removeAttr("id").appendTo(this.instance.element).data("ui-sortable-item",!0),this.instance.options._helper=this.instance.options.helper,this.instance.options.helper=function(){return a.helper[0]},t.target=this.instance.currentItem[0],this.instance._mouseCapture(t,!0),this.instance._mouseStart(t,!0,!0),this.instance.offset.click.top=r.offset.click.top,this.instance.offset.click.left=r.offset.click.left,this.instance.offset.parent.left-=r.offset.parent.left-this.instance.offset.parent.left,this.instance.offset.parent.top-=r.offset.parent.top-this.instance.offset.parent.top,r._trigger("toSortable",t),r.dropped=this.instance.element,r.currentItem=r.element,this.instance.fromOutside=r),this.instance.currentItem&&this.instance._mouseDrag(t)):this.instance.isOver&&(this.instance.isOver=0,this.instance.cancelHelperRemoval=!0,this.instance.options.revert=!1,this.instance._trigger("out",t,this.instance._uiHash(this.instance)),this.instance._mouseStop(t,!0),this.instance.options.helper=this.instance.options._helper,this.instance.currentItem.remove(),this.instance.placeholder&&this.instance.placeholder.remove(),r._trigger("fromSortable",t),r.dropped=!1)})}}),e.ui.plugin.add("draggable","cursor",{start:function(){var t=e("body"),a=e(this).data("ui-draggable").options;t.css("cursor")&&(a._cursor=t.css("cursor")),t.css("cursor",a.cursor)},stop:function(){var t=e(this).data("ui-draggable").options;t._cursor&&e("body").css("cursor",t._cursor)}}),e.ui.plugin.add("draggable","opacity",{start:function(t,a){var r=e(a.helper),i=e(this).data("ui-draggable").options;r.css("opacity")&&(i._opacity=r.css("opacity")),r.css("opacity",i.opacity)},stop:function(t,a){var r=e(this).data("ui-draggable").options;r._opacity&&e(a.helper).css("opacity",r._opacity)}}),e.ui.plugin.add("draggable","scroll",{start:function(){var t=e(this).data("ui-draggable");t.scrollParent[0]!==document&&"HTML"!==t.scrollParent[0].tagName&&(t.overflowOffset=t.scrollParent.offset())},drag:function(t){var a=e(this).data("ui-draggable"),r=a.options,i=!1;a.scrollParent[0]!==document&&"HTML"!==a.scrollParent[0].tagName?(r.axis&&"x"===r.axis||(a.overflowOffset.top+a.scrollParent[0].offsetHeight-t.pageY<r.scrollSensitivity?a.scrollParent[0].scrollTop=i=a.scrollParent[0].scrollTop+r.scrollSpeed:t.pageY-a.overflowOffset.top<r.scrollSensitivity&&(a.scrollParent[0].scrollTop=i=a.scrollParent[0].scrollTop-r.scrollSpeed)),r.axis&&"y"===r.axis||(a.overflowOffset.left+a.scrollParent[0].offsetWidth-t.pageX<r.scrollSensitivity?a.scrollParent[0].scrollLeft=i=a.scrollParent[0].scrollLeft+r.scrollSpeed:t.pageX-a.overflowOffset.left<r.scrollSensitivity&&(a.scrollParent[0].scrollLeft=i=a.scrollParent[0].scrollLeft-r.scrollSpeed))):(r.axis&&"x"===r.axis||(t.pageY-e(document).scrollTop()<r.scrollSensitivity?i=e(document).scrollTop(e(document).scrollTop()-r.scrollSpeed):e(window).height()-(t.pageY-e(document).scrollTop())<r.scrollSensitivity&&(i=e(document).scrollTop(e(document).scrollTop()+r.scrollSpeed))),r.axis&&"y"===r.axis||(t.pageX-e(document).scrollLeft()<r.scrollSensitivity?i=e(document).scrollLeft(e(document).scrollLeft()-r.scrollSpeed):e(window).width()-(t.pageX-e(document).scrollLeft())<r.scrollSensitivity&&(i=e(document).scrollLeft(e(document).scrollLeft()+r.scrollSpeed)))),i!==!1&&e.ui.ddmanager&&!r.dropBehaviour&&e.ui.ddmanager.prepareOffsets(a,t)}}),e.ui.plugin.add("draggable","snap",{start:function(){var t=e(this).data("ui-draggable"),a=t.options;t.snapElements=[],e(a.snap.constructor!==String?a.snap.items||":data(ui-draggable)":a.snap).each(function(){var a=e(this),r=a.offset();this!==t.element[0]&&t.snapElements.push({item:this,width:a.outerWidth(),height:a.outerHeight(),top:r.top,left:r.left})})},drag:function(t,a){var r,i,s,n,o,d,u,l,h,c,m=e(this).data("ui-draggable"),p=m.options,f=p.snapTolerance,g=a.offset.left,y=g+m.helperProportions.width,k=a.offset.top,x=k+m.helperProportions.height;for(h=m.snapElements.length-1;h>=0;h--)o=m.snapElements[h].left,d=o+m.snapElements[h].width,u=m.snapElements[h].top,l=u+m.snapElements[h].height,o-f>y||g>d+f||u-f>x||k>l+f||!e.contains(m.snapElements[h].item.ownerDocument,m.snapElements[h].item)?(m.snapElements[h].snapping&&m.options.snap.release&&m.options.snap.release.call(m.element,t,e.extend(m._uiHash(),{snapItem:m.snapElements[h].item})),m.snapElements[h].snapping=!1):("inner"!==p.snapMode&&(r=f>=Math.abs(u-x),i=f>=Math.abs(l-k),s=f>=Math.abs(o-y),n=f>=Math.abs(d-g),r&&(a.position.top=m._convertPositionTo("relative",{top:u-m.helperProportions.height,left:0}).top-m.margins.top),i&&(a.position.top=m._convertPositionTo("relative",{top:l,left:0}).top-m.margins.top),s&&(a.position.left=m._convertPositionTo("relative",{top:0,left:o-m.helperProportions.width}).left-m.margins.left),n&&(a.position.left=m._convertPositionTo("relative",{top:0,left:d}).left-m.margins.left)),c=r||i||s||n,"outer"!==p.snapMode&&(r=f>=Math.abs(u-k),i=f>=Math.abs(l-x),s=f>=Math.abs(o-g),n=f>=Math.abs(d-y),r&&(a.position.top=m._convertPositionTo("relative",{top:u,left:0}).top-m.margins.top),i&&(a.position.top=m._convertPositionTo("relative",{top:l-m.helperProportions.height,left:0}).top-m.margins.top),s&&(a.position.left=m._convertPositionTo("relative",{top:0,left:o}).left-m.margins.left),n&&(a.position.left=m._convertPositionTo("relative",{top:0,left:d-m.helperProportions.width}).left-m.margins.left)),!m.snapElements[h].snapping&&(r||i||s||n||c)&&m.options.snap.snap&&m.options.snap.snap.call(m.element,t,e.extend(m._uiHash(),{snapItem:m.snapElements[h].item})),m.snapElements[h].snapping=r||i||s||n||c)}}),e.ui.plugin.add("draggable","stack",{start:function(){var t,a=this.data("ui-draggable").options,r=e.makeArray(e(a.stack)).sort(function(t,a){return(parseInt(e(t).css("zIndex"),10)||0)-(parseInt(e(a).css("zIndex"),10)||0)});r.length&&(t=parseInt(e(r[0]).css("zIndex"),10)||0,e(r).each(function(a){e(this).css("zIndex",t+a)}),this.css("zIndex",t+r.length))}}),e.ui.plugin.add("draggable","zIndex",{start:function(t,a){var r=e(a.helper),i=e(this).data("ui-draggable").options;r.css("zIndex")&&(i._zIndex=r.css("zIndex")),r.css("zIndex",i.zIndex)},stop:function(t,a){var r=e(this).data("ui-draggable").options;r._zIndex&&e(a.helper).css("zIndex",r._zIndex)}})})(jQuery);(function(e){function t(e,t,a){return e>t&&t+a>e}e.widget("ui.droppable",{version:"1.10.3",widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var t=this.options,a=t.accept;this.isover=!1,this.isout=!0,this.accept=e.isFunction(a)?a:function(e){return e.is(a)},this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight},e.ui.ddmanager.droppables[t.scope]=e.ui.ddmanager.droppables[t.scope]||[],e.ui.ddmanager.droppables[t.scope].push(this),t.addClasses&&this.element.addClass("ui-droppable")},_destroy:function(){for(var t=0,a=e.ui.ddmanager.droppables[this.options.scope];a.length>t;t++)a[t]===this&&a.splice(t,1);this.element.removeClass("ui-droppable ui-droppable-disabled")},_setOption:function(t,a){"accept"===t&&(this.accept=e.isFunction(a)?a:function(e){return e.is(a)}),e.Widget.prototype._setOption.apply(this,arguments)},_activate:function(t){var a=e.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass),a&&this._trigger("activate",t,this.ui(a))},_deactivate:function(t){var a=e.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass),a&&this._trigger("deactivate",t,this.ui(a))},_over:function(t){var a=e.ui.ddmanager.current;a&&(a.currentItem||a.element)[0]!==this.element[0]&&this.accept.call(this.element[0],a.currentItem||a.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",t,this.ui(a)))},_out:function(t){var a=e.ui.ddmanager.current;a&&(a.currentItem||a.element)[0]!==this.element[0]&&this.accept.call(this.element[0],a.currentItem||a.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",t,this.ui(a)))},_drop:function(t,a){var i=a||e.ui.ddmanager.current,r=!1;return i&&(i.currentItem||i.element)[0]!==this.element[0]?(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var t=e.data(this,"ui-droppable");return t.options.greedy&&!t.options.disabled&&t.options.scope===i.options.scope&&t.accept.call(t.element[0],i.currentItem||i.element)&&e.ui.intersect(i,e.extend(t,{offset:t.element.offset()}),t.options.tolerance)?(r=!0,!1):undefined}),r?!1:this.accept.call(this.element[0],i.currentItem||i.element)?(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",t,this.ui(i)),this.element):!1):!1},ui:function(e){return{draggable:e.currentItem||e.element,helper:e.helper,position:e.position,offset:e.positionAbs}}}),e.ui.intersect=function(e,a,i){if(!a.offset)return!1;var r,s,n=(e.positionAbs||e.position.absolute).left,o=n+e.helperProportions.width,d=(e.positionAbs||e.position.absolute).top,l=d+e.helperProportions.height,u=a.offset.left,h=u+a.proportions.width,c=a.offset.top,m=c+a.proportions.height;switch(i){case"fit":return n>=u&&h>=o&&d>=c&&m>=l;case"intersect":return n+e.helperProportions.width/2>u&&h>o-e.helperProportions.width/2&&d+e.helperProportions.height/2>c&&m>l-e.helperProportions.height/2;case"pointer":return r=(e.positionAbs||e.position.absolute).left+(e.clickOffset||e.offset.click).left,s=(e.positionAbs||e.position.absolute).top+(e.clickOffset||e.offset.click).top,t(s,c,a.proportions.height)&&t(r,u,a.proportions.width);case"touch":return(d>=c&&m>=d||l>=c&&m>=l||c>d&&l>m)&&(n>=u&&h>=n||o>=u&&h>=o||u>n&&o>h);default:return!1}},e.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(t,a){var i,r,s=e.ui.ddmanager.droppables[t.options.scope]||[],n=a?a.type:null,o=(t.currentItem||t.element).find(":data(ui-droppable)").addBack();e:for(i=0;s.length>i;i++)if(!(s[i].options.disabled||t&&!s[i].accept.call(s[i].element[0],t.currentItem||t.element))){for(r=0;o.length>r;r++)if(o[r]===s[i].element[0]){s[i].proportions.height=0;continue e}s[i].visible="none"!==s[i].element.css("display"),s[i].visible&&("mousedown"===n&&s[i]._activate.call(s[i],a),s[i].offset=s[i].element.offset(),s[i].proportions={width:s[i].element[0].offsetWidth,height:s[i].element[0].offsetHeight})}},drop:function(t,a){var i=!1;return e.each((e.ui.ddmanager.droppables[t.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&e.ui.intersect(t,this,this.options.tolerance)&&(i=this._drop.call(this,a)||i),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],t.currentItem||t.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,a)))}),i},dragStart:function(t,a){t.element.parentsUntil("body").bind("scroll.droppable",function(){t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,a)})},drag:function(t,a){t.options.refreshPositions&&e.ui.ddmanager.prepareOffsets(t,a),e.each(e.ui.ddmanager.droppables[t.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var i,r,s,n=e.ui.intersect(t,this,this.options.tolerance),o=!n&&this.isover?"isout":n&&!this.isover?"isover":null;o&&(this.options.greedy&&(r=this.options.scope,s=this.element.parents(":data(ui-droppable)").filter(function(){return e.data(this,"ui-droppable").options.scope===r}),s.length&&(i=e.data(s[0],"ui-droppable"),i.greedyChild="isover"===o)),i&&"isover"===o&&(i.isover=!1,i.isout=!0,i._out.call(i,a)),this[o]=!0,this["isout"===o?"isover":"isout"]=!1,this["isover"===o?"_over":"_out"].call(this,a),i&&"isout"===o&&(i.isout=!1,i.isover=!0,i._over.call(i,a)))}})},dragStop:function(t,a){t.element.parentsUntil("body").unbind("scroll.droppable"),t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,a)}}})(jQuery);(function(e){function t(e){return parseInt(e,10)||0}function a(e){return!isNaN(parseInt(e,10))}e.widget("ui.resizable",e.ui.mouse,{version:"1.10.3",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_create:function(){var t,a,i,r,s,n=this,o=this.options;if(this.element.addClass("ui-resizable"),e.extend(this,{_aspectRatio:!!o.aspectRatio,aspectRatio:o.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:o.helper||o.ghost||o.animate?o.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)&&(this.element.wrap(e("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.data("ui-resizable")),this.elementIsWrapper=!0,this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0}),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css({margin:this.originalElement.css("margin")}),this._proportionallyResize()),this.handles=o.handles||(e(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),t=this.handles.split(","),this.handles={},a=0;t.length>a;a++)i=e.trim(t[a]),s="ui-resizable-"+i,r=e("<div class='ui-resizable-handle "+s+"'></div>"),r.css({zIndex:o.zIndex}),"se"===i&&r.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[i]=".ui-resizable-"+i,this.element.append(r);this._renderAxis=function(t){var a,i,r,s;t=t||this.element;for(a in this.handles)this.handles[a].constructor===String&&(this.handles[a]=e(this.handles[a],this.element).show()),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)&&(i=e(this.handles[a],this.element),s=/sw|ne|nw|se|n|s/.test(a)?i.outerHeight():i.outerWidth(),r=["padding",/ne|nw|n/.test(a)?"Top":/se|sw|s/.test(a)?"Bottom":/^e$/.test(a)?"Right":"Left"].join(""),t.css(r,s),this._proportionallyResize()),e(this.handles[a]).length},this._renderAxis(this.element),this._handles=e(".ui-resizable-handle",this.element).disableSelection(),this._handles.mouseover(function(){n.resizing||(this.className&&(r=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),n.axis=r&&r[1]?r[1]:"se")}),o.autoHide&&(this._handles.hide(),e(this.element).addClass("ui-resizable-autohide").mouseenter(function(){o.disabled||(e(this).removeClass("ui-resizable-autohide"),n._handles.show())}).mouseleave(function(){o.disabled||n.resizing||(e(this).addClass("ui-resizable-autohide"),n._handles.hide())})),this._mouseInit()},_destroy:function(){this._mouseDestroy();var t,a=function(t){e(t).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(a(this.element),t=this.element,this.originalElement.css({position:t.css("position"),width:t.outerWidth(),height:t.outerHeight(),top:t.css("top"),left:t.css("left")}).insertAfter(t),t.remove()),this.originalElement.css("resize",this.originalResizeStyle),a(this.originalElement),this},_mouseCapture:function(t){var a,i,r=!1;for(a in this.handles)i=e(this.handles[a])[0],(i===t.target||e.contains(i,t.target))&&(r=!0);return!this.options.disabled&&r},_mouseStart:function(a){var i,r,s,n=this.options,o=this.element.position(),d=this.element;return this.resizing=!0,/absolute/.test(d.css("position"))?d.css({position:"absolute",top:d.css("top"),left:d.css("left")}):d.is(".ui-draggable")&&d.css({position:"absolute",top:o.top,left:o.left}),this._renderProxy(),i=t(this.helper.css("left")),r=t(this.helper.css("top")),n.containment&&(i+=e(n.containment).scrollLeft()||0,r+=e(n.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:i,top:r},this.size=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()},this.originalSize=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()},this.originalPosition={left:i,top:r},this.sizeDiff={width:d.outerWidth()-d.width(),height:d.outerHeight()-d.height()},this.originalMousePosition={left:a.pageX,top:a.pageY},this.aspectRatio="number"==typeof n.aspectRatio?n.aspectRatio:this.originalSize.width/this.originalSize.height||1,s=e(".ui-resizable-"+this.axis).css("cursor"),e("body").css("cursor","auto"===s?this.axis+"-resize":s),d.addClass("ui-resizable-resizing"),this._propagate("start",a),!0},_mouseDrag:function(t){var a,i=this.helper,r={},s=this.originalMousePosition,n=this.axis,o=this.position.top,d=this.position.left,l=this.size.width,u=this.size.height,h=t.pageX-s.left||0,c=t.pageY-s.top||0,m=this._change[n];return m?(a=m.apply(this,[t,h,c]),this._updateVirtualBoundaries(t.shiftKey),(this._aspectRatio||t.shiftKey)&&(a=this._updateRatio(a,t)),a=this._respectSize(a,t),this._updateCache(a),this._propagate("resize",t),this.position.top!==o&&(r.top=this.position.top+"px"),this.position.left!==d&&(r.left=this.position.left+"px"),this.size.width!==l&&(r.width=this.size.width+"px"),this.size.height!==u&&(r.height=this.size.height+"px"),i.css(r),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),e.isEmptyObject(r)||this._trigger("resize",t,this.ui()),!1):!1},_mouseStop:function(t){this.resizing=!1;var a,i,r,s,n,o,d,l=this.options,u=this;return this._helper&&(a=this._proportionallyResizeElements,i=a.length&&/textarea/i.test(a[0].nodeName),r=i&&e.ui.hasScroll(a[0],"left")?0:u.sizeDiff.height,s=i?0:u.sizeDiff.width,n={width:u.helper.width()-s,height:u.helper.height()-r},o=parseInt(u.element.css("left"),10)+(u.position.left-u.originalPosition.left)||null,d=parseInt(u.element.css("top"),10)+(u.position.top-u.originalPosition.top)||null,l.animate||this.element.css(e.extend(n,{top:d,left:o})),u.helper.height(u.size.height),u.helper.width(u.size.width),this._helper&&!l.animate&&this._proportionallyResize()),e("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",t),this._helper&&this.helper.remove(),!1},_updateVirtualBoundaries:function(e){var t,i,r,s,n,o=this.options;n={minWidth:a(o.minWidth)?o.minWidth:0,maxWidth:a(o.maxWidth)?o.maxWidth:1/0,minHeight:a(o.minHeight)?o.minHeight:0,maxHeight:a(o.maxHeight)?o.maxHeight:1/0},(this._aspectRatio||e)&&(t=n.minHeight*this.aspectRatio,r=n.minWidth/this.aspectRatio,i=n.maxHeight*this.aspectRatio,s=n.maxWidth/this.aspectRatio,t>n.minWidth&&(n.minWidth=t),r>n.minHeight&&(n.minHeight=r),n.maxWidth>i&&(n.maxWidth=i),n.maxHeight>s&&(n.maxHeight=s)),this._vBoundaries=n},_updateCache:function(e){this.offset=this.helper.offset(),a(e.left)&&(this.position.left=e.left),a(e.top)&&(this.position.top=e.top),a(e.height)&&(this.size.height=e.height),a(e.width)&&(this.size.width=e.width)},_updateRatio:function(e){var t=this.position,i=this.size,r=this.axis;return a(e.height)?e.width=e.height*this.aspectRatio:a(e.width)&&(e.height=e.width/this.aspectRatio),"sw"===r&&(e.left=t.left+(i.width-e.width),e.top=null),"nw"===r&&(e.top=t.top+(i.height-e.height),e.left=t.left+(i.width-e.width)),e},_respectSize:function(e){var t=this._vBoundaries,i=this.axis,r=a(e.width)&&t.maxWidth&&t.maxWidth<e.width,s=a(e.height)&&t.maxHeight&&t.maxHeight<e.height,n=a(e.width)&&t.minWidth&&t.minWidth>e.width,o=a(e.height)&&t.minHeight&&t.minHeight>e.height,d=this.originalPosition.left+this.originalSize.width,l=this.position.top+this.size.height,u=/sw|nw|w/.test(i),h=/nw|ne|n/.test(i);return n&&(e.width=t.minWidth),o&&(e.height=t.minHeight),r&&(e.width=t.maxWidth),s&&(e.height=t.maxHeight),n&&u&&(e.left=d-t.minWidth),r&&u&&(e.left=d-t.maxWidth),o&&h&&(e.top=l-t.minHeight),s&&h&&(e.top=l-t.maxHeight),e.width||e.height||e.left||!e.top?e.width||e.height||e.top||!e.left||(e.left=null):e.top=null,e},_proportionallyResize:function(){if(this._proportionallyResizeElements.length){var e,t,a,i,r,s=this.helper||this.element;for(e=0;this._proportionallyResizeElements.length>e;e++){if(r=this._proportionallyResizeElements[e],!this.borderDif)for(this.borderDif=[],a=[r.css("borderTopWidth"),r.css("borderRightWidth"),r.css("borderBottomWidth"),r.css("borderLeftWidth")],i=[r.css("paddingTop"),r.css("paddingRight"),r.css("paddingBottom"),r.css("paddingLeft")],t=0;a.length>t;t++)this.borderDif[t]=(parseInt(a[t],10)||0)+(parseInt(i[t],10)||0);r.css({height:s.height()-this.borderDif[0]-this.borderDif[2]||0,width:s.width()-this.borderDif[1]-this.borderDif[3]||0})}}},_renderProxy:function(){var t=this.element,a=this.options;this.elementOffset=t.offset(),this._helper?(this.helper=this.helper||e("<div style='overflow:hidden;'></div>"),this.helper.addClass(this._helper).css({width:this.element.outerWidth()-1,height:this.element.outerHeight()-1,position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++a.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(e,t){return{width:this.originalSize.width+t}},w:function(e,t){var a=this.originalSize,i=this.originalPosition;return{left:i.left+t,width:a.width-t}},n:function(e,t,a){var i=this.originalSize,r=this.originalPosition;return{top:r.top+a,height:i.height-a}},s:function(e,t,a){return{height:this.originalSize.height+a}},se:function(t,a,i){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[t,a,i]))},sw:function(t,a,i){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[t,a,i]))},ne:function(t,a,i){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[t,a,i]))},nw:function(t,a,i){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[t,a,i]))}},_propagate:function(t,a){e.ui.plugin.call(this,t,[a,this.ui()]),"resize"!==t&&this._trigger(t,a,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),e.ui.plugin.add("resizable","animate",{stop:function(t){var a=e(this).data("ui-resizable"),i=a.options,r=a._proportionallyResizeElements,s=r.length&&/textarea/i.test(r[0].nodeName),n=s&&e.ui.hasScroll(r[0],"left")?0:a.sizeDiff.height,o=s?0:a.sizeDiff.width,d={width:a.size.width-o,height:a.size.height-n},l=parseInt(a.element.css("left"),10)+(a.position.left-a.originalPosition.left)||null,u=parseInt(a.element.css("top"),10)+(a.position.top-a.originalPosition.top)||null;a.element.animate(e.extend(d,u&&l?{top:u,left:l}:{}),{duration:i.animateDuration,easing:i.animateEasing,step:function(){var i={width:parseInt(a.element.css("width"),10),height:parseInt(a.element.css("height"),10),top:parseInt(a.element.css("top"),10),left:parseInt(a.element.css("left"),10)};r&&r.length&&e(r[0]).css({width:i.width,height:i.height}),a._updateCache(i),a._propagate("resize",t)}})}}),e.ui.plugin.add("resizable","containment",{start:function(){var a,i,r,s,n,o,d,l=e(this).data("ui-resizable"),u=l.options,h=l.element,c=u.containment,m=c instanceof e?c.get(0):/parent/.test(c)?h.parent().get(0):c;m&&(l.containerElement=e(m),/document/.test(c)||c===document?(l.containerOffset={left:0,top:0},l.containerPosition={left:0,top:0},l.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}):(a=e(m),i=[],e(["Top","Right","Left","Bottom"]).each(function(e,r){i[e]=t(a.css("padding"+r))}),l.containerOffset=a.offset(),l.containerPosition=a.position(),l.containerSize={height:a.innerHeight()-i[3],width:a.innerWidth()-i[1]},r=l.containerOffset,s=l.containerSize.height,n=l.containerSize.width,o=e.ui.hasScroll(m,"left")?m.scrollWidth:n,d=e.ui.hasScroll(m)?m.scrollHeight:s,l.parentData={element:m,left:r.left,top:r.top,width:o,height:d}))},resize:function(t){var a,i,r,s,n=e(this).data("ui-resizable"),o=n.options,d=n.containerOffset,l=n.position,u=n._aspectRatio||t.shiftKey,h={top:0,left:0},c=n.containerElement;c[0]!==document&&/static/.test(c.css("position"))&&(h=d),l.left<(n._helper?d.left:0)&&(n.size.width=n.size.width+(n._helper?n.position.left-d.left:n.position.left-h.left),u&&(n.size.height=n.size.width/n.aspectRatio),n.position.left=o.helper?d.left:0),l.top<(n._helper?d.top:0)&&(n.size.height=n.size.height+(n._helper?n.position.top-d.top:n.position.top),u&&(n.size.width=n.size.height*n.aspectRatio),n.position.top=n._helper?d.top:0),n.offset.left=n.parentData.left+n.position.left,n.offset.top=n.parentData.top+n.position.top,a=Math.abs((n._helper?n.offset.left-h.left:n.offset.left-h.left)+n.sizeDiff.width),i=Math.abs((n._helper?n.offset.top-h.top:n.offset.top-d.top)+n.sizeDiff.height),r=n.containerElement.get(0)===n.element.parent().get(0),s=/relative|absolute/.test(n.containerElement.css("position")),r&&s&&(a-=n.parentData.left),a+n.size.width>=n.parentData.width&&(n.size.width=n.parentData.width-a,u&&(n.size.height=n.size.width/n.aspectRatio)),i+n.size.height>=n.parentData.height&&(n.size.height=n.parentData.height-i,u&&(n.size.width=n.size.height*n.aspectRatio))},stop:function(){var t=e(this).data("ui-resizable"),a=t.options,i=t.containerOffset,r=t.containerPosition,s=t.containerElement,n=e(t.helper),o=n.offset(),d=n.outerWidth()-t.sizeDiff.width,l=n.outerHeight()-t.sizeDiff.height;t._helper&&!a.animate&&/relative/.test(s.css("position"))&&e(this).css({left:o.left-r.left-i.left,width:d,height:l}),t._helper&&!a.animate&&/static/.test(s.css("position"))&&e(this).css({left:o.left-r.left-i.left,width:d,height:l})}}),e.ui.plugin.add("resizable","alsoResize",{start:function(){var t=e(this).data("ui-resizable"),a=t.options,i=function(t){e(t).each(function(){var t=e(this);t.data("ui-resizable-alsoresize",{width:parseInt(t.width(),10),height:parseInt(t.height(),10),left:parseInt(t.css("left"),10),top:parseInt(t.css("top"),10)})})};"object"!=typeof a.alsoResize||a.alsoResize.parentNode?i(a.alsoResize):a.alsoResize.length?(a.alsoResize=a.alsoResize[0],i(a.alsoResize)):e.each(a.alsoResize,function(e){i(e)})},resize:function(t,a){var i=e(this).data("ui-resizable"),r=i.options,s=i.originalSize,n=i.originalPosition,o={height:i.size.height-s.height||0,width:i.size.width-s.width||0,top:i.position.top-n.top||0,left:i.position.left-n.left||0},d=function(t,i){e(t).each(function(){var t=e(this),r=e(this).data("ui-resizable-alsoresize"),s={},n=i&&i.length?i:t.parents(a.originalElement[0]).length?["width","height"]:["width","height","top","left"];e.each(n,function(e,t){var a=(r[t]||0)+(o[t]||0);a&&a>=0&&(s[t]=a||null)}),t.css(s)})};"object"!=typeof r.alsoResize||r.alsoResize.nodeType?d(r.alsoResize):e.each(r.alsoResize,function(e,t){d(e,t)})},stop:function(){e(this).removeData("resizable-alsoresize")}}),e.ui.plugin.add("resizable","ghost",{start:function(){var t=e(this).data("ui-resizable"),a=t.options,i=t.size;t.ghost=t.originalElement.clone(),t.ghost.css({opacity:.25,display:"block",position:"relative",height:i.height,width:i.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass("string"==typeof a.ghost?a.ghost:""),t.ghost.appendTo(t.helper)},resize:function(){var t=e(this).data("ui-resizable");t.ghost&&t.ghost.css({position:"relative",height:t.size.height,width:t.size.width})},stop:function(){var t=e(this).data("ui-resizable");t.ghost&&t.helper&&t.helper.get(0).removeChild(t.ghost.get(0))}}),e.ui.plugin.add("resizable","grid",{resize:function(){var t=e(this).data("ui-resizable"),a=t.options,i=t.size,r=t.originalSize,s=t.originalPosition,n=t.axis,o="number"==typeof a.grid?[a.grid,a.grid]:a.grid,d=o[0]||1,l=o[1]||1,u=Math.round((i.width-r.width)/d)*d,h=Math.round((i.height-r.height)/l)*l,c=r.width+u,m=r.height+h,p=a.maxWidth&&c>a.maxWidth,f=a.maxHeight&&m>a.maxHeight,g=a.minWidth&&a.minWidth>c,y=a.minHeight&&a.minHeight>m;a.grid=o,g&&(c+=d),y&&(m+=l),p&&(c-=d),f&&(m-=l),/^(se|s|e)$/.test(n)?(t.size.width=c,t.size.height=m):/^(ne)$/.test(n)?(t.size.width=c,t.size.height=m,t.position.top=s.top-h):/^(sw)$/.test(n)?(t.size.width=c,t.size.height=m,t.position.left=s.left-u):(t.size.width=c,t.size.height=m,t.position.top=s.top-h,t.position.left=s.left-u)}})})(jQuery);(function(e){e.widget("ui.selectable",e.ui.mouse,{version:"1.10.3",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var t,i=this;this.element.addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){t=e(i.options.filter,i.element[0]),t.addClass("ui-selectee"),t.each(function(){var t=e(this),i=t.offset();e.data(this,"selectable-item",{element:this,$element:t,left:i.left,top:i.top,right:i.left+t.outerWidth(),bottom:i.top+t.outerHeight(),startselected:!1,selected:t.hasClass("ui-selected"),selecting:t.hasClass("ui-selecting"),unselecting:t.hasClass("ui-unselecting")})})},this.refresh(),this.selectees=t.addClass("ui-selectee"),this._mouseInit(),this.helper=e("<div class='ui-selectable-helper'></div>")},_destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item"),this.element.removeClass("ui-selectable ui-selectable-disabled"),this._mouseDestroy()},_mouseStart:function(t){var i=this,a=this.options;this.opos=[t.pageX,t.pageY],this.options.disabled||(this.selectees=e(a.filter,this.element[0]),this._trigger("start",t),e(a.appendTo).append(this.helper),this.helper.css({left:t.pageX,top:t.pageY,width:0,height:0}),a.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var a=e.data(this,"selectable-item");a.startselected=!0,t.metaKey||t.ctrlKey||(a.$element.removeClass("ui-selected"),a.selected=!1,a.$element.addClass("ui-unselecting"),a.unselecting=!0,i._trigger("unselecting",t,{unselecting:a.element}))}),e(t.target).parents().addBack().each(function(){var a,r=e.data(this,"selectable-item");return r?(a=!t.metaKey&&!t.ctrlKey||!r.$element.hasClass("ui-selected"),r.$element.removeClass(a?"ui-unselecting":"ui-selected").addClass(a?"ui-selecting":"ui-unselecting"),r.unselecting=!a,r.selecting=a,r.selected=a,a?i._trigger("selecting",t,{selecting:r.element}):i._trigger("unselecting",t,{unselecting:r.element}),!1):undefined}))},_mouseDrag:function(t){if(this.dragged=!0,!this.options.disabled){var i,a=this,r=this.options,s=this.opos[0],n=this.opos[1],o=t.pageX,d=t.pageY;return s>o&&(i=o,o=s,s=i),n>d&&(i=d,d=n,n=i),this.helper.css({left:s,top:n,width:o-s,height:d-n}),this.selectees.each(function(){var i=e.data(this,"selectable-item"),l=!1;i&&i.element!==a.element[0]&&("touch"===r.tolerance?l=!(i.left>o||s>i.right||i.top>d||n>i.bottom):"fit"===r.tolerance&&(l=i.left>s&&o>i.right&&i.top>n&&d>i.bottom),l?(i.selected&&(i.$element.removeClass("ui-selected"),i.selected=!1),i.unselecting&&(i.$element.removeClass("ui-unselecting"),i.unselecting=!1),i.selecting||(i.$element.addClass("ui-selecting"),i.selecting=!0,a._trigger("selecting",t,{selecting:i.element}))):(i.selecting&&((t.metaKey||t.ctrlKey)&&i.startselected?(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.$element.addClass("ui-selected"),i.selected=!0):(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.startselected&&(i.$element.addClass("ui-unselecting"),i.unselecting=!0),a._trigger("unselecting",t,{unselecting:i.element}))),i.selected&&(t.metaKey||t.ctrlKey||i.startselected||(i.$element.removeClass("ui-selected"),i.selected=!1,i.$element.addClass("ui-unselecting"),i.unselecting=!0,a._trigger("unselecting",t,{unselecting:i.element})))))}),!1}},_mouseStop:function(t){var i=this;return this.dragged=!1,e(".ui-unselecting",this.element[0]).each(function(){var a=e.data(this,"selectable-item");a.$element.removeClass("ui-unselecting"),a.unselecting=!1,a.startselected=!1,i._trigger("unselected",t,{unselected:a.element})}),e(".ui-selecting",this.element[0]).each(function(){var a=e.data(this,"selectable-item");a.$element.removeClass("ui-selecting").addClass("ui-selected"),a.selecting=!1,a.selected=!0,a.startselected=!0,i._trigger("selected",t,{selected:a.element})}),this._trigger("stop",t),this.helper.remove(),!1}})})(jQuery);(function(e){function t(e,t,i){return e>t&&t+i>e}function i(e){return/left|right/.test(e.css("float"))||/inline|table-cell/.test(e.css("display"))}e.widget("ui.sortable",e.ui.mouse,{version:"1.10.3",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_create:function(){var e=this.options;this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.floating=this.items.length?"x"===e.axis||i(this.items[0].item):!1,this.offset=this.element.offset(),this._mouseInit(),this.ready=!0},_destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled"),this._mouseDestroy();for(var e=this.items.length-1;e>=0;e--)this.items[e].item.removeData(this.widgetName+"-item");return this},_setOption:function(t,i){"disabled"===t?(this.options[t]=i,this.widget().toggleClass("ui-sortable-disabled",!!i)):e.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(t,i){var a=null,r=!1,s=this;return this.reverting?!1:this.options.disabled||"static"===this.options.type?!1:(this._refreshItems(t),e(t.target).parents().each(function(){return e.data(this,s.widgetName+"-item")===s?(a=e(this),!1):undefined}),e.data(t.target,s.widgetName+"-item")===s&&(a=e(t.target)),a?!this.options.handle||i||(e(this.options.handle,a).find("*").addBack().each(function(){this===t.target&&(r=!0)}),r)?(this.currentItem=a,this._removeCurrentsFromItems(),!0):!1:!1)},_mouseStart:function(t,i,a){var r,s,n=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(t),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,n.cursorAt&&this._adjustOffsetFromHelper(n.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),n.containment&&this._setContainment(),n.cursor&&"auto"!==n.cursor&&(s=this.document.find("body"),this.storedCursor=s.css("cursor"),s.css("cursor",n.cursor),this.storedStylesheet=e("<style>*{ cursor: "+n.cursor+" !important; }</style>").appendTo(s)),n.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",n.opacity)),n.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",n.zIndex)),this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",t,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!a)for(r=this.containers.length-1;r>=0;r--)this.containers[r]._trigger("activate",t,this._uiHash(this));return e.ui.ddmanager&&(e.ui.ddmanager.current=this),e.ui.ddmanager&&!n.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(t),!0},_mouseDrag:function(t){var i,a,r,s,n=this.options,o=!1;for(this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-t.pageY<n.scrollSensitivity?this.scrollParent[0].scrollTop=o=this.scrollParent[0].scrollTop+n.scrollSpeed:t.pageY-this.overflowOffset.top<n.scrollSensitivity&&(this.scrollParent[0].scrollTop=o=this.scrollParent[0].scrollTop-n.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-t.pageX<n.scrollSensitivity?this.scrollParent[0].scrollLeft=o=this.scrollParent[0].scrollLeft+n.scrollSpeed:t.pageX-this.overflowOffset.left<n.scrollSensitivity&&(this.scrollParent[0].scrollLeft=o=this.scrollParent[0].scrollLeft-n.scrollSpeed)):(t.pageY-e(document).scrollTop()<n.scrollSensitivity?o=e(document).scrollTop(e(document).scrollTop()-n.scrollSpeed):e(window).height()-(t.pageY-e(document).scrollTop())<n.scrollSensitivity&&(o=e(document).scrollTop(e(document).scrollTop()+n.scrollSpeed)),t.pageX-e(document).scrollLeft()<n.scrollSensitivity?o=e(document).scrollLeft(e(document).scrollLeft()-n.scrollSpeed):e(window).width()-(t.pageX-e(document).scrollLeft())<n.scrollSensitivity&&(o=e(document).scrollLeft(e(document).scrollLeft()+n.scrollSpeed))),o!==!1&&e.ui.ddmanager&&!n.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t)),this.positionAbs=this._convertPositionTo("absolute"),this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),i=this.items.length-1;i>=0;i--)if(a=this.items[i],r=a.item[0],s=this._intersectsWithPointer(a),s&&a.instance===this.currentContainer&&r!==this.currentItem[0]&&this.placeholder[1===s?"next":"prev"]()[0]!==r&&!e.contains(this.placeholder[0],r)&&("semi-dynamic"===this.options.type?!e.contains(this.element[0],r):!0)){if(this.direction=1===s?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(a))break;this._rearrange(t,a),this._trigger("change",t,this._uiHash());break}return this._contactContainers(t),e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),this._trigger("sort",t,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(t,i){if(t){if(e.ui.ddmanager&&!this.options.dropBehaviour&&e.ui.ddmanager.drop(this,t),this.options.revert){var a=this,r=this.placeholder.offset(),s=this.options.axis,n={};s&&"x"!==s||(n.left=r.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollLeft)),s&&"y"!==s||(n.top=r.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,e(this.helper).animate(n,parseInt(this.options.revert,10)||500,function(){a._clear(t)})}else this._clear(t,i);return!1}},cancel:function(){if(this.dragging){this._mouseUp({target:null}),"original"===this.options.helper?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var t=this.containers.length-1;t>=0;t--)this.containers[t]._trigger("deactivate",null,this._uiHash(this)),this.containers[t].containerCache.over&&(this.containers[t]._trigger("out",null,this._uiHash(this)),this.containers[t].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),e.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?e(this.domPosition.prev).after(this.currentItem):e(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(t){var i=this._getItemsAsjQuery(t&&t.connected),a=[];return t=t||{},e(i).each(function(){var i=(e(t.item||this).attr(t.attribute||"id")||"").match(t.expression||/(.+)[\-=_](.+)/);i&&a.push((t.key||i[1]+"[]")+"="+(t.key&&t.expression?i[1]:i[2]))}),!a.length&&t.key&&a.push(t.key+"="),a.join("&")},toArray:function(t){var i=this._getItemsAsjQuery(t&&t.connected),a=[];return t=t||{},i.each(function(){a.push(e(t.item||this).attr(t.attribute||"id")||"")}),a},_intersectsWith:function(e){var t=this.positionAbs.left,i=t+this.helperProportions.width,a=this.positionAbs.top,r=a+this.helperProportions.height,s=e.left,n=s+e.width,o=e.top,h=o+e.height,l=this.offset.click.top,d=this.offset.click.left,u="x"===this.options.axis||a+l>o&&h>a+l,c="y"===this.options.axis||t+d>s&&n>t+d,p=u&&c;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>e[this.floating?"width":"height"]?p:t+this.helperProportions.width/2>s&&n>i-this.helperProportions.width/2&&a+this.helperProportions.height/2>o&&h>r-this.helperProportions.height/2},_intersectsWithPointer:function(e){var i="x"===this.options.axis||t(this.positionAbs.top+this.offset.click.top,e.top,e.height),a="y"===this.options.axis||t(this.positionAbs.left+this.offset.click.left,e.left,e.width),r=i&&a,s=this._getDragVerticalDirection(),n=this._getDragHorizontalDirection();return r?this.floating?n&&"right"===n||"down"===s?2:1:s&&("down"===s?2:1):!1},_intersectsWithSides:function(e){var i=t(this.positionAbs.top+this.offset.click.top,e.top+e.height/2,e.height),a=t(this.positionAbs.left+this.offset.click.left,e.left+e.width/2,e.width),r=this._getDragVerticalDirection(),s=this._getDragHorizontalDirection();return this.floating&&s?"right"===s&&a||"left"===s&&!a:r&&("down"===r&&i||"up"===r&&!i)},_getDragVerticalDirection:function(){var e=this.positionAbs.top-this.lastPositionAbs.top;return 0!==e&&(e>0?"down":"up")},_getDragHorizontalDirection:function(){var e=this.positionAbs.left-this.lastPositionAbs.left;return 0!==e&&(e>0?"right":"left")},refresh:function(e){return this._refreshItems(e),this.refreshPositions(),this},_connectWith:function(){var e=this.options;return e.connectWith.constructor===String?[e.connectWith]:e.connectWith},_getItemsAsjQuery:function(t){var i,a,r,s,n=[],o=[],h=this._connectWith();if(h&&t)for(i=h.length-1;i>=0;i--)for(r=e(h[i]),a=r.length-1;a>=0;a--)s=e.data(r[a],this.widgetFullName),s&&s!==this&&!s.options.disabled&&o.push([e.isFunction(s.options.items)?s.options.items.call(s.element):e(s.options.items,s.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),s]);for(o.push([e.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):e(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),i=o.length-1;i>=0;i--)o[i][0].each(function(){n.push(this)});return e(n)},_removeCurrentsFromItems:function(){var t=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=e.grep(this.items,function(e){for(var i=0;t.length>i;i++)if(t[i]===e.item[0])return!1;return!0})},_refreshItems:function(t){this.items=[],this.containers=[this];var i,a,r,s,n,o,h,l,d=this.items,u=[[e.isFunction(this.options.items)?this.options.items.call(this.element[0],t,{item:this.currentItem}):e(this.options.items,this.element),this]],c=this._connectWith();if(c&&this.ready)for(i=c.length-1;i>=0;i--)for(r=e(c[i]),a=r.length-1;a>=0;a--)s=e.data(r[a],this.widgetFullName),s&&s!==this&&!s.options.disabled&&(u.push([e.isFunction(s.options.items)?s.options.items.call(s.element[0],t,{item:this.currentItem}):e(s.options.items,s.element),s]),this.containers.push(s));for(i=u.length-1;i>=0;i--)for(n=u[i][1],o=u[i][0],a=0,l=o.length;l>a;a++)h=e(o[a]),h.data(this.widgetName+"-item",n),d.push({item:h,instance:n,width:0,height:0,left:0,top:0})},refreshPositions:function(t){this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var i,a,r,s;for(i=this.items.length-1;i>=0;i--)a=this.items[i],a.instance!==this.currentContainer&&this.currentContainer&&a.item[0]!==this.currentItem[0]||(r=this.options.toleranceElement?e(this.options.toleranceElement,a.item):a.item,t||(a.width=r.outerWidth(),a.height=r.outerHeight()),s=r.offset(),a.left=s.left,a.top=s.top);if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(i=this.containers.length-1;i>=0;i--)s=this.containers[i].element.offset(),this.containers[i].containerCache.left=s.left,this.containers[i].containerCache.top=s.top,this.containers[i].containerCache.width=this.containers[i].element.outerWidth(),this.containers[i].containerCache.height=this.containers[i].element.outerHeight();return this},_createPlaceholder:function(t){t=t||this;var i,a=t.options;a.placeholder&&a.placeholder.constructor!==String||(i=a.placeholder,a.placeholder={element:function(){var a=t.currentItem[0].nodeName.toLowerCase(),r=e("<"+a+">",t.document[0]).addClass(i||t.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper");return"tr"===a?t.currentItem.children().each(function(){e("<td>&#160;</td>",t.document[0]).attr("colspan",e(this).attr("colspan")||1).appendTo(r)}):"img"===a&&r.attr("src",t.currentItem.attr("src")),i||r.css("visibility","hidden"),r},update:function(e,r){(!i||a.forcePlaceholderSize)&&(r.height()||r.height(t.currentItem.innerHeight()-parseInt(t.currentItem.css("paddingTop")||0,10)-parseInt(t.currentItem.css("paddingBottom")||0,10)),r.width()||r.width(t.currentItem.innerWidth()-parseInt(t.currentItem.css("paddingLeft")||0,10)-parseInt(t.currentItem.css("paddingRight")||0,10)))}}),t.placeholder=e(a.placeholder.element.call(t.element,t.currentItem)),t.currentItem.after(t.placeholder),a.placeholder.update(t,t.placeholder)},_contactContainers:function(a){var r,s,n,o,h,l,d,u,c,p,m=null,f=null;for(r=this.containers.length-1;r>=0;r--)if(!e.contains(this.currentItem[0],this.containers[r].element[0]))if(this._intersectsWith(this.containers[r].containerCache)){if(m&&e.contains(this.containers[r].element[0],m.element[0]))continue;m=this.containers[r],f=r}else this.containers[r].containerCache.over&&(this.containers[r]._trigger("out",a,this._uiHash(this)),this.containers[r].containerCache.over=0);if(m)if(1===this.containers.length)this.containers[f].containerCache.over||(this.containers[f]._trigger("over",a,this._uiHash(this)),this.containers[f].containerCache.over=1);else{for(n=1e4,o=null,p=m.floating||i(this.currentItem),h=p?"left":"top",l=p?"width":"height",d=this.positionAbs[h]+this.offset.click[h],s=this.items.length-1;s>=0;s--)e.contains(this.containers[f].element[0],this.items[s].item[0])&&this.items[s].item[0]!==this.currentItem[0]&&(!p||t(this.positionAbs.top+this.offset.click.top,this.items[s].top,this.items[s].height))&&(u=this.items[s].item.offset()[h],c=!1,Math.abs(u-d)>Math.abs(u+this.items[s][l]-d)&&(c=!0,u+=this.items[s][l]),n>Math.abs(u-d)&&(n=Math.abs(u-d),o=this.items[s],this.direction=c?"up":"down"));if(!o&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[f])return;o?this._rearrange(a,o,null,!0):this._rearrange(a,null,this.containers[f].element,!0),this._trigger("change",a,this._uiHash()),this.containers[f]._trigger("change",a,this._uiHash(this)),this.currentContainer=this.containers[f],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[f]._trigger("over",a,this._uiHash(this)),this.containers[f].containerCache.over=1}},_createHelper:function(t){var i=this.options,a=e.isFunction(i.helper)?e(i.helper.apply(this.element[0],[t,this.currentItem])):"clone"===i.helper?this.currentItem.clone():this.currentItem;return a.parents("body").length||e("parent"!==i.appendTo?i.appendTo:this.currentItem[0].parentNode)[0].appendChild(a[0]),a[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(!a[0].style.width||i.forceHelperSize)&&a.width(this.currentItem.width()),(!a[0].style.height||i.forceHelperSize)&&a.height(this.currentItem.height()),a},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var t=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&e.ui.ie)&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var e=this.currentItem.position();return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:e.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,i,a,r=this.options;"parent"===r.containment&&(r.containment=this.helper[0].parentNode),("document"===r.containment||"window"===r.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,e("document"===r.containment?document:window).width()-this.helperProportions.width-this.margins.left,(e("document"===r.containment?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(r.containment)||(t=e(r.containment)[0],i=e(r.containment).offset(),a="hidden"!==e(t).css("overflow"),this.containment=[i.left+(parseInt(e(t).css("borderLeftWidth"),10)||0)+(parseInt(e(t).css("paddingLeft"),10)||0)-this.margins.left,i.top+(parseInt(e(t).css("borderTopWidth"),10)||0)+(parseInt(e(t).css("paddingTop"),10)||0)-this.margins.top,i.left+(a?Math.max(t.scrollWidth,t.offsetWidth):t.offsetWidth)-(parseInt(e(t).css("borderLeftWidth"),10)||0)-(parseInt(e(t).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,i.top+(a?Math.max(t.scrollHeight,t.offsetHeight):t.offsetHeight)-(parseInt(e(t).css("borderTopWidth"),10)||0)-(parseInt(e(t).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(t,i){i||(i=this.position);var a="absolute"===t?1:-1,r="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,s=/(html|body)/i.test(r[0].tagName);return{top:i.top+this.offset.relative.top*a+this.offset.parent.top*a-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():s?0:r.scrollTop())*a,left:i.left+this.offset.relative.left*a+this.offset.parent.left*a-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():s?0:r.scrollLeft())*a}},_generatePosition:function(t){var i,a,r=this.options,s=t.pageX,n=t.pageY,o="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,h=/(html|body)/i.test(o[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==document&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(t.pageX-this.offset.click.left<this.containment[0]&&(s=this.containment[0]+this.offset.click.left),t.pageY-this.offset.click.top<this.containment[1]&&(n=this.containment[1]+this.offset.click.top),t.pageX-this.offset.click.left>this.containment[2]&&(s=this.containment[2]+this.offset.click.left),t.pageY-this.offset.click.top>this.containment[3]&&(n=this.containment[3]+this.offset.click.top)),r.grid&&(i=this.originalPageY+Math.round((n-this.originalPageY)/r.grid[1])*r.grid[1],n=this.containment?i-this.offset.click.top>=this.containment[1]&&i-this.offset.click.top<=this.containment[3]?i:i-this.offset.click.top>=this.containment[1]?i-r.grid[1]:i+r.grid[1]:i,a=this.originalPageX+Math.round((s-this.originalPageX)/r.grid[0])*r.grid[0],s=this.containment?a-this.offset.click.left>=this.containment[0]&&a-this.offset.click.left<=this.containment[2]?a:a-this.offset.click.left>=this.containment[0]?a-r.grid[0]:a+r.grid[0]:a)),{top:n-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():h?0:o.scrollTop()),left:s-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():h?0:o.scrollLeft())}},_rearrange:function(e,t,i,a){i?i[0].appendChild(this.placeholder[0]):t.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?t.item[0]:t.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var r=this.counter;this._delay(function(){r===this.counter&&this.refreshPositions(!a)})},_clear:function(e,t){this.reverting=!1;var i,a=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(i in this._storedCSS)("auto"===this._storedCSS[i]||"static"===this._storedCSS[i])&&(this._storedCSS[i]="");this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!t&&a.push(function(e){this._trigger("receive",e,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||t||a.push(function(e){this._trigger("update",e,this._uiHash())}),this!==this.currentContainer&&(t||(a.push(function(e){this._trigger("remove",e,this._uiHash())}),a.push(function(e){return function(t){e._trigger("receive",t,this._uiHash(this))}}.call(this,this.currentContainer)),a.push(function(e){return function(t){e._trigger("update",t,this._uiHash(this))}}.call(this,this.currentContainer)))),i=this.containers.length-1;i>=0;i--)t||a.push(function(e){return function(t){e._trigger("deactivate",t,this._uiHash(this))}}.call(this,this.containers[i])),this.containers[i].containerCache.over&&(a.push(function(e){return function(t){e._trigger("out",t,this._uiHash(this))}}.call(this,this.containers[i])),this.containers[i].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,this.cancelHelperRemoval){if(!t){for(this._trigger("beforeStop",e,this._uiHash()),i=0;a.length>i;i++)a[i].call(this,e);this._trigger("stop",e,this._uiHash())}return this.fromOutside=!1,!1}if(t||this._trigger("beforeStop",e,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null,!t){for(i=0;a.length>i;i++)a[i].call(this,e);this._trigger("stop",e,this._uiHash())}return this.fromOutside=!1,!0},_trigger:function(){e.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(t){var i=t||this;return{helper:i.helper,placeholder:i.placeholder||e([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:t?t.element:null}}})})(jQuery);(function(e){var t=0,i={},a={};i.height=i.paddingTop=i.paddingBottom=i.borderTopWidth=i.borderBottomWidth="hide",a.height=a.paddingTop=a.paddingBottom=a.borderTopWidth=a.borderBottomWidth="show",e.widget("ui.accordion",{version:"1.10.3",options:{active:0,animate:{},collapsible:!1,event:"click",header:"> li > :first-child,> :not(li):even",heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},_create:function(){var t=this.options;this.prevShow=this.prevHide=e(),this.element.addClass("ui-accordion ui-widget ui-helper-reset").attr("role","tablist"),t.collapsible||t.active!==!1&&null!=t.active||(t.active=0),this._processPanels(),0>t.active&&(t.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():e(),content:this.active.length?this.active.next():e()}},_createIcons:function(){var t=this.options.icons;t&&(e("<span>").addClass("ui-accordion-header-icon ui-icon "+t.header).prependTo(this.headers),this.active.children(".ui-accordion-header-icon").removeClass(t.header).addClass(t.activeHeader),this.headers.addClass("ui-accordion-icons"))},_destroyIcons:function(){this.headers.removeClass("ui-accordion-icons").children(".ui-accordion-header-icon").remove()},_destroy:function(){var e;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role"),this.headers.removeClass("ui-accordion-header ui-accordion-header-active ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-selected").removeAttr("aria-controls").removeAttr("tabIndex").each(function(){/^ui-accordion/.test(this.id)&&this.removeAttribute("id")}),this._destroyIcons(),e=this.headers.next().css("display","").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled").each(function(){/^ui-accordion/.test(this.id)&&this.removeAttribute("id")}),"content"!==this.options.heightStyle&&e.css("height","")},_setOption:function(e,t){return"active"===e?(this._activate(t),undefined):("event"===e&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(t)),this._super(e,t),"collapsible"!==e||t||this.options.active!==!1||this._activate(0),"icons"===e&&(this._destroyIcons(),t&&this._createIcons()),"disabled"===e&&this.headers.add(this.headers.next()).toggleClass("ui-state-disabled",!!t),undefined)},_keydown:function(t){if(!t.altKey&&!t.ctrlKey){var i=e.ui.keyCode,a=this.headers.length,r=this.headers.index(t.target),s=!1;switch(t.keyCode){case i.RIGHT:case i.DOWN:s=this.headers[(r+1)%a];break;case i.LEFT:case i.UP:s=this.headers[(r-1+a)%a];break;case i.SPACE:case i.ENTER:this._eventHandler(t);break;case i.HOME:s=this.headers[0];break;case i.END:s=this.headers[a-1]}s&&(e(t.target).attr("tabIndex",-1),e(s).attr("tabIndex",0),s.focus(),t.preventDefault())}},_panelKeyDown:function(t){t.keyCode===e.ui.keyCode.UP&&t.ctrlKey&&e(t.currentTarget).prev().focus()},refresh:function(){var t=this.options;this._processPanels(),t.active===!1&&t.collapsible===!0||!this.headers.length?(t.active=!1,this.active=e()):t.active===!1?this._activate(0):this.active.length&&!e.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(t.active=!1,this.active=e()):this._activate(Math.max(0,t.active-1)):t.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){this.headers=this.element.find(this.options.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all"),this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom").filter(":not(.ui-accordion-content-active)").hide()},_refresh:function(){var i,a=this.options,r=a.heightStyle,s=this.element.parent(),n=this.accordionId="ui-accordion-"+(this.element.attr("id")||++t);this.active=this._findActive(a.active).addClass("ui-accordion-header-active ui-state-active ui-corner-top").removeClass("ui-corner-all"),this.active.next().addClass("ui-accordion-content-active").show(),this.headers.attr("role","tab").each(function(t){var i=e(this),a=i.attr("id"),r=i.next(),s=r.attr("id");a||(a=n+"-header-"+t,i.attr("id",a)),s||(s=n+"-panel-"+t,r.attr("id",s)),i.attr("aria-controls",s),r.attr("aria-labelledby",a)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false",tabIndex:-1}).next().attr({"aria-expanded":"false","aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true",tabIndex:0}).next().attr({"aria-expanded":"true","aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(a.event),"fill"===r?(i=s.height(),this.element.siblings(":visible").each(function(){var t=e(this),a=t.css("position");"absolute"!==a&&"fixed"!==a&&(i-=t.outerHeight(!0))}),this.headers.each(function(){i-=e(this).outerHeight(!0)}),this.headers.next().each(function(){e(this).height(Math.max(0,i-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):"auto"===r&&(i=0,this.headers.next().each(function(){i=Math.max(i,e(this).css("height","").height())}).height(i))},_activate:function(t){var i=this._findActive(t)[0];i!==this.active[0]&&(i=i||this.active[0],this._eventHandler({target:i,currentTarget:i,preventDefault:e.noop}))},_findActive:function(t){return"number"==typeof t?this.headers.eq(t):e()},_setupEvents:function(t){var i={keydown:"_keydown"};t&&e.each(t.split(" "),function(e,t){i[t]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,i),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(t){var i=this.options,a=this.active,r=e(t.currentTarget),s=r[0]===a[0],n=s&&i.collapsible,o=n?e():r.next(),h=a.next(),l={oldHeader:a,oldPanel:h,newHeader:n?e():r,newPanel:o};t.preventDefault(),s&&!i.collapsible||this._trigger("beforeActivate",t,l)===!1||(i.active=n?!1:this.headers.index(r),this.active=s?e():r,this._toggle(l),a.removeClass("ui-accordion-header-active ui-state-active"),i.icons&&a.children(".ui-accordion-header-icon").removeClass(i.icons.activeHeader).addClass(i.icons.header),s||(r.removeClass("ui-corner-all").addClass("ui-accordion-header-active ui-state-active ui-corner-top"),i.icons&&r.children(".ui-accordion-header-icon").removeClass(i.icons.header).addClass(i.icons.activeHeader),r.next().addClass("ui-accordion-content-active")))},_toggle:function(t){var i=t.newPanel,a=this.prevShow.length?this.prevShow:t.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=i,this.prevHide=a,this.options.animate?this._animate(i,a,t):(a.hide(),i.show(),this._toggleComplete(t)),a.attr({"aria-expanded":"false","aria-hidden":"true"}),a.prev().attr("aria-selected","false"),i.length&&a.length?a.prev().attr("tabIndex",-1):i.length&&this.headers.filter(function(){return 0===e(this).attr("tabIndex")}).attr("tabIndex",-1),i.attr({"aria-expanded":"true","aria-hidden":"false"}).prev().attr({"aria-selected":"true",tabIndex:0})},_animate:function(e,t,r){var s,n,o,h=this,l=0,d=e.length&&(!t.length||e.index()<t.index()),u=this.options.animate||{},c=d&&u.down||u,p=function(){h._toggleComplete(r)};return"number"==typeof c&&(o=c),"string"==typeof c&&(n=c),n=n||c.easing||u.easing,o=o||c.duration||u.duration,t.length?e.length?(s=e.show().outerHeight(),t.animate(i,{duration:o,easing:n,step:function(e,t){t.now=Math.round(e)}}),e.hide().animate(a,{duration:o,easing:n,complete:p,step:function(e,i){i.now=Math.round(e),"height"!==i.prop?l+=i.now:"content"!==h.options.heightStyle&&(i.now=Math.round(s-t.outerHeight()-l),l=0)}}),undefined):t.animate(i,o,n,p):e.animate(a,o,n,p)},_toggleComplete:function(e){var t=e.oldPanel;t.removeClass("ui-accordion-content-active").prev().removeClass("ui-corner-top").addClass("ui-corner-all"),t.length&&(t.parent()[0].className=t.parent()[0].className),this._trigger("activate",null,e)}})})(jQuery);(function(e){var t=0;e.widget("ui.autocomplete",{version:"1.10.3",defaultElement:"<input>",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},pending:0,_create:function(){var t,i,a,s=this.element[0].nodeName.toLowerCase(),r="textarea"===s,n="input"===s;this.isMultiLine=r?!0:n?!1:this.element.prop("isContentEditable"),this.valueMethod=this.element[r||n?"val":"text"],this.isNewMenu=!0,this.element.addClass("ui-autocomplete-input").attr("autocomplete","off"),this._on(this.element,{keydown:function(s){if(this.element.prop("readOnly"))return t=!0,a=!0,i=!0,undefined;t=!1,a=!1,i=!1;var r=e.ui.keyCode;switch(s.keyCode){case r.PAGE_UP:t=!0,this._move("previousPage",s);break;case r.PAGE_DOWN:t=!0,this._move("nextPage",s);break;case r.UP:t=!0,this._keyEvent("previous",s);break;case r.DOWN:t=!0,this._keyEvent("next",s);break;case r.ENTER:case r.NUMPAD_ENTER:this.menu.active&&(t=!0,s.preventDefault(),this.menu.select(s));break;case r.TAB:this.menu.active&&this.menu.select(s);break;case r.ESCAPE:this.menu.element.is(":visible")&&(this._value(this.term),this.close(s),s.preventDefault());break;default:i=!0,this._searchTimeout(s)}},keypress:function(a){if(t)return t=!1,(!this.isMultiLine||this.menu.element.is(":visible"))&&a.preventDefault(),undefined;if(!i){var s=e.ui.keyCode;switch(a.keyCode){case s.PAGE_UP:this._move("previousPage",a);break;case s.PAGE_DOWN:this._move("nextPage",a);break;case s.UP:this._keyEvent("previous",a);break;case s.DOWN:this._keyEvent("next",a)}}},input:function(e){return a?(a=!1,e.preventDefault(),undefined):(this._searchTimeout(e),undefined)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(e){return this.cancelBlur?(delete this.cancelBlur,undefined):(clearTimeout(this.searching),this.close(e),this._change(e),undefined)}}),this._initSource(),this.menu=e("<ul>").addClass("ui-autocomplete ui-front").appendTo(this._appendTo()).menu({role:null}).hide().data("ui-menu"),this._on(this.menu.element,{mousedown:function(t){t.preventDefault(),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur});var i=this.menu.element[0];e(t.target).closest(".ui-menu-item").length||this._delay(function(){var t=this;this.document.one("mousedown",function(a){a.target===t.element[0]||a.target===i||e.contains(i,a.target)||t.close()})})},menufocus:function(t,i){if(this.isNewMenu&&(this.isNewMenu=!1,t.originalEvent&&/^mouse/.test(t.originalEvent.type)))return this.menu.blur(),this.document.one("mousemove",function(){e(t.target).trigger(t.originalEvent)}),undefined;var a=i.item.data("ui-autocomplete-item");!1!==this._trigger("focus",t,{item:a})?t.originalEvent&&/^key/.test(t.originalEvent.type)&&this._value(a.value):this.liveRegion.text(a.value)},menuselect:function(e,t){var i=t.item.data("ui-autocomplete-item"),a=this.previous;this.element[0]!==this.document[0].activeElement&&(this.element.focus(),this.previous=a,this._delay(function(){this.previous=a,this.selectedItem=i})),!1!==this._trigger("select",e,{item:i})&&this._value(i.value),this.term=this._value(),this.close(e),this.selectedItem=i}}),this.liveRegion=e("<span>",{role:"status","aria-live":"polite"}).addClass("ui-helper-hidden-accessible").insertBefore(this.element),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(e,t){this._super(e,t),"source"===e&&this._initSource(),"appendTo"===e&&this.menu.element.appendTo(this._appendTo()),"disabled"===e&&t&&this.xhr&&this.xhr.abort()},_appendTo:function(){var t=this.options.appendTo;return t&&(t=t.jquery||t.nodeType?e(t):this.document.find(t).eq(0)),t||(t=this.element.closest(".ui-front")),t.length||(t=this.document[0].body),t},_initSource:function(){var t,i,a=this;e.isArray(this.options.source)?(t=this.options.source,this.source=function(i,a){a(e.ui.autocomplete.filter(t,i.term))}):"string"==typeof this.options.source?(i=this.options.source,this.source=function(t,s){a.xhr&&a.xhr.abort(),a.xhr=e.ajax({url:i,data:t,dataType:"json",success:function(e){s(e)},error:function(){s([])}})}):this.source=this.options.source},_searchTimeout:function(e){clearTimeout(this.searching),this.searching=this._delay(function(){this.term!==this._value()&&(this.selectedItem=null,this.search(null,e))},this.options.delay)},search:function(e,t){return e=null!=e?e:this._value(),this.term=this._value(),e.length<this.options.minLength?this.close(t):this._trigger("search",t)!==!1?this._search(e):undefined},_search:function(e){this.pending++,this.element.addClass("ui-autocomplete-loading"),this.cancelSearch=!1,this.source({term:e},this._response())},_response:function(){var e=this,i=++t;return function(a){i===t&&e.__response(a),e.pending--,e.pending||e.element.removeClass("ui-autocomplete-loading")}},__response:function(e){e&&(e=this._normalize(e)),this._trigger("response",null,{content:e}),!this.options.disabled&&e&&e.length&&!this.cancelSearch?(this._suggest(e),this._trigger("open")):this._close()},close:function(e){this.cancelSearch=!0,this._close(e)},_close:function(e){this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),this.isNewMenu=!0,this._trigger("close",e))},_change:function(e){this.previous!==this._value()&&this._trigger("change",e,{item:this.selectedItem})},_normalize:function(t){return t.length&&t[0].label&&t[0].value?t:e.map(t,function(t){return"string"==typeof t?{label:t,value:t}:e.extend({label:t.label||t.value,value:t.value||t.label},t)})},_suggest:function(t){var i=this.menu.element.empty();this._renderMenu(i,t),this.isNewMenu=!0,this.menu.refresh(),i.show(),this._resizeMenu(),i.position(e.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next()},_resizeMenu:function(){var e=this.menu.element;e.outerWidth(Math.max(e.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(t,i){var a=this;e.each(i,function(e,i){a._renderItemData(t,i)})},_renderItemData:function(e,t){return this._renderItem(e,t).data("ui-autocomplete-item",t)},_renderItem:function(t,i){return e("<li>").append(e("<a>").text(i.label)).appendTo(t)},_move:function(e,t){return this.menu.element.is(":visible")?this.menu.isFirstItem()&&/^previous/.test(e)||this.menu.isLastItem()&&/^next/.test(e)?(this._value(this.term),this.menu.blur(),undefined):(this.menu[e](t),undefined):(this.search(null,t),undefined)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(e,t){(!this.isMultiLine||this.menu.element.is(":visible"))&&(this._move(e,t),t.preventDefault())}}),e.extend(e.ui.autocomplete,{escapeRegex:function(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(t,i){var a=RegExp(e.ui.autocomplete.escapeRegex(i),"i");return e.grep(t,function(e){return a.test(e.label||e.value||e)})}}),e.widget("ui.autocomplete",e.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(e){return e+(e>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(e){var t;this._superApply(arguments),this.options.disabled||this.cancelSearch||(t=e&&e.length?this.options.messages.results(e.length):this.options.messages.noResults,this.liveRegion.text(t))}})})(jQuery);(function(e){var t,a,r,i,n="ui-button ui-widget ui-state-default ui-corner-all",s="ui-state-hover ui-state-active ",o="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",d=function(){var t=e(this);setTimeout(function(){t.find(":ui-button").button("refresh")},1)},u=function(t){var a=t.name,r=t.form,i=e([]);return a&&(a=a.replace(/'/g,"\\'"),i=r?e(r).find("[name='"+a+"']"):e("[name='"+a+"']",t.ownerDocument).filter(function(){return!this.form})),i};e.widget("ui.button",{version:"1.10.3",defaultElement:"<button>",options:{disabled:null,text:!0,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset"+this.eventNamespace).bind("reset"+this.eventNamespace,d),"boolean"!=typeof this.options.disabled?this.options.disabled=!!this.element.prop("disabled"):this.element.prop("disabled",this.options.disabled),this._determineButtonType(),this.hasTitle=!!this.buttonElement.attr("title");var s=this,o=this.options,m="checkbox"===this.type||"radio"===this.type,c=m?"":"ui-state-active",l="ui-state-focus";null===o.label&&(o.label="input"===this.type?this.buttonElement.val():this.buttonElement.html()),this._hoverable(this.buttonElement),this.buttonElement.addClass(n).attr("role","button").bind("mouseenter"+this.eventNamespace,function(){o.disabled||this===t&&e(this).addClass("ui-state-active")}).bind("mouseleave"+this.eventNamespace,function(){o.disabled||e(this).removeClass(c)}).bind("click"+this.eventNamespace,function(e){o.disabled&&(e.preventDefault(),e.stopImmediatePropagation())}),this.element.bind("focus"+this.eventNamespace,function(){s.buttonElement.addClass(l)}).bind("blur"+this.eventNamespace,function(){s.buttonElement.removeClass(l)}),m&&(this.element.bind("change"+this.eventNamespace,function(){i||s.refresh()}),this.buttonElement.bind("mousedown"+this.eventNamespace,function(e){o.disabled||(i=!1,a=e.pageX,r=e.pageY)}).bind("mouseup"+this.eventNamespace,function(e){o.disabled||(a!==e.pageX||r!==e.pageY)&&(i=!0)})),"checkbox"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){return o.disabled||i?!1:undefined}):"radio"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){if(o.disabled||i)return!1;e(this).addClass("ui-state-active"),s.buttonElement.attr("aria-pressed","true");var t=s.element[0];u(t).not(t).map(function(){return e(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed","false")}):(this.buttonElement.bind("mousedown"+this.eventNamespace,function(){return o.disabled?!1:(e(this).addClass("ui-state-active"),t=this,s.document.one("mouseup",function(){t=null}),undefined)}).bind("mouseup"+this.eventNamespace,function(){return o.disabled?!1:(e(this).removeClass("ui-state-active"),undefined)}).bind("keydown"+this.eventNamespace,function(t){return o.disabled?!1:((t.keyCode===e.ui.keyCode.SPACE||t.keyCode===e.ui.keyCode.ENTER)&&e(this).addClass("ui-state-active"),undefined)}).bind("keyup"+this.eventNamespace+" blur"+this.eventNamespace,function(){e(this).removeClass("ui-state-active")}),this.buttonElement.is("a")&&this.buttonElement.keyup(function(t){t.keyCode===e.ui.keyCode.SPACE&&e(this).click()})),this._setOption("disabled",o.disabled),this._resetButton()},_determineButtonType:function(){var e,t,a;this.type=this.element.is("[type=checkbox]")?"checkbox":this.element.is("[type=radio]")?"radio":this.element.is("input")?"input":"button","checkbox"===this.type||"radio"===this.type?(e=this.element.parents().last(),t="label[for='"+this.element.attr("id")+"']",this.buttonElement=e.find(t),this.buttonElement.length||(e=e.length?e.siblings():this.element.siblings(),this.buttonElement=e.filter(t),this.buttonElement.length||(this.buttonElement=e.find(t))),this.element.addClass("ui-helper-hidden-accessible"),a=this.element.is(":checked"),a&&this.buttonElement.addClass("ui-state-active"),this.buttonElement.prop("aria-pressed",a)):this.buttonElement=this.element},widget:function(){return this.buttonElement},_destroy:function(){this.element.removeClass("ui-helper-hidden-accessible"),this.buttonElement.removeClass(n+" "+s+" "+o).removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html()),this.hasTitle||this.buttonElement.removeAttr("title")},_setOption:function(e,t){return this._super(e,t),"disabled"===e?(t?this.element.prop("disabled",!0):this.element.prop("disabled",!1),undefined):(this._resetButton(),undefined)},refresh:function(){var t=this.element.is("input, button")?this.element.is(":disabled"):this.element.hasClass("ui-button-disabled");t!==this.options.disabled&&this._setOption("disabled",t),"radio"===this.type?u(this.element[0]).each(function(){e(this).is(":checked")?e(this).button("widget").addClass("ui-state-active").attr("aria-pressed","true"):e(this).button("widget").removeClass("ui-state-active").attr("aria-pressed","false")}):"checkbox"===this.type&&(this.element.is(":checked")?this.buttonElement.addClass("ui-state-active").attr("aria-pressed","true"):this.buttonElement.removeClass("ui-state-active").attr("aria-pressed","false"))},_resetButton:function(){if("input"===this.type)return this.options.label&&this.element.val(this.options.label),undefined;var t=this.buttonElement.removeClass(o),a=e("<span></span>",this.document[0]).addClass("ui-button-text").html(this.options.label).appendTo(t.empty()).text(),r=this.options.icons,i=r.primary&&r.secondary,n=[];r.primary||r.secondary?(this.options.text&&n.push("ui-button-text-icon"+(i?"s":r.primary?"-primary":"-secondary")),r.primary&&t.prepend("<span class='ui-button-icon-primary ui-icon "+r.primary+"'></span>"),r.secondary&&t.append("<span class='ui-button-icon-secondary ui-icon "+r.secondary+"'></span>"),this.options.text||(n.push(i?"ui-button-icons-only":"ui-button-icon-only"),this.hasTitle||t.attr("title",e.trim(a)))):n.push("ui-button-text-only"),t.addClass(n.join(" "))}}),e.widget("ui.buttonset",{version:"1.10.3",options:{items:"button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(e,t){"disabled"===e&&this.buttons.button("option",e,t),this._super(e,t)},refresh:function(){var t="rtl"===this.element.css("direction");this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return e(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(t?"ui-corner-right":"ui-corner-left").end().filter(":last").addClass(t?"ui-corner-left":"ui-corner-right").end().end()},_destroy:function(){this.element.removeClass("ui-buttonset"),this.buttons.map(function(){return e(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy")}})})(jQuery);(function(e,t){function a(){this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},e.extend(this._defaults,this.regional[""]),this.dpDiv=i(e("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}function i(t){var a="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return t.delegate(a,"mouseout",function(){e(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&e(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&e(this).removeClass("ui-datepicker-next-hover")}).delegate(a,"mouseover",function(){e.datepicker._isDisabledDatepicker(n.inline?t.parent()[0]:n.input[0])||(e(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),e(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&e(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&e(this).addClass("ui-datepicker-next-hover"))})}function s(t,a){e.extend(t,a);for(var i in a)null==a[i]&&(t[i]=a[i]);return t}e.extend(e.ui,{datepicker:{version:"1.10.3"}});var n,r="datepicker";e.extend(a.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(e){return s(this._defaults,e||{}),this},_attachDatepicker:function(t,a){var i,s,n;i=t.nodeName.toLowerCase(),s="div"===i||"span"===i,t.id||(this.uuid+=1,t.id="dp"+this.uuid),n=this._newInst(e(t),s),n.settings=e.extend({},a||{}),"input"===i?this._connectDatepicker(t,n):s&&this._inlineDatepicker(t,n)},_newInst:function(t,a){var s=t[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1");return{id:s,input:t,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:a,dpDiv:a?i(e("<div class='"+this._inlineClass+" ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")):this.dpDiv}},_connectDatepicker:function(t,a){var i=e(t);a.append=e([]),a.trigger=e([]),i.hasClass(this.markerClassName)||(this._attachments(i,a),i.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp),this._autoSize(a),e.data(t,r,a),a.settings.disabled&&this._disableDatepicker(t))},_attachments:function(t,a){var i,s,n,r=this._get(a,"appendText"),o=this._get(a,"isRTL");a.append&&a.append.remove(),r&&(a.append=e("<span class='"+this._appendClass+"'>"+r+"</span>"),t[o?"before":"after"](a.append)),t.unbind("focus",this._showDatepicker),a.trigger&&a.trigger.remove(),i=this._get(a,"showOn"),("focus"===i||"both"===i)&&t.focus(this._showDatepicker),("button"===i||"both"===i)&&(s=this._get(a,"buttonText"),n=this._get(a,"buttonImage"),a.trigger=e(this._get(a,"buttonImageOnly")?e("<img/>").addClass(this._triggerClass).attr({src:n,alt:s,title:s}):e("<button type='button'></button>").addClass(this._triggerClass).html(n?e("<img/>").attr({src:n,alt:s,title:s}):s)),t[o?"before":"after"](a.trigger),a.trigger.click(function(){return e.datepicker._datepickerShowing&&e.datepicker._lastInput===t[0]?e.datepicker._hideDatepicker():e.datepicker._datepickerShowing&&e.datepicker._lastInput!==t[0]?(e.datepicker._hideDatepicker(),e.datepicker._showDatepicker(t[0])):e.datepicker._showDatepicker(t[0]),!1}))},_autoSize:function(e){if(this._get(e,"autoSize")&&!e.inline){var t,a,i,s,n=new Date(2009,11,20),r=this._get(e,"dateFormat");r.match(/[DM]/)&&(t=function(e){for(a=0,i=0,s=0;e.length>s;s++)e[s].length>a&&(a=e[s].length,i=s);return i},n.setMonth(t(this._get(e,r.match(/MM/)?"monthNames":"monthNamesShort"))),n.setDate(t(this._get(e,r.match(/DD/)?"dayNames":"dayNamesShort"))+20-n.getDay())),e.input.attr("size",this._formatDate(e,n).length)}},_inlineDatepicker:function(t,a){var i=e(t);i.hasClass(this.markerClassName)||(i.addClass(this.markerClassName).append(a.dpDiv),e.data(t,r,a),this._setDate(a,this._getDefaultDate(a),!0),this._updateDatepicker(a),this._updateAlternate(a),a.settings.disabled&&this._disableDatepicker(t),a.dpDiv.css("display","block"))},_dialogDatepicker:function(t,a,i,n,o){var c,d,l,u,h,p=this._dialogInst;return p||(this.uuid+=1,c="dp"+this.uuid,this._dialogInput=e("<input type='text' id='"+c+"' style='position: absolute; top: -100px; width: 0px;'/>"),this._dialogInput.keydown(this._doKeyDown),e("body").append(this._dialogInput),p=this._dialogInst=this._newInst(this._dialogInput,!1),p.settings={},e.data(this._dialogInput[0],r,p)),s(p.settings,n||{}),a=a&&a.constructor===Date?this._formatDate(p,a):a,this._dialogInput.val(a),this._pos=o?o.length?o:[o.pageX,o.pageY]:null,this._pos||(d=document.documentElement.clientWidth,l=document.documentElement.clientHeight,u=document.documentElement.scrollLeft||document.body.scrollLeft,h=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[d/2-100+u,l/2-150+h]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),p.settings.onSelect=i,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),e.blockUI&&e.blockUI(this.dpDiv),e.data(this._dialogInput[0],r,p),this},_destroyDatepicker:function(t){var a,i=e(t),s=e.data(t,r);i.hasClass(this.markerClassName)&&(a=t.nodeName.toLowerCase(),e.removeData(t,r),"input"===a?(s.append.remove(),s.trigger.remove(),i.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):("div"===a||"span"===a)&&i.removeClass(this.markerClassName).empty())},_enableDatepicker:function(t){var a,i,s=e(t),n=e.data(t,r);s.hasClass(this.markerClassName)&&(a=t.nodeName.toLowerCase(),"input"===a?(t.disabled=!1,n.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):("div"===a||"span"===a)&&(i=s.children("."+this._inlineClass),i.children().removeClass("ui-state-disabled"),i.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=e.map(this._disabledInputs,function(e){return e===t?null:e}))},_disableDatepicker:function(t){var a,i,s=e(t),n=e.data(t,r);s.hasClass(this.markerClassName)&&(a=t.nodeName.toLowerCase(),"input"===a?(t.disabled=!0,n.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):("div"===a||"span"===a)&&(i=s.children("."+this._inlineClass),i.children().addClass("ui-state-disabled"),i.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=e.map(this._disabledInputs,function(e){return e===t?null:e}),this._disabledInputs[this._disabledInputs.length]=t)},_isDisabledDatepicker:function(e){if(!e)return!1;for(var t=0;this._disabledInputs.length>t;t++)if(this._disabledInputs[t]===e)return!0;return!1},_getInst:function(t){try{return e.data(t,r)}catch(a){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(a,i,n){var r,o,c,d,l=this._getInst(a);return 2===arguments.length&&"string"==typeof i?"defaults"===i?e.extend({},e.datepicker._defaults):l?"all"===i?e.extend({},l.settings):this._get(l,i):null:(r=i||{},"string"==typeof i&&(r={},r[i]=n),l&&(this._curInst===l&&this._hideDatepicker(),o=this._getDateDatepicker(a,!0),c=this._getMinMaxDate(l,"min"),d=this._getMinMaxDate(l,"max"),s(l.settings,r),null!==c&&r.dateFormat!==t&&r.minDate===t&&(l.settings.minDate=this._formatDate(l,c)),null!==d&&r.dateFormat!==t&&r.maxDate===t&&(l.settings.maxDate=this._formatDate(l,d)),"disabled"in r&&(r.disabled?this._disableDatepicker(a):this._enableDatepicker(a)),this._attachments(e(a),l),this._autoSize(l),this._setDate(l,o),this._updateAlternate(l),this._updateDatepicker(l)),t)},_changeDatepicker:function(e,t,a){this._optionDatepicker(e,t,a)},_refreshDatepicker:function(e){var t=this._getInst(e);t&&this._updateDatepicker(t)},_setDateDatepicker:function(e,t){var a=this._getInst(e);a&&(this._setDate(a,t),this._updateDatepicker(a),this._updateAlternate(a))},_getDateDatepicker:function(e,t){var a=this._getInst(e);return a&&!a.inline&&this._setDateFromField(a,t),a?this._getDate(a):null},_doKeyDown:function(t){var a,i,s,n=e.datepicker._getInst(t.target),r=!0,o=n.dpDiv.is(".ui-datepicker-rtl");if(n._keyEvent=!0,e.datepicker._datepickerShowing)switch(t.keyCode){case 9:e.datepicker._hideDatepicker(),r=!1;break;case 13:return s=e("td."+e.datepicker._dayOverClass+":not(."+e.datepicker._currentClass+")",n.dpDiv),s[0]&&e.datepicker._selectDay(t.target,n.selectedMonth,n.selectedYear,s[0]),a=e.datepicker._get(n,"onSelect"),a?(i=e.datepicker._formatDate(n),a.apply(n.input?n.input[0]:null,[i,n])):e.datepicker._hideDatepicker(),!1;case 27:e.datepicker._hideDatepicker();break;case 33:e.datepicker._adjustDate(t.target,t.ctrlKey?-e.datepicker._get(n,"stepBigMonths"):-e.datepicker._get(n,"stepMonths"),"M");break;case 34:e.datepicker._adjustDate(t.target,t.ctrlKey?+e.datepicker._get(n,"stepBigMonths"):+e.datepicker._get(n,"stepMonths"),"M");break;case 35:(t.ctrlKey||t.metaKey)&&e.datepicker._clearDate(t.target),r=t.ctrlKey||t.metaKey;break;case 36:(t.ctrlKey||t.metaKey)&&e.datepicker._gotoToday(t.target),r=t.ctrlKey||t.metaKey;break;case 37:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,o?1:-1,"D"),r=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&e.datepicker._adjustDate(t.target,t.ctrlKey?-e.datepicker._get(n,"stepBigMonths"):-e.datepicker._get(n,"stepMonths"),"M");break;case 38:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,-7,"D"),r=t.ctrlKey||t.metaKey;break;case 39:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,o?-1:1,"D"),r=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&e.datepicker._adjustDate(t.target,t.ctrlKey?+e.datepicker._get(n,"stepBigMonths"):+e.datepicker._get(n,"stepMonths"),"M");break;case 40:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,7,"D"),r=t.ctrlKey||t.metaKey;break;default:r=!1}else 36===t.keyCode&&t.ctrlKey?e.datepicker._showDatepicker(this):r=!1;r&&(t.preventDefault(),t.stopPropagation())},_doKeyPress:function(a){var i,s,n=e.datepicker._getInst(a.target);return e.datepicker._get(n,"constrainInput")?(i=e.datepicker._possibleChars(e.datepicker._get(n,"dateFormat")),s=String.fromCharCode(null==a.charCode?a.keyCode:a.charCode),a.ctrlKey||a.metaKey||" ">s||!i||i.indexOf(s)>-1):t},_doKeyUp:function(t){var a,i=e.datepicker._getInst(t.target);if(i.input.val()!==i.lastVal)try{a=e.datepicker.parseDate(e.datepicker._get(i,"dateFormat"),i.input?i.input.val():null,e.datepicker._getFormatConfig(i)),a&&(e.datepicker._setDateFromField(i),e.datepicker._updateAlternate(i),e.datepicker._updateDatepicker(i))}catch(s){}return!0},_showDatepicker:function(t){if(t=t.target||t,"input"!==t.nodeName.toLowerCase()&&(t=e("input",t.parentNode)[0]),!e.datepicker._isDisabledDatepicker(t)&&e.datepicker._lastInput!==t){var a,i,n,r,o,c,d;a=e.datepicker._getInst(t),e.datepicker._curInst&&e.datepicker._curInst!==a&&(e.datepicker._curInst.dpDiv.stop(!0,!0),a&&e.datepicker._datepickerShowing&&e.datepicker._hideDatepicker(e.datepicker._curInst.input[0])),i=e.datepicker._get(a,"beforeShow"),n=i?i.apply(t,[t,a]):{},n!==!1&&(s(a.settings,n),a.lastVal=null,e.datepicker._lastInput=t,e.datepicker._setDateFromField(a),e.datepicker._inDialog&&(t.value=""),e.datepicker._pos||(e.datepicker._pos=e.datepicker._findPos(t),e.datepicker._pos[1]+=t.offsetHeight),r=!1,e(t).parents().each(function(){return r|="fixed"===e(this).css("position"),!r}),o={left:e.datepicker._pos[0],top:e.datepicker._pos[1]},e.datepicker._pos=null,a.dpDiv.empty(),a.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),e.datepicker._updateDatepicker(a),o=e.datepicker._checkOffset(a,o,r),a.dpDiv.css({position:e.datepicker._inDialog&&e.blockUI?"static":r?"fixed":"absolute",display:"none",left:o.left+"px",top:o.top+"px"}),a.inline||(c=e.datepicker._get(a,"showAnim"),d=e.datepicker._get(a,"duration"),a.dpDiv.zIndex(e(t).zIndex()+1),e.datepicker._datepickerShowing=!0,e.effects&&e.effects.effect[c]?a.dpDiv.show(c,e.datepicker._get(a,"showOptions"),d):a.dpDiv[c||"show"](c?d:null),e.datepicker._shouldFocusInput(a)&&a.input.focus(),e.datepicker._curInst=a))}},_updateDatepicker:function(t){this.maxRows=4,n=t,t.dpDiv.empty().append(this._generateHTML(t)),this._attachHandlers(t),t.dpDiv.find("."+this._dayOverClass+" a").mouseover();var a,i=this._getNumberOfMonths(t),s=i[1],r=17;t.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),s>1&&t.dpDiv.addClass("ui-datepicker-multi-"+s).css("width",r*s+"em"),t.dpDiv[(1!==i[0]||1!==i[1]?"add":"remove")+"Class"]("ui-datepicker-multi"),t.dpDiv[(this._get(t,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),t===e.datepicker._curInst&&e.datepicker._datepickerShowing&&e.datepicker._shouldFocusInput(t)&&t.input.focus(),t.yearshtml&&(a=t.yearshtml,setTimeout(function(){a===t.yearshtml&&t.yearshtml&&t.dpDiv.find("select.ui-datepicker-year:first").replaceWith(t.yearshtml),a=t.yearshtml=null},0))},_shouldFocusInput:function(e){return e.input&&e.input.is(":visible")&&!e.input.is(":disabled")&&!e.input.is(":focus")},_checkOffset:function(t,a,i){var s=t.dpDiv.outerWidth(),n=t.dpDiv.outerHeight(),r=t.input?t.input.outerWidth():0,o=t.input?t.input.outerHeight():0,c=document.documentElement.clientWidth+(i?0:e(document).scrollLeft()),d=document.documentElement.clientHeight+(i?0:e(document).scrollTop());return a.left-=this._get(t,"isRTL")?s-r:0,a.left-=i&&a.left===t.input.offset().left?e(document).scrollLeft():0,a.top-=i&&a.top===t.input.offset().top+o?e(document).scrollTop():0,a.left-=Math.min(a.left,a.left+s>c&&c>s?Math.abs(a.left+s-c):0),a.top-=Math.min(a.top,a.top+n>d&&d>n?Math.abs(n+o):0),a},_findPos:function(t){for(var a,i=this._getInst(t),s=this._get(i,"isRTL");t&&("hidden"===t.type||1!==t.nodeType||e.expr.filters.hidden(t));)t=t[s?"previousSibling":"nextSibling"];return a=e(t).offset(),[a.left,a.top]},_hideDatepicker:function(t){var a,i,s,n,o=this._curInst;!o||t&&o!==e.data(t,r)||this._datepickerShowing&&(a=this._get(o,"showAnim"),i=this._get(o,"duration"),s=function(){e.datepicker._tidyDialog(o)},e.effects&&(e.effects.effect[a]||e.effects[a])?o.dpDiv.hide(a,e.datepicker._get(o,"showOptions"),i,s):o.dpDiv["slideDown"===a?"slideUp":"fadeIn"===a?"fadeOut":"hide"](a?i:null,s),a||s(),this._datepickerShowing=!1,n=this._get(o,"onClose"),n&&n.apply(o.input?o.input[0]:null,[o.input?o.input.val():"",o]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),e.blockUI&&(e.unblockUI(),e("body").append(this.dpDiv))),this._inDialog=!1)},_tidyDialog:function(e){e.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(t){if(e.datepicker._curInst){var a=e(t.target),i=e.datepicker._getInst(a[0]);(a[0].id!==e.datepicker._mainDivId&&0===a.parents("#"+e.datepicker._mainDivId).length&&!a.hasClass(e.datepicker.markerClassName)&&!a.closest("."+e.datepicker._triggerClass).length&&e.datepicker._datepickerShowing&&(!e.datepicker._inDialog||!e.blockUI)||a.hasClass(e.datepicker.markerClassName)&&e.datepicker._curInst!==i)&&e.datepicker._hideDatepicker()}},_adjustDate:function(t,a,i){var s=e(t),n=this._getInst(s[0]);this._isDisabledDatepicker(s[0])||(this._adjustInstDate(n,a+("M"===i?this._get(n,"showCurrentAtPos"):0),i),this._updateDatepicker(n))},_gotoToday:function(t){var a,i=e(t),s=this._getInst(i[0]);this._get(s,"gotoCurrent")&&s.currentDay?(s.selectedDay=s.currentDay,s.drawMonth=s.selectedMonth=s.currentMonth,s.drawYear=s.selectedYear=s.currentYear):(a=new Date,s.selectedDay=a.getDate(),s.drawMonth=s.selectedMonth=a.getMonth(),s.drawYear=s.selectedYear=a.getFullYear()),this._notifyChange(s),this._adjustDate(i)},_selectMonthYear:function(t,a,i){var s=e(t),n=this._getInst(s[0]);n["selected"+("M"===i?"Month":"Year")]=n["draw"+("M"===i?"Month":"Year")]=parseInt(a.options[a.selectedIndex].value,10),this._notifyChange(n),this._adjustDate(s)},_selectDay:function(t,a,i,s){var n,r=e(t);e(s).hasClass(this._unselectableClass)||this._isDisabledDatepicker(r[0])||(n=this._getInst(r[0]),n.selectedDay=n.currentDay=e("a",s).html(),n.selectedMonth=n.currentMonth=a,n.selectedYear=n.currentYear=i,this._selectDate(t,this._formatDate(n,n.currentDay,n.currentMonth,n.currentYear)))},_clearDate:function(t){var a=e(t);this._selectDate(a,"")},_selectDate:function(t,a){var i,s=e(t),n=this._getInst(s[0]);a=null!=a?a:this._formatDate(n),n.input&&n.input.val(a),this._updateAlternate(n),i=this._get(n,"onSelect"),i?i.apply(n.input?n.input[0]:null,[a,n]):n.input&&n.input.trigger("change"),n.inline?this._updateDatepicker(n):(this._hideDatepicker(),this._lastInput=n.input[0],"object"!=typeof n.input[0]&&n.input.focus(),this._lastInput=null)},_updateAlternate:function(t){var a,i,s,n=this._get(t,"altField");n&&(a=this._get(t,"altFormat")||this._get(t,"dateFormat"),i=this._getDate(t),s=this.formatDate(a,i,this._getFormatConfig(t)),e(n).each(function(){e(this).val(s)}))},noWeekends:function(e){var t=e.getDay();return[t>0&&6>t,""]},iso8601Week:function(e){var t,a=new Date(e.getTime());return a.setDate(a.getDate()+4-(a.getDay()||7)),t=a.getTime(),a.setMonth(0),a.setDate(1),Math.floor(Math.round((t-a)/864e5)/7)+1},parseDate:function(a,i,s){if(null==a||null==i)throw"Invalid arguments";if(i="object"==typeof i?""+i:i+"",""===i)return null;var n,r,o,c,d=0,l=(s?s.shortYearCutoff:null)||this._defaults.shortYearCutoff,u="string"!=typeof l?l:(new Date).getFullYear()%100+parseInt(l,10),h=(s?s.dayNamesShort:null)||this._defaults.dayNamesShort,p=(s?s.dayNames:null)||this._defaults.dayNames,g=(s?s.monthNamesShort:null)||this._defaults.monthNamesShort,_=(s?s.monthNames:null)||this._defaults.monthNames,f=-1,m=-1,D=-1,k=-1,y=!1,v=function(e){var t=a.length>n+1&&a.charAt(n+1)===e;return t&&n++,t},M=function(e){var t=v(e),a="@"===e?14:"!"===e?20:"y"===e&&t?4:"o"===e?3:2,s=RegExp("^\\d{1,"+a+"}"),n=i.substring(d).match(s);if(!n)throw"Missing number at position "+d;return d+=n[0].length,parseInt(n[0],10)},b=function(a,s,n){var r=-1,o=e.map(v(a)?n:s,function(e,t){return[[t,e]]}).sort(function(e,t){return-(e[1].length-t[1].length)});if(e.each(o,function(e,a){var s=a[1];return i.substr(d,s.length).toLowerCase()===s.toLowerCase()?(r=a[0],d+=s.length,!1):t}),-1!==r)return r+1;throw"Unknown name at position "+d},w=function(){if(i.charAt(d)!==a.charAt(n))throw"Unexpected literal at position "+d;d++};for(n=0;a.length>n;n++)if(y)"'"!==a.charAt(n)||v("'")?w():y=!1;else switch(a.charAt(n)){case"d":D=M("d");break;case"D":b("D",h,p);break;case"o":k=M("o");break;case"m":m=M("m");break;case"M":m=b("M",g,_);break;case"y":f=M("y");break;case"@":c=new Date(M("@")),f=c.getFullYear(),m=c.getMonth()+1,D=c.getDate();break;case"!":c=new Date((M("!")-this._ticksTo1970)/1e4),f=c.getFullYear(),m=c.getMonth()+1,D=c.getDate();break;case"'":v("'")?w():y=!0;break;default:w()}if(i.length>d&&(o=i.substr(d),!/^\s+/.test(o)))throw"Extra/unparsed characters found in date: "+o;if(-1===f?f=(new Date).getFullYear():100>f&&(f+=(new Date).getFullYear()-(new Date).getFullYear()%100+(u>=f?0:-100)),k>-1)for(m=1,D=k;;){if(r=this._getDaysInMonth(f,m-1),r>=D)break;m++,D-=r}if(c=this._daylightSavingAdjust(new Date(f,m-1,D)),c.getFullYear()!==f||c.getMonth()+1!==m||c.getDate()!==D)throw"Invalid date";return c},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:1e7*60*60*24*(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925)),formatDate:function(e,t,a){if(!t)return"";var i,s=(a?a.dayNamesShort:null)||this._defaults.dayNamesShort,n=(a?a.dayNames:null)||this._defaults.dayNames,r=(a?a.monthNamesShort:null)||this._defaults.monthNamesShort,o=(a?a.monthNames:null)||this._defaults.monthNames,c=function(t){var a=e.length>i+1&&e.charAt(i+1)===t;return a&&i++,a},d=function(e,t,a){var i=""+t;if(c(e))for(;a>i.length;)i="0"+i;return i},l=function(e,t,a,i){return c(e)?i[t]:a[t]},u="",h=!1;if(t)for(i=0;e.length>i;i++)if(h)"'"!==e.charAt(i)||c("'")?u+=e.charAt(i):h=!1;else switch(e.charAt(i)){case"d":u+=d("d",t.getDate(),2);break;case"D":u+=l("D",t.getDay(),s,n);break;case"o":u+=d("o",Math.round((new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()-new Date(t.getFullYear(),0,0).getTime())/864e5),3);break;case"m":u+=d("m",t.getMonth()+1,2);break;case"M":u+=l("M",t.getMonth(),r,o);break;case"y":u+=c("y")?t.getFullYear():(10>t.getYear()%100?"0":"")+t.getYear()%100;break;case"@":u+=t.getTime();break;case"!":u+=1e4*t.getTime()+this._ticksTo1970;break;case"'":c("'")?u+="'":h=!0;break;default:u+=e.charAt(i)}return u},_possibleChars:function(e){var t,a="",i=!1,s=function(a){var i=e.length>t+1&&e.charAt(t+1)===a;return i&&t++,i};for(t=0;e.length>t;t++)if(i)"'"!==e.charAt(t)||s("'")?a+=e.charAt(t):i=!1;else switch(e.charAt(t)){case"d":case"m":case"y":case"@":a+="0123456789";break;case"D":case"M":return null;case"'":s("'")?a+="'":i=!0;break;default:a+=e.charAt(t)}return a},_get:function(e,a){return e.settings[a]!==t?e.settings[a]:this._defaults[a]},_setDateFromField:function(e,t){if(e.input.val()!==e.lastVal){var a=this._get(e,"dateFormat"),i=e.lastVal=e.input?e.input.val():null,s=this._getDefaultDate(e),n=s,r=this._getFormatConfig(e);try{n=this.parseDate(a,i,r)||s}catch(o){i=t?"":i}e.selectedDay=n.getDate(),e.drawMonth=e.selectedMonth=n.getMonth(),e.drawYear=e.selectedYear=n.getFullYear(),e.currentDay=i?n.getDate():0,e.currentMonth=i?n.getMonth():0,e.currentYear=i?n.getFullYear():0,this._adjustInstDate(e)}},_getDefaultDate:function(e){return this._restrictMinMax(e,this._determineDate(e,this._get(e,"defaultDate"),new Date))},_determineDate:function(t,a,i){var s=function(e){var t=new Date;return t.setDate(t.getDate()+e),t},n=function(a){try{return e.datepicker.parseDate(e.datepicker._get(t,"dateFormat"),a,e.datepicker._getFormatConfig(t))}catch(i){}for(var s=(a.toLowerCase().match(/^c/)?e.datepicker._getDate(t):null)||new Date,n=s.getFullYear(),r=s.getMonth(),o=s.getDate(),c=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,d=c.exec(a);d;){switch(d[2]||"d"){case"d":case"D":o+=parseInt(d[1],10);break;case"w":case"W":o+=7*parseInt(d[1],10);break;case"m":case"M":r+=parseInt(d[1],10),o=Math.min(o,e.datepicker._getDaysInMonth(n,r));break;case"y":case"Y":n+=parseInt(d[1],10),o=Math.min(o,e.datepicker._getDaysInMonth(n,r))}d=c.exec(a)}return new Date(n,r,o)},r=null==a||""===a?i:"string"==typeof a?n(a):"number"==typeof a?isNaN(a)?i:s(a):new Date(a.getTime());return r=r&&"Invalid Date"==""+r?i:r,r&&(r.setHours(0),r.setMinutes(0),r.setSeconds(0),r.setMilliseconds(0)),this._daylightSavingAdjust(r)},_daylightSavingAdjust:function(e){return e?(e.setHours(e.getHours()>12?e.getHours()+2:0),e):null},_setDate:function(e,t,a){var i=!t,s=e.selectedMonth,n=e.selectedYear,r=this._restrictMinMax(e,this._determineDate(e,t,new Date));e.selectedDay=e.currentDay=r.getDate(),e.drawMonth=e.selectedMonth=e.currentMonth=r.getMonth(),e.drawYear=e.selectedYear=e.currentYear=r.getFullYear(),s===e.selectedMonth&&n===e.selectedYear||a||this._notifyChange(e),this._adjustInstDate(e),e.input&&e.input.val(i?"":this._formatDate(e))},_getDate:function(e){var t=!e.currentYear||e.input&&""===e.input.val()?null:this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return t},_attachHandlers:function(t){var a=this._get(t,"stepMonths"),i="#"+t.id.replace(/\\\\/g,"\\");t.dpDiv.find("[data-handler]").map(function(){var t={prev:function(){e.datepicker._adjustDate(i,-a,"M")},next:function(){e.datepicker._adjustDate(i,+a,"M")},hide:function(){e.datepicker._hideDatepicker()},today:function(){e.datepicker._gotoToday(i)},selectDay:function(){return e.datepicker._selectDay(i,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return e.datepicker._selectMonthYear(i,this,"M"),!1},selectYear:function(){return e.datepicker._selectMonthYear(i,this,"Y"),!1}};e(this).bind(this.getAttribute("data-event"),t[this.getAttribute("data-handler")])})},_generateHTML:function(e){var t,a,i,s,n,r,o,c,d,l,u,h,p,g,_,f,m,D,k,y,v,M,b,w,C,I,x,N,Y,S,A,T,F,j,K,O,E,P,L,R=new Date,W=this._daylightSavingAdjust(new Date(R.getFullYear(),R.getMonth(),R.getDate())),H=this._get(e,"isRTL"),U=this._get(e,"showButtonPanel"),z=this._get(e,"hideIfNoPrevNext"),B=this._get(e,"navigationAsDateFormat"),J=this._getNumberOfMonths(e),q=this._get(e,"showCurrentAtPos"),V=this._get(e,"stepMonths"),G=1!==J[0]||1!==J[1],Q=this._daylightSavingAdjust(e.currentDay?new Date(e.currentYear,e.currentMonth,e.currentDay):new Date(9999,9,9)),$=this._getMinMaxDate(e,"min"),X=this._getMinMaxDate(e,"max"),Z=e.drawMonth-q,et=e.drawYear;if(0>Z&&(Z+=12,et--),X)for(t=this._daylightSavingAdjust(new Date(X.getFullYear(),X.getMonth()-J[0]*J[1]+1,X.getDate())),t=$&&$>t?$:t;this._daylightSavingAdjust(new Date(et,Z,1))>t;)Z--,0>Z&&(Z=11,et--);for(e.drawMonth=Z,e.drawYear=et,a=this._get(e,"prevText"),a=B?this.formatDate(a,this._daylightSavingAdjust(new Date(et,Z-V,1)),this._getFormatConfig(e)):a,i=this._canAdjustMonth(e,-1,et,Z)?"<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click' title='"+a+"'><span class='ui-icon ui-icon-circle-triangle-"+(H?"e":"w")+"'>"+a+"</span></a>":z?"":"<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+a+"'><span class='ui-icon ui-icon-circle-triangle-"+(H?"e":"w")+"'>"+a+"</span></a>",s=this._get(e,"nextText"),s=B?this.formatDate(s,this._daylightSavingAdjust(new Date(et,Z+V,1)),this._getFormatConfig(e)):s,n=this._canAdjustMonth(e,1,et,Z)?"<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click' title='"+s+"'><span class='ui-icon ui-icon-circle-triangle-"+(H?"w":"e")+"'>"+s+"</span></a>":z?"":"<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+s+"'><span class='ui-icon ui-icon-circle-triangle-"+(H?"w":"e")+"'>"+s+"</span></a>",r=this._get(e,"currentText"),o=this._get(e,"gotoCurrent")&&e.currentDay?Q:W,r=B?this.formatDate(r,o,this._getFormatConfig(e)):r,c=e.inline?"":"<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>"+this._get(e,"closeText")+"</button>",d=U?"<div class='ui-datepicker-buttonpane ui-widget-content'>"+(H?c:"")+(this._isInRange(e,o)?"<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'>"+r+"</button>":"")+(H?"":c)+"</div>":"",l=parseInt(this._get(e,"firstDay"),10),l=isNaN(l)?0:l,u=this._get(e,"showWeek"),h=this._get(e,"dayNames"),p=this._get(e,"dayNamesMin"),g=this._get(e,"monthNames"),_=this._get(e,"monthNamesShort"),f=this._get(e,"beforeShowDay"),m=this._get(e,"showOtherMonths"),D=this._get(e,"selectOtherMonths"),k=this._getDefaultDate(e),y="",M=0;J[0]>M;M++){for(b="",this.maxRows=4,w=0;J[1]>w;w++){if(C=this._daylightSavingAdjust(new Date(et,Z,e.selectedDay)),I=" ui-corner-all",x="",G){if(x+="<div class='ui-datepicker-group",J[1]>1)switch(w){case 0:x+=" ui-datepicker-group-first",I=" ui-corner-"+(H?"right":"left");break;case J[1]-1:x+=" ui-datepicker-group-last",I=" ui-corner-"+(H?"left":"right");break;default:x+=" ui-datepicker-group-middle",I=""}x+="'>"}for(x+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+I+"'>"+(/all|left/.test(I)&&0===M?H?n:i:"")+(/all|right/.test(I)&&0===M?H?i:n:"")+this._generateMonthYearHeader(e,Z,et,$,X,M>0||w>0,g,_)+"</div><table class='ui-datepicker-calendar'><thead>"+"<tr>",N=u?"<th class='ui-datepicker-week-col'>"+this._get(e,"weekHeader")+"</th>":"",v=0;7>v;v++)Y=(v+l)%7,N+="<th"+((v+l+6)%7>=5?" class='ui-datepicker-week-end'":"")+">"+"<span title='"+h[Y]+"'>"+p[Y]+"</span></th>";for(x+=N+"</tr></thead><tbody>",S=this._getDaysInMonth(et,Z),et===e.selectedYear&&Z===e.selectedMonth&&(e.selectedDay=Math.min(e.selectedDay,S)),A=(this._getFirstDayOfMonth(et,Z)-l+7)%7,T=Math.ceil((A+S)/7),F=G?this.maxRows>T?this.maxRows:T:T,this.maxRows=F,j=this._daylightSavingAdjust(new Date(et,Z,1-A)),K=0;F>K;K++){for(x+="<tr>",O=u?"<td class='ui-datepicker-week-col'>"+this._get(e,"calculateWeek")(j)+"</td>":"",v=0;7>v;v++)E=f?f.apply(e.input?e.input[0]:null,[j]):[!0,""],P=j.getMonth()!==Z,L=P&&!D||!E[0]||$&&$>j||X&&j>X,O+="<td class='"+((v+l+6)%7>=5?" ui-datepicker-week-end":"")+(P?" ui-datepicker-other-month":"")+(j.getTime()===C.getTime()&&Z===e.selectedMonth&&e._keyEvent||k.getTime()===j.getTime()&&k.getTime()===C.getTime()?" "+this._dayOverClass:"")+(L?" "+this._unselectableClass+" ui-state-disabled":"")+(P&&!m?"":" "+E[1]+(j.getTime()===Q.getTime()?" "+this._currentClass:"")+(j.getTime()===W.getTime()?" ui-datepicker-today":""))+"'"+(P&&!m||!E[2]?"":" title='"+E[2].replace(/'/g,"&#39;")+"'")+(L?"":" data-handler='selectDay' data-event='click' data-month='"+j.getMonth()+"' data-year='"+j.getFullYear()+"'")+">"+(P&&!m?"&#xa0;":L?"<span class='ui-state-default'>"+j.getDate()+"</span>":"<a class='ui-state-default"+(j.getTime()===W.getTime()?" ui-state-highlight":"")+(j.getTime()===Q.getTime()?" ui-state-active":"")+(P?" ui-priority-secondary":"")+"' href='#'>"+j.getDate()+"</a>")+"</td>",j.setDate(j.getDate()+1),j=this._daylightSavingAdjust(j);x+=O+"</tr>"}Z++,Z>11&&(Z=0,et++),x+="</tbody></table>"+(G?"</div>"+(J[0]>0&&w===J[1]-1?"<div class='ui-datepicker-row-break'></div>":""):""),b+=x}y+=b}return y+=d,e._keyEvent=!1,y},_generateMonthYearHeader:function(e,t,a,i,s,n,r,o){var c,d,l,u,h,p,g,_,f=this._get(e,"changeMonth"),m=this._get(e,"changeYear"),D=this._get(e,"showMonthAfterYear"),k="<div class='ui-datepicker-title'>",y="";if(n||!f)y+="<span class='ui-datepicker-month'>"+r[t]+"</span>";else{for(c=i&&i.getFullYear()===a,d=s&&s.getFullYear()===a,y+="<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>",l=0;12>l;l++)(!c||l>=i.getMonth())&&(!d||s.getMonth()>=l)&&(y+="<option value='"+l+"'"+(l===t?" selected='selected'":"")+">"+o[l]+"</option>");y+="</select>"}if(D||(k+=y+(!n&&f&&m?"":"&#xa0;")),!e.yearshtml)if(e.yearshtml="",n||!m)k+="<span class='ui-datepicker-year'>"+a+"</span>";else{for(u=this._get(e,"yearRange").split(":"),h=(new Date).getFullYear(),p=function(e){var t=e.match(/c[+\-].*/)?a+parseInt(e.substring(1),10):e.match(/[+\-].*/)?h+parseInt(e,10):parseInt(e,10);
-return isNaN(t)?h:t},g=p(u[0]),_=Math.max(g,p(u[1]||"")),g=i?Math.max(g,i.getFullYear()):g,_=s?Math.min(_,s.getFullYear()):_,e.yearshtml+="<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";_>=g;g++)e.yearshtml+="<option value='"+g+"'"+(g===a?" selected='selected'":"")+">"+g+"</option>";e.yearshtml+="</select>",k+=e.yearshtml,e.yearshtml=null}return k+=this._get(e,"yearSuffix"),D&&(k+=(!n&&f&&m?"":"&#xa0;")+y),k+="</div>"},_adjustInstDate:function(e,t,a){var i=e.drawYear+("Y"===a?t:0),s=e.drawMonth+("M"===a?t:0),n=Math.min(e.selectedDay,this._getDaysInMonth(i,s))+("D"===a?t:0),r=this._restrictMinMax(e,this._daylightSavingAdjust(new Date(i,s,n)));e.selectedDay=r.getDate(),e.drawMonth=e.selectedMonth=r.getMonth(),e.drawYear=e.selectedYear=r.getFullYear(),("M"===a||"Y"===a)&&this._notifyChange(e)},_restrictMinMax:function(e,t){var a=this._getMinMaxDate(e,"min"),i=this._getMinMaxDate(e,"max"),s=a&&a>t?a:t;return i&&s>i?i:s},_notifyChange:function(e){var t=this._get(e,"onChangeMonthYear");t&&t.apply(e.input?e.input[0]:null,[e.selectedYear,e.selectedMonth+1,e])},_getNumberOfMonths:function(e){var t=this._get(e,"numberOfMonths");return null==t?[1,1]:"number"==typeof t?[1,t]:t},_getMinMaxDate:function(e,t){return this._determineDate(e,this._get(e,t+"Date"),null)},_getDaysInMonth:function(e,t){return 32-this._daylightSavingAdjust(new Date(e,t,32)).getDate()},_getFirstDayOfMonth:function(e,t){return new Date(e,t,1).getDay()},_canAdjustMonth:function(e,t,a,i){var s=this._getNumberOfMonths(e),n=this._daylightSavingAdjust(new Date(a,i+(0>t?t:s[0]*s[1]),1));return 0>t&&n.setDate(this._getDaysInMonth(n.getFullYear(),n.getMonth())),this._isInRange(e,n)},_isInRange:function(e,t){var a,i,s=this._getMinMaxDate(e,"min"),n=this._getMinMaxDate(e,"max"),r=null,o=null,c=this._get(e,"yearRange");return c&&(a=c.split(":"),i=(new Date).getFullYear(),r=parseInt(a[0],10),o=parseInt(a[1],10),a[0].match(/[+\-].*/)&&(r+=i),a[1].match(/[+\-].*/)&&(o+=i)),(!s||t.getTime()>=s.getTime())&&(!n||t.getTime()<=n.getTime())&&(!r||t.getFullYear()>=r)&&(!o||o>=t.getFullYear())},_getFormatConfig:function(e){var t=this._get(e,"shortYearCutoff");return t="string"!=typeof t?t:(new Date).getFullYear()%100+parseInt(t,10),{shortYearCutoff:t,dayNamesShort:this._get(e,"dayNamesShort"),dayNames:this._get(e,"dayNames"),monthNamesShort:this._get(e,"monthNamesShort"),monthNames:this._get(e,"monthNames")}},_formatDate:function(e,t,a,i){t||(e.currentDay=e.selectedDay,e.currentMonth=e.selectedMonth,e.currentYear=e.selectedYear);var s=t?"object"==typeof t?t:this._daylightSavingAdjust(new Date(i,a,t)):this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return this.formatDate(this._get(e,"dateFormat"),s,this._getFormatConfig(e))}}),e.fn.datepicker=function(t){if(!this.length)return this;e.datepicker.initialized||(e(document).mousedown(e.datepicker._checkExternalClick),e.datepicker.initialized=!0),0===e("#"+e.datepicker._mainDivId).length&&e("body").append(e.datepicker.dpDiv);var a=Array.prototype.slice.call(arguments,1);return"string"!=typeof t||"isDisabled"!==t&&"getDate"!==t&&"widget"!==t?"option"===t&&2===arguments.length&&"string"==typeof arguments[1]?e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this[0]].concat(a)):this.each(function(){"string"==typeof t?e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this].concat(a)):e.datepicker._attachDatepicker(this,t)}):e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this[0]].concat(a))},e.datepicker=new a,e.datepicker.initialized=!1,e.datepicker.uuid=(new Date).getTime(),e.datepicker.version="1.10.3"})(jQuery);(function(e){var t={buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},a={maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0};e.widget("ui.dialog",{version:"1.10.3",options:{appendTo:"body",autoOpen:!0,buttons:[],closeOnEscape:!0,closeText:"close",dialogClass:"",draggable:!0,hide:null,height:"auto",maxHeight:null,maxWidth:null,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",of:window,collision:"fit",using:function(t){var a=e(this).css(t).offset().top;0>a&&e(this).css("top",t.top-a)}},resizable:!0,show:null,title:null,width:300,beforeClose:null,close:null,drag:null,dragStart:null,dragStop:null,focus:null,open:null,resize:null,resizeStart:null,resizeStop:null},_create:function(){this.originalCss={display:this.element[0].style.display,width:this.element[0].style.width,minHeight:this.element[0].style.minHeight,maxHeight:this.element[0].style.maxHeight,height:this.element[0].style.height},this.originalPosition={parent:this.element.parent(),index:this.element.parent().children().index(this.element)},this.originalTitle=this.element.attr("title"),this.options.title=this.options.title||this.originalTitle,this._createWrapper(),this.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(this.uiDialog),this._createTitlebar(),this._createButtonPane(),this.options.draggable&&e.fn.draggable&&this._makeDraggable(),this.options.resizable&&e.fn.resizable&&this._makeResizable(),this._isOpen=!1},_init:function(){this.options.autoOpen&&this.open()},_appendTo:function(){var t=this.options.appendTo;return t&&(t.jquery||t.nodeType)?e(t):this.document.find(t||"body").eq(0)},_destroy:function(){var e,t=this.originalPosition;this._destroyOverlay(),this.element.removeUniqueId().removeClass("ui-dialog-content ui-widget-content").css(this.originalCss).detach(),this.uiDialog.stop(!0,!0).remove(),this.originalTitle&&this.element.attr("title",this.originalTitle),e=t.parent.children().eq(t.index),e.length&&e[0]!==this.element[0]?e.before(this.element):t.parent.append(this.element)},widget:function(){return this.uiDialog},disable:e.noop,enable:e.noop,close:function(t){var a=this;this._isOpen&&this._trigger("beforeClose",t)!==!1&&(this._isOpen=!1,this._destroyOverlay(),this.opener.filter(":focusable").focus().length||e(this.document[0].activeElement).blur(),this._hide(this.uiDialog,this.options.hide,function(){a._trigger("close",t)}))},isOpen:function(){return this._isOpen},moveToTop:function(){this._moveToTop()},_moveToTop:function(e,t){var a=!!this.uiDialog.nextAll(":visible").insertBefore(this.uiDialog).length;return a&&!t&&this._trigger("focus",e),a},open:function(){var t=this;return this._isOpen?(this._moveToTop()&&this._focusTabbable(),undefined):(this._isOpen=!0,this.opener=e(this.document[0].activeElement),this._size(),this._position(),this._createOverlay(),this._moveToTop(null,!0),this._show(this.uiDialog,this.options.show,function(){t._focusTabbable(),t._trigger("focus")}),this._trigger("open"),undefined)},_focusTabbable:function(){var e=this.element.find("[autofocus]");e.length||(e=this.element.find(":tabbable")),e.length||(e=this.uiDialogButtonPane.find(":tabbable")),e.length||(e=this.uiDialogTitlebarClose.filter(":tabbable")),e.length||(e=this.uiDialog),e.eq(0).focus()},_keepFocus:function(t){function a(){var t=this.document[0].activeElement,a=this.uiDialog[0]===t||e.contains(this.uiDialog[0],t);a||this._focusTabbable()}t.preventDefault(),a.call(this),this._delay(a)},_createWrapper:function(){this.uiDialog=e("<div>").addClass("ui-dialog ui-widget ui-widget-content ui-corner-all ui-front "+this.options.dialogClass).hide().attr({tabIndex:-1,role:"dialog"}).appendTo(this._appendTo()),this._on(this.uiDialog,{keydown:function(t){if(this.options.closeOnEscape&&!t.isDefaultPrevented()&&t.keyCode&&t.keyCode===e.ui.keyCode.ESCAPE)return t.preventDefault(),this.close(t),undefined;if(t.keyCode===e.ui.keyCode.TAB){var a=this.uiDialog.find(":tabbable"),r=a.filter(":first"),i=a.filter(":last");t.target!==i[0]&&t.target!==this.uiDialog[0]||t.shiftKey?t.target!==r[0]&&t.target!==this.uiDialog[0]||!t.shiftKey||(i.focus(1),t.preventDefault()):(r.focus(1),t.preventDefault())}},mousedown:function(e){this._moveToTop(e)&&this._focusTabbable()}}),this.element.find("[aria-describedby]").length||this.uiDialog.attr({"aria-describedby":this.element.uniqueId().attr("id")})},_createTitlebar:function(){var t;this.uiDialogTitlebar=e("<div>").addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(this.uiDialog),this._on(this.uiDialogTitlebar,{mousedown:function(t){e(t.target).closest(".ui-dialog-titlebar-close")||this.uiDialog.focus()}}),this.uiDialogTitlebarClose=e("<button></button>").button({label:this.options.closeText,icons:{primary:"ui-icon-closethick"},text:!1}).addClass("ui-dialog-titlebar-close").appendTo(this.uiDialogTitlebar),this._on(this.uiDialogTitlebarClose,{click:function(e){e.preventDefault(),this.close(e)}}),t=e("<span>").uniqueId().addClass("ui-dialog-title").prependTo(this.uiDialogTitlebar),this._title(t),this.uiDialog.attr({"aria-labelledby":t.attr("id")})},_title:function(e){this.options.title||e.html("&#160;"),e.text(this.options.title)},_createButtonPane:function(){this.uiDialogButtonPane=e("<div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),this.uiButtonSet=e("<div>").addClass("ui-dialog-buttonset").appendTo(this.uiDialogButtonPane),this._createButtons()},_createButtons:function(){var t=this,a=this.options.buttons;return this.uiDialogButtonPane.remove(),this.uiButtonSet.empty(),e.isEmptyObject(a)||e.isArray(a)&&!a.length?(this.uiDialog.removeClass("ui-dialog-buttons"),undefined):(e.each(a,function(a,r){var i,n;r=e.isFunction(r)?{click:r,text:a}:r,r=e.extend({type:"button"},r),i=r.click,r.click=function(){i.apply(t.element[0],arguments)},n={icons:r.icons,text:r.showText},delete r.icons,delete r.showText,e("<button></button>",r).button(n).appendTo(t.uiButtonSet)}),this.uiDialog.addClass("ui-dialog-buttons"),this.uiDialogButtonPane.appendTo(this.uiDialog),undefined)},_makeDraggable:function(){function t(e){return{position:e.position,offset:e.offset}}var a=this,r=this.options;this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(r,i){e(this).addClass("ui-dialog-dragging"),a._blockFrames(),a._trigger("dragStart",r,t(i))},drag:function(e,r){a._trigger("drag",e,t(r))},stop:function(i,n){r.position=[n.position.left-a.document.scrollLeft(),n.position.top-a.document.scrollTop()],e(this).removeClass("ui-dialog-dragging"),a._unblockFrames(),a._trigger("dragStop",i,t(n))}})},_makeResizable:function(){function t(e){return{originalPosition:e.originalPosition,originalSize:e.originalSize,position:e.position,size:e.size}}var a=this,r=this.options,i=r.resizable,n=this.uiDialog.css("position"),s="string"==typeof i?i:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:r.maxWidth,maxHeight:r.maxHeight,minWidth:r.minWidth,minHeight:this._minHeight(),handles:s,start:function(r,i){e(this).addClass("ui-dialog-resizing"),a._blockFrames(),a._trigger("resizeStart",r,t(i))},resize:function(e,r){a._trigger("resize",e,t(r))},stop:function(i,n){r.height=e(this).height(),r.width=e(this).width(),e(this).removeClass("ui-dialog-resizing"),a._unblockFrames(),a._trigger("resizeStop",i,t(n))}}).css("position",n)},_minHeight:function(){var e=this.options;return"auto"===e.height?e.minHeight:Math.min(e.minHeight,e.height)},_position:function(){var e=this.uiDialog.is(":visible");e||this.uiDialog.show(),this.uiDialog.position(this.options.position),e||this.uiDialog.hide()},_setOptions:function(r){var i=this,n=!1,s={};e.each(r,function(e,r){i._setOption(e,r),e in t&&(n=!0),e in a&&(s[e]=r)}),n&&(this._size(),this._position()),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option",s)},_setOption:function(e,t){var a,r,i=this.uiDialog;"dialogClass"===e&&i.removeClass(this.options.dialogClass).addClass(t),"disabled"!==e&&(this._super(e,t),"appendTo"===e&&this.uiDialog.appendTo(this._appendTo()),"buttons"===e&&this._createButtons(),"closeText"===e&&this.uiDialogTitlebarClose.button({label:""+t}),"draggable"===e&&(a=i.is(":data(ui-draggable)"),a&&!t&&i.draggable("destroy"),!a&&t&&this._makeDraggable()),"position"===e&&this._position(),"resizable"===e&&(r=i.is(":data(ui-resizable)"),r&&!t&&i.resizable("destroy"),r&&"string"==typeof t&&i.resizable("option","handles",t),r||t===!1||this._makeResizable()),"title"===e&&this._title(this.uiDialogTitlebar.find(".ui-dialog-title")))},_size:function(){var e,t,a,r=this.options;this.element.show().css({width:"auto",minHeight:0,maxHeight:"none",height:0}),r.minWidth>r.width&&(r.width=r.minWidth),e=this.uiDialog.css({height:"auto",width:r.width}).outerHeight(),t=Math.max(0,r.minHeight-e),a="number"==typeof r.maxHeight?Math.max(0,r.maxHeight-e):"none","auto"===r.height?this.element.css({minHeight:t,maxHeight:a,height:"auto"}):this.element.height(Math.max(0,r.height-e)),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())},_blockFrames:function(){this.iframeBlocks=this.document.find("iframe").map(function(){var t=e(this);return e("<div>").css({position:"absolute",width:t.outerWidth(),height:t.outerHeight()}).appendTo(t.parent()).offset(t.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_allowInteraction:function(t){return e(t.target).closest(".ui-dialog").length?!0:!!e(t.target).closest(".ui-datepicker").length},_createOverlay:function(){if(this.options.modal){var t=this,a=this.widgetFullName;e.ui.dialog.overlayInstances||this._delay(function(){e.ui.dialog.overlayInstances&&this.document.bind("focusin.dialog",function(r){t._allowInteraction(r)||(r.preventDefault(),e(".ui-dialog:visible:last .ui-dialog-content").data(a)._focusTabbable())})}),this.overlay=e("<div>").addClass("ui-widget-overlay ui-front").appendTo(this._appendTo()),this._on(this.overlay,{mousedown:"_keepFocus"}),e.ui.dialog.overlayInstances++}},_destroyOverlay:function(){this.options.modal&&this.overlay&&(e.ui.dialog.overlayInstances--,e.ui.dialog.overlayInstances||this.document.unbind("focusin.dialog"),this.overlay.remove(),this.overlay=null)}}),e.ui.dialog.overlayInstances=0,e.uiBackCompat!==!1&&e.widget("ui.dialog",e.ui.dialog,{_position:function(){var t,a=this.options.position,r=[],i=[0,0];a?(("string"==typeof a||"object"==typeof a&&"0"in a)&&(r=a.split?a.split(" "):[a[0],a[1]],1===r.length&&(r[1]=r[0]),e.each(["left","top"],function(e,t){+r[e]===r[e]&&(i[e]=r[e],r[e]=t)}),a={my:r[0]+(0>i[0]?i[0]:"+"+i[0])+" "+r[1]+(0>i[1]?i[1]:"+"+i[1]),at:r.join(" ")}),a=e.extend({},e.ui.dialog.prototype.options.position,a)):a=e.ui.dialog.prototype.options.position,t=this.uiDialog.is(":visible"),t||this.uiDialog.show(),this.uiDialog.position(a),t||this.uiDialog.hide()}})})(jQuery);(function(e){e.widget("ui.menu",{version:"1.10.3",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-carat-1-e"},menus:"ul",position:{my:"left top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.element.uniqueId().addClass("ui-menu ui-widget ui-widget-content ui-corner-all").toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length).attr({role:this.options.role,tabIndex:0}).bind("click"+this.eventNamespace,e.proxy(function(e){this.options.disabled&&e.preventDefault()},this)),this.options.disabled&&this.element.addClass("ui-state-disabled").attr("aria-disabled","true"),this._on({"mousedown .ui-menu-item > a":function(e){e.preventDefault()},"click .ui-state-disabled > a":function(e){e.preventDefault()},"click .ui-menu-item:has(a)":function(t){var i=e(t.target).closest(".ui-menu-item");!this.mouseHandled&&i.not(".ui-state-disabled").length&&(this.mouseHandled=!0,this.select(t),i.has(".ui-menu").length?this.expand(t):this.element.is(":focus")||(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(t){var i=e(t.currentTarget);i.siblings().children(".ui-state-active").removeClass("ui-state-active"),this.focus(t,i)},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(e,t){var i=this.active||this.element.children(".ui-menu-item").eq(0);t||this.focus(e,i)},blur:function(t){this._delay(function(){e.contains(this.element[0],this.document[0].activeElement)||this.collapseAll(t)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(t){e(t.target).closest(".ui-menu").length||this.collapseAll(t),this.mouseHandled=!1}})},_destroy:function(){this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeClass("ui-menu ui-widget ui-widget-content ui-corner-all ui-menu-icons").removeAttr("role").removeAttr("tabIndex").removeAttr("aria-labelledby").removeAttr("aria-expanded").removeAttr("aria-hidden").removeAttr("aria-disabled").removeUniqueId().show(),this.element.find(".ui-menu-item").removeClass("ui-menu-item").removeAttr("role").removeAttr("aria-disabled").children("a").removeUniqueId().removeClass("ui-corner-all ui-state-hover").removeAttr("tabIndex").removeAttr("role").removeAttr("aria-haspopup").children().each(function(){var t=e(this);t.data("ui-menu-submenu-carat")&&t.remove()}),this.element.find(".ui-menu-divider").removeClass("ui-menu-divider ui-widget-content")},_keydown:function(t){function i(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}var a,s,r,n,o,h=!0;switch(t.keyCode){case e.ui.keyCode.PAGE_UP:this.previousPage(t);break;case e.ui.keyCode.PAGE_DOWN:this.nextPage(t);break;case e.ui.keyCode.HOME:this._move("first","first",t);break;case e.ui.keyCode.END:this._move("last","last",t);break;case e.ui.keyCode.UP:this.previous(t);break;case e.ui.keyCode.DOWN:this.next(t);break;case e.ui.keyCode.LEFT:this.collapse(t);break;case e.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(t);break;case e.ui.keyCode.ENTER:case e.ui.keyCode.SPACE:this._activate(t);break;case e.ui.keyCode.ESCAPE:this.collapse(t);break;default:h=!1,s=this.previousFilter||"",r=String.fromCharCode(t.keyCode),n=!1,clearTimeout(this.filterTimer),r===s?n=!0:r=s+r,o=RegExp("^"+i(r),"i"),a=this.activeMenu.children(".ui-menu-item").filter(function(){return o.test(e(this).children("a").text())}),a=n&&-1!==a.index(this.active.next())?this.active.nextAll(".ui-menu-item"):a,a.length||(r=String.fromCharCode(t.keyCode),o=RegExp("^"+i(r),"i"),a=this.activeMenu.children(".ui-menu-item").filter(function(){return o.test(e(this).children("a").text())})),a.length?(this.focus(t,a),a.length>1?(this.previousFilter=r,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter):delete this.previousFilter}h&&t.preventDefault()},_activate:function(e){this.active.is(".ui-state-disabled")||(this.active.children("a[aria-haspopup='true']").length?this.expand(e):this.select(e))},refresh:function(){var t,i=this.options.icons.submenu,a=this.element.find(this.options.menus);a.filter(":not(.ui-menu)").addClass("ui-menu ui-widget ui-widget-content ui-corner-all").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var t=e(this),a=t.prev("a"),s=e("<span>").addClass("ui-menu-icon ui-icon "+i).data("ui-menu-submenu-carat",!0);a.attr("aria-haspopup","true").prepend(s),t.attr("aria-labelledby",a.attr("id"))}),t=a.add(this.element),t.children(":not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","presentation").children("a").uniqueId().addClass("ui-corner-all").attr({tabIndex:-1,role:this._itemRole()}),t.children(":not(.ui-menu-item)").each(function(){var t=e(this);/[^\-\u2014\u2013\s]/.test(t.text())||t.addClass("ui-widget-content ui-menu-divider")}),t.children(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!e.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(e,t){"icons"===e&&this.element.find(".ui-menu-icon").removeClass(this.options.icons.submenu).addClass(t.submenu),this._super(e,t)},focus:function(e,t){var i,a;this.blur(e,e&&"focus"===e.type),this._scrollIntoView(t),this.active=t.first(),a=this.active.children("a").addClass("ui-state-focus"),this.options.role&&this.element.attr("aria-activedescendant",a.attr("id")),this.active.parent().closest(".ui-menu-item").children("a:first").addClass("ui-state-active"),e&&"keydown"===e.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),i=t.children(".ui-menu"),i.length&&/^mouse/.test(e.type)&&this._startOpening(i),this.activeMenu=t.parent(),this._trigger("focus",e,{item:t})},_scrollIntoView:function(t){var i,a,s,r,n,o;this._hasScroll()&&(i=parseFloat(e.css(this.activeMenu[0],"borderTopWidth"))||0,a=parseFloat(e.css(this.activeMenu[0],"paddingTop"))||0,s=t.offset().top-this.activeMenu.offset().top-i-a,r=this.activeMenu.scrollTop(),n=this.activeMenu.height(),o=t.height(),0>s?this.activeMenu.scrollTop(r+s):s+o>n&&this.activeMenu.scrollTop(r+s-n+o))},blur:function(e,t){t||clearTimeout(this.timer),this.active&&(this.active.children("a").removeClass("ui-state-focus"),this.active=null,this._trigger("blur",e,{item:this.active}))},_startOpening:function(e){clearTimeout(this.timer),"true"===e.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(e)},this.delay))},_open:function(t){var i=e.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(t.parents(".ui-menu")).hide().attr("aria-hidden","true"),t.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(i)},collapseAll:function(t,i){clearTimeout(this.timer),this.timer=this._delay(function(){var a=i?this.element:e(t&&t.target).closest(this.element.find(".ui-menu"));a.length||(a=this.element),this._close(a),this.blur(t),this.activeMenu=a},this.delay)},_close:function(e){e||(e=this.active?this.active.parent():this.element),e.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false").end().find("a.ui-state-active").removeClass("ui-state-active")},collapse:function(e){var t=this.active&&this.active.parent().closest(".ui-menu-item",this.element);t&&t.length&&(this._close(),this.focus(e,t))},expand:function(e){var t=this.active&&this.active.children(".ui-menu ").children(".ui-menu-item").first();t&&t.length&&(this._open(t.parent()),this._delay(function(){this.focus(e,t)}))},next:function(e){this._move("next","first",e)},previous:function(e){this._move("prev","last",e)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(e,t,i){var a;this.active&&(a="first"===e||"last"===e?this.active["first"===e?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[e+"All"](".ui-menu-item").eq(0)),a&&a.length&&this.active||(a=this.activeMenu.children(".ui-menu-item")[t]()),this.focus(i,a)},nextPage:function(t){var i,a,s;return this.active?(this.isLastItem()||(this._hasScroll()?(a=this.active.offset().top,s=this.element.height(),this.active.nextAll(".ui-menu-item").each(function(){return i=e(this),0>i.offset().top-a-s}),this.focus(t,i)):this.focus(t,this.activeMenu.children(".ui-menu-item")[this.active?"last":"first"]())),undefined):(this.next(t),undefined)},previousPage:function(t){var i,a,s;return this.active?(this.isFirstItem()||(this._hasScroll()?(a=this.active.offset().top,s=this.element.height(),this.active.prevAll(".ui-menu-item").each(function(){return i=e(this),i.offset().top-a+s>0}),this.focus(t,i)):this.focus(t,this.activeMenu.children(".ui-menu-item").first())),undefined):(this.next(t),undefined)},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(t){this.active=this.active||e(t.target).closest(".ui-menu-item");var i={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(t,!0),this._trigger("select",t,i)}})})(jQuery);(function(e,t){e.widget("ui.progressbar",{version:"1.10.3",options:{max:100,value:0,change:null,complete:null},min:0,_create:function(){this.oldValue=this.options.value=this._constrainedValue(),this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min}),this.valueDiv=e("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>").appendTo(this.element),this._refreshValue()},_destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.valueDiv.remove()},value:function(e){return e===t?this.options.value:(this.options.value=this._constrainedValue(e),this._refreshValue(),t)},_constrainedValue:function(e){return e===t&&(e=this.options.value),this.indeterminate=e===!1,"number"!=typeof e&&(e=0),this.indeterminate?!1:Math.min(this.options.max,Math.max(this.min,e))},_setOptions:function(e){var t=e.value;delete e.value,this._super(e),this.options.value=this._constrainedValue(t),this._refreshValue()},_setOption:function(e,t){"max"===e&&(t=Math.max(this.min,t)),this._super(e,t)},_percentage:function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min)},_refreshValue:function(){var t=this.options.value,i=this._percentage();this.valueDiv.toggle(this.indeterminate||t>this.min).toggleClass("ui-corner-right",t===this.options.max).width(i.toFixed(0)+"%"),this.element.toggleClass("ui-progressbar-indeterminate",this.indeterminate),this.indeterminate?(this.element.removeAttr("aria-valuenow"),this.overlayDiv||(this.overlayDiv=e("<div class='ui-progressbar-overlay'></div>").appendTo(this.valueDiv))):(this.element.attr({"aria-valuemax":this.options.max,"aria-valuenow":t}),this.overlayDiv&&(this.overlayDiv.remove(),this.overlayDiv=null)),this.oldValue!==t&&(this.oldValue=t,this._trigger("change")),t===this.options.max&&this._trigger("complete")}})})(jQuery);(function(e){var t=5;e.widget("ui.slider",e.ui.mouse,{version:"1.10.3",widgetEventPrefix:"slide",options:{animate:!1,distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},_create:function(){this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget"+" ui-widget-content"+" ui-corner-all"),this._refresh(),this._setOption("disabled",this.options.disabled),this._animateOff=!1},_refresh:function(){this._createRange(),this._createHandles(),this._setupEvents(),this._refreshValue()},_createHandles:function(){var t,i,a=this.options,s=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),r="<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>",n=[];for(i=a.values&&a.values.length||1,s.length>i&&(s.slice(i).remove(),s=s.slice(0,i)),t=s.length;i>t;t++)n.push(r);this.handles=s.add(e(n.join("")).appendTo(this.element)),this.handle=this.handles.eq(0),this.handles.each(function(t){e(this).data("ui-slider-handle-index",t)})},_createRange:function(){var t=this.options,i="";t.range?(t.range===!0&&(t.values?t.values.length&&2!==t.values.length?t.values=[t.values[0],t.values[0]]:e.isArray(t.values)&&(t.values=t.values.slice(0)):t.values=[this._valueMin(),this._valueMin()]),this.range&&this.range.length?this.range.removeClass("ui-slider-range-min ui-slider-range-max").css({left:"",bottom:""}):(this.range=e("<div></div>").appendTo(this.element),i="ui-slider-range ui-widget-header ui-corner-all"),this.range.addClass(i+("min"===t.range||"max"===t.range?" ui-slider-range-"+t.range:""))):this.range=e([])},_setupEvents:function(){var e=this.handles.add(this.range).filter("a");this._off(e),this._on(e,this._handleEvents),this._hoverable(e),this._focusable(e)},_destroy:function(){this.handles.remove(),this.range.remove(),this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-widget ui-widget-content ui-corner-all"),this._mouseDestroy()},_mouseCapture:function(t){var i,a,s,r,n,o,h,l,u=this,d=this.options;return d.disabled?!1:(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),i={x:t.pageX,y:t.pageY},a=this._normValueFromMouse(i),s=this._valueMax()-this._valueMin()+1,this.handles.each(function(t){var i=Math.abs(a-u.values(t));(s>i||s===i&&(t===u._lastChangedValue||u.values(t)===d.min))&&(s=i,r=e(this),n=t)}),o=this._start(t,n),o===!1?!1:(this._mouseSliding=!0,this._handleIndex=n,r.addClass("ui-state-active").focus(),h=r.offset(),l=!e(t.target).parents().addBack().is(".ui-slider-handle"),this._clickOffset=l?{left:0,top:0}:{left:t.pageX-h.left-r.width()/2,top:t.pageY-h.top-r.height()/2-(parseInt(r.css("borderTopWidth"),10)||0)-(parseInt(r.css("borderBottomWidth"),10)||0)+(parseInt(r.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(t,n,a),this._animateOff=!0,!0))},_mouseStart:function(){return!0},_mouseDrag:function(e){var t={x:e.pageX,y:e.pageY},i=this._normValueFromMouse(t);return this._slide(e,this._handleIndex,i),!1},_mouseStop:function(e){return this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(e,this._handleIndex),this._change(e,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(e){var t,i,a,s,r;return"horizontal"===this.orientation?(t=this.elementSize.width,i=e.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(t=this.elementSize.height,i=e.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),a=i/t,a>1&&(a=1),0>a&&(a=0),"vertical"===this.orientation&&(a=1-a),s=this._valueMax()-this._valueMin(),r=this._valueMin()+a*s,this._trimAlignValue(r)},_start:function(e,t){var i={handle:this.handles[t],value:this.value()};return this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._trigger("start",e,i)},_slide:function(e,t,i){var a,s,r;this.options.values&&this.options.values.length?(a=this.values(t?0:1),2===this.options.values.length&&this.options.range===!0&&(0===t&&i>a||1===t&&a>i)&&(i=a),i!==this.values(t)&&(s=this.values(),s[t]=i,r=this._trigger("slide",e,{handle:this.handles[t],value:i,values:s}),a=this.values(t?0:1),r!==!1&&this.values(t,i,!0))):i!==this.value()&&(r=this._trigger("slide",e,{handle:this.handles[t],value:i}),r!==!1&&this.value(i))},_stop:function(e,t){var i={handle:this.handles[t],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._trigger("stop",e,i)},_change:function(e,t){if(!this._keySliding&&!this._mouseSliding){var i={handle:this.handles[t],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._lastChangedValue=t,this._trigger("change",e,i)}},value:function(e){return arguments.length?(this.options.value=this._trimAlignValue(e),this._refreshValue(),this._change(null,0),undefined):this._value()},values:function(t,i){var a,s,r;if(arguments.length>1)return this.options.values[t]=this._trimAlignValue(i),this._refreshValue(),this._change(null,t),undefined;if(!arguments.length)return this._values();if(!e.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(t):this.value();for(a=this.options.values,s=arguments[0],r=0;a.length>r;r+=1)a[r]=this._trimAlignValue(s[r]),this._change(null,r);this._refreshValue()},_setOption:function(t,i){var a,s=0;switch("range"===t&&this.options.range===!0&&("min"===i?(this.options.value=this._values(0),this.options.values=null):"max"===i&&(this.options.value=this._values(this.options.values.length-1),this.options.values=null)),e.isArray(this.options.values)&&(s=this.options.values.length),e.Widget.prototype._setOption.apply(this,arguments),t){case"orientation":this._detectOrientation(),this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation),this._refreshValue();break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":for(this._animateOff=!0,this._refreshValue(),a=0;s>a;a+=1)this._change(null,a);this._animateOff=!1;break;case"min":case"max":this._animateOff=!0,this._refreshValue(),this._animateOff=!1;break;case"range":this._animateOff=!0,this._refresh(),this._animateOff=!1}},_value:function(){var e=this.options.value;return e=this._trimAlignValue(e)},_values:function(e){var t,i,a;if(arguments.length)return t=this.options.values[e],t=this._trimAlignValue(t);if(this.options.values&&this.options.values.length){for(i=this.options.values.slice(),a=0;i.length>a;a+=1)i[a]=this._trimAlignValue(i[a]);return i}return[]},_trimAlignValue:function(e){if(this._valueMin()>=e)return this._valueMin();if(e>=this._valueMax())return this._valueMax();var t=this.options.step>0?this.options.step:1,i=(e-this._valueMin())%t,a=e-i;return 2*Math.abs(i)>=t&&(a+=i>0?t:-t),parseFloat(a.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var t,i,a,s,r,n=this.options.range,o=this.options,h=this,l=this._animateOff?!1:o.animate,u={};this.options.values&&this.options.values.length?this.handles.each(function(a){i=100*((h.values(a)-h._valueMin())/(h._valueMax()-h._valueMin())),u["horizontal"===h.orientation?"left":"bottom"]=i+"%",e(this).stop(1,1)[l?"animate":"css"](u,o.animate),h.options.range===!0&&("horizontal"===h.orientation?(0===a&&h.range.stop(1,1)[l?"animate":"css"]({left:i+"%"},o.animate),1===a&&h.range[l?"animate":"css"]({width:i-t+"%"},{queue:!1,duration:o.animate})):(0===a&&h.range.stop(1,1)[l?"animate":"css"]({bottom:i+"%"},o.animate),1===a&&h.range[l?"animate":"css"]({height:i-t+"%"},{queue:!1,duration:o.animate}))),t=i}):(a=this.value(),s=this._valueMin(),r=this._valueMax(),i=r!==s?100*((a-s)/(r-s)):0,u["horizontal"===this.orientation?"left":"bottom"]=i+"%",this.handle.stop(1,1)[l?"animate":"css"](u,o.animate),"min"===n&&"horizontal"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({width:i+"%"},o.animate),"max"===n&&"horizontal"===this.orientation&&this.range[l?"animate":"css"]({width:100-i+"%"},{queue:!1,duration:o.animate}),"min"===n&&"vertical"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({height:i+"%"},o.animate),"max"===n&&"vertical"===this.orientation&&this.range[l?"animate":"css"]({height:100-i+"%"},{queue:!1,duration:o.animate}))},_handleEvents:{keydown:function(i){var a,s,r,n,o=e(i.target).data("ui-slider-handle-index");switch(i.keyCode){case e.ui.keyCode.HOME:case e.ui.keyCode.END:case e.ui.keyCode.PAGE_UP:case e.ui.keyCode.PAGE_DOWN:case e.ui.keyCode.UP:case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:case e.ui.keyCode.LEFT:if(i.preventDefault(),!this._keySliding&&(this._keySliding=!0,e(i.target).addClass("ui-state-active"),a=this._start(i,o),a===!1))return}switch(n=this.options.step,s=r=this.options.values&&this.options.values.length?this.values(o):this.value(),i.keyCode){case e.ui.keyCode.HOME:r=this._valueMin();break;case e.ui.keyCode.END:r=this._valueMax();break;case e.ui.keyCode.PAGE_UP:r=this._trimAlignValue(s+(this._valueMax()-this._valueMin())/t);break;case e.ui.keyCode.PAGE_DOWN:r=this._trimAlignValue(s-(this._valueMax()-this._valueMin())/t);break;case e.ui.keyCode.UP:case e.ui.keyCode.RIGHT:if(s===this._valueMax())return;r=this._trimAlignValue(s+n);break;case e.ui.keyCode.DOWN:case e.ui.keyCode.LEFT:if(s===this._valueMin())return;r=this._trimAlignValue(s-n)}this._slide(i,o,r)},click:function(e){e.preventDefault()},keyup:function(t){var i=e(t.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(t,i),this._change(t,i),e(t.target).removeClass("ui-state-active"))}}})})(jQuery);(function(e){function t(e){return function(){var t=this.element.val();e.apply(this,arguments),this._refresh(),t!==this.element.val()&&this._trigger("change")}}e.widget("ui.spinner",{version:"1.10.3",defaultElement:"<input>",widgetEventPrefix:"spin",options:{culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:!0,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:function(){this._setOption("max",this.options.max),this._setOption("min",this.options.min),this._setOption("step",this.options.step),this._value(this.element.val(),!0),this._draw(),this._on(this._events),this._refresh(),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_getCreateOptions:function(){var t={},i=this.element;return e.each(["min","max","step"],function(e,a){var s=i.attr(a);void 0!==s&&s.length&&(t[a]=s)}),t},_events:{keydown:function(e){this._start(e)&&this._keydown(e)&&e.preventDefault()},keyup:"_stop",focus:function(){this.previous=this.element.val()},blur:function(e){return this.cancelBlur?(delete this.cancelBlur,void 0):(this._stop(),this._refresh(),this.previous!==this.element.val()&&this._trigger("change",e),void 0)},mousewheel:function(e,t){if(t){if(!this.spinning&&!this._start(e))return!1;this._spin((t>0?1:-1)*this.options.step,e),clearTimeout(this.mousewheelTimer),this.mousewheelTimer=this._delay(function(){this.spinning&&this._stop(e)},100),e.preventDefault()}},"mousedown .ui-spinner-button":function(t){function i(){var e=this.element[0]===this.document[0].activeElement;e||(this.element.focus(),this.previous=a,this._delay(function(){this.previous=a}))}var a;a=this.element[0]===this.document[0].activeElement?this.previous:this.element.val(),t.preventDefault(),i.call(this),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,i.call(this)}),this._start(t)!==!1&&this._repeat(null,e(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t)},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(t){return e(t.currentTarget).hasClass("ui-state-active")?this._start(t)===!1?!1:(this._repeat(null,e(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t),void 0):void 0},"mouseleave .ui-spinner-button":"_stop"},_draw:function(){var e=this.uiSpinner=this.element.addClass("ui-spinner-input").attr("autocomplete","off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml());this.element.attr("role","spinbutton"),this.buttons=e.find(".ui-spinner-button").attr("tabIndex",-1).button().removeClass("ui-corner-all"),this.buttons.height()>Math.ceil(.5*e.height())&&e.height()>0&&e.height(e.height()),this.options.disabled&&this.disable()},_keydown:function(t){var i=this.options,a=e.ui.keyCode;switch(t.keyCode){case a.UP:return this._repeat(null,1,t),!0;case a.DOWN:return this._repeat(null,-1,t),!0;case a.PAGE_UP:return this._repeat(null,i.page,t),!0;case a.PAGE_DOWN:return this._repeat(null,-i.page,t),!0}return!1},_uiSpinnerHtml:function(){return"<span class='ui-spinner ui-widget ui-widget-content ui-corner-all'></span>"},_buttonHtml:function(){return"<a class='ui-spinner-button ui-spinner-up ui-corner-tr'><span class='ui-icon "+this.options.icons.up+"'>&#9650;</span>"+"</a>"+"<a class='ui-spinner-button ui-spinner-down ui-corner-br'>"+"<span class='ui-icon "+this.options.icons.down+"'>&#9660;</span>"+"</a>"},_start:function(e){return this.spinning||this._trigger("start",e)!==!1?(this.counter||(this.counter=1),this.spinning=!0,!0):!1},_repeat:function(e,t,i){e=e||500,clearTimeout(this.timer),this.timer=this._delay(function(){this._repeat(40,t,i)},e),this._spin(t*this.options.step,i)},_spin:function(e,t){var i=this.value()||0;this.counter||(this.counter=1),i=this._adjustValue(i+e*this._increment(this.counter)),this.spinning&&this._trigger("spin",t,{value:i})===!1||(this._value(i),this.counter++)},_increment:function(t){var i=this.options.incremental;return i?e.isFunction(i)?i(t):Math.floor(t*t*t/5e4-t*t/500+17*t/200+1):1},_precision:function(){var e=this._precisionOf(this.options.step);return null!==this.options.min&&(e=Math.max(e,this._precisionOf(this.options.min))),e},_precisionOf:function(e){var t=""+e,i=t.indexOf(".");return-1===i?0:t.length-i-1},_adjustValue:function(e){var t,i,a=this.options;return t=null!==a.min?a.min:0,i=e-t,i=Math.round(i/a.step)*a.step,e=t+i,e=parseFloat(e.toFixed(this._precision())),null!==a.max&&e>a.max?a.max:null!==a.min&&a.min>e?a.min:e},_stop:function(e){this.spinning&&(clearTimeout(this.timer),clearTimeout(this.mousewheelTimer),this.counter=0,this.spinning=!1,this._trigger("stop",e))},_setOption:function(e,t){if("culture"===e||"numberFormat"===e){var i=this._parse(this.element.val());return this.options[e]=t,this.element.val(this._format(i)),void 0}("max"===e||"min"===e||"step"===e)&&"string"==typeof t&&(t=this._parse(t)),"icons"===e&&(this.buttons.first().find(".ui-icon").removeClass(this.options.icons.up).addClass(t.up),this.buttons.last().find(".ui-icon").removeClass(this.options.icons.down).addClass(t.down)),this._super(e,t),"disabled"===e&&(t?(this.element.prop("disabled",!0),this.buttons.button("disable")):(this.element.prop("disabled",!1),this.buttons.button("enable")))},_setOptions:t(function(e){this._super(e),this._value(this.element.val())}),_parse:function(e){return"string"==typeof e&&""!==e&&(e=window.Globalize&&this.options.numberFormat?Globalize.parseFloat(e,10,this.options.culture):+e),""===e||isNaN(e)?null:e},_format:function(e){return""===e?"":window.Globalize&&this.options.numberFormat?Globalize.format(e,this.options.numberFormat,this.options.culture):e},_refresh:function(){this.element.attr({"aria-valuemin":this.options.min,"aria-valuemax":this.options.max,"aria-valuenow":this._parse(this.element.val())})},_value:function(e,t){var i;""!==e&&(i=this._parse(e),null!==i&&(t||(i=this._adjustValue(i)),e=this._format(i))),this.element.val(e),this._refresh()},_destroy:function(){this.element.removeClass("ui-spinner-input").prop("disabled",!1).removeAttr("autocomplete").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.uiSpinner.replaceWith(this.element)},stepUp:t(function(e){this._stepUp(e)}),_stepUp:function(e){this._start()&&(this._spin((e||1)*this.options.step),this._stop())},stepDown:t(function(e){this._stepDown(e)}),_stepDown:function(e){this._start()&&(this._spin((e||1)*-this.options.step),this._stop())},pageUp:t(function(e){this._stepUp((e||1)*this.options.page)}),pageDown:t(function(e){this._stepDown((e||1)*this.options.page)}),value:function(e){return arguments.length?(t(this._value).call(this,e),void 0):this._parse(this.element.val())},widget:function(){return this.uiSpinner}})})(jQuery);(function(e,t){function i(){return++s}function a(e){return e.hash.length>1&&decodeURIComponent(e.href.replace(r,""))===decodeURIComponent(location.href.replace(r,""))}var s=0,r=/#.*$/;e.widget("ui.tabs",{version:"1.10.3",delay:300,options:{active:null,collapsible:!1,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_create:function(){var t=this,i=this.options;this.running=!1,this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all").toggleClass("ui-tabs-collapsible",i.collapsible).delegate(".ui-tabs-nav > li","mousedown"+this.eventNamespace,function(t){e(this).is(".ui-state-disabled")&&t.preventDefault()}).delegate(".ui-tabs-anchor","focus"+this.eventNamespace,function(){e(this).closest("li").is(".ui-state-disabled")&&this.blur()}),this._processTabs(),i.active=this._initialActive(),e.isArray(i.disabled)&&(i.disabled=e.unique(i.disabled.concat(e.map(this.tabs.filter(".ui-state-disabled"),function(e){return t.tabs.index(e)}))).sort()),this.active=this.options.active!==!1&&this.anchors.length?this._findActive(i.active):e(),this._refresh(),this.active.length&&this.load(i.active)},_initialActive:function(){var i=this.options.active,a=this.options.collapsible,s=location.hash.substring(1);return null===i&&(s&&this.tabs.each(function(a,r){return e(r).attr("aria-controls")===s?(i=a,!1):t}),null===i&&(i=this.tabs.index(this.tabs.filter(".ui-tabs-active"))),(null===i||-1===i)&&(i=this.tabs.length?0:!1)),i!==!1&&(i=this.tabs.index(this.tabs.eq(i)),-1===i&&(i=a?!1:0)),!a&&i===!1&&this.anchors.length&&(i=0),i},_getCreateEventData:function(){return{tab:this.active,panel:this.active.length?this._getPanelForTab(this.active):e()}},_tabKeydown:function(i){var a=e(this.document[0].activeElement).closest("li"),s=this.tabs.index(a),r=!0;if(!this._handlePageNav(i)){switch(i.keyCode){case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:s++;break;case e.ui.keyCode.UP:case e.ui.keyCode.LEFT:r=!1,s--;break;case e.ui.keyCode.END:s=this.anchors.length-1;break;case e.ui.keyCode.HOME:s=0;break;case e.ui.keyCode.SPACE:return i.preventDefault(),clearTimeout(this.activating),this._activate(s),t;case e.ui.keyCode.ENTER:return i.preventDefault(),clearTimeout(this.activating),this._activate(s===this.options.active?!1:s),t;default:return}i.preventDefault(),clearTimeout(this.activating),s=this._focusNextTab(s,r),i.ctrlKey||(a.attr("aria-selected","false"),this.tabs.eq(s).attr("aria-selected","true"),this.activating=this._delay(function(){this.option("active",s)},this.delay))}},_panelKeydown:function(t){this._handlePageNav(t)||t.ctrlKey&&t.keyCode===e.ui.keyCode.UP&&(t.preventDefault(),this.active.focus())},_handlePageNav:function(i){return i.altKey&&i.keyCode===e.ui.keyCode.PAGE_UP?(this._activate(this._focusNextTab(this.options.active-1,!1)),!0):i.altKey&&i.keyCode===e.ui.keyCode.PAGE_DOWN?(this._activate(this._focusNextTab(this.options.active+1,!0)),!0):t},_findNextTab:function(t,i){function a(){return t>s&&(t=0),0>t&&(t=s),t}for(var s=this.tabs.length-1;-1!==e.inArray(a(),this.options.disabled);)t=i?t+1:t-1;return t},_focusNextTab:function(e,t){return e=this._findNextTab(e,t),this.tabs.eq(e).focus(),e},_setOption:function(e,i){return"active"===e?(this._activate(i),t):"disabled"===e?(this._setupDisabled(i),t):(this._super(e,i),"collapsible"===e&&(this.element.toggleClass("ui-tabs-collapsible",i),i||this.options.active!==!1||this._activate(0)),"event"===e&&this._setupEvents(i),"heightStyle"===e&&this._setupHeightStyle(i),t)},_tabId:function(e){return e.attr("aria-controls")||"ui-tabs-"+i()},_sanitizeSelector:function(e){return e?e.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var t=this.options,i=this.tablist.children(":has(a[href])");t.disabled=e.map(i.filter(".ui-state-disabled"),function(e){return i.index(e)}),this._processTabs(),t.active!==!1&&this.anchors.length?this.active.length&&!e.contains(this.tablist[0],this.active[0])?this.tabs.length===t.disabled.length?(t.active=!1,this.active=e()):this._activate(this._findNextTab(Math.max(0,t.active-1),!1)):t.active=this.tabs.index(this.active):(t.active=!1,this.active=e()),this._refresh()},_refresh:function(){this._setupDisabled(this.options.disabled),this._setupEvents(this.options.event),this._setupHeightStyle(this.options.heightStyle),this.tabs.not(this.active).attr({"aria-selected":"false",tabIndex:-1}),this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-expanded":"false","aria-hidden":"true"}),this.active.length?(this.active.addClass("ui-tabs-active ui-state-active").attr({"aria-selected":"true",tabIndex:0}),this._getPanelForTab(this.active).show().attr({"aria-expanded":"true","aria-hidden":"false"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function(){var t=this;this.tablist=this._getList().addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").attr("role","tablist"),this.tabs=this.tablist.find("> li:has(a[href])").addClass("ui-state-default ui-corner-top").attr({role:"tab",tabIndex:-1}),this.anchors=this.tabs.map(function(){return e("a",this)[0]}).addClass("ui-tabs-anchor").attr({role:"presentation",tabIndex:-1}),this.panels=e(),this.anchors.each(function(i,s){var r,n,o,h=e(s).uniqueId().attr("id"),l=e(s).closest("li"),u=l.attr("aria-controls");a(s)?(r=s.hash,n=t.element.find(t._sanitizeSelector(r))):(o=t._tabId(l),r="#"+o,n=t.element.find(r),n.length||(n=t._createPanel(o),n.insertAfter(t.panels[i-1]||t.tablist)),n.attr("aria-live","polite")),n.length&&(t.panels=t.panels.add(n)),u&&l.data("ui-tabs-aria-controls",u),l.attr({"aria-controls":r.substring(1),"aria-labelledby":h}),n.attr("aria-labelledby",h)}),this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").attr("role","tabpanel")},_getList:function(){return this.element.find("ol,ul").eq(0)},_createPanel:function(t){return e("<div>").attr("id",t).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").data("ui-tabs-destroy",!0)},_setupDisabled:function(t){e.isArray(t)&&(t.length?t.length===this.anchors.length&&(t=!0):t=!1);for(var i,a=0;i=this.tabs[a];a++)t===!0||-1!==e.inArray(a,t)?e(i).addClass("ui-state-disabled").attr("aria-disabled","true"):e(i).removeClass("ui-state-disabled").removeAttr("aria-disabled");this.options.disabled=t},_setupEvents:function(t){var i={click:function(e){e.preventDefault()}};t&&e.each(t.split(" "),function(e,t){i[t]="_eventHandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(this.anchors,i),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupHeightStyle:function(t){var i,a=this.element.parent();"fill"===t?(i=a.height(),i-=this.element.outerHeight()-this.element.height(),this.element.siblings(":visible").each(function(){var t=e(this),a=t.css("position");"absolute"!==a&&"fixed"!==a&&(i-=t.outerHeight(!0))}),this.element.children().not(this.panels).each(function(){i-=e(this).outerHeight(!0)}),this.panels.each(function(){e(this).height(Math.max(0,i-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):"auto"===t&&(i=0,this.panels.each(function(){i=Math.max(i,e(this).height("").height())}).height(i))},_eventHandler:function(t){var i=this.options,a=this.active,s=e(t.currentTarget),r=s.closest("li"),n=r[0]===a[0],o=n&&i.collapsible,h=o?e():this._getPanelForTab(r),l=a.length?this._getPanelForTab(a):e(),u={oldTab:a,oldPanel:l,newTab:o?e():r,newPanel:h};t.preventDefault(),r.hasClass("ui-state-disabled")||r.hasClass("ui-tabs-loading")||this.running||n&&!i.collapsible||this._trigger("beforeActivate",t,u)===!1||(i.active=o?!1:this.tabs.index(r),this.active=n?e():r,this.xhr&&this.xhr.abort(),l.length||h.length||e.error("jQuery UI Tabs: Mismatching fragment identifier."),h.length&&this.load(this.tabs.index(r),t),this._toggle(t,u))},_toggle:function(t,i){function a(){r.running=!1,r._trigger("activate",t,i)}function s(){i.newTab.closest("li").addClass("ui-tabs-active ui-state-active"),n.length&&r.options.show?r._show(n,r.options.show,a):(n.show(),a())}var r=this,n=i.newPanel,o=i.oldPanel;this.running=!0,o.length&&this.options.hide?this._hide(o,this.options.hide,function(){i.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),s()}):(i.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),o.hide(),s()),o.attr({"aria-expanded":"false","aria-hidden":"true"}),i.oldTab.attr("aria-selected","false"),n.length&&o.length?i.oldTab.attr("tabIndex",-1):n.length&&this.tabs.filter(function(){return 0===e(this).attr("tabIndex")}).attr("tabIndex",-1),n.attr({"aria-expanded":"true","aria-hidden":"false"}),i.newTab.attr({"aria-selected":"true",tabIndex:0})},_activate:function(t){var i,a=this._findActive(t);a[0]!==this.active[0]&&(a.length||(a=this.active),i=a.find(".ui-tabs-anchor")[0],this._eventHandler({target:i,currentTarget:i,preventDefault:e.noop}))},_findActive:function(t){return t===!1?e():this.tabs.eq(t)},_getIndex:function(e){return"string"==typeof e&&(e=this.anchors.index(this.anchors.filter("[href$='"+e+"']"))),e},_destroy:function(){this.xhr&&this.xhr.abort(),this.element.removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible"),this.tablist.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").removeAttr("role"),this.anchors.removeClass("ui-tabs-anchor").removeAttr("role").removeAttr("tabIndex").removeUniqueId(),this.tabs.add(this.panels).each(function(){e.data(this,"ui-tabs-destroy")?e(this).remove():e(this).removeClass("ui-state-default ui-state-active ui-state-disabled ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel").removeAttr("tabIndex").removeAttr("aria-live").removeAttr("aria-busy").removeAttr("aria-selected").removeAttr("aria-labelledby").removeAttr("aria-hidden").removeAttr("aria-expanded").removeAttr("role")}),this.tabs.each(function(){var t=e(this),i=t.data("ui-tabs-aria-controls");i?t.attr("aria-controls",i).removeData("ui-tabs-aria-controls"):t.removeAttr("aria-controls")}),this.panels.show(),"content"!==this.options.heightStyle&&this.panels.css("height","")},enable:function(i){var a=this.options.disabled;a!==!1&&(i===t?a=!1:(i=this._getIndex(i),a=e.isArray(a)?e.map(a,function(e){return e!==i?e:null}):e.map(this.tabs,function(e,t){return t!==i?t:null})),this._setupDisabled(a))},disable:function(i){var a=this.options.disabled;if(a!==!0){if(i===t)a=!0;else{if(i=this._getIndex(i),-1!==e.inArray(i,a))return;a=e.isArray(a)?e.merge([i],a).sort():[i]}this._setupDisabled(a)}},load:function(t,i){t=this._getIndex(t);var s=this,r=this.tabs.eq(t),n=r.find(".ui-tabs-anchor"),o=this._getPanelForTab(r),h={tab:r,panel:o};a(n[0])||(this.xhr=e.ajax(this._ajaxSettings(n,i,h)),this.xhr&&"canceled"!==this.xhr.statusText&&(r.addClass("ui-tabs-loading"),o.attr("aria-busy","true"),this.xhr.success(function(e){setTimeout(function(){o.html(e),s._trigger("load",i,h)},1)}).complete(function(e,t){setTimeout(function(){"abort"===t&&s.panels.stop(!1,!0),r.removeClass("ui-tabs-loading"),o.removeAttr("aria-busy"),e===s.xhr&&delete s.xhr},1)})))},_ajaxSettings:function(t,i,a){var s=this;return{url:t.attr("href"),beforeSend:function(t,r){return s._trigger("beforeLoad",i,e.extend({jqXHR:t,ajaxSettings:r},a))}}},_getPanelForTab:function(t){var i=e(t).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+i))}})})(jQuery);(function(e){function t(t,i){var a=(t.attr("aria-describedby")||"").split(/\s+/);a.push(i),t.data("ui-tooltip-id",i).attr("aria-describedby",e.trim(a.join(" ")))}function i(t){var i=t.data("ui-tooltip-id"),a=(t.attr("aria-describedby")||"").split(/\s+/),s=e.inArray(i,a);-1!==s&&a.splice(s,1),t.removeData("ui-tooltip-id"),a=e.trim(a.join(" ")),a?t.attr("aria-describedby",a):t.removeAttr("aria-describedby")}var a=0;e.widget("ui.tooltip",{version:"1.10.3",options:{content:function(){var t=e(this).attr("title")||"";return e("<a>").text(t).html()},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,tooltipClass:null,track:!1,close:null,open:null},_create:function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.options.disabled&&this._disable()},_setOption:function(t,i){var a=this;return"disabled"===t?(this[i?"_disable":"_enable"](),this.options[t]=i,void 0):(this._super(t,i),"content"===t&&e.each(this.tooltips,function(e,t){a._updateContent(t)}),void 0)},_disable:function(){var t=this;e.each(this.tooltips,function(i,a){var s=e.Event("blur");s.target=s.currentTarget=a[0],t.close(s,!0)}),this.element.find(this.options.items).addBack().each(function(){var t=e(this);t.is("[title]")&&t.data("ui-tooltip-title",t.attr("title")).attr("title","")})},_enable:function(){this.element.find(this.options.items).addBack().each(function(){var t=e(this);t.data("ui-tooltip-title")&&t.attr("title",t.data("ui-tooltip-title"))})},open:function(t){var i=this,a=e(t?t.target:this.element).closest(this.options.items);a.length&&!a.data("ui-tooltip-id")&&(a.attr("title")&&a.data("ui-tooltip-title",a.attr("title")),a.data("ui-tooltip-open",!0),t&&"mouseover"===t.type&&a.parents().each(function(){var t,a=e(this);a.data("ui-tooltip-open")&&(t=e.Event("blur"),t.target=t.currentTarget=this,i.close(t,!0)),a.attr("title")&&(a.uniqueId(),i.parents[this.id]={element:this,title:a.attr("title")},a.attr("title",""))}),this._updateContent(a,t))},_updateContent:function(e,t){var i,a=this.options.content,s=this,n=t?t.type:null;return"string"==typeof a?this._open(t,e,a):(i=a.call(e[0],function(i){e.data("ui-tooltip-open")&&s._delay(function(){t&&(t.type=n),this._open(t,e,i)})}),i&&this._open(t,e,i),void 0)},_open:function(i,a,s){function n(e){l.of=e,r.is(":hidden")||r.position(l)}var r,o,h,l=e.extend({},this.options.position);if(s){if(r=this._find(a),r.length)return r.find(".ui-tooltip-content").html(s),void 0;a.is("[title]")&&(i&&"mouseover"===i.type?a.attr("title",""):a.removeAttr("title")),r=this._tooltip(a),t(a,r.attr("id")),r.find(".ui-tooltip-content").html(s),this.options.track&&i&&/^mouse/.test(i.type)?(this._on(this.document,{mousemove:n}),n(i)):r.position(e.extend({of:a},this.options.position)),r.hide(),this._show(r,this.options.show),this.options.show&&this.options.show.delay&&(h=this.delayedShow=setInterval(function(){r.is(":visible")&&(n(l.of),clearInterval(h))},e.fx.interval)),this._trigger("open",i,{tooltip:r}),o={keyup:function(t){if(t.keyCode===e.ui.keyCode.ESCAPE){var i=e.Event(t);i.currentTarget=a[0],this.close(i,!0)}},remove:function(){this._removeTooltip(r)}},i&&"mouseover"!==i.type||(o.mouseleave="close"),i&&"focusin"!==i.type||(o.focusout="close"),this._on(!0,a,o)}},close:function(t){var a=this,s=e(t?t.currentTarget:this.element),n=this._find(s);this.closing||(clearInterval(this.delayedShow),s.data("ui-tooltip-title")&&s.attr("title",s.data("ui-tooltip-title")),i(s),n.stop(!0),this._hide(n,this.options.hide,function(){a._removeTooltip(e(this))}),s.removeData("ui-tooltip-open"),this._off(s,"mouseleave focusout keyup"),s[0]!==this.element[0]&&this._off(s,"remove"),this._off(this.document,"mousemove"),t&&"mouseleave"===t.type&&e.each(this.parents,function(t,i){e(i.element).attr("title",i.title),delete a.parents[t]}),this.closing=!0,this._trigger("close",t,{tooltip:n}),this.closing=!1)},_tooltip:function(t){var i="ui-tooltip-"+a++,s=e("<div>").attr({id:i,role:"tooltip"}).addClass("ui-tooltip ui-widget ui-corner-all ui-widget-content "+(this.options.tooltipClass||""));return e("<div>").addClass("ui-tooltip-content").appendTo(s),s.appendTo(this.document[0].body),this.tooltips[i]=t,s},_find:function(t){var i=t.data("ui-tooltip-id");return i?e("#"+i):e()},_removeTooltip:function(e){e.remove(),delete this.tooltips[e.attr("id")]},_destroy:function(){var t=this;e.each(this.tooltips,function(i,a){var s=e.Event("blur");s.target=s.currentTarget=a[0],t.close(s,!0),e("#"+i).remove(),a.data("ui-tooltip-title")&&(a.attr("title",a.data("ui-tooltip-title")),a.removeData("ui-tooltip-title"))})}})})(jQuery);(function(e,t){var i="ui-effects-";e.effects={effect:{}},function(e,t){function i(e,t,i){var a=l[t.type]||{};return null==e?i||!t.def?null:t.def:(e=a.floor?~~e:parseFloat(e),isNaN(e)?t.def:a.mod?(e+a.mod)%a.mod:0>e?0:e>a.max?a.max:e)}function a(i){var a=u(),r=a._rgba=[];return i=i.toLowerCase(),p(d,function(e,s){var n,o=s.re.exec(i),d=o&&s.parse(o),u=s.space||"rgba";return d?(n=a[u](d),a[h[u].cache]=n[h[u].cache],r=a._rgba=n._rgba,!1):t}),r.length?("0,0,0,0"===r.join()&&e.extend(r,s.transparent),a):s[i]}function r(e,t,i){return i=(i+1)%1,1>6*i?e+6*(t-e)*i:1>2*i?t:2>3*i?e+6*(t-e)*(2/3-i):e}var s,n="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",o=/^([\-+])=\s*(\d+\.?\d*)/,d=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[e[1],e[2],e[3],e[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[2.55*e[1],2.55*e[2],2.55*e[3],e[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(e){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(e){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(e){return[e[1],e[2]/100,e[3]/100,e[4]]}}],u=e.Color=function(t,i,a,r){return new e.Color.fn.parse(t,i,a,r)},h={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},l={"byte":{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},c=u.support={},m=e("<p>")[0],p=e.each;m.style.cssText="background-color:rgba(1,1,1,.5)",c.rgba=m.style.backgroundColor.indexOf("rgba")>-1,p(h,function(e,t){t.cache="_"+e,t.props.alpha={idx:3,type:"percent",def:1}}),u.fn=e.extend(u.prototype,{parse:function(r,n,o,d){if(r===t)return this._rgba=[null,null,null,null],this;(r.jquery||r.nodeType)&&(r=e(r).css(n),n=t);var l=this,c=e.type(r),m=this._rgba=[];return n!==t&&(r=[r,n,o,d],c="array"),"string"===c?this.parse(a(r)||s._default):"array"===c?(p(h.rgba.props,function(e,t){m[t.idx]=i(r[t.idx],t)}),this):"object"===c?(r instanceof u?p(h,function(e,t){r[t.cache]&&(l[t.cache]=r[t.cache].slice())}):p(h,function(t,a){var s=a.cache;p(a.props,function(e,t){if(!l[s]&&a.to){if("alpha"===e||null==r[e])return;l[s]=a.to(l._rgba)}l[s][t.idx]=i(r[e],t,!0)}),l[s]&&0>e.inArray(null,l[s].slice(0,3))&&(l[s][3]=1,a.from&&(l._rgba=a.from(l[s])))}),this):t},is:function(e){var i=u(e),a=!0,r=this;return p(h,function(e,s){var n,o=i[s.cache];return o&&(n=r[s.cache]||s.to&&s.to(r._rgba)||[],p(s.props,function(e,i){return null!=o[i.idx]?a=o[i.idx]===n[i.idx]:t})),a}),a},_space:function(){var e=[],t=this;return p(h,function(i,a){t[a.cache]&&e.push(i)}),e.pop()},transition:function(e,t){var a=u(e),r=a._space(),s=h[r],n=0===this.alpha()?u("transparent"):this,o=n[s.cache]||s.to(n._rgba),d=o.slice();return a=a[s.cache],p(s.props,function(e,r){var s=r.idx,n=o[s],u=a[s],h=l[r.type]||{};null!==u&&(null===n?d[s]=u:(h.mod&&(u-n>h.mod/2?n+=h.mod:n-u>h.mod/2&&(n-=h.mod)),d[s]=i((u-n)*t+n,r)))}),this[r](d)},blend:function(t){if(1===this._rgba[3])return this;var i=this._rgba.slice(),a=i.pop(),r=u(t)._rgba;return u(e.map(i,function(e,t){return(1-a)*r[t]+a*e}))},toRgbaString:function(){var t="rgba(",i=e.map(this._rgba,function(e,t){return null==e?t>2?1:0:e});return 1===i[3]&&(i.pop(),t="rgb("),t+i.join()+")"},toHslaString:function(){var t="hsla(",i=e.map(this.hsla(),function(e,t){return null==e&&(e=t>2?1:0),t&&3>t&&(e=Math.round(100*e)+"%"),e});return 1===i[3]&&(i.pop(),t="hsl("),t+i.join()+")"},toHexString:function(t){var i=this._rgba.slice(),a=i.pop();return t&&i.push(~~(255*a)),"#"+e.map(i,function(e){return e=(e||0).toString(16),1===e.length?"0"+e:e}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),u.fn.parse.prototype=u.fn,h.hsla.to=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t,i,a=e[0]/255,r=e[1]/255,s=e[2]/255,n=e[3],o=Math.max(a,r,s),d=Math.min(a,r,s),u=o-d,h=o+d,l=.5*h;return t=d===o?0:a===o?60*(r-s)/u+360:r===o?60*(s-a)/u+120:60*(a-r)/u+240,i=0===u?0:.5>=l?u/h:u/(2-h),[Math.round(t)%360,i,l,null==n?1:n]},h.hsla.from=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t=e[0]/360,i=e[1],a=e[2],s=e[3],n=.5>=a?a*(1+i):a+i-a*i,o=2*a-n;return[Math.round(255*r(o,n,t+1/3)),Math.round(255*r(o,n,t)),Math.round(255*r(o,n,t-1/3)),s]},p(h,function(a,r){var s=r.props,n=r.cache,d=r.to,h=r.from;u.fn[a]=function(a){if(d&&!this[n]&&(this[n]=d(this._rgba)),a===t)return this[n].slice();var r,o=e.type(a),l="array"===o||"object"===o?a:arguments,c=this[n].slice();return p(s,function(e,t){var a=l["object"===o?e:t.idx];null==a&&(a=c[t.idx]),c[t.idx]=i(a,t)}),h?(r=u(h(c)),r[n]=c,r):u(c)},p(s,function(t,i){u.fn[t]||(u.fn[t]=function(r){var s,n=e.type(r),d="alpha"===t?this._hsla?"hsla":"rgba":a,u=this[d](),h=u[i.idx];return"undefined"===n?h:("function"===n&&(r=r.call(this,h),n=e.type(r)),null==r&&i.empty?this:("string"===n&&(s=o.exec(r),s&&(r=h+parseFloat(s[2])*("+"===s[1]?1:-1))),u[i.idx]=r,this[d](u)))})})}),u.hook=function(t){var i=t.split(" ");p(i,function(t,i){e.cssHooks[i]={set:function(t,r){var s,n,o="";if("transparent"!==r&&("string"!==e.type(r)||(s=a(r)))){if(r=u(s||r),!c.rgba&&1!==r._rgba[3]){for(n="backgroundColor"===i?t.parentNode:t;(""===o||"transparent"===o)&&n&&n.style;)try{o=e.css(n,"backgroundColor"),n=n.parentNode}catch(d){}r=r.blend(o&&"transparent"!==o?o:"_default")}r=r.toRgbaString()}try{t.style[i]=r}catch(d){}}},e.fx.step[i]=function(t){t.colorInit||(t.start=u(t.elem,i),t.end=u(t.end),t.colorInit=!0),e.cssHooks[i].set(t.elem,t.start.transition(t.end,t.pos))}})},u.hook(n),e.cssHooks.borderColor={expand:function(e){var t={};return p(["Top","Right","Bottom","Left"],function(i,a){t["border"+a+"Color"]=e}),t}},s=e.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(jQuery),function(){function i(t){var i,a,r=t.ownerDocument.defaultView?t.ownerDocument.defaultView.getComputedStyle(t,null):t.currentStyle,s={};if(r&&r.length&&r[0]&&r[r[0]])for(a=r.length;a--;)i=r[a],"string"==typeof r[i]&&(s[e.camelCase(i)]=r[i]);else for(i in r)"string"==typeof r[i]&&(s[i]=r[i]);return s}function a(t,i){var a,r,n={};for(a in i)r=i[a],t[a]!==r&&(s[a]||(e.fx.step[a]||!isNaN(parseFloat(r)))&&(n[a]=r));return n}var r=["add","remove","toggle"],s={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};e.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(t,i){e.fx.step[i]=function(e){("none"!==e.end&&!e.setAttr||1===e.pos&&!e.setAttr)&&(jQuery.style(e.elem,i,e.end),e.setAttr=!0)}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e.effects.animateClass=function(t,s,n,o){var d=e.speed(s,n,o);return this.queue(function(){var s,n=e(this),o=n.attr("class")||"",u=d.children?n.find("*").addBack():n;u=u.map(function(){var t=e(this);return{el:t,start:i(this)}}),s=function(){e.each(r,function(e,i){t[i]&&n[i+"Class"](t[i])})},s(),u=u.map(function(){return this.end=i(this.el[0]),this.diff=a(this.start,this.end),this}),n.attr("class",o),u=u.map(function(){var t=this,i=e.Deferred(),a=e.extend({},d,{queue:!1,complete:function(){i.resolve(t)}});return this.el.animate(this.diff,a),i.promise()}),e.when.apply(e,u.get()).done(function(){s(),e.each(arguments,function(){var t=this.el;e.each(this.diff,function(e){t.css(e,"")})}),d.complete.call(n[0])})})},e.fn.extend({addClass:function(t){return function(i,a,r,s){return a?e.effects.animateClass.call(this,{add:i},a,r,s):t.apply(this,arguments)}}(e.fn.addClass),removeClass:function(t){return function(i,a,r,s){return arguments.length>1?e.effects.animateClass.call(this,{remove:i},a,r,s):t.apply(this,arguments)}}(e.fn.removeClass),toggleClass:function(i){return function(a,r,s,n,o){return"boolean"==typeof r||r===t?s?e.effects.animateClass.call(this,r?{add:a}:{remove:a},s,n,o):i.apply(this,arguments):e.effects.animateClass.call(this,{toggle:a},r,s,n)}}(e.fn.toggleClass),switchClass:function(t,i,a,r,s){return e.effects.animateClass.call(this,{add:i,remove:t},a,r,s)}})}(),function(){function a(t,i,a,r){return e.isPlainObject(t)&&(i=t,t=t.effect),t={effect:t},null==i&&(i={}),e.isFunction(i)&&(r=i,a=null,i={}),("number"==typeof i||e.fx.speeds[i])&&(r=a,a=i,i={}),e.isFunction(a)&&(r=a,a=null),i&&e.extend(t,i),a=a||i.duration,t.duration=e.fx.off?0:"number"==typeof a?a:a in e.fx.speeds?e.fx.speeds[a]:e.fx.speeds._default,t.complete=r||i.complete,t}function r(t){return!t||"number"==typeof t||e.fx.speeds[t]?!0:"string"!=typeof t||e.effects.effect[t]?e.isFunction(t)?!0:"object"!=typeof t||t.effect?!1:!0:!0}e.extend(e.effects,{version:"1.10.3",save:function(e,t){for(var a=0;t.length>a;a++)null!==t[a]&&e.data(i+t[a],e[0].style[t[a]])},restore:function(e,a){var r,s;for(s=0;a.length>s;s++)null!==a[s]&&(r=e.data(i+a[s]),r===t&&(r=""),e.css(a[s],r))},setMode:function(e,t){return"toggle"===t&&(t=e.is(":hidden")?"show":"hide"),t},getBaseline:function(e,t){var i,a;switch(e[0]){case"top":i=0;break;case"middle":i=.5;break;case"bottom":i=1;break;default:i=e[0]/t.height}switch(e[1]){case"left":a=0;break;case"center":a=.5;break;case"right":a=1;break;default:a=e[1]/t.width}return{x:a,y:i}},createWrapper:function(t){if(t.parent().is(".ui-effects-wrapper"))return t.parent();var i={width:t.outerWidth(!0),height:t.outerHeight(!0),"float":t.css("float")},a=e("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),r={width:t.width(),height:t.height()},s=document.activeElement;try{s.id}catch(n){s=document.body}return t.wrap(a),(t[0]===s||e.contains(t[0],s))&&e(s).focus(),a=t.parent(),"static"===t.css("position")?(a.css({position:"relative"}),t.css({position:"relative"})):(e.extend(i,{position:t.css("position"),zIndex:t.css("z-index")}),e.each(["top","left","bottom","right"],function(e,a){i[a]=t.css(a),isNaN(parseInt(i[a],10))&&(i[a]="auto")}),t.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),t.css(r),a.css(i).show()},removeWrapper:function(t){var i=document.activeElement;return t.parent().is(".ui-effects-wrapper")&&(t.parent().replaceWith(t),(t[0]===i||e.contains(t[0],i))&&e(i).focus()),t},setTransition:function(t,i,a,r){return r=r||{},e.each(i,function(e,i){var s=t.cssUnit(i);s[0]>0&&(r[i]=s[0]*a+s[1])}),r}}),e.fn.extend({effect:function(){function t(t){function a(){e.isFunction(s)&&s.call(r[0]),e.isFunction(t)&&t()}var r=e(this),s=i.complete,o=i.mode;(r.is(":hidden")?"hide"===o:"show"===o)?(r[o](),a()):n.call(r[0],i,a)}var i=a.apply(this,arguments),r=i.mode,s=i.queue,n=e.effects.effect[i.effect];return e.fx.off||!n?r?this[r](i.duration,i.complete):this.each(function(){i.complete&&i.complete.call(this)}):s===!1?this.each(t):this.queue(s||"fx",t)},show:function(e){return function(t){if(r(t))return e.apply(this,arguments);var i=a.apply(this,arguments);return i.mode="show",this.effect.call(this,i)}}(e.fn.show),hide:function(e){return function(t){if(r(t))return e.apply(this,arguments);var i=a.apply(this,arguments);return i.mode="hide",this.effect.call(this,i)}}(e.fn.hide),toggle:function(e){return function(t){if(r(t)||"boolean"==typeof t)return e.apply(this,arguments);var i=a.apply(this,arguments);return i.mode="toggle",this.effect.call(this,i)}}(e.fn.toggle),cssUnit:function(t){var i=this.css(t),a=[];return e.each(["em","px","%","pt"],function(e,t){i.indexOf(t)>0&&(a=[parseFloat(i),t])}),a}})}(),function(){var t={};e.each(["Quad","Cubic","Quart","Quint","Expo"],function(e,i){t[i]=function(t){return Math.pow(t,e+2)}}),e.extend(t,{Sine:function(e){return 1-Math.cos(e*Math.PI/2)},Circ:function(e){return 1-Math.sqrt(1-e*e)},Elastic:function(e){return 0===e||1===e?e:-Math.pow(2,8*(e-1))*Math.sin((80*(e-1)-7.5)*Math.PI/15)},Back:function(e){return e*e*(3*e-2)},Bounce:function(e){for(var t,i=4;((t=Math.pow(2,--i))-1)/11>e;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*t-2)/22-e,2)}}),e.each(t,function(t,i){e.easing["easeIn"+t]=i,e.easing["easeOut"+t]=function(e){return 1-i(1-e)},e.easing["easeInOut"+t]=function(e){return.5>e?i(2*e)/2:1-i(-2*e+2)/2}})}()})(jQuery);(function(e){var t=/up|down|vertical/,a=/up|left|vertical|horizontal/;e.effects.effect.blind=function(i,r){var s,n,o,d=e(this),l=["position","top","bottom","left","right","height","width"],u=e.effects.setMode(d,i.mode||"hide"),h=i.direction||"up",c=t.test(h),m=c?"height":"width",p=c?"top":"left",f=a.test(h),g={},y="show"===u;d.parent().is(".ui-effects-wrapper")?e.effects.save(d.parent(),l):e.effects.save(d,l),d.show(),s=e.effects.createWrapper(d).css({overflow:"hidden"}),n=s[m](),o=parseFloat(s.css(p))||0,g[m]=y?n:0,f||(d.css(c?"bottom":"right",0).css(c?"top":"left","auto").css({position:"absolute"}),g[p]=y?o:n+o),y&&(s.css(m,0),f||s.css(p,o+n)),s.animate(g,{duration:i.duration,easing:i.easing,queue:!1,complete:function(){"hide"===u&&d.hide(),e.effects.restore(d,l),e.effects.removeWrapper(d),r()}})}})(jQuery);(function(e){e.effects.effect.bounce=function(t,a){var i,r,s,n=e(this),o=["position","top","bottom","left","right","height","width"],d=e.effects.setMode(n,t.mode||"effect"),l="hide"===d,u="show"===d,h=t.direction||"up",c=t.distance,m=t.times||5,p=2*m+(u||l?1:0),f=t.duration/p,g=t.easing,y="up"===h||"down"===h?"top":"left",x="up"===h||"left"===h,k=n.queue(),b=k.length;for((u||l)&&o.push("opacity"),e.effects.save(n,o),n.show(),e.effects.createWrapper(n),c||(c=n["top"===y?"outerHeight":"outerWidth"]()/3),u&&(s={opacity:1},s[y]=0,n.css("opacity",0).css(y,x?2*-c:2*c).animate(s,f,g)),l&&(c/=Math.pow(2,m-1)),s={},s[y]=0,i=0;m>i;i++)r={},r[y]=(x?"-=":"+=")+c,n.animate(r,f,g).animate(s,f,g),c=l?2*c:c/2;l&&(r={opacity:0},r[y]=(x?"-=":"+=")+c,n.animate(r,f,g)),n.queue(function(){l&&n.hide(),e.effects.restore(n,o),e.effects.removeWrapper(n),a()}),b>1&&k.splice.apply(k,[1,0].concat(k.splice(b,p+1))),n.dequeue()}})(jQuery);(function(e){e.effects.effect.clip=function(t,a){var i,r,s,n=e(this),o=["position","top","bottom","left","right","height","width"],d=e.effects.setMode(n,t.mode||"hide"),l="show"===d,u=t.direction||"vertical",h="vertical"===u,c=h?"height":"width",m=h?"top":"left",p={};e.effects.save(n,o),n.show(),i=e.effects.createWrapper(n).css({overflow:"hidden"}),r="IMG"===n[0].tagName?i:n,s=r[c](),l&&(r.css(c,0),r.css(m,s/2)),p[c]=l?s:0,p[m]=l?0:s/2,r.animate(p,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){l||n.hide(),e.effects.restore(n,o),e.effects.removeWrapper(n),a()}})}})(jQuery);(function(e){e.effects.effect.drop=function(t,a){var i,r=e(this),s=["position","top","bottom","left","right","opacity","height","width"],n=e.effects.setMode(r,t.mode||"hide"),o="show"===n,d=t.direction||"left",l="up"===d||"down"===d?"top":"left",u="up"===d||"left"===d?"pos":"neg",h={opacity:o?1:0};e.effects.save(r,s),r.show(),e.effects.createWrapper(r),i=t.distance||r["top"===l?"outerHeight":"outerWidth"](!0)/2,o&&r.css("opacity",0).css(l,"pos"===u?-i:i),h[l]=(o?"pos"===u?"+=":"-=":"pos"===u?"-=":"+=")+i,r.animate(h,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===n&&r.hide(),e.effects.restore(r,s),e.effects.removeWrapper(r),a()}})}})(jQuery);(function(e){e.effects.effect.explode=function(t,a){function i(){k.push(this),k.length===h*c&&r()}function r(){m.css({visibility:"visible"}),e(k).remove(),f||m.hide(),a()}var s,n,o,d,l,u,h=t.pieces?Math.round(Math.sqrt(t.pieces)):3,c=h,m=e(this),p=e.effects.setMode(m,t.mode||"hide"),f="show"===p,g=m.show().css("visibility","hidden").offset(),y=Math.ceil(m.outerWidth()/c),x=Math.ceil(m.outerHeight()/h),k=[];for(s=0;h>s;s++)for(d=g.top+s*x,u=s-(h-1)/2,n=0;c>n;n++)o=g.left+n*y,l=n-(c-1)/2,m.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-n*y,top:-s*x}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:y,height:x,left:o+(f?l*y:0),top:d+(f?u*x:0),opacity:f?0:1}).animate({left:o+(f?0:l*y),top:d+(f?0:u*x),opacity:f?1:0},t.duration||500,t.easing,i)}})(jQuery);(function(e){e.effects.effect.fade=function(t,a){var i=e(this),r=e.effects.setMode(i,t.mode||"toggle");i.animate({opacity:r},{queue:!1,duration:t.duration,easing:t.easing,complete:a})}})(jQuery);(function(e){e.effects.effect.fold=function(t,a){var i,r,s=e(this),n=["position","top","bottom","left","right","height","width"],o=e.effects.setMode(s,t.mode||"hide"),d="show"===o,l="hide"===o,u=t.size||15,h=/([0-9]+)%/.exec(u),c=!!t.horizFirst,m=d!==c,p=m?["width","height"]:["height","width"],f=t.duration/2,g={},y={};e.effects.save(s,n),s.show(),i=e.effects.createWrapper(s).css({overflow:"hidden"}),r=m?[i.width(),i.height()]:[i.height(),i.width()],h&&(u=parseInt(h[1],10)/100*r[l?0:1]),d&&i.css(c?{height:0,width:u}:{height:u,width:0}),g[p[0]]=d?r[0]:u,y[p[1]]=d?r[1]:0,i.animate(g,f,t.easing).animate(y,f,t.easing,function(){l&&s.hide(),e.effects.restore(s,n),e.effects.removeWrapper(s),a()})}})(jQuery);(function(e){e.effects.effect.highlight=function(t,a){var i=e(this),r=["backgroundImage","backgroundColor","opacity"],s=e.effects.setMode(i,t.mode||"show"),n={backgroundColor:i.css("backgroundColor")};"hide"===s&&(n.opacity=0),e.effects.save(i,r),i.show().css({backgroundImage:"none",backgroundColor:t.color||"#ffff99"}).animate(n,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===s&&i.hide(),e.effects.restore(i,r),a()}})}})(jQuery);(function(e){e.effects.effect.pulsate=function(t,a){var i,r=e(this),s=e.effects.setMode(r,t.mode||"show"),n="show"===s,o="hide"===s,d=n||"hide"===s,l=2*(t.times||5)+(d?1:0),u=t.duration/l,h=0,c=r.queue(),m=c.length;for((n||!r.is(":visible"))&&(r.css("opacity",0).show(),h=1),i=1;l>i;i++)r.animate({opacity:h},u,t.easing),h=1-h;r.animate({opacity:h},u,t.easing),r.queue(function(){o&&r.hide(),a()}),m>1&&c.splice.apply(c,[1,0].concat(c.splice(m,l+1))),r.dequeue()}})(jQuery);(function(e){e.effects.effect.puff=function(t,i){var a=e(this),r=e.effects.setMode(a,t.mode||"hide"),s="hide"===r,n=parseInt(t.percent,10)||150,o=n/100,d={height:a.height(),width:a.width(),outerHeight:a.outerHeight(),outerWidth:a.outerWidth()};e.extend(t,{effect:"scale",queue:!1,fade:!0,mode:r,complete:i,percent:s?n:100,from:s?d:{height:d.height*o,width:d.width*o,outerHeight:d.outerHeight*o,outerWidth:d.outerWidth*o}}),a.effect(t)},e.effects.effect.scale=function(t,i){var a=e(this),r=e.extend(!0,{},t),s=e.effects.setMode(a,t.mode||"effect"),n=parseInt(t.percent,10)||(0===parseInt(t.percent,10)?0:"hide"===s?0:100),o=t.direction||"both",d=t.origin,h={height:a.height(),width:a.width(),outerHeight:a.outerHeight(),outerWidth:a.outerWidth()},u={y:"horizontal"!==o?n/100:1,x:"vertical"!==o?n/100:1};r.effect="size",r.queue=!1,r.complete=i,"effect"!==s&&(r.origin=d||["middle","center"],r.restore=!0),r.from=t.from||("show"===s?{height:0,width:0,outerHeight:0,outerWidth:0}:h),r.to={height:h.height*u.y,width:h.width*u.x,outerHeight:h.outerHeight*u.y,outerWidth:h.outerWidth*u.x},r.fade&&("show"===s&&(r.from.opacity=0,r.to.opacity=1),"hide"===s&&(r.from.opacity=1,r.to.opacity=0)),a.effect(r)},e.effects.effect.size=function(t,i){var a,r,s,n=e(this),o=["position","top","bottom","left","right","width","height","overflow","opacity"],d=["position","top","bottom","left","right","overflow","opacity"],h=["width","height","overflow"],u=["fontSize"],l=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],c=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],m=e.effects.setMode(n,t.mode||"effect"),p=t.restore||"effect"!==m,f=t.scale||"both",g=t.origin||["middle","center"],y=n.css("position"),x=p?o:d,k={height:0,width:0,outerHeight:0,outerWidth:0};"show"===m&&n.show(),a={height:n.height(),width:n.width(),outerHeight:n.outerHeight(),outerWidth:n.outerWidth()},"toggle"===t.mode&&"show"===m?(n.from=t.to||k,n.to=t.from||a):(n.from=t.from||("show"===m?k:a),n.to=t.to||("hide"===m?k:a)),s={from:{y:n.from.height/a.height,x:n.from.width/a.width},to:{y:n.to.height/a.height,x:n.to.width/a.width}},("box"===f||"both"===f)&&(s.from.y!==s.to.y&&(x=x.concat(l),n.from=e.effects.setTransition(n,l,s.from.y,n.from),n.to=e.effects.setTransition(n,l,s.to.y,n.to)),s.from.x!==s.to.x&&(x=x.concat(c),n.from=e.effects.setTransition(n,c,s.from.x,n.from),n.to=e.effects.setTransition(n,c,s.to.x,n.to))),("content"===f||"both"===f)&&s.from.y!==s.to.y&&(x=x.concat(u).concat(h),n.from=e.effects.setTransition(n,u,s.from.y,n.from),n.to=e.effects.setTransition(n,u,s.to.y,n.to)),e.effects.save(n,x),n.show(),e.effects.createWrapper(n),n.css("overflow","hidden").css(n.from),g&&(r=e.effects.getBaseline(g,a),n.from.top=(a.outerHeight-n.outerHeight())*r.y,n.from.left=(a.outerWidth-n.outerWidth())*r.x,n.to.top=(a.outerHeight-n.to.outerHeight)*r.y,n.to.left=(a.outerWidth-n.to.outerWidth)*r.x),n.css(n.from),("content"===f||"both"===f)&&(l=l.concat(["marginTop","marginBottom"]).concat(u),c=c.concat(["marginLeft","marginRight"]),h=o.concat(l).concat(c),n.find("*[width]").each(function(){var i=e(this),a={height:i.height(),width:i.width(),outerHeight:i.outerHeight(),outerWidth:i.outerWidth()};p&&e.effects.save(i,h),i.from={height:a.height*s.from.y,width:a.width*s.from.x,outerHeight:a.outerHeight*s.from.y,outerWidth:a.outerWidth*s.from.x},i.to={height:a.height*s.to.y,width:a.width*s.to.x,outerHeight:a.height*s.to.y,outerWidth:a.width*s.to.x},s.from.y!==s.to.y&&(i.from=e.effects.setTransition(i,l,s.from.y,i.from),i.to=e.effects.setTransition(i,l,s.to.y,i.to)),s.from.x!==s.to.x&&(i.from=e.effects.setTransition(i,c,s.from.x,i.from),i.to=e.effects.setTransition(i,c,s.to.x,i.to)),i.css(i.from),i.animate(i.to,t.duration,t.easing,function(){p&&e.effects.restore(i,h)})})),n.animate(n.to,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){0===n.to.opacity&&n.css("opacity",n.from.opacity),"hide"===m&&n.hide(),e.effects.restore(n,x),p||("static"===y?n.css({position:"relative",top:n.to.top,left:n.to.left}):e.each(["top","left"],function(e,t){n.css(t,function(t,i){var a=parseInt(i,10),r=e?n.to.left:n.to.top;return"auto"===i?r+"px":a+r+"px"})})),e.effects.removeWrapper(n),i()}})}})(jQuery);(function(e){e.effects.effect.shake=function(t,i){var a,r=e(this),s=["position","top","bottom","left","right","height","width"],n=e.effects.setMode(r,t.mode||"effect"),o=t.direction||"left",d=t.distance||20,h=t.times||3,u=2*h+1,l=Math.round(t.duration/u),c="up"===o||"down"===o?"top":"left",m="up"===o||"left"===o,p={},f={},g={},y=r.queue(),x=y.length;for(e.effects.save(r,s),r.show(),e.effects.createWrapper(r),p[c]=(m?"-=":"+=")+d,f[c]=(m?"+=":"-=")+2*d,g[c]=(m?"-=":"+=")+2*d,r.animate(p,l,t.easing),a=1;h>a;a++)r.animate(f,l,t.easing).animate(g,l,t.easing);r.animate(f,l,t.easing).animate(p,l/2,t.easing).queue(function(){"hide"===n&&r.hide(),e.effects.restore(r,s),e.effects.removeWrapper(r),i()}),x>1&&y.splice.apply(y,[1,0].concat(y.splice(x,u+1))),r.dequeue()}})(jQuery);(function(e){e.effects.effect.slide=function(t,i){var a,r=e(this),s=["position","top","bottom","left","right","width","height"],n=e.effects.setMode(r,t.mode||"show"),o="show"===n,d=t.direction||"left",h="up"===d||"down"===d?"top":"left",u="up"===d||"left"===d,l={};e.effects.save(r,s),r.show(),a=t.distance||r["top"===h?"outerHeight":"outerWidth"](!0),e.effects.createWrapper(r).css({overflow:"hidden"}),o&&r.css(h,u?isNaN(a)?"-"+a:-a:a),l[h]=(o?u?"+=":"-=":u?"-=":"+=")+a,r.animate(l,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===n&&r.hide(),e.effects.restore(r,s),e.effects.removeWrapper(r),i()}})}})(jQuery);(function(e){e.effects.effect.transfer=function(t,i){var a=e(this),r=e(t.to),s="fixed"===r.css("position"),n=e("body"),o=s?n.scrollTop():0,d=s?n.scrollLeft():0,h=r.offset(),u={top:h.top-o,left:h.left-d,height:r.innerHeight(),width:r.innerWidth()},l=a.offset(),c=e("<div class='ui-effects-transfer'></div>").appendTo(document.body).addClass(t.className).css({top:l.top-o,left:l.left-d,height:a.innerHeight(),width:a.innerWidth(),position:s?"fixed":"absolute"}).animate(u,t.duration,t.easing,function(){c.remove(),i()})}})(jQuery);
\ No newline at end of file
diff --git a/js/extlib/jquery.cookie.min.js b/js/extlib/jquery.cookie.min.js
deleted file mode 100644 (file)
index 12a4791..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-/*
- * jQuery Cookie Plugin v1.3.1
- * https://github.com/carhartl/jquery-cookie
- *
- * Copyright 2013 Klaus Hartl
- * Released under the MIT license
- */
-(function(a){if(typeof define==="function"&&define.amd){define(["jquery"],a)}else{a(jQuery)}}(function(c){var a=/\+/g;function d(f){if(b.raw){return f}try{return decodeURIComponent(f.replace(a," "))}catch(g){}}function e(f){if(f.indexOf('"')===0){f=f.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\")}f=d(f);try{return b.json?JSON.parse(f):f}catch(g){}}var b=c.cookie=function(n,m,r){if(m!==undefined){r=c.extend({},b.defaults,r);if(typeof r.expires==="number"){var o=r.expires,q=r.expires=new Date();q.setDate(q.getDate()+o)}m=b.json?JSON.stringify(m):String(m);return(document.cookie=[b.raw?n:encodeURIComponent(n),"=",b.raw?m:encodeURIComponent(m),r.expires?"; expires="+r.expires.toUTCString():"",r.path?"; path="+r.path:"",r.domain?"; domain="+r.domain:"",r.secure?"; secure":""].join(""))}var s=n?undefined:{};var p=document.cookie?document.cookie.split("; "):[];for(var k=0,h=p.length;k<h;k++){var j=p[k].split("=");var f=d(j.shift());var g=j.join("=");if(n&&n===f){s=e(g);break}if(!n&&(g=e(g))!==undefined){s[f]=g}}return s};b.defaults={};c.removeCookie=function(g,f){if(c.cookie(g)!==undefined){c.cookie(g,"",c.extend({},f,{expires:-1}));return true}return false}}));
\ No newline at end of file
diff --git a/js/extlib/jquery.form.min.js b/js/extlib/jquery.form.min.js
deleted file mode 100644 (file)
index 9f9068b..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-/*
-* jQuery Form Plugin; v20130903
-* http://jquery.malsup.com/form/
-* Copyright (c) 2013 M. Alsup; Dual licensed: MIT/GPL
-* https://github.com/malsup/form#copyright-and-license
-*/
-;(function(e){"use strict";function t(t){var r=t.data;t.isDefaultPrevented()||(t.preventDefault(),e(this).ajaxSubmit(r))}function r(t){var r=t.target,a=e(r);if(!a.is("[type=submit],[type=image]")){var n=a.closest("[type=submit]");if(0===n.length)return;r=n[0]}var i=this;if(i.clk=r,"image"==r.type)if(void 0!==t.offsetX)i.clk_x=t.offsetX,i.clk_y=t.offsetY;else if("function"==typeof e.fn.offset){var o=a.offset();i.clk_x=t.pageX-o.left,i.clk_y=t.pageY-o.top}else i.clk_x=t.pageX-r.offsetLeft,i.clk_y=t.pageY-r.offsetTop;setTimeout(function(){i.clk=i.clk_x=i.clk_y=null},100)}function a(){if(e.fn.ajaxSubmit.debug){var t="[jquery.form] "+Array.prototype.join.call(arguments,"");window.console&&window.console.log?window.console.log(t):window.opera&&window.opera.postError&&window.opera.postError(t)}}var n={};n.fileapi=void 0!==e("<input type='file'/>").get(0).files,n.formdata=void 0!==window.FormData;var i=!!e.fn.prop;e.fn.attr2=function(){if(!i)return this.attr.apply(this,arguments);var e=this.prop.apply(this,arguments);return e&&e.jquery||"string"==typeof e?e:this.attr.apply(this,arguments)},e.fn.ajaxSubmit=function(t){function r(r){var a,n,i=e.param(r,t.traditional).split("&"),o=i.length,s=[];for(a=0;o>a;a++)i[a]=i[a].replace(/\+/g," "),n=i[a].split("="),s.push([decodeURIComponent(n[0]),decodeURIComponent(n[1])]);return s}function o(a){for(var n=new FormData,i=0;a.length>i;i++)n.append(a[i].name,a[i].value);if(t.extraData){var o=r(t.extraData);for(i=0;o.length>i;i++)o[i]&&n.append(o[i][0],o[i][1])}t.data=null;var s=e.extend(!0,{},e.ajaxSettings,t,{contentType:!1,processData:!1,cache:!1,type:u||"POST"});t.uploadProgress&&(s.xhr=function(){var r=e.ajaxSettings.xhr();return r.upload&&r.upload.addEventListener("progress",function(e){var r=0,a=e.loaded||e.position,n=e.total;e.lengthComputable&&(r=Math.ceil(100*(a/n))),t.uploadProgress(e,a,n,r)},!1),r}),s.data=null;var l=s.beforeSend;return s.beforeSend=function(e,t){t.data=n,l&&l.call(this,e,t)},e.ajax(s)}function s(r){function n(e){var t=null;try{e.contentWindow&&(t=e.contentWindow.document)}catch(r){a("cannot get iframe.contentWindow document: "+r)}if(t)return t;try{t=e.contentDocument?e.contentDocument:e.document}catch(r){a("cannot get iframe.contentDocument: "+r),t=e.document}return t}function o(){function t(){try{var e=n(g).readyState;a("state = "+e),e&&"uninitialized"==e.toLowerCase()&&setTimeout(t,50)}catch(r){a("Server abort: ",r," (",r.name,")"),s(D),j&&clearTimeout(j),j=void 0}}var r=f.attr2("target"),i=f.attr2("action");w.setAttribute("target",d),(!u||/post/i.test(u))&&w.setAttribute("method","POST"),i!=m.url&&w.setAttribute("action",m.url),m.skipEncodingOverride||u&&!/post/i.test(u)||f.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"}),m.timeout&&(j=setTimeout(function(){T=!0,s(k)},m.timeout));var o=[];try{if(m.extraData)for(var l in m.extraData)m.extraData.hasOwnProperty(l)&&(e.isPlainObject(m.extraData[l])&&m.extraData[l].hasOwnProperty("name")&&m.extraData[l].hasOwnProperty("value")?o.push(e('<input type="hidden" name="'+m.extraData[l].name+'">').val(m.extraData[l].value).appendTo(w)[0]):o.push(e('<input type="hidden" name="'+l+'">').val(m.extraData[l]).appendTo(w)[0]));m.iframeTarget||v.appendTo("body"),g.attachEvent?g.attachEvent("onload",s):g.addEventListener("load",s,!1),setTimeout(t,15);try{w.submit()}catch(c){var p=document.createElement("form").submit;p.apply(w)}}finally{w.setAttribute("action",i),r?w.setAttribute("target",r):f.removeAttr("target"),e(o).remove()}}function s(t){if(!x.aborted&&!F){if(M=n(g),M||(a("cannot access response document"),t=D),t===k&&x)return x.abort("timeout"),S.reject(x,"timeout"),void 0;if(t==D&&x)return x.abort("server abort"),S.reject(x,"error","server abort"),void 0;if(M&&M.location.href!=m.iframeSrc||T){g.detachEvent?g.detachEvent("onload",s):g.removeEventListener("load",s,!1);var r,i="success";try{if(T)throw"timeout";var o="xml"==m.dataType||M.XMLDocument||e.isXMLDoc(M);if(a("isXml="+o),!o&&window.opera&&(null===M.body||!M.body.innerHTML)&&--O)return a("requeing onLoad callback, DOM not available"),setTimeout(s,250),void 0;var u=M.body?M.body:M.documentElement;x.responseText=u?u.innerHTML:null,x.responseXML=M.XMLDocument?M.XMLDocument:M,o&&(m.dataType="xml"),x.getResponseHeader=function(e){var t={"content-type":m.dataType};return t[e.toLowerCase()]},u&&(x.status=Number(u.getAttribute("status"))||x.status,x.statusText=u.getAttribute("statusText")||x.statusText);var l=(m.dataType||"").toLowerCase(),c=/(json|script|text)/.test(l);if(c||m.textarea){var f=M.getElementsByTagName("textarea")[0];if(f)x.responseText=f.value,x.status=Number(f.getAttribute("status"))||x.status,x.statusText=f.getAttribute("statusText")||x.statusText;else if(c){var d=M.getElementsByTagName("pre")[0],h=M.getElementsByTagName("body")[0];d?x.responseText=d.textContent?d.textContent:d.innerText:h&&(x.responseText=h.textContent?h.textContent:h.innerText)}}else"xml"==l&&!x.responseXML&&x.responseText&&(x.responseXML=X(x.responseText));try{E=_(x,l,m)}catch(b){i="parsererror",x.error=r=b||i}}catch(b){a("error caught: ",b),i="error",x.error=r=b||i}x.aborted&&(a("upload aborted"),i=null),x.status&&(i=x.status>=200&&300>x.status||304===x.status?"success":"error"),"success"===i?(m.success&&m.success.call(m.context,E,"success",x),S.resolve(x.responseText,"success",x),p&&e.event.trigger("ajaxSuccess",[x,m])):i&&(void 0===r&&(r=x.statusText),m.error&&m.error.call(m.context,x,i,r),S.reject(x,"error",r),p&&e.event.trigger("ajaxError",[x,m,r])),p&&e.event.trigger("ajaxComplete",[x,m]),p&&!--e.active&&e.event.trigger("ajaxStop"),m.complete&&m.complete.call(m.context,x,i),F=!0,m.timeout&&clearTimeout(j),setTimeout(function(){m.iframeTarget?v.attr("src",m.iframeSrc):v.remove(),x.responseXML=null},100)}}}var l,c,m,p,d,v,g,x,b,y,T,j,w=f[0],S=e.Deferred();if(S.abort=function(e){x.abort(e)},r)for(c=0;h.length>c;c++)l=e(h[c]),i?l.prop("disabled",!1):l.removeAttr("disabled");if(m=e.extend(!0,{},e.ajaxSettings,t),m.context=m.context||m,d="jqFormIO"+(new Date).getTime(),m.iframeTarget?(v=e(m.iframeTarget),y=v.attr2("name"),y?d=y:v.attr2("name",d)):(v=e('<iframe name="'+d+'" src="'+m.iframeSrc+'" />'),v.css({position:"absolute",top:"-1000px",left:"-1000px"})),g=v[0],x={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(t){var r="timeout"===t?"timeout":"aborted";a("aborting upload... "+r),this.aborted=1;try{g.contentWindow.document.execCommand&&g.contentWindow.document.execCommand("Stop")}catch(n){}v.attr("src",m.iframeSrc),x.error=r,m.error&&m.error.call(m.context,x,r,t),p&&e.event.trigger("ajaxError",[x,m,r]),m.complete&&m.complete.call(m.context,x,r)}},p=m.global,p&&0===e.active++&&e.event.trigger("ajaxStart"),p&&e.event.trigger("ajaxSend",[x,m]),m.beforeSend&&m.beforeSend.call(m.context,x,m)===!1)return m.global&&e.active--,S.reject(),S;if(x.aborted)return S.reject(),S;b=w.clk,b&&(y=b.name,y&&!b.disabled&&(m.extraData=m.extraData||{},m.extraData[y]=b.value,"image"==b.type&&(m.extraData[y+".x"]=w.clk_x,m.extraData[y+".y"]=w.clk_y)));var k=1,D=2,A=e("meta[name=csrf-token]").attr("content"),L=e("meta[name=csrf-param]").attr("content");L&&A&&(m.extraData=m.extraData||{},m.extraData[L]=A),m.forceSync?o():setTimeout(o,10);var E,M,F,O=50,X=e.parseXML||function(e,t){return window.ActiveXObject?(t=new ActiveXObject("Microsoft.XMLDOM"),t.async="false",t.loadXML(e)):t=(new DOMParser).parseFromString(e,"text/xml"),t&&t.documentElement&&"parsererror"!=t.documentElement.nodeName?t:null},C=e.parseJSON||function(e){return window.eval("("+e+")")},_=function(t,r,a){var n=t.getResponseHeader("content-type")||"",i="xml"===r||!r&&n.indexOf("xml")>=0,o=i?t.responseXML:t.responseText;return i&&"parsererror"===o.documentElement.nodeName&&e.error&&e.error("parsererror"),a&&a.dataFilter&&(o=a.dataFilter(o,r)),"string"==typeof o&&("json"===r||!r&&n.indexOf("json")>=0?o=C(o):("script"===r||!r&&n.indexOf("javascript")>=0)&&e.globalEval(o)),o};return S}if(!this.length)return a("ajaxSubmit: skipping submit process - no element selected"),this;var u,l,c,f=this;"function"==typeof t?t={success:t}:void 0===t&&(t={}),u=t.type||this.attr2("method"),l=t.url||this.attr2("action"),c="string"==typeof l?e.trim(l):"",c=c||window.location.href||"",c&&(c=(c.match(/^([^#]+)/)||[])[1]),t=e.extend(!0,{url:c,success:e.ajaxSettings.success,type:u||e.ajaxSettings.type,iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},t);var m={};if(this.trigger("form-pre-serialize",[this,t,m]),m.veto)return a("ajaxSubmit: submit vetoed via form-pre-serialize trigger"),this;if(t.beforeSerialize&&t.beforeSerialize(this,t)===!1)return a("ajaxSubmit: submit aborted via beforeSerialize callback"),this;var p=t.traditional;void 0===p&&(p=e.ajaxSettings.traditional);var d,h=[],v=this.formToArray(t.semantic,h);if(t.data&&(t.extraData=t.data,d=e.param(t.data,p)),t.beforeSubmit&&t.beforeSubmit(v,this,t)===!1)return a("ajaxSubmit: submit aborted via beforeSubmit callback"),this;if(this.trigger("form-submit-validate",[v,this,t,m]),m.veto)return a("ajaxSubmit: submit vetoed via form-submit-validate trigger"),this;var g=e.param(v,p);d&&(g=g?g+"&"+d:d),"GET"==t.type.toUpperCase()?(t.url+=(t.url.indexOf("?")>=0?"&":"?")+g,t.data=null):t.data=g;var x=[];if(t.resetForm&&x.push(function(){f.resetForm()}),t.clearForm&&x.push(function(){f.clearForm(t.includeHidden)}),!t.dataType&&t.target){var b=t.success||function(){};x.push(function(r){var a=t.replaceTarget?"replaceWith":"html";e(t.target)[a](r).each(b,arguments)})}else t.success&&x.push(t.success);if(t.success=function(e,r,a){for(var n=t.context||this,i=0,o=x.length;o>i;i++)x[i].apply(n,[e,r,a||f,f])},t.error){var y=t.error;t.error=function(e,r,a){var n=t.context||this;y.apply(n,[e,r,a,f])}}if(t.complete){var T=t.complete;t.complete=function(e,r){var a=t.context||this;T.apply(a,[e,r,f])}}var j=e("input[type=file]:enabled",this).filter(function(){return""!=e(this).val()}),w=j.length>0,S="multipart/form-data",k=f.attr("enctype")==S||f.attr("encoding")==S,D=n.fileapi&&n.formdata;a("fileAPI :"+D);var A,L=(w||k)&&!D;t.iframe!==!1&&(t.iframe||L)?t.closeKeepAlive?e.get(t.closeKeepAlive,function(){A=s(v)}):A=s(v):A=(w||k)&&D?o(v):e.ajax(t),f.removeData("jqxhr").data("jqxhr",A);for(var E=0;h.length>E;E++)h[E]=null;return this.trigger("form-submit-notify",[this,t]),this},e.fn.ajaxForm=function(n){if(n=n||{},n.delegation=n.delegation&&e.isFunction(e.fn.on),!n.delegation&&0===this.length){var i={s:this.selector,c:this.context};return!e.isReady&&i.s?(a("DOM not ready, queuing ajaxForm"),e(function(){e(i.s,i.c).ajaxForm(n)}),this):(a("terminating; zero elements found by selector"+(e.isReady?"":" (DOM not ready)")),this)}return n.delegation?(e(document).off("submit.form-plugin",this.selector,t).off("click.form-plugin",this.selector,r).on("submit.form-plugin",this.selector,n,t).on("click.form-plugin",this.selector,n,r),this):this.ajaxFormUnbind().bind("submit.form-plugin",n,t).bind("click.form-plugin",n,r)},e.fn.ajaxFormUnbind=function(){return this.unbind("submit.form-plugin click.form-plugin")},e.fn.formToArray=function(t,r){var a=[];if(0===this.length)return a;var i=this[0],o=t?i.getElementsByTagName("*"):i.elements;if(!o)return a;var s,u,l,c,f,m,p;for(s=0,m=o.length;m>s;s++)if(f=o[s],l=f.name,l&&!f.disabled)if(t&&i.clk&&"image"==f.type)i.clk==f&&(a.push({name:l,value:e(f).val(),type:f.type}),a.push({name:l+".x",value:i.clk_x},{name:l+".y",value:i.clk_y}));else if(c=e.fieldValue(f,!0),c&&c.constructor==Array)for(r&&r.push(f),u=0,p=c.length;p>u;u++)a.push({name:l,value:c[u]});else if(n.fileapi&&"file"==f.type){r&&r.push(f);var d=f.files;if(d.length)for(u=0;d.length>u;u++)a.push({name:l,value:d[u],type:f.type});else a.push({name:l,value:"",type:f.type})}else null!==c&&c!==void 0&&(r&&r.push(f),a.push({name:l,value:c,type:f.type,required:f.required}));if(!t&&i.clk){var h=e(i.clk),v=h[0];l=v.name,l&&!v.disabled&&"image"==v.type&&(a.push({name:l,value:h.val()}),a.push({name:l+".x",value:i.clk_x},{name:l+".y",value:i.clk_y}))}return a},e.fn.formSerialize=function(t){return e.param(this.formToArray(t))},e.fn.fieldSerialize=function(t){var r=[];return this.each(function(){var a=this.name;if(a){var n=e.fieldValue(this,t);if(n&&n.constructor==Array)for(var i=0,o=n.length;o>i;i++)r.push({name:a,value:n[i]});else null!==n&&n!==void 0&&r.push({name:this.name,value:n})}}),e.param(r)},e.fn.fieldValue=function(t){for(var r=[],a=0,n=this.length;n>a;a++){var i=this[a],o=e.fieldValue(i,t);null===o||void 0===o||o.constructor==Array&&!o.length||(o.constructor==Array?e.merge(r,o):r.push(o))}return r},e.fieldValue=function(t,r){var a=t.name,n=t.type,i=t.tagName.toLowerCase();if(void 0===r&&(r=!0),r&&(!a||t.disabled||"reset"==n||"button"==n||("checkbox"==n||"radio"==n)&&!t.checked||("submit"==n||"image"==n)&&t.form&&t.form.clk!=t||"select"==i&&-1==t.selectedIndex))return null;if("select"==i){var o=t.selectedIndex;if(0>o)return null;for(var s=[],u=t.options,l="select-one"==n,c=l?o+1:u.length,f=l?o:0;c>f;f++){var m=u[f];if(m.selected){var p=m.value;if(p||(p=m.attributes&&m.attributes.value&&!m.attributes.value.specified?m.text:m.value),l)return p;s.push(p)}}return s}return e(t).val()},e.fn.clearForm=function(t){return this.each(function(){e("input,select,textarea",this).clearFields(t)})},e.fn.clearFields=e.fn.clearInputs=function(t){var r=/^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i;return this.each(function(){var a=this.type,n=this.tagName.toLowerCase();r.test(a)||"textarea"==n?this.value="":"checkbox"==a||"radio"==a?this.checked=!1:"select"==n?this.selectedIndex=-1:"file"==a?/MSIE/.test(navigator.userAgent)?e(this).replaceWith(e(this).clone(!0)):e(this).val(""):t&&(t===!0&&/hidden/.test(a)||"string"==typeof t&&e(this).is(t))&&(this.value="")})},e.fn.resetForm=function(){return this.each(function(){("function"==typeof this.reset||"object"==typeof this.reset&&!this.reset.nodeType)&&this.reset()})},e.fn.enable=function(e){return void 0===e&&(e=!0),this.each(function(){this.disabled=!e})},e.fn.selected=function(t){return void 0===t&&(t=!0),this.each(function(){var r=this.type;if("checkbox"==r||"radio"==r)this.checked=t;else if("option"==this.tagName.toLowerCase()){var a=e(this).parent("select");t&&a[0]&&"select-one"==a[0].type&&a.find("option").selected(!1),this.selected=t}})},e.fn.ajaxSubmit.debug=!1})("undefined"!=typeof jQuery?jQuery:window.Zepto);
\ No newline at end of file
diff --git a/js/extlib/jquery.infieldlabel.min.js b/js/extlib/jquery.infieldlabel.min.js
deleted file mode 100644 (file)
index 2f6e48b..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-/**
- * In-Field Label jQuery Plugin v0.2.1
- * http://fuelyourcoding.com/scripts/infield.html
- * http://github.com/streetpc/jquery-infieldlabels
- *
- * Copyright (c) 2009 Doug Neiner, Adrien Lavoillotte
- * Dual licensed under the MIT and GPL licenses, see:
- * http://docs.jquery.com/License
- */
-(function(f){var d=0,a=1,b=2,g=/^(?:text|password|search|number|tel|url|email|date(?:time(?:-local)?)?|time|month|week)?$/,c=function(i,h){return(i<<3)|h},e={};e[c(a,d)]=function(h){h.fadeTo(1)};e[c(b,d)]=function(h){h.$label.css({opacity:1}).show();h.emptied(true)};e[c(d,a)]=function(h){h.fadeTo(h.options.fadeOpacity)};e[c(b,a)]=function(h){h.$label.css({opacity:h.options.fadeOpacity}).show();h.emptied(true)};e[c(d,b)]=function(h){h.$label.hide();h.emptied(false)};e[c(a,b)]=e[c(d,b)];f.InFieldLabels=function(i,k,h){var j=this;j.$label=f(i);j.label=i;j.$field=f(k);j.field=k;j.$label.data("InFieldLabels",j);j.state=d;j.init=function(){j.options=f.extend({},f.InFieldLabels.defaultOptions,h);if(j.options.labelClass){j.$label.addClass(j.options.labelClass)}if(j.options.disableAutocomplete){j.$field.attr("autocomplete","off")}j.$field.bind("blur focus change keyup.infield cut",j.updateState).bind("paste",function(l){j.setState(b)});j.updateState()};j.emptied=function(l){if(!j.options.emptyWatch){if(l){j.$field.bind("keyup.infield",j.updateState)}else{j.$field.unbind("keyup.infield",j.updateState)}}};j.fadeTo=function(l){if(!j.options.fadeDuration){j.$label.css({opacity:l})}else{j.$label.stop().animate({opacity:l},j.options.fadeDuration)}};j.updateState=function(o,m){var n=b;if(j.field.value===""){var l=o&&o.type;if(l==="focus"||l==="keyup"){l=true}else{if(l==="blur"||l==="change"){l=false}else{l=j.$field.is(":focus")}}n=l?a:d}j.setState(n,m)};j.setState=function(m,l){if(m===j.state){return}var n=e[c(j.state,m)];if(typeof n==="function"){n(j);j.state=m}else{l||j.updateState(null,true)}};j.init()};f.InFieldLabels.defaultOptions={emptyWatch:true,disableAutocomplete:true,fadeOpacity:0.5,fadeDuration:300,labelClass:"in-field"};f.fn.inFieldLabels=function(h){return this.each(function(){if(this.tagName!=="LABEL"){return}var k=this.getAttribute("for")||this.htmlFor,j,i=true;if(!k){return}j=document.getElementById(k);if(!j){return}if(j.tagName==="INPUT"){i=g.test(j.type.toLowerCase())}else{if(j.tagName!=="TEXTAREA"){i=false}}i=i&&!j.getAttribute("placeholder");if(!i){return}(new f.InFieldLabels(this,j,h))})}}(jQuery));
\ No newline at end of file
diff --git a/js/extlib/jquery.min.js b/js/extlib/jquery.min.js
deleted file mode 100644 (file)
index 2be209d..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-/*! jQuery v2.0.3 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license
-//@ sourceMappingURL=jquery-2.0.3.min.map
-*/
-(function(e,undefined){var t,n,r=typeof undefined,i=e.location,o=e.document,s=o.documentElement,a=e.jQuery,u=e.$,l={},c=[],p="2.0.3",f=c.concat,h=c.push,d=c.slice,g=c.indexOf,m=l.toString,y=l.hasOwnProperty,v=p.trim,x=function(e,n){return new x.fn.init(e,n,t)},b=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,w=/\S+/g,T=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,k=/^-ms-/,N=/-([\da-z])/gi,E=function(e,t){return t.toUpperCase()},S=function(){o.removeEventListener("DOMContentLoaded",S,!1),e.removeEventListener("load",S,!1),x.ready()};x.fn=x.prototype={jquery:p,constructor:x,init:function(e,t,n){var r,i;if(!e)return this;if("string"==typeof e){if(r="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:T.exec(e),!r||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof x?t[0]:t,x.merge(this,x.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:o,!0)),C.test(r[1])&&x.isPlainObject(t))for(r in t)x.isFunction(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return i=o.getElementById(r[2]),i&&i.parentNode&&(this.length=1,this[0]=i),this.context=o,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):x.isFunction(e)?n.ready(e):(e.selector!==undefined&&(this.selector=e.selector,this.context=e.context),x.makeArray(e,this))},selector:"",length:0,toArray:function(){return d.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=x.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return x.each(this,e,t)},ready:function(e){return x.ready.promise().done(e),this},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(x.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:h,sort:[].sort,splice:[].splice},x.fn.init.prototype=x.fn,x.extend=x.fn.extend=function(){var e,t,n,r,i,o,s=arguments[0]||{},a=1,u=arguments.length,l=!1;for("boolean"==typeof s&&(l=s,s=arguments[1]||{},a=2),"object"==typeof s||x.isFunction(s)||(s={}),u===a&&(s=this,--a);u>a;a++)if(null!=(e=arguments[a]))for(t in e)n=s[t],r=e[t],s!==r&&(l&&r&&(x.isPlainObject(r)||(i=x.isArray(r)))?(i?(i=!1,o=n&&x.isArray(n)?n:[]):o=n&&x.isPlainObject(n)?n:{},s[t]=x.extend(l,o,r)):r!==undefined&&(s[t]=r));return s},x.extend({expando:"jQuery"+(p+Math.random()).replace(/\D/g,""),noConflict:function(t){return e.$===x&&(e.$=u),t&&e.jQuery===x&&(e.jQuery=a),x},isReady:!1,readyWait:1,holdReady:function(e){e?x.readyWait++:x.ready(!0)},ready:function(e){(e===!0?--x.readyWait:x.isReady)||(x.isReady=!0,e!==!0&&--x.readyWait>0||(n.resolveWith(o,[x]),x.fn.trigger&&x(o).trigger("ready").off("ready")))},isFunction:function(e){return"function"===x.type(e)},isArray:Array.isArray,isWindow:function(e){return null!=e&&e===e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[m.call(e)]||"object":typeof e},isPlainObject:function(e){if("object"!==x.type(e)||e.nodeType||x.isWindow(e))return!1;try{if(e.constructor&&!y.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(t){return!1}return!0},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||o;var r=C.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=x.buildFragment([e],t,i),i&&x(i).remove(),x.merge([],r.childNodes))},parseJSON:JSON.parse,parseXML:function(e){var t,n;if(!e||"string"!=typeof e)return null;try{n=new DOMParser,t=n.parseFromString(e,"text/xml")}catch(r){t=undefined}return(!t||t.getElementsByTagName("parsererror").length)&&x.error("Invalid XML: "+e),t},noop:function(){},globalEval:function(e){var t,n=eval;e=x.trim(e),e&&(1===e.indexOf("use strict")?(t=o.createElement("script"),t.text=e,o.head.appendChild(t).parentNode.removeChild(t)):n(e))},camelCase:function(e){return e.replace(k,"ms-").replace(N,E)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,s=j(e);if(n){if(s){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(s){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:function(e){return null==e?"":v.call(e)},makeArray:function(e,t){var n=t||[];return null!=e&&(j(Object(e))?x.merge(n,"string"==typeof e?[e]:e):h.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:g.call(t,e,n)},merge:function(e,t){var n=t.length,r=e.length,i=0;if("number"==typeof n)for(;n>i;i++)e[r++]=t[i];else while(t[i]!==undefined)e[r++]=t[i++];return e.length=r,e},grep:function(e,t,n){var r,i=[],o=0,s=e.length;for(n=!!n;s>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,s=j(e),a=[];if(s)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(a[a.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(a[a.length]=r);return f.apply([],a)},guid:1,proxy:function(e,t){var n,r,i;return"string"==typeof t&&(n=e[t],t=e,e=n),x.isFunction(e)?(r=d.call(arguments,2),i=function(){return e.apply(t||this,r.concat(d.call(arguments)))},i.guid=e.guid=e.guid||x.guid++,i):undefined},access:function(e,t,n,r,i,o,s){var a=0,u=e.length,l=null==n;if("object"===x.type(n)){i=!0;for(a in n)x.access(e,t,a,n[a],!0,o,s)}else if(r!==undefined&&(i=!0,x.isFunction(r)||(s=!0),l&&(s?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(x(e),n)})),t))for(;u>a;a++)t(e[a],n,s?r:r.call(e[a],a,t(e[a],n)));return i?e:l?t.call(e):u?t(e[0],n):o},now:Date.now,swap:function(e,t,n,r){var i,o,s={};for(o in t)s[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=s[o];return i}}),x.ready.promise=function(t){return n||(n=x.Deferred(),"complete"===o.readyState?setTimeout(x.ready):(o.addEventListener("DOMContentLoaded",S,!1),e.addEventListener("load",S,!1))),n.promise(t)},x.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function j(e){var t=e.length,n=x.type(e);return x.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}t=x(o),function(e,undefined){var t,n,r,i,o,s,a,u,l,c,p,f,h,d,g,m,y,v="sizzle"+-new Date,b=e.document,w=0,T=0,C=st(),k=st(),N=st(),E=!1,S=function(e,t){return e===t?(E=!0,0):0},j=typeof undefined,D=1<<31,A={}.hasOwnProperty,L=[],q=L.pop,H=L.push,O=L.push,F=L.slice,P=L.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},R="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",W="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",$=W.replace("w","w#"),B="\\["+M+"*("+W+")"+M+"*(?:([*^$|!~]?=)"+M+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+$+")|)|)"+M+"*\\]",I=":("+W+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+B.replace(3,8)+")*)|.*)\\)|)",z=RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),_=RegExp("^"+M+"*,"+M+"*"),X=RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=RegExp(M+"*[+~]"),Y=RegExp("="+M+"*([^\\]'\"]*)"+M+"*\\]","g"),V=RegExp(I),G=RegExp("^"+$+"$"),J={ID:RegExp("^#("+W+")"),CLASS:RegExp("^\\.("+W+")"),TAG:RegExp("^("+W.replace("w","w*")+")"),ATTR:RegExp("^"+B),PSEUDO:RegExp("^"+I),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:RegExp("^(?:"+R+")$","i"),needsContext:RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Q=/^[^{]+\{\s*\[native \w/,K=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,Z=/^(?:input|select|textarea|button)$/i,et=/^h\d$/i,tt=/'|\\/g,nt=RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),rt=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:0>r?String.fromCharCode(r+65536):String.fromCharCode(55296|r>>10,56320|1023&r)};try{O.apply(L=F.call(b.childNodes),b.childNodes),L[b.childNodes.length].nodeType}catch(it){O={apply:L.length?function(e,t){H.apply(e,F.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function ot(e,t,r,i){var o,s,a,u,l,f,g,m,x,w;if((t?t.ownerDocument||t:b)!==p&&c(t),t=t||p,r=r||[],!e||"string"!=typeof e)return r;if(1!==(u=t.nodeType)&&9!==u)return[];if(h&&!i){if(o=K.exec(e))if(a=o[1]){if(9===u){if(s=t.getElementById(a),!s||!s.parentNode)return r;if(s.id===a)return r.push(s),r}else if(t.ownerDocument&&(s=t.ownerDocument.getElementById(a))&&y(t,s)&&s.id===a)return r.push(s),r}else{if(o[2])return O.apply(r,t.getElementsByTagName(e)),r;if((a=o[3])&&n.getElementsByClassName&&t.getElementsByClassName)return O.apply(r,t.getElementsByClassName(a)),r}if(n.qsa&&(!d||!d.test(e))){if(m=g=v,x=t,w=9===u&&e,1===u&&"object"!==t.nodeName.toLowerCase()){f=gt(e),(g=t.getAttribute("id"))?m=g.replace(tt,"\\$&"):t.setAttribute("id",m),m="[id='"+m+"'] ",l=f.length;while(l--)f[l]=m+mt(f[l]);x=U.test(e)&&t.parentNode||t,w=f.join(",")}if(w)try{return O.apply(r,x.querySelectorAll(w)),r}catch(T){}finally{g||t.removeAttribute("id")}}}return kt(e.replace(z,"$1"),t,r,i)}function st(){var e=[];function t(n,r){return e.push(n+=" ")>i.cacheLength&&delete t[e.shift()],t[n]=r}return t}function at(e){return e[v]=!0,e}function ut(e){var t=p.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function lt(e,t){var n=e.split("|"),r=e.length;while(r--)i.attrHandle[n[r]]=t}function ct(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||D)-(~e.sourceIndex||D);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function pt(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function ft(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function ht(e){return at(function(t){return t=+t,at(function(n,r){var i,o=e([],n.length,t),s=o.length;while(s--)n[i=o[s]]&&(n[i]=!(r[i]=n[i]))})})}s=ot.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},n=ot.support={},c=ot.setDocument=function(e){var t=e?e.ownerDocument||e:b,r=t.defaultView;return t!==p&&9===t.nodeType&&t.documentElement?(p=t,f=t.documentElement,h=!s(t),r&&r.attachEvent&&r!==r.top&&r.attachEvent("onbeforeunload",function(){c()}),n.attributes=ut(function(e){return e.className="i",!e.getAttribute("className")}),n.getElementsByTagName=ut(function(e){return e.appendChild(t.createComment("")),!e.getElementsByTagName("*").length}),n.getElementsByClassName=ut(function(e){return e.innerHTML="<div class='a'></div><div class='a i'></div>",e.firstChild.className="i",2===e.getElementsByClassName("i").length}),n.getById=ut(function(e){return f.appendChild(e).id=v,!t.getElementsByName||!t.getElementsByName(v).length}),n.getById?(i.find.ID=function(e,t){if(typeof t.getElementById!==j&&h){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},i.filter.ID=function(e){var t=e.replace(nt,rt);return function(e){return e.getAttribute("id")===t}}):(delete i.find.ID,i.filter.ID=function(e){var t=e.replace(nt,rt);return function(e){var n=typeof e.getAttributeNode!==j&&e.getAttributeNode("id");return n&&n.value===t}}),i.find.TAG=n.getElementsByTagName?function(e,t){return typeof t.getElementsByTagName!==j?t.getElementsByTagName(e):undefined}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},i.find.CLASS=n.getElementsByClassName&&function(e,t){return typeof t.getElementsByClassName!==j&&h?t.getElementsByClassName(e):undefined},g=[],d=[],(n.qsa=Q.test(t.querySelectorAll))&&(ut(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||d.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll(":checked").length||d.push(":checked")}),ut(function(e){var n=t.createElement("input");n.setAttribute("type","hidden"),e.appendChild(n).setAttribute("t",""),e.querySelectorAll("[t^='']").length&&d.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll(":enabled").length||d.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),d.push(",.*:")})),(n.matchesSelector=Q.test(m=f.webkitMatchesSelector||f.mozMatchesSelector||f.oMatchesSelector||f.msMatchesSelector))&&ut(function(e){n.disconnectedMatch=m.call(e,"div"),m.call(e,"[s!='']:x"),g.push("!=",I)}),d=d.length&&RegExp(d.join("|")),g=g.length&&RegExp(g.join("|")),y=Q.test(f.contains)||f.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},S=f.compareDocumentPosition?function(e,r){if(e===r)return E=!0,0;var i=r.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(r);return i?1&i||!n.sortDetached&&r.compareDocumentPosition(e)===i?e===t||y(b,e)?-1:r===t||y(b,r)?1:l?P.call(l,e)-P.call(l,r):0:4&i?-1:1:e.compareDocumentPosition?-1:1}:function(e,n){var r,i=0,o=e.parentNode,s=n.parentNode,a=[e],u=[n];if(e===n)return E=!0,0;if(!o||!s)return e===t?-1:n===t?1:o?-1:s?1:l?P.call(l,e)-P.call(l,n):0;if(o===s)return ct(e,n);r=e;while(r=r.parentNode)a.unshift(r);r=n;while(r=r.parentNode)u.unshift(r);while(a[i]===u[i])i++;return i?ct(a[i],u[i]):a[i]===b?-1:u[i]===b?1:0},t):p},ot.matches=function(e,t){return ot(e,null,null,t)},ot.matchesSelector=function(e,t){if((e.ownerDocument||e)!==p&&c(e),t=t.replace(Y,"='$1']"),!(!n.matchesSelector||!h||g&&g.test(t)||d&&d.test(t)))try{var r=m.call(e,t);if(r||n.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(i){}return ot(t,p,null,[e]).length>0},ot.contains=function(e,t){return(e.ownerDocument||e)!==p&&c(e),y(e,t)},ot.attr=function(e,t){(e.ownerDocument||e)!==p&&c(e);var r=i.attrHandle[t.toLowerCase()],o=r&&A.call(i.attrHandle,t.toLowerCase())?r(e,t,!h):undefined;return o===undefined?n.attributes||!h?e.getAttribute(t):(o=e.getAttributeNode(t))&&o.specified?o.value:null:o},ot.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},ot.uniqueSort=function(e){var t,r=[],i=0,o=0;if(E=!n.detectDuplicates,l=!n.sortStable&&e.slice(0),e.sort(S),E){while(t=e[o++])t===e[o]&&(i=r.push(o));while(i--)e.splice(r[i],1)}return e},o=ot.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=o(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=o(t);return n},i=ot.selectors={cacheLength:50,createPseudo:at,match:J,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(nt,rt),e[3]=(e[4]||e[5]||"").replace(nt,rt),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||ot.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&ot.error(e[0]),e},PSEUDO:function(e){var t,n=!e[5]&&e[2];return J.CHILD.test(e[0])?null:(e[3]&&e[4]!==undefined?e[2]=e[4]:n&&V.test(n)&&(t=gt(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(nt,rt).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=C[e+" "];return t||(t=RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&C(e,function(e){return t.test("string"==typeof e.className&&e.className||typeof e.getAttribute!==j&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=ot.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),s="last"!==e.slice(-4),a="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,p,f,h,d,g=o!==s?"nextSibling":"previousSibling",m=t.parentNode,y=a&&t.nodeName.toLowerCase(),x=!u&&!a;if(m){if(o){while(g){p=t;while(p=p[g])if(a?p.nodeName.toLowerCase()===y:1===p.nodeType)return!1;d=g="only"===e&&!d&&"nextSibling"}return!0}if(d=[s?m.firstChild:m.lastChild],s&&x){c=m[v]||(m[v]={}),l=c[e]||[],h=l[0]===w&&l[1],f=l[0]===w&&l[2],p=h&&m.childNodes[h];while(p=++h&&p&&p[g]||(f=h=0)||d.pop())if(1===p.nodeType&&++f&&p===t){c[e]=[w,h,f];break}}else if(x&&(l=(t[v]||(t[v]={}))[e])&&l[0]===w)f=l[1];else while(p=++h&&p&&p[g]||(f=h=0)||d.pop())if((a?p.nodeName.toLowerCase()===y:1===p.nodeType)&&++f&&(x&&((p[v]||(p[v]={}))[e]=[w,f]),p===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||ot.error("unsupported pseudo: "+e);return r[v]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?at(function(e,n){var i,o=r(e,t),s=o.length;while(s--)i=P.call(e,o[s]),e[i]=!(n[i]=o[s])}):function(e){return r(e,0,n)}):r}},pseudos:{not:at(function(e){var t=[],n=[],r=a(e.replace(z,"$1"));return r[v]?at(function(e,t,n,i){var o,s=r(e,null,i,[]),a=e.length;while(a--)(o=s[a])&&(e[a]=!(t[a]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:at(function(e){return function(t){return ot(e,t).length>0}}),contains:at(function(e){return function(t){return(t.textContent||t.innerText||o(t)).indexOf(e)>-1}}),lang:at(function(e){return G.test(e||"")||ot.error("unsupported lang: "+e),e=e.replace(nt,rt).toLowerCase(),function(t){var n;do if(n=h?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===f},focus:function(e){return e===p.activeElement&&(!p.hasFocus||p.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!i.pseudos.empty(e)},header:function(e){return et.test(e.nodeName)},input:function(e){return Z.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:ht(function(){return[0]}),last:ht(function(e,t){return[t-1]}),eq:ht(function(e,t,n){return[0>n?n+t:n]}),even:ht(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:ht(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:ht(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:ht(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}},i.pseudos.nth=i.pseudos.eq;for(t in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})i.pseudos[t]=pt(t);for(t in{submit:!0,reset:!0})i.pseudos[t]=ft(t);function dt(){}dt.prototype=i.filters=i.pseudos,i.setFilters=new dt;function gt(e,t){var n,r,o,s,a,u,l,c=k[e+" "];if(c)return t?0:c.slice(0);a=e,u=[],l=i.preFilter;while(a){(!n||(r=_.exec(a)))&&(r&&(a=a.slice(r[0].length)||a),u.push(o=[])),n=!1,(r=X.exec(a))&&(n=r.shift(),o.push({value:n,type:r[0].replace(z," ")}),a=a.slice(n.length));for(s in i.filter)!(r=J[s].exec(a))||l[s]&&!(r=l[s](r))||(n=r.shift(),o.push({value:n,type:s,matches:r}),a=a.slice(n.length));if(!n)break}return t?a.length:a?ot.error(e):k(e,u).slice(0)}function mt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function yt(e,t,n){var i=t.dir,o=n&&"parentNode"===i,s=T++;return t.first?function(t,n,r){while(t=t[i])if(1===t.nodeType||o)return e(t,n,r)}:function(t,n,a){var u,l,c,p=w+" "+s;if(a){while(t=t[i])if((1===t.nodeType||o)&&e(t,n,a))return!0}else while(t=t[i])if(1===t.nodeType||o)if(c=t[v]||(t[v]={}),(l=c[i])&&l[0]===p){if((u=l[1])===!0||u===r)return u===!0}else if(l=c[i]=[p],l[1]=e(t,n,a)||r,l[1]===!0)return!0}}function vt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function xt(e,t,n,r,i){var o,s=[],a=0,u=e.length,l=null!=t;for(;u>a;a++)(o=e[a])&&(!n||n(o,r,i))&&(s.push(o),l&&t.push(a));return s}function bt(e,t,n,r,i,o){return r&&!r[v]&&(r=bt(r)),i&&!i[v]&&(i=bt(i,o)),at(function(o,s,a,u){var l,c,p,f=[],h=[],d=s.length,g=o||Ct(t||"*",a.nodeType?[a]:a,[]),m=!e||!o&&t?g:xt(g,f,e,a,u),y=n?i||(o?e:d||r)?[]:s:m;if(n&&n(m,y,a,u),r){l=xt(y,h),r(l,[],a,u),c=l.length;while(c--)(p=l[c])&&(y[h[c]]=!(m[h[c]]=p))}if(o){if(i||e){if(i){l=[],c=y.length;while(c--)(p=y[c])&&l.push(m[c]=p);i(null,y=[],l,u)}c=y.length;while(c--)(p=y[c])&&(l=i?P.call(o,p):f[c])>-1&&(o[l]=!(s[l]=p))}}else y=xt(y===s?y.splice(d,y.length):y),i?i(null,s,y,u):O.apply(s,y)})}function wt(e){var t,n,r,o=e.length,s=i.relative[e[0].type],a=s||i.relative[" "],l=s?1:0,c=yt(function(e){return e===t},a,!0),p=yt(function(e){return P.call(t,e)>-1},a,!0),f=[function(e,n,r){return!s&&(r||n!==u)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;o>l;l++)if(n=i.relative[e[l].type])f=[yt(vt(f),n)];else{if(n=i.filter[e[l].type].apply(null,e[l].matches),n[v]){for(r=++l;o>r;r++)if(i.relative[e[r].type])break;return bt(l>1&&vt(f),l>1&&mt(e.slice(0,l-1).concat({value:" "===e[l-2].type?"*":""})).replace(z,"$1"),n,r>l&&wt(e.slice(l,r)),o>r&&wt(e=e.slice(r)),o>r&&mt(e))}f.push(n)}return vt(f)}function Tt(e,t){var n=0,o=t.length>0,s=e.length>0,a=function(a,l,c,f,h){var d,g,m,y=[],v=0,x="0",b=a&&[],T=null!=h,C=u,k=a||s&&i.find.TAG("*",h&&l.parentNode||l),N=w+=null==C?1:Math.random()||.1;for(T&&(u=l!==p&&l,r=n);null!=(d=k[x]);x++){if(s&&d){g=0;while(m=e[g++])if(m(d,l,c)){f.push(d);break}T&&(w=N,r=++n)}o&&((d=!m&&d)&&v--,a&&b.push(d))}if(v+=x,o&&x!==v){g=0;while(m=t[g++])m(b,y,l,c);if(a){if(v>0)while(x--)b[x]||y[x]||(y[x]=q.call(f));y=xt(y)}O.apply(f,y),T&&!a&&y.length>0&&v+t.length>1&&ot.uniqueSort(f)}return T&&(w=N,u=C),b};return o?at(a):a}a=ot.compile=function(e,t){var n,r=[],i=[],o=N[e+" "];if(!o){t||(t=gt(e)),n=t.length;while(n--)o=wt(t[n]),o[v]?r.push(o):i.push(o);o=N(e,Tt(i,r))}return o};function Ct(e,t,n){var r=0,i=t.length;for(;i>r;r++)ot(e,t[r],n);return n}function kt(e,t,r,o){var s,u,l,c,p,f=gt(e);if(!o&&1===f.length){if(u=f[0]=f[0].slice(0),u.length>2&&"ID"===(l=u[0]).type&&n.getById&&9===t.nodeType&&h&&i.relative[u[1].type]){if(t=(i.find.ID(l.matches[0].replace(nt,rt),t)||[])[0],!t)return r;e=e.slice(u.shift().value.length)}s=J.needsContext.test(e)?0:u.length;while(s--){if(l=u[s],i.relative[c=l.type])break;if((p=i.find[c])&&(o=p(l.matches[0].replace(nt,rt),U.test(u[0].type)&&t.parentNode||t))){if(u.splice(s,1),e=o.length&&mt(u),!e)return O.apply(r,o),r;break}}}return a(e,f)(o,t,!h,r,U.test(e)),r}n.sortStable=v.split("").sort(S).join("")===v,n.detectDuplicates=E,c(),n.sortDetached=ut(function(e){return 1&e.compareDocumentPosition(p.createElement("div"))}),ut(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||lt("type|href|height|width",function(e,t,n){return n?undefined:e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),n.attributes&&ut(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||lt("value",function(e,t,n){return n||"input"!==e.nodeName.toLowerCase()?undefined:e.defaultValue}),ut(function(e){return null==e.getAttribute("disabled")})||lt(R,function(e,t,n){var r;return n?undefined:(r=e.getAttributeNode(t))&&r.specified?r.value:e[t]===!0?t.toLowerCase():null}),x.find=ot,x.expr=ot.selectors,x.expr[":"]=x.expr.pseudos,x.unique=ot.uniqueSort,x.text=ot.getText,x.isXMLDoc=ot.isXML,x.contains=ot.contains}(e);var D={};function A(e){var t=D[e]={};return x.each(e.match(w)||[],function(e,n){t[n]=!0}),t}x.Callbacks=function(e){e="string"==typeof e?D[e]||A(e):x.extend({},e);var t,n,r,i,o,s,a=[],u=!e.once&&[],l=function(p){for(t=e.memory&&p,n=!0,s=i||0,i=0,o=a.length,r=!0;a&&o>s;s++)if(a[s].apply(p[0],p[1])===!1&&e.stopOnFalse){t=!1;break}r=!1,a&&(u?u.length&&l(u.shift()):t?a=[]:c.disable())},c={add:function(){if(a){var n=a.length;(function s(t){x.each(t,function(t,n){var r=x.type(n);"function"===r?e.unique&&c.has(n)||a.push(n):n&&n.length&&"string"!==r&&s(n)})})(arguments),r?o=a.length:t&&(i=n,l(t))}return this},remove:function(){return a&&x.each(arguments,function(e,t){var n;while((n=x.inArray(t,a,n))>-1)a.splice(n,1),r&&(o>=n&&o--,s>=n&&s--)}),this},has:function(e){return e?x.inArray(e,a)>-1:!(!a||!a.length)},empty:function(){return a=[],o=0,this},disable:function(){return a=u=t=undefined,this},disabled:function(){return!a},lock:function(){return u=undefined,t||c.disable(),this},locked:function(){return!u},fireWith:function(e,t){return!a||n&&!u||(t=t||[],t=[e,t.slice?t.slice():t],r?u.push(t):l(t)),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!n}};return c},x.extend({Deferred:function(e){var t=[["resolve","done",x.Callbacks("once memory"),"resolved"],["reject","fail",x.Callbacks("once memory"),"rejected"],["notify","progress",x.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return x.Deferred(function(n){x.each(t,function(t,o){var s=o[0],a=x.isFunction(e[t])&&e[t];i[o[1]](function(){var e=a&&a.apply(this,arguments);e&&x.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[s+"With"](this===r?n.promise():this,a?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?x.extend(e,r):r}},i={};return r.pipe=r.then,x.each(t,function(e,o){var s=o[2],a=o[3];r[o[1]]=s.add,a&&s.add(function(){n=a},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=s.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=d.call(arguments),r=n.length,i=1!==r||e&&x.isFunction(e.promise)?r:0,o=1===i?e:x.Deferred(),s=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?d.call(arguments):r,n===a?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},a,u,l;if(r>1)for(a=Array(r),u=Array(r),l=Array(r);r>t;t++)n[t]&&x.isFunction(n[t].promise)?n[t].promise().done(s(t,l,n)).fail(o.reject).progress(s(t,u,a)):--i;return i||o.resolveWith(l,n),o.promise()}}),x.support=function(t){var n=o.createElement("input"),r=o.createDocumentFragment(),i=o.createElement("div"),s=o.createElement("select"),a=s.appendChild(o.createElement("option"));return n.type?(n.type="checkbox",t.checkOn=""!==n.value,t.optSelected=a.selected,t.reliableMarginRight=!0,t.boxSizingReliable=!0,t.pixelPosition=!1,n.checked=!0,t.noCloneChecked=n.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!a.disabled,n=o.createElement("input"),n.value="t",n.type="radio",t.radioValue="t"===n.value,n.setAttribute("checked","t"),n.setAttribute("name","t"),r.appendChild(n),t.checkClone=r.cloneNode(!0).cloneNode(!0).lastChild.checked,t.focusinBubbles="onfocusin"in e,i.style.backgroundClip="content-box",i.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===i.style.backgroundClip,x(function(){var n,r,s="padding:0;margin:0;border:0;display:block;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box",a=o.getElementsByTagName("body")[0];a&&(n=o.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",a.appendChild(n).appendChild(i),i.innerHTML="",i.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%",x.swap(a,null!=a.style.zoom?{zoom:1}:{},function(){t.boxSizing=4===i.offsetWidth}),e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(i,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(i,null)||{width:"4px"}).width,r=i.appendChild(o.createElement("div")),r.style.cssText=i.style.cssText=s,r.style.marginRight=r.style.width="0",i.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),a.removeChild(n))}),t):t}({});var L,q,H=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,O=/([A-Z])/g;function F(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=x.expando+Math.random()}F.uid=1,F.accepts=function(e){return e.nodeType?1===e.nodeType||9===e.nodeType:!0},F.prototype={key:function(e){if(!F.accepts(e))return 0;var t={},n=e[this.expando];if(!n){n=F.uid++;try{t[this.expando]={value:n},Object.defineProperties(e,t)}catch(r){t[this.expando]=n,x.extend(e,t)}}return this.cache[n]||(this.cache[n]={}),n},set:function(e,t,n){var r,i=this.key(e),o=this.cache[i];if("string"==typeof t)o[t]=n;else if(x.isEmptyObject(o))x.extend(this.cache[i],t);else for(r in t)o[r]=t[r];return o},get:function(e,t){var n=this.cache[this.key(e)];return t===undefined?n:n[t]},access:function(e,t,n){var r;return t===undefined||t&&"string"==typeof t&&n===undefined?(r=this.get(e,t),r!==undefined?r:this.get(e,x.camelCase(t))):(this.set(e,t,n),n!==undefined?n:t)},remove:function(e,t){var n,r,i,o=this.key(e),s=this.cache[o];if(t===undefined)this.cache[o]={};else{x.isArray(t)?r=t.concat(t.map(x.camelCase)):(i=x.camelCase(t),t in s?r=[t,i]:(r=i,r=r in s?[r]:r.match(w)||[])),n=r.length;while(n--)delete s[r[n]]}},hasData:function(e){return!x.isEmptyObject(this.cache[e[this.expando]]||{})},discard:function(e){e[this.expando]&&delete this.cache[e[this.expando]]}},L=new F,q=new F,x.extend({acceptData:F.accepts,hasData:function(e){return L.hasData(e)||q.hasData(e)},data:function(e,t,n){return L.access(e,t,n)},removeData:function(e,t){L.remove(e,t)},_data:function(e,t,n){return q.access(e,t,n)},_removeData:function(e,t){q.remove(e,t)}}),x.fn.extend({data:function(e,t){var n,r,i=this[0],o=0,s=null;if(e===undefined){if(this.length&&(s=L.get(i),1===i.nodeType&&!q.get(i,"hasDataAttrs"))){for(n=i.attributes;n.length>o;o++)r=n[o].name,0===r.indexOf("data-")&&(r=x.camelCase(r.slice(5)),P(i,r,s[r]));q.set(i,"hasDataAttrs",!0)}return s}return"object"==typeof e?this.each(function(){L.set(this,e)}):x.access(this,function(t){var n,r=x.camelCase(e);if(i&&t===undefined){if(n=L.get(i,e),n!==undefined)return n;if(n=L.get(i,r),n!==undefined)return n;if(n=P(i,r,undefined),n!==undefined)return n}else this.each(function(){var n=L.get(this,r);L.set(this,r,t),-1!==e.indexOf("-")&&n!==undefined&&L.set(this,e,t)})},null,t,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){L.remove(this,e)})}});function P(e,t,n){var r;if(n===undefined&&1===e.nodeType)if(r="data-"+t.replace(O,"-$1").toLowerCase(),n=e.getAttribute(r),"string"==typeof n){try{n="true"===n?!0:"false"===n?!1:"null"===n?null:+n+""===n?+n:H.test(n)?JSON.parse(n):n}catch(i){}L.set(e,t,n)}else n=undefined;return n}x.extend({queue:function(e,t,n){var r;return e?(t=(t||"fx")+"queue",r=q.get(e,t),n&&(!r||x.isArray(n)?r=q.access(e,t,x.makeArray(n)):r.push(n)),r||[]):undefined},dequeue:function(e,t){t=t||"fx";var n=x.queue(e,t),r=n.length,i=n.shift(),o=x._queueHooks(e,t),s=function(){x.dequeue(e,t)
-};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,s,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return q.get(e,n)||q.access(e,n,{empty:x.Callbacks("once memory").add(function(){q.remove(e,[t+"queue",n])})})}}),x.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),n>arguments.length?x.queue(this[0],e):t===undefined?this:this.each(function(){var n=x.queue(this,e,t);x._queueHooks(this,e),"fx"===e&&"inprogress"!==n[0]&&x.dequeue(this,e)})},dequeue:function(e){return this.each(function(){x.dequeue(this,e)})},delay:function(e,t){return e=x.fx?x.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=x.Deferred(),o=this,s=this.length,a=function(){--r||i.resolveWith(o,[o])};"string"!=typeof e&&(t=e,e=undefined),e=e||"fx";while(s--)n=q.get(o[s],e+"queueHooks"),n&&n.empty&&(r++,n.empty.add(a));return a(),i.promise(t)}});var R,M,W=/[\t\r\n\f]/g,$=/\r/g,B=/^(?:input|select|textarea|button)$/i;x.fn.extend({attr:function(e,t){return x.access(this,x.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){x.removeAttr(this,e)})},prop:function(e,t){return x.access(this,x.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[x.propFix[e]||e]})},addClass:function(e){var t,n,r,i,o,s=0,a=this.length,u="string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).addClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];a>s;s++)if(n=this[s],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(W," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=x.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,s=0,a=this.length,u=0===arguments.length||"string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).removeClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];a>s;s++)if(n=this[s],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(W," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?x.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):x.isFunction(e)?this.each(function(n){x(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var t,i=0,o=x(this),s=e.match(w)||[];while(t=s[i++])o.hasClass(t)?o.removeClass(t):o.addClass(t)}else(n===r||"boolean"===n)&&(this.className&&q.set(this,"__className__",this.className),this.className=this.className||e===!1?"":q.get(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(W," ").indexOf(t)>=0)return!0;return!1},val:function(e){var t,n,r,i=this[0];{if(arguments.length)return r=x.isFunction(e),this.each(function(n){var i;1===this.nodeType&&(i=r?e.call(this,n,x(this).val()):e,null==i?i="":"number"==typeof i?i+="":x.isArray(i)&&(i=x.map(i,function(e){return null==e?"":e+""})),t=x.valHooks[this.type]||x.valHooks[this.nodeName.toLowerCase()],t&&"set"in t&&t.set(this,i,"value")!==undefined||(this.value=i))});if(i)return t=x.valHooks[i.type]||x.valHooks[i.nodeName.toLowerCase()],t&&"get"in t&&(n=t.get(i,"value"))!==undefined?n:(n=i.value,"string"==typeof n?n.replace($,""):null==n?"":n)}}}),x.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,s=o?null:[],a=o?i+1:r.length,u=0>i?a:o?i:0;for(;a>u;u++)if(n=r[u],!(!n.selected&&u!==i||(x.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&x.nodeName(n.parentNode,"optgroup"))){if(t=x(n).val(),o)return t;s.push(t)}return s},set:function(e,t){var n,r,i=e.options,o=x.makeArray(t),s=i.length;while(s--)r=i[s],(r.selected=x.inArray(x(r).val(),o)>=0)&&(n=!0);return n||(e.selectedIndex=-1),o}}},attr:function(e,t,n){var i,o,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return typeof e.getAttribute===r?x.prop(e,t,n):(1===s&&x.isXMLDoc(e)||(t=t.toLowerCase(),i=x.attrHooks[t]||(x.expr.match.bool.test(t)?M:R)),n===undefined?i&&"get"in i&&null!==(o=i.get(e,t))?o:(o=x.find.attr(e,t),null==o?undefined:o):null!==n?i&&"set"in i&&(o=i.set(e,n,t))!==undefined?o:(e.setAttribute(t,n+""),n):(x.removeAttr(e,t),undefined))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(w);if(o&&1===e.nodeType)while(n=o[i++])r=x.propFix[n]||n,x.expr.match.bool.test(n)&&(e[r]=!1),e.removeAttribute(n)},attrHooks:{type:{set:function(e,t){if(!x.support.radioValue&&"radio"===t&&x.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{"for":"htmlFor","class":"className"},prop:function(e,t,n){var r,i,o,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return o=1!==s||!x.isXMLDoc(e),o&&(t=x.propFix[t]||t,i=x.propHooks[t]),n!==undefined?i&&"set"in i&&(r=i.set(e,n,t))!==undefined?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){return e.hasAttribute("tabindex")||B.test(e.nodeName)||e.href?e.tabIndex:-1}}}}),M={set:function(e,t,n){return t===!1?x.removeAttr(e,n):e.setAttribute(n,n),n}},x.each(x.expr.match.bool.source.match(/\w+/g),function(e,t){var n=x.expr.attrHandle[t]||x.find.attr;x.expr.attrHandle[t]=function(e,t,r){var i=x.expr.attrHandle[t],o=r?undefined:(x.expr.attrHandle[t]=undefined)!=n(e,t,r)?t.toLowerCase():null;return x.expr.attrHandle[t]=i,o}}),x.support.optSelected||(x.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null}}),x.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){x.propFix[this.toLowerCase()]=this}),x.each(["radio","checkbox"],function(){x.valHooks[this]={set:function(e,t){return x.isArray(t)?e.checked=x.inArray(x(e).val(),t)>=0:undefined}},x.support.checkOn||(x.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var I=/^key/,z=/^(?:mouse|contextmenu)|click/,_=/^(?:focusinfocus|focusoutblur)$/,X=/^([^.]*)(?:\.(.+)|)$/;function U(){return!0}function Y(){return!1}function V(){try{return o.activeElement}catch(e){}}x.event={global:{},add:function(e,t,n,i,o){var s,a,u,l,c,p,f,h,d,g,m,y=q.get(e);if(y){n.handler&&(s=n,n=s.handler,o=s.selector),n.guid||(n.guid=x.guid++),(l=y.events)||(l=y.events={}),(a=y.handle)||(a=y.handle=function(e){return typeof x===r||e&&x.event.triggered===e.type?undefined:x.event.dispatch.apply(a.elem,arguments)},a.elem=e),t=(t||"").match(w)||[""],c=t.length;while(c--)u=X.exec(t[c])||[],d=m=u[1],g=(u[2]||"").split(".").sort(),d&&(f=x.event.special[d]||{},d=(o?f.delegateType:f.bindType)||d,f=x.event.special[d]||{},p=x.extend({type:d,origType:m,data:i,handler:n,guid:n.guid,selector:o,needsContext:o&&x.expr.match.needsContext.test(o),namespace:g.join(".")},s),(h=l[d])||(h=l[d]=[],h.delegateCount=0,f.setup&&f.setup.call(e,i,g,a)!==!1||e.addEventListener&&e.addEventListener(d,a,!1)),f.add&&(f.add.call(e,p),p.handler.guid||(p.handler.guid=n.guid)),o?h.splice(h.delegateCount++,0,p):h.push(p),x.event.global[d]=!0);e=null}},remove:function(e,t,n,r,i){var o,s,a,u,l,c,p,f,h,d,g,m=q.hasData(e)&&q.get(e);if(m&&(u=m.events)){t=(t||"").match(w)||[""],l=t.length;while(l--)if(a=X.exec(t[l])||[],h=g=a[1],d=(a[2]||"").split(".").sort(),h){p=x.event.special[h]||{},h=(r?p.delegateType:p.bindType)||h,f=u[h]||[],a=a[2]&&RegExp("(^|\\.)"+d.join("\\.(?:.*\\.|)")+"(\\.|$)"),s=o=f.length;while(o--)c=f[o],!i&&g!==c.origType||n&&n.guid!==c.guid||a&&!a.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(f.splice(o,1),c.selector&&f.delegateCount--,p.remove&&p.remove.call(e,c));s&&!f.length&&(p.teardown&&p.teardown.call(e,d,m.handle)!==!1||x.removeEvent(e,h,m.handle),delete u[h])}else for(h in u)x.event.remove(e,h+t[l],n,r,!0);x.isEmptyObject(u)&&(delete m.handle,q.remove(e,"events"))}},trigger:function(t,n,r,i){var s,a,u,l,c,p,f,h=[r||o],d=y.call(t,"type")?t.type:t,g=y.call(t,"namespace")?t.namespace.split("."):[];if(a=u=r=r||o,3!==r.nodeType&&8!==r.nodeType&&!_.test(d+x.event.triggered)&&(d.indexOf(".")>=0&&(g=d.split("."),d=g.shift(),g.sort()),c=0>d.indexOf(":")&&"on"+d,t=t[x.expando]?t:new x.Event(d,"object"==typeof t&&t),t.isTrigger=i?2:3,t.namespace=g.join("."),t.namespace_re=t.namespace?RegExp("(^|\\.)"+g.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=undefined,t.target||(t.target=r),n=null==n?[t]:x.makeArray(n,[t]),f=x.event.special[d]||{},i||!f.trigger||f.trigger.apply(r,n)!==!1)){if(!i&&!f.noBubble&&!x.isWindow(r)){for(l=f.delegateType||d,_.test(l+d)||(a=a.parentNode);a;a=a.parentNode)h.push(a),u=a;u===(r.ownerDocument||o)&&h.push(u.defaultView||u.parentWindow||e)}s=0;while((a=h[s++])&&!t.isPropagationStopped())t.type=s>1?l:f.bindType||d,p=(q.get(a,"events")||{})[t.type]&&q.get(a,"handle"),p&&p.apply(a,n),p=c&&a[c],p&&x.acceptData(a)&&p.apply&&p.apply(a,n)===!1&&t.preventDefault();return t.type=d,i||t.isDefaultPrevented()||f._default&&f._default.apply(h.pop(),n)!==!1||!x.acceptData(r)||c&&x.isFunction(r[d])&&!x.isWindow(r)&&(u=r[c],u&&(r[c]=null),x.event.triggered=d,r[d](),x.event.triggered=undefined,u&&(r[c]=u)),t.result}},dispatch:function(e){e=x.event.fix(e);var t,n,r,i,o,s=[],a=d.call(arguments),u=(q.get(this,"events")||{})[e.type]||[],l=x.event.special[e.type]||{};if(a[0]=e,e.delegateTarget=this,!l.preDispatch||l.preDispatch.call(this,e)!==!1){s=x.event.handlers.call(this,e,u),t=0;while((i=s[t++])&&!e.isPropagationStopped()){e.currentTarget=i.elem,n=0;while((o=i.handlers[n++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(o.namespace))&&(e.handleObj=o,e.data=o.data,r=((x.event.special[o.origType]||{}).handle||o.handler).apply(i.elem,a),r!==undefined&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return l.postDispatch&&l.postDispatch.call(this,e),e.result}},handlers:function(e,t){var n,r,i,o,s=[],a=t.delegateCount,u=e.target;if(a&&u.nodeType&&(!e.button||"click"!==e.type))for(;u!==this;u=u.parentNode||this)if(u.disabled!==!0||"click"!==e.type){for(r=[],n=0;a>n;n++)o=t[n],i=o.selector+" ",r[i]===undefined&&(r[i]=o.needsContext?x(i,this).index(u)>=0:x.find(i,this,null,[u]).length),r[i]&&r.push(o);r.length&&s.push({elem:u,handlers:r})}return t.length>a&&s.push({elem:this,handlers:t.slice(a)}),s},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,t){var n,r,i,s=t.button;return null==e.pageX&&null!=t.clientX&&(n=e.target.ownerDocument||o,r=n.documentElement,i=n.body,e.pageX=t.clientX+(r&&r.scrollLeft||i&&i.scrollLeft||0)-(r&&r.clientLeft||i&&i.clientLeft||0),e.pageY=t.clientY+(r&&r.scrollTop||i&&i.scrollTop||0)-(r&&r.clientTop||i&&i.clientTop||0)),e.which||s===undefined||(e.which=1&s?1:2&s?3:4&s?2:0),e}},fix:function(e){if(e[x.expando])return e;var t,n,r,i=e.type,s=e,a=this.fixHooks[i];a||(this.fixHooks[i]=a=z.test(i)?this.mouseHooks:I.test(i)?this.keyHooks:{}),r=a.props?this.props.concat(a.props):this.props,e=new x.Event(s),t=r.length;while(t--)n=r[t],e[n]=s[n];return e.target||(e.target=o),3===e.target.nodeType&&(e.target=e.target.parentNode),a.filter?a.filter(e,s):e},special:{load:{noBubble:!0},focus:{trigger:function(){return this!==V()&&this.focus?(this.focus(),!1):undefined},delegateType:"focusin"},blur:{trigger:function(){return this===V()&&this.blur?(this.blur(),!1):undefined},delegateType:"focusout"},click:{trigger:function(){return"checkbox"===this.type&&this.click&&x.nodeName(this,"input")?(this.click(),!1):undefined},_default:function(e){return x.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){e.result!==undefined&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=x.extend(new x.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?x.event.trigger(i,null,t):x.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},x.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)},x.Event=function(e,t){return this instanceof x.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.getPreventDefault&&e.getPreventDefault()?U:Y):this.type=e,t&&x.extend(this,t),this.timeStamp=e&&e.timeStamp||x.now(),this[x.expando]=!0,undefined):new x.Event(e,t)},x.Event.prototype={isDefaultPrevented:Y,isPropagationStopped:Y,isImmediatePropagationStopped:Y,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=U,e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=U,e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=U,this.stopPropagation()}},x.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){x.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return(!i||i!==r&&!x.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),x.support.focusinBubbles||x.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){x.event.simulate(t,e.target,x.event.fix(e),!0)};x.event.special[t]={setup:function(){0===n++&&o.addEventListener(e,r,!0)},teardown:function(){0===--n&&o.removeEventListener(e,r,!0)}}}),x.fn.extend({on:function(e,t,n,r,i){var o,s;if("object"==typeof e){"string"!=typeof t&&(n=n||t,t=undefined);for(s in e)this.on(s,t,n,e[s],i);return this}if(null==n&&null==r?(r=t,n=t=undefined):null==r&&("string"==typeof t?(r=n,n=undefined):(r=n,n=t,t=undefined)),r===!1)r=Y;else if(!r)return this;return 1===i&&(o=r,r=function(e){return x().off(e),o.apply(this,arguments)},r.guid=o.guid||(o.guid=x.guid++)),this.each(function(){x.event.add(this,e,r,n,t)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,x(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"==typeof e){for(i in e)this.off(i,t,e[i]);return this}return(t===!1||"function"==typeof t)&&(n=t,t=undefined),n===!1&&(n=Y),this.each(function(){x.event.remove(this,e,n,t)})},trigger:function(e,t){return this.each(function(){x.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];return n?x.event.trigger(e,t,n,!0):undefined}});var G=/^.[^:#\[\.,]*$/,J=/^(?:parents|prev(?:Until|All))/,Q=x.expr.match.needsContext,K={children:!0,contents:!0,next:!0,prev:!0};x.fn.extend({find:function(e){var t,n=[],r=this,i=r.length;if("string"!=typeof e)return this.pushStack(x(e).filter(function(){for(t=0;i>t;t++)if(x.contains(r[t],this))return!0}));for(t=0;i>t;t++)x.find(e,r[t],n);return n=this.pushStack(i>1?x.unique(n):n),n.selector=this.selector?this.selector+" "+e:e,n},has:function(e){var t=x(e,this),n=t.length;return this.filter(function(){var e=0;for(;n>e;e++)if(x.contains(this,t[e]))return!0})},not:function(e){return this.pushStack(et(this,e||[],!0))},filter:function(e){return this.pushStack(et(this,e||[],!1))},is:function(e){return!!et(this,"string"==typeof e&&Q.test(e)?x(e):e||[],!1).length},closest:function(e,t){var n,r=0,i=this.length,o=[],s=Q.test(e)||"string"!=typeof e?x(e,t||this.context):0;for(;i>r;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(11>n.nodeType&&(s?s.index(n)>-1:1===n.nodeType&&x.find.matchesSelector(n,e))){n=o.push(n);break}return this.pushStack(o.length>1?x.unique(o):o)},index:function(e){return e?"string"==typeof e?g.call(x(e),this[0]):g.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?x(e,t):x.makeArray(e&&e.nodeType?[e]:e),r=x.merge(this.get(),n);return this.pushStack(x.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function Z(e,t){while((e=e[t])&&1!==e.nodeType);return e}x.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return x.dir(e,"parentNode")},parentsUntil:function(e,t,n){return x.dir(e,"parentNode",n)},next:function(e){return Z(e,"nextSibling")},prev:function(e){return Z(e,"previousSibling")},nextAll:function(e){return x.dir(e,"nextSibling")},prevAll:function(e){return x.dir(e,"previousSibling")},nextUntil:function(e,t,n){return x.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return x.dir(e,"previousSibling",n)},siblings:function(e){return x.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return x.sibling(e.firstChild)},contents:function(e){return e.contentDocument||x.merge([],e.childNodes)}},function(e,t){x.fn[e]=function(n,r){var i=x.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=x.filter(r,i)),this.length>1&&(K[e]||x.unique(i),J.test(e)&&i.reverse()),this.pushStack(i)}}),x.extend({filter:function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?x.find.matchesSelector(r,e)?[r]:[]:x.find.matches(e,x.grep(t,function(e){return 1===e.nodeType}))},dir:function(e,t,n){var r=[],i=n!==undefined;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&x(e).is(n))break;r.push(e)}return r},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});function et(e,t,n){if(x.isFunction(t))return x.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return x.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(G.test(t))return x.filter(t,e,n);t=x.filter(t,e)}return x.grep(e,function(e){return g.call(t,e)>=0!==n})}var tt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,nt=/<([\w:]+)/,rt=/<|&#?\w+;/,it=/<(?:script|style|link)/i,ot=/^(?:checkbox|radio)$/i,st=/checked\s*(?:[^=]|=\s*.checked.)/i,at=/^$|\/(?:java|ecma)script/i,ut=/^true\/(.*)/,lt=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,ct={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};ct.optgroup=ct.option,ct.tbody=ct.tfoot=ct.colgroup=ct.caption=ct.thead,ct.th=ct.td,x.fn.extend({text:function(e){return x.access(this,function(e){return e===undefined?x.text(this):this.empty().append((this[0]&&this[0].ownerDocument||o).createTextNode(e))},null,e,arguments.length)},append:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=pt(this,e);t.appendChild(e)}})},prepend:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=pt(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=e?x.filter(e,this):this,i=0;for(;null!=(n=r[i]);i++)t||1!==n.nodeType||x.cleanData(mt(n)),n.parentNode&&(t&&x.contains(n.ownerDocument,n)&&dt(mt(n,"script")),n.parentNode.removeChild(n));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++)1===e.nodeType&&(x.cleanData(mt(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return x.clone(this,e,t)})},html:function(e){return x.access(this,function(e){var t=this[0]||{},n=0,r=this.length;if(e===undefined&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!it.test(e)&&!ct[(nt.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(tt,"<$1></$2>");try{for(;r>n;n++)t=this[n]||{},1===t.nodeType&&(x.cleanData(mt(t,!1)),t.innerHTML=e);t=0}catch(i){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=x.map(this,function(e){return[e.nextSibling,e.parentNode]}),t=0;return this.domManip(arguments,function(n){var r=e[t++],i=e[t++];i&&(r&&r.parentNode!==i&&(r=this.nextSibling),x(this).remove(),i.insertBefore(n,r))},!0),t?this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(e,t,n){e=f.apply([],e);var r,i,o,s,a,u,l=0,c=this.length,p=this,h=c-1,d=e[0],g=x.isFunction(d);if(g||!(1>=c||"string"!=typeof d||x.support.checkClone)&&st.test(d))return this.each(function(r){var i=p.eq(r);g&&(e[0]=d.call(this,r,i.html())),i.domManip(e,t,n)});if(c&&(r=x.buildFragment(e,this[0].ownerDocument,!1,!n&&this),i=r.firstChild,1===r.childNodes.length&&(r=i),i)){for(o=x.map(mt(r,"script"),ft),s=o.length;c>l;l++)a=r,l!==h&&(a=x.clone(a,!0,!0),s&&x.merge(o,mt(a,"script"))),t.call(this[l],a,l);if(s)for(u=o[o.length-1].ownerDocument,x.map(o,ht),l=0;s>l;l++)a=o[l],at.test(a.type||"")&&!q.access(a,"globalEval")&&x.contains(u,a)&&(a.src?x._evalUrl(a.src):x.globalEval(a.textContent.replace(lt,"")))}return this}}),x.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){x.fn[e]=function(e){var n,r=[],i=x(e),o=i.length-1,s=0;for(;o>=s;s++)n=s===o?this:this.clone(!0),x(i[s])[t](n),h.apply(r,n.get());return this.pushStack(r)}}),x.extend({clone:function(e,t,n){var r,i,o,s,a=e.cloneNode(!0),u=x.contains(e.ownerDocument,e);if(!(x.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||x.isXMLDoc(e)))for(s=mt(a),o=mt(e),r=0,i=o.length;i>r;r++)yt(o[r],s[r]);if(t)if(n)for(o=o||mt(e),s=s||mt(a),r=0,i=o.length;i>r;r++)gt(o[r],s[r]);else gt(e,a);return s=mt(a,"script"),s.length>0&&dt(s,!u&&mt(e,"script")),a},buildFragment:function(e,t,n,r){var i,o,s,a,u,l,c=0,p=e.length,f=t.createDocumentFragment(),h=[];for(;p>c;c++)if(i=e[c],i||0===i)if("object"===x.type(i))x.merge(h,i.nodeType?[i]:i);else if(rt.test(i)){o=o||f.appendChild(t.createElement("div")),s=(nt.exec(i)||["",""])[1].toLowerCase(),a=ct[s]||ct._default,o.innerHTML=a[1]+i.replace(tt,"<$1></$2>")+a[2],l=a[0];while(l--)o=o.lastChild;x.merge(h,o.childNodes),o=f.firstChild,o.textContent=""}else h.push(t.createTextNode(i));f.textContent="",c=0;while(i=h[c++])if((!r||-1===x.inArray(i,r))&&(u=x.contains(i.ownerDocument,i),o=mt(f.appendChild(i),"script"),u&&dt(o),n)){l=0;while(i=o[l++])at.test(i.type||"")&&n.push(i)}return f},cleanData:function(e){var t,n,r,i,o,s,a=x.event.special,u=0;for(;(n=e[u])!==undefined;u++){if(F.accepts(n)&&(o=n[q.expando],o&&(t=q.cache[o]))){if(r=Object.keys(t.events||{}),r.length)for(s=0;(i=r[s])!==undefined;s++)a[i]?x.event.remove(n,i):x.removeEvent(n,i,t.handle);q.cache[o]&&delete q.cache[o]}delete L.cache[n[L.expando]]}},_evalUrl:function(e){return x.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})}});function pt(e,t){return x.nodeName(e,"table")&&x.nodeName(1===t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function ft(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function ht(e){var t=ut.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function dt(e,t){var n=e.length,r=0;for(;n>r;r++)q.set(e[r],"globalEval",!t||q.get(t[r],"globalEval"))}function gt(e,t){var n,r,i,o,s,a,u,l;if(1===t.nodeType){if(q.hasData(e)&&(o=q.access(e),s=q.set(t,o),l=o.events)){delete s.handle,s.events={};for(i in l)for(n=0,r=l[i].length;r>n;n++)x.event.add(t,i,l[i][n])}L.hasData(e)&&(a=L.access(e),u=x.extend({},a),L.set(t,u))}}function mt(e,t){var n=e.getElementsByTagName?e.getElementsByTagName(t||"*"):e.querySelectorAll?e.querySelectorAll(t||"*"):[];return t===undefined||t&&x.nodeName(e,t)?x.merge([e],n):n}function yt(e,t){var n=t.nodeName.toLowerCase();"input"===n&&ot.test(e.type)?t.checked=e.checked:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}x.fn.extend({wrapAll:function(e){var t;return x.isFunction(e)?this.each(function(t){x(this).wrapAll(e.call(this,t))}):(this[0]&&(t=x(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this)},wrapInner:function(e){return x.isFunction(e)?this.each(function(t){x(this).wrapInner(e.call(this,t))}):this.each(function(){var t=x(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=x.isFunction(e);return this.each(function(n){x(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){x.nodeName(this,"body")||x(this).replaceWith(this.childNodes)}).end()}});var vt,xt,bt=/^(none|table(?!-c[ea]).+)/,wt=/^margin/,Tt=RegExp("^("+b+")(.*)$","i"),Ct=RegExp("^("+b+")(?!px)[a-z%]+$","i"),kt=RegExp("^([+-])=("+b+")","i"),Nt={BODY:"block"},Et={position:"absolute",visibility:"hidden",display:"block"},St={letterSpacing:0,fontWeight:400},jt=["Top","Right","Bottom","Left"],Dt=["Webkit","O","Moz","ms"];function At(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=Dt.length;while(i--)if(t=Dt[i]+n,t in e)return t;return r}function Lt(e,t){return e=t||e,"none"===x.css(e,"display")||!x.contains(e.ownerDocument,e)}function qt(t){return e.getComputedStyle(t,null)}function Ht(e,t){var n,r,i,o=[],s=0,a=e.length;for(;a>s;s++)r=e[s],r.style&&(o[s]=q.get(r,"olddisplay"),n=r.style.display,t?(o[s]||"none"!==n||(r.style.display=""),""===r.style.display&&Lt(r)&&(o[s]=q.access(r,"olddisplay",Rt(r.nodeName)))):o[s]||(i=Lt(r),(n&&"none"!==n||!i)&&q.set(r,"olddisplay",i?n:x.css(r,"display"))));for(s=0;a>s;s++)r=e[s],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[s]||"":"none"));return e}x.fn.extend({css:function(e,t){return x.access(this,function(e,t,n){var r,i,o={},s=0;if(x.isArray(t)){for(r=qt(e),i=t.length;i>s;s++)o[t[s]]=x.css(e,t[s],!1,r);return o}return n!==undefined?x.style(e,t,n):x.css(e,t)},e,t,arguments.length>1)},show:function(){return Ht(this,!0)},hide:function(){return Ht(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){Lt(this)?x(this).show():x(this).hide()})}}),x.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=vt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,s,a=x.camelCase(t),u=e.style;return t=x.cssProps[a]||(x.cssProps[a]=At(u,a)),s=x.cssHooks[t]||x.cssHooks[a],n===undefined?s&&"get"in s&&(i=s.get(e,!1,r))!==undefined?i:u[t]:(o=typeof n,"string"===o&&(i=kt.exec(n))&&(n=(i[1]+1)*i[2]+parseFloat(x.css(e,t)),o="number"),null==n||"number"===o&&isNaN(n)||("number"!==o||x.cssNumber[a]||(n+="px"),x.support.clearCloneStyle||""!==n||0!==t.indexOf("background")||(u[t]="inherit"),s&&"set"in s&&(n=s.set(e,n,r))===undefined||(u[t]=n)),undefined)}},css:function(e,t,n,r){var i,o,s,a=x.camelCase(t);return t=x.cssProps[a]||(x.cssProps[a]=At(e.style,a)),s=x.cssHooks[t]||x.cssHooks[a],s&&"get"in s&&(i=s.get(e,!0,n)),i===undefined&&(i=vt(e,t,r)),"normal"===i&&t in St&&(i=St[t]),""===n||n?(o=parseFloat(i),n===!0||x.isNumeric(o)?o||0:i):i}}),vt=function(e,t,n){var r,i,o,s=n||qt(e),a=s?s.getPropertyValue(t)||s[t]:undefined,u=e.style;return s&&(""!==a||x.contains(e.ownerDocument,e)||(a=x.style(e,t)),Ct.test(a)&&wt.test(t)&&(r=u.width,i=u.minWidth,o=u.maxWidth,u.minWidth=u.maxWidth=u.width=a,a=s.width,u.width=r,u.minWidth=i,u.maxWidth=o)),a};function Ot(e,t,n){var r=Tt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function Ft(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,s=0;for(;4>o;o+=2)"margin"===n&&(s+=x.css(e,n+jt[o],!0,i)),r?("content"===n&&(s-=x.css(e,"padding"+jt[o],!0,i)),"margin"!==n&&(s-=x.css(e,"border"+jt[o]+"Width",!0,i))):(s+=x.css(e,"padding"+jt[o],!0,i),"padding"!==n&&(s+=x.css(e,"border"+jt[o]+"Width",!0,i)));return s}function Pt(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=qt(e),s=x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=vt(e,t,o),(0>i||null==i)&&(i=e.style[t]),Ct.test(i))return i;r=s&&(x.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+Ft(e,t,n||(s?"border":"content"),r,o)+"px"}function Rt(e){var t=o,n=Nt[e];return n||(n=Mt(e,t),"none"!==n&&n||(xt=(xt||x("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(t.documentElement),t=(xt[0].contentWindow||xt[0].contentDocument).document,t.write("<!doctype html><html><body>"),t.close(),n=Mt(e,t),xt.detach()),Nt[e]=n),n}function Mt(e,t){var n=x(t.createElement(e)).appendTo(t.body),r=x.css(n[0],"display");return n.remove(),r}x.each(["height","width"],function(e,t){x.cssHooks[t]={get:function(e,n,r){return n?0===e.offsetWidth&&bt.test(x.css(e,"display"))?x.swap(e,Et,function(){return Pt(e,t,r)}):Pt(e,t,r):undefined},set:function(e,n,r){var i=r&&qt(e);return Ot(e,n,r?Ft(e,t,r,x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,i),i):0)}}}),x(function(){x.support.reliableMarginRight||(x.cssHooks.marginRight={get:function(e,t){return t?x.swap(e,{display:"inline-block"},vt,[e,"marginRight"]):undefined}}),!x.support.pixelPosition&&x.fn.position&&x.each(["top","left"],function(e,t){x.cssHooks[t]={get:function(e,n){return n?(n=vt(e,t),Ct.test(n)?x(e).position()[t]+"px":n):undefined}}})}),x.expr&&x.expr.filters&&(x.expr.filters.hidden=function(e){return 0>=e.offsetWidth&&0>=e.offsetHeight},x.expr.filters.visible=function(e){return!x.expr.filters.hidden(e)}),x.each({margin:"",padding:"",border:"Width"},function(e,t){x.cssHooks[e+t]={expand:function(n){var r=0,i={},o="string"==typeof n?n.split(" "):[n];for(;4>r;r++)i[e+jt[r]+t]=o[r]||o[r-2]||o[0];return i}},wt.test(e)||(x.cssHooks[e+t].set=Ot)});var Wt=/%20/g,$t=/\[\]$/,Bt=/\r?\n/g,It=/^(?:submit|button|image|reset|file)$/i,zt=/^(?:input|select|textarea|keygen)/i;x.fn.extend({serialize:function(){return x.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=x.prop(this,"elements");return e?x.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!x(this).is(":disabled")&&zt.test(this.nodeName)&&!It.test(e)&&(this.checked||!ot.test(e))}).map(function(e,t){var n=x(this).val();return null==n?null:x.isArray(n)?x.map(n,function(e){return{name:t.name,value:e.replace(Bt,"\r\n")}}):{name:t.name,value:n.replace(Bt,"\r\n")}}).get()}}),x.param=function(e,t){var n,r=[],i=function(e,t){t=x.isFunction(t)?t():null==t?"":t,r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(t===undefined&&(t=x.ajaxSettings&&x.ajaxSettings.traditional),x.isArray(e)||e.jquery&&!x.isPlainObject(e))x.each(e,function(){i(this.name,this.value)});else for(n in e)_t(n,e[n],t,i);return r.join("&").replace(Wt,"+")};function _t(e,t,n,r){var i;if(x.isArray(t))x.each(t,function(t,i){n||$t.test(e)?r(e,i):_t(e+"["+("object"==typeof i?t:"")+"]",i,n,r)});else if(n||"object"!==x.type(t))r(e,t);else for(i in t)_t(e+"["+i+"]",t[i],n,r)}x.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){x.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),x.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)
-},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}});var Xt,Ut,Yt=x.now(),Vt=/\?/,Gt=/#.*$/,Jt=/([?&])_=[^&]*/,Qt=/^(.*?):[ \t]*([^\r\n]*)$/gm,Kt=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Zt=/^(?:GET|HEAD)$/,en=/^\/\//,tn=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,nn=x.fn.load,rn={},on={},sn="*/".concat("*");try{Ut=i.href}catch(an){Ut=o.createElement("a"),Ut.href="",Ut=Ut.href}Xt=tn.exec(Ut.toLowerCase())||[];function un(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(w)||[];if(x.isFunction(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function ln(e,t,n,r){var i={},o=e===on;function s(a){var u;return i[a]=!0,x.each(e[a]||[],function(e,a){var l=a(t,n,r);return"string"!=typeof l||o||i[l]?o?!(u=l):undefined:(t.dataTypes.unshift(l),s(l),!1)}),u}return s(t.dataTypes[0])||!i["*"]&&s("*")}function cn(e,t){var n,r,i=x.ajaxSettings.flatOptions||{};for(n in t)t[n]!==undefined&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&x.extend(!0,e,r),e}x.fn.load=function(e,t,n){if("string"!=typeof e&&nn)return nn.apply(this,arguments);var r,i,o,s=this,a=e.indexOf(" ");return a>=0&&(r=e.slice(a),e=e.slice(0,a)),x.isFunction(t)?(n=t,t=undefined):t&&"object"==typeof t&&(i="POST"),s.length>0&&x.ajax({url:e,type:i,dataType:"html",data:t}).done(function(e){o=arguments,s.html(r?x("<div>").append(x.parseHTML(e)).find(r):e)}).complete(n&&function(e,t){s.each(n,o||[e.responseText,t,e])}),this},x.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){x.fn[t]=function(e){return this.on(t,e)}}),x.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Ut,type:"GET",isLocal:Kt.test(Xt[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":sn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":x.parseJSON,"text xml":x.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?cn(cn(e,x.ajaxSettings),t):cn(x.ajaxSettings,e)},ajaxPrefilter:un(rn),ajaxTransport:un(on),ajax:function(e,t){"object"==typeof e&&(t=e,e=undefined),t=t||{};var n,r,i,o,s,a,u,l,c=x.ajaxSetup({},t),p=c.context||c,f=c.context&&(p.nodeType||p.jquery)?x(p):x.event,h=x.Deferred(),d=x.Callbacks("once memory"),g=c.statusCode||{},m={},y={},v=0,b="canceled",T={readyState:0,getResponseHeader:function(e){var t;if(2===v){if(!o){o={};while(t=Qt.exec(i))o[t[1].toLowerCase()]=t[2]}t=o[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===v?i:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return v||(e=y[n]=y[n]||e,m[e]=t),this},overrideMimeType:function(e){return v||(c.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>v)for(t in e)g[t]=[g[t],e[t]];else T.always(e[T.status]);return this},abort:function(e){var t=e||b;return n&&n.abort(t),k(0,t),this}};if(h.promise(T).complete=d.add,T.success=T.done,T.error=T.fail,c.url=((e||c.url||Ut)+"").replace(Gt,"").replace(en,Xt[1]+"//"),c.type=t.method||t.type||c.method||c.type,c.dataTypes=x.trim(c.dataType||"*").toLowerCase().match(w)||[""],null==c.crossDomain&&(a=tn.exec(c.url.toLowerCase()),c.crossDomain=!(!a||a[1]===Xt[1]&&a[2]===Xt[2]&&(a[3]||("http:"===a[1]?"80":"443"))===(Xt[3]||("http:"===Xt[1]?"80":"443")))),c.data&&c.processData&&"string"!=typeof c.data&&(c.data=x.param(c.data,c.traditional)),ln(rn,c,t,T),2===v)return T;u=c.global,u&&0===x.active++&&x.event.trigger("ajaxStart"),c.type=c.type.toUpperCase(),c.hasContent=!Zt.test(c.type),r=c.url,c.hasContent||(c.data&&(r=c.url+=(Vt.test(r)?"&":"?")+c.data,delete c.data),c.cache===!1&&(c.url=Jt.test(r)?r.replace(Jt,"$1_="+Yt++):r+(Vt.test(r)?"&":"?")+"_="+Yt++)),c.ifModified&&(x.lastModified[r]&&T.setRequestHeader("If-Modified-Since",x.lastModified[r]),x.etag[r]&&T.setRequestHeader("If-None-Match",x.etag[r])),(c.data&&c.hasContent&&c.contentType!==!1||t.contentType)&&T.setRequestHeader("Content-Type",c.contentType),T.setRequestHeader("Accept",c.dataTypes[0]&&c.accepts[c.dataTypes[0]]?c.accepts[c.dataTypes[0]]+("*"!==c.dataTypes[0]?", "+sn+"; q=0.01":""):c.accepts["*"]);for(l in c.headers)T.setRequestHeader(l,c.headers[l]);if(c.beforeSend&&(c.beforeSend.call(p,T,c)===!1||2===v))return T.abort();b="abort";for(l in{success:1,error:1,complete:1})T[l](c[l]);if(n=ln(on,c,t,T)){T.readyState=1,u&&f.trigger("ajaxSend",[T,c]),c.async&&c.timeout>0&&(s=setTimeout(function(){T.abort("timeout")},c.timeout));try{v=1,n.send(m,k)}catch(C){if(!(2>v))throw C;k(-1,C)}}else k(-1,"No Transport");function k(e,t,o,a){var l,m,y,b,w,C=t;2!==v&&(v=2,s&&clearTimeout(s),n=undefined,i=a||"",T.readyState=e>0?4:0,l=e>=200&&300>e||304===e,o&&(b=pn(c,T,o)),b=fn(c,b,T,l),l?(c.ifModified&&(w=T.getResponseHeader("Last-Modified"),w&&(x.lastModified[r]=w),w=T.getResponseHeader("etag"),w&&(x.etag[r]=w)),204===e||"HEAD"===c.type?C="nocontent":304===e?C="notmodified":(C=b.state,m=b.data,y=b.error,l=!y)):(y=C,(e||!C)&&(C="error",0>e&&(e=0))),T.status=e,T.statusText=(t||C)+"",l?h.resolveWith(p,[m,C,T]):h.rejectWith(p,[T,C,y]),T.statusCode(g),g=undefined,u&&f.trigger(l?"ajaxSuccess":"ajaxError",[T,c,l?m:y]),d.fireWith(p,[T,C]),u&&(f.trigger("ajaxComplete",[T,c]),--x.active||x.event.trigger("ajaxStop")))}return T},getJSON:function(e,t,n){return x.get(e,t,n,"json")},getScript:function(e,t){return x.get(e,undefined,t,"script")}}),x.each(["get","post"],function(e,t){x[t]=function(e,n,r,i){return x.isFunction(n)&&(i=i||r,r=n,n=undefined),x.ajax({url:e,type:t,dataType:i,data:n,success:r})}});function pn(e,t,n){var r,i,o,s,a=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),r===undefined&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in a)if(a[i]&&a[i].test(r)){u.unshift(i);break}if(u[0]in n)o=u[0];else{for(i in n){if(!u[0]||e.converters[i+" "+u[0]]){o=i;break}s||(s=i)}o=o||s}return o?(o!==u[0]&&u.unshift(o),n[o]):undefined}function fn(e,t,n,r){var i,o,s,a,u,l={},c=e.dataTypes.slice();if(c[1])for(s in e.converters)l[s.toLowerCase()]=e.converters[s];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(s=l[u+" "+o]||l["* "+o],!s)for(i in l)if(a=i.split(" "),a[1]===o&&(s=l[u+" "+a[0]]||l["* "+a[0]])){s===!0?s=l[i]:l[i]!==!0&&(o=a[0],c.unshift(a[1]));break}if(s!==!0)if(s&&e["throws"])t=s(t);else try{t=s(t)}catch(p){return{state:"parsererror",error:s?p:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}}x.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return x.globalEval(e),e}}}),x.ajaxPrefilter("script",function(e){e.cache===undefined&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),x.ajaxTransport("script",function(e){if(e.crossDomain){var t,n;return{send:function(r,i){t=x("<script>").prop({async:!0,charset:e.scriptCharset,src:e.url}).on("load error",n=function(e){t.remove(),n=null,e&&i("error"===e.type?404:200,e.type)}),o.head.appendChild(t[0])},abort:function(){n&&n()}}}});var hn=[],dn=/(=)\?(?=&|$)|\?\?/;x.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=hn.pop()||x.expando+"_"+Yt++;return this[e]=!0,e}}),x.ajaxPrefilter("json jsonp",function(t,n,r){var i,o,s,a=t.jsonp!==!1&&(dn.test(t.url)?"url":"string"==typeof t.data&&!(t.contentType||"").indexOf("application/x-www-form-urlencoded")&&dn.test(t.data)&&"data");return a||"jsonp"===t.dataTypes[0]?(i=t.jsonpCallback=x.isFunction(t.jsonpCallback)?t.jsonpCallback():t.jsonpCallback,a?t[a]=t[a].replace(dn,"$1"+i):t.jsonp!==!1&&(t.url+=(Vt.test(t.url)?"&":"?")+t.jsonp+"="+i),t.converters["script json"]=function(){return s||x.error(i+" was not called"),s[0]},t.dataTypes[0]="json",o=e[i],e[i]=function(){s=arguments},r.always(function(){e[i]=o,t[i]&&(t.jsonpCallback=n.jsonpCallback,hn.push(i)),s&&x.isFunction(o)&&o(s[0]),s=o=undefined}),"script"):undefined}),x.ajaxSettings.xhr=function(){try{return new XMLHttpRequest}catch(e){}};var gn=x.ajaxSettings.xhr(),mn={0:200,1223:204},yn=0,vn={};e.ActiveXObject&&x(e).on("unload",function(){for(var e in vn)vn[e]();vn=undefined}),x.support.cors=!!gn&&"withCredentials"in gn,x.support.ajax=gn=!!gn,x.ajaxTransport(function(e){var t;return x.support.cors||gn&&!e.crossDomain?{send:function(n,r){var i,o,s=e.xhr();if(s.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(i in e.xhrFields)s[i]=e.xhrFields[i];e.mimeType&&s.overrideMimeType&&s.overrideMimeType(e.mimeType),e.crossDomain||n["X-Requested-With"]||(n["X-Requested-With"]="XMLHttpRequest");for(i in n)s.setRequestHeader(i,n[i]);t=function(e){return function(){t&&(delete vn[o],t=s.onload=s.onerror=null,"abort"===e?s.abort():"error"===e?r(s.status||404,s.statusText):r(mn[s.status]||s.status,s.statusText,"string"==typeof s.responseText?{text:s.responseText}:undefined,s.getAllResponseHeaders()))}},s.onload=t(),s.onerror=t("error"),t=vn[o=yn++]=t("abort"),s.send(e.hasContent&&e.data||null)},abort:function(){t&&t()}}:undefined});var xn,bn,wn=/^(?:toggle|show|hide)$/,Tn=RegExp("^(?:([+-])=|)("+b+")([a-z%]*)$","i"),Cn=/queueHooks$/,kn=[An],Nn={"*":[function(e,t){var n=this.createTween(e,t),r=n.cur(),i=Tn.exec(t),o=i&&i[3]||(x.cssNumber[e]?"":"px"),s=(x.cssNumber[e]||"px"!==o&&+r)&&Tn.exec(x.css(n.elem,e)),a=1,u=20;if(s&&s[3]!==o){o=o||s[3],i=i||[],s=+r||1;do a=a||".5",s/=a,x.style(n.elem,e,s+o);while(a!==(a=n.cur()/r)&&1!==a&&--u)}return i&&(s=n.start=+s||+r||0,n.unit=o,n.end=i[1]?s+(i[1]+1)*i[2]:+i[2]),n}]};function En(){return setTimeout(function(){xn=undefined}),xn=x.now()}function Sn(e,t,n){var r,i=(Nn[t]||[]).concat(Nn["*"]),o=0,s=i.length;for(;s>o;o++)if(r=i[o].call(n,t,e))return r}function jn(e,t,n){var r,i,o=0,s=kn.length,a=x.Deferred().always(function(){delete u.elem}),u=function(){if(i)return!1;var t=xn||En(),n=Math.max(0,l.startTime+l.duration-t),r=n/l.duration||0,o=1-r,s=0,u=l.tweens.length;for(;u>s;s++)l.tweens[s].run(o);return a.notifyWith(e,[l,o,n]),1>o&&u?n:(a.resolveWith(e,[l]),!1)},l=a.promise({elem:e,props:x.extend({},t),opts:x.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:xn||En(),duration:n.duration,tweens:[],createTween:function(t,n){var r=x.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){var n=0,r=t?l.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)l.tweens[n].run(1);return t?a.resolveWith(e,[l,t]):a.rejectWith(e,[l,t]),this}}),c=l.props;for(Dn(c,l.opts.specialEasing);s>o;o++)if(r=kn[o].call(l,e,c,l.opts))return r;return x.map(c,Sn,l),x.isFunction(l.opts.start)&&l.opts.start.call(e,l),x.fx.timer(x.extend(u,{elem:e,anim:l,queue:l.opts.queue})),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always)}function Dn(e,t){var n,r,i,o,s;for(n in e)if(r=x.camelCase(n),i=t[r],o=e[n],x.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),s=x.cssHooks[r],s&&"expand"in s){o=s.expand(o),delete e[r];for(n in o)n in e||(e[n]=o[n],t[n]=i)}else t[r]=i}x.Animation=x.extend(jn,{tweener:function(e,t){x.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;i>r;r++)n=e[r],Nn[n]=Nn[n]||[],Nn[n].unshift(t)},prefilter:function(e,t){t?kn.unshift(e):kn.push(e)}});function An(e,t,n){var r,i,o,s,a,u,l=this,c={},p=e.style,f=e.nodeType&&Lt(e),h=q.get(e,"fxshow");n.queue||(a=x._queueHooks(e,"fx"),null==a.unqueued&&(a.unqueued=0,u=a.empty.fire,a.empty.fire=function(){a.unqueued||u()}),a.unqueued++,l.always(function(){l.always(function(){a.unqueued--,x.queue(e,"fx").length||a.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],"inline"===x.css(e,"display")&&"none"===x.css(e,"float")&&(p.display="inline-block")),n.overflow&&(p.overflow="hidden",l.always(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(r in t)if(i=t[r],wn.exec(i)){if(delete t[r],o=o||"toggle"===i,i===(f?"hide":"show")){if("show"!==i||!h||h[r]===undefined)continue;f=!0}c[r]=h&&h[r]||x.style(e,r)}if(!x.isEmptyObject(c)){h?"hidden"in h&&(f=h.hidden):h=q.access(e,"fxshow",{}),o&&(h.hidden=!f),f?x(e).show():l.done(function(){x(e).hide()}),l.done(function(){var t;q.remove(e,"fxshow");for(t in c)x.style(e,t,c[t])});for(r in c)s=Sn(f?h[r]:0,r,l),r in h||(h[r]=s.start,f&&(s.end=s.start,s.start="width"===r||"height"===r?1:0))}}function Ln(e,t,n,r,i){return new Ln.prototype.init(e,t,n,r,i)}x.Tween=Ln,Ln.prototype={constructor:Ln,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(x.cssNumber[n]?"":"px")},cur:function(){var e=Ln.propHooks[this.prop];return e&&e.get?e.get(this):Ln.propHooks._default.get(this)},run:function(e){var t,n=Ln.propHooks[this.prop];return this.pos=t=this.options.duration?x.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):Ln.propHooks._default.set(this),this}},Ln.prototype.init.prototype=Ln.prototype,Ln.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=x.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){x.fx.step[e.prop]?x.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[x.cssProps[e.prop]]||x.cssHooks[e.prop])?x.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},Ln.propHooks.scrollTop=Ln.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},x.each(["toggle","show","hide"],function(e,t){var n=x.fn[t];x.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(qn(t,!0),e,r,i)}}),x.fn.extend({fadeTo:function(e,t,n,r){return this.filter(Lt).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=x.isEmptyObject(e),o=x.speed(t,n,r),s=function(){var t=jn(this,x.extend({},e),o);(i||q.get(this,"finish"))&&t.stop(!0)};return s.finish=s,i||o.queue===!1?this.each(s):this.queue(o.queue,s)},stop:function(e,t,n){var r=function(e){var t=e.stop;delete e.stop,t(n)};return"string"!=typeof e&&(n=t,t=e,e=undefined),t&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,i=null!=e&&e+"queueHooks",o=x.timers,s=q.get(this);if(i)s[i]&&s[i].stop&&r(s[i]);else for(i in s)s[i]&&s[i].stop&&Cn.test(i)&&r(s[i]);for(i=o.length;i--;)o[i].elem!==this||null!=e&&o[i].queue!==e||(o[i].anim.stop(n),t=!1,o.splice(i,1));(t||!n)&&x.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=q.get(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=x.timers,s=r?r.length:0;for(n.finish=!0,x.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;s>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}});function qn(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)n=jt[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}x.each({slideDown:qn("show"),slideUp:qn("hide"),slideToggle:qn("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){x.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),x.speed=function(e,t,n){var r=e&&"object"==typeof e?x.extend({},e):{complete:n||!n&&t||x.isFunction(e)&&e,duration:e,easing:n&&t||t&&!x.isFunction(t)&&t};return r.duration=x.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in x.fx.speeds?x.fx.speeds[r.duration]:x.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){x.isFunction(r.old)&&r.old.call(this),r.queue&&x.dequeue(this,r.queue)},r},x.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},x.timers=[],x.fx=Ln.prototype.init,x.fx.tick=function(){var e,t=x.timers,n=0;for(xn=x.now();t.length>n;n++)e=t[n],e()||t[n]!==e||t.splice(n--,1);t.length||x.fx.stop(),xn=undefined},x.fx.timer=function(e){e()&&x.timers.push(e)&&x.fx.start()},x.fx.interval=13,x.fx.start=function(){bn||(bn=setInterval(x.fx.tick,x.fx.interval))},x.fx.stop=function(){clearInterval(bn),bn=null},x.fx.speeds={slow:600,fast:200,_default:400},x.fx.step={},x.expr&&x.expr.filters&&(x.expr.filters.animated=function(e){return x.grep(x.timers,function(t){return e===t.elem}).length}),x.fn.offset=function(e){if(arguments.length)return e===undefined?this:this.each(function(t){x.offset.setOffset(this,e,t)});var t,n,i=this[0],o={top:0,left:0},s=i&&i.ownerDocument;if(s)return t=s.documentElement,x.contains(t,i)?(typeof i.getBoundingClientRect!==r&&(o=i.getBoundingClientRect()),n=Hn(s),{top:o.top+n.pageYOffset-t.clientTop,left:o.left+n.pageXOffset-t.clientLeft}):o},x.offset={setOffset:function(e,t,n){var r,i,o,s,a,u,l,c=x.css(e,"position"),p=x(e),f={};"static"===c&&(e.style.position="relative"),a=p.offset(),o=x.css(e,"top"),u=x.css(e,"left"),l=("absolute"===c||"fixed"===c)&&(o+u).indexOf("auto")>-1,l?(r=p.position(),s=r.top,i=r.left):(s=parseFloat(o)||0,i=parseFloat(u)||0),x.isFunction(t)&&(t=t.call(e,n,a)),null!=t.top&&(f.top=t.top-a.top+s),null!=t.left&&(f.left=t.left-a.left+i),"using"in t?t.using.call(e,f):p.css(f)}},x.fn.extend({position:function(){if(this[0]){var e,t,n=this[0],r={top:0,left:0};return"fixed"===x.css(n,"position")?t=n.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),x.nodeName(e[0],"html")||(r=e.offset()),r.top+=x.css(e[0],"borderTopWidth",!0),r.left+=x.css(e[0],"borderLeftWidth",!0)),{top:t.top-r.top-x.css(n,"marginTop",!0),left:t.left-r.left-x.css(n,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||s;while(e&&!x.nodeName(e,"html")&&"static"===x.css(e,"position"))e=e.offsetParent;return e||s})}}),x.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,n){var r="pageYOffset"===n;x.fn[t]=function(i){return x.access(this,function(t,i,o){var s=Hn(t);return o===undefined?s?s[n]:t[i]:(s?s.scrollTo(r?e.pageXOffset:o,r?o:e.pageYOffset):t[i]=o,undefined)},t,i,arguments.length,null)}});function Hn(e){return x.isWindow(e)?e:9===e.nodeType&&e.defaultView}x.each({Height:"height",Width:"width"},function(e,t){x.each({padding:"inner"+e,content:t,"":"outer"+e},function(n,r){x.fn[r]=function(r,i){var o=arguments.length&&(n||"boolean"!=typeof r),s=n||(r===!0||i===!0?"margin":"border");return x.access(this,function(t,n,r){var i;return x.isWindow(t)?t.document.documentElement["client"+e]:9===t.nodeType?(i=t.documentElement,Math.max(t.body["scroll"+e],i["scroll"+e],t.body["offset"+e],i["offset"+e],i["client"+e])):r===undefined?x.css(t,n,s):x.style(t,n,r,s)},t,o?r:undefined,o,null)}})}),x.fn.size=function(){return this.length},x.fn.andSelf=x.fn.addBack,"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=x:"function"==typeof define&&define.amd&&define("jquery",[],function(){return x}),"object"==typeof e&&"object"==typeof e.document&&(e.jQuery=e.$=x)})(window);
diff --git a/js/extlib/json2.min.js b/js/extlib/json2.min.js
deleted file mode 100644 (file)
index ecb44b9..0000000
+++ /dev/null
@@ -1 +0,0 @@
-if(typeof JSON!=="object"){JSON={}}(function(){function f(n){return n<10?"0"+n:n}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==="string"?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==="object"&&typeof value.toJSON==="function"){value=value.toJSON(key)}if(typeof rep==="function"){value=rep.call(holder,key,value)}switch(typeof value){case"string":return quote(value);case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value){return"null"}gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==="[object Array]"){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||"null"}v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";gap=mind;return v}if(rep&&typeof rep==="object"){length=rep.length;for(i=0;i<length;i+=1){if(typeof rep[i]==="string"){k=rep[i];v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}else{for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v}}if(typeof JSON.stringify!=="function"){JSON.stringify=function(value,replacer,space){var i;gap="";indent="";if(typeof space==="number"){for(i=0;i<space;i+=1){indent+=" "}}else{if(typeof space==="string"){indent=space}}rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("JSON.stringify")}return str("",{"":value})}}if(typeof JSON.parse!=="function"){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==="object"){for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")}}}());
\ No newline at end of file
index 839648485948898c19f6b8f64707106148ba96bb..5f95595edd134ec5c646ee151b7e9c536709447c 100644 (file)
@@ -1414,6 +1414,8 @@ var SN = { // StatusNet
                     SN.Init.NoticeFormSetup(form);
                 })
                 .find('.notice_data-text').focus();
+
+        return false;
     },
 
         showMoreMenuItems: function (menuid) {
diff --git a/js/util.min.js b/js/util.min.js
deleted file mode 100644 (file)
index d963380..0000000
+++ /dev/null
@@ -1 +0,0 @@
-var SN={C:{I:{CounterBlackout:false,MaxLength:140,PatternUsername:/^[0-9a-zA-Z\-_.]*$/,HTTP20x30x:[200,201,202,203,204,205,206,300,301,302,303,304,305,306,307],NoticeFormMaster:null},S:{Disabled:"disabled",Warning:"warning",Error:"error",Success:"success",Processing:"processing",CommandResult:"command_result",FormNotice:"form_notice",NoticeDataGeo:"notice_data-geo",NoticeDataGeoCookie:"NoticeDataGeo",NoticeDataGeoSelected:"notice_data-geo_selected",StatusNetInstance:"StatusNetInstance"}},messages:{},msg:function(a){if(SN.messages[a]===undefined){return"["+a+"]"}return SN.messages[a]},U:{FormNoticeEnhancements:function(d){if(jQuery.data(d[0],"ElementData")===undefined){var a=d.find(".count").text();if(a===undefined){a=SN.C.I.MaxLength}jQuery.data(d[0],"ElementData",{MaxLength:a});SN.U.Counter(d);var c=d.find(".notice_data-text:first");c.on("keyup",function(f){SN.U.Counter(d)});var b=function(f){window.setTimeout(function(){SN.U.Counter(d)},50)};c.on("cut",b).on("paste",b)}else{d.find(".count").text(jQuery.data(d[0],"ElementData").MaxLength)}},Counter:function(d){SN.C.I.FormNoticeCurrent=d;var b=jQuery.data(d[0],"ElementData").MaxLength;if(b<=0){return}var c=b-SN.U.CharacterCount(d);var a=d.find(".count");if(c.toString()!=a.text()){if(!SN.C.I.CounterBlackout||c===0){if(a.text()!=String(c)){a.text(c)}if(c<0){d.addClass(SN.C.S.Warning)}else{d.removeClass(SN.C.S.Warning)}if(!SN.C.I.CounterBlackout){SN.C.I.CounterBlackout=true;SN.C.I.FormNoticeCurrent=d;window.setTimeout("SN.U.ClearCounterBlackout(SN.C.I.FormNoticeCurrent);",500)}}}},CharacterCount:function(a){return a.find(".notice_data-text:first").val().length},ClearCounterBlackout:function(a){SN.C.I.CounterBlackout=false;SN.U.Counter(a)},RewriteAjaxAction:function(a){if(document.location.protocol==="https:"&&a.substr(0,5)==="http:"){return a.replace(/^http:\/\/[^:\/]+/,"https://"+document.location.host)}return a},FormXHR:function(a,b){$.ajax({type:"POST",dataType:"xml",url:SN.U.RewriteAjaxAction(a.attr("action")),data:a.serialize()+"&ajax=1",beforeSend:function(c){a.addClass(SN.C.S.Processing).find(".submit").addClass(SN.C.S.Disabled).prop(SN.C.S.Disabled,true)},error:function(e,f,d){var c=null;if(e.responseXML){c=$("#error",e.responseXML).text()}window.alert(c||d||f);a.removeClass(SN.C.S.Processing).find(".submit").removeClass(SN.C.S.Disabled).prop(SN.C.S.Disabled,false)},success:function(c,e){if($("form",c)[0]!==undefined){var d=document._importNode($("form",c)[0],true);a.replaceWith(d);if(b){b()}}else{if($("p",c)[0]!==undefined){a.replaceWith(document._importNode($("p",c)[0],true));if(b){b()}}else{window.alert("Unknown error.")}}}})},FormNoticeXHR:function(b){SN.C.I.NoticeDataGeo={};b.append('<input type="hidden" name="ajax" value="1"/>');b.attr("action",SN.U.RewriteAjaxAction(b.attr("action")));var c=function(d,e){b.append($('<p class="form_response"></p>').addClass(d).text(e))};var a=function(){b.find(".form_response").remove()};b.ajaxForm({dataType:"xml",timeout:"60000",beforeSend:function(d){if(b.find(".notice_data-text:first").val()==""){b.addClass(SN.C.S.Warning);return false}b.addClass(SN.C.S.Processing).find(".submit").addClass(SN.C.S.Disabled).prop(SN.C.S.Disabled,true);SN.U.normalizeGeoData(b);return true},error:function(f,g,e){b.removeClass(SN.C.S.Processing).find(".submit").removeClass(SN.C.S.Disabled).prop(SN.C.S.Disabled,false);a();if(g=="timeout"){c("error","Sorry! We had trouble sending your notice. The servers are overloaded. Please try again, and contact the site administrator if this problem persists.")}else{var d=SN.U.GetResponseXML(f);if($("."+SN.C.S.Error,d).length>0){b.append(document._importNode($("."+SN.C.S.Error,d)[0],true))}else{if(parseInt(f.status)===0||jQuery.inArray(parseInt(f.status),SN.C.I.HTTP20x30x)>=0){b.resetForm().find(".attach-status").remove();SN.U.FormNoticeEnhancements(b)}else{c("error","(Sorry! We had trouble sending your notice ("+f.status+" "+f.statusText+"). Please report the problem to the site administrator if this happens again.")}}}},success:function(j,f){a();var p=$("#"+SN.C.S.Error,j);if(p.length>0){c("error",p.text())}else{if($("body")[0].id=="bookmarklet"){self.close()}var d=$("#"+SN.C.S.CommandResult,j);if(d.length>0){c("success",d.text())}else{var o=document._importNode($("li",j)[0],true);var k=$("#notices_primary .notices:first");var m=b.closest("li.notice-reply");if(m.length>0){var l=b.closest(".threaded-replies");var n=l.find(".notice-reply-placeholder");m.remove();var e=$(o).attr("id");if($("#"+e).length==0){$(o).insertBefore(n)}n.show()}else{if(k.length>0&&SN.U.belongsOnTimeline(o)){if($("#"+o.id).length===0){var h=b.find("[name=inreplyto]").val();var g="#notices_primary #notice-"+h;if($("body")[0].id=="conversation"){if(h.length>0&&$(g+" .notices").length<1){$(g).append('<ul class="notices"></ul>')}$($(g+" .notices")[0]).append(o)}else{k.prepend(o)}$("#"+o.id).css({display:"none"}).fadeIn(2500);SN.U.NoticeWithAttachment($("#"+o.id));SN.U.switchInputFormTab("placeholder")}}else{c("success",$("title",j).text())}}}b.resetForm();b.find("[name=inreplyto]").val("");b.find(".attach-status").remove();SN.U.FormNoticeEnhancements(b)}},complete:function(d,e){b.removeClass(SN.C.S.Processing).find(".submit").prop(SN.C.S.Disabled,false).removeClass(SN.C.S.Disabled);b.find("[name=lat]").val(SN.C.I.NoticeDataGeo.NLat);b.find("[name=lon]").val(SN.C.I.NoticeDataGeo.NLon);b.find("[name=location_ns]").val(SN.C.I.NoticeDataGeo.NLNS);b.find("[name=location_id]").val(SN.C.I.NoticeDataGeo.NLID);b.find("[name=notice_data-geo]").prop("checked",SN.C.I.NoticeDataGeo.NDG)}})},FormProfileSearchXHR:function(a){$.ajax({type:"POST",dataType:"xml",url:a.attr("action"),data:a.serialize()+"&ajax=1",beforeSend:function(b){a.addClass(SN.C.S.Processing).find(".submit").addClass(SN.C.S.Disabled).prop(SN.C.S.Disabled,true)},error:function(c,d,b){window.alert(b||d)},success:function(d,f){var b=$("#profile_search_results");if($("ul",d)[0]!==undefined){var c=document._importNode($("ul",d)[0],true);b.replaceWith(c)}else{var e=$("<li/>").append(document._importNode($("p",d)[0],true));b.html(e)}a.removeClass(SN.C.S.Processing).find(".submit").removeClass(SN.C.S.Disabled).prop(SN.C.S.Disabled,false)}})},FormPeopletagsXHR:function(a){$.ajax({type:"POST",dataType:"xml",url:a.attr("action"),data:a.serialize()+"&ajax=1",beforeSend:function(b){a.find(".submit").addClass(SN.C.S.Processing).addClass(SN.C.S.Disabled).prop(SN.C.S.Disabled,true)},error:function(c,d,b){window.alert(b||d)},success:function(d,e){var c=a.parents(".entity_tags");if($(".entity_tags",d)[0]!==undefined){var b=document._importNode($(".entity_tags",d)[0],true);$(b).find(".editable").append($('<button class="peopletags_edit_button"/>'));c.replaceWith(b)}else{c.find("p").remove();c.append(document._importNode($("p",d)[0],true));a.removeClass(SN.C.S.Processing).find(".submit").removeClass(SN.C.S.Disabled).prop(SN.C.S.Disabled,false)}}})},normalizeGeoData:function(a){SN.C.I.NoticeDataGeo.NLat=a.find("[name=lat]").val();SN.C.I.NoticeDataGeo.NLon=a.find("[name=lon]").val();SN.C.I.NoticeDataGeo.NLNS=a.find("[name=location_ns]").val();SN.C.I.NoticeDataGeo.NLID=a.find("[name=location_id]").val();SN.C.I.NoticeDataGeo.NDG=a.find("[name=notice_data-geo]").prop("checked");var b=$.cookie(SN.C.S.NoticeDataGeoCookie);if(b!==undefined&&b!="disabled"){b=JSON.parse(b);SN.C.I.NoticeDataGeo.NLat=a.find("[name=lat]").val(b.NLat).val();SN.C.I.NoticeDataGeo.NLon=a.find("[name=lon]").val(b.NLon).val();if(b.NLNS){SN.C.I.NoticeDataGeo.NLNS=a.find("[name=location_ns]").val(b.NLNS).val();SN.C.I.NoticeDataGeo.NLID=a.find("[name=location_id]").val(b.NLID).val()}else{a.find("[name=location_ns]").val("");a.find("[name=location_id]").val("")}}if(b=="disabled"){SN.C.I.NoticeDataGeo.NDG=a.find("[name=notice_data-geo]").prop("checked",false).prop("checked")}else{SN.C.I.NoticeDataGeo.NDG=a.find("[name=notice_data-geo]").prop("checked",true).prop("checked")}},GetResponseXML:function(b){try{return b.responseXML}catch(a){return(new DOMParser()).parseFromString(b.responseText,"text/xml")}},NoticeReply:function(){$(document).on("click","#content .notice_reply",function(b){b.preventDefault();var a=$(this).closest("li.notice");SN.U.NoticeInlineReplyTrigger(a);return false})},NoticeReplyTo:function(a){},NoticeInlineReplyTrigger:function(k,l){var b=$($(".notice_id",k)[0]).text();var m,j;var e=k;var g=true;var f=k.closest(".notices");if(f.closest(".old-school").length){SN.U.switchInputFormTab("status");m=$("#input_form_status").find("form");g=false}else{if(f.hasClass("threaded-replies")){e=f.closest(".notice");m=$(".notice-reply-form",f)}else{f=$("ul.threaded-replies",k);if(f.length==0){SN.U.NoticeInlineReplyPlaceholder(k);f=$("ul.threaded-replies",k)}else{j=$("li.notice-reply-placeholder",k);if(j.length==0){SN.U.NoticeInlineReplyPlaceholder(k)}}m=$(".notice-reply-form",f)}}var d=function(){m.find("input[name=inreplyto]").val(b);if(g){m.find("#notice_to").prop("disabled",true).hide();m.find("#notice_private").prop("disabled",true).hide();m.find("label[for=notice_to]").hide();m.find("label[for=notice_private]").hide()}var p=m.find("textarea");if(p.length==0){throw"No textarea"}var o="";if(l){o=l+" "}p.val(o+p.val().replace(new RegExp(o,"i"),""));p.data("initialText",$.trim(l));p.focus();if(p[0].setSelectionRange){var n=p.val().length;p[0].setSelectionRange(n,n)}};if(m.length>0){d()}else{j=f.find("li.notice-reply-placeholder").hide();var h=$("li.notice-reply",f);if(h.length==0){h=$('<li class="notice-reply"></li>');var c=function(n){var o=document._importNode(n,true);h.append(o);f.append(h);var p=$(o);m=p;SN.Init.NoticeFormSetup(p);d()};if(SN.C.I.NoticeFormMaster){c(SN.C.I.NoticeFormMaster)}else{var a=$("#form_notice").attr("action");$.get(a,{ajax:1},function(n,p,o){c($("form",n)[0])})}}}},NoticeInlineReplyPlaceholder:function(b){var a=b.find("ul.threaded-replies");if(a.length==0){a=$('<ul class="notices threaded-replies xoxo"></ul>');b.append(a);a=b.find("ul.threaded-replies")}var c=$('<li class="notice-reply-placeholder"><input class="placeholder" /></li>');c.find("input").val(SN.msg("reply_placeholder"));a.append(c)},NoticeInlineReplySetup:function(){$("li.notice-reply-placeholder input").on("focus",function(){var a=$(this).closest("li.notice");SN.U.NoticeInlineReplyTrigger(a);return false});$("li.notice-reply-comments a").on("click",function(){var a=$(this).attr("href");var b=$(this).closest(".threaded-replies");$.get(a,{ajax:1},function(d,f,e){var c=$(".threaded-replies",d);if(c.length){b.replaceWith(document._importNode(c[0],true))}});return false})},NoticeRepeat:function(){$(".form_repeat").on("click",function(a){a.preventDefault();SN.U.NoticeRepeatConfirmation($(this));return false})},NoticeRepeatConfirmation:function(a){var c=a.find(".submit");var b=c.clone();b.addClass("submit_dialogbox").removeClass("submit");a.append(b);b.on("click",function(){SN.U.FormXHR(a);return false});c.hide();a.addClass("dialogbox").append('<button class="close">&#215;</button>').closest(".notice-options").addClass("opaque");a.find("button.close").click(function(){$(this).remove();a.removeClass("dialogbox").closest(".notice-options").removeClass("opaque");a.find(".submit_dialogbox").remove();a.find(".submit").show();return false})},NoticeAttachments:function(){$(".notice a.attachment").each(function(){SN.U.NoticeWithAttachment($(this).closest(".notice"))})},NoticeWithAttachment:function(b){if(b.find(".attachment").length===0){return}var a=b.find(".attachment.more");if(a.length>0){$(a[0]).click(function(){var c=$(this);c.addClass(SN.C.S.Processing);$.get(c.attr("href")+"/ajax",null,function(d){c.parent(".entry-content").html($(d).find("#attachment_view .entry-content").html())});return false}).attr("title",SN.msg("showmore_tooltip"))}},NoticeDataAttach:function(c){var b;var a=c.find("input[type=file]");a.change(function(f){c.find(".attach-status").remove();var e=$(this).val();if(!e){return false}var d=$('<div class="attach-status '+SN.C.S.Success+'"><code></code> <button class="close">&#215;</button></div>');d.find("code").text(e);d.find("button").click(function(){d.remove();a.val("");return false});c.append(d);if(typeof this.files==="object"){for(b=0;b<this.files.length;b++){SN.U.PreviewAttach(c,this.files[b])}}})},maxFileSize:function(b){var a=$(b).find("input[name=MAX_FILE_SIZE]").attr("value");if(a){return parseInt(a)}return 0},PreviewAttach:function(d,c){var e=c.type+" "+Math.round(c.size/1024)+"KB";var f=true;var h;if(window.createObjectURL!==undefined){h=function(j,k){k(window.createObjectURL(j))}}else{if(window.FileReader!==undefined){h=function(k,l){var j=new FileReader();j.onload=function(m){l(j.result)};j.readAsDataURL(k)}}else{f=false}}var a=["image/png","image/jpeg","image/gif","image/svg+xml"];if($.inArray(c.type,a)==-1){f=false}var g=8*1024*1024;if(c.size>g){f=false}if(f){h(c,function(k){var j=$("<img>").attr("title",e).attr("alt",e).attr("src",k).attr("style","height: 120px");d.find(".attach-status").append(j)})}else{var b=$("<div></div>").text(e);d.find(".attach-status").append(b)}},NoticeLocationAttach:function(a){var e=a.find("[name=lat]");var l=a.find("[name=lon]");var g=a.find("[name=location_ns]").val();var m=a.find("[name=location_id]").val();var b="";var d=a.find("[name=notice_data-geo]");var c=a.find("[name=notice_data-geo]");var k=a.find("label.notice_data-geo");function f(o){k.attr("title",jQuery.trim(k.text())).removeClass("checked");a.find("[name=lat]").val("");a.find("[name=lon]").val("");a.find("[name=location_ns]").val("");a.find("[name=location_id]").val("");a.find("[name=notice_data-geo]").prop("checked",false);$.cookie(SN.C.S.NoticeDataGeoCookie,"disabled",{path:"/"});if(o){a.find(".geo_status_wrapper").removeClass("success").addClass("error");a.find(".geo_status_wrapper .geo_status").text(o)}else{a.find(".geo_status_wrapper").remove()}}function n(o,p){SN.U.NoticeGeoStatus(a,"Looking up place name...");$.getJSON(o,p,function(q){var r,t,s;if(q.location_ns!==undefined){a.find("[name=location_ns]").val(q.location_ns);r=q.location_ns}if(q.location_id!==undefined){a.find("[name=location_id]").val(q.location_id);t=q.location_id}if(q.name===undefined){s=p.lat+";"+p.lon}else{s=q.name}SN.U.NoticeGeoStatus(a,s,p.lat,p.lon,q.url);k.attr("title",NoticeDataGeo_text.ShareDisable+" ("+s+")");a.find("[name=lat]").val(p.lat);a.find("[name=lon]").val(p.lon);a.find("[name=location_ns]").val(r);a.find("[name=location_id]").val(t);a.find("[name=notice_data-geo]").prop("checked",true);var u={NLat:p.lat,NLon:p.lon,NLNS:r,NLID:t,NLN:s,NLNU:q.url,NDG:true};$.cookie(SN.C.S.NoticeDataGeoCookie,JSON.stringify(u),{path:"/"})})}if(c.length>0){if($.cookie(SN.C.S.NoticeDataGeoCookie)=="disabled"){c.prop("checked",false)}else{c.prop("checked",true)}var h=a.find(".notice_data-geo_wrap");var j=h.attr("data-api");k.attr("title",k.text());c.change(function(){if(c.prop("checked")===true||$.cookie(SN.C.S.NoticeDataGeoCookie)===null){k.attr("title",NoticeDataGeo_text.ShareDisable).addClass("checked");if($.cookie(SN.C.S.NoticeDataGeoCookie)===null||$.cookie(SN.C.S.NoticeDataGeoCookie)=="disabled"){if(navigator.geolocation){SN.U.NoticeGeoStatus(a,"Requesting location from browser...");navigator.geolocation.getCurrentPosition(function(q){a.find("[name=lat]").val(q.coords.latitude);a.find("[name=lon]").val(q.coords.longitude);var r={lat:q.coords.latitude,lon:q.coords.longitude,token:$("#token").val()};n(j,r)},function(q){switch(q.code){case q.PERMISSION_DENIED:f("Location permission denied.");break;case q.TIMEOUT:f("Location lookup timeout.");break}},{timeout:10000})}else{if(e.length>0&&l.length>0){var o={lat:e,lon:l,token:$("#token").val()};n(j,o)}else{f();c.remove();k.remove()}}}else{var p=JSON.parse($.cookie(SN.C.S.NoticeDataGeoCookie));a.find("[name=lat]").val(p.NLat);a.find("[name=lon]").val(p.NLon);a.find("[name=location_ns]").val(p.NLNS);a.find("[name=location_id]").val(p.NLID);a.find("[name=notice_data-geo]").prop("checked",p.NDG);SN.U.NoticeGeoStatus(a,p.NLN,p.NLat,p.NLon,p.NLNU);k.attr("title",NoticeDataGeo_text.ShareDisable+" ("+p.NLN+")").addClass("checked")}}else{f()}}).change()}},NoticeGeoStatus:function(e,a,f,g,c){var h=e.find(".geo_status_wrapper");if(h.length==0){h=$('<div class="'+SN.C.S.Success+' geo_status_wrapper"><button class="close" style="float:right">&#215;</button><div class="geo_status"></div></div>');h.find("button.close").click(function(){e.find("[name=notice_data-geo]").prop("checked",false).change();return false});e.append(h)}var b;if(c){b=$("<a></a>").attr("href",c)}else{b=$("<span></span>")}b.text(a);if(f||g){var d=f+";"+g;b.attr("title",d);if(!a){b.text(d)}}h.find(".geo_status").empty().append(b)},NewDirectMessage:function(){NDM=$(".entity_send-a-message a");NDM.attr({href:NDM.attr("href")+"&ajax=1"});NDM.on("click",function(){var a=$(".entity_send-a-message form");if(a.length===0){$(this).addClass(SN.C.S.Processing);$.get(NDM.attr("href"),null,function(b){$(".entity_send-a-message").append(document._importNode($("form",b)[0],true));a=$(".entity_send-a-message .form_notice");SN.U.FormNoticeXHR(a);SN.U.FormNoticeEnhancements(a);a.append('<button class="close">&#215;</button>');$(".entity_send-a-message button").click(function(){a.hide();return false});NDM.removeClass(SN.C.S.Processing)})}else{a.show();$(".entity_send-a-message textarea").focus()}return false})},GetFullYear:function(c,d,a){var b=new Date();b.setFullYear(c,d,a);return b},StatusNetInstance:{Set:function(b){var a=SN.U.StatusNetInstance.Get();if(a!==null){b=$.extend(a,b)}$.cookie(SN.C.S.StatusNetInstance,JSON.stringify(b),{path:"/",expires:SN.U.GetFullYear(2029,0,1)})},Get:function(){var a=$.cookie(SN.C.S.StatusNetInstance);if(a!==null){return JSON.parse(a)}return null},Delete:function(){$.cookie(SN.C.S.StatusNetInstance,null)}},belongsOnTimeline:function(b){var a=$("body").attr("id");if(a=="public"){return true}var c=$("#nav_profile a").attr("href");if(c){var d=$(b).find(".vcard.author a.url").attr("href");if(d==c){if(a=="all"||a=="showstream"){return true}}}return false},switchInputFormTab:function(a){$(".input_form_nav_tab.current").removeClass("current");if(a=="placeholder"){$("#input_form_nav_status").addClass("current")}else{$("#input_form_nav_"+a).addClass("current")}var b=$(".input_form.current.nonav");if(b.length>0){return}$(".input_form.current").removeClass("current");$("#input_form_"+a).addClass("current").find(".ajax-notice").each(function(){var c=$(this);SN.Init.NoticeFormSetup(c)}).find(".notice_data-text").focus()},showMoreMenuItems:function(c){$("#"+c+" .more_link").remove();var b="#"+c+" .extended_menu";var a=$(b);a.removeClass("extended_menu");return void (0)}},Init:{NoticeForm:function(){if($("body.user_in").length>0){$("#input_form_placeholder input.placeholder").focus(function(){SN.U.switchInputFormTab("status")});$("body").on("click",function(g){var d=$("#content .input_forms div.current");if(d.length>0){if($("#content .input_forms").has(g.target).length==0){var a=d.find('textarea, input[type=text], input[type=""]');var c=false;a.each(function(){c=c||$(this).val()});if(!c){SN.U.switchInputFormTab("placeholder")}}}var b=$("li.notice-reply");if(b.length>0){var f=$(g.target);b.each(function(){var k=$(this);if(k.has(g.target).length==0){var h=k.find(".notice_data-text:first");var j=$.trim(h.val());if(j==""||j==h.data("initialText")){var e=k.closest("li.notice");k.remove();e.find("li.notice-reply-placeholder").show()}}})}});$(".input_forms fieldset fieldset label").inFieldLabels({fadeOpacity:0})}},NoticeFormSetup:function(a){if(!a.data("NoticeFormSetup")){SN.U.NoticeLocationAttach(a);SN.U.FormNoticeXHR(a);SN.U.FormNoticeEnhancements(a);SN.U.NoticeDataAttach(a);a.data("NoticeFormSetup",true)}},Notices:function(){if($("body.user_in").length>0){var a=$(".form_notice:first");if(a.length>0){SN.C.I.NoticeFormMaster=document._importNode(a[0],true)}SN.U.NoticeRepeat();SN.U.NoticeReply();SN.U.NoticeInlineReplySetup()}SN.U.NoticeAttachments()},EntityActions:function(){if($("body.user_in").length>0){$(document).on("click",".form_user_subscribe",function(){SN.U.FormXHR($(this));return false});$(document).on("click",".form_user_unsubscribe",function(){SN.U.FormXHR($(this));return false});$(document).on("click",".form_group_join",function(){SN.U.FormXHR($(this));return false});$(document).on("click",".form_group_leave",function(){SN.U.FormXHR($(this));return false});$(document).on("click",".form_user_nudge",function(){SN.U.FormXHR($(this));return false});$(document).on("click",".form_peopletag_subscribe",function(){SN.U.FormXHR($(this));return false});$(document).on("click",".form_peopletag_unsubscribe",function(){SN.U.FormXHR($(this));return false});$(document).on("click",".form_user_add_peopletag",function(){SN.U.FormXHR($(this));return false});$(document).on("click",".form_user_remove_peopletag",function(){SN.U.FormXHR($(this));return false});SN.U.NewDirectMessage()}},ProfileSearch:function(){if($("body.user_in").length>0){$(document).on("click",".form_peopletag_edit_user_search input.submit",function(){SN.U.FormProfileSearchXHR($(this).parents("form"));return false})}},Login:function(){if(SN.U.StatusNetInstance.Get()!==null){var a=SN.U.StatusNetInstance.Get().Nickname;if(a!==null){$("#form_login #nickname").val(a)}}$("#form_login").on("submit",function(){SN.U.StatusNetInstance.Set({Nickname:$("#form_login #nickname").val()});return true})},PeopletagAutocomplete:function(b){var a=function(d){return d.split(/\s+/)};var c=function(d){return a(d).pop()};b.on("keydown",function(d){if(d.keyCode===$.ui.keyCode.TAB&&$(this).data("autocomplete").menu.active){d.preventDefault()}}).autocomplete({minLength:0,source:function(e,d){d($.ui.autocomplete.filter(SN.C.PtagACData,c(e.term)))},focus:function(){return false},select:function(e,f){var d=a(this.value);d.pop();d.push(f.item.value);d.push("");this.value=d.join(" ");return false}}).data("autocomplete")._renderItem=function(e,f){var d='<a class="ptag-ac-line-tag">'+f.tag+' <em class="privacy_mode">'+f.mode+'</em><span class="freq">'+f.freq+"</span></a>";return $("<li/>").addClass("mode-"+f.mode).addClass("ptag-ac-line").data("item.autocomplete",f).append(d).appendTo(e)}},PeopleTags:function(){$(".user_profile_tags .editable").append($('<button class="peopletags_edit_button"/>'));$(document).on("click",".peopletags_edit_button",function(){var a=$(this).parents("dd").eq(0).find("form");$.ajax({url:_peopletagAC,dataType:"json",data:{token:$("#token").val()},ifModified:true,success:function(b){for(i=0;i<b.length;i++){b[i].label=b[i].tag}SN.C.PtagACData=b;SN.Init.PeopletagAutocomplete(a.find("#tags"))}});$(this).parents("ul").eq(0).fadeOut(200,function(){a.fadeIn(200).find("input#tags")})});$(document).on("click",".user_profile_tags form .submit",function(){SN.U.FormPeopletagsXHR($(this).parents("form"));return false})},AjaxForms:function(){$(document).on("submit","form.ajax",function(){SN.U.FormXHR($(this));return false});$(document).on("click","form.ajax input[type=submit]",function(){var a=$(this);var b=a.closest("form");b.find(".hidden-submit-button").remove();$('<input class="hidden-submit-button" type="hidden" />').attr("name",a.attr("name")).val(a.val()).appendTo(b)})},UploadForms:function(){$("input[type=file]").change(function(d){if(typeof this.files==="object"&&this.files.length>0){var c=0;for(var b=0;b<this.files.length;b++){c+=this.files[b].size}var a=SN.U.maxFileSize($(this.form));if(a>0&&c>a){var e="File too large: maximum upload size is %d bytes.";alert(e.replace("%d",a));$(this).val("");d.preventDefault();return false}}})},CheckBoxes:function(){$("span[class='checkbox-wrapper']").addClass("unchecked");$(".checkbox-wrapper").click(function(){if($(this).children("input").prop("checked")){$(this).children("input").prop("checked",false);$(this).removeClass("checked");$(this).addClass("unchecked");$(this).children("label").text("Private?")}else{$(this).children("input").prop("checked",true);$(this).removeClass("unchecked");$(this).addClass("checked");$(this).children("label").text("Private")}})}}};$(function(){SN.Init.AjaxForms();SN.Init.UploadForms();SN.Init.CheckBoxes();if($("."+SN.C.S.FormNotice).length>0){SN.Init.NoticeForm()}if($("#content .notices").length>0){SN.Init.Notices()}if($("#content .entity_actions").length>0){SN.Init.EntityActions()}if($("#form_login").length>0){SN.Init.Login()}if($("#profile_search_results").length>0){SN.Init.ProfileSearch()}if($(".user_profile_tags .editable").length>0){SN.Init.PeopleTags()}});if(!document.ELEMENT_NODE){document.ELEMENT_NODE=1;document.ATTRIBUTE_NODE=2;document.TEXT_NODE=3;document.CDATA_SECTION_NODE=4;document.ENTITY_REFERENCE_NODE=5;document.ENTITY_NODE=6;document.PROCESSING_INSTRUCTION_NODE=7;document.COMMENT_NODE=8;document.DOCUMENT_NODE=9;document.DOCUMENT_TYPE_NODE=10;document.DOCUMENT_FRAGMENT_NODE=11;document.NOTATION_NODE=12}document._importNode=function(e,a){switch(e.nodeType){case document.ELEMENT_NODE:var d=document.createElement(e.nodeName);if(e.attributes&&e.attributes.length>0){for(var c=0,b=e.attributes.length;c<b;){if(e.attributes[c].nodeName=="class"){d.className=e.getAttribute(e.attributes[c++].nodeName)}else{d.setAttribute(e.attributes[c].nodeName,e.getAttribute(e.attributes[c++].nodeName))}}}if(a&&e.childNodes&&e.childNodes.length>0){for(var c=0,b=e.childNodes.length;c<b;){d.appendChild(document._importNode(e.childNodes[c++],a))}}return d;break;case document.TEXT_NODE:case document.CDATA_SECTION_NODE:case document.COMMENT_NODE:return document.createTextNode(e.nodeValue);break}};if(typeof navigator.geolocation=="undefined"||navigator.geolocation.shim){(function(){(function(){if(window.google&&google.gears){return}var c=null;if(typeof GearsFactory!="undefined"){c=new GearsFactory()}else{try{c=new ActiveXObject("Gears.Factory");if(c.getBuildInfo().indexOf("ie_mobile")!=-1){c.privateSetGlobalObject(this)}}catch(d){if((typeof navigator.mimeTypes!="undefined")&&navigator.mimeTypes["application/x-googlegears"]){c=document.createElement("object");c.style.display="none";c.width=0;c.height=0;c.type="application/x-googlegears";document.documentElement.appendChild(c)}}}if(!c){return}if(!window.google){google={}}if(!google.gears){google.gears={factory:c}}})();var a=(function(){var d=google.gears.factory.create("beta.geolocation");var c=function(f,e){return function(g){f(g);e.lastPosition=g}};return{shim:true,type:"Gears",lastPosition:null,getCurrentPosition:function(e,g,h){var f=this;var j=c(e,f);d.getCurrentPosition(j,g,h)},watchPosition:function(e,f,g){d.watchPosition(e,f,g)},clearWatch:function(e){d.clearWatch(e)},getPermission:function(g,e,f){d.getPermission(g,e,f)}}});var b=(function(){var j=false;var e=function(){if(!d()&&!j){j=true;var k=document.createElement("script");k.src=(document.location.protocol=="https:"?"https://":"http://")+"www.google.com/jsapi?callback=_google_loader_apiLoaded";k.type="text/javascript";document.getElementsByTagName("body")[0].appendChild(k)}};var c=[];var h=function(k){c.push(k)};var f=function(){if(d()){while(c.length>0){var k=c.pop();k()}}};window._google_loader_apiLoaded=function(){f()};var d=function(){return(window.google&&google.loader)};var g=function(k){if(d()){return true}h(k);e();return false};e();return{shim:true,type:"ClientLocation",lastPosition:null,getCurrentPosition:function(l,o,p){var n=this;if(!g(function(){n.getCurrentPosition(l,o,p)})){return}if(google.loader.ClientLocation){var m=google.loader.ClientLocation;var k={coords:{latitude:m.latitude,longitude:m.longitude,altitude:null,accuracy:43000,altitudeAccuracy:null,heading:null,speed:null},address:{city:m.address.city,country:m.address.country,country_code:m.address.country_code,region:m.address.region},timestamp:new Date()};l(k);this.lastPosition=k}else{if(o==="function"){o({code:3,message:"Using the Google ClientLocation API and it is not able to calculate a location."})}}},watchPosition:function(k,m,n){this.getCurrentPosition(k,m,n);var l=this;var o=setInterval(function(){l.getCurrentPosition(k,m,n)},10000);return o},clearWatch:function(k){clearInterval(k)},getPermission:function(m,k,l){return true}}});navigator.geolocation=(window.google&&google.gears)?a():b()})()};
\ No newline at end of file
index 6d21c36e370985861b5c479188189dd3c99ec89f..74ced563fbbbc46e3951dc9dfc5431db7ac38f89 100644 (file)
@@ -370,32 +370,20 @@ class Action extends HTMLOutputter // lawsuit
     {
         if (Event::handle('StartShowScripts', array($this))) {
             if (Event::handle('StartShowJQueryScripts', array($this))) {
-                if (common_config('site', 'minify')) {
-                    $this->script('extlib/jquery.min.js');
-                    $this->script('extlib/jquery.form.min.js');
-                    $this->script('extlib/jquery-ui/jquery-ui.min.js');
-                    $this->script('extlib/jquery.cookie.min.js');
-                    $this->inlineScript('if (typeof window.JSON !== "object") { $.getScript("'.common_path('js/extlib/json2.min.js', StatusNet::isHTTPS()).'"); }');
-                    $this->script('extlib/jquery.infieldlabel.min.js');
-                } else {
-                    $this->script('extlib/jquery.js');
-                    $this->script('extlib/jquery.form.js');
-                    $this->script('extlib/jquery-ui/jquery-ui.js');
-                    $this->script('extlib/jquery.cookie.js');
-                    $this->inlineScript('if (typeof window.JSON !== "object") { $.getScript("'.common_path('js/extlib/json2.js', StatusNet::isHTTPS()).'"); }');
-                    $this->script('extlib/jquery.infieldlabel.js');
-                }
+                $this->script('extlib/jquery.js');
+                $this->script('extlib/jquery.form.js');
+                $this->script('extlib/jquery-ui/jquery-ui.js');
+                $this->script('extlib/jquery.cookie.js');
+                $this->inlineScript('if (typeof window.JSON !== "object") { $.getScript("'.common_path('js/extlib/json2.js', StatusNet::isHTTPS()).'"); }');
+                $this->script('extlib/jquery.infieldlabel.js');
 
                 Event::handle('EndShowJQueryScripts', array($this));
             }
             if (Event::handle('StartShowStatusNetScripts', array($this))) {
-                if (common_config('site', 'minify')) {
-                    $this->script('util.min.js');
-                } else {
-                    $this->script('util.js');
-                    $this->script('xbImportNode.js');
-                    $this->script('geometa.js');
-                }
+                $this->script('util.js');
+                $this->script('xbImportNode.js');
+                $this->script('geometa.js');
+
                 // This route isn't available in single-user mode.
                 // Not sure why, but it causes errors here.
                 $this->inlineScript('var _peopletagAC = "' .
@@ -693,7 +681,8 @@ class Action extends HTMLOutputter // lawsuit
     function showNoticeForm()
     {
         // TRANS: Tab on the notice form.
-        $tabs = array('status' => _m('TAB','Status'));
+        $tabs = array('status' => array('title' => _m('TAB','Status'),
+                                        'href'  => common_local_url('newnotice')));
 
         $this->elementStart('div', 'input_forms');
 
@@ -701,7 +690,8 @@ class Action extends HTMLOutputter // lawsuit
             $this->elementStart('ul', array('class' => 'nav',
                                             'id' => 'input_form_nav'));
 
-            foreach ($tabs as $tag => $title) {
+            foreach ($tabs as $tag => $data) {
+                $tag = htmlspecialchars($tag);
                 $attrs = array('id' => 'input_form_nav_'.$tag,
                                'class' => 'input_form_nav_tab');
 
@@ -714,8 +704,9 @@ class Action extends HTMLOutputter // lawsuit
                 $this->elementStart('li', $attrs);
 
                 $this->element('a',
-                               array('href' => 'javascript:SN.U.switchInputFormTab("'.$tag.'")'),
-                               $title);
+                               array('onclick' => 'return SN.U.switchInputFormTab("'.$tag.'");',
+                                     'href' => $data['href']),
+                               $data['title']);
                 $this->elementEnd('li');
             }
 
@@ -728,7 +719,7 @@ class Action extends HTMLOutputter // lawsuit
             $form->show();
             $this->elementEnd('div');
 
-            foreach ($tabs as $tag => $title) {
+            foreach ($tabs as $tag => $data) {
                 $attrs = array('class' => 'input_form',
                                'id' => 'input_form_'.$tag);
 
index 40c4889f27afd6fd6905a363b1e38a69514fa3b6..93a4d36ebbe6c673953ed73e45b5676af54a7f9e 100644 (file)
@@ -134,14 +134,6 @@ class AdminPanelNav extends Menu
                                      $menu_title, $action_name == 'sitenoticeadminpanel', 'nav_sitenotice_admin_panel');
             }
 
-            if (AdminPanelAction::canAdmin('snapshot')) {
-                // TRANS: Menu item title in administrator navigation panel.
-                $menu_title = _('Snapshots configuration');
-                // TRANS: Menu item in administrator navigation panel.
-                $this->out->menuItem(common_local_url('snapshotadminpanel'), _m('MENU','Snapshots'),
-                                     $menu_title, $action_name == 'snapshotadminpanel', 'nav_snapshot_admin_panel');
-            }
-
             if (AdminPanelAction::canAdmin('license')) {
                 // TRANS: Menu item title in administrator navigation panel.
                 $menu_title = _('Set site license');
index d151f4c51fd7f461f639235d9db39d87d4d11211..f8ffbc84a5b4bc449abe779c160bb2146aee1917 100644 (file)
@@ -215,6 +215,8 @@ class ApiAction extends Action
 
         // TODO: avatar url template (example.com/user/avatar?size={x}x{y})
         $twitter_user['profile_image_url'] = Avatar::urlByProfile($profile, AVATAR_STREAM_SIZE);
+        $twitter_user['profile_image_url_https'] = $twitter_user['profile_image_url'];
+
         // START introduced by qvitter API, not necessary for StatusNet API
         $twitter_user['profile_image_url_profile_size'] = Avatar::urlByProfile($profile, AVATAR_PROFILE_SIZE);
         try {
@@ -1466,7 +1468,7 @@ class ApiAction extends Action
             } else if ($this->arg('screen_name')) {
                 $nickname = common_canonical_nickname($this->arg('screen_name'));
                 $user = User::getKV('nickname', $nickname);
-                return $user ? $user->getProfile() : null;
+                return $user instanceof User ? $user->getProfile() : null;
             } else {
                 // Fall back to trying the currently authenticated user
                 return $this->scoped;
index 7550ec5f6fa8723e4b240eb6c5724cd08c3d70f7..da412df8d298bfe9a55a946a37b4df71c7a79ecc 100644 (file)
@@ -30,7 +30,7 @@ class ApiGNUsocialOAuthDataStore extends OAuthDataStore
     {
         $con = Consumer::getKV('consumer_key', $consumerKey);
 
-        if (!$con) {
+        if (!$con instanceof Consumer) {
 
             // Create an anon consumer and anon application if one
             // doesn't exist already
index 1d5be73714ada190a4690412b29918137e6077e4..c0c45a1dbb2fdea7c2964bda3db5cecb8f9b2613 100644 (file)
@@ -28,7 +28,7 @@
  * @link      http://status.net/
  */
 
-if (!defined('STATUSNET') && !defined('LACONICA')) {
+if (!defined('GNUSOCIAL') && !defined('STATUSNET')) {
     exit(1);
 }
 
@@ -67,12 +67,12 @@ class AttachmentList extends Widget
     }
 
     /**
-     * show the list of notices
+     * show the list of attachments
      *
      * "Uses up" the stream by looping through it. So, probably can't
      * be called twice on the same list.
      *
-     * @return int count of notices listed.
+     * @return int count of items listed.
      */
     function show()
     {
@@ -101,16 +101,13 @@ class AttachmentList extends Widget
     }
 
     /**
-     * returns a new list item for the current notice
+     * returns a new list item for the current attachment
      *
-     * Recipe (factory?) method; overridden by sub-classes to give
-     * a different list item class.
+     * @param File $attachment the current attachment
      *
-     * @param Notice $notice the current notice
-     *
-     * @return NoticeListItem a list item for displaying the notice
+     * @return AttachmentListItem a list item for displaying the attachment
      */
-    function newListItem($attachment)
+    function newListItem(File $attachment)
     {
         return new AttachmentListItem($attachment, $this->out);
     }
@@ -142,13 +139,9 @@ class AttachmentListItem extends Widget
     var $oembed = null;
 
     /**
-     * constructor
-     *
-     * Also initializes the profile attribute.
-     *
-     * @param Notice $notice The notice we'll display
+     * @param File $attachment the attachment we will display
      */
-    function __construct($attachment, $out=null)
+    function __construct(File $attachment, $out=null)
     {
         parent::__construct($out);
         $this->attachment  = $attachment;
index 6a04b32dddcc58864ff235c7ef07c0582780c7d4..c5794565a302f181c740d8b00c02ec1785021054 100644 (file)
@@ -62,7 +62,6 @@ $default =
               'use_x_sendfile' => false,
               'notice' => null, // site wide notice text
               'build' => 1, // build number, for code-dependent cache
-              'minify' => false, // true to use the minified versions of JS files; false to use orig files. Can aid during development
               ),
         'db' =>
           array('database' => null, // must be set
@@ -86,6 +85,7 @@ $default =
               'facility' => LOG_USER),
         'queue' =>
         array('enabled' => true,
+              'daemon' => false, # Use queuedaemon. Default to false
               'subsystem' => 'db', # default to database, or 'stomp'
               'stomp_server' => null,
               'queue_basename' => '/queue/statusnet/',
@@ -207,10 +207,6 @@ $default =
         'newuser' =>
         array('default' => null,
               'welcome' => null),
-        'snapshot' =>
-        array('run' => 'web',
-              'frequency' => 10000,
-              'reporturl' => 'http://status.net/stats/report'),
         'attachments' =>
         array('server' => null,
               'dir' => INSTALLDIR . '/file/',
index ede0e3100f4439f393f1ae7d2e15a47cacb1f166..0e2867fba890170882b62c1a22a90489db525c88 100644 (file)
@@ -46,7 +46,7 @@ class GroupAction extends Action
 {
     protected $group;
 
-    function prepare($args)
+    protected function prepare(array $args=array())
     {
         parent::prepare($args);
 
index 6292b184673907b0d5641f722491fa57168c210c..b649dc3e2c51a6caca4f051d9fb62dc28bc262e0 100644 (file)
@@ -34,7 +34,7 @@
  * @author   Tom Adams <tom@holizz.com>
  * @author   Zach Copley <zach@status.net>
  * @copyright 2009-2010 StatusNet, Inc http://status.net
- * @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
+ * @copyright 2009-2014 Free Software Foundation, Inc http://www.fsf.org
  * @license  GNU Affero General Public License http://www.gnu.org/licenses/
  * @version  1.0.x
  * @link     http://status.net
@@ -96,25 +96,12 @@ abstract class Installer
             }
         }
 
-        if (version_compare(PHP_VERSION, '5.2.3', '<')) {
-            $this->warning('Require PHP version 5.2.3 or greater.');
+        if (version_compare(PHP_VERSION, '5.3.2', '<')) {
+            $this->warning('Require PHP version 5.3.2 or greater.');
             $pass = false;
         }
 
-        // Look for known library bugs
-        $str = "abcdefghijklmnopqrstuvwxyz";
-        $replaced = preg_replace('/[\p{Cc}\p{Cs}]/u', '*', $str);
-        if ($str != $replaced) {
-            $this->warning('PHP is linked to a version of the PCRE library ' .
-                           'that does not support Unicode properties. ' .
-                           'If you are running Red Hat Enterprise Linux / ' .
-                           'CentOS 5.4 or earlier, see <a href="' .
-                           'http://status.net/wiki/Red_Hat_Enterprise_Linux#PCRE_library' .
-                           '">our documentation page</a> on fixing this.');
-            $pass = false;
-        }
-
-        $reqs = array('gd', 'curl',
+        $reqs = array('gd', 'curl', 'json',
                       'xmlwriter', 'mbstring', 'xml', 'dom', 'simplexml');
 
         foreach ($reqs as $req) {
@@ -227,7 +214,7 @@ abstract class Installer
         $fail = false;
 
         if (empty($this->adminNick)) {
-            $this->updateStatus("No initial StatusNet user nickname specified.", true);
+            $this->updateStatus("No initial user nickname specified.", true);
             $fail = true;
         }
         if ($this->adminNick && !preg_match('/^[0-9a-z]{1,64}$/', $this->adminNick)) {
@@ -245,7 +232,7 @@ abstract class Installer
         }
 
         if (empty($this->adminPass)) {
-            $this->updateStatus("No initial StatusNet user password specified.", true);
+            $this->updateStatus("No initial user password specified.", true);
             $fail = true;
         }
 
@@ -301,7 +288,7 @@ abstract class Installer
         } else if ($this->dbtype == 'pgsql') {
             $record = $conn->getRow('SHOW server_encoding');
             if ($record->server_encoding != 'UTF8') {
-                $this->updateStatus("StatusNet requires UTF8 character encoding. Your database is ". htmlentities($record->server_encoding));
+                $this->updateStatus("GNU social requires UTF8 character encoding. Your database is ". htmlentities($record->server_encoding));
                 return false;
             }
         }
@@ -508,7 +495,7 @@ abstract class Installer
 
     /**
      * Create the initial admin user account.
-     * Side effect: may load portions of StatusNet framework.
+     * Side effect: may load portions of GNU social framework.
      * Side effect: outputs program info
      */
     function registerInitialUser()
@@ -612,7 +599,7 @@ abstract class Installer
                 );
             } else {
                 $this->updateStatus(
-                    "Could not create initial GNU social user.",
+                    "Could not create initial user account.",
                     true
                 );
                 return false;
@@ -637,9 +624,9 @@ abstract class Installer
         $scheme = $this->ssl === 'always' ? 'https' : 'http';
         $link = "{$scheme}://{$this->server}/{$this->path}";
 
-        $this->updateStatus("StatusNet has been installed at $link");
+        $this->updateStatus("GNU social has been installed at $link");
         $this->updateStatus(
-            "<strong>DONE!</strong> You can visit your <a href='$link'>new StatusNet site</a> (login as '$this->adminNick'). If this is your first StatusNet install, you may want to poke around our <a href='http://status.net/wiki/Getting_started'>Getting Started guide</a>."
+            '<strong>DONE!</strong> You can visit your <a href="'.htmlspecialchars($link).'">new GNU social site</a> (log in as "'.htmlspecialchars($this->adminNick).'"). If this is your first GNU social install, make your experience the best possible by visiting our resource site to join the mailing list and <a href="http://gnu.io/resources/">good documentation</a>.'
         );
 
         return true;
index 9ba4b0311c6176f13c3ef43be7060eeb57624d44..d967cfd796e546f91c50254dc8e2467529cff633 100644 (file)
@@ -50,9 +50,7 @@ function mail_backend()
 
     if (!$backend) {
         $backend = Mail::factory(common_config('mail', 'backend'),
-                                 (common_config('mail', 'params')) ?
-                                 common_config('mail', 'params') :
-                                 array());
+                                 common_config('mail', 'params') ?: array());
         if (PEAR::isError($backend)) {
             common_server_error($backend->getMessage(), 500);
         }
index 8cb1450788e9f576bd9397310424f4434ef03aaa..4da3bef935a7e60c7a6c6da3e00511df18f4c2f3 100644 (file)
@@ -162,6 +162,14 @@ abstract class MicroAppPlugin extends Plugin
      */
     abstract function deleteRelated($notice);
 
+    /**
+     *
+     */
+    public function newFormAction() {
+        // such as 'newbookmark' or 'newevent' route
+        return 'new'.$this->tag();
+    }
+
     /**
      * Check if a given notice object should be handled by this micro-app
      * plugin.
@@ -536,7 +544,9 @@ abstract class MicroAppPlugin extends Plugin
 
     function onStartShowEntryForms(&$tabs)
     {
-        $tabs[$this->tag()] = $this->appTitle();
+        $tabs[$this->tag()] = array('title' => $this->appTitle(),
+                                    'href'  => common_local_url($this->newFormAction()),
+                                   );
         return true;
     }
 
index df6e8d98c205522b731c00c7d0677cbcc59b1bfa..b00e476d92a1e11f231fea7b40977f7e096e97c8 100644 (file)
  * @link      http://status.net/
  */
 
-if (!defined('STATUSNET') && !defined('LACONICA')) {
-    exit(1);
-}
-
-require_once INSTALLDIR.'/lib/favorform.php';
-require_once INSTALLDIR.'/lib/disfavorform.php';
-require_once INSTALLDIR.'/lib/attachmentlist.php';
+if (!defined('GNUSOCIAL') && !defined('STATUSNET')) { exit(1); }
 
 /**
  * widget for displaying a list of notices
@@ -136,8 +130,7 @@ class NoticeList extends Widget
             $profiles = Notice::fillProfiles($notices);
        
             $p = Profile::current();
-       
-            if (!empty($p)) {
+            if ($p instanceof Profile) {
 
                 $ids = array();
        
index 605a4d12b5a9da0a450daa74d17dc3148c86216a..5acdc1c2ba5e076be788deb9206010767be1606a 100644 (file)
@@ -99,7 +99,11 @@ class Plugin
      */
     public function onAutoload($cls) {
         $cls = basename($cls);
-        $basedir = INSTALLDIR . '/plugins/' . mb_substr(get_called_class(), 0, -6);
+        $basedir = INSTALLDIR . '/local/plugins/' . mb_substr(get_called_class(), 0, -6);
+        if (!file_exists($basedir)) {
+            $basedir = INSTALLDIR . '/plugins/' . mb_substr(get_called_class(), 0, -6);
+        }
+
         $file = null;
 
         if (preg_match('/^(\w+)(Action|Form)$/', $cls, $type)) {
index 0e37ab0c530f84c363987adf881a430a06a60437..bc18e1fc56fe9e39ca6a769c8eec9dcdd46ff599 100644 (file)
@@ -180,7 +180,8 @@ abstract class QueueManager extends IoManager
         $object = unserialize($frame);
 
         // If it is a string, we really store a JSON object in there
-        if (is_string($object)) {
+        // except if it begins with '<', because then it is XML.
+        if (is_string($object) && substr($object, 0, 1) != '<') {
             $json = json_decode($object);
             if ($json === null) {
                 throw new Exception('Bad frame in queue item');
index c8277859de319d7608fdc864014c579eeb0b622f..71bf4e8e82d5c9751125f912baef118e19185a24 100644 (file)
@@ -397,6 +397,15 @@ class Router
             $m->connect('api/statuses/replies.:format',
                         array('action' => 'ApiTimelineMentions',
                               'format' => '(xml|json|rss|atom|as)'));
+            $m->connect('api/statuses/mentions_timeline/:id.:format',
+                        array('action' => 'ApiTimelineMentions',
+                              'id' => Nickname::INPUT_FMT,
+                              'format' => '(xml|json|rss|atom|as)'));
+
+            $m->connect('api/statuses/mentions_timeline.:format',
+                        array('action' => 'ApiTimelineMentions',
+                              'format' => '(xml|json|rss|atom|as)'));
 
             $m->connect('api/statuses/retweeted_by_me.:format',
                         array('action' => 'ApiTimelineRetweetedByMe',
@@ -604,6 +613,18 @@ class Router
 
             // favorites
 
+            $m->connect('api/favorites/create.:format',
+                        array('action' => 'ApiFavoriteCreate',
+                              'format' => '(xml|json)'));
+
+            $m->connect('api/favorites/destroy.:format',
+                        array('action' => 'ApiFavoriteDestroy',
+                              'format' => '(xml|json)'));
+
+            $m->connect('api/favorites/list.:format',
+                        array('action' => 'ApiTimelineFavorites',
+                              'format' => '(xml|json|rss|atom|as)'));
+
             $m->connect('api/favorites/:id.:format',
                         array('action' => 'ApiTimelineFavorites',
                               'id' => Nickname::INPUT_FMT,
@@ -622,6 +643,7 @@ class Router
                         array('action' => 'ApiFavoriteDestroy',
                               'id' => '[0-9]+',
                               'format' => '(xml|json)'));
+
             // blocks
 
             $m->connect('api/blocks/create/:id.:format',
@@ -690,11 +712,11 @@ class Router
 
             $m->connect('api/statusnet/groups/join/:id.:format',
                         array('action' => 'ApiGroupJoin',
+                              'id' => Nickname::INPUT_FMT,
                               'format' => '(xml|json)'));
 
             $m->connect('api/statusnet/groups/join.:format',
                         array('action' => 'ApiGroupJoin',
-                              'id' => Nickname::INPUT_FMT,
                               'format' => '(xml|json)'));
 
             $m->connect('api/statusnet/groups/leave/:id.:format',
@@ -747,6 +769,9 @@ class Router
                               'format' => '(xml|json|rss|atom|as)'));
 
             // Lists (people tags)
+            $m->connect('api/lists/list.:format',
+                        array('action' => 'ApiListSubscriptions',
+                              'format' => '(xml|json)'));
 
             $m->connect('api/lists/memberships.:format',
                         array('action' => 'ApiListMemberships',
@@ -824,6 +849,10 @@ class Router
                 'api/statusnet/media/upload',
                 array('action' => 'ApiMediaUpload')
             );
+            $m->connect(
+                'api/statuses/update_with_media.json',
+                array('action' => 'ApiMediaUpload')
+            );
 
             // search
             $m->connect('api/search.atom', array('action' => 'ApiSearchAtom'));
@@ -843,11 +872,10 @@ class Router
 
             $m->connect('panel/site', array('action' => 'siteadminpanel'));
             $m->connect('panel/user', array('action' => 'useradminpanel'));
-               $m->connect('panel/access', array('action' => 'accessadminpanel'));
+            $m->connect('panel/access', array('action' => 'accessadminpanel'));
             $m->connect('panel/paths', array('action' => 'pathsadminpanel'));
             $m->connect('panel/sessions', array('action' => 'sessionsadminpanel'));
             $m->connect('panel/sitenotice', array('action' => 'sitenoticeadminpanel'));
-            $m->connect('panel/snapshot', array('action' => 'snapshotadminpanel'));
             $m->connect('panel/license', array('action' => 'licenseadminpanel'));
 
             $m->connect('panel/plugins', array('action' => 'pluginsadminpanel'));
diff --git a/lib/snapshot.php b/lib/snapshot.php
deleted file mode 100644 (file)
index f41efba..0000000
+++ /dev/null
@@ -1,213 +0,0 @@
-<?php
-/**
- * StatusNet, the distributed open-source microblogging tool
- *
- * A snapshot of site stats that can report itself to headquarters
- *
- * PHP version 5
- *
- * LICENCE: This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- * @category  Stats
- * @package   StatusNet
- * @author    Evan Prodromou <evan@status.net>
- * @copyright 2009 StatusNet, Inc.
- * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link      http://status.net/
- */
-
-if (!defined('STATUSNET') && !defined('LACONICA')) {
-    exit(1);
-}
-
-/**
- * A snapshot of site stats that can report itself to headquarters
- *
- * This class will collect statistics on the site and report them to
- * a statistics server of the admin's choice. (Default is the big one
- * at status.net.)
- *
- * It can either be called from a cron job, or run occasionally by the
- * Web site.
- *
- * @category Stats
- * @package  StatusNet
- * @author   Evan Prodromou <evan@status.net>
- * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link     http://status.net/
- *
- */
-
-class Snapshot
-{
-    var $stats = null;
-
-    /**
-     * Constructor for a snapshot
-     */
-
-    function __construct()
-    {
-    }
-
-    /**
-     * Static function for reporting statistics
-     *
-     * This function checks whether it should report statistics, based on
-     * the current configuation settings. If it should, it creates a new
-     * Snapshot object, takes a snapshot, and reports it to headquarters.
-     *
-     * @return void
-     */
-
-    static function check()
-    {
-        switch (common_config('snapshot', 'run')) {
-        case 'web':
-            // skip if we're not running on the Web.
-            if (!isset($_SERVER) || !array_key_exists('REQUEST_METHOD', $_SERVER)) {
-                break;
-            }
-            // Run once every frequency hits
-            // XXX: do frequency by time (once a week, etc.) rather than
-            // hits
-            if (rand() % common_config('snapshot', 'frequency') == 0) {
-                $snapshot = new Snapshot();
-                $snapshot->take();
-                $snapshot->report();
-            }
-            break;
-        case 'cron':
-            // skip if we're running on the Web
-            if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) {
-                break;
-            }
-            common_log(LOG_INFO, 'Running snapshot from cron job');
-            // We're running from the command line; assume
-
-            $snapshot = new Snapshot();
-            $snapshot->take();
-            common_log(LOG_INFO, count($snapshot->stats) . " statistics being uploaded.");
-            $snapshot->report();
-
-            break;
-        case 'never':
-            break;
-        default:
-            common_log(LOG_WARNING, "Unrecognized value for snapshot run config.");
-        }
-    }
-
-    /**
-     * Take a snapshot of the server
-     *
-     * Builds an array of statistical and configuration data based
-     * on the local database and config files. We avoid grabbing any
-     * information that could be personal or private.
-     *
-     * @return void
-     */
-
-    function take()
-    {
-        $this->stats = array();
-
-        // Some basic identification stuff
-
-        $this->stats['version']    = GNUSOCIAL_VERSION;
-        $this->stats['phpversion'] = phpversion();
-        $this->stats['name']       = common_config('site', 'name');
-        $this->stats['root']       = common_root_url();
-
-        // non-identifying stats on various tables. Primary
-        // interest is size and rate of activity of service.
-
-        $tables = array('user',
-                        'notice',
-                        'subscription',
-                        'user_group');
-
-        foreach ($tables as $table) {
-            $this->tableStats($table);
-        }
-
-        // stats on some important config options
-
-        $this->stats['theme']     = common_config('site', 'theme');
-        $this->stats['dbtype']    = common_config('db', 'type');
-        $this->stats['xmpp']      = common_config('xmpp', 'enabled');
-        $this->stats['inboxes']   = common_config('inboxes', 'enabled');
-        $this->stats['queue']     = common_config('queue', 'enabled');
-        $this->stats['license']   = common_config('license', 'url');
-        $this->stats['fancy']     = common_config('site', 'fancy');
-        $this->stats['private']   = common_config('site', 'private');
-        $this->stats['closed']    = common_config('site', 'closed');
-        $this->stats['memcached'] = common_config('memcached', 'enabled');
-        $this->stats['language']  = common_config('site', 'language');
-        $this->stats['timezone']  = common_config('site', 'timezone');
-
-    }
-
-    /**
-     * Reports statistics to headquarters
-     *
-     * Posts statistics to a reporting server.
-     *
-     * @return void
-     */
-
-    function report()
-    {
-        // XXX: Use OICU2 and OAuth to make authorized requests
-
-        $reporturl = common_config('snapshot', 'reporturl');
-        try {
-            $request = HTTPClient::start();
-            $request->post($reporturl, null, $this->stats);
-        } catch (Exception $e) {
-            common_log(LOG_WARNING, "Error in snapshot: " . $e->getMessage());
-        }
-    }
-
-    /**
-     * Updates statistics for a single table
-     *
-     * Determines the size of a table and its oldest and newest rows.
-     * Goal here is to see how active a site is. Note that it
-     * fills up the instance stats variable.
-     *
-     * @param string $table name of table to check
-     *
-     * @return void
-     */
-
-    function tableStats($table)
-    {
-        $inst = DB_DataObject::factory($table);
-
-        $inst->selectAdd();
-        $inst->selectAdd('count(*) as cnt, '.
-                         'min(created) as first, '.
-                         'max(created) as last');
-
-        if ($inst->find(true)) {
-            $this->stats[$table.'count'] = $inst->cnt;
-            $this->stats[$table.'first'] = $inst->first;
-            $this->stats[$table.'last']  = $inst->last;
-        }
-
-        $inst->free();
-        unset($inst);
-    }
-}
index c3382897c7b368636b8b967b1ec54f9a0d5a4024..6d8570fbee6a5c422eeb186fae31e5ed755cec17 100644 (file)
@@ -27,9 +27,7 @@
  * @link      http://status.net/
  */
 
-if (!defined('STATUSNET') && !defined('LACONICA')) {
-    exit(1);
-}
+if (!defined('GNUSOCIAL') && !defined('STATUSNET')) { exit(1); }
 
 /**
  * widget for displaying a list of notices
index 7b75a467843f1c56452c3d1218c76cd166000712..9f7eac90f9a4b560cbcdf623724e9a47884bc327 100644 (file)
@@ -832,7 +832,7 @@ function common_find_mentions_raw($text)
 
 function common_render_text($text)
 {
-    $r = htmlspecialchars($text);
+    $r = nl2br(htmlspecialchars($text));
 
     $r = preg_replace('/[\x{0}-\x{8}\x{b}-\x{c}\x{e}-\x{19}]/', '', $r);
     $r = common_replace_urls_callback($r, 'common_linkify');
index 787ef15326e195c167af3b54424ff1bc049f8351..fce00145732c7065a571384d3460d3f2d5ca91a1 100644 (file)
@@ -2,7 +2,7 @@
 /**
  * StatusNet, the distributed open-source microblogging tool
  *
- * List users for autocompletion
+ * List profiles and groups for autocompletion
  *
  * PHP version 5
  *
@@ -29,7 +29,7 @@
  * @link      http://status.net/
  */
 
-if (!defined('STATUSNET') && !defined('LACONICA')) {
+if (!defined('GNUSOCIAL') && !defined('STATUSNET')) {
     exit(1);
 }
 
@@ -62,8 +62,8 @@ class AutocompleteAction extends Action
     function lastModified()
     {
         $max=0;
-        foreach($this->users as $user){
-            $max = max($max,strtotime($user->modified),strtotime($user->getProfile()->modified));
+        foreach($this->profiles as $profile){
+            $max = max($max,strtotime($user->modified),strtotime($profile->modified));
         }
         foreach($this->groups as $group){
             $max = max($max,strtotime($group->modified));
@@ -103,19 +103,22 @@ class AutocompleteAction extends Action
         }
 
         $this->groups=array();
-        $this->users=array();
+        $this->profiles=array();
         $term = $this->arg('term');
         $limit = $this->arg('limit');
         if($limit > 200) $limit=200; //prevent DOS attacks
         if(substr($term,0,1)=='@'){
-            //user search
+            //profile search
             $term=substr($term,1);
-            $user = new User();
-            $user->limit($limit);
-            $user->whereAdd('nickname like \'' . trim($user->escape($term), '\'') . '%\'');
-            if($user->find()){
-                while($user->fetch()) {
-                    $this->users[]=clone($user);
+            $profile = new Profile();
+            $profile->limit($limit);
+            $profile->whereAdd('nickname like \'' . trim($profile->escape($term), '\'') . '%\'');
+            $profile->whereAdd(sprintf('id in (SELECT id FROM user) OR '
+                               . 'id in (SELECT subscribed from subscription'
+                               . ' where subscriber = %d)', $cur->id));
+            if ($profile->find()) {
+                while($profile->fetch()) {
+                    $this->profiles[]=clone($profile);
                 }
             }
         }
@@ -139,8 +142,7 @@ class AutocompleteAction extends Action
         parent::handle();
 
         $results = array();
-        foreach($this->users as $user){
-            $profile = $user->getProfile();
+        foreach($this->profiles as $profile){
             $avatarUrl = $profile->avatarUrl(AVATAR_MINI_SIZE);
             $results[] = array(
                 'value' => '@'.$profile->nickname,
index 70f5ab85fe45ac0e59404cac9b9eb734eebb5753..d669626a67d30611d976782fbb15f666a67e77e8 100644 (file)
@@ -27,7 +27,7 @@
  * @link      http://status.net/
  */
 
-if (!defined('STATUSNET') && !defined('LACONICA')) {
+if (!defined('GNUSOCIAL') && !defined('STATUSNET')) {
     exit(1);
 }
 
@@ -64,10 +64,10 @@ class CometPlugin extends RealtimePlugin
     {
         $scripts = parent::_getScripts();
 
-        $ours = array('jquery.comet.js', 'cometupdate.js');
+        $ours = array('js/jquery.comet.js', 'js/cometupdate.js');
 
         foreach ($ours as $script) {
-            $scripts[] = 'plugins/Comet/'.$script;
+            $scripts[] = $this->path($script);
         }
 
         return $scripts;
@@ -81,7 +81,7 @@ class CometPlugin extends RealtimePlugin
 
     function _connect()
     {
-        require_once INSTALLDIR.'/plugins/Comet/bayeux.class.inc.php';
+        require_once INSTALLDIR.'/plugins/Comet/extlib/Bayeux/Bayeux.class.php';
         // Bayeux? Comet? Huh? These terms confuse me
         $this->bay = new Bayeux($this->server, $this->user, $this->password);
     }
diff --git a/plugins/Comet/bayeux.class.inc.php b/plugins/Comet/bayeux.class.inc.php
deleted file mode 100644 (file)
index 4fe8600..0000000
+++ /dev/null
@@ -1,133 +0,0 @@
-<?php
-/*
- * Phomet: a php comet client
- *
- * Copyright (C) 2008 Morgan 'ARR!' Allen <morganrallen@gmail.com> http://morglog.alleycatracing.com
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- */
-
-class Bayeux
-{
-    private $oCurl = '';
-    private $nNextId = 0;
-
-    private $sUser = '';
-    private $sPassword = '';
-
-    public $sUrl = '';
-
-    function __construct($sUrl, $sUser='', $sPassword='')
-    {
-        $this->sUrl = $sUrl;
-
-        $this->oCurl = curl_init();
-
-        $aHeaders = array();
-        $aHeaders[] = 'Connection: Keep-Alive';
-
-        curl_setopt($this->oCurl, CURLOPT_URL, $sUrl);
-        curl_setopt($this->oCurl, CURLOPT_HTTPHEADER, $aHeaders);
-        curl_setopt($this->oCurl, CURLOPT_HEADER, 0);
-        curl_setopt($this->oCurl, CURLOPT_POST, 1);
-        curl_setopt($this->oCurl, CURLOPT_RETURNTRANSFER,1);
-
-        if (!is_null($sUser) && mb_strlen($sUser) > 0) {
-            curl_setopt($this->oCurl, CURLOPT_USERPWD,"$sUser:$sPassword");
-        }
-
-        $this->handShake();
-    }
-
-    function __destruct()
-    {
-        $this->disconnect();
-    }
-
-    function handShake()
-    {
-        $msgHandshake = array();
-        $msgHandshake['channel'] = '/meta/handshake';
-        $msgHandshake['version'] = "1.0";
-        $msgHandshake['minimumVersion'] = "0.9";
-        $msgHandshake['supportedConnectionTypes'] = array('long-polling');
-        $msgHandshake['id'] = $this->nNextId++;
-
-        curl_setopt($this->oCurl, CURLOPT_POSTFIELDS, "message=".urlencode(str_replace('\\', '', json_encode(array($msgHandshake)))));
-
-        $data = curl_exec($this->oCurl);
-
-        if(curl_errno($this->oCurl))
-          die("Error: " . curl_error($this->oCurl));
-
-        $oReturn = json_decode($data);
-
-        if (is_array($oReturn)) {
-            $oReturn = $oReturn[0];
-        }
-
-        $bSuccessful = ($oReturn->successful) ? true : false;
-
-        if($bSuccessful)
-        {
-            $this->clientId = $oReturn->clientId;
-
-            $this->connect();
-        }
-    }
-
-    public function connect()
-    {
-        $aMsg['channel'] = '/meta/connect';
-        $aMsg['id'] = $this->nNextId++;
-        $aMsg['clientId'] = $this->clientId;
-        $aMsg['connectionType'] = 'long-polling';
-
-        curl_setopt($this->oCurl, CURLOPT_POSTFIELDS, "message=".urlencode(str_replace('\\', '', json_encode(array($aMsg)))));
-
-        $data = curl_exec($this->oCurl);
-    }
-
-    function disconnect()
-    {
-        $msgHandshake = array();
-        $msgHandshake['channel'] = '/meta/disconnect';
-        $msgHandshake['id'] = $this->nNextId++;
-        $msgHandshake['clientId'] = $this->clientId;
-
-        curl_setopt($this->oCurl, CURLOPT_POSTFIELDS, "message=".urlencode(str_replace('\\', '', json_encode(array($msgHandshake)))));
-
-        curl_exec($this->oCurl);
-    }
-
-    public function publish($sChannel, $oData)
-    {
-        if(!$sChannel || !$oData)
-          return;
-
-        $aMsg = array();
-
-        $aMsg['channel'] = $sChannel;
-        $aMsg['id'] = $this->nNextId++;
-        $aMsg['data'] = $oData;
-        $aMsg['clientId'] = $this->clientId;
-
-        curl_setopt($this->oCurl, CURLOPT_POSTFIELDS, "message=".urlencode(str_replace('\\', '', json_encode(array($aMsg)))));
-
-        $data = curl_exec($this->oCurl);
-//        var_dump($data);
-    }
-}
diff --git a/plugins/Comet/cometupdate.js b/plugins/Comet/cometupdate.js
deleted file mode 100644 (file)
index 50b02b7..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-// update the local timeline from a Comet server
-var CometUpdate = function()
-{
-     var _server;
-     var _timeline;
-     var _userid;
-     var _replyurl;
-     var _favorurl;
-     var _deleteurl;
-     var _cometd;
-
-     return {
-          init: function(server, timeline, userid, replyurl, favorurl, deleteurl)
-          {
-               _cometd = $.cometd; // Uses the default Comet object
-               _cometd.init(server);
-               _server = server;
-               _timeline = timeline;
-               _userid = userid;
-               _favorurl = favorurl;
-               _replyurl = replyurl;
-               _deleteurl = deleteurl;
-               _cometd.subscribe(timeline, function(message) { RealtimeUpdate.receive(message.data) });
-               $(window).unload(function() { _cometd.disconnect(); } );
-          }
-     }
-}();
diff --git a/plugins/Comet/extlib/Bayeux/Bayeux.class.php b/plugins/Comet/extlib/Bayeux/Bayeux.class.php
new file mode 100644 (file)
index 0000000..4fe8600
--- /dev/null
@@ -0,0 +1,133 @@
+<?php
+/*
+ * Phomet: a php comet client
+ *
+ * Copyright (C) 2008 Morgan 'ARR!' Allen <morganrallen@gmail.com> http://morglog.alleycatracing.com
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+class Bayeux
+{
+    private $oCurl = '';
+    private $nNextId = 0;
+
+    private $sUser = '';
+    private $sPassword = '';
+
+    public $sUrl = '';
+
+    function __construct($sUrl, $sUser='', $sPassword='')
+    {
+        $this->sUrl = $sUrl;
+
+        $this->oCurl = curl_init();
+
+        $aHeaders = array();
+        $aHeaders[] = 'Connection: Keep-Alive';
+
+        curl_setopt($this->oCurl, CURLOPT_URL, $sUrl);
+        curl_setopt($this->oCurl, CURLOPT_HTTPHEADER, $aHeaders);
+        curl_setopt($this->oCurl, CURLOPT_HEADER, 0);
+        curl_setopt($this->oCurl, CURLOPT_POST, 1);
+        curl_setopt($this->oCurl, CURLOPT_RETURNTRANSFER,1);
+
+        if (!is_null($sUser) && mb_strlen($sUser) > 0) {
+            curl_setopt($this->oCurl, CURLOPT_USERPWD,"$sUser:$sPassword");
+        }
+
+        $this->handShake();
+    }
+
+    function __destruct()
+    {
+        $this->disconnect();
+    }
+
+    function handShake()
+    {
+        $msgHandshake = array();
+        $msgHandshake['channel'] = '/meta/handshake';
+        $msgHandshake['version'] = "1.0";
+        $msgHandshake['minimumVersion'] = "0.9";
+        $msgHandshake['supportedConnectionTypes'] = array('long-polling');
+        $msgHandshake['id'] = $this->nNextId++;
+
+        curl_setopt($this->oCurl, CURLOPT_POSTFIELDS, "message=".urlencode(str_replace('\\', '', json_encode(array($msgHandshake)))));
+
+        $data = curl_exec($this->oCurl);
+
+        if(curl_errno($this->oCurl))
+          die("Error: " . curl_error($this->oCurl));
+
+        $oReturn = json_decode($data);
+
+        if (is_array($oReturn)) {
+            $oReturn = $oReturn[0];
+        }
+
+        $bSuccessful = ($oReturn->successful) ? true : false;
+
+        if($bSuccessful)
+        {
+            $this->clientId = $oReturn->clientId;
+
+            $this->connect();
+        }
+    }
+
+    public function connect()
+    {
+        $aMsg['channel'] = '/meta/connect';
+        $aMsg['id'] = $this->nNextId++;
+        $aMsg['clientId'] = $this->clientId;
+        $aMsg['connectionType'] = 'long-polling';
+
+        curl_setopt($this->oCurl, CURLOPT_POSTFIELDS, "message=".urlencode(str_replace('\\', '', json_encode(array($aMsg)))));
+
+        $data = curl_exec($this->oCurl);
+    }
+
+    function disconnect()
+    {
+        $msgHandshake = array();
+        $msgHandshake['channel'] = '/meta/disconnect';
+        $msgHandshake['id'] = $this->nNextId++;
+        $msgHandshake['clientId'] = $this->clientId;
+
+        curl_setopt($this->oCurl, CURLOPT_POSTFIELDS, "message=".urlencode(str_replace('\\', '', json_encode(array($msgHandshake)))));
+
+        curl_exec($this->oCurl);
+    }
+
+    public function publish($sChannel, $oData)
+    {
+        if(!$sChannel || !$oData)
+          return;
+
+        $aMsg = array();
+
+        $aMsg['channel'] = $sChannel;
+        $aMsg['id'] = $this->nNextId++;
+        $aMsg['data'] = $oData;
+        $aMsg['clientId'] = $this->clientId;
+
+        curl_setopt($this->oCurl, CURLOPT_POSTFIELDS, "message=".urlencode(str_replace('\\', '', json_encode(array($aMsg)))));
+
+        $data = curl_exec($this->oCurl);
+//        var_dump($data);
+    }
+}
diff --git a/plugins/Comet/jquery.comet.js b/plugins/Comet/jquery.comet.js
deleted file mode 100644 (file)
index 6de437f..0000000
+++ /dev/null
@@ -1,1451 +0,0 @@
-/**
- * Copyright 2008 Mort Bay Consulting Pty. Ltd.
- * Dual licensed under the Apache License 2.0 and the MIT license.
- * ----------------------------------------------------------------------------
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http: *www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ----------------------------------------------------------------------------
- * Licensed under the MIT license;
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- * ----------------------------------------------------------------------------
- * $Revision$ $Date$
- */
-(function($)
-{
-    /**
-     * The constructor for a Comet object.
-     * There is a default Comet instance already created at the variable <code>$.cometd</code>,
-     * and hence that can be used to start a comet conversation with a server.
-     * In the rare case a page needs more than one comet conversation, a new instance can be
-     * created via:
-     * <pre>
-     * var url2 = ...;
-     * var cometd2 = new $.Cometd();
-     * cometd2.init(url2);
-     * </pre>
-     */
-    $.Cometd = function(name)
-    {
-        var _name = name || 'default';
-        var _logPriorities = { debug: 1, info: 2, warn: 3, error: 4 };
-        var _logLevel = 'info';
-        var _url;
-        var _xd = false;
-        var _transport;
-        var _status = 'disconnected';
-        var _messageId = 0;
-        var _clientId = null;
-        var _batch = 0;
-        var _messageQueue = [];
-        var _listeners = {};
-        var _backoff = 0;
-        var _backoffIncrement = 1000;
-        var _maxBackoff = 60000;
-        var _scheduledSend = null;
-        var _extensions = [];
-        var _advice = {};
-        var _handshakeProps;
-
-        /**
-         * Returns the name assigned to this Comet object, or the string 'default'
-         * if no name has been explicitely passed as parameter to the constructor.
-         */
-        this.getName = function()
-        {
-            return _name;
-        };
-
-        /**
-         * Configures the initial comet communication with the comet server.
-         * @param cometURL the URL of the comet server
-         */
-        this.configure = function(cometURL)
-        {
-            _configure(cometURL);
-        };
-
-        function _configure(cometURL)
-        {
-            _url = cometURL;
-            _debug('Initializing comet with url: {}', _url);
-
-            // Check immediately if we're cross domain
-            // If cross domain, the handshake must not send the long polling transport type
-            var urlParts = /(^https?:)?(\/\/(([^:\/\?#]+)(:(\d+))?))?([^\?#]*)/.exec(cometURL);
-            if (urlParts[3]) _xd = urlParts[3] != location.host;
-
-            // Temporary setup a transport to send the initial handshake
-            // The transport may be changed as a result of handshake
-            if (_xd)
-                _transport = newCallbackPollingTransport();
-            else
-                _transport = newLongPollingTransport();
-            _debug('Initial transport is {}', _transport.getType());
-        };
-
-        /**
-         * Configures and establishes the comet communication with the comet server
-         * via a handshake and a subsequent connect.
-         * @param cometURL the URL of the comet server
-         * @param handshakeProps an object to be merged with the handshake message
-         * @see #configure(cometURL)
-         * @see #handshake(handshakeProps)
-         */
-        this.init = function(cometURL, handshakeProps)
-        {
-            _configure(cometURL);
-            _handshake(handshakeProps);
-        };
-
-        /**
-         * Establishes the comet communication with the comet server
-         * via a handshake and a subsequent connect.
-         * @param handshakeProps an object to be merged with the handshake message
-         */
-        this.handshake = function(handshakeProps)
-        {
-            _handshake(handshakeProps);
-        };
-
-        /**
-         * Disconnects from the comet server.
-         * @param disconnectProps an object to be merged with the disconnect message
-         */
-        this.disconnect = function(disconnectProps)
-        {
-            var bayeuxMessage = {
-                channel: '/meta/disconnect'
-            };
-            var message = $.extend({}, disconnectProps, bayeuxMessage);
-            // Deliver immediately
-            // The handshake and connect mechanism make use of startBatch(), and in case
-            // of a failed handshake the disconnect would not be delivered if using _send().
-            _setStatus('disconnecting');
-            _deliver([message], false);
-        };
-
-        /**
-         * Marks the start of a batch of application messages to be sent to the server
-         * in a single request, obtaining a single response containing (possibly) many
-         * application reply messages.
-         * Messages are held in a queue and not sent until {@link #endBatch()} is called.
-         * If startBatch() is called multiple times, then an equal number of endBatch()
-         * calls must be made to close and send the batch of messages.
-         * @see #endBatch()
-         */
-        this.startBatch = function()
-        {
-            _startBatch();
-        };
-
-        /**
-         * Marks the end of a batch of application messages to be sent to the server
-         * in a single request.
-         * @see #startBatch()
-         */
-        this.endBatch = function()
-        {
-            _endBatch(true);
-        };
-
-        /**
-         * Subscribes to the given channel, performing the given callback in the given scope
-         * when a message for the channel arrives.
-         * @param channel the channel to subscribe to
-         * @param scope the scope of the callback
-         * @param callback the callback to call when a message is delivered to the channel
-         * @param subscribeProps an object to be merged with the subscribe message
-         * @return the subscription handle to be passed to {@link #unsubscribe(object)}
-         */
-        this.subscribe = function(channel, scope, callback, subscribeProps)
-        {
-            var subscription = this.addListener(channel, scope, callback);
-
-            // Send the subscription message after the subscription registration to avoid
-            // races where the server would deliver a message to the subscribers, but here
-            // on the client the subscription has not been added yet to the data structures
-            var bayeuxMessage = {
-                channel: '/meta/subscribe',
-                subscription: channel
-            };
-            var message = $.extend({}, subscribeProps, bayeuxMessage);
-            _send(message);
-
-            return subscription;
-        };
-
-        /**
-         * Unsubscribes the subscription obtained with a call to {@link #subscribe(string, object, function)}.
-         * @param subscription the subscription to unsubscribe.
-         */
-        this.unsubscribe = function(subscription, unsubscribeProps)
-        {
-            // Remove the local listener before sending the message
-            // This ensures that if the server fails, this client does not get notifications
-            this.removeListener(subscription);
-            var bayeuxMessage = {
-                channel: '/meta/unsubscribe',
-                subscription: subscription[0]
-            };
-            var message = $.extend({}, unsubscribeProps, bayeuxMessage);
-            _send(message);
-        };
-
-        /**
-         * Publishes a message on the given channel, containing the given content.
-         * @param channel the channel to publish the message to
-         * @param content the content of the message
-         * @param publishProps an object to be merged with the publish message
-         */
-        this.publish = function(channel, content, publishProps)
-        {
-            var bayeuxMessage = {
-                channel: channel,
-                data: content
-            };
-            var message = $.extend({}, publishProps, bayeuxMessage);
-            _send(message);
-        };
-
-        /**
-         * Adds a listener for bayeux messages, performing the given callback in the given scope
-         * when a message for the given channel arrives.
-         * @param channel the channel the listener is interested to
-         * @param scope the scope of the callback
-         * @param callback the callback to call when a message is delivered to the channel
-         * @returns the subscription handle to be passed to {@link #removeListener(object)}
-         * @see #removeListener(object)
-         */
-        this.addListener = function(channel, scope, callback)
-        {
-            // The data structure is a map<channel, subscription[]>, where each subscription
-            // holds the callback to be called and its scope.
-
-            // Normalize arguments
-            if (!callback)
-            {
-                callback = scope;
-                scope = undefined;
-            }
-
-            var subscription = {
-                scope: scope,
-                callback: callback
-            };
-
-            var subscriptions = _listeners[channel];
-            if (!subscriptions)
-            {
-                subscriptions = [];
-                _listeners[channel] = subscriptions;
-            }
-            // Pushing onto an array appends at the end and returns the id associated with the element increased by 1.
-            // Note that if:
-            // a.push('a'); var hb=a.push('b'); delete a[hb-1]; var hc=a.push('c');
-            // then:
-            // hc==3, a.join()=='a',,'c', a.length==3
-            var subscriptionIndex = subscriptions.push(subscription) - 1;
-            _debug('Added listener: channel \'{}\', callback \'{}\', index {}', channel, callback.name, subscriptionIndex);
-
-            // The subscription to allow removal of the listener is made of the channel and the index
-            return [channel, subscriptionIndex];
-        };
-
-        /**
-         * Removes the subscription obtained with a call to {@link #addListener(string, object, function)}.
-         * @param subscription the subscription to unsubscribe.
-         */
-        this.removeListener = function(subscription)
-        {
-            var subscriptions = _listeners[subscription[0]];
-            if (subscriptions)
-            {
-                delete subscriptions[subscription[1]];
-                _debug('Removed listener: channel \'{}\', index {}', subscription[0], subscription[1]);
-            }
-        };
-
-        /**
-         * Removes all listeners registered with {@link #addListener(channel, scope, callback)} or
-         * {@link #subscribe(channel, scope, callback)}.
-         */
-        this.clearListeners = function()
-        {
-            _listeners = {};
-        };
-
-        /**
-         * Returns a string representing the status of the bayeux communication with the comet server.
-         */
-        this.getStatus = function()
-        {
-            return _status;
-        };
-
-        /**
-         * Sets the backoff period used to increase the backoff time when retrying an unsuccessful or failed message.
-         * Default value is 1 second, which means if there is a persistent failure the retries will happen
-         * after 1 second, then after 2 seconds, then after 3 seconds, etc. So for example with 15 seconds of
-         * elapsed time, there will be 5 retries (at 1, 3, 6, 10 and 15 seconds elapsed).
-         * @param period the backoff period to set
-         * @see #getBackoffIncrement()
-         */
-        this.setBackoffIncrement = function(period)
-        {
-            _backoffIncrement = period;
-        };
-
-        /**
-         * Returns the backoff period used to increase the backoff time when retrying an unsuccessful or failed message.
-         * @see #setBackoffIncrement(period)
-         */
-        this.getBackoffIncrement = function()
-        {
-            return _backoffIncrement;
-        };
-
-        /**
-         * Returns the backoff period to wait before retrying an unsuccessful or failed message.
-         */
-        this.getBackoffPeriod = function()
-        {
-            return _backoff;
-        };
-
-        /**
-         * Sets the log level for console logging.
-         * Valid values are the strings 'error', 'warn', 'info' and 'debug', from
-         * less verbose to more verbose.
-         * @param level the log level string
-         */
-        this.setLogLevel = function(level)
-        {
-            _logLevel = level;
-        };
-
-        /**
-         * Registers an extension whose callbacks are called for every incoming message
-         * (that comes from the server to this client implementation) and for every
-         * outgoing message (that originates from this client implementation for the
-         * server).
-         * The format of the extension object is the following:
-         * <pre>
-         * {
-         *     incoming: function(message) { ... },
-         *     outgoing: function(message) { ... }
-         * }
-         * Both properties are optional, but if they are present they will be called
-         * respectively for each incoming message and for each outgoing message.
-         * </pre>
-         * @param name the name of the extension
-         * @param extension the extension to register
-         * @return true if the extension was registered, false otherwise
-         * @see #unregisterExtension(name)
-         */
-        this.registerExtension = function(name, extension)
-        {
-            var existing = false;
-            for (var i = 0; i < _extensions.length; ++i)
-            {
-                var existingExtension = _extensions[i];
-                if (existingExtension.name == name)
-                {
-                    existing = true;
-                    return false;
-                }
-            }
-            if (!existing)
-            {
-                _extensions.push({
-                    name: name,
-                    extension: extension
-                });
-                _debug('Registered extension \'{}\'', name);
-                return true;
-            }
-            else
-            {
-                _info('Could not register extension with name \'{}\': another extension with the same name already exists');
-                return false;
-            }
-        };
-
-        /**
-         * Unregister an extension previously registered with
-         * {@link #registerExtension(name, extension)}.
-         * @param name the name of the extension to unregister.
-         * @return true if the extension was unregistered, false otherwise
-         */
-        this.unregisterExtension = function(name)
-        {
-            var unregistered = false;
-            $.each(_extensions, function(index, extension)
-            {
-                if (extension.name == name)
-                {
-                    _extensions.splice(index, 1);
-                    unregistered = true;
-                    _debug('Unregistered extension \'{}\'', name);
-                    return false;
-                }
-            });
-            return unregistered;
-        };
-
-        /**
-         * Starts a the batch of messages to be sent in a single request.
-         * @see _endBatch(deliverMessages)
-         */
-        function _startBatch()
-        {
-            ++_batch;
-        };
-
-        /**
-         * Ends the batch of messages to be sent in a single request,
-         * optionally delivering messages present in the message queue depending
-         * on the given argument.
-         * @param deliverMessages whether to deliver the messages in the queue or not
-         * @see _startBatch()
-         */
-        function _endBatch(deliverMessages)
-        {
-            --_batch;
-            if (_batch < 0) _batch = 0;
-            if (deliverMessages && _batch == 0 && !_isDisconnected())
-            {
-                var messages = _messageQueue;
-                _messageQueue = [];
-                if (messages.length > 0) _deliver(messages, false);
-            }
-        };
-
-        function _nextMessageId()
-        {
-            return ++_messageId;
-        };
-
-        /**
-         * Converts the given response into an array of bayeux messages
-         * @param response the response to convert
-         * @return an array of bayeux messages obtained by converting the response
-         */
-        function _convertToMessages(response)
-        {
-            if (response === undefined) return [];
-            if (response instanceof Array) return response;
-            if (response instanceof String || typeof response == 'string') return eval('(' + response + ')');
-            if (response instanceof Object) return [response];
-            throw 'Conversion Error ' + response + ', typeof ' + (typeof response);
-        };
-
-        function _setStatus(newStatus)
-        {
-            _debug('{} -> {}', _status, newStatus);
-            _status = newStatus;
-        };
-
-        function _isDisconnected()
-        {
-            return _status == 'disconnecting' || _status == 'disconnected';
-        };
-
-        /**
-         * Sends the initial handshake message
-         */
-        function _handshake(handshakeProps)
-        {
-            _debug('Starting handshake');
-            _clientId = null;
-
-            // Start a batch.
-            // This is needed because handshake and connect are async.
-            // It may happen that the application calls init() then subscribe()
-            // and the subscribe message is sent before the connect message, if
-            // the subscribe message is not held until the connect message is sent.
-            // So here we start a batch to hold temporarly any message until
-            // the connection is fully established.
-            _batch = 0;
-            _startBatch();
-
-            // Save the original properties provided by the user
-            // Deep copy to avoid the user to be able to change them later
-            _handshakeProps = $.extend(true, {}, handshakeProps);
-
-            var bayeuxMessage = {
-                version: '1.0',
-                minimumVersion: '0.9',
-                channel: '/meta/handshake',
-                supportedConnectionTypes: _xd ? ['callback-polling'] : ['long-polling', 'callback-polling']
-            };
-            // Do not allow the user to mess with the required properties,
-            // so merge first the user properties and *then* the bayeux message
-            var message = $.extend({}, handshakeProps, bayeuxMessage);
-
-            // We started a batch to hold the application messages,
-            // so here we must bypass it and deliver immediately.
-            _setStatus('handshaking');
-            _deliver([message], false);
-        };
-
-        function _findTransport(handshakeResponse)
-        {
-            var transportTypes = handshakeResponse.supportedConnectionTypes;
-            if (_xd)
-            {
-                // If we are cross domain, check if the server supports it, that's the only option
-                if ($.inArray('callback-polling', transportTypes) >= 0) return _transport;
-            }
-            else
-            {
-                // Check if we can keep long-polling
-                if ($.inArray('long-polling', transportTypes) >= 0) return _transport;
-
-                // The server does not support long-polling
-                if ($.inArray('callback-polling', transportTypes) >= 0) return newCallbackPollingTransport();
-            }
-            return null;
-        };
-
-        function _delayedHandshake()
-        {
-            _setStatus('handshaking');
-            _delayedSend(function()
-            {
-                _handshake(_handshakeProps);
-            });
-        };
-
-        function _delayedConnect()
-        {
-            _setStatus('connecting');
-            _delayedSend(function()
-            {
-                _connect();
-            });
-        };
-
-        function _delayedSend(operation)
-        {
-            _cancelDelayedSend();
-            var delay = _backoff;
-            _debug("Delayed send: backoff {}, interval {}", _backoff, _advice.interval);
-            if (_advice.interval && _advice.interval > 0)
-                delay += _advice.interval;
-            _scheduledSend = _setTimeout(operation, delay);
-        };
-
-        function _cancelDelayedSend()
-        {
-            if (_scheduledSend !== null) clearTimeout(_scheduledSend);
-            _scheduledSend = null;
-        };
-
-        function _setTimeout(funktion, delay)
-        {
-            return setTimeout(function()
-            {
-                try
-                {
-                    funktion();
-                }
-                catch (x)
-                {
-                    _debug('Exception during scheduled execution of function \'{}\': {}', funktion.name, x);
-                }
-            }, delay);
-        };
-
-        /**
-         * Sends the connect message
-         */
-        function _connect()
-        {
-            _debug('Starting connect');
-            var message = {
-                channel: '/meta/connect',
-                connectionType: _transport.getType()
-            };
-            _setStatus('connecting');
-            _deliver([message], true);
-            _setStatus('connected');
-        };
-
-        function _send(message)
-        {
-            if (_batch > 0)
-                _messageQueue.push(message);
-            else
-                _deliver([message], false);
-        };
-
-        /**
-         * Delivers the messages to the comet server
-         * @param messages the array of messages to send
-         */
-        function _deliver(messages, comet)
-        {
-            // We must be sure that the messages have a clientId.
-            // This is not guaranteed since the handshake may take time to return
-            // (and hence the clientId is not known yet) and the application
-            // may create other messages.
-            $.each(messages, function(index, message)
-            {
-                message['id'] = _nextMessageId();
-                if (_clientId) message['clientId'] = _clientId;
-                messages[index] = _applyOutgoingExtensions(message);
-            });
-
-            var self = this;
-            var envelope = {
-                url: _url,
-                messages: messages,
-                onSuccess: function(request, response)
-                {
-                    try
-                    {
-                        _handleSuccess.call(self, request, response, comet);
-                    }
-                    catch (x)
-                    {
-                        _debug('Exception during execution of success callback: {}', x);
-                    }
-                },
-                onFailure: function(request, reason, exception)
-                {
-                    try
-                    {
-                        _handleFailure.call(self, request, messages, reason, exception, comet);
-                    }
-                    catch (x)
-                    {
-                        _debug('Exception during execution of failure callback: {}', x);
-                    }
-                }
-            };
-            _debug('Sending request to {}, message(s): {}', envelope.url, JSON.stringify(envelope.messages));
-            _transport.send(envelope, comet);
-        };
-
-        function _applyIncomingExtensions(message)
-        {
-            for (var i = 0; i < _extensions.length; ++i)
-            {
-                var extension = _extensions[i];
-                var callback = extension.extension.incoming;
-                if (callback && typeof callback === 'function')
-                {
-                    _debug('Calling incoming extension \'{}\', callback \'{}\'', extension.name, callback.name);
-                    message = _applyExtension(extension.name, callback, message) || message;
-                }
-            }
-            return message;
-        };
-
-        function _applyOutgoingExtensions(message)
-        {
-            for (var i = 0; i < _extensions.length; ++i)
-            {
-                var extension = _extensions[i];
-                var callback = extension.extension.outgoing;
-                if (callback && typeof callback === 'function')
-                {
-                    _debug('Calling outgoing extension \'{}\', callback \'{}\'', extension.name, callback.name);
-                    message = _applyExtension(extension.name, callback, message) || message;
-                }
-            }
-            return message;
-        };
-
-        function _applyExtension(name, callback, message)
-        {
-            try
-            {
-                return callback(message);
-            }
-            catch (x)
-            {
-                _debug('Exception during execution of extension \'{}\': {}', name, x);
-                return message;
-            }
-        };
-
-        function _handleSuccess(request, response, comet)
-        {
-            var messages = _convertToMessages(response);
-            _debug('Received response {}', JSON.stringify(messages));
-
-            // Signal the transport it can deliver other queued requests
-            _transport.complete(request, true, comet);
-
-            for (var i = 0; i < messages.length; ++i)
-            {
-                var message = messages[i];
-                message = _applyIncomingExtensions(message);
-
-                if (message.advice) _advice = message.advice;
-
-                var channel = message.channel;
-                switch (channel)
-                {
-                    case '/meta/handshake':
-                        _handshakeSuccess(message);
-                        break;
-                    case '/meta/connect':
-                        _connectSuccess(message);
-                        break;
-                    case '/meta/disconnect':
-                        _disconnectSuccess(message);
-                        break;
-                    case '/meta/subscribe':
-                        _subscribeSuccess(message);
-                        break;
-                    case '/meta/unsubscribe':
-                        _unsubscribeSuccess(message);
-                        break;
-                    default:
-                        _messageSuccess(message);
-                        break;
-                }
-            }
-        };
-
-        function _handleFailure(request, messages, reason, exception, comet)
-        {
-            var xhr = request.xhr;
-            _debug('Request failed, status: {}, reason: {}, exception: {}', xhr && xhr.status, reason, exception);
-
-            // Signal the transport it can deliver other queued requests
-            _transport.complete(request, false, comet);
-
-            for (var i = 0; i < messages.length; ++i)
-            {
-                var message = messages[i];
-                var channel = message.channel;
-                switch (channel)
-                {
-                    case '/meta/handshake':
-                        _handshakeFailure(xhr, message);
-                        break;
-                    case '/meta/connect':
-                        _connectFailure(xhr, message);
-                        break;
-                    case '/meta/disconnect':
-                        _disconnectFailure(xhr, message);
-                        break;
-                    case '/meta/subscribe':
-                        _subscribeFailure(xhr, message);
-                        break;
-                    case '/meta/unsubscribe':
-                        _unsubscribeFailure(xhr, message);
-                        break;
-                    default:
-                        _messageFailure(xhr, message);
-                        break;
-                }
-            }
-        };
-
-        function _handshakeSuccess(message)
-        {
-            if (message.successful)
-            {
-                _debug('Handshake successful');
-                // Save clientId, figure out transport, then follow the advice to connect
-                _clientId = message.clientId;
-
-                var newTransport = _findTransport(message);
-                if (newTransport === null)
-                {
-                    throw 'Could not agree on transport with server';
-                }
-                else
-                {
-                    if (_transport.getType() != newTransport.getType())
-                    {
-                        _debug('Changing transport from {} to {}', _transport.getType(), newTransport.getType());
-                        _transport = newTransport;
-                    }
-                }
-
-                // Notify the listeners
-                // Here the new transport is in place, as well as the clientId, so
-                // the listener can perform a publish() if it wants, and the listeners
-                // are notified before the connect below.
-                _notifyListeners('/meta/handshake', message);
-
-                var action = _advice.reconnect ? _advice.reconnect : 'retry';
-                switch (action)
-                {
-                    case 'retry':
-                        _delayedConnect();
-                        break;
-                    default:
-                        break;
-                }
-            }
-            else
-            {
-                _debug('Handshake unsuccessful');
-
-                var retry = !_isDisconnected() && _advice.reconnect != 'none';
-                if (!retry) _setStatus('disconnected');
-
-                _notifyListeners('/meta/handshake', message);
-                _notifyListeners('/meta/unsuccessful', message);
-
-                // Only try again if we haven't been disconnected and
-                // the advice permits us to retry the handshake
-                if (retry)
-                {
-                    _increaseBackoff();
-                    _debug('Handshake failure, backing off and retrying in {} ms', _backoff);
-                    _delayedHandshake();
-                }
-            }
-        };
-
-        function _handshakeFailure(xhr, message)
-        {
-            _debug('Handshake failure');
-
-            // Notify listeners
-            var failureMessage = {
-                successful: false,
-                failure: true,
-                channel: '/meta/handshake',
-                request: message,
-                xhr: xhr,
-                advice: {
-                    action: 'retry',
-                    interval: _backoff
-                }
-            };
-
-            var retry = !_isDisconnected() && _advice.reconnect != 'none';
-            if (!retry) _setStatus('disconnected');
-
-            _notifyListeners('/meta/handshake', failureMessage);
-            _notifyListeners('/meta/unsuccessful', failureMessage);
-
-            // Only try again if we haven't been disconnected and the
-            // advice permits us to try again
-            if (retry)
-            {
-                _increaseBackoff();
-                _debug('Handshake failure, backing off and retrying in {} ms', _backoff);
-                _delayedHandshake();
-            }
-        };
-
-        function _connectSuccess(message)
-        {
-            var action = _isDisconnected() ? 'none' : (_advice.reconnect ? _advice.reconnect : 'retry');
-            if (!_isDisconnected()) _setStatus(action == 'retry' ? 'connecting' : 'disconnecting');
-
-            if (message.successful)
-            {
-                _debug('Connect successful');
-
-                // End the batch and allow held messages from the application
-                // to go to the server (see _handshake() where we start the batch).
-                // The batch is ended before notifying the listeners, so that
-                // listeners can batch other cometd operations
-                _endBatch(true);
-
-                // Notify the listeners after the status change but before the next connect
-                _notifyListeners('/meta/connect', message);
-
-                // Connect was successful.
-                // Normally, the advice will say "reconnect: 'retry', interval: 0"
-                // and the server will hold the request, so when a response returns
-                // we immediately call the server again (long polling)
-                switch (action)
-                {
-                    case 'retry':
-                        _resetBackoff();
-                        _delayedConnect();
-                        break;
-                    default:
-                        _resetBackoff();
-                        _setStatus('disconnected');
-                        break;
-                }
-            }
-            else
-            {
-                _debug('Connect unsuccessful');
-
-                // Notify the listeners after the status change but before the next action
-                _notifyListeners('/meta/connect', message);
-                _notifyListeners('/meta/unsuccessful', message);
-
-                // Connect was not successful.
-                // This may happen when the server crashed, the current clientId
-                // will be invalid, and the server will ask to handshake again
-                switch (action)
-                {
-                    case 'retry':
-                        _increaseBackoff();
-                        _delayedConnect();
-                        break;
-                    case 'handshake':
-                        // End the batch but do not deliver the messages until we connect successfully
-                        _endBatch(false);
-                        _resetBackoff();
-                        _delayedHandshake();
-                        break;
-                    case 'none':
-                        _resetBackoff();
-                        _setStatus('disconnected');
-                        break;
-                }
-            }
-        };
-
-        function _connectFailure(xhr, message)
-        {
-            _debug('Connect failure');
-
-            // Notify listeners
-            var failureMessage = {
-                successful: false,
-                failure: true,
-                channel: '/meta/connect',
-                request: message,
-                xhr: xhr,
-                advice: {
-                    action: 'retry',
-                    interval: _backoff
-                }
-            };
-            _notifyListeners('/meta/connect', failureMessage);
-            _notifyListeners('/meta/unsuccessful', failureMessage);
-
-            if (!_isDisconnected())
-            {
-                var action = _advice.reconnect ? _advice.reconnect : 'retry';
-                switch (action)
-                {
-                    case 'retry':
-                        _increaseBackoff();
-                        _debug('Connect failure, backing off and retrying in {} ms', _backoff);
-                        _delayedConnect();
-                        break;
-                    case 'handshake':
-                        _resetBackoff();
-                        _delayedHandshake();
-                        break;
-                    case 'none':
-                        _resetBackoff();
-                        break;
-                    default:
-                        _debug('Unrecognized reconnect value: {}', action);
-                        break;
-                }
-            }
-        };
-
-        function _disconnectSuccess(message)
-        {
-            if (message.successful)
-            {
-                _debug('Disconnect successful');
-                _disconnect(false);
-                _notifyListeners('/meta/disconnect', message);
-            }
-            else
-            {
-                _debug('Disconnect unsuccessful');
-                _disconnect(true);
-                _notifyListeners('/meta/disconnect', message);
-                _notifyListeners('/meta/usuccessful', message);
-            }
-        };
-
-        function _disconnect(abort)
-        {
-            _cancelDelayedSend();
-            if (abort) _transport.abort();
-            _clientId = null;
-            _setStatus('disconnected');
-            _batch = 0;
-            _messageQueue = [];
-            _resetBackoff();
-        };
-
-        function _disconnectFailure(xhr, message)
-        {
-            _debug('Disconnect failure');
-            _disconnect(true);
-
-            var failureMessage = {
-                successful: false,
-                failure: true,
-                channel: '/meta/disconnect',
-                request: message,
-                xhr: xhr,
-                advice: {
-                    action: 'none',
-                    interval: 0
-                }
-            };
-            _notifyListeners('/meta/disconnect', failureMessage);
-            _notifyListeners('/meta/unsuccessful', failureMessage);
-        };
-
-        function _subscribeSuccess(message)
-        {
-            if (message.successful)
-            {
-                _debug('Subscribe successful');
-                _notifyListeners('/meta/subscribe', message);
-            }
-            else
-            {
-                _debug('Subscribe unsuccessful');
-                _notifyListeners('/meta/subscribe', message);
-                _notifyListeners('/meta/unsuccessful', message);
-            }
-        };
-
-        function _subscribeFailure(xhr, message)
-        {
-            _debug('Subscribe failure');
-
-            var failureMessage = {
-                successful: false,
-                failure: true,
-                channel: '/meta/subscribe',
-                request: message,
-                xhr: xhr,
-                advice: {
-                    action: 'none',
-                    interval: 0
-                }
-            };
-            _notifyListeners('/meta/subscribe', failureMessage);
-            _notifyListeners('/meta/unsuccessful', failureMessage);
-        };
-
-        function _unsubscribeSuccess(message)
-        {
-            if (message.successful)
-            {
-                _debug('Unsubscribe successful');
-                _notifyListeners('/meta/unsubscribe', message);
-            }
-            else
-            {
-                _debug('Unsubscribe unsuccessful');
-                _notifyListeners('/meta/unsubscribe', message);
-                _notifyListeners('/meta/unsuccessful', message);
-            }
-        };
-
-        function _unsubscribeFailure(xhr, message)
-        {
-            _debug('Unsubscribe failure');
-
-            var failureMessage = {
-                successful: false,
-                failure: true,
-                channel: '/meta/unsubscribe',
-                request: message,
-                xhr: xhr,
-                advice: {
-                    action: 'none',
-                    interval: 0
-                }
-            };
-            _notifyListeners('/meta/unsubscribe', failureMessage);
-            _notifyListeners('/meta/unsuccessful', failureMessage);
-        };
-
-        function _messageSuccess(message)
-        {
-            if (message.successful === undefined)
-            {
-                if (message.data)
-                {
-                    // It is a plain message, and not a bayeux meta message
-                    _notifyListeners(message.channel, message);
-                }
-                else
-                {
-                    _debug('Unknown message {}', JSON.stringify(message));
-                }
-            }
-            else
-            {
-                if (message.successful)
-                {
-                    _debug('Publish successful');
-                    _notifyListeners('/meta/publish', message);
-                }
-                else
-                {
-                    _debug('Publish unsuccessful');
-                    _notifyListeners('/meta/publish', message);
-                    _notifyListeners('/meta/unsuccessful', message);
-                }
-            }
-        };
-
-        function _messageFailure(xhr, message)
-        {
-            _debug('Publish failure');
-
-            var failureMessage = {
-                successful: false,
-                failure: true,
-                channel: message.channel,
-                request: message,
-                xhr: xhr,
-                advice: {
-                    action: 'none',
-                    interval: 0
-                }
-            };
-            _notifyListeners('/meta/publish', failureMessage);
-            _notifyListeners('/meta/unsuccessful', failureMessage);
-        };
-
-        function _notifyListeners(channel, message)
-        {
-            // Notify direct listeners
-            _notify(channel, message);
-
-            // Notify the globbing listeners
-            var channelParts = channel.split("/");
-            var last = channelParts.length - 1;
-            for (var i = last; i > 0; --i)
-            {
-                var channelPart = channelParts.slice(0, i).join('/') + '/*';
-                // We don't want to notify /foo/* if the channel is /foo/bar/baz,
-                // so we stop at the first non recursive globbing
-                if (i == last) _notify(channelPart, message);
-                // Add the recursive globber and notify
-                channelPart += '*';
-                _notify(channelPart, message);
-            }
-        };
-
-        function _notify(channel, message)
-        {
-            var subscriptions = _listeners[channel];
-            if (subscriptions && subscriptions.length > 0)
-            {
-                for (var i = 0; i < subscriptions.length; ++i)
-                {
-                    var subscription = subscriptions[i];
-                    // Subscriptions may come and go, so the array may have 'holes'
-                    if (subscription)
-                    {
-                        try
-                        {
-                            _debug('Notifying subscription: channel \'{}\', callback \'{}\'', channel, subscription.callback.name);
-                            subscription.callback.call(subscription.scope, message);
-                        }
-                        catch (x)
-                        {
-                            // Ignore exceptions from callbacks
-                            _warn('Exception during execution of callback \'{}\' on channel \'{}\' for message {}, exception: {}', subscription.callback.name, channel, JSON.stringify(message), x);
-                        }
-                    }
-                }
-            }
-        };
-
-        function _resetBackoff()
-        {
-            _backoff = 0;
-        };
-
-        function _increaseBackoff()
-        {
-            if (_backoff < _maxBackoff) _backoff += _backoffIncrement;
-        };
-
-        var _error = this._error = function(text, args)
-        {
-            _log('error', _format.apply(this, arguments));
-        };
-
-        var _warn = this._warn = function(text, args)
-        {
-            _log('warn', _format.apply(this, arguments));
-        };
-
-        var _info = this._info = function(text, args)
-        {
-            _log('info', _format.apply(this, arguments));
-        };
-
-        var _debug = this._debug = function(text, args)
-        {
-            _log('debug', _format.apply(this, arguments));
-        };
-
-        function _log(level, text)
-        {
-            var priority = _logPriorities[level];
-            var configPriority = _logPriorities[_logLevel];
-            if (!configPriority) configPriority = _logPriorities['info'];
-            if (priority >= configPriority)
-            {
-                if (window.console) window.console.log(text);
-            }
-        };
-
-        function _format(text)
-        {
-            var braces = /\{\}/g;
-            var result = '';
-            var start = 0;
-            var count = 0;
-            while (braces.test(text))
-            {
-                result += text.substr(start, braces.lastIndex - start - 2);
-                var arg = arguments[++count];
-                result += arg !== undefined ? arg : '{}';
-                start = braces.lastIndex;
-            }
-            result += text.substr(start, text.length - start);
-            return result;
-        };
-
-        function newLongPollingTransport()
-        {
-            return $.extend({}, new Transport('long-polling'), new LongPollingTransport());
-        };
-
-        function newCallbackPollingTransport()
-        {
-            return $.extend({}, new Transport('callback-polling'), new CallbackPollingTransport());
-        };
-
-        /**
-         * Base object with the common functionality for transports.
-         * The key responsibility is to allow at most 2 outstanding requests to the server,
-         * to avoid that requests are sent behind a long poll.
-         * To achieve this, we have one reserved request for the long poll, and all other
-         * requests are serialized one after the other.
-         */
-        var Transport = function(type)
-        {
-            var _maxRequests = 2;
-            var _requestIds = 0;
-            var _cometRequest = null;
-            var _requests = [];
-            var _packets = [];
-
-            this.getType = function()
-            {
-                return type;
-            };
-
-            this.send = function(packet, comet)
-            {
-                if (comet)
-                    _cometSend(this, packet);
-                else
-                    _send(this, packet);
-            };
-
-            function _cometSend(self, packet)
-            {
-                if (_cometRequest !== null) throw 'Concurrent comet requests not allowed, request ' + _cometRequest.id + ' not yet completed';
-
-                var requestId = ++_requestIds;
-                _debug('Beginning comet request {}', requestId);
-
-                var request = {id: requestId};
-                _debug('Delivering comet request {}', requestId);
-                self.deliver(packet, request);
-                _cometRequest = request;
-            };
-
-            function _send(self, packet)
-            {
-                var requestId = ++_requestIds;
-                _debug('Beginning request {}, {} other requests, {} queued requests', requestId, _requests.length, _packets.length);
-
-                var request = {id: requestId};
-                // Consider the comet request which should always be present
-                if (_requests.length < _maxRequests - 1)
-                {
-                    _debug('Delivering request {}', requestId);
-                    self.deliver(packet, request);
-                    _requests.push(request);
-                }
-                else
-                {
-                    _packets.push([packet, request]);
-                    _debug('Queued request {}, {} queued requests', requestId, _packets.length);
-                }
-            };
-
-            this.complete = function(request, success, comet)
-            {
-                if (comet)
-                    _cometComplete(request);
-                else
-                    _complete(this, request, success);
-            };
-
-            function _cometComplete(request)
-            {
-                var requestId = request.id;
-                if (_cometRequest !== request) throw 'Comet request mismatch, completing request ' + requestId;
-
-                // Reset comet request
-                _cometRequest = null;
-                _debug('Ended comet request {}', requestId);
-            };
-
-            function _complete(self, request, success)
-            {
-                var requestId = request.id;
-                var index = $.inArray(request, _requests);
-                // The index can be negative the request has been aborted
-                if (index >= 0) _requests.splice(index, 1);
-                _debug('Ended request {}, {} other requests, {} queued requests', requestId, _requests.length, _packets.length);
-
-                if (_packets.length > 0)
-                {
-                    var packet = _packets.shift();
-                    if (success)
-                    {
-                        _debug('Dequeueing and sending request {}, {} queued requests', packet[1].id, _packets.length);
-                        _send(self, packet[0]);
-                    }
-                    else
-                    {
-                        _debug('Dequeueing and failing request {}, {} queued requests', packet[1].id, _packets.length);
-                        // Keep the semantic of calling response callbacks asynchronously after the request
-                        setTimeout(function() { packet[0].onFailure(packet[1], 'error'); }, 0);
-                    }
-                }
-            };
-
-            this.abort = function()
-            {
-                for (var i = 0; i < _requests.length; ++i)
-                {
-                    var request = _requests[i];
-                    _debug('Aborting request {}', request.id);
-                    if (request.xhr) request.xhr.abort();
-                }
-                if (_cometRequest)
-                {
-                    _debug('Aborting comet request {}', _cometRequest.id);
-                    if (_cometRequest.xhr) _cometRequest.xhr.abort();
-                }
-                _cometRequest = null;
-                _requests = [];
-                _packets = [];
-            };
-        };
-
-        var LongPollingTransport = function()
-        {
-            this.deliver = function(packet, request)
-            {
-                request.xhr = $.ajax({
-                    url: packet.url,
-                    type: 'POST',
-                    contentType: 'text/json;charset=UTF-8',
-                    beforeSend: function(xhr)
-                    {
-                        xhr.setRequestHeader('Connection', 'Keep-Alive');
-                        return true;
-                    },
-                    data: JSON.stringify(packet.messages),
-                    success: function(response) { packet.onSuccess(request, response); },
-                    error: function(xhr, reason, exception) { packet.onFailure(request, reason, exception); }
-                });
-            };
-        };
-
-        var CallbackPollingTransport = function()
-        {
-            var _maxLength = 2000;
-            this.deliver = function(packet, request)
-            {
-                // Microsoft Internet Explorer has a 2083 URL max length
-                // We must ensure that we stay within that length
-                var messages = JSON.stringify(packet.messages);
-                // Encode the messages because all brackets, quotes, commas, colons, etc
-                // present in the JSON will be URL encoded, taking many more characters
-                var urlLength = packet.url.length + encodeURI(messages).length;
-                _debug('URL length: {}', urlLength);
-                // Let's stay on the safe side and use 2000 instead of 2083
-                // also because we did not count few characters among which
-                // the parameter name 'message' and the parameter 'jsonp',
-                // which sum up to about 50 chars
-                if (urlLength > _maxLength)
-                {
-                    var x = packet.messages.length > 1 ?
-                            'Too many bayeux messages in the same batch resulting in message too big ' +
-                            '(' + urlLength + ' bytes, max is ' + _maxLength + ') for transport ' + this.getType() :
-                            'Bayeux message too big (' + urlLength + ' bytes, max is ' + _maxLength + ') ' +
-                            'for transport ' + this.getType();
-                    // Keep the semantic of calling response callbacks asynchronously after the request
-                    _setTimeout(function() { packet.onFailure(request, 'error', x); }, 0);
-                }
-                else
-                {
-                    $.ajax({
-                        url: packet.url,
-                        type: 'GET',
-                        dataType: 'jsonp',
-                        jsonp: 'jsonp',
-                        beforeSend: function(xhr)
-                        {
-                            xhr.setRequestHeader('Connection', 'Keep-Alive');
-                            return true;
-                        },
-                        data:
-                        {
-                            // In callback-polling, the content must be sent via the 'message' parameter
-                            message: messages
-                        },
-                        success: function(response) { packet.onSuccess(request, response); },
-                        error: function(xhr, reason, exception) { packet.onFailure(request, reason, exception); }
-                    });
-                }
-            };
-        };
-    };
-
-    /**
-     * The JS object that exposes the comet API to applications
-     */
-    $.cometd = new $.Cometd(); // The default instance
-
-})(jQuery);
diff --git a/plugins/Comet/js/cometupdate.js b/plugins/Comet/js/cometupdate.js
new file mode 100644 (file)
index 0000000..50b02b7
--- /dev/null
@@ -0,0 +1,27 @@
+// update the local timeline from a Comet server
+var CometUpdate = function()
+{
+     var _server;
+     var _timeline;
+     var _userid;
+     var _replyurl;
+     var _favorurl;
+     var _deleteurl;
+     var _cometd;
+
+     return {
+          init: function(server, timeline, userid, replyurl, favorurl, deleteurl)
+          {
+               _cometd = $.cometd; // Uses the default Comet object
+               _cometd.init(server);
+               _server = server;
+               _timeline = timeline;
+               _userid = userid;
+               _favorurl = favorurl;
+               _replyurl = replyurl;
+               _deleteurl = deleteurl;
+               _cometd.subscribe(timeline, function(message) { RealtimeUpdate.receive(message.data) });
+               $(window).unload(function() { _cometd.disconnect(); } );
+          }
+     }
+}();
diff --git a/plugins/Comet/js/jquery.comet.js b/plugins/Comet/js/jquery.comet.js
new file mode 100644 (file)
index 0000000..6de437f
--- /dev/null
@@ -0,0 +1,1451 @@
+/**
+ * Copyright 2008 Mort Bay Consulting Pty. Ltd.
+ * Dual licensed under the Apache License 2.0 and the MIT license.
+ * ----------------------------------------------------------------------------
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http: *www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ----------------------------------------------------------------------------
+ * Licensed under the MIT license;
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * ----------------------------------------------------------------------------
+ * $Revision$ $Date$
+ */
+(function($)
+{
+    /**
+     * The constructor for a Comet object.
+     * There is a default Comet instance already created at the variable <code>$.cometd</code>,
+     * and hence that can be used to start a comet conversation with a server.
+     * In the rare case a page needs more than one comet conversation, a new instance can be
+     * created via:
+     * <pre>
+     * var url2 = ...;
+     * var cometd2 = new $.Cometd();
+     * cometd2.init(url2);
+     * </pre>
+     */
+    $.Cometd = function(name)
+    {
+        var _name = name || 'default';
+        var _logPriorities = { debug: 1, info: 2, warn: 3, error: 4 };
+        var _logLevel = 'info';
+        var _url;
+        var _xd = false;
+        var _transport;
+        var _status = 'disconnected';
+        var _messageId = 0;
+        var _clientId = null;
+        var _batch = 0;
+        var _messageQueue = [];
+        var _listeners = {};
+        var _backoff = 0;
+        var _backoffIncrement = 1000;
+        var _maxBackoff = 60000;
+        var _scheduledSend = null;
+        var _extensions = [];
+        var _advice = {};
+        var _handshakeProps;
+
+        /**
+         * Returns the name assigned to this Comet object, or the string 'default'
+         * if no name has been explicitely passed as parameter to the constructor.
+         */
+        this.getName = function()
+        {
+            return _name;
+        };
+
+        /**
+         * Configures the initial comet communication with the comet server.
+         * @param cometURL the URL of the comet server
+         */
+        this.configure = function(cometURL)
+        {
+            _configure(cometURL);
+        };
+
+        function _configure(cometURL)
+        {
+            _url = cometURL;
+            _debug('Initializing comet with url: {}', _url);
+
+            // Check immediately if we're cross domain
+            // If cross domain, the handshake must not send the long polling transport type
+            var urlParts = /(^https?:)?(\/\/(([^:\/\?#]+)(:(\d+))?))?([^\?#]*)/.exec(cometURL);
+            if (urlParts[3]) _xd = urlParts[3] != location.host;
+
+            // Temporary setup a transport to send the initial handshake
+            // The transport may be changed as a result of handshake
+            if (_xd)
+                _transport = newCallbackPollingTransport();
+            else
+                _transport = newLongPollingTransport();
+            _debug('Initial transport is {}', _transport.getType());
+        };
+
+        /**
+         * Configures and establishes the comet communication with the comet server
+         * via a handshake and a subsequent connect.
+         * @param cometURL the URL of the comet server
+         * @param handshakeProps an object to be merged with the handshake message
+         * @see #configure(cometURL)
+         * @see #handshake(handshakeProps)
+         */
+        this.init = function(cometURL, handshakeProps)
+        {
+            _configure(cometURL);
+            _handshake(handshakeProps);
+        };
+
+        /**
+         * Establishes the comet communication with the comet server
+         * via a handshake and a subsequent connect.
+         * @param handshakeProps an object to be merged with the handshake message
+         */
+        this.handshake = function(handshakeProps)
+        {
+            _handshake(handshakeProps);
+        };
+
+        /**
+         * Disconnects from the comet server.
+         * @param disconnectProps an object to be merged with the disconnect message
+         */
+        this.disconnect = function(disconnectProps)
+        {
+            var bayeuxMessage = {
+                channel: '/meta/disconnect'
+            };
+            var message = $.extend({}, disconnectProps, bayeuxMessage);
+            // Deliver immediately
+            // The handshake and connect mechanism make use of startBatch(), and in case
+            // of a failed handshake the disconnect would not be delivered if using _send().
+            _setStatus('disconnecting');
+            _deliver([message], false);
+        };
+
+        /**
+         * Marks the start of a batch of application messages to be sent to the server
+         * in a single request, obtaining a single response containing (possibly) many
+         * application reply messages.
+         * Messages are held in a queue and not sent until {@link #endBatch()} is called.
+         * If startBatch() is called multiple times, then an equal number of endBatch()
+         * calls must be made to close and send the batch of messages.
+         * @see #endBatch()
+         */
+        this.startBatch = function()
+        {
+            _startBatch();
+        };
+
+        /**
+         * Marks the end of a batch of application messages to be sent to the server
+         * in a single request.
+         * @see #startBatch()
+         */
+        this.endBatch = function()
+        {
+            _endBatch(true);
+        };
+
+        /**
+         * Subscribes to the given channel, performing the given callback in the given scope
+         * when a message for the channel arrives.
+         * @param channel the channel to subscribe to
+         * @param scope the scope of the callback
+         * @param callback the callback to call when a message is delivered to the channel
+         * @param subscribeProps an object to be merged with the subscribe message
+         * @return the subscription handle to be passed to {@link #unsubscribe(object)}
+         */
+        this.subscribe = function(channel, scope, callback, subscribeProps)
+        {
+            var subscription = this.addListener(channel, scope, callback);
+
+            // Send the subscription message after the subscription registration to avoid
+            // races where the server would deliver a message to the subscribers, but here
+            // on the client the subscription has not been added yet to the data structures
+            var bayeuxMessage = {
+                channel: '/meta/subscribe',
+                subscription: channel
+            };
+            var message = $.extend({}, subscribeProps, bayeuxMessage);
+            _send(message);
+
+            return subscription;
+        };
+
+        /**
+         * Unsubscribes the subscription obtained with a call to {@link #subscribe(string, object, function)}.
+         * @param subscription the subscription to unsubscribe.
+         */
+        this.unsubscribe = function(subscription, unsubscribeProps)
+        {
+            // Remove the local listener before sending the message
+            // This ensures that if the server fails, this client does not get notifications
+            this.removeListener(subscription);
+            var bayeuxMessage = {
+                channel: '/meta/unsubscribe',
+                subscription: subscription[0]
+            };
+            var message = $.extend({}, unsubscribeProps, bayeuxMessage);
+            _send(message);
+        };
+
+        /**
+         * Publishes a message on the given channel, containing the given content.
+         * @param channel the channel to publish the message to
+         * @param content the content of the message
+         * @param publishProps an object to be merged with the publish message
+         */
+        this.publish = function(channel, content, publishProps)
+        {
+            var bayeuxMessage = {
+                channel: channel,
+                data: content
+            };
+            var message = $.extend({}, publishProps, bayeuxMessage);
+            _send(message);
+        };
+
+        /**
+         * Adds a listener for bayeux messages, performing the given callback in the given scope
+         * when a message for the given channel arrives.
+         * @param channel the channel the listener is interested to
+         * @param scope the scope of the callback
+         * @param callback the callback to call when a message is delivered to the channel
+         * @returns the subscription handle to be passed to {@link #removeListener(object)}
+         * @see #removeListener(object)
+         */
+        this.addListener = function(channel, scope, callback)
+        {
+            // The data structure is a map<channel, subscription[]>, where each subscription
+            // holds the callback to be called and its scope.
+
+            // Normalize arguments
+            if (!callback)
+            {
+                callback = scope;
+                scope = undefined;
+            }
+
+            var subscription = {
+                scope: scope,
+                callback: callback
+            };
+
+            var subscriptions = _listeners[channel];
+            if (!subscriptions)
+            {
+                subscriptions = [];
+                _listeners[channel] = subscriptions;
+            }
+            // Pushing onto an array appends at the end and returns the id associated with the element increased by 1.
+            // Note that if:
+            // a.push('a'); var hb=a.push('b'); delete a[hb-1]; var hc=a.push('c');
+            // then:
+            // hc==3, a.join()=='a',,'c', a.length==3
+            var subscriptionIndex = subscriptions.push(subscription) - 1;
+            _debug('Added listener: channel \'{}\', callback \'{}\', index {}', channel, callback.name, subscriptionIndex);
+
+            // The subscription to allow removal of the listener is made of the channel and the index
+            return [channel, subscriptionIndex];
+        };
+
+        /**
+         * Removes the subscription obtained with a call to {@link #addListener(string, object, function)}.
+         * @param subscription the subscription to unsubscribe.
+         */
+        this.removeListener = function(subscription)
+        {
+            var subscriptions = _listeners[subscription[0]];
+            if (subscriptions)
+            {
+                delete subscriptions[subscription[1]];
+                _debug('Removed listener: channel \'{}\', index {}', subscription[0], subscription[1]);
+            }
+        };
+
+        /**
+         * Removes all listeners registered with {@link #addListener(channel, scope, callback)} or
+         * {@link #subscribe(channel, scope, callback)}.
+         */
+        this.clearListeners = function()
+        {
+            _listeners = {};
+        };
+
+        /**
+         * Returns a string representing the status of the bayeux communication with the comet server.
+         */
+        this.getStatus = function()
+        {
+            return _status;
+        };
+
+        /**
+         * Sets the backoff period used to increase the backoff time when retrying an unsuccessful or failed message.
+         * Default value is 1 second, which means if there is a persistent failure the retries will happen
+         * after 1 second, then after 2 seconds, then after 3 seconds, etc. So for example with 15 seconds of
+         * elapsed time, there will be 5 retries (at 1, 3, 6, 10 and 15 seconds elapsed).
+         * @param period the backoff period to set
+         * @see #getBackoffIncrement()
+         */
+        this.setBackoffIncrement = function(period)
+        {
+            _backoffIncrement = period;
+        };
+
+        /**
+         * Returns the backoff period used to increase the backoff time when retrying an unsuccessful or failed message.
+         * @see #setBackoffIncrement(period)
+         */
+        this.getBackoffIncrement = function()
+        {
+            return _backoffIncrement;
+        };
+
+        /**
+         * Returns the backoff period to wait before retrying an unsuccessful or failed message.
+         */
+        this.getBackoffPeriod = function()
+        {
+            return _backoff;
+        };
+
+        /**
+         * Sets the log level for console logging.
+         * Valid values are the strings 'error', 'warn', 'info' and 'debug', from
+         * less verbose to more verbose.
+         * @param level the log level string
+         */
+        this.setLogLevel = function(level)
+        {
+            _logLevel = level;
+        };
+
+        /**
+         * Registers an extension whose callbacks are called for every incoming message
+         * (that comes from the server to this client implementation) and for every
+         * outgoing message (that originates from this client implementation for the
+         * server).
+         * The format of the extension object is the following:
+         * <pre>
+         * {
+         *     incoming: function(message) { ... },
+         *     outgoing: function(message) { ... }
+         * }
+         * Both properties are optional, but if they are present they will be called
+         * respectively for each incoming message and for each outgoing message.
+         * </pre>
+         * @param name the name of the extension
+         * @param extension the extension to register
+         * @return true if the extension was registered, false otherwise
+         * @see #unregisterExtension(name)
+         */
+        this.registerExtension = function(name, extension)
+        {
+            var existing = false;
+            for (var i = 0; i < _extensions.length; ++i)
+            {
+                var existingExtension = _extensions[i];
+                if (existingExtension.name == name)
+                {
+                    existing = true;
+                    return false;
+                }
+            }
+            if (!existing)
+            {
+                _extensions.push({
+                    name: name,
+                    extension: extension
+                });
+                _debug('Registered extension \'{}\'', name);
+                return true;
+            }
+            else
+            {
+                _info('Could not register extension with name \'{}\': another extension with the same name already exists');
+                return false;
+            }
+        };
+
+        /**
+         * Unregister an extension previously registered with
+         * {@link #registerExtension(name, extension)}.
+         * @param name the name of the extension to unregister.
+         * @return true if the extension was unregistered, false otherwise
+         */
+        this.unregisterExtension = function(name)
+        {
+            var unregistered = false;
+            $.each(_extensions, function(index, extension)
+            {
+                if (extension.name == name)
+                {
+                    _extensions.splice(index, 1);
+                    unregistered = true;
+                    _debug('Unregistered extension \'{}\'', name);
+                    return false;
+                }
+            });
+            return unregistered;
+        };
+
+        /**
+         * Starts a the batch of messages to be sent in a single request.
+         * @see _endBatch(deliverMessages)
+         */
+        function _startBatch()
+        {
+            ++_batch;
+        };
+
+        /**
+         * Ends the batch of messages to be sent in a single request,
+         * optionally delivering messages present in the message queue depending
+         * on the given argument.
+         * @param deliverMessages whether to deliver the messages in the queue or not
+         * @see _startBatch()
+         */
+        function _endBatch(deliverMessages)
+        {
+            --_batch;
+            if (_batch < 0) _batch = 0;
+            if (deliverMessages && _batch == 0 && !_isDisconnected())
+            {
+                var messages = _messageQueue;
+                _messageQueue = [];
+                if (messages.length > 0) _deliver(messages, false);
+            }
+        };
+
+        function _nextMessageId()
+        {
+            return ++_messageId;
+        };
+
+        /**
+         * Converts the given response into an array of bayeux messages
+         * @param response the response to convert
+         * @return an array of bayeux messages obtained by converting the response
+         */
+        function _convertToMessages(response)
+        {
+            if (response === undefined) return [];
+            if (response instanceof Array) return response;
+            if (response instanceof String || typeof response == 'string') return eval('(' + response + ')');
+            if (response instanceof Object) return [response];
+            throw 'Conversion Error ' + response + ', typeof ' + (typeof response);
+        };
+
+        function _setStatus(newStatus)
+        {
+            _debug('{} -> {}', _status, newStatus);
+            _status = newStatus;
+        };
+
+        function _isDisconnected()
+        {
+            return _status == 'disconnecting' || _status == 'disconnected';
+        };
+
+        /**
+         * Sends the initial handshake message
+         */
+        function _handshake(handshakeProps)
+        {
+            _debug('Starting handshake');
+            _clientId = null;
+
+            // Start a batch.
+            // This is needed because handshake and connect are async.
+            // It may happen that the application calls init() then subscribe()
+            // and the subscribe message is sent before the connect message, if
+            // the subscribe message is not held until the connect message is sent.
+            // So here we start a batch to hold temporarly any message until
+            // the connection is fully established.
+            _batch = 0;
+            _startBatch();
+
+            // Save the original properties provided by the user
+            // Deep copy to avoid the user to be able to change them later
+            _handshakeProps = $.extend(true, {}, handshakeProps);
+
+            var bayeuxMessage = {
+                version: '1.0',
+                minimumVersion: '0.9',
+                channel: '/meta/handshake',
+                supportedConnectionTypes: _xd ? ['callback-polling'] : ['long-polling', 'callback-polling']
+            };
+            // Do not allow the user to mess with the required properties,
+            // so merge first the user properties and *then* the bayeux message
+            var message = $.extend({}, handshakeProps, bayeuxMessage);
+
+            // We started a batch to hold the application messages,
+            // so here we must bypass it and deliver immediately.
+            _setStatus('handshaking');
+            _deliver([message], false);
+        };
+
+        function _findTransport(handshakeResponse)
+        {
+            var transportTypes = handshakeResponse.supportedConnectionTypes;
+            if (_xd)
+            {
+                // If we are cross domain, check if the server supports it, that's the only option
+                if ($.inArray('callback-polling', transportTypes) >= 0) return _transport;
+            }
+            else
+            {
+                // Check if we can keep long-polling
+                if ($.inArray('long-polling', transportTypes) >= 0) return _transport;
+
+                // The server does not support long-polling
+                if ($.inArray('callback-polling', transportTypes) >= 0) return newCallbackPollingTransport();
+            }
+            return null;
+        };
+
+        function _delayedHandshake()
+        {
+            _setStatus('handshaking');
+            _delayedSend(function()
+            {
+                _handshake(_handshakeProps);
+            });
+        };
+
+        function _delayedConnect()
+        {
+            _setStatus('connecting');
+            _delayedSend(function()
+            {
+                _connect();
+            });
+        };
+
+        function _delayedSend(operation)
+        {
+            _cancelDelayedSend();
+            var delay = _backoff;
+            _debug("Delayed send: backoff {}, interval {}", _backoff, _advice.interval);
+            if (_advice.interval && _advice.interval > 0)
+                delay += _advice.interval;
+            _scheduledSend = _setTimeout(operation, delay);
+        };
+
+        function _cancelDelayedSend()
+        {
+            if (_scheduledSend !== null) clearTimeout(_scheduledSend);
+            _scheduledSend = null;
+        };
+
+        function _setTimeout(funktion, delay)
+        {
+            return setTimeout(function()
+            {
+                try
+                {
+                    funktion();
+                }
+                catch (x)
+                {
+                    _debug('Exception during scheduled execution of function \'{}\': {}', funktion.name, x);
+                }
+            }, delay);
+        };
+
+        /**
+         * Sends the connect message
+         */
+        function _connect()
+        {
+            _debug('Starting connect');
+            var message = {
+                channel: '/meta/connect',
+                connectionType: _transport.getType()
+            };
+            _setStatus('connecting');
+            _deliver([message], true);
+            _setStatus('connected');
+        };
+
+        function _send(message)
+        {
+            if (_batch > 0)
+                _messageQueue.push(message);
+            else
+                _deliver([message], false);
+        };
+
+        /**
+         * Delivers the messages to the comet server
+         * @param messages the array of messages to send
+         */
+        function _deliver(messages, comet)
+        {
+            // We must be sure that the messages have a clientId.
+            // This is not guaranteed since the handshake may take time to return
+            // (and hence the clientId is not known yet) and the application
+            // may create other messages.
+            $.each(messages, function(index, message)
+            {
+                message['id'] = _nextMessageId();
+                if (_clientId) message['clientId'] = _clientId;
+                messages[index] = _applyOutgoingExtensions(message);
+            });
+
+            var self = this;
+            var envelope = {
+                url: _url,
+                messages: messages,
+                onSuccess: function(request, response)
+                {
+                    try
+                    {
+                        _handleSuccess.call(self, request, response, comet);
+                    }
+                    catch (x)
+                    {
+                        _debug('Exception during execution of success callback: {}', x);
+                    }
+                },
+                onFailure: function(request, reason, exception)
+                {
+                    try
+                    {
+                        _handleFailure.call(self, request, messages, reason, exception, comet);
+                    }
+                    catch (x)
+                    {
+                        _debug('Exception during execution of failure callback: {}', x);
+                    }
+                }
+            };
+            _debug('Sending request to {}, message(s): {}', envelope.url, JSON.stringify(envelope.messages));
+            _transport.send(envelope, comet);
+        };
+
+        function _applyIncomingExtensions(message)
+        {
+            for (var i = 0; i < _extensions.length; ++i)
+            {
+                var extension = _extensions[i];
+                var callback = extension.extension.incoming;
+                if (callback && typeof callback === 'function')
+                {
+                    _debug('Calling incoming extension \'{}\', callback \'{}\'', extension.name, callback.name);
+                    message = _applyExtension(extension.name, callback, message) || message;
+                }
+            }
+            return message;
+        };
+
+        function _applyOutgoingExtensions(message)
+        {
+            for (var i = 0; i < _extensions.length; ++i)
+            {
+                var extension = _extensions[i];
+                var callback = extension.extension.outgoing;
+                if (callback && typeof callback === 'function')
+                {
+                    _debug('Calling outgoing extension \'{}\', callback \'{}\'', extension.name, callback.name);
+                    message = _applyExtension(extension.name, callback, message) || message;
+                }
+            }
+            return message;
+        };
+
+        function _applyExtension(name, callback, message)
+        {
+            try
+            {
+                return callback(message);
+            }
+            catch (x)
+            {
+                _debug('Exception during execution of extension \'{}\': {}', name, x);
+                return message;
+            }
+        };
+
+        function _handleSuccess(request, response, comet)
+        {
+            var messages = _convertToMessages(response);
+            _debug('Received response {}', JSON.stringify(messages));
+
+            // Signal the transport it can deliver other queued requests
+            _transport.complete(request, true, comet);
+
+            for (var i = 0; i < messages.length; ++i)
+            {
+                var message = messages[i];
+                message = _applyIncomingExtensions(message);
+
+                if (message.advice) _advice = message.advice;
+
+                var channel = message.channel;
+                switch (channel)
+                {
+                    case '/meta/handshake':
+                        _handshakeSuccess(message);
+                        break;
+                    case '/meta/connect':
+                        _connectSuccess(message);
+                        break;
+                    case '/meta/disconnect':
+                        _disconnectSuccess(message);
+                        break;
+                    case '/meta/subscribe':
+                        _subscribeSuccess(message);
+                        break;
+                    case '/meta/unsubscribe':
+                        _unsubscribeSuccess(message);
+                        break;
+                    default:
+                        _messageSuccess(message);
+                        break;
+                }
+            }
+        };
+
+        function _handleFailure(request, messages, reason, exception, comet)
+        {
+            var xhr = request.xhr;
+            _debug('Request failed, status: {}, reason: {}, exception: {}', xhr && xhr.status, reason, exception);
+
+            // Signal the transport it can deliver other queued requests
+            _transport.complete(request, false, comet);
+
+            for (var i = 0; i < messages.length; ++i)
+            {
+                var message = messages[i];
+                var channel = message.channel;
+                switch (channel)
+                {
+                    case '/meta/handshake':
+                        _handshakeFailure(xhr, message);
+                        break;
+                    case '/meta/connect':
+                        _connectFailure(xhr, message);
+                        break;
+                    case '/meta/disconnect':
+                        _disconnectFailure(xhr, message);
+                        break;
+                    case '/meta/subscribe':
+                        _subscribeFailure(xhr, message);
+                        break;
+                    case '/meta/unsubscribe':
+                        _unsubscribeFailure(xhr, message);
+                        break;
+                    default:
+                        _messageFailure(xhr, message);
+                        break;
+                }
+            }
+        };
+
+        function _handshakeSuccess(message)
+        {
+            if (message.successful)
+            {
+                _debug('Handshake successful');
+                // Save clientId, figure out transport, then follow the advice to connect
+                _clientId = message.clientId;
+
+                var newTransport = _findTransport(message);
+                if (newTransport === null)
+                {
+                    throw 'Could not agree on transport with server';
+                }
+                else
+                {
+                    if (_transport.getType() != newTransport.getType())
+                    {
+                        _debug('Changing transport from {} to {}', _transport.getType(), newTransport.getType());
+                        _transport = newTransport;
+                    }
+                }
+
+                // Notify the listeners
+                // Here the new transport is in place, as well as the clientId, so
+                // the listener can perform a publish() if it wants, and the listeners
+                // are notified before the connect below.
+                _notifyListeners('/meta/handshake', message);
+
+                var action = _advice.reconnect ? _advice.reconnect : 'retry';
+                switch (action)
+                {
+                    case 'retry':
+                        _delayedConnect();
+                        break;
+                    default:
+                        break;
+                }
+            }
+            else
+            {
+                _debug('Handshake unsuccessful');
+
+                var retry = !_isDisconnected() && _advice.reconnect != 'none';
+                if (!retry) _setStatus('disconnected');
+
+                _notifyListeners('/meta/handshake', message);
+                _notifyListeners('/meta/unsuccessful', message);
+
+                // Only try again if we haven't been disconnected and
+                // the advice permits us to retry the handshake
+                if (retry)
+                {
+                    _increaseBackoff();
+                    _debug('Handshake failure, backing off and retrying in {} ms', _backoff);
+                    _delayedHandshake();
+                }
+            }
+        };
+
+        function _handshakeFailure(xhr, message)
+        {
+            _debug('Handshake failure');
+
+            // Notify listeners
+            var failureMessage = {
+                successful: false,
+                failure: true,
+                channel: '/meta/handshake',
+                request: message,
+                xhr: xhr,
+                advice: {
+                    action: 'retry',
+                    interval: _backoff
+                }
+            };
+
+            var retry = !_isDisconnected() && _advice.reconnect != 'none';
+            if (!retry) _setStatus('disconnected');
+
+            _notifyListeners('/meta/handshake', failureMessage);
+            _notifyListeners('/meta/unsuccessful', failureMessage);
+
+            // Only try again if we haven't been disconnected and the
+            // advice permits us to try again
+            if (retry)
+            {
+                _increaseBackoff();
+                _debug('Handshake failure, backing off and retrying in {} ms', _backoff);
+                _delayedHandshake();
+            }
+        };
+
+        function _connectSuccess(message)
+        {
+            var action = _isDisconnected() ? 'none' : (_advice.reconnect ? _advice.reconnect : 'retry');
+            if (!_isDisconnected()) _setStatus(action == 'retry' ? 'connecting' : 'disconnecting');
+
+            if (message.successful)
+            {
+                _debug('Connect successful');
+
+                // End the batch and allow held messages from the application
+                // to go to the server (see _handshake() where we start the batch).
+                // The batch is ended before notifying the listeners, so that
+                // listeners can batch other cometd operations
+                _endBatch(true);
+
+                // Notify the listeners after the status change but before the next connect
+                _notifyListeners('/meta/connect', message);
+
+                // Connect was successful.
+                // Normally, the advice will say "reconnect: 'retry', interval: 0"
+                // and the server will hold the request, so when a response returns
+                // we immediately call the server again (long polling)
+                switch (action)
+                {
+                    case 'retry':
+                        _resetBackoff();
+                        _delayedConnect();
+                        break;
+                    default:
+                        _resetBackoff();
+                        _setStatus('disconnected');
+                        break;
+                }
+            }
+            else
+            {
+                _debug('Connect unsuccessful');
+
+                // Notify the listeners after the status change but before the next action
+                _notifyListeners('/meta/connect', message);
+                _notifyListeners('/meta/unsuccessful', message);
+
+                // Connect was not successful.
+                // This may happen when the server crashed, the current clientId
+                // will be invalid, and the server will ask to handshake again
+                switch (action)
+                {
+                    case 'retry':
+                        _increaseBackoff();
+                        _delayedConnect();
+                        break;
+                    case 'handshake':
+                        // End the batch but do not deliver the messages until we connect successfully
+                        _endBatch(false);
+                        _resetBackoff();
+                        _delayedHandshake();
+                        break;
+                    case 'none':
+                        _resetBackoff();
+                        _setStatus('disconnected');
+                        break;
+                }
+            }
+        };
+
+        function _connectFailure(xhr, message)
+        {
+            _debug('Connect failure');
+
+            // Notify listeners
+            var failureMessage = {
+                successful: false,
+                failure: true,
+                channel: '/meta/connect',
+                request: message,
+                xhr: xhr,
+                advice: {
+                    action: 'retry',
+                    interval: _backoff
+                }
+            };
+            _notifyListeners('/meta/connect', failureMessage);
+            _notifyListeners('/meta/unsuccessful', failureMessage);
+
+            if (!_isDisconnected())
+            {
+                var action = _advice.reconnect ? _advice.reconnect : 'retry';
+                switch (action)
+                {
+                    case 'retry':
+                        _increaseBackoff();
+                        _debug('Connect failure, backing off and retrying in {} ms', _backoff);
+                        _delayedConnect();
+                        break;
+                    case 'handshake':
+                        _resetBackoff();
+                        _delayedHandshake();
+                        break;
+                    case 'none':
+                        _resetBackoff();
+                        break;
+                    default:
+                        _debug('Unrecognized reconnect value: {}', action);
+                        break;
+                }
+            }
+        };
+
+        function _disconnectSuccess(message)
+        {
+            if (message.successful)
+            {
+                _debug('Disconnect successful');
+                _disconnect(false);
+                _notifyListeners('/meta/disconnect', message);
+            }
+            else
+            {
+                _debug('Disconnect unsuccessful');
+                _disconnect(true);
+                _notifyListeners('/meta/disconnect', message);
+                _notifyListeners('/meta/usuccessful', message);
+            }
+        };
+
+        function _disconnect(abort)
+        {
+            _cancelDelayedSend();
+            if (abort) _transport.abort();
+            _clientId = null;
+            _setStatus('disconnected');
+            _batch = 0;
+            _messageQueue = [];
+            _resetBackoff();
+        };
+
+        function _disconnectFailure(xhr, message)
+        {
+            _debug('Disconnect failure');
+            _disconnect(true);
+
+            var failureMessage = {
+                successful: false,
+                failure: true,
+                channel: '/meta/disconnect',
+                request: message,
+                xhr: xhr,
+                advice: {
+                    action: 'none',
+                    interval: 0
+                }
+            };
+            _notifyListeners('/meta/disconnect', failureMessage);
+            _notifyListeners('/meta/unsuccessful', failureMessage);
+        };
+
+        function _subscribeSuccess(message)
+        {
+            if (message.successful)
+            {
+                _debug('Subscribe successful');
+                _notifyListeners('/meta/subscribe', message);
+            }
+            else
+            {
+                _debug('Subscribe unsuccessful');
+                _notifyListeners('/meta/subscribe', message);
+                _notifyListeners('/meta/unsuccessful', message);
+            }
+        };
+
+        function _subscribeFailure(xhr, message)
+        {
+            _debug('Subscribe failure');
+
+            var failureMessage = {
+                successful: false,
+                failure: true,
+                channel: '/meta/subscribe',
+                request: message,
+                xhr: xhr,
+                advice: {
+                    action: 'none',
+                    interval: 0
+                }
+            };
+            _notifyListeners('/meta/subscribe', failureMessage);
+            _notifyListeners('/meta/unsuccessful', failureMessage);
+        };
+
+        function _unsubscribeSuccess(message)
+        {
+            if (message.successful)
+            {
+                _debug('Unsubscribe successful');
+                _notifyListeners('/meta/unsubscribe', message);
+            }
+            else
+            {
+                _debug('Unsubscribe unsuccessful');
+                _notifyListeners('/meta/unsubscribe', message);
+                _notifyListeners('/meta/unsuccessful', message);
+            }
+        };
+
+        function _unsubscribeFailure(xhr, message)
+        {
+            _debug('Unsubscribe failure');
+
+            var failureMessage = {
+                successful: false,
+                failure: true,
+                channel: '/meta/unsubscribe',
+                request: message,
+                xhr: xhr,
+                advice: {
+                    action: 'none',
+                    interval: 0
+                }
+            };
+            _notifyListeners('/meta/unsubscribe', failureMessage);
+            _notifyListeners('/meta/unsuccessful', failureMessage);
+        };
+
+        function _messageSuccess(message)
+        {
+            if (message.successful === undefined)
+            {
+                if (message.data)
+                {
+                    // It is a plain message, and not a bayeux meta message
+                    _notifyListeners(message.channel, message);
+                }
+                else
+                {
+                    _debug('Unknown message {}', JSON.stringify(message));
+                }
+            }
+            else
+            {
+                if (message.successful)
+                {
+                    _debug('Publish successful');
+                    _notifyListeners('/meta/publish', message);
+                }
+                else
+                {
+                    _debug('Publish unsuccessful');
+                    _notifyListeners('/meta/publish', message);
+                    _notifyListeners('/meta/unsuccessful', message);
+                }
+            }
+        };
+
+        function _messageFailure(xhr, message)
+        {
+            _debug('Publish failure');
+
+            var failureMessage = {
+                successful: false,
+                failure: true,
+                channel: message.channel,
+                request: message,
+                xhr: xhr,
+                advice: {
+                    action: 'none',
+                    interval: 0
+                }
+            };
+            _notifyListeners('/meta/publish', failureMessage);
+            _notifyListeners('/meta/unsuccessful', failureMessage);
+        };
+
+        function _notifyListeners(channel, message)
+        {
+            // Notify direct listeners
+            _notify(channel, message);
+
+            // Notify the globbing listeners
+            var channelParts = channel.split("/");
+            var last = channelParts.length - 1;
+            for (var i = last; i > 0; --i)
+            {
+                var channelPart = channelParts.slice(0, i).join('/') + '/*';
+                // We don't want to notify /foo/* if the channel is /foo/bar/baz,
+                // so we stop at the first non recursive globbing
+                if (i == last) _notify(channelPart, message);
+                // Add the recursive globber and notify
+                channelPart += '*';
+                _notify(channelPart, message);
+            }
+        };
+
+        function _notify(channel, message)
+        {
+            var subscriptions = _listeners[channel];
+            if (subscriptions && subscriptions.length > 0)
+            {
+                for (var i = 0; i < subscriptions.length; ++i)
+                {
+                    var subscription = subscriptions[i];
+                    // Subscriptions may come and go, so the array may have 'holes'
+                    if (subscription)
+                    {
+                        try
+                        {
+                            _debug('Notifying subscription: channel \'{}\', callback \'{}\'', channel, subscription.callback.name);
+                            subscription.callback.call(subscription.scope, message);
+                        }
+                        catch (x)
+                        {
+                            // Ignore exceptions from callbacks
+                            _warn('Exception during execution of callback \'{}\' on channel \'{}\' for message {}, exception: {}', subscription.callback.name, channel, JSON.stringify(message), x);
+                        }
+                    }
+                }
+            }
+        };
+
+        function _resetBackoff()
+        {
+            _backoff = 0;
+        };
+
+        function _increaseBackoff()
+        {
+            if (_backoff < _maxBackoff) _backoff += _backoffIncrement;
+        };
+
+        var _error = this._error = function(text, args)
+        {
+            _log('error', _format.apply(this, arguments));
+        };
+
+        var _warn = this._warn = function(text, args)
+        {
+            _log('warn', _format.apply(this, arguments));
+        };
+
+        var _info = this._info = function(text, args)
+        {
+            _log('info', _format.apply(this, arguments));
+        };
+
+        var _debug = this._debug = function(text, args)
+        {
+            _log('debug', _format.apply(this, arguments));
+        };
+
+        function _log(level, text)
+        {
+            var priority = _logPriorities[level];
+            var configPriority = _logPriorities[_logLevel];
+            if (!configPriority) configPriority = _logPriorities['info'];
+            if (priority >= configPriority)
+            {
+                if (window.console) window.console.log(text);
+            }
+        };
+
+        function _format(text)
+        {
+            var braces = /\{\}/g;
+            var result = '';
+            var start = 0;
+            var count = 0;
+            while (braces.test(text))
+            {
+                result += text.substr(start, braces.lastIndex - start - 2);
+                var arg = arguments[++count];
+                result += arg !== undefined ? arg : '{}';
+                start = braces.lastIndex;
+            }
+            result += text.substr(start, text.length - start);
+            return result;
+        };
+
+        function newLongPollingTransport()
+        {
+            return $.extend({}, new Transport('long-polling'), new LongPollingTransport());
+        };
+
+        function newCallbackPollingTransport()
+        {
+            return $.extend({}, new Transport('callback-polling'), new CallbackPollingTransport());
+        };
+
+        /**
+         * Base object with the common functionality for transports.
+         * The key responsibility is to allow at most 2 outstanding requests to the server,
+         * to avoid that requests are sent behind a long poll.
+         * To achieve this, we have one reserved request for the long poll, and all other
+         * requests are serialized one after the other.
+         */
+        var Transport = function(type)
+        {
+            var _maxRequests = 2;
+            var _requestIds = 0;
+            var _cometRequest = null;
+            var _requests = [];
+            var _packets = [];
+
+            this.getType = function()
+            {
+                return type;
+            };
+
+            this.send = function(packet, comet)
+            {
+                if (comet)
+                    _cometSend(this, packet);
+                else
+                    _send(this, packet);
+            };
+
+            function _cometSend(self, packet)
+            {
+                if (_cometRequest !== null) throw 'Concurrent comet requests not allowed, request ' + _cometRequest.id + ' not yet completed';
+
+                var requestId = ++_requestIds;
+                _debug('Beginning comet request {}', requestId);
+
+                var request = {id: requestId};
+                _debug('Delivering comet request {}', requestId);
+                self.deliver(packet, request);
+                _cometRequest = request;
+            };
+
+            function _send(self, packet)
+            {
+                var requestId = ++_requestIds;
+                _debug('Beginning request {}, {} other requests, {} queued requests', requestId, _requests.length, _packets.length);
+
+                var request = {id: requestId};
+                // Consider the comet request which should always be present
+                if (_requests.length < _maxRequests - 1)
+                {
+                    _debug('Delivering request {}', requestId);
+                    self.deliver(packet, request);
+                    _requests.push(request);
+                }
+                else
+                {
+                    _packets.push([packet, request]);
+                    _debug('Queued request {}, {} queued requests', requestId, _packets.length);
+                }
+            };
+
+            this.complete = function(request, success, comet)
+            {
+                if (comet)
+                    _cometComplete(request);
+                else
+                    _complete(this, request, success);
+            };
+
+            function _cometComplete(request)
+            {
+                var requestId = request.id;
+                if (_cometRequest !== request) throw 'Comet request mismatch, completing request ' + requestId;
+
+                // Reset comet request
+                _cometRequest = null;
+                _debug('Ended comet request {}', requestId);
+            };
+
+            function _complete(self, request, success)
+            {
+                var requestId = request.id;
+                var index = $.inArray(request, _requests);
+                // The index can be negative the request has been aborted
+                if (index >= 0) _requests.splice(index, 1);
+                _debug('Ended request {}, {} other requests, {} queued requests', requestId, _requests.length, _packets.length);
+
+                if (_packets.length > 0)
+                {
+                    var packet = _packets.shift();
+                    if (success)
+                    {
+                        _debug('Dequeueing and sending request {}, {} queued requests', packet[1].id, _packets.length);
+                        _send(self, packet[0]);
+                    }
+                    else
+                    {
+                        _debug('Dequeueing and failing request {}, {} queued requests', packet[1].id, _packets.length);
+                        // Keep the semantic of calling response callbacks asynchronously after the request
+                        setTimeout(function() { packet[0].onFailure(packet[1], 'error'); }, 0);
+                    }
+                }
+            };
+
+            this.abort = function()
+            {
+                for (var i = 0; i < _requests.length; ++i)
+                {
+                    var request = _requests[i];
+                    _debug('Aborting request {}', request.id);
+                    if (request.xhr) request.xhr.abort();
+                }
+                if (_cometRequest)
+                {
+                    _debug('Aborting comet request {}', _cometRequest.id);
+                    if (_cometRequest.xhr) _cometRequest.xhr.abort();
+                }
+                _cometRequest = null;
+                _requests = [];
+                _packets = [];
+            };
+        };
+
+        var LongPollingTransport = function()
+        {
+            this.deliver = function(packet, request)
+            {
+                request.xhr = $.ajax({
+                    url: packet.url,
+                    type: 'POST',
+                    contentType: 'text/json;charset=UTF-8',
+                    beforeSend: function(xhr)
+                    {
+                        xhr.setRequestHeader('Connection', 'Keep-Alive');
+                        return true;
+                    },
+                    data: JSON.stringify(packet.messages),
+                    success: function(response) { packet.onSuccess(request, response); },
+                    error: function(xhr, reason, exception) { packet.onFailure(request, reason, exception); }
+                });
+            };
+        };
+
+        var CallbackPollingTransport = function()
+        {
+            var _maxLength = 2000;
+            this.deliver = function(packet, request)
+            {
+                // Microsoft Internet Explorer has a 2083 URL max length
+                // We must ensure that we stay within that length
+                var messages = JSON.stringify(packet.messages);
+                // Encode the messages because all brackets, quotes, commas, colons, etc
+                // present in the JSON will be URL encoded, taking many more characters
+                var urlLength = packet.url.length + encodeURI(messages).length;
+                _debug('URL length: {}', urlLength);
+                // Let's stay on the safe side and use 2000 instead of 2083
+                // also because we did not count few characters among which
+                // the parameter name 'message' and the parameter 'jsonp',
+                // which sum up to about 50 chars
+                if (urlLength > _maxLength)
+                {
+                    var x = packet.messages.length > 1 ?
+                            'Too many bayeux messages in the same batch resulting in message too big ' +
+                            '(' + urlLength + ' bytes, max is ' + _maxLength + ') for transport ' + this.getType() :
+                            'Bayeux message too big (' + urlLength + ' bytes, max is ' + _maxLength + ') ' +
+                            'for transport ' + this.getType();
+                    // Keep the semantic of calling response callbacks asynchronously after the request
+                    _setTimeout(function() { packet.onFailure(request, 'error', x); }, 0);
+                }
+                else
+                {
+                    $.ajax({
+                        url: packet.url,
+                        type: 'GET',
+                        dataType: 'jsonp',
+                        jsonp: 'jsonp',
+                        beforeSend: function(xhr)
+                        {
+                            xhr.setRequestHeader('Connection', 'Keep-Alive');
+                            return true;
+                        },
+                        data:
+                        {
+                            // In callback-polling, the content must be sent via the 'message' parameter
+                            message: messages
+                        },
+                        success: function(response) { packet.onSuccess(request, response); },
+                        error: function(xhr, reason, exception) { packet.onFailure(request, reason, exception); }
+                    });
+                }
+            };
+        };
+    };
+
+    /**
+     * The JS object that exposes the comet API to applications
+     */
+    $.cometd = new $.Cometd(); // The default instance
+
+})(jQuery);
index 301076ec94e7cb9658df0a86f2f4bac87be64e95..0a1d6d0da8b0986f4d6702be650e4f5f69727368 100644 (file)
@@ -52,12 +52,7 @@ class LinkPreviewPlugin extends Plugin
     {
         $user = common_current_user();
         if ($user && common_config('attachments', 'process_links')) {
-            if (common_config('site', 'minify')) {
-                $js = 'linkpreview.min.js';
-            } else {
-                $js = 'linkpreview.js';
-            }
-            $action->script($this->path($js));
+            $action->script($this->path('js/linkpreview.js'));
             $data = json_encode(array(
                 'api' => common_local_url('oembedproxy'),
                 'width' => common_config('attachments', 'thumbwidth'),
diff --git a/plugins/LinkPreview/js/linkpreview.js b/plugins/LinkPreview/js/linkpreview.js
new file mode 100644 (file)
index 0000000..e6e98bd
--- /dev/null
@@ -0,0 +1,270 @@
+/**
+ * (c) 2010 StatusNet, Inc.
+ */
+
+(function() {
+    /**
+     * Quickie wrapper around ooembed JSON lookup
+     */
+    var oEmbed = {
+        api: 'https://noembed.com/embed',
+        width: 100,
+        height: 75,
+        cache: {},
+        callbacks: {},
+
+        /**
+         * Do a cached oEmbed lookup for the given URL.
+         *
+         * @param {String} url
+         * @param {function} callback
+         */
+        lookup: function(url, callback)
+        {
+            if (typeof oEmbed.cache[url] == "object") {
+                // We already have a successful lookup.
+                callback(oEmbed.cache[url]);
+            } else if (typeof oEmbed.callbacks[url] == "undefined") {
+                // No lookup yet... Start it!
+                oEmbed.callbacks[url] = [callback];
+
+                oEmbed.rawLookup(url, function(data) {
+                    oEmbed.cache[url] = data;
+                    var callbacks = oEmbed.callbacks[url];
+                    oEmbed.callbacks[url] = undefined;
+                    for (var i = 0; i < callbacks.length; i++) {
+                        callbacks[i](data);
+                    }
+                });
+            } else {
+                // A lookup is in progress.
+                oEmbed.callbacks[url].push(callback);
+            }
+        },
+
+        /**
+         * Do an oEmbed lookup for the given URL.
+         *
+         * @fixme proxy through ourselves if possible?
+         * @fixme use the global thumbnail size settings
+         *
+         * @param {String} url
+         * @param {function} callback
+         */
+        rawLookup: function(url, callback)
+        {
+            var params = {
+                url: url,
+                format: 'json',
+                maxwidth: oEmbed.width,
+                maxheight: oEmbed.height,
+                token: $('#token').val()
+            };
+            $.ajax({
+                url: oEmbed.api,
+                data: params,
+                dataType: 'json',
+                success: function(data, xhr) {
+                    callback(data);
+                },
+                error: function(xhr, textStatus, errorThrown) {
+                    callback(null);
+                }
+            });
+        }
+    };
+
+    SN.Init.LinkPreview = function(params) {
+        if (params.api) oEmbed.api = params.api;
+        if (params.width) oEmbed.width = params.width;
+        if (params.height) oEmbed.height = params.height;
+    }
+
+    // Piggyback on the counter update...
+    var origCounter = SN.U.Counter;
+    SN.U.Counter = function(form) {
+        var preview = form.data('LinkPreview');
+        if (preview) {
+            preview.previewLinks(form.find('.notice_data-text:first').val());
+        }
+        return origCounter(form);
+    }
+
+    // Customize notice form init...
+    var origSetup = SN.Init.NoticeFormSetup;
+    SN.Init.NoticeFormSetup = function(form) {
+        origSetup(form);
+
+        form
+            .bind('reset', function() {
+                LinkPreview.clear();
+            });
+
+        var LinkPreview = {
+            links: [],
+            state: [],
+            refresh: [],
+
+            /**
+             * Find URL links from the source text that may be interesting.
+             *
+             * @param {String} text
+             * @return {Array} list of URLs
+             */
+            findLinks: function (text)
+            {
+                // @fixme match this to core code
+                var re = /(?:^| )(https?:\/\/.+?\/.+?)(?= |$)/mg;
+                var links = [];
+                var matches;
+                while ((matches = re.exec(text)) !== null) {
+                    links.push(matches[1]);
+                }
+                return links;
+            },
+
+            ensureArea: function() {
+                if (form.find('.link-preview').length < 1) {
+                    form.append('<div class="notice-status link-preview thumbnails"></div>');
+                }
+            },
+
+            /**
+             * Start looking up info for a link preview...
+             * May start async data loads.
+             *
+             * @param {number} col: column number to insert preview into
+             */
+            prepLinkPreview: function(col)
+            {
+                var id = 'link-preview-' + col;
+                var url = LinkPreview.links[col];
+                LinkPreview.refresh[col] = false;
+                LinkPreview.markLoading(col);
+
+                oEmbed.lookup(url, function(data) {
+                    var thumb = null;
+                    var width = 100;
+                    if (data && typeof data.thumbnail_url == "string") {
+                        thumb = data.thumbnail_url;
+                        if (typeof data.thumbnail_width !== "undefined") {
+                            if (data.thumbnail_width < width) {
+                                width = data.thumbnail_width;
+                            }
+                        }
+                    } else if (data && data.type == 'photo' && typeof data.url == "string") {
+                        thumb = data.url;
+                        if (typeof data.width !== "undefined") {
+                            if (data.width < width) {
+                                width = data.width;
+                            }
+                        }
+                    }
+
+                    if (thumb) {
+                        LinkPreview.ensureArea();
+                        var link = $('<span class="inline-attachment"><a><img/></a></span>');
+                        link.find('a')
+                                .attr('href', url)
+                                .attr('target', '_blank')
+                                .last()
+                            .find('img')
+                                .attr('src', thumb)
+                                .attr('width', width)
+                                .attr('title', data.title || data.url || url);
+                        form.find('.' + id)
+                            .empty()
+                            .append(link);
+                    } else {
+                        // No thumbnail available or error retriving it.
+                        LinkPreview.clearLink(col);
+                    }
+
+                    if (LinkPreview.refresh[col]) {
+                        // Darn user has typed more characters.
+                        // Go fetch another link!
+                        LinkPreview.prepLinkPreview(col);
+                    } else {
+                        LinkPreview.markDone(col);
+                    }
+                });
+            },
+
+            /**
+             * Update the live preview section with links found in the given text.
+             * May start async data loads.
+             *
+             * @param {String} text: free-form input text
+             */
+            previewLinks: function(text)
+            {
+                var i;
+                var old = LinkPreview.links;
+                var links = LinkPreview.findLinks(text);
+                LinkPreview.links = links;
+
+                // Check for existing common elements...
+                for (i = 0; i < old.length && i < links.length; i++) {
+                    if (links[i] != old[i]) {
+                        if (LinkPreview.state[i] == "loading") {
+                            // Slate this column for a refresh when this one's done.
+                            LinkPreview.refresh[i] = true;
+                        } else {
+                            // Change an existing entry!
+                            LinkPreview.prepLinkPreview(i);
+                        }
+                    }
+                }
+                if (links.length > old.length) {
+                    // Adding new entries, whee!
+                    for (i = old.length; i < links.length; i++) {
+                        LinkPreview.addPreviewArea(i);
+                        LinkPreview.prepLinkPreview(i);
+                    }
+                } else if (old.length > links.length) {
+                    // Remove preview entries for links that have been removed.
+                    for (i = links.length; i < old.length; i++) {
+                        LinkPreview.clearLink(i);
+                    }
+                }
+                if (links.length == 0) {
+                    LinkPreview.clear();
+                }
+            },
+
+            addPreviewArea: function(col) {
+                LinkPreview.ensureArea();
+                var id = 'link-preview-' + col;
+                if (form.find('.' + id).length < 1) {
+                    form.find('.link-preview').append('<span class="' + id + '"></span>');
+                }
+            },
+
+            clearLink: function(col) {
+                var id = 'link-preview-' + col;
+                form.find('.' + id).html('');
+            },
+
+            markLoading: function(col) {
+                LinkPreview.state[col] = "loading";
+                var id = 'link-preview-' + col;
+                form.find('.' + id).attr('style', 'opacity: 0.5');
+            },
+
+            markDone: function(col) {
+                LinkPreview.state[col] = "done";
+                var id = 'link-preview-' + col;
+                form.find('.' + id).removeAttr('style');
+            },
+
+            /**
+             * Clear out any link preview data.
+             */
+            clear: function() {
+                LinkPreview.links = [];
+                form.find('.link-preview').remove();
+            }
+        };
+        form.data('LinkPreview', LinkPreview);
+    }
+})();
diff --git a/plugins/LinkPreview/linkpreview.js b/plugins/LinkPreview/linkpreview.js
deleted file mode 100644 (file)
index e6e98bd..0000000
+++ /dev/null
@@ -1,270 +0,0 @@
-/**
- * (c) 2010 StatusNet, Inc.
- */
-
-(function() {
-    /**
-     * Quickie wrapper around ooembed JSON lookup
-     */
-    var oEmbed = {
-        api: 'https://noembed.com/embed',
-        width: 100,
-        height: 75,
-        cache: {},
-        callbacks: {},
-
-        /**
-         * Do a cached oEmbed lookup for the given URL.
-         *
-         * @param {String} url
-         * @param {function} callback
-         */
-        lookup: function(url, callback)
-        {
-            if (typeof oEmbed.cache[url] == "object") {
-                // We already have a successful lookup.
-                callback(oEmbed.cache[url]);
-            } else if (typeof oEmbed.callbacks[url] == "undefined") {
-                // No lookup yet... Start it!
-                oEmbed.callbacks[url] = [callback];
-
-                oEmbed.rawLookup(url, function(data) {
-                    oEmbed.cache[url] = data;
-                    var callbacks = oEmbed.callbacks[url];
-                    oEmbed.callbacks[url] = undefined;
-                    for (var i = 0; i < callbacks.length; i++) {
-                        callbacks[i](data);
-                    }
-                });
-            } else {
-                // A lookup is in progress.
-                oEmbed.callbacks[url].push(callback);
-            }
-        },
-
-        /**
-         * Do an oEmbed lookup for the given URL.
-         *
-         * @fixme proxy through ourselves if possible?
-         * @fixme use the global thumbnail size settings
-         *
-         * @param {String} url
-         * @param {function} callback
-         */
-        rawLookup: function(url, callback)
-        {
-            var params = {
-                url: url,
-                format: 'json',
-                maxwidth: oEmbed.width,
-                maxheight: oEmbed.height,
-                token: $('#token').val()
-            };
-            $.ajax({
-                url: oEmbed.api,
-                data: params,
-                dataType: 'json',
-                success: function(data, xhr) {
-                    callback(data);
-                },
-                error: function(xhr, textStatus, errorThrown) {
-                    callback(null);
-                }
-            });
-        }
-    };
-
-    SN.Init.LinkPreview = function(params) {
-        if (params.api) oEmbed.api = params.api;
-        if (params.width) oEmbed.width = params.width;
-        if (params.height) oEmbed.height = params.height;
-    }
-
-    // Piggyback on the counter update...
-    var origCounter = SN.U.Counter;
-    SN.U.Counter = function(form) {
-        var preview = form.data('LinkPreview');
-        if (preview) {
-            preview.previewLinks(form.find('.notice_data-text:first').val());
-        }
-        return origCounter(form);
-    }
-
-    // Customize notice form init...
-    var origSetup = SN.Init.NoticeFormSetup;
-    SN.Init.NoticeFormSetup = function(form) {
-        origSetup(form);
-
-        form
-            .bind('reset', function() {
-                LinkPreview.clear();
-            });
-
-        var LinkPreview = {
-            links: [],
-            state: [],
-            refresh: [],
-
-            /**
-             * Find URL links from the source text that may be interesting.
-             *
-             * @param {String} text
-             * @return {Array} list of URLs
-             */
-            findLinks: function (text)
-            {
-                // @fixme match this to core code
-                var re = /(?:^| )(https?:\/\/.+?\/.+?)(?= |$)/mg;
-                var links = [];
-                var matches;
-                while ((matches = re.exec(text)) !== null) {
-                    links.push(matches[1]);
-                }
-                return links;
-            },
-
-            ensureArea: function() {
-                if (form.find('.link-preview').length < 1) {
-                    form.append('<div class="notice-status link-preview thumbnails"></div>');
-                }
-            },
-
-            /**
-             * Start looking up info for a link preview...
-             * May start async data loads.
-             *
-             * @param {number} col: column number to insert preview into
-             */
-            prepLinkPreview: function(col)
-            {
-                var id = 'link-preview-' + col;
-                var url = LinkPreview.links[col];
-                LinkPreview.refresh[col] = false;
-                LinkPreview.markLoading(col);
-
-                oEmbed.lookup(url, function(data) {
-                    var thumb = null;
-                    var width = 100;
-                    if (data && typeof data.thumbnail_url == "string") {
-                        thumb = data.thumbnail_url;
-                        if (typeof data.thumbnail_width !== "undefined") {
-                            if (data.thumbnail_width < width) {
-                                width = data.thumbnail_width;
-                            }
-                        }
-                    } else if (data && data.type == 'photo' && typeof data.url == "string") {
-                        thumb = data.url;
-                        if (typeof data.width !== "undefined") {
-                            if (data.width < width) {
-                                width = data.width;
-                            }
-                        }
-                    }
-
-                    if (thumb) {
-                        LinkPreview.ensureArea();
-                        var link = $('<span class="inline-attachment"><a><img/></a></span>');
-                        link.find('a')
-                                .attr('href', url)
-                                .attr('target', '_blank')
-                                .last()
-                            .find('img')
-                                .attr('src', thumb)
-                                .attr('width', width)
-                                .attr('title', data.title || data.url || url);
-                        form.find('.' + id)
-                            .empty()
-                            .append(link);
-                    } else {
-                        // No thumbnail available or error retriving it.
-                        LinkPreview.clearLink(col);
-                    }
-
-                    if (LinkPreview.refresh[col]) {
-                        // Darn user has typed more characters.
-                        // Go fetch another link!
-                        LinkPreview.prepLinkPreview(col);
-                    } else {
-                        LinkPreview.markDone(col);
-                    }
-                });
-            },
-
-            /**
-             * Update the live preview section with links found in the given text.
-             * May start async data loads.
-             *
-             * @param {String} text: free-form input text
-             */
-            previewLinks: function(text)
-            {
-                var i;
-                var old = LinkPreview.links;
-                var links = LinkPreview.findLinks(text);
-                LinkPreview.links = links;
-
-                // Check for existing common elements...
-                for (i = 0; i < old.length && i < links.length; i++) {
-                    if (links[i] != old[i]) {
-                        if (LinkPreview.state[i] == "loading") {
-                            // Slate this column for a refresh when this one's done.
-                            LinkPreview.refresh[i] = true;
-                        } else {
-                            // Change an existing entry!
-                            LinkPreview.prepLinkPreview(i);
-                        }
-                    }
-                }
-                if (links.length > old.length) {
-                    // Adding new entries, whee!
-                    for (i = old.length; i < links.length; i++) {
-                        LinkPreview.addPreviewArea(i);
-                        LinkPreview.prepLinkPreview(i);
-                    }
-                } else if (old.length > links.length) {
-                    // Remove preview entries for links that have been removed.
-                    for (i = links.length; i < old.length; i++) {
-                        LinkPreview.clearLink(i);
-                    }
-                }
-                if (links.length == 0) {
-                    LinkPreview.clear();
-                }
-            },
-
-            addPreviewArea: function(col) {
-                LinkPreview.ensureArea();
-                var id = 'link-preview-' + col;
-                if (form.find('.' + id).length < 1) {
-                    form.find('.link-preview').append('<span class="' + id + '"></span>');
-                }
-            },
-
-            clearLink: function(col) {
-                var id = 'link-preview-' + col;
-                form.find('.' + id).html('');
-            },
-
-            markLoading: function(col) {
-                LinkPreview.state[col] = "loading";
-                var id = 'link-preview-' + col;
-                form.find('.' + id).attr('style', 'opacity: 0.5');
-            },
-
-            markDone: function(col) {
-                LinkPreview.state[col] = "done";
-                var id = 'link-preview-' + col;
-                form.find('.' + id).removeAttr('style');
-            },
-
-            /**
-             * Clear out any link preview data.
-             */
-            clear: function() {
-                LinkPreview.links = [];
-                form.find('.link-preview').remove();
-            }
-        };
-        form.data('LinkPreview', LinkPreview);
-    }
-})();
diff --git a/plugins/LinkPreview/linkpreview.min.js b/plugins/LinkPreview/linkpreview.min.js
deleted file mode 100644 (file)
index 99af839..0000000
+++ /dev/null
@@ -1 +0,0 @@
-(function(){var b={api:"https://noembed.com/embed",width:100,height:75,cache:{},callbacks:{},lookup:function(d,e){if(typeof b.cache[d]=="object"){e(b.cache[d])}else{if(typeof b.callbacks[d]=="undefined"){b.callbacks[d]=[e];b.rawLookup(d,function(h){b.cache[d]=h;var g=b.callbacks[d];b.callbacks[d]=undefined;for(var f=0;f<g.length;f++){g[f](h)}})}else{b.callbacks[d].push(e)}}},rawLookup:function(d,f){var e={url:d,format:"json",maxwidth:b.width,maxheight:b.height,token:$("#token").val()};$.ajax({url:b.api,data:e,dataType:"json",success:function(g,h){f(g)},error:function(h,i,g){f(null)}})}};SN.Init.LinkPreview=function(d){if(d.api){b.api=d.api}if(d.width){b.width=d.width}if(d.height){b.height=d.height}};var c=SN.U.Counter;SN.U.Counter=function(d){var e=d.data("LinkPreview");if(e){e.previewLinks(d.find(".notice_data-text:first").val())}return c(d)};var a=SN.Init.NoticeFormSetup;SN.Init.NoticeFormSetup=function(d){a(d);d.bind("reset",function(){e.clear()});var e={links:[],state:[],refresh:[],findLinks:function(i){var g=/(?:^| )(https?:\/\/.+?\/.+?)(?= |$)/mg;var f=[];var h;while((h=g.exec(i))!==null){f.push(h[1])}return f},ensureArea:function(){if(d.find(".link-preview").length<1){d.append('<div class="notice-status link-preview thumbnails"></div>')}},prepLinkPreview:function(g){var h="link-preview-"+g;var f=e.links[g];e.refresh[g]=false;e.markLoading(g);b.lookup(f,function(l){var i=null;var j=100;if(l&&typeof l.thumbnail_url=="string"){i=l.thumbnail_url;if(typeof l.thumbnail_width!=="undefined"){if(l.thumbnail_width<j){j=l.thumbnail_width}}}else{if(l&&l.type=="photo"&&typeof l.url=="string"){i=l.url;if(typeof l.width!=="undefined"){if(l.width<j){j=l.width}}}}if(i){e.ensureArea();var k=$('<span class="inline-attachment"><a><img/></a></span>');k.find("a").attr("href",f).attr("target","_blank").last().find("img").attr("src",i).attr("width",j).attr("title",l.title||l.url||f);d.find("."+h).empty().append(k)}else{e.clearLink(g)}if(e.refresh[g]){e.prepLinkPreview(g)}else{e.markDone(g)}})},previewLinks:function(j){var h;var f=e.links;var g=e.findLinks(j);e.links=g;for(h=0;h<f.length&&h<g.length;h++){if(g[h]!=f[h]){if(e.state[h]=="loading"){e.refresh[h]=true}else{e.prepLinkPreview(h)}}}if(g.length>f.length){for(h=f.length;h<g.length;h++){e.addPreviewArea(h);e.prepLinkPreview(h)}}else{if(f.length>g.length){for(h=g.length;h<f.length;h++){e.clearLink(h)}}}if(g.length==0){e.clear()}},addPreviewArea:function(f){e.ensureArea();var g="link-preview-"+f;if(d.find("."+g).length<1){d.find(".link-preview").append('<span class="'+g+'"></span>')}},clearLink:function(f){var g="link-preview-"+f;d.find("."+g).html("")},markLoading:function(f){e.state[f]="loading";var g="link-preview-"+f;d.find("."+g).attr("style","opacity: 0.5")},markDone:function(f){e.state[f]="done";var g="link-preview-"+f;d.find("."+g).removeAttr("style")},clear:function(){e.links=[];d.find(".link-preview").remove()}};d.data("LinkPreview",e)}})();
\ No newline at end of file
index d65fe3f0e51cd45a637d4c5ba6cc8806efde8341..881dfdc1b3daadb627cc71b60bdb2bc001d8d625 100644 (file)
@@ -27,7 +27,7 @@
  * @link      http://status.net/
  */
 
-if (!defined('STATUSNET') && !defined('LACONICA')) {
+if (!defined('GNUSOCIAL') && !defined('STATUSNET')) {
     exit(1);
 }
 
@@ -96,7 +96,7 @@ class MeteorPlugin extends RealtimePlugin
         } else {
                $scripts[] = 'http://'.$this->webserver.(($this->webport == 80) ? '':':'.$this->webport).'/meteor.js';
         }
-        $scripts[] = $this->path('meteorupdater.min.js');
+        $scripts[] = $this->path('js/meteorupdater.js');
         return $scripts;
     }
 
diff --git a/plugins/Meteor/js/meteorupdater.js b/plugins/Meteor/js/meteorupdater.js
new file mode 100644 (file)
index 0000000..cdd1d63
--- /dev/null
@@ -0,0 +1,20 @@
+// Update the local timeline from a Meteor server
+
+var MeteorUpdater = function()
+{
+     return {
+
+          init: function(server, port, timeline)
+          {
+               Meteor.callbacks["process"] = function(data) {
+                    RealtimeUpdate.receive(JSON.parse(data));
+               };
+
+               Meteor.host = server;
+               Meteor.port = port;
+               Meteor.joinChannel(timeline, 0);
+               Meteor.connect();
+          }
+     }
+}();
+
diff --git a/plugins/Meteor/meteorupdater.js b/plugins/Meteor/meteorupdater.js
deleted file mode 100644 (file)
index cdd1d63..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-// Update the local timeline from a Meteor server
-
-var MeteorUpdater = function()
-{
-     return {
-
-          init: function(server, port, timeline)
-          {
-               Meteor.callbacks["process"] = function(data) {
-                    RealtimeUpdate.receive(JSON.parse(data));
-               };
-
-               Meteor.host = server;
-               Meteor.port = port;
-               Meteor.joinChannel(timeline, 0);
-               Meteor.connect();
-          }
-     }
-}();
-
diff --git a/plugins/Meteor/meteorupdater.min.js b/plugins/Meteor/meteorupdater.min.js
deleted file mode 100644 (file)
index 61928ab..0000000
+++ /dev/null
@@ -1 +0,0 @@
-var MeteorUpdater=function(){return{init:function(c,a,b){Meteor.callbacks.process=function(d){RealtimeUpdate.receive(JSON.parse(d))};Meteor.host=c;Meteor.port=a;Meteor.joinChannel(b,0);Meteor.connect()}}}();
\ No newline at end of file
index c6c413873e8d198405b499c703df3e300ac7142f..75d4fb74bc0f191aee973f5d643326ea8802482f 100644 (file)
@@ -332,7 +332,7 @@ class OStatusPlugin extends Plugin
      * Find any explicit remote mentions. Accepted forms:
      *   Webfinger: @user@example.com
      *   Profile link: @example.com/mublog/user
-     * @param Profile $sender (os user?)
+     * @param Profile $sender
      * @param string $text input markup text
      * @param array &$mention in/out param: set of found mentions
      * @return boolean hook return value
@@ -354,6 +354,7 @@ class OStatusPlugin extends Plugin
                     if ($oprofile && !$oprofile->isGroup()) {
                         $profile = $oprofile->localProfile();
                         $matches[$pos] = array('mentioned' => array($profile),
+                                               'type' => 'mention',
                                                'text' => $target,
                                                'position' => $pos,
                                                'url' => $profile->profileurl);
@@ -380,6 +381,7 @@ class OStatusPlugin extends Plugin
                         if ($oprofile && !$oprofile->isGroup()) {
                             $profile = $oprofile->localProfile();
                             $matches[$pos] = array('mentioned' => array($profile),
+                                                   'type' => 'mention',
                                                    'text' => $target,
                                                    'position' => $pos,
                                                    'url' => $profile->profileurl);
index 4edaafaa4eb97f3003d25febd17746fa0fb074a3..5666c898af4e91938e91c2c412174579089865f0 100644 (file)
@@ -218,7 +218,7 @@ class OStatusInitAction extends Action
             }
         } else if ($this->group) {
             $group = Local_group::getKV('nickname', $this->group);
-            if ($group) {
+            if ($group instanceof Local_group) {
                 return common_local_url('groupbyid', array('id' => $group->group_id));
             } else {
                 // TRANS: Client error.
index 61ac6e263fb8d8362c753799e12ddc247f0dc984..8a8cfb9880eaf0cb7138840b4288d2100dfb7bbc 100644 (file)
@@ -22,9 +22,7 @@
  * @maintainer Brion Vibber <brion@status.net>
  */
 
-if (!defined('STATUSNET')) {
-    exit(1);
-}
+if (!defined('GNUSOCIAL') && !defined('STATUSNET')) { exit(1); }
 
 /**
  * Key UI methods:
@@ -42,16 +40,44 @@ class OStatusSubAction extends Action
     protected $profile_uri; // provided acct: or URI of remote entity
     protected $oprofile; // Ostatus_profile of remote entity, if valid
 
+    protected function prepare(array $args=array())
+    {
+        parent::prepare($args);
+
+        if (!common_logged_in()) {
+            // XXX: selfURL() didn't work. :<
+            common_set_returnto($_SERVER['REQUEST_URI']);
+            if (Event::handle('RedirectToLogin', array($this, null))) {
+                common_redirect(common_local_url('login'), 303);
+            }
+            return false;
+        }
+
+        if ($this->pullRemoteProfile()) {
+            $this->validateRemoteProfile();
+        }
+        return true;
+    }
+
+    /**
+     * Handle the submission.
+     */
+    protected function handle()
+    {
+        parent::handle();
+        if ($_SERVER['REQUEST_METHOD'] == 'POST') {
+            $this->handlePost();
+        } else {
+            $this->showForm();
+        }
+    }
+
     /**
      * Show the initial form, when we haven't yet been given a valid
      * remote profile.
      */
     function showInputForm()
     {
-        $user = common_current_user();
-
-        $profile = $user->getProfile();
-
         $this->elementStart('form', array('method' => 'post',
                                           'id' => 'form_ostatus_sub',
                                           'class' => 'form_settings',
@@ -132,8 +158,7 @@ class OStatusSubAction extends Action
         $oprofile = $this->oprofile;
         $profile = $oprofile->localProfile();
 
-        $cur = common_current_user();
-        if ($cur->isSubscribed($profile)) {
+        if ($this->scoped->isSubscribed($profile)) {
             $this->element('div', array('class' => 'error'),
                            // TRANS: Extra paragraph in remote profile view when already subscribed.
                            _m('You are already subscribed to this user.'));
@@ -203,8 +228,7 @@ class OStatusSubAction extends Action
      */
     function success()
     {
-        $cur = common_current_user();
-        $url = common_local_url('subscriptions', array('nickname' => $cur->nickname));
+        $url = common_local_url('subscriptions', array('nickname' => $this->scoped->nickname));
         common_redirect($url, 303);
     }
 
@@ -288,12 +312,11 @@ class OStatusSubAction extends Action
     function saveFeed()
     {
         // And subscribe the current user to the local profile
-        $user = common_current_user();
         $local = $this->oprofile->localProfile();
-        if ($user->isSubscribed($local)) {
+        if ($this->scoped->isSubscribed($local)) {
             // TRANS: OStatus remote subscription dialog error.
             $this->showForm(_m('Already subscribed!'));
-        } elseif (Subscription::start($user->getProfile(), $local)) {
+        } elseif (Subscription::start($this->scoped, $local)) {
             $this->success();
         } else {
             // TRANS: OStatus remote subscription dialog error.
@@ -301,38 +324,6 @@ class OStatusSubAction extends Action
         }
     }
 
-    function prepare($args)
-    {
-        parent::prepare($args);
-
-        if (!common_logged_in()) {
-            // XXX: selfURL() didn't work. :<
-            common_set_returnto($_SERVER['REQUEST_URI']);
-            if (Event::handle('RedirectToLogin', array($this, null))) {
-                common_redirect(common_local_url('login'), 303);
-            }
-            return false;
-        }
-
-        if ($this->pullRemoteProfile()) {
-            $this->validateRemoteProfile();
-        }
-        return true;
-    }
-
-    /**
-     * Handle the submission.
-     */
-    function handle($args)
-    {
-        parent::handle($args);
-        if ($_SERVER['REQUEST_METHOD'] == 'POST') {
-            $this->handlePost();
-        } else {
-            $this->showForm();
-        }
-    }
-
     /**
      * Handle posts to this form
      *
index f68ef7693ed4c7b5513ad8e3293b2eaf31f9166e..1dab72b2e0fc95d941dc6c3f8bdcaf38094911dd 100644 (file)
@@ -52,7 +52,7 @@ class PushCallbackAction extends Action
         }
 
         $feedsub = FeedSub::getKV('id', $feedid);
-        if (!$feedsub) {
+        if (!$feedsub instanceof FeedSub) {
             // TRANS: Server exception. %s is a feed ID.
             throw new ServerException(sprintf(_m('Unknown PuSH feed id %s'),$feedid), 400);
         }
index 2e62c512d13996d32ed5915d3f433138c3349b86..dc0f4ea1e2d617faeb7b06d48867c8f5311d00b0 100644 (file)
@@ -261,11 +261,16 @@ class FeedSub extends Managed_DataObject
     }
 
     /**
+     * Setting to subscribe means it is _waiting_ to become active. This
+     * cannot be done in a transaction because there is a chance that the
+     * remote script we're calling (as in the case of PuSHpress) performs
+     * the lookup _while_ we're POSTing data, which means the transaction
+     * never completes (PushcallbackAction gets an 'inactive' state).
+     *
      * @return boolean  true on successful sub/unsub, false on failure
      */
     protected function doSubscribe($mode)
     {
-        $this->query('BEGIN');
         $orig = clone($this);
         if ($mode == 'subscribe') {
             $this->secret = common_random_hexstr(32);
@@ -302,7 +307,6 @@ class FeedSub extends Managed_DataObject
             $response = $client->post($hub, $headers, $post);
             $status = $response->getStatus();
             if ($status == 202) {
-                $this->query('COMMIT');
                 common_log(LOG_INFO, __METHOD__ . ': sub req ok, awaiting verification callback');
                 return true;
             } else if ($status >= 200 && $status < 300) {
@@ -310,9 +314,7 @@ class FeedSub extends Managed_DataObject
             } else {
                 common_log(LOG_ERR, __METHOD__ . ": sub req failed with HTTP $status: " . $response->getBody());
             }
-            $this->query('ROLLBACK');
         } catch (Exception $e) {
-            $this->query('ROLLBACK');
             // wtf!
             common_log(LOG_ERR, __METHOD__ . ": error \"{$e->getMessage()}\" hitting hub $this->huburi subscribing to $this->uri");
 
index 1ef913792bd983bcf9ad6bae8845904a5432f889..c07a082495578790eea86f080323a3d5fbfffa5b 100644 (file)
@@ -91,13 +91,15 @@ class Magicsig extends Managed_DataObject
     static function getKV($k, $v=null)
     {
         $obj =  parent::getKV($k, $v);
-        if (!empty($obj)) {
+        if ($obj instanceof Magicsig) {
+            // Please note we're replacing the $obj
+            // FIXME: There should be an import-key that modifies the fetched $obj
             $obj = Magicsig::fromString($obj->keypair);
 
-            // Double check keys: Crypt_RSA did not
-            // consistently generate good keypairs.
-            // We've also moved to 1024 bit keys.
-            if (strlen($obj->publicKey->modulus->toBits()) != 1024) {
+            // Never allow less than 1024 bit keys.
+            // The only case these show up in would be imported or
+            // legacy very-old-StatusNet generated keypairs.
+            if (strlen($obj->publicKey->modulus->toBits()) < 1024) {
                 $obj->delete();
                 return false;
             }
@@ -144,11 +146,11 @@ class Magicsig extends Managed_DataObject
      *
      * @param int $user_id id of local user we're creating a key for
      */
-    public function generate($user_id)
+    public function generate($user_id, $bits=1024)
     {
         $rsa = new Crypt_RSA();
 
-        $keypair = $rsa->createKey();
+        $keypair = $rsa->createKey($bits);
 
         $rsa->loadKey($keypair['privatekey']);
 
index 6ae394b61d49470df6cc808bbfbc088fc422c325..e788c464e605f42b36d90f3fa9578ad774d13f97 100644 (file)
@@ -27,7 +27,7 @@
  * @link      http://laconi.ca/
  */
 
-if (!defined('LACONICA')) {
+if (!defined('GNUSOCIAL') && !defined('STATUSNET')) {
     exit(1);
 }
 
@@ -76,9 +76,9 @@ class OrbitedPlugin extends RealtimePlugin
         $root = 'http://'.$server.(($port == 80) ? '':':'.$port);
 
         $scripts[] = $root.'/static/Orbited.js';
-        $scripts[] = 'plugins/Orbited/orbitedextra.js';
+        $scripts[] = $this->path('js/orbitedextra.js');
         $scripts[] = $root.'/static/protocols/stomp/stomp.js';
-        $scripts[] = 'plugins/Orbited/orbitedupdater.js';
+        $scripts[] = $this->path('js/orbitedupdater.js');
 
         return $scripts;
     }
diff --git a/plugins/Orbited/js/orbitedextra.js b/plugins/Orbited/js/orbitedextra.js
new file mode 100644 (file)
index 0000000..47e5c0c
--- /dev/null
@@ -0,0 +1,2 @@
+TCPSocket = Orbited.TCPSocket;
+
diff --git a/plugins/Orbited/js/orbitedupdater.js b/plugins/Orbited/js/orbitedupdater.js
new file mode 100644 (file)
index 0000000..8c5ab3b
--- /dev/null
@@ -0,0 +1,24 @@
+// Update the local timeline from a Orbited server
+
+var OrbitedUpdater = function()
+{
+     return {
+
+          init: function(server, port, timeline, username, password)
+          {
+               // set up stomp client.
+               stomp = new STOMPClient();
+
+               stomp.onmessageframe = function(frame) {
+                    RealtimeUpdate.receive(JSON.parse(frame.body));
+               };
+
+               stomp.onconnectedframe = function() {
+                    stomp.subscribe(timeline);
+               }
+
+               stomp.connect(server, port, username, password);
+          }
+     }
+}();
+
diff --git a/plugins/Orbited/orbitedextra.js b/plugins/Orbited/orbitedextra.js
deleted file mode 100644 (file)
index 47e5c0c..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-TCPSocket = Orbited.TCPSocket;
-
diff --git a/plugins/Orbited/orbitedupdater.js b/plugins/Orbited/orbitedupdater.js
deleted file mode 100644 (file)
index 8c5ab3b..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-// Update the local timeline from a Orbited server
-
-var OrbitedUpdater = function()
-{
-     return {
-
-          init: function(server, port, timeline, username, password)
-          {
-               // set up stomp client.
-               stomp = new STOMPClient();
-
-               stomp.onmessageframe = function(frame) {
-                    RealtimeUpdate.receive(JSON.parse(frame.body));
-               };
-
-               stomp.onconnectedframe = function() {
-                    stomp.subscribe(timeline);
-               }
-
-               stomp.connect(server, port, username, password);
-          }
-     }
-}();
-
index a4709df462e6f97ce92e4e37f863c1fab320b991..6e2560be35a29a48a9d747dd8c5a1bdc09afa076 100644 (file)
@@ -65,6 +65,10 @@ class QnAPlugin extends MicroAppPlugin
         return true;
     }
 
+    public function newFormAction() {
+        return 'qnanewquestion';
+    }
+
     /**
      * Map URLs to actions
      *
index 958716fa7621af0cf398e9f16f1263291da55b57..05bb7714edce4272f3ba4bf32beeeb6e6005f689 100644 (file)
@@ -142,9 +142,9 @@ class RealtimePlugin extends Plugin
 
     public function onEndShowStylesheets(Action $action)
     {
-        $action->cssLink(Plugin::staticPath('Realtime', 'realtimeupdate.css'),
-                         null,
-                         'screen, projection, tv');
+        $urlpath = self::staticPath(str_replace('Plugin','',__CLASS__),
+                                    'css/realtimeupdate.css');
+        $action->cssLink($urlpath, null, 'screen, projection, tv');
         return true;
     }
 
@@ -391,12 +391,9 @@ class RealtimePlugin extends Plugin
 
     function _getScripts()
     {
-        if (common_config('site', 'minify')) {
-            $js = 'realtimeupdate.min.js';
-        } else {
-            $js = 'realtimeupdate.js';
-        }
-        return array(Plugin::staticPath('Realtime', $js));
+        $urlpath = self::staticPath(str_replace('Plugin','',__CLASS__),
+                                    'js/realtimeupdate.js');
+        return array($urlpath);
     }
 
     /**
diff --git a/plugins/Realtime/css/realtimeupdate.css b/plugins/Realtime/css/realtimeupdate.css
new file mode 100644 (file)
index 0000000..3295fe4
--- /dev/null
@@ -0,0 +1,76 @@
+.realtime-popup address {
+display:none;
+}
+
+.realtime-popup #content {
+width:93.5%;
+}
+
+.realtime-popup #form_notice {
+margin:18px 0 18px 1.795%;
+width:93%;
+max-width:451px;
+}
+
+.realtime-popup #form_notice label[for=notice_data-text],
+.realtime-popup h1 {
+display:none;
+}
+
+.realtime-popup #form_notice label.notice_data-attach,
+.realtime-popup #form_notice input.notice_data-attach,
+.realtime-popup #form_notice label.notice_data-geo {
+top:0;
+}
+
+.realtime-popup #form_notice input.notice_data-attach {
+left:auto;
+right:0;
+}
+
+.realtime-popup .entity_profile {
+width:70%;
+}
+.realtime-popup .entity_actions {
+margin-left:1%;
+}
+
+#notices_primary {
+position:relative;
+}
+
+#realtime_actions {
+position: absolute;
+top: -20px;
+right: 0;
+margin: 0 0 11px 0;
+}
+
+#realtime_actions li {
+margin-left: 18px;
+list-style-type: none;
+float: left;
+}
+
+#realtime_actions button {
+width: 16px;
+height: 16px;
+display: block;
+border: none;
+cursor: pointer;
+text-indent: -9999px;
+float: left;
+}
+
+#realtime_play {
+margin-left: 4px;
+}
+
+#queued_counter {
+float:left;
+line-height:1.2;
+}
+
+#showstream #notices_primary {
+margin-top: 18px;
+}
diff --git a/plugins/Realtime/js/realtimeupdate.js b/plugins/Realtime/js/realtimeupdate.js
new file mode 100644 (file)
index 0000000..90d0a05
--- /dev/null
@@ -0,0 +1,644 @@
+/*
+ * StatusNet - a distributed open-source microblogging tool
+ * Copyright (C) 2009-2011, StatusNet, Inc.
+ *
+ * Add a notice encoded as JSON into the current timeline
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Plugin
+ * @package   StatusNet
+ * @author    Evan Prodromou <evan@status.net>
+ * @author    Sarven Capadisli <csarven@status.net>
+ * @copyright 2009-2011 StatusNet, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://status.net/
+ */
+
+/**
+ * This is the UI portion of the Realtime plugin base class, handling
+ * queueing up and displaying of notices that have been received through
+ * other code in one of the subclassed plugin implementations such as
+ * Meteor or Orbited.
+ *
+ * Notices are passed in as JSON objects formatted per the Twitter-compatible
+ * API.
+ *
+ * @todo Currently we duplicate a lot of formatting and layout code from
+ *       the PHP side of StatusNet, which makes it very difficult to maintain
+ *       this package. Internationalization as well as newer features such
+ *       as location data, customized source links for OStatus profiles,
+ *       and image thumbnails are not yet supported in Realtime yet because
+ *       they have not been implemented here.
+ */
+RealtimeUpdate = {
+     _userid: 0,
+     _showurl: '',
+     _keepaliveurl: '',
+     _closeurl: '',
+     _updatecounter: 0,
+     _maxnotices: 50,
+     _windowhasfocus: true,
+     _documenttitle: '',
+     _paused:false,
+     _queuedNotices:[],
+
+     /**
+      * Initialize the Realtime plugin UI on a page with a timeline view.
+      *
+      * This function is called from a JS fragment inserted by the PHP side
+      * of the Realtime plugin, and provides us with base information
+      * needed to build a near-replica of StatusNet's NoticeListItem output.
+      *
+      * Once the UI is initialized, a plugin subclass will need to actually
+      * feed data into the RealtimeUpdate object!
+      *
+      * @param {int} userid: local profile ID of the currently logged-in user
+      * @param {String} showurl: URL for shownotice action, used when fetching formatting notices.
+      *                            This URL contains a stub value of 0000000000 which will be replaced with the notice ID.
+      *
+      * @access public
+      */
+     init: function(userid, showurl)
+     {
+        RealtimeUpdate._userid = userid;
+        RealtimeUpdate._showurl = showurl;
+
+        RealtimeUpdate._documenttitle = document.title;
+
+        $(window).bind('focus', function() {
+          RealtimeUpdate._windowhasfocus = true;
+
+          // Clear the counter on the window title when we focus in.
+          RealtimeUpdate._updatecounter = 0;
+          RealtimeUpdate.removeWindowCounter();
+        });
+
+        $(window).bind('blur', function() {
+          $('#notices_primary .notice').removeClass('mark-top');
+
+          $('#notices_primary .notice:first').addClass('mark-top');
+
+          // While we're in the background, received messages will increment
+          // a counter that we put on the window title. This will cause some
+          // browsers to also flash or mark the tab or window title bar until
+          // you seek attention (eg Firefox 4 pinned app tabs).
+          RealtimeUpdate._windowhasfocus = false;
+
+          return false;
+        });
+     },
+
+     /**
+      * Accept a notice in a Twitter-API JSON style and either show it
+      * or queue it up, depending on whether the realtime display is
+      * active.
+      *
+      * The meat of a Realtime plugin subclass is to provide a substrate
+      * transport to receive data and shove it into this function. :)
+      *
+      * Note that the JSON data is extended from the standard API return
+      * with additional fields added by RealtimePlugin's PHP code.
+      *
+      * @param {Object} data: extended JSON API-formatted notice
+      *
+      * @access public
+      */
+     receive: function(data)
+     {
+          if (RealtimeUpdate.isNoticeVisible(data.id)) {
+              // Probably posted by the user in this window, and so already
+              // shown by the AJAX form handler. Ignore it.
+              return;
+          }
+          if (RealtimeUpdate._paused === false) {
+              RealtimeUpdate.purgeLastNoticeItem();
+
+              RealtimeUpdate.insertNoticeItem(data);
+          }
+          else {
+              RealtimeUpdate._queuedNotices.push(data);
+
+              RealtimeUpdate.updateQueuedCounter();
+          }
+
+          RealtimeUpdate.updateWindowCounter();
+     },
+
+     /**
+      * Add a visible representation of the given notice at the top of
+      * the current timeline.
+      *
+      * If the notice is already in the timeline, nothing will be added.
+      *
+      * @param {Object} data: extended JSON API-formatted notice
+      *
+      * @fixme while core UI JS code is used to activate the AJAX UI controls,
+      *        the actual production of HTML (in makeNoticeItem and its subs)
+      *        duplicates core code without plugin hook points or i18n support.
+      *
+      * @access private
+      */
+     insertNoticeItem: function(data) {
+        // Don't add it if it already exists
+        if (RealtimeUpdate.isNoticeVisible(data.id)) {
+            return;
+        }
+
+        RealtimeUpdate.makeNoticeItem(data, function(noticeItem) {
+            // Check again in case it got shown while we were waiting for data...
+            if (RealtimeUpdate.isNoticeVisible(data.id)) {
+                return;
+            }
+            var noticeItemID = $(noticeItem).attr('id');
+
+            var list = $("#notices_primary .notices:first")
+            var prepend = true;
+
+            var threaded = list.hasClass('threaded-notices');
+            if (threaded && data.in_reply_to_status_id) {
+                // aho!
+                var parent = $('#notice-' + data.in_reply_to_status_id);
+                if (parent.length == 0) {
+                    // @todo fetch the original, insert it, and finish the rest
+                } else {
+                    // Check the parent notice to make sure it's not a reply itself.
+                    // If so, use it's parent as the parent.
+                    var parentList = parent.closest('.notices');
+                    if (parentList.hasClass('threaded-replies')) {
+                        parent = parentList.closest('.notice');
+                    }
+                    list = parent.find('.threaded-replies');
+                    if (list.length == 0) {
+                        list = $('<ul class="notices threaded-replies xoxo"></ul>');
+                        parent.append(list);
+                        SN.U.NoticeInlineReplyPlaceholder(parent);
+                    }
+                    prepend = false;
+                }
+            }
+
+            var newNotice = $(noticeItem);
+            if (prepend) {
+                list.prepend(newNotice);
+            } else {
+                var placeholder = list.find('li.notice-reply-placeholder')
+                if (placeholder.length > 0) {
+                    newNotice.insertBefore(placeholder)
+                } else {
+                    newNotice.appendTo(list);
+                }
+            }
+            newNotice.css({display:"none"}).fadeIn(1000);
+
+            SN.U.NoticeReplyTo($('#'+noticeItemID));
+            SN.U.NoticeWithAttachment($('#'+noticeItemID));
+        });
+     },
+
+     /**
+      * Check if the given notice is visible in the timeline currently.
+      * Used to avoid duplicate processing of notices that have been
+      * displayed by other means.
+      *
+      * @param {number} id: notice ID to check
+      *
+      * @return boolean
+      *
+      * @access private
+      */
+     isNoticeVisible: function(id) {
+        return ($("#notice-"+id).length > 0);
+     },
+
+     /**
+      * Trims a notice off the end of the timeline if we have more than the
+      * maximum number of notices visible.
+      *
+      * @access private
+      */
+     purgeLastNoticeItem: function() {
+        if ($('#notices_primary .notice').length > RealtimeUpdate._maxnotices) {
+            $("#notices_primary .notice:last").remove();
+        }
+     },
+
+     /**
+      * If the window/tab is in background, increment the counter of newly
+      * received notices and append it onto the window title.
+      *
+      * Has no effect if the window is in foreground.
+      *
+      * @access private
+      */
+     updateWindowCounter: function() {
+          if (RealtimeUpdate._windowhasfocus === false) {
+              RealtimeUpdate._updatecounter += 1;
+              document.title = '('+RealtimeUpdate._updatecounter+') ' + RealtimeUpdate._documenttitle;
+          }
+     },
+
+     /**
+      * Clear the background update counter from the window title.
+      *
+      * @access private
+      *
+      * @fixme could interfere with anything else trying similar tricks
+      */
+     removeWindowCounter: function() {
+          document.title = RealtimeUpdate._documenttitle;
+     },
+
+     /**
+      * Builds a notice HTML block from JSON API-style data;
+      * loads data from server, so runs async.
+      *
+      * @param {Object} data: extended JSON API-formatted notice
+      * @param {function} callback: function(DOMNode) to receive new code
+      *
+      * @access private
+      */
+     makeNoticeItem: function(data, callback)
+     {
+         var url = RealtimeUpdate._showurl.replace('0000000000', data.id);
+         $.get(url, {ajax: 1}, function(data, textStatus, xhr) {
+             var notice = $('li.notice:first', data);
+             if (notice.length) {
+                 var node = document._importNode(notice[0], true);
+                 callback(node);
+             }
+         });
+     },
+
+     /**
+      * Creates a favorite button.
+      *
+      * @param {number} id: notice ID to work with
+      * @param {String} session_key: session token for form CSRF protection
+      * @return {String} HTML fragment
+      *
+      * @fixme this replicates core StatusNet code, making maintenance harder
+      * @fixme sloppy HTML building (raw concat without escaping)
+      * @fixme no i18n support
+      *
+      * @access private
+      */
+     makeFavoriteForm: function(id, session_key)
+     {
+          var ff;
+
+          ff = "<form id=\"favor-"+id+"\" class=\"form_favor\" method=\"post\" action=\""+RealtimeUpdate._favorurl+"\">"+
+                "<fieldset>"+
+               "<legend>Favor this notice</legend>"+
+               "<input name=\"token\" type=\"hidden\" id=\"token-"+id+"\" value=\""+session_key+"\"/>"+
+               "<input name=\"notice\" type=\"hidden\" id=\"notice-n"+id+"\" value=\""+id+"\"/>"+
+               "<input type=\"submit\" id=\"favor-submit-"+id+"\" name=\"favor-submit-"+id+"\" class=\"submit\" value=\"Favor\" title=\"Favor this notice\"/>"+
+                "</fieldset>"+
+               "</form>";
+          return ff;
+     },
+
+     /**
+      * Creates a reply button.
+      *
+      * @param {number} id: notice ID to work with
+      * @param {String} nickname: nick of the user to whom we are replying
+      * @return {String} HTML fragment
+      *
+      * @fixme this replicates core StatusNet code, making maintenance harder
+      * @fixme sloppy HTML building (raw concat without escaping)
+      * @fixme no i18n support
+      *
+      * @access private
+      */
+     makeReplyLink: function(id, nickname)
+     {
+          var rl;
+          rl = "<a class=\"notice_reply\" href=\""+RealtimeUpdate._replyurl+"?replyto="+nickname+"\" title=\"Reply to this notice\">Reply <span class=\"notice_id\">"+id+"</span></a>";
+          return rl;
+     },
+
+     /**
+      * Creates a repeat button.
+      *
+      * @param {number} id: notice ID to work with
+      * @param {String} session_key: session token for form CSRF protection
+      * @return {String} HTML fragment
+      *
+      * @fixme this replicates core StatusNet code, making maintenance harder
+      * @fixme sloppy HTML building (raw concat without escaping)
+      * @fixme no i18n support
+      *
+      * @access private
+      */
+     makeRepeatForm: function(id, session_key)
+     {
+          var rf;
+          rf = "<form id=\"repeat-"+id+"\" class=\"form_repeat\" method=\"post\" action=\""+RealtimeUpdate._repeaturl+"\">"+
+               "<fieldset>"+
+               "<legend>Repeat this notice?</legend>"+
+               "<input name=\"token\" type=\"hidden\" id=\"token-"+id+"\" value=\""+session_key+"\"/>"+
+               "<input name=\"notice\" type=\"hidden\" id=\"notice-"+id+"\" value=\""+id+"\"/>"+
+               "<input type=\"submit\" id=\"repeat-submit-"+id+"\" name=\"repeat-submit-"+id+"\" class=\"submit\" value=\"Yes\" title=\"Repeat this notice\"/>"+
+               "</fieldset>"+
+               "</form>";
+
+          return rf;
+     },
+
+     /**
+      * Creates a delete button.
+      *
+      * @param {number} id: notice ID to create a delete link for
+      * @return {String} HTML fragment
+      *
+      * @fixme this replicates core StatusNet code, making maintenance harder
+      * @fixme sloppy HTML building (raw concat without escaping)
+      * @fixme no i18n support
+      *
+      * @access private
+      */
+     makeDeleteLink: function(id)
+     {
+          var dl, delurl;
+          delurl = RealtimeUpdate._deleteurl.replace("0000000000", id);
+
+          dl = "<a class=\"notice_delete\" href=\""+delurl+"\" title=\"Delete this notice\">Delete</a>";
+
+          return dl;
+     },
+
+     /**
+      * Adds a control widget at the top of the timeline view, containing
+      * pause/play and popup buttons.
+      *
+      * @param {String} url: full URL to the popup window variant of this timeline page
+      * @param {String} timeline: string key for the timeline (eg 'public' or 'evan-all')
+      * @param {String} path: URL to the base directory containing the Realtime plugin,
+      *                       used to fetch resources if needed.
+      *
+      * @todo timeline and path parameters are unused and probably should be removed.
+      *
+      * @access private
+      */
+    initActions: function(url, timeline, path, keepaliveurl, closeurl)
+     {
+        $('#notices_primary').prepend('<ul id="realtime_actions"><li id="realtime_playpause"></li><li id="realtime_timeline"></li></ul>');
+
+        RealtimeUpdate._pluginPath = path;
+        RealtimeUpdate._keepaliveurl = keepaliveurl;
+        RealtimeUpdate._closeurl = closeurl;
+
+
+        // On unload, let the server know we're no longer listening
+         $(window).unload(function() {
+            $.ajax({
+                type: 'POST',
+                url: RealtimeUpdate._closeurl});
+        });
+
+       setInterval(function() {
+            $.ajax({
+                type: 'POST',
+                url: RealtimeUpdate._keepaliveurl});
+
+       }, 15 * 60 * 1000 ); // every 15 min; timeout in 30 min
+
+        RealtimeUpdate.initPlayPause();
+        RealtimeUpdate.initAddPopup(url, timeline, RealtimeUpdate._pluginPath);
+     },
+
+     /**
+      * Initialize the state of the play/pause controls.
+      *
+      * If the browser supports the localStorage interface, we'll attempt
+      * to retrieve a pause state from there; otherwise we default to paused.
+      *
+      * @access private
+      */
+     initPlayPause: function()
+     {
+        if (typeof(localStorage) == 'undefined') {
+            RealtimeUpdate.showPause();
+        }
+        else {
+            if (localStorage.getItem('RealtimeUpdate_paused') === 'true') {
+                RealtimeUpdate.showPlay();
+            }
+            else {
+                RealtimeUpdate.showPause();
+            }
+        }
+     },
+
+     /**
+      * Switch the realtime UI into paused state.
+      * Uses SN.msg i18n system for the button label and tooltip.
+      *
+      * State will be saved and re-used next time if the browser supports
+      * the localStorage interface (via setPause).
+      *
+      * @access private
+      */
+     showPause: function()
+     {
+        RealtimeUpdate.setPause(false);
+        RealtimeUpdate.showQueuedNotices();
+        RealtimeUpdate.addNoticesHover();
+
+        $('#realtime_playpause').remove();
+        $('#realtime_actions').prepend('<li id="realtime_playpause"><button id="realtime_pause" class="pause"></button></li>');
+        $('#realtime_pause').text(SN.msg('realtime_pause'))
+                            .attr('title', SN.msg('realtime_pause_tooltip'))
+                            .bind('click', function() {
+            RealtimeUpdate.removeNoticesHover();
+            RealtimeUpdate.showPlay();
+            return false;
+        });
+     },
+
+     /**
+      * Switch the realtime UI into play state.
+      * Uses SN.msg i18n system for the button label and tooltip.
+      *
+      * State will be saved and re-used next time if the browser supports
+      * the localStorage interface (via setPause).
+      *
+      * @access private
+      */
+     showPlay: function()
+     {
+        RealtimeUpdate.setPause(true);
+        $('#realtime_playpause').remove();
+        $('#realtime_actions').prepend('<li id="realtime_playpause"><span id="queued_counter"></span> <button id="realtime_play" class="play"></button></li>');
+        $('#realtime_play').text(SN.msg('realtime_play'))
+                           .attr('title', SN.msg('realtime_play_tooltip'))
+                           .bind('click', function() {
+            RealtimeUpdate.showPause();
+            return false;
+        });
+     },
+
+     /**
+      * Update the internal pause/play state.
+      * Do not call directly; use showPause() and showPlay().
+      *
+      * State will be saved and re-used next time if the browser supports
+      * the localStorage interface.
+      *
+      * @param {boolean} state: true = paused, false = not paused
+      *
+      * @access private
+      */
+     setPause: function(state)
+     {
+        RealtimeUpdate._paused = state;
+        if (typeof(localStorage) != 'undefined') {
+            localStorage.setItem('RealtimeUpdate_paused', RealtimeUpdate._paused);
+        }
+     },
+
+     /**
+      * Go through notices we have previously received while paused,
+      * dumping them into the timeline view.
+      *
+      * @fixme long timelines are not trimmed here as they are for things received while not paused
+      *
+      * @access private
+      */
+     showQueuedNotices: function()
+     {
+        $.each(RealtimeUpdate._queuedNotices, function(i, n) {
+            RealtimeUpdate.insertNoticeItem(n);
+        });
+
+        RealtimeUpdate._queuedNotices = [];
+
+        RealtimeUpdate.removeQueuedCounter();
+     },
+
+     /**
+      * Update the Realtime widget control's counter of queued notices to show
+      * the current count. This will be called after receiving and queueing
+      * a notice while paused.
+      *
+      * @access private
+      */
+     updateQueuedCounter: function()
+     {
+        $('#realtime_playpause #queued_counter').html('('+RealtimeUpdate._queuedNotices.length+')');
+     },
+
+     /**
+      * Clear the Realtime widget control's counter of queued notices.
+      *
+      * @access private
+      */
+     removeQueuedCounter: function()
+     {
+        $('#realtime_playpause #queued_counter').empty();
+     },
+
+     /**
+      * Set up event handlers on the timeline view to automatically pause
+      * when the mouse is over the timeline, as this indicates the user's
+      * desire to interact with the UI. (Which is hard to do when it's moving!)
+      *
+      * @access private
+      */
+     addNoticesHover: function()
+     {
+        $('#notices_primary .notices').hover(
+            function() {
+                if (RealtimeUpdate._paused === false) {
+                    RealtimeUpdate.showPlay();
+                }
+            },
+            function() {
+                if (RealtimeUpdate._paused === true) {
+                    RealtimeUpdate.showPause();
+                }
+            }
+        );
+     },
+
+     /**
+      * Tear down event handlers on the timeline view to automatically pause
+      * when the mouse is over the timeline.
+      *
+      * @fixme this appears to remove *ALL* event handlers from the timeline,
+      *        which assumes that nobody else is adding any event handlers.
+      *        Sloppy -- we should only remove the ones we add.
+      *
+      * @access private
+      */
+     removeNoticesHover: function()
+     {
+        $('#notices_primary .notices').unbind();
+     },
+
+     /**
+      * UI initialization, to be called from Realtime plugin code on regular
+      * timeline pages.
+      *
+      * Adds a button to the control widget at the top of the timeline view,
+      * allowing creation of a popup window with a more compact real-time
+      * view of the current timeline.
+      *
+      * @param {String} url: full URL to the popup window variant of this timeline page
+      * @param {String} timeline: string key for the timeline (eg 'public' or 'evan-all')
+      * @param {String} path: URL to the base directory containing the Realtime plugin,
+      *                       used to fetch resources if needed.
+      *
+      * @todo timeline and path parameters are unused and probably should be removed.
+      *
+      * @access public
+      */
+     initAddPopup: function(url, timeline, path)
+     {
+         $('#realtime_timeline').append('<button id="realtime_popup"></button>');
+         $('#realtime_popup').text(SN.msg('realtime_popup'))
+                             .attr('title', SN.msg('realtime_popup_tooltip'))
+                             .bind('click', function() {
+                window.open(url,
+                         '',
+                         'toolbar=no,resizable=yes,scrollbars=yes,status=no,menubar=no,personalbar=no,location=no,width=500,height=550');
+
+             return false;
+         });
+     },
+
+     /**
+      * UI initialization, to be called from Realtime plugin code on popup
+      * compact timeline pages.
+      *
+      * Sets up links in notices to open in a new window.
+      *
+      * @fixme fails to do the same for UI links like context view which will
+      *        look bad in the tiny chromeless window.
+      *
+      * @access public
+      */
+     initPopupWindow: function()
+     {
+         $('.notices .entry-title a, .notices .entry-content a').bind('click', function() {
+            window.open(this.href, '');
+
+            return false;
+         });
+
+         $('#showstream .entity_profile').css({'width':'69%'});
+     }
+}
+
diff --git a/plugins/Realtime/realtimeupdate.css b/plugins/Realtime/realtimeupdate.css
deleted file mode 100644 (file)
index 3295fe4..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-.realtime-popup address {
-display:none;
-}
-
-.realtime-popup #content {
-width:93.5%;
-}
-
-.realtime-popup #form_notice {
-margin:18px 0 18px 1.795%;
-width:93%;
-max-width:451px;
-}
-
-.realtime-popup #form_notice label[for=notice_data-text],
-.realtime-popup h1 {
-display:none;
-}
-
-.realtime-popup #form_notice label.notice_data-attach,
-.realtime-popup #form_notice input.notice_data-attach,
-.realtime-popup #form_notice label.notice_data-geo {
-top:0;
-}
-
-.realtime-popup #form_notice input.notice_data-attach {
-left:auto;
-right:0;
-}
-
-.realtime-popup .entity_profile {
-width:70%;
-}
-.realtime-popup .entity_actions {
-margin-left:1%;
-}
-
-#notices_primary {
-position:relative;
-}
-
-#realtime_actions {
-position: absolute;
-top: -20px;
-right: 0;
-margin: 0 0 11px 0;
-}
-
-#realtime_actions li {
-margin-left: 18px;
-list-style-type: none;
-float: left;
-}
-
-#realtime_actions button {
-width: 16px;
-height: 16px;
-display: block;
-border: none;
-cursor: pointer;
-text-indent: -9999px;
-float: left;
-}
-
-#realtime_play {
-margin-left: 4px;
-}
-
-#queued_counter {
-float:left;
-line-height:1.2;
-}
-
-#showstream #notices_primary {
-margin-top: 18px;
-}
diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js
deleted file mode 100644 (file)
index 90d0a05..0000000
+++ /dev/null
@@ -1,644 +0,0 @@
-/*
- * StatusNet - a distributed open-source microblogging tool
- * Copyright (C) 2009-2011, StatusNet, Inc.
- *
- * Add a notice encoded as JSON into the current timeline
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- * @category  Plugin
- * @package   StatusNet
- * @author    Evan Prodromou <evan@status.net>
- * @author    Sarven Capadisli <csarven@status.net>
- * @copyright 2009-2011 StatusNet, Inc.
- * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link      http://status.net/
- */
-
-/**
- * This is the UI portion of the Realtime plugin base class, handling
- * queueing up and displaying of notices that have been received through
- * other code in one of the subclassed plugin implementations such as
- * Meteor or Orbited.
- *
- * Notices are passed in as JSON objects formatted per the Twitter-compatible
- * API.
- *
- * @todo Currently we duplicate a lot of formatting and layout code from
- *       the PHP side of StatusNet, which makes it very difficult to maintain
- *       this package. Internationalization as well as newer features such
- *       as location data, customized source links for OStatus profiles,
- *       and image thumbnails are not yet supported in Realtime yet because
- *       they have not been implemented here.
- */
-RealtimeUpdate = {
-     _userid: 0,
-     _showurl: '',
-     _keepaliveurl: '',
-     _closeurl: '',
-     _updatecounter: 0,
-     _maxnotices: 50,
-     _windowhasfocus: true,
-     _documenttitle: '',
-     _paused:false,
-     _queuedNotices:[],
-
-     /**
-      * Initialize the Realtime plugin UI on a page with a timeline view.
-      *
-      * This function is called from a JS fragment inserted by the PHP side
-      * of the Realtime plugin, and provides us with base information
-      * needed to build a near-replica of StatusNet's NoticeListItem output.
-      *
-      * Once the UI is initialized, a plugin subclass will need to actually
-      * feed data into the RealtimeUpdate object!
-      *
-      * @param {int} userid: local profile ID of the currently logged-in user
-      * @param {String} showurl: URL for shownotice action, used when fetching formatting notices.
-      *                            This URL contains a stub value of 0000000000 which will be replaced with the notice ID.
-      *
-      * @access public
-      */
-     init: function(userid, showurl)
-     {
-        RealtimeUpdate._userid = userid;
-        RealtimeUpdate._showurl = showurl;
-
-        RealtimeUpdate._documenttitle = document.title;
-
-        $(window).bind('focus', function() {
-          RealtimeUpdate._windowhasfocus = true;
-
-          // Clear the counter on the window title when we focus in.
-          RealtimeUpdate._updatecounter = 0;
-          RealtimeUpdate.removeWindowCounter();
-        });
-
-        $(window).bind('blur', function() {
-          $('#notices_primary .notice').removeClass('mark-top');
-
-          $('#notices_primary .notice:first').addClass('mark-top');
-
-          // While we're in the background, received messages will increment
-          // a counter that we put on the window title. This will cause some
-          // browsers to also flash or mark the tab or window title bar until
-          // you seek attention (eg Firefox 4 pinned app tabs).
-          RealtimeUpdate._windowhasfocus = false;
-
-          return false;
-        });
-     },
-
-     /**
-      * Accept a notice in a Twitter-API JSON style and either show it
-      * or queue it up, depending on whether the realtime display is
-      * active.
-      *
-      * The meat of a Realtime plugin subclass is to provide a substrate
-      * transport to receive data and shove it into this function. :)
-      *
-      * Note that the JSON data is extended from the standard API return
-      * with additional fields added by RealtimePlugin's PHP code.
-      *
-      * @param {Object} data: extended JSON API-formatted notice
-      *
-      * @access public
-      */
-     receive: function(data)
-     {
-          if (RealtimeUpdate.isNoticeVisible(data.id)) {
-              // Probably posted by the user in this window, and so already
-              // shown by the AJAX form handler. Ignore it.
-              return;
-          }
-          if (RealtimeUpdate._paused === false) {
-              RealtimeUpdate.purgeLastNoticeItem();
-
-              RealtimeUpdate.insertNoticeItem(data);
-          }
-          else {
-              RealtimeUpdate._queuedNotices.push(data);
-
-              RealtimeUpdate.updateQueuedCounter();
-          }
-
-          RealtimeUpdate.updateWindowCounter();
-     },
-
-     /**
-      * Add a visible representation of the given notice at the top of
-      * the current timeline.
-      *
-      * If the notice is already in the timeline, nothing will be added.
-      *
-      * @param {Object} data: extended JSON API-formatted notice
-      *
-      * @fixme while core UI JS code is used to activate the AJAX UI controls,
-      *        the actual production of HTML (in makeNoticeItem and its subs)
-      *        duplicates core code without plugin hook points or i18n support.
-      *
-      * @access private
-      */
-     insertNoticeItem: function(data) {
-        // Don't add it if it already exists
-        if (RealtimeUpdate.isNoticeVisible(data.id)) {
-            return;
-        }
-
-        RealtimeUpdate.makeNoticeItem(data, function(noticeItem) {
-            // Check again in case it got shown while we were waiting for data...
-            if (RealtimeUpdate.isNoticeVisible(data.id)) {
-                return;
-            }
-            var noticeItemID = $(noticeItem).attr('id');
-
-            var list = $("#notices_primary .notices:first")
-            var prepend = true;
-
-            var threaded = list.hasClass('threaded-notices');
-            if (threaded && data.in_reply_to_status_id) {
-                // aho!
-                var parent = $('#notice-' + data.in_reply_to_status_id);
-                if (parent.length == 0) {
-                    // @todo fetch the original, insert it, and finish the rest
-                } else {
-                    // Check the parent notice to make sure it's not a reply itself.
-                    // If so, use it's parent as the parent.
-                    var parentList = parent.closest('.notices');
-                    if (parentList.hasClass('threaded-replies')) {
-                        parent = parentList.closest('.notice');
-                    }
-                    list = parent.find('.threaded-replies');
-                    if (list.length == 0) {
-                        list = $('<ul class="notices threaded-replies xoxo"></ul>');
-                        parent.append(list);
-                        SN.U.NoticeInlineReplyPlaceholder(parent);
-                    }
-                    prepend = false;
-                }
-            }
-
-            var newNotice = $(noticeItem);
-            if (prepend) {
-                list.prepend(newNotice);
-            } else {
-                var placeholder = list.find('li.notice-reply-placeholder')
-                if (placeholder.length > 0) {
-                    newNotice.insertBefore(placeholder)
-                } else {
-                    newNotice.appendTo(list);
-                }
-            }
-            newNotice.css({display:"none"}).fadeIn(1000);
-
-            SN.U.NoticeReplyTo($('#'+noticeItemID));
-            SN.U.NoticeWithAttachment($('#'+noticeItemID));
-        });
-     },
-
-     /**
-      * Check if the given notice is visible in the timeline currently.
-      * Used to avoid duplicate processing of notices that have been
-      * displayed by other means.
-      *
-      * @param {number} id: notice ID to check
-      *
-      * @return boolean
-      *
-      * @access private
-      */
-     isNoticeVisible: function(id) {
-        return ($("#notice-"+id).length > 0);
-     },
-
-     /**
-      * Trims a notice off the end of the timeline if we have more than the
-      * maximum number of notices visible.
-      *
-      * @access private
-      */
-     purgeLastNoticeItem: function() {
-        if ($('#notices_primary .notice').length > RealtimeUpdate._maxnotices) {
-            $("#notices_primary .notice:last").remove();
-        }
-     },
-
-     /**
-      * If the window/tab is in background, increment the counter of newly
-      * received notices and append it onto the window title.
-      *
-      * Has no effect if the window is in foreground.
-      *
-      * @access private
-      */
-     updateWindowCounter: function() {
-          if (RealtimeUpdate._windowhasfocus === false) {
-              RealtimeUpdate._updatecounter += 1;
-              document.title = '('+RealtimeUpdate._updatecounter+') ' + RealtimeUpdate._documenttitle;
-          }
-     },
-
-     /**
-      * Clear the background update counter from the window title.
-      *
-      * @access private
-      *
-      * @fixme could interfere with anything else trying similar tricks
-      */
-     removeWindowCounter: function() {
-          document.title = RealtimeUpdate._documenttitle;
-     },
-
-     /**
-      * Builds a notice HTML block from JSON API-style data;
-      * loads data from server, so runs async.
-      *
-      * @param {Object} data: extended JSON API-formatted notice
-      * @param {function} callback: function(DOMNode) to receive new code
-      *
-      * @access private
-      */
-     makeNoticeItem: function(data, callback)
-     {
-         var url = RealtimeUpdate._showurl.replace('0000000000', data.id);
-         $.get(url, {ajax: 1}, function(data, textStatus, xhr) {
-             var notice = $('li.notice:first', data);
-             if (notice.length) {
-                 var node = document._importNode(notice[0], true);
-                 callback(node);
-             }
-         });
-     },
-
-     /**
-      * Creates a favorite button.
-      *
-      * @param {number} id: notice ID to work with
-      * @param {String} session_key: session token for form CSRF protection
-      * @return {String} HTML fragment
-      *
-      * @fixme this replicates core StatusNet code, making maintenance harder
-      * @fixme sloppy HTML building (raw concat without escaping)
-      * @fixme no i18n support
-      *
-      * @access private
-      */
-     makeFavoriteForm: function(id, session_key)
-     {
-          var ff;
-
-          ff = "<form id=\"favor-"+id+"\" class=\"form_favor\" method=\"post\" action=\""+RealtimeUpdate._favorurl+"\">"+
-                "<fieldset>"+
-               "<legend>Favor this notice</legend>"+
-               "<input name=\"token\" type=\"hidden\" id=\"token-"+id+"\" value=\""+session_key+"\"/>"+
-               "<input name=\"notice\" type=\"hidden\" id=\"notice-n"+id+"\" value=\""+id+"\"/>"+
-               "<input type=\"submit\" id=\"favor-submit-"+id+"\" name=\"favor-submit-"+id+"\" class=\"submit\" value=\"Favor\" title=\"Favor this notice\"/>"+
-                "</fieldset>"+
-               "</form>";
-          return ff;
-     },
-
-     /**
-      * Creates a reply button.
-      *
-      * @param {number} id: notice ID to work with
-      * @param {String} nickname: nick of the user to whom we are replying
-      * @return {String} HTML fragment
-      *
-      * @fixme this replicates core StatusNet code, making maintenance harder
-      * @fixme sloppy HTML building (raw concat without escaping)
-      * @fixme no i18n support
-      *
-      * @access private
-      */
-     makeReplyLink: function(id, nickname)
-     {
-          var rl;
-          rl = "<a class=\"notice_reply\" href=\""+RealtimeUpdate._replyurl+"?replyto="+nickname+"\" title=\"Reply to this notice\">Reply <span class=\"notice_id\">"+id+"</span></a>";
-          return rl;
-     },
-
-     /**
-      * Creates a repeat button.
-      *
-      * @param {number} id: notice ID to work with
-      * @param {String} session_key: session token for form CSRF protection
-      * @return {String} HTML fragment
-      *
-      * @fixme this replicates core StatusNet code, making maintenance harder
-      * @fixme sloppy HTML building (raw concat without escaping)
-      * @fixme no i18n support
-      *
-      * @access private
-      */
-     makeRepeatForm: function(id, session_key)
-     {
-          var rf;
-          rf = "<form id=\"repeat-"+id+"\" class=\"form_repeat\" method=\"post\" action=\""+RealtimeUpdate._repeaturl+"\">"+
-               "<fieldset>"+
-               "<legend>Repeat this notice?</legend>"+
-               "<input name=\"token\" type=\"hidden\" id=\"token-"+id+"\" value=\""+session_key+"\"/>"+
-               "<input name=\"notice\" type=\"hidden\" id=\"notice-"+id+"\" value=\""+id+"\"/>"+
-               "<input type=\"submit\" id=\"repeat-submit-"+id+"\" name=\"repeat-submit-"+id+"\" class=\"submit\" value=\"Yes\" title=\"Repeat this notice\"/>"+
-               "</fieldset>"+
-               "</form>";
-
-          return rf;
-     },
-
-     /**
-      * Creates a delete button.
-      *
-      * @param {number} id: notice ID to create a delete link for
-      * @return {String} HTML fragment
-      *
-      * @fixme this replicates core StatusNet code, making maintenance harder
-      * @fixme sloppy HTML building (raw concat without escaping)
-      * @fixme no i18n support
-      *
-      * @access private
-      */
-     makeDeleteLink: function(id)
-     {
-          var dl, delurl;
-          delurl = RealtimeUpdate._deleteurl.replace("0000000000", id);
-
-          dl = "<a class=\"notice_delete\" href=\""+delurl+"\" title=\"Delete this notice\">Delete</a>";
-
-          return dl;
-     },
-
-     /**
-      * Adds a control widget at the top of the timeline view, containing
-      * pause/play and popup buttons.
-      *
-      * @param {String} url: full URL to the popup window variant of this timeline page
-      * @param {String} timeline: string key for the timeline (eg 'public' or 'evan-all')
-      * @param {String} path: URL to the base directory containing the Realtime plugin,
-      *                       used to fetch resources if needed.
-      *
-      * @todo timeline and path parameters are unused and probably should be removed.
-      *
-      * @access private
-      */
-    initActions: function(url, timeline, path, keepaliveurl, closeurl)
-     {
-        $('#notices_primary').prepend('<ul id="realtime_actions"><li id="realtime_playpause"></li><li id="realtime_timeline"></li></ul>');
-
-        RealtimeUpdate._pluginPath = path;
-        RealtimeUpdate._keepaliveurl = keepaliveurl;
-        RealtimeUpdate._closeurl = closeurl;
-
-
-        // On unload, let the server know we're no longer listening
-         $(window).unload(function() {
-            $.ajax({
-                type: 'POST',
-                url: RealtimeUpdate._closeurl});
-        });
-
-       setInterval(function() {
-            $.ajax({
-                type: 'POST',
-                url: RealtimeUpdate._keepaliveurl});
-
-       }, 15 * 60 * 1000 ); // every 15 min; timeout in 30 min
-
-        RealtimeUpdate.initPlayPause();
-        RealtimeUpdate.initAddPopup(url, timeline, RealtimeUpdate._pluginPath);
-     },
-
-     /**
-      * Initialize the state of the play/pause controls.
-      *
-      * If the browser supports the localStorage interface, we'll attempt
-      * to retrieve a pause state from there; otherwise we default to paused.
-      *
-      * @access private
-      */
-     initPlayPause: function()
-     {
-        if (typeof(localStorage) == 'undefined') {
-            RealtimeUpdate.showPause();
-        }
-        else {
-            if (localStorage.getItem('RealtimeUpdate_paused') === 'true') {
-                RealtimeUpdate.showPlay();
-            }
-            else {
-                RealtimeUpdate.showPause();
-            }
-        }
-     },
-
-     /**
-      * Switch the realtime UI into paused state.
-      * Uses SN.msg i18n system for the button label and tooltip.
-      *
-      * State will be saved and re-used next time if the browser supports
-      * the localStorage interface (via setPause).
-      *
-      * @access private
-      */
-     showPause: function()
-     {
-        RealtimeUpdate.setPause(false);
-        RealtimeUpdate.showQueuedNotices();
-        RealtimeUpdate.addNoticesHover();
-
-        $('#realtime_playpause').remove();
-        $('#realtime_actions').prepend('<li id="realtime_playpause"><button id="realtime_pause" class="pause"></button></li>');
-        $('#realtime_pause').text(SN.msg('realtime_pause'))
-                            .attr('title', SN.msg('realtime_pause_tooltip'))
-                            .bind('click', function() {
-            RealtimeUpdate.removeNoticesHover();
-            RealtimeUpdate.showPlay();
-            return false;
-        });
-     },
-
-     /**
-      * Switch the realtime UI into play state.
-      * Uses SN.msg i18n system for the button label and tooltip.
-      *
-      * State will be saved and re-used next time if the browser supports
-      * the localStorage interface (via setPause).
-      *
-      * @access private
-      */
-     showPlay: function()
-     {
-        RealtimeUpdate.setPause(true);
-        $('#realtime_playpause').remove();
-        $('#realtime_actions').prepend('<li id="realtime_playpause"><span id="queued_counter"></span> <button id="realtime_play" class="play"></button></li>');
-        $('#realtime_play').text(SN.msg('realtime_play'))
-                           .attr('title', SN.msg('realtime_play_tooltip'))
-                           .bind('click', function() {
-            RealtimeUpdate.showPause();
-            return false;
-        });
-     },
-
-     /**
-      * Update the internal pause/play state.
-      * Do not call directly; use showPause() and showPlay().
-      *
-      * State will be saved and re-used next time if the browser supports
-      * the localStorage interface.
-      *
-      * @param {boolean} state: true = paused, false = not paused
-      *
-      * @access private
-      */
-     setPause: function(state)
-     {
-        RealtimeUpdate._paused = state;
-        if (typeof(localStorage) != 'undefined') {
-            localStorage.setItem('RealtimeUpdate_paused', RealtimeUpdate._paused);
-        }
-     },
-
-     /**
-      * Go through notices we have previously received while paused,
-      * dumping them into the timeline view.
-      *
-      * @fixme long timelines are not trimmed here as they are for things received while not paused
-      *
-      * @access private
-      */
-     showQueuedNotices: function()
-     {
-        $.each(RealtimeUpdate._queuedNotices, function(i, n) {
-            RealtimeUpdate.insertNoticeItem(n);
-        });
-
-        RealtimeUpdate._queuedNotices = [];
-
-        RealtimeUpdate.removeQueuedCounter();
-     },
-
-     /**
-      * Update the Realtime widget control's counter of queued notices to show
-      * the current count. This will be called after receiving and queueing
-      * a notice while paused.
-      *
-      * @access private
-      */
-     updateQueuedCounter: function()
-     {
-        $('#realtime_playpause #queued_counter').html('('+RealtimeUpdate._queuedNotices.length+')');
-     },
-
-     /**
-      * Clear the Realtime widget control's counter of queued notices.
-      *
-      * @access private
-      */
-     removeQueuedCounter: function()
-     {
-        $('#realtime_playpause #queued_counter').empty();
-     },
-
-     /**
-      * Set up event handlers on the timeline view to automatically pause
-      * when the mouse is over the timeline, as this indicates the user's
-      * desire to interact with the UI. (Which is hard to do when it's moving!)
-      *
-      * @access private
-      */
-     addNoticesHover: function()
-     {
-        $('#notices_primary .notices').hover(
-            function() {
-                if (RealtimeUpdate._paused === false) {
-                    RealtimeUpdate.showPlay();
-                }
-            },
-            function() {
-                if (RealtimeUpdate._paused === true) {
-                    RealtimeUpdate.showPause();
-                }
-            }
-        );
-     },
-
-     /**
-      * Tear down event handlers on the timeline view to automatically pause
-      * when the mouse is over the timeline.
-      *
-      * @fixme this appears to remove *ALL* event handlers from the timeline,
-      *        which assumes that nobody else is adding any event handlers.
-      *        Sloppy -- we should only remove the ones we add.
-      *
-      * @access private
-      */
-     removeNoticesHover: function()
-     {
-        $('#notices_primary .notices').unbind();
-     },
-
-     /**
-      * UI initialization, to be called from Realtime plugin code on regular
-      * timeline pages.
-      *
-      * Adds a button to the control widget at the top of the timeline view,
-      * allowing creation of a popup window with a more compact real-time
-      * view of the current timeline.
-      *
-      * @param {String} url: full URL to the popup window variant of this timeline page
-      * @param {String} timeline: string key for the timeline (eg 'public' or 'evan-all')
-      * @param {String} path: URL to the base directory containing the Realtime plugin,
-      *                       used to fetch resources if needed.
-      *
-      * @todo timeline and path parameters are unused and probably should be removed.
-      *
-      * @access public
-      */
-     initAddPopup: function(url, timeline, path)
-     {
-         $('#realtime_timeline').append('<button id="realtime_popup"></button>');
-         $('#realtime_popup').text(SN.msg('realtime_popup'))
-                             .attr('title', SN.msg('realtime_popup_tooltip'))
-                             .bind('click', function() {
-                window.open(url,
-                         '',
-                         'toolbar=no,resizable=yes,scrollbars=yes,status=no,menubar=no,personalbar=no,location=no,width=500,height=550');
-
-             return false;
-         });
-     },
-
-     /**
-      * UI initialization, to be called from Realtime plugin code on popup
-      * compact timeline pages.
-      *
-      * Sets up links in notices to open in a new window.
-      *
-      * @fixme fails to do the same for UI links like context view which will
-      *        look bad in the tiny chromeless window.
-      *
-      * @access public
-      */
-     initPopupWindow: function()
-     {
-         $('.notices .entry-title a, .notices .entry-content a').bind('click', function() {
-            window.open(this.href, '');
-
-            return false;
-         });
-
-         $('#showstream .entity_profile').css({'width':'69%'});
-     }
-}
-
diff --git a/plugins/Realtime/realtimeupdate.min.js b/plugins/Realtime/realtimeupdate.min.js
deleted file mode 100644 (file)
index ad3fb97..0000000
+++ /dev/null
@@ -1 +0,0 @@
-RealtimeUpdate={_userid:0,_showurl:"",_keepaliveurl:"",_closeurl:"",_updatecounter:0,_maxnotices:50,_windowhasfocus:true,_documenttitle:"",_paused:false,_queuedNotices:[],init:function(a,b){RealtimeUpdate._userid=a;RealtimeUpdate._showurl=b;RealtimeUpdate._documenttitle=document.title;$(window).bind("focus",function(){RealtimeUpdate._windowhasfocus=true;RealtimeUpdate._updatecounter=0;RealtimeUpdate.removeWindowCounter()});$(window).bind("blur",function(){$("#notices_primary .notice").removeClass("mark-top");$("#notices_primary .notice:first").addClass("mark-top");RealtimeUpdate._windowhasfocus=false;return false})},receive:function(a){if(RealtimeUpdate.isNoticeVisible(a.id)){return}if(RealtimeUpdate._paused===false){RealtimeUpdate.purgeLastNoticeItem();RealtimeUpdate.insertNoticeItem(a)}else{RealtimeUpdate._queuedNotices.push(a);RealtimeUpdate.updateQueuedCounter()}RealtimeUpdate.updateWindowCounter()},insertNoticeItem:function(a){if(RealtimeUpdate.isNoticeVisible(a.id)){return}RealtimeUpdate.makeNoticeItem(a,function(b){if(RealtimeUpdate.isNoticeVisible(a.id)){return}var c=$(b).attr("id");var d=$("#notices_primary .notices:first");var j=true;var e=d.hasClass("threaded-notices");if(e&&a.in_reply_to_status_id){var g=$("#notice-"+a.in_reply_to_status_id);if(g.length==0){}else{var h=g.closest(".notices");if(h.hasClass("threaded-replies")){g=h.closest(".notice")}d=g.find(".threaded-replies");if(d.length==0){d=$('<ul class="notices threaded-replies xoxo"></ul>');g.append(d);SN.U.NoticeInlineReplyPlaceholder(g)}j=false}}var i=$(b);if(j){d.prepend(i)}else{var f=d.find("li.notice-reply-placeholder");if(f.length>0){i.insertBefore(f)}else{i.appendTo(d)}}i.css({display:"none"}).fadeIn(1000);SN.U.NoticeReplyTo($("#"+c));SN.U.NoticeWithAttachment($("#"+c))})},isNoticeVisible:function(a){return($("#notice-"+a).length>0)},purgeLastNoticeItem:function(){if($("#notices_primary .notice").length>RealtimeUpdate._maxnotices){$("#notices_primary .notice:last").remove()}},updateWindowCounter:function(){if(RealtimeUpdate._windowhasfocus===false){RealtimeUpdate._updatecounter+=1;document.title="("+RealtimeUpdate._updatecounter+") "+RealtimeUpdate._documenttitle}},removeWindowCounter:function(){document.title=RealtimeUpdate._documenttitle},makeNoticeItem:function(b,c){var a=RealtimeUpdate._showurl.replace("0000000000",b.id);$.get(a,{ajax:1},function(f,h,g){var e=$("li.notice:first",f);if(e.length){var d=document._importNode(e[0],true);c(d)}})},makeFavoriteForm:function(c,b){var a;a='<form id="favor-'+c+'" class="form_favor" method="post" action="'+RealtimeUpdate._favorurl+'"><fieldset><legend>Favor this notice</legend><input name="token-'+c+'" type="hidden" id="token-'+c+'" value="'+b+'"/><input name="notice" type="hidden" id="notice-n'+c+'" value="'+c+'"/><input type="submit" id="favor-submit-'+c+'" name="favor-submit-'+c+'" class="submit" value="Favor" title="Favor this notice"/></fieldset></form>';return a},makeReplyLink:function(c,a){var b;b='<a class="notice_reply" href="'+RealtimeUpdate._replyurl+"?replyto="+a+'" title="Reply to this notice">Reply <span class="notice_id">'+c+"</span></a>";return b},makeRepeatForm:function(c,b){var a;a='<form id="repeat-'+c+'" class="form_repeat" method="post" action="'+RealtimeUpdate._repeaturl+'"><fieldset><legend>Repeat this notice?</legend><input name="token-'+c+'" type="hidden" id="token-'+c+'" value="'+b+'"/><input name="notice" type="hidden" id="notice-'+c+'" value="'+c+'"/><input type="submit" id="repeat-submit-'+c+'" name="repeat-submit-'+c+'" class="submit" value="Yes" title="Repeat this notice"/></fieldset></form>';return a},makeDeleteLink:function(c){var b,a;a=RealtimeUpdate._deleteurl.replace("0000000000",c);b='<a class="notice_delete" href="'+a+'" title="Delete this notice">Delete</a>';return b},initActions:function(a,c,d,b,e){$("#notices_primary").prepend('<ul id="realtime_actions"><li id="realtime_playpause"></li><li id="realtime_timeline"></li></ul>');RealtimeUpdate._pluginPath=d;RealtimeUpdate._keepaliveurl=b;RealtimeUpdate._closeurl=e;$(window).unload(function(){$.ajax({type:"POST",url:RealtimeUpdate._closeurl})});setInterval(function(){$.ajax({type:"POST",url:RealtimeUpdate._keepaliveurl})},15*60*1000);RealtimeUpdate.initPlayPause();RealtimeUpdate.initAddPopup(a,c,RealtimeUpdate._pluginPath)},initPlayPause:function(){if(typeof(localStorage)=="undefined"){RealtimeUpdate.showPause()}else{if(localStorage.getItem("RealtimeUpdate_paused")==="true"){RealtimeUpdate.showPlay()}else{RealtimeUpdate.showPause()}}},showPause:function(){RealtimeUpdate.setPause(false);RealtimeUpdate.showQueuedNotices();RealtimeUpdate.addNoticesHover();$("#realtime_playpause").remove();$("#realtime_actions").prepend('<li id="realtime_playpause"><button id="realtime_pause" class="pause"></button></li>');$("#realtime_pause").text(SN.msg("realtime_pause")).attr("title",SN.msg("realtime_pause_tooltip")).bind("click",function(){RealtimeUpdate.removeNoticesHover();RealtimeUpdate.showPlay();return false})},showPlay:function(){RealtimeUpdate.setPause(true);$("#realtime_playpause").remove();$("#realtime_actions").prepend('<li id="realtime_playpause"><span id="queued_counter"></span> <button id="realtime_play" class="play"></button></li>');$("#realtime_play").text(SN.msg("realtime_play")).attr("title",SN.msg("realtime_play_tooltip")).bind("click",function(){RealtimeUpdate.showPause();return false})},setPause:function(a){RealtimeUpdate._paused=a;if(typeof(localStorage)!="undefined"){localStorage.setItem("RealtimeUpdate_paused",RealtimeUpdate._paused)}},showQueuedNotices:function(){$.each(RealtimeUpdate._queuedNotices,function(a,b){RealtimeUpdate.insertNoticeItem(b)});RealtimeUpdate._queuedNotices=[];RealtimeUpdate.removeQueuedCounter()},updateQueuedCounter:function(){$("#realtime_playpause #queued_counter").html("("+RealtimeUpdate._queuedNotices.length+")")},removeQueuedCounter:function(){$("#realtime_playpause #queued_counter").empty()},addNoticesHover:function(){$("#notices_primary .notices").hover(function(){if(RealtimeUpdate._paused===false){RealtimeUpdate.showPlay()}},function(){if(RealtimeUpdate._paused===true){RealtimeUpdate.showPause()}})},removeNoticesHover:function(){$("#notices_primary .notices").unbind()},initAddPopup:function(a,b,c){$("#realtime_timeline").append('<button id="realtime_popup"></button>');$("#realtime_popup").text(SN.msg("realtime_popup")).attr("title",SN.msg("realtime_popup_tooltip")).bind("click",function(){window.open(a,"","toolbar=no,resizable=yes,scrollbars=yes,status=no,menubar=no,personalbar=no,location=no,width=500,height=550");return false})},initPopupWindow:function(){$(".notices .entry-title a, .notices .entry-content a").bind("click",function(){window.open(this.href,"");return false});$("#showstream .entity_profile").css({width:"69%"})}};
\ No newline at end of file
index 0031cf1bf4735b17833c620b743bd52a873f5bae..51d141c28956f684d03d688414c1c774925a483e 100644 (file)
@@ -26,9 +26,7 @@
  * @link      http://status.net/
  */
 
-if (!defined('STATUSNET')) {
-    exit(1);
-}
+if (!defined('GNUSOCIAL') && !defined('STATUSNET')) { exit(1); }
 
 /**
  * Takes parameters:
@@ -56,7 +54,7 @@ class AddMirrorAction extends BaseMirrorAction
      *
      * @return boolean success flag
      */
-    function prepare($args)
+    protected function prepare(array $args=array())
     {
         parent::prepare($args);
         $feedurl = $this->getFeedUrl();
@@ -71,17 +69,13 @@ class AddMirrorAction extends BaseMirrorAction
         switch ($provider) {
         case 'feed':
             return $this->trimmed('feedurl');
-        case 'twitter':
-            $screenie = $this->trimmed('screen_name');
-            $base = 'http://api.twitter.com/1/statuses/user_timeline.atom?screen_name=';
-            return $base . urlencode($screenie);
         default:
             // TRANS: Exception thrown when a feed provider could not be recognised.
             throw new Exception(_m('Internal form error: Unrecognized feed provider.'));
         }
     }
 
-    function saveMirror()
+    protected function saveMirror()
     {
         if ($this->oprofile->subscribe()) {
             SubMirror::saveMirror($this->user, $this->profile);
index bc5e2b541cda7f7134efca7d34be5996dd376586..b3dc1a0517bda905eba2ebce7c64d6a2bacb5ee9 100644 (file)
@@ -26,9 +26,7 @@
  * @link      http://status.net/
  */
 
-if (!defined('STATUSNET')) {
-    exit(1);
-}
+if (!defined('GNUSOCIAL') && !defined('STATUSNET')) { exit(1); }
 
 /**
  * Takes parameters:
@@ -57,7 +55,7 @@ abstract class BaseMirrorAction extends Action
      *
      * @return boolean success flag
      */
-    function prepare($args)
+    protected function prepare(array $args=array())
     {
         parent::prepare($args);
         return $this->sharedBoilerplate();
@@ -101,8 +99,8 @@ abstract class BaseMirrorAction extends Action
             $oprofile = Ostatus_profile::ensureFeedURL($url);
         }
         if ($oprofile->isGroup()) {
-            // TRANS: Client error displayed when trying to mirror a StatusNet group feed.
-            $this->clientError(_m('Cannot mirror a StatusNet group at this time.'));
+            // TRANS: Client error displayed when trying to mirror a GNU social group feed.
+            $this->clientError(_m('Cannot mirror a GNU social group at this time.'));
         }
         $this->oprofile = $oprofile; // @todo FIXME: ugly side effect :D
         return $oprofile->localProfile();
@@ -152,7 +150,7 @@ abstract class BaseMirrorAction extends Action
      *
      * @return void
      */
-    function handle($args)
+    protected function handle()
     {
         // Throws exception on error
         $this->saveMirror();
@@ -174,5 +172,5 @@ abstract class BaseMirrorAction extends Action
         }
     }
 
-    abstract function saveMirror();
+    abstract protected function saveMirror();
 }
index 1119e8718f23182c0395b9540ffbd6d1d672b572..d3d79966b9b4e130c203c4ea0b46ce891a9d00b2 100644 (file)
@@ -26,9 +26,7 @@
  * @link      http://status.net/
  */
 
-if (!defined('STATUSNET')) {
-    exit(1);
-}
+if (!defined('GNUSOCIAL') && !defined('STATUSNET')) { exit(1); }
 
 /**
  * Takes parameters:
@@ -54,7 +52,7 @@ class EditMirrorAction extends BaseMirrorAction
      *
      * @return boolean success flag
      */
-    function prepare($args)
+    protected function prepare(array $args=array())
     {
         parent::prepare($args);
 
@@ -63,7 +61,7 @@ class EditMirrorAction extends BaseMirrorAction
         $this->mirror = SubMirror::pkeyGet(array('subscriber' => $this->user->id,
                                                  'subscribed' => $this->profile->id));
 
-        if (!$this->mirror) {
+        if (!$this->mirror instanceof SubMirror) {
             // TRANS: Client error displayed when trying to edit an object that is not a feed mirror.
             $this->clientError(_m('Requested invalid profile to edit.'));
         }
@@ -88,7 +86,7 @@ class EditMirrorAction extends BaseMirrorAction
         }
     }
 
-    function saveMirror()
+    protected function saveMirror()
     {
         $mirror = SubMirror::getMirror($this->user, $this->profile);
         if (!$mirror) {
index b8e23ca561a5b13e8a63d2a1ed2b09f6910ac4fc..b5a49fe4fadb84846ef0968e46c01e3e60bede6e 100644 (file)
@@ -25,9 +25,7 @@
  * @link      http://status.net/
  */
 
-if (!defined('STATUSNET') && !defined('LACONICA')) {
-    exit(1);
-}
+if (!defined('GNUSOCIAL') && !defined('STATUSNET')) { exit(1); }
 
 class MirrorSettingsAction extends SettingsAction
 {
@@ -52,7 +50,7 @@ class MirrorSettingsAction extends SettingsAction
     {
         // TRANS: Page instructions.
         return _m('You can mirror updates from many RSS and Atom feeds ' .
-                  'into your StatusNet timeline!');
+                  'into your GNU social timeline!');
     }
 
     /**
@@ -103,9 +101,6 @@ class MirrorSettingsAction extends SettingsAction
         switch ($this->arg('provider')) {
         case 'statusnet':
             break;
-        case 'twitter':
-            $form = new AddTwitterMirrorForm($this);
-            break;
         case 'wordpress':
             break;
         case 'linkedin':
diff --git a/plugins/SubMirror/forms/addtwitter.php b/plugins/SubMirror/forms/addtwitter.php
deleted file mode 100644 (file)
index 172d321..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-<?php
-/**
- * StatusNet, the distributed open-source microblogging tool
- * PHP version 5
- *
- * LICENCE: This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- * @package   StatusNet
- * @copyright 2010 StatusNet, Inc.
- * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link      http://status.net/
- */
-
-if (!defined('STATUSNET') && !defined('LACONICA')) {
-    exit(1);
-}
-
-class AddTwitterMirrorForm extends AddMirrorForm
-{
-
-    /**
-     * Visible or invisible data elements
-     *
-     * Display the form fields that make up the data of the form.
-     * Sub-classes should overload this to show their data.
-     *
-     * @return void
-     */
-    function formData()
-    {
-        $this->out->hidden('provider', 'twitter');
-        $this->out->elementStart('fieldset');
-
-        $this->out->elementStart('ul');
-
-        $this->li();
-        $this->doInput('addmirror-feedurl',
-                       'screen_name',
-                       // TRANS: Field label.
-                       _m('Twitter username:'),
-                       $this->out->trimmed('screen_name'));
-        $this->unli();
-
-        $this->li();
-        // TRANS: Button text for adding a Twitter feed mirror.
-        $this->out->submit('addmirror-save', _m('BUTTON','Add feed'));
-        $this->unli();
-        $this->out->elementEnd('ul');
-        $this->out->elementEnd('fieldset');
-    }
-}
diff --git a/plugins/SubMirror/images/providers/twitter.png b/plugins/SubMirror/images/providers/twitter.png
deleted file mode 100644 (file)
index 41dabc8..0000000
Binary files a/plugins/SubMirror/images/providers/twitter.png and /dev/null differ
index 512b2bfa4add66abde9ab9f1280b40ed3421a3b7..0f8ac266eed113ca87c20babcc9024089ab5813a 100644 (file)
@@ -64,18 +64,10 @@ class AddMirrorWizard extends Widget
             // We could accept hostname & username combos here, or
             // webfingery combinations as for remote users.
             array(
-                'id' => 'statusnet',
-                'name' => _m('StatusNet'),
+                'id' => 'gnusocial',
+                'name' => _m('GNU social'),
             ),
              */
-            // Accepts a Twitter username and pulls their user timeline as a
-            // public Atom feed. Requires a working alternate hub which, one
-            // hopes, is getting timely updates.
-            array(
-                'id' => 'twitter',
-                // TRANS: Name for possible feed provider.
-                'name' => _m('Twitter'),
-            ),
             /*
             // WordPress was on our list some whiles ago, but not sure
             // what we can actually do here. Search on Wordpress.com hosted
@@ -85,26 +77,6 @@ class AddMirrorWizard extends Widget
                 'name' => _m('WordPress'),
             ),
              */
-            /*
-            // In theory, Facebook lets you pull public updates over RSS,
-            // but the URLs for your own update feed that I can find from
-            // 2009-era websites no longer seem to work and there's no
-            // good current documentation. May not still be available...
-            // Mirroring from an FB account is probably better done with
-            // the dedicated plugin. (As of March 2011)
-            array(
-                'id' => 'facebook',
-                'name' => _m('Facebook'),
-            ),
-             */
-            /*
-            // LinkedIn doesn't currently seem to have public feeds
-            // for users or groups (March 2011)
-            array(
-                'id' => 'linkedin',
-                'name' => _m('LinkedIn'),
-            ),
-             */
             array(
                 'id' => 'feed',
                 // TRANS: Name for possible feed provider.
index 2d481688aa6f1dc3ead79133fc341cc7926b4420..124d9e2cfaebcd59a63a5ac13273a697bb2e86a2 100644 (file)
@@ -165,12 +165,6 @@ class TwitterImport
             }
         }
 
-        if (empty($notice->conversation)) {
-            $conv = Conversation::create();
-            $notice->conversation = $conv->id;
-            common_log(LOG_INFO, "No known conversation for status {$statusId} so making a new one {$conv->id}.");
-        }
-
         $notice->is_local   = Notice::GATEWAY;
 
         $notice->content  = html_entity_decode($this->linkify($status, FALSE), ENT_QUOTES, 'UTF-8');
@@ -180,11 +174,19 @@ class TwitterImport
 
             $id = $notice->insert();
 
-            if (!$id) {
+            if ($id === false) {
                 common_log_db_error($notice, 'INSERT', __FILE__);
                 common_log(LOG_ERR, __METHOD__ . ' - Problem saving notice.');
             }
 
+            if (empty($notice->conversation)) {
+                $orig = clone($notice);
+                $conv = Conversation::create($notice);
+                common_log(LOG_INFO, "No known conversation for status {$statusId} so a new one ({$conv->id}) was created.");
+                $notice->conversation = $conv->id;
+                $notice->update($orig);
+            }
+
             Event::handle('EndNoticeSave', array($notice));
         }
 
@@ -519,7 +521,7 @@ class TwitterImport
 
     static function tagLink($tag, $orig)
     {
-        return "<a href='https://search.twitter.com/search?q=%23{$tag}' class='hashtag'>{$orig}</a>";
+        return "<a href='https://twitter.com/search?q=%23{$tag}' class='hashtag'>{$orig}</a>";
     }
 
     static function atLink($screenName, $fullName, $orig)
index 720844211a0af26030a0b608a5ebcbdbb45c7a3b..f992a09079299d6bba4691d575445a99f389123f 100644 (file)
@@ -310,7 +310,7 @@ class TwitterOAuthClient extends OAuthClient
 
     function statusesRetweet($id)
     {
-        $url = "http://api.twitter.com/1.1/statuses/retweet/$id.json";
+        $url = "https://api.twitter.com/1.1/statuses/retweet/$id.json";
         $response = $this->oAuthPost($url);
         $status = json_decode($response);
         return $status;
@@ -326,7 +326,7 @@ class TwitterOAuthClient extends OAuthClient
 
     function favoritesCreate($id)
     {
-        $url = "http://api.twitter.com/1.1/favorites/create.json";
+        $url = "https://api.twitter.com/1.1/favorites/create.json";
         $params=array();
         $params['id'] = $id;
         $response = $this->oAuthPost($url, $params);
@@ -344,7 +344,7 @@ class TwitterOAuthClient extends OAuthClient
 
     function favoritesDestroy($id)
     {
-        $url = "http://api.twitter.com/1.1/favorites/destroy.json";
+        $url = "https://api.twitter.com/1.1/favorites/destroy.json";
         $params=array();
         $params['id'] = $id;
         $response = $this->oAuthPost($url,$params);
@@ -362,7 +362,7 @@ class TwitterOAuthClient extends OAuthClient
 
     function statusesDestroy($id)
     {
-        $url = "http://api.twitter.com/1.1/statuses/destroy/$id.json";
+        $url = "https://api.twitter.com/1.1/statuses/destroy/$id.json";
         $response = $this->oAuthPost($url);
         $status = json_decode($response);
         return $status;
index b4e1e57e43be85a25af4e8bfd3b021d1dea21d5c..909060722486deddbfef5639434b91c6cbfbfbfa 100755 (executable)
@@ -37,7 +37,9 @@ require_once INSTALLDIR.'/scripts/commandline.inc';
 
 $daemons = array();
 
-#$daemons[] = INSTALLDIR.'/scripts/queuedaemon.php';
+if (common_config('queue', 'daemon')) {
+    $daemons[] = INSTALLDIR.'/scripts/queuedaemon.php';
+}
 
 if (Event::handle('GetValidDaemons', array(&$daemons))) {
     foreach ($daemons as $daemon) {
diff --git a/scripts/reportsnapshot.php b/scripts/reportsnapshot.php
deleted file mode 100644 (file)
index 71f1019..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/usr/bin/env php
-<?php
-/*
- * StatusNet - the distributed open-source microblogging tool
- * Copyright (C) 2009, StatusNet, Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
-
-$helptext = <<<END_OF_SNAPSHOT_HELP
-Batch script for sending snapshot information about this installation to devs.
-
-END_OF_SNAPSHOT_HELP;
-
-require_once INSTALLDIR.'/scripts/commandline.inc';
-
-Snapshot::check();
index e4634b9e9c59f8b314008468e8c4906865f6c646..0b293847ee0849c1dfe2264afec6847baa0156aa 100644 (file)
Binary files a/theme/neo/logo.png and b/theme/neo/logo.png differ
index cd2e0e7f16d24e832186cf3310dc77c774b29b87..7645fae265e4dd38f0e59c21771e41ee197ba67d 100644 (file)
Binary files a/theme/neo/mobilelogo.png and b/theme/neo/mobilelogo.png differ