Merge branch 'pretty' of github.com:fnp/wolnelektury into pretty
authorMarcin Koziej <marcin.koziej@nowoczesnapolska.org.pl>
Mon, 30 Jan 2012 16:44:44 +0000 (17:44 +0100)
committerMarcin Koziej <marcin.koziej@nowoczesnapolska.org.pl>
Mon, 30 Jan 2012 16:44:44 +0000 (17:44 +0100)
Conflicts:
wolnelektury/templates/catalogue/book_searched.html

32 files changed:
apps/catalogue/templatetags/catalogue_tags.py
apps/search/forms.py
apps/search/index.py
apps/search/views.py
apps/social/forms.py
apps/social/templates/social/sets_form.html
apps/social/templates/social/shelf_tags.html
lib/librarian
wolnelektury/locale/pl/LC_MESSAGES/django.mo
wolnelektury/locale/pl/LC_MESSAGES/django.po
wolnelektury/settings.py
wolnelektury/static/css/base.css
wolnelektury/static/css/catalogue.css
wolnelektury/static/css/cite.css
wolnelektury/static/css/dialogs.css
wolnelektury/static/css/header.css
wolnelektury/static/css/ie.css [new file with mode: 0644]
wolnelektury/static/fonts/WL-Nav.eot [new file with mode: 0644]
wolnelektury/static/img/bg-header.png
wolnelektury/static/js/base.js
wolnelektury/static/js/dialogs.js
wolnelektury/static/js/jquery.labelify.js [deleted file]
wolnelektury/static/js/modernizr-latest.js [new file with mode: 0644]
wolnelektury/static/js/search.js
wolnelektury/templates/base.html
wolnelektury/templates/catalogue/book_detail.html
wolnelektury/templates/catalogue/book_fragments.html
wolnelektury/templates/catalogue/book_searched.html
wolnelektury/templates/catalogue/fragment_short.html
wolnelektury/templates/catalogue/search_multiple_hits.html
wolnelektury/templates/catalogue/tagged_object_list.html
wolnelektury/templates/main_page.html

index cf80beb..e8bc138 100644 (file)
@@ -7,6 +7,7 @@ import feedparser
 
 from django import template
 from django.template import Node, Variable, Template, Context
+from django.core.cache import cache
 from django.core.urlresolvers import reverse
 from django.contrib.auth.forms import UserCreationForm, AuthenticationForm
 from django.utils.translation import ugettext as _
@@ -266,17 +267,14 @@ def latest_blog_posts(feed_url, posts_to_show=5):
 def tag_list(tags, choices=None):
     if choices is None:
         choices = []
-    if len(tags) == 1:
+    if len(tags) == 1 and tags[0].category not in [t.category for t in choices]:
         one_tag = tags[0]
     return locals()
 
+
 @register.inclusion_tag('catalogue/inline_tag_list.html')
 def inline_tag_list(tags, choices=None):
-    if choices is None:
-        choices = []
-    if len(tags) == 1:
-        one_tag = tags[0]
-    return locals()
+    return tag_list(tags, choices)
 
 
 @register.inclusion_tag('catalogue/book_info.html')
@@ -348,14 +346,23 @@ def fragment_promo(arg=None):
 
 
 @register.inclusion_tag('catalogue/related_books.html')
-def related_books(book, limit=6):
-    related = list(Book.objects.filter(
-        common_slug=book.common_slug).exclude(pk=book.pk)[:limit])
-    limit -= len(related)
-    if limit:
-        related += Book.tagged.related_to(book,
-                Book.objects.exclude(common_slug=book.common_slug),
-                ignore_by_tag=book.book_tag())[:limit]
+def related_books(book, limit=6, random=1):
+    cache_key = "catalogue.related_books.%d.%d" % (book.id, limit - random)
+    related = cache.get(cache_key)
+    if related is None:
+        print 'not in cache'
+        related = list(Book.objects.filter(
+            common_slug=book.common_slug).exclude(pk=book.pk)[:limit])
+        limit -= len(related)
+        if limit > random:
+            related += Book.tagged.related_to(book,
+                    Book.objects.exclude(common_slug=book.common_slug),
+                    ignore_by_tag=book.book_tag())[:limit-random]
+        cache.set(cache_key, related, 1800)
+    if random:
+        related += list(Book.objects.exclude(
+                        pk__in=[b.pk for b in related] + [book.pk]
+                    ).order_by('?')[:random])
     return {
         'books': related,
     }
index 60521f9..9e0a078 100755 (executable)
@@ -9,7 +9,7 @@ from search.fields import JQueryAutoCompleteSearchField
 
 
 class SearchForm(forms.Form):
-    q = JQueryAutoCompleteSearchField()  # {'minChars': 2, 'selectFirst': True, 'cacheLength': 50, 'matchContains': "word"})
+    q = JQueryAutoCompleteSearchField(label=_('Search'))  # {'minChars': 2, 'selectFirst': True, 'cacheLength': 50, 'matchContains': "word"})
 
     def __init__(self, source, *args, **kwargs):
         kwargs['auto_id'] = False
@@ -18,4 +18,4 @@ class SearchForm(forms.Form):
         self.fields['q'].widget.attrs['autocomplete'] = 'off'
         self.fields['q'].widget.attrs['data-source'] = source
         if not 'q' in self.data:
-            self.fields['q'].widget.attrs['title'] = _('title, author, theme/topic, epoch, kind, genre, phrase')
+            self.fields['q'].widget.attrs['placeholder'] = _('title, author, theme/topic, epoch, kind, genre, phrase')
index 6068fa2..71c0ed2 100644 (file)
@@ -27,6 +27,7 @@ from librarian import dcparser
 from librarian.parser import WLDocument
 from lxml import etree
 import catalogue.models
+from pdcounter.models import Author as PDCounterAuthor
 from multiprocessing.pool import ThreadPool
 from threading import current_thread
 import atexit
@@ -219,6 +220,15 @@ class Index(BaseIndex):
             doc.add(Field("tag_category", tag.category, Field.Store.NO, Field.Index.NOT_ANALYZED))
             self.index.addDocument(doc)
 
+        for pdtag in PDCounterAuthor.objects.all():
+            doc = Document()
+            doc.add(NumericField("tag_id", Field.Store.YES, True).setIntValue(int(pdtag.id)))
+            doc.add(Field("tag_name", pdtag.name, Field.Store.NO, Field.Index.ANALYZED))
+            doc.add(Field("tag_name_pl", pdtag.name, Field.Store.NO, Field.Index.ANALYZED))
+            doc.add(Field("tag_category", 'pdcounter', Field.Store.NO, Field.Index.NOT_ANALYZED))
+            doc.add(Field("is_pdcounter", 'true', Field.Store.YES, Field.Index.NOT_ANALYZED))
+            self.index.addDocument(doc)
+
     def create_book_doc(self, book):
         """
         Create a lucene document referring book id.
@@ -322,9 +332,10 @@ class Index(BaseIndex):
 
         # get published date
         source = book_info.source_name
-        match = self.published_date_re.search(source)
-        if match is not None:
-            fields["published_date"] = Field("published_date", str(match.groups()[0]), Field.Store.YES, Field.Index.NOT_ANALYZED)
+        if hasattr(book_info, 'source_name'):
+            match = self.published_date_re.search(source)
+            if match is not None:
+                fields["published_date"] = Field("published_date", str(match.groups()[0]), Field.Store.YES, Field.Index.NOT_ANALYZED)
 
         return fields
 
@@ -624,26 +635,25 @@ class SearchResult(object):
         stored = search.searcher.doc(scoreDocs.doc)
         self.book_id = int(stored.get("book_id"))
 
-        header_type = stored.get("header_type")
-        if not header_type:
-            return
-
-        sec = (header_type, int(stored.get("header_index")))
-        header_span = stored.get('header_span')
-        header_span = header_span is not None and int(header_span) or 1
-
-        fragment = stored.get("fragment_anchor")
-
         pd = stored.get("published_date")
         if pd is None:
             pd = 0
         self.published_date = int(pd)
 
-        if snippets:
-            snippets = snippets.replace("/\n", "\n")
-        hit = (sec + (header_span,), fragment, scoreDocs.score, {'how_found': how_found, 'snippets': snippets and [snippets] or []})
+        header_type = stored.get("header_type")
+        # we have a content hit in some header of fragment
+        if header_type is not None:
+            sec = (header_type, int(stored.get("header_index")))
+            header_span = stored.get('header_span')
+            header_span = header_span is not None and int(header_span) or 1
+
+            fragment = stored.get("fragment_anchor")
 
-        self._hits.append(hit)
+            if snippets:
+                snippets = snippets.replace("/\n", "\n")
+            hit = (sec + (header_span,), fragment, scoreDocs.score, {'how_found': how_found, 'snippets': snippets and [snippets] or []})
+
+            self._hits.append(hit)
 
         self.search = search
         self.searched = searched
@@ -1228,19 +1238,27 @@ class Search(IndexStore):
         if terms:
             return JArray('object')(terms, Term)
 
-    def search_tags(self, query, filter=None, max_results=40):
+    def search_tags(self, query, filters=None, max_results=40, pdcounter=False):
         """
         Search for Tag objects using query.
         """
-        tops = self.searcher.search(query, filter, max_results)
+        if not pdcounter:
+            filters = self.chain_filters([filter, self.term_filter(Term('is_pdcounter', 'true'), inverse=True)])
+        tops = self.searcher.search(query, filters, max_results)
 
         tags = []
         for found in tops.scoreDocs:
             doc = self.searcher.doc(found.doc)
-            tag = catalogue.models.Tag.objects.get(id=doc.get("tag_id"))
-            tags.append(tag)
-            print "%s (%d) -> %f" % (tag, tag.id, found.score)
-
+            is_pdcounter = doc.get('is_pdcounter')
+            if is_pdcounter:
+                tag = PDCounterAuthor.objects.get(id=doc.get('tag_id'))
+            else:
+                tag = catalogue.models.Tag.objects.get(id=doc.get("tag_id"))
+                # don't add the pdcounter tag if same tag already exists
+            if not (is_pdcounter and filter(lambda t: tag.slug == t.slug, tags)):
+                tags.append(tag)
+                #            print "%s (%d) -> %f" % (tag, tag.id, found.score)
+        print 'returning %s' % tags
         return tags
 
     def search_books(self, query, filter=None, max_results=10):
@@ -1254,7 +1272,7 @@ class Search(IndexStore):
             bks.append(catalogue.models.Book.objects.get(id=doc.get("book_id")))
         return bks
 
-    def create_prefix_phrase(self, toks, field):
+    def make_prefix_phrase(self, toks, field):
         q = MultiPhraseQuery()
         for i in range(len(toks)):
             t = Term(field, toks[i])
@@ -1280,7 +1298,7 @@ class Search(IndexStore):
 
         return only_term
 
-    def hint_tags(self, string, max_results=50):
+    def hint_tags(self, string, max_results=50, pdcounter=True, prefix=True):
         """
         Return auto-complete hints for tags
         using prefix search.
@@ -1289,14 +1307,17 @@ class Search(IndexStore):
         top = BooleanQuery()
 
         for field in ['tag_name', 'tag_name_pl']:
-            q = self.create_prefix_phrase(toks, field)
+            if prefix:
+                q = self.make_prefix_phrase(toks, field)
+            else:
+                q = self.make_term_query(toks, field)
             top.add(BooleanClause(q, BooleanClause.Occur.SHOULD))
 
         no_book_cat = self.term_filter(Term("tag_category", "book"), inverse=True)
 
-        return self.search_tags(top, no_book_cat, max_results=max_results)
+        return self.search_tags(top, no_book_cat, max_results=max_results, pdcounter=pdcounter)
 
-    def hint_books(self, string, max_results=50):
+    def hint_books(self, string, max_results=50, prefix=True):
         """
         Returns auto-complete hints for book titles
         Because we do not index 'pseudo' title-tags.
@@ -1304,7 +1325,10 @@ class Search(IndexStore):
         """
         toks = self.get_tokens(string, field='SIMPLE')
 
