+/*\r
+ * Verrari - Realm\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: \r
+ * BonYong Lee <bonyong.lee@samsung.com>\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ *\r
+ */\r
package org.tizen.common.verrari;\r
\r
import java.util.Map;\r
\r
+/**\r
+ * <p>\r
+ * AttributeConfiguable\r
+ * \r
+ * interface to configure attribute\r
+ * \r
+ * </p>\r
+ * \r
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)\r
+ * \r
+ */\r
public interface\r
AttributeConfiguable\r
{\r
+ /**\r
+ * Set attribute set\r
+ * \r
+ * @param attrs attribute set\r
+ */\r
void setAttributes( Map<String, String> attrs );\r
\r
}\r
+/*\r
+ * Verrari - Realm\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: \r
+ * BonYong Lee <bonyong.lee@samsung.com>\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ *\r
+ */\r
package org.tizen.common.verrari;\r
\r
+import java.util.Collection;\r
\r
+\r
+/**\r
+ * <p>\r
+ * AttributeContainer\r
+ * \r
+ * interface to provide attibutes\r
+ * \r
+ * </p>\r
+ * \r
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)\r
+ * \r
+ */\r
public interface\r
AttributeContainer\r
{\r
+ /**\r
+ * return attibutes' keys\r
+ * \r
+ * @return keys\r
+ */\r
+ Collection<String> getAttributeKeys();\r
+ \r
+ /**\r
+ * return attribute value for <code>key</code>\r
+ * \r
+ * @param key attribute key\r
+ * \r
+ * @return attribute value\r
+ */\r
String getAttribute( final String key );\r
\r
}\r
+/*\r
+ * Verrari - Realm\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: \r
+ * BonYong Lee <bonyong.lee@samsung.com>\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ *\r
+ */\r
package org.tizen.common.verrari;\r
\r
-public class Condition\r
+import java.io.Serializable;\r
+\r
+\r
+\r
+/**\r
+ * <p>\r
+ * Condition\r
+ * \r
+ * search condition\r
+ * \r
+ * </p>\r
+ * \r
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)\r
+ * \r
+ * @see SearchableRealm\r
+ */\r
+public class\r
+Condition\r
+implements Serializable\r
{\r
+ private static final long serialVersionUID = -1254191699371474861L;\r
+ \r
+ /**\r
+ * Search condition's operation type\r
+ */\r
+ public enum Operation {\r
+ Equals,\r
+ Contains\r
+ }\r
+\r
+ /**\r
+ * left object\r
+ */\r
+ protected Object left;\r
+ \r
+ /**\r
+ * right object\r
+ */\r
+ protected Object right;\r
+ \r
+ /**\r
+ * comparision operation\r
+ */\r
+ protected Operation operation;\r
+\r
+ /**\r
+ * constructor with operation, left operand and right operand\r
+ * \r
+ * @param op operation\r
+ * @param left left operand\r
+ * @param right right operand\r
+ */\r
+ public\r
+ Condition(\r
+ final Operation op,\r
+ final Object left,\r
+ final Object right\r
+ )\r
+ {\r
+ this.operation = op;\r
+ this.left = left;\r
+ this.right = right;\r
+ }\r
+ \r
+ /**\r
+ * constructor with operation and right operand\r
+ * \r
+ * @param op operation\r
+ * @param right right operand\r
+ */\r
+ public Condition( final Operation op, final String right )\r
+ {\r
+ this( op, null, right );\r
+ }\r
+ \r
+ /**\r
+ * return operation\r
+ * \r
+ * @return operation\r
+ */\r
+ public Operation getOperation()\r
+ {\r
+ return this.operation;\r
+ }\r
+ \r
+ /**\r
+ * return left operand\r
+ * \r
+ * @return left object\r
+ */\r
+ public Object getLeft() \r
+ {\r
+ return this.left;\r
+ }\r
+ \r
+ /**\r
+ * return right operand\r
+ * \r
+ * @return right object\r
+ */\r
+ public Object getRight()\r
+ {\r
+ return this.right;\r
+ }\r
+ \r
+ \r
\r
}\r
+++ /dev/null
-package org.tizen.common.verrari;\r
-\r
-public class\r
-InvalidMapperException\r
-extends TemplateException\r
-{\r
-\r
- private static final long serialVersionUID = 3697025810808668703L;\r
- \r
- public InvalidMapperException()\r
- {\r
- super();\r
- }\r
- \r
- public InvalidMapperException( final String msg )\r
- {\r
- super( msg );\r
- }\r
-\r
-}\r
+++ /dev/null
-package org.tizen.common.verrari;\r
-\r
-public class\r
-Mappings\r
-{\r
-\r
-}\r
+/*\r
+ * Verrari - Realm\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: \r
+ * BonYong Lee <bonyong.lee@samsung.com>\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ *\r
+ */\r
package org.tizen.common.verrari;\r
\r
import java.io.IOException;\r
\r
\r
+/**\r
+ * <p>\r
+ * Realm\r
+ * \r
+ * repository for template\r
+ * \r
+ * </p>\r
+ * \r
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)\r
+ */\r
public interface\r
Realm\r
-extends RealmInfo\r
+extends AttributeContainer\r
{\r
+ /**\r
+ * <p>\r
+ * return template for <code>id</code>\r
+ * </p>\r
+ * \r
+ * @param id template id\r
+ * \r
+ * @return template for id\r
+ * \r
+ * @throws IOException If template can't be accessible\r
+ */\r
Template getTemplate( String id ) throws IOException;\r
}\r
+/*\r
+ * Verrari - Realm\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: \r
+ * BonYong Lee <bonyong.lee@samsung.com>\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ *\r
+ */\r
package org.tizen.common.verrari;\r
\r
import static org.tizen.common.util.IOUtil.getBytes;\r
import org.tizen.common.classloader.ClassSource;\r
import org.tizen.common.classloader.CustomClassLoader;\r
import org.tizen.common.classloader.JarClassSource;\r
+import org.tizen.common.verrari.realm.RealmConstants;\r
\r
+/**\r
+ * <p>\r
+ * RealmFactory\r
+ * \r
+ * Factory to create {@link Realm} using realm definition\r
+ * \r
+ * </p>\r
+ * \r
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)\r
+ */\r
public class\r
RealmFactory\r
implements FactoryWithArgument<Realm, URL>\r
{\r
- protected static final String ATTR_LOADER = "loader";\r
- \r
- protected static final String MIME_JSON = "application/json";\r
- \r
- protected static final String PROP_REALM = "Tizen-Template-Realm";\r
- \r
+ /**\r
+ * singleton instance\r
+ */\r
protected static final RealmFactory instance = new RealmFactory();\r
\r
+ /**\r
+ * logger for this object\r
+ */\r
protected final Logger logger = LoggerFactory.getLogger( getClass() );\r
\r
+ /**\r
+ * access method for singleton object\r
+ * \r
+ * @return singleton instance\r
+ */\r
public static RealmFactory getInstance()\r
{\r
return instance;\r
}\r
\r
+ /**\r
+ * Read and parse realm definition from <code>in</code>\r
+ * \r
+ * @param in {@link InputStream} to provide realm definition\r
+ * @param contentType contents type of <code>in</code>\r
+ * \r
+ * @return attributes {@link Map}\r
+ * \r
+ * @throws IOException If can't read from <code>in</code>\r
+ */\r
protected\r
Map<String, String>\r
parseRealm(\r
{\r
HashMap<String, String> attrs = null;\r
\r
- if ( MIME_JSON.equals( contentType ) )\r
+ final byte[] bytes = getBytes( in );\r
+ logger.debug( "Realm config :\n{}", new String( bytes ) );\r
+ \r
+ \r
+ final ByteArrayInputStream byteIn = new ByteArrayInputStream( bytes );\r
+ \r
+ attrs = new HashMap<String, String>();\r
+ final ObjectMapper mapper = new ObjectMapper();\r
+ JsonNode node = mapper.readValue( byteIn, JsonNode.class );\r
+ \r
+ for ( final Iterator<String> iter = node.getFieldNames() ; iter.hasNext() ; )\r
{\r
- attrs = new HashMap<String, String>();\r
- final ObjectMapper mapper = new ObjectMapper();\r
- JsonNode node = mapper.readValue( in, JsonNode.class );\r
- \r
- for ( final Iterator<String> iter = node.getFieldNames() ; iter.hasNext() ; )\r
- {\r
- final String key = iter.next();\r
- attrs.put( key, node.get( key ).asText() );\r
- }\r
+ final String key = iter.next();\r
+ attrs.put( key, node.get( key ).asText() );\r
}\r
logger.debug( "Realm Attributes :{}", attrs );\r
\r
}\r
\r
\r
+ /* (non-Javadoc)\r
+ * @see org.tizen.common.FactoryWithArgument#create(java.lang.Object)\r
+ */\r
@Override\r
public\r
Realm\r
{\r
\r
final String contentType =\r
- nvl( con.getContentType(), MIME_JSON );\r
+ nvl( con.getContentType(), RealmConstants.MIME_JSON );\r
+ \r
+ logger.debug( "Contents mime :{}", contentType );\r
\r
final Map<String, String> attrs = parseRealm( in, contentType );\r
\r
{\r
throw new IllegalArgumentException( "Realm[" + url + "] not found" );\r
}\r
- final String loader = attrs.get( ATTR_LOADER );\r
+ final String loader = attrs.get( RealmConstants.ATTR_LOADER );\r
logger.debug( "Loader :{}", loader );\r
final ClassSource source = new JarClassSource( loader );\r
logger.debug( "Source :{}", source );\r
}\r
}\r
\r
+ /**\r
+ * Load realm from definition\r
+ * \r
+ * @param cl {@link ClassLoader} to load\r
+ * @param attrs realm attributes\r
+ * \r
+ * @return {@link Realm}\r
+ * \r
+ * @throws IOException If can't read info\r
+ * @throws ClassNotFoundException If can't load realm\r
+ * @throws InstantiationException If can't instantiate realm\r
+ * @throws IllegalAccessException If can't instantiate realm\r
+ */\r
protected\r
Realm\r
load(\r
return null;\r
}\r
\r
+ /**\r
+ * Return realm name\r
+ * \r
+ * @param in realm difinition\r
+ * \r
+ * @return realm name\r
+ * \r
+ * @throws IOException If can't read from <code>in</code>\r
+ */\r
public\r
String\r
getRealmName(\r
byte[] contents = getBytes( in );\r
final Manifest m = new Manifest( new ByteArrayInputStream( contents ) );\r
final Attributes attrs = m.getMainAttributes();\r
- final String realmName = trim( attrs.getValue( PROP_REALM ) );\r
+ final String realmName = trim( attrs.getValue( RealmConstants.ATTR_REALM ) );\r
if ( null != realmName )\r
{\r
logger.info( "Realm name :{}", realmName );\r
+++ /dev/null
-package org.tizen.common.verrari;\r
-\r
-public interface\r
-RealmInfo\r
-{\r
- String getAttribute( String key );\r
-}\r
--- /dev/null
+/*\r
+ * Verrari - Realm\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: \r
+ * BonYong Lee <bonyong.lee@samsung.com>\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ *\r
+ */\r
+package org.tizen.common.verrari;\r
+\r
+import java.io.IOException;\r
+import java.util.Collection;\r
+\r
+/**\r
+ * <p>\r
+ * SearchableRealm\r
+ * \r
+ * {@link Realm} to enable to search\r
+ * \r
+ * </p>\r
+ * \r
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)\r
+ * \r
+ */\r
+public interface\r
+SearchableRealm\r
+{\r
+ /**\r
+ * Search template matching with condition\r
+ * \r
+ * @param condition search condition\r
+ * \r
+ * @return template list\r
+ * \r
+ * @throws IOException If can't access realm\r
+ */\r
+ Collection<AttributeContainer> search( Condition condition ) throws IOException;\r
+\r
+}\r
+/*\r
+ * Verrari - Realm\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: \r
+ * BonYong Lee <bonyong.lee@samsung.com>\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ *\r
+ */\r
package org.tizen.common.verrari;\r
\r
import java.io.IOException;\r
import java.io.InputStream;\r
import java.io.OutputStream;\r
\r
+/**\r
+ * <p>\r
+ * Storage\r
+ * \r
+ * Interface to store data into any storage with key\r
+ * \r
+ * </p>\r
+ * \r
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)\r
+ */\r
public interface\r
Storage\r
{\r
+ /**\r
+ * return target to write\r
+ * \r
+ * @param key key string for data\r
+ * \r
+ * @return {@link OutputStream} to write\r
+ * \r
+ * @throws IOException If target can't be accessible\r
+ */\r
OutputStream getTarget( String key ) throws IOException;\r
\r
+ /**\r
+ * return source to read\r
+ * \r
+ * @param key key string for data\r
+ * \r
+ * @return {@link InputStream} to read\r
+ * \r
+ * @throws IOException If source can't be accessible\r
+ */\r
InputStream getSource( String key ) throws IOException;\r
}\r
+/*\r
+ * Verrari - Realm\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: \r
+ * BonYong Lee <bonyong.lee@samsung.com>\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ *\r
+ */\r
package org.tizen.common.verrari;\r
\r
\r
+\r
+/**\r
+ * <p>\r
+ * Template\r
+ * \r
+ * Interface of template\r
+ * \r
+ * </p>\r
+ * \r
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)\r
+ */\r
public interface\r
Template\r
extends AttributeContainer\r
{\r
- void template( Storage storage ) throws TemplateException;\r
+ /**\r
+ * apply model and generate result\r
+ * \r
+ * @param models {@link IModelProvider} to provider models\r
+ * @param storage storage to store result\r
+ * \r
+ * @throws TemplateException If process is break\r
+ * \r
+ * @see IModelProvider\r
+ * @see Storage\r
+ */\r
+ void template( IModelProvider models, Storage storage ) throws TemplateException;\r
}\r
+++ /dev/null
-package org.tizen.common.verrari;\r
-\r
-import java.util.Collection;\r
-\r
-public interface\r
-TemplateSearchable\r
-{\r
- Collection<AttributeContainer> search( Condition condition );\r
-\r
-}\r
+++ /dev/null
-package org.tizen.common.verrari;\r
-\r
-public class\r
-UnsupportedVersion\r
-extends TemplateException\r
-{\r
-\r
- private static final long serialVersionUID = 6945520707261158918L;\r
-\r
-}\r
--- /dev/null
+/*\r
+ * Verrari - Realm\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: \r
+ * BonYong Lee <bonyong.lee@samsung.com>\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ *\r
+ */\r
+package org.tizen.common.verrari.exception;\r
+\r
+import org.tizen.common.verrari.TemplateException;\r
+\r
+/**\r
+ * <p>\r
+ * InvalidMapperException\r
+ * \r
+ * exception in case that mapper is invalid\r
+ * \r
+ * </p>\r
+ * \r
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)\r
+ * \r
+ * @see TemplateException\r
+ */\r
+public class\r
+InvalidMapperException\r
+extends TemplateException\r
+{\r
+\r
+ /**\r
+ * serialVersionUID\r
+ */\r
+ private static final long serialVersionUID = 3697025810808668703L;\r
+ \r
+ /**\r
+ * default constructor\r
+ */\r
+ public InvalidMapperException()\r
+ {\r
+ super();\r
+ }\r
+ \r
+ /**\r
+ * constructor with message\r
+ * \r
+ * @param msg message\r
+ */\r
+ public\r
+ InvalidMapperException(\r
+ final String msg\r
+ )\r
+ {\r
+ super( msg );\r
+ }\r
+\r
+}\r
--- /dev/null
+/*\r
+ * Verrari - Realm\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: \r
+ * BonYong Lee <bonyong.lee@samsung.com>\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ *\r
+ */\r
+package org.tizen.common.verrari.exception;\r
+\r
+import org.tizen.common.verrari.TemplateException;\r
+\r
+/**\r
+ * <p>\r
+ * UnsupportedVersionException\r
+ * \r
+ * exception in case that version is unsupported\r
+ * \r
+ * </p>\r
+ * \r
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)\r
+ */\r
+public class\r
+UnsupportedVersionException\r
+extends TemplateException\r
+{\r
+\r
+ /**\r
+ * serialVersionUID\r
+ */\r
+ private static final long serialVersionUID = 6945520707261158918L;\r
+\r
+}\r
+/*\r
+ * Verrari - Realm\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: \r
+ * BonYong Lee <bonyong.lee@samsung.com>\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ *\r
+ */\r
package org.tizen.common.verrari.realm;\r
\r
import java.io.IOException;\r
import java.util.ArrayList;\r
+import java.util.Collection;\r
\r
import org.tizen.common.verrari.Realm;\r
import org.tizen.common.verrari.Template;\r
\r
-public class CompositeRealm\r
+/**\r
+ * <p>\r
+ * CompositeRealm\r
+ * \r
+ * delegate multiple realms\r
+ * \r
+ * </p>\r
+ * \r
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)\r
+ * \r
+ * @see Realm\r
+ */\r
+public class\r
+CompositeRealm\r
implements Realm\r
{\r
\r
+ /**\r
+ * realm chain\r
+ */\r
protected final ArrayList<Realm> chain = new ArrayList<Realm>();\r
\r
+ /**\r
+ * add new realm into realm chain\r
+ * \r
+ * @param realm new realm to add\r
+ */\r
public\r
void\r
addRealm(\r
{\r
chain.add( realm );\r
}\r
+ \r
+ /* (non-Javadoc)\r
+ * @see org.tizen.common.verrari.AttributeContainer#getAttributeKeys()\r
+ */\r
+ @Override\r
+ public Collection<String> getAttributeKeys()\r
+ {\r
+ throw new UnsupportedOperationException();\r
+ }\r
\r
+ /* (non-Javadoc)\r
+ * @see org.tizen.common.verrari.RealmInfo#getAttribute(java.lang.String)\r
+ */\r
@Override\r
public\r
String\r
throw new UnsupportedOperationException();\r
}\r
\r
+ /* (non-Javadoc)\r
+ * @see org.tizen.common.verrari.Realm#getTemplate(java.lang.String)\r
+ */\r
@Override\r
public\r
Template\r
+++ /dev/null
-package org.tizen.common.verrari.realm;\r
-\r
-public interface\r
-IRealmConstants\r
-{\r
- String ATTR_ID = "id";\r
- \r
- String ATTR_TEMPLATE_TYPE = "template-query-type";\r
- String ATTR_TEMPLATE_URL = "template-query-url";\r
- \r
- String ATTR_SEARCH_TYPE = "search-query-type";\r
- String ATTR_SEARCH_URL = "search-query-url";\r
-\r
-}\r
+/*\r
+ * Verrari - Realm\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: \r
+ * BonYong Lee <bonyong.lee@samsung.com>\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ *\r
+ */\r
package org.tizen.common.verrari.realm;\r
\r
import java.util.Map;\r
\r
+/**\r
+ * <p>\r
+ * Query\r
+ * \r
+ * object to make query string from argument\r
+ * \r
+ * </p>\r
+ * \r
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)\r
+ * \r
+ */\r
public interface\r
Query\r
{\r
+ /**\r
+ * make query string from <code>args</code>\r
+ * \r
+ * @param args argument map\r
+ * \r
+ * @return query string\r
+ */\r
String query( Map<String, Object> args );\r
}\r
--- /dev/null
+/*\r
+ * Verrari - Realm\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: \r
+ * BonYong Lee <bonyong.lee@samsung.com>\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ *\r
+ */\r
+package org.tizen.common.verrari.realm;\r
+\r
+\r
+/**\r
+ * <p>\r
+ * RealmConstants\r
+ * \r
+ * constant pool for realm\r
+ * \r
+ * </p>\r
+ * \r
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)\r
+ * \r
+ */\r
+public class\r
+RealmConstants\r
+{\r
+ /**\r
+ * Realm loader\r
+ */\r
+ public static final String ATTR_LOADER = "loader";\r
+ \r
+ /**\r
+ * json realm definition format\r
+ */\r
+ public static final String MIME_JSON = "application/json";\r
+ \r
+ /**\r
+ * Template realm\r
+ */\r
+ public static final String ATTR_REALM = "Tizen-Template-Realm";\r
+ \r
+\r
+ /**\r
+ * realm id\r
+ */\r
+ public static final String ATTR_ID = "id";\r
+ \r
+ /**\r
+ * how-to make template query\r
+ */\r
+ public static final String ATTR_TEMPLATE_TYPE = "template-query-type";\r
+ /**\r
+ * template query url\r
+ */\r
+ public static final String ATTR_TEMPLATE_URL = "template-query-url";\r
+ \r
+ /**\r
+ * how-to make search query\r
+ */\r
+ public static final String ATTR_SEARCH_TYPE = "search-query-type";\r
+ /**\r
+ * search query url\r
+ */\r
+ public static final String ATTR_SEARCH_URL = "search-query-url";\r
+ \r
+ /**\r
+ * directory search type\r
+ */\r
+ public static final String SEARCH_TYPE_DIR = "directory";\r
+ /**\r
+ * parameter search type\r
+ */\r
+ public static final String SEARCH_TYPE_PARAMETER = "parameter";// TODO Not implement\r
+\r
+}\r
+/*\r
+ * Verrari - Realm\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: \r
+ * BonYong Lee <bonyong.lee@samsung.com>\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ *\r
+ */\r
package org.tizen.common.verrari.realm;\r
\r
import static org.tizen.common.util.IOUtil.getBytes;\r
+import static org.tizen.common.util.IOUtil.tryClose;\r
\r
import java.io.IOException;\r
import java.io.InputStream;\r
import java.net.URL;\r
-import java.net.URLConnection;\r
+import java.util.Collection;\r
import java.util.HashMap;\r
import java.util.Map;\r
\r
import org.slf4j.Logger;\r
import org.slf4j.LoggerFactory;\r
-import org.tizen.common.Adaptable;\r
-import org.tizen.common.AdaptableWithArgument;\r
import org.tizen.common.util.MapUtil;\r
import org.tizen.common.verrari.AttributeConfiguable;\r
import org.tizen.common.verrari.Realm;\r
import org.tizen.common.verrari.template.StandardTemplate;\r
import org.tizen.common.verrari.util.QueryFactory;\r
\r
+/**\r
+ * <p>\r
+ * StandardRealm\r
+ * \r
+ * Built-in {@link Realm} to provide RI\r
+ * \r
+ * </p>\r
+ * \r
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)\r
+ * \r
+ * @see Realm\r
+ * @see AttributeConfiguable\r
+ */\r
public class\r
StandardRealm\r
-implements Realm, AttributeConfiguable, Adaptable, AdaptableWithArgument, IRealmConstants\r
+implements Realm, AttributeConfiguable\r
{\r
+ /**\r
+ * logger for this object\r
+ */\r
protected final Logger logger = LoggerFactory.getLogger( getClass() );\r
\r
+ /**\r
+ * attribute( ,metadata ) for realm\r
+ */\r
protected HashMap<String, String> attributes;\r
\r
+ /* (non-Javadoc)\r
+ * @see org.tizen.common.verrari.AttributeContainer#getAttributeKeys()\r
+ */\r
@Override\r
- public String toString()\r
+ public Collection<String> getAttributeKeys()\r
{\r
- return attributes.get( ATTR_ID ) + "@" + Realm.class.getSimpleName();\r
+ return attributes.keySet();\r
}\r
\r
+ /* (non-Javadoc)\r
+ * @see org.tizen.common.verrari.AttributeContainer#getAttribute(java.lang.String)\r
+ */\r
@Override\r
public String getAttribute( final String key )\r
{\r
return attributes.get( key );\r
}\r
\r
+ /* (non-Javadoc)\r
+ * @see org.tizen.common.verrari.AttributeConfiguable#setAttributes(java.util.Map)\r
+ */\r
@Override\r
public void setAttributes( final Map<String, String> attrs )\r
{\r
}\r
\r
\r
+ /* (non-Javadoc)\r
+ * @see org.tizen.common.verrari.Realm#getTemplate(java.lang.String)\r
+ */\r
@SuppressWarnings("unchecked")\r
@Override\r
public\r
throw new IOException( "Template[" + id + "] not found" );\r
}\r
\r
- final byte[] bytes = getBytes( in, true );\r
+ try\r
+ {\r
+ return getTemplate( in );\r
+ }\r
+ finally\r
+ {\r
+ tryClose( in );\r
+ }\r
+ }\r
+ \r
+ /**\r
+ * extract template from {@link InputStream}\r
+ * \r
+ * @param in {@link InputStream} to read\r
+ * \r
+ * @return template to be extracted\r
+ * \r
+ * @throws IOException If <code>in</code> throw {@link IOException}\r
+ */\r
+ public\r
+ Template\r
+ getTemplate(\r
+ final InputStream in\r
+ )\r
+ throws IOException\r
+ {\r
+ \r
+ final byte[] bytes = getBytes( in );\r
\r
try\r
{\r
{\r
throw new IOException( e );\r
}\r
+ \r
}\r
\r
+ /**\r
+ * make template query\r
+ * \r
+ * @return template query\r
+ * \r
+ * @see QueryFactory\r
+ */\r
protected\r
Query\r
getTemplateQuery()\r
return factory.createTemplateQuery( this );\r
}\r
\r
- protected\r
- Query\r
- getSearchQuery()\r
- {\r
- final QueryFactory factory = QueryFactory.getInstance();\r
- return factory.createSearchQuery( this );\r
- }\r
-\r
- @SuppressWarnings({ "unchecked" })\r
+ /* (non-Javadoc)\r
+ * @see java.lang.Object#toString()\r
+ */\r
@Override\r
- public <T> T adapt( Class<T> clazz )\r
+ public String toString()\r
{\r
- if ( clazz.isAssignableFrom( getClass() ) )\r
- {\r
- return (T) this;\r
- }\r
- \r
- \r
- return null;\r
+ return attributes.get( RealmConstants.ATTR_ID ) + "@" + Realm.class.getSimpleName();\r
}\r
\r
- @SuppressWarnings({ "hiding" })\r
- @Override\r
- public <T, Object> T adapt( Class<T> clazz, Object arg )\r
- {\r
- \r
- return adapt( clazz );\r
- }\r
-\r
\r
}\r
+/*\r
+ * Verrari - Realm\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: \r
+ * BonYong Lee <bonyong.lee@samsung.com>\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ *\r
+ */\r
package org.tizen.common.verrari.realm;\r
\r
+import static org.tizen.common.util.IOUtil.tryClose;\r
+\r
+import java.io.File;\r
+import java.io.FileInputStream;\r
+import java.io.IOException;\r
+import java.net.MalformedURLException;\r
+import java.net.URL;\r
import java.util.Collection;\r
+import java.util.HashSet;\r
\r
-import org.tizen.common.verrari.Condition;\r
import org.tizen.common.verrari.AttributeContainer;\r
-import org.tizen.common.verrari.TemplateSearchable;\r
+import org.tizen.common.verrari.Condition;\r
+import org.tizen.common.verrari.Condition.Operation;\r
+import org.tizen.common.verrari.SearchableRealm;\r
+import org.tizen.common.verrari.Template;\r
\r
+/**\r
+ * <p>\r
+ * StandardSearchableRealm\r
+ * \r
+ * Built-in {@link SearchableRealm} to provide RI\r
+ * \r
+ * </p>\r
+ * \r
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)\r
+ * \r
+ * @see SearchableRealm\r
+ */\r
public class\r
StandardSearchableRealm\r
-implements TemplateSearchable\r
+extends StandardRealm\r
+implements SearchableRealm\r
{\r
\r
+ /* (non-Javadoc)\r
+ * @see org.tizen.common.verrari.SearchableRealm#search(org.tizen.common.verrari.Condition)\r
+ */\r
@Override\r
- public Collection<AttributeContainer> search(Condition condition)\r
+ public\r
+ Collection<AttributeContainer>\r
+ search(\r
+ final Condition condition\r
+ )\r
+ throws IOException\r
{\r
- // TODO Auto-generated method stub\r
- return null;\r
+ final HashSet<AttributeContainer> ret = new HashSet<AttributeContainer>();\r
+ \r
+ String type = getAttribute( RealmConstants.ATTR_SEARCH_TYPE );\r
+ String urlStr = getAttribute( RealmConstants.ATTR_SEARCH_URL );\r
+ if ( RealmConstants.SEARCH_TYPE_DIR.equals( type ) )\r
+ {\r
+ URL url;\r
+ try\r
+ {\r
+ url = new URL( urlStr );\r
+ }\r
+ catch (\r
+ final MalformedURLException e\r
+ )\r
+ {\r
+ throw new IllegalArgumentException( "Invalid URL :" + urlStr, e );\r
+ }\r
+ if ( !"file".equals( url.getProtocol() ) ) \r
+ {\r
+ throw new UnsupportedOperationException( "Check search url. It must start with \"file://\"" );\r
+ }\r
+ \r
+ final Operation op = condition.getOperation();\r
+ final String keyword = (String) condition.getRight();\r
+ \r
+ final String path = url.getFile();\r
+ final File dir = new File( path );\r
+ final File[] files = dir.listFiles();\r
+ for ( final File file : files )\r
+ {\r
+ logger.debug( "File :{}", file.getCanonicalPath() );\r
+ switch ( op )\r
+ {\r
+ case Contains:\r
+ final FileInputStream fileIn = new FileInputStream( file );\r
+ try\r
+ {\r
+ final Template template = getTemplate( fileIn );\r
+ final Collection<String> keys = template.getAttributeKeys();\r
+ for ( final String key : keys )\r
+ {\r
+ final String value = template.getAttribute( key );\r
+ if ( value.contains( keyword ) )\r
+ {\r
+ ret.add( template );\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ finally\r
+ {\r
+ tryClose( fileIn );\r
+ }\r
+ \r
+ break;\r
+\r
+ default:\r
+ break;\r
+ }\r
+ }\r
+ \r
+ }\r
+ \r
+ return ret;\r
}\r
\r
}\r
+/*\r
+ * Verrari - Realm\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: \r
+ * BonYong Lee <bonyong.lee@samsung.com>\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ *\r
+ */\r
package org.tizen.common.verrari.storage;\r
\r
import static org.tizen.common.util.FilenameUtil.removeTailingPath;\r
import org.slf4j.Logger;\r
import org.slf4j.LoggerFactory;\r
import org.tizen.common.file.FileHandler;\r
-import org.tizen.common.file.FileHandler.Attribute;\r
-import org.tizen.common.util.FilenameUtil;\r
+import org.tizen.common.util.Assert;\r
import org.tizen.common.util.io.BufferInputStream;\r
import org.tizen.common.util.io.BufferOutputStream;\r
import org.tizen.common.verrari.Storage;\r
import org.tizen.common.verrari.util.BufferFactory;\r
\r
+/**\r
+ * <p>\r
+ * FileStorage\r
+ * \r
+ * {@link Storage} to store data in file\r
+ * \r
+ * </p>\r
+ * \r
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)\r
+ * \r
+ * @see Storage\r
+ * @see FileHandler\r
+ */\r
public class\r
FileStorage\r
implements Storage\r
{\r
+ /**\r
+ * logger for this object\r
+ */\r
protected final Logger logger = LoggerFactory.getLogger( getClass() );\r
\r
+ /**\r
+ * {@link FileHandler} for file access\r
+ */\r
protected FileHandler handler = null;\r
\r
+ /**\r
+ * constructor with {@link FileHandler}\r
+ * \r
+ * @param handler {@link FileHandler}\r
+ */\r
public\r
FileStorage(\r
final FileHandler handler\r
)\r
{\r
- if ( null == handler )\r
- {\r
- throw new NullPointerException();\r
- }\r
+ Assert.notNull( handler );\r
this.handler = handler;\r
}\r
\r
+ /* (non-Javadoc)\r
+ * @see org.tizen.common.verrari.Storage#getTarget(java.lang.String)\r
+ */\r
@Override\r
public\r
OutputStream\r
return bufferOut;\r
}\r
\r
+ /* (non-Javadoc)\r
+ * @see org.tizen.common.verrari.Storage#getSource(java.lang.String)\r
+ */\r
@Override\r
public\r
InputStream\r
+++ /dev/null
-package org.tizen.common.verrari.template;\r
-\r
-public interface ITemplateConstants\r
-{\r
- String ATTR_NAME = "Tizen-Template-Name";\r
- String ATTR_TAGS = "Tizen-Template-Tags";\r
- \r
- String ATTR_VERSION = "Tizen-Template-Version";\r
- \r
- String ATTR_EXCLUDE = "Tizen-Template-Exclude";\r
- String ATTR_INCLUDE = "Tizen-Template-Include";\r
- \r
- String ATTR_MAPPER = "Tizen-Template-Mapper";\r
- String DV_MAPPER = StandardMapper.class.getName();\r
- \r
- String ATTR_MAPPING = "Tizen-Template-Mapper";\r
-\r
-}\r
+/*\r
+ * Verrari - Realm\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: \r
+ * BonYong Lee <bonyong.lee@samsung.com>\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ *\r
+ */\r
package org.tizen.common.verrari.template;\r
\r
+import java.util.Map;\r
+\r
+\r
+/**\r
+ * <p>\r
+ * Mapper\r
+ * \r
+ * interface to string mapping along mapping rule.\r
+ * \r
+ * </p>\r
+ * \r
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)\r
+ * \r
+ */\r
public interface\r
Mapper\r
{\r
+ /**\r
+ * Configure mapping rule\r
+ * \r
+ * @param mappings mapping rule\r
+ */\r
+ void setMappings( Map<String, String> mappings );\r
+ \r
+ /**\r
+ * apply rule and generate result string for <code>value</code>\r
+ * \r
+ * @param value input strng\r
+ * \r
+ * @return output string\r
+ */\r
String map( String value );\r
+\r
}\r
+/*\r
+ * Verrari - Realm\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: \r
+ * BonYong Lee <bonyong.lee@samsung.com>\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ *\r
+ */\r
package org.tizen.common.verrari.template;\r
\r
+import static org.tizen.common.util.IOUtil.tryClose;\r
+\r
+import java.io.ByteArrayOutputStream;\r
+import java.util.Collections;\r
+import java.util.HashMap;\r
+import java.util.Map;\r
import java.util.regex.Pattern;\r
\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
+import org.tizen.common.verrari.ITemplateEngine;\r
+import org.tizen.common.verrari.engine.TemplateEngineFactory;\r
+import org.tizen.common.verrari.model.ModelManager;\r
+import org.tizen.common.verrari.util.BufferFactory;\r
+\r
+\r
+/**\r
+ * <p>\r
+ * StandardMapper\r
+ * \r
+ * {@link Mapper} using regular expression\r
+ * \r
+ * </p>\r
+ * \r
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)\r
+ * \r
+ * @see Mapper\r
+ */\r
public class\r
StandardMapper\r
implements Mapper\r
{\r
+ /**\r
+ * dummpy key for template engine\r
+ */\r
+ protected static final String PROP_KEY_TEMPLATE = "key";\r
+ \r
+ /**\r
+ * dummy value for template engine\r
+ */\r
+ protected static final String PROP_VALUE_TEMPLATE = "value";\r
+ \r
+ /**\r
+ * logger for this object\r
+ */\r
+ protected final Logger logger = LoggerFactory.getLogger( getClass() );\r
+ \r
+ /**\r
+ * mapping rule\r
+ */\r
+ protected Map<String, String> mappings = new HashMap<String, String>();\r
\r
+ /* (non-Javadoc)\r
+ * @see org.tizen.common.verrari.template.Mapper#setMappings(java.util.Map)\r
+ */\r
@Override\r
- public String map(String value)\r
+ public\r
+ void\r
+ setMappings(\r
+ final Map<String, String> mappings\r
+ )\r
{\r
- // TODO Auto-generated method stub\r
- return null;\r
+ logger.info( "Mappings :{}", mappings );\r
+ this.mappings = Collections.unmodifiableMap( mappings );\r
}\r
\r
- public static void main(String[] args)\r
+ /* (non-Javadoc)\r
+ * @see org.tizen.common.verrari.template.Mapper#map(java.lang.String)\r
+ */\r
+ @Override\r
+ public\r
+ String\r
+ map(\r
+ final String value\r
+ )\r
{\r
- final String pattern = "(a[0-9]+)(b[0-9]+)";\r
- final String str = "a3b2";\r
- System.out.println( Pattern.matches( pattern, str ) );\r
- System.out.println( str.replaceAll( pattern, "-$0-" ) );\r
+ for ( final String key : this.mappings.keySet() )\r
+ {\r
+ if ( !Pattern.matches( key, value ) )\r
+ { // if this rule is not for value, skip to next\r
+ continue;\r
+ }\r
+ \r
+ final String target = this.mappings.get( key );\r
+ \r
+ // configure template engine\r
+ final ITemplateEngine engine = TemplateEngineFactory.getInstance().create();\r
+ final TemplateManager templates = new TemplateManager();\r
+ engine.setTemplateProvider( templates );\r
+ \r
+ InMemoryTemplate keyTemplate = null;\r
+ InMemoryTemplate valueTemplate = null;\r
+ try\r
+ {\r
+ keyTemplate = new InMemoryTemplate( key.getBytes(), "utf-8", BufferFactory.getInstance() );\r
+ valueTemplate = new InMemoryTemplate( target.getBytes(), "utf-8", BufferFactory.getInstance() );\r
+ templates.addTemplate( PROP_KEY_TEMPLATE, keyTemplate );\r
+ templates.addTemplate( PROP_VALUE_TEMPLATE, valueTemplate );\r
+ final ByteArrayOutputStream keyOut = new ByteArrayOutputStream();\r
+ engine.generate( PROP_KEY_TEMPLATE, new ModelManager(), keyOut );\r
+ final ByteArrayOutputStream valueOut = new ByteArrayOutputStream();\r
+ engine.generate( PROP_VALUE_TEMPLATE, new ModelManager(), valueOut );\r
+\r
+ final String keyStr = keyOut.toString();\r
+ final String valueStr = valueOut.toString();\r
+ \r
+ logger.info( "Key :{}, Value :{}", keyStr, valueStr );\r
+ return value.replaceAll( keyStr, valueStr );\r
+ }\r
+ catch\r
+ (\r
+ final Exception e\r
+ )\r
+ {\r
+ logger.error( "No effective mapping for {}", value, e );\r
+ }\r
+ finally\r
+ {\r
+ tryClose( keyTemplate, valueTemplate );\r
+ }\r
+ }\r
+ return value;\r
}\r
\r
+\r
}\r
+/*\r
+ * Verrari - Realm\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: \r
+ * BonYong Lee <bonyong.lee@samsung.com>\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ *\r
+ */\r
package org.tizen.common.verrari.template;\r
\r
import static org.tizen.common.util.IOUtil.getBytes;\r
import static org.tizen.common.util.IOUtil.tryClose;\r
import static org.tizen.common.util.StringUtil.nvl;\r
+import static org.tizen.common.verrari.template.TemplateConstants.ATTR_COPY;\r
+import static org.tizen.common.verrari.template.TemplateConstants.ATTR_EXCLUDE;\r
+import static org.tizen.common.verrari.template.TemplateConstants.ATTR_INCLUDE;\r
+import static org.tizen.common.verrari.template.TemplateConstants.ATTR_MAPPER;\r
+import static org.tizen.common.verrari.template.TemplateConstants.ATTR_MAPPING;\r
+import static org.tizen.common.verrari.template.TemplateConstants.ATTR_VERSION;\r
+import static org.tizen.common.verrari.template.TemplateConstants.DV_MAPPER;\r
\r
+import java.io.BufferedReader;\r
import java.io.ByteArrayInputStream;\r
import java.io.IOException;\r
+import java.io.InputStream;\r
import java.io.OutputStream;\r
+import java.io.StringReader;\r
+import java.util.Collection;\r
import java.util.HashMap;\r
+import java.util.HashSet;\r
import java.util.jar.Attributes;\r
+import java.util.jar.Attributes.Name;\r
import java.util.jar.JarEntry;\r
import java.util.jar.JarInputStream;\r
import java.util.jar.Manifest;\r
import org.tizen.common.file.Filter;\r
import org.tizen.common.file.SimpleFileFilter;\r
import org.tizen.common.file.filter.WildCardFilterFactory;\r
+import org.tizen.common.util.IOUtil;\r
import org.tizen.common.util.ReflectionUtil;\r
import org.tizen.common.verrari.IModelProvider;\r
import org.tizen.common.verrari.ITemplateEngine;\r
-import org.tizen.common.verrari.InvalidMapperException;\r
import org.tizen.common.verrari.Storage;\r
import org.tizen.common.verrari.Template;\r
import org.tizen.common.verrari.TemplateException;\r
-import org.tizen.common.verrari.UnsupportedVersion;\r
import org.tizen.common.verrari.engine.TemplateEngineFactory;\r
-import org.tizen.common.verrari.model.ModelManager;\r
+import org.tizen.common.verrari.exception.InvalidMapperException;\r
+import org.tizen.common.verrari.exception.UnsupportedVersionException;\r
import org.tizen.common.verrari.util.BufferFactory;\r
\r
+/**\r
+ * <p>\r
+ * StandardTemplate\r
+ * \r
+ * Built-in {@link Template} to provide RI\r
+ * \r
+ * </p>\r
+ * \r
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)\r
+ * \r
+ * @see Template\r
+ */\r
public class\r
StandardTemplate\r
-implements Template, ITemplateConstants\r
+implements Template\r
{\r
\r
- protected Logger logger = LoggerFactory.getLogger( getClass() );\r
- \r
- protected static final String ATTR_ID = "id";\r
+ /**\r
+ * logger for this object\r
+ */\r
+ protected final Logger logger = LoggerFactory.getLogger( getClass() );\r
\r
+ /**\r
+ * attributes for template\r
+ */\r
protected final HashMap<String, String> attrs = new HashMap<String, String>();\r
\r
/**\r
* Factory to create file name pattern filter\r
*/\r
protected FactoryWithArgument<Filter, String> filterFactory = new WildCardFilterFactory();\r
-\r
\r
+ /**\r
+ * template engine\r
+ */\r
protected ITemplateEngine engine = null;\r
+\r
+ /**\r
+ * template list to start\r
+ */\r
+ protected HashSet<String> templateNames = new HashSet<String>();\r
\r
- protected final JarInputStream jarIn;\r
- \r
- protected HashMap<String, String> name2targets = new HashMap<String, String>();\r
+ /**\r
+ * list to copy\r
+ */\r
+ protected HashSet<String> copyNames = new HashSet<String>();\r
\r
- public StandardTemplate( byte[] bytes ) throws IOException, TemplateException\r
+ /**\r
+ * name mapper\r
+ * \r
+ * @see Mapper\r
+ */\r
+ protected Mapper mapper = null;\r
+\r
+ /**\r
+ * constructor with template contents in jar file format byte[]\r
+ * \r
+ * @param bytes template contents\r
+ * \r
+ * @throws IOException If <code>bytes</code> is invalid format\r
+ * @throws TemplateException If template mapping is invalid\r
+ */\r
+ public\r
+ StandardTemplate(\r
+ final byte[] bytes\r
+ )\r
+ throws IOException, TemplateException\r
{\r
- jarIn = new JarInputStream( new ByteArrayInputStream( bytes ) );\r
- \r
- load( jarIn );\r
+ load( new JarInputStream( new ByteArrayInputStream( bytes ) ) );\r
}\r
\r
\r
\r
+ /**\r
+ * Separate arguemnt with semicolon\r
+ * \r
+ * @param value value to separate\r
+ * \r
+ * @return string array to be separated\r
+ */\r
protected static\r
- String[] separate(\r
+ String[]\r
+ separate(\r
final String value\r
)\r
{\r
{\r
return null;\r
}\r
- return null;\r
+ return value.split( ";" );\r
}\r
\r
\r
)\r
{\r
this.filterFactory = factory;\r
+ \r
logger.debug( "Configured filter factory :{}", factory );\r
}\r
\r
+ /**\r
+ * Read contents from <code>in</code> and make template info\r
+ * \r
+ * @param in {@link InputStream} to read\r
+ * \r
+ * @throws TemplateException If version or mapper is invalid\r
+ * @throws IOException If <code>in</code> is invalid\r
+ */\r
protected\r
void\r
- load( final JarInputStream in )\r
+ load(\r
+ final JarInputStream in\r
+ )\r
throws TemplateException, IOException\r
{\r
this.engine = TemplateEngineFactory.getInstance().create();\r
final TemplateManager templates = new TemplateManager();\r
\r
- final Manifest manifest = jarIn.getManifest();\r
+ final Manifest manifest = in.getManifest();\r
final Attributes attributes =\r
manifest.getMainAttributes();\r
+ \r
+ for ( final Object key : attributes.keySet() )\r
+ {\r
+ final Name name = (Name) key;\r
+ String keyStr = name.toString();\r
+ this.attrs.put( keyStr, attributes.getValue( name ) );\r
+ }\r
+ logger.info( "Attribute :{}", attrs );\r
+ \r
final String version = attributes.getValue( ATTR_VERSION );\r
\r
// Check version\r
\r
final String excludes = attributes.getValue( ATTR_EXCLUDE );\r
final String includes = attributes.getValue( ATTR_INCLUDE );\r
- final Mapper mapper = getMapper( attributes.getValue( ATTR_MAPPER ) );\r
+ final String copies = attributes.getValue( ATTR_COPY );\r
+ final String mappings = attributes.getValue( ATTR_MAPPING );\r
+ this.mapper = getMapper( attributes.getValue( ATTR_MAPPER ), mappings );\r
\r
final Filter filter = createFilter( separate( includes ), separate( excludes ) );\r
\r
+ final Filter copyFilter = createFilter( separate( copies ), null );\r
+ \r
JarEntry iter = null;\r
- while ( null != ( iter = jarIn.getNextJarEntry() ) )\r
+ while ( null != ( iter = in.getNextJarEntry() ) )\r
{\r
if ( iter.isDirectory() )\r
{\r
}\r
final String name = iter.getName();\r
logger.trace( "Name :{}", name );\r
- final byte[] contents = getBytes( jarIn );\r
- final String target = nvl( mapper.map( name ), name );\r
- logger.trace( "Target :{}", target );\r
+ final byte[] contents = getBytes( in );\r
\r
templates.addTemplate( name, new InMemoryTemplate(contents, "utf-8", BufferFactory.getInstance() ) );\r
- if ( !filter.accept( "/", name ) )\r
+ if ( copyFilter.accept( "/", name ) )\r
+ {\r
+ this.copyNames.add( name );\r
+ continue;\r
+ }\r
+ else if ( !filter.accept( "/", name ) )\r
{\r
logger.info( "{} filtered", name );\r
continue;\r
}\r
+ else\r
+ {\r
+ this.templateNames.add( name );\r
+ }\r
\r
- name2targets.put( name, target );\r
}\r
\r
engine.setTemplateProvider( templates );\r
}\r
\r
+ /* (non-Javadoc)\r
+ * @see org.tizen.common.verrari.Template#template(org.tizen.common.verrari.IModelProvider, org.tizen.common.verrari.Storage)\r
+ */\r
@Override\r
public\r
void\r
- template( Storage storage )\r
+ template(\r
+ final IModelProvider models,\r
+ final Storage storage\r
+ )\r
throws TemplateException\r
{\r
logger.info( "Start template process..." );\r
try\r
{\r
- for ( final String name : name2targets.keySet() )\r
+ for ( final String name : this.copyNames )\r
{\r
- logger.trace( "Template[{}] start", name );\r
- final String target = name2targets.get( name );\r
- final IModelProvider models = new ModelManager();\r
+ logger.trace( "Copy[{}] start", name );\r
+ final String target = nvl( this.mapper.map( name ), name );\r
+\r
+ InputStream in = null;\r
+ OutputStream out = null;\r
\r
+ try\r
+ {\r
+ in = engine.getTemplateProvider().getTemplate( name ).open();\r
+ out = storage.getTarget( target );\r
+ \r
+ IOUtil.redirect( in , out );\r
+ }\r
+ finally\r
+ {\r
+ tryClose( in, out );\r
+ }\r
+ }\r
+ for ( final String name : this.templateNames )\r
+ {\r
+ logger.trace( "Template[{}] start", name );\r
+ final String target = nvl( this.mapper.map( name ), name );\r
+\r
final OutputStream out = storage.getTarget( target );\r
\r
+ \r
try\r
{\r
engine.generate( name, models, out );\r
}\r
}\r
\r
- private Mapper getMapper( final String mapperName ) throws InvalidMapperException\r
+ /**\r
+ * Create and return mapper with <code>mapperName</code> and <code>mappings</code>\r
+ * \r
+ * @param mapperName mapper name( class qualified name )\r
+ * @param mappings mapper arguments\r
+ * \r
+ * @return {@link Mapper} to be created\r
+ * \r
+ * @throws InvalidMapperException If mapper name is invalid\r
+ */\r
+ private\r
+ Mapper\r
+ getMapper(\r
+ final String mapperName,\r
+ final String mappings\r
+ )\r
+ throws InvalidMapperException\r
{\r
final String safeMapperName = nvl( mapperName, DV_MAPPER );\r
final Mapper mapper = (Mapper) ReflectionUtil.tryNewInstance( safeMapperName );\r
throw new InvalidMapperException( "'" + safeMapperName + "' is invalide. check your class or config" );\r
}\r
\r
+ \r
+ final HashMap<String, String> mappingMap = new HashMap<String, String>();\r
+ if ( null != mappings )\r
+ {\r
+ final BufferedReader reader = new BufferedReader( new StringReader( mappings ) );\r
+ String line = null;\r
+ try\r
+ {\r
+ while ( null != ( line = reader.readLine() ) )\r
+ {\r
+ String[] args = line.split( "/" );\r
+ mappingMap.put( args[0], args[1] );\r
+ }\r
+ }\r
+ catch (IOException e)\r
+ {\r
+ }\r
+ }\r
+ mapper.setMappings( mappingMap );\r
return mapper;\r
}\r
\r
+ /**\r
+ * Create {@link Filter} with includes-list and excludes-list\r
+ * \r
+ * @param includes includes list\r
+ * @param excludes excludes list\r
+ * \r
+ * @return {@link Filter} to be configured\r
+ */\r
protected\r
Filter\r
createFilter(\r
return filter;\r
}\r
\r
- protected void checkVersion( String version ) throws UnsupportedVersion\r
+ /**\r
+ * Check template version\r
+ * \r
+ * @param version template version\r
+ * \r
+ * @throws UnsupportedVersionException If version is invalid in this template system\r
+ */\r
+ protected void checkVersion( String version ) throws UnsupportedVersionException\r
{\r
- \r
+ // TODO impl\r
}\r
\r
+ /* (non-Javadoc)\r
+ * @see org.tizen.common.verrari.AttributeContainer#getAttributeKeys()\r
+ */\r
+ @Override\r
+ public Collection<String> getAttributeKeys()\r
+ {\r
+ return this.attrs.keySet();\r
+ }\r
+\r
+ /* (non-Javadoc)\r
+ * @see org.tizen.common.verrari.AttributeContainer#getAttribute(java.lang.String)\r
+ */\r
@Override\r
public String getAttribute( final String key )\r
{\r
return attrs.get( key );\r
}\r
\r
+\r
+\r
}\r
--- /dev/null
+/*\r
+ * Verrari - Realm\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: \r
+ * BonYong Lee <bonyong.lee@samsung.com>\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ *\r
+ */\r
+package org.tizen.common.verrari.template;\r
+\r
+/**\r
+ * <p>\r
+ * TemplateConstants\r
+ * \r
+ * constant pool for template\r
+ * \r
+ * </p>\r
+ * \r
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)\r
+ * \r
+ */\r
+public class\r
+TemplateConstants\r
+{\r
+ /**\r
+ * template name( used as id )\r
+ */\r
+ public static final String ATTR_NAME = "Tizen-Template-Name";\r
+ /**\r
+ * template description\r
+ */\r
+ public static final String ATTR_DESCRIPTION = "Tizen-Template-Description";\r
+ /**\r
+ * template tags( used for searching )\r
+ */\r
+ public static final String ATTR_TAGS = "Tizen-Template-Tags";\r
+ \r
+ /**\r
+ * template version\r
+ */\r
+ public static final String ATTR_VERSION = "Tizen-Template-Version";\r
+ \r
+ /**\r
+ * list to exclude in template starting\r
+ */\r
+ public static final String ATTR_EXCLUDE = "Tizen-Template-Exclude";\r
+ /**\r
+ * list to include in template starging\r
+ */\r
+ public static final String ATTR_INCLUDE = "Tizen-Template-Include";\r
+ /**\r
+ * list not to apply template engine. just copy\r
+ */\r
+ public static final String ATTR_COPY = "Tizen-Template-Copy";\r
+ \r
+ /**\r
+ * file name mapper\r
+ */\r
+ public static final String ATTR_MAPPER = "Tizen-Template-Mapper";\r
+ /**\r
+ * default mapper\r
+ * \r
+ * @see StandardMapper\r
+ */\r
+ public static final String DV_MAPPER = StandardMapper.class.getName();\r
+ \r
+ /**\r
+ * mapping rule( mapper's argument )\r
+ */\r
+ public static final String ATTR_MAPPING = "Tizen-Template-Mapping";\r
+\r
+}\r
+/*\r
+ * Verrari - Realm\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: \r
+ * BonYong Lee <bonyong.lee@samsung.com>\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ *\r
+ */\r
package org.tizen.common.verrari.util;\r
\r
import java.io.ByteArrayOutputStream;\r
import org.tizen.common.verrari.Realm;\r
import org.tizen.common.verrari.engine.TemplateEngineFactory;\r
import org.tizen.common.verrari.model.ModelManager;\r
-import org.tizen.common.verrari.realm.IRealmConstants;\r
+import org.tizen.common.verrari.realm.RealmConstants;\r
import org.tizen.common.verrari.realm.Query;\r
import org.tizen.common.verrari.template.InMemoryTemplate;\r
import org.tizen.common.verrari.template.TemplateManager;\r
\r
+/**\r
+ * <p>\r
+ * QueryFactory\r
+ * \r
+ * Object to create template query\r
+ * \r
+ * </p>\r
+ * \r
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)\r
+ * \r
+ */\r
public class\r
QueryFactory\r
-implements IRealmConstants\r
{\r
+ /**\r
+ * Pattern type\r
+ */\r
protected static final String PATTERN_TYPE = "pattern";\r
\r
+ protected static final String STARTING_POINT = "_";\r
+\r
+ /**\r
+ * logger for this object\r
+ */\r
protected final Logger logger = LoggerFactory.getLogger( getClass() );\r
\r
+ /**\r
+ * Query to use pattern\r
+ * \r
+ * @see Query\r
+ *\r
+ */\r
class PatternQuery\r
implements Query\r
{\r
+ /**\r
+ * template engine\r
+ */\r
protected final ITemplateEngine engine;\r
\r
+ /**\r
+ * constructor with pattern\r
+ * \r
+ * @param pattern string to use in making query\r
+ */\r
public\r
PatternQuery(\r
final String pattern\r
this.engine = TemplateEngineFactory.getInstance().create();\r
final TemplateManager templateManager = new TemplateManager();\r
engine.setTemplateProvider( templateManager );\r
- templateManager.addTemplate( "_", new InMemoryTemplate( pattern.getBytes(), "utf-8", BufferFactory.getInstance() ) );\r
+ templateManager.addTemplate( STARTING_POINT, new InMemoryTemplate( pattern.getBytes(), "utf-8", BufferFactory.getInstance() ) );\r
}\r
\r
+ /* (non-Javadoc)\r
+ * @see org.tizen.common.verrari.realm.Query#query(java.util.Map)\r
+ */\r
@Override\r
public\r
String\r
{\r
final ModelManager manager = new ModelManager( args );\r
final ByteArrayOutputStream byteOut = new ByteArrayOutputStream();\r
- engine.generate( "_", manager, byteOut );\r
+ engine.generate( STARTING_POINT, manager, byteOut );\r
final String ret = new String( byteOut.toByteArray(), "utf-8" );\r
logger.info( "Query result :{}", ret );\r
\r
return ret;\r
}\r
- catch ( Throwable e )\r
+ catch ( final Throwable e )\r
{\r
throw new IllegalStateException( e );\r
}\r
\r
}\r
\r
- protected static QueryFactory instance;\r
- \r
+ /**\r
+ * Factory to create {@link Query}\r
+ */\r
+ protected static QueryFactory instance = new QueryFactory();\r
\r
- public static QueryFactory getInstance()\r
+ /**\r
+ * return {@link QueryFactory}\r
+ * \r
+ * @return {@link QueryFactory}\r
+ */\r
+ public static\r
+ QueryFactory\r
+ getInstance()\r
{\r
if ( null == instance )\r
{\r
return instance;\r
}\r
\r
+ /**\r
+ * set {@link QueryFactory}\r
+ * @param factory\r
+ */\r
synchronized public static\r
void\r
setInstance(\r
instance = factory;\r
}\r
\r
- protected String pattern = null;\r
-\r
+ /**\r
+ * create template query for realm\r
+ * \r
+ * @param realm {@link Realm} to apply\r
+ * \r
+ * @return template query\r
+ */\r
public\r
Query\r
createTemplateQuery(\r
{\r
Assert.notNull( realm );\r
\r
- final String templateType = realm.getAttribute( ATTR_TEMPLATE_TYPE );\r
- final PatternQuery query = new PatternQuery( realm.getAttribute( ATTR_TEMPLATE_URL ) );\r
+ final String templateType = realm.getAttribute( RealmConstants.ATTR_TEMPLATE_TYPE );\r
+ logger.debug( "Template type :{}", templateType );\r
+ final PatternQuery query = new PatternQuery( realm.getAttribute( RealmConstants.ATTR_TEMPLATE_URL ) );\r
\r
return query;\r
}\r
\r
- public\r
- Query\r
- createSearchQuery(\r
- final Realm realm\r
- )\r
- {\r
- Assert.notNull( realm );\r
- \r
- final String templateType = realm.getAttribute( ATTR_SEARCH_TYPE );\r
- final PatternQuery query = new PatternQuery( realm.getAttribute( ATTR_SEARCH_URL ) );\r
- \r
- return query;\r
- }\r
\r
}\r
Manifest-Version: 1.0
Tizen-Template-Version: 0.1
Tizen-Template-Exclude: META-INF/*.*
-Tizen-Template-Mapping: ^(.*)\.css$ -> <{&pref('DIR_CSS')}>/$1.css,
- ^(.*)\.png$ -> <{&pref( 'DIR_IMAGE' )}>/$1.png,
- ^(.*)\.html -> <{&pref( 'DIR_HTML' )}>/$1.html,
+Tizen-Template-Mapping: ^(.*)\.css$/${DIR_CSS}/$1.css
+ ^(.*)\.png$/${DIR_IMAGE}/$1.png,
+ ^(.*)\.html/${DIR_HTML}/$1.html,
^(.*)\.htm -> <{&pref( 'DIR_HTML' )}>/$1.htm,
^(.*)\.js -> <{&pref( 'DIR_JAVASCRIPT' )}>/$1.js,
Manifest-Version: 1.0
-Tizen-Template-Realm: org.tizen.common.verrari.realm.StandardRealm
+Tizen-Template-Realm: org.tizen.common.verrari.realm.StandardSearchableRealm
+/*\r
+ * Verrari - Realm\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: \r
+ * BonYong Lee <bonyong.lee@samsung.com>\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ *\r
+ */\r
package org.tizen.common.verrari;\r
\r
import org.junit.After;\r
import org.tizen.common.classloader.CustomClassLoader;\r
import org.tizen.common.classloader.JarClassSource;\r
\r
+/**\r
+ * AbstractTestCase.\r
+ *\r
+ * abstract class for test case\r
+ *\r
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)\r
+ *\r
+ */\r
public class\r
AbstractTestCase\r
{\r
+ /**\r
+ * logger for this object\r
+ */\r
protected Logger logger = LoggerFactory.getLogger( getClass() );\r
\r
+ /**\r
+ * old config value for url handler\r
+ */\r
protected String oldConfig;\r
\r
+ /**\r
+ * cloassloader to use in test case\r
+ */\r
protected CustomClassLoader cl;\r
\r
+ /**\r
+ * Initialize test case\r
+ * \r
+ * @throws Exception If initialization occur error\r
+ */\r
@Before\r
public void\r
setUp()\r
cl = new CustomClassLoader( source );\r
}\r
\r
+ /**\r
+ * clean up test case\r
+ */\r
@After\r
public\r
void\r
+/*\r
+ * Verrari - Realm\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: \r
+ * BonYong Lee <bonyong.lee@samsung.com>\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ *\r
+ */\r
package org.tizen.common.verrari;\r
\r
import static org.junit.Assert.assertEquals;\r
\r
import java.io.InputStream;\r
import java.net.URL;\r
+import java.util.Map;\r
\r
import org.junit.Test;\r
import org.tizen.common.verrari.realm.StandardRealm;\r
\r
+/**\r
+ * RealmFactoryTest.\r
+ *\r
+ * Test case for {@link RealmFactory}\r
+ *\r
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)\r
+ *\r
+ * @see RealmFactory\r
+ *\r
+ */\r
public class\r
RealmFactoryTest\r
extends AbstractTestCase\r
{\r
+ /**\r
+ * Test {@link RealmFactory#getRealmName(InputStream)}\r
+ *\r
+ * @throws Exception in case of failure in test\r
+ *\r
+ * @see RealmFactory#getRealmName(InputStream)\r
+ */\r
@Test\r
public\r
void\r
\r
}\r
\r
+ /**\r
+ * Test {@link RealmFactory#load(ClassLoader, Map)}\r
+ *\r
+ * @throws Exception in case of failure in test\r
+ *\r
+ * @see RealmFactory#load(ClassLoader, Map)\r
+ */\r
@Test\r
public\r
void\r
+/*\r
+ * Verrari - Realm\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: \r
+ * BonYong Lee <bonyong.lee@samsung.com>\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ *\r
+ */\r
package org.tizen.common.verrari.realm;\r
\r
import static org.junit.Assert.assertNotNull;\r
import org.tizen.common.verrari.AbstractTestCase;\r
import org.tizen.common.verrari.Template;\r
\r
+/**\r
+ * StandardRealmTest.\r
+ *\r
+ * Test case for {@link StandardRealm}\r
+ *\r
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)\r
+ *\r
+ * @see MapUtil\r
+ *\r
+ */\r
public class\r
StandardRealmTest\r
extends AbstractTestCase\r
{\r
+ /**\r
+ * Test {@link StandardRealm#getTemplate(String)}\r
+ *\r
+ * @throws Exception in case of failure in test\r
+ *\r
+ * @see StandardRealm#getTemplate(String)\r
+ */\r
@SuppressWarnings("unchecked")\r
@Test\r
public void test_getTemplate() throws Exception\r
realm.setAttributes( (Map<String, String>) attrs );\r
final Template simple = realm.getTemplate( "simple-template" );\r
assertNotNull( simple );\r
- final Template complex = realm.getTemplate( "complex-template" );\r
- assertNotNull( complex );\r
+ // TODO\r
+// final Template complex = realm.getTemplate( "complex-template" );\r
+// assertNotNull( complex );\r
}\r
\r
}\r
--- /dev/null
+/*\r
+ * Verrari - Realm\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: \r
+ * BonYong Lee <bonyong.lee@samsung.com>\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ *\r
+ */\r
+package org.tizen.common.verrari.template;\r
+\r
+import static org.junit.Assert.assertEquals;\r
+\r
+import java.util.LinkedHashMap;\r
+import java.util.regex.Pattern;\r
+\r
+import org.junit.Test;\r
+import org.tizen.common.verrari.TemplateContext;\r
+import org.tizen.common.verrari.model.ModelManager;\r
+\r
+/**\r
+ * StandardMapperTest.\r
+ *\r
+ * Test case for {@link StandardMapper}\r
+ *\r
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)\r
+ *\r
+ * @see StandardMapper\r
+ *\r
+ */\r
+public class\r
+StandardMapperTest\r
+{\r
+\r
+ /**\r
+ * Test {@link StandardMapper#map(String)}\r
+ *\r
+ * @throws Exception in case of failure in test\r
+ *\r
+ * @see StandardMapper#map(String)\r
+ */\r
+ @Test\r
+ public void test_map()\r
+ {\r
+ final StandardMapper target = new StandardMapper();\r
+ final LinkedHashMap<String, String> mappings = new LinkedHashMap<String, String>();\r
+ mappings.put( "model\\.js", "${MODEL_NAME}.js" );\r
+ mappings.put( "([a-zA-Z]*)([0-9]?)\\.js$", "$1-$2.js" );\r
+ target.setMappings( mappings );\r
+ \r
+ ModelManager modelProvider = new ModelManager();\r
+ modelProvider.addModel( "MODEL_NAME", "Person" );\r
+ TemplateContext.set( modelProvider );\r
+ \r
+ System.out.println( Pattern.matches( "^([a-zA-Z]*)([0-9]?)\\.js$", "Abcdef9.js" ) );\r
+ System.out.println( "Abcdef9.js".replaceAll( "([a-zA-Z]*)([0-9]?)\\.js$", "$1-$2.js" ) );\r
+ try\r
+ {\r
+ assertEquals( "Person.js", target.map( "model.js" ) );\r
+ assertEquals( "Abcdef-9.js", target.map( "Abcdef9.js" ) );\r
+ }\r
+ finally\r
+ {\r
+ TemplateContext.clear();\r
+ }\r
+ }\r
+\r
+}\r
+/*\r
+ * Verrari - Realm\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: \r
+ * BonYong Lee <bonyong.lee@samsung.com>\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ *\r
+ */\r
package org.tizen.common.verrari.template;\r
\r
import static org.mockito.Matchers.anyString;\r
\r
import org.junit.Test;\r
import org.tizen.common.verrari.AbstractTestCase;\r
+import org.tizen.common.verrari.IModelProvider;\r
import org.tizen.common.verrari.Storage;\r
+import org.tizen.common.verrari.model.ModelManager;\r
\r
+/**\r
+ * StandardTemplateTest.\r
+ *\r
+ * Test case for {@link StandardTemplate}\r
+ *\r
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)\r
+ *\r
+ * @see StandardTemplate\r
+ *\r
+ */\r
public class StandardTemplateTest\r
extends AbstractTestCase\r
{\r
\r
+ /**\r
+ * Test {@link StandardTemplate#template(IModelProvider, Storage)}\r
+ *\r
+ * @throws Exception in case of failure in test\r
+ *\r
+ * @see StandardTemplate#template(IModelProvider, Storage)\r
+ */\r
@Test\r
public\r
void\r
test_template()\r
throws Exception\r
{\r
- final URL u = new URL( "cp:///simple-template.jar" );\r
- final InputStream in = u.openStream();\r
- \r
- StandardTemplate template = new StandardTemplate( getBytes( in, true ) );\r
- \r
- Storage storageMock = mock( Storage.class );\r
- when( storageMock.getTarget( anyString() ) ).thenReturn( new ByteArrayOutputStream() );\r
- template.template( storageMock );\r
+ {\r
+ final URL u = new URL( "cp:///simple-template.jar" );\r
+ final InputStream in = u.openStream();\r
+\r
+ StandardTemplate template = new StandardTemplate( getBytes( in, true ) );\r
+\r
+ Storage storageMock = mock( Storage.class );\r
+ when( storageMock.getTarget( anyString() ) ).thenReturn( new ByteArrayOutputStream() );\r
+ ModelManager models = new ModelManager();\r
+ template.template( models, storageMock );\r
+ }\r
+\r
+ {\r
+ final URL u = new URL( "cp:///tizen-web-project.jar" );\r
+ final InputStream in = u.openStream();\r
+\r
+ StandardTemplate template = new StandardTemplate( getBytes( in, true ) );\r
+\r
+ Storage storageMock = mock( Storage.class );\r
+ when( storageMock.getTarget( anyString() ) ).thenReturn( new ByteArrayOutputStream() );\r
+ ModelManager models = new ModelManager();\r
+ models.addModel( "SITE_DOMAIN", "mysite.com" );\r
+ models.addModel( "APP_ICON", "icon.ico" );\r
+ models.addModel( "START_PAGE", "index.html" );\r
+ models.addModel( "APP_NAME", "test" );\r
+ models.addModel( "APP_ID", "12345678" );\r
+ template.template( models, storageMock );\r
+\r
+ }\r
}\r
\r
}\r
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>\r
-<classpath>\r
- <classpathentry kind="src" path="src"/>\r
- <classpathentry kind="src" path="test/src"/>\r
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.6.0_32">\r
- <attributes>\r
- <attribute name="owner.project.facets" value="java"/>\r
- </attributes>\r
- </classpathentry>\r
- <classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v7.0">\r
- <attributes>\r
- <attribute name="owner.project.facets" value="jst.web"/>\r
- </attributes>\r
- </classpathentry>\r
- <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>\r
- <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>\r
- <classpathentry kind="lib" path="test/lib/junit-4.10.jar"/>\r
- <classpathentry kind="lib" path="test/lib/mockito-all-1.9.0.jar"/>\r
- <classpathentry kind="lib" path="test/lib/org.springframework.test-3.1.0.RELEASE.jar"/>\r
- <classpathentry combineaccessrules="false" kind="src" path="/org.tizen.common.verrari.realm"/>\r
- <classpathentry kind="output" path="bin"/>\r
-</classpath>\r
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>\r
-<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">\r
-<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="false"/>\r
-<stringAttribute key="org.eclipse.ui.externaltools.ATTR_DISABLED_BUILDER" value="org.eclipse.wst.jsdt.core.javascriptValidator"/>\r
-<mapAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS"/>\r
-<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>\r
-</launchConfiguration>\r
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>\r
-<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">\r
-<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="false"/>\r
-<stringAttribute key="org.eclipse.ui.externaltools.ATTR_DISABLED_BUILDER" value="org.eclipse.wst.validation.validationbuilder"/>\r
-<mapAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS"/>\r
-<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>\r
-</launchConfiguration>\r
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>\r
-<projectDescription>\r
- <name>org.tizen.common.verrari.server</name>\r
- <comment></comment>\r
- <projects>\r
- </projects>\r
- <buildSpec>\r
- <buildCommand>\r
- <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>\r
- <triggers>full,incremental,</triggers>\r
- <arguments>\r
- <dictionary>\r
- <key>LaunchConfigHandle</key>\r
- <value><project>/.externalToolBuilders/org.eclipse.wst.jsdt.core.javascriptValidator.launch</value>\r
- </dictionary>\r
- </arguments>\r
- </buildCommand>\r
- <buildCommand>\r
- <name>org.eclipse.jdt.core.javabuilder</name>\r
- <arguments>\r
- </arguments>\r
- </buildCommand>\r
- <buildCommand>\r
- <name>org.eclipse.wst.common.project.facet.core.builder</name>\r
- <arguments>\r
- </arguments>\r
- </buildCommand>\r
- <buildCommand>\r
- <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>\r
- <triggers>full,incremental,</triggers>\r
- <arguments>\r
- <dictionary>\r
- <key>LaunchConfigHandle</key>\r
- <value><project>/.externalToolBuilders/org.eclipse.wst.validation.validationbuilder.launch</value>\r
- </dictionary>\r
- </arguments>\r
- </buildCommand>\r
- </buildSpec>\r
- <natures>\r
- <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>\r
- <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>\r
- <nature>org.eclipse.wst.common.project.facet.core.nature</nature>\r
- <nature>org.eclipse.jdt.core.javanature</nature>\r
- <nature>org.eclipse.wst.jsdt.core.jsNature</nature>\r
- </natures>\r
-</projectDescription>\r
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>\r
-<classpath>\r
- <classpathentry kind="src" path="WebContent"/>\r
- <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>\r
- <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">\r
- <attributes>\r
- <attribute name="hide" value="true"/>\r
- </attributes>\r
- </classpathentry>\r
- <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>\r
- <classpathentry kind="output" path=""/>\r
-</classpath>\r
+++ /dev/null
-eclipse.preferences.version=1\r
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled\r
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6\r
-org.eclipse.jdt.core.compiler.compliance=1.6\r
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error\r
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error\r
-org.eclipse.jdt.core.compiler.source=1.6\r
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>\r
-<project-modules id="moduleCoreId" project-version="1.5.0">\r
- <wb-module deploy-name="org.tizen.common.verrari.server">\r
- <wb-resource deploy-path="/" source-path="/WebContent" tag="defaultRootSource"/>\r
- <wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>\r
- <wb-resource deploy-path="/WEB-INF/classes" source-path="/test/src"/>\r
- <property name="context-root" value="/"/>\r
- <property name="java-output-path" value="/org.tizen.common.verrari.server/bin"/>\r
- </wb-module>\r
-</project-modules>\r
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>\r
-<faceted-project>\r
- <runtime name="Apache Tomcat v7.0"/>\r
- <fixed facet="wst.jsdt.web"/>\r
- <fixed facet="java"/>\r
- <fixed facet="jst.web"/>\r
- <installed facet="java" version="1.6"/>\r
- <installed facet="jst.web" version="3.0"/>\r
- <installed facet="wst.jsdt.web" version="1.0"/>\r
-</faceted-project>\r
+++ /dev/null
-org.eclipse.wst.jsdt.launching.baseBrowserLibrary
\ No newline at end of file
+++ /dev/null
-Window
\ No newline at end of file
+++ /dev/null
-Manifest-Version: 1.0\r
-Class-Path: \r
-\r
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:context="http://www.springframework.org/schema/context"
- xmlns:tx="http://www.springframework.org/schema/tx"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
- ">
- <!-- Root Context: defines shared resources visible to all other web components -->
- <bean id="dataSource"
- class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" lazy-init="true">
- <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
- <property name="url" value="jdbc:mysql://127.0.0.1/tizen"/>
- <property name="username" value="tizen"/>
- <property name="password" value="tizen"/>
- </bean>
-
- <tx:annotation-driven/>
-
- <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
- <property name="dataSource" ref="dataSource"/>
- <property name="hibernateProperties">
- <props>
- <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
- <prop key="hibernate.show_sql">true</prop>
- </props>
- </property>
-
- <property name="packagesToScan" value="org.tizen.common.verrari.server.model"/>
- </bean>
-
- <bean class="org.tizen.common.verrari.server.util.IdGenerator" />
-
- <context:component-scan base-package="org.tizen.common.verrari.server.dao" />
- <context:component-scan base-package="org.tizen.common.verrari.server.service" />
-
-</beans>
-
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<beans:beans xmlns="http://www.springframework.org/schema/mvc"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:beans="http://www.springframework.org/schema/beans"
- xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
- ">
-
- <!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure -->
-
- <!-- Enables the Spring MVC @Controller programming model -->
- <annotation-driven />
-
- <!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources directory -->
- <resources mapping="/favicon.ico" location="/img/favicon.ico" />
- <resources mapping="/css/**" location="/css/" />
- <resources mapping="/js/**" location="/js/" />
- <resources mapping="/html/**" location="/html/" />
- <resources mapping="/img/**" location="/img/" />
-
- <beans:bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
- <beans:property name="mediaTypes">
- <beans:map>
- <beans:entry key="html" value="text/html"/>
- <beans:entry key="json" value="application/json"/>
- </beans:map>
- </beans:property>
- <beans:property name="viewResolvers">
- <beans:list>
- <beans:bean id="jspViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
- <beans:property name="prefix" value="/WEB-INF/views/" />
- <beans:property name="suffix" value=".jsp" />
- </beans:bean>
- </beans:list>
- </beans:property>
- <beans:property name="defaultViews">
- <beans:list>
- <beans:bean class="org.springframework.web.servlet.view.json.MappingJacksonJsonView">
- <beans:property name="prefixJson" value="true"/>
- </beans:bean>
- </beans:list>
- </beans:property>
- </beans:bean>
-
- <beans:bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
- <beans:property name="maxUploadSize" value="100000000" />
- <beans:property name="defaultEncoding" value="UTF-8" />
- </beans:bean>
-
- <default-servlet-handler/>
-
- <context:component-scan base-package="org.tizen.common.verrari.server.controller" />
-</beans:beans>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>\r
-<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">\r
- <context-param>\r
- <param-name>contextConfigLocation</param-name>\r
- <param-value>/WEB-INF/spring/*.xml</param-value>\r
- </context-param>\r
- <listener>\r
- <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>\r
- </listener>\r
- <filter>\r
- <filter-name>hibernateFilter</filter-name>\r
- <filter-class>org.tizen.common.verrari.server.servlet.SessionInViewFilter</filter-class>\r
- <init-param>\r
- <param-name>flushMode</param-name>\r
- <param-value>always</param-value>\r
- </init-param>\r
- </filter>\r
- <filter-mapping>\r
- <filter-name>hibernateFilter</filter-name>\r
- <url-pattern>/*</url-pattern>\r
- </filter-mapping>\r
- <servlet>\r
- <servlet-name>org.tizen.common.verrari</servlet-name>\r
- <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>\r
- <init-param>\r
- <param-name>contextConfigLocation</param-name>\r
- <param-value>/WEB-INF/verrari-context.xml</param-value>\r
- </init-param>\r
- <load-on-startup>1</load-on-startup>\r
- </servlet>\r
- <servlet-mapping>\r
- <servlet-name>org.tizen.common.verrari</servlet-name>\r
- <url-pattern>/*.*</url-pattern>\r
- </servlet-mapping>\r
-</web-app>
\ No newline at end of file
+++ /dev/null
-/*!
- * Bootstrap v2.0.4
- *
- * Copyright 2012 Twitter, Inc
- * Licensed under the Apache License v2.0
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Designed and built with all the love in the world @twitter by @mdo and @fat.
- */
-
-article,
-aside,
-details,
-figcaption,
-figure,
-footer,
-header,
-hgroup,
-nav,
-section {
- display: block;
-}
-
-audio,
-canvas,
-video {
- display: inline-block;
- *display: inline;
- *zoom: 1;
-}
-
-audio:not([controls]) {
- display: none;
-}
-
-html {
- font-size: 100%;
- -webkit-text-size-adjust: 100%;
- -ms-text-size-adjust: 100%;
-}
-
-a:focus {
- outline: thin dotted #333;
- outline: 5px auto -webkit-focus-ring-color;
- outline-offset: -2px;
-}
-
-a:hover,
-a:active {
- outline: 0;
-}
-
-sub,
-sup {
- position: relative;
- font-size: 75%;
- line-height: 0;
- vertical-align: baseline;
-}
-
-sup {
- top: -0.5em;
-}
-
-sub {
- bottom: -0.25em;
-}
-
-img {
- max-width: 100%;
- vertical-align: middle;
- border: 0;
- -ms-interpolation-mode: bicubic;
-}
-
-#map_canvas img {
- max-width: none;
-}
-
-button,
-input,
-select,
-textarea {
- margin: 0;
- font-size: 100%;
- vertical-align: middle;
-}
-
-button,
-input {
- *overflow: visible;
- line-height: normal;
-}
-
-button::-moz-focus-inner,
-input::-moz-focus-inner {
- padding: 0;
- border: 0;
-}
-
-button,
-input[type="button"],
-input[type="reset"],
-input[type="submit"] {
- cursor: pointer;
- -webkit-appearance: button;
-}
-
-input[type="search"] {
- -webkit-box-sizing: content-box;
- -moz-box-sizing: content-box;
- box-sizing: content-box;
- -webkit-appearance: textfield;
-}
-
-input[type="search"]::-webkit-search-decoration,
-input[type="search"]::-webkit-search-cancel-button {
- -webkit-appearance: none;
-}
-
-textarea {
- overflow: auto;
- vertical-align: top;
-}
-
-.clearfix {
- *zoom: 1;
-}
-
-.clearfix:before,
-.clearfix:after {
- display: table;
- content: "";
-}
-
-.clearfix:after {
- clear: both;
-}
-
-.hide-text {
- font: 0/0 a;
- color: transparent;
- text-shadow: none;
- background-color: transparent;
- border: 0;
-}
-
-.input-block-level {
- display: block;
- width: 100%;
- min-height: 28px;
- -webkit-box-sizing: border-box;
- -moz-box-sizing: border-box;
- -ms-box-sizing: border-box;
- box-sizing: border-box;
-}
-
-body {
- margin: 0;
- font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
- font-size: 13px;
- line-height: 18px;
- color: #333333;
- background-color: #ffffff;
-}
-
-a {
- color: #0088cc;
- text-decoration: none;
-}
-
-a:hover {
- color: #005580;
- text-decoration: underline;
-}
-
-.row {
- margin-left: -20px;
- *zoom: 1;
-}
-
-.row:before,
-.row:after {
- display: table;
- content: "";
-}
-
-.row:after {
- clear: both;
-}
-
-[class*="span"] {
- float: left;
- margin-left: 20px;
-}
-
-.container,
-.navbar-fixed-top .container,
-.navbar-fixed-bottom .container {
- width: 940px;
-}
-
-.span12 {
- width: 940px;
-}
-
-.span11 {
- width: 860px;
-}
-
-.span10 {
- width: 780px;
-}
-
-.span9 {
- width: 700px;
-}
-
-.span8 {
- width: 620px;
-}
-
-.span7 {
- width: 540px;
-}
-
-.span6 {
- width: 460px;
-}
-
-.span5 {
- width: 380px;
-}
-
-.span4 {
- width: 300px;
-}
-
-.span3 {
- width: 220px;
-}
-
-.span2 {
- width: 140px;
-}
-
-.span1 {
- width: 60px;
-}
-
-.offset12 {
- margin-left: 980px;
-}
-
-.offset11 {
- margin-left: 900px;
-}
-
-.offset10 {
- margin-left: 820px;
-}
-
-.offset9 {
- margin-left: 740px;
-}
-
-.offset8 {
- margin-left: 660px;
-}
-
-.offset7 {
- margin-left: 580px;
-}
-
-.offset6 {
- margin-left: 500px;
-}
-
-.offset5 {
- margin-left: 420px;
-}
-
-.offset4 {
- margin-left: 340px;
-}
-
-.offset3 {
- margin-left: 260px;
-}
-
-.offset2 {
- margin-left: 180px;
-}
-
-.offset1 {
- margin-left: 100px;
-}
-
-.row-fluid {
- width: 100%;
- *zoom: 1;
-}
-
-.row-fluid:before,
-.row-fluid:after {
- display: table;
- content: "";
-}
-
-.row-fluid:after {
- clear: both;
-}
-
-.row-fluid [class*="span"] {
- display: block;
- float: left;
- width: 100%;
- min-height: 28px;
- margin-left: 2.127659574%;
- *margin-left: 2.0744680846382977%;
- -webkit-box-sizing: border-box;
- -moz-box-sizing: border-box;
- -ms-box-sizing: border-box;
- box-sizing: border-box;
-}
-
-.row-fluid [class*="span"]:first-child {
- margin-left: 0;
-}
-
-.row-fluid .span12 {
- width: 99.99999998999999%;
- *width: 99.94680850063828%;
-}
-
-.row-fluid .span11 {
- width: 91.489361693%;
- *width: 91.4361702036383%;
-}
-
-.row-fluid .span10 {
- width: 82.97872339599999%;
- *width: 82.92553190663828%;
-}
-
-.row-fluid .span9 {
- width: 74.468085099%;
- *width: 74.4148936096383%;
-}
-
-.row-fluid .span8 {
- width: 65.95744680199999%;
- *width: 65.90425531263828%;
-}
-
-.row-fluid .span7 {
- width: 57.446808505%;
- *width: 57.3936170156383%;
-}
-
-.row-fluid .span6 {
- width: 48.93617020799999%;
- *width: 48.88297871863829%;
-}
-
-.row-fluid .span5 {
- width: 40.425531911%;
- *width: 40.3723404216383%;
-}
-
-.row-fluid .span4 {
- width: 31.914893614%;
- *width: 31.8617021246383%;
-}
-
-.row-fluid .span3 {
- width: 23.404255317%;
- *width: 23.3510638276383%;
-}
-
-.row-fluid .span2 {
- width: 14.89361702%;
- *width: 14.8404255306383%;
-}
-
-.row-fluid .span1 {
- width: 6.382978723%;
- *width: 6.329787233638298%;
-}
-
-.container {
- margin-right: auto;
- margin-left: auto;
- *zoom: 1;
-}
-
-.container:before,
-.container:after {
- display: table;
- content: "";
-}
-
-.container:after {
- clear: both;
-}
-
-.container-fluid {
- padding-right: 20px;
- padding-left: 20px;
- *zoom: 1;
-}
-
-.container-fluid:before,
-.container-fluid:after {
- display: table;
- content: "";
-}
-
-.container-fluid:after {
- clear: both;
-}
-
-p {
- margin: 0 0 9px;
-}
-
-p small {
- font-size: 11px;
- color: #999999;
-}
-
-.lead {
- margin-bottom: 18px;
- font-size: 20px;
- font-weight: 200;
- line-height: 27px;
-}
-
-h1,
-h2,
-h3,
-h4,
-h5,
-h6 {
- margin: 0;
- font-family: inherit;
- font-weight: bold;
- color: inherit;
- text-rendering: optimizelegibility;
-}
-
-h1 small,
-h2 small,
-h3 small,
-h4 small,
-h5 small,
-h6 small {
- font-weight: normal;
- color: #999999;
-}
-
-h1 {
- font-size: 30px;
- line-height: 36px;
-}
-
-h1 small {
- font-size: 18px;
-}
-
-h2 {
- font-size: 24px;
- line-height: 36px;
-}
-
-h2 small {
- font-size: 18px;
-}
-
-h3 {
- font-size: 18px;
- line-height: 27px;
-}
-
-h3 small {
- font-size: 14px;
-}
-
-h4,
-h5,
-h6 {
- line-height: 18px;
-}
-
-h4 {
- font-size: 14px;
-}
-
-h4 small {
- font-size: 12px;
-}
-
-h5 {
- font-size: 12px;
-}
-
-h6 {
- font-size: 11px;
- color: #999999;
- text-transform: uppercase;
-}
-
-.page-header {
- padding-bottom: 17px;
- margin: 18px 0;
- border-bottom: 1px solid #eeeeee;
-}
-
-.page-header h1 {
- line-height: 1;
-}
-
-ul,
-ol {
- padding: 0;
- margin: 0 0 9px 25px;
-}
-
-ul ul,
-ul ol,
-ol ol,
-ol ul {
- margin-bottom: 0;
-}
-
-ul {
- list-style: disc;
-}
-
-ol {
- list-style: decimal;
-}
-
-li {
- line-height: 18px;
-}
-
-ul.unstyled,
-ol.unstyled {
- margin-left: 0;
- list-style: none;
-}
-
-dl {
- margin-bottom: 18px;
-}
-
-dt,
-dd {
- line-height: 18px;
-}
-
-dt {
- font-weight: bold;
- line-height: 17px;
-}
-
-dd {
- margin-left: 9px;
-}
-
-.dl-horizontal dt {
- float: left;
- width: 120px;
- overflow: hidden;
- clear: left;
- text-align: right;
- text-overflow: ellipsis;
- white-space: nowrap;
-}
-
-.dl-horizontal dd {
- margin-left: 130px;
-}
-
-hr {
- margin: 18px 0;
- border: 0;
- border-top: 1px solid #eeeeee;
- border-bottom: 1px solid #ffffff;
-}
-
-strong {
- font-weight: bold;
-}
-
-em {
- font-style: italic;
-}
-
-.muted {
- color: #999999;
-}
-
-abbr[title] {
- cursor: help;
- border-bottom: 1px dotted #999999;
-}
-
-abbr.initialism {
- font-size: 90%;
- text-transform: uppercase;
-}
-
-blockquote {
- padding: 0 0 0 15px;
- margin: 0 0 18px;
- border-left: 5px solid #eeeeee;
-}
-
-blockquote p {
- margin-bottom: 0;
- font-size: 16px;
- font-weight: 300;
- line-height: 22.5px;
-}
-
-blockquote small {
- display: block;
- line-height: 18px;
- color: #999999;
-}
-
-blockquote small:before {
- content: '\2014 \00A0';
-}
-
-blockquote.pull-right {
- float: right;
- padding-right: 15px;
- padding-left: 0;
- border-right: 5px solid #eeeeee;
- border-left: 0;
-}
-
-blockquote.pull-right p,
-blockquote.pull-right small {
- text-align: right;
-}
-
-q:before,
-q:after,
-blockquote:before,
-blockquote:after {
- content: "";
-}
-
-address {
- display: block;
- margin-bottom: 18px;
- font-style: normal;
- line-height: 18px;
-}
-
-small {
- font-size: 100%;
-}
-
-cite {
- font-style: normal;
-}
-
-code,
-pre {
- padding: 0 3px 2px;
- font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
- font-size: 12px;
- color: #333333;
- -webkit-border-radius: 3px;
- -moz-border-radius: 3px;
- border-radius: 3px;
-}
-
-code {
- padding: 2px 4px;
- color: #d14;
- background-color: #f7f7f9;
- border: 1px solid #e1e1e8;
-}
-
-pre {
- display: block;
- padding: 8.5px;
- margin: 0 0 9px;
- font-size: 12.025px;
- line-height: 18px;
- word-break: break-all;
- word-wrap: break-word;
- white-space: pre;
- white-space: pre-wrap;
- background-color: #f5f5f5;
- border: 1px solid #ccc;
- border: 1px solid rgba(0, 0, 0, 0.15);
- -webkit-border-radius: 4px;
- -moz-border-radius: 4px;
- border-radius: 4px;
-}
-
-pre.prettyprint {
- margin-bottom: 18px;
-}
-
-pre code {
- padding: 0;
- color: inherit;
- background-color: transparent;
- border: 0;
-}
-
-.pre-scrollable {
- max-height: 340px;
- overflow-y: scroll;
-}
-
-form {
- margin: 0 0 18px;
-}
-
-fieldset {
- padding: 0;
- margin: 0;
- border: 0;
-}
-
-legend {
- display: block;
- width: 100%;
- padding: 0;
- margin-bottom: 27px;
- font-size: 19.5px;
- line-height: 36px;
- color: #333333;
- border: 0;
- border-bottom: 1px solid #e5e5e5;
-}
-
-legend small {
- font-size: 13.5px;
- color: #999999;
-}
-
-label,
-input,
-button,
-select,
-textarea {
- font-size: 13px;
- font-weight: normal;
- line-height: 18px;
-}
-
-input,
-button,
-select,
-textarea {
- font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
-}
-
-label {
- display: block;
- margin-bottom: 5px;
-}
-
-select,
-textarea,
-input[type="text"],
-input[type="password"],
-input[type="datetime"],
-input[type="datetime-local"],
-input[type="date"],
-input[type="month"],
-input[type="time"],
-input[type="week"],
-input[type="number"],
-input[type="email"],
-input[type="url"],
-input[type="search"],
-input[type="tel"],
-input[type="color"],
-.uneditable-input {
- display: inline-block;
- height: 18px;
- padding: 4px;
- margin-bottom: 9px;
- font-size: 13px;
- line-height: 18px;
- color: #555555;
-}
-
-input,
-textarea {
- width: 210px;
-}
-
-textarea {
- height: auto;
-}
-
-textarea,
-input[type="text"],
-input[type="password"],
-input[type="datetime"],
-input[type="datetime-local"],
-input[type="date"],
-input[type="month"],
-input[type="time"],
-input[type="week"],
-input[type="number"],
-input[type="email"],
-input[type="url"],
-input[type="search"],
-input[type="tel"],
-input[type="color"],
-.uneditable-input {
- background-color: #ffffff;
- border: 1px solid #cccccc;
- -webkit-border-radius: 3px;
- -moz-border-radius: 3px;
- border-radius: 3px;
- -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
- -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
- box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
- -webkit-transition: border linear 0.2s, box-shadow linear 0.2s;
- -moz-transition: border linear 0.2s, box-shadow linear 0.2s;
- -ms-transition: border linear 0.2s, box-shadow linear 0.2s;
- -o-transition: border linear 0.2s, box-shadow linear 0.2s;
- transition: border linear 0.2s, box-shadow linear 0.2s;
-}
-
-textarea:focus,
-input[type="text"]:focus,
-input[type="password"]:focus,
-input[type="datetime"]:focus,
-input[type="datetime-local"]:focus,
-input[type="date"]:focus,
-input[type="month"]:focus,
-input[type="time"]:focus,
-input[type="week"]:focus,
-input[type="number"]:focus,
-input[type="email"]:focus,
-input[type="url"]:focus,
-input[type="search"]:focus,
-input[type="tel"]:focus,
-input[type="color"]:focus,
-.uneditable-input:focus {
- border-color: rgba(82, 168, 236, 0.8);
- outline: 0;
- outline: thin dotted \9;
- /* IE6-9 */
-
- -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6);
- -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6);
- box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6);
-}
-
-input[type="radio"],
-input[type="checkbox"] {
- margin: 3px 0;
- *margin-top: 0;
- /* IE7 */
-
- line-height: normal;
- cursor: pointer;
-}
-
-input[type="submit"],
-input[type="reset"],
-input[type="button"],
-input[type="radio"],
-input[type="checkbox"] {
- width: auto;
-}
-
-.uneditable-textarea {
- width: auto;
- height: auto;
-}
-
-select,
-input[type="file"] {
- height: 28px;
- /* In IE7, the height of the select element cannot be changed by height, only font-size */
-
- *margin-top: 4px;
- /* For IE7, add top margin to align select with labels */
-
- line-height: 28px;
-}
-
-select {
- width: 220px;
- border: 1px solid #bbb;
-}
-
-select[multiple],
-select[size] {
- height: auto;
-}
-
-select:focus,
-input[type="file"]:focus,
-input[type="radio"]:focus,
-input[type="checkbox"]:focus {
- outline: thin dotted #333;
- outline: 5px auto -webkit-focus-ring-color;
- outline-offset: -2px;
-}
-
-.radio,
-.checkbox {
- min-height: 18px;
- padding-left: 18px;
-}
-
-.radio input[type="radio"],
-.checkbox input[type="checkbox"] {
- float: left;
- margin-left: -18px;
-}
-
-.controls > .radio:first-child,
-.controls > .checkbox:first-child {
- padding-top: 5px;
-}
-
-.radio.inline,
-.checkbox.inline {
- display: inline-block;
- padding-top: 5px;
- margin-bottom: 0;
- vertical-align: middle;
-}
-
-.radio.inline + .radio.inline,
-.checkbox.inline + .checkbox.inline {
- margin-left: 10px;
-}
-
-.input-mini {
- width: 60px;
-}
-
-.input-small {
- width: 90px;
-}
-
-.input-medium {
- width: 150px;
-}
-
-.input-large {
- width: 210px;
-}
-
-.input-xlarge {
- width: 270px;
-}
-
-.input-xxlarge {
- width: 530px;
-}
-
-input[class*="span"],
-select[class*="span"],
-textarea[class*="span"],
-.uneditable-input[class*="span"],
-.row-fluid input[class*="span"],
-.row-fluid select[class*="span"],
-.row-fluid textarea[class*="span"],
-.row-fluid .uneditable-input[class*="span"] {
- float: none;
- margin-left: 0;
-}
-
-.input-append input[class*="span"],
-.input-append .uneditable-input[class*="span"],
-.input-prepend input[class*="span"],
-.input-prepend .uneditable-input[class*="span"],
-.row-fluid .input-prepend [class*="span"],
-.row-fluid .input-append [class*="span"] {
- display: inline-block;
-}
-
-input,
-textarea,
-.uneditable-input {
- margin-left: 0;
-}
-
-input.span12,
-textarea.span12,
-.uneditable-input.span12 {
- width: 930px;
-}
-
-input.span11,
-textarea.span11,
-.uneditable-input.span11 {
- width: 850px;
-}
-
-input.span10,
-textarea.span10,
-.uneditable-input.span10 {
- width: 770px;
-}
-
-input.span9,
-textarea.span9,
-.uneditable-input.span9 {
- width: 690px;
-}
-
-input.span8,
-textarea.span8,
-.uneditable-input.span8 {
- width: 610px;
-}
-
-input.span7,
-textarea.span7,
-.uneditable-input.span7 {
- width: 530px;
-}
-
-input.span6,
-textarea.span6,
-.uneditable-input.span6 {
- width: 450px;
-}
-
-input.span5,
-textarea.span5,
-.uneditable-input.span5 {
- width: 370px;
-}
-
-input.span4,
-textarea.span4,
-.uneditable-input.span4 {
- width: 290px;
-}
-
-input.span3,
-textarea.span3,
-.uneditable-input.span3 {
- width: 210px;
-}
-
-input.span2,
-textarea.span2,
-.uneditable-input.span2 {
- width: 130px;
-}
-
-input.span1,
-textarea.span1,
-.uneditable-input.span1 {
- width: 50px;
-}
-
-input[disabled],
-select[disabled],
-textarea[disabled],
-input[readonly],
-select[readonly],
-textarea[readonly] {
- cursor: not-allowed;
- background-color: #eeeeee;
- border-color: #ddd;
-}
-
-input[type="radio"][disabled],
-input[type="checkbox"][disabled],
-input[type="radio"][readonly],
-input[type="checkbox"][readonly] {
- background-color: transparent;
-}
-
-.control-group.warning > label,
-.control-group.warning .help-block,
-.control-group.warning .help-inline {
- color: #c09853;
-}
-
-.control-group.warning .checkbox,
-.control-group.warning .radio,
-.control-group.warning input,
-.control-group.warning select,
-.control-group.warning textarea {
- color: #c09853;
- border-color: #c09853;
-}
-
-.control-group.warning .checkbox:focus,
-.control-group.warning .radio:focus,
-.control-group.warning input:focus,
-.control-group.warning select:focus,
-.control-group.warning textarea:focus {
- border-color: #a47e3c;
- -webkit-box-shadow: 0 0 6px #dbc59e;
- -moz-box-shadow: 0 0 6px #dbc59e;
- box-shadow: 0 0 6px #dbc59e;
-}
-
-.control-group.warning .input-prepend .add-on,
-.control-group.warning .input-append .add-on {
- color: #c09853;
- background-color: #fcf8e3;
- border-color: #c09853;
-}
-
-.control-group.error > label,
-.control-group.error .help-block,
-.control-group.error .help-inline {
- color: #b94a48;
-}
-
-.control-group.error .checkbox,
-.control-group.error .radio,
-.control-group.error input,
-.control-group.error select,
-.control-group.error textarea {
- color: #b94a48;
- border-color: #b94a48;
-}
-
-.control-group.error .checkbox:focus,
-.control-group.error .radio:focus,
-.control-group.error input:focus,
-.control-group.error select:focus,
-.control-group.error textarea:focus {
- border-color: #953b39;
- -webkit-box-shadow: 0 0 6px #d59392;
- -moz-box-shadow: 0 0 6px #d59392;
- box-shadow: 0 0 6px #d59392;
-}
-
-.control-group.error .input-prepend .add-on,
-.control-group.error .input-append .add-on {
- color: #b94a48;
- background-color: #f2dede;
- border-color: #b94a48;
-}
-
-.control-group.success > label,
-.control-group.success .help-block,
-.control-group.success .help-inline {
- color: #468847;
-}
-
-.control-group.success .checkbox,
-.control-group.success .radio,
-.control-group.success input,
-.control-group.success select,
-.control-group.success textarea {
- color: #468847;
- border-color: #468847;
-}
-
-.control-group.success .checkbox:focus,
-.control-group.success .radio:focus,
-.control-group.success input:focus,
-.control-group.success select:focus,
-.control-group.success textarea:focus {
- border-color: #356635;
- -webkit-box-shadow: 0 0 6px #7aba7b;
- -moz-box-shadow: 0 0 6px #7aba7b;
- box-shadow: 0 0 6px #7aba7b;
-}
-
-.control-group.success .input-prepend .add-on,
-.control-group.success .input-append .add-on {
- color: #468847;
- background-color: #dff0d8;
- border-color: #468847;
-}
-
-input:focus:required:invalid,
-textarea:focus:required:invalid,
-select:focus:required:invalid {
- color: #b94a48;
- border-color: #ee5f5b;
-}
-
-input:focus:required:invalid:focus,
-textarea:focus:required:invalid:focus,
-select:focus:required:invalid:focus {
- border-color: #e9322d;
- -webkit-box-shadow: 0 0 6px #f8b9b7;
- -moz-box-shadow: 0 0 6px #f8b9b7;
- box-shadow: 0 0 6px #f8b9b7;
-}
-
-.form-actions {
- padding: 17px 20px 18px;
- margin-top: 18px;
- margin-bottom: 18px;
- background-color: #f5f5f5;
- border-top: 1px solid #e5e5e5;
- *zoom: 1;
-}
-
-.form-actions:before,
-.form-actions:after {
- display: table;
- content: "";
-}
-
-.form-actions:after {
- clear: both;
-}
-
-.uneditable-input {
- overflow: hidden;
- white-space: nowrap;
- cursor: not-allowed;
- background-color: #ffffff;
- border-color: #eee;
- -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.025);
- -moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.025);
- box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.025);
-}
-
-:-moz-placeholder {
- color: #999999;
-}
-
-:-ms-input-placeholder {
- color: #999999;
-}
-
-::-webkit-input-placeholder {
- color: #999999;
-}
-
-.help-block,
-.help-inline {
- color: #555555;
-}
-
-.help-block {
- display: block;
- margin-bottom: 9px;
-}
-
-.help-inline {
- display: inline-block;
- *display: inline;
- padding-left: 5px;
- vertical-align: middle;
- *zoom: 1;
-}
-
-.input-prepend,
-.input-append {
- margin-bottom: 5px;
-}
-
-.input-prepend input,
-.input-append input,
-.input-prepend select,
-.input-append select,
-.input-prepend .uneditable-input,
-.input-append .uneditable-input {
- position: relative;
- margin-bottom: 0;
- *margin-left: 0;
- vertical-align: middle;
- -webkit-border-radius: 0 3px 3px 0;
- -moz-border-radius: 0 3px 3px 0;
- border-radius: 0 3px 3px 0;
-}
-
-.input-prepend input:focus,
-.input-append input:focus,
-.input-prepend select:focus,
-.input-append select:focus,
-.input-prepend .uneditable-input:focus,
-.input-append .uneditable-input:focus {
- z-index: 2;
-}
-
-.input-prepend .uneditable-input,
-.input-append .uneditable-input {
- border-left-color: #ccc;
-}
-
-.input-prepend .add-on,
-.input-append .add-on {
- display: inline-block;
- width: auto;
- height: 18px;
- min-width: 16px;
- padding: 4px 5px;
- font-weight: normal;
- line-height: 18px;
- text-align: center;
- text-shadow: 0 1px 0 #ffffff;
- vertical-align: middle;
- background-color: #eeeeee;
- border: 1px solid #ccc;
-}
-
-.input-prepend .add-on,
-.input-append .add-on,
-.input-prepend .btn,
-.input-append .btn {
- margin-left: -1px;
- -webkit-border-radius: 0;
- -moz-border-radius: 0;
- border-radius: 0;
-}
-
-.input-prepend .active,
-.input-append .active {
- background-color: #a9dba9;
- border-color: #46a546;
-}
-
-.input-prepend .add-on,
-.input-prepend .btn {
- margin-right: -1px;
-}
-
-.input-prepend .add-on:first-child,
-.input-prepend .btn:first-child {
- -webkit-border-radius: 3px 0 0 3px;
- -moz-border-radius: 3px 0 0 3px;
- border-radius: 3px 0 0 3px;
-}
-
-.input-append input,
-.input-append select,
-.input-append .uneditable-input {
- -webkit-border-radius: 3px 0 0 3px;
- -moz-border-radius: 3px 0 0 3px;
- border-radius: 3px 0 0 3px;
-}
-
-.input-append .uneditable-input {
- border-right-color: #ccc;
- border-left-color: #eee;
-}
-
-.input-append .add-on:last-child,
-.input-append .btn:last-child {
- -webkit-border-radius: 0 3px 3px 0;
- -moz-border-radius: 0 3px 3px 0;
- border-radius: 0 3px 3px 0;
-}
-
-.input-prepend.input-append input,
-.input-prepend.input-append select,
-.input-prepend.input-append .uneditable-input {
- -webkit-border-radius: 0;
- -moz-border-radius: 0;
- border-radius: 0;
-}
-
-.input-prepend.input-append .add-on:first-child,
-.input-prepend.input-append .btn:first-child {
- margin-right: -1px;
- -webkit-border-radius: 3px 0 0 3px;
- -moz-border-radius: 3px 0 0 3px;
- border-radius: 3px 0 0 3px;
-}
-
-.input-prepend.input-append .add-on:last-child,
-.input-prepend.input-append .btn:last-child {
- margin-left: -1px;
- -webkit-border-radius: 0 3px 3px 0;
- -moz-border-radius: 0 3px 3px 0;
- border-radius: 0 3px 3px 0;
-}
-
-.search-query {
- padding-right: 14px;
- padding-right: 4px \9;
- padding-left: 14px;
- padding-left: 4px \9;
- /* IE7-8 doesn't have border-radius, so don't indent the padding */
-
- margin-bottom: 0;
- -webkit-border-radius: 14px;
- -moz-border-radius: 14px;
- border-radius: 14px;
-}
-
-.form-search input,
-.form-inline input,
-.form-horizontal input,
-.form-search textarea,
-.form-inline textarea,
-.form-horizontal textarea,
-.form-search select,
-.form-inline select,
-.form-horizontal select,
-.form-search .help-inline,
-.form-inline .help-inline,
-.form-horizontal .help-inline,
-.form-search .uneditable-input,
-.form-inline .uneditable-input,
-.form-horizontal .uneditable-input,
-.form-search .input-prepend,
-.form-inline .input-prepend,
-.form-horizontal .input-prepend,
-.form-search .input-append,
-.form-inline .input-append,
-.form-horizontal .input-append {
- display: inline-block;
- *display: inline;
- margin-bottom: 0;
- *zoom: 1;
-}
-
-.form-search .hide,
-.form-inline .hide,
-.form-horizontal .hide {
- display: none;
-}
-
-.form-search label,
-.form-inline label {
- display: inline-block;
-}
-
-.form-search .input-append,
-.form-inline .input-append,
-.form-search .input-prepend,
-.form-inline .input-prepend {
- margin-bottom: 0;
-}
-
-.form-search .radio,
-.form-search .checkbox,
-.form-inline .radio,
-.form-inline .checkbox {
- padding-left: 0;
- margin-bottom: 0;
- vertical-align: middle;
-}
-
-.form-search .radio input[type="radio"],
-.form-search .checkbox input[type="checkbox"],
-.form-inline .radio input[type="radio"],
-.form-inline .checkbox input[type="checkbox"] {
- float: left;
- margin-right: 3px;
- margin-left: 0;
-}
-
-.control-group {
- margin-bottom: 9px;
-}
-
-legend + .control-group {
- margin-top: 18px;
- -webkit-margin-top-collapse: separate;
-}
-
-.form-horizontal .control-group {
- margin-bottom: 18px;
- *zoom: 1;
-}
-
-.form-horizontal .control-group:before,
-.form-horizontal .control-group:after {
- display: table;
- content: "";
-}
-
-.form-horizontal .control-group:after {
- clear: both;
-}
-
-.form-horizontal .control-label {
- float: left;
- width: 140px;
- padding-top: 5px;
- text-align: right;
-}
-
-.form-horizontal .controls {
- *display: inline-block;
- *padding-left: 20px;
- margin-left: 160px;
- *margin-left: 0;
-}
-
-.form-horizontal .controls:first-child {
- *padding-left: 160px;
-}
-
-.form-horizontal .help-block {
- margin-top: 9px;
- margin-bottom: 0;
-}
-
-.form-horizontal .form-actions {
- padding-left: 160px;
-}
-
-table {
- max-width: 100%;
- background-color: transparent;
- border-collapse: collapse;
- border-spacing: 0;
-}
-
-.table {
- width: 100%;
- margin-bottom: 18px;
-}
-
-.table th,
-.table td {
- padding: 8px;
- line-height: 18px;
- text-align: left;
- vertical-align: top;
- border-top: 1px solid #dddddd;
-}
-
-.table th {
- font-weight: bold;
-}
-
-.table thead th {
- vertical-align: bottom;
-}
-
-.table caption + thead tr:first-child th,
-.table caption + thead tr:first-child td,
-.table colgroup + thead tr:first-child th,
-.table colgroup + thead tr:first-child td,
-.table thead:first-child tr:first-child th,
-.table thead:first-child tr:first-child td {
- border-top: 0;
-}
-
-.table tbody + tbody {
- border-top: 2px solid #dddddd;
-}
-
-.table-condensed th,
-.table-condensed td {
- padding: 4px 5px;
-}
-
-.table-bordered {
- border: 1px solid #dddddd;
- border-collapse: separate;
- *border-collapse: collapsed;
- border-left: 0;
- -webkit-border-radius: 4px;
- -moz-border-radius: 4px;
- border-radius: 4px;
-}
-
-.table-bordered th,
-.table-bordered td {
- border-left: 1px solid #dddddd;
-}
-
-.table-bordered caption + thead tr:first-child th,
-.table-bordered caption + tbody tr:first-child th,
-.table-bordered caption + tbody tr:first-child td,
-.table-bordered colgroup + thead tr:first-child th,
-.table-bordered colgroup + tbody tr:first-child th,
-.table-bordered colgroup + tbody tr:first-child td,
-.table-bordered thead:first-child tr:first-child th,
-.table-bordered tbody:first-child tr:first-child th,
-.table-bordered tbody:first-child tr:first-child td {
- border-top: 0;
-}
-
-.table-bordered thead:first-child tr:first-child th:first-child,
-.table-bordered tbody:first-child tr:first-child td:first-child {
- -webkit-border-top-left-radius: 4px;
- border-top-left-radius: 4px;
- -moz-border-radius-topleft: 4px;
-}
-
-.table-bordered thead:first-child tr:first-child th:last-child,
-.table-bordered tbody:first-child tr:first-child td:last-child {
- -webkit-border-top-right-radius: 4px;
- border-top-right-radius: 4px;
- -moz-border-radius-topright: 4px;
-}
-
-.table-bordered thead:last-child tr:last-child th:first-child,
-.table-bordered tbody:last-child tr:last-child td:first-child {
- -webkit-border-radius: 0 0 0 4px;
- -moz-border-radius: 0 0 0 4px;
- border-radius: 0 0 0 4px;
- -webkit-border-bottom-left-radius: 4px;
- border-bottom-left-radius: 4px;
- -moz-border-radius-bottomleft: 4px;
-}
-
-.table-bordered thead:last-child tr:last-child th:last-child,
-.table-bordered tbody:last-child tr:last-child td:last-child {
- -webkit-border-bottom-right-radius: 4px;
- border-bottom-right-radius: 4px;
- -moz-border-radius-bottomright: 4px;
-}
-
-.table-striped tbody tr:nth-child(odd) td,
-.table-striped tbody tr:nth-child(odd) th {
- background-color: #f9f9f9;
-}
-
-.table tbody tr:hover td,
-.table tbody tr:hover th {
- background-color: #f5f5f5;
-}
-
-table .span1 {
- float: none;
- width: 44px;
- margin-left: 0;
-}
-
-table .span2 {
- float: none;
- width: 124px;
- margin-left: 0;
-}
-
-table .span3 {
- float: none;
- width: 204px;
- margin-left: 0;
-}
-
-table .span4 {
- float: none;
- width: 284px;
- margin-left: 0;
-}
-
-table .span5 {
- float: none;
- width: 364px;
- margin-left: 0;
-}
-
-table .span6 {
- float: none;
- width: 444px;
- margin-left: 0;
-}
-
-table .span7 {
- float: none;
- width: 524px;
- margin-left: 0;
-}
-
-table .span8 {
- float: none;
- width: 604px;
- margin-left: 0;
-}
-
-table .span9 {
- float: none;
- width: 684px;
- margin-left: 0;
-}
-
-table .span10 {
- float: none;
- width: 764px;
- margin-left: 0;
-}
-
-table .span11 {
- float: none;
- width: 844px;
- margin-left: 0;
-}
-
-table .span12 {
- float: none;
- width: 924px;
- margin-left: 0;
-}
-
-table .span13 {
- float: none;
- width: 1004px;
- margin-left: 0;
-}
-
-table .span14 {
- float: none;
- width: 1084px;
- margin-left: 0;
-}
-
-table .span15 {
- float: none;
- width: 1164px;
- margin-left: 0;
-}
-
-table .span16 {
- float: none;
- width: 1244px;
- margin-left: 0;
-}
-
-table .span17 {
- float: none;
- width: 1324px;
- margin-left: 0;
-}
-
-table .span18 {
- float: none;
- width: 1404px;
- margin-left: 0;
-}
-
-table .span19 {
- float: none;
- width: 1484px;
- margin-left: 0;
-}
-
-table .span20 {
- float: none;
- width: 1564px;
- margin-left: 0;
-}
-
-table .span21 {
- float: none;
- width: 1644px;
- margin-left: 0;
-}
-
-table .span22 {
- float: none;
- width: 1724px;
- margin-left: 0;
-}
-
-table .span23 {
- float: none;
- width: 1804px;
- margin-left: 0;
-}
-
-table .span24 {
- float: none;
- width: 1884px;
- margin-left: 0;
-}
-
-[class^="icon-"],
-[class*=" icon-"] {
- display: inline-block;
- width: 14px;
- height: 14px;
- *margin-right: .3em;
- line-height: 14px;
- vertical-align: text-top;
- background-image: url("../img/glyphicons-halflings.png");
- background-position: 14px 14px;
- background-repeat: no-repeat;
-}
-
-[class^="icon-"]:last-child,
-[class*=" icon-"]:last-child {
- *margin-left: 0;
-}
-
-.icon-white {
- background-image: url("../img/glyphicons-halflings-white.png");
-}
-
-.icon-glass {
- background-position: 0 0;
-}
-
-.icon-music {
- background-position: -24px 0;
-}
-
-.icon-search {
- background-position: -48px 0;
-}
-
-.icon-envelope {
- background-position: -72px 0;
-}
-
-.icon-heart {
- background-position: -96px 0;
-}
-
-.icon-star {
- background-position: -120px 0;
-}
-
-.icon-star-empty {
- background-position: -144px 0;
-}
-
-.icon-user {
- background-position: -168px 0;
-}
-
-.icon-film {
- background-position: -192px 0;
-}
-
-.icon-th-large {
- background-position: -216px 0;
-}
-
-.icon-th {
- background-position: -240px 0;
-}
-
-.icon-th-list {
- background-position: -264px 0;
-}
-
-.icon-ok {
- background-position: -288px 0;
-}
-
-.icon-remove {
- background-position: -312px 0;
-}
-
-.icon-zoom-in {
- background-position: -336px 0;
-}
-
-.icon-zoom-out {
- background-position: -360px 0;
-}
-
-.icon-off {
- background-position: -384px 0;
-}
-
-.icon-signal {
- background-position: -408px 0;
-}
-
-.icon-cog {
- background-position: -432px 0;
-}
-
-.icon-trash {
- background-position: -456px 0;
-}
-
-.icon-home {
- background-position: 0 -24px;
-}
-
-.icon-file {
- background-position: -24px -24px;
-}
-
-.icon-time {
- background-position: -48px -24px;
-}
-
-.icon-road {
- background-position: -72px -24px;
-}
-
-.icon-download-alt {
- background-position: -96px -24px;
-}
-
-.icon-download {
- background-position: -120px -24px;
-}
-
-.icon-upload {
- background-position: -144px -24px;
-}
-
-.icon-inbox {
- background-position: -168px -24px;
-}
-
-.icon-play-circle {
- background-position: -192px -24px;
-}
-
-.icon-repeat {
- background-position: -216px -24px;
-}
-
-.icon-refresh {
- background-position: -240px -24px;
-}
-
-.icon-list-alt {
- background-position: -264px -24px;
-}
-
-.icon-lock {
- background-position: -287px -24px;
-}
-
-.icon-flag {
- background-position: -312px -24px;
-}
-
-.icon-headphones {
- background-position: -336px -24px;
-}
-
-.icon-volume-off {
- background-position: -360px -24px;
-}
-
-.icon-volume-down {
- background-position: -384px -24px;
-}
-
-.icon-volume-up {
- background-position: -408px -24px;
-}
-
-.icon-qrcode {
- background-position: -432px -24px;
-}
-
-.icon-barcode {
- background-position: -456px -24px;
-}
-
-.icon-tag {
- background-position: 0 -48px;
-}
-
-.icon-tags {
- background-position: -25px -48px;
-}
-
-.icon-book {
- background-position: -48px -48px;
-}
-
-.icon-bookmark {
- background-position: -72px -48px;
-}
-
-.icon-print {
- background-position: -96px -48px;
-}
-
-.icon-camera {
- background-position: -120px -48px;
-}
-
-.icon-font {
- background-position: -144px -48px;
-}
-
-.icon-bold {
- background-position: -167px -48px;
-}
-
-.icon-italic {
- background-position: -192px -48px;
-}
-
-.icon-text-height {
- background-position: -216px -48px;
-}
-
-.icon-text-width {
- background-position: -240px -48px;
-}
-
-.icon-align-left {
- background-position: -264px -48px;
-}
-
-.icon-align-center {
- background-position: -288px -48px;
-}
-
-.icon-align-right {
- background-position: -312px -48px;
-}
-
-.icon-align-justify {
- background-position: -336px -48px;
-}
-
-.icon-list {
- background-position: -360px -48px;
-}
-
-.icon-indent-left {
- background-position: -384px -48px;
-}
-
-.icon-indent-right {
- background-position: -408px -48px;
-}
-
-.icon-facetime-video {
- background-position: -432px -48px;
-}
-
-.icon-picture {
- background-position: -456px -48px;
-}
-
-.icon-pencil {
- background-position: 0 -72px;
-}
-
-.icon-map-marker {
- background-position: -24px -72px;
-}
-
-.icon-adjust {
- background-position: -48px -72px;
-}
-
-.icon-tint {
- background-position: -72px -72px;
-}
-
-.icon-edit {
- background-position: -96px -72px;
-}
-
-.icon-share {
- background-position: -120px -72px;
-}
-
-.icon-check {
- background-position: -144px -72px;
-}
-
-.icon-move {
- background-position: -168px -72px;
-}
-
-.icon-step-backward {
- background-position: -192px -72px;
-}
-
-.icon-fast-backward {
- background-position: -216px -72px;
-}
-
-.icon-backward {
- background-position: -240px -72px;
-}
-
-.icon-play {
- background-position: -264px -72px;
-}
-
-.icon-pause {
- background-position: -288px -72px;
-}
-
-.icon-stop {
- background-position: -312px -72px;
-}
-
-.icon-forward {
- background-position: -336px -72px;
-}
-
-.icon-fast-forward {
- background-position: -360px -72px;
-}
-
-.icon-step-forward {
- background-position: -384px -72px;
-}
-
-.icon-eject {
- background-position: -408px -72px;
-}
-
-.icon-chevron-left {
- background-position: -432px -72px;
-}
-
-.icon-chevron-right {
- background-position: -456px -72px;
-}
-
-.icon-plus-sign {
- background-position: 0 -96px;
-}
-
-.icon-minus-sign {
- background-position: -24px -96px;
-}
-
-.icon-remove-sign {
- background-position: -48px -96px;
-}
-
-.icon-ok-sign {
- background-position: -72px -96px;
-}
-
-.icon-question-sign {
- background-position: -96px -96px;
-}
-
-.icon-info-sign {
- background-position: -120px -96px;
-}
-
-.icon-screenshot {
- background-position: -144px -96px;
-}
-
-.icon-remove-circle {
- background-position: -168px -96px;
-}
-
-.icon-ok-circle {
- background-position: -192px -96px;
-}
-
-.icon-ban-circle {
- background-position: -216px -96px;
-}
-
-.icon-arrow-left {
- background-position: -240px -96px;
-}
-
-.icon-arrow-right {
- background-position: -264px -96px;
-}
-
-.icon-arrow-up {
- background-position: -289px -96px;
-}
-
-.icon-arrow-down {
- background-position: -312px -96px;
-}
-
-.icon-share-alt {
- background-position: -336px -96px;
-}
-
-.icon-resize-full {
- background-position: -360px -96px;
-}
-
-.icon-resize-small {
- background-position: -384px -96px;
-}
-
-.icon-plus {
- background-position: -408px -96px;
-}
-
-.icon-minus {
- background-position: -433px -96px;
-}
-
-.icon-asterisk {
- background-position: -456px -96px;
-}
-
-.icon-exclamation-sign {
- background-position: 0 -120px;
-}
-
-.icon-gift {
- background-position: -24px -120px;
-}
-
-.icon-leaf {
- background-position: -48px -120px;
-}
-
-.icon-fire {
- background-position: -72px -120px;
-}
-
-.icon-eye-open {
- background-position: -96px -120px;
-}
-
-.icon-eye-close {
- background-position: -120px -120px;
-}
-
-.icon-warning-sign {
- background-position: -144px -120px;
-}
-
-.icon-plane {
- background-position: -168px -120px;
-}
-
-.icon-calendar {
- background-position: -192px -120px;
-}
-
-.icon-random {
- background-position: -216px -120px;
-}
-
-.icon-comment {
- background-position: -240px -120px;
-}
-
-.icon-magnet {
- background-position: -264px -120px;
-}
-
-.icon-chevron-up {
- background-position: -288px -120px;
-}
-
-.icon-chevron-down {
- background-position: -313px -119px;
-}
-
-.icon-retweet {
- background-position: -336px -120px;
-}
-
-.icon-shopping-cart {
- background-position: -360px -120px;
-}
-
-.icon-folder-close {
- background-position: -384px -120px;
-}
-
-.icon-folder-open {
- background-position: -408px -120px;
-}
-
-.icon-resize-vertical {
- background-position: -432px -119px;
-}
-
-.icon-resize-horizontal {
- background-position: -456px -118px;
-}
-
-.icon-hdd {
- background-position: 0 -144px;
-}
-
-.icon-bullhorn {
- background-position: -24px -144px;
-}
-
-.icon-bell {
- background-position: -48px -144px;
-}
-
-.icon-certificate {
- background-position: -72px -144px;
-}
-
-.icon-thumbs-up {
- background-position: -96px -144px;
-}
-
-.icon-thumbs-down {
- background-position: -120px -144px;
-}
-
-.icon-hand-right {
- background-position: -144px -144px;
-}
-
-.icon-hand-left {
- background-position: -168px -144px;
-}
-
-.icon-hand-up {
- background-position: -192px -144px;
-}
-
-.icon-hand-down {
- background-position: -216px -144px;
-}
-
-.icon-circle-arrow-right {
- background-position: -240px -144px;
-}
-
-.icon-circle-arrow-left {
- background-position: -264px -144px;
-}
-
-.icon-circle-arrow-up {
- background-position: -288px -144px;
-}
-
-.icon-circle-arrow-down {
- background-position: -312px -144px;
-}
-
-.icon-globe {
- background-position: -336px -144px;
-}
-
-.icon-wrench {
- background-position: -360px -144px;
-}
-
-.icon-tasks {
- background-position: -384px -144px;
-}
-
-.icon-filter {
- background-position: -408px -144px;
-}
-
-.icon-briefcase {
- background-position: -432px -144px;
-}
-
-.icon-fullscreen {
- background-position: -456px -144px;
-}
-
-.dropup,
-.dropdown {
- position: relative;
-}
-
-.dropdown-toggle {
- *margin-bottom: -3px;
-}
-
-.dropdown-toggle:active,
-.open .dropdown-toggle {
- outline: 0;
-}
-
-.caret {
- display: inline-block;
- width: 0;
- height: 0;
- vertical-align: top;
- border-top: 4px solid #000000;
- border-right: 4px solid transparent;
- border-left: 4px solid transparent;
- content: "";
- opacity: 0.3;
- filter: alpha(opacity=30);
-}
-
-.dropdown .caret {
- margin-top: 8px;
- margin-left: 2px;
-}
-
-.dropdown:hover .caret,
-.open .caret {
- opacity: 1;
- filter: alpha(opacity=100);
-}
-
-.dropdown-menu {
- position: absolute;
- top: 100%;
- left: 0;
- z-index: 1000;
- display: none;
- float: left;
- min-width: 160px;
- padding: 4px 0;
- margin: 1px 0 0;
- list-style: none;
- background-color: #ffffff;
- border: 1px solid #ccc;
- border: 1px solid rgba(0, 0, 0, 0.2);
- *border-right-width: 2px;
- *border-bottom-width: 2px;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px;
- -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
- -moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
- box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
- -webkit-background-clip: padding-box;
- -moz-background-clip: padding;
- background-clip: padding-box;
-}
-
-.dropdown-menu.pull-right {
- right: 0;
- left: auto;
-}
-
-.dropdown-menu .divider {
- *width: 100%;
- height: 1px;
- margin: 8px 1px;
- *margin: -5px 0 5px;
- overflow: hidden;
- background-color: #e5e5e5;
- border-bottom: 1px solid #ffffff;
-}
-
-.dropdown-menu a {
- display: block;
- padding: 3px 15px;
- clear: both;
- font-weight: normal;
- line-height: 18px;
- color: #333333;
- white-space: nowrap;
-}
-
-.dropdown-menu li > a:hover,
-.dropdown-menu .active > a,
-.dropdown-menu .active > a:hover {
- color: #ffffff;
- text-decoration: none;
- background-color: #0088cc;
-}
-
-.open {
- *z-index: 1000;
-}
-
-.open > .dropdown-menu {
- display: block;
-}
-
-.pull-right > .dropdown-menu {
- right: 0;
- left: auto;
-}
-
-.dropup .caret,
-.navbar-fixed-bottom .dropdown .caret {
- border-top: 0;
- border-bottom: 4px solid #000000;
- content: "\2191";
-}
-
-.dropup .dropdown-menu,
-.navbar-fixed-bottom .dropdown .dropdown-menu {
- top: auto;
- bottom: 100%;
- margin-bottom: 1px;
-}
-
-.typeahead {
- margin-top: 2px;
- -webkit-border-radius: 4px;
- -moz-border-radius: 4px;
- border-radius: 4px;
-}
-
-.well {
- min-height: 20px;
- padding: 19px;
- margin-bottom: 20px;
- background-color: #f5f5f5;
- border: 1px solid #eee;
- border: 1px solid rgba(0, 0, 0, 0.05);
- -webkit-border-radius: 4px;
- -moz-border-radius: 4px;
- border-radius: 4px;
- -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
- -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
- box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
-}
-
-.well blockquote {
- border-color: #ddd;
- border-color: rgba(0, 0, 0, 0.15);
-}
-
-.well-large {
- padding: 24px;
- -webkit-border-radius: 6px;
- -moz-border-radius: 6px;
- border-radius: 6px;
-}
-
-.well-small {
- padding: 9px;
- -webkit-border-radius: 3px;
- -moz-border-radius: 3px;
- border-radius: 3px;
-}
-
-.fade {
- opacity: 0;
- -webkit-transition: opacity 0.15s linear;
- -moz-transition: opacity 0.15s linear;
- -ms-transition: opacity 0.15s linear;
- -o-transition: opacity 0.15s linear;
- transition: opacity 0.15s linear;
-}
-
-.fade.in {
- opacity: 1;
-}
-
-.collapse {
- position: relative;
- height: 0;
- overflow: hidden;
- -webkit-transition: height 0.35s ease;
- -moz-transition: height 0.35s ease;
- -ms-transition: height 0.35s ease;
- -o-transition: height 0.35s ease;
- transition: height 0.35s ease;
-}
-
-.collapse.in {
- height: auto;
-}
-
-.close {
- float: right;
- font-size: 20px;
- font-weight: bold;
- line-height: 18px;
- color: #000000;
- text-shadow: 0 1px 0 #ffffff;
- opacity: 0.2;
- filter: alpha(opacity=20);
-}
-
-.close:hover {
- color: #000000;
- text-decoration: none;
- cursor: pointer;
- opacity: 0.4;
- filter: alpha(opacity=40);
-}
-
-button.close {
- padding: 0;
- cursor: pointer;
- background: transparent;
- border: 0;
- -webkit-appearance: none;
-}
-
-.btn {
- display: inline-block;
- *display: inline;
- padding: 4px 10px 4px;
- margin-bottom: 0;
- *margin-left: .3em;
- font-size: 13px;
- line-height: 18px;
- *line-height: 20px;
- color: #333333;
- text-align: center;
- text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
- vertical-align: middle;
- cursor: pointer;
- background-color: #f5f5f5;
- *background-color: #e6e6e6;
- background-image: -ms-linear-gradient(top, #ffffff, #e6e6e6);
- background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6));
- background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6);
- background-image: -o-linear-gradient(top, #ffffff, #e6e6e6);
- background-image: linear-gradient(top, #ffffff, #e6e6e6);
- background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6);
- background-repeat: repeat-x;
- border: 1px solid #cccccc;
- *border: 0;
- border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
- border-color: #e6e6e6 #e6e6e6 #bfbfbf;
- border-bottom-color: #b3b3b3;
- -webkit-border-radius: 4px;
- -moz-border-radius: 4px;
- border-radius: 4px;
- filter: progid:dximagetransform.microsoft.gradient(startColorstr='#ffffff', endColorstr='#e6e6e6', GradientType=0);
- filter: progid:dximagetransform.microsoft.gradient(enabled=false);
- *zoom: 1;
- -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
- -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
- box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
-}
-
-.btn:hover,
-.btn:active,
-.btn.active,
-.btn.disabled,
-.btn[disabled] {
- background-color: #e6e6e6;
- *background-color: #d9d9d9;
-}
-
-.btn:active,
-.btn.active {
- background-color: #cccccc \9;
-}
-
-.btn:first-child {
- *margin-left: 0;
-}
-
-.btn:hover {
- color: #333333;
- text-decoration: none;
- background-color: #e6e6e6;
- *background-color: #d9d9d9;
- /* Buttons in IE7 don't get borders, so darken on hover */
-
- background-position: 0 -15px;
- -webkit-transition: background-position 0.1s linear;
- -moz-transition: background-position 0.1s linear;
- -ms-transition: background-position 0.1s linear;
- -o-transition: background-position 0.1s linear;
- transition: background-position 0.1s linear;
-}
-
-.btn:focus {
- outline: thin dotted #333;
- outline: 5px auto -webkit-focus-ring-color;
- outline-offset: -2px;
-}
-
-.btn.active,
-.btn:active {
- background-color: #e6e6e6;
- background-color: #d9d9d9 \9;
- background-image: none;
- outline: 0;
- -webkit-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05);
- -moz-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05);
- box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05);
-}
-
-.btn.disabled,
-.btn[disabled] {
- cursor: default;
- background-color: #e6e6e6;
- background-image: none;
- opacity: 0.65;
- filter: alpha(opacity=65);
- -webkit-box-shadow: none;
- -moz-box-shadow: none;
- box-shadow: none;
-}
-
-.btn-large {
- padding: 9px 14px;
- font-size: 15px;
- line-height: normal;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px;
-}
-
-.btn-large [class^="icon-"] {
- margin-top: 1px;
-}
-
-.btn-small {
- padding: 5px 9px;
- font-size: 11px;
- line-height: 16px;
-}
-
-.btn-small [class^="icon-"] {
- margin-top: -1px;
-}
-
-.btn-mini {
- padding: 2px 6px;
- font-size: 11px;
- line-height: 14px;
-}
-
-.btn-primary,
-.btn-primary:hover,
-.btn-warning,
-.btn-warning:hover,
-.btn-danger,
-.btn-danger:hover,
-.btn-success,
-.btn-success:hover,
-.btn-info,
-.btn-info:hover,
-.btn-inverse,
-.btn-inverse:hover {
- color: #ffffff;
- text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
-}
-
-.btn-primary.active,
-.btn-warning.active,
-.btn-danger.active,
-.btn-success.active,
-.btn-info.active,
-.btn-inverse.active {
- color: rgba(255, 255, 255, 0.75);
-}
-
-.btn {
- border-color: #ccc;
- border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
-}
-
-.btn-primary {
- background-color: #0074cc;
- *background-color: #0055cc;
- background-image: -ms-linear-gradient(top, #0088cc, #0055cc);
- background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0055cc));
- background-image: -webkit-linear-gradient(top, #0088cc, #0055cc);
- background-image: -o-linear-gradient(top, #0088cc, #0055cc);
- background-image: -moz-linear-gradient(top, #0088cc, #0055cc);
- background-image: linear-gradient(top, #0088cc, #0055cc);
- background-repeat: repeat-x;
- border-color: #0055cc #0055cc #003580;
- border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
- filter: progid:dximagetransform.microsoft.gradient(startColorstr='#0088cc', endColorstr='#0055cc', GradientType=0);
- filter: progid:dximagetransform.microsoft.gradient(enabled=false);
-}
-
-.btn-primary:hover,
-.btn-primary:active,
-.btn-primary.active,
-.btn-primary.disabled,
-.btn-primary[disabled] {
- background-color: #0055cc;
- *background-color: #004ab3;
-}
-
-.btn-primary:active,
-.btn-primary.active {
- background-color: #004099 \9;
-}
-
-.btn-warning {
- background-color: #faa732;
- *background-color: #f89406;
- background-image: -ms-linear-gradient(top, #fbb450, #f89406);
- background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fbb450), to(#f89406));
- background-image: -webkit-linear-gradient(top, #fbb450, #f89406);
- background-image: -o-linear-gradient(top, #fbb450, #f89406);
- background-image: -moz-linear-gradient(top, #fbb450, #f89406);
- background-image: linear-gradient(top, #fbb450, #f89406);
- background-repeat: repeat-x;
- border-color: #f89406 #f89406 #ad6704;
- border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
- filter: progid:dximagetransform.microsoft.gradient(startColorstr='#fbb450', endColorstr='#f89406', GradientType=0);
- filter: progid:dximagetransform.microsoft.gradient(enabled=false);
-}
-
-.btn-warning:hover,
-.btn-warning:active,
-.btn-warning.active,
-.btn-warning.disabled,
-.btn-warning[disabled] {
- background-color: #f89406;
- *background-color: #df8505;
-}
-
-.btn-warning:active,
-.btn-warning.active {
- background-color: #c67605 \9;
-}
-
-.btn-danger {
- background-color: #da4f49;
- *background-color: #bd362f;
- background-image: -ms-linear-gradient(top, #ee5f5b, #bd362f);
- background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ee5f5b), to(#bd362f));
- background-image: -webkit-linear-gradient(top, #ee5f5b, #bd362f);
- background-image: -o-linear-gradient(top, #ee5f5b, #bd362f);
- background-image: -moz-linear-gradient(top, #ee5f5b, #bd362f);
- background-image: linear-gradient(top, #ee5f5b, #bd362f);
- background-repeat: repeat-x;
- border-color: #bd362f #bd362f #802420;
- border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
- filter: progid:dximagetransform.microsoft.gradient(startColorstr='#ee5f5b', endColorstr='#bd362f', GradientType=0);
- filter: progid:dximagetransform.microsoft.gradient(enabled=false);
-}
-
-.btn-danger:hover,
-.btn-danger:active,
-.btn-danger.active,
-.btn-danger.disabled,
-.btn-danger[disabled] {
- background-color: #bd362f;
- *background-color: #a9302a;
-}
-
-.btn-danger:active,
-.btn-danger.active {
- background-color: #942a25 \9;
-}
-
-.btn-success {
- background-color: #5bb75b;
- *background-color: #51a351;
- background-image: -ms-linear-gradient(top, #62c462, #51a351);
- background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#62c462), to(#51a351));
- background-image: -webkit-linear-gradient(top, #62c462, #51a351);
- background-image: -o-linear-gradient(top, #62c462, #51a351);
- background-image: -moz-linear-gradient(top, #62c462, #51a351);
- background-image: linear-gradient(top, #62c462, #51a351);
- background-repeat: repeat-x;
- border-color: #51a351 #51a351 #387038;
- border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
- filter: progid:dximagetransform.microsoft.gradient(startColorstr='#62c462', endColorstr='#51a351', GradientType=0);
- filter: progid:dximagetransform.microsoft.gradient(enabled=false);
-}
-
-.btn-success:hover,
-.btn-success:active,
-.btn-success.active,
-.btn-success.disabled,
-.btn-success[disabled] {
- background-color: #51a351;
- *background-color: #499249;
-}
-
-.btn-success:active,
-.btn-success.active {
- background-color: #408140 \9;
-}
-
-.btn-info {
- background-color: #49afcd;
- *background-color: #2f96b4;
- background-image: -ms-linear-gradient(top, #5bc0de, #2f96b4);
- background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#5bc0de), to(#2f96b4));
- background-image: -webkit-linear-gradient(top, #5bc0de, #2f96b4);
- background-image: -o-linear-gradient(top, #5bc0de, #2f96b4);
- background-image: -moz-linear-gradient(top, #5bc0de, #2f96b4);
- background-image: linear-gradient(top, #5bc0de, #2f96b4);
- background-repeat: repeat-x;
- border-color: #2f96b4 #2f96b4 #1f6377;
- border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
- filter: progid:dximagetransform.microsoft.gradient(startColorstr='#5bc0de', endColorstr='#2f96b4', GradientType=0);
- filter: progid:dximagetransform.microsoft.gradient(enabled=false);
-}
-
-.btn-info:hover,
-.btn-info:active,
-.btn-info.active,
-.btn-info.disabled,
-.btn-info[disabled] {
- background-color: #2f96b4;
- *background-color: #2a85a0;
-}
-
-.btn-info:active,
-.btn-info.active {
- background-color: #24748c \9;
-}
-
-.btn-inverse {
- background-color: #414141;
- *background-color: #222222;
- background-image: -ms-linear-gradient(top, #555555, #222222);
- background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#555555), to(#222222));
- background-image: -webkit-linear-gradient(top, #555555, #222222);
- background-image: -o-linear-gradient(top, #555555, #222222);
- background-image: -moz-linear-gradient(top, #555555, #222222);
- background-image: linear-gradient(top, #555555, #222222);
- background-repeat: repeat-x;
- border-color: #222222 #222222 #000000;
- border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
- filter: progid:dximagetransform.microsoft.gradient(startColorstr='#555555', endColorstr='#222222', GradientType=0);
- filter: progid:dximagetransform.microsoft.gradient(enabled=false);
-}
-
-.btn-inverse:hover,
-.btn-inverse:active,
-.btn-inverse.active,
-.btn-inverse.disabled,
-.btn-inverse[disabled] {
- background-color: #222222;
- *background-color: #151515;
-}
-
-.btn-inverse:active,
-.btn-inverse.active {
- background-color: #080808 \9;
-}
-
-button.btn,
-input[type="submit"].btn {
- *padding-top: 2px;
- *padding-bottom: 2px;
-}
-
-button.btn::-moz-focus-inner,
-input[type="submit"].btn::-moz-focus-inner {
- padding: 0;
- border: 0;
-}
-
-button.btn.btn-large,
-input[type="submit"].btn.btn-large {
- *padding-top: 7px;
- *padding-bottom: 7px;
-}
-
-button.btn.btn-small,
-input[type="submit"].btn.btn-small {
- *padding-top: 3px;
- *padding-bottom: 3px;
-}
-
-button.btn.btn-mini,
-input[type="submit"].btn.btn-mini {
- *padding-top: 1px;
- *padding-bottom: 1px;
-}
-
-.btn-group {
- position: relative;
- *margin-left: .3em;
- *zoom: 1;
-}
-
-.btn-group:before,
-.btn-group:after {
- display: table;
- content: "";
-}
-
-.btn-group:after {
- clear: both;
-}
-
-.btn-group:first-child {
- *margin-left: 0;
-}
-
-.btn-group + .btn-group {
- margin-left: 5px;
-}
-
-.btn-toolbar {
- margin-top: 9px;
- margin-bottom: 9px;
-}
-
-.btn-toolbar .btn-group {
- display: inline-block;
- *display: inline;
- /* IE7 inline-block hack */
-
- *zoom: 1;
-}
-
-.btn-group > .btn {
- position: relative;
- float: left;
- margin-left: -1px;
- -webkit-border-radius: 0;
- -moz-border-radius: 0;
- border-radius: 0;
-}
-
-.btn-group > .btn:first-child {
- margin-left: 0;
- -webkit-border-bottom-left-radius: 4px;
- border-bottom-left-radius: 4px;
- -webkit-border-top-left-radius: 4px;
- border-top-left-radius: 4px;
- -moz-border-radius-bottomleft: 4px;
- -moz-border-radius-topleft: 4px;
-}
-
-.btn-group > .btn:last-child,
-.btn-group > .dropdown-toggle {
- -webkit-border-top-right-radius: 4px;
- border-top-right-radius: 4px;
- -webkit-border-bottom-right-radius: 4px;
- border-bottom-right-radius: 4px;
- -moz-border-radius-topright: 4px;
- -moz-border-radius-bottomright: 4px;
-}
-
-.btn-group > .btn.large:first-child {
- margin-left: 0;
- -webkit-border-bottom-left-radius: 6px;
- border-bottom-left-radius: 6px;
- -webkit-border-top-left-radius: 6px;
- border-top-left-radius: 6px;
- -moz-border-radius-bottomleft: 6px;
- -moz-border-radius-topleft: 6px;
-}
-
-.btn-group > .btn.large:last-child,
-.btn-group > .large.dropdown-toggle {
- -webkit-border-top-right-radius: 6px;
- border-top-right-radius: 6px;
- -webkit-border-bottom-right-radius: 6px;
- border-bottom-right-radius: 6px;
- -moz-border-radius-topright: 6px;
- -moz-border-radius-bottomright: 6px;
-}
-
-.btn-group > .btn:hover,
-.btn-group > .btn:focus,
-.btn-group > .btn:active,
-.btn-group > .btn.active {
- z-index: 2;
-}
-
-.btn-group .dropdown-toggle:active,
-.btn-group.open .dropdown-toggle {
- outline: 0;
-}
-
-.btn-group > .dropdown-toggle {
- *padding-top: 4px;
- padding-right: 8px;
- *padding-bottom: 4px;
- padding-left: 8px;
- -webkit-box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.125), inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
- -moz-box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.125), inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
- box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.125), inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
-}
-
-.btn-group > .btn-mini.dropdown-toggle {
- padding-right: 5px;
- padding-left: 5px;
-}
-
-.btn-group > .btn-small.dropdown-toggle {
- *padding-top: 4px;
- *padding-bottom: 4px;
-}
-
-.btn-group > .btn-large.dropdown-toggle {
- padding-right: 12px;
- padding-left: 12px;
-}
-
-.btn-group.open .dropdown-toggle {
- background-image: none;
- -webkit-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05);
- -moz-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05);
- box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05);
-}
-
-.btn-group.open .btn.dropdown-toggle {
- background-color: #e6e6e6;
-}
-
-.btn-group.open .btn-primary.dropdown-toggle {
- background-color: #0055cc;
-}
-
-.btn-group.open .btn-warning.dropdown-toggle {
- background-color: #f89406;
-}
-
-.btn-group.open .btn-danger.dropdown-toggle {
- background-color: #bd362f;
-}
-
-.btn-group.open .btn-success.dropdown-toggle {
- background-color: #51a351;
-}
-
-.btn-group.open .btn-info.dropdown-toggle {
- background-color: #2f96b4;
-}
-
-.btn-group.open .btn-inverse.dropdown-toggle {
- background-color: #222222;
-}
-
-.btn .caret {
- margin-top: 7px;
- margin-left: 0;
-}
-
-.btn:hover .caret,
-.open.btn-group .caret {
- opacity: 1;
- filter: alpha(opacity=100);
-}
-
-.btn-mini .caret {
- margin-top: 5px;
-}
-
-.btn-small .caret {
- margin-top: 6px;
-}
-
-.btn-large .caret {
- margin-top: 6px;
- border-top-width: 5px;
- border-right-width: 5px;
- border-left-width: 5px;
-}
-
-.dropup .btn-large .caret {
- border-top: 0;
- border-bottom: 5px solid #000000;
-}
-
-.btn-primary .caret,
-.btn-warning .caret,
-.btn-danger .caret,
-.btn-info .caret,
-.btn-success .caret,
-.btn-inverse .caret {
- border-top-color: #ffffff;
- border-bottom-color: #ffffff;
- opacity: 0.75;
- filter: alpha(opacity=75);
-}
-
-.alert {
- padding: 8px 35px 8px 14px;
- margin-bottom: 18px;
- color: #c09853;
- text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
- background-color: #fcf8e3;
- border: 1px solid #fbeed5;
- -webkit-border-radius: 4px;
- -moz-border-radius: 4px;
- border-radius: 4px;
-}
-
-.alert-heading {
- color: inherit;
-}
-
-.alert .close {
- position: relative;
- top: -2px;
- right: -21px;
- line-height: 18px;
-}
-
-.alert-success {
- color: #468847;
- background-color: #dff0d8;
- border-color: #d6e9c6;
-}
-
-.alert-danger,
-.alert-error {
- color: #b94a48;
- background-color: #f2dede;
- border-color: #eed3d7;
-}
-
-.alert-info {
- color: #3a87ad;
- background-color: #d9edf7;
- border-color: #bce8f1;
-}
-
-.alert-block {
- padding-top: 14px;
- padding-bottom: 14px;
-}
-
-.alert-block > p,
-.alert-block > ul {
- margin-bottom: 0;
-}
-
-.alert-block p + p {
- margin-top: 5px;
-}
-
-.nav {
- margin-bottom: 18px;
- margin-left: 0;
- list-style: none;
-}
-
-.nav > li > a {
- display: block;
-}
-
-.nav > li > a:hover {
- text-decoration: none;
- background-color: #eeeeee;
-}
-
-.nav > .pull-right {
- float: right;
-}
-
-.nav .nav-header {
- display: block;
- padding: 3px 15px;
- font-size: 11px;
- font-weight: bold;
- line-height: 18px;
- color: #999999;
- text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
- text-transform: uppercase;
-}
-
-.nav li + .nav-header {
- margin-top: 9px;
-}
-
-.nav-list {
- padding-right: 15px;
- padding-left: 15px;
- margin-bottom: 0;
-}
-
-.nav-list > li > a,
-.nav-list .nav-header {
- margin-right: -15px;
- margin-left: -15px;
- text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
-}
-
-.nav-list > li > a {
- padding: 3px 15px;
-}
-
-.nav-list > .active > a,
-.nav-list > .active > a:hover {
- color: #ffffff;
- text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.2);
- background-color: #0088cc;
-}
-
-.nav-list [class^="icon-"] {
- margin-right: 2px;
-}
-
-.nav-list .divider {
- *width: 100%;
- height: 1px;
- margin: 8px 1px;
- *margin: -5px 0 5px;
- overflow: hidden;
- background-color: #e5e5e5;
- border-bottom: 1px solid #ffffff;
-}
-
-.nav-tabs,
-.nav-pills {
- *zoom: 1;
-}
-
-.nav-tabs:before,
-.nav-pills:before,
-.nav-tabs:after,
-.nav-pills:after {
- display: table;
- content: "";
-}
-
-.nav-tabs:after,
-.nav-pills:after {
- clear: both;
-}
-
-.nav-tabs > li,
-.nav-pills > li {
- float: left;
-}
-
-.nav-tabs > li > a,
-.nav-pills > li > a {
- padding-right: 12px;
- padding-left: 12px;
- margin-right: 2px;
- line-height: 14px;
-}
-
-.nav-tabs {
- border-bottom: 1px solid #ddd;
-}
-
-.nav-tabs > li {
- margin-bottom: -1px;
-}
-
-.nav-tabs > li > a {
- padding-top: 8px;
- padding-bottom: 8px;
- line-height: 18px;
- border: 1px solid transparent;
- -webkit-border-radius: 4px 4px 0 0;
- -moz-border-radius: 4px 4px 0 0;
- border-radius: 4px 4px 0 0;
-}
-
-.nav-tabs > li > a:hover {
- border-color: #eeeeee #eeeeee #dddddd;
-}
-
-.nav-tabs > .active > a,
-.nav-tabs > .active > a:hover {
- color: #555555;
- cursor: default;
- background-color: #ffffff;
- border: 1px solid #ddd;
- border-bottom-color: transparent;
-}
-
-.nav-pills > li > a {
- padding-top: 8px;
- padding-bottom: 8px;
- margin-top: 2px;
- margin-bottom: 2px;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px;
-}
-
-.nav-pills > .active > a,
-.nav-pills > .active > a:hover {
- color: #ffffff;
- background-color: #0088cc;
-}
-
-.nav-stacked > li {
- float: none;
-}
-
-.nav-stacked > li > a {
- margin-right: 0;
-}
-
-.nav-tabs.nav-stacked {
- border-bottom: 0;
-}
-
-.nav-tabs.nav-stacked > li > a {
- border: 1px solid #ddd;
- -webkit-border-radius: 0;
- -moz-border-radius: 0;
- border-radius: 0;
-}
-
-.nav-tabs.nav-stacked > li:first-child > a {
- -webkit-border-radius: 4px 4px 0 0;
- -moz-border-radius: 4px 4px 0 0;
- border-radius: 4px 4px 0 0;
-}
-
-.nav-tabs.nav-stacked > li:last-child > a {
- -webkit-border-radius: 0 0 4px 4px;
- -moz-border-radius: 0 0 4px 4px;
- border-radius: 0 0 4px 4px;
-}
-
-.nav-tabs.nav-stacked > li > a:hover {
- z-index: 2;
- border-color: #ddd;
-}
-
-.nav-pills.nav-stacked > li > a {
- margin-bottom: 3px;
-}
-
-.nav-pills.nav-stacked > li:last-child > a {
- margin-bottom: 1px;
-}
-
-.nav-tabs .dropdown-menu {
- -webkit-border-radius: 0 0 5px 5px;
- -moz-border-radius: 0 0 5px 5px;
- border-radius: 0 0 5px 5px;
-}
-
-.nav-pills .dropdown-menu {
- -webkit-border-radius: 4px;
- -moz-border-radius: 4px;
- border-radius: 4px;
-}
-
-.nav-tabs .dropdown-toggle .caret,
-.nav-pills .dropdown-toggle .caret {
- margin-top: 6px;
- border-top-color: #0088cc;
- border-bottom-color: #0088cc;
-}
-
-.nav-tabs .dropdown-toggle:hover .caret,
-.nav-pills .dropdown-toggle:hover .caret {
- border-top-color: #005580;
- border-bottom-color: #005580;
-}
-
-.nav-tabs .active .dropdown-toggle .caret,
-.nav-pills .active .dropdown-toggle .caret {
- border-top-color: #333333;
- border-bottom-color: #333333;
-}
-
-.nav > .dropdown.active > a:hover {
- color: #000000;
- cursor: pointer;
-}
-
-.nav-tabs .open .dropdown-toggle,
-.nav-pills .open .dropdown-toggle,
-.nav > li.dropdown.open.active > a:hover {
- color: #ffffff;
- background-color: #999999;
- border-color: #999999;
-}
-
-.nav li.dropdown.open .caret,
-.nav li.dropdown.open.active .caret,
-.nav li.dropdown.open a:hover .caret {
- border-top-color: #ffffff;
- border-bottom-color: #ffffff;
- opacity: 1;
- filter: alpha(opacity=100);
-}
-
-.tabs-stacked .open > a:hover {
- border-color: #999999;
-}
-
-.tabbable {
- *zoom: 1;
-}
-
-.tabbable:before,
-.tabbable:after {
- display: table;
- content: "";
-}
-
-.tabbable:after {
- clear: both;
-}
-
-.tab-content {
- overflow: auto;
-}
-
-.tabs-below > .nav-tabs,
-.tabs-right > .nav-tabs,
-.tabs-left > .nav-tabs {
- border-bottom: 0;
-}
-
-.tab-content > .tab-pane,
-.pill-content > .pill-pane {
- display: none;
-}
-
-.tab-content > .active,
-.pill-content > .active {
- display: block;
-}
-
-.tabs-below > .nav-tabs {
- border-top: 1px solid #ddd;
-}
-
-.tabs-below > .nav-tabs > li {
- margin-top: -1px;
- margin-bottom: 0;
-}
-
-.tabs-below > .nav-tabs > li > a {
- -webkit-border-radius: 0 0 4px 4px;
- -moz-border-radius: 0 0 4px 4px;
- border-radius: 0 0 4px 4px;
-}
-
-.tabs-below > .nav-tabs > li > a:hover {
- border-top-color: #ddd;
- border-bottom-color: transparent;
-}
-
-.tabs-below > .nav-tabs > .active > a,
-.tabs-below > .nav-tabs > .active > a:hover {
- border-color: transparent #ddd #ddd #ddd;
-}
-
-.tabs-left > .nav-tabs > li,
-.tabs-right > .nav-tabs > li {
- float: none;
-}
-
-.tabs-left > .nav-tabs > li > a,
-.tabs-right > .nav-tabs > li > a {
- min-width: 74px;
- margin-right: 0;
- margin-bottom: 3px;
-}
-
-.tabs-left > .nav-tabs {
- float: left;
- margin-right: 19px;
- border-right: 1px solid #ddd;
-}
-
-.tabs-left > .nav-tabs > li > a {
- margin-right: -1px;
- -webkit-border-radius: 4px 0 0 4px;
- -moz-border-radius: 4px 0 0 4px;
- border-radius: 4px 0 0 4px;
-}
-
-.tabs-left > .nav-tabs > li > a:hover {
- border-color: #eeeeee #dddddd #eeeeee #eeeeee;
-}
-
-.tabs-left > .nav-tabs .active > a,
-.tabs-left > .nav-tabs .active > a:hover {
- border-color: #ddd transparent #ddd #ddd;
- *border-right-color: #ffffff;
-}
-
-.tabs-right > .nav-tabs {
- float: right;
- margin-left: 19px;
- border-left: 1px solid #ddd;
-}
-
-.tabs-right > .nav-tabs > li > a {
- margin-left: -1px;
- -webkit-border-radius: 0 4px 4px 0;
- -moz-border-radius: 0 4px 4px 0;
- border-radius: 0 4px 4px 0;
-}
-
-.tabs-right > .nav-tabs > li > a:hover {
- border-color: #eeeeee #eeeeee #eeeeee #dddddd;
-}
-
-.tabs-right > .nav-tabs .active > a,
-.tabs-right > .nav-tabs .active > a:hover {
- border-color: #ddd #ddd #ddd transparent;
- *border-left-color: #ffffff;
-}
-
-.navbar {
- *position: relative;
- *z-index: 2;
- margin-bottom: 18px;
- overflow: visible;
-}
-
-.navbar-inner {
- min-height: 40px;
- padding-right: 20px;
- padding-left: 20px;
- background-color: #2c2c2c;
- background-image: -moz-linear-gradient(top, #333333, #222222);
- background-image: -ms-linear-gradient(top, #333333, #222222);
- background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#333333), to(#222222));
- background-image: -webkit-linear-gradient(top, #333333, #222222);
- background-image: -o-linear-gradient(top, #333333, #222222);
- background-image: linear-gradient(top, #333333, #222222);
- background-repeat: repeat-x;
- -webkit-border-radius: 4px;
- -moz-border-radius: 4px;
- border-radius: 4px;
- filter: progid:dximagetransform.microsoft.gradient(startColorstr='#333333', endColorstr='#222222', GradientType=0);
- -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), inset 0 -1px 0 rgba(0, 0, 0, 0.1);
- -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), inset 0 -1px 0 rgba(0, 0, 0, 0.1);
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), inset 0 -1px 0 rgba(0, 0, 0, 0.1);
-}
-
-.navbar .container {
- width: auto;
-}
-
-.nav-collapse.collapse {
- height: auto;
-}
-
-.navbar {
- color: #999999;
-}
-
-.navbar .brand:hover {
- text-decoration: none;
-}
-
-.navbar .brand {
- display: block;
- float: left;
- padding: 8px 20px 12px;
- margin-left: -20px;
- font-size: 20px;
- font-weight: 200;
- line-height: 1;
- color: #999999;
-}
-
-.navbar .navbar-text {
- margin-bottom: 0;
- line-height: 40px;
-}
-
-.navbar .navbar-link {
- color: #999999;
-}
-
-.navbar .navbar-link:hover {
- color: #ffffff;
-}
-
-.navbar .btn,
-.navbar .btn-group {
- margin-top: 5px;
-}
-
-.navbar .btn-group .btn {
- margin: 0;
-}
-
-.navbar-form {
- margin-bottom: 0;
- *zoom: 1;
-}
-
-.navbar-form:before,
-.navbar-form:after {
- display: table;
- content: "";
-}
-
-.navbar-form:after {
- clear: both;
-}
-
-.navbar-form input,
-.navbar-form select,
-.navbar-form .radio,
-.navbar-form .checkbox {
- margin-top: 5px;
-}
-
-.navbar-form input,
-.navbar-form select {
- display: inline-block;
- margin-bottom: 0;
-}
-
-.navbar-form input[type="image"],
-.navbar-form input[type="checkbox"],
-.navbar-form input[type="radio"] {
- margin-top: 3px;
-}
-
-.navbar-form .input-append,
-.navbar-form .input-prepend {
- margin-top: 6px;
- white-space: nowrap;
-}
-
-.navbar-form .input-append input,
-.navbar-form .input-prepend input {
- margin-top: 0;
-}
-
-.navbar-search {
- position: relative;
- float: left;
- margin-top: 6px;
- margin-bottom: 0;
-}
-
-.navbar-search .search-query {
- padding: 4px 9px;
- font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
- font-size: 13px;
- font-weight: normal;
- line-height: 1;
- color: #ffffff;
- background-color: #626262;
- border: 1px solid #151515;
- -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 0 rgba(255, 255, 255, 0.15);
- -moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 0 rgba(255, 255, 255, 0.15);
- box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 0 rgba(255, 255, 255, 0.15);
- -webkit-transition: none;
- -moz-transition: none;
- -ms-transition: none;
- -o-transition: none;
- transition: none;
-}
-
-.navbar-search .search-query:-moz-placeholder {
- color: #cccccc;
-}
-
-.navbar-search .search-query:-ms-input-placeholder {
- color: #cccccc;
-}
-
-.navbar-search .search-query::-webkit-input-placeholder {
- color: #cccccc;
-}
-
-.navbar-search .search-query:focus,
-.navbar-search .search-query.focused {
- padding: 5px 10px;
- color: #333333;
- text-shadow: 0 1px 0 #ffffff;
- background-color: #ffffff;
- border: 0;
- outline: 0;
- -webkit-box-shadow: 0 0 3px rgba(0, 0, 0, 0.15);
- -moz-box-shadow: 0 0 3px rgba(0, 0, 0, 0.15);
- box-shadow: 0 0 3px rgba(0, 0, 0, 0.15);
-}
-
-.navbar-fixed-top,
-.navbar-fixed-bottom {
- position: fixed;
- right: 0;
- left: 0;
- z-index: 1030;
- margin-bottom: 0;
-}
-
-.navbar-fixed-top .navbar-inner,
-.navbar-fixed-bottom .navbar-inner {
- padding-right: 0;
- padding-left: 0;
- -webkit-border-radius: 0;
- -moz-border-radius: 0;
- border-radius: 0;
-}
-
-.navbar-fixed-top .container,
-.navbar-fixed-bottom .container {
- width: 940px;
-}
-
-.navbar-fixed-top {
- top: 0;
-}
-
-.navbar-fixed-bottom {
- bottom: 0;
-}
-
-.navbar .nav {
- position: relative;
- left: 0;
- display: block;
- float: left;
- margin: 0 10px 0 0;
-}
-
-.navbar .nav.pull-right {
- float: right;
-}
-
-.navbar .nav > li {
- display: block;
- float: left;
-}
-
-.navbar .nav > li > a {
- float: none;
- padding: 9px 10px 11px;
- line-height: 19px;
- color: #999999;
- text-decoration: none;
- text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
-}
-
-.navbar .btn {
- display: inline-block;
- padding: 4px 10px 4px;
- margin: 5px 5px 6px;
- line-height: 18px;
-}
-
-.navbar .btn-group {
- padding: 5px 5px 6px;
- margin: 0;
-}
-
-.navbar .nav > li > a:hover {
- color: #ffffff;
- text-decoration: none;
- background-color: transparent;
-}
-
-.navbar .nav .active > a,
-.navbar .nav .active > a:hover {
- color: #ffffff;
- text-decoration: none;
- background-color: #222222;
-}
-
-.navbar .divider-vertical {
- width: 1px;
- height: 40px;
- margin: 0 9px;
- overflow: hidden;
- background-color: #222222;
- border-right: 1px solid #333333;
-}
-
-.navbar .nav.pull-right {
- margin-right: 0;
- margin-left: 10px;
-}
-
-.navbar .btn-navbar {
- display: none;
- float: right;
- padding: 7px 10px;
- margin-right: 5px;
- margin-left: 5px;
- background-color: #2c2c2c;
- *background-color: #222222;
- background-image: -ms-linear-gradient(top, #333333, #222222);
- background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#333333), to(#222222));
- background-image: -webkit-linear-gradient(top, #333333, #222222);
- background-image: -o-linear-gradient(top, #333333, #222222);
- background-image: linear-gradient(top, #333333, #222222);
- background-image: -moz-linear-gradient(top, #333333, #222222);
- background-repeat: repeat-x;
- border-color: #222222 #222222 #000000;
- border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
- filter: progid:dximagetransform.microsoft.gradient(startColorstr='#333333', endColorstr='#222222', GradientType=0);
- filter: progid:dximagetransform.microsoft.gradient(enabled=false);
- -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.075);
- -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.075);
- box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.075);
-}
-
-.navbar .btn-navbar:hover,
-.navbar .btn-navbar:active,
-.navbar .btn-navbar.active,
-.navbar .btn-navbar.disabled,
-.navbar .btn-navbar[disabled] {
- background-color: #222222;
- *background-color: #151515;
-}
-
-.navbar .btn-navbar:active,
-.navbar .btn-navbar.active {
- background-color: #080808 \9;
-}
-
-.navbar .btn-navbar .icon-bar {
- display: block;
- width: 18px;
- height: 2px;
- background-color: #f5f5f5;
- -webkit-border-radius: 1px;
- -moz-border-radius: 1px;
- border-radius: 1px;
- -webkit-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
- -moz-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
- box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
-}
-
-.btn-navbar .icon-bar + .icon-bar {
- margin-top: 3px;
-}
-
-.navbar .dropdown-menu:before {
- position: absolute;
- top: -7px;
- left: 9px;
- display: inline-block;
- border-right: 7px solid transparent;
- border-bottom: 7px solid #ccc;
- border-left: 7px solid transparent;
- border-bottom-color: rgba(0, 0, 0, 0.2);
- content: '';
-}
-
-.navbar .dropdown-menu:after {
- position: absolute;
- top: -6px;
- left: 10px;
- display: inline-block;
- border-right: 6px solid transparent;
- border-bottom: 6px solid #ffffff;
- border-left: 6px solid transparent;
- content: '';
-}
-
-.navbar-fixed-bottom .dropdown-menu:before {
- top: auto;
- bottom: -7px;
- border-top: 7px solid #ccc;
- border-bottom: 0;
- border-top-color: rgba(0, 0, 0, 0.2);
-}
-
-.navbar-fixed-bottom .dropdown-menu:after {
- top: auto;
- bottom: -6px;
- border-top: 6px solid #ffffff;
- border-bottom: 0;
-}
-
-.navbar .nav li.dropdown .dropdown-toggle .caret,
-.navbar .nav li.dropdown.open .caret {
- border-top-color: #ffffff;
- border-bottom-color: #ffffff;
-}
-
-.navbar .nav li.dropdown.active .caret {
- opacity: 1;
- filter: alpha(opacity=100);
-}
-
-.navbar .nav li.dropdown.open > .dropdown-toggle,
-.navbar .nav li.dropdown.active > .dropdown-toggle,
-.navbar .nav li.dropdown.open.active > .dropdown-toggle {
- background-color: transparent;
-}
-
-.navbar .nav li.dropdown.active > .dropdown-toggle:hover {
- color: #ffffff;
-}
-
-.navbar .pull-right .dropdown-menu,
-.navbar .dropdown-menu.pull-right {
- right: 0;
- left: auto;
-}
-
-.navbar .pull-right .dropdown-menu:before,
-.navbar .dropdown-menu.pull-right:before {
- right: 12px;
- left: auto;
-}
-
-.navbar .pull-right .dropdown-menu:after,
-.navbar .dropdown-menu.pull-right:after {
- right: 13px;
- left: auto;
-}
-
-.breadcrumb {
- padding: 7px 14px;
- margin: 0 0 18px;
- list-style: none;
- background-color: #fbfbfb;
- background-image: -moz-linear-gradient(top, #ffffff, #f5f5f5);
- background-image: -ms-linear-gradient(top, #ffffff, #f5f5f5);
- background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#f5f5f5));
- background-image: -webkit-linear-gradient(top, #ffffff, #f5f5f5);
- background-image: -o-linear-gradient(top, #ffffff, #f5f5f5);
- background-image: linear-gradient(top, #ffffff, #f5f5f5);
- background-repeat: repeat-x;
- border: 1px solid #ddd;
- -webkit-border-radius: 3px;
- -moz-border-radius: 3px;
- border-radius: 3px;
- filter: progid:dximagetransform.microsoft.gradient(startColorstr='#ffffff', endColorstr='#f5f5f5', GradientType=0);
- -webkit-box-shadow: inset 0 1px 0 #ffffff;
- -moz-box-shadow: inset 0 1px 0 #ffffff;
- box-shadow: inset 0 1px 0 #ffffff;
-}
-
-.breadcrumb li {
- display: inline-block;
- *display: inline;
- text-shadow: 0 1px 0 #ffffff;
- *zoom: 1;
-}
-
-.breadcrumb .divider {
- padding: 0 5px;
- color: #999999;
-}
-
-.breadcrumb .active a {
- color: #333333;
-}
-
-.pagination {
- height: 36px;
- margin: 18px 0;
-}
-
-.pagination ul {
- display: inline-block;
- *display: inline;
- margin-bottom: 0;
- margin-left: 0;
- -webkit-border-radius: 3px;
- -moz-border-radius: 3px;
- border-radius: 3px;
- *zoom: 1;
- -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
- -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
- box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
-}
-
-.pagination li {
- display: inline;
-}
-
-.pagination a {
- float: left;
- padding: 0 14px;
- line-height: 34px;
- text-decoration: none;
- border: 1px solid #ddd;
- border-left-width: 0;
-}
-
-.pagination a:hover,
-.pagination .active a {
- background-color: #f5f5f5;
-}
-
-.pagination .active a {
- color: #999999;
- cursor: default;
-}
-
-.pagination .disabled span,
-.pagination .disabled a,
-.pagination .disabled a:hover {
- color: #999999;
- cursor: default;
- background-color: transparent;
-}
-
-.pagination li:first-child a {
- border-left-width: 1px;
- -webkit-border-radius: 3px 0 0 3px;
- -moz-border-radius: 3px 0 0 3px;
- border-radius: 3px 0 0 3px;
-}
-
-.pagination li:last-child a {
- -webkit-border-radius: 0 3px 3px 0;
- -moz-border-radius: 0 3px 3px 0;
- border-radius: 0 3px 3px 0;
-}
-
-.pagination-centered {
- text-align: center;
-}
-
-.pagination-right {
- text-align: right;
-}
-
-.pager {
- margin-bottom: 18px;
- margin-left: 0;
- text-align: center;
- list-style: none;
- *zoom: 1;
-}
-
-.pager:before,
-.pager:after {
- display: table;
- content: "";
-}
-
-.pager:after {
- clear: both;
-}
-
-.pager li {
- display: inline;
-}
-
-.pager a {
- display: inline-block;
- padding: 5px 14px;
- background-color: #fff;
- border: 1px solid #ddd;
- -webkit-border-radius: 15px;
- -moz-border-radius: 15px;
- border-radius: 15px;
-}
-
-.pager a:hover {
- text-decoration: none;
- background-color: #f5f5f5;
-}
-
-.pager .next a {
- float: right;
-}
-
-.pager .previous a {
- float: left;
-}
-
-.pager .disabled a,
-.pager .disabled a:hover {
- color: #999999;
- cursor: default;
- background-color: #fff;
-}
-
-.modal-open .dropdown-menu {
- z-index: 2050;
-}
-
-.modal-open .dropdown.open {
- *z-index: 2050;
-}
-
-.modal-open .popover {
- z-index: 2060;
-}
-
-.modal-open .tooltip {
- z-index: 2070;
-}
-
-.modal-backdrop {
- position: fixed;
- top: 0;
- right: 0;
- bottom: 0;
- left: 0;
- z-index: 1040;
- background-color: #000000;
-}
-
-.modal-backdrop.fade {
- opacity: 0;
-}
-
-.modal-backdrop,
-.modal-backdrop.fade.in {
- opacity: 0.8;
- filter: alpha(opacity=80);
-}
-
-.modal {
- position: fixed;
- top: 50%;
- left: 50%;
- z-index: 1050;
- width: 560px;
- margin: -250px 0 0 -280px;
- overflow: auto;
- background-color: #ffffff;
- border: 1px solid #999;
- border: 1px solid rgba(0, 0, 0, 0.3);
- *border: 1px solid #999;
- -webkit-border-radius: 6px;
- -moz-border-radius: 6px;
- border-radius: 6px;
- -webkit-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);
- -moz-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);
- box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);
- -webkit-background-clip: padding-box;
- -moz-background-clip: padding-box;
- background-clip: padding-box;
-}
-
-.modal.fade {
- top: -25%;
- -webkit-transition: opacity 0.3s linear, top 0.3s ease-out;
- -moz-transition: opacity 0.3s linear, top 0.3s ease-out;
- -ms-transition: opacity 0.3s linear, top 0.3s ease-out;
- -o-transition: opacity 0.3s linear, top 0.3s ease-out;
- transition: opacity 0.3s linear, top 0.3s ease-out;
-}
-
-.modal.fade.in {
- top: 50%;
-}
-
-.modal-header {
- padding: 9px 15px;
- border-bottom: 1px solid #eee;
-}
-
-.modal-header .close {
- margin-top: 2px;
-}
-
-.modal-body {
- max-height: 400px;
- padding: 15px;
- overflow-y: auto;
-}
-
-.modal-form {
- margin-bottom: 0;
-}
-
-.modal-footer {
- padding: 14px 15px 15px;
- margin-bottom: 0;
- text-align: right;
- background-color: #f5f5f5;
- border-top: 1px solid #ddd;
- -webkit-border-radius: 0 0 6px 6px;
- -moz-border-radius: 0 0 6px 6px;
- border-radius: 0 0 6px 6px;
- *zoom: 1;
- -webkit-box-shadow: inset 0 1px 0 #ffffff;
- -moz-box-shadow: inset 0 1px 0 #ffffff;
- box-shadow: inset 0 1px 0 #ffffff;
-}
-
-.modal-footer:before,
-.modal-footer:after {
- display: table;
- content: "";
-}
-
-.modal-footer:after {
- clear: both;
-}
-
-.modal-footer .btn + .btn {
- margin-bottom: 0;
- margin-left: 5px;
-}
-
-.modal-footer .btn-group .btn + .btn {
- margin-left: -1px;
-}
-
-.tooltip {
- position: absolute;
- z-index: 1020;
- display: block;
- padding: 5px;
- font-size: 11px;
- opacity: 0;
- filter: alpha(opacity=0);
- visibility: visible;
-}
-
-.tooltip.in {
- opacity: 0.8;
- filter: alpha(opacity=80);
-}
-
-.tooltip.top {
- margin-top: -2px;
-}
-
-.tooltip.right {
- margin-left: 2px;
-}
-
-.tooltip.bottom {
- margin-top: 2px;
-}
-
-.tooltip.left {
- margin-left: -2px;
-}
-
-.tooltip.top .tooltip-arrow {
- bottom: 0;
- left: 50%;
- margin-left: -5px;
- border-top: 5px solid #000000;
- border-right: 5px solid transparent;
- border-left: 5px solid transparent;
-}
-
-.tooltip.left .tooltip-arrow {
- top: 50%;
- right: 0;
- margin-top: -5px;
- border-top: 5px solid transparent;
- border-bottom: 5px solid transparent;
- border-left: 5px solid #000000;
-}
-
-.tooltip.bottom .tooltip-arrow {
- top: 0;
- left: 50%;
- margin-left: -5px;
- border-right: 5px solid transparent;
- border-bottom: 5px solid #000000;
- border-left: 5px solid transparent;
-}
-
-.tooltip.right .tooltip-arrow {
- top: 50%;
- left: 0;
- margin-top: -5px;
- border-top: 5px solid transparent;
- border-right: 5px solid #000000;
- border-bottom: 5px solid transparent;
-}
-
-.tooltip-inner {
- max-width: 200px;
- padding: 3px 8px;
- color: #ffffff;
- text-align: center;
- text-decoration: none;
- background-color: #000000;
- -webkit-border-radius: 4px;
- -moz-border-radius: 4px;
- border-radius: 4px;
-}
-
-.tooltip-arrow {
- position: absolute;
- width: 0;
- height: 0;
-}
-
-.popover {
- position: absolute;
- top: 0;
- left: 0;
- z-index: 1010;
- display: none;
- padding: 5px;
-}
-
-.popover.top {
- margin-top: -5px;
-}
-
-.popover.right {
- margin-left: 5px;
-}
-
-.popover.bottom {
- margin-top: 5px;
-}
-
-.popover.left {
- margin-left: -5px;
-}
-
-.popover.top .arrow {
- bottom: 0;
- left: 50%;
- margin-left: -5px;
- border-top: 5px solid #000000;
- border-right: 5px solid transparent;
- border-left: 5px solid transparent;
-}
-
-.popover.right .arrow {
- top: 50%;
- left: 0;
- margin-top: -5px;
- border-top: 5px solid transparent;
- border-right: 5px solid #000000;
- border-bottom: 5px solid transparent;
-}
-
-.popover.bottom .arrow {
- top: 0;
- left: 50%;
- margin-left: -5px;
- border-right: 5px solid transparent;
- border-bottom: 5px solid #000000;
- border-left: 5px solid transparent;
-}
-
-.popover.left .arrow {
- top: 50%;
- right: 0;
- margin-top: -5px;
- border-top: 5px solid transparent;
- border-bottom: 5px solid transparent;
- border-left: 5px solid #000000;
-}
-
-.popover .arrow {
- position: absolute;
- width: 0;
- height: 0;
-}
-
-.popover-inner {
- width: 280px;
- padding: 3px;
- overflow: hidden;
- background: #000000;
- background: rgba(0, 0, 0, 0.8);
- -webkit-border-radius: 6px;
- -moz-border-radius: 6px;
- border-radius: 6px;
- -webkit-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);
- -moz-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);
- box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);
-}
-
-.popover-title {
- padding: 9px 15px;
- line-height: 1;
- background-color: #f5f5f5;
- border-bottom: 1px solid #eee;
- -webkit-border-radius: 3px 3px 0 0;
- -moz-border-radius: 3px 3px 0 0;
- border-radius: 3px 3px 0 0;
-}
-
-.popover-content {
- padding: 14px;
- background-color: #ffffff;
- -webkit-border-radius: 0 0 3px 3px;
- -moz-border-radius: 0 0 3px 3px;
- border-radius: 0 0 3px 3px;
- -webkit-background-clip: padding-box;
- -moz-background-clip: padding-box;
- background-clip: padding-box;
-}
-
-.popover-content p,
-.popover-content ul,
-.popover-content ol {
- margin-bottom: 0;
-}
-
-.thumbnails {
- margin-left: -20px;
- list-style: none;
- *zoom: 1;
-}
-
-.thumbnails:before,
-.thumbnails:after {
- display: table;
- content: "";
-}
-
-.thumbnails:after {
- clear: both;
-}
-
-.row-fluid .thumbnails {
- margin-left: 0;
-}
-
-.thumbnails > li {
- float: left;
- margin-bottom: 18px;
- margin-left: 20px;
-}
-
-.thumbnail {
- display: block;
- padding: 4px;
- line-height: 1;
- border: 1px solid #ddd;
- -webkit-border-radius: 4px;
- -moz-border-radius: 4px;
- border-radius: 4px;
- -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075);
- -moz-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075);
- box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075);
-}
-
-a.thumbnail:hover {
- border-color: #0088cc;
- -webkit-box-shadow: 0 1px 4px rgba(0, 105, 214, 0.25);
- -moz-box-shadow: 0 1px 4px rgba(0, 105, 214, 0.25);
- box-shadow: 0 1px 4px rgba(0, 105, 214, 0.25);
-}
-
-.thumbnail > img {
- display: block;
- max-width: 100%;
- margin-right: auto;
- margin-left: auto;
-}
-
-.thumbnail .caption {
- padding: 9px;
-}
-
-.label,
-.badge {
- font-size: 10.998px;
- font-weight: bold;
- line-height: 14px;
- color: #ffffff;
- text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
- white-space: nowrap;
- vertical-align: baseline;
- background-color: #999999;
-}
-
-.label {
- padding: 1px 4px 2px;
- -webkit-border-radius: 3px;
- -moz-border-radius: 3px;
- border-radius: 3px;
-}
-
-.badge {
- padding: 1px 9px 2px;
- -webkit-border-radius: 9px;
- -moz-border-radius: 9px;
- border-radius: 9px;
-}
-
-a.label:hover,
-a.badge:hover {
- color: #ffffff;
- text-decoration: none;
- cursor: pointer;
-}
-
-.label-important,
-.badge-important {
- background-color: #b94a48;
-}
-
-.label-important[href],
-.badge-important[href] {
- background-color: #953b39;
-}
-
-.label-warning,
-.badge-warning {
- background-color: #f89406;
-}
-
-.label-warning[href],
-.badge-warning[href] {
- background-color: #c67605;
-}
-
-.label-success,
-.badge-success {
- background-color: #468847;
-}
-
-.label-success[href],
-.badge-success[href] {
- background-color: #356635;
-}
-
-.label-info,
-.badge-info {
- background-color: #3a87ad;
-}
-
-.label-info[href],
-.badge-info[href] {
- background-color: #2d6987;
-}
-
-.label-inverse,
-.badge-inverse {
- background-color: #333333;
-}
-
-.label-inverse[href],
-.badge-inverse[href] {
- background-color: #1a1a1a;
-}
-
-@-webkit-keyframes progress-bar-stripes {
- from {
- background-position: 40px 0;
- }
- to {
- background-position: 0 0;
- }
-}
-
-@-moz-keyframes progress-bar-stripes {
- from {
- background-position: 40px 0;
- }
- to {
- background-position: 0 0;
- }
-}
-
-@-ms-keyframes progress-bar-stripes {
- from {
- background-position: 40px 0;
- }
- to {
- background-position: 0 0;
- }
-}
-
-@-o-keyframes progress-bar-stripes {
- from {
- background-position: 0 0;
- }
- to {
- background-position: 40px 0;
- }
-}
-
-@keyframes progress-bar-stripes {
- from {
- background-position: 40px 0;
- }
- to {
- background-position: 0 0;
- }
-}
-
-.progress {
- height: 18px;
- margin-bottom: 18px;
- overflow: hidden;
- background-color: #f7f7f7;
- background-image: -moz-linear-gradient(top, #f5f5f5, #f9f9f9);
- background-image: -ms-linear-gradient(top, #f5f5f5, #f9f9f9);
- background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f5f5f5), to(#f9f9f9));
- background-image: -webkit-linear-gradient(top, #f5f5f5, #f9f9f9);
- background-image: -o-linear-gradient(top, #f5f5f5, #f9f9f9);
- background-image: linear-gradient(top, #f5f5f5, #f9f9f9);
- background-repeat: repeat-x;
- -webkit-border-radius: 4px;
- -moz-border-radius: 4px;
- border-radius: 4px;
- filter: progid:dximagetransform.microsoft.gradient(startColorstr='#f5f5f5', endColorstr='#f9f9f9', GradientType=0);
- -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
- -moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
- box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
-}
-
-.progress .bar {
- width: 0;
- height: 18px;
- font-size: 12px;
- color: #ffffff;
- text-align: center;
- text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
- background-color: #0e90d2;
- background-image: -moz-linear-gradient(top, #149bdf, #0480be);
- background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#149bdf), to(#0480be));
- background-image: -webkit-linear-gradient(top, #149bdf, #0480be);
- background-image: -o-linear-gradient(top, #149bdf, #0480be);
- background-image: linear-gradient(top, #149bdf, #0480be);
- background-image: -ms-linear-gradient(top, #149bdf, #0480be);
- background-repeat: repeat-x;
- filter: progid:dximagetransform.microsoft.gradient(startColorstr='#149bdf', endColorstr='#0480be', GradientType=0);
- -webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15);
- -moz-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15);
- box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15);
- -webkit-box-sizing: border-box;
- -moz-box-sizing: border-box;
- -ms-box-sizing: border-box;
- box-sizing: border-box;
- -webkit-transition: width 0.6s ease;
- -moz-transition: width 0.6s ease;
- -ms-transition: width 0.6s ease;
- -o-transition: width 0.6s ease;
- transition: width 0.6s ease;
-}
-
-.progress-striped .bar {
- background-color: #149bdf;
- background-image: -o-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
- background-image: -webkit-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
- background-image: -moz-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
- background-image: -ms-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
- background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));
- background-image: linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
- -webkit-background-size: 40px 40px;
- -moz-background-size: 40px 40px;
- -o-background-size: 40px 40px;
- background-size: 40px 40px;
-}
-
-.progress.active .bar {
- -webkit-animation: progress-bar-stripes 2s linear infinite;
- -moz-animation: progress-bar-stripes 2s linear infinite;
- -ms-animation: progress-bar-stripes 2s linear infinite;
- -o-animation: progress-bar-stripes 2s linear infinite;
- animation: progress-bar-stripes 2s linear infinite;
-}
-
-.progress-danger .bar {
- background-color: #dd514c;
- background-image: -moz-linear-gradient(top, #ee5f5b, #c43c35);
- background-image: -ms-linear-gradient(top, #ee5f5b, #c43c35);
- background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ee5f5b), to(#c43c35));
- background-image: -webkit-linear-gradient(top, #ee5f5b, #c43c35);
- background-image: -o-linear-gradient(top, #ee5f5b, #c43c35);
- background-image: linear-gradient(top, #ee5f5b, #c43c35);
- background-repeat: repeat-x;
- filter: progid:dximagetransform.microsoft.gradient(startColorstr='#ee5f5b', endColorstr='#c43c35', GradientType=0);
-}
-
-.progress-danger.progress-striped .bar {
- background-color: #ee5f5b;
- background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));
- background-image: -webkit-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
- background-image: -moz-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
- background-image: -ms-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
- background-image: -o-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
- background-image: linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
-}
-
-.progress-success .bar {
- background-color: #5eb95e;
- background-image: -moz-linear-gradient(top, #62c462, #57a957);
- background-image: -ms-linear-gradient(top, #62c462, #57a957);
- background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#62c462), to(#57a957));
- background-image: -webkit-linear-gradient(top, #62c462, #57a957);
- background-image: -o-linear-gradient(top, #62c462, #57a957);
- background-image: linear-gradient(top, #62c462, #57a957);
- background-repeat: repeat-x;
- filter: progid:dximagetransform.microsoft.gradient(startColorstr='#62c462', endColorstr='#57a957', GradientType=0);
-}
-
-.progress-success.progress-striped .bar {
- background-color: #62c462;
- background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));
- background-image: -webkit-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
- background-image: -moz-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
- background-image: -ms-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
- background-image: -o-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
- background-image: linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
-}
-
-.progress-info .bar {
- background-color: #4bb1cf;
- background-image: -moz-linear-gradient(top, #5bc0de, #339bb9);
- background-image: -ms-linear-gradient(top, #5bc0de, #339bb9);
- background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#5bc0de), to(#339bb9));
- background-image: -webkit-linear-gradient(top, #5bc0de, #339bb9);
- background-image: -o-linear-gradient(top, #5bc0de, #339bb9);
- background-image: linear-gradient(top, #5bc0de, #339bb9);
- background-repeat: repeat-x;
- filter: progid:dximagetransform.microsoft.gradient(startColorstr='#5bc0de', endColorstr='#339bb9', GradientType=0);
-}
-
-.progress-info.progress-striped .bar {
- background-color: #5bc0de;
- background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));
- background-image: -webkit-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
- background-image: -moz-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
- background-image: -ms-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
- background-image: -o-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
- background-image: linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
-}
-
-.progress-warning .bar {
- background-color: #faa732;
- background-image: -moz-linear-gradient(top, #fbb450, #f89406);
- background-image: -ms-linear-gradient(top, #fbb450, #f89406);
- background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fbb450), to(#f89406));
- background-image: -webkit-linear-gradient(top, #fbb450, #f89406);
- background-image: -o-linear-gradient(top, #fbb450, #f89406);
- background-image: linear-gradient(top, #fbb450, #f89406);
- background-repeat: repeat-x;
- filter: progid:dximagetransform.microsoft.gradient(startColorstr='#fbb450', endColorstr='#f89406', GradientType=0);
-}
-
-.progress-warning.progress-striped .bar {
- background-color: #fbb450;
- background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));
- background-image: -webkit-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
- background-image: -moz-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
- background-image: -ms-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
- background-image: -o-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
- background-image: linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
-}
-
-.accordion {
- margin-bottom: 18px;
-}
-
-.accordion-group {
- margin-bottom: 2px;
- border: 1px solid #e5e5e5;
- -webkit-border-radius: 4px;
- -moz-border-radius: 4px;
- border-radius: 4px;
-}
-
-.accordion-heading {
- border-bottom: 0;
-}
-
-.accordion-heading .accordion-toggle {
- display: block;
- padding: 8px 15px;
-}
-
-.accordion-toggle {
- cursor: pointer;
-}
-
-.accordion-inner {
- padding: 9px 15px;
- border-top: 1px solid #e5e5e5;
-}
-
-.carousel {
- position: relative;
- margin-bottom: 18px;
- line-height: 1;
-}
-
-.carousel-inner {
- position: relative;
- width: 100%;
- overflow: hidden;
-}
-
-.carousel .item {
- position: relative;
- display: none;
- -webkit-transition: 0.6s ease-in-out left;
- -moz-transition: 0.6s ease-in-out left;
- -ms-transition: 0.6s ease-in-out left;
- -o-transition: 0.6s ease-in-out left;
- transition: 0.6s ease-in-out left;
-}
-
-.carousel .item > img {
- display: block;
- line-height: 1;
-}
-
-.carousel .active,
-.carousel .next,
-.carousel .prev {
- display: block;
-}
-
-.carousel .active {
- left: 0;
-}
-
-.carousel .next,
-.carousel .prev {
- position: absolute;
- top: 0;
- width: 100%;
-}
-
-.carousel .next {
- left: 100%;
-}
-
-.carousel .prev {
- left: -100%;
-}
-
-.carousel .next.left,
-.carousel .prev.right {
- left: 0;
-}
-
-.carousel .active.left {
- left: -100%;
-}
-
-.carousel .active.right {
- left: 100%;
-}
-
-.carousel-control {
- position: absolute;
- top: 40%;
- left: 15px;
- width: 40px;
- height: 40px;
- margin-top: -20px;
- font-size: 60px;
- font-weight: 100;
- line-height: 30px;
- color: #ffffff;
- text-align: center;
- background: #222222;
- border: 3px solid #ffffff;
- -webkit-border-radius: 23px;
- -moz-border-radius: 23px;
- border-radius: 23px;
- opacity: 0.5;
- filter: alpha(opacity=50);
-}
-
-.carousel-control.right {
- right: 15px;
- left: auto;
-}
-
-.carousel-control:hover {
- color: #ffffff;
- text-decoration: none;
- opacity: 0.9;
- filter: alpha(opacity=90);
-}
-
-.carousel-caption {
- position: absolute;
- right: 0;
- bottom: 0;
- left: 0;
- padding: 10px 15px 5px;
- background: #333333;
- background: rgba(0, 0, 0, 0.75);
-}
-
-.carousel-caption h4,
-.carousel-caption p {
- color: #ffffff;
-}
-
-.hero-unit {
- padding: 60px;
- margin-bottom: 30px;
- background-color: #eeeeee;
- -webkit-border-radius: 6px;
- -moz-border-radius: 6px;
- border-radius: 6px;
-}
-
-.hero-unit h1 {
- margin-bottom: 0;
- font-size: 60px;
- line-height: 1;
- letter-spacing: -1px;
- color: inherit;
-}
-
-.hero-unit p {
- font-size: 18px;
- font-weight: 200;
- line-height: 27px;
- color: inherit;
-}
-
-.pull-right {
- float: right;
-}
-
-.pull-left {
- float: left;
-}
-
-.hide {
- display: none;
-}
-
-.show {
- display: block;
-}
-
-.invisible {
- visibility: hidden;
-}
+++ /dev/null
-/*!
- * Jasny Bootstrap Extensions j2
- *
- * Copyright 2012 Jasny BV
- * Licensed under the Apache License v2.0
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Extended with pride by @ArnoldDaniels of jasny.net
- */
-
-.clearfix {
- *zoom: 1;
-}
-
-.clearfix:before,
-.clearfix:after {
- display: table;
- line-height: 0;
- content: "";
-}
-
-.clearfix:after {
- clear: both;
-}
-
-.hide-text {
- font: 0/0 a;
- color: transparent;
- text-shadow: none;
- background-color: transparent;
- border: 0;
-}
-
-.input-block-level {
- display: block;
- width: 100%;
- min-height: 30px;
- -webkit-box-sizing: border-box;
- -moz-box-sizing: border-box;
- box-sizing: border-box;
-}
-
-.container-semifluid {
- max-width: 940px;
- padding-right: 20px;
- padding-left: 20px;
- margin-right: auto;
- margin-left: auto;
- *zoom: 1;
-}
-
-.container-semifluid:before,
-.container-semifluid:after {
- display: table;
- line-height: 0;
- content: "";
-}
-
-.container-semifluid:after {
- clear: both;
-}
-
-form > *:last-child {
- margin-bottom: 0;
-}
-
-label input[type="image"],
-label input[type="checkbox"],
-label input[type="radio"] {
- vertical-align: middle;
-}
-
-.small-labels .control-group > label {
- width: 70px;
-}
-
-.small-labels .controls {
- margin-left: 80px;
-}
-
-.small-labels .form-actions {
- padding-left: 80px;
-}
-
-.form-vertical .form-horizontal .control-group > label {
- text-align: left;
-}
-
-.form-horizontal .form-vertical .control-group > label {
- float: none;
- padding-top: 0;
- text-align: left;
-}
-
-.form-horizontal .form-vertical .controls {
- margin-left: 0;
-}
-
-.form-horizontal .form-vertical.form-actions,
-.form-horizontal .form-vertical .form-actions {
- padding-left: 20px;
-}
-
-.control-group .control-group {
- margin-bottom: 0;
-}
-
-.form-horizontal .well .control-label {
- width: 120px;
-}
-
-.form-horizontal .well .controls {
- margin-left: 140px;
-}
-
-form .well > *:last-child {
- margin-bottom: 0;
-}
-
-.editor {
- width: 100%;
- height: 100px;
- padding: 5px;
- -webkit-box-sizing: border-box;
- -moz-box-sizing: border-box;
- box-sizing: border-box;
-}
-
-.uneditable-textarea.editor-html {
- padding: 5px 3px 5px 5px;
- white-space: normal;
-}
-
-textarea.editor-html {
- visibility: hidden;
-}
-
-.uneditable-input,
-.uneditable-textarea {
- display: inline-block;
- padding: 4px 3px 4px 5px;
- font-size: 14px;
- line-height: 20px;
- color: #555555;
- cursor: not-allowed;
- background-color: #ffffff;
- border: 1px solid #eee;
- -webkit-border-radius: 3px;
- -moz-border-radius: 3px;
- border-radius: 3px;
- -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.025);
- -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
- -moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.025);
- -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
- box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.025);
- box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
-}
-
-.uneditable-input {
- height: 20px;
- overflow: hidden;
- white-space: pre;
-}
-
-.uneditable-textarea {
- overflow-x: hidden;
- overflow-y: auto;
- white-space: pre-wrap;
-}
-
-select[disabled],
-textarea[disabled],
-input[type="text"][disabled],
-input[type="password"][disabled],
-input[type="datetime"][disabled],
-input[type="datetime-local"][disabled],
-input[type="date"][disabled],
-input[type="month"][disabled],
-input[type="time"][disabled],
-input[type="week"][disabled],
-input[type="number"][disabled],
-input[type="email"][disabled],
-input[type="url"][disabled],
-input[type="search"][disabled] {
- color: #999;
-}
-
-.uneditable-input.disabled,
-.uneditable-textarea.disabled {
- color: #999;
- cursor: not-allowed;
- background-color: #f5f5f5;
- border-color: #ddd;
-}
-
-textarea,
-.uneditable-textarea {
- height: 60px;
-}
-
-textarea[rows="1"],
-.uneditable-textarea[rows="1"] {
- height: 40px;
-}
-
-textarea[rows="2"],
-.uneditable-textarea[rows="2"] {
- height: 60px;
-}
-
-textarea[rows="3"],
-.uneditable-textarea[rows="3"] {
- height: 80px;
-}
-
-textarea[rows="4"],
-.uneditable-textarea[rows="4"] {
- height: 100px;
-}
-
-textarea[rows="5"],
-.uneditable-textarea[rows="5"] {
- height: 120px;
-}
-
-textarea[rows="6"],
-.uneditable-textarea[rows="6"] {
- height: 140px;
-}
-
-textarea[rows="7"],
-.uneditable-textarea[rows="7"] {
- height: 160px;
-}
-
-textarea[rows="8"],
-.uneditable-textarea[rows="8"] {
- height: 180px;
-}
-
-textarea[rows="9"],
-.uneditable-textarea[rows="9"] {
- height: 200px;
-}
-
-textarea[rows="10"],
-.uneditable-textarea[rows="10"] {
- height: 220px;
-}
-
-textarea[rows="11"],
-.uneditable-textarea[rows="11"] {
- height: 240px;
-}
-
-textarea[rows="12"],
-.uneditable-textarea[rows="12"] {
- height: 260px;
-}
-
-textarea[rows="13"],
-.uneditable-textarea[rows="13"] {
- height: 280px;
-}
-
-textarea[rows="14"],
-.uneditable-textarea[rows="14"] {
- height: 300px;
-}
-
-textarea[rows="15"],
-.uneditable-textarea[rows="15"] {
- height: 320px;
-}
-
-textarea[rows="16"],
-.uneditable-textarea[rows="16"] {
- height: 340px;
-}
-
-textarea[rows="17"],
-.uneditable-textarea[rows="17"] {
- height: 360px;
-}
-
-textarea[rows="18"],
-.uneditable-textarea[rows="18"] {
- height: 380px;
-}
-
-textarea[rows="19"],
-.uneditable-textarea[rows="19"] {
- height: 400px;
-}
-
-textarea[rows="20"],
-.uneditable-textarea[rows="20"] {
- height: 420px;
-}
-
-textarea[rows="21"],
-.uneditable-textarea[rows="21"] {
- height: 440px;
-}
-
-textarea[rows="22"],
-.uneditable-textarea[rows="22"] {
- height: 460px;
-}
-
-textarea[rows="23"],
-.uneditable-textarea[rows="23"] {
- height: 480px;
-}
-
-textarea[rows="24"],
-.uneditable-textarea[rows="24"] {
- height: 500px;
-}
-
-textarea[rows="25"],
-.uneditable-textarea[rows="25"] {
- height: 520px;
-}
-
-textarea[rows="26"],
-.uneditable-textarea[rows="26"] {
- height: 540px;
-}
-
-textarea[rows="27"],
-.uneditable-textarea[rows="27"] {
- height: 560px;
-}
-
-textarea[rows="28"],
-.uneditable-textarea[rows="28"] {
- height: 580px;
-}
-
-textarea[rows="29"],
-.uneditable-textarea[rows="29"] {
- height: 600px;
-}
-
-textarea[rows="30"],
-.uneditable-textarea[rows="30"] {
- height: 620px;
-}
-
-textarea[rows="35"],
-.uneditable-textarea[rows="35"] {
- height: 720px;
-}
-
-textarea[rows="40"],
-.uneditable-textarea[rows="40"] {
- height: 820px;
-}
-
-textarea[rows="45"],
-.uneditable-textarea[rows="45"] {
- height: 920px;
-}
-
-textarea[rows="50"],
-.uneditable-textarea[rows="50"] {
- height: 1020px;
-}
-
-textarea[rows="55"],
-.uneditable-textarea[rows="55"] {
- height: 1120px;
-}
-
-textarea[rows="60"],
-.uneditable-textarea[rows="60"] {
- height: 1220px;
-}
-
-textarea[rows="65"],
-.uneditable-textarea[rows="65"] {
- height: 1320px;
-}
-
-textarea[rows="70"],
-.uneditable-textarea[rows="70"] {
- height: 1420px;
-}
-
-textarea[rows="75"],
-.uneditable-textarea[rows="75"] {
- height: 1520px;
-}
-
-textarea[rows="80"],
-.uneditable-textarea[rows="80"] {
- height: 1620px;
-}
-
-textarea[rows="85"],
-.uneditable-textarea[rows="85"] {
- height: 1720px;
-}
-
-textarea[rows="90"],
-.uneditable-textarea[rows="90"] {
- height: 1820px;
-}
-
-textarea[rows="95"],
-.uneditable-textarea[rows="95"] {
- height: 1920px;
-}
-
-textarea[rows="100"],
-.uneditable-textarea[rows="100"] {
- height: 2020px;
-}
-
-.uneditable-textarea {
- -webkit-box-sizing: border-box;
- -moz-box-sizing: border-box;
- box-sizing: border-box;
-}
-
-.uneditable-input[class*="span"],
-.uneditable-textarea[class*="span"],
-.row-fluid .uneditable-input[class*="span"],
-.row-fluid .uneditable-textarea[class*="span"] {
- float: none;
- margin-left: 0;
-}
-
-.input-append .uneditable-input,
-.input-prepend .uneditable-input {
- vertical-align: top;
-}
-
-.input-append .uneditable-input[class*="span"],
-.input-prepend .uneditable-input[class*="span"] {
- display: inline-block;
-}
-
-.uneditable-form input[disabled],
-.uneditable-form textarea[disabled],
-.uneditable-form select[disabled] {
- cursor: auto;
-}
-
-.uneditable-form .uneditable-input,
-.uneditable-form .uneditable-textarea {
- cursor: text;
-}
-
-.uneditable-form .form-actions {
- background-color: transparent;
-}
-
-.header-actions {
- padding: 0 20px;
- line-height: 36px;
-}
-
-.table-actions {
- padding-bottom: 20px;
- *zoom: 1;
-}
-
-.table-actions:before,
-.table-actions:after {
- display: table;
- line-height: 0;
- content: "";
-}
-
-.table-actions:after {
- clear: both;
-}
-
-tr.rowlink td {
- cursor: pointer;
-}
-
-tr.rowlink td.nolink {
- cursor: auto;
-}
-
-.table tbody tr.rowlink:hover td {
- background-color: #cfcfcf;
-}
-
-a.rowlink {
- font: inherit;
- color: inherit;
- text-decoration: inherit;
-}
-
-.act {
- display: inline;
- padding: 0;
- font-weight: bold;
- color: #555555;
- background: inherit;
- border: none;
- -webkit-transition: text-shadow 0.1s linear;
- -moz-transition: text-shadow 0.1s linear;
- -o-transition: text-shadow 0.1s linear;
- transition: text-shadow 0.1s linear;
-}
-
-.act:hover {
- color: #333333;
- text-decoration: none;
- text-shadow: 1px 1px 3px rgba(85, 85, 85, 0.5);
-}
-
-.act-primary {
- color: #006dcc;
-}
-
-.act-primary:hover {
- color: #0044cc;
- text-shadow: 1px 1px 3px rgba(0, 109, 204, 0.5);
-}
-
-.act-info {
- color: #49afcd;
-}
-
-.act-info:hover {
- color: #2f96b4;
- text-shadow: 1px 1px 3px rgba(75, 175, 206, 0.5);
-}
-
-.act-success {
- color: #51a351;
-}
-
-.act-success:hover {
- color: #468847;
- text-shadow: 1px 1px 3px rgba(81, 164, 81, 0.5);
-}
-
-.act-warning {
- color: #c09853;
-}
-
-.act-warning:hover {
- color: #f89406;
- text-shadow: 1px 1px 3px rgba(192, 152, 84, 0.5);
-}
-
-.act-danger {
- color: #b94a48;
-}
-
-.act-danger:hover {
- color: #bd362f;
- text-shadow: 1px 1px 3px rgba(185, 72, 70, 0.5);
-}
-
-.act.disabled,
-.act[disabled] {
- color: #AAAAAA;
- cursor: not-allowed;
-}
-
-.act.disabled:hover,
-.act[disabled]:hover {
- color: #AAAAAA;
- text-shadow: none;
-}
-
-.form-actions .act {
- line-height: 30px;
-}
-
-@font-face {
- font-family: IconicStroke;
- font-weight: normal;
- src: url('../fonts/iconic_stroke.eot');
- src: local('IconicStroke'), url('iconic_stroke.eot?#iefix') format('../fonts/embedded-opentype'), url('../fonts/iconic_stroke.woff') format('woff'), url('../fonts/iconic_stroke.ttf') format('truetype'), url('iconic_stroke.svg#iconic') format('svg'), url('../fonts/iconic_stroke.otf') format('opentype');
-}
-
-@font-face {
- font-family: IconicFill;
- font-weight: normal;
- src: url('../fonts/iconic_fill.eot');
- src: local('IconicFill'), url('../fonts/iconic_fill.eot?#iefix') format('embedded-opentype'), url('../fonts/iconic_fill.woff') format('woff'), url('../fonts/iconic_fill.ttf') format('truetype'), url('iconic_fill.svg#iconic') format('svg'), url('../fonts/iconic_fill.otf') format('opentype');
-}
-
-@media screen, print {
- [class*="iconic-"] {
- font-style: inherit;
- font-weight: normal;
- vertical-align: bottom;
- }
- [class*="iconic-"]:before {
- display: inline-block;
- width: 1em;
- font-family: IconicFill;
- font-size: 0.9em;
- text-align: center;
- vertical-align: middle;
- content: "";
- }
- .iconic-stroke:before {
- font-family: IconicStroke;
- }
- .iconic-hash:before {
- content: '\23';
- }
- .iconic-question-mark:before {
- content: '\3f';
- }
- .iconic-at:before {
- content: '\40';
- }
- .iconic-pilcrow:before {
- content: '\b6';
- }
- .iconic-info:before {
- content: '\2139';
- }
- .iconic-arrow-left:before {
- content: '\2190';
- }
- .iconic-arrow-up:before {
- content: '\2191';
- }
- .iconic-arrow-right:before {
- content: '\2192';
- }
- .iconic-arrow-down:before {
- content: '\2193';
- }
- .iconic-home:before {
- content: '\2302';
- }
- .iconic-sun:before {
- content: '\2600';
- }
- .iconic-cloud:before {
- content: '\2601';
- }
- .iconic-umbrella:before {
- content: '\2602';
- }
- .iconic-star:before {
- content: '\2605';
- }
- .iconic-moon:before {
- content: '\263e';
- }
- .iconic-heart:before {
- content: '\2764';
- }
- .iconic-cog:before {
- content: '\2699';
- }
- .iconic-bolt:before {
- content: '\26a1';
- }
- .iconic-key:before {
- content: '\26bf';
- }
- .iconic-rain:before {
- content: '\26c6';
- }
- .iconic-denied:before {
- content: '\26d4';
- }
- .iconic-mail:before {
- content: '\2709';
- }
- .iconic-pen:before {
- content: '\270e';
- }
- .iconic-x:before {
- content: '\2717';
- }
- .iconic-o-x:before {
- content: '\2718';
- }
- .iconic-check:before {
- content: '\2713';
- }
- .iconic-o-check:before {
- content: '\2714';
- }
- .iconic-left-quote:before {
- content: '\275d';
- }
- .iconic-right-quote:before {
- content: '\275e';
- }
- .iconic-plus:before {
- content: '\2795';
- }
- .iconic-minus:before {
- content: '\2796';
- }
- .iconic-curved-arrow:before {
- content: '\2935';
- }
- .iconic-document-alt:before {
- content: '\e000';
- }
- .iconic-calendar:before {
- content: '\e001';
- }
- .iconic-map-pin-alt:before {
- content: '\e002';
- }
- .iconic-comment-alt1:before {
- content: '\e003';
- }
- .iconic-comment-alt2:before {
- content: '\e004';
- }
- .iconic-pen-alt:before {
- content: '\e005';
- }
- .iconic-pen-alt2:before {
- content: '\e006';
- }
- .iconic-chat-alt:before {
- content: '\e007';
- }
- .iconic-o-plus:before {
- content: '\e008';
- }
- .iconic-o-minus:before {
- content: '\e009';
- }
- .iconic-bars-alt:before {
- content: '\e00a';
- }
- .iconic-book-alt:before {
- content: '\e00b';
- }
- .iconic-aperture-alt:before {
- content: '\e00c';
- }
- .iconic-beaker-alt:before {
- content: '\e010';
- }
- .iconic-left-quote-alt:before {
- content: '\e011';
- }
- .iconic-right-quote-alt:before {
- content: '\e012';
- }
- .iconic-o-arrow-left:before {
- content: '\e013';
- }
- .iconic-o-arrow-up:before {
- content: '\e014';
- }
- .iconic-o-arrow-right:before {
- content: '\e015';
- }
- .iconic-o-arrow-down:before {
- content: '\e016';
- }
- .iconic-o-arrow-left-alt:before {
- content: '\e017';
- }
- .iconic-o-arrow-up-alt:before {
- content: '\e018';
- }
- .iconic-o-arrow-right-alt:before {
- content: '\e019';
- }
- .iconic-o-arrow-down-alt:before {
- content: '\e01a';
- }
- .iconic-brush:before {
- content: '\e01b';
- }
- .iconic-brush-alt:before {
- content: '\e01c';
- }
- .iconic-eyedropper:before {
- content: '\e01e';
- }
- .iconic-layers:before {
- content: '\e01f';
- }
- .iconic-layers-alt:before {
- content: '\e020';
- }
- .iconic-compass:before {
- content: '\e021';
- }
- .iconic-award:before {
- content: '\e022';
- }
- .iconic-beaker:before {
- content: '\e023';
- }
- .iconic-steering-wheel:before {
- content: '\e024';
- }
- .iconic-eye:before {
- content: '\e025';
- }
- .iconic-aperture:before {
- content: '\e026';
- }
- .iconic-image:before {
- content: '\e027';
- }
- .iconic-chart:before {
- content: '\e028';
- }
- .iconic-chart-alt:before {
- content: '\e029';
- }
- .iconic-target:before {
- content: '\e02a';
- }
- .iconic-tag:before {
- content: '\e02b';
- }
- .iconic-rss:before {
- content: '\e02c';
- }
- .iconic-rss-alt:before {
- content: '\e02d';
- }
- .iconic-share:before {
- content: '\e02e';
- }
- .iconic-undo:before {
- content: '\e02f';
- }
- .iconic-reload:before {
- content: '\e030';
- }
- .iconic-reload-alt:before {
- content: '\e031';
- }
- .iconic-loop:before {
- content: '\e032';
- }
- .iconic-loop-alt:before {
- content: '\e033';
- }
- .iconic-back-forth:before {
- content: '\e034';
- }
- .iconic-back-forth-alt:before {
- content: '\e035';
- }
- .iconic-spin:before {
- content: '\e036';
- }
- .iconic-spin-alt:before {
- content: '\e037';
- }
- .iconic-move-horizontal:before {
- content: '\e038';
- }
- .iconic-move-horizontal-alt:before {
- content: '\e039';
- }
- .iconic-o-move-horizontal:before {
- content: '\e03a';
- }
- .iconic-move-vertical:before {
- content: '\e03b';
- }
- .iconic-move-vertical-alt:before {
- content: '\e03c';
- }
- .iconic-o-move-vertical:before {
- content: '\e03d';
- }
- .iconic-move:before {
- content: '\e03e';
- }
- .iconic-move-alt:before {
- content: '\e03f';
- }
- .iconic-o-move:before {
- content: '\e040';
- }
- .iconic-transfer:before {
- content: '\e041';
- }
- .iconic-download:before {
- content: '\e042';
- }
- .iconic-upload:before {
- content: '\e043';
- }
- .iconic-cloud-download:before {
- content: '\e044';
- }
- .iconic-cloud-upload:before {
- content: '\e045';
- }
- .iconic-fork:before {
- content: '\e046';
- }
- .iconic-play:before {
- content: '\e047';
- }
- .iconic-o-play:before {
- content: '\e048';
- }
- .iconic-pause:before {
- content: '\e049';
- }
- .iconic-stop:before {
- content: '\e04a';
- }
- .iconic-eject:before {
- content: '\e04b';
- }
- .iconic-first:before {
- content: '\e04c';
- }
- .iconic-last:before {
- content: '\e04d';
- }
- .iconic-fullscreen:before {
- content: '\e04e';
- }
- .iconic-fullscreen-alt:before {
- content: '\e04f';
- }
- .iconic-fullscreen-exit:before {
- content: '\e050';
- }
- .iconic-fullscreen-exit-alt:before {
- content: '\e051';
- }
- .iconic-equalizer:before {
- content: '\e052';
- }
- .iconic-article:before {
- content: '\e053';
- }
- .iconic-read-more:before {
- content: '\e054';
- }
- .iconic-list:before {
- content: '\e055';
- }
- .iconic-list-nested:before {
- content: '\e056';
- }
- .iconic-cursor:before {
- content: '\e057';
- }
- .iconic-dial:before {
- content: '\e058';
- }
- .iconic-new-window:before {
- content: '\e059';
- }
- .iconic-trash:before {
- content: '\e05a';
- }
- .iconic-battery-half:before {
- content: '\e05b';
- }
- .iconic-battery-empty:before {
- content: '\e05c';
- }
- .iconic-battery-charging:before {
- content: '\e05d';
- }
- .iconic-chat:before {
- content: '\e05e';
- }
- .iconic-mic:before {
- content: '\e05f';
- }
- .iconic-movie:before {
- content: '\e060';
- }
- .iconic-headphones:before {
- content: '\e061';
- }
- .iconic-user:before {
- content: '\e062';
- }
- .iconic-lightbulb:before {
- content: '\e063';
- }
- .iconic-cd:before {
- content: '\e064';
- }
- .iconic-folder:before {
- content: '\e065';
- }
- .iconic-document:before {
- content: '\e066';
- }
- .iconic-pin:before {
- content: '\e067';
- }
- .iconic-map-pin:before {
- content: '\e068';
- }
- .iconic-book:before {
- content: '\e069';
- }
- .iconic-book-alt2:before {
- content: '\e06a';
- }
- .iconic-box:before {
- content: '\e06b';
- }
- .iconic-calendar-alt:before {
- content: '\e06c';
- }
- .iconic-comment:before {
- content: '\e06d';
- }
- .iconic-iphone:before {
- content: '\e06e';
- }
- .iconic-bars:before {
- content: '\e06f';
- }
- .iconic-camera:before {
- content: '\e070';
- }
- .iconic-volume-mute:before {
- content: '\e071';
- }
- .iconic-volume:before {
- content: '\e072';
- }
- .iconic-battery-full:before {
- content: '\e073';
- }
- .iconic-magnifying-glass:before {
- content: '\e074';
- }
- .iconic-lock:before {
- content: '\e075';
- }
- .iconic-unlock:before {
- content: '\e076';
- }
- .iconic-link:before {
- content: '\e077';
- }
- .iconic-wrench:before {
- content: '\e078';
- }
- .iconic-clock:before {
- content: '\e079';
- }
- .iconic-sun-stroke:before {
- font-family: IconicStroke;
- content: '\2600';
- }
- .iconic-moon-stroke:before {
- font-family: IconicStroke;
- content: '\263e';
- }
- .iconic-star-stroke:before {
- font-family: IconicStroke;
- content: '\2605';
- }
- .iconic-heart-stroke:before {
- font-family: IconicStroke;
- content: '\2764';
- }
- .iconic-key-stroke:before {
- font-family: IconicStroke;
- content: '\26bf';
- }
- .iconic-document-alt-stroke:before {
- font-family: IconicStroke;
- content: '\e000';
- }
- .iconic-comment-alt1-stroke:before {
- font-family: IconicStroke;
- content: '\e003';
- }
- .iconic-comment-alt2-stroke:before {
- font-family: IconicStroke;
- content: '\e004';
- }
- .iconic-pen-alt-stroke:before {
- font-family: IconicStroke;
- content: '\e005';
- }
- .iconic-chat-alt-stroke:before {
- font-family: IconicStroke;
- content: '\e007';
- }
- .iconic-award-stroke:before {
- font-family: IconicStroke;
- content: '\e022';
- }
- .iconic-tag-stroke:before {
- font-family: IconicStroke;
- content: '\e02b';
- }
- .iconic-trash-stroke:before {
- font-family: IconicStroke;
- content: '\e05a';
- }
- .iconic-folder-stroke:before {
- font-family: IconicStroke;
- content: '\e065';
- }
- .iconic-document-stroke:before {
- font-family: IconicStroke;
- content: '\e066';
- }
- .iconic-map-pin-stroke:before {
- font-family: IconicStroke;
- content: '\e068';
- }
- .iconic-calendar-alt-stroke:before {
- font-family: IconicStroke;
- content: '\e06c';
- }
- .iconic-comment-stroke:before {
- font-family: IconicStroke;
- content: '\e06d';
- }
- .iconic-lock-stroke:before {
- font-family: IconicStroke;
- content: '\e075';
- }
- .iconic-unlock-stroke:before {
- font-family: IconicStroke;
- content: '\e076';
- }
-}
-
-.page-alert {
- position: absolute;
- top: 0;
- left: 50%;
- z-index: 1020;
- width: 0;
-}
-
-.page-alert .alert {
- width: 550px;
- margin-left: -300px;
- border-top-width: 0;
- -webkit-border-radius: 0 0 4px 4px;
- -moz-border-radius: 0 0 4px 4px;
- border-radius: 0 0 4px 4px;
-}
-
-.navbar-fixed-top + .page-alert {
- top: 40px;
-}
-
-body > .page-alert {
- position: fixed;
-}
-
-.btn-file {
- position: relative;
- overflow: hidden;
- vertical-align: middle;
-}
-
-.btn-file > input {
- position: absolute;
- top: 0;
- right: 0;
- margin: 0;
- cursor: pointer;
- border: solid transparent;
- border-width: 0 0 100px 200px;
- opacity: 0;
- filter: alpha(opacity=0);
- -moz-transform: translate(-300px, 0) scale(4);
- direction: ltr;
-}
-
-.fileupload {
- margin-bottom: 9px;
-}
-
-.fileupload .uneditable-input {
- display: inline-block;
- margin-bottom: 0;
- vertical-align: middle;
- cursor: text;
-}
-
-.fileupload .thumbnail {
- display: inline-block;
- margin-bottom: 5px;
- overflow: hidden;
- text-align: center;
- vertical-align: middle;
-}
-
-.fileupload .thumbnail > img {
- display: inline-block;
- max-height: 100%;
- vertical-align: middle;
-}
-
-.fileupload .btn {
- vertical-align: middle;
-}
-
-.fileupload-exists .fileupload-new,
-.fileupload-new .fileupload-exists {
- display: none;
-}
-
-.fileupload-inline .fileupload-controls {
- display: inline;
-}
-
-.fileupload-new .input-append .btn-file {
- -webkit-border-radius: 0 3px 3px 0;
- -moz-border-radius: 0 3px 3px 0;
- border-radius: 0 3px 3px 0;
-}
-
-.thumbnail-borderless .thumbnail {
- padding: 0;
- border: none;
- -webkit-border-radius: 0;
- -moz-border-radius: 0;
- border-radius: 0;
- -webkit-box-shadow: none;
- -moz-box-shadow: none;
- box-shadow: none;
-}
-
-.fileupload-new.thumbnail-borderless .thumbnail {
- border: 1px solid #ddd;
-}
-
-.control-group.warning .fileupload .uneditable-input {
- color: #a47e3c;
- border-color: #a47e3c;
-}
-
-.control-group.warning .fileupload .fileupload-preview {
- color: #a47e3c;
-}
-
-.control-group.warning .fileupload .thumbnail {
- border-color: #a47e3c;
-}
-
-.control-group.error .fileupload .uneditable-input {
- color: #b94a48;
- border-color: #b94a48;
-}
-
-.control-group.error .fileupload .fileupload-preview {
- color: #b94a48;
-}
-
-.control-group.error .fileupload .thumbnail {
- border-color: #b94a48;
-}
-
-.control-group.success .fileupload .uneditable-input {
- color: #468847;
- border-color: #468847;
-}
-
-.control-group.success .fileupload .fileupload-preview {
- color: #468847;
-}
-
-.control-group.success .fileupload .thumbnail {
- border-color: #468847;
-}
-
-.nav-tabs > li > a,
-.nav-pills > li > a {
- outline: none;
-}
-
-.nav-tabs > li.disabled > a {
- color: #CCCCCC;
- cursor: not-allowed;
-}
-
-.tabbable {
- border-color: #ddd;
- border-style: solid;
- border-width: 0;
- *zoom: 1;
-}
-
-.tabbable:before,
-.tabbable:after {
- display: table;
- line-height: 0;
- content: "";
-}
-
-.tabbable:after {
- clear: both;
-}
-
-.tabbable > .nav-tabs {
- margin: 0;
-}
-
-.tab-content {
- padding: 18px 0 0 0;
- overflow: auto;
- border-color: #ddd;
- border-style: solid;
- border-width: 0;
-}
-
-.tabbable-bordered {
- -webkit-border-radius: 4px;
- -moz-border-radius: 4px;
- border-radius: 4px;
-}
-
-.tabbable-bordered > .tab-content {
- padding: 20px 20px 10px 20px;
- border-width: 0 1px 1px 1px;
- -webkit-border-radius: 0 0 4px 4px;
- -moz-border-radius: 0 0 4px 4px;
- border-radius: 0 0 4px 4px;
-}
-
-body > .container.tabbable > .nav-tabs {
- padding-top: 15px;
-}
-
-.tabs-below > .tab-content {
- padding: 0 0 10px 0;
-}
-
-.tabs-below.tabbable-bordered > .tab-content {
- padding: 20px 20px 10px 20px;
- border-width: 1px 1px 0 1px;
- -webkit-border-radius: 4px 4px 0 0;
- -moz-border-radius: 4px 4px 0 0;
- border-radius: 4px 4px 0 0;
-}
-
-body > .container.tabs-below.tabbable-bodered > .tab-content {
- border-top-width: 0;
- -webkit-border-radius: 0;
- -moz-border-radius: 0;
- border-radius: 0;
-}
-
-.tabs-left,
-.tabs-right {
- margin-bottom: 20px;
-}
-
-.tabs-left > .nav-tabs,
-.tabs-right > .nav-tabs {
- position: relative;
- z-index: 1;
- margin-bottom: 0;
-}
-
-.tabs-left > .tab-content,
-.tabs-right > .tab-content {
- overflow: hidden;
-}
-
-.tabs-left > .nav-tabs {
- left: 1px;
-}
-
-.tabs-left > .nav-tabs > .active > a,
-.tabs-left > .nav-tabs > .active > a:hover {
- border-color: #ddd transparent #ddd #ddd;
- *border-right-color: #ffffff;
-}
-
-.tabs-left > .tab-content {
- padding: 0 0 0 19px;
- border-left-width: 1px;
-}
-
-.tabs-left.tabbable-bordered {
- border-width: 0 1px 0 0;
-}
-
-.tabs-left.tabbable-bordered > .tab-content {
- padding: 20px 20px 10px 20px;
- border-width: 1px 0 1px 1px;
- -webkit-border-radius: 0 4px 4px 0;
- -moz-border-radius: 0 4px 4px 0;
- border-radius: 0 4px 4px 0;
-}
-
-body > .container.tabs-left.tabbable-bodered > .tab-content {
- border-top-width: 0;
- -webkit-border-radius: 0 0 4px 0;
- -moz-border-radius: 0 0 4px 0;
- border-radius: 0 0 4px 0;
-}
-
-.tabs-right > .nav-tabs {
- right: 1px;
-}
-
-.tabs-right > .nav-tabs > .active > a,
-.tabs-right > .nav-tabs > .active > a:hover {
- border-color: #ddd #ddd #ddd transparent;
- *border-left-color: #ffffff;
-}
-
-.tabs-right > .tab-content {
- padding: 0 19px 0 0;
- border-right-width: 1px;
-}
-
-.tabs-right.tabbable-bordered {
- border-width: 0 0 0 1px;
-}
-
-.tabs-right.tabbable-bordered > .tab-content {
- padding: 20px 20px 10px 20px;
- border-width: 1px 1px 1px 0;
- -webkit-border-radius: 4px 0 0 4px;
- -moz-border-radius: 4px 0 0 4px;
- border-radius: 4px 0 0 4px;
-}
-
-body > .container.tabs-right.tabbable-bodered > .tab-content {
- border-top-width: 0;
- -webkit-border-radius: 0 0 0 4px;
- -moz-border-radius: 0 0 0 4px;
- border-radius: 0 0 0 4px;
-}
-
-.modal form {
- margin-bottom: 0;
-}
+++ /dev/null
-.fileupload input[type=text]{\r
- float: left\r
-}\r
-\r
-.fileupload div {\r
- position: relative;\r
- overflow: hidden;\r
-}\r
-\r
-.fileupload div input[type=file] {\r
- display: none;\r
- font-size: 45px;\r
- position: absolute;\r
- right: 0px;\r
- top: 0px;\r
- opacity: 0;\r
- filter: alpha(opacity = 0);\r
- -ms-filter: "alpha(opacity=0)";\r
- -khtml-opacity: 0;\r
- -moz-opacity: 0;\r
-}
\ No newline at end of file
+++ /dev/null
-@charset "UTF-8";\r
-\r
-/** \r
- * NVIDIA Advanced CSS Drop-Down Menu Theme\r
- *\r
- * @file default.advanced.css\r
- * @name NVIDIA\r
- * @version 0.1\r
- * @type transitional\r
- * @browsers Windows: IE7+, Opera7+, Firefox3+\r
- * Mac OS: Safari2+, Firefox3+\r
- *\r
- * @link http://www.lwis.net/free-css-drop-down-menu\r
- * @copyright 2008-2012 Live Web Initiatives, http://www.lwis.net\r
- *\r
- */\r
-\r
-@import "default.css";\r
-\r
-\r
-/* -- Base style extension -- */\r
-\r
-ul.dropdown li a {\r
- display: block;\r
- padding: 7px 14px;\r
-}\r
-\r
-\r
-/* -- Base style override -- */\r
-\r
-ul.dropdown li {\r
- padding: 0;\r
-}\r
-\r
-\r
-/* -- Base style reinitiate: post-override activities -- */\r
-\r
-ul.dropdown li.dir {\r
- padding: 7px 20px 7px 14px;\r
-}\r
-\r
-ul.dropdown ul li.dir {\r
- padding-right: 15px;\r
-}\r
-\r
-\r
-/* -- Custom -- */\r
-\r
-ul.dropdown ul a {\r
- padding: 4px 5px 4px 14px;\r
- width: 151px; /* Especially for IE */\r
-}\r
-\r
-ul.dropdown ul a:hover {\r
- background-color: #76b900;\r
-}\r
-\r
-\r
-/* -- Drop-down open -- */\r
-\r
-ul.dropdown li:hover > a.dir {\r
- background-color: #2e2e2e;\r
- color: #76b900;\r
-}\r
-\r
-ul.dropdown ul li:hover > a.dir {\r
- background-color: #76b900;\r
- color: #fff;\r
-}
\ No newline at end of file
+++ /dev/null
-@charset "UTF-8";\r
-\r
-/** \r
- * NVIDIA CSS Drop-Down Menu Theme\r
- *\r
- * @file default.css\r
- * @name NVIDIA\r
- * @version 0.1\r
- * @type transitional\r
- * @browsers Windows: IE6+, Opera7+, Firefox3+\r
- * Mac OS: Safari2+, Firefox3+\r
- *\r
- * @link http://www.lwis.net/free-css-drop-down-menu\r
- * @copyright 2008-2012 Live Web Initiatives, http://www.lwis.net\r
- *\r
- */\r
-\r
-\r
-/* -- Base drop-down styling -- */\r
-\r
-ul.dropdown {\r
- font: normal 12px "Trebuchet MS", Arial, Helvetica, sans-serif;\r
- text-transform: uppercase;\r
-}\r
-\r
- ul.dropdown li {\r
- padding: 7px 0;\r
- background-color: #000;\r
- color: #fff;\r
- line-height: normal;\r
- }\r
-\r
- ul.dropdown a:link,\r
- ul.dropdown a:visited { color: #fff; text-decoration: none; }\r
- ul.dropdown a:hover { color: #76b900; text-decoration: none; }\r
- ul.dropdown a:active { color: #fff; }\r
-\r
- /* -- level mark -- */\r
-\r
- ul.dropdown ul {\r
- width: 170px;\r
- background-color: #333;\r
- color: #fff;\r
- font-size: 11px;\r
- text-transform: none;\r
- filter: alpha(opacity=90);\r
- -moz-opacity: .9;\r
- KhtmlOpacity: .9;\r
- opacity: .9;\r
- }\r
-\r
- ul.dropdown ul li {\r
- background-color: transparent;\r
- color: #000;\r
- filter: none;\r
- }\r
-\r
- ul.dropdown ul li.hover,\r
- ul.dropdown ul li:hover {\r
- background-color: transparent;\r
- }\r
-\r
- ul.dropdown ul a:link,\r
- ul.dropdown ul a:visited { color: #fff; }\r
- ul.dropdown ul a:hover { color: #fff; text-decoration: none; }\r
- ul.dropdown ul a:active { color: #fff; }\r
-\r
-\r
-/* -- Supporting class `dir` -- */\r
-\r
-ul.dropdown *.dir {\r
- padding-right: 12px;\r
- background-image: none;\r
- background-position: 100% 50%;\r
- background-repeat: no-repeat;\r
-}
\ No newline at end of file
+++ /dev/null
-/*!
- * jQuery UI Accordion @VERSION
- *
- * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Accordion#theming
- */
-/* IE/Win - Fix animation bug - #4615 */
-.ui-accordion { width: 100%; }
-.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
-.ui-accordion .ui-accordion-li-fix { display: inline; }
-.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }
-.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; }
-.ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; }
-.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
-.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; }
-.ui-accordion .ui-accordion-content-active { display: block; }
+++ /dev/null
-/*!
- * jQuery UI CSS Framework @VERSION
- *
- * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Theming
- */
-@import "jquery.ui.base.css";
-@import "jquery.ui.theme.css";
+++ /dev/null
-/*!
- * jQuery UI Autocomplete @VERSION
- *
- * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Autocomplete#theming
- */
-.ui-autocomplete { position: absolute; cursor: default; }
-
-/* workarounds */
-* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
-
-/*
- * jQuery UI Menu @VERSION
- *
- * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Menu#theming
- */
-.ui-menu {
- list-style:none;
- padding: 2px;
- margin: 0;
- display:block;
- float: left;
-}
-.ui-menu .ui-menu {
- margin-top: -3px;
-}
-.ui-menu .ui-menu-item {
- margin:0;
- padding: 0;
- zoom: 1;
- float: left;
- clear: left;
- width: 100%;
-}
-.ui-menu .ui-menu-item a {
- text-decoration:none;
- display:block;
- padding:.2em .4em;
- line-height:1.5;
- zoom:1;
-}
-.ui-menu .ui-menu-item a.ui-state-hover,
-.ui-menu .ui-menu-item a.ui-state-active {
- font-weight: normal;
- margin: -1px;
-}
+++ /dev/null
-/*!
- * jQuery UI CSS Framework @VERSION
- *
- * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Theming
- */
-@import url("jquery.ui.core.css");
-
-@import url("jquery.ui.accordion.css");
-@import url("jquery.ui.autocomplete.css");
-@import url("jquery.ui.button.css");
-@import url("jquery.ui.datepicker.css");
-@import url("jquery.ui.dialog.css");
-@import url("jquery.ui.progressbar.css");
-@import url("jquery.ui.resizable.css");
-@import url("jquery.ui.selectable.css");
-@import url("jquery.ui.slider.css");
-@import url("jquery.ui.tabs.css");
+++ /dev/null
-/*!
- * jQuery UI Button @VERSION
- *
- * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Button#theming
- */
-.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */
-.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
-button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
-.ui-button-icons-only { width: 3.4em; }
-button.ui-button-icons-only { width: 3.7em; }
-
-/*button text element */
-.ui-button .ui-button-text { display: block; line-height: 1.4; }
-.ui-button-text-only .ui-button-text { padding: .4em 1em; }
-.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }
-.ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }
-.ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; }
-.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }
-/* no icon support for input elements, provide padding by default */
-input.ui-button { padding: .4em 1em; }
-
-/*button icon element(s) */
-.ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }
-.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }
-.ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }
-.ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
-.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
-
-/*button sets*/
-.ui-buttonset { margin-right: 7px; }
-.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; }
-
-/* workarounds */
-button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */
+++ /dev/null
-/*!
- * jQuery UI CSS Framework @VERSION
- *
- * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Theming/API
- */
-
-/* Layout helpers
-----------------------------------*/
-.ui-helper-hidden { display: none; }
-.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
-.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
-.ui-helper-clearfix:before, .ui-helper-clearfix:after { content: ""; display: table; }
-.ui-helper-clearfix:after { clear: both; }
-.ui-helper-clearfix { zoom: 1; }
-.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
-
-
-/* Interaction Cues
-----------------------------------*/
-.ui-state-disabled { cursor: default !important; }
-
-
-/* Icons
-----------------------------------*/
-
-/* states and images */
-.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
-
-
-/* Misc visuals
-----------------------------------*/
-
-/* Overlays */
-.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
+++ /dev/null
-/*!
- * jQuery UI Datepicker @VERSION
- *
- * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Datepicker#theming
- */
-.ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; }
-.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
-.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
-.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
-.ui-datepicker .ui-datepicker-prev { left:2px; }
-.ui-datepicker .ui-datepicker-next { right:2px; }
-.ui-datepicker .ui-datepicker-prev-hover { left:1px; }
-.ui-datepicker .ui-datepicker-next-hover { right:1px; }
-.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
-.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
-.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
-.ui-datepicker select.ui-datepicker-month-year {width: 100%;}
-.ui-datepicker select.ui-datepicker-month,
-.ui-datepicker select.ui-datepicker-year { width: 49%;}
-.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
-.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
-.ui-datepicker td { border: 0; padding: 1px; }
-.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
-.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
-.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
-.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
-
-/* with multiple calendars */
-.ui-datepicker.ui-datepicker-multi { width:auto; }
-.ui-datepicker-multi .ui-datepicker-group { float:left; }
-.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
-.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
-.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
-.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
-.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
-.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
-.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
-.ui-datepicker-row-break { clear:both; width:100%; font-size:0em; }
-
-/* RTL support */
-.ui-datepicker-rtl { direction: rtl; }
-.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
-.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
-.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
-.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
-.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
-.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
-.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
-.ui-datepicker-rtl .ui-datepicker-group { float:right; }
-.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
-.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
-
-/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
-.ui-datepicker-cover {
- position: absolute; /*must have*/
- z-index: -1; /*must have*/
- filter: mask(); /*must have*/
- top: -4px; /*must have*/
- left: -4px; /*must have*/
- width: 200px; /*must have*/
- height: 200px; /*must have*/
-}
\ No newline at end of file
+++ /dev/null
-/*!
- * jQuery UI Dialog @VERSION
- *
- * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Dialog#theming
- */
-.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; }
-.ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; }
-.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; }
-.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
-.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
-.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
-.ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
-.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
-.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; }
-.ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; }
-.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
-.ui-draggable .ui-dialog-titlebar { cursor: move; }
+++ /dev/null
-/*!
- * jQuery UI Progressbar @VERSION
- *
- * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Progressbar#theming
- */
-.ui-progressbar { height:2em; text-align: left; overflow: hidden; }
-.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }
\ No newline at end of file
+++ /dev/null
-/*!
- * jQuery UI Resizable @VERSION
- *
- * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Resizable#theming
- */
-.ui-resizable { position: relative;}
-.ui-resizable-handle { position: absolute;font-size: 0.1px; display: block; }
-.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
-.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
-.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
-.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }
-.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }
-.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
-.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
-.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
-.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}
\ No newline at end of file
+++ /dev/null
-/*!
- * jQuery UI Selectable @VERSION
- *
- * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Selectable#theming
- */
-.ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; }
+++ /dev/null
-/*!
- * jQuery UI Slider @VERSION
- *
- * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Slider#theming
- */
-.ui-slider { position: relative; text-align: left; }
-.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
-.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
-
-.ui-slider-horizontal { height: .8em; }
-.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
-.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
-.ui-slider-horizontal .ui-slider-range-min { left: 0; }
-.ui-slider-horizontal .ui-slider-range-max { right: 0; }
-
-.ui-slider-vertical { width: .8em; height: 100px; }
-.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
-.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
-.ui-slider-vertical .ui-slider-range-min { bottom: 0; }
-.ui-slider-vertical .ui-slider-range-max { top: 0; }
\ No newline at end of file
+++ /dev/null
-/*!
- * jQuery UI Tabs @VERSION
- *
- * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Tabs#theming
- */
-.ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
-.ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; }
-.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; }
-.ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; }
-.ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; }
-.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; }
-.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
-.ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; }
-.ui-tabs .ui-tabs-hide { display: none !important; }
+++ /dev/null
-/*!
- * jQuery UI CSS Framework @VERSION
- *
- * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Theming/API
- *
- * To view and modify this theme, visit http://jqueryui.com/themeroller/
- */
-
-
-/* Component containers
-----------------------------------*/
-.ui-widget { font-family: Verdana,Arial,sans-serif/*{ffDefault}*/; font-size: 1.1em/*{fsDefault}*/; }
-.ui-widget .ui-widget { font-size: 1em; }
-.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif/*{ffDefault}*/; font-size: 1em; }
-.ui-widget-content { border: 1px solid #aaaaaa/*{borderColorContent}*/; background: #ffffff/*{bgColorContent}*/ url(images/ui-bg_flat_75_ffffff_40x100.png)/*{bgImgUrlContent}*/ 50%/*{bgContentXPos}*/ 50%/*{bgContentYPos}*/ repeat-x/*{bgContentRepeat}*/; color: #222222/*{fcContent}*/; }
-.ui-widget-content a { color: #222222/*{fcContent}*/; }
-.ui-widget-header { border: 1px solid #aaaaaa/*{borderColorHeader}*/; background: #cccccc/*{bgColorHeader}*/ url(images/ui-bg_highlight-soft_75_cccccc_1x100.png)/*{bgImgUrlHeader}*/ 50%/*{bgHeaderXPos}*/ 50%/*{bgHeaderYPos}*/ repeat-x/*{bgHeaderRepeat}*/; color: #222222/*{fcHeader}*/; font-weight: bold; }
-.ui-widget-header a { color: #222222/*{fcHeader}*/; }
-
-/* Interaction states
-----------------------------------*/
-.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3/*{borderColorDefault}*/; background: #e6e6e6/*{bgColorDefault}*/ url(images/ui-bg_glass_75_e6e6e6_1x400.png)/*{bgImgUrlDefault}*/ 50%/*{bgDefaultXPos}*/ 50%/*{bgDefaultYPos}*/ repeat-x/*{bgDefaultRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #555555/*{fcDefault}*/; }
-.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555/*{fcDefault}*/; text-decoration: none; }
-.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999/*{borderColorHover}*/; background: #dadada/*{bgColorHover}*/ url(images/ui-bg_glass_75_dadada_1x400.png)/*{bgImgUrlHover}*/ 50%/*{bgHoverXPos}*/ 50%/*{bgHoverYPos}*/ repeat-x/*{bgHoverRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #212121/*{fcHover}*/; }
-.ui-state-hover a, .ui-state-hover a:hover { color: #212121/*{fcHover}*/; text-decoration: none; }
-.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa/*{borderColorActive}*/; background: #ffffff/*{bgColorActive}*/ url(images/ui-bg_glass_65_ffffff_1x400.png)/*{bgImgUrlActive}*/ 50%/*{bgActiveXPos}*/ 50%/*{bgActiveYPos}*/ repeat-x/*{bgActiveRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #212121/*{fcActive}*/; }
-.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121/*{fcActive}*/; text-decoration: none; }
-.ui-widget :active { outline: none; }
-
-/* Interaction Cues
-----------------------------------*/
-.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1/*{borderColorHighlight}*/; background: #fbf9ee/*{bgColorHighlight}*/ url(images/ui-bg_glass_55_fbf9ee_1x400.png)/*{bgImgUrlHighlight}*/ 50%/*{bgHighlightXPos}*/ 50%/*{bgHighlightYPos}*/ repeat-x/*{bgHighlightRepeat}*/; color: #363636/*{fcHighlight}*/; }
-.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636/*{fcHighlight}*/; }
-.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a/*{borderColorError}*/; background: #fef1ec/*{bgColorError}*/ url(images/ui-bg_glass_95_fef1ec_1x400.png)/*{bgImgUrlError}*/ 50%/*{bgErrorXPos}*/ 50%/*{bgErrorYPos}*/ repeat-x/*{bgErrorRepeat}*/; color: #cd0a0a/*{fcError}*/; }
-.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a/*{fcError}*/; }
-.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a/*{fcError}*/; }
-.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
-.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
-.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
-
-/* Icons
-----------------------------------*/
-
-/* states and images */
-.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png)/*{iconsContent}*/; }
-.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png)/*{iconsContent}*/; }
-.ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png)/*{iconsHeader}*/; }
-.ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png)/*{iconsDefault}*/; }
-.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png)/*{iconsHover}*/; }
-.ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png)/*{iconsActive}*/; }
-.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png)/*{iconsHighlight}*/; }
-.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png)/*{iconsError}*/; }
-
-/* positioning */
-.ui-icon-carat-1-n { background-position: 0 0; }
-.ui-icon-carat-1-ne { background-position: -16px 0; }
-.ui-icon-carat-1-e { background-position: -32px 0; }
-.ui-icon-carat-1-se { background-position: -48px 0; }
-.ui-icon-carat-1-s { background-position: -64px 0; }
-.ui-icon-carat-1-sw { background-position: -80px 0; }
-.ui-icon-carat-1-w { background-position: -96px 0; }
-.ui-icon-carat-1-nw { background-position: -112px 0; }
-.ui-icon-carat-2-n-s { background-position: -128px 0; }
-.ui-icon-carat-2-e-w { background-position: -144px 0; }
-.ui-icon-triangle-1-n { background-position: 0 -16px; }
-.ui-icon-triangle-1-ne { background-position: -16px -16px; }
-.ui-icon-triangle-1-e { background-position: -32px -16px; }
-.ui-icon-triangle-1-se { background-position: -48px -16px; }
-.ui-icon-triangle-1-s { background-position: -64px -16px; }
-.ui-icon-triangle-1-sw { background-position: -80px -16px; }
-.ui-icon-triangle-1-w { background-position: -96px -16px; }
-.ui-icon-triangle-1-nw { background-position: -112px -16px; }
-.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
-.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
-.ui-icon-arrow-1-n { background-position: 0 -32px; }
-.ui-icon-arrow-1-ne { background-position: -16px -32px; }
-.ui-icon-arrow-1-e { background-position: -32px -32px; }
-.ui-icon-arrow-1-se { background-position: -48px -32px; }
-.ui-icon-arrow-1-s { background-position: -64px -32px; }
-.ui-icon-arrow-1-sw { background-position: -80px -32px; }
-.ui-icon-arrow-1-w { background-position: -96px -32px; }
-.ui-icon-arrow-1-nw { background-position: -112px -32px; }
-.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
-.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
-.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
-.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
-.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
-.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
-.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
-.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
-.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
-.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
-.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
-.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
-.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
-.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
-.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
-.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
-.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
-.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
-.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
-.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
-.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
-.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
-.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
-.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
-.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
-.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
-.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
-.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
-.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
-.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
-.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
-.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
-.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
-.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
-.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
-.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
-.ui-icon-arrow-4 { background-position: 0 -80px; }
-.ui-icon-arrow-4-diag { background-position: -16px -80px; }
-.ui-icon-extlink { background-position: -32px -80px; }
-.ui-icon-newwin { background-position: -48px -80px; }
-.ui-icon-refresh { background-position: -64px -80px; }
-.ui-icon-shuffle { background-position: -80px -80px; }
-.ui-icon-transfer-e-w { background-position: -96px -80px; }
-.ui-icon-transferthick-e-w { background-position: -112px -80px; }
-.ui-icon-folder-collapsed { background-position: 0 -96px; }
-.ui-icon-folder-open { background-position: -16px -96px; }
-.ui-icon-document { background-position: -32px -96px; }
-.ui-icon-document-b { background-position: -48px -96px; }
-.ui-icon-note { background-position: -64px -96px; }
-.ui-icon-mail-closed { background-position: -80px -96px; }
-.ui-icon-mail-open { background-position: -96px -96px; }
-.ui-icon-suitcase { background-position: -112px -96px; }
-.ui-icon-comment { background-position: -128px -96px; }
-.ui-icon-person { background-position: -144px -96px; }
-.ui-icon-print { background-position: -160px -96px; }
-.ui-icon-trash { background-position: -176px -96px; }
-.ui-icon-locked { background-position: -192px -96px; }
-.ui-icon-unlocked { background-position: -208px -96px; }
-.ui-icon-bookmark { background-position: -224px -96px; }
-.ui-icon-tag { background-position: -240px -96px; }
-.ui-icon-home { background-position: 0 -112px; }
-.ui-icon-flag { background-position: -16px -112px; }
-.ui-icon-calendar { background-position: -32px -112px; }
-.ui-icon-cart { background-position: -48px -112px; }
-.ui-icon-pencil { background-position: -64px -112px; }
-.ui-icon-clock { background-position: -80px -112px; }
-.ui-icon-disk { background-position: -96px -112px; }
-.ui-icon-calculator { background-position: -112px -112px; }
-.ui-icon-zoomin { background-position: -128px -112px; }
-.ui-icon-zoomout { background-position: -144px -112px; }
-.ui-icon-search { background-position: -160px -112px; }
-.ui-icon-wrench { background-position: -176px -112px; }
-.ui-icon-gear { background-position: -192px -112px; }
-.ui-icon-heart { background-position: -208px -112px; }
-.ui-icon-star { background-position: -224px -112px; }
-.ui-icon-link { background-position: -240px -112px; }
-.ui-icon-cancel { background-position: 0 -128px; }
-.ui-icon-plus { background-position: -16px -128px; }
-.ui-icon-plusthick { background-position: -32px -128px; }
-.ui-icon-minus { background-position: -48px -128px; }
-.ui-icon-minusthick { background-position: -64px -128px; }
-.ui-icon-close { background-position: -80px -128px; }
-.ui-icon-closethick { background-position: -96px -128px; }
-.ui-icon-key { background-position: -112px -128px; }
-.ui-icon-lightbulb { background-position: -128px -128px; }
-.ui-icon-scissors { background-position: -144px -128px; }
-.ui-icon-clipboard { background-position: -160px -128px; }
-.ui-icon-copy { background-position: -176px -128px; }
-.ui-icon-contact { background-position: -192px -128px; }
-.ui-icon-image { background-position: -208px -128px; }
-.ui-icon-video { background-position: -224px -128px; }
-.ui-icon-script { background-position: -240px -128px; }
-.ui-icon-alert { background-position: 0 -144px; }
-.ui-icon-info { background-position: -16px -144px; }
-.ui-icon-notice { background-position: -32px -144px; }
-.ui-icon-help { background-position: -48px -144px; }
-.ui-icon-check { background-position: -64px -144px; }
-.ui-icon-bullet { background-position: -80px -144px; }
-.ui-icon-radio-off { background-position: -96px -144px; }
-.ui-icon-radio-on { background-position: -112px -144px; }
-.ui-icon-pin-w { background-position: -128px -144px; }
-.ui-icon-pin-s { background-position: -144px -144px; }
-.ui-icon-play { background-position: 0 -160px; }
-.ui-icon-pause { background-position: -16px -160px; }
-.ui-icon-seek-next { background-position: -32px -160px; }
-.ui-icon-seek-prev { background-position: -48px -160px; }
-.ui-icon-seek-end { background-position: -64px -160px; }
-.ui-icon-seek-start { background-position: -80px -160px; }
-/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
-.ui-icon-seek-first { background-position: -80px -160px; }
-.ui-icon-stop { background-position: -96px -160px; }
-.ui-icon-eject { background-position: -112px -160px; }
-.ui-icon-volume-off { background-position: -128px -160px; }
-.ui-icon-volume-on { background-position: -144px -160px; }
-.ui-icon-power { background-position: 0 -176px; }
-.ui-icon-signal-diag { background-position: -16px -176px; }
-.ui-icon-signal { background-position: -32px -176px; }
-.ui-icon-battery-0 { background-position: -48px -176px; }
-.ui-icon-battery-1 { background-position: -64px -176px; }
-.ui-icon-battery-2 { background-position: -80px -176px; }
-.ui-icon-battery-3 { background-position: -96px -176px; }
-.ui-icon-circle-plus { background-position: 0 -192px; }
-.ui-icon-circle-minus { background-position: -16px -192px; }
-.ui-icon-circle-close { background-position: -32px -192px; }
-.ui-icon-circle-triangle-e { background-position: -48px -192px; }
-.ui-icon-circle-triangle-s { background-position: -64px -192px; }
-.ui-icon-circle-triangle-w { background-position: -80px -192px; }
-.ui-icon-circle-triangle-n { background-position: -96px -192px; }
-.ui-icon-circle-arrow-e { background-position: -112px -192px; }
-.ui-icon-circle-arrow-s { background-position: -128px -192px; }
-.ui-icon-circle-arrow-w { background-position: -144px -192px; }
-.ui-icon-circle-arrow-n { background-position: -160px -192px; }
-.ui-icon-circle-zoomin { background-position: -176px -192px; }
-.ui-icon-circle-zoomout { background-position: -192px -192px; }
-.ui-icon-circle-check { background-position: -208px -192px; }
-.ui-icon-circlesmall-plus { background-position: 0 -208px; }
-.ui-icon-circlesmall-minus { background-position: -16px -208px; }
-.ui-icon-circlesmall-close { background-position: -32px -208px; }
-.ui-icon-squaresmall-plus { background-position: -48px -208px; }
-.ui-icon-squaresmall-minus { background-position: -64px -208px; }
-.ui-icon-squaresmall-close { background-position: -80px -208px; }
-.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
-.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
-.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
-.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
-.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
-.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
-
-
-/* Misc visuals
-----------------------------------*/
-
-/* Corner radius */
-.ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 4px/*{cornerRadius}*/; -webkit-border-top-left-radius: 4px/*{cornerRadius}*/; -khtml-border-top-left-radius: 4px/*{cornerRadius}*/; border-top-left-radius: 4px/*{cornerRadius}*/; }
-.ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 4px/*{cornerRadius}*/; -webkit-border-top-right-radius: 4px/*{cornerRadius}*/; -khtml-border-top-right-radius: 4px/*{cornerRadius}*/; border-top-right-radius: 4px/*{cornerRadius}*/; }
-.ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 4px/*{cornerRadius}*/; -webkit-border-bottom-left-radius: 4px/*{cornerRadius}*/; -khtml-border-bottom-left-radius: 4px/*{cornerRadius}*/; border-bottom-left-radius: 4px/*{cornerRadius}*/; }
-.ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 4px/*{cornerRadius}*/; -webkit-border-bottom-right-radius: 4px/*{cornerRadius}*/; -khtml-border-bottom-right-radius: 4px/*{cornerRadius}*/; border-bottom-right-radius: 4px/*{cornerRadius}*/; }
-
-/* Overlays */
-.ui-widget-overlay { background: #aaaaaa/*{bgColorOverlay}*/ url(images/ui-bg_flat_0_aaaaaa_40x100.png)/*{bgImgUrlOverlay}*/ 50%/*{bgOverlayXPos}*/ 50%/*{bgOverlayYPos}*/ repeat-x/*{bgOverlayRepeat}*/; opacity: .3;filter:Alpha(Opacity=30)/*{opacityOverlay}*/; }
-.ui-widget-shadow { margin: -8px/*{offsetTopShadow}*/ 0 0 -8px/*{offsetLeftShadow}*/; padding: 8px/*{thicknessShadow}*/; background: #aaaaaa/*{bgColorShadow}*/ url(images/ui-bg_flat_0_aaaaaa_40x100.png)/*{bgImgUrlShadow}*/ 50%/*{bgShadowXPos}*/ 50%/*{bgShadowYPos}*/ repeat-x/*{bgShadowRepeat}*/; opacity: .3;filter:Alpha(Opacity=30)/*{opacityShadow}*/; -moz-border-radius: 8px/*{cornerRadiusShadow}*/; -khtml-border-radius: 8px/*{cornerRadiusShadow}*/; -webkit-border-radius: 8px/*{cornerRadiusShadow}*/; border-radius: 8px/*{cornerRadiusShadow}*/; }
\ No newline at end of file
+++ /dev/null
-<!DOCTYPE HTML>\r
-<html lang="en-US">\r
-<head>\r
-<meta charset="UTF-8">\r
-<title>Main</title>\r
-<link rel="stylesheet" href="../css/themes/base/jquery.ui.all.css" />\r
-<link rel="stylesheet" href="../css/bootstrap.css" />\r
-<link rel="stylesheet" href="../css/jasny-bootstrap.css" />\r
-<link rel="stylesheet" href="../css/main.css" />\r
-\r
-<style type="text/css">\r
-body {\r
- padding-top: 140px;\r
- padding-bottom: 40px;\r
-}\r
-\r
-</style>\r
-</head>\r
-\r
-<body>\r
- <div class="navbar navbar-inverse navbar-fixed-top">\r
- <div class="navbar-inner">\r
- <div class="container">\r
- <img src="../img/tizen-logo-white-mascot.png">\r
- <div id="menu"></div>\r
- <form class="navbar-search pull-right">\r
- <input type="text" class="search-query" placeholder="Search">\r
- <a class="btn btn-primary btn-block" id="open" >Upload</a>\r
- </form>\r
- </div>\r
- </div>\r
- </div>\r
- <div class="container">\r
- <div class="row">\r
- <div class="span12"></div>\r
- </div>\r
- </div>\r
-\r
- <div class="modal hide fade" id="upload_dialog">\r
- <div class="modal-header">\r
- <!-- \r
- <button type="button" class="close" data-dismiss="modal">×</button>\r
- -->\r
- <h2>Upload template...</h2>\r
- </div>\r
- <div class="modal-body">\r
- <div id="template-info">\r
- <form id="uploadForm" class="form-horizontal" class="form-horizontal"action="/template" method="post" enctype="multipart/form-data" >\r
- <div class="control-group">\r
- <!-- Text input-->\r
- <label class="control-label">Email</label>\r
- <div class="controls">\r
- <input name="email" placeholder="Input your email" class="input-xlarge" type="text">\r
- <p class="help-block">It will be used to send the important information</p>\r
- </div>\r
- </div>\r
- \r
- <div class="control-group">\r
- <!-- Text input-->\r
- <label class="control-label">Description</label>\r
- <div class="controls">\r
- <textarea name="description" rows="5" placeholder="Input comment for template" class="input-xlarge"></textarea> \r
- <p class="help-block">It helps other to understand your template.</p>\r
- </div>\r
- </div>\r
- \r
- </form> \r
-\r
- <div class="progress progress-striped active">\r
- <div class="bar" style="width: 0%;"></div>\r
- </div> \r
- <div class="alert-error">\r
- </div>\r
- </div>\r
- </div>\r
- <div class="modal-footer">\r
- <button class="btn" id="cancel" >Cancel</button>\r
- <button class="btn btn-primary" id="upload">OK</button>\r
- </div>\r
- </div>\r
-\r
- <div id="contents" class="container"></div>\r
- <script id="menu-template" type="template/jquery"><ul class="nav"></ul></script>\r
- <script id="menu-item-template" type="template/jquery"><a id='{{id}}' >{{name}}</a></script>\r
- <script id="upload-file-template" type="template/jquery">\r
- <div class="control-group">\r
- <label class="control-label" >Template</label>\r
- <div class="controls">\r
- <input type="text" readonly="readonly">\r
- <div class="fileinput_div">\r
- <input class="btn" id="select" type="button" value="{{selection}}" />\r
- <input class="btn" id="clear" type="button" value="{{reset}}" />\r
- <input name="uploadFile" type="file"/>\r
- </div>\r
- <p class="help-block">Your template file must be java archive</p>\r
- </div>\r
- </div>\r
- </script>\r
-\r
-<script type="text/javascript" src="../js/jquery.js" charset="utf-8"></script>\r
-<script type="text/javascript" src="../js/jquery.form.js" charset="utf-8"></script>\r
-<script type="text/javascript" src="../js/jquery.dotdotdot-1.5.1.js" charset="utf-8"></script>\r
-<script type="text/javascript" src="../js/mustache.js" charset="utf-8"></script>\r
-<script type="text/javascript" src="../js/underscore.js" charset="utf-8"></script>\r
-<script type="text/javascript" src="../js/backbone.js" charset="utf-8"></script>\r
-<script type="text/javascript" src="../js/bootstrap.js" charset="utf-8"></script>\r
-<script type="text/javascript" src="../js/mvc.js" charset="utf-8"></script>\r
-<script type="text/javascript" src="../js/editor.js" charset="utf-8"></script>\r
-<script type="text/javascript" src="../js/main.js" charset="utf-8"></script>\r
- <script type="text/javascript">\r
-$( function() {\r
- updateContents = function( url, data ) {\r
- $.get( url, function( view ) {\r
- if ( data ) {\r
- $( "#contents" ).html( Mustache.render( view, data.toJSON() ) );\r
- } else {\r
- $( "#contents" ).html( view );\r
- }\r
- } );\r
- }\r
- \r
- var menu = new Menu();\r
- menu.add( new MenuItem( { id :'recently', name :'Recent', url :'recent.html' } ) );\r
- menu.add( new MenuItem( { id :'popular', name :'Popular', url :'popular.html' } ) );\r
-\r
- new MenuView( { el: $( '#menu' ), collection: menu } );\r
- \r
- \r
- var upload = new Upload();\r
- upload.bind( "change", function() {\r
- if ( this.get( "file" ) ) {\r
- $( "#upload" ).removeAttr( "disabled" );\r
- } else {\r
- $( "#upload" ).attr( "disabled", "disabled" );\r
- }\r
- \r
- }, upload );\r
- \r
- $( "#uploadForm" ).append( new UploadView( { model: upload } ).render().el );\r
-\r
- $( "#cancel" ).click( function() {\r
- $( "#upload_dialog" ).modal( 'hide' );\r
- } );\r
- \r
- $( "#upload" ).click( function() {\r
- $( ".alert-error" ).hide();\r
- $( ".progress" ).show();\r
- $('#uploadForm').ajaxSubmit( {\r
- url: '/template',\r
- dataType: 'json',\r
- beforeSend: function() {\r
- $( "#upload_dialog *" ).attr( "disabled", "disabled" );\r
- },\r
- uploadProgress: function( event, position, total, percent ) {\r
- $( ".bar" ).width( percent + "%" );\r
- },\r
- error: function( jqXHR, statusText, error ) {\r
- $( "#upload_dialog *" ).removeAttr( "disabled" );\r
- $( ".progress" ).hide();\r
- $( ".alert-error" ).html( "<strong>Error!</strong> " + error.type ).show();\r
- },\r
- success: function( json ) {\r
- \r
- if ( json.status == "error" ) {\r
- $( "#upload_dialog *" ).removeAttr( "disabled" );\r
- $( ".progress" ).hide();\r
- $( ".alert-error" ).html( "<strong>Error!</strong> " + json.details ).show();\r
- return ; \r
- }\r
- $( ".bar" ).width( "100%" );\r
- setTimeout( function() {\r
- $( "#upload_dialog" ).modal( 'hide' );\r
- }, 500);\r
- }\r
- } );\r
- } );\r
- \r
- $( "#open" ).click( function() {\r
- $( "#upload_dialog" ).clearForm();\r
- $( ".alert-error" ).hide();\r
- $( ".fileupload" ).show();\r
- $( ".progress" ).hide();\r
- $( "#upload_dialog *" ).removeAttr( "disabled" );\r
- $( "#upload_dialog" ).modal( { backdrop: false, keyboard: false } );\r
- \r
- upload.clear();\r
- } );\r
- \r
-} );\r
-</script>\r
-</body>\r
-</html>
\ No newline at end of file
+++ /dev/null
-<!DOCTYPE HTML>\r
-<html lang="en-US">\r
-<head>\r
-<meta charset="UTF-8">\r
-<title>Main</title>\r
-</head>\r
-\r
-<body>\r
-\r
- World\r
-</body>\r
-</html>
\ No newline at end of file
+++ /dev/null
-<!DOCTYPE HTML>\r
-<html lang="en-US">\r
-<head>\r
-<meta charset="UTF-8">\r
-<title>Main</title>\r
-<style type="text/css">\r
-.ellipsis {\r
- display: block;\r
- height: 150px;\r
- white-space: pre-wrap; /* CSS3 */\r
- white-space: -moz-pre-wrap; /* Firefox */\r
- white-space: -pre-wrap; /* Opera <7 */\r
- white-space: -o-pre-wrap; /* Opera 7 */\r
- word-wrap: break-word; /* IE */\r
-}\r
-.template:hover {\r
- cursor: pointer; cursor: hand\r
-}\r
-</style>\r
-</head>\r
-\r
-<body>\r
-<div class="row">\r
- <div class="span12" id="templates">\r
- </div>\r
-</div>\r
-\r
-</body>\r
- <script id="template-template" type="template/jquery">\r
- <div class="thumbnail">\r
- <form>\r
- <legend>{{name}}<span class="badge badge-info pull-right">{{downloads}}</span></legend>\r
- <blockquote style="text-align:right;"><small>{{email}}</small></blockquote>\r
- <div class="ellipsis" style="height:100px;">{{description}}</div>\r
- </form>\r
- </div>\r
- </script>\r
-\r
-<script type="text/javascript">\r
-$( function() {\r
- var templates = new RecentTemplates();\r
- var templateViews = new TemplatesView( {\r
- el: $( "#templates" ),\r
- collection: templates\r
- } ).render();\r
-} );\r
-</script>\r
-\r
-</html>
\ No newline at end of file
+++ /dev/null
-<!DOCTYPE HTML>\r
-<html lang="en-US">\r
-<head>\r
-<meta charset="UTF-8">\r
-<title>Template </title>\r
-</head>\r
-\r
-<body>\r
-\r
-<div id="template" class="container">\r
-</div>\r
-\r
-<script id="template-details-template" type="template/jquery">\r
- <div class="hero-unit">\r
- <h1>{{name}}</h1>\r
- <blockquote style="text-align:right;">{{email}}</blockquote>\r
- <div>\r
- <p>{{description}}</p>\r
- <a class="btn btn-primary btn-large" href="/template/{{name}}">Download</a>\r
- </div>\r
- </div>\r
- <div class="row">\r
- <div class="spen3 week">\r
- </div>\r
- <div class="spen3 month">\r
- </div>\r
- <div class="spen3 year">\r
- </div>\r
- </div>\r
- <div class="row">\r
- </div>\r
-</script>\r
-\r
-<script type="text/javascript">\r
-$( function() {\r
- var template = new TemplateDetails( { id: '{{id}}' } );\r
- var templateView = new TemplateDetailsView( {\r
- el: $( "#template" ),\r
- model: template\r
- } );\r
-} );\r
-</script>\r
-</body>\r
-</html>
\ No newline at end of file
+++ /dev/null
-// Backbone.js 0.9.2
-
-// (c) 2010-2012 Jeremy Ashkenas, DocumentCloud Inc.
-// Backbone may be freely distributed under the MIT license.
-// For all details and documentation:
-// http://backbonejs.org
-
-(function(){
-
- // Initial Setup
- // -------------
-
- // Save a reference to the global object (`window` in the browser, `global`
- // on the server).
- var root = this;
-
- // Save the previous value of the `Backbone` variable, so that it can be
- // restored later on, if `noConflict` is used.
- var previousBackbone = root.Backbone;
-
- // Create a local reference to slice/splice.
- var slice = Array.prototype.slice;
- var splice = Array.prototype.splice;
-
- // The top-level namespace. All public Backbone classes and modules will
- // be attached to this. Exported for both CommonJS and the browser.
- var Backbone;
- if (typeof exports !== 'undefined') {
- Backbone = exports;
- } else {
- Backbone = root.Backbone = {};
- }
-
- // Current version of the library. Keep in sync with `package.json`.
- Backbone.VERSION = '0.9.2';
-
- // Require Underscore, if we're on the server, and it's not already present.
- var _ = root._;
- if (!_ && (typeof require !== 'undefined')) _ = require('underscore');
-
- // For Backbone's purposes, jQuery, Zepto, or Ender owns the `$` variable.
- var $ = root.jQuery || root.Zepto || root.ender;
-
- // Set the JavaScript library that will be used for DOM manipulation and
- // Ajax calls (a.k.a. the `$` variable). By default Backbone will use: jQuery,
- // Zepto, or Ender; but the `setDomLibrary()` method lets you inject an
- // alternate JavaScript library (or a mock library for testing your views
- // outside of a browser).
- Backbone.setDomLibrary = function(lib) {
- $ = lib;
- };
-
- // Runs Backbone.js in *noConflict* mode, returning the `Backbone` variable
- // to its previous owner. Returns a reference to this Backbone object.
- Backbone.noConflict = function() {
- root.Backbone = previousBackbone;
- return this;
- };
-
- // Turn on `emulateHTTP` to support legacy HTTP servers. Setting this option
- // will fake `"PUT"` and `"DELETE"` requests via the `_method` parameter and
- // set a `X-Http-Method-Override` header.
- Backbone.emulateHTTP = false;
-
- // Turn on `emulateJSON` to support legacy servers that can't deal with direct
- // `application/json` requests ... will encode the body as
- // `application/x-www-form-urlencoded` instead and will send the model in a
- // form param named `model`.
- Backbone.emulateJSON = false;
-
- // Backbone.Events
- // -----------------
-
- // Regular expression used to split event strings
- var eventSplitter = /\s+/;
-
- // A module that can be mixed in to *any object* in order to provide it with
- // custom events. You may bind with `on` or remove with `off` callback functions
- // to an event; trigger`-ing an event fires all callbacks in succession.
- //
- // var object = {};
- // _.extend(object, Backbone.Events);
- // object.on('expand', function(){ alert('expanded'); });
- // object.trigger('expand');
- //
- var Events = Backbone.Events = {
-
- // Bind one or more space separated events, `events`, to a `callback`
- // function. Passing `"all"` will bind the callback to all events fired.
- on: function(events, callback, context) {
-
- var calls, event, node, tail, list;
- if (!callback) return this;
- events = events.split(eventSplitter);
- calls = this._callbacks || (this._callbacks = {});
-
- // Create an immutable callback list, allowing traversal during
- // modification. The tail is an empty object that will always be used
- // as the next node.
- while (event = events.shift()) {
- list = calls[event];
- node = list ? list.tail : {};
- node.next = tail = {};
- node.context = context;
- node.callback = callback;
- calls[event] = {tail: tail, next: list ? list.next : node};
- }
-
- return this;
- },
-
- // Remove one or many callbacks. If `context` is null, removes all callbacks
- // with that function. If `callback` is null, removes all callbacks for the
- // event. If `events` is null, removes all bound callbacks for all events.
- off: function(events, callback, context) {
- var event, calls, node, tail, cb, ctx;
-
- // No events, or removing *all* events.
- if (!(calls = this._callbacks)) return;
- if (!(events || callback || context)) {
- delete this._callbacks;
- return this;
- }
-
- // Loop through the listed events and contexts, splicing them out of the
- // linked list of callbacks if appropriate.
- events = events ? events.split(eventSplitter) : _.keys(calls);
- while (event = events.shift()) {
- node = calls[event];
- delete calls[event];
- if (!node || !(callback || context)) continue;
- // Create a new list, omitting the indicated callbacks.
- tail = node.tail;
- while ((node = node.next) !== tail) {
- cb = node.callback;
- ctx = node.context;
- if ((callback && cb !== callback) || (context && ctx !== context)) {
- this.on(event, cb, ctx);
- }
- }
- }
-
- return this;
- },
-
- // Trigger one or many events, firing all bound callbacks. Callbacks are
- // passed the same arguments as `trigger` is, apart from the event name
- // (unless you're listening on `"all"`, which will cause your callback to
- // receive the true name of the event as the first argument).
- trigger: function(events) {
- var event, node, calls, tail, args, all, rest;
- if (!(calls = this._callbacks)) return this;
- all = calls.all;
- events = events.split(eventSplitter);
- rest = slice.call(arguments, 1);
-
- // For each event, walk through the linked list of callbacks twice,
- // first to trigger the event, then to trigger any `"all"` callbacks.
- while (event = events.shift()) {
- if (node = calls[event]) {
- tail = node.tail;
- while ((node = node.next) !== tail) {
- node.callback.apply(node.context || this, rest);
- }
- }
- if (node = all) {
- tail = node.tail;
- args = [event].concat(rest);
- while ((node = node.next) !== tail) {
- node.callback.apply(node.context || this, args);
- }
- }
- }
-
- return this;
- }
-
- };
-
- // Aliases for backwards compatibility.
- Events.bind = Events.on;
- Events.unbind = Events.off;
-
- // Backbone.Model
- // --------------
-
- // Create a new model, with defined attributes. A client id (`cid`)
- // is automatically generated and assigned for you.
- var Model = Backbone.Model = function(attributes, options) {
- var defaults;
- attributes || (attributes = {});
- if (options && options.parse) attributes = this.parse(attributes);
- if (defaults = getValue(this, 'defaults')) {
- attributes = _.extend({}, defaults, attributes);
- }
- if (options && options.collection) this.collection = options.collection;
- this.attributes = {};
- this._escapedAttributes = {};
- this.cid = _.uniqueId('c');
- this.changed = {};
- this._silent = {};
- this._pending = {};
- this.set(attributes, {silent: true});
- // Reset change tracking.
- this.changed = {};
- this._silent = {};
- this._pending = {};
- this._previousAttributes = _.clone(this.attributes);
- this.initialize.apply(this, arguments);
- };
-
- // Attach all inheritable methods to the Model prototype.
- _.extend(Model.prototype, Events, {
-
- // A hash of attributes whose current and previous value differ.
- changed: null,
-
- // A hash of attributes that have silently changed since the last time
- // `change` was called. Will become pending attributes on the next call.
- _silent: null,
-
- // A hash of attributes that have changed since the last `'change'` event
- // began.
- _pending: null,
-
- // The default name for the JSON `id` attribute is `"id"`. MongoDB and
- // CouchDB users may want to set this to `"_id"`.
- idAttribute: 'id',
-
- // Initialize is an empty function by default. Override it with your own
- // initialization logic.
- initialize: function(){},
-
- // Return a copy of the model's `attributes` object.
- toJSON: function(options) {
- return _.clone(this.attributes);
- },
-
- // Get the value of an attribute.
- get: function(attr) {
- return this.attributes[attr];
- },
-
- // Get the HTML-escaped value of an attribute.
- escape: function(attr) {
- var html;
- if (html = this._escapedAttributes[attr]) return html;
- var val = this.get(attr);
- return this._escapedAttributes[attr] = _.escape(val == null ? '' : '' + val);
- },
-
- // Returns `true` if the attribute contains a value that is not null
- // or undefined.
- has: function(attr) {
- return this.get(attr) != null;
- },
-
- // Set a hash of model attributes on the object, firing `"change"` unless
- // you choose to silence it.
- set: function(key, value, options) {
- var attrs, attr, val;
-
- // Handle both `"key", value` and `{key: value}` -style arguments.
- if (_.isObject(key) || key == null) {
- attrs = key;
- options = value;
- } else {
- attrs = {};
- attrs[key] = value;
- }
-
- // Extract attributes and options.
- options || (options = {});
- if (!attrs) return this;
- if (attrs instanceof Model) attrs = attrs.attributes;
- if (options.unset) for (attr in attrs) attrs[attr] = void 0;
-
- // Run validation.
- if (!this._validate(attrs, options)) return false;
-
- // Check for changes of `id`.
- if (this.idAttribute in attrs) this.id = attrs[this.idAttribute];
-
- var changes = options.changes = {};
- var now = this.attributes;
- var escaped = this._escapedAttributes;
- var prev = this._previousAttributes || {};
-
- // For each `set` attribute...
- for (attr in attrs) {
- val = attrs[attr];
-
- // If the new and current value differ, record the change.
- if (!_.isEqual(now[attr], val) || (options.unset && _.has(now, attr))) {
- delete escaped[attr];
- (options.silent ? this._silent : changes)[attr] = true;
- }
-
- // Update or delete the current value.
- options.unset ? delete now[attr] : now[attr] = val;
-
- // If the new and previous value differ, record the change. If not,
- // then remove changes for this attribute.
- if (!_.isEqual(prev[attr], val) || (_.has(now, attr) != _.has(prev, attr))) {
- this.changed[attr] = val;
- if (!options.silent) this._pending[attr] = true;
- } else {
- delete this.changed[attr];
- delete this._pending[attr];
- }
- }
-
- // Fire the `"change"` events.
- if (!options.silent) this.change(options);
- return this;
- },
-
- // Remove an attribute from the model, firing `"change"` unless you choose
- // to silence it. `unset` is a noop if the attribute doesn't exist.
- unset: function(attr, options) {
- (options || (options = {})).unset = true;
- return this.set(attr, null, options);
- },
-
- // Clear all attributes on the model, firing `"change"` unless you choose
- // to silence it.
- clear: function(options) {
- (options || (options = {})).unset = true;
- return this.set(_.clone(this.attributes), options);
- },
-
- // Fetch the model from the server. If the server's representation of the
- // model differs from its current attributes, they will be overriden,
- // triggering a `"change"` event.
- fetch: function(options) {
- options = options ? _.clone(options) : {};
- var model = this;
- var success = options.success;
- options.success = function(resp, status, xhr) {
- if (!model.set(model.parse(resp, xhr), options)) return false;
- if (success) success(model, resp);
- };
- options.error = Backbone.wrapError(options.error, model, options);
- return (this.sync || Backbone.sync).call(this, 'read', this, options);
- },
-
- // Set a hash of model attributes, and sync the model to the server.
- // If the server returns an attributes hash that differs, the model's
- // state will be `set` again.
- save: function(key, value, options) {
- var attrs, current;
-
- // Handle both `("key", value)` and `({key: value})` -style calls.
- if (_.isObject(key) || key == null) {
- attrs = key;
- options = value;
- } else {
- attrs = {};
- attrs[key] = value;
- }
- options = options ? _.clone(options) : {};
-
- // If we're "wait"-ing to set changed attributes, validate early.
- if (options.wait) {
- if (!this._validate(attrs, options)) return false;
- current = _.clone(this.attributes);
- }
-
- // Regular saves `set` attributes before persisting to the server.
- var silentOptions = _.extend({}, options, {silent: true});
- if (attrs && !this.set(attrs, options.wait ? silentOptions : options)) {
- return false;
- }
-
- // After a successful server-side save, the client is (optionally)
- // updated with the server-side state.
- var model = this;
- var success = options.success;
- options.success = function(resp, status, xhr) {
- var serverAttrs = model.parse(resp, xhr);
- if (options.wait) {
- delete options.wait;
- serverAttrs = _.extend(attrs || {}, serverAttrs);
- }
- if (!model.set(serverAttrs, options)) return false;
- if (success) {
- success(model, resp);
- } else {
- model.trigger('sync', model, resp, options);
- }
- };
-
- // Finish configuring and sending the Ajax request.
- options.error = Backbone.wrapError(options.error, model, options);
- var method = this.isNew() ? 'create' : 'update';
- var xhr = (this.sync || Backbone.sync).call(this, method, this, options);
- if (options.wait) this.set(current, silentOptions);
- return xhr;
- },
-
- // Destroy this model on the server if it was already persisted.
- // Optimistically removes the model from its collection, if it has one.
- // If `wait: true` is passed, waits for the server to respond before removal.
- destroy: function(options) {
- options = options ? _.clone(options) : {};
- var model = this;
- var success = options.success;
-
- var triggerDestroy = function() {
- model.trigger('destroy', model, model.collection, options);
- };
-
- if (this.isNew()) {
- triggerDestroy();
- return false;
- }
-
- options.success = function(resp) {
- if (options.wait) triggerDestroy();
- if (success) {
- success(model, resp);
- } else {
- model.trigger('sync', model, resp, options);
- }
- };
-
- options.error = Backbone.wrapError(options.error, model, options);
- var xhr = (this.sync || Backbone.sync).call(this, 'delete', this, options);
- if (!options.wait) triggerDestroy();
- return xhr;
- },
-
- // Default URL for the model's representation on the server -- if you're
- // using Backbone's restful methods, override this to change the endpoint
- // that will be called.
- url: function() {
- var base = getValue(this, 'urlRoot') || getValue(this.collection, 'url') || urlError();
- if (this.isNew()) return base;
- return base + (base.charAt(base.length - 1) == '/' ? '' : '/') + encodeURIComponent(this.id);
- },
-
- // **parse** converts a response into the hash of attributes to be `set` on
- // the model. The default implementation is just to pass the response along.
- parse: function(resp, xhr) {
- return resp;
- },
-
- // Create a new model with identical attributes to this one.
- clone: function() {
- return new this.constructor(this.attributes);
- },
-
- // A model is new if it has never been saved to the server, and lacks an id.
- isNew: function() {
- return this.id == null;
- },
-
- // Call this method to manually fire a `"change"` event for this model and
- // a `"change:attribute"` event for each changed attribute.
- // Calling this will cause all objects observing the model to update.
- change: function(options) {
- options || (options = {});
- var changing = this._changing;
- this._changing = true;
-
- // Silent changes become pending changes.
- for (var attr in this._silent) this._pending[attr] = true;
-
- // Silent changes are triggered.
- var changes = _.extend({}, options.changes, this._silent);
- this._silent = {};
- for (var attr in changes) {
- this.trigger('change:' + attr, this, this.get(attr), options);
- }
- if (changing) return this;
-
- // Continue firing `"change"` events while there are pending changes.
- while (!_.isEmpty(this._pending)) {
- this._pending = {};
- this.trigger('change', this, options);
- // Pending and silent changes still remain.
- for (var attr in this.changed) {
- if (this._pending[attr] || this._silent[attr]) continue;
- delete this.changed[attr];
- }
- this._previousAttributes = _.clone(this.attributes);
- }
-
- this._changing = false;
- return this;
- },
-
- // Determine if the model has changed since the last `"change"` event.
- // If you specify an attribute name, determine if that attribute has changed.
- hasChanged: function(attr) {
- if (!arguments.length) return !_.isEmpty(this.changed);
- return _.has(this.changed, attr);
- },
-
- // Return an object containing all the attributes that have changed, or
- // false if there are no changed attributes. Useful for determining what
- // parts of a view need to be updated and/or what attributes need to be
- // persisted to the server. Unset attributes will be set to undefined.
- // You can also pass an attributes object to diff against the model,
- // determining if there *would be* a change.
- changedAttributes: function(diff) {
- if (!diff) return this.hasChanged() ? _.clone(this.changed) : false;
- var val, changed = false, old = this._previousAttributes;
- for (var attr in diff) {
- if (_.isEqual(old[attr], (val = diff[attr]))) continue;
- (changed || (changed = {}))[attr] = val;
- }
- return changed;
- },
-
- // Get the previous value of an attribute, recorded at the time the last
- // `"change"` event was fired.
- previous: function(attr) {
- if (!arguments.length || !this._previousAttributes) return null;
- return this._previousAttributes[attr];
- },
-
- // Get all of the attributes of the model at the time of the previous
- // `"change"` event.
- previousAttributes: function() {
- return _.clone(this._previousAttributes);
- },
-
- // Check if the model is currently in a valid state. It's only possible to
- // get into an *invalid* state if you're using silent changes.
- isValid: function() {
- return !this.validate(this.attributes);
- },
-
- // Run validation against the next complete set of model attributes,
- // returning `true` if all is well. If a specific `error` callback has
- // been passed, call that instead of firing the general `"error"` event.
- _validate: function(attrs, options) {
- if (options.silent || !this.validate) return true;
- attrs = _.extend({}, this.attributes, attrs);
- var error = this.validate(attrs, options);
- if (!error) return true;
- if (options && options.error) {
- options.error(this, error, options);
- } else {
- this.trigger('error', this, error, options);
- }
- return false;
- }
-
- });
-
- // Backbone.Collection
- // -------------------
-
- // Provides a standard collection class for our sets of models, ordered
- // or unordered. If a `comparator` is specified, the Collection will maintain
- // its models in sort order, as they're added and removed.
- var Collection = Backbone.Collection = function(models, options) {
- options || (options = {});
- if (options.model) this.model = options.model;
- if (options.comparator) this.comparator = options.comparator;
- this._reset();
- this.initialize.apply(this, arguments);
- if (models) this.reset(models, {silent: true, parse: options.parse});
- };
-
- // Define the Collection's inheritable methods.
- _.extend(Collection.prototype, Events, {
-
- // The default model for a collection is just a **Backbone.Model**.
- // This should be overridden in most cases.
- model: Model,
-
- // Initialize is an empty function by default. Override it with your own
- // initialization logic.
- initialize: function(){},
-
- // The JSON representation of a Collection is an array of the
- // models' attributes.
- toJSON: function(options) {
- return this.map(function(model){ return model.toJSON(options); });
- },
-
- // Add a model, or list of models to the set. Pass **silent** to avoid
- // firing the `add` event for every new model.
- add: function(models, options) {
- var i, index, length, model, cid, id, cids = {}, ids = {}, dups = [];
- options || (options = {});
- models = _.isArray(models) ? models.slice() : [models];
-
- // Begin by turning bare objects into model references, and preventing
- // invalid models or duplicate models from being added.
- for (i = 0, length = models.length; i < length; i++) {
- if (!(model = models[i] = this._prepareModel(models[i], options))) {
- throw new Error("Can't add an invalid model to a collection");
- }
- cid = model.cid;
- id = model.id;
- if (cids[cid] || this._byCid[cid] || ((id != null) && (ids[id] || this._byId[id]))) {
- dups.push(i);
- continue;
- }
- cids[cid] = ids[id] = model;
- }
-
- // Remove duplicates.
- i = dups.length;
- while (i--) {
- models.splice(dups[i], 1);
- }
-
- // Listen to added models' events, and index models for lookup by
- // `id` and by `cid`.
- for (i = 0, length = models.length; i < length; i++) {
- (model = models[i]).on('all', this._onModelEvent, this);
- this._byCid[model.cid] = model;
- if (model.id != null) this._byId[model.id] = model;
- }
-
- // Insert models into the collection, re-sorting if needed, and triggering
- // `add` events unless silenced.
- this.length += length;
- index = options.at != null ? options.at : this.models.length;
- splice.apply(this.models, [index, 0].concat(models));
- if (this.comparator) this.sort({silent: true});
- if (options.silent) return this;
- for (i = 0, length = this.models.length; i < length; i++) {
- if (!cids[(model = this.models[i]).cid]) continue;
- options.index = i;
- model.trigger('add', model, this, options);
- }
- return this;
- },
-
- // Remove a model, or a list of models from the set. Pass silent to avoid
- // firing the `remove` event for every model removed.
- remove: function(models, options) {
- var i, l, index, model;
- options || (options = {});
- models = _.isArray(models) ? models.slice() : [models];
- for (i = 0, l = models.length; i < l; i++) {
- model = this.getByCid(models[i]) || this.get(models[i]);
- if (!model) continue;
- delete this._byId[model.id];
- delete this._byCid[model.cid];
- index = this.indexOf(model);
- this.models.splice(index, 1);
- this.length--;
- if (!options.silent) {
- options.index = index;
- model.trigger('remove', model, this, options);
- }
- this._removeReference(model);
- }
- return this;
- },
-
- // Add a model to the end of the collection.
- push: function(model, options) {
- model = this._prepareModel(model, options);
- this.add(model, options);
- return model;
- },
-
- // Remove a model from the end of the collection.
- pop: function(options) {
- var model = this.at(this.length - 1);
- this.remove(model, options);
- return model;
- },
-
- // Add a model to the beginning of the collection.
- unshift: function(model, options) {
- model = this._prepareModel(model, options);
- this.add(model, _.extend({at: 0}, options));
- return model;
- },
-
- // Remove a model from the beginning of the collection.
- shift: function(options) {
- var model = this.at(0);
- this.remove(model, options);
- return model;
- },
-
- // Get a model from the set by id.
- get: function(id) {
- if (id == null) return void 0;
- return this._byId[id.id != null ? id.id : id];
- },
-
- // Get a model from the set by client id.
- getByCid: function(cid) {
- return cid && this._byCid[cid.cid || cid];
- },
-
- // Get the model at the given index.
- at: function(index) {
- return this.models[index];
- },
-
- // Return models with matching attributes. Useful for simple cases of `filter`.
- where: function(attrs) {
- if (_.isEmpty(attrs)) return [];
- return this.filter(function(model) {
- for (var key in attrs) {
- if (attrs[key] !== model.get(key)) return false;
- }
- return true;
- });
- },
-
- // Force the collection to re-sort itself. You don't need to call this under
- // normal circumstances, as the set will maintain sort order as each item
- // is added.
- sort: function(options) {
- options || (options = {});
- if (!this.comparator) throw new Error('Cannot sort a set without a comparator');
- var boundComparator = _.bind(this.comparator, this);
- if (this.comparator.length == 1) {
- this.models = this.sortBy(boundComparator);
- } else {
- this.models.sort(boundComparator);
- }
- if (!options.silent) this.trigger('reset', this, options);
- return this;
- },
-
- // Pluck an attribute from each model in the collection.
- pluck: function(attr) {
- return _.map(this.models, function(model){ return model.get(attr); });
- },
-
- // When you have more items than you want to add or remove individually,
- // you can reset the entire set with a new list of models, without firing
- // any `add` or `remove` events. Fires `reset` when finished.
- reset: function(models, options) {
- models || (models = []);
- options || (options = {});
- for (var i = 0, l = this.models.length; i < l; i++) {
- this._removeReference(this.models[i]);
- }
- this._reset();
- this.add(models, _.extend({silent: true}, options));
- if (!options.silent) this.trigger('reset', this, options);
- return this;
- },
-
- // Fetch the default set of models for this collection, resetting the
- // collection when they arrive. If `add: true` is passed, appends the
- // models to the collection instead of resetting.
- fetch: function(options) {
- options = options ? _.clone(options) : {};
- if (options.parse === undefined) options.parse = true;
- var collection = this;
- var success = options.success;
- options.success = function(resp, status, xhr) {
- collection[options.add ? 'add' : 'reset'](collection.parse(resp, xhr), options);
- if (success) success(collection, resp);
- };
- options.error = Backbone.wrapError(options.error, collection, options);
- return (this.sync || Backbone.sync).call(this, 'read', this, options);
- },
-
- // Create a new instance of a model in this collection. Add the model to the
- // collection immediately, unless `wait: true` is passed, in which case we
- // wait for the server to agree.
- create: function(model, options) {
- var coll = this;
- options = options ? _.clone(options) : {};
- model = this._prepareModel(model, options);
- if (!model) return false;
- if (!options.wait) coll.add(model, options);
- var success = options.success;
- options.success = function(nextModel, resp, xhr) {
- if (options.wait) coll.add(nextModel, options);
- if (success) {
- success(nextModel, resp);
- } else {
- nextModel.trigger('sync', model, resp, options);
- }
- };
- model.save(null, options);
- return model;
- },
-
- // **parse** converts a response into a list of models to be added to the
- // collection. The default implementation is just to pass it through.
- parse: function(resp, xhr) {
- return resp;
- },
-
- // Proxy to _'s chain. Can't be proxied the same way the rest of the
- // underscore methods are proxied because it relies on the underscore
- // constructor.
- chain: function () {
- return _(this.models).chain();
- },
-
- // Reset all internal state. Called when the collection is reset.
- _reset: function(options) {
- this.length = 0;
- this.models = [];
- this._byId = {};
- this._byCid = {};
- },
-
- // Prepare a model or hash of attributes to be added to this collection.
- _prepareModel: function(model, options) {
- options || (options = {});
- if (!(model instanceof Model)) {
- var attrs = model;
- options.collection = this;
- model = new this.model(attrs, options);
- if (!model._validate(model.attributes, options)) model = false;
- } else if (!model.collection) {
- model.collection = this;
- }
- return model;
- },
-
- // Internal method to remove a model's ties to a collection.
- _removeReference: function(model) {
- if (this == model.collection) {
- delete model.collection;
- }
- model.off('all', this._onModelEvent, this);
- },
-
- // Internal method called every time a model in the set fires an event.
- // Sets need to update their indexes when models change ids. All other
- // events simply proxy through. "add" and "remove" events that originate
- // in other collections are ignored.
- _onModelEvent: function(event, model, collection, options) {
- if ((event == 'add' || event == 'remove') && collection != this) return;
- if (event == 'destroy') {
- this.remove(model, options);
- }
- if (model && event === 'change:' + model.idAttribute) {
- delete this._byId[model.previous(model.idAttribute)];
- this._byId[model.id] = model;
- }
- this.trigger.apply(this, arguments);
- }
-
- });
-
- // Underscore methods that we want to implement on the Collection.
- var methods = ['forEach', 'each', 'map', 'reduce', 'reduceRight', 'find',
- 'detect', 'filter', 'select', 'reject', 'every', 'all', 'some', 'any',
- 'include', 'contains', 'invoke', 'max', 'min', 'sortBy', 'sortedIndex',
- 'toArray', 'size', 'first', 'initial', 'rest', 'last', 'without', 'indexOf',
- 'shuffle', 'lastIndexOf', 'isEmpty', 'groupBy'];
-
- // Mix in each Underscore method as a proxy to `Collection#models`.
- _.each(methods, function(method) {
- Collection.prototype[method] = function() {
- return _[method].apply(_, [this.models].concat(_.toArray(arguments)));
- };
- });
-
- // Backbone.Router
- // -------------------
-
- // Routers map faux-URLs to actions, and fire events when routes are
- // matched. Creating a new one sets its `routes` hash, if not set statically.
- var Router = Backbone.Router = function(options) {
- options || (options = {});
- if (options.routes) this.routes = options.routes;
- this._bindRoutes();
- this.initialize.apply(this, arguments);
- };
-
- // Cached regular expressions for matching named param parts and splatted
- // parts of route strings.
- var namedParam = /:\w+/g;
- var splatParam = /\*\w+/g;
- var escapeRegExp = /[-[\]{}()+?.,\\^$|#\s]/g;
-
- // Set up all inheritable **Backbone.Router** properties and methods.
- _.extend(Router.prototype, Events, {
-
- // Initialize is an empty function by default. Override it with your own
- // initialization logic.
- initialize: function(){},
-
- // Manually bind a single named route to a callback. For example:
- //
- // this.route('search/:query/p:num', 'search', function(query, num) {
- // ...
- // });
- //
- route: function(route, name, callback) {
- Backbone.history || (Backbone.history = new History);
- if (!_.isRegExp(route)) route = this._routeToRegExp(route);
- if (!callback) callback = this[name];
- Backbone.history.route(route, _.bind(function(fragment) {
- var args = this._extractParameters(route, fragment);
- callback && callback.apply(this, args);
- this.trigger.apply(this, ['route:' + name].concat(args));
- Backbone.history.trigger('route', this, name, args);
- }, this));
- return this;
- },
-
- // Simple proxy to `Backbone.history` to save a fragment into the history.
- navigate: function(fragment, options) {
- Backbone.history.navigate(fragment, options);
- },
-
- // Bind all defined routes to `Backbone.history`. We have to reverse the
- // order of the routes here to support behavior where the most general
- // routes can be defined at the bottom of the route map.
- _bindRoutes: function() {
- if (!this.routes) return;
- var routes = [];
- for (var route in this.routes) {
- routes.unshift([route, this.routes[route]]);
- }
- for (var i = 0, l = routes.length; i < l; i++) {
- this.route(routes[i][0], routes[i][1], this[routes[i][1]]);
- }
- },
-
- // Convert a route string into a regular expression, suitable for matching
- // against the current location hash.
- _routeToRegExp: function(route) {
- route = route.replace(escapeRegExp, '\\$&')
- .replace(namedParam, '([^\/]+)')
- .replace(splatParam, '(.*?)');
- return new RegExp('^' + route + '$');
- },
-
- // Given a route, and a URL fragment that it matches, return the array of
- // extracted parameters.
- _extractParameters: function(route, fragment) {
- return route.exec(fragment).slice(1);
- }
-
- });
-
- // Backbone.History
- // ----------------
-
- // Handles cross-browser history management, based on URL fragments. If the
- // browser does not support `onhashchange`, falls back to polling.
- var History = Backbone.History = function() {
- this.handlers = [];
- _.bindAll(this, 'checkUrl');
- };
-
- // Cached regex for cleaning leading hashes and slashes .
- var routeStripper = /^[#\/]/;
-
- // Cached regex for detecting MSIE.
- var isExplorer = /msie [\w.]+/;
-
- // Has the history handling already been started?
- History.started = false;
-
- // Set up all inheritable **Backbone.History** properties and methods.
- _.extend(History.prototype, Events, {
-
- // The default interval to poll for hash changes, if necessary, is
- // twenty times a second.
- interval: 50,
-
- // Gets the true hash value. Cannot use location.hash directly due to bug
- // in Firefox where location.hash will always be decoded.
- getHash: function(windowOverride) {
- var loc = windowOverride ? windowOverride.location : window.location;
- var match = loc.href.match(/#(.*)$/);
- return match ? match[1] : '';
- },
-
- // Get the cross-browser normalized URL fragment, either from the URL,
- // the hash, or the override.
- getFragment: function(fragment, forcePushState) {
- if (fragment == null) {
- if (this._hasPushState || forcePushState) {
- fragment = window.location.pathname;
- var search = window.location.search;
- if (search) fragment += search;
- } else {
- fragment = this.getHash();
- }
- }
- if (!fragment.indexOf(this.options.root)) fragment = fragment.substr(this.options.root.length);
- return fragment.replace(routeStripper, '');
- },
-
- // Start the hash change handling, returning `true` if the current URL matches
- // an existing route, and `false` otherwise.
- start: function(options) {
- if (History.started) throw new Error("Backbone.history has already been started");
- History.started = true;
-
- // Figure out the initial configuration. Do we need an iframe?
- // Is pushState desired ... is it available?
- this.options = _.extend({}, {root: '/'}, this.options, options);
- this._wantsHashChange = this.options.hashChange !== false;
- this._wantsPushState = !!this.options.pushState;
- this._hasPushState = !!(this.options.pushState && window.history && window.history.pushState);
- var fragment = this.getFragment();
- var docMode = document.documentMode;
- var oldIE = (isExplorer.exec(navigator.userAgent.toLowerCase()) && (!docMode || docMode <= 7));
-
- if (oldIE) {
- this.iframe = $('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo('body')[0].contentWindow;
- this.navigate(fragment);
- }
-
- // Depending on whether we're using pushState or hashes, and whether
- // 'onhashchange' is supported, determine how we check the URL state.
- if (this._hasPushState) {
- $(window).bind('popstate', this.checkUrl);
- } else if (this._wantsHashChange && ('onhashchange' in window) && !oldIE) {
- $(window).bind('hashchange', this.checkUrl);
- } else if (this._wantsHashChange) {
- this._checkUrlInterval = setInterval(this.checkUrl, this.interval);
- }
-
- // Determine if we need to change the base url, for a pushState link
- // opened by a non-pushState browser.
- this.fragment = fragment;
- var loc = window.location;
- var atRoot = loc.pathname == this.options.root;
-
- // If we've started off with a route from a `pushState`-enabled browser,
- // but we're currently in a browser that doesn't support it...
- if (this._wantsHashChange && this._wantsPushState && !this._hasPushState && !atRoot) {
- this.fragment = this.getFragment(null, true);
- window.location.replace(this.options.root + '#' + this.fragment);
- // Return immediately as browser will do redirect to new url
- return true;
-
- // Or if we've started out with a hash-based route, but we're currently
- // in a browser where it could be `pushState`-based instead...
- } else if (this._wantsPushState && this._hasPushState && atRoot && loc.hash) {
- this.fragment = this.getHash().replace(routeStripper, '');
- window.history.replaceState({}, document.title, loc.protocol + '//' + loc.host + this.options.root + this.fragment);
- }
-
- if (!this.options.silent) {
- return this.loadUrl();
- }
- },
-
- // Disable Backbone.history, perhaps temporarily. Not useful in a real app,
- // but possibly useful for unit testing Routers.
- stop: function() {
- $(window).unbind('popstate', this.checkUrl).unbind('hashchange', this.checkUrl);
- clearInterval(this._checkUrlInterval);
- History.started = false;
- },
-
- // Add a route to be tested when the fragment changes. Routes added later
- // may override previous routes.
- route: function(route, callback) {
- this.handlers.unshift({route: route, callback: callback});
- },
-
- // Checks the current URL to see if it has changed, and if it has,
- // calls `loadUrl`, normalizing across the hidden iframe.
- checkUrl: function(e) {
- var current = this.getFragment();
- if (current == this.fragment && this.iframe) current = this.getFragment(this.getHash(this.iframe));
- if (current == this.fragment) return false;
- if (this.iframe) this.navigate(current);
- this.loadUrl() || this.loadUrl(this.getHash());
- },
-
- // Attempt to load the current URL fragment. If a route succeeds with a
- // match, returns `true`. If no defined routes matches the fragment,
- // returns `false`.
- loadUrl: function(fragmentOverride) {
- var fragment = this.fragment = this.getFragment(fragmentOverride);
- var matched = _.any(this.handlers, function(handler) {
- if (handler.route.test(fragment)) {
- handler.callback(fragment);
- return true;
- }
- });
- return matched;
- },
-
- // Save a fragment into the hash history, or replace the URL state if the
- // 'replace' option is passed. You are responsible for properly URL-encoding
- // the fragment in advance.
- //
- // The options object can contain `trigger: true` if you wish to have the
- // route callback be fired (not usually desirable), or `replace: true`, if
- // you wish to modify the current URL without adding an entry to the history.
- navigate: function(fragment, options) {
- if (!History.started) return false;
- if (!options || options === true) options = {trigger: options};
- var frag = (fragment || '').replace(routeStripper, '');
- if (this.fragment == frag) return;
-
- // If pushState is available, we use it to set the fragment as a real URL.
- if (this._hasPushState) {
- if (frag.indexOf(this.options.root) != 0) frag = this.options.root + frag;
- this.fragment = frag;
- window.history[options.replace ? 'replaceState' : 'pushState']({}, document.title, frag);
-
- // If hash changes haven't been explicitly disabled, update the hash
- // fragment to store history.
- } else if (this._wantsHashChange) {
- this.fragment = frag;
- this._updateHash(window.location, frag, options.replace);
- if (this.iframe && (frag != this.getFragment(this.getHash(this.iframe)))) {
- // Opening and closing the iframe tricks IE7 and earlier to push a history entry on hash-tag change.
- // When replace is true, we don't want this.
- if(!options.replace) this.iframe.document.open().close();
- this._updateHash(this.iframe.location, frag, options.replace);
- }
-
- // If you've told us that you explicitly don't want fallback hashchange-
- // based history, then `navigate` becomes a page refresh.
- } else {
- window.location.assign(this.options.root + fragment);
- }
- if (options.trigger) this.loadUrl(fragment);
- },
-
- // Update the hash location, either replacing the current entry, or adding
- // a new one to the browser history.
- _updateHash: function(location, fragment, replace) {
- if (replace) {
- location.replace(location.toString().replace(/(javascript:|#).*$/, '') + '#' + fragment);
- } else {
- location.hash = fragment;
- }
- }
- });
-
- // Backbone.View
- // -------------
-
- // Creating a Backbone.View creates its initial element outside of the DOM,
- // if an existing element is not provided...
- var View = Backbone.View = function(options) {
- this.cid = _.uniqueId('view');
- this._configure(options || {});
- this._ensureElement();
- this.initialize.apply(this, arguments);
- this.delegateEvents();
- };
-
- // Cached regex to split keys for `delegate`.
- var delegateEventSplitter = /^(\S+)\s*(.*)$/;
-
- // List of view options to be merged as properties.
- var viewOptions = ['model', 'collection', 'el', 'id', 'attributes', 'className', 'tagName'];
-
- // Set up all inheritable **Backbone.View** properties and methods.
- _.extend(View.prototype, Events, {
-
- // The default `tagName` of a View's element is `"div"`.
- tagName: 'div',
-
- // jQuery delegate for element lookup, scoped to DOM elements within the
- // current view. This should be prefered to global lookups where possible.
- $: function(selector) {
- return this.$el.find(selector);
- },
-
- // Initialize is an empty function by default. Override it with your own
- // initialization logic.
- initialize: function(){},
-
- // **render** is the core function that your view should override, in order
- // to populate its element (`this.el`), with the appropriate HTML. The
- // convention is for **render** to always return `this`.
- render: function() {
- return this;
- },
-
- // Remove this view from the DOM. Note that the view isn't present in the
- // DOM by default, so calling this method may be a no-op.
- remove: function() {
- this.$el.remove();
- return this;
- },
-
- // For small amounts of DOM Elements, where a full-blown template isn't
- // needed, use **make** to manufacture elements, one at a time.
- //
- // var el = this.make('li', {'class': 'row'}, this.model.escape('title'));
- //
- make: function(tagName, attributes, content) {
- var el = document.createElement(tagName);
- if (attributes) $(el).attr(attributes);
- if (content) $(el).html(content);
- return el;
- },
-
- // Change the view's element (`this.el` property), including event
- // re-delegation.
- setElement: function(element, delegate) {
- if (this.$el) this.undelegateEvents();
- this.$el = (element instanceof $) ? element : $(element);
- this.el = this.$el[0];
- if (delegate !== false) this.delegateEvents();
- return this;
- },
-
- // Set callbacks, where `this.events` is a hash of
- //
- // *{"event selector": "callback"}*
- //
- // {
- // 'mousedown .title': 'edit',
- // 'click .button': 'save'
- // 'click .open': function(e) { ... }
- // }
- //
- // pairs. Callbacks will be bound to the view, with `this` set properly.
- // Uses event delegation for efficiency.
- // Omitting the selector binds the event to `this.el`.
- // This only works for delegate-able events: not `focus`, `blur`, and
- // not `change`, `submit`, and `reset` in Internet Explorer.
- delegateEvents: function(events) {
- if (!(events || (events = getValue(this, 'events')))) return;
- this.undelegateEvents();
- for (var key in events) {
- var method = events[key];
- if (!_.isFunction(method)) method = this[events[key]];
- if (!method) throw new Error('Method "' + events[key] + '" does not exist');
- var match = key.match(delegateEventSplitter);
- var eventName = match[1], selector = match[2];
- method = _.bind(method, this);
- eventName += '.delegateEvents' + this.cid;
- if (selector === '') {
- this.$el.bind(eventName, method);
- } else {
- this.$el.delegate(selector, eventName, method);
- }
- }
- },
-
- // Clears all callbacks previously bound to the view with `delegateEvents`.
- // You usually don't need to use this, but may wish to if you have multiple
- // Backbone views attached to the same DOM element.
- undelegateEvents: function() {
- this.$el.unbind('.delegateEvents' + this.cid);
- },
-
- // Performs the initial configuration of a View with a set of options.
- // Keys with special meaning *(model, collection, id, className)*, are
- // attached directly to the view.
- _configure: function(options) {
- if (this.options) options = _.extend({}, this.options, options);
- for (var i = 0, l = viewOptions.length; i < l; i++) {
- var attr = viewOptions[i];
- if (options[attr]) this[attr] = options[attr];
- }
- this.options = options;
- },
-
- // Ensure that the View has a DOM element to render into.
- // If `this.el` is a string, pass it through `$()`, take the first
- // matching element, and re-assign it to `el`. Otherwise, create
- // an element from the `id`, `className` and `tagName` properties.
- _ensureElement: function() {
- if (!this.el) {
- var attrs = getValue(this, 'attributes') || {};
- if (this.id) attrs.id = this.id;
- if (this.className) attrs['class'] = this.className;
- this.setElement(this.make(this.tagName, attrs), false);
- } else {
- this.setElement(this.el, false);
- }
- }
-
- });
-
- // The self-propagating extend function that Backbone classes use.
- var extend = function (protoProps, classProps) {
- var child = inherits(this, protoProps, classProps);
- child.extend = this.extend;
- return child;
- };
-
- // Set up inheritance for the model, collection, and view.
- Model.extend = Collection.extend = Router.extend = View.extend = extend;
-
- // Backbone.sync
- // -------------
-
- // Map from CRUD to HTTP for our default `Backbone.sync` implementation.
- var methodMap = {
- 'create': 'POST',
- 'update': 'PUT',
- 'delete': 'DELETE',
- 'read': 'GET'
- };
-
- // Override this function to change the manner in which Backbone persists
- // models to the server. You will be passed the type of request, and the
- // model in question. By default, makes a RESTful Ajax request
- // to the model's `url()`. Some possible customizations could be:
- //
- // * Use `setTimeout` to batch rapid-fire updates into a single request.
- // * Send up the models as XML instead of JSON.
- // * Persist models via WebSockets instead of Ajax.
- //
- // Turn on `Backbone.emulateHTTP` in order to send `PUT` and `DELETE` requests
- // as `POST`, with a `_method` parameter containing the true HTTP method,
- // as well as all requests with the body as `application/x-www-form-urlencoded`
- // instead of `application/json` with the model in a param named `model`.
- // Useful when interfacing with server-side languages like **PHP** that make
- // it difficult to read the body of `PUT` requests.
- Backbone.sync = function(method, model, options) {
- var type = methodMap[method];
-
- // Default options, unless specified.
- options || (options = {});
-
- // Default JSON-request options.
- var params = {type: type, dataType: 'json'};
-
- // Ensure that we have a URL.
- if (!options.url) {
- params.url = getValue(model, 'url') || urlError();
- }
-
- // Ensure that we have the appropriate request data.
- if (!options.data && model && (method == 'create' || method == 'update')) {
- params.contentType = 'application/json';
- params.data = JSON.stringify(model.toJSON());
- }
-
- // For older servers, emulate JSON by encoding the request into an HTML-form.
- if (Backbone.emulateJSON) {
- params.contentType = 'application/x-www-form-urlencoded';
- params.data = params.data ? {model: params.data} : {};
- }
-
- // For older servers, emulate HTTP by mimicking the HTTP method with `_method`
- // And an `X-HTTP-Method-Override` header.
- if (Backbone.emulateHTTP) {
- if (type === 'PUT' || type === 'DELETE') {
- if (Backbone.emulateJSON) params.data._method = type;
- params.type = 'POST';
- params.beforeSend = function(xhr) {
- xhr.setRequestHeader('X-HTTP-Method-Override', type);
- };
- }
- }
-
- // Don't process data on a non-GET request.
- if (params.type !== 'GET' && !Backbone.emulateJSON) {
- params.processData = false;
- }
-
- // Make the request, allowing the user to override any Ajax options.
- return $.ajax(_.extend(params, options));
- };
-
- // Wrap an optional error callback with a fallback error event.
- Backbone.wrapError = function(onError, originalModel, options) {
- return function(model, resp) {
- resp = model === originalModel ? resp : model;
- if (onError) {
- onError(originalModel, resp, options);
- } else {
- originalModel.trigger('error', originalModel, resp, options);
- }
- };
- };
-
- // Helpers
- // -------
-
- // Shared empty constructor function to aid in prototype-chain creation.
- var ctor = function(){};
-
- // Helper function to correctly set up the prototype chain, for subclasses.
- // Similar to `goog.inherits`, but uses a hash of prototype properties and
- // class properties to be extended.
- var inherits = function(parent, protoProps, staticProps) {
- var child;
-
- // The constructor function for the new subclass is either defined by you
- // (the "constructor" property in your `extend` definition), or defaulted
- // by us to simply call the parent's constructor.
- if (protoProps && protoProps.hasOwnProperty('constructor')) {
- child = protoProps.constructor;
- } else {
- child = function(){ parent.apply(this, arguments); };
- }
-
- // Inherit class (static) properties from parent.
- _.extend(child, parent);
-
- // Set the prototype chain to inherit from `parent`, without calling
- // `parent`'s constructor function.
- ctor.prototype = parent.prototype;
- child.prototype = new ctor();
-
- // Add prototype properties (instance properties) to the subclass,
- // if supplied.
- if (protoProps) _.extend(child.prototype, protoProps);
-
- // Add static properties to the constructor function, if supplied.
- if (staticProps) _.extend(child, staticProps);
-
- // Correctly set child's `prototype.constructor`.
- child.prototype.constructor = child;
-
- // Set a convenience property in case the parent's prototype is needed later.
- child.__super__ = parent.prototype;
-
- return child;
- };
-
- // Helper function to get a value from a Backbone object as a property
- // or as a function.
- var getValue = function(object, prop) {
- if (!(object && object[prop])) return null;
- return _.isFunction(object[prop]) ? object[prop]() : object[prop];
- };
-
- // Throw an error when a URL is needed, and none is supplied.
- var urlError = function() {
- throw new Error('A "url" property or function must be specified');
- };
-
-}).call(this);
+++ /dev/null
-/* ==========================================================
- * bootstrap-carousel.js v2.0.4
- * http://twitter.github.com/bootstrap/javascript.html#carousel
- * ==========================================================
- * Copyright 2012 Twitter, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ========================================================== */
-
-
-!function ($) {
-
- "use strict"; // jshint ;_;
-
-
- /* CAROUSEL CLASS DEFINITION
- * ========================= */
-
- var Carousel = function (element, options) {
- this.$element = $(element)
- this.options = options
- this.options.slide && this.slide(this.options.slide)
- this.options.pause == 'hover' && this.$element
- .on('mouseenter', $.proxy(this.pause, this))
- .on('mouseleave', $.proxy(this.cycle, this))
- }
-
- Carousel.prototype = {
-
- cycle: function (e) {
- if (!e) this.paused = false
- this.options.interval
- && !this.paused
- && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
- return this
- }
-
- , to: function (pos) {
- var $active = this.$element.find('.active')
- , children = $active.parent().children()
- , activePos = children.index($active)
- , that = this
-
- if (pos > (children.length - 1) || pos < 0) return
-
- if (this.sliding) {
- return this.$element.one('slid', function () {
- that.to(pos)
- })
- }
-
- if (activePos == pos) {
- return this.pause().cycle()
- }
-
- return this.slide(pos > activePos ? 'next' : 'prev', $(children[pos]))
- }
-
- , pause: function (e) {
- if (!e) this.paused = true
- clearInterval(this.interval)
- this.interval = null
- return this
- }
-
- , next: function () {
- if (this.sliding) return
- return this.slide('next')
- }
-
- , prev: function () {
- if (this.sliding) return
- return this.slide('prev')
- }
-
- , slide: function (type, next) {
- var $active = this.$element.find('.active')
- , $next = next || $active[type]()
- , isCycling = this.interval
- , direction = type == 'next' ? 'left' : 'right'
- , fallback = type == 'next' ? 'first' : 'last'
- , that = this
- , e = $.Event('slide')
-
- this.sliding = true
-
- isCycling && this.pause()
-
- $next = $next.length ? $next : this.$element.find('.item')[fallback]()
-
- if ($next.hasClass('active')) return
-
- if ($.support.transition && this.$element.hasClass('slide')) {
- this.$element.trigger(e)
- if (e.isDefaultPrevented()) return
- $next.addClass(type)
- $next[0].offsetWidth // force reflow
- $active.addClass(direction)
- $next.addClass(direction)
- this.$element.one($.support.transition.end, function () {
- $next.removeClass([type, direction].join(' ')).addClass('active')
- $active.removeClass(['active', direction].join(' '))
- that.sliding = false
- setTimeout(function () { that.$element.trigger('slid') }, 0)
- })
- } else {
- this.$element.trigger(e)
- if (e.isDefaultPrevented()) return
- $active.removeClass('active')
- $next.addClass('active')
- this.sliding = false
- this.$element.trigger('slid')
- }
-
- isCycling && this.cycle()
-
- return this
- }
-
- }
-
-
- /* CAROUSEL PLUGIN DEFINITION
- * ========================== */
-
- $.fn.carousel = function (option) {
- return this.each(function () {
- var $this = $(this)
- , data = $this.data('carousel')
- , options = $.extend({}, $.fn.carousel.defaults, typeof option == 'object' && option)
- if (!data) $this.data('carousel', (data = new Carousel(this, options)))
- if (typeof option == 'number') data.to(option)
- else if (typeof option == 'string' || (option = options.slide)) data[option]()
- else if (options.interval) data.cycle()
- })
- }
-
- $.fn.carousel.defaults = {
- interval: 5000
- , pause: 'hover'
- }
-
- $.fn.carousel.Constructor = Carousel
-
-
- /* CAROUSEL DATA-API
- * ================= */
-
- $(function () {
- $('body').on('click.carousel.data-api', '[data-slide]', function ( e ) {
- var $this = $(this), href
- , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
- , options = !$target.data('modal') && $.extend({}, $target.data(), $this.data())
- $target.carousel(options)
- e.preventDefault()
- })
- })
-
-}(window.jQuery);
\ No newline at end of file
+++ /dev/null
-/* =========================================================
- * bootstrap-datepicker.js
- * http://www.eyecon.ro/bootstrap-datepicker
- * =========================================================
- * Copyright 2012 Stefan Petre
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ========================================================= */
-
- DPGlobal = {
- modes: [
- {
- clsName: 'days',
- navFnc: 'Month',
- navStep: 1
- },
- {
- clsName: 'months',
- navFnc: 'FullYear',
- navStep: 1
- },
- {
- clsName: 'years',
- navFnc: 'FullYear',
- navStep: 10
- }],
- dates:{
- days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
- daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
- daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"],
- months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
- monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
- },
- isLeapYear: function (year) {
- return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0))
- },
- getDaysInMonth: function (year, month) {
- return [31, (DPGlobal.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]
- },
- parseFormat: function(format){
- var separator = format.match(/[.\/-].*?/),
- parts = format.split(/\W+/);
- if (!separator || !parts || parts.length == 0){
- throw new Error("Invalid date format.");
- }
- return {separator: separator, parts: parts};
- },
- parseDate: function(date, format) {
- var parts = date.split(format.separator),
- date = new Date(1970, 1, 1, 0, 0, 0),
- val;
- if (parts.length == format.parts.length) {
- for (var i=0, cnt = format.parts.length; i < cnt; i++) {
- val = parseInt(parts[i], 10)||1;
- switch(format.parts[i]) {
- case 'dd':
- case 'd':
- date.setDate(val);
- break;
- case 'mm':
- case 'm':
- date.setMonth(val - 1);
- break;
- case 'yy':
- date.setFullYear(2000 + val);
- break;
- case 'yyyy':
- date.setFullYear(val);
- break;
- }
- }
- }
- return date;
- },
- formatDate: function(date, format){
- var val = {
- d: date.getDate(),
- m: date.getMonth() + 1,
- yy: date.getFullYear().toString().substring(2),
- yyyy: date.getFullYear()
- };
- val.dd = (val.d < 10 ? '0' : '') + val.d;
- val.mm = (val.m < 10 ? '0' : '') + val.m;
- var date = [];
- for (var i=0, cnt = format.parts.length; i < cnt; i++) {
- date.push(val[format.parts[i]]);
- }
- return date.join(format.separator);
- },
- headTemplate: '<thead>'+
- '<tr>'+
- '<th class="prev"><i class="icon-arrow-left"/></th>'+
- '<th colspan="5" class="switch"></th>'+
- '<th class="next"><i class="icon-arrow-right"/></th>'+
- '</tr>'+
- '</thead>',
- contTemplate: '<tbody><tr><td colspan="7"></td></tr></tbody>'
- };
- DPGlobal.template = '<div class="datepicker dropdown-menu">'+
- '<div class="datepicker-days">'+
- '<table class=" table-condensed">'+
- DPGlobal.headTemplate+
- '<tbody></tbody>'+
- '</table>'+
- '</div>'+
- '<div class="datepicker-months">'+
- '<table class="table-condensed">'+
- DPGlobal.headTemplate+
- DPGlobal.contTemplate+
- '</table>'+
- '</div>'+
- '<div class="datepicker-years">'+
- '<table class="table-condensed">'+
- DPGlobal.headTemplate+
- DPGlobal.contTemplate+
- '</table>'+
- '</div>'+
- '</div>';
-
-
-!function( $ ) {
-
- // Picker object
-
- var Datepicker = function(element, options){
- this.element = $(element);
- this.format = DPGlobal.parseFormat(options.format||this.element.data('date-format')||'mm/dd/yyyy');
- this.picker = $(DPGlobal.template)
- .appendTo('body')
- .on({
- click: $.proxy(this.click, this),
- mousedown: $.proxy(this.mousedown, this)
- });
- this.isInput = this.element.is('input');
- this.component = this.element.is('.date') ? this.element.find('.add-on') : false;
-
- if (this.isInput) {
- this.element.on({
- focus: $.proxy(this.show, this),
- blur: $.proxy(this.hide, this),
- keyup: $.proxy(this.update, this)
- });
- } else {
- if (this.component){
- this.component.on('click', $.proxy(this.show, this));
- } else {
- this.element.on('click', $.proxy(this.show, this));
- }
- }
-
- this.viewMode = 0;
- this.weekStart = options.weekStart||this.element.data('date-weekstart')||0;
- this.weekEnd = this.weekStart == 0 ? 6 : this.weekStart - 1;
- this.fillDow();
- this.fillMonths();
- this.update();
- this.showMode();
- };
-
- Datepicker.prototype = {
- constructor: Datepicker,
-
- show: function(e) {
- this.picker.show();
- this.height = this.component ? this.component.outerHeight() : this.element.outerHeight();
- this.place();
- $(window).on('resize', $.proxy(this.place, this));
- if (e ) {
- e.stopPropagation();
- e.preventDefault();
- }
- if (!this.isInput) {
- $(document).on('mousedown', $.proxy(this.hide, this));
- }
- this.element.trigger({
- type: 'show',
- date: this.date
- });
- },
-
- hide: function(){
- this.picker.hide();
- $(window).off('resize', this.place);
- this.viewMode = 0;
- this.showMode();
- if (!this.isInput) {
- $(document).off('mousedown', this.hide);
- }
- this.setValue();
- this.element.trigger({
- type: 'hide',
- date: this.date
- });
- },
-
- setValue: function() {
- var formated = DPGlobal.formatDate(this.date, this.format);
- if (!this.isInput) {
- if (this.component){
- this.element.find('input').prop('value', formated);
- }
- this.element.data('date', formated);
- } else {
- this.element.prop('value', formated);
- }
- },
-
- place: function(){
- var offset = this.component ? this.component.offset() : this.element.offset();
- this.picker.css({
- top: offset.top + this.height,
- left: offset.left
- });
- },
-
- update: function(){
- this.date = DPGlobal.parseDate(
- this.isInput ? this.element.prop('value') : this.element.data('date'),
- this.format
- );
- this.viewDate = new Date(this.date);
- this.fill();
- },
-
- fillDow: function(){
- var dowCnt = this.weekStart;
- var html = '<tr>';
- while (dowCnt < this.weekStart + 7) {
- html += '<th class="dow">'+DPGlobal.dates.daysMin[(dowCnt++)%7]+'</th>';
- }
- html += '</tr>';
- this.picker.find('.datepicker-days thead').append(html);
- },
-
- fillMonths: function(){
- var html = '';
- var i = 0
- while (i < 12) {
- html += '<span class="month">'+DPGlobal.dates.monthsShort[i++]+'</span>';
- }
- this.picker.find('.datepicker-months td').append(html);
- },
-
- fill: function() {
- var d = new Date(this.viewDate),
- year = d.getFullYear(),
- month = d.getMonth(),
- currentDate = this.date.valueOf();
- this.picker.find('.datepicker-days th:eq(1)')
- .text(DPGlobal.dates.months[month]+' '+year);
- var prevMonth = new Date(year, month-1, 28,0,0,0,0),
- day = DPGlobal.getDaysInMonth(prevMonth.getFullYear(), prevMonth.getMonth());
- prevMonth.setDate(day);
- prevMonth.setDate(day - (prevMonth.getDay() - this.weekStart + 7)%7);
- var nextMonth = new Date(prevMonth);
- nextMonth.setDate(nextMonth.getDate() + 42);
- nextMonth = nextMonth.valueOf();
- html = [];
- var clsName;
- while(prevMonth.valueOf() < nextMonth) {
- if (prevMonth.getDay() == this.weekStart) {
- html.push('<tr>');
- }
- clsName = '';
- if (prevMonth.getMonth() < month) {
- clsName += ' old';
- } else if (prevMonth.getMonth() > month) {
- clsName += ' new';
- }
- if (prevMonth.valueOf() == currentDate) {
- clsName += ' active';
- }
- html.push('<td class="day'+clsName+'">'+prevMonth.getDate() + '</td>');
- if (prevMonth.getDay() == this.weekEnd) {
- html.push('</tr>');
- }
- prevMonth.setDate(prevMonth.getDate()+1);
- }
- this.picker.find('.datepicker-days tbody').empty().append(html.join(''));
- var currentYear = this.date.getFullYear();
-
- var months = this.picker.find('.datepicker-months')
- .find('th:eq(1)')
- .text(year)
- .end()
- .find('span').removeClass('active');
- if (currentYear == year) {
- months.eq(this.date.getMonth()).addClass('active');
- }
-
- html = '';
- year = parseInt(year/10, 10) * 10;
- var yearCont = this.picker.find('.datepicker-years')
- .find('th:eq(1)')
- .text(year + '-' + (year + 9))
- .end()
- .find('td');
- year -= 1;
- for (var i = -1; i < 11; i++) {
- html += '<span class="year'+(i == -1 || i == 10 ? ' old' : '')+(currentYear == year ? ' active' : '')+'">'+year+'</span>';
- year += 1;
- }
- yearCont.html(html);
- },
-
- click: function(e) {
- e.stopPropagation();
- e.preventDefault();
- var target = $(e.target).closest('span, td, th');
- if (target.length == 1) {
- switch(target[0].nodeName.toLowerCase()) {
- case 'th':
- switch(target[0].className) {
- case 'switch':
- this.showMode(1);
- break;
- case 'prev':
- case 'next':
- this.viewDate['set'+DPGlobal.modes[this.viewMode].navFnc].call(
- this.viewDate,
- this.viewDate['get'+DPGlobal.modes[this.viewMode].navFnc].call(this.viewDate) +
- DPGlobal.modes[this.viewMode].navStep * (target[0].className == 'prev' ? -1 : 1)
- );
- this.fill();
- break;
- }
- break;
- case 'span':
- if (target.is('.month')) {
- var month = target.parent().find('span').index(target);
- this.viewDate.setMonth(month);
- } else {
- var year = parseInt(target.text(), 10)||0;
- this.viewDate.setFullYear(year);
- }
- this.showMode(-1);
- this.fill();
- break;
- case 'td':
- if (target.is('.day')){
- var day = parseInt(target.text(), 10)||1;
- var month = this.viewDate.getMonth();
- if (target.is('.old')) {
- month -= 1;
- } else if (target.is('.new')) {
- month += 1;
- }
- var year = this.viewDate.getFullYear();
- this.date = new Date(year, month, day,0,0,0,0);
- this.viewDate = new Date(year, month, day,0,0,0,0);
- this.fill();
- this.setValue();
- this.element.trigger({
- type: 'changeDate',
- date: this.date
- });
- }
- break;
- }
- }
- },
-
- mousedown: function(e){
- e.stopPropagation();
- e.preventDefault();
- },
-
- showMode: function(dir) {
- if (dir) {
- this.viewMode = Math.max(0, Math.min(2, this.viewMode + dir));
- }
- this.picker.find('>div').hide().filter('.datepicker-'+DPGlobal.modes[this.viewMode].clsName).show();
- }
- };
-
- $.fn.datepicker = function ( option ) {
- return this.each(function () {
- var $this = $(this),
- data = $this.data('datepicker'),
- options = typeof option == 'object' && option;
- if (!data) {
- $this.data('datepicker', (data = new Datepicker(this, $.extend({}, $.fn.datepicker.defaults,options))));
- }
- if (typeof option == 'string') data[option]();
- });
- };
-
- $.fn.datepicker.defaults = {
- };
- $.fn.datepicker.Constructor = Datepicker;
-
-}( window.jQuery )
\ No newline at end of file
+++ /dev/null
-/* ===================================================
- * bootstrap-transition.js v2.0.4
- * http://twitter.github.com/bootstrap/javascript.html#transitions
- * ===================================================
- * Copyright 2012 Twitter, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ========================================================== */
-
-
-!function ($) {
-
- $(function () {
-
- "use strict"; // jshint ;_;
-
-
- /* CSS TRANSITION SUPPORT (http://www.modernizr.com/)
- * ======================================================= */
-
- $.support.transition = (function () {
-
- var transitionEnd = (function () {
-
- var el = document.createElement('bootstrap')
- , transEndEventNames = {
- 'WebkitTransition' : 'webkitTransitionEnd'
- , 'MozTransition' : 'transitionend'
- , 'OTransition' : 'oTransitionEnd'
- , 'msTransition' : 'MSTransitionEnd'
- , 'transition' : 'transitionend'
- }
- , name
-
- for (name in transEndEventNames){
- if (el.style[name] !== undefined) {
- return transEndEventNames[name]
- }
- }
-
- }())
-
- return transitionEnd && {
- end: transitionEnd
- }
-
- })()
-
- })
-
-}(window.jQuery);/* ==========================================================
- * bootstrap-alert.js v2.0.4
- * http://twitter.github.com/bootstrap/javascript.html#alerts
- * ==========================================================
- * Copyright 2012 Twitter, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ========================================================== */
-
-
-!function ($) {
-
- "use strict"; // jshint ;_;
-
-
- /* ALERT CLASS DEFINITION
- * ====================== */
-
- var dismiss = '[data-dismiss="alert"]'
- , Alert = function (el) {
- $(el).on('click', dismiss, this.close)
- }
-
- Alert.prototype.close = function (e) {
- var $this = $(this)
- , selector = $this.attr('data-target')
- , $parent
-
- if (!selector) {
- selector = $this.attr('href')
- selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
- }
-
- $parent = $(selector)
-
- e && e.preventDefault()
-
- $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
-
- $parent.trigger(e = $.Event('close'))
-
- if (e.isDefaultPrevented()) return
-
- $parent.removeClass('in')
-
- function removeElement() {
- $parent
- .trigger('closed')
- .remove()
- }
-
- $.support.transition && $parent.hasClass('fade') ?
- $parent.on($.support.transition.end, removeElement) :
- removeElement()
- }
-
-
- /* ALERT PLUGIN DEFINITION
- * ======================= */
-
- $.fn.alert = function (option) {
- return this.each(function () {
- var $this = $(this)
- , data = $this.data('alert')
- if (!data) $this.data('alert', (data = new Alert(this)))
- if (typeof option == 'string') data[option].call($this)
- })
- }
-
- $.fn.alert.Constructor = Alert
-
-
- /* ALERT DATA-API
- * ============== */
-
- $(function () {
- $('body').on('click.alert.data-api', dismiss, Alert.prototype.close)
- })
-
-}(window.jQuery);/* ============================================================
- * bootstrap-button.js v2.0.4
- * http://twitter.github.com/bootstrap/javascript.html#buttons
- * ============================================================
- * Copyright 2012 Twitter, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============================================================ */
-
-
-!function ($) {
-
- "use strict"; // jshint ;_;
-
-
- /* BUTTON PUBLIC CLASS DEFINITION
- * ============================== */
-
- var Button = function (element, options) {
- this.$element = $(element)
- this.options = $.extend({}, $.fn.button.defaults, options)
- }
-
- Button.prototype.setState = function (state) {
- var d = 'disabled'
- , $el = this.$element
- , data = $el.data()
- , val = $el.is('input') ? 'val' : 'html'
-
- state = state + 'Text'
- data.resetText || $el.data('resetText', $el[val]())
-
- $el[val](data[state] || this.options[state])
-
- // push to event loop to allow forms to submit
- setTimeout(function () {
- state == 'loadingText' ?
- $el.addClass(d).attr(d, d) :
- $el.removeClass(d).removeAttr(d)
- }, 0)
- }
-
- Button.prototype.toggle = function () {
- var $parent = this.$element.parent('[data-toggle="buttons-radio"]')
-
- $parent && $parent
- .find('.active')
- .removeClass('active')
-
- this.$element.toggleClass('active')
- }
-
-
- /* BUTTON PLUGIN DEFINITION
- * ======================== */
-
- $.fn.button = function (option) {
- return this.each(function () {
- var $this = $(this)
- , data = $this.data('button')
- , options = typeof option == 'object' && option
- if (!data) $this.data('button', (data = new Button(this, options)))
- if (option == 'toggle') data.toggle()
- else if (option) data.setState(option)
- })
- }
-
- $.fn.button.defaults = {
- loadingText: 'loading...'
- }
-
- $.fn.button.Constructor = Button
-
-
- /* BUTTON DATA-API
- * =============== */
-
- $(function () {
- $('body').on('click.button.data-api', '[data-toggle^=button]', function ( e ) {
- var $btn = $(e.target)
- if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
- $btn.button('toggle')
- })
- })
-
-}(window.jQuery);/* ==========================================================
- * bootstrap-carousel.js v2.0.4
- * http://twitter.github.com/bootstrap/javascript.html#carousel
- * ==========================================================
- * Copyright 2012 Twitter, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ========================================================== */
-
-
-!function ($) {
-
- "use strict"; // jshint ;_;
-
-
- /* CAROUSEL CLASS DEFINITION
- * ========================= */
-
- var Carousel = function (element, options) {
- this.$element = $(element)
- this.options = options
- this.options.slide && this.slide(this.options.slide)
- this.options.pause == 'hover' && this.$element
- .on('mouseenter', $.proxy(this.pause, this))
- .on('mouseleave', $.proxy(this.cycle, this))
- }
-
- Carousel.prototype = {
-
- cycle: function (e) {
- if (!e) this.paused = false
- this.options.interval
- && !this.paused
- && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
- return this
- }
-
- , to: function (pos) {
- var $active = this.$element.find('.active')
- , children = $active.parent().children()
- , activePos = children.index($active)
- , that = this
-
- if (pos > (children.length - 1) || pos < 0) return
-
- if (this.sliding) {
- return this.$element.one('slid', function () {
- that.to(pos)
- })
- }
-
- if (activePos == pos) {
- return this.pause().cycle()
- }
-
- return this.slide(pos > activePos ? 'next' : 'prev', $(children[pos]))
- }
-
- , pause: function (e) {
- if (!e) this.paused = true
- clearInterval(this.interval)
- this.interval = null
- return this
- }
-
- , next: function () {
- if (this.sliding) return
- return this.slide('next')
- }
-
- , prev: function () {
- if (this.sliding) return
- return this.slide('prev')
- }
-
- , slide: function (type, next) {
- var $active = this.$element.find('.active')
- , $next = next || $active[type]()
- , isCycling = this.interval
- , direction = type == 'next' ? 'left' : 'right'
- , fallback = type == 'next' ? 'first' : 'last'
- , that = this
- , e = $.Event('slide')
-
- this.sliding = true
-
- isCycling && this.pause()
-
- $next = $next.length ? $next : this.$element.find('.item')[fallback]()
-
- if ($next.hasClass('active')) return
-
- if ($.support.transition && this.$element.hasClass('slide')) {
- this.$element.trigger(e)
- if (e.isDefaultPrevented()) return
- $next.addClass(type)
- $next[0].offsetWidth // force reflow
- $active.addClass(direction)
- $next.addClass(direction)
- this.$element.one($.support.transition.end, function () {
- $next.removeClass([type, direction].join(' ')).addClass('active')
- $active.removeClass(['active', direction].join(' '))
- that.sliding = false
- setTimeout(function () { that.$element.trigger('slid') }, 0)
- })
- } else {
- this.$element.trigger(e)
- if (e.isDefaultPrevented()) return
- $active.removeClass('active')
- $next.addClass('active')
- this.sliding = false
- this.$element.trigger('slid')
- }
-
- isCycling && this.cycle()
-
- return this
- }
-
- }
-
-
- /* CAROUSEL PLUGIN DEFINITION
- * ========================== */
-
- $.fn.carousel = function (option) {
- return this.each(function () {
- var $this = $(this)
- , data = $this.data('carousel')
- , options = $.extend({}, $.fn.carousel.defaults, typeof option == 'object' && option)
- if (!data) $this.data('carousel', (data = new Carousel(this, options)))
- if (typeof option == 'number') data.to(option)
- else if (typeof option == 'string' || (option = options.slide)) data[option]()
- else if (options.interval) data.cycle()
- })
- }
-
- $.fn.carousel.defaults = {
- interval: 5000
- , pause: 'hover'
- }
-
- $.fn.carousel.Constructor = Carousel
-
-
- /* CAROUSEL DATA-API
- * ================= */
-
- $(function () {
- $('body').on('click.carousel.data-api', '[data-slide]', function ( e ) {
- var $this = $(this), href
- , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
- , options = !$target.data('modal') && $.extend({}, $target.data(), $this.data())
- $target.carousel(options)
- e.preventDefault()
- })
- })
-
-}(window.jQuery);/* =============================================================
- * bootstrap-collapse.js v2.0.4
- * http://twitter.github.com/bootstrap/javascript.html#collapse
- * =============================================================
- * Copyright 2012 Twitter, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============================================================ */
-
-
-!function ($) {
-
- "use strict"; // jshint ;_;
-
-
- /* COLLAPSE PUBLIC CLASS DEFINITION
- * ================================ */
-
- var Collapse = function (element, options) {
- this.$element = $(element)
- this.options = $.extend({}, $.fn.collapse.defaults, options)
-
- if (this.options.parent) {
- this.$parent = $(this.options.parent)
- }
-
- this.options.toggle && this.toggle()
- }
-
- Collapse.prototype = {
-
- constructor: Collapse
-
- , dimension: function () {
- var hasWidth = this.$element.hasClass('width')
- return hasWidth ? 'width' : 'height'
- }
-
- , show: function () {
- var dimension
- , scroll
- , actives
- , hasData
-
- if (this.transitioning) return
-
- dimension = this.dimension()
- scroll = $.camelCase(['scroll', dimension].join('-'))
- actives = this.$parent && this.$parent.find('> .accordion-group > .in')
-
- if (actives && actives.length) {
- hasData = actives.data('collapse')
- if (hasData && hasData.transitioning) return
- actives.collapse('hide')
- hasData || actives.data('collapse', null)
- }
-
- this.$element[dimension](0)
- this.transition('addClass', $.Event('show'), 'shown')
- this.$element[dimension](this.$element[0][scroll])
- }
-
- , hide: function () {
- var dimension
- if (this.transitioning) return
- dimension = this.dimension()
- this.reset(this.$element[dimension]())
- this.transition('removeClass', $.Event('hide'), 'hidden')
- this.$element[dimension](0)
- }
-
- , reset: function (size) {
- var dimension = this.dimension()
-
- this.$element
- .removeClass('collapse')
- [dimension](size || 'auto')
- [0].offsetWidth
-
- this.$element[size !== null ? 'addClass' : 'removeClass']('collapse')
-
- return this
- }
-
- , transition: function (method, startEvent, completeEvent) {
- var that = this
- , complete = function () {
- if (startEvent.type == 'show') that.reset()
- that.transitioning = 0
- that.$element.trigger(completeEvent)
- }
-
- this.$element.trigger(startEvent)
-
- if (startEvent.isDefaultPrevented()) return
-
- this.transitioning = 1
-
- this.$element[method]('in')
-
- $.support.transition && this.$element.hasClass('collapse') ?
- this.$element.one($.support.transition.end, complete) :
- complete()
- }
-
- , toggle: function () {
- this[this.$element.hasClass('in') ? 'hide' : 'show']()
- }
-
- }
-
-
- /* COLLAPSIBLE PLUGIN DEFINITION
- * ============================== */
-
- $.fn.collapse = function (option) {
- return this.each(function () {
- var $this = $(this)
- , data = $this.data('collapse')
- , options = typeof option == 'object' && option
- if (!data) $this.data('collapse', (data = new Collapse(this, options)))
- if (typeof option == 'string') data[option]()
- })
- }
-
- $.fn.collapse.defaults = {
- toggle: true
- }
-
- $.fn.collapse.Constructor = Collapse
-
-
- /* COLLAPSIBLE DATA-API
- * ==================== */
-
- $(function () {
- $('body').on('click.collapse.data-api', '[data-toggle=collapse]', function ( e ) {
- var $this = $(this), href
- , target = $this.attr('data-target')
- || e.preventDefault()
- || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
- , option = $(target).data('collapse') ? 'toggle' : $this.data()
- $(target).collapse(option)
- })
- })
-
-}(window.jQuery);/* ============================================================
- * bootstrap-dropdown.js v2.0.4
- * http://twitter.github.com/bootstrap/javascript.html#dropdowns
- * ============================================================
- * Copyright 2012 Twitter, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============================================================ */
-
-
-!function ($) {
-
- "use strict"; // jshint ;_;
-
-
- /* DROPDOWN CLASS DEFINITION
- * ========================= */
-
- var toggle = '[data-toggle="dropdown"]'
- , Dropdown = function (element) {
- var $el = $(element).on('click.dropdown.data-api', this.toggle)
- $('html').on('click.dropdown.data-api', function () {
- $el.parent().removeClass('open')
- })
- }
-
- Dropdown.prototype = {
-
- constructor: Dropdown
-
- , toggle: function (e) {
- var $this = $(this)
- , $parent
- , selector
- , isActive
-
- if ($this.is('.disabled, :disabled')) return
-
- selector = $this.attr('data-target')
-
- if (!selector) {
- selector = $this.attr('href')
- selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
- }
-
- $parent = $(selector)
- $parent.length || ($parent = $this.parent())
-
- isActive = $parent.hasClass('open')
-
- clearMenus()
-
- if (!isActive) $parent.toggleClass('open')
-
- return false
- }
-
- }
-
- function clearMenus() {
- $(toggle).parent().removeClass('open')
- }
-
-
- /* DROPDOWN PLUGIN DEFINITION
- * ========================== */
-
- $.fn.dropdown = function (option) {
- return this.each(function () {
- var $this = $(this)
- , data = $this.data('dropdown')
- if (!data) $this.data('dropdown', (data = new Dropdown(this)))
- if (typeof option == 'string') data[option].call($this)
- })
- }
-
- $.fn.dropdown.Constructor = Dropdown
-
-
- /* APPLY TO STANDARD DROPDOWN ELEMENTS
- * =================================== */
-
- $(function () {
- $('html').on('click.dropdown.data-api', clearMenus)
- $('body')
- .on('click.dropdown', '.dropdown form', function (e) { e.stopPropagation() })
- .on('click.dropdown.data-api', toggle, Dropdown.prototype.toggle)
- })
-
-}(window.jQuery);/* =========================================================
- * bootstrap-modal.js v2.0.4
- * http://twitter.github.com/bootstrap/javascript.html#modals
- * =========================================================
- * Copyright 2012 Twitter, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ========================================================= */
-
-
-!function ($) {
-
- "use strict"; // jshint ;_;
-
-
- /* MODAL CLASS DEFINITION
- * ====================== */
-
- var Modal = function (content, options) {
- this.options = options
- this.$element = $(content)
- .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this))
- }
-
- Modal.prototype = {
-
- constructor: Modal
-
- , toggle: function () {
- return this[!this.isShown ? 'show' : 'hide']()
- }
-
- , show: function () {
- var that = this
- , e = $.Event('show')
-
- this.$element.trigger(e)
-
- if (this.isShown || e.isDefaultPrevented()) return
-
- $('body').addClass('modal-open')
-
- this.isShown = true
-
- escape.call(this)
- backdrop.call(this, function () {
- var transition = $.support.transition && that.$element.hasClass('fade')
-
- if (!that.$element.parent().length) {
- that.$element.appendTo(document.body) //don't move modals dom position
- }
-
- that.$element
- .show()
-
- if (transition) {
- that.$element[0].offsetWidth // force reflow
- }
-
- that.$element.addClass('in')
-
- transition ?
- that.$element.one($.support.transition.end, function () { that.$element.trigger('shown') }) :
- that.$element.trigger('shown')
-
- })
- }
-
- , hide: function (e) {
- e && e.preventDefault()
-
- var that = this
-
- e = $.Event('hide')
-
- this.$element.trigger(e)
-
- if (!this.isShown || e.isDefaultPrevented()) return
-
- this.isShown = false
-
- $('body').removeClass('modal-open')
-
- escape.call(this)
-
- this.$element.removeClass('in')
-
- $.support.transition && this.$element.hasClass('fade') ?
- hideWithTransition.call(this) :
- hideModal.call(this)
- }
-
- }
-
-
- /* MODAL PRIVATE METHODS
- * ===================== */
-
- function hideWithTransition() {
- var that = this
- , timeout = setTimeout(function () {
- that.$element.off($.support.transition.end)
- hideModal.call(that)
- }, 500)
-
- this.$element.one($.support.transition.end, function () {
- clearTimeout(timeout)
- hideModal.call(that)
- })
- }
-
- function hideModal(that) {
- this.$element
- .hide()
- .trigger('hidden')
-
- backdrop.call(this)
- }
-
- function backdrop(callback) {
- var that = this
- , animate = this.$element.hasClass('fade') ? 'fade' : ''
-
- if (this.isShown && this.options.backdrop) {
- var doAnimate = $.support.transition && animate
-
- this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
- .appendTo(document.body)
-
- if (this.options.backdrop != 'static') {
- this.$backdrop.click($.proxy(this.hide, this))
- }
-
- if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
-
- this.$backdrop.addClass('in')
-
- doAnimate ?
- this.$backdrop.one($.support.transition.end, callback) :
- callback()
-
- } else if (!this.isShown && this.$backdrop) {
- this.$backdrop.removeClass('in')
-
- $.support.transition && this.$element.hasClass('fade')?
- this.$backdrop.one($.support.transition.end, $.proxy(removeBackdrop, this)) :
- removeBackdrop.call(this)
-
- } else if (callback) {
- callback()
- }
- }
-
- function removeBackdrop() {
- this.$backdrop.remove()
- this.$backdrop = null
- }
-
- function escape() {
- var that = this
- if (this.isShown && this.options.keyboard) {
- $(document).on('keyup.dismiss.modal', function ( e ) {
- e.which == 27 && that.hide()
- })
- } else if (!this.isShown) {
- $(document).off('keyup.dismiss.modal')
- }
- }
-
-
- /* MODAL PLUGIN DEFINITION
- * ======================= */
-
- $.fn.modal = function (option) {
- return this.each(function () {
- var $this = $(this)
- , data = $this.data('modal')
- , options = $.extend({}, $.fn.modal.defaults, $this.data(), typeof option == 'object' && option)
- if (!data) $this.data('modal', (data = new Modal(this, options)))
- if (typeof option == 'string') data[option]()
- else if (options.show) data.show()
- })
- }
-
- $.fn.modal.defaults = {
- backdrop: true
- , keyboard: true
- , show: true
- }
-
- $.fn.modal.Constructor = Modal
-
-
- /* MODAL DATA-API
- * ============== */
-
- $(function () {
- $('body').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) {
- var $this = $(this), href
- , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
- , option = $target.data('modal') ? 'toggle' : $.extend({}, $target.data(), $this.data())
-
- e.preventDefault()
- $target.modal(option)
- })
- })
-
-}(window.jQuery);/* ===========================================================
- * bootstrap-tooltip.js v2.0.4
- * http://twitter.github.com/bootstrap/javascript.html#tooltips
- * Inspired by the original jQuery.tipsy by Jason Frame
- * ===========================================================
- * Copyright 2012 Twitter, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ========================================================== */
-
-
-!function ($) {
-
- "use strict"; // jshint ;_;
-
-
- /* TOOLTIP PUBLIC CLASS DEFINITION
- * =============================== */
-
- var Tooltip = function (element, options) {
- this.init('tooltip', element, options)
- }
-
- Tooltip.prototype = {
-
- constructor: Tooltip
-
- , init: function (type, element, options) {
- var eventIn
- , eventOut
-
- this.type = type
- this.$element = $(element)
- this.options = this.getOptions(options)
- this.enabled = true
-
- if (this.options.trigger != 'manual') {
- eventIn = this.options.trigger == 'hover' ? 'mouseenter' : 'focus'
- eventOut = this.options.trigger == 'hover' ? 'mouseleave' : 'blur'
- this.$element.on(eventIn, this.options.selector, $.proxy(this.enter, this))
- this.$element.on(eventOut, this.options.selector, $.proxy(this.leave, this))
- }
-
- this.options.selector ?
- (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
- this.fixTitle()
- }
-
- , getOptions: function (options) {
- options = $.extend({}, $.fn[this.type].defaults, options, this.$element.data())
-
- if (options.delay && typeof options.delay == 'number') {
- options.delay = {
- show: options.delay
- , hide: options.delay
- }
- }
-
- return options
- }
-
- , enter: function (e) {
- var self = $(e.currentTarget)[this.type](this._options).data(this.type)
-
- if (!self.options.delay || !self.options.delay.show) return self.show()
-
- clearTimeout(this.timeout)
- self.hoverState = 'in'
- this.timeout = setTimeout(function() {
- if (self.hoverState == 'in') self.show()
- }, self.options.delay.show)
- }
-
- , leave: function (e) {
- var self = $(e.currentTarget)[this.type](this._options).data(this.type)
-
- if (this.timeout) clearTimeout(this.timeout)
- if (!self.options.delay || !self.options.delay.hide) return self.hide()
-
- self.hoverState = 'out'
- this.timeout = setTimeout(function() {
- if (self.hoverState == 'out') self.hide()
- }, self.options.delay.hide)
- }
-
- , show: function () {
- var $tip
- , inside
- , pos
- , actualWidth
- , actualHeight
- , placement
- , tp
-
- if (this.hasContent() && this.enabled) {
- $tip = this.tip()
- this.setContent()
-
- if (this.options.animation) {
- $tip.addClass('fade')
- }
-
- placement = typeof this.options.placement == 'function' ?
- this.options.placement.call(this, $tip[0], this.$element[0]) :
- this.options.placement
-
- inside = /in/.test(placement)
-
- $tip
- .remove()
- .css({ top: 0, left: 0, display: 'block' })
- .appendTo(inside ? this.$element : document.body)
-
- pos = this.getPosition(inside)
-
- actualWidth = $tip[0].offsetWidth
- actualHeight = $tip[0].offsetHeight
-
- switch (inside ? placement.split(' ')[1] : placement) {
- case 'bottom':
- tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2}
- break
- case 'top':
- tp = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2}
- break
- case 'left':
- tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth}
- break
- case 'right':
- tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width}
- break
- }
-
- $tip
- .css(tp)
- .addClass(placement)
- .addClass('in')
- }
- }
-
- , isHTML: function(text) {
- // html string detection logic adapted from jQuery
- return typeof text != 'string'
- || ( text.charAt(0) === "<"
- && text.charAt( text.length - 1 ) === ">"
- && text.length >= 3
- ) || /^(?:[^<]*<[\w\W]+>[^>]*$)/.exec(text)
- }
-
- , setContent: function () {
- var $tip = this.tip()
- , title = this.getTitle()
-
- $tip.find('.tooltip-inner')[this.isHTML(title) ? 'html' : 'text'](title)
- $tip.removeClass('fade in top bottom left right')
- }
-
- , hide: function () {
- var that = this
- , $tip = this.tip()
-
- $tip.removeClass('in')
-
- function removeWithAnimation() {
- var timeout = setTimeout(function () {
- $tip.off($.support.transition.end).remove()
- }, 500)
-
- $tip.one($.support.transition.end, function () {
- clearTimeout(timeout)
- $tip.remove()
- })
- }
-
- $.support.transition && this.$tip.hasClass('fade') ?
- removeWithAnimation() :
- $tip.remove()
- }
-
- , fixTitle: function () {
- var $e = this.$element
- if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
- $e.attr('data-original-title', $e.attr('title') || '').removeAttr('title')
- }
- }
-
- , hasContent: function () {
- return this.getTitle()
- }
-
- , getPosition: function (inside) {
- return $.extend({}, (inside ? {top: 0, left: 0} : this.$element.offset()), {
- width: this.$element[0].offsetWidth
- , height: this.$element[0].offsetHeight
- })
- }
-
- , getTitle: function () {
- var title
- , $e = this.$element
- , o = this.options
-
- title = $e.attr('data-original-title')
- || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
-
- return title
- }
-
- , tip: function () {
- return this.$tip = this.$tip || $(this.options.template)
- }
-
- , validate: function () {
- if (!this.$element[0].parentNode) {
- this.hide()
- this.$element = null
- this.options = null
- }
- }
-
- , enable: function () {
- this.enabled = true
- }
-
- , disable: function () {
- this.enabled = false
- }
-
- , toggleEnabled: function () {
- this.enabled = !this.enabled
- }
-
- , toggle: function () {
- this[this.tip().hasClass('in') ? 'hide' : 'show']()
- }
-
- }
-
-
- /* TOOLTIP PLUGIN DEFINITION
- * ========================= */
-
- $.fn.tooltip = function ( option ) {
- return this.each(function () {
- var $this = $(this)
- , data = $this.data('tooltip')
- , options = typeof option == 'object' && option
- if (!data) $this.data('tooltip', (data = new Tooltip(this, options)))
- if (typeof option == 'string') data[option]()
- })
- }
-
- $.fn.tooltip.Constructor = Tooltip
-
- $.fn.tooltip.defaults = {
- animation: true
- , placement: 'top'
- , selector: false
- , template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
- , trigger: 'hover'
- , title: ''
- , delay: 0
- }
-
-}(window.jQuery);
-/* ===========================================================
- * bootstrap-popover.js v2.0.4
- * http://twitter.github.com/bootstrap/javascript.html#popovers
- * ===========================================================
- * Copyright 2012 Twitter, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * =========================================================== */
-
-
-!function ($) {
-
- "use strict"; // jshint ;_;
-
-
- /* POPOVER PUBLIC CLASS DEFINITION
- * =============================== */
-
- var Popover = function ( element, options ) {
- this.init('popover', element, options)
- }
-
-
- /* NOTE: POPOVER EXTENDS BOOTSTRAP-TOOLTIP.js
- ========================================== */
-
- Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype, {
-
- constructor: Popover
-
- , setContent: function () {
- var $tip = this.tip()
- , title = this.getTitle()
- , content = this.getContent()
-
- $tip.find('.popover-title')[this.isHTML(title) ? 'html' : 'text'](title)
- $tip.find('.popover-content > *')[this.isHTML(content) ? 'html' : 'text'](content)
-
- $tip.removeClass('fade top bottom left right in')
- }
-
- , hasContent: function () {
- return this.getTitle() || this.getContent()
- }
-
- , getContent: function () {
- var content
- , $e = this.$element
- , o = this.options
-
- content = $e.attr('data-content')
- || (typeof o.content == 'function' ? o.content.call($e[0]) : o.content)
-
- return content
- }
-
- , tip: function () {
- if (!this.$tip) {
- this.$tip = $(this.options.template)
- }
- return this.$tip
- }
-
- })
-
-
- /* POPOVER PLUGIN DEFINITION
- * ======================= */
-
- $.fn.popover = function (option) {
- return this.each(function () {
- var $this = $(this)
- , data = $this.data('popover')
- , options = typeof option == 'object' && option
- if (!data) $this.data('popover', (data = new Popover(this, options)))
- if (typeof option == 'string') data[option]()
- })
- }
-
- $.fn.popover.Constructor = Popover
-
- $.fn.popover.defaults = $.extend({} , $.fn.tooltip.defaults, {
- placement: 'right'
- , content: ''
- , template: '<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>'
- })
-
-}(window.jQuery);/* =============================================================
- * bootstrap-scrollspy.js v2.0.4
- * http://twitter.github.com/bootstrap/javascript.html#scrollspy
- * =============================================================
- * Copyright 2012 Twitter, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============================================================== */
-
-
-!function ($) {
-
- "use strict"; // jshint ;_;
-
-
- /* SCROLLSPY CLASS DEFINITION
- * ========================== */
-
- function ScrollSpy( element, options) {
- var process = $.proxy(this.process, this)
- , $element = $(element).is('body') ? $(window) : $(element)
- , href
- this.options = $.extend({}, $.fn.scrollspy.defaults, options)
- this.$scrollElement = $element.on('scroll.scroll.data-api', process)
- this.selector = (this.options.target
- || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
- || '') + ' .nav li > a'
- this.$body = $('body')
- this.refresh()
- this.process()
- }
-
- ScrollSpy.prototype = {
-
- constructor: ScrollSpy
-
- , refresh: function () {
- var self = this
- , $targets
-
- this.offsets = $([])
- this.targets = $([])
-
- $targets = this.$body
- .find(this.selector)
- .map(function () {
- var $el = $(this)
- , href = $el.data('target') || $el.attr('href')
- , $href = /^#\w/.test(href) && $(href)
- return ( $href
- && href.length
- && [[ $href.position().top, href ]] ) || null
- })
- .sort(function (a, b) { return a[0] - b[0] })
- .each(function () {
- self.offsets.push(this[0])
- self.targets.push(this[1])
- })
- }
-
- , process: function () {
- var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
- , scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight
- , maxScroll = scrollHeight - this.$scrollElement.height()
- , offsets = this.offsets
- , targets = this.targets
- , activeTarget = this.activeTarget
- , i
-
- if (scrollTop >= maxScroll) {
- return activeTarget != (i = targets.last()[0])
- && this.activate ( i )
- }
-
- for (i = offsets.length; i--;) {
- activeTarget != targets[i]
- && scrollTop >= offsets[i]
- && (!offsets[i + 1] || scrollTop <= offsets[i + 1])
- && this.activate( targets[i] )
- }
- }
-
- , activate: function (target) {
- var active
- , selector
-
- this.activeTarget = target
-
- $(this.selector)
- .parent('.active')
- .removeClass('active')
-
- selector = this.selector
- + '[data-target="' + target + '"],'
- + this.selector + '[href="' + target + '"]'
-
- active = $(selector)
- .parent('li')
- .addClass('active')
-
- if (active.parent('.dropdown-menu')) {
- active = active.closest('li.dropdown').addClass('active')
- }
-
- active.trigger('activate')
- }
-
- }
-
-
- /* SCROLLSPY PLUGIN DEFINITION
- * =========================== */
-
- $.fn.scrollspy = function ( option ) {
- return this.each(function () {
- var $this = $(this)
- , data = $this.data('scrollspy')
- , options = typeof option == 'object' && option
- if (!data) $this.data('scrollspy', (data = new ScrollSpy(this, options)))
- if (typeof option == 'string') data[option]()
- })
- }
-
- $.fn.scrollspy.Constructor = ScrollSpy
-
- $.fn.scrollspy.defaults = {
- offset: 10
- }
-
-
- /* SCROLLSPY DATA-API
- * ================== */
-
- $(function () {
- $('[data-spy="scroll"]').each(function () {
- var $spy = $(this)
- $spy.scrollspy($spy.data())
- })
- })
-
-}(window.jQuery);/* ========================================================
- * bootstrap-tab.js v2.0.4
- * http://twitter.github.com/bootstrap/javascript.html#tabs
- * ========================================================
- * Copyright 2012 Twitter, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ======================================================== */
-
-
-!function ($) {
-
- "use strict"; // jshint ;_;
-
-
- /* TAB CLASS DEFINITION
- * ==================== */
-
- var Tab = function ( element ) {
- this.element = $(element)
- }
-
- Tab.prototype = {
-
- constructor: Tab
-
- , show: function () {
- var $this = this.element
- , $ul = $this.closest('ul:not(.dropdown-menu)')
- , selector = $this.attr('data-target')
- , previous
- , $target
- , e
-
- if (!selector) {
- selector = $this.attr('href')
- selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
- }
-
- if ( $this.parent('li').hasClass('active') ) return
-
- previous = $ul.find('.active a').last()[0]
-
- e = $.Event('show', {
- relatedTarget: previous
- })
-
- $this.trigger(e)
-
- if (e.isDefaultPrevented()) return
-
- $target = $(selector)
-
- this.activate($this.parent('li'), $ul)
- this.activate($target, $target.parent(), function () {
- $this.trigger({
- type: 'shown'
- , relatedTarget: previous
- })
- })
- }
-
- , activate: function ( element, container, callback) {
- var $active = container.find('> .active')
- , transition = callback
- && $.support.transition
- && $active.hasClass('fade')
-
- function next() {
- $active
- .removeClass('active')
- .find('> .dropdown-menu > .active')
- .removeClass('active')
-
- element.addClass('active')
-
- if (transition) {
- element[0].offsetWidth // reflow for transition
- element.addClass('in')
- } else {
- element.removeClass('fade')
- }
-
- if ( element.parent('.dropdown-menu') ) {
- element.closest('li.dropdown').addClass('active')
- }
-
- callback && callback()
- }
-
- transition ?
- $active.one($.support.transition.end, next) :
- next()
-
- $active.removeClass('in')
- }
- }
-
-
- /* TAB PLUGIN DEFINITION
- * ===================== */
-
- $.fn.tab = function ( option ) {
- return this.each(function () {
- var $this = $(this)
- , data = $this.data('tab')
- if (!data) $this.data('tab', (data = new Tab(this)))
- if (typeof option == 'string') data[option]()
- })
- }
-
- $.fn.tab.Constructor = Tab
-
-
- /* TAB DATA-API
- * ============ */
-
- $(function () {
- $('body').on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
- e.preventDefault()
- $(this).tab('show')
- })
- })
-
-}(window.jQuery);/* =============================================================
- * bootstrap-typeahead.js v2.0.4
- * http://twitter.github.com/bootstrap/javascript.html#typeahead
- * =============================================================
- * Copyright 2012 Twitter, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============================================================ */
-
-
-!function($){
-
- "use strict"; // jshint ;_;
-
-
- /* TYPEAHEAD PUBLIC CLASS DEFINITION
- * ================================= */
-
- var Typeahead = function (element, options) {
- this.$element = $(element)
- this.options = $.extend({}, $.fn.typeahead.defaults, options)
- this.matcher = this.options.matcher || this.matcher
- this.sorter = this.options.sorter || this.sorter
- this.highlighter = this.options.highlighter || this.highlighter
- this.updater = this.options.updater || this.updater
- this.$menu = $(this.options.menu).appendTo('body')
- this.source = this.options.source
- this.shown = false
- this.listen()
- }
-
- Typeahead.prototype = {
-
- constructor: Typeahead
-
- , select: function () {
- var val = this.$menu.find('.active').attr('data-value')
- this.$element
- .val(this.updater(val))
- .change()
- return this.hide()
- }
-
- , updater: function (item) {
- return item
- }
-
- , show: function () {
- var pos = $.extend({}, this.$element.offset(), {
- height: this.$element[0].offsetHeight
- })
-
- this.$menu.css({
- top: pos.top + pos.height
- , left: pos.left
- })
-
- this.$menu.show()
- this.shown = true
- return this
- }
-
- , hide: function () {
- this.$menu.hide()
- this.shown = false
- return this
- }
-
- , lookup: function (event) {
- var that = this
- , items
- , q
-
- this.query = this.$element.val()
-
- if (!this.query) {
- return this.shown ? this.hide() : this
- }
-
- items = $.grep(this.source, function (item) {
- return that.matcher(item)
- })
-
- items = this.sorter(items)
-
- if (!items.length) {
- return this.shown ? this.hide() : this
- }
-
- return this.render(items.slice(0, this.options.items)).show()
- }
-
- , matcher: function (item) {
- return ~item.toLowerCase().indexOf(this.query.toLowerCase())
- }
-
- , sorter: function (items) {
- var beginswith = []
- , caseSensitive = []
- , caseInsensitive = []
- , item
-
- while (item = items.shift()) {
- if (!item.toLowerCase().indexOf(this.query.toLowerCase())) beginswith.push(item)
- else if (~item.indexOf(this.query)) caseSensitive.push(item)
- else caseInsensitive.push(item)
- }
-
- return beginswith.concat(caseSensitive, caseInsensitive)
- }
-
- , highlighter: function (item) {
- var query = this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, '\\$&')
- return item.replace(new RegExp('(' + query + ')', 'ig'), function ($1, match) {
- return '<strong>' + match + '</strong>'
- })
- }
-
- , render: function (items) {
- var that = this
-
- items = $(items).map(function (i, item) {
- i = $(that.options.item).attr('data-value', item)
- i.find('a').html(that.highlighter(item))
- return i[0]
- })
-
- items.first().addClass('active')
- this.$menu.html(items)
- return this
- }
-
- , next: function (event) {
- var active = this.$menu.find('.active').removeClass('active')
- , next = active.next()
-
- if (!next.length) {
- next = $(this.$menu.find('li')[0])
- }
-
- next.addClass('active')
- }
-
- , prev: function (event) {
- var active = this.$menu.find('.active').removeClass('active')
- , prev = active.prev()
-
- if (!prev.length) {
- prev = this.$menu.find('li').last()
- }
-
- prev.addClass('active')
- }
-
- , listen: function () {
- this.$element
- .on('blur', $.proxy(this.blur, this))
- .on('keypress', $.proxy(this.keypress, this))
- .on('keyup', $.proxy(this.keyup, this))
-
- if ($.browser.webkit || $.browser.msie) {
- this.$element.on('keydown', $.proxy(this.keypress, this))
- }
-
- this.$menu
- .on('click', $.proxy(this.click, this))
- .on('mouseenter', 'li', $.proxy(this.mouseenter, this))
- }
-
- , keyup: function (e) {
- switch(e.keyCode) {
- case 40: // down arrow
- case 38: // up arrow
- break
-
- case 9: // tab
- case 13: // enter
- if (!this.shown) return
- this.select()
- break
-
- case 27: // escape
- if (!this.shown) return
- this.hide()
- break
-
- default:
- this.lookup()
- }
-
- e.stopPropagation()
- e.preventDefault()
- }
-
- , keypress: function (e) {
- if (!this.shown) return
-
- switch(e.keyCode) {
- case 9: // tab
- case 13: // enter
- case 27: // escape
- e.preventDefault()
- break
-
- case 38: // up arrow
- if (e.type != 'keydown') break
- e.preventDefault()
- this.prev()
- break
-
- case 40: // down arrow
- if (e.type != 'keydown') break
- e.preventDefault()
- this.next()
- break
- }
-
- e.stopPropagation()
- }
-
- , blur: function (e) {
- var that = this
- setTimeout(function () { that.hide() }, 150)
- }
-
- , click: function (e) {
- e.stopPropagation()
- e.preventDefault()
- this.select()
- }
-
- , mouseenter: function (e) {
- this.$menu.find('.active').removeClass('active')
- $(e.currentTarget).addClass('active')
- }
-
- }
-
-
- /* TYPEAHEAD PLUGIN DEFINITION
- * =========================== */
-
- $.fn.typeahead = function (option) {
- return this.each(function () {
- var $this = $(this)
- , data = $this.data('typeahead')
- , options = typeof option == 'object' && option
- if (!data) $this.data('typeahead', (data = new Typeahead(this, options)))
- if (typeof option == 'string') data[option]()
- })
- }
-
- $.fn.typeahead.defaults = {
- source: []
- , items: 8
- , menu: '<ul class="typeahead dropdown-menu"></ul>'
- , item: '<li><a href="#"></a></li>'
- }
-
- $.fn.typeahead.Constructor = Typeahead
-
-
- /* TYPEAHEAD DATA-API
- * ================== */
-
- $(function () {
- $('body').on('focus.typeahead.data-api', '[data-provide="typeahead"]', function (e) {
- var $this = $(this)
- if ($this.data('typeahead')) return
- e.preventDefault()
- $this.typeahead($this.data())
- })
- })
-
-}(window.jQuery);
\ No newline at end of file
+++ /dev/null
-require.config( {\r
- paths: {\r
- jquery: '/js/jquery',\r
- mustache: '/js/mustache.js',\r
- underscore: '/js/underscore',\r
- backbone: '/js/backbone',\r
- bootstrap: '/js/bootstrap',\r
- codeview: '/js/codeview',\r
- main: '/js/main',\r
- mvc: '/js/mvc'\r
- }\r
-} );\r
-\r
-\r
+++ /dev/null
-( function() {\r
- NodeType = {\r
- ELEMENT_NODE: 1,\r
- ATTRIBUTE_NODE: 2,\r
- TEXT_NODE: 3,\r
- CDATA_SECTION_NODE: 4,\r
- ENTITY_REFERENCE_NODE: 5,\r
- ENTITY_NODE: 6,\r
- PROCESSING_INSTRUCTION_NODE: 7,\r
- COMMENT_NODE: 8,\r
- DOCUMENT_NODE: 9,\r
- DOCUMENT_TYPE_NODE: 10,\r
- DOCUMENT_FRAGMENT_NODE: 11,\r
- NOTATION_NODE: 12\r
- };\r
- \r
- Part = Model.extend( { } );\r
- \r
- PartView = View.extend( {\r
- modelType : Part,\r
- canHandle :function( target ) {\r
- return target.constructor == this.modelType;\r
- }\r
- } );\r
- \r
- Paragraph = Part.extend( {\r
- \r
- } );\r
- \r
- ParagraphView = PartView.extend( {\r
- \r
- className: 'paragraph part',\r
- \r
- initialize: function() {\r
- this.modelType = Paragraph;\r
- },\r
- \r
- render: function() {\r
- $( this.el ).html( "Hello, World<b>Hello</b>, World<br>" );\r
- return this;\r
- },\r
- \r
- selectionChanged: function() {\r
- console.log( "Selection changed" );\r
- }\r
- } );\r
- \r
- Factory = Model.extend( {\r
- \r
- model2view: {},\r
- \r
- register: function( modelType, viewType ) {\r
- this.model2view[modelType] = viewType;\r
- },\r
- \r
- create: function( model ) {\r
- modelType = _.find( _.keys( this.model2view ), function( candidate ) {\r
- return model.constructor == candidate;\r
- } );\r
- console.log( "Model :" + modelType );\r
- \r
- view = this.model2view[modelType];\r
- if ( view ) {\r
- return new view( { model: model } );\r
- }\r
- }\r
- } );\r
- \r
- ToolbarIcon = Model.extend( {\r
- state: 'deactive',\r
- getSelection: function() {\r
- toolbar = this.get( 'toolbar' );\r
- if ( toolbar ) {\r
- editor = toolbar.getEditor();\r
- return editor.getSelection();\r
- }\r
- }\r
- \r
- } );\r
- \r
- ToolbarIconView = View.extend( {\r
- \r
- className: 'toolbaricon',\r
- \r
- initialize: function() {\r
- $( this.el ).addClass( this.model.className );\r
- }\r
- \r
- } );\r
- \r
- Bold = ToolbarIcon.extend( {\r
- \r
- className: 'bold',\r
- \r
- toggle: function() {\r
- \r
- var old = this.state;\r
- \r
- this.state = ('active'==this.state)?'deactive':'active';\r
- \r
- return old;\r
- },\r
- \r
- createView: function() {\r
- return new BoldView( { model: this } );\r
- },\r
- \r
- /*\r
- * State\r
- * -1 : End\r
- * 1 : Bold\r
- * 2 : Normal\r
- */\r
- iterate: function( node, target, range ) {\r
- \r
- if ( $( node ).hasClass( 'part' ) ) {\r
- return true;\r
- }\r
- if ( _.any( range, function( element ) { return node == element; } ) ) {\r
- return false;\r
- }\r
- \r
- range.push( node );\r
- console.log( "Push :" + node + "(" + ( node.nodeValue?node.nodeValue:node.nodeName ) + ")" );\r
- \r
- if ( node == target ) {\r
- console.log( "Find target :" + target );\r
- return true;\r
- }\r
- \r
- if ( node.childNodes && 0 < node.childNodes.length ) {\r
- if ( this.push( node.childNodes[0], target, range ) ) {\r
- return true;\r
- }\r
- }\r
- if ( node.nextSibling ) {\r
- if ( this.push( node.nextSibling, target, range ) ) {\r
- return true;\r
- }\r
- }\r
- return this.push( node.parentNode, target, range );\r
- },\r
-\r
- \r
- selectionChanged: function( range ) {\r
- console.log( "Range :" + range );\r
- \r
-// map = {};\r
-// this.iterate( range.startContainer, range.endContainer, map );\r
-// \r
-// console.log( "State :" + state );\r
- }\r
- } );\r
- \r
- BoldView = ToolbarIconView.extend( {\r
- tagName: 'button',\r
- \r
- events: { "click" : "select" },\r
- \r
- initialize: function() {\r
- $( this.el ).addClass( this.model.className );\r
- },\r
- \r
- select: function( e ) {\r
- $( this.el ).removeClass( this.model.toggle() );\r
- $( this.el ).addClass( this.model.state );\r
- \r
- editor = this.model.get( 'toolbar' ).getEditor();\r
- editor.wrap( $( '<b></b>' ) );\r
- \r
- }\r
- } );\r
- \r
- Image = ToolbarIcon.extend( {\r
- className: 'picture',\r
- \r
- createView: function() {\r
- return new ImageView( { model: this } );\r
- },\r
-\r
- selectionChanged: function( range ) {\r
- console.log( "Range :" + range );\r
- }\r
- } );\r
- \r
- ImageView = ToolbarIconView.extend( {\r
- tagName: 'button',\r
- \r
- events: { "click": "select" },\r
- \r
- initialize: function() {\r
- $( this.el ).addClass( this.model.className );\r
- },\r
- \r
- select: function( e ) {\r
- selection = new ImageSelection();\r
- dialog = new ImageSelectionView( { model: selection } );\r
- dialog.open();\r
- }\r
- } );\r
- \r
- ImageSelection = Model.extend( {\r
- \r
- } );\r
- ImageSelectionView = View.extend( {\r
- templateId: "#image-selection-dialog",\r
- defaultTemplate:\r
- '<div class="modal hide fade" id="test">' +\r
- '<div class="modal-header">' + \r
- '<button type="button" class="close" data-dismiss="modal" >×</button>' +\r
- '<h2>Select file to review...</h2>' +\r
- '<div id="path">' +\r
- '</div>' +\r
- '</div>' +\r
- '<div class="modal-body">' +\r
- '<div id="directory"></div>' +\r
- '</div>' +\r
- '<div class="modal-footer">' +\r
- '<a href="#" class="btn" data-dismiss="modal">Cancel</a>' +\r
- '<a href="#" class="btn btn-primary">Process to review</a>' +\r
- '</div>' +\r
- '</div>',\r
- initialize: function() {\r
- _.bindAll( this, "close" );\r
-\r
- this.el = this.template( this.model );\r
- this.$el = $( this.el );\r
- $( "body" ).append( this.$el );\r
- },\r
- open: function() {\r
- this.$el.modal();\r
- this.$el.on( 'hidden', this.close );\r
- },\r
- close: function() {\r
- this.$el.remove();\r
- }\r
- } );\r
- \r
- EditorToolbar = Collection.extend( {\r
- \r
- setEditor: function( editor ) {\r
- if ( this.editor ) {\r
- this.editor.removeSelectionChangeListener( this );\r
- }\r
- \r
- this.editor = editor;\r
- \r
- if ( this.editor ) {\r
- this.editor.addSelectionChangeListener( this );\r
- }\r
- \r
- },\r
- \r
- getEditor: function() {\r
- return this.editor;\r
- },\r
- \r
- selectionChanged: function( range ) {\r
- this.each( function( toolbarIcon ) {\r
- toolbarIcon.selectionChanged( range );\r
- } );\r
- }\r
- \r
- } );\r
- \r
- EditorToolbarView = View.extend( {\r
- \r
- className: 'toolbar',\r
- \r
- model2view: {},\r
- \r
- initialize: function() {\r
- \r
- this.collection.bind( 'reset', this.render, this );\r
- this.collection.bind( 'add', this.add, this );\r
- this.collection.bind( 'remove', this.remove, this );\r
- \r
- this.collection.add( new Bold( { toolbar: this.collection } ) );\r
- this.collection.add( new Image( { toolbar: this.collection } ) );\r
- },\r
- \r
- add: function( model ) {\r
- \r
- var view = model.createView();\r
- \r
- if ( view ) {\r
- $( this.el ).append( $( view.render().el ) );\r
- this.model2view[model] = view;\r
- }\r
- },\r
- \r
- render: function() {\r
- \r
- $( this.el ).empty();\r
- \r
- this.collection.each( this.add, this );\r
- \r
- return this;\r
- }\r
- \r
- } );\r
-\r
- /* Editor */\r
- Editor = Collection.extend( {\r
- model: Part,\r
-\r
- wrap: function( insertTag ) {\r
- if ( document.selection ) {\r
- var textRange = document.selection.createRange();\r
-\r
- var selectionStart = this.getTextRangeBoundaryPosition( textRange, true );\r
- \r
- console.log( "Selection start :" + selectionStart );\r
- } else if ( document.getSelection ) {\r
- var selection = document.getSelection();\r
- if ( selection.rangeCount ) {\r
- for ( var i = 0, len = selection.rangeCount ; i < len ; ++i ) {\r
- var range = selection.getRangeAt( i );\r
- console.log( 'Contents :' + this.toString( range ) );\r
- \r
- if ( range.startContainer == range.endContainer ) {\r
- console.log( 'Simple case' );\r
- container = range.startContainer;\r
- console.log( 'Container Type :' + container.nodeType );\r
- \r
- if ( NodeType.TEXT_NODE == container.nodeType ) {\r
- str = container.nodeValue;\r
- $( container ).replaceWith( str.substring( 0, range.startOffset ) + insertTag.text( str.substring( range.startOffset, range.endOffset ) ).html() + str.substring( range.endOffset ) );\r
- } else {\r
- startOffset = 0;\r
- for ( var i = 0 ; i < range.startOffset ; ++i ) {\r
- console.log( 'Node Type :' + iter );\r
- }\r
- }\r
- \r
- } else {\r
- \r
- \r
- }\r
- start = $( range.startContainer );\r
- end = $( range.endContainer );\r
- \r
- }\r
- }\r
- }\r
- },\r
- \r
- removeSelectionChangeListener: function( listener ) {\r
- if ( this.listeners ) {\r
- this.listeners = _.reject( this.listeners, function( candidate ) { return candidate == listener; } );\r
- }\r
- },\r
- \r
- addSelectionChangeListener: function( listener ) {\r
- if ( !this.listeners ) {\r
- this.listeners = [];\r
- }\r
- \r
- this.listeners.push( listener );\r
- \r
- },\r
- \r
- push: function( node, target, range ) {\r
- if ( $( node ).hasClass( 'part' ) ) {\r
- return true;\r
- }\r
- if ( _.any( range, function( element ) { return node == element; } ) ) {\r
- return false;\r
- }\r
- \r
- range.push( node );\r
- console.log( "Push :" + node + "(" + ( node.nodeValue?node.nodeValue:node.nodeName ) + ")" );\r
- \r
- if ( node == target ) {\r
- console.log( "Find target :" + target );\r
- return true;\r
- }\r
- \r
- if ( node.childNodes && 0 < node.childNodes.length ) {\r
- if ( this.push( node.childNodes[0], target, range ) ) {\r
- return true;\r
- }\r
- }\r
- if ( node.nextSibling ) {\r
- if ( this.push( node.nextSibling, target, range ) ) {\r
- return true;\r
- }\r
- }\r
- return this.push( node.parentNode, target, range );\r
- },\r
- \r
-\r
- /*\r
- * 선택된 영역을 해석한다.\r
- */\r
- selectionChanged: function( selection ) {\r
- console.log( "Selection changed" );\r
- \r
- if ( !selection.rangeCount ) {\r
- return ;\r
- }\r
- \r
- for ( var i = 0, len = selection.rangeCount ; i < len ; ++i ) {\r
- var range = selection.getRangeAt( i );\r
- console.log( 'Contents :' + this.toString( range ) );\r
- \r
- container = range.startContainer;\r
- console.log( 'Container Type :' + container.nodeType );\r
- \r
-// iter = range.startContainer;\r
-// path = [];\r
-// \r
-// this.push( range.startContainer, range.endContainer, path );\r
- _.each( this.listeners, function( listener ) {\r
- listener.selectionChanged( range );\r
- } );\r
- \r
- }\r
- },\r
- \r
- toString: function( range ) {\r
- return range + '<' + range.startContainer + '(' + range.startOffset + ')-' + range.endContainer + '(' + range.endOffset + ')>';\r
- }\r
- \r
- \r
- } );\r
-\r
- EditorView = View.extend( {\r
- className: 'editor',\r
- \r
- /*\r
- * 마우스에 의한 선택 변경을 감지한다.\r
- */\r
- events: { "mouseup": "selectionChanged", "mouseleave": "selectionChanged" },\r
- \r
- factory: new Factory(),\r
- \r
- model2view: {},\r
- \r
- initialize: function() {\r
- \r
- this.collection.bind( 'reset', this.render, this );\r
- this.collection.bind( 'add', this.add, this );\r
- this.collection.bind( 'remove', this.remove, this );\r
- \r
- $( this.el ).attr( "contenteditable", "true" );\r
- \r
- this.factory.register( Paragraph, ParagraphView );\r
- \r
- this.collection.add( new Paragraph() );\r
- },\r
- \r
- add: function( model ) {\r
- \r
- var view = this.factory.create( model );\r
- \r
- if ( view ) {\r
- $( this.el ).append( $( view.render().el ) );\r
- this.model2view[model] = view;\r
- }\r
- \r
- },\r
- \r
- render: function() {\r
- \r
- $( this.el ).empty();\r
- this.collection.each( this.add, this );\r
- \r
- return this;\r
- },\r
-\r
- /*\r
- * 선택 변경을 모델에 알려준다.\r
- */\r
- selectionChanged: function( e ) {\r
- \r
- this.collection.selectionChanged( document.getSelection() );\r
- \r
- },\r
- toString: function( range ) {\r
- return range + '<' + range.startContainer + '(' + range.startOffset + ')-' + range.endContainer + '(' + range.endOffset + ')>';\r
- }\r
- \r
- } );\r
- \r
-} ).call();
\ No newline at end of file
+++ /dev/null
-/* \r
- * jQuery dotdotdot 1.5.1\r
- * \r
- * Copyright (c) 2012 Fred Heusschen\r
- * www.frebsite.nl\r
- *\r
- * Plugin website:\r
- * dotdotdot.frebsite.nl\r
- *\r
- * Dual licensed under the MIT and GPL licenses.\r
- * http://en.wikipedia.org/wiki/MIT_License\r
- * http://en.wikipedia.org/wiki/GNU_General_Public_License\r
- */\r
-\r
-\r
-(function( $ )\r
-{\r
- if ( $.fn.dotdotdot )\r
- {\r
- return;\r
- }\r
-\r
- $.fn.dotdotdot = function( o )\r
- {\r
- if ( this.length == 0 )\r
- {\r
- debug( true, 'No element found for "' + this.selector + '".' );\r
- return this;\r
- }\r
- if ( this.length > 1 )\r
- {\r
- return this.each(\r
- function()\r
- {\r
- $(this).dotdotdot( o );\r
- }\r
- );\r
- }\r
-\r
-\r
- var $dot = this;\r
-\r
- if ( $dot.data( 'dotdotdot' ) )\r
- {\r
- $dot.trigger( 'destroy.dot' );\r
- }\r
-\r
- $dot.bind_events = function()\r
- {\r
- $dot.bind(\r
- 'update.dot',\r
- function( e, c )\r
- {\r
- e.preventDefault();\r
- e.stopPropagation();\r
-\r
- opts.maxHeight = ( typeof opts.height == 'number' ) \r
- ? opts.height \r
- : getTrueInnerHeight( $dot );\r
-\r
- opts.maxHeight += opts.tolerance;\r
-\r
- if ( typeof c != 'undefined' )\r
- {\r
- if ( typeof c == 'string' || c instanceof HTMLElement )\r
- {\r
- c = $('<div />').append( c ).contents();\r
- }\r
- if ( c instanceof $ )\r
- {\r
- orgContent = c;\r
- }\r
- }\r
-\r
- $inr = $dot.wrapInner( '<div class="dotdotdot" />' ).children();\r
- $inr.empty()\r
- .append( orgContent.clone( true ) )\r
- .css({\r
- 'height' : 'auto',\r
- 'width' : 'auto',\r
- 'border' : 'none',\r
- 'padding' : 0,\r
- 'margin' : 0\r
- });\r
-\r
- var after = false,\r
- trunc = false;\r
-\r
- if ( conf.afterElement )\r
- {\r
- after = conf.afterElement.clone( true );\r
- conf.afterElement.remove();\r
- }\r
- if ( test( $inr, opts ) )\r
- {\r
- if ( opts.wrap == 'children' )\r
- {\r
- trunc = children( $inr, opts, after );\r
- }\r
- else\r
- {\r
- trunc = ellipsis( $inr, $dot, $inr, opts, after );\r
- }\r
- }\r
- $inr.replaceWith( $inr.contents() );\r
- $inr = null;\r
- \r
- if ( $.isFunction( opts.callback ) )\r
- {\r
- opts.callback.call( $dot[ 0 ], trunc, orgContent );\r
- }\r
-\r
- conf.isTruncated = trunc;\r
- return trunc;\r
- }\r
-\r
- ).bind(\r
- 'isTruncated.dot',\r
- function( e, fn )\r
- {\r
- e.preventDefault();\r
- e.stopPropagation();\r
-\r
- if ( typeof fn == 'function' )\r
- {\r
- fn.call( $dot[ 0 ], conf.isTruncated );\r
- }\r
- return conf.isTruncated;\r
- }\r
-\r
- ).bind(\r
- 'originalContent.dot',\r
- function( e, fn )\r
- {\r
- e.preventDefault();\r
- e.stopPropagation();\r
-\r
- if ( typeof fn == 'function' )\r
- {\r
- fn.call( $dot[ 0 ], orgContent );\r
- }\r
- return orgContent;\r
- }\r
-\r
- ).bind(\r
- 'destroy.dot',\r
- function( e )\r
- {\r
- e.preventDefault();\r
- e.stopPropagation();\r
-\r
- $dot.unwatch()\r
- .unbind_events()\r
- .empty()\r
- .append( orgContent )\r
- .data( 'dotdotdot', false );\r
- }\r
- );\r
- return $dot;\r
- }; // /bind_events\r
-\r
- $dot.unbind_events = function()\r
- {\r
- $dot.unbind('.dot');\r
- return $dot;\r
- }; // /unbind_events\r
-\r
- $dot.watch = function()\r
- {\r
- $dot.unwatch();\r
- if ( opts.watch == 'window' )\r
- {\r
- var $window = $(window),\r
- _wWidth = $window.width(),\r
- _wHeight = $window.height(); \r
-\r
- $window.bind(\r
- 'resize.dot' + conf.dotId,\r
- function()\r
- {\r
- if ( _wWidth != $window.width() || _wHeight != $window.height() || !opts.windowResizeFix )\r
- {\r
- _wWidth = $window.width();\r
- _wHeight = $window.height();\r
- \r
- if ( watchInt )\r
- {\r
- clearInterval( watchInt );\r
- }\r
- watchInt = setTimeout(\r
- function()\r
- {\r
- $dot.trigger( 'update.dot' );\r
- }, 10\r
- );\r
- }\r
- }\r
- );\r
- }\r
- else\r
- {\r
- watchOrg = getSizes( $dot );\r
- watchInt = setInterval(\r
- function()\r
- {\r
- var watchNew = getSizes( $dot );\r
- if ( watchOrg.width != watchNew.width ||\r
- watchOrg.height != watchNew.height )\r
- {\r
- $dot.trigger( 'update.dot' );\r
- watchOrg = getSizes( $dot );\r
- }\r
- }, 100\r
- );\r
- }\r
- return $dot;\r
- };\r
- $dot.unwatch = function()\r
- {\r
- $(window).unbind( 'resize.dot' + conf.dotId );\r
- if ( watchInt )\r
- {\r
- clearInterval( watchInt );\r
- }\r
- return $dot;\r
- };\r
-\r
- var orgContent = $dot.contents(),\r
- opts = $.extend( true, {}, $.fn.dotdotdot.defaults, o ),\r
- conf = {},\r
- watchOrg = {},\r
- watchInt = null,\r
- $inr = null;\r
-\r
- conf.afterElement = getElement( opts.after, $dot );\r
- conf.isTruncated = false;\r
- conf.dotId = dotId++;\r
-\r
-\r
- $dot.data( 'dotdotdot', true )\r
- .bind_events()\r
- .trigger( 'update.dot' );\r
-\r
- if ( opts.watch )\r
- {\r
- $dot.watch();\r
- }\r
-\r
- return $dot;\r
- };\r
-\r
-\r
- // public\r
- $.fn.dotdotdot.defaults = {\r
- 'ellipsis' : '... ',\r
- 'wrap' : 'word',\r
- 'lastCharacter': {\r
- 'remove' : [ ' ', ',', ';', '.', '!', '?' ],\r
- 'noEllipsis' : []\r
- },\r
- 'tolerance' : 0,\r
- 'callback' : null,\r
- 'after' : null,\r
- 'height' : null,\r
- 'watch' : false,\r
- 'windowResizeFix': true,\r
- 'debug' : false\r
- };\r
- \r
-\r
- // private\r
- var dotId = 1;\r
-\r
- function children( $elem, o, after )\r
- {\r
- var $elements = $elem.children(),\r
- isTruncated = false;\r
-\r
- $elem.empty();\r
-\r
- for ( var a = 0, l = $elements.length; a < l; a++ )\r
- {\r
- var $e = $elements.eq( a );\r
- $elem.append( $e );\r
- if ( after )\r
- {\r
- $elem.append( after );\r
- }\r
- if ( test( $elem, o ) )\r
- {\r
- $e.remove();\r
- isTruncated = true;\r
- break;\r
- }\r
- else\r
- {\r
- if ( after )\r
- {\r
- after.remove();\r
- }\r
- }\r
- }\r
- return isTruncated;\r
- }\r
- function ellipsis( $elem, $d, $i, o, after )\r
- {\r
- var $elements = $elem.contents(),\r
- isTruncated = false;\r
-\r
- $elem.empty();\r
-\r
- var notx = 'table, thead, tbody, tfoot, tr, col, colgroup, object, embed, param, ol, ul, dl, select, optgroup, option, textarea, script, style';\r
- for ( var a = 0, l = $elements.length; a < l; a++ )\r
- {\r
-\r
- if ( isTruncated )\r
- {\r
- break;\r
- }\r
-\r
- var e = $elements[ a ],\r
- $e = $(e);\r
-\r
- if ( typeof e == 'undefined' )\r
- {\r
- continue;\r
- }\r
-\r
- $elem.append( $e );\r
- if ( after )\r
- {\r
- var func = ( $elem.is( notx ) )\r
- ? 'after'\r
- : 'append';\r
- $elem[ func ]( after );\r
- }\r
- if ( e.nodeType == 3 )\r
- {\r
- if ( test( $i, o ) )\r
- {\r
- isTruncated = ellipsisElement( $e, $d, $i, o, after );\r
- }\r
- }\r
- else\r
- {\r
- isTruncated = ellipsis( $e, $d, $i, o, after );\r
- }\r
-\r
- if ( !isTruncated )\r
- {\r
- if ( after )\r
- {\r
- after.remove();\r
- }\r
- }\r
- }\r
- return isTruncated;\r
- }\r
- function ellipsisElement( $e, $d, $i, o, after )\r
- {\r
- var isTruncated = false,\r
- e = $e[ 0 ];\r
-\r
- if ( typeof e == 'undefined' )\r
- {\r
- return false;\r
- }\r
-\r
- var seporator = ( o.wrap == 'letter' ) ? '' : ' ',\r
- textArr = getTextContent( e ).split( seporator ),\r
- position = -1,\r
- midPos = -1,\r
- startPos = 0,\r
- endPos = textArr.length - 1;\r
-\r
- while ( startPos <= endPos )\r
- {\r
- var m = Math.floor( ( startPos + endPos ) / 2 );\r
- if ( m == midPos ) \r
- {\r
- break;\r
- }\r
- midPos = m;\r
-\r
- setTextContent( e, textArr.slice( 0, midPos + 1 ).join( seporator ) + o.ellipsis );\r
-\r
- if ( !test( $i, o ) )\r
- {\r
- position = midPos;\r
- startPos = midPos; \r
- }\r
- else\r
- {\r
- endPos = midPos;\r
- } \r
- } \r
- \r
- if ( position != -1 )\r
- {\r
- var txt = textArr.slice( 0, position + 1 ).join( seporator );\r
- isTruncated = true;\r
-\r
- while( $.inArray( txt.slice( -1 ), o.lastCharacter.remove ) > -1 )\r
- {\r
- txt = txt.slice( 0, -1 );\r
- }\r
- if ( $.inArray( txt.slice( -1 ), o.lastCharacter.noEllipsis ) < 0 )\r
- {\r
- txt += o.ellipsis;\r
- }\r
- setTextContent( e, txt );\r
- }\r
- else\r
- {\r
- var $w = $e.parent();\r
- $e.remove();\r
- $n = $w.contents().eq( -1 );\r
-\r
- isTruncated = ellipsisElement( $n, $d, $i, o, after );\r
- }\r
-\r
- return isTruncated;\r
- }\r
- function test( $i, o )\r
- {\r
- return $i.innerHeight() > o.maxHeight;\r
- }\r
- function getSizes( $d )\r
- {\r
- return {\r
- 'width' : $d.innerWidth(),\r
- 'height': $d.innerHeight()\r
- };\r
- }\r
- function setTextContent( e, content )\r
- {\r
- if ( e.innerText )\r
- {\r
- e.innerText = content;\r
- }\r
- else if ( e.nodeValue )\r
- {\r
- e.nodeValue = content;\r
- }\r
- else if (e.textContent)\r
- {\r
- e.textContent = content;\r
- }\r
- }\r
- function getTextContent( e )\r
- {\r
- if ( e.innerText )\r
- {\r
- return e.innerText;\r
- }\r
- else if ( e.nodeValue )\r
- {\r
- return e.nodeValue;\r
- }\r
- else if ( e.textContent )\r
- {\r
- return e.textContent;\r
- }\r
- else\r
- {\r
- return "";\r
- }\r
- }\r
- function getElement( e, $i )\r
- {\r
- if ( typeof e == 'undefined' )\r
- {\r
- return false;\r
- }\r
- if ( !e )\r
- {\r
- return false;\r
- }\r
- if ( typeof e == 'string' )\r
- {\r
- e = $(e, $i);\r
- return ( e.length )\r
- ? e \r
- : false;\r
- }\r
- if ( typeof e == 'object' )\r
- {\r
- return ( typeof e.jquery == 'undefined' )\r
- ? false\r
- : e;\r
- }\r
- return false;\r
- }\r
- function getTrueInnerHeight( $el )\r
- {\r
- var h = $el.innerHeight(),\r
- a = [ 'paddingTop', 'paddingBottom' ];\r
-\r
- for ( z = 0, l = a.length; z < l; z++ ) {\r
- var m = parseInt( $el.css( a[ z ] ), 10 );\r
- if ( isNaN( m ) )\r
- {\r
- m = 0;\r
- }\r
- h -= m;\r
- }\r
- return h;\r
- }\r
- function debug( d, m )\r
- {\r
- if ( !d )\r
- {\r
- return false;\r
- }\r
- if ( typeof m == 'string' )\r
- {\r
- m = 'dotdotdot: ' + m;\r
- }\r
- else\r
- {\r
- m = [ 'dotdotdot:', m ];\r
- }\r
-\r
- if ( window.console && window.console.log )\r
- {\r
- window.console.log( m );\r
- }\r
- return false;\r
- }\r
- \r
-\r
- // override jQuery.html\r
- var _orgHtml = $.fn.html;\r
- $.fn.html = function( str ) {\r
- if ( typeof str != 'undefined' )\r
- {\r
- if ( this.data( 'dotdotdot' ) )\r
- {\r
- if ( typeof str != 'function' )\r
- {\r
- return this.trigger( 'update', [ str ] );\r
- }\r
- }\r
- return _orgHtml.call( this, str );\r
- }\r
- return _orgHtml.call( this );\r
- };\r
-\r
-\r
- // override jQuery.text\r
- var _orgText = $.fn.text;\r
- $.fn.text = function( str ) {\r
- if ( typeof str != 'undefined' )\r
- {\r
- if ( this.data( 'dotdotdot' ) )\r
- {\r
- var temp = $( '<div />' );\r
- temp.text( str );\r
- str = temp.html();\r
- temp.remove();\r
- return this.trigger( 'update', [ str ] );\r
- }\r
- return _orgText.call( this, str );\r
- }\r
- return _orgText.call( this );\r
- };\r
-\r
-\r
-})( jQuery );
\ No newline at end of file
+++ /dev/null
-/*!
- * jQuery Form Plugin
- * version: 3.18 (28-SEP-2012)
- * @requires jQuery v1.5 or later
- *
- * Examples and documentation at: http://malsup.com/jquery/form/
- * Project repository: https://github.com/malsup/form
- * Dual licensed under the MIT and GPL licenses:
- * http://malsup.github.com/mit-license.txt
- * http://malsup.github.com/gpl-license-v2.txt
- */
-/*global ActiveXObject alert */
-;(function($) {
-"use strict";
-
-/*
- Usage Note:
- -----------
- Do not use both ajaxSubmit and ajaxForm on the same form. These
- functions are mutually exclusive. Use ajaxSubmit if you want
- to bind your own submit handler to the form. For example,
-
- $(document).ready(function() {
- $('#myForm').on('submit', function(e) {
- e.preventDefault(); // <-- important
- $(this).ajaxSubmit({
- target: '#output'
- });
- });
- });
-
- Use ajaxForm when you want the plugin to manage all the event binding
- for you. For example,
-
- $(document).ready(function() {
- $('#myForm').ajaxForm({
- target: '#output'
- });
- });
-
- You can also use ajaxForm with delegation (requires jQuery v1.7+), so the
- form does not have to exist when you invoke ajaxForm:
-
- $('#myForm').ajaxForm({
- delegation: true,
- target: '#output'
- });
-
- When using ajaxForm, the ajaxSubmit function will be invoked for you
- at the appropriate time.
-*/
-
-/**
- * Feature detection
- */
-var feature = {};
-feature.fileapi = $("<input type='file'/>").get(0).files !== undefined;
-feature.formdata = window.FormData !== undefined;
-
-/**
- * ajaxSubmit() provides a mechanism for immediately submitting
- * an HTML form using AJAX.
- */
-$.fn.ajaxSubmit = function(options) {
- /*jshint scripturl:true */
-
- // fast fail if nothing selected (http://dev.jquery.com/ticket/2752)
- if (!this.length) {
- log('ajaxSubmit: skipping submit process - no element selected');
- return this;
- }
-
- var method, action, url, $form = this;
-
- if (typeof options == 'function') {
- options = { success: options };
- }
-
- method = this.attr('method');
- action = this.attr('action');
- url = (typeof action === 'string') ? $.trim(action) : '';
- url = url || window.location.href || '';
- if (url) {
- // clean url (don't include hash vaue)
- url = (url.match(/^([^#]+)/)||[])[1];
- }
-
- options = $.extend(true, {
- url: url,
- success: $.ajaxSettings.success,
- type: method || 'GET',
- iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank'
- }, options);
-
- // hook for manipulating the form data before it is extracted;
- // convenient for use with rich editors like tinyMCE or FCKEditor
- var veto = {};
- this.trigger('form-pre-serialize', [this, options, veto]);
- if (veto.veto) {
- log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');
- return this;
- }
-
- // provide opportunity to alter form data before it is serialized
- if (options.beforeSerialize && options.beforeSerialize(this, options) === false) {
- log('ajaxSubmit: submit aborted via beforeSerialize callback');
- return this;
- }
-
- var traditional = options.traditional;
- if ( traditional === undefined ) {
- traditional = $.ajaxSettings.traditional;
- }
-
- var elements = [];
- var qx, a = this.formToArray(options.semantic, elements);
- if (options.data) {
- options.extraData = options.data;
- qx = $.param(options.data, traditional);
- }
-
- // give pre-submit callback an opportunity to abort the submit
- if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {
- log('ajaxSubmit: submit aborted via beforeSubmit callback');
- return this;
- }
-
- // fire vetoable 'validate' event
- this.trigger('form-submit-validate', [a, this, options, veto]);
- if (veto.veto) {
- log('ajaxSubmit: submit vetoed via form-submit-validate trigger');
- return this;
- }
-
- var q = $.param(a, traditional);
- if (qx) {
- q = ( q ? (q + '&' + qx) : qx );
- }
- if (options.type.toUpperCase() == 'GET') {
- options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
- options.data = null; // data is null for 'get'
- }
- else {
- options.data = q; // data is the query string for 'post'
- }
-
- var callbacks = [];
- if (options.resetForm) {
- callbacks.push(function() { $form.resetForm(); });
- }
- if (options.clearForm) {
- callbacks.push(function() { $form.clearForm(options.includeHidden); });
- }
-
- // perform a load on the target only if dataType is not provided
- if (!options.dataType && options.target) {
- var oldSuccess = options.success || function(){};
- callbacks.push(function(data) {
- var fn = options.replaceTarget ? 'replaceWith' : 'html';
- $(options.target)[fn](data).each(oldSuccess, arguments);
- });
- }
- else if (options.success) {
- callbacks.push(options.success);
- }
-
- options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg
- var context = options.context || this ; // jQuery 1.4+ supports scope context
- for (var i=0, max=callbacks.length; i < max; i++) {
- callbacks[i].apply(context, [data, status, xhr || $form, $form]);
- }
- };
-
- // are there files to upload?
- var fileInputs = $('input:file:enabled[value]', this); // [value] (issue #113)
- var hasFileInputs = fileInputs.length > 0;
- var mp = 'multipart/form-data';
- var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp);
-
- var fileAPI = feature.fileapi && feature.formdata;
- log("fileAPI :" + fileAPI);
- var shouldUseFrame = (hasFileInputs || multipart) && !fileAPI;
-
- var jqxhr;
-
- // options.iframe allows user to force iframe mode
- // 06-NOV-09: now defaulting to iframe mode if file input is detected
- if (options.iframe !== false && (options.iframe || shouldUseFrame)) {
- // hack to fix Safari hang (thanks to Tim Molendijk for this)
- // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
- if (options.closeKeepAlive) {
- $.get(options.closeKeepAlive, function() {
- jqxhr = fileUploadIframe(a);
- });
- }
- else {
- jqxhr = fileUploadIframe(a);
- }
- }
- else if ((hasFileInputs || multipart) && fileAPI) {
- jqxhr = fileUploadXhr(a);
- }
- else {
- jqxhr = $.ajax(options);
- }
-
- $form.removeData('jqxhr').data('jqxhr', jqxhr);
-
- // clear element array
- for (var k=0; k < elements.length; k++)
- elements[k] = null;
-
- // fire 'notify' event
- this.trigger('form-submit-notify', [this, options]);
- return this;
-
- // utility fn for deep serialization
- function deepSerialize(extraData){
- var serialized = $.param(extraData).split('&');
- var len = serialized.length;
- var result = {};
- var i, part;
- for (i=0; i < len; i++) {
- part = serialized[i].split('=');
- result[decodeURIComponent(part[0])] = decodeURIComponent(part[1]);
- }
- return result;
- }
-
- // XMLHttpRequest Level 2 file uploads (big hat tip to francois2metz)
- function fileUploadXhr(a) {
- var formdata = new FormData();
-
- for (var i=0; i < a.length; i++) {
- formdata.append(a[i].name, a[i].value);
- }
-
- if (options.extraData) {
- var serializedData = deepSerialize(options.extraData);
- for (var p in serializedData)
- if (serializedData.hasOwnProperty(p))
- formdata.append(p, serializedData[p]);
- }
-
- options.data = null;
-
- var s = $.extend(true, {}, $.ajaxSettings, options, {
- contentType: false,
- processData: false,
- cache: false,
- type: method || 'POST'
- });
-
- if (options.uploadProgress) {
- // workaround because jqXHR does not expose upload property
- s.xhr = function() {
- var xhr = jQuery.ajaxSettings.xhr();
- if (xhr.upload) {
- xhr.upload.onprogress = function(event) {
- var percent = 0;
- var position = event.loaded || event.position; /*event.position is deprecated*/
- var total = event.total;
- if (event.lengthComputable) {
- percent = Math.ceil(position / total * 100);
- }
- options.uploadProgress(event, position, total, percent);
- };
- }
- return xhr;
- };
- }
-
- s.data = null;
- var beforeSend = s.beforeSend;
- s.beforeSend = function(xhr, o) {
- o.data = formdata;
- if(beforeSend)
- beforeSend.call(this, xhr, o);
- };
- return $.ajax(s);
- }
-
- // private function for handling file uploads (hat tip to YAHOO!)
- function fileUploadIframe(a) {
- var form = $form[0], el, i, s, g, id, $io, io, xhr, sub, n, timedOut, timeoutHandle;
- var useProp = !!$.fn.prop;
- var deferred = $.Deferred();
-
- if ($(':input[name=submit],:input[id=submit]', form).length) {
- // if there is an input with a name or id of 'submit' then we won't be
- // able to invoke the submit fn on the form (at least not x-browser)
- alert('Error: Form elements must not have name or id of "submit".');
- deferred.reject();
- return deferred;
- }
-
- if (a) {
- // ensure that every serialized input is still enabled
- for (i=0; i < elements.length; i++) {
- el = $(elements[i]);
- if ( useProp )
- el.prop('disabled', false);
- else
- el.removeAttr('disabled');
- }
- }
-
- s = $.extend(true, {}, $.ajaxSettings, options);
- s.context = s.context || s;
- id = 'jqFormIO' + (new Date().getTime());
- if (s.iframeTarget) {
- $io = $(s.iframeTarget);
- n = $io.attr('name');
- if (!n)
- $io.attr('name', id);
- else
- id = n;
- }
- else {
- $io = $('<iframe name="' + id + '" src="'+ s.iframeSrc +'" />');
- $io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
- }
- io = $io[0];
-
-
- xhr = { // mock object
- aborted: 0,
- responseText: null,
- responseXML: null,
- status: 0,
- statusText: 'n/a',
- getAllResponseHeaders: function() {},
- getResponseHeader: function() {},
- setRequestHeader: function() {},
- abort: function(status) {
- var e = (status === 'timeout' ? 'timeout' : 'aborted');
- log('aborting upload... ' + e);
- this.aborted = 1;
- // #214
- if (io.contentWindow.document.execCommand) {
- try { // #214
- io.contentWindow.document.execCommand('Stop');
- } catch(ignore) {}
- }
- $io.attr('src', s.iframeSrc); // abort op in progress
- xhr.error = e;
- if (s.error)
- s.error.call(s.context, xhr, e, status);
- if (g)
- $.event.trigger("ajaxError", [xhr, s, e]);
- if (s.complete)
- s.complete.call(s.context, xhr, e);
- }
- };
-
- g = s.global;
- // trigger ajax global events so that activity/block indicators work like normal
- if (g && 0 === $.active++) {
- $.event.trigger("ajaxStart");
- }
- if (g) {
- $.event.trigger("ajaxSend", [xhr, s]);
- }
-
- if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {
- if (s.global) {
- $.active--;
- }
- deferred.reject();
- return deferred;
- }
- if (xhr.aborted) {
- deferred.reject();
- return deferred;
- }
-
- // add submitting element to data if we know it
- sub = form.clk;
- if (sub) {
- n = sub.name;
- if (n && !sub.disabled) {
- s.extraData = s.extraData || {};
- s.extraData[n] = sub.value;
- if (sub.type == "image") {
- s.extraData[n+'.x'] = form.clk_x;
- s.extraData[n+'.y'] = form.clk_y;
- }
- }
- }
-
- var CLIENT_TIMEOUT_ABORT = 1;
- var SERVER_ABORT = 2;
-
- function getDoc(frame) {
- var doc = frame.contentWindow ? frame.contentWindow.document : frame.contentDocument ? frame.contentDocument : frame.document;
- return doc;
- }
-
- // Rails CSRF hack (thanks to Yvan Barthelemy)
- var csrf_token = $('meta[name=csrf-token]').attr('content');
- var csrf_param = $('meta[name=csrf-param]').attr('content');
- if (csrf_param && csrf_token) {
- s.extraData = s.extraData || {};
- s.extraData[csrf_param] = csrf_token;
- }
-
- // take a breath so that pending repaints get some cpu time before the upload starts
- function doSubmit() {
- // make sure form attrs are set
- var t = $form.attr('target'), a = $form.attr('action');
-
- // update form attrs in IE friendly way
- form.setAttribute('target',id);
- if (!method) {
- form.setAttribute('method', 'POST');
- }
- if (a != s.url) {
- form.setAttribute('action', s.url);
- }
-
- // ie borks in some cases when setting encoding
- if (! s.skipEncodingOverride && (!method || /post/i.test(method))) {
- $form.attr({
- encoding: 'multipart/form-data',
- enctype: 'multipart/form-data'
- });
- }
-
- // support timout
- if (s.timeout) {
- timeoutHandle = setTimeout(function() { timedOut = true; cb(CLIENT_TIMEOUT_ABORT); }, s.timeout);
- }
-
- // look for server aborts
- function checkState() {
- try {
- var state = getDoc(io).readyState;
- log('state = ' + state);
- if (state && state.toLowerCase() == 'uninitialized')
- setTimeout(checkState,50);
- }
- catch(e) {
- log('Server abort: ' , e, ' (', e.name, ')');
- cb(SERVER_ABORT);
- if (timeoutHandle)
- clearTimeout(timeoutHandle);
- timeoutHandle = undefined;
- }
- }
-
- // add "extra" data to form if provided in options
- var extraInputs = [];
- try {
- if (s.extraData) {
- for (var n in s.extraData) {
- if (s.extraData.hasOwnProperty(n)) {
- // if using the $.param format that allows for multiple values with the same name
- if($.isPlainObject(s.extraData[n]) && s.extraData[n].hasOwnProperty('name') && s.extraData[n].hasOwnProperty('value')) {
- extraInputs.push(
- $('<input type="hidden" name="'+s.extraData[n].name+'">').attr('value',s.extraData[n].value)
- .appendTo(form)[0]);
- } else {
- extraInputs.push(
- $('<input type="hidden" name="'+n+'">').attr('value',s.extraData[n])
- .appendTo(form)[0]);
- }
- }
- }
- }
-
- if (!s.iframeTarget) {
- // add iframe to doc and submit the form
- $io.appendTo('body');
- if (io.attachEvent)
- io.attachEvent('onload', cb);
- else
- io.addEventListener('load', cb, false);
- }
- setTimeout(checkState,15);
- form.submit();
- }
- finally {
- // reset attrs and remove "extra" input elements
- form.setAttribute('action',a);
- if(t) {
- form.setAttribute('target', t);
- } else {
- $form.removeAttr('target');
- }
- $(extraInputs).remove();
- }
- }
-
- if (s.forceSync) {
- doSubmit();
- }
- else {
- setTimeout(doSubmit, 10); // this lets dom updates render
- }
-
- var data, doc, domCheckCount = 50, callbackProcessed;
-
- function cb(e) {
- if (xhr.aborted || callbackProcessed) {
- return;
- }
- try {
- doc = getDoc(io);
- }
- catch(ex) {
- log('cannot access response document: ', ex);
- e = SERVER_ABORT;
- }
- if (e === CLIENT_TIMEOUT_ABORT && xhr) {
- xhr.abort('timeout');
- deferred.reject(xhr, 'timeout');
- return;
- }
- else if (e == SERVER_ABORT && xhr) {
- xhr.abort('server abort');
- deferred.reject(xhr, 'error', 'server abort');
- return;
- }
-
- if (!doc || doc.location.href == s.iframeSrc) {
- // response not received yet
- if (!timedOut)
- return;
- }
- if (io.detachEvent)
- io.detachEvent('onload', cb);
- else
- io.removeEventListener('load', cb, false);
-
- var status = 'success', errMsg;
- try {
- if (timedOut) {
- throw 'timeout';
- }
-
- var isXml = s.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc);
- log('isXml='+isXml);
- if (!isXml && window.opera && (doc.body === null || !doc.body.innerHTML)) {
- if (--domCheckCount) {
- // in some browsers (Opera) the iframe DOM is not always traversable when
- // the onload callback fires, so we loop a bit to accommodate
- log('requeing onLoad callback, DOM not available');
- setTimeout(cb, 250);
- return;
- }
- // let this fall through because server response could be an empty document
- //log('Could not access iframe DOM after mutiple tries.');
- //throw 'DOMException: not available';
- }
-
- //log('response detected');
- var docRoot = doc.body ? doc.body : doc.documentElement;
- xhr.responseText = docRoot ? docRoot.innerHTML : null;
- xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
- if (isXml)
- s.dataType = 'xml';
- xhr.getResponseHeader = function(header){
- var headers = {'content-type': s.dataType};
- return headers[header];
- };
- // support for XHR 'status' & 'statusText' emulation :
- if (docRoot) {
- xhr.status = Number( docRoot.getAttribute('status') ) || xhr.status;
- xhr.statusText = docRoot.getAttribute('statusText') || xhr.statusText;
- }
-
- var dt = (s.dataType || '').toLowerCase();
- var scr = /(json|script|text)/.test(dt);
- if (scr || s.textarea) {
- // see if user embedded response in textarea
- var ta = doc.getElementsByTagName('textarea')[0];
- if (ta) {
- xhr.responseText = ta.value;
- // support for XHR 'status' & 'statusText' emulation :
- xhr.status = Number( ta.getAttribute('status') ) || xhr.status;
- xhr.statusText = ta.getAttribute('statusText') || xhr.statusText;
- }
- else if (scr) {
- // account for browsers injecting pre around json response
- var pre = doc.getElementsByTagName('pre')[0];
- var b = doc.getElementsByTagName('body')[0];
- if (pre) {
- xhr.responseText = pre.textContent ? pre.textContent : pre.innerText;
- }
- else if (b) {
- xhr.responseText = b.textContent ? b.textContent : b.innerText;
- }
- }
- }
- else if (dt == 'xml' && !xhr.responseXML && xhr.responseText) {
- xhr.responseXML = toXml(xhr.responseText);
- }
-
- try {
- data = httpData(xhr, dt, s);
- }
- catch (e) {
- status = 'parsererror';
- xhr.error = errMsg = (e || status);
- }
- }
- catch (e) {
- log('error caught: ',e);
- status = 'error';
- xhr.error = errMsg = (e || status);
- }
-
- if (xhr.aborted) {
- log('upload aborted');
- status = null;
- }
-
- if (xhr.status) { // we've set xhr.status
- status = (xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) ? 'success' : 'error';
- }
-
- // ordering of these callbacks/triggers is odd, but that's how $.ajax does it
- if (status === 'success') {
- if (s.success)
- s.success.call(s.context, data, 'success', xhr);
- deferred.resolve(xhr.responseText, 'success', xhr);
- if (g)
- $.event.trigger("ajaxSuccess", [xhr, s]);
- }
- else if (status) {
- if (errMsg === undefined)
- errMsg = xhr.statusText;
- if (s.error)
- s.error.call(s.context, xhr, status, errMsg);
- deferred.reject(xhr, 'error', errMsg);
- if (g)
- $.event.trigger("ajaxError", [xhr, s, errMsg]);
- }
-
- if (g)
- $.event.trigger("ajaxComplete", [xhr, s]);
-
- if (g && ! --$.active) {
- $.event.trigger("ajaxStop");
- }
-
- if (s.complete)
- s.complete.call(s.context, xhr, status);
-
- callbackProcessed = true;
- if (s.timeout)
- clearTimeout(timeoutHandle);
-
- // clean up
- setTimeout(function() {
- if (!s.iframeTarget)
- $io.remove();
- xhr.responseXML = null;
- }, 100);
- }
-
- var toXml = $.parseXML || function(s, doc) { // use parseXML if available (jQuery 1.5+)
- if (window.ActiveXObject) {
- doc = new ActiveXObject('Microsoft.XMLDOM');
- doc.async = 'false';
- doc.loadXML(s);
- }
- else {
- doc = (new DOMParser()).parseFromString(s, 'text/xml');
- }
- return (doc && doc.documentElement && doc.documentElement.nodeName != 'parsererror') ? doc : null;
- };
- var parseJSON = $.parseJSON || function(s) {
- /*jslint evil:true */
- return window['eval']('(' + s + ')');
- };
-
- var httpData = function( xhr, type, s ) { // mostly lifted from jq1.4.4
-
- var ct = xhr.getResponseHeader('content-type') || '',
- xml = type === 'xml' || !type && ct.indexOf('xml') >= 0,
- data = xml ? xhr.responseXML : xhr.responseText;
-
- if (xml && data.documentElement.nodeName === 'parsererror') {
- if ($.error)
- $.error('parsererror');
- }
- if (s && s.dataFilter) {
- data = s.dataFilter(data, type);
- }
- if (typeof data === 'string') {
- if (type === 'json' || !type && ct.indexOf('json') >= 0) {
- data = parseJSON(data);
- } else if (type === "script" || !type && ct.indexOf("javascript") >= 0) {
- $.globalEval(data);
- }
- }
- return data;
- };
-
- return deferred;
- }
-};
-
-/**
- * ajaxForm() provides a mechanism for fully automating form submission.
- *
- * The advantages of using this method instead of ajaxSubmit() are:
- *
- * 1: This method will include coordinates for <input type="image" /> elements (if the element
- * is used to submit the form).
- * 2. This method will include the submit element's name/value data (for the element that was
- * used to submit the form).
- * 3. This method binds the submit() method to the form for you.
- *
- * The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely
- * passes the options argument along after properly binding events for submit elements and
- * the form itself.
- */
-$.fn.ajaxForm = function(options) {
- options = options || {};
- options.delegation = options.delegation && $.isFunction($.fn.on);
-
- // in jQuery 1.3+ we can fix mistakes with the ready state
- if (!options.delegation && this.length === 0) {
- var o = { s: this.selector, c: this.context };
- if (!$.isReady && o.s) {
- log('DOM not ready, queuing ajaxForm');
- $(function() {
- $(o.s,o.c).ajaxForm(options);
- });
- return this;
- }
- // is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
- log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
- return this;
- }
-
- if ( options.delegation ) {
- $(document)
- .off('submit.form-plugin', this.selector, doAjaxSubmit)
- .off('click.form-plugin', this.selector, captureSubmittingElement)
- .on('submit.form-plugin', this.selector, options, doAjaxSubmit)
- .on('click.form-plugin', this.selector, options, captureSubmittingElement);
- return this;
- }
-
- return this.ajaxFormUnbind()
- .bind('submit.form-plugin', options, doAjaxSubmit)
- .bind('click.form-plugin', options, captureSubmittingElement);
-};
-
-// private event handlers
-function doAjaxSubmit(e) {
- /*jshint validthis:true */
- var options = e.data;
- if (!e.isDefaultPrevented()) { // if event has been canceled, don't proceed
- e.preventDefault();
- $(this).ajaxSubmit(options);
- }
-}
-
-function captureSubmittingElement(e) {
- /*jshint validthis:true */
- var target = e.target;
- var $el = $(target);
- if (!($el.is(":submit,input:image"))) {
- // is this a child element of the submit el? (ex: a span within a button)
- var t = $el.closest(':submit');
- if (t.length === 0) {
- return;
- }
- target = t[0];
- }
- var form = this;
- form.clk = target;
- if (target.type == 'image') {
- if (e.offsetX !== undefined) {
- form.clk_x = e.offsetX;
- form.clk_y = e.offsetY;
- } else if (typeof $.fn.offset == 'function') {
- var offset = $el.offset();
- form.clk_x = e.pageX - offset.left;
- form.clk_y = e.pageY - offset.top;
- } else {
- form.clk_x = e.pageX - target.offsetLeft;
- form.clk_y = e.pageY - target.offsetTop;
- }
- }
- // clear form vars
- setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 100);
-}
-
-
-// ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
-$.fn.ajaxFormUnbind = function() {
- return this.unbind('submit.form-plugin click.form-plugin');
-};
-
-/**
- * formToArray() gathers form element data into an array of objects that can
- * be passed to any of the following ajax functions: $.get, $.post, or load.
- * Each object in the array has both a 'name' and 'value' property. An example of
- * an array for a simple login form might be:
- *
- * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
- *
- * It is this array that is passed to pre-submit callback functions provided to the
- * ajaxSubmit() and ajaxForm() methods.
- */
-$.fn.formToArray = function(semantic, elements) {
- var a = [];
- if (this.length === 0) {
- return a;
- }
-
- var form = this[0];
- var els = semantic ? form.getElementsByTagName('*') : form.elements;
- if (!els) {
- return a;
- }
-
- var i,j,n,v,el,max,jmax;
- for(i=0, max=els.length; i < max; i++) {
- el = els[i];
- n = el.name;
- if (!n) {
- continue;
- }
-
- if (semantic && form.clk && el.type == "image") {
- // handle image inputs on the fly when semantic == true
- if(!el.disabled && form.clk == el) {
- a.push({name: n, value: $(el).val(), type: el.type });
- a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
- }
- continue;
- }
-
- v = $.fieldValue(el, true);
- if (v && v.constructor == Array) {
- if (elements)
- elements.push(el);
- for(j=0, jmax=v.length; j < jmax; j++) {
- a.push({name: n, value: v[j]});
- }
- }
- else if (feature.fileapi && el.type == 'file' && !el.disabled) {
- if (elements)
- elements.push(el);
- var files = el.files;
- if (files.length) {
- for (j=0; j < files.length; j++) {
- a.push({name: n, value: files[j], type: el.type});
- }
- }
- else {
- // #180
- a.push({ name: n, value: '', type: el.type });
- }
- }
- else if (v !== null && typeof v != 'undefined') {
- if (elements)
- elements.push(el);
- a.push({name: n, value: v, type: el.type, required: el.required});
- }
- }
-
- if (!semantic && form.clk) {
- // input type=='image' are not found in elements array! handle it here
- var $input = $(form.clk), input = $input[0];
- n = input.name;
- if (n && !input.disabled && input.type == 'image') {
- a.push({name: n, value: $input.val()});
- a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
- }
- }
- return a;
-};
-
-/**
- * Serializes form data into a 'submittable' string. This method will return a string
- * in the format: name1=value1&name2=value2
- */
-$.fn.formSerialize = function(semantic) {
- //hand off to jQuery.param for proper encoding
- return $.param(this.formToArray(semantic));
-};
-
-/**
- * Serializes all field elements in the jQuery object into a query string.
- * This method will return a string in the format: name1=value1&name2=value2
- */
-$.fn.fieldSerialize = function(successful) {
- var a = [];
- this.each(function() {
- var n = this.name;
- if (!n) {
- return;
- }
- var v = $.fieldValue(this, successful);
- if (v && v.constructor == Array) {
- for (var i=0,max=v.length; i < max; i++) {
- a.push({name: n, value: v[i]});
- }
- }
- else if (v !== null && typeof v != 'undefined') {
- a.push({name: this.name, value: v});
- }
- });
- //hand off to jQuery.param for proper encoding
- return $.param(a);
-};
-
-/**
- * Returns the value(s) of the element in the matched set. For example, consider the following form:
- *
- * <form><fieldset>
- * <input name="A" type="text" />
- * <input name="A" type="text" />
- * <input name="B" type="checkbox" value="B1" />
- * <input name="B" type="checkbox" value="B2"/>
- * <input name="C" type="radio" value="C1" />
- * <input name="C" type="radio" value="C2" />
- * </fieldset></form>
- *
- * var v = $(':text').fieldValue();
- * // if no values are entered into the text inputs
- * v == ['','']
- * // if values entered into the text inputs are 'foo' and 'bar'
- * v == ['foo','bar']
- *
- * var v = $(':checkbox').fieldValue();
- * // if neither checkbox is checked
- * v === undefined
- * // if both checkboxes are checked
- * v == ['B1', 'B2']
- *
- * var v = $(':radio').fieldValue();
- * // if neither radio is checked
- * v === undefined
- * // if first radio is checked
- * v == ['C1']
- *
- * The successful argument controls whether or not the field element must be 'successful'
- * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
- * The default value of the successful argument is true. If this value is false the value(s)
- * for each element is returned.
- *
- * Note: This method *always* returns an array. If no valid value can be determined the
- * array will be empty, otherwise it will contain one or more values.
- */
-$.fn.fieldValue = function(successful) {
- for (var val=[], i=0, max=this.length; i < max; i++) {
- var el = this[i];
- var v = $.fieldValue(el, successful);
- if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length)) {
- continue;
- }
- if (v.constructor == Array)
- $.merge(val, v);
- else
- val.push(v);
- }
- return val;
-};
-
-/**
- * Returns the value of the field element.
- */
-$.fieldValue = function(el, successful) {
- var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
- if (successful === undefined) {
- successful = true;
- }
-
- if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
- (t == 'checkbox' || t == 'radio') && !el.checked ||
- (t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
- tag == 'select' && el.selectedIndex == -1)) {
- return null;
- }
-
- if (tag == 'select') {
- var index = el.selectedIndex;
- if (index < 0) {
- return null;
- }
- var a = [], ops = el.options;
- var one = (t == 'select-one');
- var max = (one ? index+1 : ops.length);
- for(var i=(one ? index : 0); i < max; i++) {
- var op = ops[i];
- if (op.selected) {
- var v = op.value;
- if (!v) { // extra pain for IE...
- v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value;
- }
- if (one) {
- return v;
- }
- a.push(v);
- }
- }
- return a;
- }
- return $(el).val();
-};
-
-/**
- * Clears the form data. Takes the following actions on the form's input fields:
- * - input text fields will have their 'value' property set to the empty string
- * - select elements will have their 'selectedIndex' property set to -1
- * - checkbox and radio inputs will have their 'checked' property set to false
- * - inputs of type submit, button, reset, and hidden will *not* be effected
- * - button elements will *not* be effected
- */
-$.fn.clearForm = function(includeHidden) {
- return this.each(function() {
- $('input,select,textarea', this).clearFields(includeHidden);
- });
-};
-
-/**
- * Clears the selected form elements.
- */
-$.fn.clearFields = $.fn.clearInputs = function(includeHidden) {
- var re = /^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i; // 'hidden' is not in this list
- return this.each(function() {
- var t = this.type, tag = this.tagName.toLowerCase();
- if (re.test(t) || tag == 'textarea') {
- this.value = '';
- }
- else if (t == 'checkbox' || t == 'radio') {
- this.checked = false;
- }
- else if (tag == 'select') {
- this.selectedIndex = -1;
- }
- else if (includeHidden) {
- // includeHidden can be the value true, or it can be a selector string
- // indicating a special test; for example:
- // $('#myForm').clearForm('.special:hidden')
- // the above would clean hidden inputs that have the class of 'special'
- if ( (includeHidden === true && /hidden/.test(t)) ||
- (typeof includeHidden == 'string' && $(this).is(includeHidden)) )
- this.value = '';
- }
- });
-};
-
-/**
- * Resets the form data. Causes all form elements to be reset to their original value.
- */
-$.fn.resetForm = function() {
- return this.each(function() {
- // guard against an input with the name of 'reset'
- // note that IE reports the reset function as an 'object'
- if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType)) {
- this.reset();
- }
- });
-};
-
-/**
- * Enables or disables any matching elements.
- */
-$.fn.enable = function(b) {
- if (b === undefined) {
- b = true;
- }
- return this.each(function() {
- this.disabled = !b;
- });
-};
-
-/**
- * Checks/unchecks any matching checkboxes or radio buttons and
- * selects/deselects and matching option elements.
- */
-$.fn.selected = function(select) {
- if (select === undefined) {
- select = true;
- }
- return this.each(function() {
- var t = this.type;
- if (t == 'checkbox' || t == 'radio') {
- this.checked = select;
- }
- else if (this.tagName.toLowerCase() == 'option') {
- var $sel = $(this).parent('select');
- if (select && $sel[0] && $sel[0].type == 'select-one') {
- // deselect all other options
- $sel.find('option').selected(false);
- }
- this.selected = select;
- }
- });
-};
-
-// expose debug var
-$.fn.ajaxSubmit.debug = false;
-
-// helper fn for console logging
-function log() {
- if (!$.fn.ajaxSubmit.debug)
- return;
- var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,'');
- if (window.console && window.console.log) {
- window.console.log(msg);
- }
- else if (window.opera && window.opera.postError) {
- window.opera.postError(msg);
- }
-}
-
-})(jQuery);
+++ /dev/null
-/*!
- * jQuery JavaScript Library v1.7.2
- * http://jquery.com/
- *
- * Copyright 2011, John Resig
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * Includes Sizzle.js
- * http://sizzlejs.com/
- * Copyright 2011, The Dojo Foundation
- * Released under the MIT, BSD, and GPL Licenses.
- *
- * Date: Wed Mar 21 12:46:34 2012 -0700
- */
-(function( window, undefined ) {
-
-// Use the correct document accordingly with window argument (sandbox)
-var document = window.document,
- navigator = window.navigator,
- location = window.location;
-var jQuery = (function() {
-
-// Define a local copy of jQuery
-var jQuery = function( selector, context ) {
- // The jQuery object is actually just the init constructor 'enhanced'
- return new jQuery.fn.init( selector, context, rootjQuery );
- },
-
- // Map over jQuery in case of overwrite
- _jQuery = window.jQuery,
-
- // Map over the $ in case of overwrite
- _$ = window.$,
-
- // A central reference to the root jQuery(document)
- rootjQuery,
-
- // A simple way to check for HTML strings or ID strings
- // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
- quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,
-
- // Check if a string has a non-whitespace character in it
- rnotwhite = /\S/,
-
- // Used for trimming whitespace
- trimLeft = /^\s+/,
- trimRight = /\s+$/,
-
- // Match a standalone tag
- rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
-
- // JSON RegExp
- rvalidchars = /^[\],:{}\s]*$/,
- rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
- rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
- rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
-
- // Useragent RegExp
- rwebkit = /(webkit)[ \/]([\w.]+)/,
- ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
- rmsie = /(msie) ([\w.]+)/,
- rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
-
- // Matches dashed string for camelizing
- rdashAlpha = /-([a-z]|[0-9])/ig,
- rmsPrefix = /^-ms-/,
-
- // Used by jQuery.camelCase as callback to replace()
- fcamelCase = function( all, letter ) {
- return ( letter + "" ).toUpperCase();
- },
-
- // Keep a UserAgent string for use with jQuery.browser
- userAgent = navigator.userAgent,
-
- // For matching the engine and version of the browser
- browserMatch,
-
- // The deferred used on DOM ready
- readyList,
-
- // The ready event handler
- DOMContentLoaded,
-
- // Save a reference to some core methods
- toString = Object.prototype.toString,
- hasOwn = Object.prototype.hasOwnProperty,
- push = Array.prototype.push,
- slice = Array.prototype.slice,
- trim = String.prototype.trim,
- indexOf = Array.prototype.indexOf,
-
- // [[Class]] -> type pairs
- class2type = {};
-
-jQuery.fn = jQuery.prototype = {
- constructor: jQuery,
- init: function( selector, context, rootjQuery ) {
- var match, elem, ret, doc;
-
- // Handle $(""), $(null), or $(undefined)
- if ( !selector ) {
- return this;
- }
-
- // Handle $(DOMElement)
- if ( selector.nodeType ) {
- this.context = this[0] = selector;
- this.length = 1;
- return this;
- }
-
- // The body element only exists once, optimize finding it
- if ( selector === "body" && !context && document.body ) {
- this.context = document;
- this[0] = document.body;
- this.selector = selector;
- this.length = 1;
- return this;
- }
-
- // Handle HTML strings
- if ( typeof selector === "string" ) {
- // Are we dealing with HTML string or an ID?
- if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
- // Assume that strings that start and end with <> are HTML and skip the regex check
- match = [ null, selector, null ];
-
- } else {
- match = quickExpr.exec( selector );
- }
-
- // Verify a match, and that no context was specified for #id
- if ( match && (match[1] || !context) ) {
-
- // HANDLE: $(html) -> $(array)
- if ( match[1] ) {
- context = context instanceof jQuery ? context[0] : context;
- doc = ( context ? context.ownerDocument || context : document );
-
- // If a single string is passed in and it's a single tag
- // just do a createElement and skip the rest
- ret = rsingleTag.exec( selector );
-
- if ( ret ) {
- if ( jQuery.isPlainObject( context ) ) {
- selector = [ document.createElement( ret[1] ) ];
- jQuery.fn.attr.call( selector, context, true );
-
- } else {
- selector = [ doc.createElement( ret[1] ) ];
- }
-
- } else {
- ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
- selector = ( ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment ).childNodes;
- }
-
- return jQuery.merge( this, selector );
-
- // HANDLE: $("#id")
- } else {
- elem = document.getElementById( match[2] );
-
- // Check parentNode to catch when Blackberry 4.6 returns
- // nodes that are no longer in the document #6963
- if ( elem && elem.parentNode ) {
- // Handle the case where IE and Opera return items
- // by name instead of ID
- if ( elem.id !== match[2] ) {
- return rootjQuery.find( selector );
- }
-
- // Otherwise, we inject the element directly into the jQuery object
- this.length = 1;
- this[0] = elem;
- }
-
- this.context = document;
- this.selector = selector;
- return this;
- }
-
- // HANDLE: $(expr, $(...))
- } else if ( !context || context.jquery ) {
- return ( context || rootjQuery ).find( selector );
-
- // HANDLE: $(expr, context)
- // (which is just equivalent to: $(context).find(expr)
- } else {
- return this.constructor( context ).find( selector );
- }
-
- // HANDLE: $(function)
- // Shortcut for document ready
- } else if ( jQuery.isFunction( selector ) ) {
- return rootjQuery.ready( selector );
- }
-
- if ( selector.selector !== undefined ) {
- this.selector = selector.selector;
- this.context = selector.context;
- }
-
- return jQuery.makeArray( selector, this );
- },
-
- // Start with an empty selector
- selector: "",
-
- // The current version of jQuery being used
- jquery: "1.7.2",
-
- // The default length of a jQuery object is 0
- length: 0,
-
- // The number of elements contained in the matched element set
- size: function() {
- return this.length;
- },
-
- toArray: function() {
- return slice.call( this, 0 );
- },
-
- // Get the Nth element in the matched element set OR
- // Get the whole matched element set as a clean array
- get: function( num ) {
- return num == null ?
-
- // Return a 'clean' array
- this.toArray() :
-
- // Return just the object
- ( num < 0 ? this[ this.length + num ] : this[ num ] );
- },
-
- // Take an array of elements and push it onto the stack
- // (returning the new matched element set)
- pushStack: function( elems, name, selector ) {
- // Build a new jQuery matched element set
- var ret = this.constructor();
-
- if ( jQuery.isArray( elems ) ) {
- push.apply( ret, elems );
-
- } else {
- jQuery.merge( ret, elems );
- }
-
- // Add the old object onto the stack (as a reference)
- ret.prevObject = this;
-
- ret.context = this.context;
-
- if ( name === "find" ) {
- ret.selector = this.selector + ( this.selector ? " " : "" ) + selector;
- } else if ( name ) {
- ret.selector = this.selector + "." + name + "(" + selector + ")";
- }
-
- // Return the newly-formed element set
- return ret;
- },
-
- // Execute a callback for every element in the matched set.
- // (You can seed the arguments with an array of args, but this is
- // only used internally.)
- each: function( callback, args ) {
- return jQuery.each( this, callback, args );
- },
-
- ready: function( fn ) {
- // Attach the listeners
- jQuery.bindReady();
-
- // Add the callback
- readyList.add( fn );
-
- return this;
- },
-
- eq: function( i ) {
- i = +i;
- return i === -1 ?
- this.slice( i ) :
- this.slice( i, i + 1 );
- },
-
- first: function() {
- return this.eq( 0 );
- },
-
- last: function() {
- return this.eq( -1 );
- },
-
- slice: function() {
- return this.pushStack( slice.apply( this, arguments ),
- "slice", slice.call(arguments).join(",") );
- },
-
- map: function( callback ) {
- return this.pushStack( jQuery.map(this, function( elem, i ) {
- return callback.call( elem, i, elem );
- }));
- },
-
- end: function() {
- return this.prevObject || this.constructor(null);
- },
-
- // For internal use only.
- // Behaves like an Array's method, not like a jQuery method.
- push: push,
- sort: [].sort,
- splice: [].splice
-};
-
-// Give the init function the jQuery prototype for later instantiation
-jQuery.fn.init.prototype = jQuery.fn;
-
-jQuery.extend = jQuery.fn.extend = function() {
- var options, name, src, copy, copyIsArray, clone,
- target = arguments[0] || {},
- i = 1,
- length = arguments.length,
- deep = false;
-
- // Handle a deep copy situation
- if ( typeof target === "boolean" ) {
- deep = target;
- target = arguments[1] || {};
- // skip the boolean and the target
- i = 2;
- }
-
- // Handle case when target is a string or something (possible in deep copy)
- if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
- target = {};
- }
-
- // extend jQuery itself if only one argument is passed
- if ( length === i ) {
- target = this;
- --i;
- }
-
- for ( ; i < length; i++ ) {
- // Only deal with non-null/undefined values
- if ( (options = arguments[ i ]) != null ) {
- // Extend the base object
- for ( name in options ) {
- src = target[ name ];
- copy = options[ name ];
-
- // Prevent never-ending loop
- if ( target === copy ) {
- continue;
- }
-
- // Recurse if we're merging plain objects or arrays
- if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
- if ( copyIsArray ) {
- copyIsArray = false;
- clone = src && jQuery.isArray(src) ? src : [];
-
- } else {
- clone = src && jQuery.isPlainObject(src) ? src : {};
- }
-
- // Never move original objects, clone them
- target[ name ] = jQuery.extend( deep, clone, copy );
-
- // Don't bring in undefined values
- } else if ( copy !== undefined ) {
- target[ name ] = copy;
- }
- }
- }
- }
-
- // Return the modified object
- return target;
-};
-
-jQuery.extend({
- noConflict: function( deep ) {
- if ( window.$ === jQuery ) {
- window.$ = _$;
- }
-
- if ( deep && window.jQuery === jQuery ) {
- window.jQuery = _jQuery;
- }
-
- return jQuery;
- },
-
- // Is the DOM ready to be used? Set to true once it occurs.
- isReady: false,
-
- // A counter to track how many items to wait for before
- // the ready event fires. See #6781
- readyWait: 1,
-
- // Hold (or release) the ready event
- holdReady: function( hold ) {
- if ( hold ) {
- jQuery.readyWait++;
- } else {
- jQuery.ready( true );
- }
- },
-
- // Handle when the DOM is ready
- ready: function( wait ) {
- // Either a released hold or an DOMready/load event and not yet ready
- if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) {
- // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
- if ( !document.body ) {
- return setTimeout( jQuery.ready, 1 );
- }
-
- // Remember that the DOM is ready
- jQuery.isReady = true;
-
- // If a normal DOM Ready event fired, decrement, and wait if need be
- if ( wait !== true && --jQuery.readyWait > 0 ) {
- return;
- }
-
- // If there are functions bound, to execute
- readyList.fireWith( document, [ jQuery ] );
-
- // Trigger any bound ready events
- if ( jQuery.fn.trigger ) {
- jQuery( document ).trigger( "ready" ).off( "ready" );
- }
- }
- },
-
- bindReady: function() {
- if ( readyList ) {
- return;
- }
-
- readyList = jQuery.Callbacks( "once memory" );
-
- // Catch cases where $(document).ready() is called after the
- // browser event has already occurred.
- if ( document.readyState === "complete" ) {
- // Handle it asynchronously to allow scripts the opportunity to delay ready
- return setTimeout( jQuery.ready, 1 );
- }
-
- // Mozilla, Opera and webkit nightlies currently support this event
- if ( document.addEventListener ) {
- // Use the handy event callback
- document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
-
- // A fallback to window.onload, that will always work
- window.addEventListener( "load", jQuery.ready, false );
-
- // If IE event model is used
- } else if ( document.attachEvent ) {
- // ensure firing before onload,
- // maybe late but safe also for iframes
- document.attachEvent( "onreadystatechange", DOMContentLoaded );
-
- // A fallback to window.onload, that will always work
- window.attachEvent( "onload", jQuery.ready );
-
- // If IE and not a frame
- // continually check to see if the document is ready
- var toplevel = false;
-
- try {
- toplevel = window.frameElement == null;
- } catch(e) {}
-
- if ( document.documentElement.doScroll && toplevel ) {
- doScrollCheck();
- }
- }
- },
-
- // See test/unit/core.js for details concerning isFunction.
- // Since version 1.3, DOM methods and functions like alert
- // aren't supported. They return false on IE (#2968).
- isFunction: function( obj ) {
- return jQuery.type(obj) === "function";
- },
-
- isArray: Array.isArray || function( obj ) {
- return jQuery.type(obj) === "array";
- },
-
- isWindow: function( obj ) {
- return obj != null && obj == obj.window;
- },
-
- isNumeric: function( obj ) {
- return !isNaN( parseFloat(obj) ) && isFinite( obj );
- },
-
- type: function( obj ) {
- return obj == null ?
- String( obj ) :
- class2type[ toString.call(obj) ] || "object";
- },
-
- isPlainObject: function( obj ) {
- // Must be an Object.
- // Because of IE, we also have to check the presence of the constructor property.
- // Make sure that DOM nodes and window objects don't pass through, as well
- if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
- return false;
- }
-
- try {
- // Not own constructor property must be Object
- if ( obj.constructor &&
- !hasOwn.call(obj, "constructor") &&
- !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
- return false;
- }
- } catch ( e ) {
- // IE8,9 Will throw exceptions on certain host objects #9897
- return false;
- }
-
- // Own properties are enumerated firstly, so to speed up,
- // if last one is own, then all properties are own.
-
- var key;
- for ( key in obj ) {}
-
- return key === undefined || hasOwn.call( obj, key );
- },
-
- isEmptyObject: function( obj ) {
- for ( var name in obj ) {
- return false;
- }
- return true;
- },
-
- error: function( msg ) {
- throw new Error( msg );
- },
-
- parseJSON: function( data ) {
- if ( typeof data !== "string" || !data ) {
- return null;
- }
-
- // Make sure leading/trailing whitespace is removed (IE can't handle it)
- data = jQuery.trim( data );
-
- // Attempt to parse using the native JSON parser first
- if ( window.JSON && window.JSON.parse ) {
- return window.JSON.parse( data );
- }
-
- // Make sure the incoming data is actual JSON
- // Logic borrowed from http://json.org/json2.js
- if ( rvalidchars.test( data.replace( rvalidescape, "@" )
- .replace( rvalidtokens, "]" )
- .replace( rvalidbraces, "")) ) {
-
- return ( new Function( "return " + data ) )();
-
- }
- jQuery.error( "Invalid JSON: " + data );
- },
-
- // Cross-browser xml parsing
- parseXML: function( data ) {
- if ( typeof data !== "string" || !data ) {
- return null;
- }
- var xml, tmp;
- try {
- if ( window.DOMParser ) { // Standard
- tmp = new DOMParser();
- xml = tmp.parseFromString( data , "text/xml" );
- } else { // IE
- xml = new ActiveXObject( "Microsoft.XMLDOM" );
- xml.async = "false";
- xml.loadXML( data );
- }
- } catch( e ) {
- xml = undefined;
- }
- if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
- jQuery.error( "Invalid XML: " + data );
- }
- return xml;
- },
-
- noop: function() {},
-
- // Evaluates a script in a global context
- // Workarounds based on findings by Jim Driscoll
- // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
- globalEval: function( data ) {
- if ( data && rnotwhite.test( data ) ) {
- // We use execScript on Internet Explorer
- // We use an anonymous function so that context is window
- // rather than jQuery in Firefox
- ( window.execScript || function( data ) {
- window[ "eval" ].call( window, data );
- } )( data );
- }
- },
-
- // Convert dashed to camelCase; used by the css and data modules
- // Microsoft forgot to hump their vendor prefix (#9572)
- camelCase: function( string ) {
- return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
- },
-
- nodeName: function( elem, name ) {
- return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
- },
-
- // args is for internal usage only
- each: function( object, callback, args ) {
- var name, i = 0,
- length = object.length,
- isObj = length === undefined || jQuery.isFunction( object );
-
- if ( args ) {
- if ( isObj ) {
- for ( name in object ) {
- if ( callback.apply( object[ name ], args ) === false ) {
- break;
- }
- }
- } else {
- for ( ; i < length; ) {
- if ( callback.apply( object[ i++ ], args ) === false ) {
- break;
- }
- }
- }
-
- // A special, fast, case for the most common use of each
- } else {
- if ( isObj ) {
- for ( name in object ) {
- if ( callback.call( object[ name ], name, object[ name ] ) === false ) {
- break;
- }
- }
- } else {
- for ( ; i < length; ) {
- if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) {
- break;
- }
- }
- }
- }
-
- return object;
- },
-
- // Use native String.trim function wherever possible
- trim: trim ?
- function( text ) {
- return text == null ?
- "" :
- trim.call( text );
- } :
-
- // Otherwise use our own trimming functionality
- function( text ) {
- return text == null ?
- "" :
- text.toString().replace( trimLeft, "" ).replace( trimRight, "" );
- },
-
- // results is for internal usage only
- makeArray: function( array, results ) {
- var ret = results || [];
-
- if ( array != null ) {
- // The window, strings (and functions) also have 'length'
- // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
- var type = jQuery.type( array );
-
- if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {
- push.call( ret, array );
- } else {
- jQuery.merge( ret, array );
- }
- }
-
- return ret;
- },
-
- inArray: function( elem, array, i ) {
- var len;
-
- if ( array ) {
- if ( indexOf ) {
- return indexOf.call( array, elem, i );
- }
-
- len = array.length;
- i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
-
- for ( ; i < len; i++ ) {
- // Skip accessing in sparse arrays
- if ( i in array && array[ i ] === elem ) {
- return i;
- }
- }
- }
-
- return -1;
- },
-
- merge: function( first, second ) {
- var i = first.length,
- j = 0;
-
- if ( typeof second.length === "number" ) {
- for ( var l = second.length; j < l; j++ ) {
- first[ i++ ] = second[ j ];
- }
-
- } else {
- while ( second[j] !== undefined ) {
- first[ i++ ] = second[ j++ ];
- }
- }
-
- first.length = i;
-
- return first;
- },
-
- grep: function( elems, callback, inv ) {
- var ret = [], retVal;
- inv = !!inv;
-
- // Go through the array, only saving the items
- // that pass the validator function
- for ( var i = 0, length = elems.length; i < length; i++ ) {
- retVal = !!callback( elems[ i ], i );
- if ( inv !== retVal ) {
- ret.push( elems[ i ] );
- }
- }
-
- return ret;
- },
-
- // arg is for internal usage only
- map: function( elems, callback, arg ) {
- var value, key, ret = [],
- i = 0,
- length = elems.length,
- // jquery objects are treated as arrays
- isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ;
-
- // Go through the array, translating each of the items to their
- if ( isArray ) {
- for ( ; i < length; i++ ) {
- value = callback( elems[ i ], i, arg );
-
- if ( value != null ) {
- ret[ ret.length ] = value;
- }
- }
-
- // Go through every key on the object,
- } else {
- for ( key in elems ) {
- value = callback( elems[ key ], key, arg );
-
- if ( value != null ) {
- ret[ ret.length ] = value;
- }
- }
- }
-
- // Flatten any nested arrays
- return ret.concat.apply( [], ret );
- },
-
- // A global GUID counter for objects
- guid: 1,
-
- // Bind a function to a context, optionally partially applying any
- // arguments.
- proxy: function( fn, context ) {
- if ( typeof context === "string" ) {
- var tmp = fn[ context ];
- context = fn;
- fn = tmp;
- }
-
- // Quick check to determine if target is callable, in the spec
- // this throws a TypeError, but we will just return undefined.
- if ( !jQuery.isFunction( fn ) ) {
- return undefined;
- }
-
- // Simulated bind
- var args = slice.call( arguments, 2 ),
- proxy = function() {
- return fn.apply( context, args.concat( slice.call( arguments ) ) );
- };
-
- // Set the guid of unique handler to the same of original handler, so it can be removed
- proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
-
- return proxy;
- },
-
- // Mutifunctional method to get and set values to a collection
- // The value/s can optionally be executed if it's a function
- access: function( elems, fn, key, value, chainable, emptyGet, pass ) {
- var exec,
- bulk = key == null,
- i = 0,
- length = elems.length;
-
- // Sets many values
- if ( key && typeof key === "object" ) {
- for ( i in key ) {
- jQuery.access( elems, fn, i, key[i], 1, emptyGet, value );
- }
- chainable = 1;
-
- // Sets one value
- } else if ( value !== undefined ) {
- // Optionally, function values get executed if exec is true
- exec = pass === undefined && jQuery.isFunction( value );
-
- if ( bulk ) {
- // Bulk operations only iterate when executing function values
- if ( exec ) {
- exec = fn;
- fn = function( elem, key, value ) {
- return exec.call( jQuery( elem ), value );
- };
-
- // Otherwise they run against the entire set
- } else {
- fn.call( elems, value );
- fn = null;
- }
- }
-
- if ( fn ) {
- for (; i < length; i++ ) {
- fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
- }
- }
-
- chainable = 1;
- }
-
- return chainable ?
- elems :
-
- // Gets
- bulk ?
- fn.call( elems ) :
- length ? fn( elems[0], key ) : emptyGet;
- },
-
- now: function() {
- return ( new Date() ).getTime();
- },
-
- // Use of jQuery.browser is frowned upon.
- // More details: http://docs.jquery.com/Utilities/jQuery.browser
- uaMatch: function( ua ) {
- ua = ua.toLowerCase();
-
- var match = rwebkit.exec( ua ) ||
- ropera.exec( ua ) ||
- rmsie.exec( ua ) ||
- ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||
- [];
-
- return { browser: match[1] || "", version: match[2] || "0" };
- },
-
- sub: function() {
- function jQuerySub( selector, context ) {
- return new jQuerySub.fn.init( selector, context );
- }
- jQuery.extend( true, jQuerySub, this );
- jQuerySub.superclass = this;
- jQuerySub.fn = jQuerySub.prototype = this();
- jQuerySub.fn.constructor = jQuerySub;
- jQuerySub.sub = this.sub;
- jQuerySub.fn.init = function init( selector, context ) {
- if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
- context = jQuerySub( context );
- }
-
- return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
- };
- jQuerySub.fn.init.prototype = jQuerySub.fn;
- var rootjQuerySub = jQuerySub(document);
- return jQuerySub;
- },
-
- browser: {}
-});
-
-// Populate the class2type map
-jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
- class2type[ "[object " + name + "]" ] = name.toLowerCase();
-});
-
-browserMatch = jQuery.uaMatch( userAgent );
-if ( browserMatch.browser ) {
- jQuery.browser[ browserMatch.browser ] = true;
- jQuery.browser.version = browserMatch.version;
-}
-
-// Deprecated, use jQuery.browser.webkit instead
-if ( jQuery.browser.webkit ) {
- jQuery.browser.safari = true;
-}
-
-// IE doesn't match non-breaking spaces with \s
-if ( rnotwhite.test( "\xA0" ) ) {
- trimLeft = /^[\s\xA0]+/;
- trimRight = /[\s\xA0]+$/;
-}
-
-// All jQuery objects should point back to these
-rootjQuery = jQuery(document);
-
-// Cleanup functions for the document ready method
-if ( document.addEventListener ) {
- DOMContentLoaded = function() {
- document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
- jQuery.ready();
- };
-
-} else if ( document.attachEvent ) {
- DOMContentLoaded = function() {
- // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
- if ( document.readyState === "complete" ) {
- document.detachEvent( "onreadystatechange", DOMContentLoaded );
- jQuery.ready();
- }
- };
-}
-
-// The DOM ready check for Internet Explorer
-function doScrollCheck() {
- if ( jQuery.isReady ) {
- return;
- }
-
- try {
- // If IE is used, use the trick by Diego Perini
- // http://javascript.nwbox.com/IEContentLoaded/
- document.documentElement.doScroll("left");
- } catch(e) {
- setTimeout( doScrollCheck, 1 );
- return;
- }
-
- // and execute any waiting functions
- jQuery.ready();
-}
-
-return jQuery;
-
-})();
-
-
-// String to Object flags format cache
-var flagsCache = {};
-
-// Convert String-formatted flags into Object-formatted ones and store in cache
-function createFlags( flags ) {
- var object = flagsCache[ flags ] = {},
- i, length;
- flags = flags.split( /\s+/ );
- for ( i = 0, length = flags.length; i < length; i++ ) {
- object[ flags[i] ] = true;
- }
- return object;
-}
-
-/*
- * Create a callback list using the following parameters:
- *
- * flags: an optional list of space-separated flags that will change how
- * the callback list behaves
- *
- * By default a callback list will act like an event callback list and can be
- * "fired" multiple times.
- *
- * Possible flags:
- *
- * once: will ensure the callback list can only be fired once (like a Deferred)
- *
- * memory: will keep track of previous values and will call any callback added
- * after the list has been fired right away with the latest "memorized"
- * values (like a Deferred)
- *
- * unique: will ensure a callback can only be added once (no duplicate in the list)
- *
- * stopOnFalse: interrupt callings when a callback returns false
- *
- */
-jQuery.Callbacks = function( flags ) {
-
- // Convert flags from String-formatted to Object-formatted
- // (we check in cache first)
- flags = flags ? ( flagsCache[ flags ] || createFlags( flags ) ) : {};
-
- var // Actual callback list
- list = [],
- // Stack of fire calls for repeatable lists
- stack = [],
- // Last fire value (for non-forgettable lists)
- memory,
- // Flag to know if list was already fired
- fired,
- // Flag to know if list is currently firing
- firing,
- // First callback to fire (used internally by add and fireWith)
- firingStart,
- // End of the loop when firing
- firingLength,
- // Index of currently firing callback (modified by remove if needed)
- firingIndex,
- // Add one or several callbacks to the list
- add = function( args ) {
- var i,
- length,
- elem,
- type,
- actual;
- for ( i = 0, length = args.length; i < length; i++ ) {
- elem = args[ i ];
- type = jQuery.type( elem );
- if ( type === "array" ) {
- // Inspect recursively
- add( elem );
- } else if ( type === "function" ) {
- // Add if not in unique mode and callback is not in
- if ( !flags.unique || !self.has( elem ) ) {
- list.push( elem );
- }
- }
- }
- },
- // Fire callbacks
- fire = function( context, args ) {
- args = args || [];
- memory = !flags.memory || [ context, args ];
- fired = true;
- firing = true;
- firingIndex = firingStart || 0;
- firingStart = 0;
- firingLength = list.length;
- for ( ; list && firingIndex < firingLength; firingIndex++ ) {
- if ( list[ firingIndex ].apply( context, args ) === false && flags.stopOnFalse ) {
- memory = true; // Mark as halted
- break;
- }
- }
- firing = false;
- if ( list ) {
- if ( !flags.once ) {
- if ( stack && stack.length ) {
- memory = stack.shift();
- self.fireWith( memory[ 0 ], memory[ 1 ] );
- }
- } else if ( memory === true ) {
- self.disable();
- } else {
- list = [];
- }
- }
- },
- // Actual Callbacks object
- self = {
- // Add a callback or a collection of callbacks to the list
- add: function() {
- if ( list ) {
- var length = list.length;
- add( arguments );
- // Do we need to add the callbacks to the
- // current firing batch?
- if ( firing ) {
- firingLength = list.length;
- // With memory, if we're not firing then
- // we should call right away, unless previous
- // firing was halted (stopOnFalse)
- } else if ( memory && memory !== true ) {
- firingStart = length;
- fire( memory[ 0 ], memory[ 1 ] );
- }
- }
- return this;
- },
- // Remove a callback from the list
- remove: function() {
- if ( list ) {
- var args = arguments,
- argIndex = 0,
- argLength = args.length;
- for ( ; argIndex < argLength ; argIndex++ ) {
- for ( var i = 0; i < list.length; i++ ) {
- if ( args[ argIndex ] === list[ i ] ) {
- // Handle firingIndex and firingLength
- if ( firing ) {
- if ( i <= firingLength ) {
- firingLength--;
- if ( i <= firingIndex ) {
- firingIndex--;
- }
- }
- }
- // Remove the element
- list.splice( i--, 1 );
- // If we have some unicity property then
- // we only need to do this once
- if ( flags.unique ) {
- break;
- }
- }
- }
- }
- }
- return this;
- },
- // Control if a given callback is in the list
- has: function( fn ) {
- if ( list ) {
- var i = 0,
- length = list.length;
- for ( ; i < length; i++ ) {
- if ( fn === list[ i ] ) {
- return true;
- }
- }
- }
- return false;
- },
- // Remove all callbacks from the list
- empty: function() {
- list = [];
- return this;
- },
- // Have the list do nothing anymore
- disable: function() {
- list = stack = memory = undefined;
- return this;
- },
- // Is it disabled?
- disabled: function() {
- return !list;
- },
- // Lock the list in its current state
- lock: function() {
- stack = undefined;
- if ( !memory || memory === true ) {
- self.disable();
- }
- return this;
- },
- // Is it locked?
- locked: function() {
- return !stack;
- },
- // Call all callbacks with the given context and arguments
- fireWith: function( context, args ) {
- if ( stack ) {
- if ( firing ) {
- if ( !flags.once ) {
- stack.push( [ context, args ] );
- }
- } else if ( !( flags.once && memory ) ) {
- fire( context, args );
- }
- }
- return this;
- },
- // Call all the callbacks with the given arguments
- fire: function() {
- self.fireWith( this, arguments );
- return this;
- },
- // To know if the callbacks have already been called at least once
- fired: function() {
- return !!fired;
- }
- };
-
- return self;
-};
-
-
-
-
-var // Static reference to slice
- sliceDeferred = [].slice;
-
-jQuery.extend({
-
- Deferred: function( func ) {
- var doneList = jQuery.Callbacks( "once memory" ),
- failList = jQuery.Callbacks( "once memory" ),
- progressList = jQuery.Callbacks( "memory" ),
- state = "pending",
- lists = {
- resolve: doneList,
- reject: failList,
- notify: progressList
- },
- promise = {
- done: doneList.add,
- fail: failList.add,
- progress: progressList.add,
-
- state: function() {
- return state;
- },
-
- // Deprecated
- isResolved: doneList.fired,
- isRejected: failList.fired,
-
- then: function( doneCallbacks, failCallbacks, progressCallbacks ) {
- deferred.done( doneCallbacks ).fail( failCallbacks ).progress( progressCallbacks );
- return this;
- },
- always: function() {
- deferred.done.apply( deferred, arguments ).fail.apply( deferred, arguments );
- return this;
- },
- pipe: function( fnDone, fnFail, fnProgress ) {
- return jQuery.Deferred(function( newDefer ) {
- jQuery.each( {
- done: [ fnDone, "resolve" ],
- fail: [ fnFail, "reject" ],
- progress: [ fnProgress, "notify" ]
- }, function( handler, data ) {
- var fn = data[ 0 ],
- action = data[ 1 ],
- returned;
- if ( jQuery.isFunction( fn ) ) {
- deferred[ handler ](function() {
- returned = fn.apply( this, arguments );
- if ( returned && jQuery.isFunction( returned.promise ) ) {
- returned.promise().then( newDefer.resolve, newDefer.reject, newDefer.notify );
- } else {
- newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] );
- }
- });
- } else {
- deferred[ handler ]( newDefer[ action ] );
- }
- });
- }).promise();
- },
- // Get a promise for this deferred
- // If obj is provided, the promise aspect is added to the object
- promise: function( obj ) {
- if ( obj == null ) {
- obj = promise;
- } else {
- for ( var key in promise ) {
- obj[ key ] = promise[ key ];
- }
- }
- return obj;
- }
- },
- deferred = promise.promise({}),
- key;
-
- for ( key in lists ) {
- deferred[ key ] = lists[ key ].fire;
- deferred[ key + "With" ] = lists[ key ].fireWith;
- }
-
- // Handle state
- deferred.done( function() {
- state = "resolved";
- }, failList.disable, progressList.lock ).fail( function() {
- state = "rejected";
- }, doneList.disable, progressList.lock );
-
- // Call given func if any
- if ( func ) {
- func.call( deferred, deferred );
- }
-
- // All done!
- return deferred;
- },
-
- // Deferred helper
- when: function( firstParam ) {
- var args = sliceDeferred.call( arguments, 0 ),
- i = 0,
- length = args.length,
- pValues = new Array( length ),
- count = length,
- pCount = length,
- deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ?
- firstParam :
- jQuery.Deferred(),
- promise = deferred.promise();
- function resolveFunc( i ) {
- return function( value ) {
- args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
- if ( !( --count ) ) {
- deferred.resolveWith( deferred, args );
- }
- };
- }
- function progressFunc( i ) {
- return function( value ) {
- pValues[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
- deferred.notifyWith( promise, pValues );
- };
- }
- if ( length > 1 ) {
- for ( ; i < length; i++ ) {
- if ( args[ i ] && args[ i ].promise && jQuery.isFunction( args[ i ].promise ) ) {
- args[ i ].promise().then( resolveFunc(i), deferred.reject, progressFunc(i) );
- } else {
- --count;
- }
- }
- if ( !count ) {
- deferred.resolveWith( deferred, args );
- }
- } else if ( deferred !== firstParam ) {
- deferred.resolveWith( deferred, length ? [ firstParam ] : [] );
- }
- return promise;
- }
-});
-
-
-
-
-jQuery.support = (function() {
-
- var support,
- all,
- a,
- select,
- opt,
- input,
- fragment,
- tds,
- events,
- eventName,
- i,
- isSupported,
- div = document.createElement( "div" ),
- documentElement = document.documentElement;
-
- // Preliminary tests
- div.setAttribute("className", "t");
- div.innerHTML = " <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
-
- all = div.getElementsByTagName( "*" );
- a = div.getElementsByTagName( "a" )[ 0 ];
-
- // Can't get basic test support
- if ( !all || !all.length || !a ) {
- return {};
- }
-
- // First batch of supports tests
- select = document.createElement( "select" );
- opt = select.appendChild( document.createElement("option") );
- input = div.getElementsByTagName( "input" )[ 0 ];
-
- support = {
- // IE strips leading whitespace when .innerHTML is used
- leadingWhitespace: ( div.firstChild.nodeType === 3 ),
-
- // Make sure that tbody elements aren't automatically inserted
- // IE will insert them into empty tables
- tbody: !div.getElementsByTagName("tbody").length,
-
- // Make sure that link elements get serialized correctly by innerHTML
- // This requires a wrapper element in IE
- htmlSerialize: !!div.getElementsByTagName("link").length,
-
- // Get the style information from getAttribute
- // (IE uses .cssText instead)
- style: /top/.test( a.getAttribute("style") ),
-
- // Make sure that URLs aren't manipulated
- // (IE normalizes it by default)
- hrefNormalized: ( a.getAttribute("href") === "/a" ),
-
- // Make sure that element opacity exists
- // (IE uses filter instead)
- // Use a regex to work around a WebKit issue. See #5145
- opacity: /^0.55/.test( a.style.opacity ),
-
- // Verify style float existence
- // (IE uses styleFloat instead of cssFloat)
- cssFloat: !!a.style.cssFloat,
-
- // Make sure that if no value is specified for a checkbox
- // that it defaults to "on".
- // (WebKit defaults to "" instead)
- checkOn: ( input.value === "on" ),
-
- // Make sure that a selected-by-default option has a working selected property.
- // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
- optSelected: opt.selected,
-
- // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
- getSetAttribute: div.className !== "t",
-
- // Tests for enctype support on a form(#6743)
- enctype: !!document.createElement("form").enctype,
-
- // Makes sure cloning an html5 element does not cause problems
- // Where outerHTML is undefined, this still works
- html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>",
-
- // Will be defined later
- submitBubbles: true,
- changeBubbles: true,
- focusinBubbles: false,
- deleteExpando: true,
- noCloneEvent: true,
- inlineBlockNeedsLayout: false,
- shrinkWrapBlocks: false,
- reliableMarginRight: true,
- pixelMargin: true
- };
-
- // jQuery.boxModel DEPRECATED in 1.3, use jQuery.support.boxModel instead
- jQuery.boxModel = support.boxModel = (document.compatMode === "CSS1Compat");
-
- // Make sure checked status is properly cloned
- input.checked = true;
- support.noCloneChecked = input.cloneNode( true ).checked;
-
- // Make sure that the options inside disabled selects aren't marked as disabled
- // (WebKit marks them as disabled)
- select.disabled = true;
- support.optDisabled = !opt.disabled;
-
- // Test to see if it's possible to delete an expando from an element
- // Fails in Internet Explorer
- try {
- delete div.test;
- } catch( e ) {
- support.deleteExpando = false;
- }
-
- if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
- div.attachEvent( "onclick", function() {
- // Cloning a node shouldn't copy over any
- // bound event handlers (IE does this)
- support.noCloneEvent = false;
- });
- div.cloneNode( true ).fireEvent( "onclick" );
- }
-
- // Check if a radio maintains its value
- // after being appended to the DOM
- input = document.createElement("input");
- input.value = "t";
- input.setAttribute("type", "radio");
- support.radioValue = input.value === "t";
-
- input.setAttribute("checked", "checked");
-
- // #11217 - WebKit loses check when the name is after the checked attribute
- input.setAttribute( "name", "t" );
-
- div.appendChild( input );
- fragment = document.createDocumentFragment();
- fragment.appendChild( div.lastChild );
-
- // WebKit doesn't clone checked state correctly in fragments
- support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
-
- // Check if a disconnected checkbox will retain its checked
- // value of true after appended to the DOM (IE6/7)
- support.appendChecked = input.checked;
-
- fragment.removeChild( input );
- fragment.appendChild( div );
-
- // Technique from Juriy Zaytsev
- // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/
- // We only care about the case where non-standard event systems
- // are used, namely in IE. Short-circuiting here helps us to
- // avoid an eval call (in setAttribute) which can cause CSP
- // to go haywire. See: https://developer.mozilla.org/en/Security/CSP
- if ( div.attachEvent ) {
- for ( i in {
- submit: 1,
- change: 1,
- focusin: 1
- }) {
- eventName = "on" + i;
- isSupported = ( eventName in div );
- if ( !isSupported ) {
- div.setAttribute( eventName, "return;" );
- isSupported = ( typeof div[ eventName ] === "function" );
- }
- support[ i + "Bubbles" ] = isSupported;
- }
- }
-
- fragment.removeChild( div );
-
- // Null elements to avoid leaks in IE
- fragment = select = opt = div = input = null;
-
- // Run tests that need a body at doc ready
- jQuery(function() {
- var container, outer, inner, table, td, offsetSupport,
- marginDiv, conMarginTop, style, html, positionTopLeftWidthHeight,
- paddingMarginBorderVisibility, paddingMarginBorder,
- body = document.getElementsByTagName("body")[0];
-
- if ( !body ) {
- // Return for frameset docs that don't have a body
- return;
- }
-
- conMarginTop = 1;
- paddingMarginBorder = "padding:0;margin:0;border:";
- positionTopLeftWidthHeight = "position:absolute;top:0;left:0;width:1px;height:1px;";
- paddingMarginBorderVisibility = paddingMarginBorder + "0;visibility:hidden;";
- style = "style='" + positionTopLeftWidthHeight + paddingMarginBorder + "5px solid #000;";
- html = "<div " + style + "display:block;'><div style='" + paddingMarginBorder + "0;display:block;overflow:hidden;'></div></div>" +
- "<table " + style + "' cellpadding='0' cellspacing='0'>" +
- "<tr><td></td></tr></table>";
-
- container = document.createElement("div");
- container.style.cssText = paddingMarginBorderVisibility + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px";
- body.insertBefore( container, body.firstChild );
-
- // Construct the test element
- div = document.createElement("div");
- container.appendChild( div );
-
- // Check if table cells still have offsetWidth/Height when they are set
- // to display:none and there are still other visible table cells in a
- // table row; if so, offsetWidth/Height are not reliable for use when
- // determining if an element has been hidden directly using
- // display:none (it is still safe to use offsets if a parent element is
- // hidden; don safety goggles and see bug #4512 for more information).
- // (only IE 8 fails this test)
- div.innerHTML = "<table><tr><td style='" + paddingMarginBorder + "0;display:none'></td><td>t</td></tr></table>";
- tds = div.getElementsByTagName( "td" );
- isSupported = ( tds[ 0 ].offsetHeight === 0 );
-
- tds[ 0 ].style.display = "";
- tds[ 1 ].style.display = "none";
-
- // Check if empty table cells still have offsetWidth/Height
- // (IE <= 8 fail this test)
- support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
-
- // Check if div with explicit width and no margin-right incorrectly
- // gets computed margin-right based on width of container. For more
- // info see bug #3333
- // Fails in WebKit before Feb 2011 nightlies
- // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
- if ( window.getComputedStyle ) {
- div.innerHTML = "";
- marginDiv = document.createElement( "div" );
- marginDiv.style.width = "0";
- marginDiv.style.marginRight = "0";
- div.style.width = "2px";
- div.appendChild( marginDiv );
- support.reliableMarginRight =
- ( parseInt( ( window.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0;
- }
-
- if ( typeof div.style.zoom !== "undefined" ) {
- // Check if natively block-level elements act like inline-block
- // elements when setting their display to 'inline' and giving
- // them layout
- // (IE < 8 does this)
- div.innerHTML = "";
- div.style.width = div.style.padding = "1px";
- div.style.border = 0;
- div.style.overflow = "hidden";
- div.style.display = "inline";
- div.style.zoom = 1;
- support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
-
- // Check if elements with layout shrink-wrap their children
- // (IE 6 does this)
- div.style.display = "block";
- div.style.overflow = "visible";
- div.innerHTML = "<div style='width:5px;'></div>";
- support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
- }
-
- div.style.cssText = positionTopLeftWidthHeight + paddingMarginBorderVisibility;
- div.innerHTML = html;
-
- outer = div.firstChild;
- inner = outer.firstChild;
- td = outer.nextSibling.firstChild.firstChild;
-
- offsetSupport = {
- doesNotAddBorder: ( inner.offsetTop !== 5 ),
- doesAddBorderForTableAndCells: ( td.offsetTop === 5 )
- };
-
- inner.style.position = "fixed";
- inner.style.top = "20px";
-
- // safari subtracts parent border width here which is 5px
- offsetSupport.fixedPosition = ( inner.offsetTop === 20 || inner.offsetTop === 15 );
- inner.style.position = inner.style.top = "";
-
- outer.style.overflow = "hidden";
- outer.style.position = "relative";
-
- offsetSupport.subtractsBorderForOverflowNotVisible = ( inner.offsetTop === -5 );
- offsetSupport.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== conMarginTop );
-
- if ( window.getComputedStyle ) {
- div.style.marginTop = "1%";
- support.pixelMargin = ( window.getComputedStyle( div, null ) || { marginTop: 0 } ).marginTop !== "1%";
- }
-
- if ( typeof container.style.zoom !== "undefined" ) {
- container.style.zoom = 1;
- }
-
- body.removeChild( container );
- marginDiv = div = container = null;
-
- jQuery.extend( support, offsetSupport );
- });
-
- return support;
-})();
-
-
-
-
-var rbrace = /^(?:\{.*\}|\[.*\])$/,
- rmultiDash = /([A-Z])/g;
-
-jQuery.extend({
- cache: {},
-
- // Please use with caution
- uuid: 0,
-
- // Unique for each copy of jQuery on the page
- // Non-digits removed to match rinlinejQuery
- expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ),
-
- // The following elements throw uncatchable exceptions if you
- // attempt to add expando properties to them.
- noData: {
- "embed": true,
- // Ban all objects except for Flash (which handle expandos)
- "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
- "applet": true
- },
-
- hasData: function( elem ) {
- elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
- return !!elem && !isEmptyDataObject( elem );
- },
-
- data: function( elem, name, data, pvt /* Internal Use Only */ ) {
- if ( !jQuery.acceptData( elem ) ) {
- return;
- }
-
- var privateCache, thisCache, ret,
- internalKey = jQuery.expando,
- getByName = typeof name === "string",
-
- // We have to handle DOM nodes and JS objects differently because IE6-7
- // can't GC object references properly across the DOM-JS boundary
- isNode = elem.nodeType,
-
- // Only DOM nodes need the global jQuery cache; JS object data is
- // attached directly to the object so GC can occur automatically
- cache = isNode ? jQuery.cache : elem,
-
- // Only defining an ID for JS objects if its cache already exists allows
- // the code to shortcut on the same path as a DOM node with no cache
- id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey,
- isEvents = name === "events";
-
- // Avoid doing any more work than we need to when trying to get data on an
- // object that has no data at all
- if ( (!id || !cache[id] || (!isEvents && !pvt && !cache[id].data)) && getByName && data === undefined ) {
- return;
- }
-
- if ( !id ) {
- // Only DOM nodes need a new unique ID for each element since their data
- // ends up in the global cache
- if ( isNode ) {
- elem[ internalKey ] = id = ++jQuery.uuid;
- } else {
- id = internalKey;
- }
- }
-
- if ( !cache[ id ] ) {
- cache[ id ] = {};
-
- // Avoids exposing jQuery metadata on plain JS objects when the object
- // is serialized using JSON.stringify
- if ( !isNode ) {
- cache[ id ].toJSON = jQuery.noop;
- }
- }
-
- // An object can be passed to jQuery.data instead of a key/value pair; this gets
- // shallow copied over onto the existing cache
- if ( typeof name === "object" || typeof name === "function" ) {
- if ( pvt ) {
- cache[ id ] = jQuery.extend( cache[ id ], name );
- } else {
- cache[ id ].data = jQuery.extend( cache[ id ].data, name );
- }
- }
-
- privateCache = thisCache = cache[ id ];
-
- // jQuery data() is stored in a separate object inside the object's internal data
- // cache in order to avoid key collisions between internal data and user-defined
- // data.
- if ( !pvt ) {
- if ( !thisCache.data ) {
- thisCache.data = {};
- }
-
- thisCache = thisCache.data;
- }
-
- if ( data !== undefined ) {
- thisCache[ jQuery.camelCase( name ) ] = data;
- }
-
- // Users should not attempt to inspect the internal events object using jQuery.data,
- // it is undocumented and subject to change. But does anyone listen? No.
- if ( isEvents && !thisCache[ name ] ) {
- return privateCache.events;
- }
-
- // Check for both converted-to-camel and non-converted data property names
- // If a data property was specified
- if ( getByName ) {
-
- // First Try to find as-is property data
- ret = thisCache[ name ];
-
- // Test for null|undefined property data
- if ( ret == null ) {
-
- // Try to find the camelCased property
- ret = thisCache[ jQuery.camelCase( name ) ];
- }
- } else {
- ret = thisCache;
- }
-
- return ret;
- },
-
- removeData: function( elem, name, pvt /* Internal Use Only */ ) {
- if ( !jQuery.acceptData( elem ) ) {
- return;
- }
-
- var thisCache, i, l,
-
- // Reference to internal data cache key
- internalKey = jQuery.expando,
-
- isNode = elem.nodeType,
-
- // See jQuery.data for more information
- cache = isNode ? jQuery.cache : elem,
-
- // See jQuery.data for more information
- id = isNode ? elem[ internalKey ] : internalKey;
-
- // If there is already no cache entry for this object, there is no
- // purpose in continuing
- if ( !cache[ id ] ) {
- return;
- }
-
- if ( name ) {
-
- thisCache = pvt ? cache[ id ] : cache[ id ].data;
-
- if ( thisCache ) {
-
- // Support array or space separated string names for data keys
- if ( !jQuery.isArray( name ) ) {
-
- // try the string as a key before any manipulation
- if ( name in thisCache ) {
- name = [ name ];
- } else {
-
- // split the camel cased version by spaces unless a key with the spaces exists
- name = jQuery.camelCase( name );
- if ( name in thisCache ) {
- name = [ name ];
- } else {
- name = name.split( " " );
- }
- }
- }
-
- for ( i = 0, l = name.length; i < l; i++ ) {
- delete thisCache[ name[i] ];
- }
-
- // If there is no data left in the cache, we want to continue
- // and let the cache object itself get destroyed
- if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) {
- return;
- }
- }
- }
-
- // See jQuery.data for more information
- if ( !pvt ) {
- delete cache[ id ].data;
-
- // Don't destroy the parent cache unless the internal data object
- // had been the only thing left in it
- if ( !isEmptyDataObject(cache[ id ]) ) {
- return;
- }
- }
-
- // Browsers that fail expando deletion also refuse to delete expandos on
- // the window, but it will allow it on all other JS objects; other browsers
- // don't care
- // Ensure that `cache` is not a window object #10080
- if ( jQuery.support.deleteExpando || !cache.setInterval ) {
- delete cache[ id ];
- } else {
- cache[ id ] = null;
- }
-
- // We destroyed the cache and need to eliminate the expando on the node to avoid
- // false lookups in the cache for entries that no longer exist
- if ( isNode ) {
- // IE does not allow us to delete expando properties from nodes,
- // nor does it have a removeAttribute function on Document nodes;
- // we must handle all of these cases
- if ( jQuery.support.deleteExpando ) {
- delete elem[ internalKey ];
- } else if ( elem.removeAttribute ) {
- elem.removeAttribute( internalKey );
- } else {
- elem[ internalKey ] = null;
- }
- }
- },
-
- // For internal use only.
- _data: function( elem, name, data ) {
- return jQuery.data( elem, name, data, true );
- },
-
- // A method for determining if a DOM node can handle the data expando
- acceptData: function( elem ) {
- if ( elem.nodeName ) {
- var match = jQuery.noData[ elem.nodeName.toLowerCase() ];
-
- if ( match ) {
- return !(match === true || elem.getAttribute("classid") !== match);
- }
- }
-
- return true;
- }
-});
-
-jQuery.fn.extend({
- data: function( key, value ) {
- var parts, part, attr, name, l,
- elem = this[0],
- i = 0,
- data = null;
-
- // Gets all values
- if ( key === undefined ) {
- if ( this.length ) {
- data = jQuery.data( elem );
-
- if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
- attr = elem.attributes;
- for ( l = attr.length; i < l; i++ ) {
- name = attr[i].name;
-
- if ( name.indexOf( "data-" ) === 0 ) {
- name = jQuery.camelCase( name.substring(5) );
-
- dataAttr( elem, name, data[ name ] );
- }
- }
- jQuery._data( elem, "parsedAttrs", true );
- }
- }
-
- return data;
- }
-
- // Sets multiple values
- if ( typeof key === "object" ) {
- return this.each(function() {
- jQuery.data( this, key );
- });
- }
-
- parts = key.split( ".", 2 );
- parts[1] = parts[1] ? "." + parts[1] : "";
- part = parts[1] + "!";
-
- return jQuery.access( this, function( value ) {
-
- if ( value === undefined ) {
- data = this.triggerHandler( "getData" + part, [ parts[0] ] );
-
- // Try to fetch any internally stored data first
- if ( data === undefined && elem ) {
- data = jQuery.data( elem, key );
- data = dataAttr( elem, key, data );
- }
-
- return data === undefined && parts[1] ?
- this.data( parts[0] ) :
- data;
- }
-
- parts[1] = value;
- this.each(function() {
- var self = jQuery( this );
-
- self.triggerHandler( "setData" + part, parts );
- jQuery.data( this, key, value );
- self.triggerHandler( "changeData" + part, parts );
- });
- }, null, value, arguments.length > 1, null, false );
- },
-
- removeData: function( key ) {
- return this.each(function() {
- jQuery.removeData( this, key );
- });
- }
-});
-
-function dataAttr( elem, key, data ) {
- // If nothing was found internally, try to fetch any
- // data from the HTML5 data-* attribute
- if ( data === undefined && elem.nodeType === 1 ) {
-
- var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
-
- data = elem.getAttribute( name );
-
- if ( typeof data === "string" ) {
- try {
- data = data === "true" ? true :
- data === "false" ? false :
- data === "null" ? null :
- jQuery.isNumeric( data ) ? +data :
- rbrace.test( data ) ? jQuery.parseJSON( data ) :
- data;
- } catch( e ) {}
-
- // Make sure we set the data so it isn't changed later
- jQuery.data( elem, key, data );
-
- } else {
- data = undefined;
- }
- }
-
- return data;
-}
-
-// checks a cache object for emptiness
-function isEmptyDataObject( obj ) {
- for ( var name in obj ) {
-
- // if the public data object is empty, the private is still empty
- if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
- continue;
- }
- if ( name !== "toJSON" ) {
- return false;
- }
- }
-
- return true;
-}
-
-
-
-
-function handleQueueMarkDefer( elem, type, src ) {
- var deferDataKey = type + "defer",
- queueDataKey = type + "queue",
- markDataKey = type + "mark",
- defer = jQuery._data( elem, deferDataKey );
- if ( defer &&
- ( src === "queue" || !jQuery._data(elem, queueDataKey) ) &&
- ( src === "mark" || !jQuery._data(elem, markDataKey) ) ) {
- // Give room for hard-coded callbacks to fire first
- // and eventually mark/queue something else on the element
- setTimeout( function() {
- if ( !jQuery._data( elem, queueDataKey ) &&
- !jQuery._data( elem, markDataKey ) ) {
- jQuery.removeData( elem, deferDataKey, true );
- defer.fire();
- }
- }, 0 );
- }
-}
-
-jQuery.extend({
-
- _mark: function( elem, type ) {
- if ( elem ) {
- type = ( type || "fx" ) + "mark";
- jQuery._data( elem, type, (jQuery._data( elem, type ) || 0) + 1 );
- }
- },
-
- _unmark: function( force, elem, type ) {
- if ( force !== true ) {
- type = elem;
- elem = force;
- force = false;
- }
- if ( elem ) {
- type = type || "fx";
- var key = type + "mark",
- count = force ? 0 : ( (jQuery._data( elem, key ) || 1) - 1 );
- if ( count ) {
- jQuery._data( elem, key, count );
- } else {
- jQuery.removeData( elem, key, true );
- handleQueueMarkDefer( elem, type, "mark" );
- }
- }
- },
-
- queue: function( elem, type, data ) {
- var q;
- if ( elem ) {
- type = ( type || "fx" ) + "queue";
- q = jQuery._data( elem, type );
-
- // Speed up dequeue by getting out quickly if this is just a lookup
- if ( data ) {
- if ( !q || jQuery.isArray(data) ) {
- q = jQuery._data( elem, type, jQuery.makeArray(data) );
- } else {
- q.push( data );
- }
- }
- return q || [];
- }
- },
-
- dequeue: function( elem, type ) {
- type = type || "fx";
-
- var queue = jQuery.queue( elem, type ),
- fn = queue.shift(),
- hooks = {};
-
- // If the fx queue is dequeued, always remove the progress sentinel
- if ( fn === "inprogress" ) {
- fn = queue.shift();
- }
-
- if ( fn ) {
- // Add a progress sentinel to prevent the fx queue from being
- // automatically dequeued
- if ( type === "fx" ) {
- queue.unshift( "inprogress" );
- }
-
- jQuery._data( elem, type + ".run", hooks );
- fn.call( elem, function() {
- jQuery.dequeue( elem, type );
- }, hooks );
- }
-
- if ( !queue.length ) {
- jQuery.removeData( elem, type + "queue " + type + ".run", true );
- handleQueueMarkDefer( elem, type, "queue" );
- }
- }
-});
-
-jQuery.fn.extend({
- queue: function( type, data ) {
- var setter = 2;
-
- if ( typeof type !== "string" ) {
- data = type;
- type = "fx";
- setter--;
- }
-
- if ( arguments.length < setter ) {
- return jQuery.queue( this[0], type );
- }
-
- return data === undefined ?
- this :
- this.each(function() {
- var queue = jQuery.queue( this, type, data );
-
- if ( type === "fx" && queue[0] !== "inprogress" ) {
- jQuery.dequeue( this, type );
- }
- });
- },
- dequeue: function( type ) {
- return this.each(function() {
- jQuery.dequeue( this, type );
- });
- },
- // Based off of the plugin by Clint Helfers, with permission.
- // http://blindsignals.com/index.php/2009/07/jquery-delay/
- delay: function( time, type ) {
- time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
- type = type || "fx";
-
- return this.queue( type, function( next, hooks ) {
- var timeout = setTimeout( next, time );
- hooks.stop = function() {
- clearTimeout( timeout );
- };
- });
- },
- clearQueue: function( type ) {
- return this.queue( type || "fx", [] );
- },
- // Get a promise resolved when queues of a certain type
- // are emptied (fx is the type by default)
- promise: function( type, object ) {
- if ( typeof type !== "string" ) {
- object = type;
- type = undefined;
- }
- type = type || "fx";
- var defer = jQuery.Deferred(),
- elements = this,
- i = elements.length,
- count = 1,
- deferDataKey = type + "defer",
- queueDataKey = type + "queue",
- markDataKey = type + "mark",
- tmp;
- function resolve() {
- if ( !( --count ) ) {
- defer.resolveWith( elements, [ elements ] );
- }
- }
- while( i-- ) {
- if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) ||
- ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) ||
- jQuery.data( elements[ i ], markDataKey, undefined, true ) ) &&
- jQuery.data( elements[ i ], deferDataKey, jQuery.Callbacks( "once memory" ), true ) )) {
- count++;
- tmp.add( resolve );
- }
- }
- resolve();
- return defer.promise( object );
- }
-});
-
-
-
-
-var rclass = /[\n\t\r]/g,
- rspace = /\s+/,
- rreturn = /\r/g,
- rtype = /^(?:button|input)$/i,
- rfocusable = /^(?:button|input|object|select|textarea)$/i,
- rclickable = /^a(?:rea)?$/i,
- rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
- getSetAttribute = jQuery.support.getSetAttribute,
- nodeHook, boolHook, fixSpecified;
-
-jQuery.fn.extend({
- attr: function( name, value ) {
- return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 );
- },
-
- removeAttr: function( name ) {
- return this.each(function() {
- jQuery.removeAttr( this, name );
- });
- },
-
- prop: function( name, value ) {
- return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 );
- },
-
- removeProp: function( name ) {
- name = jQuery.propFix[ name ] || name;
- return this.each(function() {
- // try/catch handles cases where IE balks (such as removing a property on window)
- try {
- this[ name ] = undefined;
- delete this[ name ];
- } catch( e ) {}
- });
- },
-
- addClass: function( value ) {
- var classNames, i, l, elem,
- setClass, c, cl;
-
- if ( jQuery.isFunction( value ) ) {
- return this.each(function( j ) {
- jQuery( this ).addClass( value.call(this, j, this.className) );
- });
- }
-
- if ( value && typeof value === "string" ) {
- classNames = value.split( rspace );
-
- for ( i = 0, l = this.length; i < l; i++ ) {
- elem = this[ i ];
-
- if ( elem.nodeType === 1 ) {
- if ( !elem.className && classNames.length === 1 ) {
- elem.className = value;
-
- } else {
- setClass = " " + elem.className + " ";
-
- for ( c = 0, cl = classNames.length; c < cl; c++ ) {
- if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) {
- setClass += classNames[ c ] + " ";
- }
- }
- elem.className = jQuery.trim( setClass );
- }
- }
- }
- }
-
- return this;
- },
-
- removeClass: function( value ) {
- var classNames, i, l, elem, className, c, cl;
-
- if ( jQuery.isFunction( value ) ) {
- return this.each(function( j ) {
- jQuery( this ).removeClass( value.call(this, j, this.className) );
- });
- }
-
- if ( (value && typeof value === "string") || value === undefined ) {
- classNames = ( value || "" ).split( rspace );
-
- for ( i = 0, l = this.length; i < l; i++ ) {
- elem = this[ i ];
-
- if ( elem.nodeType === 1 && elem.className ) {
- if ( value ) {
- className = (" " + elem.className + " ").replace( rclass, " " );
- for ( c = 0, cl = classNames.length; c < cl; c++ ) {
- className = className.replace(" " + classNames[ c ] + " ", " ");
- }
- elem.className = jQuery.trim( className );
-
- } else {
- elem.className = "";
- }
- }
- }
- }
-
- return this;
- },
-
- toggleClass: function( value, stateVal ) {
- var type = typeof value,
- isBool = typeof stateVal === "boolean";
-
- if ( jQuery.isFunction( value ) ) {
- return this.each(function( i ) {
- jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
- });
- }
-
- return this.each(function() {
- if ( type === "string" ) {
- // toggle individual class names
- var className,
- i = 0,
- self = jQuery( this ),
- state = stateVal,
- classNames = value.split( rspace );
-
- while ( (className = classNames[ i++ ]) ) {
- // check each className given, space seperated list
- state = isBool ? state : !self.hasClass( className );
- self[ state ? "addClass" : "removeClass" ]( className );
- }
-
- } else if ( type === "undefined" || type === "boolean" ) {
- if ( this.className ) {
- // store className if set
- jQuery._data( this, "__className__", this.className );
- }
-
- // toggle whole className
- this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
- }
- });
- },
-
- hasClass: function( selector ) {
- var className = " " + selector + " ",
- i = 0,
- l = this.length;
- for ( ; i < l; i++ ) {
- if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {
- return true;
- }
- }
-
- return false;
- },
-
- val: function( value ) {
- var hooks, ret, isFunction,
- elem = this[0];
-
- if ( !arguments.length ) {
- if ( elem ) {
- hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
-
- if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
- return ret;
- }
-
- ret = elem.value;
-
- return typeof ret === "string" ?
- // handle most common string cases
- ret.replace(rreturn, "") :
- // handle cases where value is null/undef or number
- ret == null ? "" : ret;
- }
-
- return;
- }
-
- isFunction = jQuery.isFunction( value );
-
- return this.each(function( i ) {
- var self = jQuery(this), val;
-
- if ( this.nodeType !== 1 ) {
- return;
- }
-
- if ( isFunction ) {
- val = value.call( this, i, self.val() );
- } else {
- val = value;
- }
-
- // Treat null/undefined as ""; convert numbers to string
- if ( val == null ) {
- val = "";
- } else if ( typeof val === "number" ) {
- val += "";
- } else if ( jQuery.isArray( val ) ) {
- val = jQuery.map(val, function ( value ) {
- return value == null ? "" : value + "";
- });
- }
-
- hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
-
- // If set returns undefined, fall back to normal setting
- if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
- this.value = val;
- }
- });
- }
-});
-
-jQuery.extend({
- valHooks: {
- option: {
- get: function( elem ) {
- // attributes.value is undefined in Blackberry 4.7 but
- // uses .value. See #6932
- var val = elem.attributes.value;
- return !val || val.specified ? elem.value : elem.text;
- }
- },
- select: {
- get: function( elem ) {
- var value, i, max, option,
- index = elem.selectedIndex,
- values = [],
- options = elem.options,
- one = elem.type === "select-one";
-
- // Nothing was selected
- if ( index < 0 ) {
- return null;
- }
-
- // Loop through all the selected options
- i = one ? index : 0;
- max = one ? index + 1 : options.length;
- for ( ; i < max; i++ ) {
- option = options[ i ];
-
- // Don't return options that are disabled or in a disabled optgroup
- if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
- (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
-
- // Get the specific value for the option
- value = jQuery( option ).val();
-
- // We don't need an array for one selects
- if ( one ) {
- return value;
- }
-
- // Multi-Selects return an array
- values.push( value );
- }
- }
-
- // Fixes Bug #2551 -- select.val() broken in IE after form.reset()
- if ( one && !values.length && options.length ) {
- return jQuery( options[ index ] ).val();
- }
-
- return values;
- },
-
- set: function( elem, value ) {
- var values = jQuery.makeArray( value );
-
- jQuery(elem).find("option").each(function() {
- this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
- });
-
- if ( !values.length ) {
- elem.selectedIndex = -1;
- }
- return values;
- }
- }
- },
-
- attrFn: {
- val: true,
- css: true,
- html: true,
- text: true,
- data: true,
- width: true,
- height: true,
- offset: true
- },
-
- attr: function( elem, name, value, pass ) {
- var ret, hooks, notxml,
- nType = elem.nodeType;
-
- // don't get/set attributes on text, comment and attribute nodes
- if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
- return;
- }
-
- if ( pass && name in jQuery.attrFn ) {
- return jQuery( elem )[ name ]( value );
- }
-
- // Fallback to prop when attributes are not supported
- if ( typeof elem.getAttribute === "undefined" ) {
- return jQuery.prop( elem, name, value );
- }
-
- notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
-
- // All attributes are lowercase
- // Grab necessary hook if one is defined
- if ( notxml ) {
- name = name.toLowerCase();
- hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook );
- }
-
- if ( value !== undefined ) {
-
- if ( value === null ) {
- jQuery.removeAttr( elem, name );
- return;
-
- } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) {
- return ret;
-
- } else {
- elem.setAttribute( name, "" + value );
- return value;
- }
-
- } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) {
- return ret;
-
- } else {
-
- ret = elem.getAttribute( name );
-
- // Non-existent attributes return null, we normalize to undefined
- return ret === null ?
- undefined :
- ret;
- }
- },
-
- removeAttr: function( elem, value ) {
- var propName, attrNames, name, l, isBool,
- i = 0;
-
- if ( value && elem.nodeType === 1 ) {
- attrNames = value.toLowerCase().split( rspace );
- l = attrNames.length;
-
- for ( ; i < l; i++ ) {
- name = attrNames[ i ];
-
- if ( name ) {
- propName = jQuery.propFix[ name ] || name;
- isBool = rboolean.test( name );
-
- // See #9699 for explanation of this approach (setting first, then removal)
- // Do not do this for boolean attributes (see #10870)
- if ( !isBool ) {
- jQuery.attr( elem, name, "" );
- }
- elem.removeAttribute( getSetAttribute ? name : propName );
-
- // Set corresponding property to false for boolean attributes
- if ( isBool && propName in elem ) {
- elem[ propName ] = false;
- }
- }
- }
- }
- },
-
- attrHooks: {
- type: {
- set: function( elem, value ) {
- // We can't allow the type property to be changed (since it causes problems in IE)
- if ( rtype.test( elem.nodeName ) && elem.parentNode ) {
- jQuery.error( "type property can't be changed" );
- } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
- // Setting the type on a radio button after the value resets the value in IE6-9
- // Reset value to it's default in case type is set after value
- // This is for element creation
- var val = elem.value;
- elem.setAttribute( "type", value );
- if ( val ) {
- elem.value = val;
- }
- return value;
- }
- }
- },
- // Use the value property for back compat
- // Use the nodeHook for button elements in IE6/7 (#1954)
- value: {
- get: function( elem, name ) {
- if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
- return nodeHook.get( elem, name );
- }
- return name in elem ?
- elem.value :
- null;
- },
- set: function( elem, value, name ) {
- if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
- return nodeHook.set( elem, value, name );
- }
- // Does not return so that setAttribute is also used
- elem.value = value;
- }
- }
- },
-
- propFix: {
- tabindex: "tabIndex",
- readonly: "readOnly",
- "for": "htmlFor",
- "class": "className",
- maxlength: "maxLength",
- cellspacing: "cellSpacing",
- cellpadding: "cellPadding",
- rowspan: "rowSpan",
- colspan: "colSpan",
- usemap: "useMap",
- frameborder: "frameBorder",
- contenteditable: "contentEditable"
- },
-
- prop: function( elem, name, value ) {
- var ret, hooks, notxml,
- nType = elem.nodeType;
-
- // don't get/set properties on text, comment and attribute nodes
- if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
- return;
- }
-
- notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
-
- if ( notxml ) {
- // Fix name and attach hooks
- name = jQuery.propFix[ name ] || name;
- hooks = jQuery.propHooks[ name ];
- }
-
- if ( value !== undefined ) {
- if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
- return ret;
-
- } else {
- return ( elem[ name ] = value );
- }
-
- } else {
- if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
- return ret;
-
- } else {
- return elem[ name ];
- }
- }
- },
-
- propHooks: {
- tabIndex: {
- get: function( elem ) {
- // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
- // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
- var attributeNode = elem.getAttributeNode("tabindex");
-
- return attributeNode && attributeNode.specified ?
- parseInt( attributeNode.value, 10 ) :
- rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
- 0 :
- undefined;
- }
- }
- }
-});
-
-// Add the tabIndex propHook to attrHooks for back-compat (different case is intentional)
-jQuery.attrHooks.tabindex = jQuery.propHooks.tabIndex;
-
-// Hook for boolean attributes
-boolHook = {
- get: function( elem, name ) {
- // Align boolean attributes with corresponding properties
- // Fall back to attribute presence where some booleans are not supported
- var attrNode,
- property = jQuery.prop( elem, name );
- return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?
- name.toLowerCase() :
- undefined;
- },
- set: function( elem, value, name ) {
- var propName;
- if ( value === false ) {
- // Remove boolean attributes when set to false
- jQuery.removeAttr( elem, name );
- } else {
- // value is true since we know at this point it's type boolean and not false
- // Set boolean attributes to the same name and set the DOM property
- propName = jQuery.propFix[ name ] || name;
- if ( propName in elem ) {
- // Only set the IDL specifically if it already exists on the element
- elem[ propName ] = true;
- }
-
- elem.setAttribute( name, name.toLowerCase() );
- }
- return name;
- }
-};
-
-// IE6/7 do not support getting/setting some attributes with get/setAttribute
-if ( !getSetAttribute ) {
-
- fixSpecified = {
- name: true,
- id: true,
- coords: true
- };
-
- // Use this for any attribute in IE6/7
- // This fixes almost every IE6/7 issue
- nodeHook = jQuery.valHooks.button = {
- get: function( elem, name ) {
- var ret;
- ret = elem.getAttributeNode( name );
- return ret && ( fixSpecified[ name ] ? ret.nodeValue !== "" : ret.specified ) ?
- ret.nodeValue :
- undefined;
- },
- set: function( elem, value, name ) {
- // Set the existing or create a new attribute node
- var ret = elem.getAttributeNode( name );
- if ( !ret ) {
- ret = document.createAttribute( name );
- elem.setAttributeNode( ret );
- }
- return ( ret.nodeValue = value + "" );
- }
- };
-
- // Apply the nodeHook to tabindex
- jQuery.attrHooks.tabindex.set = nodeHook.set;
-
- // Set width and height to auto instead of 0 on empty string( Bug #8150 )
- // This is for removals
- jQuery.each([ "width", "height" ], function( i, name ) {
- jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
- set: function( elem, value ) {
- if ( value === "" ) {
- elem.setAttribute( name, "auto" );
- return value;
- }
- }
- });
- });
-
- // Set contenteditable to false on removals(#10429)
- // Setting to empty string throws an error as an invalid value
- jQuery.attrHooks.contenteditable = {
- get: nodeHook.get,
- set: function( elem, value, name ) {
- if ( value === "" ) {
- value = "false";
- }
- nodeHook.set( elem, value, name );
- }
- };
-}
-
-
-// Some attributes require a special call on IE
-if ( !jQuery.support.hrefNormalized ) {
- jQuery.each([ "href", "src", "width", "height" ], function( i, name ) {
- jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
- get: function( elem ) {
- var ret = elem.getAttribute( name, 2 );
- return ret === null ? undefined : ret;
- }
- });
- });
-}
-
-if ( !jQuery.support.style ) {
- jQuery.attrHooks.style = {
- get: function( elem ) {
- // Return undefined in the case of empty string
- // Normalize to lowercase since IE uppercases css property names
- return elem.style.cssText.toLowerCase() || undefined;
- },
- set: function( elem, value ) {
- return ( elem.style.cssText = "" + value );
- }
- };
-}
-
-// Safari mis-reports the default selected property of an option
-// Accessing the parent's selectedIndex property fixes it
-if ( !jQuery.support.optSelected ) {
- jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {
- get: function( elem ) {
- var parent = elem.parentNode;
-
- if ( parent ) {
- parent.selectedIndex;
-
- // Make sure that it also works with optgroups, see #5701
- if ( parent.parentNode ) {
- parent.parentNode.selectedIndex;
- }
- }
- return null;
- }
- });
-}
-
-// IE6/7 call enctype encoding
-if ( !jQuery.support.enctype ) {
- jQuery.propFix.enctype = "encoding";
-}
-
-// Radios and checkboxes getter/setter
-if ( !jQuery.support.checkOn ) {
- jQuery.each([ "radio", "checkbox" ], function() {
- jQuery.valHooks[ this ] = {
- get: function( elem ) {
- // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
- return elem.getAttribute("value") === null ? "on" : elem.value;
- }
- };
- });
-}
-jQuery.each([ "radio", "checkbox" ], function() {
- jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {
- set: function( elem, value ) {
- if ( jQuery.isArray( value ) ) {
- return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
- }
- }
- });
-});
-
-
-
-
-var rformElems = /^(?:textarea|input|select)$/i,
- rtypenamespace = /^([^\.]*)?(?:\.(.+))?$/,
- rhoverHack = /(?:^|\s)hover(\.\S+)?\b/,
- rkeyEvent = /^key/,
- rmouseEvent = /^(?:mouse|contextmenu)|click/,
- rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
- rquickIs = /^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,
- quickParse = function( selector ) {
- var quick = rquickIs.exec( selector );
- if ( quick ) {
- // 0 1 2 3
- // [ _, tag, id, class ]
- quick[1] = ( quick[1] || "" ).toLowerCase();
- quick[3] = quick[3] && new RegExp( "(?:^|\\s)" + quick[3] + "(?:\\s|$)" );
- }
- return quick;
- },
- quickIs = function( elem, m ) {
- var attrs = elem.attributes || {};
- return (
- (!m[1] || elem.nodeName.toLowerCase() === m[1]) &&
- (!m[2] || (attrs.id || {}).value === m[2]) &&
- (!m[3] || m[3].test( (attrs[ "class" ] || {}).value ))
- );
- },
- hoverHack = function( events ) {
- return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );
- };
-
-/*
- * Helper functions for managing events -- not part of the public interface.
- * Props to Dean Edwards' addEvent library for many of the ideas.
- */
-jQuery.event = {
-
- add: function( elem, types, handler, data, selector ) {
-
- var elemData, eventHandle, events,
- t, tns, type, namespaces, handleObj,
- handleObjIn, quick, handlers, special;
-
- // Don't attach events to noData or text/comment nodes (allow plain objects tho)
- if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) {
- return;
- }
-
- // Caller can pass in an object of custom data in lieu of the handler
- if ( handler.handler ) {
- handleObjIn = handler;
- handler = handleObjIn.handler;
- selector = handleObjIn.selector;
- }
-
- // Make sure that the handler has a unique ID, used to find/remove it later
- if ( !handler.guid ) {
- handler.guid = jQuery.guid++;
- }
-
- // Init the element's event structure and main handler, if this is the first
- events = elemData.events;
- if ( !events ) {
- elemData.events = events = {};
- }
- eventHandle = elemData.handle;
- if ( !eventHandle ) {
- elemData.handle = eventHandle = function( e ) {
- // Discard the second event of a jQuery.event.trigger() and
- // when an event is called after a page has unloaded
- return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ?
- jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
- undefined;
- };
- // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
- eventHandle.elem = elem;
- }
-
- // Handle multiple events separated by a space
- // jQuery(...).bind("mouseover mouseout", fn);
- types = jQuery.trim( hoverHack(types) ).split( " " );
- for ( t = 0; t < types.length; t++ ) {
-
- tns = rtypenamespace.exec( types[t] ) || [];
- type = tns[1];
- namespaces = ( tns[2] || "" ).split( "." ).sort();
-
- // If event changes its type, use the special event handlers for the changed type
- special = jQuery.event.special[ type ] || {};
-
- // If selector defined, determine special event api type, otherwise given type
- type = ( selector ? special.delegateType : special.bindType ) || type;
-
- // Update special based on newly reset type
- special = jQuery.event.special[ type ] || {};
-
- // handleObj is passed to all event handlers
- handleObj = jQuery.extend({
- type: type,
- origType: tns[1],
- data: data,
- handler: handler,
- guid: handler.guid,
- selector: selector,
- quick: selector && quickParse( selector ),
- namespace: namespaces.join(".")
- }, handleObjIn );
-
- // Init the event handler queue if we're the first
- handlers = events[ type ];
- if ( !handlers ) {
- handlers = events[ type ] = [];
- handlers.delegateCount = 0;
-
- // Only use addEventListener/attachEvent if the special events handler returns false
- if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
- // Bind the global event handler to the element
- if ( elem.addEventListener ) {
- elem.addEventListener( type, eventHandle, false );
-
- } else if ( elem.attachEvent ) {
- elem.attachEvent( "on" + type, eventHandle );
- }
- }
- }
-
- if ( special.add ) {
- special.add.call( elem, handleObj );
-
- if ( !handleObj.handler.guid ) {
- handleObj.handler.guid = handler.guid;
- }
- }
-
- // Add to the element's handler list, delegates in front
- if ( selector ) {
- handlers.splice( handlers.delegateCount++, 0, handleObj );
- } else {
- handlers.push( handleObj );
- }
-
- // Keep track of which events have ever been used, for event optimization
- jQuery.event.global[ type ] = true;
- }
-
- // Nullify elem to prevent memory leaks in IE
- elem = null;
- },
-
- global: {},
-
- // Detach an event or set of events from an element
- remove: function( elem, types, handler, selector, mappedTypes ) {
-
- var elemData = jQuery.hasData( elem ) && jQuery._data( elem ),
- t, tns, type, origType, namespaces, origCount,
- j, events, special, handle, eventType, handleObj;
-
- if ( !elemData || !(events = elemData.events) ) {
- return;
- }
-
- // Once for each type.namespace in types; type may be omitted
- types = jQuery.trim( hoverHack( types || "" ) ).split(" ");
- for ( t = 0; t < types.length; t++ ) {
- tns = rtypenamespace.exec( types[t] ) || [];
- type = origType = tns[1];
- namespaces = tns[2];
-
- // Unbind all events (on this namespace, if provided) for the element
- if ( !type ) {
- for ( type in events ) {
- jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
- }
- continue;
- }
-
- special = jQuery.event.special[ type ] || {};
- type = ( selector? special.delegateType : special.bindType ) || type;
- eventType = events[ type ] || [];
- origCount = eventType.length;
- namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.)?") + "(\\.|$)") : null;
-
- // Remove matching events
- for ( j = 0; j < eventType.length; j++ ) {
- handleObj = eventType[ j ];
-
- if ( ( mappedTypes || origType === handleObj.origType ) &&
- ( !handler || handler.guid === handleObj.guid ) &&
- ( !namespaces || namespaces.test( handleObj.namespace ) ) &&
- ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
- eventType.splice( j--, 1 );
-
- if ( handleObj.selector ) {
- eventType.delegateCount--;
- }
- if ( special.remove ) {
- special.remove.call( elem, handleObj );
- }
- }
- }
-
- // Remove generic event handler if we removed something and no more handlers exist
- // (avoids potential for endless recursion during removal of special event handlers)
- if ( eventType.length === 0 && origCount !== eventType.length ) {
- if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
- jQuery.removeEvent( elem, type, elemData.handle );
- }
-
- delete events[ type ];
- }
- }
-
- // Remove the expando if it's no longer used
- if ( jQuery.isEmptyObject( events ) ) {
- handle = elemData.handle;
- if ( handle ) {
- handle.elem = null;
- }
-
- // removeData also checks for emptiness and clears the expando if empty
- // so use it instead of delete
- jQuery.removeData( elem, [ "events", "handle" ], true );
- }
- },
-
- // Events that are safe to short-circuit if no handlers are attached.
- // Native DOM events should not be added, they may have inline handlers.
- customEvent: {
- "getData": true,
- "setData": true,
- "changeData": true
- },
-
- trigger: function( event, data, elem, onlyHandlers ) {
- // Don't do events on text and comment nodes
- if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) {
- return;
- }
-
- // Event object or event type
- var type = event.type || event,
- namespaces = [],
- cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType;
-
- // focus/blur morphs to focusin/out; ensure we're not firing them right now
- if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
- return;
- }
-
- if ( type.indexOf( "!" ) >= 0 ) {
- // Exclusive events trigger only for the exact event (no namespaces)
- type = type.slice(0, -1);
- exclusive = true;
- }
-
- if ( type.indexOf( "." ) >= 0 ) {
- // Namespaced trigger; create a regexp to match event type in handle()
- namespaces = type.split(".");
- type = namespaces.shift();
- namespaces.sort();
- }
-
- if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) {
- // No jQuery handlers for this event type, and it can't have inline handlers
- return;
- }
-
- // Caller can pass in an Event, Object, or just an event type string
- event = typeof event === "object" ?
- // jQuery.Event object
- event[ jQuery.expando ] ? event :
- // Object literal
- new jQuery.Event( type, event ) :
- // Just the event type (string)
- new jQuery.Event( type );
-
- event.type = type;
- event.isTrigger = true;
- event.exclusive = exclusive;
- event.namespace = namespaces.join( "." );
- event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)") : null;
- ontype = type.indexOf( ":" ) < 0 ? "on" + type : "";
-
- // Handle a global trigger
- if ( !elem ) {
-
- // TODO: Stop taunting the data cache; remove global events and always attach to document
- cache = jQuery.cache;
- for ( i in cache ) {
- if ( cache[ i ].events && cache[ i ].events[ type ] ) {
- jQuery.event.trigger( event, data, cache[ i ].handle.elem, true );
- }
- }
- return;
- }
-
- // Clean up the event in case it is being reused
- event.result = undefined;
- if ( !event.target ) {
- event.target = elem;
- }
-
- // Clone any incoming data and prepend the event, creating the handler arg list
- data = data != null ? jQuery.makeArray( data ) : [];
- data.unshift( event );
-
- // Allow special events to draw outside the lines
- special = jQuery.event.special[ type ] || {};
- if ( special.trigger && special.trigger.apply( elem, data ) === false ) {
- return;
- }
-
- // Determine event propagation path in advance, per W3C events spec (#9951)
- // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
- eventPath = [[ elem, special.bindType || type ]];
- if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
-
- bubbleType = special.delegateType || type;
- cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode;
- old = null;
- for ( ; cur; cur = cur.parentNode ) {
- eventPath.push([ cur, bubbleType ]);
- old = cur;
- }
-
- // Only add window if we got to document (e.g., not plain obj or detached DOM)
- if ( old && old === elem.ownerDocument ) {
- eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]);
- }
- }
-
- // Fire handlers on the event path
- for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) {
-
- cur = eventPath[i][0];
- event.type = eventPath[i][1];
-
- handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
- if ( handle ) {
- handle.apply( cur, data );
- }
- // Note that this is a bare JS function and not a jQuery handler
- handle = ontype && cur[ ontype ];
- if ( handle && jQuery.acceptData( cur ) && handle.apply( cur, data ) === false ) {
- event.preventDefault();
- }
- }
- event.type = type;
-
- // If nobody prevented the default action, do it now
- if ( !onlyHandlers && !event.isDefaultPrevented() ) {
-
- if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) &&
- !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
-
- // Call a native DOM method on the target with the same name name as the event.
- // Can't use an .isFunction() check here because IE6/7 fails that test.
- // Don't do default actions on window, that's where global variables be (#6170)
- // IE<9 dies on focus/blur to hidden element (#1486)
- if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) {
-
- // Don't re-trigger an onFOO event when we call its FOO() method
- old = elem[ ontype ];
-
- if ( old ) {
- elem[ ontype ] = null;
- }
-
- // Prevent re-triggering of the same event, since we already bubbled it above
- jQuery.event.triggered = type;
- elem[ type ]();
- jQuery.event.triggered = undefined;
-
- if ( old ) {
- elem[ ontype ] = old;
- }
- }
- }
- }
-
- return event.result;
- },
-
- dispatch: function( event ) {
-
- // Make a writable jQuery.Event from the native event object
- event = jQuery.event.fix( event || window.event );
-
- var handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []),
- delegateCount = handlers.delegateCount,
- args = [].slice.call( arguments, 0 ),
- run_all = !event.exclusive && !event.namespace,
- special = jQuery.event.special[ event.type ] || {},
- handlerQueue = [],
- i, j, cur, jqcur, ret, selMatch, matched, matches, handleObj, sel, related;
-
- // Use the fix-ed jQuery.Event rather than the (read-only) native event
- args[0] = event;
- event.delegateTarget = this;
-
- // Call the preDispatch hook for the mapped type, and let it bail if desired
- if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
- return;
- }
-
- // Determine handlers that should run if there are delegated events
- // Avoid non-left-click bubbling in Firefox (#3861)
- if ( delegateCount && !(event.button && event.type === "click") ) {
-
- // Pregenerate a single jQuery object for reuse with .is()
- jqcur = jQuery(this);
- jqcur.context = this.ownerDocument || this;
-
- for ( cur = event.target; cur != this; cur = cur.parentNode || this ) {
-
- // Don't process events on disabled elements (#6911, #8165)
- if ( cur.disabled !== true ) {
- selMatch = {};
- matches = [];
- jqcur[0] = cur;
- for ( i = 0; i < delegateCount; i++ ) {
- handleObj = handlers[ i ];
- sel = handleObj.selector;
-
- if ( selMatch[ sel ] === undefined ) {
- selMatch[ sel ] = (
- handleObj.quick ? quickIs( cur, handleObj.quick ) : jqcur.is( sel )
- );
- }
- if ( selMatch[ sel ] ) {
- matches.push( handleObj );
- }
- }
- if ( matches.length ) {
- handlerQueue.push({ elem: cur, matches: matches });
- }
- }
- }
- }
-
- // Add the remaining (directly-bound) handlers
- if ( handlers.length > delegateCount ) {
- handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) });
- }
-
- // Run delegates first; they may want to stop propagation beneath us
- for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) {
- matched = handlerQueue[ i ];
- event.currentTarget = matched.elem;
-
- for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) {
- handleObj = matched.matches[ j ];
-
- // Triggered event must either 1) be non-exclusive and have no namespace, or
- // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
- if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) {
-
- event.data = handleObj.data;
- event.handleObj = handleObj;
-
- ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
- .apply( matched.elem, args );
-
- if ( ret !== undefined ) {
- event.result = ret;
- if ( ret === false ) {
- event.preventDefault();
- event.stopPropagation();
- }
- }
- }
- }
- }
-
- // Call the postDispatch hook for the mapped type
- if ( special.postDispatch ) {
- special.postDispatch.call( this, event );
- }
-
- return event.result;
- },
-
- // Includes some event props shared by KeyEvent and MouseEvent
- // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 ***
- props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
-
- fixHooks: {},
-
- keyHooks: {
- props: "char charCode key keyCode".split(" "),
- filter: function( event, original ) {
-
- // Add which for key events
- if ( event.which == null ) {
- event.which = original.charCode != null ? original.charCode : original.keyCode;
- }
-
- return event;
- }
- },
-
- mouseHooks: {
- props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
- filter: function( event, original ) {
- var eventDoc, doc, body,
- button = original.button,
- fromElement = original.fromElement;
-
- // Calculate pageX/Y if missing and clientX/Y available
- if ( event.pageX == null && original.clientX != null ) {
- eventDoc = event.target.ownerDocument || document;
- doc = eventDoc.documentElement;
- body = eventDoc.body;
-
- event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
- event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
- }
-
- // Add relatedTarget, if necessary
- if ( !event.relatedTarget && fromElement ) {
- event.relatedTarget = fromElement === event.target ? original.toElement : fromElement;
- }
-
- // Add which for click: 1 === left; 2 === middle; 3 === right
- // Note: button is not normalized, so don't use it
- if ( !event.which && button !== undefined ) {
- event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
- }
-
- return event;
- }
- },
-
- fix: function( event ) {
- if ( event[ jQuery.expando ] ) {
- return event;
- }
-
- // Create a writable copy of the event object and normalize some properties
- var i, prop,
- originalEvent = event,
- fixHook = jQuery.event.fixHooks[ event.type ] || {},
- copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
-
- event = jQuery.Event( originalEvent );
-
- for ( i = copy.length; i; ) {
- prop = copy[ --i ];
- event[ prop ] = originalEvent[ prop ];
- }
-
- // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2)
- if ( !event.target ) {
- event.target = originalEvent.srcElement || document;
- }
-
- // Target should not be a text node (#504, Safari)
- if ( event.target.nodeType === 3 ) {
- event.target = event.target.parentNode;
- }
-
- // For mouse/key events; add metaKey if it's not there (#3368, IE6/7/8)
- if ( event.metaKey === undefined ) {
- event.metaKey = event.ctrlKey;
- }
-
- return fixHook.filter? fixHook.filter( event, originalEvent ) : event;
- },
-
- special: {
- ready: {
- // Make sure the ready event is setup
- setup: jQuery.bindReady
- },
-
- load: {
- // Prevent triggered image.load events from bubbling to window.load
- noBubble: true
- },
-
- focus: {
- delegateType: "focusin"
- },
- blur: {
- delegateType: "focusout"
- },
-
- beforeunload: {
- setup: function( data, namespaces, eventHandle ) {
- // We only want to do this special case on windows
- if ( jQuery.isWindow( this ) ) {
- this.onbeforeunload = eventHandle;
- }
- },
-
- teardown: function( namespaces, eventHandle ) {
- if ( this.onbeforeunload === eventHandle ) {
- this.onbeforeunload = null;
- }
- }
- }
- },
-
- simulate: function( type, elem, event, bubble ) {
- // Piggyback on a donor event to simulate a different one.
- // Fake originalEvent to avoid donor's stopPropagation, but if the
- // simulated event prevents default then we do the same on the donor.
- var e = jQuery.extend(
- new jQuery.Event(),
- event,
- { type: type,
- isSimulated: true,
- originalEvent: {}
- }
- );
- if ( bubble ) {
- jQuery.event.trigger( e, null, elem );
- } else {
- jQuery.event.dispatch.call( elem, e );
- }
- if ( e.isDefaultPrevented() ) {
- event.preventDefault();
- }
- }
-};
-
-// Some plugins are using, but it's undocumented/deprecated and will be removed.
-// The 1.7 special event interface should provide all the hooks needed now.
-jQuery.event.handle = jQuery.event.dispatch;
-
-jQuery.removeEvent = document.removeEventListener ?
- function( elem, type, handle ) {
- if ( elem.removeEventListener ) {
- elem.removeEventListener( type, handle, false );
- }
- } :
- function( elem, type, handle ) {
- if ( elem.detachEvent ) {
- elem.detachEvent( "on" + type, handle );
- }
- };
-
-jQuery.Event = function( src, props ) {
- // Allow instantiation without the 'new' keyword
- if ( !(this instanceof jQuery.Event) ) {
- return new jQuery.Event( src, props );
- }
-
- // Event object
- if ( src && src.type ) {
- this.originalEvent = src;
- this.type = src.type;
-
- // Events bubbling up the document may have been marked as prevented
- // by a handler lower down the tree; reflect the correct value.
- this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false ||
- src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;
-
- // Event type
- } else {
- this.type = src;
- }
-
- // Put explicitly provided properties onto the event object
- if ( props ) {
- jQuery.extend( this, props );
- }
-
- // Create a timestamp if incoming event doesn't have one
- this.timeStamp = src && src.timeStamp || jQuery.now();
-
- // Mark it as fixed
- this[ jQuery.expando ] = true;
-};
-
-function returnFalse() {
- return false;
-}
-function returnTrue() {
- return true;
-}
-
-// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
-// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
-jQuery.Event.prototype = {
- preventDefault: function() {
- this.isDefaultPrevented = returnTrue;
-
- var e = this.originalEvent;
- if ( !e ) {
- return;
- }
-
- // if preventDefault exists run it on the original event
- if ( e.preventDefault ) {
- e.preventDefault();
-
- // otherwise set the returnValue property of the original event to false (IE)
- } else {
- e.returnValue = false;
- }
- },
- stopPropagation: function() {
- this.isPropagationStopped = returnTrue;
-
- var e = this.originalEvent;
- if ( !e ) {
- return;
- }
- // if stopPropagation exists run it on the original event
- if ( e.stopPropagation ) {
- e.stopPropagation();
- }
- // otherwise set the cancelBubble property of the original event to true (IE)
- e.cancelBubble = true;
- },
- stopImmediatePropagation: function() {
- this.isImmediatePropagationStopped = returnTrue;
- this.stopPropagation();
- },
- isDefaultPrevented: returnFalse,
- isPropagationStopped: returnFalse,
- isImmediatePropagationStopped: returnFalse
-};
-
-// Create mouseenter/leave events using mouseover/out and event-time checks
-jQuery.each({
- mouseenter: "mouseover",
- mouseleave: "mouseout"
-}, function( orig, fix ) {
- jQuery.event.special[ orig ] = {
- delegateType: fix,
- bindType: fix,
-
- handle: function( event ) {
- var target = this,
- related = event.relatedTarget,
- handleObj = event.handleObj,
- selector = handleObj.selector,
- ret;
-
- // For mousenter/leave call the handler if related is outside the target.
- // NB: No relatedTarget if the mouse left/entered the browser window
- if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
- event.type = handleObj.origType;
- ret = handleObj.handler.apply( this, arguments );
- event.type = fix;
- }
- return ret;
- }
- };
-});
-
-// IE submit delegation
-if ( !jQuery.support.submitBubbles ) {
-
- jQuery.event.special.submit = {
- setup: function() {
- // Only need this for delegated form submit events
- if ( jQuery.nodeName( this, "form" ) ) {
- return false;
- }
-
- // Lazy-add a submit handler when a descendant form may potentially be submitted
- jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
- // Node name check avoids a VML-related crash in IE (#9807)
- var elem = e.target,
- form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;
- if ( form && !form._submit_attached ) {
- jQuery.event.add( form, "submit._submit", function( event ) {
- event._submit_bubble = true;
- });
- form._submit_attached = true;
- }
- });
- // return undefined since we don't need an event listener
- },
-
- postDispatch: function( event ) {
- // If form was submitted by the user, bubble the event up the tree
- if ( event._submit_bubble ) {
- delete event._submit_bubble;
- if ( this.parentNode && !event.isTrigger ) {
- jQuery.event.simulate( "submit", this.parentNode, event, true );
- }
- }
- },
-
- teardown: function() {
- // Only need this for delegated form submit events
- if ( jQuery.nodeName( this, "form" ) ) {
- return false;
- }
-
- // Remove delegated handlers; cleanData eventually reaps submit handlers attached above
- jQuery.event.remove( this, "._submit" );
- }
- };
-}
-
-// IE change delegation and checkbox/radio fix
-if ( !jQuery.support.changeBubbles ) {
-
- jQuery.event.special.change = {
-
- setup: function() {
-
- if ( rformElems.test( this.nodeName ) ) {
- // IE doesn't fire change on a check/radio until blur; trigger it on click
- // after a propertychange. Eat the blur-change in special.change.handle.
- // This still fires onchange a second time for check/radio after blur.
- if ( this.type === "checkbox" || this.type === "radio" ) {
- jQuery.event.add( this, "propertychange._change", function( event ) {
- if ( event.originalEvent.propertyName === "checked" ) {
- this._just_changed = true;
- }
- });
- jQuery.event.add( this, "click._change", function( event ) {
- if ( this._just_changed && !event.isTrigger ) {
- this._just_changed = false;
- jQuery.event.simulate( "change", this, event, true );
- }
- });
- }
- return false;
- }
- // Delegated event; lazy-add a change handler on descendant inputs
- jQuery.event.add( this, "beforeactivate._change", function( e ) {
- var elem = e.target;
-
- if ( rformElems.test( elem.nodeName ) && !elem._change_attached ) {
- jQuery.event.add( elem, "change._change", function( event ) {
- if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
- jQuery.event.simulate( "change", this.parentNode, event, true );
- }
- });
- elem._change_attached = true;
- }
- });
- },
-
- handle: function( event ) {
- var elem = event.target;
-
- // Swallow native change events from checkbox/radio, we already triggered them above
- if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {
- return event.handleObj.handler.apply( this, arguments );
- }
- },
-
- teardown: function() {
- jQuery.event.remove( this, "._change" );
-
- return rformElems.test( this.nodeName );
- }
- };
-}
-
-// Create "bubbling" focus and blur events
-if ( !jQuery.support.focusinBubbles ) {
- jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
-
- // Attach a single capturing handler while someone wants focusin/focusout
- var attaches = 0,
- handler = function( event ) {
- jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
- };
-
- jQuery.event.special[ fix ] = {
- setup: function() {
- if ( attaches++ === 0 ) {
- document.addEventListener( orig, handler, true );
- }
- },
- teardown: function() {
- if ( --attaches === 0 ) {
- document.removeEventListener( orig, handler, true );
- }
- }
- };
- });
-}
-
-jQuery.fn.extend({
-
- on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
- var origFn, type;
-
- // Types can be a map of types/handlers
- if ( typeof types === "object" ) {
- // ( types-Object, selector, data )
- if ( typeof selector !== "string" ) { // && selector != null
- // ( types-Object, data )
- data = data || selector;
- selector = undefined;
- }
- for ( type in types ) {
- this.on( type, selector, data, types[ type ], one );
- }
- return this;
- }
-
- if ( data == null && fn == null ) {
- // ( types, fn )
- fn = selector;
- data = selector = undefined;
- } else if ( fn == null ) {
- if ( typeof selector === "string" ) {
- // ( types, selector, fn )
- fn = data;
- data = undefined;
- } else {
- // ( types, data, fn )
- fn = data;
- data = selector;
- selector = undefined;
- }
- }
- if ( fn === false ) {
- fn = returnFalse;
- } else if ( !fn ) {
- return this;
- }
-
- if ( one === 1 ) {
- origFn = fn;
- fn = function( event ) {
- // Can use an empty set, since event contains the info
- jQuery().off( event );
- return origFn.apply( this, arguments );
- };
- // Use same guid so caller can remove using origFn
- fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
- }
- return this.each( function() {
- jQuery.event.add( this, types, fn, data, selector );
- });
- },
- one: function( types, selector, data, fn ) {
- return this.on( types, selector, data, fn, 1 );
- },
- off: function( types, selector, fn ) {
- if ( types && types.preventDefault && types.handleObj ) {
- // ( event ) dispatched jQuery.Event
- var handleObj = types.handleObj;
- jQuery( types.delegateTarget ).off(
- handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
- handleObj.selector,
- handleObj.handler
- );
- return this;
- }
- if ( typeof types === "object" ) {
- // ( types-object [, selector] )
- for ( var type in types ) {
- this.off( type, selector, types[ type ] );
- }
- return this;
- }
- if ( selector === false || typeof selector === "function" ) {
- // ( types [, fn] )
- fn = selector;
- selector = undefined;
- }
- if ( fn === false ) {
- fn = returnFalse;
- }
- return this.each(function() {
- jQuery.event.remove( this, types, fn, selector );
- });
- },
-
- bind: function( types, data, fn ) {
- return this.on( types, null, data, fn );
- },
- unbind: function( types, fn ) {
- return this.off( types, null, fn );
- },
-
- live: function( types, data, fn ) {
- jQuery( this.context ).on( types, this.selector, data, fn );
- return this;
- },
- die: function( types, fn ) {
- jQuery( this.context ).off( types, this.selector || "**", fn );
- return this;
- },
-
- delegate: function( selector, types, data, fn ) {
- return this.on( types, selector, data, fn );
- },
- undelegate: function( selector, types, fn ) {
- // ( namespace ) or ( selector, types [, fn] )
- return arguments.length == 1? this.off( selector, "**" ) : this.off( types, selector, fn );
- },
-
- trigger: function( type, data ) {
- return this.each(function() {
- jQuery.event.trigger( type, data, this );
- });
- },
- triggerHandler: function( type, data ) {
- if ( this[0] ) {
- return jQuery.event.trigger( type, data, this[0], true );
- }
- },
-
- toggle: function( fn ) {
- // Save reference to arguments for access in closure
- var args = arguments,
- guid = fn.guid || jQuery.guid++,
- i = 0,
- toggler = function( event ) {
- // Figure out which function to execute
- var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
- jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
-
- // Make sure that clicks stop
- event.preventDefault();
-
- // and execute the function
- return args[ lastToggle ].apply( this, arguments ) || false;
- };
-
- // link all the functions, so any of them can unbind this click handler
- toggler.guid = guid;
- while ( i < args.length ) {
- args[ i++ ].guid = guid;
- }
-
- return this.click( toggler );
- },
-
- hover: function( fnOver, fnOut ) {
- return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
- }
-});
-
-jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
- "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
- "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
-
- // Handle event binding
- jQuery.fn[ name ] = function( data, fn ) {
- if ( fn == null ) {
- fn = data;
- data = null;
- }
-
- return arguments.length > 0 ?
- this.on( name, null, data, fn ) :
- this.trigger( name );
- };
-
- if ( jQuery.attrFn ) {
- jQuery.attrFn[ name ] = true;
- }
-
- if ( rkeyEvent.test( name ) ) {
- jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks;
- }
-
- if ( rmouseEvent.test( name ) ) {
- jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks;
- }
-});
-
-
-
-/*!
- * Sizzle CSS Selector Engine
- * Copyright 2011, The Dojo Foundation
- * Released under the MIT, BSD, and GPL Licenses.
- * More information: http://sizzlejs.com/
- */
-(function(){
-
-var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
- expando = "sizcache" + (Math.random() + '').replace('.', ''),
- done = 0,
- toString = Object.prototype.toString,
- hasDuplicate = false,
- baseHasDuplicate = true,
- rBackslash = /\\/g,
- rReturn = /\r\n/g,
- rNonWord = /\W/;
-
-// Here we check if the JavaScript engine is using some sort of
-// optimization where it does not always call our comparision
-// function. If that is the case, discard the hasDuplicate value.
-// Thus far that includes Google Chrome.
-[0, 0].sort(function() {
- baseHasDuplicate = false;
- return 0;
-});
-
-var Sizzle = function( selector, context, results, seed ) {
- results = results || [];
- context = context || document;
-
- var origContext = context;
-
- if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
- return [];
- }
-
- if ( !selector || typeof selector !== "string" ) {
- return results;
- }
-
- var m, set, checkSet, extra, ret, cur, pop, i,
- prune = true,
- contextXML = Sizzle.isXML( context ),
- parts = [],
- soFar = selector;
-
- // Reset the position of the chunker regexp (start from head)
- do {
- chunker.exec( "" );
- m = chunker.exec( soFar );
-
- if ( m ) {
- soFar = m[3];
-
- parts.push( m[1] );
-
- if ( m[2] ) {
- extra = m[3];
- break;
- }
- }
- } while ( m );
-
- if ( parts.length > 1 && origPOS.exec( selector ) ) {
-
- if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
- set = posProcess( parts[0] + parts[1], context, seed );
-
- } else {
- set = Expr.relative[ parts[0] ] ?
- [ context ] :
- Sizzle( parts.shift(), context );
-
- while ( parts.length ) {
- selector = parts.shift();
-
- if ( Expr.relative[ selector ] ) {
- selector += parts.shift();
- }
-
- set = posProcess( selector, set, seed );
- }
- }
-
- } else {
- // Take a shortcut and set the context if the root selector is an ID
- // (but not if it'll be faster if the inner selector is an ID)
- if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
- Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
-
- ret = Sizzle.find( parts.shift(), context, contextXML );
- context = ret.expr ?
- Sizzle.filter( ret.expr, ret.set )[0] :
- ret.set[0];
- }
-
- if ( context ) {
- ret = seed ?
- { expr: parts.pop(), set: makeArray(seed) } :
- Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );
-
- set = ret.expr ?
- Sizzle.filter( ret.expr, ret.set ) :
- ret.set;
-
- if ( parts.length > 0 ) {
- checkSet = makeArray( set );
-
- } else {
- prune = false;
- }
-
- while ( parts.length ) {
- cur = parts.pop();
- pop = cur;
-
- if ( !Expr.relative[ cur ] ) {
- cur = "";
- } else {
- pop = parts.pop();
- }
-
- if ( pop == null ) {
- pop = context;
- }
-
- Expr.relative[ cur ]( checkSet, pop, contextXML );
- }
-
- } else {
- checkSet = parts = [];
- }
- }
-
- if ( !checkSet ) {
- checkSet = set;
- }
-
- if ( !checkSet ) {
- Sizzle.error( cur || selector );
- }
-
- if ( toString.call(checkSet) === "[object Array]" ) {
- if ( !prune ) {
- results.push.apply( results, checkSet );
-
- } else if ( context && context.nodeType === 1 ) {
- for ( i = 0; checkSet[i] != null; i++ ) {
- if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {
- results.push( set[i] );
- }
- }
-
- } else {
- for ( i = 0; checkSet[i] != null; i++ ) {
- if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
- results.push( set[i] );
- }
- }
- }
-
- } else {
- makeArray( checkSet, results );
- }
-
- if ( extra ) {
- Sizzle( extra, origContext, results, seed );
- Sizzle.uniqueSort( results );
- }
-
- return results;
-};
-
-Sizzle.uniqueSort = function( results ) {
- if ( sortOrder ) {
- hasDuplicate = baseHasDuplicate;
- results.sort( sortOrder );
-
- if ( hasDuplicate ) {
- for ( var i = 1; i < results.length; i++ ) {
- if ( results[i] === results[ i - 1 ] ) {
- results.splice( i--, 1 );
- }
- }
- }
- }
-
- return results;
-};
-
-Sizzle.matches = function( expr, set ) {
- return Sizzle( expr, null, null, set );
-};
-
-Sizzle.matchesSelector = function( node, expr ) {
- return Sizzle( expr, null, null, [node] ).length > 0;
-};
-
-Sizzle.find = function( expr, context, isXML ) {
- var set, i, len, match, type, left;
-
- if ( !expr ) {
- return [];
- }
-
- for ( i = 0, len = Expr.order.length; i < len; i++ ) {
- type = Expr.order[i];
-
- if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
- left = match[1];
- match.splice( 1, 1 );
-
- if ( left.substr( left.length - 1 ) !== "\\" ) {
- match[1] = (match[1] || "").replace( rBackslash, "" );
- set = Expr.find[ type ]( match, context, isXML );
-
- if ( set != null ) {
- expr = expr.replace( Expr.match[ type ], "" );
- break;
- }
- }
- }
- }
-
- if ( !set ) {
- set = typeof context.getElementsByTagName !== "undefined" ?
- context.getElementsByTagName( "*" ) :
- [];
- }
-
- return { set: set, expr: expr };
-};
-
-Sizzle.filter = function( expr, set, inplace, not ) {
- var match, anyFound,
- type, found, item, filter, left,
- i, pass,
- old = expr,
- result = [],
- curLoop = set,
- isXMLFilter = set && set[0] && Sizzle.isXML( set[0] );
-
- while ( expr && set.length ) {
- for ( type in Expr.filter ) {
- if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {
- filter = Expr.filter[ type ];
- left = match[1];
-
- anyFound = false;
-
- match.splice(1,1);
-
- if ( left.substr( left.length - 1 ) === "\\" ) {
- continue;
- }
-
- if ( curLoop === result ) {
- result = [];
- }
-
- if ( Expr.preFilter[ type ] ) {
- match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
-
- if ( !match ) {
- anyFound = found = true;
-
- } else if ( match === true ) {
- continue;
- }
- }
-
- if ( match ) {
- for ( i = 0; (item = curLoop[i]) != null; i++ ) {
- if ( item ) {
- found = filter( item, match, i, curLoop );
- pass = not ^ found;
-
- if ( inplace && found != null ) {
- if ( pass ) {
- anyFound = true;
-
- } else {
- curLoop[i] = false;
- }
-
- } else if ( pass ) {
- result.push( item );
- anyFound = true;
- }
- }
- }
- }
-
- if ( found !== undefined ) {
- if ( !inplace ) {
- curLoop = result;
- }
-
- expr = expr.replace( Expr.match[ type ], "" );
-
- if ( !anyFound ) {
- return [];
- }
-
- break;
- }
- }
- }
-
- // Improper expression
- if ( expr === old ) {
- if ( anyFound == null ) {
- Sizzle.error( expr );
-
- } else {
- break;
- }
- }
-
- old = expr;
- }
-
- return curLoop;
-};
-
-Sizzle.error = function( msg ) {
- throw new Error( "Syntax error, unrecognized expression: " + msg );
-};
-
-/**
- * Utility function for retreiving the text value of an array of DOM nodes
- * @param {Array|Element} elem
- */
-var getText = Sizzle.getText = function( elem ) {
- var i, node,
- nodeType = elem.nodeType,
- ret = "";
-
- if ( nodeType ) {
- if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
- // Use textContent || innerText for elements
- if ( typeof elem.textContent === 'string' ) {
- return elem.textContent;
- } else if ( typeof elem.innerText === 'string' ) {
- // Replace IE's carriage returns
- return elem.innerText.replace( rReturn, '' );
- } else {
- // Traverse it's children
- for ( elem = elem.firstChild; elem; elem = elem.nextSibling) {
- ret += getText( elem );
- }
- }
- } else if ( nodeType === 3 || nodeType === 4 ) {
- return elem.nodeValue;
- }
- } else {
-
- // If no nodeType, this is expected to be an array
- for ( i = 0; (node = elem[i]); i++ ) {
- // Do not traverse comment nodes
- if ( node.nodeType !== 8 ) {
- ret += getText( node );
- }
- }
- }
- return ret;
-};
-
-var Expr = Sizzle.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|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,
- TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,
- CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,
- POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,
- PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
- },
-
- leftMatch: {},
-
- attrMap: {
- "class": "className",
- "for": "htmlFor"
- },
-
- attrHandle: {
- href: function( elem ) {
- return elem.getAttribute( "href" );
- },
- type: function( elem ) {
- return elem.getAttribute( "type" );
- }
- },
-
- relative: {
- "+": function(checkSet, part){
- var isPartStr = typeof part === "string",
- isTag = isPartStr && !rNonWord.test( part ),
- isPartStrNotTag = isPartStr && !isTag;
-
- if ( isTag ) {
- part = part.toLowerCase();
- }
-
- for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
- if ( (elem = checkSet[i]) ) {
- while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
-
- checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?
- elem || false :
- elem === part;
- }
- }
-
- if ( isPartStrNotTag ) {
- Sizzle.filter( part, checkSet, true );
- }
- },
-
- ">": function( checkSet, part ) {
- var elem,
- isPartStr = typeof part === "string",
- i = 0,
- l = checkSet.length;
-
- if ( isPartStr && !rNonWord.test( part ) ) {
- part = part.toLowerCase();
-
- for ( ; i < l; i++ ) {
- elem = checkSet[i];
-
- if ( elem ) {
- var parent = elem.parentNode;
- checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;
- }
- }
-
- } else {
- for ( ; i < l; i++ ) {
- elem = checkSet[i];
-
- if ( elem ) {
- checkSet[i] = isPartStr ?
- elem.parentNode :
- elem.parentNode === part;
- }
- }
-
- if ( isPartStr ) {
- Sizzle.filter( part, checkSet, true );
- }
- }
- },
-
- "": function(checkSet, part, isXML){
- var nodeCheck,
- doneName = done++,
- checkFn = dirCheck;
-
- if ( typeof part === "string" && !rNonWord.test( part ) ) {
- part = part.toLowerCase();
- nodeCheck = part;
- checkFn = dirNodeCheck;
- }
-
- checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML );
- },
-
- "~": function( checkSet, part, isXML ) {
- var nodeCheck,
- doneName = done++,
- checkFn = dirCheck;
-
- if ( typeof part === "string" && !rNonWord.test( part ) ) {
- part = part.toLowerCase();
- nodeCheck = part;
- checkFn = dirNodeCheck;
- }
-
- checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML );
- }
- },
-
- find: {
- ID: function( match, context, isXML ) {
- if ( typeof context.getElementById !== "undefined" && !isXML ) {
- var m = context.getElementById(match[1]);
- // Check parentNode to catch when Blackberry 4.6 returns
- // nodes that are no longer in the document #6963
- return m && m.parentNode ? [m] : [];
- }
- },
-
- NAME: function( match, context ) {
- if ( typeof context.getElementsByName !== "undefined" ) {
- var ret = [],
- results = context.getElementsByName( match[1] );
-
- for ( var i = 0, l = results.length; i < l; i++ ) {
- if ( results[i].getAttribute("name") === match[1] ) {
- ret.push( results[i] );
- }
- }
-
- return ret.length === 0 ? null : ret;
- }
- },
-
- TAG: function( match, context ) {
- if ( typeof context.getElementsByTagName !== "undefined" ) {
- return context.getElementsByTagName( match[1] );
- }
- }
- },
- preFilter: {
- CLASS: function( match, curLoop, inplace, result, not, isXML ) {
- match = " " + match[1].replace( rBackslash, "" ) + " ";
-
- if ( isXML ) {
- return match;
- }
-
- for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
- if ( elem ) {
- if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) {
- if ( !inplace ) {
- result.push( elem );
- }
-
- } else if ( inplace ) {
- curLoop[i] = false;
- }
- }
- }
-
- return false;
- },
-
- ID: function( match ) {
- return match[1].replace( rBackslash, "" );
- },
-
- TAG: function( match, curLoop ) {
- return match[1].replace( rBackslash, "" ).toLowerCase();
- },
-
- CHILD: function( match ) {
- if ( match[1] === "nth" ) {
- if ( !match[2] ) {
- Sizzle.error( match[0] );
- }
-
- match[2] = match[2].replace(/^\+|\s*/g, '');
-
- // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
- var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec(
- match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||
- !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
-
- // calculate the numbers (first)n+(last) including if they are negative
- match[2] = (test[1] + (test[2] || 1)) - 0;
- match[3] = test[3] - 0;
- }
- else if ( match[2] ) {
- Sizzle.error( match[0] );
- }
-
- // TODO: Move to normal caching system
- match[0] = done++;
-
- return match;
- },
-
- ATTR: function( match, curLoop, inplace, result, not, isXML ) {
- var name = match[1] = match[1].replace( rBackslash, "" );
-
- if ( !isXML && Expr.attrMap[name] ) {
- match[1] = Expr.attrMap[name];
- }
-
- // Handle if an un-quoted value was used
- match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" );
-
- if ( match[2] === "~=" ) {
- match[4] = " " + match[4] + " ";
- }
-
- return match;
- },
-
- PSEUDO: function( match, curLoop, inplace, result, not ) {
- if ( match[1] === "not" ) {
- // If we're dealing with a complex expression, or a simple one
- if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {
- match[3] = Sizzle(match[3], null, null, curLoop);
-
- } else {
- var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
-
- if ( !inplace ) {
- result.push.apply( result, ret );
- }
-
- return false;
- }
-
- } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
- return true;
- }
-
- return match;
- },
-
- POS: function( match ) {
- match.unshift( true );
-
- return match;
- }
- },
-
- filters: {
- enabled: function( elem ) {
- return elem.disabled === false && elem.type !== "hidden";
- },
-
- disabled: function( elem ) {
- return elem.disabled === true;
- },
-
- checked: function( elem ) {
- return elem.checked === true;
- },
-
- selected: function( elem ) {
- // Accessing this property makes selected-by-default
- // options in Safari work properly
- if ( elem.parentNode ) {
- elem.parentNode.selectedIndex;
- }
-
- return elem.selected === true;
- },
-
- parent: function( elem ) {
- return !!elem.firstChild;
- },
-
- empty: function( elem ) {
- return !elem.firstChild;
- },
-
- has: function( elem, i, match ) {
- return !!Sizzle( match[3], elem ).length;
- },
-
- header: function( elem ) {
- return (/h\d/i).test( elem.nodeName );
- },
-
- text: function( elem ) {
- var attr = elem.getAttribute( "type" ), type = elem.type;
- // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
- // use getAttribute instead to test this case
- return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null );
- },
-
- radio: function( elem ) {
- return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type;
- },
-
- checkbox: function( elem ) {
- return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type;
- },
-
- file: function( elem ) {
- return elem.nodeName.toLowerCase() === "input" && "file" === elem.type;
- },
-
- password: function( elem ) {
- return elem.nodeName.toLowerCase() === "input" && "password" === elem.type;
- },
-
- submit: function( elem ) {
- var name = elem.nodeName.toLowerCase();
- return (name === "input" || name === "button") && "submit" === elem.type;
- },
-
- image: function( elem ) {
- return elem.nodeName.toLowerCase() === "input" && "image" === elem.type;
- },
-
- reset: function( elem ) {
- var name = elem.nodeName.toLowerCase();
- return (name === "input" || name === "button") && "reset" === elem.type;
- },
-
- button: function( elem ) {
- var name = elem.nodeName.toLowerCase();
- return name === "input" && "button" === elem.type || name === "button";
- },
-
- input: function( elem ) {
- return (/input|select|textarea|button/i).test( elem.nodeName );
- },
-
- focus: function( elem ) {
- return elem === elem.ownerDocument.activeElement;
- }
- },
- setFilters: {
- first: function( elem, i ) {
- return i === 0;
- },
-
- last: function( elem, i, match, array ) {
- return i === array.length - 1;
- },
-
- even: function( elem, i ) {
- return i % 2 === 0;
- },
-
- odd: function( elem, i ) {
- return i % 2 === 1;
- },
-
- lt: function( elem, i, match ) {
- return i < match[3] - 0;
- },
-
- gt: function( elem, i, match ) {
- return i > match[3] - 0;
- },
-
- nth: function( elem, i, match ) {
- return match[3] - 0 === i;
- },
-
- eq: function( elem, i, match ) {
- return match[3] - 0 === i;
- }
- },
- filter: {
- PSEUDO: function( elem, match, i, array ) {
- var name = match[1],
- filter = Expr.filters[ name ];
-
- if ( filter ) {
- return filter( elem, i, match, array );
-
- } else if ( name === "contains" ) {
- return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0;
-
- } else if ( name === "not" ) {
- var not = match[3];
-
- for ( var j = 0, l = not.length; j < l; j++ ) {
- if ( not[j] === elem ) {
- return false;
- }
- }
-
- return true;
-
- } else {
- Sizzle.error( name );
- }
- },
-
- CHILD: function( elem, match ) {
- var first, last,
- doneName, parent, cache,
- count, diff,
- type = match[1],
- node = elem;
-
- switch ( type ) {
- case "only":
- case "first":
- while ( (node = node.previousSibling) ) {
- if ( node.nodeType === 1 ) {
- return false;
- }
- }
-
- if ( type === "first" ) {
- return true;
- }
-
- node = elem;
-
- /* falls through */
- case "last":
- while ( (node = node.nextSibling) ) {
- if ( node.nodeType === 1 ) {
- return false;
- }
- }
-
- return true;
-
- case "nth":
- first = match[2];
- last = match[3];
-
- if ( first === 1 && last === 0 ) {
- return true;
- }
-
- doneName = match[0];
- parent = elem.parentNode;
-
- if ( parent && (parent[ expando ] !== doneName || !elem.nodeIndex) ) {
- count = 0;
-
- for ( node = parent.firstChild; node; node = node.nextSibling ) {
- if ( node.nodeType === 1 ) {
- node.nodeIndex = ++count;
- }
- }
-
- parent[ expando ] = doneName;
- }
-
- diff = elem.nodeIndex - last;
-
- if ( first === 0 ) {
- return diff === 0;
-
- } else {
- return ( diff % first === 0 && diff / first >= 0 );
- }
- }
- },
-
- ID: function( elem, match ) {
- return elem.nodeType === 1 && elem.getAttribute("id") === match;
- },
-
- TAG: function( elem, match ) {
- return (match === "*" && elem.nodeType === 1) || !!elem.nodeName && elem.nodeName.toLowerCase() === match;
- },
-
- CLASS: function( elem, match ) {
- return (" " + (elem.className || elem.getAttribute("class")) + " ")
- .indexOf( match ) > -1;
- },
-
- ATTR: function( elem, match ) {
- var name = match[1],
- result = Sizzle.attr ?
- Sizzle.attr( elem, name ) :
- Expr.attrHandle[ name ] ?
- Expr.attrHandle[ name ]( elem ) :
- elem[ name ] != null ?
- elem[ name ] :
- elem.getAttribute( name ),
- value = result + "",
- type = match[2],
- check = match[4];
-
- return result == null ?
- type === "!=" :
- !type && Sizzle.attr ?
- result != null :
- type === "=" ?
- value === check :
- type === "*=" ?
- value.indexOf(check) >= 0 :
- type === "~=" ?
- (" " + value + " ").indexOf(check) >= 0 :
- !check ?
- value && result !== false :
- type === "!=" ?
- value !== check :
- type === "^=" ?
- value.indexOf(check) === 0 :
- type === "$=" ?
- value.substr(value.length - check.length) === check :
- type === "|=" ?
- value === check || value.substr(0, check.length + 1) === check + "-" :
- false;
- },
-
- POS: function( elem, match, i, array ) {
- var name = match[2],
- filter = Expr.setFilters[ name ];
-
- if ( filter ) {
- return filter( elem, i, match, array );
- }
- }
- }
-};
-
-var origPOS = Expr.match.POS,
- fescape = function(all, num){
- return "\\" + (num - 0 + 1);
- };
-
-for ( var type in Expr.match ) {
- Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );
- Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );
-}
-// Expose origPOS
-// "global" as in regardless of relation to brackets/parens
-Expr.match.globalPOS = origPOS;
-
-var makeArray = function( array, results ) {
- array = Array.prototype.slice.call( array, 0 );
-
- if ( results ) {
- results.push.apply( results, array );
- return results;
- }
-
- return array;
-};
-
-// Perform a simple check to determine if the browser is capable of
-// converting a NodeList to an array using builtin methods.
-// Also verifies that the returned array holds DOM nodes
-// (which is not the case in the Blackberry browser)
-try {
- Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;
-
-// Provide a fallback method if it does not work
-} catch( e ) {
- makeArray = function( array, results ) {
- var i = 0,
- ret = results || [];
-
- if ( toString.call(array) === "[object Array]" ) {
- Array.prototype.push.apply( ret, array );
-
- } else {
- if ( typeof array.length === "number" ) {
- for ( var l = array.length; i < l; i++ ) {
- ret.push( array[i] );
- }
-
- } else {
- for ( ; array[i]; i++ ) {
- ret.push( array[i] );
- }
- }
- }
-
- return ret;
- };
-}
-
-var sortOrder, siblingCheck;
-
-if ( document.documentElement.compareDocumentPosition ) {
- sortOrder = function( a, b ) {
- if ( a === b ) {
- hasDuplicate = true;
- return 0;
- }
-
- if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {
- return a.compareDocumentPosition ? -1 : 1;
- }
-
- return a.compareDocumentPosition(b) & 4 ? -1 : 1;
- };
-
-} else {
- sortOrder = function( a, b ) {
- // The nodes are identical, we can exit early
- if ( a === b ) {
- hasDuplicate = true;
- return 0;
-
- // Fallback to using sourceIndex (in IE) if it's available on both nodes
- } else if ( a.sourceIndex && b.sourceIndex ) {
- return a.sourceIndex - b.sourceIndex;
- }
-
- var al, bl,
- ap = [],
- bp = [],
- aup = a.parentNode,
- bup = b.parentNode,
- cur = aup;
-
- // If the nodes are siblings (or identical) we can do a quick check
- if ( aup === bup ) {
- return siblingCheck( a, b );
-
- // If no parents were found then the nodes are disconnected
- } else if ( !aup ) {
- return -1;
-
- } else if ( !bup ) {
- return 1;
- }
-
- // Otherwise they're somewhere else in the tree so we need
- // to build up a full list of the parentNodes for comparison
- while ( cur ) {
- ap.unshift( cur );
- cur = cur.parentNode;
- }
-
- cur = bup;
-
- while ( cur ) {
- bp.unshift( cur );
- cur = cur.parentNode;
- }
-
- al = ap.length;
- bl = bp.length;
-
- // Start walking down the tree looking for a discrepancy
- for ( var i = 0; i < al && i < bl; i++ ) {
- if ( ap[i] !== bp[i] ) {
- return siblingCheck( ap[i], bp[i] );
- }
- }
-
- // We ended someplace up the tree so do a sibling check
- return i === al ?
- siblingCheck( a, bp[i], -1 ) :
- siblingCheck( ap[i], b, 1 );
- };
-
- siblingCheck = function( a, b, ret ) {
- if ( a === b ) {
- return ret;
- }
-
- var cur = a.nextSibling;
-
- while ( cur ) {
- if ( cur === b ) {
- return -1;
- }
-
- cur = cur.nextSibling;
- }
-
- return 1;
- };
-}
-
-// Check to see if the browser returns elements by name when
-// querying by getElementById (and provide a workaround)
-(function(){
- // We're going to inject a fake input element with a specified name
- var form = document.createElement("div"),
- id = "script" + (new Date()).getTime(),
- root = document.documentElement;
-
- form.innerHTML = "<a name='" + id + "'/>";
-
- // Inject it into the root element, check its status, and remove it quickly
- root.insertBefore( form, root.firstChild );
-
- // The workaround has to do additional checks after a getElementById
- // Which slows things down for other browsers (hence the branching)
- if ( document.getElementById( id ) ) {
- Expr.find.ID = function( match, context, isXML ) {
- if ( typeof context.getElementById !== "undefined" && !isXML ) {
- var m = context.getElementById(match[1]);
-
- return m ?
- m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ?
- [m] :
- undefined :
- [];
- }
- };
-
- Expr.filter.ID = function( elem, match ) {
- var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
-
- return elem.nodeType === 1 && node && node.nodeValue === match;
- };
- }
-
- root.removeChild( form );
-
- // release memory in IE
- root = form = null;
-})();
-
-(function(){
- // Check to see if the browser returns only elements
- // when doing getElementsByTagName("*")
-
- // Create a fake element
- var div = document.createElement("div");
- div.appendChild( document.createComment("") );
-
- // Make sure no comments are found
- if ( div.getElementsByTagName("*").length > 0 ) {
- Expr.find.TAG = function( match, context ) {
- var results = context.getElementsByTagName( match[1] );
-
- // Filter out possible comments
- if ( match[1] === "*" ) {
- var tmp = [];
-
- for ( var i = 0; results[i]; i++ ) {
- if ( results[i].nodeType === 1 ) {
- tmp.push( results[i] );
- }
- }
-
- results = tmp;
- }
-
- return results;
- };
- }
-
- // Check to see if an attribute returns normalized href attributes
- div.innerHTML = "<a href='#'></a>";
-
- if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
- div.firstChild.getAttribute("href") !== "#" ) {
-
- Expr.attrHandle.href = function( elem ) {
- return elem.getAttribute( "href", 2 );
- };
- }
-
- // release memory in IE
- div = null;
-})();
-
-if ( document.querySelectorAll ) {
- (function(){
- var oldSizzle = Sizzle,
- div = document.createElement("div"),
- id = "__sizzle__";
-
- div.innerHTML = "<p class='TEST'></p>";
-
- // Safari can't handle uppercase or unicode characters when
- // in quirks mode.
- if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
- return;
- }
-
- Sizzle = function( query, context, extra, seed ) {
- context = context || document;
-
- // Only use querySelectorAll on non-XML documents
- // (ID selectors don't work in non-HTML documents)
- if ( !seed && !Sizzle.isXML(context) ) {
- // See if we find a selector to speed up
- var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query );
-
- if ( match && (context.nodeType === 1 || context.nodeType === 9) ) {
- // Speed-up: Sizzle("TAG")
- if ( match[1] ) {
- return makeArray( context.getElementsByTagName( query ), extra );
-
- // Speed-up: Sizzle(".CLASS")
- } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) {
- return makeArray( context.getElementsByClassName( match[2] ), extra );
- }
- }
-
- if ( context.nodeType === 9 ) {
- // Speed-up: Sizzle("body")
- // The body element only exists once, optimize finding it
- if ( query === "body" && context.body ) {
- return makeArray( [ context.body ], extra );
-
- // Speed-up: Sizzle("#ID")
- } else if ( match && match[3] ) {
- var elem = context.getElementById( match[3] );
-
- // Check parentNode to catch when Blackberry 4.6 returns
- // nodes that are no longer in the document #6963
- if ( elem && elem.parentNode ) {
- // Handle the case where IE and Opera return items
- // by name instead of ID
- if ( elem.id === match[3] ) {
- return makeArray( [ elem ], extra );
- }
-
- } else {
- return makeArray( [], extra );
- }
- }
-
- try {
- return makeArray( context.querySelectorAll(query), extra );
- } catch(qsaError) {}
-
- // qSA works strangely on Element-rooted queries
- // We can work around this by specifying an extra ID on the root
- // and working up from there (Thanks to Andrew Dupont for the technique)
- // IE 8 doesn't work on object elements
- } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
- var oldContext = context,
- old = context.getAttribute( "id" ),
- nid = old || id,
- hasParent = context.parentNode,
- relativeHierarchySelector = /^\s*[+~]/.test( query );
-
- if ( !old ) {
- context.setAttribute( "id", nid );
- } else {
- nid = nid.replace( /'/g, "\\$&" );
- }
- if ( relativeHierarchySelector && hasParent ) {
- context = context.parentNode;
- }
-
- try {
- if ( !relativeHierarchySelector || hasParent ) {
- return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra );
- }
-
- } catch(pseudoError) {
- } finally {
- if ( !old ) {
- oldContext.removeAttribute( "id" );
- }
- }
- }
- }
-
- return oldSizzle(query, context, extra, seed);
- };
-
- for ( var prop in oldSizzle ) {
- Sizzle[ prop ] = oldSizzle[ prop ];
- }
-
- // release memory in IE
- div = null;
- })();
-}
-
-(function(){
- var html = document.documentElement,
- matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector;
-
- if ( matches ) {
- // Check to see if it's possible to do matchesSelector
- // on a disconnected node (IE 9 fails this)
- var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ),
- pseudoWorks = false;
-
- try {
- // This should fail with an exception
- // Gecko does not error, returns false instead
- matches.call( document.documentElement, "[test!='']:sizzle" );
-
- } catch( pseudoError ) {
- pseudoWorks = true;
- }
-
- Sizzle.matchesSelector = function( node, expr ) {
- // Make sure that attribute selectors are quoted
- expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
-
- if ( !Sizzle.isXML( node ) ) {
- try {
- if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {
- var ret = matches.call( node, expr );
-
- // IE 9's matchesSelector returns false on disconnected nodes
- if ( ret || !disconnectedMatch ||
- // As well, disconnected nodes are said to be in a document
- // fragment in IE 9, so check for that
- node.document && node.document.nodeType !== 11 ) {
- return ret;
- }
- }
- } catch(e) {}
- }
-
- return Sizzle(expr, null, null, [node]).length > 0;
- };
- }
-})();
-
-(function(){
- var div = document.createElement("div");
-
- div.innerHTML = "<div class='test e'></div><div class='test'></div>";
-
- // Opera can't find a second classname (in 9.6)
- // Also, make sure that getElementsByClassName actually exists
- if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) {
- return;
- }
-
- // Safari caches class attributes, doesn't catch changes (in 3.2)
- div.lastChild.className = "e";
-
- if ( div.getElementsByClassName("e").length === 1 ) {
- return;
- }
-
- Expr.order.splice(1, 0, "CLASS");
- Expr.find.CLASS = function( match, context, isXML ) {
- if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
- return context.getElementsByClassName(match[1]);
- }
- };
-
- // release memory in IE
- div = null;
-})();
-
-function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
- for ( var i = 0, l = checkSet.length; i < l; i++ ) {
- var elem = checkSet[i];
-
- if ( elem ) {
- var match = false;
-
- elem = elem[dir];
-
- while ( elem ) {
- if ( elem[ expando ] === doneName ) {
- match = checkSet[elem.sizset];
- break;
- }
-
- if ( elem.nodeType === 1 && !isXML ){
- elem[ expando ] = doneName;
- elem.sizset = i;
- }
-
- if ( elem.nodeName.toLowerCase() === cur ) {
- match = elem;
- break;
- }
-
- elem = elem[dir];
- }
-
- checkSet[i] = match;
- }
- }
-}
-
-function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
- for ( var i = 0, l = checkSet.length; i < l; i++ ) {
- var elem = checkSet[i];
-
- if ( elem ) {
- var match = false;
-
- elem = elem[dir];
-
- while ( elem ) {
- if ( elem[ expando ] === doneName ) {
- match = checkSet[elem.sizset];
- break;
- }
-
- if ( elem.nodeType === 1 ) {
- if ( !isXML ) {
- elem[ expando ] = doneName;
- elem.sizset = i;
- }
-
- if ( typeof cur !== "string" ) {
- if ( elem === cur ) {
- match = true;
- break;
- }
-
- } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
- match = elem;
- break;
- }
- }
-
- elem = elem[dir];
- }
-
- checkSet[i] = match;
- }
- }
-}
-
-if ( document.documentElement.contains ) {
- Sizzle.contains = function( a, b ) {
- return a !== b && (a.contains ? a.contains(b) : true);
- };
-
-} else if ( document.documentElement.compareDocumentPosition ) {
- Sizzle.contains = function( a, b ) {
- return !!(a.compareDocumentPosition(b) & 16);
- };
-
-} else {
- Sizzle.contains = function() {
- return false;
- };
-}
-
-Sizzle.isXML = function( elem ) {
- // documentElement is verified for cases where it doesn't yet exist
- // (such as loading iframes in IE - #4833)
- var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
-
- return documentElement ? documentElement.nodeName !== "HTML" : false;
-};
-
-var posProcess = function( selector, context, seed ) {
- var match,
- tmpSet = [],
- later = "",
- root = context.nodeType ? [context] : context;
-
- // Position selectors must be done after the filter
- // And so must :not(positional) so we move all PSEUDOs to the end
- while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
- later += match[0];
- selector = selector.replace( Expr.match.PSEUDO, "" );
- }
-
- selector = Expr.relative[selector] ? selector + "*" : selector;
-
- for ( var i = 0, l = root.length; i < l; i++ ) {
- Sizzle( selector, root[i], tmpSet, seed );
- }
-
- return Sizzle.filter( later, tmpSet );
-};
-
-// EXPOSE
-// Override sizzle attribute retrieval
-Sizzle.attr = jQuery.attr;
-Sizzle.selectors.attrMap = {};
-jQuery.find = Sizzle;
-jQuery.expr = Sizzle.selectors;
-jQuery.expr[":"] = jQuery.expr.filters;
-jQuery.unique = Sizzle.uniqueSort;
-jQuery.text = Sizzle.getText;
-jQuery.isXMLDoc = Sizzle.isXML;
-jQuery.contains = Sizzle.contains;
-
-
-})();
-
-
-var runtil = /Until$/,
- rparentsprev = /^(?:parents|prevUntil|prevAll)/,
- // Note: This RegExp should be improved, or likely pulled from Sizzle
- rmultiselector = /,/,
- isSimple = /^.[^:#\[\.,]*$/,
- slice = Array.prototype.slice,
- POS = jQuery.expr.match.globalPOS,
- // methods guaranteed to produce a unique set when starting from a unique set
- guaranteedUnique = {
- children: true,
- contents: true,
- next: true,
- prev: true
- };
-
-jQuery.fn.extend({
- find: function( selector ) {
- var self = this,
- i, l;
-
- if ( typeof selector !== "string" ) {
- return jQuery( selector ).filter(function() {
- for ( i = 0, l = self.length; i < l; i++ ) {
- if ( jQuery.contains( self[ i ], this ) ) {
- return true;
- }
- }
- });
- }
-
- var ret = this.pushStack( "", "find", selector ),
- length, n, r;
-
- for ( i = 0, l = this.length; i < l; i++ ) {
- length = ret.length;
- jQuery.find( selector, this[i], ret );
-
- if ( i > 0 ) {
- // Make sure that the results are unique
- for ( n = length; n < ret.length; n++ ) {
- for ( r = 0; r < length; r++ ) {
- if ( ret[r] === ret[n] ) {
- ret.splice(n--, 1);
- break;
- }
- }
- }
- }
- }
-
- return ret;
- },
-
- has: function( target ) {
- var targets = jQuery( target );
- return this.filter(function() {
- for ( var i = 0, l = targets.length; i < l; i++ ) {
- if ( jQuery.contains( this, targets[i] ) ) {
- return true;
- }
- }
- });
- },
-
- not: function( selector ) {
- return this.pushStack( winnow(this, selector, false), "not", selector);
- },
-
- filter: function( selector ) {
- return this.pushStack( winnow(this, selector, true), "filter", selector );
- },
-
- is: function( selector ) {
- return !!selector && (
- typeof selector === "string" ?
- // If this is a positional selector, check membership in the returned set
- // so $("p:first").is("p:last") won't return true for a doc with two "p".
- POS.test( selector ) ?
- jQuery( selector, this.context ).index( this[0] ) >= 0 :
- jQuery.filter( selector, this ).length > 0 :
- this.filter( selector ).length > 0 );
- },
-
- closest: function( selectors, context ) {
- var ret = [], i, l, cur = this[0];
-
- // Array (deprecated as of jQuery 1.7)
- if ( jQuery.isArray( selectors ) ) {
- var level = 1;
-
- while ( cur && cur.ownerDocument && cur !== context ) {
- for ( i = 0; i < selectors.length; i++ ) {
-
- if ( jQuery( cur ).is( selectors[ i ] ) ) {
- ret.push({ selector: selectors[ i ], elem: cur, level: level });
- }
- }
-
- cur = cur.parentNode;
- level++;
- }
-
- return ret;
- }
-
- // String
- var pos = POS.test( selectors ) || typeof selectors !== "string" ?
- jQuery( selectors, context || this.context ) :
- 0;
-
- for ( i = 0, l = this.length; i < l; i++ ) {
- cur = this[i];
-
- while ( cur ) {
- if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
- ret.push( cur );
- break;
-
- } else {
- cur = cur.parentNode;
- if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) {
- break;
- }
- }
- }
- }
-
- ret = ret.length > 1 ? jQuery.unique( ret ) : ret;
-
- return this.pushStack( ret, "closest", selectors );
- },
-
- // Determine the position of an element within
- // the matched set of elements
- index: function( elem ) {
-
- // No argument, return index in parent
- if ( !elem ) {
- return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1;
- }
-
- // index in selector
- if ( typeof elem === "string" ) {
- return jQuery.inArray( this[0], jQuery( elem ) );
- }
-
- // Locate the position of the desired element
- return jQuery.inArray(
- // If it receives a jQuery object, the first element is used
- elem.jquery ? elem[0] : elem, this );
- },
-
- add: function( selector, context ) {
- var set = typeof selector === "string" ?
- jQuery( selector, context ) :
- jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
- all = jQuery.merge( this.get(), set );
-
- return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?
- all :
- jQuery.unique( all ) );
- },
-
- andSelf: function() {
- return this.add( this.prevObject );
- }
-});
-
-// A painfully simple check to see if an element is disconnected
-// from a document (should be improved, where feasible).
-function isDisconnected( node ) {
- return !node || !node.parentNode || node.parentNode.nodeType === 11;
-}
-
-jQuery.each({
- parent: function( elem ) {
- var parent = elem.parentNode;
- return parent && parent.nodeType !== 11 ? parent : null;
- },
- parents: function( elem ) {
- return jQuery.dir( elem, "parentNode" );
- },
- parentsUntil: function( elem, i, until ) {
- return jQuery.dir( elem, "parentNode", until );
- },
- next: function( elem ) {
- return jQuery.nth( elem, 2, "nextSibling" );
- },
- prev: function( elem ) {
- return jQuery.nth( elem, 2, "previousSibling" );
- },
- nextAll: function( elem ) {
- return jQuery.dir( elem, "nextSibling" );
- },
- prevAll: function( elem ) {
- return jQuery.dir( elem, "previousSibling" );
- },
- nextUntil: function( elem, i, until ) {
- return jQuery.dir( elem, "nextSibling", until );
- },
- prevUntil: function( elem, i, until ) {
- return jQuery.dir( elem, "previousSibling", until );
- },
- siblings: function( elem ) {
- return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
- },
- children: function( elem ) {
- return jQuery.sibling( elem.firstChild );
- },
- contents: function( elem ) {
- return jQuery.nodeName( elem, "iframe" ) ?
- elem.contentDocument || elem.contentWindow.document :
- jQuery.makeArray( elem.childNodes );
- }
-}, function( name, fn ) {
- jQuery.fn[ name ] = function( until, selector ) {
- var ret = jQuery.map( this, fn, until );
-
- if ( !runtil.test( name ) ) {
- selector = until;
- }
-
- if ( selector && typeof selector === "string" ) {
- ret = jQuery.filter( selector, ret );
- }
-
- ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
-
- if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) {
- ret = ret.reverse();
- }
-
- return this.pushStack( ret, name, slice.call( arguments ).join(",") );
- };
-});
-
-jQuery.extend({
- filter: function( expr, elems, not ) {
- if ( not ) {
- expr = ":not(" + expr + ")";
- }
-
- return elems.length === 1 ?
- jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
- jQuery.find.matches(expr, elems);
- },
-
- dir: function( elem, dir, until ) {
- var matched = [],
- cur = elem[ dir ];
-
- while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
- if ( cur.nodeType === 1 ) {
- matched.push( cur );
- }
- cur = cur[dir];
- }
- return matched;
- },
-
- nth: function( cur, result, dir, elem ) {
- result = result || 1;
- var num = 0;
-
- for ( ; cur; cur = cur[dir] ) {
- if ( cur.nodeType === 1 && ++num === result ) {
- break;
- }
- }
-
- return cur;
- },
-
- sibling: function( n, elem ) {
- var r = [];
-
- for ( ; n; n = n.nextSibling ) {
- if ( n.nodeType === 1 && n !== elem ) {
- r.push( n );
- }
- }
-
- return r;
- }
-});
-
-// Implement the identical functionality for filter and not
-function winnow( elements, qualifier, keep ) {
-
- // Can't pass null or undefined to indexOf in Firefox 4
- // Set to 0 to skip string check
- qualifier = qualifier || 0;
-
- if ( jQuery.isFunction( qualifier ) ) {
- return jQuery.grep(elements, function( elem, i ) {
- var retVal = !!qualifier.call( elem, i, elem );
- return retVal === keep;
- });
-
- } else if ( qualifier.nodeType ) {
- return jQuery.grep(elements, function( elem, i ) {
- return ( elem === qualifier ) === keep;
- });
-
- } else if ( typeof qualifier === "string" ) {
- var filtered = jQuery.grep(elements, function( elem ) {
- return elem.nodeType === 1;
- });
-
- if ( isSimple.test( qualifier ) ) {
- return jQuery.filter(qualifier, filtered, !keep);
- } else {
- qualifier = jQuery.filter( qualifier, filtered );
- }
- }
-
- return jQuery.grep(elements, function( elem, i ) {
- return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep;
- });
-}
-
-
-
-
-function createSafeFragment( document ) {
- var list = nodeNames.split( "|" ),
- safeFrag = document.createDocumentFragment();
-
- if ( safeFrag.createElement ) {
- while ( list.length ) {
- safeFrag.createElement(
- list.pop()
- );
- }
- }
- return safeFrag;
-}
-
-var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" +
- "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
- rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
- rleadingWhitespace = /^\s+/,
- rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,
- rtagName = /<([\w:]+)/,
- rtbody = /<tbody/i,
- rhtml = /<|&#?\w+;/,
- rnoInnerhtml = /<(?:script|style)/i,
- rnocache = /<(?:script|object|embed|option|style)/i,
- rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),
- // checked="checked" or checked
- rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
- rscriptType = /\/(java|ecma)script/i,
- rcleanScript = /^\s*<!(?:\[CDATA\[|\-\-)/,
- wrapMap = {
- option: [ 1, "<select multiple='multiple'>", "</select>" ],
- legend: [ 1, "<fieldset>", "</fieldset>" ],
- thead: [ 1, "<table>", "</table>" ],
- tr: [ 2, "<table><tbody>", "</tbody></table>" ],
- td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
- col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
- area: [ 1, "<map>", "</map>" ],
- _default: [ 0, "", "" ]
- },
- safeFragment = createSafeFragment( document );
-
-wrapMap.optgroup = wrapMap.option;
-wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
-wrapMap.th = wrapMap.td;
-
-// IE can't serialize <link> and <script> tags normally
-if ( !jQuery.support.htmlSerialize ) {
- wrapMap._default = [ 1, "div<div>", "</div>" ];
-}
-
-jQuery.fn.extend({
- text: function( value ) {
- return jQuery.access( this, function( value ) {
- return value === undefined ?
- jQuery.text( this ) :
- this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );
- }, null, value, arguments.length );
- },
-
- wrapAll: function( html ) {
- if ( jQuery.isFunction( html ) ) {
- return this.each(function(i) {
- jQuery(this).wrapAll( html.call(this, i) );
- });
- }
-
- if ( this[0] ) {
- // The elements to wrap the target around
- var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
-
- if ( this[0].parentNode ) {
- wrap.insertBefore( this[0] );
- }
-
- wrap.map(function() {
- var elem = this;
-
- while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
- elem = elem.firstChild;
- }
-
- return elem;
- }).append( this );
- }
-
- return this;
- },
-
- wrapInner: function( html ) {
- if ( jQuery.isFunction( html ) ) {
- return this.each(function(i) {
- jQuery(this).wrapInner( html.call(this, i) );
- });
- }
-
- return this.each(function() {
- var self = jQuery( this ),
- contents = self.contents();
-
- if ( contents.length ) {
- contents.wrapAll( html );
-
- } else {
- self.append( html );
- }
- });
- },
-
- wrap: function( html ) {
- var isFunction = jQuery.isFunction( html );
-
- return this.each(function(i) {
- jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
- });
- },
-
- unwrap: function() {
- return this.parent().each(function() {
- if ( !jQuery.nodeName( this, "body" ) ) {
- jQuery( this ).replaceWith( this.childNodes );
- }
- }).end();
- },
-
- append: function() {
- return this.domManip(arguments, true, function( elem ) {
- if ( this.nodeType === 1 ) {
- this.appendChild( elem );
- }
- });
- },
-
- prepend: function() {
- return this.domManip(arguments, true, function( elem ) {
- if ( this.nodeType === 1 ) {
- this.insertBefore( elem, this.firstChild );
- }
- });
- },
-
- before: function() {
- if ( this[0] && this[0].parentNode ) {
- return this.domManip(arguments, false, function( elem ) {
- this.parentNode.insertBefore( elem, this );
- });
- } else if ( arguments.length ) {
- var set = jQuery.clean( arguments );
- set.push.apply( set, this.toArray() );
- return this.pushStack( set, "before", arguments );
- }
- },
-
- after: function() {
- if ( this[0] && this[0].parentNode ) {
- return this.domManip(arguments, false, function( elem ) {
- this.parentNode.insertBefore( elem, this.nextSibling );
- });
- } else if ( arguments.length ) {
- var set = this.pushStack( this, "after", arguments );
- set.push.apply( set, jQuery.clean(arguments) );
- return set;
- }
- },
-
- // keepData is for internal use only--do not document
- remove: function( selector, keepData ) {
- for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
- if ( !selector || jQuery.filter( selector, [ elem ] ).length ) {
- if ( !keepData && elem.nodeType === 1 ) {
- jQuery.cleanData( elem.getElementsByTagName("*") );
- jQuery.cleanData( [ elem ] );
- }
-
- if ( elem.parentNode ) {
- elem.parentNode.removeChild( elem );
- }
- }
- }
-
- return this;
- },
-
- empty: function() {
- for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
- // Remove element nodes and prevent memory leaks
- if ( elem.nodeType === 1 ) {
- jQuery.cleanData( elem.getElementsByTagName("*") );
- }
-
- // Remove any remaining nodes
- while ( elem.firstChild ) {
- elem.removeChild( elem.firstChild );
- }
- }
-
- return this;
- },
-
- clone: function( dataAndEvents, deepDataAndEvents ) {
- dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
- deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
-
- return this.map( function () {
- return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
- });
- },
-
- html: function( value ) {
- return jQuery.access( this, function( value ) {
- var elem = this[0] || {},
- i = 0,
- l = this.length;
-
- if ( value === undefined ) {
- return elem.nodeType === 1 ?
- elem.innerHTML.replace( rinlinejQuery, "" ) :
- null;
- }
-
-
- if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
- ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
- !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) {
-
- value = value.replace( rxhtmlTag, "<$1></$2>" );
-
- try {
- for (; i < l; i++ ) {
- // Remove element nodes and prevent memory leaks
- elem = this[i] || {};
- if ( elem.nodeType === 1 ) {
- jQuery.cleanData( elem.getElementsByTagName( "*" ) );
- elem.innerHTML = value;
- }
- }
-
- elem = 0;
-
- // If using innerHTML throws an exception, use the fallback method
- } catch(e) {}
- }
-
- if ( elem ) {
- this.empty().append( value );
- }
- }, null, value, arguments.length );
- },
-
- replaceWith: function( value ) {
- if ( this[0] && this[0].parentNode ) {
- // Make sure that the elements are removed from the DOM before they are inserted
- // this can help fix replacing a parent with child elements
- if ( jQuery.isFunction( value ) ) {
- return this.each(function(i) {
- var self = jQuery(this), old = self.html();
- self.replaceWith( value.call( this, i, old ) );
- });
- }
-
- if ( typeof value !== "string" ) {
- value = jQuery( value ).detach();
- }
-
- return this.each(function() {
- var next = this.nextSibling,
- parent = this.parentNode;
-
- jQuery( this ).remove();
-
- if ( next ) {
- jQuery(next).before( value );
- } else {
- jQuery(parent).append( value );
- }
- });
- } else {
- return this.length ?
- this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) :
- this;
- }
- },
-
- detach: function( selector ) {
- return this.remove( selector, true );
- },
-
- domManip: function( args, table, callback ) {
- var results, first, fragment, parent,
- value = args[0],
- scripts = [];
-
- // We can't cloneNode fragments that contain checked, in WebKit
- if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) {
- return this.each(function() {
- jQuery(this).domManip( args, table, callback, true );
- });
- }
-
- if ( jQuery.isFunction(value) ) {
- return this.each(function(i) {
- var self = jQuery(this);
- args[0] = value.call(this, i, table ? self.html() : undefined);
- self.domManip( args, table, callback );
- });
- }
-
- if ( this[0] ) {
- parent = value && value.parentNode;
-
- // If we're in a fragment, just use that instead of building a new one
- if ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) {
- results = { fragment: parent };
-
- } else {
- results = jQuery.buildFragment( args, this, scripts );
- }
-
- fragment = results.fragment;
-
- if ( fragment.childNodes.length === 1 ) {
- first = fragment = fragment.firstChild;
- } else {
- first = fragment.firstChild;
- }
-
- if ( first ) {
- table = table && jQuery.nodeName( first, "tr" );
-
- for ( var i = 0, l = this.length, lastIndex = l - 1; i < l; i++ ) {
- callback.call(
- table ?
- root(this[i], first) :
- this[i],
- // Make sure that we do not leak memory by inadvertently discarding
- // the original fragment (which might have attached data) instead of
- // using it; in addition, use the original fragment object for the last
- // item instead of first because it can end up being emptied incorrectly
- // in certain situations (Bug #8070).
- // Fragments from the fragment cache must always be cloned and never used
- // in place.
- results.cacheable || ( l > 1 && i < lastIndex ) ?
- jQuery.clone( fragment, true, true ) :
- fragment
- );
- }
- }
-
- if ( scripts.length ) {
- jQuery.each( scripts, function( i, elem ) {
- if ( elem.src ) {
- jQuery.ajax({
- type: "GET",
- global: false,
- url: elem.src,
- async: false,
- dataType: "script"
- });
- } else {
- jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "/*$0*/" ) );
- }
-
- if ( elem.parentNode ) {
- elem.parentNode.removeChild( elem );
- }
- });
- }
- }
-
- return this;
- }
-});
-
-function root( elem, cur ) {
- return jQuery.nodeName(elem, "table") ?
- (elem.getElementsByTagName("tbody")[0] ||
- elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
- elem;
-}
-
-function cloneCopyEvent( src, dest ) {
-
- if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
- return;
- }
-
- var type, i, l,
- oldData = jQuery._data( src ),
- curData = jQuery._data( dest, oldData ),
- events = oldData.events;
-
- if ( events ) {
- delete curData.handle;
- curData.events = {};
-
- for ( type in events ) {
- for ( i = 0, l = events[ type ].length; i < l; i++ ) {
- jQuery.event.add( dest, type, events[ type ][ i ] );
- }
- }
- }
-
- // make the cloned public data object a copy from the original
- if ( curData.data ) {
- curData.data = jQuery.extend( {}, curData.data );
- }
-}
-
-function cloneFixAttributes( src, dest ) {
- var nodeName;
-
- // We do not need to do anything for non-Elements
- if ( dest.nodeType !== 1 ) {
- return;
- }
-
- // clearAttributes removes the attributes, which we don't want,
- // but also removes the attachEvent events, which we *do* want
- if ( dest.clearAttributes ) {
- dest.clearAttributes();
- }
-
- // mergeAttributes, in contrast, only merges back on the
- // original attributes, not the events
- if ( dest.mergeAttributes ) {
- dest.mergeAttributes( src );
- }
-
- nodeName = dest.nodeName.toLowerCase();
-
- // IE6-8 fail to clone children inside object elements that use
- // the proprietary classid attribute value (rather than the type
- // attribute) to identify the type of content to display
- if ( nodeName === "object" ) {
- dest.outerHTML = src.outerHTML;
-
- } else if ( nodeName === "input" && (src.type === "checkbox" || src.type === "radio") ) {
- // IE6-8 fails to persist the checked state of a cloned checkbox
- // or radio button. Worse, IE6-7 fail to give the cloned element
- // a checked appearance if the defaultChecked value isn't also set
- if ( src.checked ) {
- dest.defaultChecked = dest.checked = src.checked;
- }
-
- // IE6-7 get confused and end up setting the value of a cloned
- // checkbox/radio button to an empty string instead of "on"
- if ( dest.value !== src.value ) {
- dest.value = src.value;
- }
-
- // IE6-8 fails to return the selected option to the default selected
- // state when cloning options
- } else if ( nodeName === "option" ) {
- dest.selected = src.defaultSelected;
-
- // IE6-8 fails to set the defaultValue to the correct value when
- // cloning other types of input fields
- } else if ( nodeName === "input" || nodeName === "textarea" ) {
- dest.defaultValue = src.defaultValue;
-
- // IE blanks contents when cloning scripts
- } else if ( nodeName === "script" && dest.text !== src.text ) {
- dest.text = src.text;
- }
-
- // Event data gets referenced instead of copied if the expando
- // gets copied too
- dest.removeAttribute( jQuery.expando );
-
- // Clear flags for bubbling special change/submit events, they must
- // be reattached when the newly cloned events are first activated
- dest.removeAttribute( "_submit_attached" );
- dest.removeAttribute( "_change_attached" );
-}
-
-jQuery.buildFragment = function( args, nodes, scripts ) {
- var fragment, cacheable, cacheresults, doc,
- first = args[ 0 ];
-
- // nodes may contain either an explicit document object,
- // a jQuery collection or context object.
- // If nodes[0] contains a valid object to assign to doc
- if ( nodes && nodes[0] ) {
- doc = nodes[0].ownerDocument || nodes[0];
- }
-
- // Ensure that an attr object doesn't incorrectly stand in as a document object
- // Chrome and Firefox seem to allow this to occur and will throw exception
- // Fixes #8950
- if ( !doc.createDocumentFragment ) {
- doc = document;
- }
-
- // Only cache "small" (1/2 KB) HTML strings that are associated with the main document
- // Cloning options loses the selected state, so don't cache them
- // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment
- // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache
- // Lastly, IE6,7,8 will not correctly reuse cached fragments that were created from unknown elems #10501
- if ( args.length === 1 && typeof first === "string" && first.length < 512 && doc === document &&
- first.charAt(0) === "<" && !rnocache.test( first ) &&
- (jQuery.support.checkClone || !rchecked.test( first )) &&
- (jQuery.support.html5Clone || !rnoshimcache.test( first )) ) {
-
- cacheable = true;
-
- cacheresults = jQuery.fragments[ first ];
- if ( cacheresults && cacheresults !== 1 ) {
- fragment = cacheresults;
- }
- }
-
- if ( !fragment ) {
- fragment = doc.createDocumentFragment();
- jQuery.clean( args, doc, fragment, scripts );
- }
-
- if ( cacheable ) {
- jQuery.fragments[ first ] = cacheresults ? fragment : 1;
- }
-
- return { fragment: fragment, cacheable: cacheable };
-};
-
-jQuery.fragments = {};
-
-jQuery.each({
- appendTo: "append",
- prependTo: "prepend",
- insertBefore: "before",
- insertAfter: "after",
- replaceAll: "replaceWith"
-}, function( name, original ) {
- jQuery.fn[ name ] = function( selector ) {
- var ret = [],
- insert = jQuery( selector ),
- parent = this.length === 1 && this[0].parentNode;
-
- if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {
- insert[ original ]( this[0] );
- return this;
-
- } else {
- for ( var i = 0, l = insert.length; i < l; i++ ) {
- var elems = ( i > 0 ? this.clone(true) : this ).get();
- jQuery( insert[i] )[ original ]( elems );
- ret = ret.concat( elems );
- }
-
- return this.pushStack( ret, name, insert.selector );
- }
- };
-});
-
-function getAll( elem ) {
- if ( typeof elem.getElementsByTagName !== "undefined" ) {
- return elem.getElementsByTagName( "*" );
-
- } else if ( typeof elem.querySelectorAll !== "undefined" ) {
- return elem.querySelectorAll( "*" );
-
- } else {
- return [];
- }
-}
-
-// Used in clean, fixes the defaultChecked property
-function fixDefaultChecked( elem ) {
- if ( elem.type === "checkbox" || elem.type === "radio" ) {
- elem.defaultChecked = elem.checked;
- }
-}
-// Finds all inputs and passes them to fixDefaultChecked
-function findInputs( elem ) {
- var nodeName = ( elem.nodeName || "" ).toLowerCase();
- if ( nodeName === "input" ) {
- fixDefaultChecked( elem );
- // Skip scripts, get other children
- } else if ( nodeName !== "script" && typeof elem.getElementsByTagName !== "undefined" ) {
- jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked );
- }
-}
-
-// Derived From: http://www.iecss.com/shimprove/javascript/shimprove.1-0-1.js
-function shimCloneNode( elem ) {
- var div = document.createElement( "div" );
- safeFragment.appendChild( div );
-
- div.innerHTML = elem.outerHTML;
- return div.firstChild;
-}
-
-jQuery.extend({
- clone: function( elem, dataAndEvents, deepDataAndEvents ) {
- var srcElements,
- destElements,
- i,
- // IE<=8 does not properly clone detached, unknown element nodes
- clone = jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ?
- elem.cloneNode( true ) :
- shimCloneNode( elem );
-
- if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
- (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
- // IE copies events bound via attachEvent when using cloneNode.
- // Calling detachEvent on the clone will also remove the events
- // from the original. In order to get around this, we use some
- // proprietary methods to clear the events. Thanks to MooTools
- // guys for this hotness.
-
- cloneFixAttributes( elem, clone );
-
- // Using Sizzle here is crazy slow, so we use getElementsByTagName instead
- srcElements = getAll( elem );
- destElements = getAll( clone );
-
- // Weird iteration because IE will replace the length property
- // with an element if you are cloning the body and one of the
- // elements on the page has a name or id of "length"
- for ( i = 0; srcElements[i]; ++i ) {
- // Ensure that the destination node is not null; Fixes #9587
- if ( destElements[i] ) {
- cloneFixAttributes( srcElements[i], destElements[i] );
- }
- }
- }
-
- // Copy the events from the original to the clone
- if ( dataAndEvents ) {
- cloneCopyEvent( elem, clone );
-
- if ( deepDataAndEvents ) {
- srcElements = getAll( elem );
- destElements = getAll( clone );
-
- for ( i = 0; srcElements[i]; ++i ) {
- cloneCopyEvent( srcElements[i], destElements[i] );
- }
- }
- }
-
- srcElements = destElements = null;
-
- // Return the cloned set
- return clone;
- },
-
- clean: function( elems, context, fragment, scripts ) {
- var checkScriptType, script, j,
- ret = [];
-
- context = context || document;
-
- // !context.createElement fails in IE with an error but returns typeof 'object'
- if ( typeof context.createElement === "undefined" ) {
- context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
- }
-
- for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
- if ( typeof elem === "number" ) {
- elem += "";
- }
-
- if ( !elem ) {
- continue;
- }
-
- // Convert html string into DOM nodes
- if ( typeof elem === "string" ) {
- if ( !rhtml.test( elem ) ) {
- elem = context.createTextNode( elem );
- } else {
- // Fix "XHTML"-style tags in all browsers
- elem = elem.replace(rxhtmlTag, "<$1></$2>");
-
- // Trim whitespace, otherwise indexOf won't work as expected
- var tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(),
- wrap = wrapMap[ tag ] || wrapMap._default,
- depth = wrap[0],
- div = context.createElement("div"),
- safeChildNodes = safeFragment.childNodes,
- remove;
-
- // Append wrapper element to unknown element safe doc fragment
- if ( context === document ) {
- // Use the fragment we've already created for this document
- safeFragment.appendChild( div );
- } else {
- // Use a fragment created with the owner document
- createSafeFragment( context ).appendChild( div );
- }
-
- // Go to html and back, then peel off extra wrappers
- div.innerHTML = wrap[1] + elem + wrap[2];
-
- // Move to the right depth
- while ( depth-- ) {
- div = div.lastChild;
- }
-
- // Remove IE's autoinserted <tbody> from table fragments
- if ( !jQuery.support.tbody ) {
-
- // String was a <table>, *may* have spurious <tbody>
- var hasBody = rtbody.test(elem),
- tbody = tag === "table" && !hasBody ?
- div.firstChild && div.firstChild.childNodes :
-
- // String was a bare <thead> or <tfoot>
- wrap[1] === "<table>" && !hasBody ?
- div.childNodes :
- [];
-
- for ( j = tbody.length - 1; j >= 0 ; --j ) {
- if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) {
- tbody[ j ].parentNode.removeChild( tbody[ j ] );
- }
- }
- }
-
- // IE completely kills leading whitespace when innerHTML is used
- if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
- div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild );
- }
-
- elem = div.childNodes;
-
- // Clear elements from DocumentFragment (safeFragment or otherwise)
- // to avoid hoarding elements. Fixes #11356
- if ( div ) {
- div.parentNode.removeChild( div );
-
- // Guard against -1 index exceptions in FF3.6
- if ( safeChildNodes.length > 0 ) {
- remove = safeChildNodes[ safeChildNodes.length - 1 ];
-
- if ( remove && remove.parentNode ) {
- remove.parentNode.removeChild( remove );
- }
- }
- }
- }
- }
-
- // Resets defaultChecked for any radios and checkboxes
- // about to be appended to the DOM in IE 6/7 (#8060)
- var len;
- if ( !jQuery.support.appendChecked ) {
- if ( elem[0] && typeof (len = elem.length) === "number" ) {
- for ( j = 0; j < len; j++ ) {
- findInputs( elem[j] );
- }
- } else {
- findInputs( elem );
- }
- }
-
- if ( elem.nodeType ) {
- ret.push( elem );
- } else {
- ret = jQuery.merge( ret, elem );
- }
- }
-
- if ( fragment ) {
- checkScriptType = function( elem ) {
- return !elem.type || rscriptType.test( elem.type );
- };
- for ( i = 0; ret[i]; i++ ) {
- script = ret[i];
- if ( scripts && jQuery.nodeName( script, "script" ) && (!script.type || rscriptType.test( script.type )) ) {
- scripts.push( script.parentNode ? script.parentNode.removeChild( script ) : script );
-
- } else {
- if ( script.nodeType === 1 ) {
- var jsTags = jQuery.grep( script.getElementsByTagName( "script" ), checkScriptType );
-
- ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
- }
- fragment.appendChild( script );
- }
- }
- }
-
- return ret;
- },
-
- cleanData: function( elems ) {
- var data, id,
- cache = jQuery.cache,
- special = jQuery.event.special,
- deleteExpando = jQuery.support.deleteExpando;
-
- for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
- if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
- continue;
- }
-
- id = elem[ jQuery.expando ];
-
- if ( id ) {
- data = cache[ id ];
-
- if ( data && data.events ) {
- for ( var type in data.events ) {
- if ( special[ type ] ) {
- jQuery.event.remove( elem, type );
-
- // This is a shortcut to avoid jQuery.event.remove's overhead
- } else {
- jQuery.removeEvent( elem, type, data.handle );
- }
- }
-
- // Null the DOM reference to avoid IE6/7/8 leak (#7054)
- if ( data.handle ) {
- data.handle.elem = null;
- }
- }
-
- if ( deleteExpando ) {
- delete elem[ jQuery.expando ];
-
- } else if ( elem.removeAttribute ) {
- elem.removeAttribute( jQuery.expando );
- }
-
- delete cache[ id ];
- }
- }
- }
-});
-
-
-
-
-var ralpha = /alpha\([^)]*\)/i,
- ropacity = /opacity=([^)]*)/,
- // fixed for IE9, see #8346
- rupper = /([A-Z]|^ms)/g,
- rnum = /^[\-+]?(?:\d*\.)?\d+$/i,
- rnumnonpx = /^-?(?:\d*\.)?\d+(?!px)[^\d\s]+$/i,
- rrelNum = /^([\-+])=([\-+.\de]+)/,
- rmargin = /^margin/,
-
- cssShow = { position: "absolute", visibility: "hidden", display: "block" },
-
- // order is important!
- cssExpand = [ "Top", "Right", "Bottom", "Left" ],
-
- curCSS,
-
- getComputedStyle,
- currentStyle;
-
-jQuery.fn.css = function( name, value ) {
- return jQuery.access( this, function( elem, name, value ) {
- return value !== undefined ?
- jQuery.style( elem, name, value ) :
- jQuery.css( elem, name );
- }, name, value, arguments.length > 1 );
-};
-
-jQuery.extend({
- // Add in style property hooks for overriding the default
- // behavior of getting and setting a style property
- cssHooks: {
- opacity: {
- get: function( elem, computed ) {
- if ( computed ) {
- // We should always get a number back from opacity
- var ret = curCSS( elem, "opacity" );
- return ret === "" ? "1" : ret;
-
- } else {
- return elem.style.opacity;
- }
- }
- }
- },
-
- // Exclude the following css properties to add px
- cssNumber: {
- "fillOpacity": true,
- "fontWeight": true,
- "lineHeight": true,
- "opacity": true,
- "orphans": true,
- "widows": true,
- "zIndex": true,
- "zoom": true
- },
-
- // Add in properties whose names you wish to fix before
- // setting or getting the value
- cssProps: {
- // normalize float css property
- "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
- },
-
- // Get and set the style property on a DOM Node
- style: function( elem, name, value, extra ) {
- // Don't set styles on text and comment nodes
- if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
- return;
- }
-
- // Make sure that we're working with the right name
- var ret, type, origName = jQuery.camelCase( name ),
- style = elem.style, hooks = jQuery.cssHooks[ origName ];
-
- name = jQuery.cssProps[ origName ] || origName;
-
- // Check if we're setting a value
- if ( value !== undefined ) {
- type = typeof value;
-
- // convert relative number strings (+= or -=) to relative numbers. #7345
- if ( type === "string" && (ret = rrelNum.exec( value )) ) {
- value = ( +( ret[1] + 1) * +ret[2] ) + parseFloat( jQuery.css( elem, name ) );
- // Fixes bug #9237
- type = "number";
- }
-
- // Make sure that NaN and null values aren't set. See: #7116
- if ( value == null || type === "number" && isNaN( value ) ) {
- return;
- }
-
- // If a number was passed in, add 'px' to the (except for certain CSS properties)
- if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
- value += "px";
- }
-
- // If a hook was provided, use that value, otherwise just set the specified value
- if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value )) !== undefined ) {
- // Wrapped to prevent IE from throwing errors when 'invalid' values are provided
- // Fixes bug #5509
- try {
- style[ name ] = value;
- } catch(e) {}
- }
-
- } else {
- // If a hook was provided get the non-computed value from there
- if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
- return ret;
- }
-
- // Otherwise just get the value from the style object
- return style[ name ];
- }
- },
-
- css: function( elem, name, extra ) {
- var ret, hooks;
-
- // Make sure that we're working with the right name
- name = jQuery.camelCase( name );
- hooks = jQuery.cssHooks[ name ];
- name = jQuery.cssProps[ name ] || name;
-
- // cssFloat needs a special treatment
- if ( name === "cssFloat" ) {
- name = "float";
- }
-
- // If a hook was provided get the computed value from there
- if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) {
- return ret;
-
- // Otherwise, if a way to get the computed value exists, use that
- } else if ( curCSS ) {
- return curCSS( elem, name );
- }
- },
-
- // A method for quickly swapping in/out CSS properties to get correct calculations
- swap: function( elem, options, callback ) {
- var old = {},
- ret, name;
-
- // Remember the old values, and insert the new ones
- for ( name in options ) {
- old[ name ] = elem.style[ name ];
- elem.style[ name ] = options[ name ];
- }
-
- ret = callback.call( elem );
-
- // Revert the old values
- for ( name in options ) {
- elem.style[ name ] = old[ name ];
- }
-
- return ret;
- }
-});
-
-// DEPRECATED in 1.3, Use jQuery.css() instead
-jQuery.curCSS = jQuery.css;
-
-if ( document.defaultView && document.defaultView.getComputedStyle ) {
- getComputedStyle = function( elem, name ) {
- var ret, defaultView, computedStyle, width,
- style = elem.style;
-
- name = name.replace( rupper, "-$1" ).toLowerCase();
-
- if ( (defaultView = elem.ownerDocument.defaultView) &&
- (computedStyle = defaultView.getComputedStyle( elem, null )) ) {
-
- ret = computedStyle.getPropertyValue( name );
- if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
- ret = jQuery.style( elem, name );
- }
- }
-
- // A tribute to the "awesome hack by Dean Edwards"
- // WebKit uses "computed value (percentage if specified)" instead of "used value" for margins
- // which is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
- if ( !jQuery.support.pixelMargin && computedStyle && rmargin.test( name ) && rnumnonpx.test( ret ) ) {
- width = style.width;
- style.width = ret;
- ret = computedStyle.width;
- style.width = width;
- }
-
- return ret;
- };
-}
-
-if ( document.documentElement.currentStyle ) {
- currentStyle = function( elem, name ) {
- var left, rsLeft, uncomputed,
- ret = elem.currentStyle && elem.currentStyle[ name ],
- style = elem.style;
-
- // Avoid setting ret to empty string here
- // so we don't default to auto
- if ( ret == null && style && (uncomputed = style[ name ]) ) {
- ret = uncomputed;
- }
-
- // From the awesome hack by Dean Edwards
- // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
-
- // If we're not dealing with a regular pixel number
- // but a number that has a weird ending, we need to convert it to pixels
- if ( rnumnonpx.test( ret ) ) {
-
- // Remember the original values
- left = style.left;
- rsLeft = elem.runtimeStyle && elem.runtimeStyle.left;
-
- // Put in the new values to get a computed value out
- if ( rsLeft ) {
- elem.runtimeStyle.left = elem.currentStyle.left;
- }
- style.left = name === "fontSize" ? "1em" : ret;
- ret = style.pixelLeft + "px";
-
- // Revert the changed values
- style.left = left;
- if ( rsLeft ) {
- elem.runtimeStyle.left = rsLeft;
- }
- }
-
- return ret === "" ? "auto" : ret;
- };
-}
-
-curCSS = getComputedStyle || currentStyle;
-
-function getWidthOrHeight( elem, name, extra ) {
-
- // Start with offset property
- var val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
- i = name === "width" ? 1 : 0,
- len = 4;
-
- if ( val > 0 ) {
- if ( extra !== "border" ) {
- for ( ; i < len; i += 2 ) {
- if ( !extra ) {
- val -= parseFloat( jQuery.css( elem, "padding" + cssExpand[ i ] ) ) || 0;
- }
- if ( extra === "margin" ) {
- val += parseFloat( jQuery.css( elem, extra + cssExpand[ i ] ) ) || 0;
- } else {
- val -= parseFloat( jQuery.css( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0;
- }
- }
- }
-
- return val + "px";
- }
-
- // Fall back to computed then uncomputed css if necessary
- val = curCSS( elem, name );
- if ( val < 0 || val == null ) {
- val = elem.style[ name ];
- }
-
- // Computed unit is not pixels. Stop here and return.
- if ( rnumnonpx.test(val) ) {
- return val;
- }
-
- // Normalize "", auto, and prepare for extra
- val = parseFloat( val ) || 0;
-
- // Add padding, border, margin
- if ( extra ) {
- for ( ; i < len; i += 2 ) {
- val += parseFloat( jQuery.css( elem, "padding" + cssExpand[ i ] ) ) || 0;
- if ( extra !== "padding" ) {
- val += parseFloat( jQuery.css( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0;
- }
- if ( extra === "margin" ) {
- val += parseFloat( jQuery.css( elem, extra + cssExpand[ i ]) ) || 0;
- }
- }
- }
-
- return val + "px";
-}
-
-jQuery.each([ "height", "width" ], function( i, name ) {
- jQuery.cssHooks[ name ] = {
- get: function( elem, computed, extra ) {
- if ( computed ) {
- if ( elem.offsetWidth !== 0 ) {
- return getWidthOrHeight( elem, name, extra );
- } else {
- return jQuery.swap( elem, cssShow, function() {
- return getWidthOrHeight( elem, name, extra );
- });
- }
- }
- },
-
- set: function( elem, value ) {
- return rnum.test( value ) ?
- value + "px" :
- value;
- }
- };
-});
-
-if ( !jQuery.support.opacity ) {
- jQuery.cssHooks.opacity = {
- get: function( elem, computed ) {
- // IE uses filters for opacity
- return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
- ( parseFloat( RegExp.$1 ) / 100 ) + "" :
- computed ? "1" : "";
- },
-
- set: function( elem, value ) {
- var style = elem.style,
- currentStyle = elem.currentStyle,
- opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",
- filter = currentStyle && currentStyle.filter || style.filter || "";
-
- // IE has trouble with opacity if it does not have layout
- // Force it by setting the zoom level
- style.zoom = 1;
-
- // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
- if ( value >= 1 && jQuery.trim( filter.replace( ralpha, "" ) ) === "" ) {
-
- // Setting style.filter to null, "" & " " still leave "filter:" in the cssText
- // if "filter:" is present at all, clearType is disabled, we want to avoid this
- // style.removeAttribute is IE Only, but so apparently is this code path...
- style.removeAttribute( "filter" );
-
- // if there there is no filter style applied in a css rule, we are done
- if ( currentStyle && !currentStyle.filter ) {
- return;
- }
- }
-
- // otherwise, set new filter values
- style.filter = ralpha.test( filter ) ?
- filter.replace( ralpha, opacity ) :
- filter + " " + opacity;
- }
- };
-}
-
-jQuery(function() {
- // This hook cannot be added until DOM ready because the support test
- // for it is not run until after DOM ready
- if ( !jQuery.support.reliableMarginRight ) {
- jQuery.cssHooks.marginRight = {
- get: function( elem, computed ) {
- // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
- // Work around by temporarily setting element display to inline-block
- return jQuery.swap( elem, { "display": "inline-block" }, function() {
- if ( computed ) {
- return curCSS( elem, "margin-right" );
- } else {
- return elem.style.marginRight;
- }
- });
- }
- };
- }
-});
-
-if ( jQuery.expr && jQuery.expr.filters ) {
- jQuery.expr.filters.hidden = function( elem ) {
- var width = elem.offsetWidth,
- height = elem.offsetHeight;
-
- return ( width === 0 && height === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none");
- };
-
- jQuery.expr.filters.visible = function( elem ) {
- return !jQuery.expr.filters.hidden( elem );
- };
-}
-
-// These hooks are used by animate to expand properties
-jQuery.each({
- margin: "",
- padding: "",
- border: "Width"
-}, function( prefix, suffix ) {
-
- jQuery.cssHooks[ prefix + suffix ] = {
- expand: function( value ) {
- var i,
-
- // assumes a single number if not a string
- parts = typeof value === "string" ? value.split(" ") : [ value ],
- expanded = {};
-
- for ( i = 0; i < 4; i++ ) {
- expanded[ prefix + cssExpand[ i ] + suffix ] =
- parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
- }
-
- return expanded;
- }
- };
-});
-
-
-
-
-var r20 = /%20/g,
- rbracket = /\[\]$/,
- rCRLF = /\r?\n/g,
- rhash = /#.*$/,
- rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
- rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
- // #7653, #8125, #8152: local protocol detection
- rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,
- rnoContent = /^(?:GET|HEAD)$/,
- rprotocol = /^\/\//,
- rquery = /\?/,
- rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
- rselectTextarea = /^(?:select|textarea)/i,
- rspacesAjax = /\s+/,
- rts = /([?&])_=[^&]*/,
- rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,
-
- // Keep a copy of the old load method
- _load = jQuery.fn.load,
-
- /* Prefilters
- * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
- * 2) These are called:
- * - BEFORE asking for a transport
- * - AFTER param serialization (s.data is a string if s.processData is true)
- * 3) key is the dataType
- * 4) the catchall symbol "*" can be used
- * 5) execution will start with transport dataType and THEN continue down to "*" if needed
- */
- prefilters = {},
-
- /* Transports bindings
- * 1) key is the dataType
- * 2) the catchall symbol "*" can be used
- * 3) selection will start with transport dataType and THEN go to "*" if needed
- */
- transports = {},
-
- // Document location
- ajaxLocation,
-
- // Document location segments
- ajaxLocParts,
-
- // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
- allTypes = ["*/"] + ["*"];
-
-// #8138, IE may throw an exception when accessing
-// a field from window.location if document.domain has been set
-try {
- ajaxLocation = location.href;
-} catch( e ) {
- // Use the href attribute of an A element
- // since IE will modify it given document.location
- ajaxLocation = document.createElement( "a" );
- ajaxLocation.href = "";
- ajaxLocation = ajaxLocation.href;
-}
-
-// Segment location into parts
-ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
-
-// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
-function addToPrefiltersOrTransports( structure ) {
-
- // dataTypeExpression is optional and defaults to "*"
- return function( dataTypeExpression, func ) {
-
- if ( typeof dataTypeExpression !== "string" ) {
- func = dataTypeExpression;
- dataTypeExpression = "*";
- }
-
- if ( jQuery.isFunction( func ) ) {
- var dataTypes = dataTypeExpression.toLowerCase().split( rspacesAjax ),
- i = 0,
- length = dataTypes.length,
- dataType,
- list,
- placeBefore;
-
- // For each dataType in the dataTypeExpression
- for ( ; i < length; i++ ) {
- dataType = dataTypes[ i ];
- // We control if we're asked to add before
- // any existing element
- placeBefore = /^\+/.test( dataType );
- if ( placeBefore ) {
- dataType = dataType.substr( 1 ) || "*";
- }
- list = structure[ dataType ] = structure[ dataType ] || [];
- // then we add to the structure accordingly
- list[ placeBefore ? "unshift" : "push" ]( func );
- }
- }
- };
-}
-
-// Base inspection function for prefilters and transports
-function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR,
- dataType /* internal */, inspected /* internal */ ) {
-
- dataType = dataType || options.dataTypes[ 0 ];
- inspected = inspected || {};
-
- inspected[ dataType ] = true;
-
- var list = structure[ dataType ],
- i = 0,
- length = list ? list.length : 0,
- executeOnly = ( structure === prefilters ),
- selection;
-
- for ( ; i < length && ( executeOnly || !selection ); i++ ) {
- selection = list[ i ]( options, originalOptions, jqXHR );
- // If we got redirected to another dataType
- // we try there if executing only and not done already
- if ( typeof selection === "string" ) {
- if ( !executeOnly || inspected[ selection ] ) {
- selection = undefined;
- } else {
- options.dataTypes.unshift( selection );
- selection = inspectPrefiltersOrTransports(
- structure, options, originalOptions, jqXHR, selection, inspected );
- }
- }
- }
- // If we're only executing or nothing was selected
- // we try the catchall dataType if not done already
- if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) {
- selection = inspectPrefiltersOrTransports(
- structure, options, originalOptions, jqXHR, "*", inspected );
- }
- // unnecessary when only executing (prefilters)
- // but it'll be ignored by the caller in that case
- return selection;
-}
-
-// A special extend for ajax options
-// that takes "flat" options (not to be deep extended)
-// Fixes #9887
-function ajaxExtend( target, src ) {
- var key, deep,
- flatOptions = jQuery.ajaxSettings.flatOptions || {};
- for ( key in src ) {
- if ( src[ key ] !== undefined ) {
- ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
- }
- }
- if ( deep ) {
- jQuery.extend( true, target, deep );
- }
-}
-
-jQuery.fn.extend({
- load: function( url, params, callback ) {
- if ( typeof url !== "string" && _load ) {
- return _load.apply( this, arguments );
-
- // Don't do a request if no elements are being requested
- } else if ( !this.length ) {
- return this;
- }
-
- var off = url.indexOf( " " );
- if ( off >= 0 ) {
- var selector = url.slice( off, url.length );
- url = url.slice( 0, off );
- }
-
- // Default to a GET request
- var type = "GET";
-
- // If the second parameter was provided
- if ( params ) {
- // If it's a function
- if ( jQuery.isFunction( params ) ) {
- // We assume that it's the callback
- callback = params;
- params = undefined;
-
- // Otherwise, build a param string
- } else if ( typeof params === "object" ) {
- params = jQuery.param( params, jQuery.ajaxSettings.traditional );
- type = "POST";
- }
- }
-
- var self = this;
-
- // Request the remote document
- jQuery.ajax({
- url: url,
- type: type,
- dataType: "html",
- data: params,
- // Complete callback (responseText is used internally)
- complete: function( jqXHR, status, responseText ) {
- // Store the response as specified by the jqXHR object
- responseText = jqXHR.responseText;
- // If successful, inject the HTML into all the matched elements
- if ( jqXHR.isResolved() ) {
- // #4825: Get the actual response in case
- // a dataFilter is present in ajaxSettings
- jqXHR.done(function( r ) {
- responseText = r;
- });
- // See if a selector was specified
- self.html( selector ?
- // Create a dummy div to hold the results
- jQuery("<div>")
- // inject the contents of the document in, removing the scripts
- // to avoid any 'Permission Denied' errors in IE
- .append(responseText.replace(rscript, ""))
-
- // Locate the specified elements
- .find(selector) :
-
- // If not, just inject the full result
- responseText );
- }
-
- if ( callback ) {
- self.each( callback, [ responseText, status, jqXHR ] );
- }
- }
- });
-
- return this;
- },
-
- serialize: function() {
- return jQuery.param( this.serializeArray() );
- },
-
- serializeArray: function() {
- return this.map(function(){
- return this.elements ? jQuery.makeArray( this.elements ) : this;
- })
- .filter(function(){
- return this.name && !this.disabled &&
- ( this.checked || rselectTextarea.test( this.nodeName ) ||
- rinput.test( this.type ) );
- })
- .map(function( i, elem ){
- var val = jQuery( this ).val();
-
- return val == null ?
- null :
- jQuery.isArray( val ) ?
- jQuery.map( val, function( val, i ){
- return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
- }) :
- { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
- }).get();
- }
-});
-
-// Attach a bunch of functions for handling common AJAX events
-jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){
- jQuery.fn[ o ] = function( f ){
- return this.on( o, f );
- };
-});
-
-jQuery.each( [ "get", "post" ], function( i, method ) {
- jQuery[ method ] = function( url, data, callback, type ) {
- // shift arguments if data argument was omitted
- if ( jQuery.isFunction( data ) ) {
- type = type || callback;
- callback = data;
- data = undefined;
- }
-
- return jQuery.ajax({
- type: method,
- url: url,
- data: data,
- success: callback,
- dataType: type
- });
- };
-});
-
-jQuery.extend({
-
- getScript: function( url, callback ) {
- return jQuery.get( url, undefined, callback, "script" );
- },
-
- getJSON: function( url, data, callback ) {
- return jQuery.get( url, data, callback, "json" );
- },
-
- // Creates a full fledged settings object into target
- // with both ajaxSettings and settings fields.
- // If target is omitted, writes into ajaxSettings.
- ajaxSetup: function( target, settings ) {
- if ( settings ) {
- // Building a settings object
- ajaxExtend( target, jQuery.ajaxSettings );
- } else {
- // Extending ajaxSettings
- settings = target;
- target = jQuery.ajaxSettings;
- }
- ajaxExtend( target, settings );
- return target;
- },
-
- ajaxSettings: {
- url: ajaxLocation,
- isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
- global: true,
- type: "GET",
- contentType: "application/x-www-form-urlencoded; charset=UTF-8",
- processData: true,
- async: true,
- /*
- timeout: 0,
- data: null,
- dataType: null,
- username: null,
- password: null,
- cache: null,
- traditional: false,
- headers: {},
- */
-
- accepts: {
- xml: "application/xml, text/xml",
- html: "text/html",
- text: "text/plain",
- json: "application/json, text/javascript",
- "*": allTypes
- },
-
- contents: {
- xml: /xml/,
- html: /html/,
- json: /json/
- },
-
- responseFields: {
- xml: "responseXML",
- text: "responseText"
- },
-
- // List of data converters
- // 1) key format is "source_type destination_type" (a single space in-between)
- // 2) the catchall symbol "*" can be used for source_type
- converters: {
-
- // Convert anything to text
- "* text": window.String,
-
- // Text to html (true = no transformation)
- "text html": true,
-
- // Evaluate text as a json expression
- "text json": jQuery.parseJSON,
-
- // Parse text as xml
- "text xml": jQuery.parseXML
- },
-
- // For options that shouldn't be deep extended:
- // you can add your own custom options here if
- // and when you create one that shouldn't be
- // deep extended (see ajaxExtend)
- flatOptions: {
- context: true,
- url: true
- }
- },
-
- ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
- ajaxTransport: addToPrefiltersOrTransports( transports ),
-
- // Main method
- ajax: function( url, options ) {
-
- // If url is an object, simulate pre-1.5 signature
- if ( typeof url === "object" ) {
- options = url;
- url = undefined;
- }
-
- // Force options to be an object
- options = options || {};
-
- var // Create the final options object
- s = jQuery.ajaxSetup( {}, options ),
- // Callbacks context
- callbackContext = s.context || s,
- // Context for global events
- // It's the callbackContext if one was provided in the options
- // and if it's a DOM node or a jQuery collection
- globalEventContext = callbackContext !== s &&
- ( callbackContext.nodeType || callbackContext instanceof jQuery ) ?
- jQuery( callbackContext ) : jQuery.event,
- // Deferreds
- deferred = jQuery.Deferred(),
- completeDeferred = jQuery.Callbacks( "once memory" ),
- // Status-dependent callbacks
- statusCode = s.statusCode || {},
- // ifModified key
- ifModifiedKey,
- // Headers (they are sent all at once)
- requestHeaders = {},
- requestHeadersNames = {},
- // Response headers
- responseHeadersString,
- responseHeaders,
- // transport
- transport,
- // timeout handle
- timeoutTimer,
- // Cross-domain detection vars
- parts,
- // The jqXHR state
- state = 0,
- // To know if global events are to be dispatched
- fireGlobals,
- // Loop variable
- i,
- // Fake xhr
- jqXHR = {
-
- readyState: 0,
-
- // Caches the header
- setRequestHeader: function( name, value ) {
- if ( !state ) {
- var lname = name.toLowerCase();
- name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
- requestHeaders[ name ] = value;
- }
- return this;
- },
-
- // Raw string
- getAllResponseHeaders: function() {
- return state === 2 ? responseHeadersString : null;
- },
-
- // Builds headers hashtable if needed
- getResponseHeader: function( key ) {
- var match;
- if ( state === 2 ) {
- if ( !responseHeaders ) {
- responseHeaders = {};
- while( ( match = rheaders.exec( responseHeadersString ) ) ) {
- responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
- }
- }
- match = responseHeaders[ key.toLowerCase() ];
- }
- return match === undefined ? null : match;
- },
-
- // Overrides response content-type header
- overrideMimeType: function( type ) {
- if ( !state ) {
- s.mimeType = type;
- }
- return this;
- },
-
- // Cancel the request
- abort: function( statusText ) {
- statusText = statusText || "abort";
- if ( transport ) {
- transport.abort( statusText );
- }
- done( 0, statusText );
- return this;
- }
- };
-
- // Callback for when everything is done
- // It is defined here because jslint complains if it is declared
- // at the end of the function (which would be more logical and readable)
- function done( status, nativeStatusText, responses, headers ) {
-
- // Called once
- if ( state === 2 ) {
- return;
- }
-
- // State is "done" now
- state = 2;
-
- // Clear timeout if it exists
- if ( timeoutTimer ) {
- clearTimeout( timeoutTimer );
- }
-
- // Dereference transport for early garbage collection
- // (no matter how long the jqXHR object will be used)
- transport = undefined;
-
- // Cache response headers
- responseHeadersString = headers || "";
-
- // Set readyState
- jqXHR.readyState = status > 0 ? 4 : 0;
-
- var isSuccess,
- success,
- error,
- statusText = nativeStatusText,
- response = responses ? ajaxHandleResponses( s, jqXHR, responses ) : undefined,
- lastModified,
- etag;
-
- // If successful, handle type chaining
- if ( status >= 200 && status < 300 || status === 304 ) {
-
- // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
- if ( s.ifModified ) {
-
- if ( ( lastModified = jqXHR.getResponseHeader( "Last-Modified" ) ) ) {
- jQuery.lastModified[ ifModifiedKey ] = lastModified;
- }
- if ( ( etag = jqXHR.getResponseHeader( "Etag" ) ) ) {
- jQuery.etag[ ifModifiedKey ] = etag;
- }
- }
-
- // If not modified
- if ( status === 304 ) {
-
- statusText = "notmodified";
- isSuccess = true;
-
- // If we have data
- } else {
-
- try {
- success = ajaxConvert( s, response );
- statusText = "success";
- isSuccess = true;
- } catch(e) {
- // We have a parsererror
- statusText = "parsererror";
- error = e;
- }
- }
- } else {
- // We extract error from statusText
- // then normalize statusText and status for non-aborts
- error = statusText;
- if ( !statusText || status ) {
- statusText = "error";
- if ( status < 0 ) {
- status = 0;
- }
- }
- }
-
- // Set data for the fake xhr object
- jqXHR.status = status;
- jqXHR.statusText = "" + ( nativeStatusText || statusText );
-
- // Success/Error
- if ( isSuccess ) {
- deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
- } else {
- deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
- }
-
- // Status-dependent callbacks
- jqXHR.statusCode( statusCode );
- statusCode = undefined;
-
- if ( fireGlobals ) {
- globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ),
- [ jqXHR, s, isSuccess ? success : error ] );
- }
-
- // Complete
- completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
-
- if ( fireGlobals ) {
- globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
- // Handle the global AJAX counter
- if ( !( --jQuery.active ) ) {
- jQuery.event.trigger( "ajaxStop" );
- }
- }
- }
-
- // Attach deferreds
- deferred.promise( jqXHR );
- jqXHR.success = jqXHR.done;
- jqXHR.error = jqXHR.fail;
- jqXHR.complete = completeDeferred.add;
-
- // Status-dependent callbacks
- jqXHR.statusCode = function( map ) {
- if ( map ) {
- var tmp;
- if ( state < 2 ) {
- for ( tmp in map ) {
- statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ];
- }
- } else {
- tmp = map[ jqXHR.status ];
- jqXHR.then( tmp, tmp );
- }
- }
- return this;
- };
-
- // Remove hash character (#7531: and string promotion)
- // Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
- // We also use the url parameter if available
- s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
-
- // Extract dataTypes list
- s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( rspacesAjax );
-
- // Determine if a cross-domain request is in order
- if ( s.crossDomain == null ) {
- parts = rurl.exec( s.url.toLowerCase() );
- s.crossDomain = !!( parts &&
- ( parts[ 1 ] != ajaxLocParts[ 1 ] || parts[ 2 ] != ajaxLocParts[ 2 ] ||
- ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=
- ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) )
- );
- }
-
- // Convert data if not already a string
- if ( s.data && s.processData && typeof s.data !== "string" ) {
- s.data = jQuery.param( s.data, s.traditional );
- }
-
- // Apply prefilters
- inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
-
- // If request was aborted inside a prefilter, stop there
- if ( state === 2 ) {
- return false;
- }
-
- // We can fire global events as of now if asked to
- fireGlobals = s.global;
-
- // Uppercase the type
- s.type = s.type.toUpperCase();
-
- // Determine if request has content
- s.hasContent = !rnoContent.test( s.type );
-
- // Watch for a new set of requests
- if ( fireGlobals && jQuery.active++ === 0 ) {
- jQuery.event.trigger( "ajaxStart" );
- }
-
- // More options handling for requests with no content
- if ( !s.hasContent ) {
-
- // If data is available, append data to url
- if ( s.data ) {
- s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data;
- // #9682: remove data so that it's not used in an eventual retry
- delete s.data;
- }
-
- // Get ifModifiedKey before adding the anti-cache parameter
- ifModifiedKey = s.url;
-
- // Add anti-cache in url if needed
- if ( s.cache === false ) {
-
- var ts = jQuery.now(),
- // try replacing _= if it is there
- ret = s.url.replace( rts, "$1_=" + ts );
-
- // if nothing was replaced, add timestamp to the end
- s.url = ret + ( ( ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" );
- }
- }
-
- // Set the correct header, if data is being sent
- if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
- jqXHR.setRequestHeader( "Content-Type", s.contentType );
- }
-
- // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
- if ( s.ifModified ) {
- ifModifiedKey = ifModifiedKey || s.url;
- if ( jQuery.lastModified[ ifModifiedKey ] ) {
- jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ ifModifiedKey ] );
- }
- if ( jQuery.etag[ ifModifiedKey ] ) {
- jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ ifModifiedKey ] );
- }
- }
-
- // Set the Accepts header for the server, depending on the dataType
- jqXHR.setRequestHeader(
- "Accept",
- s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
- s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
- s.accepts[ "*" ]
- );
-
- // Check for headers option
- for ( i in s.headers ) {
- jqXHR.setRequestHeader( i, s.headers[ i ] );
- }
-
- // Allow custom headers/mimetypes and early abort
- if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
- // Abort if not done already
- jqXHR.abort();
- return false;
-
- }
-
- // Install callbacks on deferreds
- for ( i in { success: 1, error: 1, complete: 1 } ) {
- jqXHR[ i ]( s[ i ] );
- }
-
- // Get transport
- transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
-
- // If no transport, we auto-abort
- if ( !transport ) {
- done( -1, "No Transport" );
- } else {
- jqXHR.readyState = 1;
- // Send global event
- if ( fireGlobals ) {
- globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
- }
- // Timeout
- if ( s.async && s.timeout > 0 ) {
- timeoutTimer = setTimeout( function(){
- jqXHR.abort( "timeout" );
- }, s.timeout );
- }
-
- try {
- state = 1;
- transport.send( requestHeaders, done );
- } catch (e) {
- // Propagate exception as error if not done
- if ( state < 2 ) {
- done( -1, e );
- // Simply rethrow otherwise
- } else {
- throw e;
- }
- }
- }
-
- return jqXHR;
- },
-
- // Serialize an array of form elements or a set of
- // key/values into a query string
- param: function( a, traditional ) {
- var s = [],
- add = function( key, value ) {
- // If value is a function, invoke it and return its value
- value = jQuery.isFunction( value ) ? value() : value;
- s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
- };
-
- // Set traditional to true for jQuery <= 1.3.2 behavior.
- if ( traditional === undefined ) {
- traditional = jQuery.ajaxSettings.traditional;
- }
-
- // If an array was passed in, assume that it is an array of form elements.
- if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
- // Serialize the form elements
- jQuery.each( a, function() {
- add( this.name, this.value );
- });
-
- } else {
- // If traditional, encode the "old" way (the way 1.3.2 or older
- // did it), otherwise encode params recursively.
- for ( var prefix in a ) {
- buildParams( prefix, a[ prefix ], traditional, add );
- }
- }
-
- // Return the resulting serialization
- return s.join( "&" ).replace( r20, "+" );
- }
-});
-
-function buildParams( prefix, obj, traditional, add ) {
- if ( jQuery.isArray( obj ) ) {
- // Serialize array item.
- jQuery.each( obj, function( i, v ) {
- if ( traditional || rbracket.test( prefix ) ) {
- // Treat each array item as a scalar.
- add( prefix, v );
-
- } else {
- // If array item is non-scalar (array or object), encode its
- // numeric index to resolve deserialization ambiguity issues.
- // Note that rack (as of 1.0.0) can't currently deserialize
- // nested arrays properly, and attempting to do so may cause
- // a server error. Possible fixes are to modify rack's
- // deserialization algorithm or to provide an option or flag
- // to force array serialization to be shallow.
- buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
- }
- });
-
- } else if ( !traditional && jQuery.type( obj ) === "object" ) {
- // Serialize object item.
- for ( var name in obj ) {
- buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
- }
-
- } else {
- // Serialize scalar item.
- add( prefix, obj );
- }
-}
-
-// This is still on the jQuery object... for now
-// Want to move this to jQuery.ajax some day
-jQuery.extend({
-
- // Counter for holding the number of active queries
- active: 0,
-
- // Last-Modified header cache for next request
- lastModified: {},
- etag: {}
-
-});
-
-/* Handles responses to an ajax request:
- * - sets all responseXXX fields accordingly
- * - finds the right dataType (mediates between content-type and expected dataType)
- * - returns the corresponding response
- */
-function ajaxHandleResponses( s, jqXHR, responses ) {
-
- var contents = s.contents,
- dataTypes = s.dataTypes,
- responseFields = s.responseFields,
- ct,
- type,
- finalDataType,
- firstDataType;
-
- // Fill responseXXX fields
- for ( type in responseFields ) {
- if ( type in responses ) {
- jqXHR[ responseFields[type] ] = responses[ type ];
- }
- }
-
- // Remove auto dataType and get content-type in the process
- while( dataTypes[ 0 ] === "*" ) {
- dataTypes.shift();
- if ( ct === undefined ) {
- ct = s.mimeType || jqXHR.getResponseHeader( "content-type" );
- }
- }
-
- // Check if we're dealing with a known content-type
- if ( ct ) {
- for ( type in contents ) {
- if ( contents[ type ] && contents[ type ].test( ct ) ) {
- dataTypes.unshift( type );
- break;
- }
- }
- }
-
- // Check to see if we have a response for the expected dataType
- if ( dataTypes[ 0 ] in responses ) {
- finalDataType = dataTypes[ 0 ];
- } else {
- // Try convertible dataTypes
- for ( type in responses ) {
- if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
- finalDataType = type;
- break;
- }
- if ( !firstDataType ) {
- firstDataType = type;
- }
- }
- // Or just use first one
- finalDataType = finalDataType || firstDataType;
- }
-
- // If we found a dataType
- // We add the dataType to the list if needed
- // and return the corresponding response
- if ( finalDataType ) {
- if ( finalDataType !== dataTypes[ 0 ] ) {
- dataTypes.unshift( finalDataType );
- }
- return responses[ finalDataType ];
- }
-}
-
-// Chain conversions given the request and the original response
-function ajaxConvert( s, response ) {
-
- // Apply the dataFilter if provided
- if ( s.dataFilter ) {
- response = s.dataFilter( response, s.dataType );
- }
-
- var dataTypes = s.dataTypes,
- converters = {},
- i,
- key,
- length = dataTypes.length,
- tmp,
- // Current and previous dataTypes
- current = dataTypes[ 0 ],
- prev,
- // Conversion expression
- conversion,
- // Conversion function
- conv,
- // Conversion functions (transitive conversion)
- conv1,
- conv2;
-
- // For each dataType in the chain
- for ( i = 1; i < length; i++ ) {
-
- // Create converters map
- // with lowercased keys
- if ( i === 1 ) {
- for ( key in s.converters ) {
- if ( typeof key === "string" ) {
- converters[ key.toLowerCase() ] = s.converters[ key ];
- }
- }
- }
-
- // Get the dataTypes
- prev = current;
- current = dataTypes[ i ];
-
- // If current is auto dataType, update it to prev
- if ( current === "*" ) {
- current = prev;
- // If no auto and dataTypes are actually different
- } else if ( prev !== "*" && prev !== current ) {
-
- // Get the converter
- conversion = prev + " " + current;
- conv = converters[ conversion ] || converters[ "* " + current ];
-
- // If there is no direct converter, search transitively
- if ( !conv ) {
- conv2 = undefined;
- for ( conv1 in converters ) {
- tmp = conv1.split( " " );
- if ( tmp[ 0 ] === prev || tmp[ 0 ] === "*" ) {
- conv2 = converters[ tmp[1] + " " + current ];
- if ( conv2 ) {
- conv1 = converters[ conv1 ];
- if ( conv1 === true ) {
- conv = conv2;
- } else if ( conv2 === true ) {
- conv = conv1;
- }
- break;
- }
- }
- }
- }
- // If we found no converter, dispatch an error
- if ( !( conv || conv2 ) ) {
- jQuery.error( "No conversion from " + conversion.replace(" "," to ") );
- }
- // If found converter is not an equivalence
- if ( conv !== true ) {
- // Convert with 1 or 2 converters accordingly
- response = conv ? conv( response ) : conv2( conv1(response) );
- }
- }
- }
- return response;
-}
-
-
-
-
-var jsc = jQuery.now(),
- jsre = /(\=)\?(&|$)|\?\?/i;
-
-// Default jsonp settings
-jQuery.ajaxSetup({
- jsonp: "callback",
- jsonpCallback: function() {
- return jQuery.expando + "_" + ( jsc++ );
- }
-});
-
-// Detect, normalize options and install callbacks for jsonp requests
-jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
-
- var inspectData = ( typeof s.data === "string" ) && /^application\/x\-www\-form\-urlencoded/.test( s.contentType );
-
- if ( s.dataTypes[ 0 ] === "jsonp" ||
- s.jsonp !== false && ( jsre.test( s.url ) ||
- inspectData && jsre.test( s.data ) ) ) {
-
- var responseContainer,
- jsonpCallback = s.jsonpCallback =
- jQuery.isFunction( s.jsonpCallback ) ? s.jsonpCallback() : s.jsonpCallback,
- previous = window[ jsonpCallback ],
- url = s.url,
- data = s.data,
- replace = "$1" + jsonpCallback + "$2";
-
- if ( s.jsonp !== false ) {
- url = url.replace( jsre, replace );
- if ( s.url === url ) {
- if ( inspectData ) {
- data = data.replace( jsre, replace );
- }
- if ( s.data === data ) {
- // Add callback manually
- url += (/\?/.test( url ) ? "&" : "?") + s.jsonp + "=" + jsonpCallback;
- }
- }
- }
-
- s.url = url;
- s.data = data;
-
- // Install callback
- window[ jsonpCallback ] = function( response ) {
- responseContainer = [ response ];
- };
-
- // Clean-up function
- jqXHR.always(function() {
- // Set callback back to previous value
- window[ jsonpCallback ] = previous;
- // Call if it was a function and we have a response
- if ( responseContainer && jQuery.isFunction( previous ) ) {
- window[ jsonpCallback ]( responseContainer[ 0 ] );
- }
- });
-
- // Use data converter to retrieve json after script execution
- s.converters["script json"] = function() {
- if ( !responseContainer ) {
- jQuery.error( jsonpCallback + " was not called" );
- }
- return responseContainer[ 0 ];
- };
-
- // force json dataType
- s.dataTypes[ 0 ] = "json";
-
- // Delegate to script
- return "script";
- }
-});
-
-
-
-
-// Install script dataType
-jQuery.ajaxSetup({
- accepts: {
- script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
- },
- contents: {
- script: /javascript|ecmascript/
- },
- converters: {
- "text script": function( text ) {
- jQuery.globalEval( text );
- return text;
- }
- }
-});
-
-// Handle cache's special case and global
-jQuery.ajaxPrefilter( "script", function( s ) {
- if ( s.cache === undefined ) {
- s.cache = false;
- }
- if ( s.crossDomain ) {
- s.type = "GET";
- s.global = false;
- }
-});
-
-// Bind script tag hack transport
-jQuery.ajaxTransport( "script", function(s) {
-
- // This transport only deals with cross domain requests
- if ( s.crossDomain ) {
-
- var script,
- head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement;
-
- return {
-
- send: function( _, callback ) {
-
- script = document.createElement( "script" );
-
- script.async = "async";
-
- if ( s.scriptCharset ) {
- script.charset = s.scriptCharset;
- }
-
- script.src = s.url;
-
- // Attach handlers for all browsers
- script.onload = script.onreadystatechange = function( _, isAbort ) {
-
- if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
-
- // Handle memory leak in IE
- script.onload = script.onreadystatechange = null;
-
- // Remove the script
- if ( head && script.parentNode ) {
- head.removeChild( script );
- }
-
- // Dereference the script
- script = undefined;
-
- // Callback if not abort
- if ( !isAbort ) {
- callback( 200, "success" );
- }
- }
- };
- // Use insertBefore instead of appendChild to circumvent an IE6 bug.
- // This arises when a base node is used (#2709 and #4378).
- head.insertBefore( script, head.firstChild );
- },
-
- abort: function() {
- if ( script ) {
- script.onload( 0, 1 );
- }
- }
- };
- }
-});
-
-
-
-
-var // #5280: Internet Explorer will keep connections alive if we don't abort on unload
- xhrOnUnloadAbort = window.ActiveXObject ? function() {
- // Abort all pending requests
- for ( var key in xhrCallbacks ) {
- xhrCallbacks[ key ]( 0, 1 );
- }
- } : false,
- xhrId = 0,
- xhrCallbacks;
-
-// Functions to create xhrs
-function createStandardXHR() {
- try {
- return new window.XMLHttpRequest();
- } catch( e ) {}
-}
-
-function createActiveXHR() {
- try {
- return new window.ActiveXObject( "Microsoft.XMLHTTP" );
- } catch( e ) {}
-}
-
-// Create the request object
-// (This is still attached to ajaxSettings for backward compatibility)
-jQuery.ajaxSettings.xhr = window.ActiveXObject ?
- /* Microsoft failed to properly
- * implement the XMLHttpRequest in IE7 (can't request local files),
- * so we use the ActiveXObject when it is available
- * Additionally XMLHttpRequest can be disabled in IE7/IE8 so
- * we need a fallback.
- */
- function() {
- return !this.isLocal && createStandardXHR() || createActiveXHR();
- } :
- // For all other browsers, use the standard XMLHttpRequest object
- createStandardXHR;
-
-// Determine support properties
-(function( xhr ) {
- jQuery.extend( jQuery.support, {
- ajax: !!xhr,
- cors: !!xhr && ( "withCredentials" in xhr )
- });
-})( jQuery.ajaxSettings.xhr() );
-
-// Create transport if the browser can provide an xhr
-if ( jQuery.support.ajax ) {
-
- jQuery.ajaxTransport(function( s ) {
- // Cross domain only allowed if supported through XMLHttpRequest
- if ( !s.crossDomain || jQuery.support.cors ) {
-
- var callback;
-
- return {
- send: function( headers, complete ) {
-
- // Get a new xhr
- var xhr = s.xhr(),
- handle,
- i;
-
- // Open the socket
- // Passing null username, generates a login popup on Opera (#2865)
- if ( s.username ) {
- xhr.open( s.type, s.url, s.async, s.username, s.password );
- } else {
- xhr.open( s.type, s.url, s.async );
- }
-
- // Apply custom fields if provided
- if ( s.xhrFields ) {
- for ( i in s.xhrFields ) {
- xhr[ i ] = s.xhrFields[ i ];
- }
- }
-
- // Override mime type if needed
- if ( s.mimeType && xhr.overrideMimeType ) {
- xhr.overrideMimeType( s.mimeType );
- }
-
- // X-Requested-With header
- // For cross-domain requests, seeing as conditions for a preflight are
- // akin to a jigsaw puzzle, we simply never set it to be sure.
- // (it can always be set on a per-request basis or even using ajaxSetup)
- // For same-domain requests, won't change header if already provided.
- if ( !s.crossDomain && !headers["X-Requested-With"] ) {
- headers[ "X-Requested-With" ] = "XMLHttpRequest";
- }
-
- // Need an extra try/catch for cross domain requests in Firefox 3
- try {
- for ( i in headers ) {
- xhr.setRequestHeader( i, headers[ i ] );
- }
- } catch( _ ) {}
-
- // Do send the request
- // This may raise an exception which is actually
- // handled in jQuery.ajax (so no try/catch here)
- xhr.send( ( s.hasContent && s.data ) || null );
-
- // Listener
- callback = function( _, isAbort ) {
-
- var status,
- statusText,
- responseHeaders,
- responses,
- xml;
-
- // Firefox throws exceptions when accessing properties
- // of an xhr when a network error occured
- // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
- try {
-
- // Was never called and is aborted or complete
- if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
-
- // Only called once
- callback = undefined;
-
- // Do not keep as active anymore
- if ( handle ) {
- xhr.onreadystatechange = jQuery.noop;
- if ( xhrOnUnloadAbort ) {
- delete xhrCallbacks[ handle ];
- }
- }
-
- // If it's an abort
- if ( isAbort ) {
- // Abort it manually if needed
- if ( xhr.readyState !== 4 ) {
- xhr.abort();
- }
- } else {
- status = xhr.status;
- responseHeaders = xhr.getAllResponseHeaders();
- responses = {};
- xml = xhr.responseXML;
-
- // Construct response list
- if ( xml && xml.documentElement /* #4958 */ ) {
- responses.xml = xml;
- }
-
- // When requesting binary data, IE6-9 will throw an exception
- // on any attempt to access responseText (#11426)
- try {
- responses.text = xhr.responseText;
- } catch( _ ) {
- }
-
- // Firefox throws an exception when accessing
- // statusText for faulty cross-domain requests
- try {
- statusText = xhr.statusText;
- } catch( e ) {
- // We normalize with Webkit giving an empty statusText
- statusText = "";
- }
-
- // Filter status for non standard behaviors
-
- // If the request is local and we have data: assume a success
- // (success with no data won't get notified, that's the best we
- // can do given current implementations)
- if ( !status && s.isLocal && !s.crossDomain ) {
- status = responses.text ? 200 : 404;
- // IE - #1450: sometimes returns 1223 when it should be 204
- } else if ( status === 1223 ) {
- status = 204;
- }
- }
- }
- } catch( firefoxAccessException ) {
- if ( !isAbort ) {
- complete( -1, firefoxAccessException );
- }
- }
-
- // Call complete if needed
- if ( responses ) {
- complete( status, statusText, responses, responseHeaders );
- }
- };
-
- // if we're in sync mode or it's in cache
- // and has been retrieved directly (IE6 & IE7)
- // we need to manually fire the callback
- if ( !s.async || xhr.readyState === 4 ) {
- callback();
- } else {
- handle = ++xhrId;
- if ( xhrOnUnloadAbort ) {
- // Create the active xhrs callbacks list if needed
- // and attach the unload handler
- if ( !xhrCallbacks ) {
- xhrCallbacks = {};
- jQuery( window ).unload( xhrOnUnloadAbort );
- }
- // Add to list of active xhrs callbacks
- xhrCallbacks[ handle ] = callback;
- }
- xhr.onreadystatechange = callback;
- }
- },
-
- abort: function() {
- if ( callback ) {
- callback(0,1);
- }
- }
- };
- }
- });
-}
-
-
-
-
-var elemdisplay = {},
- iframe, iframeDoc,
- rfxtypes = /^(?:toggle|show|hide)$/,
- rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,
- timerId,
- fxAttrs = [
- // height animations
- [ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ],
- // width animations
- [ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],
- // opacity animations
- [ "opacity" ]
- ],
- fxNow;
-
-jQuery.fn.extend({
- show: function( speed, easing, callback ) {
- var elem, display;
-
- if ( speed || speed === 0 ) {
- return this.animate( genFx("show", 3), speed, easing, callback );
-
- } else {
- for ( var i = 0, j = this.length; i < j; i++ ) {
- elem = this[ i ];
-
- if ( elem.style ) {
- display = elem.style.display;
-
- // Reset the inline display of this element to learn if it is
- // being hidden by cascaded rules or not
- if ( !jQuery._data(elem, "olddisplay") && display === "none" ) {
- display = elem.style.display = "";
- }
-
- // Set elements which have been overridden with display: none
- // in a stylesheet to whatever the default browser style is
- // for such an element
- if ( (display === "" && jQuery.css(elem, "display") === "none") ||
- !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
- jQuery._data( elem, "olddisplay", defaultDisplay(elem.nodeName) );
- }
- }
- }
-
- // Set the display of most of the elements in a second loop
- // to avoid the constant reflow
- for ( i = 0; i < j; i++ ) {
- elem = this[ i ];
-
- if ( elem.style ) {
- display = elem.style.display;
-
- if ( display === "" || display === "none" ) {
- elem.style.display = jQuery._data( elem, "olddisplay" ) || "";
- }
- }
- }
-
- return this;
- }
- },
-
- hide: function( speed, easing, callback ) {
- if ( speed || speed === 0 ) {
- return this.animate( genFx("hide", 3), speed, easing, callback);
-
- } else {
- var elem, display,
- i = 0,
- j = this.length;
-
- for ( ; i < j; i++ ) {
- elem = this[i];
- if ( elem.style ) {
- display = jQuery.css( elem, "display" );
-
- if ( display !== "none" && !jQuery._data( elem, "olddisplay" ) ) {
- jQuery._data( elem, "olddisplay", display );
- }
- }
- }
-
- // Set the display of the elements in a second loop
- // to avoid the constant reflow
- for ( i = 0; i < j; i++ ) {
- if ( this[i].style ) {
- this[i].style.display = "none";
- }
- }
-
- return this;
- }
- },
-
- // Save the old toggle function
- _toggle: jQuery.fn.toggle,
-
- toggle: function( fn, fn2, callback ) {
- var bool = typeof fn === "boolean";
-
- if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) {
- this._toggle.apply( this, arguments );
-
- } else if ( fn == null || bool ) {
- this.each(function() {
- var state = bool ? fn : jQuery(this).is(":hidden");
- jQuery(this)[ state ? "show" : "hide" ]();
- });
-
- } else {
- this.animate(genFx("toggle", 3), fn, fn2, callback);
- }
-
- return this;
- },
-
- fadeTo: function( speed, to, easing, callback ) {
- return this.filter(":hidden").css("opacity", 0).show().end()
- .animate({opacity: to}, speed, easing, callback);
- },
-
- animate: function( prop, speed, easing, callback ) {
- var optall = jQuery.speed( speed, easing, callback );
-
- if ( jQuery.isEmptyObject( prop ) ) {
- return this.each( optall.complete, [ false ] );
- }
-
- // Do not change referenced properties as per-property easing will be lost
- prop = jQuery.extend( {}, prop );
-
- function doAnimation() {
- // XXX 'this' does not always have a nodeName when running the
- // test suite
-
- if ( optall.queue === false ) {
- jQuery._mark( this );
- }
-
- var opt = jQuery.extend( {}, optall ),
- isElement = this.nodeType === 1,
- hidden = isElement && jQuery(this).is(":hidden"),
- name, val, p, e, hooks, replace,
- parts, start, end, unit,
- method;
-
- // will store per property easing and be used to determine when an animation is complete
- opt.animatedProperties = {};
-
- // first pass over propertys to expand / normalize
- for ( p in prop ) {
- name = jQuery.camelCase( p );
- if ( p !== name ) {
- prop[ name ] = prop[ p ];
- delete prop[ p ];
- }
-
- if ( ( hooks = jQuery.cssHooks[ name ] ) && "expand" in hooks ) {
- replace = hooks.expand( prop[ name ] );
- delete prop[ name ];
-
- // not quite $.extend, this wont overwrite keys already present.
- // also - reusing 'p' from above because we have the correct "name"
- for ( p in replace ) {
- if ( ! ( p in prop ) ) {
- prop[ p ] = replace[ p ];
- }
- }
- }
- }
-
- for ( name in prop ) {
- val = prop[ name ];
- // easing resolution: per property > opt.specialEasing > opt.easing > 'swing' (default)
- if ( jQuery.isArray( val ) ) {
- opt.animatedProperties[ name ] = val[ 1 ];
- val = prop[ name ] = val[ 0 ];
- } else {
- opt.animatedProperties[ name ] = opt.specialEasing && opt.specialEasing[ name ] || opt.easing || 'swing';
- }
-
- if ( val === "hide" && hidden || val === "show" && !hidden ) {
- return opt.complete.call( this );
- }
-
- if ( isElement && ( name === "height" || name === "width" ) ) {
- // Make sure that nothing sneaks out
- // Record all 3 overflow attributes because IE does not
- // change the overflow attribute when overflowX and
- // overflowY are set to the same value
- opt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ];
-
- // Set display property to inline-block for height/width
- // animations on inline elements that are having width/height animated
- if ( jQuery.css( this, "display" ) === "inline" &&
- jQuery.css( this, "float" ) === "none" ) {
-
- // inline-level elements accept inline-block;
- // block-level elements need to be inline with layout
- if ( !jQuery.support.inlineBlockNeedsLayout || defaultDisplay( this.nodeName ) === "inline" ) {
- this.style.display = "inline-block";
-
- } else {
- this.style.zoom = 1;
- }
- }
- }
- }
-
- if ( opt.overflow != null ) {
- this.style.overflow = "hidden";
- }
-
- for ( p in prop ) {
- e = new jQuery.fx( this, opt, p );
- val = prop[ p ];
-
- if ( rfxtypes.test( val ) ) {
-
- // Tracks whether to show or hide based on private
- // data attached to the element
- method = jQuery._data( this, "toggle" + p ) || ( val === "toggle" ? hidden ? "show" : "hide" : 0 );
- if ( method ) {
- jQuery._data( this, "toggle" + p, method === "show" ? "hide" : "show" );
- e[ method ]();
- } else {
- e[ val ]();
- }
-
- } else {
- parts = rfxnum.exec( val );
- start = e.cur();
-
- if ( parts ) {
- end = parseFloat( parts[2] );
- unit = parts[3] || ( jQuery.cssNumber[ p ] ? "" : "px" );
-
- // We need to compute starting value
- if ( unit !== "px" ) {
- jQuery.style( this, p, (end || 1) + unit);
- start = ( (end || 1) / e.cur() ) * start;
- jQuery.style( this, p, start + unit);
- }
-
- // If a +=/-= token was provided, we're doing a relative animation
- if ( parts[1] ) {
- end = ( (parts[ 1 ] === "-=" ? -1 : 1) * end ) + start;
- }
-
- e.custom( start, end, unit );
-
- } else {
- e.custom( start, val, "" );
- }
- }
- }
-
- // For JS strict compliance
- return true;
- }
-
- return optall.queue === false ?
- this.each( doAnimation ) :
- this.queue( optall.queue, doAnimation );
- },
-
- stop: function( type, clearQueue, gotoEnd ) {
- if ( typeof type !== "string" ) {
- gotoEnd = clearQueue;
- clearQueue = type;
- type = undefined;
- }
- if ( clearQueue && type !== false ) {
- this.queue( type || "fx", [] );
- }
-
- return this.each(function() {
- var index,
- hadTimers = false,
- timers = jQuery.timers,
- data = jQuery._data( this );
-
- // clear marker counters if we know they won't be
- if ( !gotoEnd ) {
- jQuery._unmark( true, this );
- }
-
- function stopQueue( elem, data, index ) {
- var hooks = data[ index ];
- jQuery.removeData( elem, index, true );
- hooks.stop( gotoEnd );
- }
-
- if ( type == null ) {
- for ( index in data ) {
- if ( data[ index ] && data[ index ].stop && index.indexOf(".run") === index.length - 4 ) {
- stopQueue( this, data, index );
- }
- }
- } else if ( data[ index = type + ".run" ] && data[ index ].stop ){
- stopQueue( this, data, index );
- }
-
- for ( index = timers.length; index--; ) {
- if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
- if ( gotoEnd ) {
-
- // force the next step to be the last
- timers[ index ]( true );
- } else {
- timers[ index ].saveState();
- }
- hadTimers = true;
- timers.splice( index, 1 );
- }
- }
-
- // start the next in the queue if the last step wasn't forced
- // timers currently will call their complete callbacks, which will dequeue
- // but only if they were gotoEnd
- if ( !( gotoEnd && hadTimers ) ) {
- jQuery.dequeue( this, type );
- }
- });
- }
-
-});
-
-// Animations created synchronously will run synchronously
-function createFxNow() {
- setTimeout( clearFxNow, 0 );
- return ( fxNow = jQuery.now() );
-}
-
-function clearFxNow() {
- fxNow = undefined;
-}
-
-// Generate parameters to create a standard animation
-function genFx( type, num ) {
- var obj = {};
-
- jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice( 0, num )), function() {
- obj[ this ] = type;
- });
-
- return obj;
-}
-
-// Generate shortcuts for custom animations
-jQuery.each({
- slideDown: genFx( "show", 1 ),
- slideUp: genFx( "hide", 1 ),
- slideToggle: genFx( "toggle", 1 ),
- fadeIn: { opacity: "show" },
- fadeOut: { opacity: "hide" },
- fadeToggle: { opacity: "toggle" }
-}, function( name, props ) {
- jQuery.fn[ name ] = function( speed, easing, callback ) {
- return this.animate( props, speed, easing, callback );
- };
-});
-
-jQuery.extend({
- speed: function( speed, easing, fn ) {
- var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
- complete: fn || !fn && easing ||
- jQuery.isFunction( speed ) && speed,
- duration: speed,
- easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
- };
-
- opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
- opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
-
- // normalize opt.queue - true/undefined/null -> "fx"
- if ( opt.queue == null || opt.queue === true ) {
- opt.queue = "fx";
- }
-
- // Queueing
- opt.old = opt.complete;
-
- opt.complete = function( noUnmark ) {
- if ( jQuery.isFunction( opt.old ) ) {
- opt.old.call( this );
- }
-
- if ( opt.queue ) {
- jQuery.dequeue( this, opt.queue );
- } else if ( noUnmark !== false ) {
- jQuery._unmark( this );
- }
- };
-
- return opt;
- },
-
- easing: {
- linear: function( p ) {
- return p;
- },
- swing: function( p ) {
- return ( -Math.cos( p*Math.PI ) / 2 ) + 0.5;
- }
- },
-
- timers: [],
-
- fx: function( elem, options, prop ) {
- this.options = options;
- this.elem = elem;
- this.prop = prop;
-
- options.orig = options.orig || {};
- }
-
-});
-
-jQuery.fx.prototype = {
- // Simple function for setting a style value
- update: function() {
- if ( this.options.step ) {
- this.options.step.call( this.elem, this.now, this );
- }
-
- ( jQuery.fx.step[ this.prop ] || jQuery.fx.step._default )( this );
- },
-
- // Get the current size
- cur: function() {
- if ( this.elem[ this.prop ] != null && (!this.elem.style || this.elem.style[ this.prop ] == null) ) {
- return this.elem[ this.prop ];
- }
-
- var parsed,
- r = jQuery.css( this.elem, this.prop );
- // Empty strings, null, undefined and "auto" are converted to 0,
- // complex values such as "rotate(1rad)" are returned as is,
- // simple values such as "10px" are parsed to Float.
- return isNaN( parsed = parseFloat( r ) ) ? !r || r === "auto" ? 0 : r : parsed;
- },
-
- // Start an animation from one number to another
- custom: function( from, to, unit ) {
- var self = this,
- fx = jQuery.fx;
-
- this.startTime = fxNow || createFxNow();
- this.end = to;
- this.now = this.start = from;
- this.pos = this.state = 0;
- this.unit = unit || this.unit || ( jQuery.cssNumber[ this.prop ] ? "" : "px" );
-
- function t( gotoEnd ) {
- return self.step( gotoEnd );
- }
-
- t.queue = this.options.queue;
- t.elem = this.elem;
- t.saveState = function() {
- if ( jQuery._data( self.elem, "fxshow" + self.prop ) === undefined ) {
- if ( self.options.hide ) {
- jQuery._data( self.elem, "fxshow" + self.prop, self.start );
- } else if ( self.options.show ) {
- jQuery._data( self.elem, "fxshow" + self.prop, self.end );
- }
- }
- };
-
- if ( t() && jQuery.timers.push(t) && !timerId ) {
- timerId = setInterval( fx.tick, fx.interval );
- }
- },
-
- // Simple 'show' function
- show: function() {
- var dataShow = jQuery._data( this.elem, "fxshow" + this.prop );
-
- // Remember where we started, so that we can go back to it later
- this.options.orig[ this.prop ] = dataShow || jQuery.style( this.elem, this.prop );
- this.options.show = true;
-
- // Begin the animation
- // Make sure that we start at a small width/height to avoid any flash of content
- if ( dataShow !== undefined ) {
- // This show is picking up where a previous hide or show left off
- this.custom( this.cur(), dataShow );
- } else {
- this.custom( this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur() );
- }
-
- // Start by showing the element
- jQuery( this.elem ).show();
- },
-
- // Simple 'hide' function
- hide: function() {
- // Remember where we started, so that we can go back to it later
- this.options.orig[ this.prop ] = jQuery._data( this.elem, "fxshow" + this.prop ) || jQuery.style( this.elem, this.prop );
- this.options.hide = true;
-
- // Begin the animation
- this.custom( this.cur(), 0 );
- },
-
- // Each step of an animation
- step: function( gotoEnd ) {
- var p, n, complete,
- t = fxNow || createFxNow(),
- done = true,
- elem = this.elem,
- options = this.options;
-
- if ( gotoEnd || t >= options.duration + this.startTime ) {
- this.now = this.end;
- this.pos = this.state = 1;
- this.update();
-
- options.animatedProperties[ this.prop ] = true;
-
- for ( p in options.animatedProperties ) {
- if ( options.animatedProperties[ p ] !== true ) {
- done = false;
- }
- }
-
- if ( done ) {
- // Reset the overflow
- if ( options.overflow != null && !jQuery.support.shrinkWrapBlocks ) {
-
- jQuery.each( [ "", "X", "Y" ], function( index, value ) {
- elem.style[ "overflow" + value ] = options.overflow[ index ];
- });
- }
-
- // Hide the element if the "hide" operation was done
- if ( options.hide ) {
- jQuery( elem ).hide();
- }
-
- // Reset the properties, if the item has been hidden or shown
- if ( options.hide || options.show ) {
- for ( p in options.animatedProperties ) {
- jQuery.style( elem, p, options.orig[ p ] );
- jQuery.removeData( elem, "fxshow" + p, true );
- // Toggle data is no longer needed
- jQuery.removeData( elem, "toggle" + p, true );
- }
- }
-
- // Execute the complete function
- // in the event that the complete function throws an exception
- // we must ensure it won't be called twice. #5684
-
- complete = options.complete;
- if ( complete ) {
-
- options.complete = false;
- complete.call( elem );
- }
- }
-
- return false;
-
- } else {
- // classical easing cannot be used with an Infinity duration
- if ( options.duration == Infinity ) {
- this.now = t;
- } else {
- n = t - this.startTime;
- this.state = n / options.duration;
-
- // Perform the easing function, defaults to swing
- this.pos = jQuery.easing[ options.animatedProperties[this.prop] ]( this.state, n, 0, 1, options.duration );
- this.now = this.start + ( (this.end - this.start) * this.pos );
- }
- // Perform the next step of the animation
- this.update();
- }
-
- return true;
- }
-};
-
-jQuery.extend( jQuery.fx, {
- tick: function() {
- var timer,
- timers = jQuery.timers,
- i = 0;
-
- for ( ; i < timers.length; i++ ) {
- timer = timers[ i ];
- // Checks the timer has not already been removed
- if ( !timer() && timers[ i ] === timer ) {
- timers.splice( i--, 1 );
- }
- }
-
- if ( !timers.length ) {
- jQuery.fx.stop();
- }
- },
-
- interval: 13,
-
- stop: function() {
- clearInterval( timerId );
- timerId = null;
- },
-
- speeds: {
- slow: 600,
- fast: 200,
- // Default speed
- _default: 400
- },
-
- step: {
- opacity: function( fx ) {
- jQuery.style( fx.elem, "opacity", fx.now );
- },
-
- _default: function( fx ) {
- if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) {
- fx.elem.style[ fx.prop ] = fx.now + fx.unit;
- } else {
- fx.elem[ fx.prop ] = fx.now;
- }
- }
- }
-});
-
-// Ensure props that can't be negative don't go there on undershoot easing
-jQuery.each( fxAttrs.concat.apply( [], fxAttrs ), function( i, prop ) {
- // exclude marginTop, marginLeft, marginBottom and marginRight from this list
- if ( prop.indexOf( "margin" ) ) {
- jQuery.fx.step[ prop ] = function( fx ) {
- jQuery.style( fx.elem, prop, Math.max(0, fx.now) + fx.unit );
- };
- }
-});
-
-if ( jQuery.expr && jQuery.expr.filters ) {
- jQuery.expr.filters.animated = function( elem ) {
- return jQuery.grep(jQuery.timers, function( fn ) {
- return elem === fn.elem;
- }).length;
- };
-}
-
-// Try to restore the default display value of an element
-function defaultDisplay( nodeName ) {
-
- if ( !elemdisplay[ nodeName ] ) {
-
- var body = document.body,
- elem = jQuery( "<" + nodeName + ">" ).appendTo( body ),
- display = elem.css( "display" );
- elem.remove();
-
- // If the simple way fails,
- // get element's real default display by attaching it to a temp iframe
- if ( display === "none" || display === "" ) {
- // No iframe to use yet, so create it
- if ( !iframe ) {
- iframe = document.createElement( "iframe" );
- iframe.frameBorder = iframe.width = iframe.height = 0;
- }
-
- body.appendChild( iframe );
-
- // Create a cacheable copy of the iframe document on first call.
- // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML
- // document to it; WebKit & Firefox won't allow reusing the iframe document.
- if ( !iframeDoc || !iframe.createElement ) {
- iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;
- iframeDoc.write( ( jQuery.support.boxModel ? "<!doctype html>" : "" ) + "<html><body>" );
- iframeDoc.close();
- }
-
- elem = iframeDoc.createElement( nodeName );
-
- iframeDoc.body.appendChild( elem );
-
- display = jQuery.css( elem, "display" );
- body.removeChild( iframe );
- }
-
- // Store the correct default display
- elemdisplay[ nodeName ] = display;
- }
-
- return elemdisplay[ nodeName ];
-}
-
-
-
-
-var getOffset,
- rtable = /^t(?:able|d|h)$/i,
- rroot = /^(?:body|html)$/i;
-
-if ( "getBoundingClientRect" in document.documentElement ) {
- getOffset = function( elem, doc, docElem, box ) {
- try {
- box = elem.getBoundingClientRect();
- } catch(e) {}
-
- // Make sure we're not dealing with a disconnected DOM node
- if ( !box || !jQuery.contains( docElem, elem ) ) {
- return box ? { top: box.top, left: box.left } : { top: 0, left: 0 };
- }
-
- var body = doc.body,
- win = getWindow( doc ),
- clientTop = docElem.clientTop || body.clientTop || 0,
- clientLeft = docElem.clientLeft || body.clientLeft || 0,
- scrollTop = win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop,
- scrollLeft = win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft,
- top = box.top + scrollTop - clientTop,
- left = box.left + scrollLeft - clientLeft;
-
- return { top: top, left: left };
- };
-
-} else {
- getOffset = function( elem, doc, docElem ) {
- var computedStyle,
- offsetParent = elem.offsetParent,
- prevOffsetParent = elem,
- body = doc.body,
- defaultView = doc.defaultView,
- prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle,
- top = elem.offsetTop,
- left = elem.offsetLeft;
-
- while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
- if ( jQuery.support.fixedPosition && prevComputedStyle.position === "fixed" ) {
- break;
- }
-
- computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle;
- top -= elem.scrollTop;
- left -= elem.scrollLeft;
-
- if ( elem === offsetParent ) {
- top += elem.offsetTop;
- left += elem.offsetLeft;
-
- if ( jQuery.support.doesNotAddBorder && !(jQuery.support.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) {
- top += parseFloat( computedStyle.borderTopWidth ) || 0;
- left += parseFloat( computedStyle.borderLeftWidth ) || 0;
- }
-
- prevOffsetParent = offsetParent;
- offsetParent = elem.offsetParent;
- }
-
- if ( jQuery.support.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) {
- top += parseFloat( computedStyle.borderTopWidth ) || 0;
- left += parseFloat( computedStyle.borderLeftWidth ) || 0;
- }
-
- prevComputedStyle = computedStyle;
- }
-
- if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) {
- top += body.offsetTop;
- left += body.offsetLeft;
- }
-
- if ( jQuery.support.fixedPosition && prevComputedStyle.position === "fixed" ) {
- top += Math.max( docElem.scrollTop, body.scrollTop );
- left += Math.max( docElem.scrollLeft, body.scrollLeft );
- }
-
- return { top: top, left: left };
- };
-}
-
-jQuery.fn.offset = function( options ) {
- if ( arguments.length ) {
- return options === undefined ?
- this :
- this.each(function( i ) {
- jQuery.offset.setOffset( this, options, i );
- });
- }
-
- var elem = this[0],
- doc = elem && elem.ownerDocument;
-
- if ( !doc ) {
- return null;
- }
-
- if ( elem === doc.body ) {
- return jQuery.offset.bodyOffset( elem );
- }
-
- return getOffset( elem, doc, doc.documentElement );
-};
-
-jQuery.offset = {
-
- bodyOffset: function( body ) {
- var top = body.offsetTop,
- left = body.offsetLeft;
-
- if ( jQuery.support.doesNotIncludeMarginInBodyOffset ) {
- top += parseFloat( jQuery.css(body, "marginTop") ) || 0;
- left += parseFloat( jQuery.css(body, "marginLeft") ) || 0;
- }
-
- return { top: top, left: left };
- },
-
- setOffset: function( elem, options, i ) {
- var position = jQuery.css( elem, "position" );
-
- // set position first, in-case top/left are set even on static elem
- if ( position === "static" ) {
- elem.style.position = "relative";
- }
-
- var curElem = jQuery( elem ),
- curOffset = curElem.offset(),
- curCSSTop = jQuery.css( elem, "top" ),
- curCSSLeft = jQuery.css( elem, "left" ),
- calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1,
- props = {}, curPosition = {}, curTop, curLeft;
-
- // need to be able to calculate position if either top or left is auto and position is either absolute or fixed
- if ( calculatePosition ) {
- curPosition = curElem.position();
- curTop = curPosition.top;
- curLeft = curPosition.left;
- } else {
- curTop = parseFloat( curCSSTop ) || 0;
- curLeft = parseFloat( curCSSLeft ) || 0;
- }
-
- if ( jQuery.isFunction( options ) ) {
- options = options.call( elem, i, curOffset );
- }
-
- if ( options.top != null ) {
- props.top = ( options.top - curOffset.top ) + curTop;
- }
- if ( options.left != null ) {
- props.left = ( options.left - curOffset.left ) + curLeft;
- }
-
- if ( "using" in options ) {
- options.using.call( elem, props );
- } else {
- curElem.css( props );
- }
- }
-};
-
-
-jQuery.fn.extend({
-
- position: function() {
- if ( !this[0] ) {
- return null;
- }
-
- var elem = this[0],
-
- // Get *real* offsetParent
- offsetParent = this.offsetParent(),
-
- // Get correct offsets
- offset = this.offset(),
- parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();
-
- // Subtract element margins
- // note: when an element has margin: auto the offsetLeft and marginLeft
- // are the same in Safari causing offset.left to incorrectly be 0
- offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0;
- offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0;
-
- // Add offsetParent borders
- parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0;
- parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0;
-
- // Subtract the two offsets
- return {
- top: offset.top - parentOffset.top,
- left: offset.left - parentOffset.left
- };
- },
-
- offsetParent: function() {
- return this.map(function() {
- var offsetParent = this.offsetParent || document.body;
- while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) {
- offsetParent = offsetParent.offsetParent;
- }
- return offsetParent;
- });
- }
-});
-
-
-// Create scrollLeft and scrollTop methods
-jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) {
- var top = /Y/.test( prop );
-
- jQuery.fn[ method ] = function( val ) {
- return jQuery.access( this, function( elem, method, val ) {
- var win = getWindow( elem );
-
- if ( val === undefined ) {
- return win ? (prop in win) ? win[ prop ] :
- jQuery.support.boxModel && win.document.documentElement[ method ] ||
- win.document.body[ method ] :
- elem[ method ];
- }
-
- if ( win ) {
- win.scrollTo(
- !top ? val : jQuery( win ).scrollLeft(),
- top ? val : jQuery( win ).scrollTop()
- );
-
- } else {
- elem[ method ] = val;
- }
- }, method, val, arguments.length, null );
- };
-});
-
-function getWindow( elem ) {
- return jQuery.isWindow( elem ) ?
- elem :
- elem.nodeType === 9 ?
- elem.defaultView || elem.parentWindow :
- false;
-}
-
-
-
-
-// Create width, height, innerHeight, innerWidth, outerHeight and outerWidth methods
-jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
- var clientProp = "client" + name,
- scrollProp = "scroll" + name,
- offsetProp = "offset" + name;
-
- // innerHeight and innerWidth
- jQuery.fn[ "inner" + name ] = function() {
- var elem = this[0];
- return elem ?
- elem.style ?
- parseFloat( jQuery.css( elem, type, "padding" ) ) :
- this[ type ]() :
- null;
- };
-
- // outerHeight and outerWidth
- jQuery.fn[ "outer" + name ] = function( margin ) {
- var elem = this[0];
- return elem ?
- elem.style ?
- parseFloat( jQuery.css( elem, type, margin ? "margin" : "border" ) ) :
- this[ type ]() :
- null;
- };
-
- jQuery.fn[ type ] = function( value ) {
- return jQuery.access( this, function( elem, type, value ) {
- var doc, docElemProp, orig, ret;
-
- if ( jQuery.isWindow( elem ) ) {
- // 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat
- doc = elem.document;
- docElemProp = doc.documentElement[ clientProp ];
- return jQuery.support.boxModel && docElemProp ||
- doc.body && doc.body[ clientProp ] || docElemProp;
- }
-
- // Get document width or height
- if ( elem.nodeType === 9 ) {
- // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
- doc = elem.documentElement;
-
- // when a window > document, IE6 reports a offset[Width/Height] > client[Width/Height]
- // so we can't use max, as it'll choose the incorrect offset[Width/Height]
- // instead we use the correct client[Width/Height]
- // support:IE6
- if ( doc[ clientProp ] >= doc[ scrollProp ] ) {
- return doc[ clientProp ];
- }
-
- return Math.max(
- elem.body[ scrollProp ], doc[ scrollProp ],
- elem.body[ offsetProp ], doc[ offsetProp ]
- );
- }
-
- // Get width or height on the element
- if ( value === undefined ) {
- orig = jQuery.css( elem, type );
- ret = parseFloat( orig );
- return jQuery.isNumeric( ret ) ? ret : orig;
- }
-
- // Set the width or height on the element
- jQuery( elem ).css( type, value );
- }, type, value, arguments.length, null );
- };
-});
-
-
-
-
-// Expose jQuery to the global object
-window.jQuery = window.$ = jQuery;
-
-// Expose jQuery as an AMD module, but only for AMD loaders that
-// understand the issues with loading multiple versions of jQuery
-// in a page that all might call define(). The loader will indicate
-// they have special allowances for multiple jQuery versions by
-// specifying define.amd.jQuery = true. Register as a named module,
-// since jQuery can be concatenated with other files that may use define,
-// but not use a proper concatenation script that understands anonymous
-// AMD modules. A named AMD is safest and most robust way to register.
-// Lowercase jquery is used because AMD module names are derived from
-// file names, and jQuery is normally delivered in a lowercase file name.
-// Do this after creating the global so that if an AMD module wants to call
-// noConflict to hide this version of jQuery, it will work.
-if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
- define( "jquery", [], function () { return jQuery; } );
-}
-
-
-
-})( window );
+++ /dev/null
-/*
- * jQuery UI Widget 1.8.23+amd
- * https://github.com/blueimp/jQuery-File-Upload
- *
- * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Widget
- */
-
-(function (factory) {
- if (typeof define === "function" && define.amd) {
- // Register as an anonymous AMD module:
- define(["jquery"], factory);
- } else {
- // Browser globals:
- factory(jQuery);
- }
-}(function( $, undefined ) {
-
-// jQuery 1.4+
-if ( $.cleanData ) {
- var _cleanData = $.cleanData;
- $.cleanData = function( elems ) {
- for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
- try {
- $( elem ).triggerHandler( "remove" );
- // http://bugs.jquery.com/ticket/8235
- } catch( e ) {}
- }
- _cleanData( elems );
- };
-} else {
- var _remove = $.fn.remove;
- $.fn.remove = function( selector, keepData ) {
- return this.each(function() {
- if ( !keepData ) {
- if ( !selector || $.filter( selector, [ this ] ).length ) {
- $( "*", this ).add( [ this ] ).each(function() {
- try {
- $( this ).triggerHandler( "remove" );
- // http://bugs.jquery.com/ticket/8235
- } catch( e ) {}
- });
- }
- }
- return _remove.call( $(this), selector, keepData );
- });
- };
-}
-
-$.widget = function( name, base, prototype ) {
- var namespace = name.split( "." )[ 0 ],
- fullName;
- name = name.split( "." )[ 1 ];
- fullName = namespace + "-" + name;
-
- if ( !prototype ) {
- prototype = base;
- base = $.Widget;
- }
-
- // create selector for plugin
- $.expr[ ":" ][ fullName ] = function( elem ) {
- return !!$.data( elem, name );
- };
-
- $[ namespace ] = $[ namespace ] || {};
- $[ namespace ][ name ] = function( options, element ) {
- // allow instantiation without initializing for simple inheritance
- if ( arguments.length ) {
- this._createWidget( options, element );
- }
- };
-
- var basePrototype = new base();
- // we need to make the options hash a property directly on the new instance
- // otherwise we'll modify the options hash on the prototype that we're
- // inheriting from
-// $.each( basePrototype, function( key, val ) {
-// if ( $.isPlainObject(val) ) {
-// basePrototype[ key ] = $.extend( {}, val );
-// }
-// });
- basePrototype.options = $.extend( true, {}, basePrototype.options );
- $[ namespace ][ name ].prototype = $.extend( true, basePrototype, {
- namespace: namespace,
- widgetName: name,
- widgetEventPrefix: $[ namespace ][ name ].prototype.widgetEventPrefix || name,
- widgetBaseClass: fullName
- }, prototype );
-
- $.widget.bridge( name, $[ namespace ][ name ] );
-};
-
-$.widget.bridge = function( name, object ) {
- $.fn[ name ] = function( options ) {
- var isMethodCall = typeof options === "string",
- args = Array.prototype.slice.call( arguments, 1 ),
- returnValue = this;
-
- // allow multiple hashes to be passed on init
- options = !isMethodCall && args.length ?
- $.extend.apply( null, [ true, options ].concat(args) ) :
- options;
-
- // prevent calls to internal methods
- if ( isMethodCall && options.charAt( 0 ) === "_" ) {
- return returnValue;
- }
-
- if ( isMethodCall ) {
- this.each(function() {
- var instance = $.data( this, name ),
- methodValue = instance && $.isFunction( instance[options] ) ?
- instance[ options ].apply( instance, args ) :
- instance;
- // TODO: add this back in 1.9 and use $.error() (see #5972)
-// if ( !instance ) {
-// throw "cannot call methods on " + name + " prior to initialization; " +
-// "attempted to call method '" + options + "'";
-// }
-// if ( !$.isFunction( instance[options] ) ) {
-// throw "no such method '" + options + "' for " + name + " widget instance";
-// }
-// var methodValue = instance[ options ].apply( instance, args );
- if ( methodValue !== instance && methodValue !== undefined ) {
- returnValue = methodValue;
- return false;
- }
- });
- } else {
- this.each(function() {
- var instance = $.data( this, name );
- if ( instance ) {
- instance.option( options || {} )._init();
- } else {
- $.data( this, name, new object( options, this ) );
- }
- });
- }
-
- return returnValue;
- };
-};
-
-$.Widget = function( options, element ) {
- // allow instantiation without initializing for simple inheritance
- if ( arguments.length ) {
- this._createWidget( options, element );
- }
-};
-
-$.Widget.prototype = {
- widgetName: "widget",
- widgetEventPrefix: "",
- options: {
- disabled: false
- },
- _createWidget: function( options, element ) {
- // $.widget.bridge stores the plugin instance, but we do it anyway
- // so that it's stored even before the _create function runs
- $.data( element, this.widgetName, this );
- this.element = $( element );
- this.options = $.extend( true, {},
- this.options,
- this._getCreateOptions(),
- options );
-
- var self = this;
- this.element.bind( "remove." + this.widgetName, function() {
- self.destroy();
- });
-
- this._create();
- this._trigger( "create" );
- this._init();
- },
- _getCreateOptions: function() {
- return $.metadata && $.metadata.get( this.element[0] )[ this.widgetName ];
- },
- _create: function() {},
- _init: function() {},
-
- destroy: function() {
- this.element
- .unbind( "." + this.widgetName )
- .removeData( this.widgetName );
- this.widget()
- .unbind( "." + this.widgetName )
- .removeAttr( "aria-disabled" )
- .removeClass(
- this.widgetBaseClass + "-disabled " +
- "ui-state-disabled" );
- },
-
- widget: function() {
- return this.element;
- },
-
- option: function( key, value ) {
- var options = key;
-
- if ( arguments.length === 0 ) {
- // don't return a reference to the internal hash
- return $.extend( {}, this.options );
- }
-
- if (typeof key === "string" ) {
- if ( value === undefined ) {
- return this.options[ key ];
- }
- options = {};
- options[ key ] = value;
- }
-
- this._setOptions( options );
-
- return this;
- },
- _setOptions: function( options ) {
- var self = this;
- $.each( options, function( key, value ) {
- self._setOption( key, value );
- });
-
- return this;
- },
- _setOption: function( key, value ) {
- this.options[ key ] = value;
-
- if ( key === "disabled" ) {
- this.widget()
- [ value ? "addClass" : "removeClass"](
- this.widgetBaseClass + "-disabled" + " " +
- "ui-state-disabled" )
- .attr( "aria-disabled", value );
- }
-
- return this;
- },
-
- enable: function() {
- return this._setOption( "disabled", false );
- },
- disable: function() {
- return this._setOption( "disabled", true );
- },
-
- _trigger: function( type, event, data ) {
- var prop, orig,
- callback = this.options[ type ];
-
- data = data || {};
- event = $.Event( event );
- event.type = ( type === this.widgetEventPrefix ?
- type :
- this.widgetEventPrefix + type ).toLowerCase();
- // the original event may come from any element
- // so we need to reset the target on the new event
- event.target = this.element[ 0 ];
-
- // copy original event properties over to the new event
- orig = event.originalEvent;
- if ( orig ) {
- for ( prop in orig ) {
- if ( !( prop in event ) ) {
- event[ prop ] = orig[ prop ];
- }
- }
- }
-
- this.element.trigger( event, data );
-
- return !( $.isFunction(callback) &&
- callback.call( this.element[0], event, data ) === false ||
- event.isDefaultPrevented() );
- }
-};
-
-}));
+++ /dev/null
-( function() {\r
- MenuItem = Model.extend( {\r
-\r
- } );\r
- MenuItemView = View.extend( {\r
- tagName: "li",\r
- templateId: "#menu-item-template",\r
- events: { "click" : "select" },\r
- render: function() {\r
- $(this.el).html( this.template( this.model ) );\r
- return this;\r
- },\r
-\r
- select: function( e ) {\r
- this.menu.select( this );\r
- return false;\r
- }\r
- } );\r
-\r
- Menu = Collection.extend( {\r
- model: MenuItem\r
-\r
- } );\r
-\r
- MenuView = View.extend( {\r
- templateId: "#menu-template",\r
-\r
- initialize: function() {\r
- this.collection.bind( 'add', this.add, this );\r
- $( this.el ).append( $( this.template( this.model ) ) );\r
- this.collection.each( this.add, this );\r
- },\r
- render: function () {\r
- return this;\r
- },\r
- add: function( model ) {\r
- itemView = new MenuItemView( { model: model } );\r
- itemView.menu = this;\r
- this.$( "ul" ).append( itemView.render().el );\r
- if ( !this.selectedItem ) {\r
- this.select( itemView );\r
- }\r
- },\r
-\r
- select: function( item ) {\r
- if ( this.selectedItem == item ) {\r
- return ;\r
- }\r
-\r
- this.$( "li" ).removeClass( "active" );\r
- $( item.el ).addClass( "active " );\r
- this.selectedItem = item;\r
-\r
- updateContents( item.model.get( 'url' ) );\r
- }\r
- } );\r
-\r
- Template = Model.extend( {\r
- } );\r
- \r
- TemplateView = View.extend( {\r
- tagName: "li",\r
- className: "span4 template",\r
- templateId: "#template-template",\r
- defaultTemplate: "<a>{{name}}</a>",\r
- events: { "click" : "select" },\r
- \r
- select: function() {\r
- updateContents( "template.html", this.model );\r
- },\r
- render: function() {\r
- $(this.el).append( this.template( this.model ) );\r
- this.$( ".ellipsis" ).dotdotdot();\r
- return this;\r
- }\r
- } );\r
- \r
- Templates = Collection.extend( {\r
- model: Template,\r
- parse: function( resp, xhr ) {\r
- return resp;\r
- },\r
- start: ""\r
- } );\r
- \r
- RecentTemplates = Templates.extend( {\r
- url: function() {\r
- return '/templates?order=recent&start=' + this.start;\r
- }\r
- } );\r
- \r
- PopularTemplates = Templates.extend( {\r
- url: function() {\r
- return '/templates?order=popular&start=' + this.start;\r
- }\r
- } );\r
-\r
- TemplatesView = View.extend( {\r
- templateId: "#template-templates",\r
- defaultTemplate: "<ul class='thumbnails'></ul>",\r
- initialize: function() {\r
- this.bLoading = false;\r
- _.bindAll( this );\r
- this.collection.bind( 'add', this.add, this );\r
- },\r
- render: function() {\r
- $( this.el ).append( this.template( this.model ) );\r
- this.loadResult();\r
- },\r
- loadResult: function() {\r
- var $that = this;\r
- this.bLoading = true;\r
- this.collection.fetch( {\r
- success: function( coll ) {\r
- $that.bLoading = false;\r
- _.each( coll.models, $that.add, this );\r
- }\r
- } );\r
- },\r
- \r
- add: function( model ) {\r
- view = new TemplateView( { model: model } );\r
- this.$( "ul" ).append( view.render().el );\r
- view.$( ".ellipsis" ).dotdotdot( {\r
- wrap : 'letter',\r
-\r
- } );\r
- \r
- },\r
- events: {\r
- 'scroll': 'checkScroll'\r
- },\r
- checkScroll: function () {\r
- var triggerPoint = 100; // 100px from the bottom\r
- if( !this.isLoading && this.el.scrollTop + this.el.clientHeight + triggerPoint > this.el.scrollHeight ) {\r
- this.collection.start = _.last( this.collection ); // Load next page\r
- this.loadResult();\r
- }\r
- }\r
- } );\r
- \r
- \r
- Upload = Model.extend( {\r
- defaults: {\r
- selection : "Select file",\r
- reset: "Clear"\r
- },\r
- clear: function() {\r
- this.set( "file", "" );\r
- }\r
- } );\r
- \r
- UploadView = View.extend( {\r
- className: "fileupload",\r
- templateId: "#upload-file-template",\r
- defaultTemplate:\r
- '<input class="span5" type="text" readonly="readonly">' +\r
- '<div class="fileinput_div">' +\r
- '<input id="select" type="button" value="{{selection}}" />' +\r
- '<input id="clear" type="button" value="{{reset}}" />' +\r
- '<input type="file"/>' +\r
- '</div>',\r
- initialize: function() {\r
- this.model.bind( "change", this.update, this );\r
- },\r
- render: function() {\r
- var $that = this;\r
- $( this.el ).append( this.template( this.model ) );\r
- this.text = this.$( "input[type='text']" );\r
- this.select = this.$( "input[type='button']#select" );\r
- this.clear = this.$( "input[type='button']#clear" ).hide().click( function() {\r
- $that.model.clear();\r
- } );\r
- this.file = this.$( "input[type='file']" );\r
- \r
- this.select.attr( "width", this.file.attr( "width" ) );\r
- this.select.attr( "height", this.file.attr( "height" ) );\r
- \r
- this.select.click( function() {\r
- $that.$( "input[type='file']" ).click();\r
- } );\r
- this.file.change( function() {\r
- $that.model.set( 'file', $(this).val() );\r
- } );\r
- \r
- return this;\r
- },\r
- update: function() {\r
- var path = this.model.get( 'file' );\r
- this.text.val( path );\r
- if ( path ) {\r
- this.clear.show();\r
- } else {\r
- this.clear.hide();\r
- }\r
- }\r
- } );\r
- \r
- TemplateDetails = Model.extend( {\r
- url: function() {\r
- return "/template-info/" + this.get( 'id' );\r
- }\r
- } );\r
- \r
- TemplateDetailsView = View.extend( {\r
- templateId: "#template-details-template",\r
- defaultTemplate: "<h2>{{name}}</h2>",\r
- initialize: function() {\r
- this.model.bind( "change", this.render, this );\r
- this.model.fetch();\r
- },\r
- \r
- render: function() {\r
- $( this.el ).append( this.template( this.model ) );\r
- }\r
- } );\r
-} ).call();
\ No newline at end of file
+++ /dev/null
-/*!
- * mustache.js - Logic-less {{mustache}} templates with JavaScript
- * http://github.com/janl/mustache.js
- */
-
-var Mustache;
-
-(function (exports) {
- if (typeof module !== "undefined") {
- module.exports = exports; // CommonJS
- } else if (typeof define === "function") {
- define(exports); // AMD
- } else {
- Mustache = exports; // <script>
- }
-}(function () {
- var exports = {};
-
- exports.name = "mustache.js";
- exports.version = "0.5.1-dev";
- exports.tags = ["{{", "}}"];
-
- exports.parse = parse;
- exports.clearCache = clearCache;
- exports.compile = compile;
- exports.compilePartial = compilePartial;
- exports.render = render;
-
- exports.Scanner = Scanner;
- exports.Context = Context;
- exports.Renderer = Renderer;
-
- // This is here for backwards compatibility with 0.4.x.
- exports.to_html = function (template, view, partials, send) {
- var result = render(template, view, partials);
-
- if (typeof send === "function") {
- send(result);
- } else {
- return result;
- }
- };
-
- var whiteRe = /\s*/;
- var spaceRe = /\s+/;
- var nonSpaceRe = /\S/;
- var eqRe = /\s*=/;
- var curlyRe = /\s*\}/;
- var tagRe = /#|\^|\/|>|\{|&|=|!/;
-
- // Workaround for https://issues.apache.org/jira/browse/COUCHDB-577
- // See https://github.com/janl/mustache.js/issues/189
- function testRe(re, string) {
- return RegExp.prototype.test.call(re, string);
- }
-
- function isWhitespace(string) {
- return !testRe(nonSpaceRe, string);
- }
-
- var isArray = Array.isArray || function (obj) {
- return Object.prototype.toString.call(obj) === "[object Array]";
- };
-
- // OSWASP Guidelines: escape all non alphanumeric characters in ASCII space.
- var jsCharsRe = /[\x00-\x2F\x3A-\x40\x5B-\x60\x7B-\xFF\u2028\u2029]/gm;
-
- function quote(text) {
- var escaped = text.replace(jsCharsRe, function (c) {
- return "\\u" + ('0000' + c.charCodeAt(0).toString(16)).slice(-4);
- });
-
- return '"' + escaped + '"';
- }
-
- function escapeRe(string) {
- return string.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
- }
-
- var entityMap = {
- "&": "&",
- "<": "<",
- ">": ">",
- '"': '"',
- "'": ''',
- "/": '/'
- };
-
- function escapeHtml(string) {
- return String(string).replace(/[&<>"'\/]/g, function (s) {
- return entityMap[s];
- });
- }
-
- // Export these utility functions.
- exports.isWhitespace = isWhitespace;
- exports.isArray = isArray;
- exports.quote = quote;
- exports.escapeRe = escapeRe;
- exports.escapeHtml = escapeHtml;
-
- function Scanner(string) {
- this.string = string;
- this.tail = string;
- this.pos = 0;
- }
-
- /**
- * Returns `true` if the tail is empty (end of string).
- */
- Scanner.prototype.eos = function () {
- return this.tail === "";
- };
-
- /**
- * Tries to match the given regular expression at the current position.
- * Returns the matched text if it can match, `null` otherwise.
- */
- Scanner.prototype.scan = function (re) {
- var match = this.tail.match(re);
-
- if (match && match.index === 0) {
- this.tail = this.tail.substring(match[0].length);
- this.pos += match[0].length;
- return match[0];
- }
-
- return null;
- };
-
- /**
- * Skips all text until the given regular expression can be matched. Returns
- * the skipped string, which is the entire tail of this scanner if no match
- * can be made.
- */
- Scanner.prototype.scanUntil = function (re) {
- var match, pos = this.tail.search(re);
-
- switch (pos) {
- case -1:
- match = this.tail;
- this.pos += this.tail.length;
- this.tail = "";
- break;
- case 0:
- match = null;
- break;
- default:
- match = this.tail.substring(0, pos);
- this.tail = this.tail.substring(pos);
- this.pos += pos;
- }
-
- return match;
- };
-
- function Context(view, parent) {
- this.view = view;
- this.parent = parent;
- this.clearCache();
- }
-
- Context.make = function (view) {
- return (view instanceof Context) ? view : new Context(view);
- };
-
- Context.prototype.clearCache = function () {
- this._cache = {};
- };
-
- Context.prototype.push = function (view) {
- return new Context(view, this);
- };
-
- Context.prototype.lookup = function (name) {
- var value = this._cache[name];
-
- if (!value) {
- if (name === ".") {
- value = this.view;
- } else {
- var context = this;
-
- while (context) {
- if (name.indexOf(".") > 0) {
- var names = name.split("."), i = 0;
-
- value = context.view;
-
- while (value && i < names.length) {
- value = value[names[i++]];
- }
- } else {
- value = context.view[name];
- }
-
- if (value != null) {
- break;
- }
-
- context = context.parent;
- }
- }
-
- this._cache[name] = value;
- }
-
- if (typeof value === "function") {
- value = value.call(this.view);
- }
-
- return value;
- };
-
- function Renderer() {
- this.clearCache();
- }
-
- Renderer.prototype.clearCache = function () {
- this._cache = {};
- this._partialCache = {};
- };
-
- Renderer.prototype.compile = function (tokens, tags) {
- if (typeof tokens === "string") {
- tokens = parse(tokens, tags);
- }
-
- var fn = compileTokens(tokens),
- self = this;
-
- return function (view) {
- return fn(Context.make(view), self);
- };
- };
-
- Renderer.prototype.compilePartial = function (name, tokens, tags) {
- this._partialCache[name] = this.compile(tokens, tags);
- return this._partialCache[name];
- };
-
- Renderer.prototype.render = function (template, view) {
- var fn = this._cache[template];
-
- if (!fn) {
- fn = this.compile(template);
- this._cache[template] = fn;
- }
-
- return fn(view);
- };
-
- Renderer.prototype._section = function (name, context, callback) {
- var value = context.lookup(name);
-
- switch (typeof value) {
- case "object":
- if (isArray(value)) {
- var buffer = "";
-
- for (var i = 0, len = value.length; i < len; ++i) {
- buffer += callback(context.push(value[i]), this);
- }
-
- return buffer;
- }
-
- return value ? callback(context.push(value), this) : "";
- case "function":
- // TODO: The text should be passed to the callback plain, not rendered.
- var sectionText = callback(context, this),
- self = this;
-
- var scopedRender = function (template) {
- return self.render(template, context);
- };
-
- return value.call(context.view, sectionText, scopedRender) || "";
- default:
- if (value) {
- return callback(context, this);
- }
- }
-
- return "";
- };
-
- Renderer.prototype._inverted = function (name, context, callback) {
- var value = context.lookup(name);
-
- // From the spec: inverted sections may render text once based on the
- // inverse value of the key. That is, they will be rendered if the key
- // doesn't exist, is false, or is an empty list.
- if (value == null || value === false || (isArray(value) && value.length === 0)) {
- return callback(context, this);
- }
-
- return "";
- };
-
- Renderer.prototype._partial = function (name, context) {
- var fn = this._partialCache[name];
-
- if (fn) {
- return fn(context, this);
- }
-
- return "";
- };
-
- Renderer.prototype._name = function (name, context, escape) {
- var value = context.lookup(name);
-
- if (typeof value === "function") {
- value = value.call(context.view);
- }
-
- var string = (value == null) ? "" : String(value);
-
- if (escape) {
- return escapeHtml(string);
- }
-
- return string;
- };
-
- /**
- * Low-level function that compiles the given `tokens` into a
- * function that accepts two arguments: a Context and a
- * Renderer. Returns the body of the function as a string if
- * `returnBody` is true.
- */
- function compileTokens(tokens, returnBody) {
- var body = ['""'];
- var token, method, escape;
-
- for (var i = 0, len = tokens.length; i < len; ++i) {
- token = tokens[i];
-
- switch (token.type) {
- case "#":
- case "^":
- method = (token.type === "#") ? "_section" : "_inverted";
- body.push("r." + method + "(" + quote(token.value) + ", c, function (c, r) {\n" +
- " " + compileTokens(token.tokens, true) + "\n" +
- "})");
- break;
- case "{":
- case "&":
- case "name":
- escape = token.type === "name" ? "true" : "false";
- body.push("r._name(" + quote(token.value) + ", c, " + escape + ")");
- break;
- case ">":
- body.push("r._partial(" + quote(token.value) + ", c)");
- break;
- case "text":
- body.push(quote(token.value));
- break;
- }
- }
-
- // Convert to a string body.
- body = "return " + body.join(" + ") + ";";
-
- // Good for debugging.
- // console.log(body);
-
- if (returnBody) {
- return body;
- }
-
- // For great evil!
- return new Function("c, r", body);
- }
-
- function escapeTags(tags) {
- if (tags.length === 2) {
- return [
- new RegExp(escapeRe(tags[0]) + "\\s*"),
- new RegExp("\\s*" + escapeRe(tags[1]))
- ];
- }
-
- throw new Error("Invalid tags: " + tags.join(" "));
- }
-
- /**
- * Forms the given linear array of `tokens` into a nested tree structure
- * where tokens that represent a section have a "tokens" array property
- * that contains all tokens that are in that section.
- */
- function nestTokens(tokens) {
- var tree = [];
- var collector = tree;
- var sections = [];
- var token, section;
-
- for (var i = 0; i < tokens.length; ++i) {
- token = tokens[i];
-
- switch (token.type) {
- case "#":
- case "^":
- token.tokens = [];
- sections.push(token);
- collector.push(token);
- collector = token.tokens;
- break;
- case "/":
- if (sections.length === 0) {
- throw new Error("Unopened section: " + token.value);
- }
-
- section = sections.pop();
-
- if (section.value !== token.value) {
- throw new Error("Unclosed section: " + section.value);
- }
-
- if (sections.length > 0) {
- collector = sections[sections.length - 1].tokens;
- } else {
- collector = tree;
- }
- break;
- default:
- collector.push(token);
- }
- }
-
- // Make sure there were no open sections when we're done.
- section = sections.pop();
-
- if (section) {
- throw new Error("Unclosed section: " + section.value);
- }
-
- return tree;
- }
-
- /**
- * Combines the values of consecutive text tokens in the given `tokens` array
- * to a single token.
- */
- function squashTokens(tokens) {
- var lastToken;
-
- for (var i = 0; i < tokens.length; ++i) {
- var token = tokens[i];
-
- if (lastToken && lastToken.type === "text" && token.type === "text") {
- lastToken.value += token.value;
- tokens.splice(i--, 1); // Remove this token from the array.
- } else {
- lastToken = token;
- }
- }
- }
-
- /**
- * Breaks up the given `template` string into a tree of token objects. If
- * `tags` is given here it must be an array with two string values: the
- * opening and closing tags used in the template (e.g. ["<%", "%>"]). Of
- * course, the default is to use mustaches (i.e. Mustache.tags).
- */
- function parse(template, tags) {
- tags = tags || exports.tags;
-
- var tagRes = escapeTags(tags);
- var scanner = new Scanner(template);
-
- var tokens = [], // Buffer to hold the tokens
- spaces = [], // Indices of whitespace tokens on the current line
- hasTag = false, // Is there a {{tag}} on the current line?
- nonSpace = false; // Is there a non-space char on the current line?
-
- // Strips all whitespace tokens array for the current line
- // if there was a {{#tag}} on it and otherwise only space.
- var stripSpace = function () {
- if (hasTag && !nonSpace) {
- while (spaces.length) {
- tokens.splice(spaces.pop(), 1);
- }
- } else {
- spaces = [];
- }
-
- hasTag = false;
- nonSpace = false;
- };
-
- var type, value, chr;
-
- while (!scanner.eos()) {
- value = scanner.scanUntil(tagRes[0]);
-
- if (value) {
- for (var i = 0, len = value.length; i < len; ++i) {
- chr = value.charAt(i);
-
- if (isWhitespace(chr)) {
- spaces.push(tokens.length);
- } else {
- nonSpace = true;
- }
-
- tokens.push({type: "text", value: chr});
-
- if (chr === "\n") {
- stripSpace(); // Check for whitespace on the current line.
- }
- }
- }
-
- // Match the opening tag.
- if (!scanner.scan(tagRes[0])) {
- break;
- }
-
- hasTag = true;
- type = scanner.scan(tagRe) || "name";
-
- // Skip any whitespace between tag and value.
- scanner.scan(whiteRe);
-
- // Extract the tag value.
- if (type === "=") {
- value = scanner.scanUntil(eqRe);
- scanner.scan(eqRe);
- scanner.scanUntil(tagRes[1]);
- } else if (type === "{") {
- var closeRe = new RegExp("\\s*" + escapeRe("}" + tags[1]));
- value = scanner.scanUntil(closeRe);
- scanner.scan(curlyRe);
- scanner.scanUntil(tagRes[1]);
- } else {
- value = scanner.scanUntil(tagRes[1]);
- }
-
- // Match the closing tag.
- if (!scanner.scan(tagRes[1])) {
- throw new Error("Unclosed tag at " + scanner.pos);
- }
-
- tokens.push({type: type, value: value});
-
- if (type === "name" || type === "{" || type === "&") {
- nonSpace = true;
- }
-
- // Set the tags for the next time around.
- if (type === "=") {
- tags = value.split(spaceRe);
- tagRes = escapeTags(tags);
- }
- }
-
- squashTokens(tokens);
-
- return nestTokens(tokens);
- }
-
- // The high-level clearCache, compile, compilePartial, and render functions
- // use this default renderer.
- var _renderer = new Renderer();
-
- /**
- * Clears all cached templates and partials.
- */
- function clearCache() {
- _renderer.clearCache();
- }
-
- /**
- * High-level API for compiling the given `tokens` down to a reusable
- * function. If `tokens` is a string it will be parsed using the given `tags`
- * before it is compiled.
- */
- function compile(tokens, tags) {
- return _renderer.compile(tokens, tags);
- }
-
- /**
- * High-level API for compiling the `tokens` for the partial with the given
- * `name` down to a reusable function. If `tokens` is a string it will be
- * parsed using the given `tags` before it is compiled.
- */
- function compilePartial(name, tokens, tags) {
- return _renderer.compilePartial(name, tokens, tags);
- }
-
- /**
- * High-level API for rendering the `template` using the given `view`. The
- * optional `partials` object may be given here for convenience, but note that
- * it will cause all partials to be re-compiled, thus hurting performance. Of
- * course, this only matters if you're going to render the same template more
- * than once. If so, it is best to call `compilePartial` before calling this
- * function and to leave the `partials` argument blank.
- */
- function render(template, view, partials) {
- if (partials) {
- for (var name in partials) {
- compilePartial(name, partials[name]);
- }
- }
-
- return _renderer.render(template, view);
- }
-
- return exports;
-
-}()));
+++ /dev/null
-( function() {\r
- escode = {};\r
- escode.coders = {};\r
- Model = escode.coders.Model = Backbone.Model.extend( {\r
- } );\r
- \r
- View = escode.coders.View = Backbone.View.extend( {\r
- template: function( model ) {\r
- var temp = this.defaultTemplate;\r
- if ( this.templateId ) {\r
- temp = $(this.templateId).html();\r
- if ( !temp ) {\r
- temp = this.defaultTemplate;\r
- }\r
- }\r
- if ( !model ) {\r
- return temp;\r
- }\r
- var result = Mustache.render( temp, model.toJSON() );\r
- console.log( "create template :%s", result );\r
- return result;\r
- }\r
- } );\r
- \r
- Collection = escode.coders.Collection = Backbone.Collection.extend( { } );\r
-} ).call();\r
+++ /dev/null
-/** vim: et:ts=4:sw=4:sts=4
- * @license RequireJS 2.0.6 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
- * Available via the MIT or new BSD license.
- * see: http://github.com/jrburke/requirejs for details
- */
-//Not using strict: uneven strict support in browsers, #392, and causes
-//problems with requirejs.exec()/transpiler plugins that may not be strict.
-/*jslint regexp: true, nomen: true, sloppy: true */
-/*global window, navigator, document, importScripts, jQuery, setTimeout, opera */
-
-var requirejs, require, define;
-(function (global) {
- var req, s, head, baseElement, dataMain, src,
- interactiveScript, currentlyAddingScript, mainScript, subPath,
- version = '2.0.6',
- commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,
- cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
- jsSuffixRegExp = /\.js$/,
- currDirRegExp = /^\.\//,
- op = Object.prototype,
- ostring = op.toString,
- hasOwn = op.hasOwnProperty,
- ap = Array.prototype,
- aps = ap.slice,
- apsp = ap.splice,
- isBrowser = !!(typeof window !== 'undefined' && navigator && document),
- isWebWorker = !isBrowser && typeof importScripts !== 'undefined',
- //PS3 indicates loaded and complete, but need to wait for complete
- //specifically. Sequence is 'loading', 'loaded', execution,
- // then 'complete'. The UA check is unfortunate, but not sure how
- //to feature test w/o causing perf issues.
- readyRegExp = isBrowser && navigator.platform === 'PLAYSTATION 3' ?
- /^complete$/ : /^(complete|loaded)$/,
- defContextName = '_',
- //Oh the tragedy, detecting opera. See the usage of isOpera for reason.
- isOpera = typeof opera !== 'undefined' && opera.toString() === '[object Opera]',
- contexts = {},
- cfg = {},
- globalDefQueue = [],
- useInteractive = false;
-
- function isFunction(it) {
- return ostring.call(it) === '[object Function]';
- }
-
- function isArray(it) {
- return ostring.call(it) === '[object Array]';
- }
-
- /**
- * Helper function for iterating over an array. If the func returns
- * a true value, it will break out of the loop.
- */
- function each(ary, func) {
- if (ary) {
- var i;
- for (i = 0; i < ary.length; i += 1) {
- if (ary[i] && func(ary[i], i, ary)) {
- break;
- }
- }
- }
- }
-
- /**
- * Helper function for iterating over an array backwards. If the func
- * returns a true value, it will break out of the loop.
- */
- function eachReverse(ary, func) {
- if (ary) {
- var i;
- for (i = ary.length - 1; i > -1; i -= 1) {
- if (ary[i] && func(ary[i], i, ary)) {
- break;
- }
- }
- }
- }
-
- function hasProp(obj, prop) {
- return hasOwn.call(obj, prop);
- }
-
- /**
- * Cycles over properties in an object and calls a function for each
- * property value. If the function returns a truthy value, then the
- * iteration is stopped.
- */
- function eachProp(obj, func) {
- var prop;
- for (prop in obj) {
- if (obj.hasOwnProperty(prop)) {
- if (func(obj[prop], prop)) {
- break;
- }
- }
- }
- }
-
- /**
- * Simple function to mix in properties from source into target,
- * but only if target does not already have a property of the same name.
- * This is not robust in IE for transferring methods that match
- * Object.prototype names, but the uses of mixin here seem unlikely to
- * trigger a problem related to that.
- */
- function mixin(target, source, force, deepStringMixin) {
- if (source) {
- eachProp(source, function (value, prop) {
- if (force || !hasProp(target, prop)) {
- if (deepStringMixin && typeof value !== 'string') {
- if (!target[prop]) {
- target[prop] = {};
- }
- mixin(target[prop], value, force, deepStringMixin);
- } else {
- target[prop] = value;
- }
- }
- });
- }
- return target;
- }
-
- //Similar to Function.prototype.bind, but the 'this' object is specified
- //first, since it is easier to read/figure out what 'this' will be.
- function bind(obj, fn) {
- return function () {
- return fn.apply(obj, arguments);
- };
- }
-
- function scripts() {
- return document.getElementsByTagName('script');
- }
-
- //Allow getting a global that expressed in
- //dot notation, like 'a.b.c'.
- function getGlobal(value) {
- if (!value) {
- return value;
- }
- var g = global;
- each(value.split('.'), function (part) {
- g = g[part];
- });
- return g;
- }
-
- function makeContextModuleFunc(func, relMap, enableBuildCallback) {
- return function () {
- //A version of a require function that passes a moduleName
- //value for items that may need to
- //look up paths relative to the moduleName
- var args = aps.call(arguments, 0), lastArg;
- if (enableBuildCallback &&
- isFunction((lastArg = args[args.length - 1]))) {
- lastArg.__requireJsBuild = true;
- }
- args.push(relMap);
- return func.apply(null, args);
- };
- }
-
- function addRequireMethods(req, context, relMap) {
- each([
- ['toUrl'],
- ['undef'],
- ['defined', 'requireDefined'],
- ['specified', 'requireSpecified']
- ], function (item) {
- var prop = item[1] || item[0];
- req[item[0]] = context ? makeContextModuleFunc(context[prop], relMap) :
- //If no context, then use default context. Reference from
- //contexts instead of early binding to default context, so
- //that during builds, the latest instance of the default
- //context with its config gets used.
- function () {
- var ctx = contexts[defContextName];
- return ctx[prop].apply(ctx, arguments);
- };
- });
- }
-
- /**
- * Constructs an error with a pointer to an URL with more information.
- * @param {String} id the error ID that maps to an ID on a web page.
- * @param {String} message human readable error.
- * @param {Error} [err] the original error, if there is one.
- *
- * @returns {Error}
- */
- function makeError(id, msg, err, requireModules) {
- var e = new Error(msg + '\nhttp://requirejs.org/docs/errors.html#' + id);
- e.requireType = id;
- e.requireModules = requireModules;
- if (err) {
- e.originalError = err;
- }
- return e;
- }
-
- if (typeof define !== 'undefined') {
- //If a define is already in play via another AMD loader,
- //do not overwrite.
- return;
- }
-
- if (typeof requirejs !== 'undefined') {
- if (isFunction(requirejs)) {
- //Do not overwrite and existing requirejs instance.
- return;
- }
- cfg = requirejs;
- requirejs = undefined;
- }
-
- //Allow for a require config object
- if (typeof require !== 'undefined' && !isFunction(require)) {
- //assume it is a config object.
- cfg = require;
- require = undefined;
- }
-
- function newContext(contextName) {
- var inCheckLoaded, Module, context, handlers,
- checkLoadedTimeoutId,
- config = {
- waitSeconds: 7,
- baseUrl: './',
- paths: {},
- pkgs: {},
- shim: {}
- },
- registry = {},
- undefEvents = {},
- defQueue = [],
- defined = {},
- urlFetched = {},
- requireCounter = 1,
- unnormalizedCounter = 1,
- //Used to track the order in which modules
- //should be executed, by the order they
- //load. Important for consistent cycle resolution
- //behavior.
- waitAry = [];
-
- /**
- * Trims the . and .. from an array of path segments.
- * It will keep a leading path segment if a .. will become
- * the first path segment, to help with module name lookups,
- * which act like paths, but can be remapped. But the end result,
- * all paths that use this function should look normalized.
- * NOTE: this method MODIFIES the input array.
- * @param {Array} ary the array of path segments.
- */
- function trimDots(ary) {
- var i, part;
- for (i = 0; ary[i]; i += 1) {
- part = ary[i];
- if (part === '.') {
- ary.splice(i, 1);
- i -= 1;
- } else if (part === '..') {
- if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
- //End of the line. Keep at least one non-dot
- //path segment at the front so it can be mapped
- //correctly to disk. Otherwise, there is likely
- //no path mapping for a path starting with '..'.
- //This can still fail, but catches the most reasonable
- //uses of ..
- break;
- } else if (i > 0) {
- ary.splice(i - 1, 2);
- i -= 2;
- }
- }
- }
- }
-
- /**
- * Given a relative module name, like ./something, normalize it to
- * a real name that can be mapped to a path.
- * @param {String} name the relative name
- * @param {String} baseName a real name that the name arg is relative
- * to.
- * @param {Boolean} applyMap apply the map config to the value. Should
- * only be done if this normalization is for a dependency ID.
- * @returns {String} normalized name
- */
- function normalize(name, baseName, applyMap) {
- var pkgName, pkgConfig, mapValue, nameParts, i, j, nameSegment,
- foundMap, foundI, foundStarMap, starI,
- baseParts = baseName && baseName.split('/'),
- normalizedBaseParts = baseParts,
- map = config.map,
- starMap = map && map['*'];
-
- //Adjust any relative paths.
- if (name && name.charAt(0) === '.') {
- //If have a base name, try to normalize against it,
- //otherwise, assume it is a top-level require that will
- //be relative to baseUrl in the end.
- if (baseName) {
- if (config.pkgs[baseName]) {
- //If the baseName is a package name, then just treat it as one
- //name to concat the name with.
- normalizedBaseParts = baseParts = [baseName];
- } else {
- //Convert baseName to array, and lop off the last part,
- //so that . matches that 'directory' and not name of the baseName's
- //module. For instance, baseName of 'one/two/three', maps to
- //'one/two/three.js', but we want the directory, 'one/two' for
- //this normalization.
- normalizedBaseParts = baseParts.slice(0, baseParts.length - 1);
- }
-
- name = normalizedBaseParts.concat(name.split('/'));
- trimDots(name);
-
- //Some use of packages may use a . path to reference the
- //'main' module name, so normalize for that.
- pkgConfig = config.pkgs[(pkgName = name[0])];
- name = name.join('/');
- if (pkgConfig && name === pkgName + '/' + pkgConfig.main) {
- name = pkgName;
- }
- } else if (name.indexOf('./') === 0) {
- // No baseName, so this is ID is resolved relative
- // to baseUrl, pull off the leading dot.
- name = name.substring(2);
- }
- }
-
- //Apply map config if available.
- if (applyMap && (baseParts || starMap) && map) {
- nameParts = name.split('/');
-
- for (i = nameParts.length; i > 0; i -= 1) {
- nameSegment = nameParts.slice(0, i).join('/');
-
- if (baseParts) {
- //Find the longest baseName segment match in the config.
- //So, do joins on the biggest to smallest lengths of baseParts.
- for (j = baseParts.length; j > 0; j -= 1) {
- mapValue = map[baseParts.slice(0, j).join('/')];
-
- //baseName segment has config, find if it has one for
- //this name.
- if (mapValue) {
- mapValue = mapValue[nameSegment];
- if (mapValue) {
- //Match, update name to the new value.
- foundMap = mapValue;
- foundI = i;
- break;
- }
- }
- }
- }
-
- if (foundMap) {
- break;
- }
-
- //Check for a star map match, but just hold on to it,
- //if there is a shorter segment match later in a matching
- //config, then favor over this star map.
- if (!foundStarMap && starMap && starMap[nameSegment]) {
- foundStarMap = starMap[nameSegment];
- starI = i;
- }
- }
-
- if (!foundMap && foundStarMap) {
- foundMap = foundStarMap;
- foundI = starI;
- }
-
- if (foundMap) {
- nameParts.splice(0, foundI, foundMap);
- name = nameParts.join('/');
- }
- }
-
- return name;
- }
-
- function removeScript(name) {
- if (isBrowser) {
- each(scripts(), function (scriptNode) {
- if (scriptNode.getAttribute('data-requiremodule') === name &&
- scriptNode.getAttribute('data-requirecontext') === context.contextName) {
- scriptNode.parentNode.removeChild(scriptNode);
- return true;
- }
- });
- }
- }
-
- function hasPathFallback(id) {
- var pathConfig = config.paths[id];
- if (pathConfig && isArray(pathConfig) && pathConfig.length > 1) {
- removeScript(id);
- //Pop off the first array value, since it failed, and
- //retry
- pathConfig.shift();
- context.undef(id);
- context.require([id]);
- return true;
- }
- }
-
- /**
- * Creates a module mapping that includes plugin prefix, module
- * name, and path. If parentModuleMap is provided it will
- * also normalize the name via require.normalize()
- *
- * @param {String} name the module name
- * @param {String} [parentModuleMap] parent module map
- * for the module name, used to resolve relative names.
- * @param {Boolean} isNormalized: is the ID already normalized.
- * This is true if this call is done for a define() module ID.
- * @param {Boolean} applyMap: apply the map config to the ID.
- * Should only be true if this map is for a dependency.
- *
- * @returns {Object}
- */
- function makeModuleMap(name, parentModuleMap, isNormalized, applyMap) {
- var url, pluginModule, suffix,
- index = name ? name.indexOf('!') : -1,
- prefix = null,
- parentName = parentModuleMap ? parentModuleMap.name : null,
- originalName = name,
- isDefine = true,
- normalizedName = '';
-
- //If no name, then it means it is a require call, generate an
- //internal name.
- if (!name) {
- isDefine = false;
- name = '_@r' + (requireCounter += 1);
- }
-
- if (index !== -1) {
- prefix = name.substring(0, index);
- name = name.substring(index + 1, name.length);
- }
-
- if (prefix) {
- prefix = normalize(prefix, parentName, applyMap);
- pluginModule = defined[prefix];
- }
-
- //Account for relative paths if there is a base name.
- if (name) {
- if (prefix) {
- if (pluginModule && pluginModule.normalize) {
- //Plugin is loaded, use its normalize method.
- normalizedName = pluginModule.normalize(name, function (name) {
- return normalize(name, parentName, applyMap);
- });
- } else {
- normalizedName = normalize(name, parentName, applyMap);
- }
- } else {
- //A regular module.
- normalizedName = normalize(name, parentName, applyMap);
- url = context.nameToUrl(normalizedName);
- }
- }
-
- //If the id is a plugin id that cannot be determined if it needs
- //normalization, stamp it with a unique ID so two matching relative
- //ids that may conflict can be separate.
- suffix = prefix && !pluginModule && !isNormalized ?
- '_unnormalized' + (unnormalizedCounter += 1) :
- '';
-
- return {
- prefix: prefix,
- name: normalizedName,
- parentMap: parentModuleMap,
- unnormalized: !!suffix,
- url: url,
- originalName: originalName,
- isDefine: isDefine,
- id: (prefix ?
- prefix + '!' + normalizedName :
- normalizedName) + suffix
- };
- }
-
- function getModule(depMap) {
- var id = depMap.id,
- mod = registry[id];
-
- if (!mod) {
- mod = registry[id] = new context.Module(depMap);
- }
-
- return mod;
- }
-
- function on(depMap, name, fn) {
- var id = depMap.id,
- mod = registry[id];
-
- if (hasProp(defined, id) &&
- (!mod || mod.defineEmitComplete)) {
- if (name === 'defined') {
- fn(defined[id]);
- }
- } else {
- getModule(depMap).on(name, fn);
- }
- }
-
- function onError(err, errback) {
- var ids = err.requireModules,
- notified = false;
-
- if (errback) {
- errback(err);
- } else {
- each(ids, function (id) {
- var mod = registry[id];
- if (mod) {
- //Set error on module, so it skips timeout checks.
- mod.error = err;
- if (mod.events.error) {
- notified = true;
- mod.emit('error', err);
- }
- }
- });
-
- if (!notified) {
- req.onError(err);
- }
- }
- }
-
- /**
- * Internal method to transfer globalQueue items to this context's
- * defQueue.
- */
- function takeGlobalQueue() {
- //Push all the globalDefQueue items into the context's defQueue
- if (globalDefQueue.length) {
- //Array splice in the values since the context code has a
- //local var ref to defQueue, so cannot just reassign the one
- //on context.
- apsp.apply(defQueue,
- [defQueue.length - 1, 0].concat(globalDefQueue));
- globalDefQueue = [];
- }
- }
-
- /**
- * Helper function that creates a require function object to give to
- * modules that ask for it as a dependency. It needs to be specific
- * per module because of the implication of path mappings that may
- * need to be relative to the module name.
- */
- function makeRequire(mod, enableBuildCallback, altRequire) {
- var relMap = mod && mod.map,
- modRequire = makeContextModuleFunc(altRequire || context.require,
- relMap,
- enableBuildCallback);
-
- addRequireMethods(modRequire, context, relMap);
- modRequire.isBrowser = isBrowser;
-
- return modRequire;
- }
-
- handlers = {
- 'require': function (mod) {
- return makeRequire(mod);
- },
- 'exports': function (mod) {
- mod.usingExports = true;
- if (mod.map.isDefine) {
- return (mod.exports = defined[mod.map.id] = {});
- }
- },
- 'module': function (mod) {
- return (mod.module = {
- id: mod.map.id,
- uri: mod.map.url,
- config: function () {
- return (config.config && config.config[mod.map.id]) || {};
- },
- exports: defined[mod.map.id]
- });
- }
- };
-
- function removeWaiting(id) {
- //Clean up machinery used for waiting modules.
- delete registry[id];
-
- each(waitAry, function (mod, i) {
- if (mod.map.id === id) {
- waitAry.splice(i, 1);
- if (!mod.defined) {
- context.waitCount -= 1;
- }
- return true;
- }
- });
- }
-
- function findCycle(mod, traced, processed) {
- var id = mod.map.id,
- depArray = mod.depMaps,
- foundModule;
-
- //Do not bother with unitialized modules or not yet enabled
- //modules.
- if (!mod.inited) {
- return;
- }
-
- //Found the cycle.
- if (traced[id]) {
- return mod;
- }
-
- traced[id] = true;
-
- //Trace through the dependencies.
- each(depArray, function (depMap) {
- var depId = depMap.id,
- depMod = registry[depId];
-
- if (!depMod || processed[depId] ||
- !depMod.inited || !depMod.enabled) {
- return;
- }
-
- return (foundModule = findCycle(depMod, traced, processed));
- });
-
- processed[id] = true;
-
- return foundModule;
- }
-
- function forceExec(mod, traced, uninited) {
- var id = mod.map.id,
- depArray = mod.depMaps;
-
- if (!mod.inited || !mod.map.isDefine) {
- return;
- }
-
- if (traced[id]) {
- return defined[id];
- }
-
- traced[id] = mod;
-
- each(depArray, function (depMap) {
- var depId = depMap.id,
- depMod = registry[depId],
- value;
-
- if (handlers[depId]) {
- return;
- }
-
- if (depMod) {
- if (!depMod.inited || !depMod.enabled) {
- //Dependency is not inited,
- //so this module cannot be
- //given a forced value yet.
- uninited[id] = true;
- return;
- }
-
- //Get the value for the current dependency
- value = forceExec(depMod, traced, uninited);
-
- //Even with forcing it may not be done,
- //in particular if the module is waiting
- //on a plugin resource.
- if (!uninited[depId]) {
- mod.defineDepById(depId, value);
- }
- }
- });
-
- mod.check(true);
-
- return defined[id];
- }
-
- function modCheck(mod) {
- mod.check();
- }
-
- function checkLoaded() {
- var map, modId, err, usingPathFallback,
- waitInterval = config.waitSeconds * 1000,
- //It is possible to disable the wait interval by using waitSeconds of 0.
- expired = waitInterval && (context.startTime + waitInterval) < new Date().getTime(),
- noLoads = [],
- stillLoading = false,
- needCycleCheck = true;
-
- //Do not bother if this call was a result of a cycle break.
- if (inCheckLoaded) {
- return;
- }
-
- inCheckLoaded = true;
-
- //Figure out the state of all the modules.
- eachProp(registry, function (mod) {
- map = mod.map;
- modId = map.id;
-
- //Skip things that are not enabled or in error state.
- if (!mod.enabled) {
- return;
- }
-
- if (!mod.error) {
- //If the module should be executed, and it has not
- //been inited and time is up, remember it.
- if (!mod.inited && expired) {
- if (hasPathFallback(modId)) {
- usingPathFallback = true;
- stillLoading = true;
- } else {
- noLoads.push(modId);
- removeScript(modId);
- }
- } else if (!mod.inited && mod.fetched && map.isDefine) {
- stillLoading = true;
- if (!map.prefix) {
- //No reason to keep looking for unfinished
- //loading. If the only stillLoading is a
- //plugin resource though, keep going,
- //because it may be that a plugin resource
- //is waiting on a non-plugin cycle.
- return (needCycleCheck = false);
- }
- }
- }
- });
-
- if (expired && noLoads.length) {
- //If wait time expired, throw error of unloaded modules.
- err = makeError('timeout', 'Load timeout for modules: ' + noLoads, null, noLoads);
- err.contextName = context.contextName;
- return onError(err);
- }
-
- //Not expired, check for a cycle.
- if (needCycleCheck) {
-
- each(waitAry, function (mod) {
- if (mod.defined) {
- return;
- }
-
- var cycleMod = findCycle(mod, {}, {}),
- traced = {};
-
- if (cycleMod) {
- forceExec(cycleMod, traced, {});
-
- //traced modules may have been
- //removed from the registry, but
- //their listeners still need to
- //be called.
- eachProp(traced, modCheck);
- }
- });
-
- //Now that dependencies have
- //been satisfied, trigger the
- //completion check that then
- //notifies listeners.
- eachProp(registry, modCheck);
- }
-
- //If still waiting on loads, and the waiting load is something
- //other than a plugin resource, or there are still outstanding
- //scripts, then just try back later.
- if ((!expired || usingPathFallback) && stillLoading) {
- //Something is still waiting to load. Wait for it, but only
- //if a timeout is not already in effect.
- if ((isBrowser || isWebWorker) && !checkLoadedTimeoutId) {
- checkLoadedTimeoutId = setTimeout(function () {
- checkLoadedTimeoutId = 0;
- checkLoaded();
- }, 50);
- }
- }
-
- inCheckLoaded = false;
- }
-
- Module = function (map) {
- this.events = undefEvents[map.id] || {};
- this.map = map;
- this.shim = config.shim[map.id];
- this.depExports = [];
- this.depMaps = [];
- this.depMatched = [];
- this.pluginMaps = {};
- this.depCount = 0;
-
- /* this.exports this.factory
- this.depMaps = [],
- this.enabled, this.fetched
- */
- };
-
- Module.prototype = {
- init: function (depMaps, factory, errback, options) {
- options = options || {};
-
- //Do not do more inits if already done. Can happen if there
- //are multiple define calls for the same module. That is not
- //a normal, common case, but it is also not unexpected.
- if (this.inited) {
- return;
- }
-
- this.factory = factory;
-
- if (errback) {
- //Register for errors on this module.
- this.on('error', errback);
- } else if (this.events.error) {
- //If no errback already, but there are error listeners
- //on this module, set up an errback to pass to the deps.
- errback = bind(this, function (err) {
- this.emit('error', err);
- });
- }
-
- //Do a copy of the dependency array, so that
- //source inputs are not modified. For example
- //"shim" deps are passed in here directly, and
- //doing a direct modification of the depMaps array
- //would affect that config.
- this.depMaps = depMaps && depMaps.slice(0);
- this.depMaps.rjsSkipMap = depMaps.rjsSkipMap;
-
- this.errback = errback;
-
- //Indicate this module has be initialized
- this.inited = true;
-
- this.ignore = options.ignore;
-
- //Could have option to init this module in enabled mode,
- //or could have been previously marked as enabled. However,
- //the dependencies are not known until init is called. So
- //if enabled previously, now trigger dependencies as enabled.
- if (options.enabled || this.enabled) {
- //Enable this module and dependencies.
- //Will call this.check()
- this.enable();
- } else {
- this.check();
- }
- },
-
- defineDepById: function (id, depExports) {
- var i;
-
- //Find the index for this dependency.
- each(this.depMaps, function (map, index) {
- if (map.id === id) {
- i = index;
- return true;
- }
- });
-
- return this.defineDep(i, depExports);
- },
-
- defineDep: function (i, depExports) {
- //Because of cycles, defined callback for a given
- //export can be called more than once.
- if (!this.depMatched[i]) {
- this.depMatched[i] = true;
- this.depCount -= 1;
- this.depExports[i] = depExports;
- }
- },
-
- fetch: function () {
- if (this.fetched) {
- return;
- }
- this.fetched = true;
-
- context.startTime = (new Date()).getTime();
-
- var map = this.map;
-
- //If the manager is for a plugin managed resource,
- //ask the plugin to load it now.
- if (this.shim) {
- makeRequire(this, true)(this.shim.deps || [], bind(this, function () {
- return map.prefix ? this.callPlugin() : this.load();
- }));
- } else {
- //Regular dependency.
- return map.prefix ? this.callPlugin() : this.load();
- }
- },
-
- load: function () {
- var url = this.map.url;
-
- //Regular dependency.
- if (!urlFetched[url]) {
- urlFetched[url] = true;
- context.load(this.map.id, url);
- }
- },
-
- /**
- * Checks is the module is ready to define itself, and if so,
- * define it. If the silent argument is true, then it will just
- * define, but not notify listeners, and not ask for a context-wide
- * check of all loaded modules. That is useful for cycle breaking.
- */
- check: function (silent) {
- if (!this.enabled || this.enabling) {
- return;
- }
-
- var err, cjsModule,
- id = this.map.id,
- depExports = this.depExports,
- exports = this.exports,
- factory = this.factory;
-
- if (!this.inited) {
- this.fetch();
- } else if (this.error) {
- this.emit('error', this.error);
- } else if (!this.defining) {
- //The factory could trigger another require call
- //that would result in checking this module to
- //define itself again. If already in the process
- //of doing that, skip this work.
- this.defining = true;
-
- if (this.depCount < 1 && !this.defined) {
- if (isFunction(factory)) {
- //If there is an error listener, favor passing
- //to that instead of throwing an error.
- if (this.events.error) {
- try {
- exports = context.execCb(id, factory, depExports, exports);
- } catch (e) {
- err = e;
- }
- } else {
- exports = context.execCb(id, factory, depExports, exports);
- }
-
- if (this.map.isDefine) {
- //If setting exports via 'module' is in play,
- //favor that over return value and exports. After that,
- //favor a non-undefined return value over exports use.
- cjsModule = this.module;
- if (cjsModule &&
- cjsModule.exports !== undefined &&
- //Make sure it is not already the exports value
- cjsModule.exports !== this.exports) {
- exports = cjsModule.exports;
- } else if (exports === undefined && this.usingExports) {
- //exports already set the defined value.
- exports = this.exports;
- }
- }
-
- if (err) {
- err.requireMap = this.map;
- err.requireModules = [this.map.id];
- err.requireType = 'define';
- return onError((this.error = err));
- }
-
- } else {
- //Just a literal value
- exports = factory;
- }
-
- this.exports = exports;
-
- if (this.map.isDefine && !this.ignore) {
- defined[id] = exports;
-
- if (req.onResourceLoad) {
- req.onResourceLoad(context, this.map, this.depMaps);
- }
- }
-
- //Clean up
- delete registry[id];
-
- this.defined = true;
- context.waitCount -= 1;
- if (context.waitCount === 0) {
- //Clear the wait array used for cycles.
- waitAry = [];
- }
- }
-
- //Finished the define stage. Allow calling check again
- //to allow define notifications below in the case of a
- //cycle.
- this.defining = false;
-
- if (!silent) {
- if (this.defined && !this.defineEmitted) {
- this.defineEmitted = true;
- this.emit('defined', this.exports);
- this.defineEmitComplete = true;
- }
- }
- }
- },
-
- callPlugin: function () {
- var map = this.map,
- id = map.id,
- pluginMap = makeModuleMap(map.prefix, null, false, true);
-
- on(pluginMap, 'defined', bind(this, function (plugin) {
- var load, normalizedMap, normalizedMod,
- name = this.map.name,
- parentName = this.map.parentMap ? this.map.parentMap.name : null;
-
- //If current map is not normalized, wait for that
- //normalized name to load instead of continuing.
- if (this.map.unnormalized) {
- //Normalize the ID if the plugin allows it.
- if (plugin.normalize) {
- name = plugin.normalize(name, function (name) {
- return normalize(name, parentName, true);
- }) || '';
- }
-
- normalizedMap = makeModuleMap(map.prefix + '!' + name,
- this.map.parentMap,
- false,
- true);
- on(normalizedMap,
- 'defined', bind(this, function (value) {
- this.init([], function () { return value; }, null, {
- enabled: true,
- ignore: true
- });
- }));
- normalizedMod = registry[normalizedMap.id];
- if (normalizedMod) {
- if (this.events.error) {
- normalizedMod.on('error', bind(this, function (err) {
- this.emit('error', err);
- }));
- }
- normalizedMod.enable();
- }
-
- return;
- }
-
- load = bind(this, function (value) {
- this.init([], function () { return value; }, null, {
- enabled: true
- });
- });
-
- load.error = bind(this, function (err) {
- this.inited = true;
- this.error = err;
- err.requireModules = [id];
-
- //Remove temp unnormalized modules for this module,
- //since they will never be resolved otherwise now.
- eachProp(registry, function (mod) {
- if (mod.map.id.indexOf(id + '_unnormalized') === 0) {
- removeWaiting(mod.map.id);
- }
- });
-
- onError(err);
- });
-
- //Allow plugins to load other code without having to know the
- //context or how to 'complete' the load.
- load.fromText = function (moduleName, text) {
- /*jslint evil: true */
- var hasInteractive = useInteractive;
-
- //Turn off interactive script matching for IE for any define
- //calls in the text, then turn it back on at the end.
- if (hasInteractive) {
- useInteractive = false;
- }
-
- //Prime the system by creating a module instance for
- //it.
- getModule(makeModuleMap(moduleName));
-
- req.exec(text);
-
- if (hasInteractive) {
- useInteractive = true;
- }
-
- //Support anonymous modules.
- context.completeLoad(moduleName);
- };
-
- //Use parentName here since the plugin's name is not reliable,
- //could be some weird string with no path that actually wants to
- //reference the parentName's path.
- plugin.load(map.name, makeRequire(map.parentMap, true, function (deps, cb, er) {
- deps.rjsSkipMap = true;
- return context.require(deps, cb, er);
- }), load, config);
- }));
-
- context.enable(pluginMap, this);
- this.pluginMaps[pluginMap.id] = pluginMap;
- },
-
- enable: function () {
- this.enabled = true;
-
- if (!this.waitPushed) {
- waitAry.push(this);
- context.waitCount += 1;
- this.waitPushed = true;
- }
-
- //Set flag mentioning that the module is enabling,
- //so that immediate calls to the defined callbacks
- //for dependencies do not trigger inadvertent load
- //with the depCount still being zero.
- this.enabling = true;
-
- //Enable each dependency
- each(this.depMaps, bind(this, function (depMap, i) {
- var id, mod, handler;
-
- if (typeof depMap === 'string') {
- //Dependency needs to be converted to a depMap
- //and wired up to this module.
- depMap = makeModuleMap(depMap,
- (this.map.isDefine ? this.map : this.map.parentMap),
- false,
- !this.depMaps.rjsSkipMap);
- this.depMaps[i] = depMap;
-
- handler = handlers[depMap.id];
-
- if (handler) {
- this.depExports[i] = handler(this);
- return;
- }
-
- this.depCount += 1;
-
- on(depMap, 'defined', bind(this, function (depExports) {
- this.defineDep(i, depExports);
- this.check();
- }));
-
- if (this.errback) {
- on(depMap, 'error', this.errback);
- }
- }
-
- id = depMap.id;
- mod = registry[id];
-
- //Skip special modules like 'require', 'exports', 'module'
- //Also, don't call enable if it is already enabled,
- //important in circular dependency cases.
- if (!handlers[id] && mod && !mod.enabled) {
- context.enable(depMap, this);
- }
- }));
-
- //Enable each plugin that is used in
- //a dependency
- eachProp(this.pluginMaps, bind(this, function (pluginMap) {
- var mod = registry[pluginMap.id];
- if (mod && !mod.enabled) {
- context.enable(pluginMap, this);
- }
- }));
-
- this.enabling = false;
-
- this.check();
- },
-
- on: function (name, cb) {
- var cbs = this.events[name];
- if (!cbs) {
- cbs = this.events[name] = [];
- }
- cbs.push(cb);
- },
-
- emit: function (name, evt) {
- each(this.events[name], function (cb) {
- cb(evt);
- });
- if (name === 'error') {
- //Now that the error handler was triggered, remove
- //the listeners, since this broken Module instance
- //can stay around for a while in the registry/waitAry.
- delete this.events[name];
- }
- }
- };
-
- function callGetModule(args) {
- getModule(makeModuleMap(args[0], null, true)).init(args[1], args[2]);
- }
-
- function removeListener(node, func, name, ieName) {
- //Favor detachEvent because of IE9
- //issue, see attachEvent/addEventListener comment elsewhere
- //in this file.
- if (node.detachEvent && !isOpera) {
- //Probably IE. If not it will throw an error, which will be
- //useful to know.
- if (ieName) {
- node.detachEvent(ieName, func);
- }
- } else {
- node.removeEventListener(name, func, false);
- }
- }
-
- /**
- * Given an event from a script node, get the requirejs info from it,
- * and then removes the event listeners on the node.
- * @param {Event} evt
- * @returns {Object}
- */
- function getScriptData(evt) {
- //Using currentTarget instead of target for Firefox 2.0's sake. Not
- //all old browsers will be supported, but this one was easy enough
- //to support and still makes sense.
- var node = evt.currentTarget || evt.srcElement;
-
- //Remove the listeners once here.
- removeListener(node, context.onScriptLoad, 'load', 'onreadystatechange');
- removeListener(node, context.onScriptError, 'error');
-
- return {
- node: node,
- id: node && node.getAttribute('data-requiremodule')
- };
- }
-
- return (context = {
- config: config,
- contextName: contextName,
- registry: registry,
- defined: defined,
- urlFetched: urlFetched,
- waitCount: 0,
- defQueue: defQueue,
- Module: Module,
- makeModuleMap: makeModuleMap,
-
- /**
- * Set a configuration for the context.
- * @param {Object} cfg config object to integrate.
- */
- configure: function (cfg) {
- //Make sure the baseUrl ends in a slash.
- if (cfg.baseUrl) {
- if (cfg.baseUrl.charAt(cfg.baseUrl.length - 1) !== '/') {
- cfg.baseUrl += '/';
- }
- }
-
- //Save off the paths and packages since they require special processing,
- //they are additive.
- var pkgs = config.pkgs,
- shim = config.shim,
- paths = config.paths,
- map = config.map;
-
- //Mix in the config values, favoring the new values over
- //existing ones in context.config.
- mixin(config, cfg, true);
-
- //Merge paths.
- config.paths = mixin(paths, cfg.paths, true);
-
- //Merge map
- if (cfg.map) {
- config.map = mixin(map || {}, cfg.map, true, true);
- }
-
- //Merge shim
- if (cfg.shim) {
- eachProp(cfg.shim, function (value, id) {
- //Normalize the structure
- if (isArray(value)) {
- value = {
- deps: value
- };
- }
- if (value.exports && !value.exports.__buildReady) {
- value.exports = context.makeShimExports(value.exports);
- }
- shim[id] = value;
- });
- config.shim = shim;
- }
-
- //Adjust packages if necessary.
- if (cfg.packages) {
- each(cfg.packages, function (pkgObj) {
- var location;
-
- pkgObj = typeof pkgObj === 'string' ? { name: pkgObj } : pkgObj;
- location = pkgObj.location;
-
- //Create a brand new object on pkgs, since currentPackages can
- //be passed in again, and config.pkgs is the internal transformed
- //state for all package configs.
- pkgs[pkgObj.name] = {
- name: pkgObj.name,
- location: location || pkgObj.name,
- //Remove leading dot in main, so main paths are normalized,
- //and remove any trailing .js, since different package
- //envs have different conventions: some use a module name,
- //some use a file name.
- main: (pkgObj.main || 'main')
- .replace(currDirRegExp, '')
- .replace(jsSuffixRegExp, '')
- };
- });
-
- //Done with modifications, assing packages back to context config
- config.pkgs = pkgs;
- }
-
- //If there are any "waiting to execute" modules in the registry,
- //update the maps for them, since their info, like URLs to load,
- //may have changed.
- eachProp(registry, function (mod, id) {
- //If module already has init called, since it is too
- //late to modify them, and ignore unnormalized ones
- //since they are transient.
- if (!mod.inited && !mod.map.unnormalized) {
- mod.map = makeModuleMap(id);
- }
- });
-
- //If a deps array or a config callback is specified, then call
- //require with those args. This is useful when require is defined as a
- //config object before require.js is loaded.
- if (cfg.deps || cfg.callback) {
- context.require(cfg.deps || [], cfg.callback);
- }
- },
-
- makeShimExports: function (exports) {
- var func;
- if (typeof exports === 'string') {
- func = function () {
- return getGlobal(exports);
- };
- //Save the exports for use in nodefine checking.
- func.exports = exports;
- return func;
- } else {
- return function () {
- return exports.apply(global, arguments);
- };
- }
- },
-
- requireDefined: function (id, relMap) {
- return hasProp(defined, makeModuleMap(id, relMap, false, true).id);
- },
-
- requireSpecified: function (id, relMap) {
- id = makeModuleMap(id, relMap, false, true).id;
- return hasProp(defined, id) || hasProp(registry, id);
- },
-
- require: function (deps, callback, errback, relMap) {
- var moduleName, id, map, requireMod, args;
- if (typeof deps === 'string') {
- if (isFunction(callback)) {
- //Invalid call
- return onError(makeError('requireargs', 'Invalid require call'), errback);
- }
-
- //Synchronous access to one module. If require.get is
- //available (as in the Node adapter), prefer that.
- //In this case deps is the moduleName and callback is
- //the relMap
- if (req.get) {
- return req.get(context, deps, callback);
- }
-
- //Just return the module wanted. In this scenario, the
- //second arg (if passed) is just the relMap.
- moduleName = deps;
- relMap = callback;
-
- //Normalize module name, if it contains . or ..
- map = makeModuleMap(moduleName, relMap, false, true);
- id = map.id;
-
- if (!hasProp(defined, id)) {
- return onError(makeError('notloaded', 'Module name "' +
- id +
- '" has not been loaded yet for context: ' +
- contextName));
- }
- return defined[id];
- }
-
- //Callback require. Normalize args. if callback or errback is
- //not a function, it means it is a relMap. Test errback first.
- if (errback && !isFunction(errback)) {
- relMap = errback;
- errback = undefined;
- }
- if (callback && !isFunction(callback)) {
- relMap = callback;
- callback = undefined;
- }
-
- //Any defined modules in the global queue, intake them now.
- takeGlobalQueue();
-
- //Make sure any remaining defQueue items get properly processed.
- while (defQueue.length) {
- args = defQueue.shift();
- if (args[0] === null) {
- return onError(makeError('mismatch', 'Mismatched anonymous define() module: ' + args[args.length - 1]));
- } else {
- //args are id, deps, factory. Should be normalized by the
- //define() function.
- callGetModule(args);
- }
- }
-
- //Mark all the dependencies as needing to be loaded.
- requireMod = getModule(makeModuleMap(null, relMap));
-
- requireMod.init(deps, callback, errback, {
- enabled: true
- });
-
- checkLoaded();
-
- return context.require;
- },
-
- undef: function (id) {
- //Bind any waiting define() calls to this context,
- //fix for #408
- takeGlobalQueue();
-
- var map = makeModuleMap(id, null, true),
- mod = registry[id];
-
- delete defined[id];
- delete urlFetched[map.url];
- delete undefEvents[id];
-
- if (mod) {
- //Hold on to listeners in case the
- //module will be attempted to be reloaded
- //using a different config.
- if (mod.events.defined) {
- undefEvents[id] = mod.events;
- }
-
- removeWaiting(id);
- }
- },
-
- /**
- * Called to enable a module if it is still in the registry
- * awaiting enablement. parent module is passed in for context,
- * used by the optimizer.
- */
- enable: function (depMap, parent) {
- var mod = registry[depMap.id];
- if (mod) {
- getModule(depMap).enable();
- }
- },
-
- /**
- * Internal method used by environment adapters to complete a load event.
- * A load event could be a script load or just a load pass from a synchronous
- * load call.
- * @param {String} moduleName the name of the module to potentially complete.
- */
- completeLoad: function (moduleName) {
- var found, args, mod,
- shim = config.shim[moduleName] || {},
- shExports = shim.exports && shim.exports.exports;
-
- takeGlobalQueue();
-
- while (defQueue.length) {
- args = defQueue.shift();
- if (args[0] === null) {
- args[0] = moduleName;
- //If already found an anonymous module and bound it
- //to this name, then this is some other anon module
- //waiting for its completeLoad to fire.
- if (found) {
- break;
- }
- found = true;
- } else if (args[0] === moduleName) {
- //Found matching define call for this script!
- found = true;
- }
-
- callGetModule(args);
- }
-
- //Do this after the cycle of callGetModule in case the result
- //of those calls/init calls changes the registry.
- mod = registry[moduleName];
-
- if (!found && !defined[moduleName] && mod && !mod.inited) {
- if (config.enforceDefine && (!shExports || !getGlobal(shExports))) {
- if (hasPathFallback(moduleName)) {
- return;
- } else {
- return onError(makeError('nodefine',
- 'No define call for ' + moduleName,
- null,
- [moduleName]));
- }
- } else {
- //A script that does not call define(), so just simulate
- //the call for it.
- callGetModule([moduleName, (shim.deps || []), shim.exports]);
- }
- }
-
- checkLoaded();
- },
-
- /**
- * Converts a module name + .extension into an URL path.
- * *Requires* the use of a module name. It does not support using
- * plain URLs like nameToUrl.
- */
- toUrl: function (moduleNamePlusExt, relModuleMap) {
- var index = moduleNamePlusExt.lastIndexOf('.'),
- ext = null;
-
- if (index !== -1) {
- ext = moduleNamePlusExt.substring(index, moduleNamePlusExt.length);
- moduleNamePlusExt = moduleNamePlusExt.substring(0, index);
- }
-
- return context.nameToUrl(normalize(moduleNamePlusExt, relModuleMap && relModuleMap.id, true),
- ext);
- },
-
- /**
- * Converts a module name to a file path. Supports cases where
- * moduleName may actually be just an URL.
- * Note that it **does not** call normalize on the moduleName,
- * it is assumed to have already been normalized. This is an
- * internal API, not a public one. Use toUrl for the public API.
- */
- nameToUrl: function (moduleName, ext) {
- var paths, pkgs, pkg, pkgPath, syms, i, parentModule, url,
- parentPath;
-
- //If a colon is in the URL, it indicates a protocol is used and it is just
- //an URL to a file, or if it starts with a slash, contains a query arg (i.e. ?)
- //or ends with .js, then assume the user meant to use an url and not a module id.
- //The slash is important for protocol-less URLs as well as full paths.
- if (req.jsExtRegExp.test(moduleName)) {
- //Just a plain path, not module name lookup, so just return it.
- //Add extension if it is included. This is a bit wonky, only non-.js things pass
- //an extension, this method probably needs to be reworked.
- url = moduleName + (ext || '');
- } else {
- //A module that needs to be converted to a path.
- paths = config.paths;
- pkgs = config.pkgs;
-
- syms = moduleName.split('/');
- //For each module name segment, see if there is a path
- //registered for it. Start with most specific name
- //and work up from it.
- for (i = syms.length; i > 0; i -= 1) {
- parentModule = syms.slice(0, i).join('/');
- pkg = pkgs[parentModule];
- parentPath = paths[parentModule];
- if (parentPath) {
- //If an array, it means there are a few choices,
- //Choose the one that is desired
- if (isArray(parentPath)) {
- parentPath = parentPath[0];
- }
- syms.splice(0, i, parentPath);
- break;
- } else if (pkg) {
- //If module name is just the package name, then looking
- //for the main module.
- if (moduleName === pkg.name) {
- pkgPath = pkg.location + '/' + pkg.main;
- } else {
- pkgPath = pkg.location;
- }
- syms.splice(0, i, pkgPath);
- break;
- }
- }
-
- //Join the path parts together, then figure out if baseUrl is needed.
- url = syms.join('/');
- url += (ext || (/\?/.test(url) ? '' : '.js'));
- url = (url.charAt(0) === '/' || url.match(/^[\w\+\.\-]+:/) ? '' : config.baseUrl) + url;
- }
-
- return config.urlArgs ? url +
- ((url.indexOf('?') === -1 ? '?' : '&') +
- config.urlArgs) : url;
- },
-
- //Delegates to req.load. Broken out as a separate function to
- //allow overriding in the optimizer.
- load: function (id, url) {
- req.load(context, id, url);
- },
-
- /**
- * Executes a module callack function. Broken out as a separate function
- * solely to allow the build system to sequence the files in the built
- * layer in the right sequence.
- *
- * @private
- */
- execCb: function (name, callback, args, exports) {
- return callback.apply(exports, args);
- },
-
- /**
- * callback for script loads, used to check status of loading.
- *
- * @param {Event} evt the event from the browser for the script
- * that was loaded.
- */
- onScriptLoad: function (evt) {
- //Using currentTarget instead of target for Firefox 2.0's sake. Not
- //all old browsers will be supported, but this one was easy enough
- //to support and still makes sense.
- if (evt.type === 'load' ||
- (readyRegExp.test((evt.currentTarget || evt.srcElement).readyState))) {
- //Reset interactive script so a script node is not held onto for
- //to long.
- interactiveScript = null;
-
- //Pull out the name of the module and the context.
- var data = getScriptData(evt);
- context.completeLoad(data.id);
- }
- },
-
- /**
- * Callback for script errors.
- */
- onScriptError: function (evt) {
- var data = getScriptData(evt);
- if (!hasPathFallback(data.id)) {
- return onError(makeError('scripterror', 'Script error', evt, [data.id]));
- }
- }
- });
- }
-
- /**
- * Main entry point.
- *
- * If the only argument to require is a string, then the module that
- * is represented by that string is fetched for the appropriate context.
- *
- * If the first argument is an array, then it will be treated as an array
- * of dependency string names to fetch. An optional function callback can
- * be specified to execute when all of those dependencies are available.
- *
- * Make a local req variable to help Caja compliance (it assumes things
- * on a require that are not standardized), and to give a short
- * name for minification/local scope use.
- */
- req = requirejs = function (deps, callback, errback, optional) {
-
- //Find the right context, use default
- var context, config,
- contextName = defContextName;
-
- // Determine if have config object in the call.
- if (!isArray(deps) && typeof deps !== 'string') {
- // deps is a config object
- config = deps;
- if (isArray(callback)) {
- // Adjust args if there are dependencies
- deps = callback;
- callback = errback;
- errback = optional;
- } else {
- deps = [];
- }
- }
-
- if (config && config.context) {
- contextName = config.context;
- }
-
- context = contexts[contextName];
- if (!context) {
- context = contexts[contextName] = req.s.newContext(contextName);
- }
-
- if (config) {
- context.configure(config);
- }
-
- return context.require(deps, callback, errback);
- };
-
- /**
- * Support require.config() to make it easier to cooperate with other
- * AMD loaders on globally agreed names.
- */
- req.config = function (config) {
- return req(config);
- };
-
- /**
- * Export require as a global, but only if it does not already exist.
- */
- if (!require) {
- require = req;
- }
-
- req.version = version;
-
- //Used to filter out dependencies that are already paths.
- req.jsExtRegExp = /^\/|:|\?|\.js$/;
- req.isBrowser = isBrowser;
- s = req.s = {
- contexts: contexts,
- newContext: newContext
- };
-
- //Create default context.
- req({});
-
- //Exports some context-sensitive methods on global require, using
- //default context if no context specified.
- addRequireMethods(req);
-
- if (isBrowser) {
- head = s.head = document.getElementsByTagName('head')[0];
- //If BASE tag is in play, using appendChild is a problem for IE6.
- //When that browser dies, this can be removed. Details in this jQuery bug:
- //http://dev.jquery.com/ticket/2709
- baseElement = document.getElementsByTagName('base')[0];
- if (baseElement) {
- head = s.head = baseElement.parentNode;
- }
- }
-
- /**
- * Any errors that require explicitly generates will be passed to this
- * function. Intercept/override it if you want custom error handling.
- * @param {Error} err the error object.
- */
- req.onError = function (err) {
- throw err;
- };
-
- /**
- * Does the request to load a module for the browser case.
- * Make this a separate function to allow other environments
- * to override it.
- *
- * @param {Object} context the require context to find state.
- * @param {String} moduleName the name of the module.
- * @param {Object} url the URL to the module.
- */
- req.load = function (context, moduleName, url) {
- var config = (context && context.config) || {},
- node;
- if (isBrowser) {
- //In the browser so use a script tag
- node = config.xhtml ?
- document.createElementNS('http://www.w3.org/1999/xhtml', 'html:script') :
- document.createElement('script');
- node.type = config.scriptType || 'text/javascript';
- node.charset = 'utf-8';
- node.async = true;
-
- node.setAttribute('data-requirecontext', context.contextName);
- node.setAttribute('data-requiremodule', moduleName);
-
- //Set up load listener. Test attachEvent first because IE9 has
- //a subtle issue in its addEventListener and script onload firings
- //that do not match the behavior of all other browsers with
- //addEventListener support, which fire the onload event for a
- //script right after the script execution. See:
- //https://connect.microsoft.com/IE/feedback/details/648057/script-onload-event-is-not-fired-immediately-after-script-execution
- //UNFORTUNATELY Opera implements attachEvent but does not follow the script
- //script execution mode.
- if (node.attachEvent &&
- //Check if node.attachEvent is artificially added by custom script or
- //natively supported by browser
- //read https://github.com/jrburke/requirejs/issues/187
- //if we can NOT find [native code] then it must NOT natively supported.
- //in IE8, node.attachEvent does not have toString()
- //Note the test for "[native code" with no closing brace, see:
- //https://github.com/jrburke/requirejs/issues/273
- !(node.attachEvent.toString && node.attachEvent.toString().indexOf('[native code') < 0) &&
- !isOpera) {
- //Probably IE. IE (at least 6-8) do not fire
- //script onload right after executing the script, so
- //we cannot tie the anonymous define call to a name.
- //However, IE reports the script as being in 'interactive'
- //readyState at the time of the define call.
- useInteractive = true;
-
- node.attachEvent('onreadystatechange', context.onScriptLoad);
- //It would be great to add an error handler here to catch
- //404s in IE9+. However, onreadystatechange will fire before
- //the error handler, so that does not help. If addEvenListener
- //is used, then IE will fire error before load, but we cannot
- //use that pathway given the connect.microsoft.com issue
- //mentioned above about not doing the 'script execute,
- //then fire the script load event listener before execute
- //next script' that other browsers do.
- //Best hope: IE10 fixes the issues,
- //and then destroys all installs of IE 6-9.
- //node.attachEvent('onerror', context.onScriptError);
- } else {
- node.addEventListener('load', context.onScriptLoad, false);
- node.addEventListener('error', context.onScriptError, false);
- }
- node.src = url;
-
- //For some cache cases in IE 6-8, the script executes before the end
- //of the appendChild execution, so to tie an anonymous define
- //call to the module name (which is stored on the node), hold on
- //to a reference to this node, but clear after the DOM insertion.
- currentlyAddingScript = node;
- if (baseElement) {
- head.insertBefore(node, baseElement);
- } else {
- head.appendChild(node);
- }
- currentlyAddingScript = null;
-
- return node;
- } else if (isWebWorker) {
- //In a web worker, use importScripts. This is not a very
- //efficient use of importScripts, importScripts will block until
- //its script is downloaded and evaluated. However, if web workers
- //are in play, the expectation that a build has been done so that
- //only one script needs to be loaded anyway. This may need to be
- //reevaluated if other use cases become common.
- importScripts(url);
-
- //Account for anonymous modules
- context.completeLoad(moduleName);
- }
- };
-
- function getInteractiveScript() {
- if (interactiveScript && interactiveScript.readyState === 'interactive') {
- return interactiveScript;
- }
-
- eachReverse(scripts(), function (script) {
- if (script.readyState === 'interactive') {
- return (interactiveScript = script);
- }
- });
- return interactiveScript;
- }
-
- //Look for a data-main script attribute, which could also adjust the baseUrl.
- if (isBrowser) {
- //Figure out baseUrl. Get it from the script tag with require.js in it.
- eachReverse(scripts(), function (script) {
- //Set the 'head' where we can append children by
- //using the script's parent.
- if (!head) {
- head = script.parentNode;
- }
-
- //Look for a data-main attribute to set main script for the page
- //to load. If it is there, the path to data main becomes the
- //baseUrl, if it is not already set.
- dataMain = script.getAttribute('data-main');
- if (dataMain) {
- //Set final baseUrl if there is not already an explicit one.
- if (!cfg.baseUrl) {
- //Pull off the directory of data-main for use as the
- //baseUrl.
- src = dataMain.split('/');
- mainScript = src.pop();
- subPath = src.length ? src.join('/') + '/' : './';
-
- cfg.baseUrl = subPath;
- dataMain = mainScript;
- }
-
- //Strip off any trailing .js since dataMain is now
- //like a module name.
- dataMain = dataMain.replace(jsSuffixRegExp, '');
-
- //Put the data-main script in the files to load.
- cfg.deps = cfg.deps ? cfg.deps.concat(dataMain) : [dataMain];
-
- return true;
- }
- });
- }
-
- /**
- * The function that handles definitions of modules. Differs from
- * require() in that a string for the module should be the first argument,
- * and the function to execute after dependencies are loaded should
- * return a value to define the module corresponding to the first argument's
- * name.
- */
- define = function (name, deps, callback) {
- var node, context;
-
- //Allow for anonymous functions
- if (typeof name !== 'string') {
- //Adjust args appropriately
- callback = deps;
- deps = name;
- name = null;
- }
-
- //This module may not have dependencies
- if (!isArray(deps)) {
- callback = deps;
- deps = [];
- }
-
- //If no name, and callback is a function, then figure out if it a
- //CommonJS thing with dependencies.
- if (!deps.length && isFunction(callback)) {
- //Remove comments from the callback string,
- //look for require calls, and pull them into the dependencies,
- //but only if there are function args.
- if (callback.length) {
- callback
- .toString()
- .replace(commentRegExp, '')
- .replace(cjsRequireRegExp, function (match, dep) {
- deps.push(dep);
- });
-
- //May be a CommonJS thing even without require calls, but still
- //could use exports, and module. Avoid doing exports and module
- //work though if it just needs require.
- //REQUIRES the function to expect the CommonJS variables in the
- //order listed below.
- deps = (callback.length === 1 ? ['require'] : ['require', 'exports', 'module']).concat(deps);
- }
- }
-
- //If in IE 6-8 and hit an anonymous define() call, do the interactive
- //work.
- if (useInteractive) {
- node = currentlyAddingScript || getInteractiveScript();
- if (node) {
- if (!name) {
- name = node.getAttribute('data-requiremodule');
- }
- context = contexts[node.getAttribute('data-requirecontext')];
- }
- }
-
- //Always save off evaluating the def call until the script onload handler.
- //This allows multiple modules to be in a file without prematurely
- //tracing dependencies, and allows for anonymous module support,
- //where the module name is not known until the script onload event
- //occurs. If no context, use the global queue, and get it processed
- //in the onscript load callback.
- (context ? context.defQueue : globalDefQueue).push([name, deps, callback]);
- };
-
- define.amd = {
- jQuery: true
- };
-
-
- /**
- * Executes the text. Normally just uses eval, but can be modified
- * to use a better, environment-specific call. Only used for transpiling
- * loader plugins, not for plain JS modules.
- * @param {String} text the text to execute/evaluate.
- */
- req.exec = function (text) {
- /*jslint evil: true */
- return eval(text);
- };
-
- //Set up with config info.
- req(cfg);
-}(this));
+++ /dev/null
-// Underscore.js 1.3.3
-// (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
-// Underscore is freely distributable under the MIT license.
-// Portions of Underscore are inspired or borrowed from Prototype,
-// Oliver Steele's Functional, and John Resig's Micro-Templating.
-// For all details and documentation:
-// http://documentcloud.github.com/underscore
-
-(function() {
-
- // Baseline setup
- // --------------
-
- // Establish the root object, `window` in the browser, or `global` on the server.
- var root = this;
-
- // Save the previous value of the `_` variable.
- var previousUnderscore = root._;
-
- // Establish the object that gets returned to break out of a loop iteration.
- var breaker = {};
-
- // Save bytes in the minified (but not gzipped) version:
- var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype;
-
- // Create quick reference variables for speed access to core prototypes.
- var slice = ArrayProto.slice,
- unshift = ArrayProto.unshift,
- toString = ObjProto.toString,
- hasOwnProperty = ObjProto.hasOwnProperty;
-
- // All **ECMAScript 5** native function implementations that we hope to use
- // are declared here.
- var
- nativeForEach = ArrayProto.forEach,
- nativeMap = ArrayProto.map,
- nativeReduce = ArrayProto.reduce,
- nativeReduceRight = ArrayProto.reduceRight,
- nativeFilter = ArrayProto.filter,
- nativeEvery = ArrayProto.every,
- nativeSome = ArrayProto.some,
- nativeIndexOf = ArrayProto.indexOf,
- nativeLastIndexOf = ArrayProto.lastIndexOf,
- nativeIsArray = Array.isArray,
- nativeKeys = Object.keys,
- nativeBind = FuncProto.bind;
-
- // Create a safe reference to the Underscore object for use below.
- var _ = function(obj) { return new wrapper(obj); };
-
- // Export the Underscore object for **Node.js**, with
- // backwards-compatibility for the old `require()` API. If we're in
- // the browser, add `_` as a global object via a string identifier,
- // for Closure Compiler "advanced" mode.
- if (typeof exports !== 'undefined') {
- if (typeof module !== 'undefined' && module.exports) {
- exports = module.exports = _;
- }
- exports._ = _;
- } else {
- root['_'] = _;
- }
-
- // Current version.
- _.VERSION = '1.3.3';
-
- // Collection Functions
- // --------------------
-
- // The cornerstone, an `each` implementation, aka `forEach`.
- // Handles objects with the built-in `forEach`, arrays, and raw objects.
- // Delegates to **ECMAScript 5**'s native `forEach` if available.
- var each = _.each = _.forEach = function(obj, iterator, context) {
- if (obj == null) return;
- if (nativeForEach && obj.forEach === nativeForEach) {
- obj.forEach(iterator, context);
- } else if (obj.length === +obj.length) {
- for (var i = 0, l = obj.length; i < l; i++) {
- if (i in obj && iterator.call(context, obj[i], i, obj) === breaker) return;
- }
- } else {
- for (var key in obj) {
- if (_.has(obj, key)) {
- if (iterator.call(context, obj[key], key, obj) === breaker) return;
- }
- }
- }
- };
-
- // Return the results of applying the iterator to each element.
- // Delegates to **ECMAScript 5**'s native `map` if available.
- _.map = _.collect = function(obj, iterator, context) {
- var results = [];
- if (obj == null) return results;
- if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context);
- each(obj, function(value, index, list) {
- results[results.length] = iterator.call(context, value, index, list);
- });
- if (obj.length === +obj.length) results.length = obj.length;
- return results;
- };
-
- // **Reduce** builds up a single result from a list of values, aka `inject`,
- // or `foldl`. Delegates to **ECMAScript 5**'s native `reduce` if available.
- _.reduce = _.foldl = _.inject = function(obj, iterator, memo, context) {
- var initial = arguments.length > 2;
- if (obj == null) obj = [];
- if (nativeReduce && obj.reduce === nativeReduce) {
- if (context) iterator = _.bind(iterator, context);
- return initial ? obj.reduce(iterator, memo) : obj.reduce(iterator);
- }
- each(obj, function(value, index, list) {
- if (!initial) {
- memo = value;
- initial = true;
- } else {
- memo = iterator.call(context, memo, value, index, list);
- }
- });
- if (!initial) throw new TypeError('Reduce of empty array with no initial value');
- return memo;
- };
-
- // The right-associative version of reduce, also known as `foldr`.
- // Delegates to **ECMAScript 5**'s native `reduceRight` if available.
- _.reduceRight = _.foldr = function(obj, iterator, memo, context) {
- var initial = arguments.length > 2;
- if (obj == null) obj = [];
- if (nativeReduceRight && obj.reduceRight === nativeReduceRight) {
- if (context) iterator = _.bind(iterator, context);
- return initial ? obj.reduceRight(iterator, memo) : obj.reduceRight(iterator);
- }
- var reversed = _.toArray(obj).reverse();
- if (context && !initial) iterator = _.bind(iterator, context);
- return initial ? _.reduce(reversed, iterator, memo, context) : _.reduce(reversed, iterator);
- };
-
- // Return the first value which passes a truth test. Aliased as `detect`.
- _.find = _.detect = function(obj, iterator, context) {
- var result;
- any(obj, function(value, index, list) {
- if (iterator.call(context, value, index, list)) {
- result = value;
- return true;
- }
- });
- return result;
- };
-
- // Return all the elements that pass a truth test.
- // Delegates to **ECMAScript 5**'s native `filter` if available.
- // Aliased as `select`.
- _.filter = _.select = function(obj, iterator, context) {
- var results = [];
- if (obj == null) return results;
- if (nativeFilter && obj.filter === nativeFilter) return obj.filter(iterator, context);
- each(obj, function(value, index, list) {
- if (iterator.call(context, value, index, list)) results[results.length] = value;
- });
- return results;
- };
-
- // Return all the elements for which a truth test fails.
- _.reject = function(obj, iterator, context) {
- var results = [];
- if (obj == null) return results;
- each(obj, function(value, index, list) {
- if (!iterator.call(context, value, index, list)) results[results.length] = value;
- });
- return results;
- };
-
- // Determine whether all of the elements match a truth test.
- // Delegates to **ECMAScript 5**'s native `every` if available.
- // Aliased as `all`.
- _.every = _.all = function(obj, iterator, context) {
- var result = true;
- if (obj == null) return result;
- if (nativeEvery && obj.every === nativeEvery) return obj.every(iterator, context);
- each(obj, function(value, index, list) {
- if (!(result = result && iterator.call(context, value, index, list))) return breaker;
- });
- return !!result;
- };
-
- // Determine if at least one element in the object matches a truth test.
- // Delegates to **ECMAScript 5**'s native `some` if available.
- // Aliased as `any`.
- var any = _.some = _.any = function(obj, iterator, context) {
- iterator || (iterator = _.identity);
- var result = false;
- if (obj == null) return result;
- if (nativeSome && obj.some === nativeSome) return obj.some(iterator, context);
- each(obj, function(value, index, list) {
- if (result || (result = iterator.call(context, value, index, list))) return breaker;
- });
- return !!result;
- };
-
- // Determine if a given value is included in the array or object using `===`.
- // Aliased as `contains`.
- _.include = _.contains = function(obj, target) {
- var found = false;
- if (obj == null) return found;
- if (nativeIndexOf && obj.indexOf === nativeIndexOf) return obj.indexOf(target) != -1;
- found = any(obj, function(value) {
- return value === target;
- });
- return found;
- };
-
- // Invoke a method (with arguments) on every item in a collection.
- _.invoke = function(obj, method) {
- var args = slice.call(arguments, 2);
- return _.map(obj, function(value) {
- return (_.isFunction(method) ? method || value : value[method]).apply(value, args);
- });
- };
-
- // Convenience version of a common use case of `map`: fetching a property.
- _.pluck = function(obj, key) {
- return _.map(obj, function(value){ return value[key]; });
- };
-
- // Return the maximum element or (element-based computation).
- _.max = function(obj, iterator, context) {
- if (!iterator && _.isArray(obj) && obj[0] === +obj[0]) return Math.max.apply(Math, obj);
- if (!iterator && _.isEmpty(obj)) return -Infinity;
- var result = {computed : -Infinity};
- each(obj, function(value, index, list) {
- var computed = iterator ? iterator.call(context, value, index, list) : value;
- computed >= result.computed && (result = {value : value, computed : computed});
- });
- return result.value;
- };
-
- // Return the minimum element (or element-based computation).
- _.min = function(obj, iterator, context) {
- if (!iterator && _.isArray(obj) && obj[0] === +obj[0]) return Math.min.apply(Math, obj);
- if (!iterator && _.isEmpty(obj)) return Infinity;
- var result = {computed : Infinity};
- each(obj, function(value, index, list) {
- var computed = iterator ? iterator.call(context, value, index, list) : value;
- computed < result.computed && (result = {value : value, computed : computed});
- });
- return result.value;
- };
-
- // Shuffle an array.
- _.shuffle = function(obj) {
- var shuffled = [], rand;
- each(obj, function(value, index, list) {
- rand = Math.floor(Math.random() * (index + 1));
- shuffled[index] = shuffled[rand];
- shuffled[rand] = value;
- });
- return shuffled;
- };
-
- // Sort the object's values by a criterion produced by an iterator.
- _.sortBy = function(obj, val, context) {
- var iterator = _.isFunction(val) ? val : function(obj) { return obj[val]; };
- return _.pluck(_.map(obj, function(value, index, list) {
- return {
- value : value,
- criteria : iterator.call(context, value, index, list)
- };
- }).sort(function(left, right) {
- var a = left.criteria, b = right.criteria;
- if (a === void 0) return 1;
- if (b === void 0) return -1;
- return a < b ? -1 : a > b ? 1 : 0;
- }), 'value');
- };
-
- // Groups the object's values by a criterion. Pass either a string attribute
- // to group by, or a function that returns the criterion.
- _.groupBy = function(obj, val) {
- var result = {};
- var iterator = _.isFunction(val) ? val : function(obj) { return obj[val]; };
- each(obj, function(value, index) {
- var key = iterator(value, index);
- (result[key] || (result[key] = [])).push(value);
- });
- return result;
- };
-
- // Use a comparator function to figure out at what index an object should
- // be inserted so as to maintain order. Uses binary search.
- _.sortedIndex = function(array, obj, iterator) {
- iterator || (iterator = _.identity);
- var low = 0, high = array.length;
- while (low < high) {
- var mid = (low + high) >> 1;
- iterator(array[mid]) < iterator(obj) ? low = mid + 1 : high = mid;
- }
- return low;
- };
-
- // Safely convert anything iterable into a real, live array.
- _.toArray = function(obj) {
- if (!obj) return [];
- if (_.isArray(obj)) return slice.call(obj);
- if (_.isArguments(obj)) return slice.call(obj);
- if (obj.toArray && _.isFunction(obj.toArray)) return obj.toArray();
- return _.values(obj);
- };
-
- // Return the number of elements in an object.
- _.size = function(obj) {
- return _.isArray(obj) ? obj.length : _.keys(obj).length;
- };
-
- // Array Functions
- // ---------------
-
- // Get the first element of an array. Passing **n** will return the first N
- // values in the array. Aliased as `head` and `take`. The **guard** check
- // allows it to work with `_.map`.
- _.first = _.head = _.take = function(array, n, guard) {
- return (n != null) && !guard ? slice.call(array, 0, n) : array[0];
- };
-
- // Returns everything but the last entry of the array. Especcialy useful on
- // the arguments object. Passing **n** will return all the values in
- // the array, excluding the last N. The **guard** check allows it to work with
- // `_.map`.
- _.initial = function(array, n, guard) {
- return slice.call(array, 0, array.length - ((n == null) || guard ? 1 : n));
- };
-
- // Get the last element of an array. Passing **n** will return the last N
- // values in the array. The **guard** check allows it to work with `_.map`.
- _.last = function(array, n, guard) {
- if ((n != null) && !guard) {
- return slice.call(array, Math.max(array.length - n, 0));
- } else {
- return array[array.length - 1];
- }
- };
-
- // Returns everything but the first entry of the array. Aliased as `tail`.
- // Especially useful on the arguments object. Passing an **index** will return
- // the rest of the values in the array from that index onward. The **guard**
- // check allows it to work with `_.map`.
- _.rest = _.tail = function(array, index, guard) {
- return slice.call(array, (index == null) || guard ? 1 : index);
- };
-
- // Trim out all falsy values from an array.
- _.compact = function(array) {
- return _.filter(array, function(value){ return !!value; });
- };
-
- // Return a completely flattened version of an array.
- _.flatten = function(array, shallow) {
- return _.reduce(array, function(memo, value) {
- if (_.isArray(value)) return memo.concat(shallow ? value : _.flatten(value));
- memo[memo.length] = value;
- return memo;
- }, []);
- };
-
- // Return a version of the array that does not contain the specified value(s).
- _.without = function(array) {
- return _.difference(array, slice.call(arguments, 1));
- };
-
- // Produce a duplicate-free version of the array. If the array has already
- // been sorted, you have the option of using a faster algorithm.
- // Aliased as `unique`.
- _.uniq = _.unique = function(array, isSorted, iterator) {
- var initial = iterator ? _.map(array, iterator) : array;
- var results = [];
- // The `isSorted` flag is irrelevant if the array only contains two elements.
- if (array.length < 3) isSorted = true;
- _.reduce(initial, function (memo, value, index) {
- if (isSorted ? _.last(memo) !== value || !memo.length : !_.include(memo, value)) {
- memo.push(value);
- results.push(array[index]);
- }
- return memo;
- }, []);
- return results;
- };
-
- // Produce an array that contains the union: each distinct element from all of
- // the passed-in arrays.
- _.union = function() {
- return _.uniq(_.flatten(arguments, true));
- };
-
- // Produce an array that contains every item shared between all the
- // passed-in arrays. (Aliased as "intersect" for back-compat.)
- _.intersection = _.intersect = function(array) {
- var rest = slice.call(arguments, 1);
- return _.filter(_.uniq(array), function(item) {
- return _.every(rest, function(other) {
- return _.indexOf(other, item) >= 0;
- });
- });
- };
-
- // Take the difference between one array and a number of other arrays.
- // Only the elements present in just the first array will remain.
- _.difference = function(array) {
- var rest = _.flatten(slice.call(arguments, 1), true);
- return _.filter(array, function(value){ return !_.include(rest, value); });
- };
-
- // Zip together multiple lists into a single array -- elements that share
- // an index go together.
- _.zip = function() {
- var args = slice.call(arguments);
- var length = _.max(_.pluck(args, 'length'));
- var results = new Array(length);
- for (var i = 0; i < length; i++) results[i] = _.pluck(args, "" + i);
- return results;
- };
-
- // If the browser doesn't supply us with indexOf (I'm looking at you, **MSIE**),
- // we need this function. Return the position of the first occurrence of an
- // item in an array, or -1 if the item is not included in the array.
- // Delegates to **ECMAScript 5**'s native `indexOf` if available.
- // If the array is large and already in sort order, pass `true`
- // for **isSorted** to use binary search.
- _.indexOf = function(array, item, isSorted) {
- if (array == null) return -1;
- var i, l;
- if (isSorted) {
- i = _.sortedIndex(array, item);
- return array[i] === item ? i : -1;
- }
- if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item);
- for (i = 0, l = array.length; i < l; i++) if (i in array && array[i] === item) return i;
- return -1;
- };
-
- // Delegates to **ECMAScript 5**'s native `lastIndexOf` if available.
- _.lastIndexOf = function(array, item) {
- if (array == null) return -1;
- if (nativeLastIndexOf && array.lastIndexOf === nativeLastIndexOf) return array.lastIndexOf(item);
- var i = array.length;
- while (i--) if (i in array && array[i] === item) return i;
- return -1;
- };
-
- // Generate an integer Array containing an arithmetic progression. A port of
- // the native Python `range()` function. See
- // [the Python documentation](http://docs.python.org/library/functions.html#range).
- _.range = function(start, stop, step) {
- if (arguments.length <= 1) {
- stop = start || 0;
- start = 0;
- }
- step = arguments[2] || 1;
-
- var len = Math.max(Math.ceil((stop - start) / step), 0);
- var idx = 0;
- var range = new Array(len);
-
- while(idx < len) {
- range[idx++] = start;
- start += step;
- }
-
- return range;
- };
-
- // Function (ahem) Functions
- // ------------------
-
- // Reusable constructor function for prototype setting.
- var ctor = function(){};
-
- // Create a function bound to a given object (assigning `this`, and arguments,
- // optionally). Binding with arguments is also known as `curry`.
- // Delegates to **ECMAScript 5**'s native `Function.bind` if available.
- // We check for `func.bind` first, to fail fast when `func` is undefined.
- _.bind = function bind(func, context) {
- var bound, args;
- if (func.bind === nativeBind && nativeBind) return nativeBind.apply(func, slice.call(arguments, 1));
- if (!_.isFunction(func)) throw new TypeError;
- args = slice.call(arguments, 2);
- return bound = function() {
- if (!(this instanceof bound)) return func.apply(context, args.concat(slice.call(arguments)));
- ctor.prototype = func.prototype;
- var self = new ctor;
- var result = func.apply(self, args.concat(slice.call(arguments)));
- if (Object(result) === result) return result;
- return self;
- };
- };
-
- // Bind all of an object's methods to that object. Useful for ensuring that
- // all callbacks defined on an object belong to it.
- _.bindAll = function(obj) {
- var funcs = slice.call(arguments, 1);
- if (funcs.length == 0) funcs = _.functions(obj);
- each(funcs, function(f) { obj[f] = _.bind(obj[f], obj); });
- return obj;
- };
-
- // Memoize an expensive function by storing its results.
- _.memoize = function(func, hasher) {
- var memo = {};
- hasher || (hasher = _.identity);
- return function() {
- var key = hasher.apply(this, arguments);
- return _.has(memo, key) ? memo[key] : (memo[key] = func.apply(this, arguments));
- };
- };
-
- // Delays a function for the given number of milliseconds, and then calls
- // it with the arguments supplied.
- _.delay = function(func, wait) {
- var args = slice.call(arguments, 2);
- return setTimeout(function(){ return func.apply(null, args); }, wait);
- };
-
- // Defers a function, scheduling it to run after the current call stack has
- // cleared.
- _.defer = function(func) {
- return _.delay.apply(_, [func, 1].concat(slice.call(arguments, 1)));
- };
-
- // Returns a function, that, when invoked, will only be triggered at most once
- // during a given window of time.
- _.throttle = function(func, wait) {
- var context, args, timeout, throttling, more, result;
- var whenDone = _.debounce(function(){ more = throttling = false; }, wait);
- return function() {
- context = this; args = arguments;
- var later = function() {
- timeout = null;
- if (more) func.apply(context, args);
- whenDone();
- };
- if (!timeout) timeout = setTimeout(later, wait);
- if (throttling) {
- more = true;
- } else {
- result = func.apply(context, args);
- }
- whenDone();
- throttling = true;
- return result;
- };
- };
-
- // Returns a function, that, as long as it continues to be invoked, will not
- // be triggered. The function will be called after it stops being called for
- // N milliseconds. If `immediate` is passed, trigger the function on the
- // leading edge, instead of the trailing.
- _.debounce = function(func, wait, immediate) {
- var timeout;
- return function() {
- var context = this, args = arguments;
- var later = function() {
- timeout = null;
- if (!immediate) func.apply(context, args);
- };
- if (immediate && !timeout) func.apply(context, args);
- clearTimeout(timeout);
- timeout = setTimeout(later, wait);
- };
- };
-
- // Returns a function that will be executed at most one time, no matter how
- // often you call it. Useful for lazy initialization.
- _.once = function(func) {
- var ran = false, memo;
- return function() {
- if (ran) return memo;
- ran = true;
- return memo = func.apply(this, arguments);
- };
- };
-
- // Returns the first function passed as an argument to the second,
- // allowing you to adjust arguments, run code before and after, and
- // conditionally execute the original function.
- _.wrap = function(func, wrapper) {
- return function() {
- var args = [func].concat(slice.call(arguments, 0));
- return wrapper.apply(this, args);
- };
- };
-
- // Returns a function that is the composition of a list of functions, each
- // consuming the return value of the function that follows.
- _.compose = function() {
- var funcs = arguments;
- return function() {
- var args = arguments;
- for (var i = funcs.length - 1; i >= 0; i--) {
- args = [funcs[i].apply(this, args)];
- }
- return args[0];
- };
- };
-
- // Returns a function that will only be executed after being called N times.
- _.after = function(times, func) {
- if (times <= 0) return func();
- return function() {
- if (--times < 1) { return func.apply(this, arguments); }
- };
- };
-
- // Object Functions
- // ----------------
-
- // Retrieve the names of an object's properties.
- // Delegates to **ECMAScript 5**'s native `Object.keys`
- _.keys = nativeKeys || function(obj) {
- if (obj !== Object(obj)) throw new TypeError('Invalid object');
- var keys = [];
- for (var key in obj) if (_.has(obj, key)) keys[keys.length] = key;
- return keys;
- };
-
- // Retrieve the values of an object's properties.
- _.values = function(obj) {
- return _.map(obj, _.identity);
- };
-
- // Return a sorted list of the function names available on the object.
- // Aliased as `methods`
- _.functions = _.methods = function(obj) {
- var names = [];
- for (var key in obj) {
- if (_.isFunction(obj[key])) names.push(key);
- }
- return names.sort();
- };
-
- // Extend a given object with all the properties in passed-in object(s).
- _.extend = function(obj) {
- each(slice.call(arguments, 1), function(source) {
- for (var prop in source) {
- obj[prop] = source[prop];
- }
- });
- return obj;
- };
-
- // Return a copy of the object only containing the whitelisted properties.
- _.pick = function(obj) {
- var result = {};
- each(_.flatten(slice.call(arguments, 1)), function(key) {
- if (key in obj) result[key] = obj[key];
- });
- return result;
- };
-
- // Fill in a given object with default properties.
- _.defaults = function(obj) {
- each(slice.call(arguments, 1), function(source) {
- for (var prop in source) {
- if (obj[prop] == null) obj[prop] = source[prop];
- }
- });
- return obj;
- };
-
- // Create a (shallow-cloned) duplicate of an object.
- _.clone = function(obj) {
- if (!_.isObject(obj)) return obj;
- return _.isArray(obj) ? obj.slice() : _.extend({}, obj);
- };
-
- // Invokes interceptor with the obj, and then returns obj.
- // The primary purpose of this method is to "tap into" a method chain, in
- // order to perform operations on intermediate results within the chain.
- _.tap = function(obj, interceptor) {
- interceptor(obj);
- return obj;
- };
-
- // Internal recursive comparison function.
- function eq(a, b, stack) {
- // Identical objects are equal. `0 === -0`, but they aren't identical.
- // See the Harmony `egal` proposal: http://wiki.ecmascript.org/doku.php?id=harmony:egal.
- if (a === b) return a !== 0 || 1 / a == 1 / b;
- // A strict comparison is necessary because `null == undefined`.
- if (a == null || b == null) return a === b;
- // Unwrap any wrapped objects.
- if (a._chain) a = a._wrapped;
- if (b._chain) b = b._wrapped;
- // Invoke a custom `isEqual` method if one is provided.
- if (a.isEqual && _.isFunction(a.isEqual)) return a.isEqual(b);
- if (b.isEqual && _.isFunction(b.isEqual)) return b.isEqual(a);
- // Compare `[[Class]]` names.
- var className = toString.call(a);
- if (className != toString.call(b)) return false;
- switch (className) {
- // Strings, numbers, dates, and booleans are compared by value.
- case '[object String]':
- // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
- // equivalent to `new String("5")`.
- return a == String(b);
- case '[object Number]':
- // `NaN`s are equivalent, but non-reflexive. An `egal` comparison is performed for
- // other numeric values.
- return a != +a ? b != +b : (a == 0 ? 1 / a == 1 / b : a == +b);
- case '[object Date]':
- case '[object Boolean]':
- // Coerce dates and booleans to numeric primitive values. Dates are compared by their
- // millisecond representations. Note that invalid dates with millisecond representations
- // of `NaN` are not equivalent.
- return +a == +b;
- // RegExps are compared by their source patterns and flags.
- case '[object RegExp]':
- return a.source == b.source &&
- a.global == b.global &&
- a.multiline == b.multiline &&
- a.ignoreCase == b.ignoreCase;
- }
- if (typeof a != 'object' || typeof b != 'object') return false;
- // Assume equality for cyclic structures. The algorithm for detecting cyclic
- // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
- var length = stack.length;
- while (length--) {
- // Linear search. Performance is inversely proportional to the number of
- // unique nested structures.
- if (stack[length] == a) return true;
- }
- // Add the first object to the stack of traversed objects.
- stack.push(a);
- var size = 0, result = true;
- // Recursively compare objects and arrays.
- if (className == '[object Array]') {
- // Compare array lengths to determine if a deep comparison is necessary.
- size = a.length;
- result = size == b.length;
- if (result) {
- // Deep compare the contents, ignoring non-numeric properties.
- while (size--) {
- // Ensure commutative equality for sparse arrays.
- if (!(result = size in a == size in b && eq(a[size], b[size], stack))) break;
- }
- }
- } else {
- // Objects with different constructors are not equivalent.
- if ('constructor' in a != 'constructor' in b || a.constructor != b.constructor) return false;
- // Deep compare objects.
- for (var key in a) {
- if (_.has(a, key)) {
- // Count the expected number of properties.
- size++;
- // Deep compare each member.
- if (!(result = _.has(b, key) && eq(a[key], b[key], stack))) break;
- }
- }
- // Ensure that both objects contain the same number of properties.
- if (result) {
- for (key in b) {
- if (_.has(b, key) && !(size--)) break;
- }
- result = !size;
- }
- }
- // Remove the first object from the stack of traversed objects.
- stack.pop();
- return result;
- }
-
- // Perform a deep comparison to check if two objects are equal.
- _.isEqual = function(a, b) {
- return eq(a, b, []);
- };
-
- // Is a given array, string, or object empty?
- // An "empty" object has no enumerable own-properties.
- _.isEmpty = function(obj) {
- if (obj == null) return true;
- if (_.isArray(obj) || _.isString(obj)) return obj.length === 0;
- for (var key in obj) if (_.has(obj, key)) return false;
- return true;
- };
-
- // Is a given value a DOM element?
- _.isElement = function(obj) {
- return !!(obj && obj.nodeType == 1);
- };
-
- // Is a given value an array?
- // Delegates to ECMA5's native Array.isArray
- _.isArray = nativeIsArray || function(obj) {
- return toString.call(obj) == '[object Array]';
- };
-
- // Is a given variable an object?
- _.isObject = function(obj) {
- return obj === Object(obj);
- };
-
- // Is a given variable an arguments object?
- _.isArguments = function(obj) {
- return toString.call(obj) == '[object Arguments]';
- };
- if (!_.isArguments(arguments)) {
- _.isArguments = function(obj) {
- return !!(obj && _.has(obj, 'callee'));
- };
- }
-
- // Is a given value a function?
- _.isFunction = function(obj) {
- return toString.call(obj) == '[object Function]';
- };
-
- // Is a given value a string?
- _.isString = function(obj) {
- return toString.call(obj) == '[object String]';
- };
-
- // Is a given value a number?
- _.isNumber = function(obj) {
- return toString.call(obj) == '[object Number]';
- };
-
- // Is a given object a finite number?
- _.isFinite = function(obj) {
- return _.isNumber(obj) && isFinite(obj);
- };
-
- // Is the given value `NaN`?
- _.isNaN = function(obj) {
- // `NaN` is the only value for which `===` is not reflexive.
- return obj !== obj;
- };
-
- // Is a given value a boolean?
- _.isBoolean = function(obj) {
- return obj === true || obj === false || toString.call(obj) == '[object Boolean]';
- };
-
- // Is a given value a date?
- _.isDate = function(obj) {
- return toString.call(obj) == '[object Date]';
- };
-
- // Is the given value a regular expression?
- _.isRegExp = function(obj) {
- return toString.call(obj) == '[object RegExp]';
- };
-
- // Is a given value equal to null?
- _.isNull = function(obj) {
- return obj === null;
- };
-
- // Is a given variable undefined?
- _.isUndefined = function(obj) {
- return obj === void 0;
- };
-
- // Has own property?
- _.has = function(obj, key) {
- return hasOwnProperty.call(obj, key);
- };
-
- // Utility Functions
- // -----------------
-
- // Run Underscore.js in *noConflict* mode, returning the `_` variable to its
- // previous owner. Returns a reference to the Underscore object.
- _.noConflict = function() {
- root._ = previousUnderscore;
- return this;
- };
-
- // Keep the identity function around for default iterators.
- _.identity = function(value) {
- return value;
- };
-
- // Run a function **n** times.
- _.times = function (n, iterator, context) {
- for (var i = 0; i < n; i++) iterator.call(context, i);
- };
-
- // Escape a string for HTML interpolation.
- _.escape = function(string) {
- return (''+string).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, ''').replace(/\//g,'/');
- };
-
- // If the value of the named property is a function then invoke it;
- // otherwise, return it.
- _.result = function(object, property) {
- if (object == null) return null;
- var value = object[property];
- return _.isFunction(value) ? value.call(object) : value;
- };
-
- // Add your own custom functions to the Underscore object, ensuring that
- // they're correctly added to the OOP wrapper as well.
- _.mixin = function(obj) {
- each(_.functions(obj), function(name){
- addToWrapper(name, _[name] = obj[name]);
- });
- };
-
- // Generate a unique integer id (unique within the entire client session).
- // Useful for temporary DOM ids.
- var idCounter = 0;
- _.uniqueId = function(prefix) {
- var id = idCounter++;
- return prefix ? prefix + id : id;
- };
-
- // By default, Underscore uses ERB-style template delimiters, change the
- // following template settings to use alternative delimiters.
- _.templateSettings = {
- evaluate : /<%([\s\S]+?)%>/g,
- interpolate : /<%=([\s\S]+?)%>/g,
- escape : /<%-([\s\S]+?)%>/g
- };
-
- // When customizing `templateSettings`, if you don't want to define an
- // interpolation, evaluation or escaping regex, we need one that is
- // guaranteed not to match.
- var noMatch = /.^/;
-
- // Certain characters need to be escaped so that they can be put into a
- // string literal.
- var escapes = {
- '\\': '\\',
- "'": "'",
- 'r': '\r',
- 'n': '\n',
- 't': '\t',
- 'u2028': '\u2028',
- 'u2029': '\u2029'
- };
-
- for (var p in escapes) escapes[escapes[p]] = p;
- var escaper = /\\|'|\r|\n|\t|\u2028|\u2029/g;
- var unescaper = /\\(\\|'|r|n|t|u2028|u2029)/g;
-
- // Within an interpolation, evaluation, or escaping, remove HTML escaping
- // that had been previously added.
- var unescape = function(code) {
- return code.replace(unescaper, function(match, escape) {
- return escapes[escape];
- });
- };
-
- // JavaScript micro-templating, similar to John Resig's implementation.
- // Underscore templating handles arbitrary delimiters, preserves whitespace,
- // and correctly escapes quotes within interpolated code.
- _.template = function(text, data, settings) {
- settings = _.defaults(settings || {}, _.templateSettings);
-
- // Compile the template source, taking care to escape characters that
- // cannot be included in a string literal and then unescape them in code
- // blocks.
- var source = "__p+='" + text
- .replace(escaper, function(match) {
- return '\\' + escapes[match];
- })
- .replace(settings.escape || noMatch, function(match, code) {
- return "'+\n_.escape(" + unescape(code) + ")+\n'";
- })
- .replace(settings.interpolate || noMatch, function(match, code) {
- return "'+\n(" + unescape(code) + ")+\n'";
- })
- .replace(settings.evaluate || noMatch, function(match, code) {
- return "';\n" + unescape(code) + "\n;__p+='";
- }) + "';\n";
-
- // If a variable is not specified, place data values in local scope.
- if (!settings.variable) source = 'with(obj||{}){\n' + source + '}\n';
-
- source = "var __p='';" +
- "var print=function(){__p+=Array.prototype.join.call(arguments, '')};\n" +
- source + "return __p;\n";
-
- var render = new Function(settings.variable || 'obj', '_', source);
- if (data) return render(data, _);
- var template = function(data) {
- return render.call(this, data, _);
- };
-
- // Provide the compiled function source as a convenience for build time
- // precompilation.
- template.source = 'function(' + (settings.variable || 'obj') + '){\n' +
- source + '}';
-
- return template;
- };
-
- // Add a "chain" function, which will delegate to the wrapper.
- _.chain = function(obj) {
- return _(obj).chain();
- };
-
- // The OOP Wrapper
- // ---------------
-
- // If Underscore is called as a function, it returns a wrapped object that
- // can be used OO-style. This wrapper holds altered versions of all the
- // underscore functions. Wrapped objects may be chained.
- var wrapper = function(obj) { this._wrapped = obj; };
-
- // Expose `wrapper.prototype` as `_.prototype`
- _.prototype = wrapper.prototype;
-
- // Helper function to continue chaining intermediate results.
- var result = function(obj, chain) {
- return chain ? _(obj).chain() : obj;
- };
-
- // A method to easily add functions to the OOP wrapper.
- var addToWrapper = function(name, func) {
- wrapper.prototype[name] = function() {
- var args = slice.call(arguments);
- unshift.call(args, this._wrapped);
- return result(func.apply(_, args), this._chain);
- };
- };
-
- // Add all of the Underscore functions to the wrapper object.
- _.mixin(_);
-
- // Add all mutator Array functions to the wrapper.
- each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {
- var method = ArrayProto[name];
- wrapper.prototype[name] = function() {
- var wrapped = this._wrapped;
- method.apply(wrapped, arguments);
- var length = wrapped.length;
- if ((name == 'shift' || name == 'splice') && length === 0) delete wrapped[0];
- return result(wrapped, this._chain);
- };
- });
-
- // Add all accessor Array functions to the wrapper.
- each(['concat', 'join', 'slice'], function(name) {
- var method = ArrayProto[name];
- wrapper.prototype[name] = function() {
- return result(method.apply(this._wrapped, arguments), this._chain);
- };
- });
-
- // Start chaining a wrapped Underscore object.
- wrapper.prototype.chain = function() {
- this._chain = true;
- return this;
- };
-
- // Extracts the result from a wrapped and chained object.
- wrapper.prototype.value = function() {
- return this._wrapped;
- };
-
-}).call(this);
+++ /dev/null
-SET GLOBAL max_allowed_packet = 1024 * 1024 * 128;\r
-SET SESSION max_allowed_packet = 1024 * 1024 * 128;\r
-\r
-CREATE DATABASE TIZEN;\r
-\r
-CREATE USER 'tizen'@'localhost' IDENTIFIED BY 'tizen';\r
-\r
-GRANT ALL PRIVILEGES ON tizen.* TO tizen@localhost \r
-IDENTIFIED BY 'tizen' WITH GRANT OPTION;\r
-\r
-FLUSH PRIVILEGES;\r
-\r
-CREATE TABLE `USER` (\r
- username VARCHAR( 64 ),\r
- password VARCHAR( 128 ),\r
- email VARCHAR( 64 )\r
-);\r
-\r
-\r
-CREATE TABLE `GROUP` (\r
- id VARCHAR( 64 ),\r
- name VARCHAR( 64 ),\r
- owner VARCHAR( 64 )\r
-);\r
-\r
-CREATE TABLE `USER_GROUP_MAPPING` (\r
- username VARCHAR( 64 ),\r
- group_id VARCHAR( 64 )\r
-);\r
-\r
-CREATE TABLE `FILE` (\r
- id VARCHAR( 64 ),\r
- name VARCHAR( 64 ),\r
- owner VARCHAR( 64 ),\r
- mime VARCHAR( 64 ),\r
- contents MEDIUMBLOB\r
-);\r
-select * from FILE\r
-\r
-CREATE TABLE `TEMPLATE` (\r
- id VARCHAR( 64 ),\r
- name VARCHAR( 64 ),\r
- email VARCHAR( 64 ),\r
- description VARCHAR( 4000 ),\r
- uploaded_date DATETIME,\r
- binary_id VARCHAR( 64 )\r
-);\r
-\r
-CREATE TABLE DOWNLOAD (\r
- id varchar( 64 ),\r
- target varchar( 64 ),\r
- download_time DATETIME\r
-) \r
-\r
-DROP TABLE DOWNLOAD\r
-DROP TABLE TEMPLATE\r
-Select * from template\r
-select * from download\r
-ALTER TABLE TEMPLATE DROP COLUMN downloads\r
-select * from File\r
-delete from template where name is null\r
-\r
-select max( template0_.id ), template0_.name as col_0_0_ from Template template0_ \r
-group by template0_.name\r
-\r
-\r
-CREATE TABLE `PUBLICATION` (\r
- template_id VARCHAR( 64 ),\r
- `range` VARCHAR( 64 )\r
-);\r
-\r
-INSERT INTO `USER` ( username, password, email ) VALUES\r
-( 'bylee', 'bylee', 'bonyong.lee@samsung.com' );\r
-\r
-INSERT INTO `GROUP` ( id, name, owner ) VALUES\r
-( 'aa', 'Tizen IDE development group', 'bylee' );\r
-\r
-INSERT INTO USER_GROUP_MAPPING ( username, group_id ) VALUES\r
-( 'bylee', 'aa' );\r
-\r
-INSERT INTO TEMPLATE_INFO ( name, parent, description, owner, tags ) VALUES\r
-( 'tizen-empty2.0', null, 'Empty project for tizen 2.0', 'bylee', 'tizen,2.0,empty,simple' );\r
-\r
-INSERT INTO TEMPLATE ( id, info_name, uploaded_date, tags, `binary` ) VALUES\r
-( 'aaaa', 'tizen-empty2.0', NOW(), 'temporary,initial', 'bbbb' );\r
-\r
-select template0_.id as id2_, template0_.binary_id as binary2_2_, template0_.downloads as downloads2_, template0_.name as name2_, template0_.uploaded_date as uploaded5_2_ from Template template0_ where template0_.id in (select max(template1_.id) from Template template1_ group by template1_.name)\r
-\r
-\r
-SELECT date_format( d.download_date, '%Y%m%d' ), COUNT( d.download_date ) FROM DOWNLOAD d\r
-GROUP BY date_format( d.download_date, '%Y%m%d' )\r
+++ /dev/null
-package org.tizen.common.verrari.server.controller;\r
-\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-\r
-public class AbstractController\r
-{\r
- protected final Logger logger = LoggerFactory.getLogger( getClass() );\r
-\r
-}\r
+++ /dev/null
-package org.tizen.common.verrari.server.controller;\r
-\r
-import java.io.IOException;\r
-import java.text.MessageFormat;\r
-\r
-import javax.servlet.http.HttpServletResponse;\r
-\r
-import org.springframework.beans.factory.annotation.Autowired;\r
-import org.springframework.stereotype.Controller;\r
-import org.springframework.web.bind.annotation.PathVariable;\r
-import org.springframework.web.bind.annotation.RequestMapping;\r
-import org.tizen.common.verrari.server.model.Binary;\r
-import org.tizen.common.verrari.server.service.BinaryService;\r
-\r
-@Controller\r
-public class\r
-BinaryController\r
-{\r
- protected static final String CONTENT_TYPE = "application/octet-stream";\r
- \r
- protected static final String FORMAT_DISPOSITION = "attachment; fileName=\"{0}\"";\r
- \r
- @Autowired\r
- protected BinaryService binarySvc;\r
- \r
- @RequestMapping( "/binary/{id}" )\r
- public\r
- void\r
- download(\r
- @PathVariable( "id" ) final String binaryId,\r
- HttpServletResponse res\r
- )\r
- throws IOException\r
- {\r
- final Binary binary = binarySvc.getBinary( binaryId );\r
- if ( null == binary )\r
- {\r
- res.setStatus( HttpServletResponse.SC_NOT_FOUND );\r
- return ;\r
- }\r
- \r
- final String fileName = binary.getName();\r
- byte[] bytes = binary.getContents();\r
- res.setContentType( CONTENT_TYPE );\r
- res.setContentLength( bytes.length );\r
- res.setHeader( "Content-Disposition", MessageFormat.format( FORMAT_DISPOSITION, fileName ) );\r
- res.setHeader( "Content-Transfer-Encoding", "binary" );\r
- res.getOutputStream().write( bytes );\r
- res.getOutputStream().flush();\r
- }\r
-\r
-}\r
+++ /dev/null
-package org.tizen.common.verrari.server.controller;\r
-\r
-import static org.tizen.common.util.IOUtil.getBytes;\r
-\r
-import java.io.IOException;\r
-import java.util.HashMap;\r
-import java.util.Map;\r
-\r
-import javax.servlet.ServletContext;\r
-import javax.servlet.http.HttpServletRequest;\r
-import javax.servlet.http.HttpServletResponse;\r
-\r
-import org.springframework.stereotype.Controller;\r
-import org.springframework.web.bind.annotation.RequestMapping;\r
-import org.springframework.web.bind.annotation.RequestMethod;\r
-import org.springframework.web.bind.annotation.ResponseBody;\r
-\r
-@Controller\r
-public class RealmController\r
-{\r
- protected byte[] realmBytes = null;\r
- \r
- @RequestMapping( value = "/realm", method = RequestMethod.GET )\r
- public\r
- @ResponseBody\r
- Map<String, String>\r
- getRealmInfo()\r
- {\r
- final HashMap<String, String> map = new HashMap<String, String>();\r
- map.put( "id", "tizen-standard-realm" );\r
- map.put( "loader", "http://localhost:8080/realm.jar" );\r
- map.put( "template-query-url", "http://localhost:8080/template/${id}" );\r
- map.put( "category-query-url", "http://localhost:8080/category/${category}" );\r
- \r
- return map;\r
- }\r
- \r
- @RequestMapping( value = "/realm.jar", method = RequestMethod.GET )\r
- public\r
- void\r
- getRealm(\r
- HttpServletRequest req,\r
- HttpServletResponse res\r
- ) throws IOException\r
- {\r
- if ( null == realmBytes )\r
- {\r
- synchronized ( this )\r
- {\r
- if ( null == realmBytes )\r
- {\r
- final ServletContext context = req.getSession().getServletContext();\r
- realmBytes =\r
- getBytes( context.getResourceAsStream("/WEB-INF/lib/realm.jar" ), true );\r
- }\r
- }\r
- }\r
- res.getOutputStream().write( realmBytes );\r
- res.getOutputStream().flush();\r
- }\r
-\r
-}\r
+++ /dev/null
-package org.tizen.common.verrari.server.controller;\r
-\r
-import java.util.List;\r
-\r
-import org.apache.lucene.store.Directory;\r
-import org.springframework.stereotype.Controller;\r
-import org.springframework.web.bind.annotation.RequestMapping;\r
-import org.tizen.common.verrari.server.model.Template;\r
-\r
-@Controller\r
-public class\r
-SearchController\r
-{\r
- protected Directory directory;\r
- \r
- @RequestMapping\r
- public\r
- List<Template>\r
- search(\r
- final String keyword\r
- )\r
- {\r
- return null;\r
- }\r
-\r
-}\r
+++ /dev/null
-package org.tizen.common.verrari.server.controller;\r
-\r
-import static org.springframework.web.bind.annotation.RequestMethod.GET;\r
-import static org.springframework.web.bind.annotation.RequestMethod.POST;\r
-\r
-import java.io.IOException;\r
-import java.text.MessageFormat;\r
-import java.util.Collection;\r
-\r
-import javax.servlet.http.HttpServletResponse;\r
-\r
-import org.springframework.beans.factory.annotation.Autowired;\r
-import org.springframework.stereotype.Controller;\r
-import org.springframework.validation.BindingResult;\r
-import org.springframework.web.bind.annotation.PathVariable;\r
-import org.springframework.web.bind.annotation.RequestMapping;\r
-import org.springframework.web.bind.annotation.RequestParam;\r
-import org.springframework.web.bind.annotation.ResponseBody;\r
-import org.tizen.common.verrari.server.model.ActionStatus;\r
-import org.tizen.common.verrari.server.model.Binary;\r
-import org.tizen.common.verrari.server.model.Template;\r
-import org.tizen.common.verrari.server.service.TemplateService;\r
-\r
-\r
-@Controller\r
-public class\r
-TemplateController\r
-extends AbstractController\r
-{\r
- protected static final String CONTENT_TYPE = "application/octet-stream";\r
- \r
- protected static final String FORMAT_DISPOSITION = "attachment; fileName=\"{0}\"";\r
-\r
- @Autowired\r
- protected TemplateService templateSvc;\r
-\r
- @RequestMapping( value = "/templates", method = GET )\r
- public\r
- @ResponseBody\r
- Collection<Template>\r
- listTemplateInfo(\r
- @RequestParam( value = "order", required = false ) final String order,\r
- @RequestParam( value = "start", required = false ) final String start\r
- )\r
- {\r
- logger.trace( "Order :{}, Start :{}", order, start );\r
- return templateSvc.listTemplatesOrderByRecent( start );\r
- }\r
- \r
- @RequestMapping( value = "/template-info/{name:.+}", method = GET )\r
- public\r
- @ResponseBody\r
- Template\r
- getTemplateInformation(\r
- @PathVariable( "name" ) final String id\r
- )\r
- {\r
- logger.trace( "Template name :{}", id );\r
- \r
- return templateSvc.getTemplate( id );\r
- }\r
- \r
- @RequestMapping( value = "/template", method = GET )\r
- public\r
- @ResponseBody\r
- Collection<Template>\r
- listTemplate(\r
- @RequestParam( "order" ) final String order\r
- )\r
- {\r
- return null;\r
- }\r
-\r
- @RequestMapping( value = "/template/{name:.+}", method = GET )\r
- public\r
- void\r
- getTemplate(\r
- @PathVariable( "name" ) final String templateName,\r
- HttpServletResponse res\r
- )\r
- throws IOException\r
- {\r
- \r
- final Binary binary = templateSvc.getTemplateBinary( templateName );\r
- \r
- final String fileName = binary.getName();\r
- byte[] bytes = binary.getContents();\r
- res.setContentType( CONTENT_TYPE );\r
- res.setContentLength( bytes.length );\r
- res.setHeader( "Content-Disposition", MessageFormat.format( FORMAT_DISPOSITION, fileName ) );\r
- res.setHeader( "Content-Transfer-Encoding", "binary" );\r
- res.getOutputStream().write( bytes );\r
- res.getOutputStream().flush();\r
-\r
- }\r
- \r
- @RequestMapping( value = "/template", method = POST )\r
- public\r
- @ResponseBody\r
- ActionStatus\r
- uploadTemplate(\r
- @RequestParam( value = "email", required = false ) final String email,\r
- @RequestParam( value = "description", required = false ) final String description,\r
- final Binary binary,\r
- final BindingResult bindingResult\r
- )\r
- {\r
- logger.trace( "Email :{}, Tags :{}", email, description );\r
- logger.trace( "File :{}", binary );\r
- \r
- try\r
- {\r
- templateSvc.update( email, description, binary );\r
- \r
- return new ActionStatus();\r
- \r
- } catch ( final Throwable e )\r
- {\r
- return new ActionStatus( "error", e.getMessage() );\r
- }\r
- \r
- }\r
-}\r
+++ /dev/null
-package org.tizen.common.verrari.server.dao;\r
-\r
-import java.io.Serializable;\r
-import java.util.ArrayList;\r
-import java.util.Date;\r
-import java.util.List;\r
-\r
-import org.hibernate.Query;\r
-import org.hibernate.Session;\r
-import org.hibernate.SessionFactory;\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-import org.tizen.common.FactoryWithArgument;\r
-\r
-\r
-public class\r
-AbstractDao\r
-{\r
- protected static final int LIMIT = 5;\r
-\r
- protected final Logger logger = LoggerFactory.getLogger( getClass() );\r
-\r
- protected SessionFactory sessionFactory;\r
-\r
- protected FactoryWithArgument<String, Object> idGenerator;\r
- \r
- protected final String entityName;\r
- \r
- protected int limit = LIMIT;\r
- \r
- public AbstractDao() {\r
- final String className = getClass().getName();\r
- this.entityName = className.substring( 0, className.length() - 3 );\r
- }\r
- \r
- public\r
- AbstractDao(\r
- final Class<?> type\r
- )\r
- {\r
- this( type.getName() );\r
- }\r
- \r
- public\r
- AbstractDao(\r
- final String entityName\r
- )\r
- {\r
- this.entityName = entityName;\r
- }\r
- \r
- protected\r
- String\r
- getEntityName()\r
- {\r
- return entityName;\r
- }\r
- \r
- public\r
- void\r
- setSessionFactory(\r
- final SessionFactory sessionFactory\r
- )\r
- {\r
- this.sessionFactory = sessionFactory;\r
- }\r
-\r
- protected\r
- Session\r
- getSession()\r
- {\r
- return sessionFactory.getCurrentSession();\r
- }\r
-\r
- public\r
- FactoryWithArgument<String, Object>\r
- getIdGenerator()\r
- {\r
- return idGenerator;\r
- }\r
-\r
- public\r
- void\r
- setIdGenerator(\r
- final FactoryWithArgument<String, Object> idGenerator\r
- )\r
- {\r
- this.idGenerator = idGenerator;\r
- }\r
-\r
- protected\r
- String\r
- generateId(\r
- final Object obj\r
- )\r
- {\r
- return idGenerator.create( obj );\r
- }\r
-\r
- protected\r
- int\r
- getLimit()\r
- {\r
- return limit;\r
- }\r
- \r
- public\r
- void\r
- setLimit(\r
- final int limit\r
- )\r
- {\r
- this.limit = limit;\r
- }\r
-\r
- public\r
- void\r
- insert(\r
- final Object obj\r
- )\r
- {\r
- logger.trace( "Insert {}", obj );\r
- getSession().persist( obj );\r
- getSession().save( obj );\r
- }\r
-\r
- public\r
- void\r
- update(\r
- final Object obj\r
- )\r
- {\r
- getSession().update( obj );\r
- getSession().save( obj );\r
- }\r
- \r
- public\r
- int\r
- update(\r
- final String queryStr,\r
- final Object... args\r
- )\r
- {\r
- Session session = getSession();\r
- session.flush();\r
- final Query query = session.createQuery( queryStr );\r
- bind( query, args );\r
- return query.executeUpdate();\r
- }\r
-\r
- public\r
- void\r
- delete(\r
- final Object obj\r
- )\r
- {\r
- getSession().delete( obj );\r
- getSession().flush();\r
- getSession().evict( obj );\r
- }\r
-\r
- public\r
- int\r
- delete(\r
- final String queryStr,\r
- final Object... args\r
- )\r
- {\r
- Session session = getSession();\r
- session.flush();\r
- final Query query = session.createQuery( queryStr );\r
- bind( query, args );\r
- return query.executeUpdate();\r
- }\r
-\r
- public <T>\r
- T\r
- get(\r
- final Class<?> clazz,\r
- final Serializable id\r
- )\r
- {\r
- return get( clazz.getName(), id );\r
- }\r
- \r
- @SuppressWarnings("unchecked")\r
- public <T>\r
- T\r
- get(\r
- final String entityName,\r
- final Serializable id\r
- )\r
- {\r
- logger.trace( "Get {} from {}", id, entityName );\r
- getSession().flush();\r
- T ret = (T) getSession().get( entityName, id );\r
- logger.debug( "Result for {} :{}", id, ret );\r
- return ret;\r
- }\r
- \r
- @SuppressWarnings("unchecked")\r
- public <T>\r
- T\r
- get( final Serializable id )\r
- {\r
- return (T) get( getEntityName(), id );\r
- }\r
-\r
- public <T>\r
- boolean\r
- exists(\r
- final String entityName,\r
- final Serializable id\r
- )\r
- {\r
- final T t = get( entityName, id );\r
- if ( null != t )\r
- {\r
- return true;\r
- }\r
-\r
- return false;\r
- }\r
-\r
- protected\r
- List<?>\r
- find(\r
- final String queryStr,\r
- final Object... args\r
- )\r
- {\r
- Session session = getSession();\r
- session.flush();\r
- final Query query = session.createQuery( queryStr );\r
- bind( query, args );\r
- if ( 0 < getLimit() )\r
- {\r
- query.setMaxResults( getLimit() );\r
- }\r
- return query.list();\r
- }\r
-\r
- @SuppressWarnings("unchecked")\r
- protected <T>\r
- T\r
- findOne(\r
- final String queryStr,\r
- final Object... args\r
- )\r
- {\r
- getSession().flush();\r
- final Query query = getSession().createQuery( queryStr );\r
- bind( query, args );\r
- return (T) query.uniqueResult();\r
- }\r
-\r
- @SuppressWarnings("unchecked")\r
- protected static <T>\r
- List<T>\r
- extract(\r
- final List<Object[]> inputs,\r
- final int index\r
- )\r
- {\r
- final List<T> ret = new ArrayList<T>();\r
-\r
- for ( final Object[] input : inputs )\r
- {\r
- ret.add( (T) input[index] );\r
- }\r
-\r
- return ret;\r
- }\r
-\r
-\r
-\r
- protected\r
- void\r
- bind(\r
- final Query query,\r
- final Object... args\r
- )\r
- {\r
- for ( int i = 0, n = args.length ; i<n ; ++i )\r
- {\r
- final Object arg = args[i];\r
- logger.debug( "Arg {} : {}", new Object[] { i, (args[i]==null)?null:args[i].getClass() } );\r
- if ( arg instanceof String )\r
- {\r
- query.setString( i, (String) args[i] );\r
- }\r
- else if ( arg instanceof Date )\r
- {\r
- query.setDate( i, (Date) args[i] );\r
- }\r
- else\r
- {\r
- throw new IllegalArgumentException();\r
- }\r
- }\r
-\r
- }\r
-}\r
+++ /dev/null
-package org.tizen.common.verrari.server.dao;\r
-\r
-import org.springframework.stereotype.Repository;\r
-import org.tizen.common.verrari.server.model.Binary;\r
-\r
-@Repository\r
-public class\r
-BinaryDao\r
-extends CommonDao\r
-{\r
- \r
- public\r
- BinaryDao()\r
- {\r
- super( Binary.class );\r
- }\r
- \r
- public\r
- void\r
- insertBinary(\r
- final Binary binary\r
- )\r
- {\r
- binary.setId( generateId( binary ) );\r
- insert( binary );\r
- }\r
- \r
- public\r
- Binary\r
- getBinary(\r
- final String binaryId\r
- )\r
- {\r
- return get( binaryId );\r
- }\r
-\r
-}\r
+++ /dev/null
-package org.tizen.common.verrari.server.dao;\r
-\r
-import org.hibernate.Session;\r
-import org.hibernate.SessionFactory;\r
-import org.springframework.beans.factory.annotation.Autowired;\r
-import org.tizen.common.FactoryWithArgument;\r
-\r
-public class\r
-CommonDao\r
-extends AbstractDao\r
-{\r
- public CommonDao() {\r
- super();\r
- }\r
- \r
- public\r
- CommonDao( final Class<?> clazz )\r
- {\r
- super( clazz );\r
- }\r
- \r
- @Autowired( required = false )\r
- @Override\r
- public void setIdGenerator(\r
- final FactoryWithArgument<String, Object> idGenerator\r
- )\r
- {\r
- super.setIdGenerator( idGenerator );\r
- }\r
- \r
- @Autowired( required = true )\r
- @Override\r
- public void setSessionFactory(\r
- final SessionFactory sessionFactory\r
- )\r
- {\r
- super.setSessionFactory( sessionFactory );\r
- }\r
-\r
- public\r
- Session\r
- getSession()\r
- {\r
- return this.sessionFactory.getCurrentSession();\r
- }\r
-}\r
+++ /dev/null
-package org.tizen.common.verrari.server.dao;\r
-\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Date;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.TreeMap;\r
-\r
-import org.springframework.stereotype.Repository;\r
-import org.tizen.common.util.ObjectUtil;\r
-import org.tizen.common.verrari.server.model.DownloadHistory;\r
-import org.tizen.common.verrari.server.model.DownloadStatisticsUnit;\r
-\r
-@Repository\r
-public class\r
-DownloadDao\r
-extends CommonDao\r
-{\r
- \r
- protected static final long SECOND = 1000;\r
- \r
- protected static final long MINUTE = 60 * SECOND;\r
- \r
- protected static final long HOUR = 60 * MINUTE;\r
- \r
- protected static final long DAY = 24 * HOUR;\r
-\r
- public\r
- DownloadDao()\r
- {\r
- super( DownloadHistory.class );\r
- }\r
- \r
- public\r
- void\r
- insertDownloadHistory(\r
- final DownloadHistory history\r
- )\r
- {\r
- history.setId( generateId( history ) );\r
- insert( history );\r
- }\r
- \r
- @SuppressWarnings({ "unchecked", "deprecation" })\r
- public\r
- List<DownloadStatisticsUnit>\r
- statisticsForWeek(\r
- final String target\r
- )\r
- {\r
- final Date now = new Date();\r
- final Date start = new Date( now.getTime() - 6 * DAY );\r
- \r
- start.setSeconds( 0 );\r
- start.setMinutes( 0 );\r
- start.setHours( 0 );\r
- \r
- final List<Object[]> values = (List<Object[]>) find(\r
- "SELECT COUNT( * ) FROM DownloadHistory d " +\r
- "WHERE d.downloadTime > ? d.target = ? " +\r
- "GROUP BY date_format( d.downloadTime, '%Y%m%d' )",\r
- start, target\r
- );\r
- \r
-// final List<Object[]> values = (List<Object[]>) find(\r
-// "SELECT TO_CHAR( d.downloadTime, 'YYYY MONTH DAY' ), COUNT( d.downloadTime ) FROM DownloadHistory d " +\r
-// "WHERE d.downloadTime > ? AND d.target = ? " +\r
-// "GROUP BY TO_CHAR( d.downloadTime, 'YYYY MONTH DAY' )",\r
-// start, target\r
-// );\r
- \r
- final TreeMap<String, Long> date2downloads = new TreeMap<String, Long>();\r
- for ( final Object[] value : values )\r
- {\r
- date2downloads.put( (String) value[0], (Long) value[1] );\r
- }\r
- \r
- final ArrayList<DownloadStatisticsUnit> ret = new ArrayList<DownloadStatisticsUnit>();\r
- Date iter = start;\r
- SimpleDateFormat format = new SimpleDateFormat( "yyyy MM dd" );\r
- for ( int i = 0 ; i < 7 ; ++i )\r
- {\r
- iter = new Date( iter.getTime() + DAY );\r
- \r
- final String dateStr = format.format( iter );\r
- final long value = ObjectUtil.nvl( date2downloads.get( dateStr ), (Long) 0L ) ;\r
- \r
- ret.add( new DownloadStatisticsUnit( dateStr, value ) );\r
- }\r
- \r
- \r
- return ret;\r
- }\r
-\r
- @SuppressWarnings("unchecked")\r
- public\r
- Map<String, Long>\r
- getDownloadInfos()\r
- {\r
- final List<Object[]> values = (List<Object[]>) find(\r
- "SELECT d.target, COUNT( d.target ) " +\r
- "FROM DownloadHistory d GROUP BY d.target"\r
- );\r
- \r
- final HashMap<String, Long> ret = new HashMap<String, Long>();\r
-\r
- \r
- for ( Object[] value : values )\r
- {\r
- ret.put( (String) value[0], (Long) value[1] );\r
- }\r
- return ret;\r
- }\r
-\r
-}\r
+++ /dev/null
-package org.tizen.common.verrari.server.dao;\r
-\r
-import java.util.List;\r
-\r
-import org.springframework.stereotype.Repository;\r
-import org.tizen.common.verrari.server.model.Template;\r
-\r
-@Repository\r
-public class\r
-TemplateDao\r
-extends CommonDao\r
-{\r
- \r
- public\r
- TemplateDao()\r
- {\r
- super( Template.class );\r
- setLimit( -1 );\r
- }\r
- \r
- public\r
- void\r
- insertTemplate(\r
- final Template template\r
- )\r
- {\r
- template.setId( generateId( template ) );\r
- insert( template );\r
- }\r
- \r
- public\r
- Template\r
- getTemplateWith( final String name )\r
- {\r
- return findOne(\r
- "FROM Template t1 " +\r
- "WHERE t1.id in ( SELECT MAX( t2.id ) FROM Template t2 WHERE t2.name = ? ) ",\r
- name\r
- );\r
- }\r
-\r
- @SuppressWarnings("unchecked")\r
- public\r
- List<Template> \r
- listByRecent()\r
- {\r
- return (List<Template>) find(\r
- "FROM Template t1 " +\r
- "WHERE t1.id in ( SELECT MAX( t2.id ) FROM Template t2 GROUP BY t2.name ) " +\r
- "ORDER BY t1.id DESC"\r
- );\r
- }\r
- @SuppressWarnings("unchecked")\r
- public\r
- List<Template> \r
- listByRecent( final String start )\r
- {\r
- return (List<Template>) find(\r
- "FROM Template t1 " +\r
- "WHERE t1.id in ( SELECT MAX( t2.id ) FROM Template t2 GROUP BY t2.name ) AND t1.id < ? " +\r
- "ORDER BY t1.id DESC",\r
- start\r
- );\r
- }\r
- \r
-}\r
+++ /dev/null
-package org.tizen.common.verrari.server.model;\r
-\r
-public class ActionStatus\r
-{\r
- protected String status;\r
- \r
- protected String details;\r
- \r
- public ActionStatus()\r
- {\r
- this( "success" );\r
- }\r
- \r
- public\r
- ActionStatus(\r
- final String status\r
- )\r
- {\r
- this( status, null );\r
- }\r
- \r
- public\r
- ActionStatus(\r
- final String status,\r
- final String details\r
- )\r
- {\r
- this.status = status;\r
- this.details = details;\r
- }\r
- \r
- public\r
- String\r
- getStatus()\r
- {\r
- return this.status;\r
- }\r
- \r
- public\r
- void\r
- setStatus(\r
- final String status\r
- )\r
- {\r
- this.status = status;\r
- }\r
- \r
- \r
- public\r
- String\r
- getDetails()\r
- {\r
- return this.details;\r
- }\r
- \r
- public\r
- void\r
- setDetails(\r
- final String details\r
- )\r
- {\r
- this.details = details;\r
- }\r
-\r
-}\r
+++ /dev/null
-package org.tizen.common.verrari.server.model;\r
-\r
-import javax.persistence.Access;\r
-import javax.persistence.AccessType;\r
-import javax.persistence.Entity;\r
-import javax.persistence.Id;\r
-import javax.persistence.Transient;\r
-\r
-import org.codehaus.jackson.annotate.JsonIgnore;\r
-import org.springframework.web.multipart.commons.CommonsMultipartFile;\r
-\r
-@Entity( name = "FILE" )\r
-@Access( AccessType.PROPERTY )\r
-public class\r
-Binary\r
-{\r
- protected String id;\r
- \r
- protected String name;\r
- \r
- protected String owner;\r
- \r
- protected String mime;\r
- \r
- @JsonIgnore\r
- protected byte[] contents;\r
- \r
- @JsonIgnore\r
- protected CommonsMultipartFile uploadFile;\r
-\r
- @Id\r
- public String getId()\r
- {\r
- return id;\r
- }\r
-\r
- public void setId(String id)\r
- {\r
- this.id = id;\r
- }\r
-\r
- public String getName()\r
- {\r
- if ( null != name )\r
- {\r
- return name;\r
- }\r
- \r
- if ( null == uploadFile )\r
- {\r
- return null;\r
- }\r
- \r
- return name = uploadFile.getOriginalFilename();\r
- }\r
-\r
- public void setName(String name)\r
- {\r
- this.name = name;\r
- }\r
-\r
- public String getOwner()\r
- {\r
- return owner;\r
- }\r
-\r
- public void setOwner(String owner)\r
- {\r
- this.owner = owner;\r
- }\r
-\r
- public String getMime()\r
- {\r
- if ( null != mime )\r
- {\r
- return mime;\r
- }\r
- \r
- if ( null == uploadFile )\r
- {\r
- return null;\r
- }\r
- \r
- return mime = uploadFile.getContentType();\r
- }\r
-\r
- public void setMime(String mime)\r
- {\r
- this.mime = mime;\r
- }\r
-\r
- public byte[] getContents()\r
- {\r
- if ( null != contents )\r
- {\r
- return contents;\r
- }\r
- if ( null == uploadFile )\r
- {\r
- return null;\r
- }\r
- \r
- return contents = uploadFile.getBytes();\r
- }\r
-\r
- public void setContents(byte[] contents)\r
- {\r
- this.contents = contents;\r
- }\r
-\r
- @Transient\r
- public CommonsMultipartFile getUploadFile()\r
- {\r
- return uploadFile;\r
- }\r
-\r
- public void setUploadFile(\r
- final CommonsMultipartFile uploadFile\r
- )\r
- {\r
- this.uploadFile = uploadFile;\r
- }\r
-\r
- @Override\r
- public String toString()\r
- {\r
- return getName() + "[" + getMime() + "]" + ((null==uploadFile)?"":"(" + uploadFile.getSize() + ")");\r
- }\r
-}\r
+++ /dev/null
-package org.tizen.common.verrari.server.model;\r
-\r
-import java.util.Date;\r
-\r
-import javax.persistence.Column;\r
-import javax.persistence.Entity;\r
-import javax.persistence.Id;\r
-import javax.persistence.Table;\r
-\r
-@Entity\r
-@Table( name = "DOWNLOAD" )\r
-public class\r
-DownloadHistory\r
-{\r
- @Id\r
- protected String id;\r
- \r
- protected String target;\r
- \r
- @Column( name = "download_time" )\r
- protected Date downloadTime;\r
- \r
- public\r
- DownloadHistory()\r
- {\r
- }\r
- \r
- public\r
- DownloadHistory(\r
- final String target\r
- )\r
- {\r
- this( target, new Date() );\r
- }\r
- \r
- public\r
- DownloadHistory(\r
- final String target,\r
- final Date downloadTime\r
- )\r
- {\r
- this( null, target, downloadTime );\r
- }\r
- \r
- public\r
- DownloadHistory(\r
- final String id,\r
- final String target,\r
- final Date downloadTime\r
- )\r
- {\r
- this.id = id;\r
- this.target = target;\r
- this.downloadTime = downloadTime;\r
- }\r
-\r
- public String getId()\r
- {\r
- return id;\r
- }\r
-\r
- public void setId(String id)\r
- {\r
- this.id = id;\r
- }\r
-\r
- public String getTarget()\r
- {\r
- return target;\r
- }\r
-\r
- public void setTarget(String target)\r
- {\r
- this.target = target;\r
- }\r
-\r
- public Date getDownloadTime()\r
- {\r
- return downloadTime;\r
- }\r
-\r
- public void setDownloadTime(Date downloadTime)\r
- {\r
- this.downloadTime = downloadTime;\r
- }\r
- \r
- \r
-\r
-}\r
+++ /dev/null
-package org.tizen.common.verrari.server.model;\r
-\r
-public class DownloadStatistics\r
-{\r
-\r
-}\r
+++ /dev/null
-package org.tizen.common.verrari.server.model;\r
-\r
-public class DownloadStatisticsUnit\r
-{\r
- protected String name;\r
- \r
- protected long value;\r
- \r
- public DownloadStatisticsUnit() {}\r
- public DownloadStatisticsUnit(\r
- final String name,\r
- final long value\r
- )\r
- {\r
- this.name = name;\r
- this.value = value;\r
- }\r
- \r
- public String getName()\r
- {\r
- return this.name;\r
- }\r
- \r
- public void setName( final String name )\r
- {\r
- this.name = name;\r
- }\r
- \r
- public long getValue()\r
- {\r
- return this.value;\r
- }\r
- \r
- public void setValue( final long value )\r
- {\r
- this.value = value;\r
- }\r
- \r
- \r
-\r
-}\r
+++ /dev/null
-package org.tizen.common.verrari.server.model;\r
-\r
-import java.util.Date;\r
-\r
-import javax.persistence.Column;\r
-import javax.persistence.Entity;\r
-import javax.persistence.Id;\r
-import javax.persistence.Transient;\r
-\r
-import org.codehaus.jackson.map.annotate.JsonSerialize;\r
-import org.tizen.common.verrari.server.util.DateTimeSerializer;\r
-\r
-@Entity\r
-public class\r
-Template\r
-{\r
- @Id\r
- protected String id;\r
- \r
- protected String name;\r
- \r
- protected String email;\r
- \r
- @Column( name = "uploaded_date" )\r
- @JsonSerialize( using = DateTimeSerializer.class )\r
- protected Date uploadedDate;\r
- \r
- protected String description;\r
- \r
- @Column( name = "binary_id" )\r
- protected String binary;\r
-\r
- @Transient\r
- protected long downloads;\r
-\r
- public\r
- String\r
- getId()\r
- {\r
- return id;\r
- }\r
-\r
- public\r
- void\r
- setId(\r
- final String id\r
- )\r
- {\r
- this.id = id;\r
- }\r
-\r
- public\r
- String\r
- getName()\r
- {\r
- return name;\r
- }\r
-\r
- public\r
- void\r
- setName(\r
- final String name\r
- )\r
- {\r
- this.name = name;\r
- }\r
- \r
- public\r
- String\r
- getEmail()\r
- {\r
- return this.email;\r
- }\r
- \r
- public\r
- void\r
- setEmail( final String email )\r
- {\r
- this.email = email;\r
- }\r
-\r
- public Date getUploadedDate()\r
- {\r
- return uploadedDate;\r
- }\r
-\r
- public void setUploadedDate(Date uploadedDate)\r
- {\r
- this.uploadedDate = uploadedDate;\r
- }\r
- \r
- public\r
- String\r
- getDescription() \r
- {\r
- return this.description;\r
- }\r
- \r
- public\r
- void\r
- setDescription(\r
- final String description\r
- )\r
- {\r
- this.description = description;\r
- }\r
-\r
- public String getBinary()\r
- {\r
- return binary;\r
- }\r
-\r
- public void setBinary(String binary)\r
- {\r
- this.binary = binary;\r
- }\r
- \r
- public long getDownloads()\r
- {\r
- return this.downloads;\r
- }\r
-\r
- public void setDownloads(\r
- final long downloads\r
- )\r
- {\r
- this.downloads = downloads;\r
- }\r
- \r
-}\r
+++ /dev/null
-package org.tizen.common.verrari.server.service;\r
-\r
-import org.springframework.beans.factory.annotation.Autowired;\r
-import org.springframework.stereotype.Service;\r
-import org.tizen.common.verrari.server.dao.BinaryDao;\r
-import org.tizen.common.verrari.server.model.Binary;\r
-\r
-@Service\r
-public class\r
-BinaryService\r
-{\r
- @Autowired\r
- protected BinaryDao binaryDao;\r
- \r
- public\r
- Binary\r
- getBinary(\r
- final String binaryId\r
- )\r
- {\r
- return this.binaryDao.getBinary( binaryId );\r
- }\r
-\r
-}\r
+++ /dev/null
-package org.tizen.common.verrari.server.service;\r
-\r
-import java.io.IOException;\r
-\r
-import org.apache.lucene.document.Document;\r
-import org.apache.lucene.index.IndexWriter;\r
-import org.apache.lucene.index.Term;\r
-import org.apache.lucene.search.IndexSearcher;\r
-import org.apache.lucene.search.Query;\r
-import org.apache.lucene.search.ScoreDoc;\r
-import org.apache.lucene.search.Sort;\r
-import org.apache.lucene.search.SortField;\r
-import org.apache.lucene.store.Directory;\r
-import org.springframework.stereotype.Service;\r
-\r
-@Service\r
-public class\r
-SearchService\r
-{\r
- protected Directory directory;\r
- \r
- protected IndexWriter indexWriter;\r
- \r
- protected IndexSearcher indexSearcher;\r
- \r
- public\r
- void\r
- setDirectory(\r
- Directory directory\r
- )\r
- {\r
- this.directory = directory;\r
- }\r
- \r
- public\r
- void\r
- setIndexWriter(\r
- final IndexWriter indexWriter\r
- )\r
- {\r
- this.indexWriter = indexWriter;\r
- }\r
- \r
- public\r
- void\r
- setIndexSearcher(\r
- final IndexSearcher indexSearcher\r
- )\r
- {\r
- this.indexSearcher = indexSearcher;\r
- }\r
- \r
- public void add( Document doc )\r
- {\r
- \r
- }\r
- \r
- public void update( Term term, Document doc )\r
- {\r
- \r
- }\r
- \r
- public\r
- void\r
- search(\r
- final String q,\r
- final String contentFieldName,\r
- final SortField sortField\r
- )\r
- throws IOException\r
- {\r
- final IndexSearcher activeSearcher = indexSearcher;\r
- \r
- ScoreDoc[] hits = new ScoreDoc[0];\r
- \r
- Sort sort = new Sort( sortField );\r
- \r
- Query query = null;\r
- hits = activeSearcher.search( query, null, 1000, sort ).scoreDocs;\r
- \r
- \r
- }\r
-\r
-}\r
+++ /dev/null
-package org.tizen.common.verrari.server.service;\r
-\r
-import static org.tizen.common.util.IOUtil.tryClose;\r
-import static org.tizen.common.util.StringUtil.isEmpty;\r
-\r
-import java.io.ByteArrayInputStream;\r
-import java.io.IOException;\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.Date;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.jar.Attributes;\r
-import java.util.jar.JarInputStream;\r
-import java.util.jar.Manifest;\r
-\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-import org.springframework.beans.factory.annotation.Autowired;\r
-import org.springframework.stereotype.Service;\r
-import org.tizen.common.verrari.server.dao.BinaryDao;\r
-import org.tizen.common.verrari.server.dao.DownloadDao;\r
-import org.tizen.common.verrari.server.dao.TemplateDao;\r
-import org.tizen.common.verrari.server.model.Binary;\r
-import org.tizen.common.verrari.server.model.DownloadHistory;\r
-import org.tizen.common.verrari.server.model.Template;\r
-import org.tizen.common.verrari.template.ITemplateConstants;\r
-\r
-@Service\r
-public class\r
-TemplateService\r
-{\r
-\r
- protected final Logger logger = LoggerFactory.getLogger( getClass() );\r
- \r
- @Autowired\r
- protected BinaryDao binaryDao;\r
- \r
- @Autowired\r
- protected TemplateDao templateDao;\r
- \r
- @Autowired\r
- protected DownloadDao downloadDao;\r
- \r
- public Collection<Template> listTemplates()\r
- {\r
- return new ArrayList<Template>();\r
- }\r
- \r
- protected List<Template> addDownloadInfo( List<Template> templates )\r
- {\r
- Map<String, Long> infos = downloadDao.getDownloadInfos();\r
- \r
- for ( final Template template : templates )\r
- {\r
- final Long nDownloads = infos.get( template.getName() );\r
- \r
- if ( null == nDownloads )\r
- {\r
- continue;\r
- }\r
- \r
- template.setDownloads( nDownloads );\r
- }\r
- \r
- return templates;\r
- }\r
- \r
- public List<Template> listTemplatesOrderByRecent( final String start )\r
- {\r
- if ( isEmpty( start ) )\r
- {\r
- return addDownloadInfo( templateDao.listByRecent() );\r
- }\r
- else\r
- {\r
- return addDownloadInfo( templateDao.listByRecent( start ) );\r
- }\r
- }\r
- \r
- \r
- public\r
- void\r
- update(\r
- final String email,\r
- final String description,\r
- final Binary binary\r
- )\r
- throws IOException\r
- {\r
- final ByteArrayInputStream byteIn = new ByteArrayInputStream( binary.getContents() );\r
- final JarInputStream jarIn = new JarInputStream( byteIn );\r
- \r
- try\r
- {\r
- final Manifest manifest = jarIn.getManifest();\r
- \r
- final Template template = new Template();\r
- \r
- final Attributes attributes = manifest.getMainAttributes();\r
- final String templateName = attributes.getValue( ITemplateConstants.ATTR_NAME );\r
- if ( null == templateName )\r
- {\r
- throw new IOException( "No template name" );\r
- }\r
- \r
- // save binary\r
- binaryDao.insertBinary( binary );\r
- \r
- template.setName( templateName );\r
- template.setEmail( email );\r
- template.setUploadedDate( new Date() );\r
- template.setDescription( description );\r
- template.setBinary( binary.getId() );\r
- \r
- templateDao.insertTemplate( template );\r
- }\r
- finally\r
- {\r
- tryClose( jarIn );\r
- }\r
- \r
- }\r
-\r
- public\r
- Binary\r
- getTemplateBinary(\r
- final String templateName\r
- )\r
- {\r
- final Template template = templateDao.getTemplateWith( templateName );\r
- \r
- if ( null == template )\r
- {\r
- return null;\r
- }\r
- \r
- final Binary binary = binaryDao.getBinary( template.getBinary() );\r
- \r
- if ( null == binary )\r
- {\r
- return null;\r
- }\r
- \r
- downloadDao.insertDownloadHistory( new DownloadHistory( template.getName() ) );\r
- \r
- return binary;\r
- }\r
-\r
- public\r
- Template\r
- getTemplate( final String id )\r
- {\r
- return templateDao.get( id );\r
- }\r
-}\r
+++ /dev/null
-package org.tizen.common.verrari.server.servlet;\r
-\r
-import java.util.HashMap;\r
-import java.util.Map;\r
-\r
-import org.hibernate.Session;\r
-import org.hibernate.SessionFactory;\r
-\r
-public class SessionHolder {\r
- protected ThreadLocal<Map<SessionFactory, Session>> cabinet = new ThreadLocal<Map<SessionFactory,Session>>();\r
- \r
- public\r
- boolean\r
- isBound(\r
- final SessionFactory factory\r
- )\r
- {\r
- final Map<SessionFactory, Session> map = cabinet.get();\r
- if ( null == map )\r
- {\r
- return false;\r
- }\r
- return map.containsKey( factory );\r
- }\r
- \r
- public\r
- void\r
- bind(\r
- final SessionFactory factory,\r
- final Session session\r
- )\r
- {\r
- Map<SessionFactory, Session> map = cabinet.get();\r
- if ( null == map )\r
- {\r
- map = new HashMap<SessionFactory, Session>();\r
- cabinet.set( map );\r
- }\r
- \r
- map.put( factory, session );\r
- }\r
- \r
- public\r
- Session\r
- unbind(\r
- final SessionFactory factory\r
- )\r
- {\r
- final Map<SessionFactory, Session> map = cabinet.get();\r
- if ( null == map )\r
- {\r
- return null;\r
- }\r
- \r
- final Session session = map.remove( factory );\r
- if ( map.isEmpty() )\r
- {\r
- cabinet.remove();\r
- }\r
- \r
- return session;\r
- }\r
-\r
-}\r
+++ /dev/null
-package org.tizen.common.verrari.server.servlet;\r
-\r
-import java.io.IOException;\r
-\r
-import javax.servlet.FilterChain;\r
-import javax.servlet.ServletException;\r
-import javax.servlet.http.HttpServletRequest;\r
-import javax.servlet.http.HttpServletResponse;\r
-\r
-import org.hibernate.SessionFactory;\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-import org.springframework.orm.hibernate4.support.OpenSessionInViewFilter;\r
-\r
-public class\r
-SessionInViewFilter\r
-extends OpenSessionInViewFilter\r
-{\r
- protected final Logger logger = LoggerFactory.getLogger( getClass() );\r
- \r
- class FilterRun\r
- {\r
- protected final HttpServletRequest request;\r
- protected final HttpServletResponse response;\r
- protected final FilterChain filterChain;\r
- \r
- public FilterRun(\r
- final HttpServletRequest request,\r
- final HttpServletResponse response,\r
- final FilterChain filterChain\r
- )\r
- {\r
- this.request = request;\r
- this.response = response;\r
- this.filterChain = filterChain;\r
- }\r
-\r
- public void run() throws IOException, ServletException {\r
- filterChain.doFilter( request, response );\r
- }\r
- }\r
- \r
- class\r
- SessionTemplateAdaptor\r
- extends SpringSessionTemplate\r
- {\r
- final ThreadLocal<FilterRun> chain = new ThreadLocal<FilterRun>();\r
-\r
- @Override\r
- protected void process() throws Exception {\r
- chain.get().run();\r
- }\r
- \r
- @Override\r
- protected\r
- SessionFactory\r
- lookupSessionFactory()\r
- {\r
- return SessionInViewFilter.this.lookupSessionFactory();\r
- }\r
-\r
- public\r
- void\r
- run(\r
- final HttpServletRequest request,\r
- final HttpServletResponse response,\r
- final FilterChain filterChain\r
- )\r
- throws ServletException, IOException\r
- {\r
- chain.set( new FilterRun( request, response, filterChain ) );\r
- try\r
- {\r
- run();\r
- }\r
- catch ( Exception e )\r
- {\r
- if ( e instanceof ServletException )\r
- {\r
- throw (ServletException) e;\r
- }\r
- else if ( e instanceof IOException )\r
- {\r
- throw (IOException) e;\r
- }\r
- else if ( e instanceof RuntimeException )\r
- {\r
- throw (RuntimeException) e;\r
- }\r
- }\r
- finally\r
- {\r
- chain.remove();\r
- }\r
- \r
- };\r
-\r
- }\r
- \r
- protected SessionTemplateAdaptor sessionTemplate = new SessionTemplateAdaptor();\r
- \r
- protected\r
- void\r
- doFilterInternal(\r
- final HttpServletRequest request,\r
- final HttpServletResponse response,\r
- final FilterChain filterChain\r
- )\r
- throws ServletException, IOException\r
- {\r
- sessionTemplate.run( request, response, filterChain );\r
- }\r
-}\r
+++ /dev/null
-package org.tizen.common.verrari.server.servlet;\r
-\r
-import java.util.Map;\r
-\r
-import org.hibernate.FlushMode;\r
-import org.hibernate.HibernateException;\r
-import org.hibernate.Session;\r
-import org.hibernate.SessionFactory;\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-import org.tizen.common.util.MapUtil;\r
-\r
-abstract public class\r
-SessionTemplate\r
-{\r
- protected static final Map<String, FlushMode> str2flushMode = MapUtil.asMap( new Object[][] {\r
- new Object[] { "manual", FlushMode.MANUAL },\r
- new Object[] { "commit", FlushMode.COMMIT },\r
- new Object[] { "auto", FlushMode.AUTO },\r
- new Object[] { "always", FlushMode.ALWAYS },\r
- } );\r
- \r
- protected final Logger logger = LoggerFactory.getLogger( getClass() );\r
- \r
- protected FlushMode flushMode = getDefaultFlushMode();\r
- \r
- protected SessionFactory sessionFactory;\r
- \r
- protected SessionHolder sessionHolder = new SessionHolder();\r
- \r
- public SessionTemplate() {}\r
- \r
- public\r
- SessionTemplate(\r
- final SessionFactory sessionFactory\r
- )\r
- {\r
- this.sessionFactory = sessionFactory;\r
- }\r
- \r
- protected\r
- FlushMode\r
- getDefaultFlushMode()\r
- {\r
- return FlushMode.AUTO;\r
- }\r
-\r
- public\r
- void\r
- setFlushMode(\r
- final String mode\r
- )\r
- {\r
- if ( null == mode )\r
- {\r
- this.flushMode = getDefaultFlushMode();\r
- logger.info( "change to default flush mode :" + this.flushMode );\r
- return ;\r
- }\r
- \r
- final FlushMode flushMode = str2flushMode.get( mode.toLowerCase() );\r
- if ( null == flushMode )\r
- {\r
- logger.warn( "unknown flush mode :" + mode );\r
- return ;\r
- }\r
- logger.info( "Change flush mode :" + this.flushMode + " -> " + flushMode );\r
- this.flushMode = flushMode;\r
- }\r
- \r
- protected\r
- SessionFactory\r
- lookupSessionFactory()\r
- {\r
- return this.sessionFactory;\r
- }\r
- \r
- public\r
- void\r
- setSessionFactory(\r
- final SessionFactory sessionFactory\r
- )\r
- {\r
- this.sessionFactory = sessionFactory;\r
- }\r
- \r
- abstract protected void process() throws Exception;\r
-\r
- protected\r
- Session\r
- openSession(\r
- final SessionFactory sessionFactory\r
- )\r
- throws HibernateException\r
- {\r
- final Session session =\r
- sessionFactory.openSession();\r
- configureSession( session );\r
- return session;\r
- }\r
-\r
- protected\r
- void\r
- configureSession(\r
- final Session session\r
- )\r
- {\r
- session.setFlushMode( flushMode );\r
- }\r
-\r
- \r
- protected\r
- void\r
- bindSession(\r
- final Session session\r
- )\r
- {\r
- this.sessionHolder.bind( session.getSessionFactory(), session );\r
- \r
- }\r
-\r
- protected\r
- boolean\r
- createSession()\r
- {\r
- final SessionFactory sessionFactory = lookupSessionFactory();\r
-\r
- if ( this.sessionHolder.isBound( sessionFactory ) )\r
- {\r
- return false;\r
- }\r
- \r
- logger.debug("Opening Hibernate Session in SessionInViewFilter");\r
- bindSession( openSession( sessionFactory ) );\r
- return true;\r
- }\r
- \r
- protected\r
- Session\r
- unbindSession(\r
- final SessionFactory sessionFactory\r
- )\r
- {\r
- return this.sessionHolder.unbind( sessionFactory );\r
- }\r
- \r
- protected\r
- void\r
- destroySession()\r
- {\r
- final SessionFactory sessionFactory = lookupSessionFactory();\r
- logger.debug("Closing Hibernate Session in SessionInViewFilter");\r
- final Session session = unbindSession( sessionFactory );\r
- if ( null != session )\r
- {\r
- session.flush();\r
- session.close();\r
- }\r
-\r
- }\r
-\r
- public\r
- void\r
- run(\r
- )\r
- throws Exception\r
- {\r
- boolean bParticipate = createSession();\r
- if ( logger.isTraceEnabled() )\r
- {\r
- logger.trace( "session's participation :" + bParticipate );\r
- }\r
-\r
- try\r
- {\r
- process();\r
- }\r
- finally\r
- {\r
- if ( bParticipate )\r
- {\r
- destroySession();\r
- }\r
- }\r
- }\r
-\r
-}\r
+++ /dev/null
-package org.tizen.common.verrari.server.servlet;\r
-\r
-import org.hibernate.Session;\r
-import org.hibernate.SessionFactory;\r
-import org.springframework.transaction.support.TransactionSynchronizationManager;\r
-\r
-abstract public class\r
-SpringSessionTemplate\r
-extends SessionTemplate\r
-{\r
- \r
- public SpringSessionTemplate() {}\r
- \r
- public\r
- SpringSessionTemplate(\r
- final SessionFactory sessionFactory\r
- )\r
- {\r
- this.sessionFactory = sessionFactory;\r
- }\r
-\r
- @Override\r
- protected\r
- void\r
- bindSession(\r
- final Session session\r
- )\r
- {\r
- super.bindSession( session );\r
- TransactionSynchronizationManager.bindResource( session.getSessionFactory(), session );\r
- }\r
-\r
- @Override\r
- protected\r
- Session\r
- unbindSession(\r
- final SessionFactory sessionFactory\r
- )\r
- {\r
- TransactionSynchronizationManager.unbindResource( sessionFactory );\r
- return super.unbindSession(sessionFactory);\r
- }\r
-}\r
+++ /dev/null
-package org.tizen.common.verrari.server.util;\r
-\r
-import java.io.IOException;\r
-import java.text.SimpleDateFormat;\r
-import java.util.Date;\r
-\r
-import org.codehaus.jackson.JsonGenerator;\r
-import org.codehaus.jackson.JsonProcessingException;\r
-import org.codehaus.jackson.map.JsonSerializer;\r
-import org.codehaus.jackson.map.SerializerProvider;\r
-\r
-public class\r
-DateTimeSerializer\r
-extends JsonSerializer<Date>\r
-{\r
- protected SimpleDateFormat format = new SimpleDateFormat( "yyyy-MM-dd hh:mm:ss" );\r
-\r
- @Override\r
- public\r
- void\r
- serialize(\r
- final Date date,\r
- final JsonGenerator generator,\r
- final SerializerProvider provider\r
- )\r
- throws IOException, JsonProcessingException\r
- {\r
- generator.writeString( format.format( date ) );\r
- }\r
-\r
-}\r
+++ /dev/null
-package org.tizen.common.verrari.server.util;\r
-\r
-import org.tizen.common.FactoryWithArgument;\r
-import org.tizen.common.util.ObjectUtil;\r
-\r
-public class\r
-IdGenerator\r
-implements FactoryWithArgument<String, Object>\r
-{\r
- @Override\r
- public String\r
- create(\r
- final Object key\r
- )\r
- {\r
- return ObjectUtil.generateGUID( key );\r
- }\r
-\r
-}\r
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN" "log4j.dtd">
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
- <appender name="console" class="org.apache.log4j.ConsoleAppender">
- <param name="Target" value="System.out" />
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="[%p] %F(%L) - %m%n" />
- </layout>
- </appender>
-
- <logger name="org.tizen.common.verrari.server.controller">
- <level value="trace" />
- </logger>
-
- <logger name="org.tizen.common.verrari.server.model">
- <level value="trace" />
- </logger>
-
- <logger name="org.tizen.common.verrari.server.service">
- <level value="trace" />
- </logger>
-
- <logger name="org.tizen.common.verrari.server.dao">
- <level value="trace" />
- </logger>
-
- <root>
- <level value="warn" />
- <appender-ref ref="console" />
- </root>
-</log4j:configuration>
\ No newline at end of file
+++ /dev/null
-package org.tizen.common.verrari.server.dao;\r
-\r
-import org.junit.Test;\r
-\r
-public class BinaryDaoTest\r
-{\r
-\r
- @Test\r
- public void test_insertBinary()\r
- {\r
- \r
- }\r
-\r
-}\r
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:context="http://www.springframework.org/schema/context"
- xmlns:tx="http://www.springframework.org/schema/tx"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
- ">
- <!-- Root Context: defines shared resources visible to all other web components -->
- <bean id="dataSource"
- class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" lazy-init="true">
- <property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
- <property name="url" value="jdbc:hsqldb:mem:tizen"/>
- </bean>
-
- <tx:annotation-driven/>
-
- <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
- <property name="dataSource" ref="dataSource"/>
- <property name="hibernateProperties">
- <props>
- <prop key="hibernate.dialect">org.hibernate.dialect.H2Dialect</prop>
- <prop key="hibernate.show_sql">true</prop>
- <prop key="hibernate.hbm2ddl.auto">create</prop>
- </props>
- </property>
-
- <property name="packagesToScan" value="org.tizen.common.verrari.server.model"/>
- </bean>
-
- <bean class="org.tizen.common.verrari.server.util.IdGenerator" />
-
- <context:component-scan base-package="org.tizen.common.verrari.server.dao" />
-
-</beans>
-
+++ /dev/null
-package org.tizen.common.verrari.server.dao;\r
-\r
-import java.util.Date;\r
-import java.util.List;\r
-\r
-import org.hibernate.SessionFactory;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.junit.runner.RunWith;\r
-import org.springframework.beans.factory.annotation.Autowired;\r
-import org.springframework.test.context.ContextConfiguration;\r
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;\r
-import org.tizen.common.verrari.server.model.DownloadHistory;\r
-import org.tizen.common.verrari.server.model.DownloadStatisticsUnit;\r
-import org.tizen.common.verrari.server.servlet.SpringSessionTemplate;\r
-\r
-@RunWith(SpringJUnit4ClassRunner.class)\r
-@ContextConfiguration( locations = {\r
- "classpath:org/tizen/common/verrari/server/dao/DownloadDaoTest-context.xml"\r
-} )\r
-public class DownloadDaoTest\r
-{\r
- \r
- protected static final String TARGET_NAME = "test";\r
-\r
- @Autowired\r
- protected SessionFactory sf;\r
- \r
- @Autowired\r
- protected DownloadDao target;\r
- \r
- @Before\r
- public\r
- void\r
- setUp()\r
- throws Exception\r
- {\r
- target.setSessionFactory( sf );\r
- new SpringSessionTemplate( sf )\r
- {\r
- @Override\r
- protected void process() throws Exception\r
- {\r
- target.insertDownloadHistory( new DownloadHistory( TARGET_NAME, new Date( 2012, 10, 19, 13, 0 ) ) );\r
- }\r
- }.run();\r
- }\r
- \r
- @Test\r
- public void test_listByRecent() throws Exception\r
- {\r
- new SpringSessionTemplate( sf )\r
- {\r
- @Override\r
- protected void process() throws Exception\r
- {\r
- List<DownloadStatisticsUnit> statistics = target.statisticsForWeek( TARGET_NAME );\r
- \r
- }\r
- }.run();\r
- }\r
-\r
-}\r
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:context="http://www.springframework.org/schema/context"
- xmlns:tx="http://www.springframework.org/schema/tx"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
- ">
- <!-- Root Context: defines shared resources visible to all other web components -->
- <bean id="dataSource"
- class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" lazy-init="true">
- <property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
- <property name="url" value="jdbc:hsqldb:mem:tizen"/>
- </bean>
-
- <tx:annotation-driven/>
-
- <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
- <property name="dataSource" ref="dataSource"/>
- <property name="hibernateProperties">
- <props>
- <prop key="hibernate.dialect">org.hibernate.dialect.H2Dialect</prop>
- <prop key="hibernate.show_sql">true</prop>
- <prop key="hibernate.hbm2ddl.auto">create</prop>
- </props>
- </property>
-
- <property name="packagesToScan" value="org.tizen.common.verrari.server.model"/>
- </bean>
-
- <bean class="org.tizen.common.verrari.server.util.IdGenerator" />
-
- <context:component-scan base-package="org.tizen.common.verrari.server.dao" />
-
-</beans>
-
+++ /dev/null
-package org.tizen.common.verrari.server.dao;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-\r
-import java.util.Date;\r
-import java.util.List;\r
-\r
-import org.hibernate.SessionFactory;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.junit.runner.RunWith;\r
-import org.springframework.beans.factory.annotation.Autowired;\r
-import org.springframework.test.context.ContextConfiguration;\r
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;\r
-import org.tizen.common.verrari.server.model.Template;\r
-import org.tizen.common.verrari.server.servlet.SpringSessionTemplate;\r
-\r
-@RunWith(SpringJUnit4ClassRunner.class)\r
-@ContextConfiguration( locations = {\r
- "classpath:org/tizen/common/verrari/server/dao/TemplateDaoTest-context.xml"\r
-} )\r
-public class TemplateDaoTest\r
-{\r
- @Autowired\r
- protected SessionFactory sf;\r
- \r
- @Autowired\r
- protected TemplateDao target;\r
- \r
- @Before\r
- public\r
- void\r
- setUp()\r
- throws Exception\r
- {\r
- new SpringSessionTemplate( sf )\r
- {\r
- @Override\r
- protected void process() throws Exception\r
- {\r
- final Template t1 = new Template();\r
- t1.setName( "test" );\r
- t1.setEmail( "bonyong.lee@samsung.com" );\r
- t1.setUploadedDate( new Date() );\r
- t1.setDescription( "Test1" );\r
- t1.setBinary( "aaa" );\r
- t1.setDownloads( 3 );\r
- target.insertTemplate( t1 );\r
- \r
- final Template t2 = new Template();\r
- t2.setName( "test" );\r
- t2.setEmail( "bonyong.lee@samsung.com" );\r
- t2.setUploadedDate( new Date() );\r
- t2.setDescription( "Test2" );\r
- t2.setBinary( "bbb" );\r
- t2.setDownloads( 3 );\r
- target.insertTemplate( t2 );\r
- }\r
- }.run();\r
- }\r
- \r
- @Test\r
- public void test_listByRecent() throws Exception\r
- {\r
- new SpringSessionTemplate( sf )\r
- {\r
- @Override\r
- protected void process() throws Exception\r
- {\r
- List<Template> templates = target.listByRecent();\r
- assertEquals( 1, templates.size() );\r
- assertEquals( "bbb", templates.get( 0 ).getBinary() );\r
- assertEquals( "Test2", templates.get( 0 ).getDescription() );\r
- \r
- }\r
- }.run();\r
- }\r
-\r
-}\r
+++ /dev/null
-package org.tizen.common.verrari.server.service;\r
-\r
-import org.apache.lucene.store.RAMDirectory;\r
-import org.junit.Test;\r
-\r
-public class SearchServiceTest\r
-{\r
-\r
- @Test\r
- public void test_search()\r
- {\r
- SearchService target = new SearchService();\r
- RAMDirectory directory = new RAMDirectory();\r
- target.setDirectory( directory );\r
- }\r
-\r
-}\r
+++ /dev/null
-package org.tizen.common.verrari.server.util;\r
-\r
-import static org.mockito.Mockito.mock;\r
-import static org.mockito.Mockito.verify;\r
-\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.GregorianCalendar;\r
-\r
-import org.codehaus.jackson.JsonGenerator;\r
-import org.junit.Test;\r
-\r
-public class DateTimeSerializerTest\r
-{\r
-\r
- @Test\r
- public void test_serialize() throws Exception\r
- {\r
- DateTimeSerializer target = new DateTimeSerializer();\r
- \r
- Calendar calendar = GregorianCalendar.getInstance();\r
- calendar.set( 2012, 8, 26, 8, 10, 24 );\r
- Date date = calendar.getTime();\r
- \r
- JsonGenerator generatorMock = mock( JsonGenerator.class );\r
- \r
- target.serialize( date, generatorMock, null );\r
- verify( generatorMock ).writeString( "2012-09-26 08:10:24" );\r
- }\r
-\r
-}\r
--- /dev/null
+package org.tizen.common.verrari;\r
+\r
+import java.util.HashMap;\r
+\r
+import org.tizen.common.verrari.model.ModelManager;\r
+\r
+public class TemplateContext\r
+{\r
+ protected static ThreadLocal<IModelProvider> cabinet = new ThreadLocal<IModelProvider>() {\r
+ @Override\r
+ protected IModelProvider initialValue()\r
+ {\r
+ return new ModelManager();\r
+ }\r
+ };\r
+ \r
+ protected HashMap<String, Object> key2value = new HashMap<String, Object>();\r
+\r
+ public static final IModelProvider getInstance()\r
+ {\r
+ return cabinet.get();\r
+ }\r
+ \r
+ public static\r
+ void\r
+ clear()\r
+ {\r
+ cabinet.remove();\r
+ }\r
+ \r
+ public static\r
+ void\r
+ set( IModelProvider models )\r
+ {\r
+ cabinet.set( models );\r
+ }\r
+ \r
+ public static\r
+ Object\r
+ get(\r
+ final String key\r
+ ) \r
+ {\r
+ return getInstance().getModel( key );\r
+ }\r
+ \r
+}\r
package org.tizen.common.verrari.engine.freemarker;\r
\r
import static org.tizen.common.util.IOUtil.tryClose;\r
+import static org.tizen.common.util.StringUtil.nvl;\r
\r
import java.io.IOException;\r
import java.io.InputStreamReader;\r
logger.info( "Open template source for {}", templateObj );\r
\r
final ITemplate template = (ITemplate) templateObj;\r
- final Reader ret = new InputStreamReader( template.open(), template.getEncoding() );\r
+ \r
+ final Reader ret = new InputStreamReader( template.open(), nvl( template.getEncoding(), encoding ) );\r
\r
tryClose( key2reader.put( templateObj, ret ) );\r
return ret;\r
throws IOException\r
{\r
logger.info( "Close template source for {}", templateObj );\r
- key2reader.remove( templateObj ).close();\r
+ tryClose( key2reader.remove( templateObj ) );\r
}\r
\r
\r
\r
import org.tizen.common.config.Preference;\r
import org.tizen.common.verrari.IModelProvider;\r
+import org.tizen.common.verrari.TemplateContext;\r
\r
/**\r
* ModelProvider.\r
return models.get( key );\r
}\r
\r
+ if ( this != TemplateContext.getInstance() ) \r
+ {\r
+ Object obj = TemplateContext.get( key );\r
+ \r
+ if ( null != obj )\r
+ {\r
+ return obj;\r
+ }\r
+ }\r
+ \r
+ \r
return Preference.getValue( key, null );\r
}\r
\r
\r
import java.util.Collection;\r
\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
import org.tizen.common.verrari.IModelProvider;\r
\r
/**\r
ModelProviderDelegate\r
implements IModelProvider\r
{\r
+ \r
+ /**\r
+ * logger for this object\r
+ */\r
+ protected final Logger logger = LoggerFactory.getLogger( getClass() );\r
+ \r
/**\r
* real {@link IModelProvider}\r
*/\r
@Override\r
public Collection<String> keys()\r
{\r
+ logger.trace( "Keys" );\r
return this.modelProvider.keys();\r
}\r
\r
@Override\r
public Object getModel(String key)\r
{\r
+ logger.trace( "Key :{}", key );\r
return this.modelProvider.getModel( key );\r
}\r
\r
import org.junit.Test;
import org.tizen.common.config.Preference;
+import org.tizen.common.config.provider.PropertiesProvider;
import org.tizen.common.verrari.template.ClasspathResourceTemplate;
import org.tizen.common.verrari.template.InMemoryTemplate;
import org.tizen.common.verrari.template.TemplateManager;
final TemplateManager templateProvider = new TemplateManager();
engine.setTemplateProvider( templateProvider );
- Preference.register( null, "description_date", "2012");
- Preference.register( null, "description_author", "changhyun1.lee@samsung.com");
+ PropertiesProvider provider = new PropertiesProvider();
+ provider.set( "description_date", "2012");
+ provider.set( "description_author", "changhyun1.lee@samsung.com");
+ Preference.register( "test", provider );
templateProvider.addTemplate( "description.ftl", new ClasspathResourceTemplate( "org/tizen/common/verrari/engine/freemarker/description.ftl", getClass() ) );
templateProvider.addTemplate( "test_html_body.ftl", new ClasspathResourceTemplate( "org/tizen/common/verrari/engine/freemarker/test_html_body.ftl", getClass() ) );
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
-import java.io.File;
-import java.net.URI;
import java.util.Collection;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
+import org.tizen.common.verrari.ITemplate;
/**
* StaticTemplateProviderTest.
*/
public class TemplateManagerTest {
+ /**
+ * old config value for url handler
+ */
+ protected String oldConfig;
+
+ /**
+ * template manager to use in test case
+ */
protected TemplateManager stp;
+ /**
+ * Initialze test case
+ */
@Before
public void setUp() {
stp = new TemplateManager();
+
+ oldConfig = System.getProperty( "java.protocol.handler.pkgs" );
+ System.setProperty( "java.protocol.handler.pkgs", "org.tizen.common.util.url" );
+
}
+ /**
+ * Clean up test case
+ */
@After
public void tearDown() {
+ if ( null == oldConfig )
+ {
+ System.clearProperty( "java.protocol.handler.pkgs" );
+ }
+ else
+ {
+ System.setProperty( "java.protocol.handler.pkgs", oldConfig );
+ }
}
/**
*/
@Test
public void test_addTemplate() throws Exception {
- assertTrue(stp.isEmpty());
- FileTemplate fileTemplate = new FileTemplate(new File("./test/src/org/tizen/common/verrari/template/test_html.ftl"));
- stp.addTemplate("testhtml", fileTemplate);
- assertFalse(stp.isEmpty());
- assertNotNull(stp.getTemplate("testhtml"));
- }
-
- /**
- * Test {@link TemplateManager#addTemplate(String, URI)}
- *
- * @throws Exception in case of failure in test
- *
- * @see TemplateManager#addTemplate(String, URI)
- */
- @Test
- public void test_addTemplate2() throws Exception {
- assertTrue(stp.isEmpty());
- File file = new File("./test/src/org/tizen/common/verrari/template/test_html.ftl");
- URI uri = file.toURI();
- stp.addTemplate("testhtml", new URLTemplate( uri.toURL() ));
+ assertTrue( stp.isEmpty() );
+
+ final URLTemplate template = new URLTemplate( "cp:///test_html.ftl" );
+ stp.addTemplate("testhtml", template );
assertFalse(stp.isEmpty());
- assertNotNull(stp.getTemplate("testhtml"));
- }
-
- /**
- * Test {@link TemplateManager#addTemplate(String, File)}
- *
- * @throws Exception in case of failure in test
- *
- * @see TemplateManager#addTemplate(String, File)
- */
- @Test
- public void test_addTemplate3() throws Exception {
- assertTrue(stp.isEmpty());
- stp.addTemplate("testhtml", new FileTemplate( new File("./test/src/org/tizen/common/verrari/template/test_html.ftl") ) );
- assertFalse(stp.isEmpty());
- assertNotNull(stp.getTemplate("testhtml"));
}
/**
@Test
public void test_getTemplate() throws Exception {
assertTrue(stp.isEmpty());
- stp.addTemplate("testhtml", new FileTemplate( new File("./test/src/org/tizen/common/verrari/template/test_html.ftl") ));
+ final URLTemplate template = new URLTemplate( "cp:///test_html.ftl" );
+ stp.addTemplate("testhtml", template );
assertNotNull(stp.getTemplate("testhtml"));
}
@Test
public void test_removeTemplate() throws Exception {
assertTrue(stp.isEmpty());
- stp.addTemplate("testhtml", new FileTemplate( new File("./test/src/org/tizen/common/verrari/template/test_html.ftl") ) );
+ stp.addTemplate("testhtml",new URLTemplate( "cp:///test_html.ftl" ) );
assertFalse(stp.isEmpty());
stp.removeTemplate(null);
assertFalse(stp.isEmpty());
@Test
public void test_getTemplates() throws Exception {
assertTrue(stp.isEmpty());
- stp.addTemplate("testhtml", new FileTemplate( new File("./test/src/org/tizen/common/verrari/template/test_html.ftl") ) );
+ stp.addTemplate("testhtml", new URLTemplate( "cp:///test_html.ftl" ) );
assertFalse(stp.isEmpty());
Collection<String> templates = stp.keys();
@Test
public void test_isEmpty() throws Exception {
assertTrue(stp.isEmpty());
- stp.addTemplate("testhtml", new FileTemplate( new File("./test/src/org/tizen/common/verrari/template/test_html.ftl") ) );
+ stp.addTemplate("testhtml", new URLTemplate( "cp:///test_html.ftl" ) );
assertFalse(stp.isEmpty());
stp.removeTemplate("testhtml");
assertTrue(stp.isEmpty());
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<widget
+ version="1.0"
+ xmlns="http://www.w3.org/ns/widgets"
+ xmlns:tizen="http://tizen.org/ns/widgets"
+ id="http://<{site.domain}>/<{tizne.app.name}>"
+ viewmodes="fullscreen">
+
+ <icon src="<{wac.icon}>"/>
+
+ <content src="<{wac.content}>"/>
+
+ <name><{tizen.app.name}></name>
+
+ <tizen:application id="<{tizen.app.id}>" required_version="1.0"/>
+
+</widget>
org.tizen.common.classloader,
org.tizen.common.config,
org.tizen.common.config.loader,
+ org.tizen.common.config.provider,
org.tizen.common.core.application,
org.tizen.common.core.command,
org.tizen.common.core.command.file,
-source.. = src/\r
-output.. = bin/\r
-bin.includes = META-INF/,\\r
- .,\\r
- icons/,\\r
- about.html,\\r
- about_files/,\\r
- plugin.xml,\\r
- lib/,\\r
- lib/commons-io-2.4.jar,\\r
- lib/commons-lang3-3.1.jar,\\r
- lib/commons-collections-3.2.1.jar,\\r
- lib/commons-pool-1.6.jar,\\r
- OSGI-INF/,\\r
- OSGI-INF/l10n/bundle.properties,\\r
- lib/commons-logging-1.1.1.jar,\\r
- 32_TIZEN_SDK_icon.png,\\r
- about.ini,\\r
- about.properties,\\r
- about.mappings\r
-javacSource = 1.6
-javacTarget = 1.6
+#Wed, 14 Nov 2012 12:16:43 +0900\r
+source..=src/\r
+output..=bin/\r
+bin.includes=META-INF/,.,icons/,about.html,about_files/,plugin.xml,lib/,lib/commons-io-2.4.jar,lib/commons-lang3-3.1.jar,lib/commons-collections-3.2.1.jar,lib/commons-pool-1.6.jar,OSGI-INF/,OSGI-INF/l10n/bundle.properties,lib/commons-logging-1.1.1.jar,32_TIZEN_SDK_icon.png,about.ini,about.properties,about.mappings\r
+javacSource=1.6\r
+javacTarget=1.6\r
+++ /dev/null
-/*\r
- * Common\r
- *\r
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
- *\r
- * Contact:\r
- * BonYong Lee <bonyong.lee@samsung.com>\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- * Contributors:\r
- * - S-Core Co., Ltd\r
- *\r
- */\r
-package org.tizen.common.config;\r
-\r
-import java.util.LinkedHashMap;\r
-import java.util.Map;\r
-\r
-/**\r
- * Namespace.\r
- * \r
- * Object to indicate preference inner region to be separated\r
- * \r
- * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)\r
- * \r
- */\r
-public class\r
-Namespace\r
-{\r
-\r
- /**\r
- * regsion name\r
- */\r
- protected final String name;\r
-\r
- // Prefernece ( key/definition )\r
- protected final Map<String, String> key2value =\r
- new LinkedHashMap<String, String>();\r
-\r
- /**\r
- * Consructor with name\r
- * \r
- * @param name namespace name\r
- */\r
- public Namespace(\r
- final String name\r
- )\r
- {\r
- this.name = name;\r
- }\r
-\r
- /**\r
- * Remove all preference in this namespace\r
- */\r
- public\r
- void\r
- clear()\r
- {\r
- key2value.clear();\r
- }\r
-\r
- /**\r
- * Register prefernece in this namespace\r
- * \r
- * @param key key of preference\r
- * @param definition definition of preference\r
- */\r
- public\r
- void\r
- put(\r
- final String key,\r
- final String definition\r
- )\r
- {\r
- key2value.put( key, definition );\r
- }\r
-\r
- /**\r
- * Return value having <code>key</code> as key\r
- * \r
- * @param key Key of preference\r
- * \r
- * @return preference definition\r
- */\r
- public\r
- String\r
- get(\r
- final String key\r
- )\r
- {\r
- return key2value.get( key );\r
- }\r
- \r
- /**\r
- * Remove preference having <code>key</code> as key\r
- * \r
- * @param key Key of preference\r
- * \r
- * @return preference definition\r
- */\r
- public\r
- String\r
- remove(\r
- final String key\r
- )\r
- {\r
- return key2value.remove( key );\r
- }\r
- \r
- /**\r
- * Return if no preference exists\r
- * \r
- * @return flag if no prefernece exists\r
- */\r
- public\r
- boolean\r
- isEmpty()\r
- {\r
- return key2value.isEmpty();\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see java.lang.Object#toString()\r
- */\r
- public\r
- String\r
- toString()\r
- {\r
- return "Namespace[" + ((null == name)?"DEFAULT":name) + "]";\r
- }\r
-\r
-}\r
*/\r
package org.tizen.common.config;\r
\r
+import java.util.ArrayList;\r
import java.util.Collection;\r
import java.util.Collections;\r
+import java.util.HashMap;\r
import java.util.HashSet;\r
-import java.util.LinkedHashSet;\r
-import java.util.TreeMap;\r
\r
-import org.tizen.common.config.loader.PropertiesLoader;\r
-import org.tizen.common.util.ArrayUtil;\r
import org.tizen.common.util.ParsingUtil;\r
-import org.tizen.common.util.StringUtil;\r
\r
/**\r
* Preference.\r
public class\r
Preference\r
{\r
- /**\r
- * Default namespace that non-specified preference have\r
- */\r
- protected static Namespace DEFAULT_NAMESPACE = new Namespace( null );\r
-\r
- /**\r
- * name-namespace map\r
- */\r
- protected static final TreeMap<String, Namespace> name2ns = \r
- new TreeMap<String, Namespace>();\r
-\r
- /**\r
- * {@link Rule}s to apply\r
- */\r
- protected static final LinkedHashSet<Rule> rules =\r
- new LinkedHashSet<Rule>();\r
-\r
- static {\r
- init();\r
- }\r
+ protected static final ArrayList<PreferenceProvider> providers = new ArrayList<PreferenceProvider>();\r
+ \r
+ protected static final HashMap<String, PreferenceProvider> name2provider = new HashMap<String, PreferenceProvider>();\r
\r
protected Preference() {}\r
\r
- /**\r
- * Initialize preference from os environment and jvm properties\r
- */\r
- public static\r
- void\r
- init()\r
+ public static void clear()\r
{\r
- // From OS environment variables\r
- new PropertiesLoader( System.getenv() ).load( null );\r
-\r
- // From JVM properties. Overwrite if preference is duplicated\r
- new PropertiesLoader( System.getProperties() ).load( null );\r
+ providers.clear();\r
+ name2provider.clear();\r
}\r
\r
- /**\r
- * Remove all preference\r
- */\r
- public static\r
- void\r
- clear()\r
- {\r
- DEFAULT_NAMESPACE.clear();\r
- name2ns.clear();\r
- }\r
\r
/**\r
* Check <code>name</code> is valid\r
void\r
register(\r
final String name,\r
- final String key,\r
- final String exp\r
+ final PreferenceProvider provider\r
)\r
{\r
// check namespace\r
{\r
return ;\r
}\r
-\r
- // check key\r
- if ( !checkName( key ) )\r
- {\r
- return ;\r
- }\r
- if ( StringUtil.isEmpty( key ) )\r
- {\r
- return ;\r
- }\r
-\r
- // specify namespace\r
- Namespace namespace =\r
- ( null==name )?DEFAULT_NAMESPACE:name2ns.get( name );\r
- if ( null == namespace )\r
- {\r
- // create new namespace\r
- namespace = new Namespace( name );\r
- name2ns.put( name, namespace );\r
- }\r
-\r
- if ( null == exp )\r
- {\r
- // remove preference\r
- namespace.remove( key );\r
- }\r
- else\r
- {\r
- // add preference\r
- namespace.put( key, exp );\r
- }\r
- \r
- if ( null != name && namespace.isEmpty() )\r
- {\r
- // remove namespace if it is empty\r
- name2ns.remove( name );\r
- }\r
\r
- }\r
\r
- /**\r
- * Clear namespace naming <code>name</code>\r
- * @param name\r
- */\r
- public static\r
- void\r
- clear(\r
- final String name\r
- )\r
- {\r
- // check namespace\r
- if ( null != name && !checkName( name ) )\r
+ PreferenceProvider old = name2provider.put( name, provider );\r
+ if ( null != old )\r
{\r
- return ;\r
- }\r
-\r
- if ( null == name )\r
- {\r
- DEFAULT_NAMESPACE.clear();\r
+ providers.set( providers.indexOf( old ), provider );\r
}\r
else\r
{\r
- name2ns.remove( name );\r
+ providers.add( 0, provider );\r
}\r
}\r
\r
/**\r
- * \r
- * Add namespace rule\r
- * \r
- * @param rule {@link Rule} to add\r
- * \r
- * @see Rule\r
- */\r
- public static\r
- void\r
- addRule(\r
- final Rule rule\r
- )\r
- {\r
- rules.add( rule );\r
- }\r
-\r
- /**\r
- * Remove namespace rule\r
- * \r
- * @param rule {@link Rule} to remove\r
- */\r
- public static\r
- void\r
- removeRule(\r
- final Rule rule\r
- )\r
- {\r
- rules.remove( rule );\r
- }\r
-\r
- /**\r
- * Remove all rules\r
- */\r
- public static\r
- void\r
- clearRule()\r
- {\r
- rules.clear();\r
- }\r
-\r
- /**\r
* Return preference expression\r
* \r
* @param name namespace name\r
public static\r
String\r
get(\r
- final String name,\r
- final String key\r
- )\r
- {\r
- final Namespace ns =\r
- (null==name)?DEFAULT_NAMESPACE:name2ns.get( name );\r
- if ( null == ns ) return null;\r
-\r
- return ns.get( key );\r
- }\r
- /**\r
- * Find preference expression for <code>key</code>\r
- * \r
- * Return <code>null</code> if it is not found\r
- * \r
- * @param key preference key\r
- * \r
- * @return preference expression\r
- */\r
- protected static\r
- String\r
- find(\r
final String key\r
)\r
{\r
- // callstack\r
- final StackTraceElement[] stacks =\r
- Thread.currentThread().getStackTrace();\r
-\r
- // iterate callstack\r
- for ( int i=0, n=ArrayUtil.size( stacks ) ; i<n ; ++i )\r
+ for ( final PreferenceProvider provider : providers )\r
{\r
- final StackTraceElement e = stacks[i];\r
- \r
- // check active namespace and validation\r
- for ( final Rule rule : rules )\r
+ final String exp = provider.get( key );\r
+ if ( null == exp )\r
{\r
- final String name = rule.accept( e );\r
-\r
- if ( null == name )\r
- {\r
- // check next rule\r
- continue;\r
- }\r
-\r
- // get expression\r
- final String exp = get( name, key );\r
-\r
- if ( null == exp ) \r
- {\r
- continue;\r
- }\r
-\r
- // Return found expression\r
- return exp;\r
+ continue;\r
}\r
+ \r
+ return exp;\r
}\r
-\r
- // Find default namespace\r
- return get( null, key );\r
+ \r
+ return null;\r
}\r
\r
/* List */\r
/**\r
- * Return all registered {@link Namespace}s\r
- * \r
- * @return registered namespaces\r
- */\r
- public static\r
- Collection<Namespace>\r
- getNamespaces()\r
- {\r
- final HashSet<Namespace> namespaces = new HashSet<Namespace>();\r
-\r
- namespaces.add( DEFAULT_NAMESPACE );\r
- namespaces.addAll( name2ns.values() );\r
-\r
- return namespaces;\r
- }\r
- /**\r
* Return preference keys in namespace <code>name</code>\r
* \r
* @param name namespace name\r
final String name\r
)\r
{\r
- final Namespace ns =\r
- ( null == name ) ? DEFAULT_NAMESPACE : name2ns.get( name ); \r
-\r
- if ( null == ns )\r
+ final HashSet<String> keys = new HashSet<String>();\r
+ for ( final PreferenceProvider provider : providers )\r
{\r
- return Collections.emptySet();\r
+ keys.addAll( provider.keys() );\r
}\r
-\r
- return Collections.unmodifiableCollection( ns.key2value.keySet() );\r
+ return Collections.unmodifiableCollection( keys );\r
\r
}\r
/* Value */\r
)\r
{\r
// get definition\r
- final String exp = find( key );\r
+ final String exp = get( key );\r
if ( null == exp )\r
{\r
// return default value if definition doesn't exist\r
--- /dev/null
+/*\r
+ * Common\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact:\r
+ * BonYong Lee <bonyong.lee@samsung.com>\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ *\r
+ */\r
+package org.tizen.common.config;\r
+\r
+import java.util.Collection;\r
+\r
+/**\r
+ * PreferenceProvider.\r
+ * \r
+ * class to provide preference info\r
+ * \r
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)\r
+ * \r
+ */\r
+public interface\r
+PreferenceProvider\r
+{\r
+ /**\r
+ * return preference key {@link Collection}\r
+ * \r
+ * @return preference keys\r
+ */\r
+ Collection<String> keys();\r
+ \r
+ /**\r
+ * return preference value for <code>key</code>\r
+ * \r
+ * @param key preference key\r
+ * \r
+ * @return preference value\r
+ */\r
+ String get( String key );\r
+ \r
+ /**\r
+ * configure preference\r
+ * \r
+ * @param key preference key\r
+ * @param value preference value\r
+ */\r
+ void set( String key, String value );\r
+}\r
+++ /dev/null
-/*\r
- * Common\r
- *\r
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
- *\r
- * Contact:\r
- * BonYong Lee <bonyong.lee@samsung.com>\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- * Contributors:\r
- * - S-Core Co., Ltd\r
- *\r
- */\r
-package org.tizen.common.config;\r
-\r
-import org.tizen.common.util.Assert;\r
-\r
-/**\r
- * Rule.\r
- * \r
- * Object to justify that target is valid\r
- * \r
- * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)\r
- * \r
- */\r
-public interface\r
-Rule\r
-{\r
- /**\r
- * Return namespace name for <code>arg</code>\r
- * \r
- * Return <code>null</code> if rule is invalid for <code>arg</code>\r
- * \r
- * @param arg target name\r
- * \r
- * @return namespace name\r
- */\r
- String accept( final Object arg );\r
-\r
- /**\r
- * {@link Rule} using pattern and call stack\r
- */\r
- public static class\r
- PatternRule\r
- implements Rule\r
- {\r
- /**\r
- * Separator between class name and method name\r
- */\r
- protected static final String SEP_METHOD = "#";\r
-\r
- /**\r
- * Wildcard matching any character\r
- */\r
- protected static final String ANY = "*";\r
-\r
- /**\r
- * Class qualified name pattern to apply\r
- */\r
- protected final String qnPattern;\r
-\r
- /**\r
- * Method name pattern to apply\r
- */\r
- protected final String methodNamePattern;\r
-\r
- /**\r
- * Namespace name\r
- */\r
- protected final String name;\r
-\r
- /**\r
- * Constructor with pattern and namespace name\r
- * \r
- * Example is following.\r
- * <ul>\r
- * <li>{QualifiedNamePattern}</li>\r
- * <li>{QualifiedNamePattern}#{MethodNamePattern}\r
- * </ul>\r
- * \r
- * @param pattern pattern string to apply\r
- * @param name namespace name to return if rule is valid\r
- */\r
- public\r
- PatternRule(\r
- final String pattern,\r
- final String name\r
- )\r
- {\r
- final int index = pattern.indexOf( SEP_METHOD );\r
- if ( index < 0 )\r
- {\r
- // qualified name if no separator exists\r
- qnPattern = pattern;\r
- methodNamePattern = "*";\r
- }\r
- else\r
- {\r
- // qualfied name and method name if separator exists\r
- qnPattern = pattern.substring( 0, index );\r
- methodNamePattern = pattern.substring( index + 1 );\r
- }\r
-\r
- this.name = name;\r
- }\r
-\r
- /**\r
- * Check <code>str</code> is matching with pattern <code>p</code>\r
- * \r
- * @param p pattern to check\r
- * @param str string to check\r
- * \r
- * @return Flag if <code>str</code> is matching with <code>p</code>\r
- */\r
- protected\r
- boolean\r
- check(\r
- final String p,\r
- final String str\r
- )\r
- {\r
- if ( ANY.equals( p ) ) {\r
- // Any string is ok\r
- return true;\r
- } else if ( !p.contains( ANY ) ) {\r
- // Pattern contains no wildcard;exact matching\r
- return p.equals( str );\r
- } else {\r
- final boolean bStart = p.startsWith( ANY );\r
- final boolean bEnd = p.endsWith( ANY );\r
-\r
- final String keyword =\r
- p.substring( 0, p.length() - (bEnd?1:0) ).\r
- substring( bStart?1:0 );\r
-\r
- if ( !bStart && !bEnd ) {\r
- // in case that strings exist leading and trailing \r
- int index = keyword.indexOf( ANY );\r
-\r
- // Dose NOT permit more than one wildcard\r
- Assert.isFalse(\r
- 0 <= keyword.indexOf( ANY, index ),\r
- "Invalid Pattern[" + p + "]"\r
- );\r
-\r
- return (\r
- str.startsWith( keyword.substring( 0, index ) ) &&\r
- str.endsWith( keyword.substring( index + 1 ) )\r
- );\r
- }\r
-\r
- Assert.isFalse(\r
- keyword.contains( ANY ),\r
- "Invalid Pattern[" + p + "]"\r
- );\r
- if ( bStart && bEnd )\r
- {\r
- // In case that target pattern exists in middle of string\r
- return str.contains( keyword );\r
- }\r
- else if ( bStart )\r
- {\r
- // In case of suffix\r
- return str.endsWith( keyword );\r
- }\r
- else if ( bEnd )\r
- {\r
- // In case of prefix\r
- return str.startsWith( keyword );\r
- }\r
- throw new IllegalStateException();\r
- }\r
- } // END of method 'check'\r
-\r
-\r
- /* (non-Javadoc)\r
- * @see com.parthenon.config.Rule#accept(java.lang.Object)\r
- */\r
- public\r
- String\r
- accept(\r
- final Object arg\r
- )\r
- {\r
- if ( arg instanceof StackTraceElement )\r
- {\r
- final StackTraceElement e = (StackTraceElement) arg;\r
-\r
- // Check classname in call stack\r
- if ( !check( qnPattern, e.getClassName() ) )\r
- {\r
- return null;\r
- }\r
-\r
- // Check method in call stack\r
- if ( !check( methodNamePattern, e.getMethodName() ) )\r
- {\r
- return null;\r
- }\r
-\r
- return name;\r
- }\r
- return null;\r
- } // END of method 'accept'\r
-\r
- /* (non-Javadoc)\r
- * @see java.lang.Object#toString()\r
- */\r
- public\r
- String\r
- toString()\r
- {\r
- return "Rule[" + qnPattern + "->" + name + "]";\r
- }\r
-\r
- } // END of class 'PatternRule'\r
-\r
-}\r
+++ /dev/null
-/*\r
- * Common\r
- *\r
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
- *\r
- * Contact:\r
- * BonYong Lee <bonyong.lee@samsung.com>\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- * Contributors:\r
- * - S-Core Co., Ltd\r
- *\r
- */\r
-package org.tizen.common.config.loader;\r
-\r
-import static org.tizen.common.util.IOUtil.tryClose;\r
-import static org.tizen.common.util.StringUtil.EMPTY_STRING;\r
-\r
-import java.io.BufferedReader;\r
-import java.io.ByteArrayInputStream;\r
-import java.io.IOException;\r
-import java.io.InputStream;\r
-import java.io.InputStreamReader;\r
-import java.io.StringReader;\r
-import java.net.URL;\r
-import java.text.ParseException;\r
-import java.util.Iterator;\r
-import java.util.Stack;\r
-\r
-import org.apache.log4j.lf5.util.StreamUtils;\r
-import org.tizen.common.config.Preference;\r
-import org.tizen.common.util.CollectionUtil;\r
-import org.tizen.common.util.StringUtil;\r
-\r
-/**\r
- * StructuredResourceLoader.\r
- * \r
- * Object to load preference from *.ini file\r
- * \r
- * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)\r
- */\r
-public class\r
-StructuredResourceLoader\r
-extends AbstractLoader\r
-{\r
-\r
- \r
- /**\r
- * Section start token\r
- */\r
- protected static final String SEC_OPEN ="[";\r
- \r
- /**\r
- * Section end token\r
- */\r
- protected static final String SEC_CLOSE = "]";\r
- \r
- /**\r
- * Line comment token\r
- */\r
- protected static final String PREFIX_COMMENT = "#";\r
-\r
- /**\r
- * Separator of preference\r
- */\r
- protected static final char CH_ATTR_VAL = '=';\r
- /**\r
- * Escaper\r
- */\r
- protected static final char CH_ESCAPE = '\\';\r
-\r
- /**\r
- * Status of parser in syntax\r
- */\r
- protected enum Status{ ST_INDENT, ST_ATTR, ST_VAL };\r
-\r
- /**\r
- * current name space\r
- */\r
- protected String ns = EMPTY_STRING;\r
- \r
- /**\r
- * current title in parsing\r
- */\r
- protected String title = null;\r
- \r
- /**\r
- * Constructor with source\r
- * \r
- * @param src {@link Source}\r
- */\r
- public\r
- StructuredResourceLoader(\r
- final Source src\r
- )\r
- {\r
- super( src );\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see org.tizen.common.config.Loader#load(java.lang.String)\r
- */\r
- public\r
- void\r
- load(\r
- final String ns\r
- ) throws IOException {\r
- final Iterator<URL> iter = src.iterator();\r
- this.ns = StringUtil.nvl( ns );\r
- while ( iter.hasNext() )\r
- {\r
- \r
- final URL url = iter.next();\r
- final InputStream in = url.openStream();\r
- try\r
- {\r
- ByteArrayInputStream byteIn = new ByteArrayInputStream( StreamUtils.getBytes( in ) );\r
- read( byteIn );\r
- }\r
- finally\r
- {\r
- tryClose( in );\r
- }\r
- }\r
- }\r
-\r
-\r
- /**\r
- * Composite sentence from <code>in</code> line-by-line\r
- * \r
- * @param in {@link InputStream} to read preference from\r
- * \r
- * @throws IOException If prefernece can't be read\r
- */\r
- protected\r
- void\r
- read(\r
- final InputStream in\r
- ) throws IOException {\r
- final BufferedReader reader =\r
- new BufferedReader( new InputStreamReader( in ) );\r
-\r
- String line = null;\r
- String meaning = "";\r
-\r
- final Stack<String> names = new Stack<String>();\r
-\r
- try\r
- {\r
- while ( null != ( line = reader.readLine() ) )\r
- {\r
- meaning += line;\r
- meaning = processLine( meaning, names );\r
- }\r
- }\r
- catch ( final ParseException e )\r
- {\r
- throw new IOException( e );\r
- }\r
-\r
- }\r
-\r
- /**\r
- * Process preference sentence\r
- * \r
- * @param line preference sentence\r
- * @param names name stack\r
- * \r
- * @throws ParseException If <code>line</code> is invalid\r
- */\r
- protected\r
- String \r
- processLine(\r
- final String line,\r
- final Stack<String> names\r
- )\r
- throws ParseException\r
- {\r
- // Ignore line comment\r
- if ( line.startsWith( PREFIX_COMMENT ) ) return EMPTY_STRING;\r
-\r
- // If next line exists\r
- int cnt = 0;\r
- for ( int i=line.length()-1 ; 0<=i ; --i )\r
- {\r
- if ( CH_ESCAPE == line.charAt( i ) )\r
- {\r
- ++cnt;\r
- }\r
- }\r
-\r
- if ( 1 == ( cnt % 2 ) )\r
- {\r
- return line.substring( 0, line.length() - 1 );\r
- }\r
-\r
- // Process meaningful sentence\r
- if ( line.startsWith( SEC_OPEN ) && line.endsWith( SEC_CLOSE ) )\r
- {\r
- // In case of title\r
- title = ns + line.substring( 1, line.length() - 1 ).trim();\r
- return EMPTY_STRING;\r
- }\r
- \r
- // Process preference\r
- try {\r
- final StringReader reader = new StringReader( line );\r
-\r
- // character index\r
- int ch = 0;\r
-\r
- // parsing state\r
- Status status = Status.ST_INDENT;\r
-\r
- // the number of indent\r
- int nTab = 0;\r
-\r
- // buffer for name\r
- final StringBuilder nameBuffer = new StringBuilder();\r
-\r
- // buffer for value \r
- final StringBuilder valBuffer = new StringBuilder();\r
-\r
- // flat that previous character is escape\r
- boolean bEscape = false;\r
-\r
- int nRead = 0;\r
- while ( 0 <= ( ch = reader.read() ) )\r
- {\r
- ++nRead;\r
- switch ( status )\r
- {\r
- case ST_INDENT:\r
- if ( '\t' == ch )\r
- {\r
- ++nTab;\r
- continue;\r
- }\r
-\r
- while ( nTab < names.size() )\r
- {\r
- names.pop();\r
- }\r
- status = Status.ST_ATTR;\r
- case ST_ATTR:\r
- if ( '.' == ch )\r
- {\r
- throw new ParseException( "It containers '.' which is NOT permitted in " + line, nRead );\r
- }\r
- else if ( bEscape )\r
- {\r
- nameBuffer.append( (char) ch );\r
- bEscape = false;\r
- }\r
- else if ( CH_ESCAPE == ch )\r
- {\r
- bEscape = true;\r
- }\r
- else if ( '=' == ch )\r
- {\r
- status = Status.ST_VAL;\r
- }\r
- else\r
- {\r
- nameBuffer.append( (char) ch );\r
- }\r
- break;\r
- case ST_VAL:\r
- valBuffer.append( (char) ch );\r
- break;\r
- }\r
- }\r
- \r
- if ( status == Status.ST_INDENT )\r
- {\r
- return EMPTY_STRING;\r
- }\r
- \r
- // Create qualified name\r
- final StringBuilder qn = new StringBuilder();\r
- for ( int i=0, n=CollectionUtil.size( names ) ; i<n ; ++i )\r
- {\r
- qn.append( names.get( i ) );\r
- qn.append( '.' );\r
- }\r
- qn.append( StringUtil.trim( nameBuffer.toString() ) );\r
- names.push( StringUtil.trim( nameBuffer.toString() ) );\r
- Preference.register( title, qn.toString(), valBuffer.toString() );\r
- }\r
- catch ( final IOException e )\r
- {\r
- e.printStackTrace();\r
- }\r
-\r
-\r
- return EMPTY_STRING;\r
- }\r
-\r
-}\r
--- /dev/null
+/*\r
+ * Common\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact:\r
+ * BonYong Lee <bonyong.lee@samsung.com>\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ *\r
+ */\r
+package org.tizen.common.config.provider;\r
+\r
+import java.util.Collection;\r
+import java.util.Collections;\r
+\r
+import org.tizen.common.config.PreferenceProvider;\r
+\r
+/**\r
+ * EnvironmentProvider.\r
+ * \r
+ * Provide from OS environment variable\r
+ * \r
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)\r
+ * \r
+ * @see PreferenceProvider\r
+ */\r
+public class\r
+EnvironmentProvider\r
+implements PreferenceProvider\r
+{\r
+\r
+ /* (non-Javadoc)\r
+ * @see org.tizen.common.config.PreferenceProvider#keys()\r
+ */\r
+ @Override\r
+ public\r
+ Collection<String>\r
+ keys()\r
+ {\r
+ return Collections.unmodifiableCollection( System.getenv().keySet() );\r
+ }\r
+\r
+ /* (non-Javadoc)\r
+ * @see org.tizen.common.config.PreferenceProvider#get(java.lang.String)\r
+ */\r
+ @Override\r
+ public\r
+ String\r
+ get(\r
+ final String key\r
+ )\r
+ {\r
+ return System.getenv( key );\r
+ }\r
+\r
+ /* (non-Javadoc)\r
+ * @see org.tizen.common.config.PreferenceProvider#set(java.lang.String, java.lang.String)\r
+ */\r
+ @Override\r
+ public\r
+ void\r
+ set(\r
+ final String key,\r
+ final String value\r
+ )\r
+ {\r
+ throw new UnsupportedOperationException();\r
+ }\r
+\r
+}\r
* - S-Core Co., Ltd\r
*\r
*/\r
-package org.tizen.common.config.loader;\r
+package org.tizen.common.config.provider;\r
\r
+import java.util.Collection;\r
+import java.util.Collections;\r
+import java.util.HashMap;\r
import java.util.Map;\r
import java.util.Properties;\r
\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-import org.tizen.common.config.Preference;\r
+import org.tizen.common.config.PreferenceProvider;\r
\r
/**\r
- * PropertiesLoader.\r
+ * Preference.\r
* \r
- * Object to load preference from *.properties file \r
+ * Provide from {@link Map}\r
* \r
* @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)\r
+ * \r
+ * @see PreferenceProvider\r
*/\r
public class\r
-PropertiesLoader\r
+PropertiesProvider\r
+implements PreferenceProvider\r
{\r
- protected final Logger logger = LoggerFactory.getLogger( getClass() );\r
- \r
+ /**\r
+ * preference\r
+ */\r
protected final Map<String, String> props;\r
+ \r
+ /**\r
+ * default constructor\r
+ */\r
+ public\r
+ PropertiesProvider()\r
+ {\r
+ this( new HashMap<String, String>() );\r
+ }\r
\r
/**\r
* Constructor with {@link Properties}\r
*/\r
@SuppressWarnings("unchecked")\r
public\r
- PropertiesLoader(\r
+ PropertiesProvider(\r
final Properties props\r
)\r
{\r
* @param props {@link Map} to clone from\r
*/\r
public\r
- PropertiesLoader(\r
+ PropertiesProvider(\r
final Map<String, String> props\r
)\r
{\r
this.props = props;\r
}\r
+ \r
\r
/* (non-Javadoc)\r
- * @see com.parthenon.config.Loader#load(java.lang.String)\r
+ * @see org.tizen.common.config.PreferenceProvider#keys()\r
*/\r
- public\r
- void\r
- load(\r
- final String name\r
- )\r
+ @SuppressWarnings("unchecked")\r
+ @Override\r
+ public Collection<String> keys()\r
+ {\r
+ final Collection<?> ret = props.keySet();\r
+ \r
+ return Collections.unmodifiableCollection( (Collection<String>) ret );\r
+ }\r
+\r
+ /* (non-Javadoc)\r
+ * @see org.tizen.common.config.PreferenceProvider#get(java.lang.String)\r
+ */\r
+ @Override\r
+ public String get( final String key )\r
+ {\r
+ return this.props.get( key );\r
+ }\r
+\r
+ /* (non-Javadoc)\r
+ * @see org.tizen.common.config.PreferenceProvider#set(java.lang.String, java.lang.String)\r
+ */\r
+ @Override\r
+ public void set(String key, String value)\r
{\r
- // 읽어들일 key/definition을 설정에 등록한다.\r
- for( final String key : props.keySet() )\r
- {\r
- try\r
- {\r
- Preference.register( name, key, props.get( key ) );\r
- }\r
- catch ( final IllegalArgumentException e )\r
- {\r
- logger.error( "Error occurred in loading.", e );\r
- }\r
- }\r
+ this.props.put( key, value );\r
}\r
\r
}\r
--- /dev/null
+/*\r
+ * Common\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact:\r
+ * BonYong Lee <bonyong.lee@samsung.com>\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ *\r
+ */\r
+package org.tizen.common.config.provider;\r
+\r
+import java.util.Collection;\r
+import java.util.Collections;\r
+\r
+import org.tizen.common.config.PreferenceProvider;\r
+\r
+/**\r
+ * Preference.\r
+ * \r
+ * Provide from jvm system properties\r
+ * \r
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)\r
+ * \r
+ * @see PreferenceProvider\r
+ * @see System#getProperties()\r
+ */\r
+public class\r
+SystemPropertiesProvider\r
+implements PreferenceProvider\r
+{\r
+\r
+ /* (non-Javadoc)\r
+ * @see org.tizen.common.config.PreferenceProvider#keys()\r
+ */\r
+ @SuppressWarnings("unchecked")\r
+ @Override\r
+ public Collection<String> keys()\r
+ {\r
+ Collection<?> ret = System.getProperties().keySet();\r
+ \r
+ return Collections.unmodifiableCollection( (Collection<String>) ret );\r
+ }\r
+\r
+ /* (non-Javadoc)\r
+ * @see org.tizen.common.config.PreferenceProvider#get(java.lang.String)\r
+ */\r
+ @Override\r
+ public\r
+ String\r
+ get(\r
+ final String key\r
+ )\r
+ {\r
+ return System.getProperty( key );\r
+ }\r
+\r
+ /* (non-Javadoc)\r
+ * @see org.tizen.common.config.PreferenceProvider#set(java.lang.String, java.lang.String)\r
+ */\r
+ @Override\r
+ public\r
+ void\r
+ set(\r
+ final String key,\r
+ final String value\r
+ )\r
+ {\r
+ throw new UnsupportedOperationException();\r
+ }\r
+\r
+}\r
*/
package org.tizen.common.core.command;
+import java.util.HashMap;
+
+import org.tizen.common.config.Preference;
import org.tizen.common.core.command.policy.PolicyRegistry;
import org.tizen.common.file.FileHandler;
/**
+ * User argument
+ */
+ protected HashMap<String, Object> args = new HashMap<String, Object>();
+
+
+ /**
* Constructor with {@link PolicyRegistry}, {@link Prompter} and {@link FileHandler}
*
* @param registry {@link PolicyRegistry} to use
{
return this.fileHandler;
}
+
+
+ /**
+ * <p>
+ * return context preference value.
+ *
+ * return global preference value if not exist.
+ * </p>
+ * @param key preference key
+ *
+ * @return preference value
+ *
+ * @see Preference
+ */
+ public
+ Object
+ getValue( final String key )
+ {
+ Object val = args.get( key );
+ if ( null != val )
+ {
+ return val;
+ }
+
+ return Preference.getValue( key, null );
+
+ }
+ /**
+ * <p>
+ * set context preference
+ * </p>
+ * @param key prefernece key
+ * @param value preference value
+ */
+ public
+ void
+ setValue( final String key, final Object value )
+ {
+ args.put( key, value );
+ }
}
--- /dev/null
+/*\r
+ * Common\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: \r
+ * BonYong Lee <bonyong.lee@samsung.com>\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ *\r
+ */\r
+package org.tizen.common.core.command.zip;\r
+\r
+import java.io.IOException;\r
+import java.io.OutputStream;\r
+import java.util.jar.JarEntry;\r
+import java.util.jar.JarOutputStream;\r
+import java.util.zip.ZipOutputStream;\r
+\r
+/**\r
+ * <p>\r
+ * JarCommand.\r
+ * \r
+ * Command to make jar archive\r
+ * </p>\r
+ * \r
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)\r
+ * \r
+ * @see ZipCommand\r
+ */\r
+public class\r
+JarCommand\r
+extends ZipCommand\r
+{\r
+ /**\r
+ * Constructor with base dir and target file name\r
+ * \r
+ * @param baseDir base directory path\r
+ * @param target target file name\r
+ */\r
+ public\r
+ JarCommand(\r
+ final String baseDir, \r
+ final String target\r
+ )\r
+ {\r
+ super( baseDir, target );\r
+ }\r
+\r
+ /* (non-Javadoc)\r
+ * @see org.tizen.common.core.command.zip.ZipCommand#createZipOutputStream(java.io.OutputStream)\r
+ */\r
+ @Override\r
+ protected\r
+ ZipOutputStream\r
+ createZipOutputStream(\r
+ final OutputStream out\r
+ )\r
+ throws IOException\r
+ {\r
+ JarOutputStream zipOut = new JarOutputStream( out );\r
+ zipOut.setMethod( ZipOutputStream.DEFLATED );\r
+ zipOut.setLevel( 9 );\r
+ \r
+ return zipOut;\r
+ }\r
+\r
+ /* (non-Javadoc)\r
+ * @see org.tizen.common.core.command.zip.ZipCommand#createEntry(java.lang.String)\r
+ */\r
+ @Override\r
+ protected\r
+ JarEntry\r
+ createEntry(\r
+ final String name\r
+ )\r
+ {\r
+ return new JarEntry( name );\r
+ }\r
+\r
+\r
+}\r
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
+import java.io.OutputStream;
import java.text.MessageFormat;
import java.util.Collection;
-import java.util.LinkedList;
-import java.util.Queue;
+import java.util.Comparator;
+import java.util.TreeSet;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
final Executor executor,
final ExecutionContext context
)
- throws IOException, InterruptedException
+ throws IOException
{
final FileHandler handler = context.getFileHandler();
Assert.notNull( handler );
}
final ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
- final ZipOutputStream zipOut = new ZipOutputStream( byteOut );
- zipOut.setMethod( ZipOutputStream.DEFLATED );
- zipOut.setLevel( 9 );
+
+ final ZipOutputStream zipOut = createZipOutputStream( byteOut );
-
try
{
- final Queue<String> directories = new LinkedList<String>();
-
- directories.add( baseDir );
-
- while ( !directories.isEmpty() )
- {
- final String filePath = directories.remove();
- final Object type = handler.get( filePath, Attribute.TYPE );
-
- logger.trace( "File path :{}", filePath );
-
- if (
- !FilenameUtil.equals( filePath, baseDir ) &&
- !filter.accept( baseDir, getRelativePath( baseDir, filePath ) )
- )
- {
- logger.debug( "Ignore {}", filePath );
- continue;
- }
- logger.trace( "file [{}]'s type :{}", filePath, type );
- if ( Type.DIRECTORY.equals( type ) )
- {
- final Collection<String> childs = handler.list( filePath );
- directories.addAll( childs );
- if ( FilenameUtil.equals( baseDir, filePath ) )
- {
- continue;
- }
-
- final String relative = getRelativePath( baseDir, filePath );
- logger.trace( "Relative path :{}", relative );
-
- final ZipEntry entry = new ZipEntry( relative + "/" );
- zipOut.putNextEntry( entry );
- zipOut.closeEntry();
-
- }
- else if ( Type.FILE.equals( type ) )
- {
-
- final String relative = getRelativePath( baseDir, filePath );
- logger.trace( "Relative path :{}", relative );
-
- final ZipEntry entry = new ZipEntry( relative );
- zipOut.putNextEntry( entry );
- IOUtil.redirect( handler.read( filePath ), zipOut );
- zipOut.closeEntry();
- logger.debug( "Zip {}", relative );
- }
- }
- }
- catch( IOException e )
- {
- throw new IllegalStateException( e );
- // TODO Handle
+ addEntry( zipOut, handler, baseDir );
}
finally
{
- tryClose( zipOut );
+ tryClose( zipOut );
}
try {
}
+ /**
+ * Add file entry with <code>filePath</code> into <code>zipOut</code>
+ *
+ * @param zipOut {@link ZipOutputStream} to add entry
+ * @param handler {@link FileHandler} to use to read contents
+ * @param filePath file paht
+ */
+ protected
+ void
+ addEntry(
+ final ZipOutputStream zipOut,
+ final FileHandler handler,
+ final String filePath
+ )
+ {
+ try
+ {
+ final Object type = handler.get( filePath, Attribute.TYPE );
+
+ logger.trace( "File path :{}", filePath );
+
+ if (
+ !FilenameUtil.equals( filePath, baseDir ) &&
+ !filter.accept( baseDir, getRelativePath( baseDir, filePath ) )
+ )
+ {
+ logger.debug( "Ignore {}", filePath );
+ return ;
+ }
+ logger.trace( "file [{}]'s type :{}", filePath, type );
+ if ( Type.DIRECTORY.equals( type ) )
+ {
+ Collection<String> children = handler.list( filePath );
+ if ( FilenameUtil.equals( baseDir, filePath ) )
+ {
+ final TreeSet<String> safe = new TreeSet<String>( new Comparator<String>()
+ {
+ @Override
+ public
+ int
+ compare(
+ final String o1,
+ final String o2
+ )
+ {
+ if ( o1.equals( o2 ) )
+ {
+ return 0;
+ }
+ if ( o1.equals( "META-INF" ) )
+ {
+ return -1;
+ }
+ else if ( o2.endsWith( "META-INF" ) )
+ {
+ return 1;
+ }
+
+ return o1.compareTo( o2 );
+ }
+ } );
+
+ safe.addAll( children );
+ children = safe;
+ }
+ else
+ {
+ final String relative = getRelativePath( baseDir, filePath );
+ logger.trace( "Relative path :{}", relative );
+
+ final ZipEntry entry = createEntry( relative + "/" );
+ zipOut.putNextEntry( entry );
+ zipOut.closeEntry();
+ }
+
+
+ for ( final String child : children )
+ {
+ addEntry( zipOut, handler, child );
+ }
+
+ }
+ else if ( Type.FILE.equals( type ) )
+ {
+
+ final String relative = getRelativePath( baseDir, filePath );
+ logger.trace( "Relative path :{}", relative );
+
+ final ZipEntry entry = createEntry( relative );
+ zipOut.putNextEntry( entry );
+ IOUtil.redirect( handler.read( filePath ), zipOut );
+ zipOut.closeEntry();
+ logger.debug( "Zip {}", relative );
+ }
+ }
+ catch( IOException e )
+ {
+ throw new IllegalStateException( e );
+ // TODO Handle
+ }
+ }
+
+ /**
+ * Create {@link ZipOutputStream} to delegate <code>out</code>
+ *
+ * @param out {@link OutputStream} to delegate
+ *
+ * @return {@link ZipOutputStream} to be created
+ *
+ * @throws IOException if {@link ZipOutputStream} can't be created
+ */
+ protected
+ ZipOutputStream
+ createZipOutputStream(
+ final OutputStream out
+ )
+ throws IOException
+ {
+ final ZipOutputStream zipOut = new ZipOutputStream( out );
+ zipOut.setMethod( ZipOutputStream.DEFLATED );
+ zipOut.setLevel( 9 );
+
+ return zipOut;
+ }
+
+ /**
+ * Create {@link ZipEntry} with <code>name</code>
+ *
+ * @param name entry name
+ *
+ * @return {@link ZipEntry}
+ */
+ protected
+ ZipEntry
+ createEntry(
+ final String name
+ )
+ {
+ return new ZipEntry( name );
+ }
+
}
+/*\r
+ * Common\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: \r
+ * BonYong Lee <bonyong.lee@samsung.com>\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ *\r
+ */\r
package org.tizen.common.daemon;\r
\r
import java.util.concurrent.locks.Lock;\r
import org.slf4j.Logger;\r
import org.slf4j.LoggerFactory;\r
\r
+/**\r
+ * <p>\r
+ * AbstractServer\r
+ * \r
+ * abstract common class for {@link Server}\r
+ * </p>\r
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)\r
+ *\r
+ */\r
abstract public class\r
AbstractServer\r
implements Server, Runnable\r
{\r
+ /**\r
+ * logger for this object\r
+ */\r
protected final Logger logger = LoggerFactory.getLogger( getClass() );\r
\r
+ /**\r
+ * {@link Thread} to use in this server\r
+ */\r
protected Thread thread = null;\r
\r
+ /**\r
+ * lock for #state\r
+ */\r
protected Lock lock = new ReentrantLock();\r
\r
+ /**\r
+ * server state\r
+ * @see ServerState\r
+ */\r
protected ServerState state = ServerState.Terminated;\r
\r
+ /**\r
+ * Server name to use thread name\r
+ */\r
protected final String name;\r
\r
+ /**\r
+ * default constructor\r
+ */\r
public AbstractServer()\r
{\r
this( null );\r
}\r
\r
- public AbstractServer( final String name )\r
+ /**\r
+ * constructor with name\r
+ * \r
+ * @param name server name\r
+ */\r
+ public\r
+ AbstractServer(\r
+ final String name\r
+ )\r
{\r
this.name = name;\r
}\r
\r
- public String getName()\r
+ /**\r
+ * return server name\r
+ * @return server name\r
+ * \r
+ * @see #name\r
+ */\r
+ public\r
+ String\r
+ getName()\r
{\r
return name;\r
}\r
\r
+ /**\r
+ * return server status\r
+ * @return server status\r
+ * \r
+ * @see #state\r
+ * @see ServerState\r
+ */\r
public\r
+ ServerState\r
+ getStatus()\r
+ {\r
+ lock.lock();\r
+ try\r
+ {\r
+ return this.state;\r
+ }\r
+ finally\r
+ {\r
+ lock.unlock();\r
+ }\r
+ }\r
+ \r
+ /**\r
+ * Change server state\r
+ * \r
+ * @param state server state\r
+ * \r
+ * @see #state\r
+ * @see ServerState\r
+ */\r
+ protected\r
void\r
setStatus(\r
final ServerState state\r
}\r
}\r
\r
+ /**\r
+ * check server state is one of <code>states</code>\r
+ * \r
+ * @param states state candidates to check\r
+ * \r
+ * @return boolean value if server state is one of <code>states</code>\r
+ */\r
public\r
boolean\r
isState(\r
}\r
}\r
\r
+ /**\r
+ * wait until server state become one of <code>states</code>\r
+ * \r
+ * @param states server states\r
+ */\r
public\r
void\r
- waitState( ServerState... states )\r
+ waitState(\r
+ final ServerState... states\r
+ )\r
{\r
while ( !isState( states ) ) {\r
try\r
\r
\r
\r
+ /* (non-Javadoc)\r
+ * @see java.lang.Runnable#run()\r
+ */\r
@Override\r
- public void run()\r
+ public\r
+ void\r
+ run()\r
{\r
- if ( isState( ServerState.Halting ) ) {\r
+ if ( isState( ServerState.Halting ) )\r
+ {\r
setStatus( ServerState.Terminated );\r
return ;\r
}\r
lock.lock();\r
try\r
{\r
- if ( isState( ServerState.Halting ) ) {\r
+ if ( isState( ServerState.Halting ) )\r
+ {\r
return ;\r
}\r
setStatus( ServerState.Running );\r
{\r
lock.unlock();\r
}\r
- while ( !isState( ServerState.Halting ) ) {\r
+ while ( !isState( ServerState.Halting ) )\r
+ {\r
process();\r
}\r
}\r
\r
}\r
\r
+ /* (non-Javadoc)\r
+ * @see org.tizen.common.daemon.Server#boot()\r
+ */\r
@Override\r
public void boot() throws Exception\r
{\r
throw new IllegalStateException();\r
}\r
\r
+ final String name = getName();\r
+ if ( null == name )\r
+ {\r
+ thread = new Thread( this );\r
+ }\r
+ else \r
+ {\r
+ thread = new Thread( this, name );\r
+ }\r
+ thread.start();\r
setStatus( ServerState.Initializing );\r
}\r
finally\r
{\r
lock.unlock();\r
}\r
- final String name = getName();\r
- if ( null == name )\r
- {\r
- thread = new Thread( this );\r
- }\r
- else \r
- {\r
- thread = new Thread( this, name );\r
- }\r
- thread.start();\r
}\r
\r
+ /* (non-Javadoc)\r
+ * @see org.tizen.common.daemon.Server#down()\r
+ */\r
@Override\r
- public void down() throws Exception\r
+ public\r
+ void\r
+ down()\r
+ throws Exception\r
{\r
lock.lock();\r
try\r
\r
}\r
\r
+ /**\r
+ * Server initialization process\r
+ * \r
+ * @throws Exception If exception is occurred\r
+ */\r
abstract protected void initialize() throws Exception;\r
\r
+ /**\r
+ * Unit process of main job\r
+ * \r
+ * @throws Exception If exception is occurred\r
+ */\r
abstract protected void process() throws Exception;\r
\r
+ /**\r
+ * Server clean-up process\r
+ */\r
abstract protected void terminate();\r
}\r
+/*\r
+ * Common\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: \r
+ * BonYong Lee <bonyong.lee@samsung.com>\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ *\r
+ */\r
package org.tizen.common.daemon;\r
\r
-public interface Server\r
+/**\r
+ * <p>\r
+ * Server\r
+ * \r
+ * Interface to daemon( thread )\r
+ *\r
+ * </p>\r
+ * \r
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)\r
+ */\r
+public interface\r
+Server\r
{\r
+ /**\r
+ * boot daemon up\r
+ * \r
+ * @throws Exception If process is failed\r
+ */\r
void boot() throws Exception;\r
\r
+ /**\r
+ * shut daemon down\r
+ * @throws Exception If process is failed\r
+ */\r
void down() throws Exception;\r
\r
}\r
+/*\r
+ * Common\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: \r
+ * BonYong Lee <bonyong.lee@samsung.com>\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ *\r
+ */\r
package org.tizen.common.daemon;\r
\r
+/**\r
+ * <p>\r
+ * ServerState\r
+ * \r
+ * State of {@link Server}\r
+ * <ul>\r
+ * <li>{@link #Terminated}</li>\r
+ * <li>{@link #Initializing}</li>\r
+ * <li>{@link #Running}</li>\r
+ * <li>{@link #Halting}</li>\r
+ * </p>\r
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)\r
+ *\r
+ */\r
public enum ServerState\r
{\r
+ /**\r
+ * Stopped state\r
+ */\r
Terminated,\r
\r
+ /**\r
+ * State to request boot\r
+ */\r
Initializing,\r
\r
+ /**\r
+ * State to run\r
+ */\r
Running,\r
\r
+ /**\r
+ * State to request down\r
+ */\r
Halting\r
\r
}\r
{
CWD, // Current Working Directory
PATH, // Abstract canonical path
+ NAME, // file name
TYPE, // Type( FILE / DIRECTORY / UNKNOWN )
EXISTS, // true / false
READABLE, // true / false
HIDDEN, // true / false
READONLY, // true / false
MODIFIED, // long
+ SIZE, // long
URI, // String
URL, // String
QUALIFIED,
import static org.tizen.common.util.ArrayUtil.size;
import static org.tizen.common.util.FilenameUtil.addTailingPath;
+import static org.tizen.common.util.FilenameUtil.getCanonicalForm;
import static org.tizen.common.util.FilenameUtil.getCanonicalFragments;
import static org.tizen.common.util.FilenameUtil.getFilename;
import static org.tizen.common.util.FilenameUtil.removeTailingPath;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.tizen.common.util.FilenameUtil;
import org.tizen.common.util.IOUtil;
import org.tizen.common.util.StringUtil;
return ( null != file );
}
+ else if ( Attribute.SIZE.equals( name ) )
+ {
+ if ( null == file || null == file.getContents() )
+ {
+ return (long) 0;
+ }
+ return (long) file.getContents().length;
+ }
else if ( Attribute.PATH.equals( name ) )
{
if ( path.startsWith( ROOT_PREFIX ) )
{
- return FilenameUtil.getCanonicalForm ( path );
+ return getCanonicalForm( path );
}
- return FilenameUtil.getCanonicalForm ( FilenameUtil.addTailingPath( cwd, path ) );
+ return getCanonicalForm ( addTailingPath( cwd, path ) );
+ }
+ else if ( Attribute.NAME.equals( name ) )
+ {
+ return getFilename( path );
}
else if ( Attribute.URI.equals( name ) || Attribute.URL.equals( name ) )
{
*/
public class FilenameUtil
{
+ /**
+ * character using separator
+ */
public static final char SEPARATOR_DIRECTORY = '/';
+ /**
+ * result of {@link #isVaildName(String)} and {@link #isVaildName(String, int)
+ */
public static final int IS_VALID_NAME = 0;
public static final int HAS_INVALID_CHARACTER = 1;
public static final int HAS_NO_NAME = 2;
return ret.toArray( new String[0] );
}
+ /**
+ * return tailing path in <code>path</code> from <code>start</code>
+ *
+ * @param path file path
+ * @param start the number of path fragment
+ *
+ * @return result file path fragments
+ */
public static
String
getTailingPath(
return buffer.toString();
}
+ /**
+ * remove <code>numberOfPath</code> path fragments from <code>path</code>
+ * @param path file path
+ * @param numberOfPath the number of path fragment to remove
+ *
+ * @return result file path
+ */
public static
String
removeTailingPath(
return buffer.toString();
}
+ /**
+ * concatenate <code>path</code> and <code>pathToAdd</code>
+ *
+ * @param path parent path
+ * @param pathToAdd path fragment to add
+ *
+ * @return result file path
+ */
public static
String
addTailingPath(
return trimTrailingCharacter( path, SEPARATOR_DIRECTORY ) + SEPARATOR_DIRECTORY + trimLeadingCharacter( pathToAdd, SEPARATOR_DIRECTORY );
}
+ /**
+ * return value if <code>root</code> contains <code>filePath</code> as descendant
+ *
+ * @param root file path
+ * @param filePath file path
+ *
+ * @return boolean value to check
+ */
public static
boolean
isAncestor( final String root, final String filePath )
return true;
}
+ /**
+ * return relative path of <code>filePath</code> based <code>root</code>
+ *
+ * @param root base path
+ * @param filePath file path
+ *
+ * @return relative path
+ */
public static
String
getRelativePath(
for ( int i = 0, n = rootFragments.length ; i < n ; ++i )
{
- Assert.isTrue( ObjectUtil.equals( rootFragments[i], fileFragments[i] ) );
+ Assert.isTrue( ObjectUtil.equals( rootFragments[i], fileFragments[i] ), i + "th [" + rootFragments[i] + "] != [" + fileFragments[i] + "]" );
}
-
-
final StringBuilder buffer = new StringBuilder();
for ( int i = rootFragments.length, n = fileFragments.length ; i < n ; ++i )
}
+ /**
+ * Compare <code>path1</code> and <code>path2</code> and return equality
+ *
+ * @param path1 file path1
+ * @param path2 file path2
+ *
+ * @return equality
+ */
public static boolean equals( final String path1, final String path2 )
{
return ObjectUtil.equals( path1, path2 );
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
+import org.tizen.common.config.provider.PropertiesProvider;
/**
* ExpressionParserTest
new String[] { "msg10", "^${abc}" }
};
+ PropertiesProvider provider = new PropertiesProvider();
for ( final String[] CONFIG : CONFIGS )
{
final String key = CONFIG[0];
final String exp = CONFIG[1];
- Preference.register( null, key, exp );
+ provider.set( key, exp );
}
+
+
+ Preference.register( "default", provider );
}
+ /**
+ * clean up test case
+ *
+ * @throws Exception in case of failure in clean-up
+ */
@After
public
void
final String key = TEST_CASE[0];
final String value = TEST_CASE[1];
- assertEquals( value, Preference.getValue( key, null ) );
+ assertEquals( "Key :" + key + ", Value :" + value, value, Preference.getValue( key, null ) );
}
}
import java.util.Properties;\r
\r
import org.junit.Test;\r
-import org.tizen.common.config.loader.PropertiesLoader;\r
+import org.tizen.common.config.provider.PropertiesProvider;\r
\r
\r
/**\r
}\r
\r
/**\r
- * Test {@link Preference#find(String)}\r
- * \r
- * @throws Exception in case of failure in test\r
- * \r
- * @see {@link Preference#find(String)}\r
- */\r
- public void\r
- test_find()\r
- throws Exception {\r
- final ClassLoader cl =\r
- Thread.currentThread().getContextClassLoader();\r
-\r
- final InputStream in =\r
- cl.getResourceAsStream( "test.properties" );\r
-\r
- try\r
- {\r
- final Properties props = new Properties();\r
- props.load( in ); \r
-\r
- final PropertiesLoader loader = new PropertiesLoader( props );\r
- loader.load( "test" );\r
-\r
- assertEquals( null, Preference.getValue( "hello", null ) );\r
-\r
- Preference.addRule( new Rule.PatternRule( "*Test", "test" ) );\r
-\r
- assertEquals( "world", Preference.find( "hello" ) );\r
- assertEquals( "${b}", Preference.find( "a" ) );\r
- assertEquals( null, Preference.find( "hello1" ) );\r
-\r
-\r
- }\r
- finally\r
- {\r
- tryClose( in );\r
- Preference.clear();\r
- Preference.clearRule();\r
- }\r
- }\r
-\r
- /**\r
* Test {@link Preference#getValue(String, String)}\r
* \r
* @throws Exception in case of failure in test\r
final Properties props = new Properties();\r
props.load( in ); \r
\r
- final PropertiesLoader loader = new PropertiesLoader( props );\r
- loader.load( "test" );\r
-\r
assertEquals( null, Preference.getValue( "hello", null ) );\r
-\r
- Preference.addRule( new Rule.PatternRule( "*Test", "test" ) );\r
+ \r
+ final PropertiesProvider provider = new PropertiesProvider( props );\r
+ Preference.register( "test", provider );\r
\r
assertEquals( "world", Preference.getValue( "hello", null ) );\r
assertEquals( "c", Preference.getValue( "a", null ) );\r
finally\r
{\r
tryClose( in );\r
- Preference.clear();\r
- Preference.clearRule();\r
}\r
}\r
\r
+++ /dev/null
-/*
- * Common
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * BonYong Lee <bonyong.lee@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-package org.tizen.common.config.loader;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import org.junit.Test;
-import org.tizen.common.config.Loader;
-import org.tizen.common.config.Preference;
-
-/**
- * StructuredResourceLoaderTest
- *
- * Test case for {@link StructuredResourceLoader}
- *
- * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)
- *
- * @see StructuredResourceLoader
- */
-public class
-StructuredResourceLoaderTest
-{
- /**
- * Test {@link StructuredResourceLoader#load(String)}
- *
- * @throws Exception in case of failure in test
- *
- * @see {@link StructuredResourceLoader#load(String)}
- */
- @Test
- public
- void
- test_load()
- throws Exception {
- final Source src = new ResourceSource( getClass().getPackage().getName().replace( '.', '/' ) + "/logging.ini" );
- final Loader reader = new StructuredResourceLoader( src );
- try
- {
-
- reader.load( "escode.logging." );
-
- assertNotNull( Preference.getNamespaces() );
-
- assertEquals( 4, Preference.getNamespaces().size() );
-
- assertEquals( 3, Preference.list( "escode.logging.layout" ).size() );
- assertEquals( 6, Preference.list( "escode.logging.appender" ).size() );
- assertEquals( 8, Preference.list( "escode.logging.logger" ).size() );
- }
- finally
- {
- Preference.clear();
- Preference.clearRule();
- }
- }
-
-}
+++ /dev/null
-[layout]\r
-layout\r
- class=org.tizen.layout\r
- pattern=%m%n\r
-[appender]\r
-ap1\r
- class=org.tizen.appender1\r
- layout=layout1\r
-ap2\r
- class=org.tizen.appender2\r
- layout=layout1\r
- \r
-[logger]\r
-logger\r
- level=debug\r
- ap1\r
-logger2\r
- level=debug\r
- ap1\r
- ap2\r
- logger\r
- level=info\r
--- /dev/null
+/*\r
+ * Common\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: \r
+ * BonYong Lee <bonyong.lee@samsung.com>\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ *\r
+ */\r
+package org.tizen.common.core.command.zip;\r
+\r
+import static org.junit.Assert.assertEquals;\r
+import static org.junit.Assert.assertTrue;\r
+import static org.tizen.common.util.IOUtil.tryClose;\r
+\r
+import java.io.InputStream;\r
+import java.util.jar.JarEntry;\r
+import java.util.jar.JarInputStream;\r
+\r
+import org.junit.Test;\r
+import org.tizen.common.core.command.CommandTest;\r
+import org.tizen.common.core.command.ExecutionContext;\r
+import org.tizen.common.core.command.Executor;\r
+import org.tizen.common.file.FileHandler.Attribute;\r
+import org.tizen.common.file.VirtualFileHandler;\r
+\r
+/**\r
+ * JarCommandTest\r
+ *\r
+ * Test case for {@link JarCommand}\r
+ * \r
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)\r
+ * \r
+ * @see JarCommand\r
+ */\r
+public class JarCommandTest\r
+extends CommandTest\r
+{\r
+\r
+ /**\r
+ * Test {@link JarCommand#execute(Executor, ExecutionContext)}\r
+ * \r
+ * @throws Exception in case of failure in test\r
+ * \r
+ * @see JarCommand#execute(Executor, ExecutionContext)\r
+ */\r
+ @Test\r
+ public\r
+ void\r
+ test_execute()\r
+ throws Exception\r
+ {\r
+ // Given\r
+ final VirtualFileHandler vfs = (VirtualFileHandler) context.getFileHandler();\r
+ vfs.makeDirectory( "/test" );\r
+ vfs.write( "/test/a.txt", "Hello, World" );\r
+ \r
+ // When\r
+ final JarCommand command = new JarCommand( "/test", "/test.jar" );\r
+ command.run( getExecutor(), getExecutionContext() );\r
+ \r
+ // Then\r
+ assertTrue( (Boolean) vfs.get( "/test.jar", Attribute.EXISTS ) );\r
+ final InputStream in = vfs.read( "/test.jar" );\r
+\r
+ final JarInputStream zipIn = new JarInputStream( in );\r
+ try\r
+ {\r
+ final JarEntry en = zipIn.getNextJarEntry();\r
+ assertEquals( "a.txt", en.getName() );\r
+ }\r
+ finally\r
+ {\r
+ tryClose( in );\r
+ }\r
+ \r
+ }\r
+}\r
*/
package org.tizen.common.core.command.zip;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-import static org.tizen.common.util.ArrayUtil.size;
-import static org.tizen.common.util.IOUtil.getBytes;
+import static org.tizen.common.util.IOUtil.tryClose;
import java.io.InputStream;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
import org.junit.Test;
import org.tizen.common.core.command.CommandTest;
* @see ZipCommand#execute(Executor, ExecutionContext)
*/
@Test
- public void test_execute() throws Exception {
+ public
+ void
+ test_execute()
+ throws Exception
+ {
// Given
final VirtualFileHandler vfs = (VirtualFileHandler) context.getFileHandler();
vfs.makeDirectory( "/test" );
// Then
assertTrue( (Boolean) vfs.get( "/test.zip", Attribute.EXISTS ) );
final InputStream in = vfs.read( "/test.zip" );
- assertTrue( 0 < size( getBytes( in, true ) ) );
-
+
+ final ZipInputStream zipIn = new ZipInputStream( in );
+ try
+ {
+ final ZipEntry en = zipIn.getNextEntry();
+ assertEquals( "a.txt", en.getName() );
+ }
+ finally
+ {
+ tryClose( in );
+ }
}
}
}
}
+ /**
+ * Test {@link FilenameUtil#getCanonicalForm(String)}
+ *
+ * @throws Exception in case of failure in test
+ *
+ * @see FilenameUtil#getCanonicalForm(String)
+ */
@Test
public void test_getCanonicalForm() throws Exception
{