You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@any23.apache.org by le...@apache.org on 2017/09/15 07:52:15 UTC

svn commit: r21620 [6/7] - in /dev/any23: ./ 2.1/ 2.1/apache-any23-service-2.1/ 2.1/apache-any23-service-2.1/META-INF/ 2.1/apache-any23-service-2.1/WEB-INF/ 2.1/apache-any23-service-2.1/WEB-INF/classes/ 2.1/apache-any23-service-2.1/WEB-INF/classes/org/...

Added: dev/any23/2.1/apache-any23-service-2.1/resources/form.html
==============================================================================
--- dev/any23/2.1/apache-any23-service-2.1/resources/form.html (added)
+++ dev/any23/2.1/apache-any23-service-2.1/resources/form.html Fri Sep 15 07:52:10 2017
@@ -0,0 +1,414 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You 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.
+-->
+<html xmlns:lang="en"
+    xmlns:xhtml="http://www.w3.org/1999/xhtml"
+    xmlns:dc="http://purl.org/dc/elements/1.1/">
+  <head>
+    <title>Apache Any23: Anything To Triples - Service 2.1 (2017-09-15 07:11:43+0000)</title>
+    <link rel="stylesheet" type="text/css" href="resources/css/bootstrap.min.css" />
+    <script type="text/javascript" src="resources/js/jquery-1.7.2.min.js"></script>
+    <script type="text/javascript" src="resources/js/bootstrap-modal.js"></script>
+    <script type="application/javascript">
+jQuery( document ).ready( function($)
+{
+    $.each( $( '.app-base-uri' ), function()
+    {
+        $( this ).text( document.location );
+    });
+
+    $( '#app-path' ).text( document.location.pathname );
+    $( '#app-host' ).text( document.location.host );
+} );
+
+function showModal( id )
+{
+    $( id ).modal( 'show' );
+}
+    </script>
+  </head>
+  <body>
+  <div class="container">
+    <a href="http://any23.apache.org/" title="Apache Any23 Dev Site" target="_blank">
+        <img
+            alt="Apache Any23 Dev Site"
+            src="resources/images/logo-any23-214x97.png"
+            width="90"
+        /></a>
+      <a href="http://www.apache.org/" title="Apache Software Foundation" target="_blank">
+        <img
+            alt="Apache Software Foundation"
+            src="resources/images/logo-apache-90x30.png"
+            width="90"
+        /></a>
+
+    <h1>Apache Any23 - Anything To Triples - Live Service Demo</h1>
+    <p>Parses Microformats, RDFa, Microdata, RDF/XML, Turtle, N-Triples, JSON-LD and NQuads.</p>
+    <p>Download and install Any23: visit the <a href="http://any23.apache.org/" target="_blank">Developers Site</a> and the <a href="http://any23.apache.org/getting-started.html" target="_blank">Documentation</a>.
+    <hr />
+    <h2>Convert document at IRI</h2>
+    <form class="well form-horizontal" method="get" action="any23/">
+      <label>Pick an output format and enter the IRI of a web document:</label>
+
+      <div class="control-group">
+        <label class="control-label app-base-uri" for="format">http://.../</label>
+        <div class="controls">
+            <select id="format" name="format">
+            <option value="best" selected="selected">best</option>
+            <option value="turtle">turtle</option>
+            <option value="ntriples">ntriples</option>
+            <option value="rdfxml">rdfxml</option>
+            <option value="nquads">nquads</option>
+            <option value="trix">trix</option>
+            <option value="json">json</option>
+          </select>/<input type="text" size="50" name="uri" value="http://twitter.com/cygri" />
+        </div>
+      </div>
+      <div class="control-group">
+        <label class="control-label" for="url-validation-get">Validation</label>
+        <div class="controls">
+          <select id="url-validation-get" name="validation-mode" onclick="if(document.getElementById('url-validation-get').value.indexOf('validate') == 0) { document.getElementById('url-report-get').checked = true; }">
+          <option value="none">none</option>
+          <option value="validate">validate</option>
+          <option value="validate-fix">validate+fix</option>
+        </select>
+          <a href="javascript:showModal( '#sPopup-fix' );">[?]</a>
+        </div>
+      </div>
+      <div class="control-group">
+        <label class="control-label" for="url-report">Report</label>
+          <div class="controls">
+           <label class="checkbox">
+             <input id="url-report-get" type="checkbox" name="report">
+             <a href="javascript:showModal( '#sPopup-report' );">[?]</a>
+          </label>
+        </div>
+      </div>
+      <div class="control-group">
+        <label class="control-label" for="url-annotate-get">Annotate</label>
+          <div class="controls">
+           <label class="checkbox">
+             <input id="url-annotate-get" type="checkbox" type="checkbox" name="annotate">
+             <a href="javascript:showModal( '#sPopup-annotate' );">[?]</a>
+          </label>
+        </div>
+      </div>
+    <div class="form-actions">
+      <button type="submit" class="btn btn-primary">Convert</button>
+      <button type="reset" class="btn">Cancel</button>
+    </div>
+    </form>
+    <hr />
+
+    <h2>Convert copy&amp;pasted document</h2>
+    <form class="well form-horizontal" method="post" action="any23/">
+      <div class="control-group">
+        <label class="control-label" for="type">Input format</label>
+        <div class="controls">
+            <select id="type" name="type">
+            <option value="">auto-detect</option>
+            <option value="text/html">HTML with Microformats, RDFa (text/html)</option>
+            <option value="application/xhtml+xml">XHTML with Microformats, RDFa, Microdata (application/xhtml+xml)</option>
+            <option value="text/turtle">Turtle (text/turtle)</option>
+            <option value="text/nt">N-Triples (text/nt)</option>
+            <option value="text/nq">N-Quads (text/nq)</option>
+            <option value="application/trix">TriX (application/trix)</option>
+            <option value="application/rdf+xml">RDF/XML (application/rdf+xml)</option>
+            <option value="text/csv">CSV (text/csv)</option>
+            <option value="application/ld+json">JSON-LD (application/ld+json)</option>
+          </select>
+        </div>
+      </div>
+      <div class="control-group">
+        <label class="control-label" for="out-format">Output format</label>
+        <div class="controls">
+            <select id="out-format" name="format">
+            <option value="best" selected="selected">best (content-negotiated)</option>
+            <option value="turtle">turtle</option>
+            <option value="ntriples">ntriples</option>
+            <option value="rdfxml">rdfxml</option>
+            <option value="nquads">nquads</option>
+            <option value="trix">trix</option>
+            <option value="json">json</option>
+          </select>
+        </div>
+      </div>
+      <div class="control-group">
+        <label class="control-label" for="url-validation-post">Validation</label>
+        <div class="controls">
+          <select id="url-validation-post" name="validation-mode" onclick="if(document.getElementById('url-validation-post').value.indexOf('validate') == 0) { document.getElementById('url-report-post').checked = true; }">
+            <option value="none">none</option>
+            <option value="validate">validate</option>
+            <option value="validate-fix">validate+fix</option>
+          </select>
+          <a href="javascript:showModal( '#sPopup-fix' );">[?]</a>
+        </div>
+      </div>
+      <div class="control-group">
+        <label class="control-label" for="url-report">Report</label>
+          <div class="controls">
+           <label class="checkbox">
+             <input id="url-report-post" type="checkbox" name="report">
+             <a href="javascript:showModal( '#sPopup-report' );">[?]</a>
+          </label>
+        </div>
+      </div>
+      <div class="control-group">
+        <label class="control-label" for="url-annotate-post">Annotate</label>
+          <div class="controls">
+           <label class="checkbox">
+             <input id="url-annotate-post" type="checkbox" type="checkbox" name="annotate">
+             <a href="javascript:showModal( '#sPopup-annotate' );">[?]</a>
+          </label>
+        </div>
+      </div>
+
+        <textarea class="span11" name="body" rows="12">@prefix foaf: &lt;http://xmlns.com/foaf/0.1/&gt; .
+
+[] a foaf:Person;
+    foaf:name "John X. Foobar";
+    foaf:mbox_sha1sum "cef817456278b70cee8e5a1611539ef9d928810e";
+    .</textarea>
+      
+    <div class="form-actions">
+      <button type="submit" class="btn btn-primary">Convert</button>
+      <button type="reset" class="btn">Cancel</button>
+    </div>
+
+    </form>
+    <hr />
+
+    <h2>API quick reference</h2>
+    <h3>Examples</h3>
+    <ul>
+      <li><code><a href="best/twitter.com/cygri"><span class="app-base-uri">http://.../</span>best/twitter.com/cygri</a></code></li>
+      <li><code><a href="rdfxml/http://data.gov"><span class="app-base-uri">http://.../</span>rdfxml/http://data.gov</a></code></li>
+      <li><code><a href="ttl/http://www.w3.org/People/Berners-Lee/card"><span class="app-base-uri">http://.../</span>ttl/http://www.w3.org/People/Berners-Lee/card</a></code></li>
+      <li><code><a href="?uri=http://dbpedia.org/resource/Berlin"><span class="app-base-uri">http://.../</span>?uri=http://dbpedia.org/resource/Berlin</a></code></li>
+      <li><code><a href="?format=nt&uri=http://dbpedia.org/resource/Berlin"><span class="app-base-uri">http://.../</span>?format=nt&uri=http://dbpedia.org/resource/Berlin</a></code></li>
+    </ul>
+    <h3>Compact API</h3>
+    <p>HTTP GET requests can be made
+      to IRIs of the shape</p>
+    <pre><span class="app-base-uri">http://.../</span><em>format</em>/<em>input-uri</em></pre>
+    <p>The response is the input document converted to the desired output format.</p>
+
+    <h3>Form-style GET API</h3>
+    <p>HTTP GET requests can be made to
+      the IRI
+      <code class="app-base-uri">http://.../</code> with the following
+      query parameters:
+    </p>
+    <table class="table">
+      <tr><th>uri</th><td>IRI of an input document.</td></tr>
+      <tr><th>format</th><td>Desired output format, defaults to <code>best</code>.</td></tr>
+      <tr><th>validation-mode</th><td>The validation level to be applied on the input. Possible values:<br/>
+          <code>none</code> (no validation applied);<br/>
+          <code>validate</code>(apply validation and produce validation report if <code>annotate</code> flag is enabled);<br/>
+          <code>validate+fix</code>(apply validation, try to fix detection issues and produce validation report if <code>annotate</code> flag is enabled).</td>
+      </tr>
+      <tr><th>annotate</th><td>If specified the output RDF will contain extractor specific scope comments.<br/>Possible values: <code>on</code>/<code>off</code></td></tr>
+      <tr><th>report</th><td>If specified will produce a full XML report containing extraction and validation issues other than produced metadata.<br/>Possible values: <code>on</code>/<code>off</code></td></tr>
+    </table>
+    Such URL will return an HTTP <i>302</i> redirect to <code><span class="app-base-uri">http://...</span>any23/<em>format</em></code>.<br/>
+    <p>The response is the input document converted to the desired output format.</p>
+
+    <h3>Direct POST API</h3>
+    <p>HTTP POSTing a document body to
+      <code><span class="app-base-uri">http://.../</span><em>format</em></code> will convert
+      the document to the specified output format. <br/>
+      The media type of the input
+      has to be specified in the <code>Content-Type</code> HTTP header.
+      Depending on the servlet container, a <code>Content-Length</code> header specifying
+      the length of the input document in bytes might also be required.<br/>
+      Typical media types for supported input formats are:
+    </p>
+    <table class="table">
+      <tr><th>Input format</th><th>Media type</th></tr>
+      <tr><th>HTML</th><td><code>text/html</code></td></tr>
+      <tr><th>RDF/XML</th><td><code>application/rdf+xml</code></td></tr>
+      <tr><th>Turtle</th><td><code>text/turtle</code></td></tr>
+      <tr><th>N-Triples</th><td><code>text/nt</code></td></tr>
+      <tr><th>N-Quads</th><td><code>text/nq</code></td></tr>
+      <tr><th>TriX</th><td><code>application/trix</code></td></tr>
+    </table>
+    <p>Example POST request:</p>
+    <pre>POST <span id="app-path">/</span>rdfxml HTTP/1.0
+Host: <span id="app-host">example.com</span>
+Content-Type: text/turtle
+Content-Length: 174
+
+@prefix foaf: &lt;http://xmlns.com/foaf/0.1/&gt; .
+
+[] a foaf:Person;
+    foaf:name "John X. Foobar";
+    foaf:mbox_sha1sum "cef817456278b70cee8e5a1611539ef9d928810e";
+    .</pre>
+
+    <h3>Form-style POST API</h3>
+    <p>A document body can also be converted by HTTP POSTing form data to
+      <code><span class="app-base-uri">http://.../</span></code>. <br/>
+      The <code>Content-Type</code> HTTP header must be set to
+      <code>application/x-www-form-urlencoded</code>. The following
+      parameters are supported:
+    </p>
+    <table class="table">
+      <tr><th>type</th><td>Media type of the input, see the table above. If not present, auto-detection will be attempted.</td></tr>
+      <tr><th>body</th><td>Document body to be converted.</td></tr>
+      <tr><th>format</th><td>Desired output format; defaults to <code>best</code>.</td></tr>
+      <tr><th>validation-mode</th><td>The validation level to be applied on the input. Possible values:<br/>
+        <code>none</code> (no validation applied);<br/>
+        <code>validate</code>(apply validation and produce validation report if <code>annotate</code> flag is enabled);<br/>
+        <code>validate+fix</code>(apply validation, try to fix detection issues and produce validation report if <code>annotate</code> flag is enabled).</td>
+      </tr>
+      <tr><th>annotate</th><td>If specified the output RDF will contain extractor specific scope comments.<br/>Possible values: <code>on</code>/<code>off</code></td></tr>
+      <tr><th>report</th><td>If specified will produce a full XML report containing extraction and validation issues other than produced metadata.<br/>Possible values: <code>on</code>/<code>off</code></td></tr>
+    </table>
+
+    <h3>Output formats</h3>
+    <p>Supported output format identifiers are:</p>
+    <ul>
+      <li><code>best</code> for content negotiation according to the client's <code>Accept</code> HTTP header</li>
+      <li><code>turtle</code>, <code>ttl</code>, <code>n3</code> for
+        <a href="http://www.w3.org/TeamSubmission/turtle/" target="_blank">Turtle</a>/<a href="http://www.w3.org/DesignIssues/Notation3" target="_blank">N3</a></li>
+      <li><code>ntriples</code>, <code>nt</code> for
+        <a href="http://www.w3.org/TR/rdf-testcases/#ntriples" target="_blank">N-Triples</a></li>
+      <li><code>nquads</code>, <code>nq</code> for
+        <a href="http://sw.deri.org/2008/07/n-quads/" target="_blank">N-Quads</a></li>
+      <li><code>trix</code> for
+        <a href="http://www.w3.org/2004/03/trix/" target="_blank">TriX</a></li>
+      <li><code>rdfxml</code>, <code>rdf</code>, <code>xml</code> for
+        <a href="http://www.w3.org/TR/rdf-syntax-grammar/" target="_blank">RDF/XML</a></li>
+      <li><code>json</code> for <a href="http://json.org/" target="_blank">JSON</a></li>
+    </ul>
+
+    <h3>Error reporting</h3>
+    <p>Processing errors are indicated via
+      HTTP status codes and brief <code>text/plain</code> error messages.
+      The following status codes can be returned:</p>
+    <table class="table">
+      <thead>
+        <tr><th>Code</th><th>Reason</th></tr>
+      </thead>
+      <tbody>
+        <tr><th>200 OK</th><td>Success</td></tr>
+        <tr><th>400 Bad Request</th><td>Missing or malformed input parameter</td></tr>
+        <tr><th>404 Not Found</th><td>Malformed request IRI</td></tr>
+        <tr><th>406 Not Acceptable</th><td>None of the media types specified in the <code>Accept</code> header are supported</td></tr>
+        <tr><th>415 Unsupported Media Type</th><td>Document body with unsupported media type was POSTed</td></tr>
+        <tr><th>501 Not Implemented</th><td>Extraction from input was successful, but yielded zero triples</td></tr>
+        <tr><th>502 Bad Gateway</th><td>Input document from a remote server could not be fetched or parsed</td></tr>
+      </tbody>
+    </table>
+    <h3>Report Format</h3>
+    <p>The XML report format is subjected to changes. The current content is described in section
+       <a href="http://any23.apache.org/service.html" target="_blank">Any23 Service</a>.
+    </p>
+    <hr />
+    <p><b>Apache Any23 v.2.1 (2017-09-15 07:11:43+0000)</b></p>
+    <p><a href="http://any23.apache.org/" target="_blank">Any23 project homepage</a> | Hosted at <a href="http://apache.org/" target="_blank">Apache Software Foundation</a></p>
+
+    <div id="sPopup-fix" class="modal hide fade">
+      <div class="modal-header">
+        <button type="button" class="close" >×</button>
+        <h3>Validation</h3>
+      </div>
+      <div class="modal-body">
+        <p> 
+          The <b>Any23</b> service tries to fix some <a href="http://www.deri.ie/fileadmin/documents/DERI-TR-2009-07-28.pdf" target="_blank">common issues</a>
+          before performing a metadata extraction. The fixing is performed according a set of fully customizable rules. 
+        </p>
+        <p>
+          The following <i>Validation</i> options are available.
+        </p>
+        <ul>
+          <li><b>none</b>: no validation will be performed;</li>
+          <li><b>validate</b>: common errors within the document will be detected and reported. When selected this option the
+              <b>Report</b> flag will be activated to visualize the validation outcome;</li>
+          <li><b>validate+fix</b>: the common issues will be detected and a fix will be applied when available.</li>
+        </ul>
+        <p>
+          Please refer to the <a href="http://any23.apache.org/dev-validation-fix.html" target="_blank">Developer Guide</a>
+          for any further detail.
+        </p>
+      </div>
+      <div class="modal-footer">
+        <a href="#" class="btn" >Close</a>
+      </div>
+    </div>
+
+    <div id="sPopup-report" class="modal hide fade">
+      <div class="modal-header">
+        <button type="button" class="close">×</button>
+        <h3>Report</h3>
+      </div>
+      <div class="modal-body">
+        <p>
+        If the <i>Report</i> checkbox is selected, the <b>Any23</b> service returns an <b>XML</b> output containing,
+        other then the <b>extracted RDF statements</b>, other information as the list of the <b>activated extractors</b>
+        and the <b>detected errors</b>.
+        </p>
+        <p>
+        If the <b>validation</b> or <b>validation and fix</b> has been activated then the report contains also a list
+        of the applied fixes.
+        </p>
+      </div>
+      <div class="modal-footer">
+        <a href="#" class="btn">Close</a>
+      </div>
+    </div>
+
+    <div id="sPopup-annotate" class="modal hide fade">
+      <div class="modal-header">
+        <button type="button" class="close">×</button>
+        <h3>Annotate</h3>
+      </div>
+      <div class="modal-body">
+        <p>
+        If the <i>Annotate</i> checkbox is selected, the <b>Any23</b> service returns an output expressed in the
+        selected <b>RDF</b> format containing also specific format <b>comments</b> describing the activated extractor
+        scopes for every produced statement.
+        </p>
+      </div>
+      <div class="modal-footer">
+        <a href="#" class="btn">Close</a>
+      </div>
+    </div>
+
+  </div>
+
+  <footer class="footer">
+  <div class="container-fluid">
+  Copyright &copy; 2010-2014 The <a href="http://www.apache.org/">Apache Software Foundation</a>. All Rights Reserved.<br/> Apache Any23, Apache, the Apache feather logo, and the Apache Any23 project logos are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.
+  </div>
+  </footer>
+
+  <!-- Google Analytics Tracker code. By default configured to report to the Any23 community group.
+  To change this default behavior please specify your custom ID in parent POM (form.tracker.id property)
+  or delete this script block to disable. -->
+  <script>
+    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+    ga('create', 'UA-59636188-1', 'auto');
+    ga('send', 'pageview');
+  </script>
+
+  </body>
+</html>

Added: dev/any23/2.1/apache-any23-service-2.1/resources/images/logo-any23-214x97.png
==============================================================================
Binary file - no diff available.

Propchange: dev/any23/2.1/apache-any23-service-2.1/resources/images/logo-any23-214x97.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: dev/any23/2.1/apache-any23-service-2.1/resources/images/logo-apache-90x30.png
==============================================================================
Binary file - no diff available.

Propchange: dev/any23/2.1/apache-any23-service-2.1/resources/images/logo-apache-90x30.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: dev/any23/2.1/apache-any23-service-2.1/resources/js/bootstrap-modal.js
==============================================================================
--- dev/any23/2.1/apache-any23-service-2.1/resources/js/bootstrap-modal.js (added)
+++ dev/any23/2.1/apache-any23-service-2.1/resources/js/bootstrap-modal.js Fri Sep 15 07:52:10 2017
@@ -0,0 +1,218 @@
+/* =========================================================
+ * 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);
\ No newline at end of file