-        q = self.create_prefix_phrase(toks, 'title')
+        if prefix:
+            q = self.make_prefix_phrase(toks, 'title')
+        else:
+            q = self.make_term_query(toks, 'title')
 
         return self.search_books(q, self.term_filter(Term("is_book", "true")), max_results=max_results)
 
index cf00870..623b311 100644 (file)
@@ -8,7 +8,7 @@ from django.views.decorators import cache
 from django.http import HttpResponse, HttpResponseRedirect, Http404, HttpResponsePermanentRedirect
 from django.utils.translation import ugettext as _
 
-from catalogue.utils import get_random_hash
+from catalogue.utils import split_tags
 from catalogue.models import Book, Tag, Fragment
 from catalogue.fields import dumps
 from catalogue.views import JSONResponse
@@ -34,7 +34,7 @@ def did_you_mean(query, tokens):
         authors = Tag.objects.filter(category='author', name__iregex=match_word_re(t))
         if len(authors) > 0:
             continue
-        
+
         if not dictionary.check(t):
             try:
                 change[t] = dictionary.suggest(t)[0]
@@ -69,7 +69,7 @@ def hint(request):
     # jezeli tagi dot tylko ksiazki, to wazne zeby te nowe byly w tej samej ksiazce
     # jesli zas dotycza themes, to wazne, zeby byly w tym samym fragmencie.
 
-    tags = s.hint_tags(prefix)
+    tags = s.hint_tags(prefix, pdcounter=True)
     books = s.hint_books(prefix)
 
     # TODO DODAC TU HINTY
@@ -97,26 +97,28 @@ def main(request):
     fuzzy = False
 
     if 'q' in request.GET:
-        tags = request.GET.get('tags', '')
+        tags = request.GET.get('tags', '')
         query = request.GET['q']
-        book_id = request.GET.get('book', None)
-        book = None
-        if book_id is not None:
-            book = get_object_or_404(Book, id=book_id)
+        book_id = request.GET.get('book', None)
+        book = None
+        if book_id is not None:
+            book = get_object_or_404(Book, id=book_id)
 
-        hint = srch.hint()
-        try:
-            tag_list = Tag.get_tag_list(tags)
-        except:
-            tag_list = []
+        hint = srch.hint()
+        try:
+            tag_list = Tag.get_tag_list(tags)
+        except:
+            tag_list = []
 
         if len(query) < 2:
