Commit 4666732eed57e9d71c341d07f68c340c3a07cb12
1 parent
f1974a22
Brand server without requiring access to FS
PT: 1243391 Added brand management to the admin->misc->manage branding section. The crop facility makes use of jquery.imageareaselect plugin Committed by: Charl Joseph Mert Reviewed by: Megan Watson
Showing
19 changed files
with
2058 additions
and
3 deletions
plugins/ktcore/KTCorePlugin.php
| ... | ... | @@ -192,14 +192,13 @@ class KTCorePlugin extends KTPlugin { |
| 192 | 192 | $this->registerWidget('KTDescriptorSelectionWidget', 'ktcore.widgets.descriptorselection', 'KTWidgets.php'); |
| 193 | 193 | $this->registerWidget('KTCoreFolderCollectionWidget', 'ktcore.widgets.foldercollection', 'KTWidgets.php'); |
| 194 | 194 | $this->registerWidget('KTCoreFolderCollectionWidget', 'ktcore.widgets.foldercollection', 'KTWidgets.php'); |
| 195 | - | |
| 196 | 195 | $this->registerWidget('KTCoreTextAreaWidget', 'ktcore.widgets.textarea', 'KTWidgets.php'); |
| 197 | 196 | $this->registerWidget('KTCoreDateWidget', 'ktcore.widgets.date', 'KTWidgets.php'); |
| 198 | - | |
| 199 | 197 | $this->registerWidget('KTCoreButtonWidget', 'ktcore.widgets.button', 'KTWidgets.php'); |
| 200 | 198 | $this->registerWidget('KTCoreLayerWidget', 'ktcore.widgets.layer', 'KTWidgets.php'); |
| 201 | - | |
| 202 | 199 | $this->registerWidget('KTCoreConditionalSelectionWidget', 'ktcore.widgets.conditionalselection', 'KTWidgets.php'); |
| 200 | + $this->registerWidget('KTCoreImageWidget', 'ktcore.widgets.image', 'KTWidgets.php'); | |
| 201 | + $this->registerWidget('KTCoreImageCropWidget', 'ktcore.widgets.imagecrop', 'KTWidgets.php'); | |
| 203 | 202 | |
| 204 | 203 | $this->registerPage('collection', 'KTCoreCollectionPage', 'KTWidgets.php'); |
| 205 | 204 | $this->registerPage('notifications', 'KTNotificationOverflowPage', 'KTMiscPages.php'); |
| ... | ... | @@ -390,6 +389,10 @@ class KTCorePlugin extends KTPlugin { |
| 390 | 389 | $this->registerAdminPage('views', 'ManageViewDispatcher', 'misc', |
| 391 | 390 | _kt('Manage views'), _kt('Allows you to specify the columns that are to be used by a particular view (e.g. Browse documents, Search)'), |
| 392 | 391 | 'admin/manageViews.php', null); |
| 392 | + $this->registerAdminPage('branding', 'ManageBrandDispatcher', 'misc', | |
| 393 | + _kt('Manage Branding'), _kt('Change customizable branding components of the site e.g. Custom company logo'), | |
| 394 | + 'admin/manageBranding.php', null); | |
| 395 | + | |
| 393 | 396 | |
| 394 | 397 | // plugins |
| 395 | 398 | ... | ... |
plugins/ktcore/KTWidgets.php
| ... | ... | @@ -1036,3 +1036,110 @@ class KTCoreLayerWidget extends KTWidget { |
| 1036 | 1036 | var $sNamespace = 'ktcore.widgets.layer'; |
| 1037 | 1037 | var $sTemplate = 'ktcore/forms/widgets/layer'; |
| 1038 | 1038 | } |
| 1039 | + | |
| 1040 | +class KTCoreImageCropWidget extends KTWidget { | |
| 1041 | + var $sNamespace = 'ktcore.widgets.imagecrop'; | |
| 1042 | + var $sTemplate = 'ktcore/forms/widgets/imagecrop'; | |
| 1043 | + | |
| 1044 | + function configure($aOptions) { | |
| 1045 | + $res = parent::configure($aOptions); | |
| 1046 | + if (PEAR::isError($res)) { | |
| 1047 | + return $res; | |
| 1048 | + } | |
| 1049 | + | |
| 1050 | + // FIXME make required *either* per-action property | |
| 1051 | + // FIXME or a global pref. | |
| 1052 | + $global_required_default = true; | |
| 1053 | + $this->bRequired = (KTUtil::arrayGet($aOptions, 'required', $global_required_default, false) == true); | |
| 1054 | + | |
| 1055 | + $this->src = $aOptions['src']; | |
| 1056 | + $this->alt = $aOptions['alt']; | |
| 1057 | + $this->title = $aOptions['title']; | |
| 1058 | + | |
| 1059 | + } | |
| 1060 | + | |
| 1061 | + function render() { | |
| 1062 | + // very simple, general purpose passthrough. Chances are this is sufficient, | |
| 1063 | + // just override the template being used. | |
| 1064 | + $bHasErrors = false; | |
| 1065 | + if (count($this->aErrors) != 0) { $bHasErrors = true; } | |
| 1066 | + //var_dump($this->aErrors); | |
| 1067 | + $oTemplating =& KTTemplating::getSingleton(); | |
| 1068 | + $oTemplate = $oTemplating->loadTemplate('ktcore/forms/widgets/base'); | |
| 1069 | + | |
| 1070 | + $this->aJavascript[] = 'thirdpartyjs/jquery/jquery-1.3.2.js'; | |
| 1071 | + $this->aJavascript[] = 'thirdpartyjs/jquery/plugins/imageareaselect/scripts/jquery.imgareaselect.pack.js'; | |
| 1072 | + $this->aJavascript[] = 'resources/js/kt_image_crop.js'; | |
| 1073 | + | |
| 1074 | + if (!empty($this->aJavascript)) { | |
| 1075 | + // grab our inner page. | |
| 1076 | + $oPage =& $GLOBALS['main']; | |
| 1077 | + $oPage->requireJSResources($this->aJavascript); | |
| 1078 | + } | |
| 1079 | + | |
| 1080 | + $this->aCSS[] = 'thirdpartyjs/jquery/plugins/imageareaselect/css/imgareaselect-default.css'; | |
| 1081 | + | |
| 1082 | + if (!empty($this->aCSS)) { | |
| 1083 | + // grab our inner page. | |
| 1084 | + $oPage =& $GLOBALS['main']; | |
| 1085 | + $oPage->requireCSSResources($this->aCSS); | |
| 1086 | + } | |
| 1087 | + | |
| 1088 | + $widget_content = $this->getWidget(); | |
| 1089 | + | |
| 1090 | + $aTemplateData = array( | |
| 1091 | + "context" => $this, | |
| 1092 | + "label" => $this->sLabel, | |
| 1093 | + "description" => $this->sDescription, | |
| 1094 | + "name" => $this->sName, | |
| 1095 | + "has_value" => ($this->value !== null), | |
| 1096 | + "value" => $this->value, | |
| 1097 | + "has_errors" => $bHasErrors, | |
| 1098 | + "errors" => $this->aErrors, | |
| 1099 | + "options" => $this->aOptions, | |
| 1100 | + "widget" => $widget_content, | |
| 1101 | + ); | |
| 1102 | + return $oTemplate->render($aTemplateData); | |
| 1103 | + } | |
| 1104 | +} | |
| 1105 | + | |
| 1106 | +class KTCoreImageWidget extends KTWidget { | |
| 1107 | + var $sNamespace = 'ktcore.widgets.image'; | |
| 1108 | + var $sTemplate = 'ktcore/forms/widgets/image'; | |
| 1109 | + | |
| 1110 | + function configure($aOptions) { | |
| 1111 | + $res = parent::configure($aOptions); | |
| 1112 | + if (PEAR::isError($res)) { | |
| 1113 | + return $res; | |
| 1114 | + } | |
| 1115 | + | |
| 1116 | + $this->src = $aOptions['src']; | |
| 1117 | + $this->alt = $aOptions['alt']; | |
| 1118 | + $this->title = $aOptions['title']; | |
| 1119 | + | |
| 1120 | + } | |
| 1121 | + | |
| 1122 | + function render() { | |
| 1123 | + $oTemplating =& KTTemplating::getSingleton(); | |
| 1124 | + $oTemplate = $oTemplating->loadTemplate('ktcore/forms/widgets/base'); | |
| 1125 | + | |
| 1126 | + $widget_content = $this->getWidget(); | |
| 1127 | + | |
| 1128 | + $aTemplateData = array( | |
| 1129 | + "context" => $this, | |
| 1130 | + "label" => $this->sLabel, | |
| 1131 | + "description" => $this->sDescription, | |
| 1132 | + "name" => $this->sName, | |
| 1133 | + "has_value" => ($this->value !== null), | |
| 1134 | + "value" => $this->value, | |
| 1135 | + "has_errors" => $bHasErrors, | |
| 1136 | + "errors" => $this->aErrors, | |
| 1137 | + "options" => $this->aOptions, | |
| 1138 | + "widget" => $widget_content, | |
| 1139 | + ); | |
| 1140 | + return $oTemplate->render($aTemplateData); | |
| 1141 | + } | |
| 1142 | + | |
| 1143 | + | |
| 1144 | +} | |
| 1145 | + | ... | ... |
plugins/ktcore/admin/manageBranding.php
0 โ 100755
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * $Id$ | |
| 4 | + * | |
| 5 | + * KnowledgeTree Community Edition | |
| 6 | + * Document Management Made Simple | |
| 7 | + * Copyright (C) 2008, 2009 KnowledgeTree Inc. | |
| 8 | + * | |
| 9 | + * | |
| 10 | + * This program is free software; you can redistribute it and/or modify it under | |
| 11 | + * the terms of the GNU General Public License version 3 as published by the | |
| 12 | + * Free Software Foundation. | |
| 13 | + * | |
| 14 | + * This program is distributed in the hope that it will be useful, but WITHOUT | |
| 15 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
| 16 | + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | |
| 17 | + * details. | |
| 18 | + * | |
| 19 | + * You should have received a copy of the GNU General Public License | |
| 20 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| 21 | + * | |
| 22 | + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | |
| 23 | + * California 94120-7775, or email info@knowledgetree.com. | |
| 24 | + * | |
| 25 | + * The interactive user interfaces in modified source and object code versions | |
| 26 | + * of this program must display Appropriate Legal Notices, as required under | |
| 27 | + * Section 5 of the GNU General Public License version 3. | |
| 28 | + * | |
| 29 | + * In accordance with Section 7(b) of the GNU General Public License version 3, | |
| 30 | + * these Appropriate Legal Notices must retain the display of the "Powered by | |
| 31 | + * KnowledgeTree" logo and retain the original copyright notice. If the display of the | |
| 32 | + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | |
| 33 | + * must display the words "Powered by KnowledgeTree" and retain the original | |
| 34 | + * copyright notice. | |
| 35 | + * Contributor( s): ______________________________________ | |
| 36 | + */ | |
| 37 | + | |
| 38 | +require_once(KT_LIB_DIR . '/dispatcher.inc.php'); | |
| 39 | +require_once(KT_LIB_DIR . '/templating/templating.inc.php'); | |
| 40 | +require_once(KT_LIB_DIR . '/browse/columnregistry.inc.php'); | |
| 41 | +require_once(KT_LIB_DIR . '/widgets/reorderdisplay.inc.php'); | |
| 42 | +require_once(KT_LIB_DIR . '/widgets/fieldWidgets.php'); | |
| 43 | +require_once(KT_LIB_DIR . "/widgets/FieldsetDisplayRegistry.inc.php"); | |
| 44 | +require_once(KT_LIB_DIR . "/widgets/fieldsetDisplay.inc.php"); | |
| 45 | +require_once(KT_LIB_DIR . "/widgets/widgetfactory.inc.php"); | |
| 46 | +require_once(KT_LIB_DIR . "/validation/dispatchervalidation.inc.php"); | |
| 47 | +require_once(KT_LIB_DIR . "/metadata/fieldsetregistry.inc.php"); | |
| 48 | +require_once(KT_LIB_DIR . "/validation/validatorfactory.inc.php"); | |
| 49 | + | |
| 50 | + | |
| 51 | +class ManageBrandDispatcher extends KTAdminDispatcher { | |
| 52 | + | |
| 53 | + private $maxLogoWidth = 313; | |
| 54 | + private $maxLogoHeight = 50; | |
| 55 | + | |
| 56 | + function check() { | |
| 57 | + | |
| 58 | + $this->aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'], 'name' => _kt('Manage Branding')); | |
| 59 | + return parent::check(); | |
| 60 | + } | |
| 61 | + | |
| 62 | + function do_main() { | |
| 63 | + $uploadLogoForm = $this->getUploadLogoForm(); | |
| 64 | + return $uploadLogoForm->render(); | |
| 65 | + } | |
| 66 | + | |
| 67 | + | |
| 68 | + /** | |
| 69 | + * Returns the upload logo form | |
| 70 | + * @return KTForm | |
| 71 | + * | |
| 72 | + */ | |
| 73 | + | |
| 74 | + function getUploadLogoForm() { | |
| 75 | + $this->oPage->setBreadcrumbDetails(_kt("Upload Logo")); | |
| 76 | + | |
| 77 | + $oForm = new KTForm; | |
| 78 | + $oForm->setOptions(array( | |
| 79 | + 'identifier' => 'ktcore.folder.branding', | |
| 80 | + 'label' => _kt('Upload Logo'), | |
| 81 | + 'submit_label' => _kt('Upload'), | |
| 82 | + 'action' => 'upload', | |
| 83 | + 'fail_action' => 'main', | |
| 84 | + 'encoding' => 'multipart/form-data', | |
| 85 | + 'context' => &$this, | |
| 86 | + 'extraargs' => $this->meldPersistQuery("","",true), | |
| 87 | + 'description' => _kt('The logo upload facility allows you to upload a logo to brand your knowledgetree site.') | |
| 88 | + )); | |
| 89 | + | |
| 90 | + $oWF =& KTWidgetFactory::getSingleton(); | |
| 91 | + | |
| 92 | + $widgets = array(); | |
| 93 | + $validators = array(); | |
| 94 | + | |
| 95 | + // Adding the File Upload Widget | |
| 96 | + $widgets[] = $oWF->get('ktcore.widgets.file', array( | |
| 97 | + 'label' => _kt('Logo File'), | |
| 98 | + 'required' => true, | |
| 99 | + 'name' => 'file', | |
| 100 | + 'id' => 'file', | |
| 101 | + 'value' => '', | |
| 102 | + 'description' => _kt('The logo should be 313px by 50px in dimension. If you don\'t have a 313x50 logo you should choose to either "crop" or "scale" it. If you are certain that your logo has the correct dimentions you can safely skip by the selecting "Don\'t do anything"'), | |
| 103 | + )); | |
| 104 | + | |
| 105 | + $aVocab['crop'] = 'Crop - Cut out a selection'; | |
| 106 | + $aVocab['scale'] = 'Scale - Stretch or Shrink to fit'; | |
| 107 | + $aVocab['nothing'] = 'Don\'t do anything'; | |
| 108 | + | |
| 109 | + //Adding document type lookup widget | |
| 110 | + $widgets[] = $oWF->get('ktcore.widgets.selection',array( | |
| 111 | + 'label' => _kt('Fitting Image'), | |
| 112 | + 'id' => 'logo_action', | |
| 113 | + 'description' => _kt('How would you like to resize the image?'), | |
| 114 | + 'name' => 'resize_method', | |
| 115 | + 'vocab' => $aVocab, | |
| 116 | + 'selected' => 'crop', | |
| 117 | + 'label_method' => 'getName', | |
| 118 | + 'simple_select' => true, | |
| 119 | + )); | |
| 120 | + | |
| 121 | + $oForm->setWidgets($widgets); | |
| 122 | + $oForm->setValidators($validators); | |
| 123 | + | |
| 124 | + // TODO: Should electronic signature be implemented for this? | |
| 125 | + // Implement an electronic signature for accessing the admin section, it will appear every 10 minutes | |
| 126 | + /* //Have to instanciate the oFolder | |
| 127 | + global $default; | |
| 128 | + $iFolderId = $this->oFolder->getId(); | |
| 129 | + if($default->enableESignatures){ | |
| 130 | + $sUrl = KTPluginUtil::getPluginPath('electronic.signatures.plugin', true); | |
| 131 | + $heading = _kt('You are attempting to perform a bulk upload'); | |
| 132 | + $submit['type'] = 'button'; | |
| 133 | + $submit['onclick'] = "javascript: showSignatureForm('{$sUrl}', '{$heading}', 'ktcore.transactions.bulk_upload', 'bulk', 'bulk_upload_form', 'submit', {$iFolderId});"; | |
| 134 | + }else{ | |
| 135 | + $submit['type'] = 'submit'; | |
| 136 | + $submit['onclick'] = ''; | |
| 137 | + } | |
| 138 | + */ | |
| 139 | + | |
| 140 | + return $oForm; | |
| 141 | + } | |
| 142 | + | |
| 143 | + | |
| 144 | + /** | |
| 145 | + * Returns the crop logo form | |
| 146 | + * | |
| 147 | + * This form will assist the user in selecting an area of the image to use as the logo | |
| 148 | + * within predefined dimensions required for the logo to fit properly into the page header. | |
| 149 | + * | |
| 150 | + * @return KTForm | |
| 151 | + * | |
| 152 | + */ | |
| 153 | + | |
| 154 | + function getCropLogoForm($logoFileName = '') { | |
| 155 | + $this->oPage->setBreadcrumbDetails(_kt("Crop Logo")); | |
| 156 | + | |
| 157 | + $oForm = new KTForm; | |
| 158 | + $oForm->setOptions(array( | |
| 159 | + 'identifier' => 'ktcore.folder.branding', | |
| 160 | + 'name' => 'crop_form', | |
| 161 | + 'label' => _kt('Crop Logo'), | |
| 162 | + 'submit_label' => _kt('Crop'), | |
| 163 | + 'action' => 'crop', | |
| 164 | + 'fail_action' => 'main', | |
| 165 | + 'encoding' => 'multipart/form-data', | |
| 166 | + 'context' => &$this, | |
| 167 | + 'extraargs' => $this->meldPersistQuery("","",true), | |
| 168 | + 'description' => _kt('Use this facility to ensure that the logo meets the required dimensions for the header.') | |
| 169 | + )); | |
| 170 | + | |
| 171 | + $oWF =& KTWidgetFactory::getSingleton(); | |
| 172 | + | |
| 173 | + $widgets = array(); | |
| 174 | + $validators = array(); | |
| 175 | + | |
| 176 | + $logoFile = 'var'.DIRECTORY_SEPARATOR.'branding'.DIRECTORY_SEPARATOR.'logo'.DIRECTORY_SEPARATOR.$logoFileName; | |
| 177 | + | |
| 178 | + // Adding the Image Crop Widget | |
| 179 | + $widgets[] = $oWF->get('ktcore.widgets.imagecrop', array( | |
| 180 | + 'label' => _kt('Crop Logo'), | |
| 181 | + //'name' => 'Logo', | |
| 182 | + 'value' => $logoFile, | |
| 183 | + 'description' => _kt('To crop an area of the logo, click and drag the resizable rectangle over the image.'), | |
| 184 | + )); | |
| 185 | + | |
| 186 | + // Adding the Hidden FileName Input String | |
| 187 | + $widgets[] = $oWF->get('ktcore.widgets.hidden', array( | |
| 188 | + 'name' => 'logo_file_name', | |
| 189 | + 'value' => $logoFileName, | |
| 190 | + )); | |
| 191 | + | |
| 192 | + // Adding the Hidden Coordinates X1 | |
| 193 | + $widgets[] = $oWF->get('ktcore.widgets.hidden', array( | |
| 194 | + 'name' => 'crop_x1', | |
| 195 | + 'value' => 'x1test', | |
| 196 | + )); | |
| 197 | + | |
| 198 | + // Adding the Hidden Coordinates Y1 | |
| 199 | + $widgets[] = $oWF->get('ktcore.widgets.hidden', array( | |
| 200 | + 'name' => 'crop_y1', | |
| 201 | + 'value' => '', | |
| 202 | + )); | |
| 203 | + | |
| 204 | + // Adding the Hidden Coordinates X2 | |
| 205 | + $widgets[] = $oWF->get('ktcore.widgets.hidden', array( | |
| 206 | + 'name' => 'crop_x2', | |
| 207 | + 'value' => '', | |
| 208 | + )); | |
| 209 | + | |
| 210 | + // Adding the Hidden Coordinates Y2 | |
| 211 | + $widgets[] = $oWF->get('ktcore.widgets.hidden', array( | |
| 212 | + 'name' => 'crop_y2', | |
| 213 | + 'value' => '', | |
| 214 | + )); | |
| 215 | + | |
| 216 | + $oForm->setWidgets($widgets); | |
| 217 | + $oForm->setValidators($validators); | |
| 218 | + | |
| 219 | + return $oForm; | |
| 220 | + } | |
| 221 | + | |
| 222 | + /** | |
| 223 | + * Returns the apply logo form | |
| 224 | + * | |
| 225 | + * This form will display a preview of the correctly sized logo and prompt the user to apply it. | |
| 226 | + * | |
| 227 | + * @return KTForm | |
| 228 | + * | |
| 229 | + */ | |
| 230 | + | |
| 231 | + function getApplyLogoForm($logoFileName = '') { | |
| 232 | + $this->oPage->setBreadcrumbDetails(_kt("Apply Logo")); | |
| 233 | + | |
| 234 | + $oForm = new KTForm; | |
| 235 | + $oForm->setOptions(array( | |
| 236 | + 'identifier' => 'ktcore.folder.branding', | |
| 237 | + 'label' => _kt('Apply Logo'), | |
| 238 | + 'submit_label' => _kt('Apply'), | |
| 239 | + 'action' => 'apply', | |
| 240 | + 'fail_action' => 'main', | |
| 241 | + 'encoding' => 'multipart/form-data', | |
| 242 | + 'context' => &$this, | |
| 243 | + 'extraargs' => $this->meldPersistQuery("","",true), | |
| 244 | + 'description' => _kt('Applying the logo will activate it in the header making it visible to all who access this site.') | |
| 245 | + )); | |
| 246 | + | |
| 247 | + $oWF =& KTWidgetFactory::getSingleton(); | |
| 248 | + | |
| 249 | + $widgets = array(); | |
| 250 | + $validators = array(); | |
| 251 | + | |
| 252 | + $logoFileName = 'var'.DIRECTORY_SEPARATOR.'branding'.DIRECTORY_SEPARATOR.'logo'.DIRECTORY_SEPARATOR.$logoFileName; | |
| 253 | + | |
| 254 | + // Adding the Image Crop Widget | |
| 255 | + $widgets[] = $oWF->get('ktcore.widgets.image', array( | |
| 256 | + 'label' => _kt('Logo Preview'), | |
| 257 | + 'name' => $logoFileName, // title and alt attributes get set to this. | |
| 258 | + 'value' => $logoFileName, | |
| 259 | + )); | |
| 260 | + | |
| 261 | + // Adding the Hidden FileName Input String | |
| 262 | + $widgets[] = $oWF->get('ktcore.widgets.hidden', array( | |
| 263 | + 'name' => 'logo_file_name', | |
| 264 | + 'value' => $logoFileName, | |
| 265 | + )); | |
| 266 | + | |
| 267 | + $oForm->setWidgets($widgets); | |
| 268 | + $oForm->setValidators($validators); | |
| 269 | + | |
| 270 | + return $oForm; | |
| 271 | + } | |
| 272 | + | |
| 273 | + | |
| 274 | + /* | |
| 275 | + * Action responsible for uploading the logo | |
| 276 | + * | |
| 277 | + */ | |
| 278 | + | |
| 279 | + function do_upload(){ | |
| 280 | + global $default; | |
| 281 | + | |
| 282 | + $oForm = $this->getUploadLogoForm(); | |
| 283 | + $res = $oForm->validate(); | |
| 284 | + if (!empty($res['errors'])) { | |
| 285 | + return $oForm->handleError(); | |
| 286 | + } | |
| 287 | + | |
| 288 | + // Setting up the branding directory, logos will be stored in var/branding/ | |
| 289 | + $brandDir = $default->varDirectory.DIRECTORY_SEPARATOR.'branding'; | |
| 290 | + | |
| 291 | + if (stristr(PHP_OS,'WIN')) { | |
| 292 | + $brandDir = str_replace('/', '\\', $brandDir); | |
| 293 | + } | |
| 294 | + | |
| 295 | + //if branding dir does not exist, generate one and add an index file to block access | |
| 296 | + if (!file_exists($brandDir)) { | |
| 297 | + mkdir($brandDir, 0755); | |
| 298 | + touch($brandDir.DIRECTORY_SEPARATOR.'index.html'); | |
| 299 | + file_put_contents($brandDir.DIRECTORY_SEPARATOR.'index.html', 'You do not have permission to access this directory.'); | |
| 300 | + } | |
| 301 | + | |
| 302 | + $logoDir = $brandDir.DIRECTORY_SEPARATOR."logo"; | |
| 303 | + //if branding dir does not exist, generate one and add an index file to block access | |
| 304 | + if (!file_exists($logoDir)) { | |
| 305 | + mkdir($logoDir, 0755); | |
| 306 | + touch($logoDir.DIRECTORY_SEPARATOR.'index.html'); | |
| 307 | + file_put_contents($logoDir.DIRECTORY_SEPARATOR.'index.html', 'You do not have permission to access this directory.'); | |
| 308 | + } | |
| 309 | + | |
| 310 | + $logoFileName = $_FILES['_kt_attempt_unique_file']['name']; | |
| 311 | + | |
| 312 | + //Changing to logo.jpg (Need to preserve extention as GD requires the exact image type to work) | |
| 313 | + $ext = end(explode('.', $logoFileName)); | |
| 314 | + $logoFileName = 'logo_tmp.'.$ext; | |
| 315 | + $logoFile = $logoDir.DIRECTORY_SEPARATOR.$logoFileName; | |
| 316 | + | |
| 317 | + // deleting old tmp file | |
| 318 | + if (file_exists($logoFile)) { | |
| 319 | + @unlink($logoFile); | |
| 320 | + } | |
| 321 | + | |
| 322 | + //TODO: Test Upload Failure by setting the $logoFile to '' | |
| 323 | + | |
| 324 | + if(!move_uploaded_file($_FILES['_kt_attempt_unique_file']['tmp_name'], $logoFile)) { | |
| 325 | + $default->log->error("Couldn't upload file from '".$_FILES['_kt_attempt_unique_file']['tmp_name']."' to '$logoFile'"); | |
| 326 | + $this->errorRedirectToMain("Couldn't upload file"); | |
| 327 | + exit(0); | |
| 328 | + } | |
| 329 | + | |
| 330 | + $resizeMethod = $_REQUEST['data']['resize_method']; | |
| 331 | + | |
| 332 | + switch ($resizeMethod) { | |
| 333 | + case 'crop': | |
| 334 | + $cropLogoForm = $this->getCropLogoForm($logoFileName); | |
| 335 | + return $cropLogoForm->render(); | |
| 336 | + | |
| 337 | + case 'scale': | |
| 338 | + $type = $_FILES['_kt_attempt_unique_file']['type']; | |
| 339 | + $res = $this->scaleImage($logoFile, $logoFile, $this->maxLogoWidth, $this->maxLogoHeight, $type); | |
| 340 | + | |
| 341 | + $form = $this->getApplyLogoForm($logoFileName); | |
| 342 | + return $form->render(); | |
| 343 | + | |
| 344 | + default: | |
| 345 | + $form = $this->getApplyLogoForm($logoFileName); | |
| 346 | + return $form->render(); | |
| 347 | + } | |
| 348 | + | |
| 349 | + } | |
| 350 | + | |
| 351 | + | |
| 352 | + /* | |
| 353 | + * This method uses the GD library to scale an image. | |
| 354 | + * - Supported images are jpeg, png and gif | |
| 355 | + * | |
| 356 | + */ | |
| 357 | + public function scaleImage( $origFile, $destFile, $width, $height, $type = 'image/jpeg', $scaleUp = true) { | |
| 358 | + global $default; | |
| 359 | + | |
| 360 | + //Requires the GD library if not exit gracefully | |
| 361 | + if (!extension_loaded('gd')) { | |
| 362 | + $default->log->error("The GD library isn't loaded"); | |
| 363 | + return false; | |
| 364 | + } | |
| 365 | + | |
| 366 | + switch($type) { | |
| 367 | + case 'image/jpeg': | |
| 368 | + $orig = imagecreatefromjpeg($origFile); | |
| 369 | + break; | |
| 370 | + case 'image/pjpeg': | |
| 371 | + $orig = imagecreatefromjpeg($origFile); | |
| 372 | + break; | |
| 373 | + case 'image/png': | |
| 374 | + $orig = imagecreatefrompng($origFile); | |
| 375 | + break; | |
| 376 | + case 'image/gif': | |
| 377 | + $orig = imagecreatefromgif($origFile); | |
| 378 | + break; | |
| 379 | + default: | |
| 380 | + //Handle Error | |
| 381 | + $default->log->error("Tried to scale an unsupported file type: $type"); | |
| 382 | + return false; | |
| 383 | + } | |
| 384 | + | |
| 385 | + if($orig) { | |
| 386 | + /* | |
| 387 | + * calculate the size of the new image. | |
| 388 | + */ | |
| 389 | + $orig_x = imagesx($orig); | |
| 390 | + $orig_y = imagesy($orig); | |
| 391 | + | |
| 392 | + if (($orig_x < $width) && ($orig_y < $height)) { | |
| 393 | + //Image Qualifies for Upscaling | |
| 394 | + //If we're not going to scale up then exit here. | |
| 395 | + if (!$scaleUp) { | |
| 396 | + return true; | |
| 397 | + } | |
| 398 | + } | |
| 399 | + | |
| 400 | + $image_x = $width; | |
| 401 | + $image_y = $height; | |
| 402 | + //$image_y = round(($orig_y * $image_x) / $orig_x); //Preserve proportion | |
| 403 | + | |
| 404 | + /* | |
| 405 | + * create the new image, and scale the original into it. | |
| 406 | + */ | |
| 407 | + $image = imagecreatetruecolor($image_x, $image_y); | |
| 408 | + imagecopyresampled($image, $orig, 0, 0, 0, 0, $image_x, $image_y, $orig_x, $orig_y); | |
| 409 | + | |
| 410 | + switch($type) { | |
| 411 | + case 'image/jpeg': | |
| 412 | + imagejpeg($image, $destFile); | |
| 413 | + break; | |
| 414 | + case 'image/pjpeg': | |
| 415 | + imagejpeg($image, $destFile); | |
| 416 | + break; | |
| 417 | + case 'image/png': | |
| 418 | + imagepng($image, $destFile); | |
| 419 | + break; | |
| 420 | + case 'image/gif': | |
| 421 | + imagegif($image, $destFile); | |
| 422 | + break; | |
| 423 | + default: | |
| 424 | + //Handle Error | |
| 425 | + $default->log->error("Tried to scale an unsupported file type: $type"); | |
| 426 | + return false; | |
| 427 | + } | |
| 428 | + | |
| 429 | + | |
| 430 | + } else { | |
| 431 | + //Handle Error | |
| 432 | + $default->log->error("Couldn't obtain a valid GD resource"); | |
| 433 | + $default->log->error($sourceFile); | |
| 434 | + $default->log->error($destFile); | |
| 435 | + return false; | |
| 436 | + } | |
| 437 | + | |
| 438 | + return true; | |
| 439 | + } | |
| 440 | + | |
| 441 | + | |
| 442 | + /* | |
| 443 | + * Action responsible for cropping the logo | |
| 444 | + * | |
| 445 | + */ | |
| 446 | + function do_crop(){ | |
| 447 | + global $default; | |
| 448 | + | |
| 449 | + $logoFileName = $_REQUEST['data']['logo_file_name']; | |
| 450 | + $logoFile = 'var'.DIRECTORY_SEPARATOR.'branding'.DIRECTORY_SEPARATOR.'logo'.DIRECTORY_SEPARATOR.$logoFileName; | |
| 451 | + | |
| 452 | + $x1 = $_REQUEST['data']['crop_x1']; | |
| 453 | + $y1 = $_REQUEST['data']['crop_y1']; | |
| 454 | + | |
| 455 | + $x2 = $_REQUEST['data']['crop_x2']; | |
| 456 | + $y2 = $_REQUEST['data']['crop_y2']; | |
| 457 | + | |
| 458 | + $type = $this->getMime($logoFileName); | |
| 459 | + | |
| 460 | + //GD Crop | |
| 461 | + $res = $this->cropImage($logoFile, $logoFile, $x1, $y1, $x2, $y2, $type); | |
| 462 | + | |
| 463 | + //If dimensions don't conform then will scale it further | |
| 464 | + $width = $x2 - $x1; | |
| 465 | + $height = $y2 - $y1; | |
| 466 | + | |
| 467 | + if (($width > $this->maxLogoWidth) || ($height > $this->maxLogoHeight)) { | |
| 468 | + $default->log->info('SCALING IMAGE AFTER CROP'); | |
| 469 | + $res = $this->scaleImage($logoFile, $logoFile, $this->maxLogoWidth, $this->maxLogoHeight, $type); | |
| 470 | + } | |
| 471 | + | |
| 472 | + // ImageMagick Crop | |
| 473 | + /* | |
| 474 | + // do generation | |
| 475 | + $pathConvert = (!empty($default->convertPath)) ? $default->convertPath : 'convert'; | |
| 476 | + | |
| 477 | + // windows path may contain spaces | |
| 478 | + if (stristr(PHP_OS,'WIN')) { | |
| 479 | + $cmd = "\"{$pathConvert}\" \"{$logoFileName}" . $pageNumber . "\" -crop 313x50+110+110 \"$logoFileName\""; | |
| 480 | + } | |
| 481 | + else { | |
| 482 | + $cmd = "{$pathConvert} {$logoFileName}" . $pageNumber . " -resize 313x50 $logoFileName"; | |
| 483 | + } | |
| 484 | + | |
| 485 | + $result = KTUtil::pexec($cmd); | |
| 486 | + */ | |
| 487 | + | |
| 488 | + $applyLogoForm = $this->getApplyLogoForm($logoFileName); | |
| 489 | + return $applyLogoForm->render(); | |
| 490 | + | |
| 491 | + } | |
| 492 | + | |
| 493 | + | |
| 494 | + /** | |
| 495 | + * Returns the MIME of the filename, deducted from its extension | |
| 496 | + * If the extension is unknown, returns "image/jpeg" | |
| 497 | + */ | |
| 498 | + function getMime($filename) | |
| 499 | + { | |
| 500 | + $pos = strrpos($filename, '.'); | |
| 501 | + $extension = ""; | |
| 502 | + if ($pos !== false) { | |
| 503 | + $extension = strtolower(substr($filename, $pos+1)); | |
| 504 | + } | |
| 505 | + | |
| 506 | + switch($extension) { | |
| 507 | + case 'gif': | |
| 508 | + return 'image/gif'; | |
| 509 | + case 'jfif': | |
| 510 | + return 'image/jpeg'; | |
| 511 | + case 'jfif-tbnl': | |
| 512 | + return 'image/jpeg'; | |
| 513 | + case 'png': | |
| 514 | + return 'image/png'; | |
| 515 | + case 'jpe': | |
| 516 | + return 'image/jpeg'; | |
| 517 | + case 'jpeg': | |
| 518 | + return 'image/jpeg'; | |
| 519 | + case 'jpg': | |
| 520 | + return 'image/jpeg'; | |
| 521 | + default: | |
| 522 | + return 'image/jpeg'; | |
| 523 | + } | |
| 524 | + } | |
| 525 | + | |
| 526 | + /* | |
| 527 | + * This method uses the GD library to crop an image. | |
| 528 | + * - Supported images are jpeg, png and gif | |
| 529 | + * | |
| 530 | + */ | |
| 531 | + public function cropImage( $origFile, $destFile, $x1, $y1, $x2, $y2, $type = 'image/jpeg', $scaleUp = true) { | |
| 532 | + global $default; | |
| 533 | + | |
| 534 | + $width = $x2 - $x1; | |
| 535 | + $height = $y2 - $y1; | |
| 536 | + | |
| 537 | + //Requires the GD library if not exit gracefully | |
| 538 | + if (!extension_loaded('gd')) { | |
| 539 | + $default->log->error("The GD library isn't loaded"); | |
| 540 | + return false; | |
| 541 | + } | |
| 542 | + | |
| 543 | + switch($type) { | |
| 544 | + case 'image/jpeg': | |
| 545 | + $orig = imagecreatefromjpeg($origFile); | |
| 546 | + break; | |
| 547 | + case 'image/pjpeg': | |
| 548 | + $orig = imagecreatefromjpeg($origFile); | |
| 549 | + break; | |
| 550 | + case 'image/png': | |
| 551 | + $orig = imagecreatefrompng($origFile); | |
| 552 | + break; | |
| 553 | + case 'image/gif': | |
| 554 | + $orig = imagecreatefromgif($origFile); | |
| 555 | + break; | |
| 556 | + default: | |
| 557 | + //Handle Error | |
| 558 | + $default->log->error("Tried to crop an unsupported file type: $type"); | |
| 559 | + return false; | |
| 560 | + } | |
| 561 | + | |
| 562 | + if($orig) { | |
| 563 | + /* | |
| 564 | + * create the new image, and crop it. | |
| 565 | + */ | |
| 566 | + $image = imagecreatetruecolor($width, $height); | |
| 567 | + //imagecopyresampled($image, $orig, 0, 0, 0, 0, $image_x, $image_y, $orig_x, $orig_y); | |
| 568 | + | |
| 569 | + // Generate the cropped image | |
| 570 | + imagecopyresampled($image, $orig, 0, 0, $x1, $y1, $width, $height, $width, $height); | |
| 571 | + //imagecopyresized($canvas, $piece, 0,0, $cropLeft, $cropHeight,$newwidth, $newheight, $width, $height); | |
| 572 | + | |
| 573 | + switch($type) { | |
| 574 | + case 'image/jpeg': | |
| 575 | + imagejpeg($image, $destFile); | |
| 576 | + break; | |
| 577 | + case 'image/pjpeg': | |
| 578 | + imagejpeg($image, $destFile); | |
| 579 | + break; | |
| 580 | + case 'image/png': | |
| 581 | + imagepng($image, $destFile); | |
| 582 | + break; | |
| 583 | + case 'image/gif': | |
| 584 | + imagegif($image, $destFile); | |
| 585 | + break; | |
| 586 | + default: | |
| 587 | + //Handle Error | |
| 588 | + $default->log->error("Tried to crop an unsupported file type: $type"); | |
| 589 | + return false; | |
| 590 | + } | |
| 591 | + | |
| 592 | + | |
| 593 | + } else { | |
| 594 | + //Handle Error | |
| 595 | + $default->log->error("Couldn't obtain a valid GD resource $sourceFile $destFile"); | |
| 596 | + return false; | |
| 597 | + } | |
| 598 | + | |
| 599 | + return true; | |
| 600 | + } | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + /* | |
| 605 | + * Action responsible for applying the logo | |
| 606 | + * | |
| 607 | + */ | |
| 608 | + function do_apply(){ | |
| 609 | + global $default; | |
| 610 | + | |
| 611 | + $rootPath = $default->varDirectory . '/'; | |
| 612 | + | |
| 613 | + $tmpLogoFileName = $_REQUEST['data']['logo_file_name']; | |
| 614 | + $tmpLogoFileName = end(explode(DIRECTORY_SEPARATOR, $tmpLogoFileName)); | |
| 615 | + $tmpLogoFile = $default->varDirectory.DIRECTORY_SEPARATOR.'branding'.DIRECTORY_SEPARATOR.'logo'.DIRECTORY_SEPARATOR.$tmpLogoFileName; | |
| 616 | + | |
| 617 | + $ext = end(explode('.', $tmpLogoFileName)); | |
| 618 | + $logoFileName = 'logo_'.md5(Date('ymd-hms')).'.'.$ext; | |
| 619 | + $logoFile = $default->varDirectory.DIRECTORY_SEPARATOR.'branding'.DIRECTORY_SEPARATOR.'logo'.DIRECTORY_SEPARATOR.$logoFileName; | |
| 620 | + | |
| 621 | + $logoFileRel = end(explode(DIRECTORY_SEPARATOR, $default->varDirectory)).DIRECTORY_SEPARATOR.'branding'.DIRECTORY_SEPARATOR.'logo'.DIRECTORY_SEPARATOR.$logoFileName; | |
| 622 | + | |
| 623 | + // Applying the new logo | |
| 624 | + if(!@copy($tmpLogoFile, $logoFile)){ | |
| 625 | + $default->log->info("Couldn't copy logo ".$tmpLogoFile." to ".$logoFile); | |
| 626 | + } else { | |
| 627 | + //Cleaning stale files | |
| 628 | + $brandDir = $default->varDirectory.DIRECTORY_SEPARATOR.'branding'.DIRECTORY_SEPARATOR.'logo'.DIRECTORY_SEPARATOR; | |
| 629 | + $handle = opendir($brandDir); | |
| 630 | + while (false !== ($file = readdir($handle))) { | |
| 631 | + if (!is_dir($file) && $file != 'logo_tmp.jpg' && $file != $logoFileName) { | |
| 632 | + if (!@unlink($brandDir.$file)) { | |
| 633 | + $default->log->error("Couldn't delete '".$brandDir.$file."'"); | |
| 634 | + } | |
| 635 | + } | |
| 636 | + } | |
| 637 | + } | |
| 638 | + | |
| 639 | + // | |
| 640 | + // Updating Config Settings with the new Logo Location | |
| 641 | + // | |
| 642 | + | |
| 643 | + $sql = "SELECT id from config_settings WHERE item = 'companyLogo'"; | |
| 644 | + $companyLogoId = DBUtil::getOneResultKey($sql,'id'); | |
| 645 | + if (PEAR::isError($companyLogoId)) | |
| 646 | + { | |
| 647 | + if (PEAR::isError($res)) { | |
| 648 | + $default->log->error(sprintf(_kt("Failed to apply logo: %s"), $res->getMessage())); | |
| 649 | + $this->errorRedirectToMain(sprintf(_kt("Failed to apply logo: %s"), $res->getMessage())); | |
| 650 | + exit(); | |
| 651 | + } | |
| 652 | + } | |
| 653 | + | |
| 654 | + $res = DBUtil::autoUpdate('config_settings', array('value' => $logoFileRel), $companyLogoId); | |
| 655 | + if (PEAR::isError($res)) { | |
| 656 | + $default->log->error(sprintf(_kt("Failed to apply logo: %s"), $res->getMessage())); | |
| 657 | + $this->errorRedirectToMain(sprintf(_kt("Failed to apply logo: %s"), $res->getMessage())); | |
| 658 | + exit(); | |
| 659 | + } | |
| 660 | + | |
| 661 | + // Clear the cached settings | |
| 662 | + $oKTConfig = new KTConfig(); | |
| 663 | + $oKTConfig->clearCache(); | |
| 664 | + | |
| 665 | + $this->successRedirectTo('', _kt("Logo succesfully applied.")); | |
| 666 | + } | |
| 667 | + | |
| 668 | + | |
| 669 | + /* | |
| 670 | + | |
| 671 | + Old Manage Views Code! | |
| 672 | + Crap, must delete | |
| 673 | + | |
| 674 | + */ | |
| 675 | + function do_editView() { | |
| 676 | + $oTemplating =& KTTemplating::getSingleton(); | |
| 677 | + $oTemplate = $oTemplating->loadTemplate('ktcore/misc/columns/edit_view'); | |
| 678 | + | |
| 679 | + $oColumnRegistry =& KTColumnRegistry::getSingleton(); | |
| 680 | + $aColumns = $oColumnRegistry->getColumnsForView($_REQUEST['viewNS']); | |
| 681 | + //var_dump($aColumns); exit(0); | |
| 682 | + $aAllColumns = $oColumnRegistry->getColumns(); | |
| 683 | + | |
| 684 | + $view_name = $oColumnRegistry->getViewName(($_REQUEST['viewNS'])); | |
| 685 | + $this->oPage->setTitle($view_name); | |
| 686 | + $this->oPage->setBreadcrumbDetails($view_name); | |
| 687 | + | |
| 688 | + $aOptions = array(); | |
| 689 | + $vocab = array(); | |
| 690 | + foreach ($aAllColumns as $aInfo) { | |
| 691 | + $vocab[$aInfo['namespace']] = $aInfo['name']; | |
| 692 | + } | |
| 693 | + $aOptions['vocab'] = $vocab; | |
| 694 | + $add_field = new KTLookupWidget(_kt("Columns"), _kt("Select a column to add to the view. Please note that while you can add multiple copies of a column, they will all behave as a single column"), 'column_ns', null, $this->oPage, true, null, $aErrors = null, $aOptions); | |
| 695 | + | |
| 696 | + $aTemplateData = array( | |
| 697 | + 'context' => $this, | |
| 698 | + 'current_columns' => $aColumns, | |
| 699 | + 'all_columns' => $aAllColumns, | |
| 700 | + 'view' => $_REQUEST['viewNS'], | |
| 701 | + 'add_field' => $add_field, | |
| 702 | + ); | |
| 703 | + return $oTemplate->render($aTemplateData); | |
| 704 | + } | |
| 705 | + | |
| 706 | + function do_deleteEntry() { | |
| 707 | + $entry_id = KTUtil::arrayGet($_REQUEST, 'entry_id'); | |
| 708 | + $view = KTUtil::arrayGet($_REQUEST, 'viewNS'); | |
| 709 | + | |
| 710 | + // none of these conditions can be reached "normally". | |
| 711 | + | |
| 712 | + $oEntry = KTColumnEntry::get($entry_id); | |
| 713 | + if (PEAR::isError($oEntry)) { | |
| 714 | + $this->errorRedirectToMain(_kt("Unable to locate the entry")); | |
| 715 | + } | |
| 716 | + | |
| 717 | + if ($oEntry->getRequired()) { | |
| 718 | + $this->errorRedirectToMain(_kt("That column is required")); | |
| 719 | + } | |
| 720 | + | |
| 721 | + if ($oEntry->getViewNamespace() != $view) { | |
| 722 | + $this->errorRedirectToMain(_kt("That column is not for the specified view")); | |
| 723 | + } | |
| 724 | + | |
| 725 | + $res = $oEntry->delete(); | |
| 726 | + | |
| 727 | + if (PEAR::isError($res)) { | |
| 728 | + $this->errorRedirectToMain(sprintf(_kt("Failed to remove that column: %s"), $res->getMessage())); | |
| 729 | + } | |
| 730 | + | |
| 731 | + $this->successRedirectTo("editView", _kt("Deleted Entry"), sprintf("viewNS=%s", $view)); | |
| 732 | + } | |
| 733 | + | |
| 734 | + function do_addEntry() { | |
| 735 | + $column_ns = KTUtil::arrayGet($_REQUEST, 'column_ns'); | |
| 736 | + $view = KTUtil::arrayGet($_REQUEST, 'viewNS'); | |
| 737 | + | |
| 738 | + $this->startTransaction(); | |
| 739 | + | |
| 740 | + $position = KTColumnEntry::getNextEntryPosition($view); | |
| 741 | + $oEntry = KTColumnEntry::createFromArray(array( | |
| 742 | + 'ColumnNamespace' => $column_ns, | |
| 743 | + 'ViewNamespace' => $view, | |
| 744 | + 'Position' => $position, // start it at the bottom | |
| 745 | + 'config' => array(), // stub, for now. | |
| 746 | + 'Required' => 0 | |
| 747 | + )); | |
| 748 | + | |
| 749 | + $this->successRedirectTo("editView", _kt("Added Entry"), sprintf("viewNS=%s", $view)); | |
| 750 | + } | |
| 751 | + | |
| 752 | + function do_orderUp(){ | |
| 753 | + $entryId = $_REQUEST['entry_id']; | |
| 754 | + $view = $_REQUEST['viewNS']; | |
| 755 | + | |
| 756 | + $oEntry = KTColumnEntry::get($entryId); | |
| 757 | + if (PEAR::isError($oEntry)) { | |
| 758 | + $this->errorRedirectTo('editView', _kt('Unable to locate the column entry'), "viewNS={$view}"); | |
| 759 | + exit(); | |
| 760 | + } | |
| 761 | + | |
| 762 | + $res = $oEntry->movePosition($view, $entryId, 'up'); | |
| 763 | + if (PEAR::isError($res)) { | |
| 764 | + $this->errorRedirectTo('editView', $res->getMessage(), "viewNS={$view}"); | |
| 765 | + exit(); | |
| 766 | + } | |
| 767 | + | |
| 768 | + $this->redirectTo('editView', "viewNS={$view}"); | |
| 769 | + } | |
| 770 | + | |
| 771 | + function do_orderDown(){ | |
| 772 | + $entryId = $_REQUEST['entry_id']; | |
| 773 | + $view = $_REQUEST['viewNS']; | |
| 774 | + | |
| 775 | + $oEntry = KTColumnEntry::get($entryId); | |
| 776 | + if (PEAR::isError($oEntry)) { | |
| 777 | + $this->errorRedirectTo('editView', _kt('Unable to locate the column entry'), "viewNS={$view}"); | |
| 778 | + exit(); | |
| 779 | + } | |
| 780 | + | |
| 781 | + $res = $oEntry->movePosition($view, $entryId, 'down'); | |
| 782 | + if (PEAR::isError($res)) { | |
| 783 | + $this->errorRedirectTo('editView', $res->getMessage(), "viewNS={$view}"); | |
| 784 | + exit(); | |
| 785 | + } | |
| 786 | + | |
| 787 | + $this->redirectTo("editView", "viewNS={$view}"); | |
| 788 | + } | |
| 789 | + | |
| 790 | +} | |
| 791 | + | |
| 792 | +?> | ... | ... |
resources/js/kt_image_crop.js
0 โ 100755
| 1 | +jQuery(function () { | |
| 2 | + //TODO: Draw attributes and config options from widget attributes | |
| 3 | + //jQuery('#kt_image_to_crop').imgAreaSelect({ maxWidth: 200, maxHeight: 150, handles: true }); | |
| 4 | + //jQuery('#kt_image_to_crop').imgAreaSelect({ aspectRatio: '4:3', handles: true }); | |
| 5 | + jQuery('#kt_image_to_crop').imgAreaSelect({ | |
| 6 | + x1: 0, | |
| 7 | + y1: 0, | |
| 8 | + x2: 313, | |
| 9 | + y2: 50, | |
| 10 | + handles: true | |
| 11 | + }); | |
| 12 | +}); | |
| 13 | + | |
| 14 | +jQuery(document).ready(function() { | |
| 15 | + jQuery('#kt_image_to_crop').imgAreaSelect({ | |
| 16 | + onSelectEnd: function (img, selection) { | |
| 17 | + jQuery('input[name="data[crop_x1]"]').val(selection.x1); | |
| 18 | + jQuery('input[name="data[crop_y1]"]').val(selection.y1); | |
| 19 | + jQuery('input[name="data[crop_x2]"]').val(selection.x2); | |
| 20 | + jQuery('input[name="data[crop_y2]"]').val(selection.y2); | |
| 21 | + } | |
| 22 | + }) | |
| 23 | +}); | ... | ... |
templates/ktcore/forms/widgets/image.smarty
0 โ 100755
| 1 | + <img id="kt_image_to_crop" {if $has_value} src="{$value}"{/if} alt="{$name}" title="{$name}" /> | ... | ... |
templates/ktcore/forms/widgets/imagecrop.smarty
0 โ 100755
| 1 | + <img id="kt_image_to_crop" {if $has_value} src="{$value}"{/if} alt="{$name}" title="{$name}" /> | ... | ... |
thirdpartyjs/jquery/plugins/imageareaselect/GPL-LICENSE.txt
0 โ 100755
| 1 | + GNU GENERAL PUBLIC LICENSE | |
| 2 | + Version 2, June 1991 | |
| 3 | + | |
| 4 | + Copyright (C) 1989, 1991 Free Software Foundation, Inc. | |
| 5 | + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
| 6 | + Everyone is permitted to copy and distribute verbatim copies | |
| 7 | + of this license document, but changing it is not allowed. | |
| 8 | + | |
| 9 | + Preamble | |
| 10 | + | |
| 11 | + The licenses for most software are designed to take away your | |
| 12 | +freedom to share and change it. By contrast, the GNU General Public | |
| 13 | +License is intended to guarantee your freedom to share and change free | |
| 14 | +software--to make sure the software is free for all its users. This | |
| 15 | +General Public License applies to most of the Free Software | |
| 16 | +Foundation's software and to any other program whose authors commit to | |
| 17 | +using it. (Some other Free Software Foundation software is covered by | |
| 18 | +the GNU Lesser General Public License instead.) You can apply it to | |
| 19 | +your programs, too. | |
| 20 | + | |
| 21 | + When we speak of free software, we are referring to freedom, not | |
| 22 | +price. Our General Public Licenses are designed to make sure that you | |
| 23 | +have the freedom to distribute copies of free software (and charge for | |
| 24 | +this service if you wish), that you receive source code or can get it | |
| 25 | +if you want it, that you can change the software or use pieces of it | |
| 26 | +in new free programs; and that you know you can do these things. | |
| 27 | + | |
| 28 | + To protect your rights, we need to make restrictions that forbid | |
| 29 | +anyone to deny you these rights or to ask you to surrender the rights. | |
| 30 | +These restrictions translate to certain responsibilities for you if you | |
| 31 | +distribute copies of the software, or if you modify it. | |
| 32 | + | |
| 33 | + For example, if you distribute copies of such a program, whether | |
| 34 | +gratis or for a fee, you must give the recipients all the rights that | |
| 35 | +you have. You must make sure that they, too, receive or can get the | |
| 36 | +source code. And you must show them these terms so they know their | |
| 37 | +rights. | |
| 38 | + | |
| 39 | + We protect your rights with two steps: (1) copyright the software, and | |
| 40 | +(2) offer you this license which gives you legal permission to copy, | |
| 41 | +distribute and/or modify the software. | |
| 42 | + | |
| 43 | + Also, for each author's protection and ours, we want to make certain | |
| 44 | +that everyone understands that there is no warranty for this free | |
| 45 | +software. If the software is modified by someone else and passed on, we | |
| 46 | +want its recipients to know that what they have is not the original, so | |
| 47 | +that any problems introduced by others will not reflect on the original | |
| 48 | +authors' reputations. | |
| 49 | + | |
| 50 | + Finally, any free program is threatened constantly by software | |
| 51 | +patents. We wish to avoid the danger that redistributors of a free | |
| 52 | +program will individually obtain patent licenses, in effect making the | |
| 53 | +program proprietary. To prevent this, we have made it clear that any | |
| 54 | +patent must be licensed for everyone's free use or not licensed at all. | |
| 55 | + | |
| 56 | + The precise terms and conditions for copying, distribution and | |
| 57 | +modification follow. | |
| 58 | + | |
| 59 | + GNU GENERAL PUBLIC LICENSE | |
| 60 | + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION | |
| 61 | + | |
| 62 | + 0. This License applies to any program or other work which contains | |
| 63 | +a notice placed by the copyright holder saying it may be distributed | |
| 64 | +under the terms of this General Public License. The "Program", below, | |
| 65 | +refers to any such program or work, and a "work based on the Program" | |
| 66 | +means either the Program or any derivative work under copyright law: | |
| 67 | +that is to say, a work containing the Program or a portion of it, | |
| 68 | +either verbatim or with modifications and/or translated into another | |
| 69 | +language. (Hereinafter, translation is included without limitation in | |
| 70 | +the term "modification".) Each licensee is addressed as "you". | |
| 71 | + | |
| 72 | +Activities other than copying, distribution and modification are not | |
| 73 | +covered by this License; they are outside its scope. The act of | |
| 74 | +running the Program is not restricted, and the output from the Program | |
| 75 | +is covered only if its contents constitute a work based on the | |
| 76 | +Program (independent of having been made by running the Program). | |
| 77 | +Whether that is true depends on what the Program does. | |
| 78 | + | |
| 79 | + 1. You may copy and distribute verbatim copies of the Program's | |
| 80 | +source code as you receive it, in any medium, provided that you | |
| 81 | +conspicuously and appropriately publish on each copy an appropriate | |
| 82 | +copyright notice and disclaimer of warranty; keep intact all the | |
| 83 | +notices that refer to this License and to the absence of any warranty; | |
| 84 | +and give any other recipients of the Program a copy of this License | |
| 85 | +along with the Program. | |
| 86 | + | |
| 87 | +You may charge a fee for the physical act of transferring a copy, and | |
| 88 | +you may at your option offer warranty protection in exchange for a fee. | |
| 89 | + | |
| 90 | + 2. You may modify your copy or copies of the Program or any portion | |
| 91 | +of it, thus forming a work based on the Program, and copy and | |
| 92 | +distribute such modifications or work under the terms of Section 1 | |
| 93 | +above, provided that you also meet all of these conditions: | |
| 94 | + | |
| 95 | + a) You must cause the modified files to carry prominent notices | |
| 96 | + stating that you changed the files and the date of any change. | |
| 97 | + | |
| 98 | + b) You must cause any work that you distribute or publish, that in | |
| 99 | + whole or in part contains or is derived from the Program or any | |
| 100 | + part thereof, to be licensed as a whole at no charge to all third | |
| 101 | + parties under the terms of this License. | |
| 102 | + | |
| 103 | + c) If the modified program normally reads commands interactively | |
| 104 | + when run, you must cause it, when started running for such | |
| 105 | + interactive use in the most ordinary way, to print or display an | |
| 106 | + announcement including an appropriate copyright notice and a | |
| 107 | + notice that there is no warranty (or else, saying that you provide | |
| 108 | + a warranty) and that users may redistribute the program under | |
| 109 | + these conditions, and telling the user how to view a copy of this | |
| 110 | + License. (Exception: if the Program itself is interactive but | |
| 111 | + does not normally print such an announcement, your work based on | |
| 112 | + the Program is not required to print an announcement.) | |
| 113 | + | |
| 114 | +These requirements apply to the modified work as a whole. If | |
| 115 | +identifiable sections of that work are not derived from the Program, | |
| 116 | +and can be reasonably considered independent and separate works in | |
| 117 | +themselves, then this License, and its terms, do not apply to those | |
| 118 | +sections when you distribute them as separate works. But when you | |
| 119 | +distribute the same sections as part of a whole which is a work based | |
| 120 | +on the Program, the distribution of the whole must be on the terms of | |
| 121 | +this License, whose permissions for other licensees extend to the | |
| 122 | +entire whole, and thus to each and every part regardless of who wrote it. | |
| 123 | + | |
| 124 | +Thus, it is not the intent of this section to claim rights or contest | |
| 125 | +your rights to work written entirely by you; rather, the intent is to | |
| 126 | +exercise the right to control the distribution of derivative or | |
| 127 | +collective works based on the Program. | |
| 128 | + | |
| 129 | +In addition, mere aggregation of another work not based on the Program | |
| 130 | +with the Program (or with a work based on the Program) on a volume of | |
| 131 | +a storage or distribution medium does not bring the other work under | |
| 132 | +the scope of this License. | |
| 133 | + | |
| 134 | + 3. You may copy and distribute the Program (or a work based on it, | |
| 135 | +under Section 2) in object code or executable form under the terms of | |
| 136 | +Sections 1 and 2 above provided that you also do one of the following: | |
| 137 | + | |
| 138 | + a) Accompany it with the complete corresponding machine-readable | |
| 139 | + source code, which must be distributed under the terms of Sections | |
| 140 | + 1 and 2 above on a medium customarily used for software interchange; or, | |
| 141 | + | |
| 142 | + b) Accompany it with a written offer, valid for at least three | |
| 143 | + years, to give any third party, for a charge no more than your | |
| 144 | + cost of physically performing source distribution, a complete | |
| 145 | + machine-readable copy of the corresponding source code, to be | |
| 146 | + distributed under the terms of Sections 1 and 2 above on a medium | |
| 147 | + customarily used for software interchange; or, | |
| 148 | + | |
| 149 | + c) Accompany it with the information you received as to the offer | |
| 150 | + to distribute corresponding source code. (This alternative is | |
| 151 | + allowed only for noncommercial distribution and only if you | |
| 152 | + received the program in object code or executable form with such | |
| 153 | + an offer, in accord with Subsection b above.) | |
| 154 | + | |
| 155 | +The source code for a work means the preferred form of the work for | |
| 156 | +making modifications to it. For an executable work, complete source | |
| 157 | +code means all the source code for all modules it contains, plus any | |
| 158 | +associated interface definition files, plus the scripts used to | |
| 159 | +control compilation and installation of the executable. However, as a | |
| 160 | +special exception, the source code distributed need not include | |
| 161 | +anything that is normally distributed (in either source or binary | |
| 162 | +form) with the major components (compiler, kernel, and so on) of the | |
| 163 | +operating system on which the executable runs, unless that component | |
| 164 | +itself accompanies the executable. | |
| 165 | + | |
| 166 | +If distribution of executable or object code is made by offering | |
| 167 | +access to copy from a designated place, then offering equivalent | |
| 168 | +access to copy the source code from the same place counts as | |
| 169 | +distribution of the source code, even though third parties are not | |
| 170 | +compelled to copy the source along with the object code. | |
| 171 | + | |
| 172 | + 4. You may not copy, modify, sublicense, or distribute the Program | |
| 173 | +except as expressly provided under this License. Any attempt | |
| 174 | +otherwise to copy, modify, sublicense or distribute the Program is | |
| 175 | +void, and will automatically terminate your rights under this License. | |
| 176 | +However, parties who have received copies, or rights, from you under | |
| 177 | +this License will not have their licenses terminated so long as such | |
| 178 | +parties remain in full compliance. | |
| 179 | + | |
| 180 | + 5. You are not required to accept this License, since you have not | |
| 181 | +signed it. However, nothing else grants you permission to modify or | |
| 182 | +distribute the Program or its derivative works. These actions are | |
| 183 | +prohibited by law if you do not accept this License. Therefore, by | |
| 184 | +modifying or distributing the Program (or any work based on the | |
| 185 | +Program), you indicate your acceptance of this License to do so, and | |
| 186 | +all its terms and conditions for copying, distributing or modifying | |
| 187 | +the Program or works based on it. | |
| 188 | + | |
| 189 | + 6. Each time you redistribute the Program (or any work based on the | |
| 190 | +Program), the recipient automatically receives a license from the | |
| 191 | +original licensor to copy, distribute or modify the Program subject to | |
| 192 | +these terms and conditions. You may not impose any further | |
| 193 | +restrictions on the recipients' exercise of the rights granted herein. | |
| 194 | +You are not responsible for enforcing compliance by third parties to | |
| 195 | +this License. | |
| 196 | + | |
| 197 | + 7. If, as a consequence of a court judgment or allegation of patent | |
| 198 | +infringement or for any other reason (not limited to patent issues), | |
| 199 | +conditions are imposed on you (whether by court order, agreement or | |
| 200 | +otherwise) that contradict the conditions of this License, they do not | |
| 201 | +excuse you from the conditions of this License. If you cannot | |
| 202 | +distribute so as to satisfy simultaneously your obligations under this | |
| 203 | +License and any other pertinent obligations, then as a consequence you | |
| 204 | +may not distribute the Program at all. For example, if a patent | |
| 205 | +license would not permit royalty-free redistribution of the Program by | |
| 206 | +all those who receive copies directly or indirectly through you, then | |
| 207 | +the only way you could satisfy both it and this License would be to | |
| 208 | +refrain entirely from distribution of the Program. | |
| 209 | + | |
| 210 | +If any portion of this section is held invalid or unenforceable under | |
| 211 | +any particular circumstance, the balance of the section is intended to | |
| 212 | +apply and the section as a whole is intended to apply in other | |
| 213 | +circumstances. | |
| 214 | + | |
| 215 | +It is not the purpose of this section to induce you to infringe any | |
| 216 | +patents or other property right claims or to contest validity of any | |
| 217 | +such claims; this section has the sole purpose of protecting the | |
| 218 | +integrity of the free software distribution system, which is | |
| 219 | +implemented by public license practices. Many people have made | |
| 220 | +generous contributions to the wide range of software distributed | |
| 221 | +through that system in reliance on consistent application of that | |
| 222 | +system; it is up to the author/donor to decide if he or she is willing | |
| 223 | +to distribute software through any other system and a licensee cannot | |
| 224 | +impose that choice. | |
| 225 | + | |
| 226 | +This section is intended to make thoroughly clear what is believed to | |
| 227 | +be a consequence of the rest of this License. | |
| 228 | + | |
| 229 | + 8. If the distribution and/or use of the Program is restricted in | |
| 230 | +certain countries either by patents or by copyrighted interfaces, the | |
| 231 | +original copyright holder who places the Program under this License | |
| 232 | +may add an explicit geographical distribution limitation excluding | |
| 233 | +those countries, so that distribution is permitted only in or among | |
| 234 | +countries not thus excluded. In such case, this License incorporates | |
| 235 | +the limitation as if written in the body of this License. | |
| 236 | + | |
| 237 | + 9. The Free Software Foundation may publish revised and/or new versions | |
| 238 | +of the General Public License from time to time. Such new versions will | |
| 239 | +be similar in spirit to the present version, but may differ in detail to | |
| 240 | +address new problems or concerns. | |
| 241 | + | |
| 242 | +Each version is given a distinguishing version number. If the Program | |
| 243 | +specifies a version number of this License which applies to it and "any | |
| 244 | +later version", you have the option of following the terms and conditions | |
| 245 | +either of that version or of any later version published by the Free | |
| 246 | +Software Foundation. If the Program does not specify a version number of | |
| 247 | +this License, you may choose any version ever published by the Free Software | |
| 248 | +Foundation. | |
| 249 | + | |
| 250 | + 10. If you wish to incorporate parts of the Program into other free | |
| 251 | +programs whose distribution conditions are different, write to the author | |
| 252 | +to ask for permission. For software which is copyrighted by the Free | |
| 253 | +Software Foundation, write to the Free Software Foundation; we sometimes | |
| 254 | +make exceptions for this. Our decision will be guided by the two goals | |
| 255 | +of preserving the free status of all derivatives of our free software and | |
| 256 | +of promoting the sharing and reuse of software generally. | |
| 257 | + | |
| 258 | + NO WARRANTY | |
| 259 | + | |
| 260 | + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY | |
| 261 | +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN | |
| 262 | +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES | |
| 263 | +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED | |
| 264 | +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | |
| 265 | +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS | |
| 266 | +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE | |
| 267 | +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, | |
| 268 | +REPAIR OR CORRECTION. | |
| 269 | + | |
| 270 | + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING | |
| 271 | +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR | |
| 272 | +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, | |
| 273 | +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING | |
| 274 | +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED | |
| 275 | +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY | |
| 276 | +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER | |
| 277 | +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE | |
| 278 | +POSSIBILITY OF SUCH DAMAGES. | ... | ... |
thirdpartyjs/jquery/plugins/imageareaselect/MIT-LICENSE.txt
0 โ 100755
| 1 | +Copyright (c) 2009 Michal Wojciechowski, http://odyniec.net/ | |
| 2 | + | |
| 3 | +Permission is hereby granted, free of charge, to any person obtaining | |
| 4 | +a copy of this software and associated documentation files (the | |
| 5 | +"Software"), to deal in the Software without restriction, including | |
| 6 | +without limitation the rights to use, copy, modify, merge, publish, | |
| 7 | +distribute, sublicense, and/or sell copies of the Software, and to | |
| 8 | +permit persons to whom the Software is furnished to do so, subject to | |
| 9 | +the following conditions: | |
| 10 | + | |
| 11 | +The above copyright notice and this permission notice shall be | |
| 12 | +included in all copies or substantial portions of the Software. | |
| 13 | + | |
| 14 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
| 15 | +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
| 16 | +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |
| 17 | +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | |
| 18 | +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | |
| 19 | +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | |
| 20 | +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ... | ... |
thirdpartyjs/jquery/plugins/imageareaselect/css/border-anim-h.gif
0 โ 100755
219 Bytes
thirdpartyjs/jquery/plugins/imageareaselect/css/border-anim-v.gif
0 โ 100755
219 Bytes
thirdpartyjs/jquery/plugins/imageareaselect/css/border-h.gif
0 โ 100755
72 Bytes
thirdpartyjs/jquery/plugins/imageareaselect/css/border-v.gif
0 โ 100755
72 Bytes
thirdpartyjs/jquery/plugins/imageareaselect/css/imgareaselect-animated.css
0 โ 100755
| 1 | +/* | |
| 2 | + * imgAreaSelect animated border style | |
| 3 | + */ | |
| 4 | + | |
| 5 | +.imgareaselect-border1 { | |
| 6 | + background: url(border-anim-v.gif) repeat-y left top; | |
| 7 | +} | |
| 8 | + | |
| 9 | +.imgareaselect-border2 { | |
| 10 | + background: url(border-anim-h.gif) repeat-x left top; | |
| 11 | +} | |
| 12 | + | |
| 13 | +.imgareaselect-border3 { | |
| 14 | + background: url(border-anim-v.gif) repeat-y right top; | |
| 15 | +} | |
| 16 | + | |
| 17 | +.imgareaselect-border4 { | |
| 18 | + background: url(border-anim-h.gif) repeat-x left bottom; | |
| 19 | +} | |
| 20 | + | |
| 21 | +.imgareaselect-border1, .imgareaselect-border2, | |
| 22 | +.imgareaselect-border3, .imgareaselect-border4 { | |
| 23 | + opacity: 0.5; | |
| 24 | + filter: alpha(opacity=50); | |
| 25 | +} | |
| 26 | + | |
| 27 | +.imgareaselect-handle { | |
| 28 | + background-color: #fff; | |
| 29 | + border: solid 1px #000; | |
| 30 | + opacity: 0.5; | |
| 31 | + filter: alpha(opacity=50); | |
| 32 | +} | |
| 33 | + | |
| 34 | +.imgareaselect-outer { | |
| 35 | + background-color: #000; | |
| 36 | + opacity: 0.5; | |
| 37 | + filter: alpha(opacity=50); | |
| 38 | +} | |
| 39 | + | |
| 40 | +.imgareaselect-selection { | |
| 41 | +} | |
| 0 | 42 | \ No newline at end of file | ... | ... |
thirdpartyjs/jquery/plugins/imageareaselect/css/imgareaselect-default.css
0 โ 100755
| 1 | +/* | |
| 2 | + * imgAreaSelect default style | |
| 3 | + */ | |
| 4 | + | |
| 5 | +.imgareaselect-border1 { | |
| 6 | + background: url(border-v.gif) repeat-y left top; | |
| 7 | +} | |
| 8 | + | |
| 9 | +.imgareaselect-border2 { | |
| 10 | + background: url(border-h.gif) repeat-x left top; | |
| 11 | +} | |
| 12 | + | |
| 13 | +.imgareaselect-border3 { | |
| 14 | + background: url(border-v.gif) repeat-y right top; | |
| 15 | +} | |
| 16 | + | |
| 17 | +.imgareaselect-border4 { | |
| 18 | + background: url(border-h.gif) repeat-x left bottom; | |
| 19 | +} | |
| 20 | + | |
| 21 | +.imgareaselect-border1, .imgareaselect-border2, | |
| 22 | +.imgareaselect-border3, .imgareaselect-border4 { | |
| 23 | + opacity: 0.5; | |
| 24 | + filter: alpha(opacity=50); | |
| 25 | +} | |
| 26 | + | |
| 27 | +.imgareaselect-handle { | |
| 28 | + background-color: #fff; | |
| 29 | + border: solid 1px #000; | |
| 30 | + opacity: 0.5; | |
| 31 | + filter: alpha(opacity=50); | |
| 32 | +} | |
| 33 | + | |
| 34 | +.imgareaselect-outer { | |
| 35 | + background-color: #000; | |
| 36 | + opacity: 0.5; | |
| 37 | + filter: alpha(opacity=50); | |
| 38 | +} | |
| 39 | + | |
| 40 | +.imgareaselect-selection { | |
| 41 | +} | |
| 0 | 42 | \ No newline at end of file | ... | ... |
thirdpartyjs/jquery/plugins/imageareaselect/css/imgareaselect-deprecated.css
0 โ 100755
| 1 | +/* | |
| 2 | + * imgAreaSelect style to be used with deprecated options | |
| 3 | + */ | |
| 4 | + | |
| 5 | +.imgareaselect-border1, .imgareaselect-border2, | |
| 6 | +.imgareaselect-border3, .imgareaselect-border4 { | |
| 7 | + opacity: 0.5; | |
| 8 | + filter: alpha(opacity=50); | |
| 9 | +} | |
| 10 | + | |
| 11 | +.imgareaselect-border1 { | |
| 12 | + border: solid 1px #000; | |
| 13 | +} | |
| 14 | + | |
| 15 | +.imgareaselect-border2 { | |
| 16 | + border: dashed 1px #fff; | |
| 17 | +} | |
| 18 | + | |
| 19 | +.imgareaselect-handle { | |
| 20 | + background-color: #fff; | |
| 21 | + border: solid 1px #000; | |
| 22 | + opacity: 0.5; | |
| 23 | + filter: alpha(opacity=50); | |
| 24 | +} | |
| 25 | + | |
| 26 | +.imgareaselect-outer { | |
| 27 | + background-color: #000; | |
| 28 | + opacity: 0.4; | |
| 29 | + filter: alpha(opacity=40); | |
| 30 | +} | |
| 31 | + | |
| 32 | +.imgareaselect-selection { | |
| 33 | + background-color: #fff; | |
| 34 | + opacity: 0; | |
| 35 | + filter: alpha(opacity=0); | |
| 36 | +} | ... | ... |
thirdpartyjs/jquery/plugins/imageareaselect/scripts/jquery.imgareaselect.js
0 โ 100755
| 1 | +/* | |
| 2 | + * imgAreaSelect jQuery plugin | |
| 3 | + * version 0.9.1 | |
| 4 | + * | |
| 5 | + * Copyright (c) 2008-2009 Michal Wojciechowski (odyniec.net) | |
| 6 | + * | |
| 7 | + * Dual licensed under the MIT (MIT-LICENSE.txt) | |
| 8 | + * and GPL (GPL-LICENSE.txt) licenses. | |
| 9 | + * | |
| 10 | + * http://odyniec.net/projects/imgareaselect/ | |
| 11 | + * | |
| 12 | + */ | |
| 13 | + | |
| 14 | +(function($) { | |
| 15 | + | |
| 16 | +var abs = Math.abs, | |
| 17 | + max = Math.max, | |
| 18 | + min = Math.min, | |
| 19 | + round = Math.round; | |
| 20 | + | |
| 21 | +function div() { | |
| 22 | + return $('<div/>'); | |
| 23 | +} | |
| 24 | + | |
| 25 | +$.imgAreaSelect = function (img, options) { | |
| 26 | + var | |
| 27 | + | |
| 28 | + $img = $(img), | |
| 29 | + | |
| 30 | + imgLoaded, | |
| 31 | + | |
| 32 | + $box = div(), | |
| 33 | + $area = div(), | |
| 34 | + $border = div().add(div()).add(div()).add(div()), | |
| 35 | + $outer = div().add(div()).add(div()).add(div()), | |
| 36 | + $handles = $([]), | |
| 37 | + | |
| 38 | + $areaOpera, | |
| 39 | + | |
| 40 | + left, top, | |
| 41 | + | |
| 42 | + imgOfs, | |
| 43 | + | |
| 44 | + imgWidth, imgHeight, | |
| 45 | + | |
| 46 | + $parent, | |
| 47 | + | |
| 48 | + parOfs, | |
| 49 | + | |
| 50 | + zIndex = 0, | |
| 51 | + | |
| 52 | + position = 'absolute', | |
| 53 | + | |
| 54 | + startX, startY, | |
| 55 | + | |
| 56 | + scaleX, scaleY, | |
| 57 | + | |
| 58 | + resizeMargin = 10, | |
| 59 | + | |
| 60 | + resize, | |
| 61 | + | |
| 62 | + aspectRatio, | |
| 63 | + | |
| 64 | + shown, | |
| 65 | + | |
| 66 | + x1, y1, x2, y2, | |
| 67 | + | |
| 68 | + selection = { x1: 0, y1: 0, x2: 0, y2: 0, width: 0, height: 0 }, | |
| 69 | + | |
| 70 | + $p, d, i, o, w, h, adjusted; | |
| 71 | + | |
| 72 | + function viewX(x) { | |
| 73 | + return x + imgOfs.left - parOfs.left; | |
| 74 | + } | |
| 75 | + | |
| 76 | + function viewY(y) { | |
| 77 | + return y + imgOfs.top - parOfs.top; | |
| 78 | + } | |
| 79 | + | |
| 80 | + function selX(x) { | |
| 81 | + return x - imgOfs.left + parOfs.left; | |
| 82 | + } | |
| 83 | + | |
| 84 | + function selY(y) { | |
| 85 | + return y - imgOfs.top + parOfs.top; | |
| 86 | + } | |
| 87 | + | |
| 88 | + function evX(event) { | |
| 89 | + return event.pageX - parOfs.left; | |
| 90 | + } | |
| 91 | + | |
| 92 | + function evY(event) { | |
| 93 | + return event.pageY - parOfs.top; | |
| 94 | + } | |
| 95 | + | |
| 96 | + function getSelection(noScale) { | |
| 97 | + var sx = noScale || scaleX, sy = noScale || scaleY; | |
| 98 | + | |
| 99 | + return { x1: round(selection.x1 * sx), | |
| 100 | + y1: round(selection.y1 * sy), | |
| 101 | + x2: round(selection.x2 * sx), | |
| 102 | + y2: round(selection.y2 * sy), | |
| 103 | + width: round(selection.x2 * sx) - round(selection.x1 * sx), | |
| 104 | + height: round(selection.y2 * sy) - round(selection.y1 * sy) }; | |
| 105 | + } | |
| 106 | + | |
| 107 | + function setSelection(x1, y1, x2, y2, noScale) { | |
| 108 | + var sx = noScale || scaleX, sy = noScale || scaleY; | |
| 109 | + | |
| 110 | + selection = { | |
| 111 | + x1: round(x1 / sx), | |
| 112 | + y1: round(y1 / sy), | |
| 113 | + x2: round(x2 / sx), | |
| 114 | + y2: round(y2 / sy) | |
| 115 | + }; | |
| 116 | + | |
| 117 | + selection.width = (x2 = viewX(selection.x2)) - (x1 = viewX(selection.x1)); | |
| 118 | + selection.height = (y2 = viewX(selection.y2)) - (y1 = viewX(selection.y1)); | |
| 119 | + } | |
| 120 | + | |
| 121 | + function adjust() { | |
| 122 | + if (!$img.width()) | |
| 123 | + return; | |
| 124 | + | |
| 125 | + imgOfs = { left: round($img.offset().left), top: round($img.offset().top) }; | |
| 126 | + | |
| 127 | + imgWidth = $img.width(); | |
| 128 | + imgHeight = $img.height(); | |
| 129 | + | |
| 130 | + if ($().jquery == '1.3.2' && $.browser.safari && position == 'fixed') { | |
| 131 | + imgOfs.top += max(document.documentElement.scrollTop, $('body').scrollTop()); | |
| 132 | + | |
| 133 | + imgOfs.left += max(document.documentElement.scrollLeft, $('body').scrollLeft()); | |
| 134 | + } | |
| 135 | + | |
| 136 | + parOfs = $.inArray($parent.css('position'), ['absolute', 'relative']) + 1 ? | |
| 137 | + { left: round($parent.offset().left) - $parent.scrollLeft(), | |
| 138 | + top: round($parent.offset().top) - $parent.scrollTop() } : | |
| 139 | + position == 'fixed' ? | |
| 140 | + { left: $(document).scrollLeft(), top: $(document).scrollTop() } : | |
| 141 | + { left: 0, top: 0 }; | |
| 142 | + | |
| 143 | + left = viewX(0); | |
| 144 | + top = viewY(0); | |
| 145 | + } | |
| 146 | + | |
| 147 | + function update(resetKeyPress) { | |
| 148 | + if (!shown) return; | |
| 149 | + | |
| 150 | + $box.css({ left: viewX(selection.x1), top: viewY(selection.y1) }) | |
| 151 | + .add($area).width(w = selection.width).height(h = selection.height); | |
| 152 | + | |
| 153 | + $area.add($border).add($handles).css({ left: 0, top: 0 }); | |
| 154 | + | |
| 155 | + $border | |
| 156 | + .width(max(w - $border.outerWidth() + $border.innerWidth(), 0)) | |
| 157 | + .height(max(h - $border.outerHeight() + $border.innerHeight(), 0)); | |
| 158 | + | |
| 159 | + $($outer[0]).css({ left: left, top: top, | |
| 160 | + width: selection.x1, height: imgHeight }); | |
| 161 | + $($outer[1]).css({ left: left + selection.x1, top: top, | |
| 162 | + width: w, height: selection.y1 }); | |
| 163 | + $($outer[2]).css({ left: left + selection.x2, top: top, | |
| 164 | + width: imgWidth - selection.x2, height: imgHeight }); | |
| 165 | + $($outer[3]).css({ left: left + selection.x1, top: top + selection.y2, | |
| 166 | + width: w, height: imgHeight - selection.y2 }); | |
| 167 | + | |
| 168 | + w -= $handles.outerWidth(); | |
| 169 | + h -= $handles.outerHeight(); | |
| 170 | + | |
| 171 | + switch ($handles.length) { | |
| 172 | + case 8: | |
| 173 | + $($handles[4]).css({ left: w / 2 }); | |
| 174 | + $($handles[5]).css({ left: w, top: h / 2 }); | |
| 175 | + $($handles[6]).css({ left: w / 2, top: h }); | |
| 176 | + $($handles[7]).css({ top: h / 2 }); | |
| 177 | + case 4: | |
| 178 | + $handles.slice(1,3).css({ left: w }); | |
| 179 | + $handles.slice(2,4).css({ top: h }); | |
| 180 | + } | |
| 181 | + | |
| 182 | + if (resetKeyPress !== false) { | |
| 183 | + if ($.imgAreaSelect.keyPress != docKeyPress) | |
| 184 | + $(document).unbind($.imgAreaSelect.keyPress, | |
| 185 | + $.imgAreaSelect.onKeyPress); | |
| 186 | + | |
| 187 | + if (options.keys) | |
| 188 | + $(document)[$.imgAreaSelect.keyPress]( | |
| 189 | + $.imgAreaSelect.onKeyPress = docKeyPress); | |
| 190 | + } | |
| 191 | + | |
| 192 | + if ($.browser.msie && $border.outerWidth() - $border.innerWidth() == 2) { | |
| 193 | + $border.css('margin', 0); | |
| 194 | + setTimeout(function () { $border.css('margin', 'auto'); }, 0); | |
| 195 | + } | |
| 196 | + } | |
| 197 | + | |
| 198 | + function doUpdate(resetKeyPress) { | |
| 199 | + adjust(); | |
| 200 | + update(resetKeyPress); | |
| 201 | + x1 = viewX(selection.x1); y1 = viewY(selection.y1); | |
| 202 | + x2 = viewX(selection.x2); y2 = viewY(selection.y2); | |
| 203 | + } | |
| 204 | + | |
| 205 | + function hide($elem, fn) { | |
| 206 | + options.fadeSpeed ? $elem.fadeOut(options.fadeSpeed, fn) : $elem.hide(); | |
| 207 | + | |
| 208 | + } | |
| 209 | + | |
| 210 | + function areaMouseMove(event) { | |
| 211 | + var x = selX(evX(event)) - selection.x1, | |
| 212 | + y = selY(evY(event)) - selection.y1; | |
| 213 | + | |
| 214 | + if (!adjusted) { | |
| 215 | + adjust(); | |
| 216 | + adjusted = true; | |
| 217 | + | |
| 218 | + $box.one('mouseout', function () { adjusted = false; }); | |
| 219 | + } | |
| 220 | + | |
| 221 | + resize = ''; | |
| 222 | + | |
| 223 | + if (options.resizable) { | |
| 224 | + if (y <= resizeMargin) | |
| 225 | + resize = 'n'; | |
| 226 | + else if (y >= selection.height - resizeMargin) | |
| 227 | + resize = 's'; | |
| 228 | + if (x <= resizeMargin) | |
| 229 | + resize += 'w'; | |
| 230 | + else if (x >= selection.width - resizeMargin) | |
| 231 | + resize += 'e'; | |
| 232 | + } | |
| 233 | + | |
| 234 | + $box.css('cursor', resize ? resize + '-resize' : | |
| 235 | + options.movable ? 'move' : ''); | |
| 236 | + if ($areaOpera) | |
| 237 | + $areaOpera.toggle(); | |
| 238 | + } | |
| 239 | + | |
| 240 | + function docMouseUp(event) { | |
| 241 | + $('body').css('cursor', ''); | |
| 242 | + | |
| 243 | + if (options.autoHide || selection.width * selection.height == 0) | |
| 244 | + hide($box.add($outer), function () { $(this).hide(); }); | |
| 245 | + | |
| 246 | + options.onSelectEnd(img, getSelection()); | |
| 247 | + | |
| 248 | + $(document).unbind('mousemove', selectingMouseMove); | |
| 249 | + $box.mousemove(areaMouseMove); | |
| 250 | + } | |
| 251 | + | |
| 252 | + function areaMouseDown(event) { | |
| 253 | + if (event.which != 1) return false; | |
| 254 | + | |
| 255 | + adjust(); | |
| 256 | + | |
| 257 | + if (resize) { | |
| 258 | + $('body').css('cursor', resize + '-resize'); | |
| 259 | + | |
| 260 | + x1 = viewX(selection[/w/.test(resize) ? 'x2' : 'x1']); | |
| 261 | + y1 = viewY(selection[/n/.test(resize) ? 'y2' : 'y1']); | |
| 262 | + | |
| 263 | + $(document).mousemove(selectingMouseMove) | |
| 264 | + .one('mouseup', docMouseUp); | |
| 265 | + $box.unbind('mousemove', areaMouseMove); | |
| 266 | + } | |
| 267 | + else if (options.movable) { | |
| 268 | + startX = left + selection.x1 - evX(event); | |
| 269 | + startY = top + selection.y1 - evY(event); | |
| 270 | + | |
| 271 | + $box.unbind('mousemove', areaMouseMove); | |
| 272 | + | |
| 273 | + $(document).mousemove(movingMouseMove) | |
| 274 | + .one('mouseup', function () { | |
| 275 | + options.onSelectEnd(img, getSelection()); | |
| 276 | + | |
| 277 | + $(document).unbind('mousemove', movingMouseMove); | |
| 278 | + $box.mousemove(areaMouseMove); | |
| 279 | + }); | |
| 280 | + } | |
| 281 | + else | |
| 282 | + $img.mousedown(event); | |
| 283 | + | |
| 284 | + return false; | |
| 285 | + } | |
| 286 | + | |
| 287 | + function aspectRatioXY() { | |
| 288 | + x2 = max(left, min(left + imgWidth, | |
| 289 | + x1 + abs(y2 - y1) * aspectRatio * (x2 > x1 || -1))); | |
| 290 | + | |
| 291 | + y2 = round(max(top, min(top + imgHeight, | |
| 292 | + y1 + abs(x2 - x1) / aspectRatio * (y2 > y1 || -1)))); | |
| 293 | + x2 = round(x2); | |
| 294 | + } | |
| 295 | + | |
| 296 | + function aspectRatioYX() { | |
| 297 | + y2 = max(top, min(top + imgHeight, | |
| 298 | + y1 + abs(x2 - x1) / aspectRatio * (y2 > y1 || -1))); | |
| 299 | + x2 = round(max(left, min(left + imgWidth, | |
| 300 | + x1 + abs(y2 - y1) * aspectRatio * (x2 > x1 || -1)))); | |
| 301 | + y2 = round(y2); | |
| 302 | + } | |
| 303 | + | |
| 304 | + function doResize() { | |
| 305 | + if (abs(x2 - x1) < options.minWidth) { | |
| 306 | + x2 = x1 - options.minWidth * (x2 < x1 || -1); | |
| 307 | + | |
| 308 | + if (x2 < left) | |
| 309 | + x1 = left + options.minWidth; | |
| 310 | + else if (x2 > left + imgWidth) | |
| 311 | + x1 = left + imgWidth - options.minWidth; | |
| 312 | + } | |
| 313 | + | |
| 314 | + if (abs(y2 - y1) < options.minHeight) { | |
| 315 | + y2 = y1 - options.minHeight * (y2 < y1 || -1); | |
| 316 | + | |
| 317 | + if (y2 < top) | |
| 318 | + y1 = top + options.minHeight; | |
| 319 | + else if (y2 > top + imgHeight) | |
| 320 | + y1 = top + imgHeight - options.minHeight; | |
| 321 | + } | |
| 322 | + | |
| 323 | + x2 = max(left, min(x2, left + imgWidth)); | |
| 324 | + y2 = max(top, min(y2, top + imgHeight)); | |
| 325 | + | |
| 326 | + if (aspectRatio) | |
| 327 | + if (abs(x2 - x1) / aspectRatio > abs(y2 - y1)) | |
| 328 | + aspectRatioYX(); | |
| 329 | + else | |
| 330 | + aspectRatioXY(); | |
| 331 | + | |
| 332 | + if (abs(x2 - x1) > options.maxWidth) { | |
| 333 | + x2 = x1 - options.maxWidth * (x2 < x1 || -1); | |
| 334 | + if (aspectRatio) aspectRatioYX(); | |
| 335 | + } | |
| 336 | + | |
| 337 | + if (abs(y2 - y1) > options.maxHeight) { | |
| 338 | + y2 = y1 - options.maxHeight * (y2 < y1 || -1); | |
| 339 | + if (aspectRatio) aspectRatioXY(); | |
| 340 | + } | |
| 341 | + | |
| 342 | + selection = { x1: selX(min(x1, x2)), x2: selX(max(x1, x2)), | |
| 343 | + y1: selY(min(y1, y2)), y2: selY(max(y1, y2)), | |
| 344 | + width: abs(x2 - x1), height: abs(y2 - y1) }; | |
| 345 | + | |
| 346 | + update(); | |
| 347 | + | |
| 348 | + options.onSelectChange(img, getSelection()); | |
| 349 | + } | |
| 350 | + | |
| 351 | + function selectingMouseMove(event) { | |
| 352 | + x2 = resize == '' || /w|e/.test(resize) || aspectRatio ? evX(event) : viewX(selection.x2); | |
| 353 | + y2 = resize == '' || /n|s/.test(resize) || aspectRatio ? evY(event) : viewY(selection.y2); | |
| 354 | + | |
| 355 | + doResize(); | |
| 356 | + | |
| 357 | + return false; | |
| 358 | + | |
| 359 | + } | |
| 360 | + | |
| 361 | + function doMove(newX1, newY1) { | |
| 362 | + x2 = (x1 = newX1) + selection.width; | |
| 363 | + y2 = (y1 = newY1) + selection.height; | |
| 364 | + | |
| 365 | + selection = $.extend(selection, { x1: selX(x1), y1: selY(y1), | |
| 366 | + x2: selX(x2), y2: selY(y2) }); | |
| 367 | + | |
| 368 | + update(); | |
| 369 | + | |
| 370 | + options.onSelectChange(img, getSelection()); | |
| 371 | + } | |
| 372 | + | |
| 373 | + function movingMouseMove(event) { | |
| 374 | + x1 = max(left, min(startX + evX(event), left + imgWidth - selection.width)); | |
| 375 | + y1 = max(top, min(startY + evY(event), top + imgHeight - selection.height)); | |
| 376 | + | |
| 377 | + doMove(x1, y1); | |
| 378 | + | |
| 379 | + event.preventDefault(); | |
| 380 | + | |
| 381 | + return false; | |
| 382 | + } | |
| 383 | + | |
| 384 | + function startSelection() { | |
| 385 | + adjust(); | |
| 386 | + | |
| 387 | + x2 = x1; | |
| 388 | + y2 = y1; | |
| 389 | + | |
| 390 | + doResize(); | |
| 391 | + | |
| 392 | + resize = ''; | |
| 393 | + | |
| 394 | + if ($outer.is(':not(:visible)')) | |
| 395 | + $box.add($outer).hide().fadeIn(options.fadeSpeed||0); | |
| 396 | + | |
| 397 | + shown = true; | |
| 398 | + | |
| 399 | + $(document).unbind('mouseup', cancelSelection) | |
| 400 | + .mousemove(selectingMouseMove).one('mouseup', docMouseUp); | |
| 401 | + $box.unbind('mousemove', areaMouseMove); | |
| 402 | + | |
| 403 | + options.onSelectStart(img, getSelection()); | |
| 404 | + } | |
| 405 | + | |
| 406 | + function cancelSelection() { | |
| 407 | + $(document).unbind('mousemove', startSelection); | |
| 408 | + hide($box.add($outer)); | |
| 409 | + | |
| 410 | + selection = { x1: selX(x1), y1: selY(y1), x2: selX(x1), y2: selY(y1), | |
| 411 | + width: 0, height: 0 }; | |
| 412 | + | |
| 413 | + options.onSelectChange(img, getSelection()); | |
| 414 | + options.onSelectEnd(img, getSelection()); | |
| 415 | + } | |
| 416 | + | |
| 417 | + function imgMouseDown(event) { | |
| 418 | + if (event.which != 1 || $outer.is(':animated')) return false; | |
| 419 | + | |
| 420 | + adjust(); | |
| 421 | + startX = x1 = evX(event); | |
| 422 | + startY = y1 = evY(event); | |
| 423 | + | |
| 424 | + $(document).one('mousemove', startSelection) | |
| 425 | + .one('mouseup', cancelSelection); | |
| 426 | + | |
| 427 | + return false; | |
| 428 | + } | |
| 429 | + | |
| 430 | + function parentScroll() { | |
| 431 | + doUpdate(false); | |
| 432 | + } | |
| 433 | + | |
| 434 | + function imgLoad() { | |
| 435 | + imgLoaded = true; | |
| 436 | + | |
| 437 | + setOptions(options = $.extend({ | |
| 438 | + classPrefix: 'imgareaselect', | |
| 439 | + movable: true, | |
| 440 | + resizable: true, | |
| 441 | + parent: 'body', | |
| 442 | + onInit: function () {}, | |
| 443 | + onSelectStart: function () {}, | |
| 444 | + onSelectChange: function () {}, | |
| 445 | + onSelectEnd: function () {} | |
| 446 | + }, options)); | |
| 447 | + | |
| 448 | + $box.add($outer).css({ visibility: '' }); | |
| 449 | + | |
| 450 | + if (options.show) { | |
| 451 | + shown = true; | |
| 452 | + adjust(); | |
| 453 | + update(); | |
| 454 | + $box.add($outer).hide().fadeIn(options.fadeSpeed||0); | |
| 455 | + } | |
| 456 | + | |
| 457 | + setTimeout(function () { options.onInit(img, getSelection()); }, 0); | |
| 458 | + } | |
| 459 | + | |
| 460 | + var docKeyPress = function(event) { | |
| 461 | + var k = options.keys, d, t, key = event.keyCode || event.which; | |
| 462 | + | |
| 463 | + d = !isNaN(k.alt) && (event.altKey || event.originalEvent.altKey) ? k.alt : | |
| 464 | + !isNaN(k.ctrl) && event.ctrlKey ? k.ctrl : | |
| 465 | + !isNaN(k.shift) && event.shiftKey ? k.shift : | |
| 466 | + !isNaN(k.arrows) ? k.arrows : 10; | |
| 467 | + | |
| 468 | + if (k.arrows == 'resize' || (k.shift == 'resize' && event.shiftKey) || | |
| 469 | + (k.ctrl == 'resize' && event.ctrlKey) || | |
| 470 | + (k.alt == 'resize' && (event.altKey || event.originalEvent.altKey))) | |
| 471 | + { | |
| 472 | + switch (key) { | |
| 473 | + case 37: | |
| 474 | + d = -d; | |
| 475 | + case 39: | |
| 476 | + t = max(x1, x2); | |
| 477 | + x1 = min(x1, x2); | |
| 478 | + x2 = max(t + d, x1); | |
| 479 | + if (aspectRatio) aspectRatioYX(); | |
| 480 | + break; | |
| 481 | + case 38: | |
| 482 | + d = -d; | |
| 483 | + case 40: | |
| 484 | + t = max(y1, y2); | |
| 485 | + y1 = min(y1, y2); | |
| 486 | + y2 = max(t + d, y1); | |
| 487 | + if (aspectRatio) aspectRatioXY(); | |
| 488 | + break; | |
| 489 | + default: | |
| 490 | + return; | |
| 491 | + } | |
| 492 | + | |
| 493 | + doResize(); | |
| 494 | + } | |
| 495 | + else { | |
| 496 | + x1 = min(x1, x2); | |
| 497 | + y1 = min(y1, y2); | |
| 498 | + | |
| 499 | + switch (key) { | |
| 500 | + case 37: | |
| 501 | + doMove(max(x1 - d, left), y1); | |
| 502 | + break; | |
| 503 | + case 38: | |
| 504 | + doMove(x1, max(y1 - d, top)); | |
| 505 | + break; | |
| 506 | + case 39: | |
| 507 | + doMove(x1 + min(d, imgWidth - selX(x2)), y1); | |
| 508 | + break; | |
| 509 | + case 40: | |
| 510 | + doMove(x1, y1 + min(d, imgHeight - selY(y2))); | |
| 511 | + break; | |
| 512 | + default: | |
| 513 | + return; | |
| 514 | + } | |
| 515 | + } | |
| 516 | + | |
| 517 | + return false; | |
| 518 | + }; | |
| 519 | + | |
| 520 | + function styleOptions($elem, props) { | |
| 521 | + for (option in props) | |
| 522 | + if (options[option] !== undefined) | |
| 523 | + $elem.css(props[option], options[option]); | |
| 524 | + } | |
| 525 | + | |
| 526 | + function setOptions(newOptions) { | |
| 527 | + if (newOptions.parent) | |
| 528 | + ($parent = $(newOptions.parent)).append($box.add($outer)); | |
| 529 | + | |
| 530 | + options = $.extend(options, newOptions); | |
| 531 | + | |
| 532 | + adjust(); | |
| 533 | + | |
| 534 | + if (newOptions.handles != null) { | |
| 535 | + $handles.remove(); | |
| 536 | + $handles = $([]); | |
| 537 | + | |
| 538 | + i = newOptions.handles ? newOptions.handles == 'corners' ? 4 : 8 : 0; | |
| 539 | + | |
| 540 | + while (i--) | |
| 541 | + $handles = $handles.add(div()); | |
| 542 | + | |
| 543 | + $handles.addClass(options.classPrefix + '-handle').css({ | |
| 544 | + position: 'absolute', | |
| 545 | + fontSize: 0, | |
| 546 | + zIndex: zIndex + 1 || 1 | |
| 547 | + }); | |
| 548 | + | |
| 549 | + if (!parseInt($handles.css('width'))) | |
| 550 | + $handles.width(5).height(5); | |
| 551 | + | |
| 552 | + if (o = options.borderWidth) | |
| 553 | + $handles.css({ borderWidth: o, borderStyle: 'solid' }); | |
| 554 | + | |
| 555 | + styleOptions($handles, { borderColor1: 'border-color', | |
| 556 | + borderColor2: 'background-color', | |
| 557 | + borderOpacity: 'opacity' }); | |
| 558 | + } | |
| 559 | + | |
| 560 | + scaleX = options.imageWidth / imgWidth || 1; | |
| 561 | + scaleY = options.imageHeight / imgHeight || 1; | |
| 562 | + | |
| 563 | + if (newOptions.x1 != null) { | |
| 564 | + setSelection(newOptions.x1, newOptions.y1, newOptions.x2, | |
| 565 | + newOptions.y2); | |
| 566 | + newOptions.show = !newOptions.hide; | |
| 567 | + } | |
| 568 | + | |
| 569 | + if (newOptions.keys) | |
| 570 | + options.keys = $.extend({ shift: 1, ctrl: 'resize' }, | |
| 571 | + newOptions.keys); | |
| 572 | + | |
| 573 | + $outer.addClass(options.classPrefix + '-outer'); | |
| 574 | + $area.addClass(options.classPrefix + '-selection'); | |
| 575 | + for (i = 0; i++ < 4;) | |
| 576 | + $($border[i-1]).addClass(options.classPrefix + '-border' + i); | |
| 577 | + | |
| 578 | + styleOptions($area, { selectionColor: 'background-color', | |
| 579 | + selectionOpacity: 'opacity' }); | |
| 580 | + styleOptions($border, { borderOpacity: 'opacity', | |
| 581 | + borderWidth: 'border-width' }); | |
| 582 | + styleOptions($outer, { outerColor: 'background-color', | |
| 583 | + outerOpacity: 'opacity' }); | |
| 584 | + if (o = options.borderColor1) | |
| 585 | + $($border[0]).css({ borderStyle: 'solid', borderColor: o }); | |
| 586 | + if (o = options.borderColor2) | |
| 587 | + $($border[1]).css({ borderStyle: 'dashed', borderColor: o }); | |
| 588 | + | |
| 589 | + $box.append($area.add($border).add($handles).add($areaOpera)); | |
| 590 | + | |
| 591 | + if ($.browser.msie) { | |
| 592 | + if (o = $outer.css('filter').match(/opacity=([0-9]+)/)) | |
| 593 | + $outer.css('opacity', o[1]/100); | |
| 594 | + if (o = $border.css('filter').match(/opacity=([0-9]+)/)) | |
| 595 | + $border.css('opacity', o[1]/100); | |
| 596 | + } | |
| 597 | + | |
| 598 | + if (newOptions.hide) | |
| 599 | + hide($box.add($outer)); | |
| 600 | + else if (newOptions.show && imgLoaded) { | |
| 601 | + shown = true; | |
| 602 | + $box.add($outer).fadeIn(options.fadeSpeed||0); | |
| 603 | + doUpdate(); | |
| 604 | + } | |
| 605 | + | |
| 606 | + aspectRatio = (d = (options.aspectRatio || '').split(/:/))[0] / d[1]; | |
| 607 | + | |
| 608 | + if (options.disable || options.enable === false) { | |
| 609 | + $box.unbind('mousemove', areaMouseMove).unbind('mousedown', areaMouseDown); | |
| 610 | + $img.add($outer).unbind('mousedown', imgMouseDown); | |
| 611 | + $(window).unbind('resize', parentScroll); | |
| 612 | + $img.add($img.parents()).unbind('scroll', parentScroll); | |
| 613 | + } | |
| 614 | + else if (options.enable || options.disable === false) { | |
| 615 | + if (options.resizable || options.movable) | |
| 616 | + $box.mousemove(areaMouseMove).mousedown(areaMouseDown); | |
| 617 | + | |
| 618 | + if (!options.persistent) | |
| 619 | + $img.add($outer).mousedown(imgMouseDown); | |
| 620 | + $(window).resize(parentScroll); | |
| 621 | + $img.add($img.parents()).scroll(parentScroll); | |
| 622 | + } | |
| 623 | + | |
| 624 | + options.enable = options.disable = undefined; | |
| 625 | + } | |
| 626 | + | |
| 627 | + this.getOptions = function () { return options; }; | |
| 628 | + | |
| 629 | + this.setOptions = setOptions; | |
| 630 | + | |
| 631 | + this.getSelection = getSelection; | |
| 632 | + | |
| 633 | + this.setSelection = setSelection; | |
| 634 | + | |
| 635 | + this.update = doUpdate; | |
| 636 | + | |
| 637 | + $p = $img; | |
| 638 | + | |
| 639 | + while ($p.length && !$p.is('body')) { | |
| 640 | + if (!isNaN($p.css('z-index')) && $p.css('z-index') > zIndex) | |
| 641 | + zIndex = $p.css('z-index'); | |
| 642 | + if ($p.css('position') == 'fixed') | |
| 643 | + position = 'fixed'; | |
| 644 | + | |
| 645 | + $p = $p.parent(); | |
| 646 | + } | |
| 647 | + | |
| 648 | + if (!isNaN(options.zIndex)) | |
| 649 | + zIndex = options.zIndex; | |
| 650 | + | |
| 651 | + if ($.browser.msie) | |
| 652 | + $img.attr('unselectable', 'on'); | |
| 653 | + | |
| 654 | + $.imgAreaSelect.keyPress = $.browser.msie || | |
| 655 | + $.browser.safari ? 'keydown' : 'keypress'; | |
| 656 | + | |
| 657 | + if ($.browser.opera) | |
| 658 | + $areaOpera = div().css({ width: '100%', height: '100%', | |
| 659 | + position: 'absolute', zIndex: zIndex + 2 || 2 }); | |
| 660 | + | |
| 661 | + $box.add($outer).css({ visibility: 'hidden', position: position, | |
| 662 | + overflow: 'hidden', zIndex: zIndex || '0' }); | |
| 663 | + $box.css({ zIndex: zIndex + 2 || 2 }); | |
| 664 | + $area.add($border).css({ position: 'absolute' }); | |
| 665 | + | |
| 666 | + img.complete || img.readyState == 'complete' || !$img.is('img') ? | |
| 667 | + imgLoad() : $img.one('load', imgLoad); | |
| 668 | + | |
| 669 | +}; | |
| 670 | + | |
| 671 | +$.fn.imgAreaSelect = function (options) { | |
| 672 | + options = options || {}; | |
| 673 | + | |
| 674 | + this.each(function () { | |
| 675 | + if ($(this).data('imgAreaSelect')) | |
| 676 | + $(this).data('imgAreaSelect').setOptions(options); | |
| 677 | + else { | |
| 678 | + if (options.enable === undefined && options.disable === undefined) | |
| 679 | + options.enable = true; | |
| 680 | + | |
| 681 | + $(this).data('imgAreaSelect', new $.imgAreaSelect(this, options)); | |
| 682 | + } | |
| 683 | + }); | |
| 684 | + | |
| 685 | + if (options.instance) | |
| 686 | + return $(this).data('imgAreaSelect'); | |
| 687 | + | |
| 688 | + return this; | |
| 689 | +}; | |
| 690 | + | |
| 691 | +})(jQuery); | ... | ... |
thirdpartyjs/jquery/plugins/imageareaselect/scripts/jquery.imgareaselect.min.js
0 โ 100755
| 1 | +(function($){var abs=Math.abs,max=Math.max,min=Math.min,round=Math.round;function div(){return $('<div/>')}$.imgAreaSelect=function(img,options){var $img=$(img),imgLoaded,$box=div(),$area=div(),$border=div().add(div()).add(div()).add(div()),$outer=div().add(div()).add(div()).add(div()),$handles=$([]),$areaOpera,left,top,imgOfs,imgWidth,imgHeight,$parent,parOfs,zIndex=0,position='absolute',startX,startY,scaleX,scaleY,resizeMargin=10,resize,aspectRatio,shown,x1,y1,x2,y2,selection={x1:0,y1:0,x2:0,y2:0,width:0,height:0},$p,d,i,o,w,h,adjusted;function viewX(x){return x+imgOfs.left-parOfs.left}function viewY(y){return y+imgOfs.top-parOfs.top}function selX(x){return x-imgOfs.left+parOfs.left}function selY(y){return y-imgOfs.top+parOfs.top}function evX(event){return event.pageX-parOfs.left}function evY(event){return event.pageY-parOfs.top}function getSelection(noScale){var sx=noScale||scaleX,sy=noScale||scaleY;return{x1:round(selection.x1*sx),y1:round(selection.y1*sy),x2:round(selection.x2*sx),y2:round(selection.y2*sy),width:round(selection.x2*sx)-round(selection.x1*sx),height:round(selection.y2*sy)-round(selection.y1*sy)}}function setSelection(x1,y1,x2,y2,noScale){var sx=noScale||scaleX,sy=noScale||scaleY;selection={x1:round(x1/sx),y1:round(y1/sy),x2:round(x2/sx),y2:round(y2/sy)};selection.width=(x2=viewX(selection.x2))-(x1=viewX(selection.x1));selection.height=(y2=viewX(selection.y2))-(y1=viewX(selection.y1))}function adjust(){if(!$img.width())return;imgOfs={left:round($img.offset().left),top:round($img.offset().top)};imgWidth=$img.width();imgHeight=$img.height();if($().jquery=='1.3.2'&&$.browser.safari&&position=='fixed'){imgOfs.top+=max(document.documentElement.scrollTop,$('body').scrollTop());imgOfs.left+=max(document.documentElement.scrollLeft,$('body').scrollLeft())}parOfs=$.inArray($parent.css('position'),['absolute','relative'])+1?{left:round($parent.offset().left)-$parent.scrollLeft(),top:round($parent.offset().top)-$parent.scrollTop()}:position=='fixed'?{left:$(document).scrollLeft(),top:$(document).scrollTop()}:{left:0,top:0};left=viewX(0);top=viewY(0)}function update(resetKeyPress){if(!shown)return;$box.css({left:viewX(selection.x1),top:viewY(selection.y1)}).add($area).width(w=selection.width).height(h=selection.height);$area.add($border).add($handles).css({left:0,top:0});$border.width(max(w-$border.outerWidth()+$border.innerWidth(),0)).height(max(h-$border.outerHeight()+$border.innerHeight(),0));$($outer[0]).css({left:left,top:top,width:selection.x1,height:imgHeight});$($outer[1]).css({left:left+selection.x1,top:top,width:w,height:selection.y1});$($outer[2]).css({left:left+selection.x2,top:top,width:imgWidth-selection.x2,height:imgHeight});$($outer[3]).css({left:left+selection.x1,top:top+selection.y2,width:w,height:imgHeight-selection.y2});w-=$handles.outerWidth();h-=$handles.outerHeight();switch($handles.length){case 8:$($handles[4]).css({left:w/2});$($handles[5]).css({left:w,top:h/2});$($handles[6]).css({left:w/2,top:h});$($handles[7]).css({top:h/2});case 4:$handles.slice(1,3).css({left:w});$handles.slice(2,4).css({top:h})}if(resetKeyPress!==false){if($.imgAreaSelect.keyPress!=docKeyPress)$(document).unbind($.imgAreaSelect.keyPress,$.imgAreaSelect.onKeyPress);if(options.keys)$(document)[$.imgAreaSelect.keyPress]($.imgAreaSelect.onKeyPress=docKeyPress)}if($.browser.msie&&$border.outerWidth()-$border.innerWidth()==2){$border.css('margin',0);setTimeout(function(){$border.css('margin','auto')},0)}}function doUpdate(resetKeyPress){adjust();update(resetKeyPress);x1=viewX(selection.x1);y1=viewY(selection.y1);x2=viewX(selection.x2);y2=viewY(selection.y2)}function hide($elem,fn){options.fadeSpeed?$elem.fadeOut(options.fadeSpeed,fn):$elem.hide()}function areaMouseMove(event){var x=selX(evX(event))-selection.x1,y=selY(evY(event))-selection.y1;if(!adjusted){adjust();adjusted=true;$box.one('mouseout',function(){adjusted=false})}resize='';if(options.resizable){if(y<=resizeMargin)resize='n';else if(y>=selection.height-resizeMargin)resize='s';if(x<=resizeMargin)resize+='w';else if(x>=selection.width-resizeMargin)resize+='e'}$box.css('cursor',resize?resize+'-resize':options.movable?'move':'');if($areaOpera)$areaOpera.toggle()}function docMouseUp(event){$('body').css('cursor','');if(options.autoHide||selection.width*selection.height==0)hide($box.add($outer),function(){$(this).hide()});options.onSelectEnd(img,getSelection());$(document).unbind('mousemove',selectingMouseMove);$box.mousemove(areaMouseMove)}function areaMouseDown(event){if(event.which!=1)return false;adjust();if(resize){$('body').css('cursor',resize+'-resize');x1=viewX(selection[/w/.test(resize)?'x2':'x1']);y1=viewY(selection[/n/.test(resize)?'y2':'y1']);$(document).mousemove(selectingMouseMove).one('mouseup',docMouseUp);$box.unbind('mousemove',areaMouseMove)}else if(options.movable){startX=left+selection.x1-evX(event);startY=top+selection.y1-evY(event);$box.unbind('mousemove',areaMouseMove);$(document).mousemove(movingMouseMove).one('mouseup',function(){options.onSelectEnd(img,getSelection());$(document).unbind('mousemove',movingMouseMove);$box.mousemove(areaMouseMove)})}else $img.mousedown(event);return false}function aspectRatioXY(){x2=max(left,min(left+imgWidth,x1+abs(y2-y1)*aspectRatio*(x2>x1||-1)));y2=round(max(top,min(top+imgHeight,y1+abs(x2-x1)/aspectRatio*(y2>y1||-1))));x2=round(x2)}function aspectRatioYX(){y2=max(top,min(top+imgHeight,y1+abs(x2-x1)/aspectRatio*(y2>y1||-1)));x2=round(max(left,min(left+imgWidth,x1+abs(y2-y1)*aspectRatio*(x2>x1||-1))));y2=round(y2)}function doResize(){if(abs(x2-x1)<options.minWidth){x2=x1-options.minWidth*(x2<x1||-1);if(x2<left)x1=left+options.minWidth;else if(x2>left+imgWidth)x1=left+imgWidth-options.minWidth}if(abs(y2-y1)<options.minHeight){y2=y1-options.minHeight*(y2<y1||-1);if(y2<top)y1=top+options.minHeight;else if(y2>top+imgHeight)y1=top+imgHeight-options.minHeight}x2=max(left,min(x2,left+imgWidth));y2=max(top,min(y2,top+imgHeight));if(aspectRatio)if(abs(x2-x1)/aspectRatio>abs(y2-y1))aspectRatioYX();else aspectRatioXY();if(abs(x2-x1)>options.maxWidth){x2=x1-options.maxWidth*(x2<x1||-1);if(aspectRatio)aspectRatioYX()}if(abs(y2-y1)>options.maxHeight){y2=y1-options.maxHeight*(y2<y1||-1);if(aspectRatio)aspectRatioXY()}selection={x1:selX(min(x1,x2)),x2:selX(max(x1,x2)),y1:selY(min(y1,y2)),y2:selY(max(y1,y2)),width:abs(x2-x1),height:abs(y2-y1)};update();options.onSelectChange(img,getSelection())}function selectingMouseMove(event){x2=resize==''||/w|e/.test(resize)||aspectRatio?evX(event):viewX(selection.x2);y2=resize==''||/n|s/.test(resize)||aspectRatio?evY(event):viewY(selection.y2);doResize();return false}function doMove(newX1,newY1){x2=(x1=newX1)+selection.width;y2=(y1=newY1)+selection.height;selection=$.extend(selection,{x1:selX(x1),y1:selY(y1),x2:selX(x2),y2:selY(y2)});update();options.onSelectChange(img,getSelection())}function movingMouseMove(event){x1=max(left,min(startX+evX(event),left+imgWidth-selection.width));y1=max(top,min(startY+evY(event),top+imgHeight-selection.height));doMove(x1,y1);event.preventDefault();return false}function startSelection(){adjust();x2=x1;y2=y1;doResize();resize='';if($outer.is(':not(:visible)'))$box.add($outer).hide().fadeIn(options.fadeSpeed||0);shown=true;$(document).unbind('mouseup',cancelSelection).mousemove(selectingMouseMove).one('mouseup',docMouseUp);$box.unbind('mousemove',areaMouseMove);options.onSelectStart(img,getSelection())}function cancelSelection(){$(document).unbind('mousemove',startSelection);hide($box.add($outer));selection={x1:selX(x1),y1:selY(y1),x2:selX(x1),y2:selY(y1),width:0,height:0};options.onSelectChange(img,getSelection());options.onSelectEnd(img,getSelection())}function imgMouseDown(event){if(event.which!=1||$outer.is(':animated'))return false;adjust();startX=x1=evX(event);startY=y1=evY(event);$(document).one('mousemove',startSelection).one('mouseup',cancelSelection);return false}function parentScroll(){doUpdate(false)}function imgLoad(){imgLoaded=true;setOptions(options=$.extend({classPrefix:'imgareaselect',movable:true,resizable:true,parent:'body',onInit:function(){},onSelectStart:function(){},onSelectChange:function(){},onSelectEnd:function(){}},options));$box.add($outer).css({visibility:''});if(options.show){shown=true;adjust();update();$box.add($outer).hide().fadeIn(options.fadeSpeed||0)}setTimeout(function(){options.onInit(img,getSelection())},0)}var docKeyPress=function(event){var k=options.keys,d,t,key=event.keyCode||event.which;d=!isNaN(k.alt)&&(event.altKey||event.originalEvent.altKey)?k.alt:!isNaN(k.ctrl)&&event.ctrlKey?k.ctrl:!isNaN(k.shift)&&event.shiftKey?k.shift:!isNaN(k.arrows)?k.arrows:10;if(k.arrows=='resize'||(k.shift=='resize'&&event.shiftKey)||(k.ctrl=='resize'&&event.ctrlKey)||(k.alt=='resize'&&(event.altKey||event.originalEvent.altKey))){switch(key){case 37:d=-d;case 39:t=max(x1,x2);x1=min(x1,x2);x2=max(t+d,x1);if(aspectRatio)aspectRatioYX();break;case 38:d=-d;case 40:t=max(y1,y2);y1=min(y1,y2);y2=max(t+d,y1);if(aspectRatio)aspectRatioXY();break;default:return}doResize()}else{x1=min(x1,x2);y1=min(y1,y2);switch(key){case 37:doMove(max(x1-d,left),y1);break;case 38:doMove(x1,max(y1-d,top));break;case 39:doMove(x1+min(d,imgWidth-selX(x2)),y1);break;case 40:doMove(x1,y1+min(d,imgHeight-selY(y2)));break;default:return}}return false};function styleOptions($elem,props){for(option in props)if(options[option]!==undefined)$elem.css(props[option],options[option])}function setOptions(newOptions){if(newOptions.parent)($parent=$(newOptions.parent)).append($box.add($outer));options=$.extend(options,newOptions);adjust();if(newOptions.handles!=null){$handles.remove();$handles=$([]);i=newOptions.handles?newOptions.handles=='corners'?4:8:0;while(i--)$handles=$handles.add(div());$handles.addClass(options.classPrefix+'-handle').css({position:'absolute',fontSize:0,zIndex:zIndex+1||1});if(!parseInt($handles.css('width')))$handles.width(5).height(5);if(o=options.borderWidth)$handles.css({borderWidth:o,borderStyle:'solid'});styleOptions($handles,{borderColor1:'border-color',borderColor2:'background-color',borderOpacity:'opacity'})}scaleX=options.imageWidth/imgWidth||1;scaleY=options.imageHeight/imgHeight||1;if(newOptions.x1!=null){setSelection(newOptions.x1,newOptions.y1,newOptions.x2,newOptions.y2);newOptions.show=!newOptions.hide}if(newOptions.keys)options.keys=$.extend({shift:1,ctrl:'resize'},newOptions.keys);$outer.addClass(options.classPrefix+'-outer');$area.addClass(options.classPrefix+'-selection');for(i=0;i++<4;)$($border[i-1]).addClass(options.classPrefix+'-border'+i);styleOptions($area,{selectionColor:'background-color',selectionOpacity:'opacity'});styleOptions($border,{borderOpacity:'opacity',borderWidth:'border-width'});styleOptions($outer,{outerColor:'background-color',outerOpacity:'opacity'});if(o=options.borderColor1)$($border[0]).css({borderStyle:'solid',borderColor:o});if(o=options.borderColor2)$($border[1]).css({borderStyle:'dashed',borderColor:o});$box.append($area.add($border).add($handles).add($areaOpera));if($.browser.msie){if(o=$outer.css('filter').match(/opacity=([0-9]+)/))$outer.css('opacity',o[1]/100);if(o=$border.css('filter').match(/opacity=([0-9]+)/))$border.css('opacity',o[1]/100)}if(newOptions.hide)hide($box.add($outer));else if(newOptions.show&&imgLoaded){shown=true;$box.add($outer).fadeIn(options.fadeSpeed||0);doUpdate()}aspectRatio=(d=(options.aspectRatio||'').split(/:/))[0]/d[1];if(options.disable||options.enable===false){$box.unbind('mousemove',areaMouseMove).unbind('mousedown',areaMouseDown);$img.add($outer).unbind('mousedown',imgMouseDown);$(window).unbind('resize',parentScroll);$img.add($img.parents()).unbind('scroll',parentScroll)}else if(options.enable||options.disable===false){if(options.resizable||options.movable)$box.mousemove(areaMouseMove).mousedown(areaMouseDown);if(!options.persistent)$img.add($outer).mousedown(imgMouseDown);$(window).resize(parentScroll);$img.add($img.parents()).scroll(parentScroll)}options.enable=options.disable=undefined}this.getOptions=function(){return options};this.setOptions=setOptions;this.getSelection=getSelection;this.setSelection=setSelection;this.update=doUpdate;$p=$img;while($p.length&&!$p.is('body')){if(!isNaN($p.css('z-index'))&&$p.css('z-index')>zIndex)zIndex=$p.css('z-index');if($p.css('position')=='fixed')position='fixed';$p=$p.parent()}if(!isNaN(options.zIndex))zIndex=options.zIndex;if($.browser.msie)$img.attr('unselectable','on');$.imgAreaSelect.keyPress=$.browser.msie||$.browser.safari?'keydown':'keypress';if($.browser.opera)$areaOpera=div().css({width:'100%',height:'100%',position:'absolute',zIndex:zIndex+2||2});$box.add($outer).css({visibility:'hidden',position:position,overflow:'hidden',zIndex:zIndex||'0'});$box.css({zIndex:zIndex+2||2});$area.add($border).css({position:'absolute'});img.complete||img.readyState=='complete'||!$img.is('img')?imgLoad():$img.one('load',imgLoad)};$.fn.imgAreaSelect=function(options){options=options||{};this.each(function(){if($(this).data('imgAreaSelect'))$(this).data('imgAreaSelect').setOptions(options);else{if(options.enable===undefined&&options.disable===undefined)options.enable=true;$(this).data('imgAreaSelect',new $.imgAreaSelect(this,options))}});if(options.instance)return $(this).data('imgAreaSelect');return this}})(jQuery); | |
| 0 | 2 | \ No newline at end of file | ... | ... |
thirdpartyjs/jquery/plugins/imageareaselect/scripts/jquery.imgareaselect.pack.js
0 โ 100755
| 1 | +eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(m($){1n W=2p.4F,F=2p.4E,M=2p.4D,G=2p.4C;m S(){v $("<4B/>")};$.R=m(X,b){1n L=$(X),2z,A=S(),1k=S(),I=S().u(S()).u(S()).u(S()),B=S().u(S()).u(S()).u(S()),E=$([]),1B,H,q,1g,11,U,1m,1f,1b=0,1A="1z",2f,2e,25,24,1M=10,N,P,1F,c,f,l,j,g={c:0,f:0,l:0,j:0,C:0,J:0},$p,d,i,o,w,h,2l;m 13(x){v x+1g.D-1f.D};m 1o(y){v y+1g.q-1f.q};m 19(x){v x-1g.D+1f.D};m 18(y){v y-1g.q+1f.q};m 1x(3G){v 3G.4A-1f.D};m 1w(3F){v 3F.4z-1f.q};m 14(2X){1n 1i=2X||25,1h=2X||24;v{c:G(g.c*1i),f:G(g.f*1h),l:G(g.l*1i),j:G(g.j*1h),C:G(g.l*1i)-G(g.c*1i),J:G(g.j*1h)-G(g.f*1h)}};m 2t(c,f,l,j,2W){1n 1i=2W||25,1h=2W||24;g={c:G(c/1i),f:G(f/1h),l:G(l/1i),j:G(j/1h)};g.C=(l=13(g.l))-(c=13(g.c));g.J=(j=13(g.j))-(f=13(g.f))};m 1e(){a(!L.C()){v}1g={D:G(L.2o().D),q:G(L.2o().q)};11=L.C();U=L.J();a($().4y=="1.3.2"&&$.1l.32&&1A=="1V"){1g.q+=F(V.3E.2m,$("1s").2m());1g.D+=F(V.3E.2n,$("1s").2n())}1f=$.4x(1m.r("1p"),["1z","4w"])+1?{D:G(1m.2o().D)-1m.2n(),q:G(1m.2o().q)-1m.2m()}:1A=="1V"?{D:$(V).2n(),q:$(V).2m()}:{D:0,q:0};H=13(0);q=1o(0)};m 1J(3B){a(!1F){v}A.r({D:13(g.c),q:1o(g.f)}).u(1k).C(w=g.C).J(h=g.J);1k.u(I).u(E).r({D:0,q:0});I.C(F(w-I.2V()+I.3z(),0)).J(F(h-I.3D()+I.4v(),0));$(B[0]).r({D:H,q:q,C:g.c,J:U});$(B[1]).r({D:H+g.c,q:q,C:w,J:g.f});$(B[2]).r({D:H+g.l,q:q,C:11-g.l,J:U});$(B[3]).r({D:H+g.c,q:q+g.j,C:w,J:U-g.j});w-=E.2V();h-=E.3D();2I(E.33){15 8:$(E[4]).r({D:w/2});$(E[5]).r({D:w,q:h/2});$(E[6]).r({D:w/2,q:h});$(E[7]).r({q:h/2});15 4:E.3C(1,3).r({D:w});E.3C(2,4).r({q:h})}a(3B!==Y){a($.R.1T!=2M){$(V).T($.R.1T,$.R.3A)}a(b.1I){$(V)[$.R.1T]($.R.3A=2M)}}a($.1l.1S&&I.2V()-I.3z()==2){I.r("3y",0);3r(m(){I.r("3y","4u")},0)}};m 1W(3x){1e();1J(3x);c=13(g.c);f=1o(g.f);l=13(g.l);j=1o(g.j)};m 1Y(2U,2q){b.1E?2U.4t(b.1E,2q):2U.1t()};m 1c(2T){1n x=19(1x(2T))-g.c,y=18(1w(2T))-g.f;a(!2l){1e();2l=1a;A.1j("4s",m(){2l=Y})}N="";a(b.2x){a(y<=1M){N="n"}Z{a(y>=g.J-1M){N="s"}}a(x<=1M){N+="w"}Z{a(x>=g.C-1M){N+="e"}}}A.r("2S",N?N+"-17":b.1X?"4r":"");a(1B){1B.4q()}};m 2P(4p){$("1s").r("2S","");a(b.4o||g.C*g.J==0){1Y(A.u(B),m(){$(Q).1t()})}b.2b(X,14());$(V).T("O",2g);A.O(1c)};m 2w(1L){a(1L.2L!=1){v Y}1e();a(N){$("1s").r("2S",N+"-17");c=13(g[/w/.2i(N)?"l":"c"]);f=1o(g[/n/.2i(N)?"j":"f"]);$(V).O(2g).1j("1K",2P);A.T("O",1c)}Z{a(b.1X){2f=H+g.c-1x(1L);2e=q+g.f-1w(1L);A.T("O",1c);$(V).O(2Q).1j("1K",m(){b.2b(X,14());$(V).T("O",2Q);A.O(1c)})}Z{L.1D(1L)}}v Y};m 28(){l=F(H,M(H+11,c+W(j-f)*P*(l>c||-1)));j=G(F(q,M(q+U,f+W(l-c)/P*(j>f||-1))));l=G(l)};m 29(){j=F(q,M(q+U,f+W(l-c)/P*(j>f||-1)));l=G(F(H,M(H+11,c+W(j-f)*P*(l>c||-1))));j=G(j)};m 27(){a(W(l-c)<b.2k){l=c-b.2k*(l<c||-1);a(l<H){c=H+b.2k}Z{a(l>H+11){c=H+11-b.2k}}}a(W(j-f)<b.2j){j=f-b.2j*(j<f||-1);a(j<q){f=q+b.2j}Z{a(j>q+U){f=q+U-b.2j}}}l=F(H,M(l,H+11));j=F(q,M(j,q+U));a(P){a(W(l-c)/P>W(j-f)){29()}Z{28()}}a(W(l-c)>b.3w){l=c-b.3w*(l<c||-1);a(P){29()}}a(W(j-f)>b.3v){j=f-b.3v*(j<f||-1);a(P){28()}}g={c:19(M(c,l)),l:19(F(c,l)),f:18(M(f,j)),j:18(F(f,j)),C:W(l-c),J:W(j-f)};1J();b.2c(X,14())};m 2g(2R){l=N==""||/w|e/.2i(N)||P?1x(2R):13(g.l);j=N==""||/n|s/.2i(N)||P?1w(2R):1o(g.j);27();v Y};m 1v(3u,3t){l=(c=3u)+g.C;j=(f=3t)+g.J;g=$.23(g,{c:19(c),f:18(f),l:19(l),j:18(j)});1J();b.2c(X,14())};m 2Q(2h){c=F(H,M(2f+1x(2h),H+11-g.C));f=F(q,M(2e+1w(2h),q+U-g.J));1v(c,f);2h.4n();v Y};m 2O(){1e();l=c;j=f;27();N="";a(B.1Q(":4m(:4l)")){A.u(B).1t().2y(b.1E||0)}1F=1a;$(V).T("1K",2N).O(2g).1j("1K",2P);A.T("O",1c);b.3s(X,14())};m 2N(){$(V).T("O",2O);1Y(A.u(B));g={c:19(c),f:18(f),l:19(c),j:18(f),C:0,J:0};b.2c(X,14());b.2b(X,14())};m 2v(2d){a(2d.2L!=1||B.1Q(":4k")){v Y}1e();2f=c=1x(2d);2e=f=1w(2d);$(V).1j("O",2O).1j("1K",2N);v Y};m 1C(){1W(Y)};m 2r(){2z=1a;2u(b=$.23({1H:"4j",1X:1a,2x:1a,1U:"1s",3q:m(){},3s:m(){},2c:m(){},2b:m(){}},b));A.u(B).r({31:""});a(b.2A){1F=1a;1e();1J();A.u(B).1t().2y(b.1E||0)}3r(m(){b.3q(X,14())},0)};1n 2M=m(12){1n k=b.1I,d,t,2H=12.4i||12.2L;d=!1r(k.2J)&&(12.2a||12.3n.2a)?k.2J:!1r(k.21)&&12.3o?k.21:!1r(k.22)&&12.3p?k.22:!1r(k.2K)?k.2K:10;a(k.2K=="17"||(k.22=="17"&&12.3p)||(k.21=="17"&&12.3o)||(k.2J=="17"&&(12.2a||12.3n.2a))){2I(2H){15 37:d=-d;15 39:t=F(c,l);c=M(c,l);l=F(t+d,c);a(P){29()}1u;15 38:d=-d;15 40:t=F(f,j);f=M(f,j);j=F(t+d,f);a(P){28()}1u;3m:v}27()}Z{c=M(c,l);f=M(f,j);2I(2H){15 37:1v(F(c-d,H),f);1u;15 38:1v(c,F(f-d,q));1u;15 39:1v(c+M(d,11-19(l)),f);1u;15 40:1v(c,f+M(d,U-18(j)));1u;3m:v}}v Y};m 1G(3l,2G){3j(26 4h 2G){a(b[26]!==1O){3l.r(2G[26],b[26])}}};m 2u(K){a(K.1U){(1m=$(K.1U)).3d(A.u(B))}b=$.23(b,K);1e();a(K.2F!=3k){E.4g();E=$([]);i=K.2F?K.2F=="4f"?4:8:0;34(i--){E=E.u(S())}E.20(b.1H+"-4e").r({1p:"1z",4d:0,1q:1b+1||1});a(!4c(E.r("C"))){E.C(5).J(5)}a(o=b.2E){E.r({2E:o,2B:"3g"})}1G(E,{3h:"2D-1Z",3f:"2C-1Z",3i:"1d"})}25=b.4b/11||1;24=b.4a/U||1;a(K.c!=3k){2t(K.c,K.f,K.l,K.j);K.2A=!K.1t}a(K.1I){b.1I=$.23({22:1,21:"17"},K.1I)}B.20(b.1H+"-49");1k.20(b.1H+"-48");3j(i=0;i++<4;){$(I[i-1]).20(b.1H+"-2D"+i)}1G(1k,{47:"2C-1Z",46:"1d"});1G(I,{3i:"1d",2E:"2D-C"});1G(B,{45:"2C-1Z",44:"1d"});a(o=b.3h){$(I[0]).r({2B:"3g",3e:o})}a(o=b.3f){$(I[1]).r({2B:"43",3e:o})}A.3d(1k.u(I).u(E).u(1B));a($.1l.1S){a(o=B.r("3c").3b(/1d=([0-9]+)/)){B.r("1d",o[1]/1R)}a(o=I.r("3c").3b(/1d=([0-9]+)/)){I.r("1d",o[1]/1R)}}a(K.1t){1Y(A.u(B))}Z{a(K.2A&&2z){1F=1a;A.u(B).2y(b.1E||0);1W()}}P=(d=(b.42||"").41(/:/))[0]/d[1];a(b.1P||b.1y===Y){A.T("O",1c).T("1D",2w);L.u(B).T("1D",2v);$(3a).T("17",1C);L.u(L.36()).T("35",1C)}Z{a(b.1y||b.1P===Y){a(b.2x||b.1X){A.O(1c).1D(2w)}a(!b.3Z){L.u(B).1D(2v)}$(3a).17(1C);L.u(L.36()).35(1C)}}b.1y=b.1P=1O};Q.3Y=m(){v b};Q.2Y=2u;Q.3X=14;Q.3W=2t;Q.3V=1W;$p=L;34($p.33&&!$p.1Q("1s")){a(!1r($p.r("z-2s"))&&$p.r("z-2s")>1b){1b=$p.r("z-2s")}a($p.r("1p")=="1V"){1A="1V"}$p=$p.1U()}a(!1r(b.1q)){1b=b.1q}a($.1l.1S){L.3U("3T","3S")}$.R.1T=$.1l.1S||$.1l.32?"3R":"3Q";a($.1l.3P){1B=S().r({C:"1R%",J:"1R%",1p:"1z",1q:1b+2||2})}A.u(B).r({31:"30",1p:1A,3O:"30",1q:1b||"0"});A.r({1q:1b+2||2});1k.u(I).r({1p:"1z"});X.2Z||X.3N=="2Z"||!L.1Q("3M")?2r():L.1j("3L",2r)};$.2q.R=m(16){16=16||{};Q.3K(m(){a($(Q).1N("R")){$(Q).1N("R").2Y(16)}Z{a(16.1y===1O&&16.1P===1O){16.1y=1a}$(Q).1N("R",3J $.R(Q,16))}});a(16.3I){v $(Q).1N("R")}v Q}})(3H);',62,290,'||||||||||if|_7|x1|||y1|_20|||y2||x2|function||||top|css|||add|return|||||_a|_d|width|left|_e|_2|_4|_10|_c|height|_4f|_8|_3|_1d|mousemove|_1e|this|imgAreaSelect|_5|unbind|_13|document|_1|_6|false|else||_12|_4b|_22|_28|case|_50|resize|_25|_24|true|_16|_34|opacity|_2c|_15|_11|sy|sx|one|_b|browser|_14|var|_23|position|zIndex|isNaN|body|hide|break|_40|evY|evX|enable|absolute|_17|_f|_48|mousedown|fadeSpeed|_1f|_4c|classPrefix|keys|_2d|mouseup|_3a|_1c|data|undefined|disable|is|100|msie|keyPress|parent|fixed|_30|movable|_32|color|addClass|ctrl|shift|extend|_1b|_1a|option|_3e|_3c|_3d|altKey|onSelectEnd|onSelectChange|_47|_19|_18|_38|_43|test|minHeight|minWidth|_21|scrollTop|scrollLeft|offset|Math|fn|_49|index|_2a|_4a|_46|_39|resizable|fadeIn|_9|show|borderStyle|background|border|borderWidth|handles|_4e|key|switch|alt|arrows|which|_2f|_45|_44|_36|_3b|_3f|cursor|_35|_33|outerWidth|_2b|_29|setOptions|complete|hidden|visibility|safari|length|while|scroll|parents||||window|match|filter|append|borderColor|borderColor2|solid|borderColor1|borderOpacity|for|null|_4d|default|originalEvent|ctrlKey|shiftKey|onInit|setTimeout|onSelectStart|_42|_41|maxHeight|maxWidth|_31|margin|innerWidth|onKeyPress|_2e|slice|outerHeight|documentElement|_27|_26|jQuery|instance|new|each|load|img|readyState|overflow|opera|keypress|keydown|on|unselectable|attr|update|setSelection|getSelection|getOptions|persistent||split|aspectRatio|dashed|outerOpacity|outerColor|selectionOpacity|selectionColor|selection|outer|imageHeight|imageWidth|parseInt|fontSize|handle|corners|remove|in|keyCode|imgareaselect|animated|visible|not|preventDefault|autoHide|_37|toggle|move|mouseout|fadeOut|auto|innerHeight|relative|inArray|jquery|pageY|pageX|div|round|min|max|abs'.split('|'))) | ... | ... |
thirdpartyjs/jquery/plugins/imageareaselect/scripts/jquery.min.js
0 โ 100755
| 1 | +/* | |
| 2 | + * jQuery JavaScript Library v1.3.2 | |
| 3 | + * http://jquery.com/ | |
| 4 | + * | |
| 5 | + * Copyright (c) 2009 John Resig | |
| 6 | + * Dual licensed under the MIT and GPL licenses. | |
| 7 | + * http://docs.jquery.com/License | |
| 8 | + * | |
| 9 | + * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009) | |
| 10 | + * Revision: 6246 | |
| 11 | + */ | |
| 12 | +(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F<J;F++){var G=M[F];if(G.selected){K=o(G).val();if(H){return K}L.push(K)}}return L}return(E.value||"").replace(/\r/g,"")}return g}if(typeof K==="number"){K+=""}return this.each(function(){if(this.nodeType!=1){return}if(o.isArray(K)&&/radio|checkbox/.test(this.type)){this.checked=(o.inArray(this.value,K)>=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G<E;G++){L.call(K(this[G],H),this.length>1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H<I;H++){if((G=arguments[H])!=null){for(var F in G){var K=J[F],L=G[F];if(J===L){continue}if(E&&L&&typeof L==="object"&&!L.nodeType){J[F]=o.extend(E,K||(L.length!=null?[]:{}),L)}else{if(L!==g){J[F]=L}}}}}return J};var b=/z-?index|font-?weight|opacity|zoom|line-?height/i,q=document.defaultView||{},s=Object.prototype.toString;o.extend({noConflict:function(E){l.$=p;if(E){l.jQuery=y}return o},isFunction:function(E){return s.call(E)==="[object Function]"},isArray:function(E){return s.call(E)==="[object Array]"},isXMLDoc:function(E){return E.nodeType===9&&E.documentElement.nodeName!=="HTML"||!!E.ownerDocument&&o.isXMLDoc(E.ownerDocument)},globalEval:function(G){if(G&&/\S/.test(G)){var F=document.getElementsByTagName("head")[0]||document.documentElement,E=document.createElement("script");E.type="text/javascript";if(o.support.scriptEval){E.appendChild(document.createTextNode(G))}else{E.text=G}F.insertBefore(E,F.firstChild);F.removeChild(E)}},nodeName:function(F,E){return F.nodeName&&F.nodeName.toUpperCase()==E.toUpperCase()},each:function(G,K,F){var E,H=0,I=G.length;if(F){if(I===g){for(E in G){if(K.apply(G[E],F)===false){break}}}else{for(;H<I;){if(K.apply(G[H++],F)===false){break}}}}else{if(I===g){for(E in G){if(K.call(G[E],E,G[E])===false){break}}}else{for(var J=G[0];H<I&&K.call(J,H,J)!==false;J=G[++H]){}}}return G},prop:function(H,I,G,F,E){if(o.isFunction(I)){I=I.call(H,F)}return typeof I==="number"&&G=="curCSS"&&!b.test(E)?I+"px":I},className:{add:function(E,F){o.each((F||"").split(/\s+/),function(G,H){if(E.nodeType==1&&!o.className.has(E.className,H)){E.className+=(E.className?" ":"")+H}})},remove:function(E,F){if(E.nodeType==1){E.className=F!==g?o.grep(E.className.split(/\s+/),function(G){return !o.className.has(F,G)}).join(" "):""}},has:function(F,E){return F&&o.inArray(E,(F.className||F).toString().split(/\s+/))>-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+"></"+T+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!O.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!O.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!O.indexOf("<td")||!O.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!O.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!o.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/<tbody/i.test(S),N=!O.indexOf("<table")&&!R?L.firstChild&&L.firstChild.childNodes:Q[1]=="<table>"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E<F;E++){if(H[E]===G){return E}}return -1},merge:function(H,E){var F=0,G,I=H.length;if(!o.support.getAll){while((G=E[F++])!=null){if(G.nodeType!=8){H[I++]=G}}}else{while((G=E[F++])!=null){H[I++]=G}}return H},unique:function(K){var F=[],E={};try{for(var G=0,H=K.length;G<H;G++){var J=o.data(K[G]);if(!E[J]){E[J]=true;F.push(K[G])}}}catch(I){F=K}return F},grep:function(F,J,E){var G=[];for(var H=0,I=F.length;H<I;H++){if(!E!=!J(F[H],H)){G.push(F[H])}}return G},map:function(E,J){var F=[];for(var G=0,H=E.length;G<H;G++){var I=J(E[G],G);if(I!=null){F[F.length]=I}}return F.concat.apply([],F)}});var C=navigator.userAgent.toLowerCase();o.browser={version:(C.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(C),opera:/opera/.test(C),msie:/msie/.test(C)&&!/opera/.test(C),mozilla:/mozilla/.test(C)&&!/(compatible|webkit)/.test(C)};o.each({parent:function(E){return E.parentNode},parents:function(E){return o.dir(E,"parentNode")},next:function(E){return o.nth(E,2,"nextSibling")},prev:function(E){return o.nth(E,2,"previousSibling")},nextAll:function(E){return o.dir(E,"nextSibling")},prevAll:function(E){return o.dir(E,"previousSibling")},siblings:function(E){return o.sibling(E.parentNode.firstChild,E)},children:function(E){return o.sibling(E.firstChild)},contents:function(E){return o.nodeName(E,"iframe")?E.contentDocument||E.contentWindow.document:o.makeArray(E.childNodes)}},function(E,F){o.fn[E]=function(G){var H=o.map(this,F);if(G&&typeof G=="string"){H=o.multiFilter(G,H)}return this.pushStack(o.unique(H),E,G)}});o.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(E,F){o.fn[E]=function(G){var J=[],L=o(G);for(var K=0,H=L.length;K<H;K++){var I=(K>0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}}); | |
| 13 | +/* | |
| 14 | + * Sizzle CSS Selector Engine - v0.9.3 | |
| 15 | + * Copyright 2009, The Dojo Foundation | |
| 16 | + * Released under the MIT, BSD, and GPL Licenses. | |
| 17 | + * More information: http://sizzlejs.com/ | |
| 18 | + */ | |
| 19 | +(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa<ab.length;aa++){if(ab[aa]===ab[aa-1]){ab.splice(aa--,1)}}}}}return ab};F.matches=function(T,U){return F(T,null,null,U)};F.find=function(aa,T,ab){var Z,X;if(!aa){return[]}for(var W=0,V=I.order.length;W<V;W++){var Y=I.order[W],X;if((X=I.match[Y].exec(aa))){var U=RegExp.leftContext;if(U.substr(U.length-1)!=="\\"){X[1]=(X[1]||"").replace(/\\/g,"");Z=I.find[Y](X,T,ab);if(Z!=null){aa=aa.replace(I.match[Y],"");break}}}}if(!Z){Z=T.getElementsByTagName("*")}return{set:Z,expr:aa}};F.filter=function(ad,ac,ag,W){var V=ad,ai=[],aa=ac,Y,T,Z=ac&&ac[0]&&Q(ac[0]);while(ad&&ac.length){for(var ab in I.filter){if((Y=I.match[ab].exec(ad))!=null){var U=I.filter[ab],ah,af;T=false;if(aa==ai){ai=[]}if(I.preFilter[ab]){Y=I.preFilter[ab](Y,aa,ag,ai,W,Z);if(!Y){T=ah=true}else{if(Y===true){continue}}}if(Y){for(var X=0;(af=aa[X])!=null;X++){if(af){ah=U(af,Y,X,aa);var ae=W^!!ah;if(ag&&ah!=null){if(ae){T=true}else{aa[X]=false}}else{if(ae){ai.push(af);T=true}}}}}if(ah!==g){if(!ag){aa=ai}ad=ad.replace(I.match[ab],"");if(!T){return[]}break}}}if(ad==V){if(T==null){throw"Syntax error, unrecognized expression: "+ad}else{break}}V=ad}return aa};var I=F.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(T){return T.getAttribute("href")}},relative:{"+":function(aa,T,Z){var X=typeof T==="string",ab=X&&!/\W/.test(T),Y=X&&!ab;if(ab&&!Z){T=T.toUpperCase()}for(var W=0,V=aa.length,U;W<V;W++){if((U=aa[W])){while((U=U.previousSibling)&&U.nodeType!==1){}aa[W]=Y||U&&U.nodeName===T?U||false:U===T}}if(Y){F.filter(T,aa,true)}},">":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){var W=Y.parentNode;Z[V]=W.nodeName===U?W:false}}}else{for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){Z[V]=X?Y.parentNode:Y.parentNode===U}}if(X){F.filter(U,Z,true)}}},"":function(W,U,Y){var V=L++,T=S;if(!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("parentNode",U,V,W,X,Y)},"~":function(W,U,Y){var V=L++,T=S;if(typeof U==="string"&&!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("previousSibling",U,V,W,X,Y)}},find:{ID:function(U,V,W){if(typeof V.getElementById!=="undefined"&&!W){var T=V.getElementById(U[1]);return T?[T]:[]}},NAME:function(V,Y,Z){if(typeof Y.getElementsByName!=="undefined"){var U=[],X=Y.getElementsByName(V[1]);for(var W=0,T=X.length;W<T;W++){if(X[W].getAttribute("name")===V[1]){U.push(X[W])}}return U.length===0?null:U}},TAG:function(T,U){return U.getElementsByTagName(T[1])}},preFilter:{CLASS:function(W,U,V,T,Z,aa){W=" "+W[1].replace(/\\/g,"")+" ";if(aa){return W}for(var X=0,Y;(Y=U[X])!=null;X++){if(Y){if(Z^(Y.className&&(" "+Y.className+" ").indexOf(W)>=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return U<T[3]-0},gt:function(V,U,T){return U>T[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W<T;W++){if(Y[W]===Z){return false}}return true}}}},CHILD:function(T,W){var Z=W[1],U=T;switch(Z){case"only":case"first":while(U=U.previousSibling){if(U.nodeType===1){return false}}if(Z=="first"){return true}U=T;case"last":while(U=U.nextSibling){if(U.nodeType===1){return false}}return true;case"nth":var V=W[2],ac=W[3];if(V==1&&ac==0){return true}var Y=W[0],ab=T.parentNode;if(ab&&(ab.sizcache!==Y||!T.nodeIndex)){var X=0;for(U=ab.firstChild;U;U=U.nextSibling){if(U.nodeType===1){U.nodeIndex=++X}}ab.sizcache=Y}var aa=T.nodeIndex-ac;if(V==0){return aa==0}else{return(aa%V==0&&aa/V>=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V<T;V++){U.push(X[V])}}else{for(var V=0;X[V];V++){U.push(X[V])}}}return U}}var G;if(document.documentElement.compareDocumentPosition){G=function(U,T){var V=U.compareDocumentPosition(T)&4?-1:U===T?0:1;if(V===0){hasDuplicate=true}return V}}else{if("sourceIndex" in document.documentElement){G=function(U,T){var V=U.sourceIndex-T.sourceIndex;if(V===0){hasDuplicate=true}return V}}else{if(document.createRange){G=function(W,U){var V=W.ownerDocument.createRange(),T=U.ownerDocument.createRange();V.selectNode(W);V.collapse(true);T.selectNode(U);T.collapse(true);var X=V.compareBoundaryPoints(Range.START_TO_END,T);if(X===0){hasDuplicate=true}return X}}}}(function(){var U=document.createElement("form"),V="script"+(new Date).getTime();U.innerHTML="<input name='"+V+"'/>";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="<a href='#'></a>";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="<p class='TEST'></p>";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="<div class='test e'></div><div class='test'></div>";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1&&!ac){T.sizcache=Y;T.sizset=W}if(T.nodeName===Z){X=T;break}T=T[U]}ad[W]=X}}}function S(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1){if(!ac){T.sizcache=Y;T.sizset=W}if(typeof Z!=="string"){if(T===Z){X=true;break}}else{if(F.filter(Z,[T]).length>0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z<U;Z++){F(T,V[Z],W)}return F.filter(X,W)};o.find=F;o.filter=F.filter;o.expr=F.selectors;o.expr[":"]=o.expr.filters;F.selectors.filters.hidden=function(T){return T.offsetWidth===0||T.offsetHeight===0};F.selectors.filters.visible=function(T){return T.offsetWidth>0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F<E.length){o.event.proxy(G,E[F++])}return this.click(o.event.proxy(G,function(H){this.lastToggle=(this.lastToggle||0)%F;H.preventDefault();return E[this.lastToggle++].apply(this,arguments)||false}))},hover:function(E,F){return this.mouseenter(E).mouseleave(F)},ready:function(E){B();if(o.isReady){E.call(document,o)}else{o.readyList.push(E)}return this},live:function(G,F){var E=o.event.proxy(F);E.guid+=this.selector+G;o(document).bind(i(G,this.selector),this.selector,E);return this},die:function(F,E){o(document).unbind(i(F,this.selector),E?{guid:E.guid+this.selector+F}:null);return this}});function c(H){var E=RegExp("(^|\\.)"+H.type+"(\\.|$)"),G=true,F=[];o.each(o.data(this,"events").live||[],function(I,J){if(E.test(J.type)){var K=o(H.target).closest(J.data)[0];if(K){F.push({elem:K,fn:J})}}});F.sort(function(J,I){return o.data(J.elem,"closest")-o.data(I.elem,"closest")});o.each(F,function(){if(this.fn.call(this.elem,H,this.fn.data)===false){return(G=false)}});return G}function i(F,E){return["live",F,E.replace(/\./g,"`").replace(/ /g,"|")].join(".")}o.extend({isReady:false,readyList:[],ready:function(){if(!o.isReady){o.isReady=true;if(o.readyList){o.each(o.readyList,function(){this.call(document,o)});o.readyList=null}o(document).triggerHandler("ready")}}});var x=false;function B(){if(x){return}x=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);o.ready()},false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);o.ready()}});if(document.documentElement.doScroll&&l==l.top){(function(){if(o.isReady){return}try{document.documentElement.doScroll("left")}catch(E){setTimeout(arguments.callee,0);return}o.ready()})()}}}o.event.add(l,"load",o.ready)}o.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error").split(","),function(F,E){o.fn[E]=function(G){return G?this.bind(E,G):this.trigger(E)}});o(l).bind("unload",function(){for(var E in o.cache){if(E!=1&&o.cache[E].handle){o.event.remove(o.cache[E].handle.elem)}}});(function(){o.support={};var F=document.documentElement,G=document.createElement("script"),K=document.createElement("div"),J="script"+(new Date).getTime();K.style.display="none";K.innerHTML=' <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';var H=K.getElementsByTagName("*"),E=K.getElementsByTagName("a")[0];if(!H||!H.length||!E){return}o.support={leadingWhitespace:K.firstChild.nodeType==3,tbody:!K.getElementsByTagName("tbody").length,objectAll:!!K.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!K.getElementsByTagName("link").length,style:/red/.test(E.getAttribute("style")),hrefNormalized:E.getAttribute("href")==="/a",opacity:E.style.opacity==="0.5",cssFloat:!!E.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};G.type="text/javascript";try{G.appendChild(document.createTextNode("window."+J+"=1;"))}catch(I){}F.insertBefore(G,F.firstChild);if(l[J]){o.support.scriptEval=true;delete l[J]}F.removeChild(G);if(K.attachEvent&&K.fireEvent){K.attachEvent("onclick",function(){o.support.noCloneEvent=false;K.detachEvent("onclick",arguments.callee)});K.cloneNode(true).fireEvent("onclick")}o(function(){var L=document.createElement("div");L.style.width=L.style.paddingLeft="1px";document.body.appendChild(L);o.boxModel=o.support.boxModel=L.offsetWidth===2;document.body.removeChild(L).style.display="none"})})();var w=o.support.cssFloat?"cssFloat":"styleFloat";o.props={"for":"htmlFor","class":"className","float":w,cssFloat:w,styleFloat:w,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};o.fn.extend({_load:o.fn.load,load:function(G,J,K){if(typeof G!=="string"){return this._load(G)}var I=G.indexOf(" ");if(I>=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("<div/>").append(M.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H<F;H++){var E=o.data(this[H],"olddisplay");this[H].style.display=E||"";if(o.css(this[H],"display")==="none"){var G=this[H].tagName,K;if(m[G]){K=m[G]}else{var I=o("<"+G+" />").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H<F;H++){this[H].style.display=o.data(this[H],"olddisplay")||""}return this}},hide:function(H,I){if(H){return this.animate(t("hide",3),H,I)}else{for(var G=0,F=this.length;G<F;G++){var E=o.data(this[G],"olddisplay");if(!E&&E!=="none"){o.data(this[G],"olddisplay",o.css(this[G],"display"))}}for(var G=0,F=this.length;G<F;G++){this[G].style.display="none"}return this}},_toggle:o.fn.toggle,toggle:function(G,F){var E=typeof G==="boolean";return o.isFunction(G)&&o.isFunction(F)?this._toggle.apply(this,arguments):G==null||E?this.each(function(){var H=E?G:o(this).is(":hidden");o(this)[H?"show":"hide"]()}):this.animate(t("toggle",3),G,F)},fadeTo:function(E,G,F){return this.animate({opacity:G},E,F)},animate:function(I,F,H,G){var E=o.speed(F,H,G);return this[E.queue===false?"each":"queue"](function(){var K=o.extend({},E),M,L=this.nodeType==1&&o(this).is(":hidden"),J=this;for(M in I){if(I[M]=="hide"&&L||I[M]=="show"&&!L){return K.complete.call(this)}if((M=="height"||M=="width")&&this.style){K.display=o.css(this,"display");K.overflow=this.style.overflow}}if(K.overflow!=null){this.style.overflow="hidden"}K.curAnim=o.extend({},I);o.each(I,function(O,S){var R=new o.fx(J,K,O);if(/toggle|show|hide/.test(S)){R[S=="toggle"?L?"show":"hide":S](I)}else{var Q=S.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),T=R.cur(true)||0;if(Q){var N=parseFloat(Q[2]),P=Q[3]||"px";if(P!="px"){J.style[O]=(N||1)+P;T=((N||1)/R.cur(true))*T;J.style[O]=T+P}if(Q[1]){N=((Q[1]=="-="?-1:1)*N)+T}R.custom(T,N,P)}else{R.custom(T,S,"")}}});return true})},stop:function(F,E){var G=o.timers;if(F){this.queue([])}this.each(function(){for(var H=G.length-1;H>=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J<K.length;J++){if(!K[J]()){K.splice(J--,1)}}if(!K.length){clearInterval(n);n=g}},13)}},show:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());o(this.elem).show()},hide:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(H){var G=e();if(H||G>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})(); | |
| 0 | 20 | \ No newline at end of file | ... | ... |