-            return render_to_response('catalogue/search_too_short.html', {'tags': tag_list, 'prefix': query},
+            return render_to_response('catalogue/search_too_short.html', {'prefix': query},
                                       context_instance=RequestContext(request))
 
-        hint.tags(tag_list)
-        if book:
-            hint.books(book)
+        # hint.tags(tag_list)
+        # if book:
+        #     hint.books(book)
+        tags = srch.hint_tags(query, pdcounter=True, prefix=False)
+        tags = split_tags(tags)
 
         toks = StringReader(query)
         tokens_cache = {}
@@ -160,7 +162,7 @@ def main(request):
 
         author_results = SearchResult.aggregate(author_results)
         title_results = SearchResult.aggregate(title_results)
-        
+
         everywhere = SearchResult.aggregate(everywhere, author_title_rest)
 
         for res in [author_results, title_results, text_phrase, everywhere]:
@@ -168,15 +170,15 @@ def main(request):
             for r in res:
                 for h in r.hits:
                     h['snippets'] = map(lambda s:
-                                        re.subn(r"(^[ \t\n]+|[ \t\n]+$)", u"", 
+                                        re.subn(r"(^[ \t\n]+|[ \t\n]+$)", u"",
                                                 re.subn(r"[ \t\n]*\n[ \t\n]*", u"\n", s)[0])[0], h['snippets'])
-                    
+
         suggestion = did_you_mean(query, srch.get_tokens(toks, field="SIMPLE"))
         print "dym? %s" % repr(suggestion).encode('utf-8')
-        
+
         results = author_results + title_results + text_phrase + everywhere
         results.sort(reverse=True)
-        
+
         if len(results) == 1:
             fragment_hits = filter(lambda h: 'fragment' in h, results[0].hits)
             if len(fragment_hits) == 1:
@@ -187,14 +189,15 @@ def main(request):
         elif len(results) == 0:
             form = PublishingSuggestForm(initial={"books": query + ", "})
             return render_to_response('catalogue/search_no_hits.html',
-                                      {'tags': tag_list,
+                                      {'tags': tags,
                                        'prefix': query,
                                        "form": form,
                                        'did_you_mean': suggestion},
                 context_instance=RequestContext(request))
 
+        print "TAGS: %s" % tags
         return render_to_response('catalogue/search_multiple_hits.html',
-                                  {'tags': tag_list,
+                                  {'tags': tags,
                                    'prefix': query,
                                    'results': { 'author': author_results,
                                                 'title': title_results,
index bbdc43c..cfa9631 100755 (executable)
@@ -19,7 +19,8 @@ class UserSetsForm(forms.Form):
 
 
 class ObjectSetsForm(forms.Form):
-    tags = forms.CharField(label=_('Tags (comma-separated)'), required=False)
+    tags = forms.CharField(label=_('Tags (comma-separated)'), required=False,
+                           widget=forms.Textarea())
 
     def __init__(self, obj, user, *args, **kwargs):
         self._obj = obj
index ab982fe..2ea1a86 100755 (executable)
@@ -6,7 +6,8 @@
     <input type="submit" value="{% trans "Remove from my shelf" %}"/>
 </form>
 
-<form action="{{ request.get_full_path }}" method="post" accept-charset="utf-8" class="cuteform">
+<form action="{{ request.get_full_path }}" method="post" accept-charset="utf-8"
+       class="cuteform{% if placeholdize %} hidelabels{% endif %}">
 <ol>
     <div id="id___all__"></div>
     {{ form.as_ul }}
index 70108eb..eabc961 100755 (executable)
@@ -1,4 +1,4 @@
-{% if tags %}
+{% if tags.exists %}
 <ul class='social-shelf-tags'>
     {% for tag in tags %}
         <li><a href="{{ tag.get_absolute_url }}">{{ tag.name }}</a></li>
index 5f2702e..1788a34 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 5f2702eda7a1b36f4d29658b5468b6b78745218c
+Subproject commit 1788a3460def290cf9dd0eff514e77c5d427bcc5
index 9bbf29f..a590c8c 100644 (file)
Binary files a/wolnelektury/locale/pl/LC_MESSAGES/django.mo and b/wolnelektury/locale/pl/LC_MESSAGES/django.mo differ
index c8c614b..d0d492a 100644 (file)
@@ -7,8 +7,8 @@ msgid ""
 msgstr ""
 "Project-Id-Version: WolneLektury\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2012-01-27 15:26+0100\n"
-"PO-Revision-Date: 2012-01-27 16:30+0100\n"
+"POT-Creation-Date: 2012-01-30 12:37+0100\n"
+"PO-Revision-Date: 2012-01-30 12:39+0100\n"
 "Last-Translator: Radek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
 "Language: pl\n"
@@ -19,20 +19,20 @@ msgstr ""
 "X-Poedit-Language: Polish\n"
 "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n"
 
-#: views.py:30
 #: views.py:31
+#: views.py:32
 #: templates/base.html:56
 msgid "Sign in"
 msgstr "Zaloguj się"
 
-#: views.py:46
 #: views.py:47
-#: views.py:72
+#: views.py:48
+#: views.py:73
 #: templates/base.html:60
 msgid "Register"
 msgstr "Załóż konto"
 
-#: views.py:67
+#: views.py:68
 msgid "You have to be logged in to continue"
 msgstr "Zaloguj się, aby kontynuować"
 
@@ -89,15 +89,15 @@ msgid_plural ""
 "                    "
 msgstr[0] ""
 "\n"
-"                    <a href='%(b)s'>%(c)s</a> darmowa lektura do której <a href='%(r)s'>masz prawo</a>\n"
+"                    <a href='%(b)s'>%(c)s</a> darmowy utwór do której <a href='%(r)s'>masz prawo</a>\n"
 "                    "
 msgstr[1] ""
 "\n"
-"                    <a href='%(b)s'>%(c)s</a> darmowe lektury do których <a href='%(r)s'>masz prawo</a>\n"
+"                    <a href='%(b)s'>%(c)s</a> darmowe utwory do których <a href='%(r)s'>masz prawo</a>\n"
 "                    "
 msgstr[2] ""
 "\n"
-"                    <a href='%(b)s'>%(c)s</a> darmowych lektur do których <a href='%(r)s'>masz prawo</a>\n"
+"                    <a href='%(b)s'>%(c)s</a> darmowych utworów do których <a href='%(r)s'>masz prawo</a>\n"
 "                    "
 
 #: templates/base.html:47
@@ -116,7 +116,7 @@ msgstr "Administracja"
 msgid "Logout"
 msgstr "Wyloguj"
 
-#: templates/base.html:81
+#: templates/base.html:82
 #: templates/catalogue/search_multiple_hits.html:5
 #: templates/catalogue/search_no_hits.html:5
 #: templates/catalogue/search_no_hits.html:10
@@ -126,11 +126,11 @@ msgstr "Wyloguj"
 msgid "Search"
 msgstr "Szukaj"
 
-#: templates/base.html:104
+#: templates/base.html:105
 msgid "Language versions"
 msgstr "Wersje językowe"
 
-#: templates/base.html:134
+#: templates/base.html:135
 msgid ""
 "\n"
 "\t\t\t\tWolne Lektury is a project lead by <a href=\"http://nowoczesnapolska.org.pl/\">Modern Poland Foundation</a>.\n"
@@ -143,7 +143,7 @@ msgstr ""
 "Reprodukcje cyfrowe wykonane przez <a href=\"http://www.bn.org.pl/\">Bibliotekę Narodową</a>, <a href=\"http://www.bs.katowice.pl/\">Bibliotekę Śląską</a> i <a href=\"http://www.bibliotekaelblaska.pl/\">Bibliotekę Elbląską</a> z egzemplarzy pochodzących ze zbiorów BN, BŚ i BE.\n"
 "Hosting: <a href=\"http://www.icm.edu.pl/\">ICM</a>."
 
-#: templates/base.html:141
+#: templates/base.html:142
 msgid ""
 "\n"
 "\t\t\t\tModern Poland Foundation, 00-514 Warsaw, ul. Marszałkowska 84/92 lok. 125, tel/fax: (22) 621-30-17\n"
@@ -153,11 +153,11 @@ msgstr ""
 "\n"
 "Fundacja Nowoczesna Polska, 00-514 Warszawa, ul. Marszałkowska 84/92 lok. 125, tel/fax: (22) 621-30-17, e-mail: <a href=\"mailto:fundacja@nowoczesnapolska.org.pl\">fundacja@nowoczesnapolska.org.pl</a>"
 
-#: templates/base.html:157
+#: templates/base.html:158
 msgid "Close"
 msgstr "Zamknij"
 
-#: templates/base.html:159
+#: templates/base.html:160
 msgid "Loading"
 msgstr "Ładowanie"
 
@@ -170,24 +170,20 @@ msgid "Report a bug or suggestion"
 msgstr "Zgłoś błąd lub sugestię"
 
 #: templates/main_page.html:45
-msgid "Mobile app"
-msgstr "Aplikacja mobilna"
-
-#: templates/main_page.html:46
 msgid "Widget"
 msgstr "Widget"
 
-#: templates/main_page.html:47
+#: templates/main_page.html:46
 msgid "Missing a book?"
 msgstr "Nie znalazłeś/-aś utworu?"
 
-#: templates/main_page.html:48
+#: templates/main_page.html:47
 #: templates/publish_plan.html:4
 #: templates/publish_plan.html.py:8
 msgid "Publishing plan"
 msgstr "Plan publikacji"
 
-#: templates/main_page.html:74
+#: templates/main_page.html:73
 msgid "Image used:"
 msgstr "Użyto obrazu:"
 
@@ -241,28 +237,21 @@ msgstr ""
 "Audiobooki nagrywają znani aktorzy, wśród nich Danuta Stenka i Jan Peszek."
 
 #: templates/catalogue/book_detail.html:18
-#: templates/catalogue/tagged_object_list.html:80
+#: templates/catalogue/tagged_object_list.html:72
+#: templates/catalogue/tagged_object_list.html:102
 msgid "See also"
 msgstr "Zobacz też"
 
 #: templates/catalogue/book_fragments.html:5
-#: templates/catalogue/book_fragments.html:10
+#: templates/catalogue/book_fragments.html:11
 msgid "Theme"
 msgstr "Motyw"
 
 #: templates/catalogue/book_fragments.html:5
-#: templates/catalogue/book_fragments.html:10
+#: templates/catalogue/book_fragments.html:13
 msgid "in work "
 msgstr "w utworze"
 
-#: templates/catalogue/book_fragments.html:23
-msgid "See description"
-msgstr "Zobacz opis"
-
-#: templates/catalogue/book_fragments.html:23
-msgid "of the book "
-msgstr "utworu"
-
 #: templates/catalogue/book_info.html:6
 msgid "This work is licensed under:"
 msgstr "Utwór jest udostępniony na licencji:"
@@ -317,33 +306,33 @@ msgstr "Nie posiadasz żadnych półek. Jeśli chcesz, możesz utworzyć nową p
 msgid "Put on the shelf!"
 msgstr "Wrzuć na półkę"
 
-#: templates/catalogue/book_short.html:49
+#: templates/catalogue/book_short.html:51
 #: templates/catalogue/picture_detail.html:54
 #: templates/picture/picture_short.html:22
 msgid "Epoch"
 msgstr "Epoka"
 
-#: templates/catalogue/book_short.html:56
+#: templates/catalogue/book_short.html:58
 #: templates/catalogue/picture_detail.html:60
 #: templates/picture/picture_short.html:29
 msgid "Kind"
 msgstr "Rodzaj"
 
-#: templates/catalogue/book_short.html:63
+#: templates/catalogue/book_short.html:65
 msgid "Genre"
 msgstr "Gatunek"
 
-#: templates/catalogue/book_short.html:77
+#: templates/catalogue/book_short.html:80
 msgid "Read online"
 msgstr "Czytaj online"
 
-#: templates/catalogue/book_short.html:81
+#: templates/catalogue/book_short.html:84
 #: templates/catalogue/book_wide.html:53
 #: templates/lessons/ajax_document_detail.html:3
 msgid "Download"
 msgstr "Pobierz"
 
-#: templates/catalogue/book_short.html:99
+#: templates/catalogue/book_short.html:102
 msgid "Listen"
 msgstr "Słuchaj"
 
@@ -411,7 +400,7 @@ msgstr "Pobierz wszystkie audiobooki tego utworu"
 
 #: templates/catalogue/book_wide.html:63
 msgid "Download a custom PDF"
-msgstr "Pobierz własny plik PDF"
+msgstr "Stwórz własny plik PDF"
 
 #: templates/catalogue/catalogue.html:6
 #: templates/catalogue/catalogue.html:11
@@ -485,11 +474,11 @@ msgstr "Nie posiadasz żadnych półek. Jeśli chcesz, możesz utworzyć nową p
 msgid "Save all shelves"
 msgstr "Zapisz półki"
 
-#: templates/catalogue/fragment_short.html:11
+#: templates/catalogue/fragment_short.html:12
 msgid "Expand fragment"
 msgstr "Rozwiń fragment"
 
-#: templates/catalogue/fragment_short.html:21
+#: templates/catalogue/fragment_short.html:22
 msgid "Hide fragment"
 msgstr "Zwiń fragment"
 
@@ -587,24 +576,24 @@ msgstr "Audiobooki przygotowane w ramach projektu %(cs)s."
 msgid "Did you mean"
 msgstr "Czy chodziło Ci o"
 
-#: templates/catalogue/search_multiple_hits.html:19
+#: templates/catalogue/search_multiple_hits.html:18
 msgid "Results by authors"
 msgstr "Znalezieni autorzy"
 
-#: templates/catalogue/search_multiple_hits.html:36
+#: templates/catalogue/search_multiple_hits.html:35
 msgid "Results by title"
 msgstr "Znalezione w tytułach"
 
-#: templates/catalogue/search_multiple_hits.html:53
+#: templates/catalogue/search_multiple_hits.html:52
 msgid "Results in text"
 msgstr "Znalezione w treści"
 
-#: templates/catalogue/search_multiple_hits.html:70
+#: templates/catalogue/search_multiple_hits.html:69
 msgid "Other results"
 msgstr "Inne wyniki"
 
 #: templates/catalogue/search_no_hits.html:19
-#: templates/catalogue/tagged_object_list.html:122
+#: templates/catalogue/tagged_object_list.html:144
 msgid "Sorry! Search cirteria did not match any resources."
 msgstr "Przepraszamy! Brak wyników spełniających kryteria podane w zapytaniu."
 
@@ -618,11 +607,13 @@ msgstr "Wyszukiwarka obsługuje takie kryteria jak tytuł, autor, motyw/temat, e
 msgid "Sorry! Search query must have at least two characters."
 msgstr "Przepraszamy! Zapytanie musi zawierać co najmniej dwa znaki."
 
-#: templates/catalogue/tagged_object_list.html:84
+#: templates/catalogue/tagged_object_list.html:76
+#: templates/catalogue/tagged_object_list.html:106
 msgid "in Lektury.Gazeta.pl"
 msgstr "w serwisie Lektury.Gazeta.pl"
 
-#: templates/catalogue/tagged_object_list.html:89
+#: templates/catalogue/tagged_object_list.html:81
+#: templates/catalogue/tagged_object_list.html:111
 msgid "in Wikipedia"
 msgstr "w Wikipedii"
 
@@ -757,6 +748,15 @@ msgstr "Zaloguj się do Wolnych Lektur"
 msgid "Login"
 msgstr "Zaloguj się"
 
+#~ msgid "Mobile app"
+#~ msgstr "Aplikacja mobilna"
+
+#~ msgid "See description"
+#~ msgstr "Zobacz opis"
+
+#~ msgid "of the book "
+#~ msgstr "utworu"
+
 #~ msgid ""
 #~ "Internet Explorer cannot display this site properly. Click here to read "
 #~ "more..."
index f5c9cf2..1608b5f 100644 (file)
@@ -204,6 +204,12 @@ COMPRESS_CSS = {
         ],
         'output_filename': 'css/all.min?.css',
     },
+    'ie': {
+        'source_filenames': [
+            'css/ie.css',
+        ],
+        'output_filename': 'css/ie.min?.css',
+    },
     'book': {
         'source_filenames': ('css/master.book.css',),
         'output_filename': 'css/book.min?.css',
@@ -240,8 +246,6 @@ COMPRESS_JS = {
             'js/pdcounter.js',
 
             'js/search.js',
-
-            'js/jquery.labelify.js',
             ),
         'output_filename': 'js/base?.min.js',
     },
index b6395e5..298fd9a 100755 (executable)
@@ -1,8 +1,8 @@
 /* Logo font */
 @font-face {
     /* IE version */
-    font-family: WL-Logo;
-    src: url(/static/fonts/WL.eot);
+    font-family: WL-Nav;
+    src: url(/static/fonts/WL-Nav.eot);
 }
 @font-face {
   font-family: WL-Nav;
@@ -23,7 +23,9 @@ body {
     /*line-height: 1.4em;*/
 }
 
-
+a img {
+       border: 0;
+}
 a {
     color: #1199a2; /* #01adba; */
     text-decoration: none;
@@ -152,7 +154,9 @@ h2 {
     padding: 0;
     margin: 0;
     font-size: 1.1em;
+    column-width: 12em;
     -moz-column-width: 12em;
+    -webkit-column-width: 12em;
     width: 48em;
 }
 .hidden-box li {
@@ -160,30 +164,6 @@ h2 {
 }
 
 
-.see-also {
-    margin-left: 8em;
-    float: left;
-    width: 14.3em;
-}
-.download {
-    margin-left: 2em;
-    float: left;
-}
-
-.see-also, .download {
-    margin-top: 2em;
-    margin-bottom: 2em;
-}
-.see-also h2, .download h2 {
-    font-size: 1.1em;
-}
-.see-also ul, .download ul {
-    list-style: none;
-    padding: 0;
-    margin: 0;
-    font-size: 1.1em;
-}
-
 .pagination {
        display: block;
        font-size: 1.2em;
@@ -197,3 +177,9 @@ h2 {
     padding-top:3em;
     background: #fff;
 }
+
+/* just on search page */
+.top-tag-list {
+    margin-top: 2.2em;
+    margin-bottom: 1.6em;
+}
index 1f19669..c23547b 100755 (executable)
     font-size: 2em;
 }
 .catalogue-catalogue ul {
+    column-width: 30em;
     -moz-column-width: 30em;
+    -webkit-column-width: 30em;
 }
 
 
 #description {
        margin-bottom: 2em;
+       cursor: pointer;
 }
 #description dl {
        margin-top: 0;
@@ -89,6 +92,9 @@
        display: inline;
        margin: 0;
 }
+#description p {
+       margin-top: 0;
+}
 #description .meta {
        list-style: none;
        padding: 0;
        margin-bottom: .5em;
 }
 .inline-body ul {
-       a-moz-column-width: 11em;
        list-style: none;
        padding: 0;
        margin: 0;
        display: inline;
        margin-right: 1em;
 }
+
+
+.see-also {
+    margin-left: 8em;
+    float: left;
+    width: 14.3em;
+}
+.download {
+    margin-left: 2em;
+    float: left;
+}
+
+.see-also, .download {
+    margin-top: 2em;
+    margin-bottom: 2em;
+}
+.see-also h2, .download h2 {
+    font-size: 1.1em;
+}
+.see-also ul, .download ul {
+    list-style: none;
+    padding: 0;
+    margin: 0;
+    font-size: 1.1em;
+}
+
+.left-column .see-also {
+       margin-left: 0;
+}
index 2067f47..5f6bb1c 100755 (executable)
 }
 .Fragment-item {
        margin-bottom: 2em;
+       /* white-box */
+       border: 1px solid #ddd;
+    background: #fff;
+    -moz-box-shadow: 2px 2px 2px #ddd;
+    -webkit-box-shadow: 2px 2px 2px #ddd;
+    box-shadow: 2px 2px 2px #ddd;
 }
index 08255d3..d83116b 100755 (executable)
@@ -74,6 +74,7 @@
 }
 
 .hidelabels label {
+       display: block;
        width: 1px;
        height: 1px;
        overflow:hidden;
index 3fe0edd..fc89f82 100755 (executable)
 }
 
 
+#header-bg {
+       z-index: -1;
+       background: #191919;
+       position: absolute;
+       width: 50%;
+       height: 9.4em;
+}
+
 #header {
     height: 3em;
     padding-top: 1.9em;
@@ -20,9 +28,6 @@
 
 #half-header {
     padding-bottom: 0;
-    background: url('/static/img/bg-header.png');
-    background-position: center;
-    background-size: 100%;
 }
 
 #half-header-content {
@@ -38,7 +43,7 @@
 
 #logo {
     position: absolute;
-    top: 1.9em;
+    top: -1.6em;
     margin-left: 1.5em;
 }
 
@@ -46,6 +51,7 @@
     font-family: WL-Logo;
     font-size: 2.05em;
     color:#f7f7f7;
+    line-height: 7em;
 }
 
 #tagline {
@@ -74,7 +80,7 @@
     width: 63.1em;
     padding-left: .5em;
     padding-right: 0;
-    padding-top: 0.6em;
+    padding-top: 0.5em;
     padding-bottom: 0;
 }
 
     -webkit-box-shadow:0 0 .38em #444 inset;
     -moz-box-shadow:0 0 .38em #444 inset;
     box-shadow: 0 0 .5em #444 inset;
+    line-height: 2.5em;
 
     font-family: Georgia;
     background-color: #fff;
     color: #000;
 }
-#search.blur {
+
+/* styling search placeholder */
+
+#search:-webkit-input-placeholder
+{
+    font-family: Georgia;
+    font-style: italic;
+    color: #888;
+}
+
+#search.placeholder
+{
+    font-family: Georgia;
+    font-style: italic;
+    color: #888;
+}
+
+#search:-moz-placeholder
+{
     font-family: Georgia;
     font-style: italic;
     color: #888;
@@ -186,6 +211,10 @@ a.menu span {
     background: #f7f7f7;
 }
 
+#lang-menu-items {
+       z-index: 9999;
+}
+
 #lang-menu-items button {
     display: none;
     background: #f7f7f7;
diff --git a/wolnelektury/static/css/ie.css b/wolnelektury/static/css/ie.css
new file mode 100644 (file)
index 0000000..ff6b412
--- /dev/null
@@ -0,0 +1,9 @@
+#logo {
+       margin-top: 2.7em;      
+       width: 17em;
+       height: 10em;
+       overflow: hidden;
+}
+#logo a {
+       padding-top: 3em;
+}
diff --git a/wolnelektury/static/fonts/WL-Nav.eot b/wolnelektury/static/fonts/WL-Nav.eot
new file mode 100644 (file)
index 0000000..f241aa1
Binary files /dev/null and b/wolnelektury/static/fonts/WL-Nav.eot differ
index f7e572e..4e4cdf9 100644 (file)
Binary files a/wolnelektury/static/img/bg-header.png and b/wolnelektury/static/img/bg-header.png differ
index 8225a1f..7c02f03 100755 (executable)
                                        } 
                                });
                        });
+                       $('body').click(function(e) {
+                               if ($current == null) return;
+                               var p = $(e.target);
+                               while (p.length) {
+                                       if (p == $current)
+                                               return;
+                                       if (p.hasClass('hidden-box-trigger'))
+                                               return;
+                                       p = p.parent();
+                               }
+                               $current.hide('fast');
+                               $current = null;
+                       });
                })();
+               
 
 
 
@@ -100,6 +114,8 @@ $('.open-player').click(function(event) {
             return false;
         });
 
+       $(function(){
+           $("#search").search();});
 
     });
 })(jQuery)
index 846331c..086a47d 100755 (executable)
         };
 
 
+
+    // check placeholder browser support
+    if (!Modernizr.input.placeholder)
+    {
+        // set placeholder values
+        $(this).find('[placeholder]').each(function()
+        {
+            $(this).val( $(this).attr('placeholder') ).addClass('placeholder');
+        });
+        // focus and blur of placeholders
+        $('[placeholder]').focus(function()
+        {
+            if ($(this).val() == $(this).attr('placeholder'))
+            {
+                $(this).val('');
+                $(this).removeClass('placeholder');
+            }
+        }).blur(function()
+        {
+            if ($(this).val() == '' || $(this).val() == $(this).attr('placeholder'))
+            {
+                $(this).val($(this).attr('placeholder'));
+                $(this).addClass('placeholder');
+            }
+        });
+
+        // remove placeholders on submit
+        $('[placeholder]').closest('form').submit(function()
+        {
+            $(this).find('[placeholder]').each(function()
+            {
+                if ($(this).val() == $(this).attr('placeholder'))
+                {
+                    $(this).val('');
+                }
+            })
+        });
+    }
+
+
+
     });
 })(jQuery)
 
diff --git a/wolnelektury/static/js/jquery.labelify.js b/wolnelektury/static/js/jquery.labelify.js
deleted file mode 100644 (file)
index 49b76a3..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-/**
- * jQuery.labelify - Display in-textbox hints
- * Stuart Langridge, http://www.kryogenix.org/
- * Released into the public domain
- * Date: 25th June 2008
- * @author Stuart Langridge
- * @version 1.3
- *
- *
- * Basic calling syntax: $("input").labelify();
- * Defaults to taking the in-field label from the field's title attribute
- *
- * You can also pass an options object with the following keys:
- *   text
- *     "title" to get the in-field label from the field's title attribute
- *      (this is the default)
- *     "label" to get the in-field label from the inner text of the field's label
- *      (note that the label must be attached to the field with for="fieldid")
- *     a function which takes one parameter, the input field, and returns
- *      whatever text it likes
- *
- *   labelledClass
- *     a class that will be applied to the input field when it contains the
- *      label and removed when it contains user input. Defaults to blank.
- *
- */
-jQuery.fn.labelify = function(settings) {
-  settings = jQuery.extend({
-    text: "title",
-    labelledClass: ""
-  }, settings);
-  var lookups = {
-    title: function(input) {
-      return $(input).attr("title");
-    },
-    label: function(input) {
-      return $("label[for=" + input.id +"]").text();
-    }
-  };
-  var lookup;
-  var jQuery_labellified_elements = $(this);
-  return $(this).each(function() {
-    if (typeof settings.text === "string") {
-      lookup = lookups[settings.text]; // what if not there?
-    } else {
-      lookup = settings.text; // what if not a fn?
-    };
-    // bail if lookup isn't a function or if it returns undefined
-    if (typeof lookup !== "function") { return; }
-    var lookupval = lookup(this);
-    if (!lookupval) { return; }
-
-    // need to strip newlines because the browser strips them
-    // if you set textbox.value to a string containing them
-    $(this).data("label",lookup(this).replace(/\n/g,''));
-    $(this).focus(function() {
-      if (this.value === $(this).data("label")) {
-        this.value = this.defaultValue;
-        $(this).removeClass(settings.labelledClass);
-      }
-    }).blur(function(){
-      if (this.value === this.defaultValue) {
-        this.value = $(this).data("label");
-        $(this).addClass(settings.labelledClass);
-      }
-    });
-
-    var removeValuesOnExit = function() {
-      jQuery_labellified_elements.each(function(){
-        if (this.value === $(this).data("label")) {
-          this.value = this.defaultValue;
-          $(this).removeClass(settings.labelledClass);
-        }
-      })
-    };
-
-    $(this).parents("form").submit(removeValuesOnExit);
-    $(window).unload(removeValuesOnExit);
-
-    if (this.value !== this.defaultValue) {
-      // user already started typing; don't overwrite their work!
-      return;
-    }
-    // actually set the value
-    this.value = $(this).data("label");
-    $(this).addClass(settings.labelledClass);
-
-  });
-};
\ No newline at end of file
diff --git a/wolnelektury/static/js/modernizr-latest.js b/wolnelektury/static/js/modernizr-latest.js
new file mode 100644 (file)
index 0000000..f9e57c8
--- /dev/null
@@ -0,0 +1,1116 @@
+/*!
+ * Modernizr v2.0.6
+ * http://www.modernizr.com
+ *
+ * Copyright (c) 2009-2011 Faruk Ates, Paul Irish, Alex Sexton
+ * Dual-licensed under the BSD or MIT licenses: www.modernizr.com/license/
+ */
+
+/*
+ * Modernizr tests which native CSS3 and HTML5 features are available in
+ * the current UA and makes the results available to you in two ways:
+ * as properties on a global Modernizr object, and as classes on the
+ * <html> element. This information allows you to progressively enhance
+ * your pages with a granular level of control over the experience.
+ *
+ * Modernizr has an optional (not included) conditional resource loader
+ * called Modernizr.load(), based on Yepnope.js (yepnopejs.com).
+ * To get a build that includes Modernizr.load(), as well as choosing
+ * which tests to include, go to www.modernizr.com/download/
+ *
+ * Authors        Faruk Ates, Paul Irish, Alex Sexton, 
+ * Contributors   Ryan Seddon, Ben Alman
+ */
+
+window.Modernizr = (function( window, document, undefined ) {
+
+    var version = '2.0.6',
+
+    Modernizr = {},
+    
+    // option for enabling the HTML classes to be added
+    enableClasses = true,
+
+    docElement = document.documentElement,
+    docHead = document.head || document.getElementsByTagName('head')[0],
+
+    /**
+     * Create our "modernizr" element that we do most feature tests on.
+     */
+    mod = 'modernizr',
+    modElem = document.createElement(mod),
+    mStyle = modElem.style,
+
+    /**
+     * Create the input element for various Web Forms feature tests.
+     */
+    inputElem = document.createElement('input'),
+
+    smile = ':)',
+
+    toString = Object.prototype.toString,
+
+    // List of property values to set for css tests. See ticket #21
+    prefixes = ' -webkit- -moz- -o- -ms- -khtml- '.split(' '),
+
+    // Following spec is to expose vendor-specific style properties as:
+    //   elem.style.WebkitBorderRadius
+    // and the following would be incorrect:
+    //   elem.style.webkitBorderRadius
+
+    // Webkit ghosts their properties in lowercase but Opera & Moz do not.
+    // Microsoft foregoes prefixes entirely <= IE8, but appears to
+    //   use a lowercase `ms` instead of the correct `Ms` in IE9
+
+    // More here: http://github.com/Modernizr/Modernizr/issues/issue/21
+    domPrefixes = 'Webkit Moz O ms Khtml'.split(' '),
+
+    ns = {'svg': 'http://www.w3.org/2000/svg'},
+
+    tests = {},
+    inputs = {},
+    attrs = {},
+
+    classes = [],
+
+    featureName, // used in testing loop
+
+
+    // Inject element with style element and some CSS rules
+    injectElementWithStyles = function( rule, callback, nodes, testnames ) {
+
+      var style, ret, node,
+          div = document.createElement('div');
+
+      if ( parseInt(nodes, 10) ) {
+          // In order not to give false positives we create a node for each test
+          // This also allows the method to scale for unspecified uses
+          while ( nodes-- ) {
+              node = document.createElement('div');
+              node.id = testnames ? testnames[nodes] : mod + (nodes + 1);
+              div.appendChild(node);
+          }
+      }
+
+      // <style> elements in IE6-9 are considered 'NoScope' elements and therefore will be removed
+      // when injected with innerHTML. To get around this you need to prepend the 'NoScope' element
+      // with a 'scoped' element, in our case the soft-hyphen entity as it won't mess with our measurements.
+      // http://msdn.microsoft.com/en-us/library/ms533897%28VS.85%29.aspx
+      style = ['&shy;', '<style>', rule, '</style>'].join('');
+      div.id = mod;
+      div.innerHTML += style;
+      docElement.appendChild(div);
+
+      ret = callback(div, rule);
+      div.parentNode.removeChild(div);
+
+      return !!ret;
+
+    },
+
+
+    // adapted from matchMedia polyfill
+    // by Scott Jehl and Paul Irish
+    // gist.github.com/786768
+    testMediaQuery = function( mq ) {
+
+      if ( window.matchMedia ) {
+        return matchMedia(mq).matches;
+      }
+
+      var bool;
+
+      injectElementWithStyles('@media ' + mq + ' { #' + mod + ' { position: absolute; } }', function( node ) {
+        bool = (window.getComputedStyle ?
+                  getComputedStyle(node, null) :
+                  node.currentStyle)['position'] == 'absolute';
+      });
+
+      return bool;
+
+     },
+
+
+    /**
+      * isEventSupported determines if a given element supports the given event
+      * function from http://yura.thinkweb2.com/isEventSupported/
+      */
+    isEventSupported = (function() {
+
+      var TAGNAMES = {
+        'select': 'input', 'change': 'input',
+        'submit': 'form', 'reset': 'form',
+        'error': 'img', 'load': 'img', 'abort': 'img'
+      };
+
+      function isEventSupported( eventName, element ) {
+
+        element = element || document.createElement(TAGNAMES[eventName] || 'div');
+        eventName = 'on' + eventName;
+
+        // When using `setAttribute`, IE skips "unload", WebKit skips "unload" and "resize", whereas `in` "catches" those
+        var isSupported = eventName in element;
+
+        if ( !isSupported ) {
+          // If it has no `setAttribute` (i.e. doesn't implement Node interface), try generic element
+          if ( !element.setAttribute ) {
+            element = document.createElement('div');
+          }
+          if ( element.setAttribute && element.removeAttribute ) {
+            element.setAttribute(eventName, '');
+            isSupported = is(element[eventName], 'function');
+
+            // If property was created, "remove it" (by setting value to `undefined`)
+            if ( !is(element[eventName], undefined) ) {
+              element[eventName] = undefined;
+            }
+            element.removeAttribute(eventName);
+          }
+        }
+
+        element = null;
+        return isSupported;
+      }
+      return isEventSupported;
+    })();
+
+    // hasOwnProperty shim by kangax needed for Safari 2.0 support
+    var _hasOwnProperty = ({}).hasOwnProperty, hasOwnProperty;
+    if ( !is(_hasOwnProperty, undefined) && !is(_hasOwnProperty.call, undefined) ) {
+      hasOwnProperty = function (object, property) {
+        return _hasOwnProperty.call(object, property);
+      };
+    }
+    else {
+      hasOwnProperty = function (object, property) { /* yes, this can give false positives/negatives, but most of the time we don't care about those */
+        return ((property in object) && is(object.constructor.prototype[property], undefined));
+      };
+    }
+
+    /**
+     * setCss applies given styles to the Modernizr DOM node.
+     */
+    function setCss( str ) {
+        mStyle.cssText = str;
+    }
+
+    /**
+     * setCssAll extrapolates all vendor-specific css strings.
+     */
+    function setCssAll( str1, str2 ) {
+        return setCss(prefixes.join(str1 + ';') + ( str2 || '' ));
+    }
+
+    /**
+     * is returns a boolean for if typeof obj is exactly type.
+     */
+    function is( obj, type ) {
+        return typeof obj === type;
+    }
+
+    /**
+     * contains returns a boolean for if substr is found within str.
+     */
+    function contains( str, substr ) {
+        return !!~('' + str).indexOf(substr);
+    }
+
+    /**
+     * testProps is a generic CSS / DOM property test; if a browser supports
+     *   a certain property, it won't return undefined for it.
+     *   A supported CSS property returns empty string when its not yet set.
+     */
+    function testProps( props, prefixed ) {
+        for ( var i in props ) {
+            if ( mStyle[ props[i] ] !== undefined ) {
+                return prefixed == 'pfx' ? props[i] : true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * testPropsAll tests a list of DOM properties we want to check against.
+     *   We specify literally ALL possible (known and/or likely) properties on
+     *   the element including the non-vendor prefixed one, for forward-
+     *   compatibility.
+     */
+    function testPropsAll( prop, prefixed ) {
+
+        var ucProp  = prop.charAt(0).toUpperCase() + prop.substr(1),
+            props   = (prop + ' ' + domPrefixes.join(ucProp + ' ') + ucProp).split(' ');
+
+        return testProps(props, prefixed);
+    }
+
+    /**
+     * testBundle tests a list of CSS features that require element and style injection.
+     *   By bundling them together we can reduce the need to touch the DOM multiple times.
+     */
+    /*>>testBundle*/
+    var testBundle = (function( styles, tests ) {
+        var style = styles.join(''),
+            len = tests.length;
+
+        injectElementWithStyles(style, function( node, rule ) {
+            var style = document.styleSheets[document.styleSheets.length - 1],
+                // IE8 will bork if you create a custom build that excludes both fontface and generatedcontent tests.
+                // So we check for cssRules and that there is a rule available
+                // More here: https://github.com/Modernizr/Modernizr/issues/288 & https://github.com/Modernizr/Modernizr/issues/293
+                cssText = style.cssRules && style.cssRules[0] ? style.cssRules[0].cssText : style.cssText || "",
+                children = node.childNodes, hash = {};
+
+            while ( len-- ) {
+                hash[children[len].id] = children[len];
+            }
+
+            /*>>touch*/           Modernizr['touch'] = ('ontouchstart' in window) || hash['touch'].offsetTop === 9; /*>>touch*/
+            /*>>csstransforms3d*/ Modernizr['csstransforms3d'] = hash['csstransforms3d'].offsetLeft === 9;          /*>>csstransforms3d*/
+            /*>>generatedcontent*/Modernizr['generatedcontent'] = hash['generatedcontent'].offsetHeight >= 1;       /*>>generatedcontent*/
+            /*>>fontface*/        Modernizr['fontface'] = /src/i.test(cssText) &&
+                                                                  cssText.indexOf(rule.split(' ')[0]) === 0;        /*>>fontface*/
+        }, len, tests);
+
+    })([
+        // Pass in styles to be injected into document
+        /*>>fontface*/        '@font-face {font-family:"font";src:url("https://")}'         /*>>fontface*/
+        
+        /*>>touch*/           ,['@media (',prefixes.join('touch-enabled),('),mod,')',
+                                '{#touch{top:9px;position:absolute}}'].join('')           /*>>touch*/
+                                
+        /*>>csstransforms3d*/ ,['@media (',prefixes.join('transform-3d),('),mod,')',
+                                '{#csstransforms3d{left:9px;position:absolute}}'].join('')/*>>csstransforms3d*/
+                                
+        /*>>generatedcontent*/,['#generatedcontent:after{content:"',smile,'";visibility:hidden}'].join('')  /*>>generatedcontent*/
+    ],
+      [
+        /*>>fontface*/        'fontface'          /*>>fontface*/
+        /*>>touch*/           ,'touch'            /*>>touch*/
+        /*>>csstransforms3d*/ ,'csstransforms3d'  /*>>csstransforms3d*/
+        /*>>generatedcontent*/,'generatedcontent' /*>>generatedcontent*/
+        
+    ]);/*>>testBundle*/
+
+
+    /**
+     * Tests
+     * -----
+     */
+
+    tests['flexbox'] = function() {
+        /**
+         * setPrefixedValueCSS sets the property of a specified element
+         * adding vendor prefixes to the VALUE of the property.
+         * @param {Element} element
+         * @param {string} property The property name. This will not be prefixed.
+         * @param {string} value The value of the property. This WILL be prefixed.
+         * @param {string=} extra Additional CSS to append unmodified to the end of
+         * the CSS string.
+         */
+        function setPrefixedValueCSS( element, property, value, extra ) {
+            property += ':';
+            element.style.cssText = (property + prefixes.join(value + ';' + property)).slice(0, -property.length) + (extra || '');
+        }
+
+        /**
+         * setPrefixedPropertyCSS sets the property of a specified element
+         * adding vendor prefixes to the NAME of the property.
+         * @param {Element} element
+         * @param {string} property The property name. This WILL be prefixed.
+         * @param {string} value The value of the property. This will not be prefixed.
+         * @param {string=} extra Additional CSS to append unmodified to the end of
+         * the CSS string.
+         */
+        function setPrefixedPropertyCSS( element, property, value, extra ) {
+            element.style.cssText = prefixes.join(property + ':' + value + ';') + (extra || '');
+        }
+
+        var c = document.createElement('div'),
+            elem = document.createElement('div');
+
+        setPrefixedValueCSS(c, 'display', 'box', 'width:42px;padding:0;');
+        setPrefixedPropertyCSS(elem, 'box-flex', '1', 'width:10px;');
+
+        c.appendChild(elem);
+        docElement.appendChild(c);
+
+        var ret = elem.offsetWidth === 42;
+
+        c.removeChild(elem);
+        docElement.removeChild(c);
+
+        return ret;
+    };
+
+    // On the S60 and BB Storm, getContext exists, but always returns undefined
+    // http://github.com/Modernizr/Modernizr/issues/issue/97/
+
+    tests['canvas'] = function() {
+        var elem = document.createElement('canvas');
+        return !!(elem.getContext && elem.getContext('2d'));
+    };
+
+    tests['canvastext'] = function() {
+        return !!(Modernizr['canvas'] && is(document.createElement('canvas').getContext('2d').fillText, 'function'));
+    };
+
+    // This WebGL test may false positive. 
+    // But really it's quite impossible to know whether webgl will succeed until after you create the context. 
+    // You might have hardware that can support a 100x100 webgl canvas, but will not support a 1000x1000 webgl 
+    // canvas. So this feature inference is weak, but intentionally so.
+    
+    // It is known to false positive in FF4 with certain hardware and the iPad 2.
+    
+    tests['webgl'] = function() {
+        return !!window.WebGLRenderingContext;
+    };
+
+    /*
+     * The Modernizr.touch test only indicates if the browser supports
+     *    touch events, which does not necessarily reflect a touchscreen
+     *    device, as evidenced by tablets running Windows 7 or, alas,
+     *    the Palm Pre / WebOS (touch) phones.
+     *
+     * Additionally, Chrome (desktop) used to lie about its support on this,
+     *    but that has since been rectified: http://crbug.com/36415
+     *
+     * We also test for Firefox 4 Multitouch Support.
+     *
+     * For more info, see: http://modernizr.github.com/Modernizr/touch.html
+     */
+
+    tests['touch'] = function() {
+        return Modernizr['touch'];
+    };
+
+    /**
+     * geolocation tests for the new Geolocation API specification.
+     *   This test is a standards compliant-only test; for more complete
+     *   testing, including a Google Gears fallback, please see:
+     *   http://code.google.com/p/geo-location-javascript/
+     * or view a fallback solution using google's geo API:
+     *   http://gist.github.com/366184
+     */
+    tests['geolocation'] = function() {
+        return !!navigator.geolocation;
+    };
+
+    // Per 1.6:
+    // This used to be Modernizr.crosswindowmessaging but the longer
+    // name has been deprecated in favor of a shorter and property-matching one.
+    // The old API is still available in 1.6, but as of 2.0 will throw a warning,
+    // and in the first release thereafter disappear entirely.
+    tests['postmessage'] = function() {
+      return !!window.postMessage;
+    };
+
+    // Web SQL database detection is tricky:
+
+    // In chrome incognito mode, openDatabase is truthy, but using it will
+    //   throw an exception: http://crbug.com/42380
+    // We can create a dummy database, but there is no way to delete it afterwards.
+
+    // Meanwhile, Safari users can get prompted on any database creation.
+    //   If they do, any page with Modernizr will give them a prompt:
+    //   http://github.com/Modernizr/Modernizr/issues/closed#issue/113
+
+    // We have chosen to allow the Chrome incognito false positive, so that Modernizr
+    //   doesn't litter the web with these test databases. As a developer, you'll have
+    //   to account for this gotcha yourself.
+    tests['websqldatabase'] = function() {
+      var result = !!window.openDatabase;
+      /*  if (result){
+            try {
+              result = !!openDatabase( mod + "testdb", "1.0", mod + "testdb", 2e4);
+            } catch(e) {
+            }
+          }  */
+      return result;
+    };
+
+    // Vendors had inconsistent prefixing with the experimental Indexed DB:
+    // - Webkit's implementation is accessible through webkitIndexedDB
+    // - Firefox shipped moz_indexedDB before FF4b9, but since then has been mozIndexedDB
+    // For speed, we don't test the legacy (and beta-only) indexedDB
+    tests['indexedDB'] = function() {
+      for ( var i = -1, len = domPrefixes.length; ++i < len; ){
+        if ( window[domPrefixes[i].toLowerCase() + 'IndexedDB'] ){
+          return true;
+        }
+      }
+      return !!window.indexedDB;
+    };
+
+    // documentMode logic from YUI to filter out IE8 Compat Mode
+    //   which false positives.
+    tests['hashchange'] = function() {
+      return isEventSupported('hashchange', window) && (document.documentMode === undefined || document.documentMode > 7);
+    };
+
+    // Per 1.6:
+    // This used to be Modernizr.historymanagement but the longer
+    // name has been deprecated in favor of a shorter and property-matching one.
+    // The old API is still available in 1.6, but as of 2.0 will throw a warning,
+    // and in the first release thereafter disappear entirely.
+    tests['history'] = function() {
+      return !!(window.history && history.pushState);
+    };
+
+    tests['draganddrop'] = function() {
+        return isEventSupported('dragstart') && isEventSupported('drop');
+    };
+
+    // Mozilla is targeting to land MozWebSocket for FF6
+    // bugzil.la/659324
+    tests['websockets'] = function() {
+        for ( var i = -1, len = domPrefixes.length; ++i < len; ){
+          if ( window[domPrefixes[i] + 'WebSocket'] ){
+            return true;
+          }
+        }
+        return 'WebSocket' in window;
+    };
+
+
+    // http://css-tricks.com/rgba-browser-support/
+    tests['rgba'] = function() {
+        // Set an rgba() color and check the returned value
+
+        setCss('background-color:rgba(150,255,150,.5)');
+
+        return contains(mStyle.backgroundColor, 'rgba');
+    };
+
+    tests['hsla'] = function() {
+        // Same as rgba(), in fact, browsers re-map hsla() to rgba() internally,
+        //   except IE9 who retains it as hsla
+
+        setCss('background-color:hsla(120,40%,100%,.5)');
+
+        return contains(mStyle.backgroundColor, 'rgba') || contains(mStyle.backgroundColor, 'hsla');
+    };
+
+    tests['multiplebgs'] = function() {
+        // Setting multiple images AND a color on the background shorthand property
+        //  and then querying the style.background property value for the number of
+        //  occurrences of "url(" is a reliable method for detecting ACTUAL support for this!
+
+        setCss('background:url(https://),url(https://),red url(https://)');
+
+        // If the UA supports multiple backgrounds, there should be three occurrences
+        //   of the string "url(" in the return value for elemStyle.background
+
+        return /(url\s*\(.*?){3}/.test(mStyle.background);
+    };
+
+
+    // In testing support for a given CSS property, it's legit to test:
+    //    `elem.style[styleName] !== undefined`
+    // If the property is supported it will return an empty string,
+    // if unsupported it will return undefined.
+
+    // We'll take advantage of this quick test and skip setting a style
+    // on our modernizr element, but instead just testing undefined vs
+    // empty string.
+
+
+    tests['backgroundsize'] = function() {
+        return testPropsAll('backgroundSize');
+    };
+
+    tests['borderimage'] = function() {
+        return testPropsAll('borderImage');
+    };
+
+
+    // Super comprehensive table about all the unique implementations of
+    // border-radius: http://muddledramblings.com/table-of-css3-border-radius-compliance
+
+    tests['borderradius'] = function() {
+        return testPropsAll('borderRadius');
+    };
+
+    // WebOS unfortunately false positives on this test.
+    tests['boxshadow'] = function() {
+        return testPropsAll('boxShadow');
+    };
+
+    // FF3.0 will false positive on this test
+    tests['textshadow'] = function() {
+        return document.createElement('div').style.textShadow === '';
+    };
+
+
+    tests['opacity'] = function() {
+        // Browsers that actually have CSS Opacity implemented have done so
+        //  according to spec, which means their return values are within the
+        //  range of [0.0,1.0] - including the leading zero.
+
+        setCssAll('opacity:.55');
+
+        // The non-literal . in this regex is intentional:
+        //   German Chrome returns this value as 0,55
+        // https://github.com/Modernizr/Modernizr/issues/#issue/59/comment/516632
+        return /^0.55$/.test(mStyle.opacity);
+    };
+
+
+    tests['cssanimations'] = function() {
+        return testPropsAll('animationName');
+    };
+
+
+    tests['csscolumns'] = function() {
+        return testPropsAll('columnCount');
+    };
+
+
+    tests['cssgradients'] = function() {
+        /**
+         * For CSS Gradients syntax, please see:
+         * http://webkit.org/blog/175/introducing-css-gradients/
+         * https://developer.mozilla.org/en/CSS/-moz-linear-gradient
+         * https://developer.mozilla.org/en/CSS/-moz-radial-gradient
+         * http://dev.w3.org/csswg/css3-images/#gradients-
+         */
+
+        var str1 = 'background-image:',
+            str2 = 'gradient(linear,left top,right bottom,from(#9f9),to(white));',
+            str3 = 'linear-gradient(left top,#9f9, white);';
+
+        setCss(
+            (str1 + prefixes.join(str2 + str1) + prefixes.join(str3 + str1)).slice(0, -str1.length)
+        );
+
+        return contains(mStyle.backgroundImage, 'gradient');
+    };
+
+
+    tests['cssreflections'] = function() {
+        return testPropsAll('boxReflect');
+    };
+
+
+    tests['csstransforms'] = function() {
+        return !!testProps(['transformProperty', 'WebkitTransform', 'MozTransform', 'OTransform', 'msTransform']);
+    };
+
+
+    tests['csstransforms3d'] = function() {
+
+        var ret = !!testProps(['perspectiveProperty', 'WebkitPerspective', 'MozPerspective', 'OPerspective', 'msPerspective']);
+
+        // Webkit’s 3D transforms are passed off to the browser's own graphics renderer.
+        //   It works fine in Safari on Leopard and Snow Leopard, but not in Chrome in
+        //   some conditions. As a result, Webkit typically recognizes the syntax but
+        //   will sometimes throw a false positive, thus we must do a more thorough check:
+        if ( ret && 'webkitPerspective' in docElement.style ) {
+
+          // Webkit allows this media query to succeed only if the feature is enabled.
+          // `@media (transform-3d),(-o-transform-3d),(-moz-transform-3d),(-ms-transform-3d),(-webkit-transform-3d),(modernizr){ ... }`
+          ret = Modernizr['csstransforms3d'];
+        }
+        return ret;
+    };
+
+
+    tests['csstransitions'] = function() {
+        return testPropsAll('transitionProperty');
+    };
+
+
+    /*>>fontface*/
+    // @font-face detection routine by Diego Perini
+    // http://javascript.nwbox.com/CSSSupport/
+    tests['fontface'] = function() {
+        return Modernizr['fontface'];
+    };
+    /*>>fontface*/
+
+    // CSS generated content detection
+    tests['generatedcontent'] = function() {
+        return Modernizr['generatedcontent'];
+    };
+
+
+
+    // These tests evaluate support of the video/audio elements, as well as
+    // testing what types of content they support.
+    //
+    // We're using the Boolean constructor here, so that we can extend the value
+    // e.g.  Modernizr.video     // true
+    //       Modernizr.video.ogg // 'probably'
+    //
+    // Codec values from : http://github.com/NielsLeenheer/html5test/blob/9106a8/index.html#L845
+    //                     thx to NielsLeenheer and zcorpan
+
+    // Note: in FF 3.5.1 and 3.5.0, "no" was a return value instead of empty string.
+    //   Modernizr does not normalize for that.
+
+    tests['video'] = function() {
+        var elem = document.createElement('video'),
+            bool = false;
+            
+        // IE9 Running on Windows Server SKU can cause an exception to be thrown, bug #224
+        try {
+            if ( bool = !!elem.canPlayType ) {
+                bool      = new Boolean(bool);
+                bool.ogg  = elem.canPlayType('video/ogg; codecs="theora"');
+
+                // Workaround required for IE9, which doesn't report video support without audio codec specified.
+                //   bug 599718 @ msft connect
+                var h264 = 'video/mp4; codecs="avc1.42E01E';
+                bool.h264 = elem.canPlayType(h264 + '"') || elem.canPlayType(h264 + ', mp4a.40.2"');
+
+                bool.webm = elem.canPlayType('video/webm; codecs="vp8, vorbis"');
+            }
+            
+        } catch(e) { }
+        
+        return bool;
+    };
+
+    tests['audio'] = function() {
+        var elem = document.createElement('audio'),
+            bool = false;
+
+        try { 
+            if ( bool = !!elem.canPlayType ) {
+                bool      = new Boolean(bool);
+                bool.ogg  = elem.canPlayType('audio/ogg; codecs="vorbis"');
+                bool.mp3  = elem.canPlayType('audio/mpeg;');
+
+                // Mimetypes accepted:
+                //   https://developer.mozilla.org/En/Media_formats_supported_by_the_audio_and_video_elements
+                //   http://bit.ly/iphoneoscodecs
+                bool.wav  = elem.canPlayType('audio/wav; codecs="1"');
+                bool.m4a  = elem.canPlayType('audio/x-m4a;') || elem.canPlayType('audio/aac;');
+            }
+        } catch(e) { }
+        
+        return bool;
+    };
+
+
+    // Firefox has made these tests rather unfun.
+
+    // In FF4, if disabled, window.localStorage should === null.
+
+    // Normally, we could not test that directly and need to do a
+    //   `('localStorage' in window) && ` test first because otherwise Firefox will
+    //   throw http://bugzil.la/365772 if cookies are disabled
+
+    // However, in Firefox 4 betas, if dom.storage.enabled == false, just mentioning
+    //   the property will throw an exception. http://bugzil.la/599479
+    // This looks to be fixed for FF4 Final.
+
+    // Because we are forced to try/catch this, we'll go aggressive.
+
+    // FWIW: IE8 Compat mode supports these features completely:
+    //   http://www.quirksmode.org/dom/html5.html
+    // But IE8 doesn't support either with local files
+
+    tests['localstorage'] = function() {
+        try {
+            return !!localStorage.getItem;
+        } catch(e) {
+            return false;
+        }
+    };
+
+    tests['sessionstorage'] = function() {
+        try {
+            return !!sessionStorage.getItem;
+        } catch(e){
+            return false;
+        }
+    };
+
+
+    tests['webworkers'] = function() {
+        return !!window.Worker;
+    };
+
+
+    tests['applicationcache'] = function() {
+        return !!window.applicationCache;
+    };
+
+
+    // Thanks to Erik Dahlstrom
+    tests['svg'] = function() {
+        return !!document.createElementNS && !!document.createElementNS(ns.svg, 'svg').createSVGRect;
+    };
+
+    // specifically for SVG inline in HTML, not within XHTML
+    // test page: paulirish.com/demo/inline-svg
+    tests['inlinesvg'] = function() {
+      var div = document.createElement('div');
+      div.innerHTML = '<svg/>';
+      return (div.firstChild && div.firstChild.namespaceURI) == ns.svg;
+    };
+
+    // Thanks to F1lt3r and lucideer, ticket #35
+    tests['smil'] = function() {
+        return !!document.createElementNS && /SVG/.test(toString.call(document.createElementNS(ns.svg, 'animate')));
+    };
+
+    tests['svgclippaths'] = function() {
+        // Possibly returns a false positive in Safari 3.2?
+        return !!document.createElementNS && /SVG/.test(toString.call(document.createElementNS(ns.svg, 'clipPath')));
+    };
+
+    // input features and input types go directly onto the ret object, bypassing the tests loop.
+    // Hold this guy to execute in a moment.
+    function webforms() {
+        // Run through HTML5's new input attributes to see if the UA understands any.
+        // We're using f which is the <input> element created early on
+        // Mike Taylr has created a comprehensive resource for testing these attributes
+        //   when applied to all input types:
+        //   http://miketaylr.com/code/input-type-attr.html
+        // spec: http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary
+        
+        // Only input placeholder is tested while textarea's placeholder is not. 
+        // Currently Safari 4 and Opera 11 have support only for the input placeholder
+        // Both tests are available in feature-detects/forms-placeholder.js
+        Modernizr['input'] = (function( props ) {
+            for ( var i = 0, len = props.length; i < len; i++ ) {
+                attrs[ props[i] ] = !!(props[i] in inputElem);
+            }
+            return attrs;
+        })('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' '));
+
+        // Run through HTML5's new input types to see if the UA understands any.
+        //   This is put behind the tests runloop because it doesn't return a
+        //   true/false like all the other tests; instead, it returns an object
+        //   containing each input type with its corresponding true/false value
+
+        // Big thanks to @miketaylr for the html5 forms expertise. http://miketaylr.com/
+        Modernizr['inputtypes'] = (function(props) {
+
+            for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) {
+
+                inputElem.setAttribute('type', inputElemType = props[i]);
+                bool = inputElem.type !== 'text';
+
+                // We first check to see if the type we give it sticks..
+                // If the type does, we feed it a textual value, which shouldn't be valid.
+                // If the value doesn't stick, we know there's input sanitization which infers a custom UI
+                if ( bool ) {
+
+                    inputElem.value         = smile;
+                    inputElem.style.cssText = 'position:absolute;visibility:hidden;';
+
+                    if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) {
+
+                      docElement.appendChild(inputElem);
+                      defaultView = document.defaultView;
+
+                      // Safari 2-4 allows the smiley as a value, despite making a slider
+                      bool =  defaultView.getComputedStyle &&
+                              defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' &&
+                              // Mobile android web browser has false positive, so must
+                              // check the height to see if the widget is actually there.
+                              (inputElem.offsetHeight !== 0);
+
+                      docElement.removeChild(inputElem);
+
+                    } else if ( /^(search|tel)$/.test(inputElemType) ){
+                      // Spec doesnt define any special parsing or detectable UI
+                      //   behaviors so we pass these through as true
+
+                      // Interestingly, opera fails the earlier test, so it doesn't
+                      //  even make it here.
+
+                    } else if ( /^(url|email)$/.test(inputElemType) ) {
+                      // Real url and email support comes with prebaked validation.
+                      bool = inputElem.checkValidity && inputElem.checkValidity() === false;
+
+                    } else if ( /^color$/.test(inputElemType) ) {
+                        // chuck into DOM and force reflow for Opera bug in 11.00
+                        // github.com/Modernizr/Modernizr/issues#issue/159
+                        docElement.appendChild(inputElem);
+                        docElement.offsetWidth;
+                        bool = inputElem.value != smile;
+                        docElement.removeChild(inputElem);
+
+                    } else {
+                      // If the upgraded input compontent rejects the :) text, we got a winner
+                      bool = inputElem.value != smile;
+                    }
+                }
+
+                inputs[ props[i] ] = !!bool;
+            }
+            return inputs;
+        })('search tel url email datetime date month week time datetime-local number range color'.split(' '));
+    }
+
+
+    // End of test definitions
+    // -----------------------
+
+
+
+    // Run through all tests and detect their support in the current UA.
+    // todo: hypothetically we could be doing an array of tests and use a basic loop here.
+    for ( var feature in tests ) {
+        if ( hasOwnProperty(tests, feature) ) {
+            // run the test, throw the return value into the Modernizr,
+            //   then based on that boolean, define an appropriate className
+            //   and push it into an array of classes we'll join later.
+            featureName  = feature.toLowerCase();
+            Modernizr[featureName] = tests[feature]();
+
+            classes.push((Modernizr[featureName] ? '' : 'no-') + featureName);
+        }
+    }
+
+    // input tests need to run.
+    Modernizr.input || webforms();
+
+
+    /**
+     * addTest allows the user to define their own feature tests
+     * the result will be added onto the Modernizr object,
+     * as well as an appropriate className set on the html element
+     *
+     * @param feature - String naming the feature
+     * @param test - Function returning true if feature is supported, false if not
+     */
+     Modernizr.addTest = function ( feature, test ) {
+       if ( typeof feature == "object" ) {
+         for ( var key in feature ) {
+           if ( hasOwnProperty( feature, key ) ) { 
+             Modernizr.addTest( key, feature[ key ] );
+           }
+         }
+       } else {
+
+         feature = feature.toLowerCase();
+
+         if ( Modernizr[feature] !== undefined ) {
+           // we're going to quit if you're trying to overwrite an existing test
+           // if we were to allow it, we'd do this:
+           //   var re = new RegExp("\\b(no-)?" + feature + "\\b");  
+           //   docElement.className = docElement.className.replace( re, '' );
+           // but, no rly, stuff 'em.
+           return; 
+         }
+
+         test = typeof test == "boolean" ? test : !!test();
+
+         docElement.className += ' ' + (test ? '' : 'no-') + feature;
+         Modernizr[feature] = test;
+
+       }
+
+       return Modernizr; // allow chaining.
+     };
+    
+
+    // Reset modElem.cssText to nothing to reduce memory footprint.
+    setCss('');
+    modElem = inputElem = null;
+
+    //>>BEGIN IEPP
+    // Enable HTML 5 elements for styling (and printing) in IE.
+    if ( window.attachEvent && (function(){ var elem = document.createElement('div');
+                                            elem.innerHTML = '<elem></elem>';
+                                            return elem.childNodes.length !== 1; })() ) {
+                                              
+        // iepp v2 by @jon_neal & afarkas : github.com/aFarkas/iepp/
+        (function(win, doc) {
+          win.iepp = win.iepp || {};
+          var iepp = win.iepp,
+            elems = iepp.html5elements || 'abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video',
+            elemsArr = elems.split('|'),
+            elemsArrLen = elemsArr.length,
+            elemRegExp = new RegExp('(^|\\s)('+elems+')', 'gi'),
+            tagRegExp = new RegExp('<(\/*)('+elems+')', 'gi'),
+            filterReg = /^\s*[\{\}]\s*$/,
+            ruleRegExp = new RegExp('(^|[^\\n]*?\\s)('+elems+')([^\\n]*)({[\\n\\w\\W]*?})', 'gi'),
+            docFrag = doc.createDocumentFragment(),
+            html = doc.documentElement,
+            head = html.firstChild,
+            bodyElem = doc.createElement('body'),
+            styleElem = doc.createElement('style'),
+            printMedias = /print|all/,
+            body;
+          function shim(doc) {
+            var a = -1;
+            while (++a < elemsArrLen)
+              // Use createElement so IE allows HTML5-named elements in a document
+              doc.createElement(elemsArr[a]);
+          }
+
+          iepp.getCSS = function(styleSheetList, mediaType) {
+            if(styleSheetList+'' === undefined){return '';}
+            var a = -1,
+              len = styleSheetList.length,
+              styleSheet,
+              cssTextArr = [];
+            while (++a < len) {
+              styleSheet = styleSheetList[a];
+              //currently no test for disabled/alternate stylesheets
+              if(styleSheet.disabled){continue;}
+              mediaType = styleSheet.media || mediaType;
+              // Get css from all non-screen stylesheets and their imports
+              if (printMedias.test(mediaType)) cssTextArr.push(iepp.getCSS(styleSheet.imports, mediaType), styleSheet.cssText);
+              //reset mediaType to all with every new *not imported* stylesheet
+              mediaType = 'all';
+            }
+            return cssTextArr.join('');
+          };
+
+          iepp.parseCSS = function(cssText) {
+            var cssTextArr = [],
+              rule;
+            while ((rule = ruleRegExp.exec(cssText)) != null){
+              // Replace all html5 element references with iepp substitute classnames
+              cssTextArr.push(( (filterReg.exec(rule[1]) ? '\n' : rule[1]) +rule[2]+rule[3]).replace(elemRegExp, '$1.iepp_$2')+rule[4]);
+            }
+            return cssTextArr.join('\n');
+          };
+
+          iepp.writeHTML = function() {
+            var a = -1;
+            body = body || doc.body;
+            while (++a < elemsArrLen) {
+              var nodeList = doc.getElementsByTagName(elemsArr[a]),
+                nodeListLen = nodeList.length,
+                b = -1;
+              while (++b < nodeListLen)
+                if (nodeList[b].className.indexOf('iepp_') < 0)
+                  // Append iepp substitute classnames to all html5 elements
+                  nodeList[b].className += ' iepp_'+elemsArr[a];
+            }
+            docFrag.appendChild(body);
+            html.appendChild(bodyElem);
+            // Write iepp substitute print-safe document
+            bodyElem.className = body.className;
+            bodyElem.id = body.id;
+            // Replace HTML5 elements with <font> which is print-safe and shouldn't conflict since it isn't part of html5
+            bodyElem.innerHTML = body.innerHTML.replace(tagRegExp, '<$1font');
+          };
+
+
+          iepp._beforePrint = function() {
+            // Write iepp custom print CSS
+            styleElem.styleSheet.cssText = iepp.parseCSS(iepp.getCSS(doc.styleSheets, 'all'));
+            iepp.writeHTML();
+          };
+
+          iepp.restoreHTML = function(){
+            // Undo everything done in onbeforeprint
+            bodyElem.innerHTML = '';
+            html.removeChild(bodyElem);
+            html.appendChild(body);
+          };
+
+          iepp._afterPrint = function(){
+            // Undo everything done in onbeforeprint
+            iepp.restoreHTML();
+            styleElem.styleSheet.cssText = '';
+          };
+
+
+
+          // Shim the document and iepp fragment
+          shim(doc);
+          shim(docFrag);
+
+          //
+          if(iepp.disablePP){return;}
+
+          // Add iepp custom print style element
+          head.insertBefore(styleElem, head.firstChild);
+          styleElem.media = 'print';
+          styleElem.className = 'iepp-printshim';
+          win.attachEvent(
+            'onbeforeprint',
+            iepp._beforePrint
+          );
+          win.attachEvent(
+            'onafterprint',
+            iepp._afterPrint
+          );
+        })(window, document);
+    }
+    //>>END IEPP
+
+    // Assign private properties to the return object with prefix
+    Modernizr._version      = version;
+
+    // expose these for the plugin API. Look in the source for how to join() them against your input
+    Modernizr._prefixes     = prefixes;
+    Modernizr._domPrefixes  = domPrefixes;
+    
+    // Modernizr.mq tests a given media query, live against the current state of the window
+    // A few important notes:
+    //   * If a browser does not support media queries at all (eg. oldIE) the mq() will always return false
+    //   * A max-width or orientation query will be evaluated against the current state, which may change later.
+    //   * You must specify values. Eg. If you are testing support for the min-width media query use: 
+    //       Modernizr.mq('(min-width:0)')
+    // usage:
+    // Modernizr.mq('only screen and (max-width:768)')
+    Modernizr.mq            = testMediaQuery;   
+    
+    // Modernizr.hasEvent() detects support for a given event, with an optional element to test on
+    // Modernizr.hasEvent('gesturestart', elem)
+    Modernizr.hasEvent      = isEventSupported; 
+
+    // Modernizr.testProp() investigates whether a given style property is recognized
+    // Note that the property names must be provided in the camelCase variant.
+    // Modernizr.testProp('pointerEvents')
+    Modernizr.testProp      = function(prop){
+        return testProps([prop]);
+    };        
+
+    // Modernizr.testAllProps() investigates whether a given style property,
+    //   or any of its vendor-prefixed variants, is recognized
+    // Note that the property names must be provided in the camelCase variant.
+    // Modernizr.testAllProps('boxSizing')    
+    Modernizr.testAllProps  = testPropsAll;     
+
+
+    
+    // Modernizr.testStyles() allows you to add custom styles to the document and test an element afterwards
+    // Modernizr.testStyles('#modernizr { position:absolute }', function(elem, rule){ ... })
+    Modernizr.testStyles    = injectElementWithStyles; 
+
+
+    // Modernizr.prefixed() returns the prefixed or nonprefixed property name variant of your input
+    // Modernizr.prefixed('boxSizing') // 'MozBoxSizing'
+    
+    // Properties must be passed as dom-style camelcase, rather than `box-sizing` hypentated style.
+    // Return values will also be the camelCase variant, if you need to translate that to hypenated style use:
+    //
+    //     str.replace(/([A-Z])/g, function(str,m1){ return '-' + m1.toLowerCase(); }).replace(/^ms-/,'-ms-');
+    
+    // If you're trying to ascertain which transition end event to bind to, you might do something like...
+    // 
+    //     var transEndEventNames = {
+    //       'WebkitTransition' : 'webkitTransitionEnd',
+    //       'MozTransition'    : 'transitionend',
+    //       'OTransition'      : 'oTransitionEnd',
+    //       'msTransition'     : 'msTransitionEnd', // maybe?
+    //       'transition'       : 'transitionEnd'
+    //     },
+    //     transEndEventName = transEndEventNames[ Modernizr.prefixed('transition') ];
+    
+    Modernizr.prefixed      = function(prop){
+      return testPropsAll(prop, 'pfx');
+    };
+
+
+
+    // Remove "no-js" class from <html> element, if it exists:
+    docElement.className = docElement.className.replace(/\bno-js\b/, '')
+                            
+                            // Add the new classes to the <html> element.
+                            + (enableClasses ? ' js ' + classes.join(' ') : '');
+
+    return Modernizr;
+
+})(this, this.document);
index 5951b8b..ee4cc51 100644 (file)
@@ -38,15 +38,6 @@ var __bind = function (self, fn) {
        },
        
 
-
-       });
-
-    $(function() {
-        $("#search").search().labelify({labelledClass: "blur"});
-
-       $(".search-result .see-more-snippets").click(function() {
-           $(this).closest('.search-result').find('.snippets').removeClass('ui-helper-hidden');
-           });
     });
 
 
index 4c2c575..554e6d3 100644 (file)
@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-<html>
+<html class="no-js">
        {% load cache compressed i18n %}
     {% load catalogue_tags reporting_stats sponsor_tags %}
     <head>
         <link rel="icon" href="{{ STATIC_URL }}img/favicon.png" type="image/png" />
         <link rel="search" type="application/opensearchdescription+xml" title="Wolne Lektury" href="{{ STATIC_URL }}opensearch.xml" />
         {% compressed_css "all" %}
+        <!--[if IE]>
+               {% compressed_css "ie" %}
+        <![endif]-->
+        <!--script src="{{ STATIC_URL }}js/modernizr.custom.13352.js"></script-->
+        <script src="{{ STATIC_URL }}js/modernizr-latest.js"></script>
 
         {% block extrahead %}
         {% endblock %}
@@ -19,6 +24,8 @@
 
         {% block bodycontent %}
 
+               <div id="header-bg"></div>
+
         <div id="header">
 
         <div id="header-content">
 
 
 
-            <form id="search-area" action="/fullsearch/">
+            <form id="search-area" action="/fullsearch/" class="hidelabels">
                 
                 <div id="search-field" class="grid-line">
+                       <label for="search">{{search_form.q.label}}</label>
                  {{search_form.q}}
 <!--                    <input title="np. Leśmian" name="q" autocomplete="off" data-source="/fullsearch/hint/">-->
                 </div><div id="search-button">
index a1a62fe..f2beb77 100644 (file)
@@ -16,8 +16,6 @@
 
 
 <h2 class="main-last"><span class="mono">{% trans "See also" %}:</span></h2>
-{% cache 1800 book-detail-related book.slug %}
-    {% related_books book %}
-{% endcache %}
+{% related_books book %}
 
 {% endblock %}
index 3ec3ad2..d46f869 100644 (file)
@@ -1,29 +1,20 @@
 {% extends "base.html" %}
 {% load i18n %}
-{% load catalogue_tags pagination_tags %}
+{% load work_list from catalogue_tags %}
 
 {% block titleextra %}{% trans "Theme" %} {{ theme }} {% trans "in work " %} {{ book }}{% endblock %}
 
 {% block bodyid %}tagged-object-list{% endblock %}
 
 {% block body %}
-    <h1>{% trans "Theme" %} {{ theme }} {% trans "in work " %} {{ book }} </h1>
-
-    {% autopaginate fragments 10 %}
-    <div id="books-list">
-        <ol>
-        {% for fragment in fragments %}
-            <li>{{ fragment.short_html }}</li>
-        {% endfor %}
-        </ol>
-        {% paginate %}
+    <div class="left-column">
+    <h1>{% trans "Theme" %}
+       <a href="{{ theme.get_absolute_url }}">{{ theme }}</a>
+       <br/>{% trans "in work " %}
+       <a href="{{ book.get_absolute_url }}">{{ book }}</a></h1>
     </div>
-    <div id="tags-list">
-        <div id="categories-list">
-            {% trans "See description" %} <a href="{{ book.get_absolute_url }}">{% trans "of the book "%} {{ book }}</a>
-        </div>
-        <div id="themes-list">
-        </div>
-        <div class="clearboth"></div>
+
+    <div class="right-column">
+        {% work_list fragments %}
     </div>
-{% endblock %}
\ No newline at end of file
+{% endblock %}
index ba2563d..1a345ed 100644 (file)
@@ -8,7 +8,7 @@
 <div class="snippets">
   {% for hit in hits %}
   {% if hit.snippets %}
-  <div class="snippet-text"><a href="{% url book_text book.slug %}#s{{hit.section_number}}">{{hit.snippets.0|safe}}</a></div>
+  <div class="snippet-text"><a href="{% url book_text book.slug %}#sec{{hit.section_number}}">{{hit.snippets.0|safe}}</a></div>
   {% else %}
   {% if hit.fragment %}
   <div class="snippet-text">
index 9fbe0cb..b5921f2 100644 (file)
@@ -1,4 +1,5 @@
 {% load i18n %}
+{% load book_title_html from catalogue_tags %} 
 
 <div class="cite {% if fragment.short_text %}fragment-with-short{% endif %}">
        {% if fragment.short_text %}
                <a href="#" class="toggle mono">↑ {% trans "Hide fragment" %} ↑</a>
                {% endif %}
     </div>
-<p class="mono source">{{ fragment.book.pretty_title }}</p>
+<p class="mono source">{% book_title_html fragment.book %}</p>
 </div>
-
-
-
-
-
-{% comment %}
-{% load catalogue_tags %}
-<div class="fragment">
-    {% if fragment.short_text %}
-    <div class='fragment-short-text'>
-        {{ fragment.short_text|safe }}
-        <a href="#">↓ {% trans "Expand fragment" %} ↓</a>
-    </div>
-    {% endif %}
-    <div class="fragment-text" {% if fragment.short_text %}style="display:none;"{% endif %}>
-        {{ fragment.text|safe }}
-        {% if fragment.short_text %}
-            <a href="#">↑ {% trans "Hide fragment" %} ↑</a>
-        {% endif %}
-    </div>
-    <div class="fragment-metadata">
-        <p>{% book_title_html fragment.book %}
-           <a href="{{ fragment.get_absolute_url }}">({% trans "See in a book" %})</a></p>
-    </div>
-    <div class="clearboth"></div>
-</div>
-{% endcomment %}
index efe6d79..70988f3 100644 (file)
       <span class="did_you_mean">{% trans "Did you mean" %} <a href="{% url search %}?q={{did_you_mean|urlencode}}">{{did_you_mean|lower}}</a>?</span>
     {% endif %}
     <!-- tu pójdą trafienia w tagi: Autorzy - z description oraz motywy i rodzaje (z book_count) -->
+      <div class="inline-tag-lists top-tag-list">
+       {% if tags.author %}
+       <div>
+         <div class="mono inline-header">{% trans "Authors" %}:</div>
+         <div class="inline-body">
+           {% inline_tag_list tags.author %}
+         </div>
+       </div>
+       {% endif %}
+       {% if tags.kind %}
+       <div>
+         <div class="mono inline-header">{% trans "Kinds" %}:</div>
+         <div class="inline-body">
+           {% inline_tag_list tags.kind %}
+         </div>
+       </div>
+       {% endif %}
+       {% if tags.genre %}
+       <div>
+         <div class="mono inline-header">{% trans "Genres" %}:</div>
+         <div class="inline-body">
+           {% inline_tag_list tags.genre  %}
+         </div>
+       </div>
+       {% endif %}
+       {% if tags.epoch %}
+       <div class="inline-tag-list">
+         <div class="mono inline-header">{% trans "Epochs" %}:</div>
+         <div class="inline-body">
+           {% inline_tag_list tags.epoch  %}
+         </div>
+       </div>
+       {% endif %}
+      </div>
+
 
+    
     {% if results.author %}
     <div class="book-list-header">
       <div class="book-box-inner">
     </div>
     <div>
       <ol class="work-list">
-       {% for author in results.author %}
-       <li class="Book-item">
-         {% book_short author.book %}
-       </li>
-       {% endfor %}
+       {% for author in results.author %}<li class="Book-item">{% book_short author.book %}</li>{% endfor %}
       </ol>
     </div>
     {% endif %}
     </div>
     <div>
       <ol class="work-list">
-       {% for result in results.title %}
-       <li class="Book-item">
+       {% for result in results.title %}<li class="Book-item">
          {% book_short result.book %}
-       </li>
-       {% endfor %}
+       </li>{% endfor %}
       </ol>
     </div>
     {% endif %}
index c7898d5..b729ca9 100644 (file)
@@ -7,64 +7,88 @@
 {% block bodyid %}tagged-object-list{% endblock %}
 
 {% block body %}
-    <div class="left-column">
-    <div class="page-desc">
+<div class="left-column">
+  <div class="page-desc">
     <h1>{% html_title_from_tags tags %}</h1>
 
     {% with tags|last as last_tag %}
     {% if last_tag.has_description %}
-        <div id="description" class="normal-text">
-            <div id='description-long' style="diplay:none">{{ last_tag.description|safe }}</div>
-            <div id='description-short'>{{ last_tag.description|safe|truncatewords_html:40 }}</div>
-        </div>
+    <div id="description" class="normal-text">
+      <div id='description-long' style="display:none">{{ last_tag.description|safe }}</div>
+      <div id='description-short'>{{ last_tag.description|safe|truncatewords_html:40 }}</div>
+    </div>
     {% endif %}
 
-
+    <div class="clearboth"></div>
     <div class="inline-tag-lists">
-    {% if categories.author %}
-       <div>
-               <div class="mono inline-header">{% trans "Authors" %}:</div>
-           <div class="inline-body">
-                           {% inline_tag_list categories.author tags %}
-               </div>
+      {% if categories.author %}
+      <div>
+       <div class="mono inline-header">{% trans "Authors" %}:</div>
+       <div class="inline-body">
+         {% inline_tag_list categories.author tags %}
         </div>
-    {% endif %}
-    {% if categories.kind %}
-       <div>
-               <div class="mono inline-header">{% trans "Kinds" %}:</div>
-           <div class="inline-body">
-                           {% inline_tag_list categories.kind tags %}
-               </div>
+      </div>
+      {% endif %}
+      {% if categories.kind %}
+      <div>
+       <div class="mono inline-header">{% trans "Kinds" %}:</div>
+       <div class="inline-body">
+         {% inline_tag_list categories.kind tags %}
         </div>
-    {% endif %}
-    {% if categories.genre %}
-       <div>
-               <div class="mono inline-header">{% trans "Genres" %}:</div>
-           <div class="inline-body">
-                           {% inline_tag_list categories.genre tags %}
-               </div>
+      </div>
+      {% endif %}
+      {% if categories.genre %}
+      <div>
+       <div class="mono inline-header">{% trans "Genres" %}:</div>
+       <div class="inline-body">
+         {% inline_tag_list categories.genre tags %}
         </div>
-    {% endif %}
-    {% if categories.epoch %}
-       <div class="inline-tag-list">
-               <div class="mono inline-header">{% trans "Epochs" %}:</div>
-           <div class="inline-body">
-                           {% inline_tag_list categories.epoch tags %}
-               </div>
+      </div>
+      {% endif %}
+      {% if categories.epoch %}
+      <div class="inline-tag-list">
+       <div class="mono inline-header">{% trans "Epochs" %}:</div>
+       <div class="inline-body">
+         {% inline_tag_list categories.epoch tags %}
         </div>
-    {% endif %}
+      </div>
+      {% endif %}
+
+      {% if categories.theme %}
+      <div class="hidden-box-wrapper">
+       <p><a href="#" class="hidden-box-trigger theme-list-link mono">
+            {% trans "Motifs and themes" %}</a></p>
+       <div class="hidden-box">
+          {% tag_list categories.theme tags %}
+       </div>
+      </div>
+      {% endif %}
     </div>
 
-    {% if categories.theme %}
-        <div class="hidden-box-wrapper">
-            <p><a href="#" class="hidden-box-trigger theme-list-link mono">
-               {% trans "Motifs and themes" %}</a></p>
-            <div class="hidden-box">
-                {% tag_list categories.theme tags %}
-            </div>
+    <div class="clearboth"></div>
+
+
+       {% if theme_is_set %}
+        <div class="see-also">
+            {% if last_tag.gazeta_link or last_tag.wiki_link %}
+            <h2 class='mono'>{% trans "See also" %}:</h2>
+            <ul>
+        {% if last_tag.gazeta_link %}
+        <li><a href="{{ last_tag.gazeta_link }}">
+               {% trans "in Lektury.Gazeta.pl" %}
+        </a></li>
+        {% endif %}
+        {% if last_tag.wiki_link %}
+        <li><a href="{{ last_tag.wiki_link }}">
+                       {% trans "in Wikipedia" %}
+        </a></li>
+        {% endif %}
+            </ul>
+            {% endif %}
         </div>
     {% endif %}
 
+
     </div>
     </div>
 
index f591863..bcd2c75 100755 (executable)
@@ -71,8 +71,8 @@
 
 {% block add_footer %}
 <p>{% trans "Image used:" %} 
-<a href="http://www.flickr.com/photos/boltron/3212284622/">Everyone loves books…</a>,
-boltron-@Flickr,
-<a href="http://creativecommons.org/licenses/by-sa/2.0/deed.pl">CC BY-SA</a>.
+<a href="http://www.flickr.com/photos/webtreatsetc/5647576127/">Blue Stripes</a>,
+webtreats@Flickr,
+<a href="http://creativecommons.org/licenses/by/2.0/deed.pl">CC BY</a>.
 </p>
 {% endblock %}